import { type DiagramDrawing, type DiagramIssue, type DiagramLayoutType, type DiagramRelationshipIds } from '../diagram/index.js'; import type { Relationship } from './package-parts.js'; import type { XmlElement } from './xml.js'; /** The `a:graphicData/@uri` of a SmartArt graphic. */ export declare const DIAGRAM_GRAPHIC_URI = "http://schemas.openxmlformats.org/drawingml/2006/diagram"; /** A package part a diagram refers to. */ export interface DocxDiagramPart { /** Relationship id in the part that holds the drawing (`word/document.xml`, a header...). */ relId: string; /** Package part name, e.g. `word/diagrams/data1.xml`. */ partName: string; } /** One content node of the diagram's data model. */ export interface DocxDiagramNode { id: string; text: string; /** Model id of the parent content node, when the data model has one. */ parentId?: string; } /** * How the diagram can be shown. * `cached-drawing`: the shapes the producing application saved (`dsp:drawing`) are available as * `drawing`; they are a snapshot, not a layout computed here. * `placeholder`: no usable cached drawing; only a labelled placeholder (with the node text) can be * shown, because no SmartArt layout is computed. */ export type DocxDiagramRendering = 'cached-drawing' | 'placeholder'; /** A SmartArt graphic in a Word document. Part contents are read-only; the XML is preserved on save. */ export interface DocxDiagram { /** `inline` (`wp:inline`) or `anchor` (`wp:anchor`, floating). */ placement: 'inline' | 'anchor'; /** `wp:extent` in EMU: the frame the cached drawing's coordinates are relative to. */ extentEmu: { width: number; height: number; }; /** `wp:docPr/@name` and `@id`. */ name?: string; id?: string; /** `dgm:relIds` as written on the graphic. */ relationshipIds: DiagramRelationshipIds; /** The diagram parts the relationships resolve to (package part names). */ parts: { data?: DocxDiagramPart; layout?: DocxDiagramPart; quickStyle?: DocxDiagramPart; colors?: DocxDiagramPart; /** Cached layout (`dsp:drawing`), once located. */ drawing?: DocxDiagramPart; }; /** * Relationship id -> package part name for the relationships this diagram needs, in the part * that holds it. Lets the parts be resolved later without the host part's `.rels`. */ hostRelationships: Record; /** Layout identification, from `dgm:layoutDef`. */ layout?: { uniqueId: string; family?: DiagramLayoutType; rootAlgorithm?: string; }; /** Colour and quick-style definition ids (`dgm:colorsDef/@uniqueId`, `dgm:styleDef/@uniqueId`). */ colorsId?: string; quickStyleId?: string; /** Content nodes of the data model, in document order. */ nodes: DocxDiagramNode[]; /** The cached shape tree, EMU relative to `extentEmu`. Absent for `placeholder` rendering. */ drawing?: DiagramDrawing; /** Whether a renderer can draw shapes (`cached-drawing`) or must show a placeholder. */ rendering: DocxDiagramRendering; /** What this model does and does not provide, to show alongside the diagram. */ notice: string; /** Problems met reading the parts; empty when everything resolved. */ issues: DiagramIssue[]; } /** The notice that goes with a rendering. */ export declare const diagramNotice: (rendering: DocxDiagramRendering) => string; /** * Reads the host side of a SmartArt graphic. Synchronous: resolves the relationships through the * host's `.rels` but reads no part; {@link resolveDiagramParts} fills in the part contents. */ export declare function parseDiagramGraphic(graphicData: XmlElement, extent: XmlElement | undefined, docPr: XmlElement | undefined, rels: ReadonlyMap, isAnchor: boolean): DocxDiagram; /** * Reads the diagram's parts from the package and completes the model: node text, layout and style * identification, the cached drawing and the honest rendering status. Never throws; problems go to * `issues`. */ export declare function resolveDiagramParts(diagram: DocxDiagram, readText: (partName: string) => Promise): Promise; //# sourceMappingURL=diagram.d.ts.map