reamkit 1.23.0 → 1.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +22 -11
  2. package/dist/esm/core/bmp.d.ts +33 -0
  3. package/dist/esm/core/bmp.js +276 -0
  4. package/dist/esm/core/converter/facade.d.ts +3 -3
  5. package/dist/esm/core/converter/facade.js +12 -0
  6. package/dist/esm/core/converter/ream.d.ts +48 -4
  7. package/dist/esm/core/converter/ream.js +25 -4
  8. package/dist/esm/core/document-model/index.d.ts +1 -1
  9. package/dist/esm/core/document-model/types.d.ts +54 -0
  10. package/dist/esm/core/drawingml/chart-geometry.js +3 -2
  11. package/dist/esm/core/drawingml/diagram/colors.d.ts +52 -0
  12. package/dist/esm/core/drawingml/diagram/colors.js +125 -0
  13. package/dist/esm/core/drawingml/diagram/data-model.d.ts +47 -0
  14. package/dist/esm/core/drawingml/diagram/data-model.js +119 -0
  15. package/dist/esm/core/drawingml/diagram/layout-engine.d.ts +46 -0
  16. package/dist/esm/core/drawingml/diagram/layout-engine.js +948 -0
  17. package/dist/esm/core/drawingml/diagram/run.d.ts +37 -0
  18. package/dist/esm/core/drawingml/diagram/run.js +50 -0
  19. package/dist/esm/core/drawingml/diagram/to-drawing.d.ts +16 -0
  20. package/dist/esm/core/drawingml/diagram/to-drawing.js +86 -0
  21. package/dist/esm/core/drawingml/preset-geometry.js +116 -6
  22. package/dist/esm/core/drawingml/text-warp.d.ts +58 -0
  23. package/dist/esm/core/drawingml/text-warp.js +355 -0
  24. package/dist/esm/core/drawingml/theme-parser.js +9 -3
  25. package/dist/esm/core/font/measure.d.ts +12 -0
  26. package/dist/esm/core/font/measure.js +36 -0
  27. package/dist/esm/core/images.d.ts +30 -2
  28. package/dist/esm/core/images.js +121 -5
  29. package/dist/esm/core/metafile/emf.js +144 -16
  30. package/dist/esm/core/metafile/picture.d.ts +49 -0
  31. package/dist/esm/core/metafile/picture.js +70 -1
  32. package/dist/esm/core/metafile/wmf.js +53 -4
  33. package/dist/esm/core/ole/escher-blip.js +11 -1
  34. package/dist/esm/core/outline.d.ts +17 -0
  35. package/dist/esm/core/outline.js +30 -0
  36. package/dist/esm/core/style-cascade/resolver.js +1 -0
  37. package/dist/esm/core/style-cascade/types.d.ts +3 -1
  38. package/dist/esm/excel/print-model.js +2 -2
  39. package/dist/esm/excel/sheet-drawing.js +1 -1
  40. package/dist/esm/excel/sheet-to-flow.d.ts +10 -0
  41. package/dist/esm/excel/sheet-to-flow.js +30 -3
  42. package/dist/esm/html/html-writer.js +5 -3
  43. package/dist/esm/index.d.ts +3 -0
  44. package/dist/esm/index.js +2 -1
  45. package/dist/esm/layout/page-doc.d.ts +35 -0
  46. package/dist/esm/layout/page-doc.js +14 -1
  47. package/dist/esm/layout/styled-layout.js +217 -30
  48. package/dist/esm/markdown/markdown-writer.d.ts +41 -0
  49. package/dist/esm/markdown/markdown-writer.js +733 -0
  50. package/dist/esm/pdf/shading.js +8 -6
  51. package/dist/esm/pdf/styled-page-emitter.js +62 -4
  52. package/dist/esm/pdf/vector-graphics.js +1 -1
  53. package/dist/esm/pdf-reader/annots.d.ts +24 -0
  54. package/dist/esm/pdf-reader/annots.js +126 -0
  55. package/dist/esm/pdf-reader/content.d.ts +131 -5
  56. package/dist/esm/pdf-reader/content.js +169 -12
  57. package/dist/esm/pdf-reader/display.d.ts +56 -0
  58. package/dist/esm/pdf-reader/display.js +162 -0
  59. package/dist/esm/pdf-reader/document.d.ts +36 -1
  60. package/dist/esm/pdf-reader/document.js +92 -25
  61. package/dist/esm/pdf-reader/embedded-fonts.d.ts +31 -0
  62. package/dist/esm/pdf-reader/embedded-fonts.js +94 -0
  63. package/dist/esm/pdf-reader/flow-build.d.ts +61 -6
  64. package/dist/esm/pdf-reader/flow-build.js +128 -22
  65. package/dist/esm/pdf-reader/font.js +185 -4
  66. package/dist/esm/pdf-reader/image-decode.js +56 -5
  67. package/dist/esm/pdf-reader/images.d.ts +6 -0
  68. package/dist/esm/pdf-reader/images.js +25 -5
  69. package/dist/esm/pdf-reader/jpeg.d.ts +18 -0
  70. package/dist/esm/pdf-reader/jpeg.js +419 -0
  71. package/dist/esm/pdf-reader/layout.d.ts +1 -1
  72. package/dist/esm/pdf-reader/layout.js +221 -32
  73. package/dist/esm/pdf-reader/pattern-tint.d.ts +17 -0
  74. package/dist/esm/pdf-reader/pattern-tint.js +181 -0
  75. package/dist/esm/pdf-reader/reader.d.ts +9 -1
  76. package/dist/esm/pdf-reader/reader.js +22 -6
  77. package/dist/esm/pdf-reader/shading.d.ts +14 -0
  78. package/dist/esm/pdf-reader/shading.js +27 -1
  79. package/dist/esm/pdf-reader/tagged.js +156 -17
  80. package/dist/esm/pdf-reader/text.d.ts +13 -1
  81. package/dist/esm/pdf-reader/text.js +70 -3
  82. package/dist/esm/pdf-reader/vector.d.ts +25 -1
  83. package/dist/esm/pdf-reader/vector.js +168 -12
  84. package/dist/esm/pptx/ppt/ppt-reader.js +95 -27
  85. package/dist/esm/pptx/ppt/ppt-text.d.ts +41 -0
  86. package/dist/esm/pptx/ppt/ppt-text.js +327 -37
  87. package/dist/esm/pptx/pptx-reader.js +90 -10
  88. package/dist/esm/pptx/slide-parser.d.ts +4 -1
  89. package/dist/esm/pptx/slide-parser.js +104 -13
  90. package/dist/esm/pptx/sp-helpers.d.ts +7 -3
  91. package/dist/esm/pptx/sp-helpers.js +45 -7
  92. package/dist/esm/pptx/table-style.d.ts +7 -0
  93. package/dist/esm/pptx/table-style.js +59 -7
  94. package/dist/esm/svg/svg-writer.js +1 -0
  95. package/dist/esm/word/document-parser.d.ts +4 -1
  96. package/dist/esm/word/document-parser.js +4 -1
  97. package/dist/esm/word/docx-reader.js +26 -13
  98. package/dist/esm/word/docx-writer.js +15 -1
  99. package/dist/esm/word/drawing-parser.d.ts +20 -0
  100. package/dist/esm/word/drawing-parser.js +44 -5
  101. package/dist/esm/word/table-parser.js +3 -0
  102. package/package.json +1 -1
@@ -875,9 +875,10 @@ function buildPieScene(chart, wPt, hPt, measure) {
875
875
  });
876
876
  const mid = ang + sweep / 2;
877
877
  const pct = Math.round(v / total * 100);
878
+ const own = chart.showValues ? fmtDataLabel(chart, v) : `${pct}%`;
878
879
  const custom = series.pointLabels?.find((l) => l.idx === i)?.text;
879
- if (custom !== void 0 || pct >= 5) labels.push({
880
- text: custom ?? `${pct}%`,
880
+ if (custom !== void 0 || chart.showValues || pct >= 5) labels.push({
881
+ text: custom ?? own,
881
882
  x: cx + Math.cos(mid) * labelR,
882
883
  y: cy + Math.sin(mid) * labelR - 9 / 3,
883
884
  sizePt: 9,
@@ -0,0 +1,52 @@
1
+ import { PoNode } from '../../po-helpers.js';
2
+ /** The colours part, as the drawing writer asks it. */
3
+ export declare class DiagramColors {
4
+ private readonly byLabel;
5
+ constructor(tree: ReadonlyArray<PoNode>);
6
+ /**
7
+ * The `a:solidFill` for a box, or undefined when the part states none.
8
+ *
9
+ * @param label The layout node's `styleLbl`.
10
+ * @param index The box's place in the run of siblings.
11
+ */
12
+ fill(label: string | undefined, index: number): string | undefined;
13
+ /**
14
+ * Whether the part states this label at all.
15
+ *
16
+ * A label it names but gives no fill — `revTx`, the reversed text of a
17
+ * process arrow — is a box with NO fill, which is not the same as a file
18
+ * that ships no colours and falls back to one accent for everything.
19
+ */
20
+ knows(label: string | undefined): boolean;
21
+ /**
22
+ * The `a:ln` for a box's OUTLINE, where the part states one.
23
+ *
24
+ * A follower box is often a near-white wash with the node's own accent drawn
25
+ * round it (`conFgAcc1` is `lt1` at 90% inside an `accent1` line): without the
26
+ * line it is a white rectangle on a white slide and reads as nothing at all.
27
+ *
28
+ * @param label The layout node's `styleLbl`.
29
+ * @param index The box's place in the run of siblings.
30
+ */
31
+ line(label: string | undefined, index: number): string | undefined;
32
+ /** The `a:solidFill` for a box's TEXT, where the part overrides the style. */
33
+ textFill(label: string | undefined, index: number): string | undefined;
34
+ private pick;
35
+ }
36
+ /**
37
+ * §21.4.2.20 `dgm:pt/dgm:spPr` — the formatting the AUTHOR set on one point,
38
+ * which beats whatever the colours part gives that point's style label.
39
+ *
40
+ * A cycle-matrix whose second quarter was recoloured by hand states it here and
41
+ * nowhere else: read only from the colours part, all four quarters came out the
42
+ * one accent the label names, and the orange quarter and the orange outline
43
+ * round its callout both vanished.
44
+ *
45
+ * @param spPr The point's `dgm:spPr`, when it has one.
46
+ * @returns The fill and the outline it overrides, each as DrawingML, when it
47
+ * overrides them.
48
+ */
49
+ export declare function pointPaint(spPr: PoNode | undefined): {
50
+ fill?: string;
51
+ line?: string;
52
+ };
@@ -0,0 +1,125 @@
1
+ import { poAttr, poChildren, poIs, poTag } from "../../po-helpers.js";
2
+ //#region src/core/drawingml/diagram/colors.ts
3
+ /** The colours part, as the drawing writer asks it. */
4
+ var DiagramColors = class {
5
+ byLabel = /* @__PURE__ */ new Map();
6
+ constructor(tree) {
7
+ const def = findDescendant(tree, "dgm:colorsDef");
8
+ for (const lbl of def ? poChildren(def) : []) {
9
+ if (!poIs(lbl, "dgm:styleLbl")) continue;
10
+ const name = poAttr(lbl, "name");
11
+ if (name === void 0) continue;
12
+ const kids = poChildren(lbl);
13
+ this.byLabel.set(name, {
14
+ ...run(kids, "dgm:fillClrLst", "fill"),
15
+ ...run(kids, "dgm:linClrLst", "line"),
16
+ ...run(kids, "dgm:txFillClrLst", "txFill")
17
+ });
18
+ }
19
+ }
20
+ /**
21
+ * The `a:solidFill` for a box, or undefined when the part states none.
22
+ *
23
+ * @param label The layout node's `styleLbl`.
24
+ * @param index The box's place in the run of siblings.
25
+ */
26
+ fill(label, index) {
27
+ return solid(this.pick(label, "fill", index));
28
+ }
29
+ /**
30
+ * Whether the part states this label at all.
31
+ *
32
+ * A label it names but gives no fill — `revTx`, the reversed text of a
33
+ * process arrow — is a box with NO fill, which is not the same as a file
34
+ * that ships no colours and falls back to one accent for everything.
35
+ */
36
+ knows(label) {
37
+ return label !== void 0 && this.byLabel.has(label);
38
+ }
39
+ /**
40
+ * The `a:ln` for a box's OUTLINE, where the part states one.
41
+ *
42
+ * A follower box is often a near-white wash with the node's own accent drawn
43
+ * round it (`conFgAcc1` is `lt1` at 90% inside an `accent1` line): without the
44
+ * line it is a white rectangle on a white slide and reads as nothing at all.
45
+ *
46
+ * @param label The layout node's `styleLbl`.
47
+ * @param index The box's place in the run of siblings.
48
+ */
49
+ line(label, index) {
50
+ const fill = solid(this.pick(label, "line", index));
51
+ return fill === void 0 ? void 0 : `<a:ln>${fill}</a:ln>`;
52
+ }
53
+ /** The `a:solidFill` for a box's TEXT, where the part overrides the style. */
54
+ textFill(label, index) {
55
+ return solid(this.pick(label, "txFill", index));
56
+ }
57
+ pick(label, which, index) {
58
+ const colors = (label === void 0 ? void 0 : this.byLabel.get(label)?.[which])?.colors ?? [];
59
+ if (colors.length === 0) return void 0;
60
+ return colors[(index % colors.length + colors.length) % colors.length];
61
+ }
62
+ };
63
+ function run(kids, tag, as) {
64
+ const list = kids.find((c) => poIs(c, tag));
65
+ const colors = list ? poChildren(list).filter((c) => poTag(c)?.endsWith("Clr") === true) : [];
66
+ if (colors.length === 0) return {};
67
+ return { [as]: {
68
+ meth: poAttr(list, "meth") ?? "repeat",
69
+ colors
70
+ } };
71
+ }
72
+ /**
73
+ * §21.4.2.20 `dgm:pt/dgm:spPr` — the formatting the AUTHOR set on one point,
74
+ * which beats whatever the colours part gives that point's style label.
75
+ *
76
+ * A cycle-matrix whose second quarter was recoloured by hand states it here and
77
+ * nowhere else: read only from the colours part, all four quarters came out the
78
+ * one accent the label names, and the orange quarter and the orange outline
79
+ * round its callout both vanished.
80
+ *
81
+ * @param spPr The point's `dgm:spPr`, when it has one.
82
+ * @returns The fill and the outline it overrides, each as DrawingML, when it
83
+ * overrides them.
84
+ */
85
+ function pointPaint(spPr) {
86
+ const kids = poChildren(spPr);
87
+ const fillNode = kids.find((c) => poIs(c, "a:solidFill") || poIs(c, "a:noFill") || poIs(c, "a:gradFill"));
88
+ const colorIn = (node) => poChildren(node).find((c) => poTag(c)?.endsWith("Clr") === true);
89
+ const fill = poIs(fillNode, "a:noFill") ? "<a:noFill/>" : poIs(fillNode, "a:solidFill") ? solid(colorIn(fillNode)) : void 0;
90
+ const ln = kids.find((c) => poIs(c, "a:ln"));
91
+ const lnColor = solid(colorIn(ln ? poChildren(ln).find((c) => poIs(c, "a:solidFill")) : void 0));
92
+ const w = poAttr(ln, "w");
93
+ const line = ln === void 0 ? void 0 : `<a:ln${w !== void 0 ? ` w="${esc(w)}"` : ""}>${lnColor ?? ""}</a:ln>`;
94
+ return {
95
+ ...fill !== void 0 ? { fill } : {},
96
+ ...line !== void 0 ? { line } : {}
97
+ };
98
+ }
99
+ function solid(color) {
100
+ const xml = color === void 0 ? "" : colorXml(color);
101
+ return xml === "" ? void 0 : `<a:solidFill>${xml}</a:solidFill>`;
102
+ }
103
+ function colorXml(color) {
104
+ const tag = poTag(color);
105
+ if (tag === void 0) return "";
106
+ const val = poAttr(color, "val");
107
+ const mods = poChildren(color).map((m) => {
108
+ const t = poTag(m);
109
+ const v = poAttr(m, "val");
110
+ return t === void 0 || v === void 0 ? "" : `<${t} val="${esc(v)}"/>`;
111
+ }).join("");
112
+ return `${val === void 0 ? `<${tag}>` : `<${tag} val="${esc(val)}">`}${mods}</${tag}>`;
113
+ }
114
+ function esc(s) {
115
+ return s.replace(/&/gu, "&amp;").replace(/</gu, "&lt;").replace(/"/gu, "&quot;");
116
+ }
117
+ function findDescendant(tree, tag) {
118
+ for (const node of tree) {
119
+ if (poIs(node, tag)) return node;
120
+ const found = findDescendant(poChildren(node), tag);
121
+ if (found) return found;
122
+ }
123
+ }
124
+ //#endregion
125
+ export { DiagramColors, pointPaint };
@@ -0,0 +1,47 @@
1
+ import { PoNode } from '../../po-helpers.js';
2
+ /** §21.4.2.27 `dgm:pt@type` — what a point is in the model. */
3
+ export type PointType = 'doc' | 'node' | 'asst' | 'parTrans' | 'sibTrans' | 'pres';
4
+ /** One point of the data model. */
5
+ export interface DiagramPoint {
6
+ readonly id: string;
7
+ readonly type: PointType;
8
+ /** `dgm:t` — the point's text, as the `a:txBody` every other reader takes. */
9
+ readonly text?: PoNode;
10
+ /** `dgm:spPr` — the formatting the user overrode on this node. */
11
+ readonly spPr?: PoNode;
12
+ /** `dgm:prSet` — presentation properties (placeholder text, custom sizes). */
13
+ readonly prSet?: PoNode;
14
+ }
15
+ /**
16
+ * The data part as the layout engine asks about it: the point tree recovered
17
+ * from the connection list, plus the transition points that go with each edge.
18
+ */
19
+ export declare class DiagramData {
20
+ private readonly byId;
21
+ private readonly kids;
22
+ /** The document point every layout starts from. */
23
+ readonly root: DiagramPoint | undefined;
24
+ /** §21.4.2.4 `dgm:bg` — the fill painted behind the whole diagram. */
25
+ readonly background: PoNode | undefined;
26
+ constructor(tree: ReadonlyArray<PoNode>);
27
+ /** The point with this id, if the model holds one. */
28
+ point(id: string): DiagramPoint | undefined;
29
+ /**
30
+ * The children of a point, in the order the connections give them.
31
+ *
32
+ * @param id The parent's model id.
33
+ * @param ptType Which kind of child to return — `node` skips the
34
+ * transitions, `sibTrans` returns them instead.
35
+ */
36
+ children(id: string, ptType?: 'node' | 'sibTrans' | 'parTrans'): Array<DiagramPoint>;
37
+ /**
38
+ * How many generations of `node` points the model holds below its root.
39
+ *
40
+ * §21.4.3.3 — a layout branches on this (`func="maxDepth" op="gte" val="2"`):
41
+ * the same part lays a chevron out as one box when the nodes have no
42
+ * children and as a labelled box over a body when they do.
43
+ */
44
+ get depth(): number;
45
+ /** The plain text of a point's `dgm:t`, paragraphs joined by newlines. */
46
+ static textOf(pt: DiagramPoint | undefined): string;
47
+ }
@@ -0,0 +1,119 @@
1
+ import { poAttr, poChildren, poIs, poText } from "../../po-helpers.js";
2
+ //#region src/core/drawingml/diagram/data-model.ts
3
+ /**
4
+ * The data part as the layout engine asks about it: the point tree recovered
5
+ * from the connection list, plus the transition points that go with each edge.
6
+ */
7
+ var DiagramData = class {
8
+ byId = /* @__PURE__ */ new Map();
9
+ kids = /* @__PURE__ */ new Map();
10
+ /** The document point every layout starts from. */
11
+ root;
12
+ /** §21.4.2.4 `dgm:bg` — the fill painted behind the whole diagram. */
13
+ background;
14
+ constructor(tree) {
15
+ const model = findDescendant(tree, "dgm:dataModel");
16
+ this.background = model ? poChildren(model).find((c) => poIs(c, "dgm:bg")) : void 0;
17
+ const ptLst = model ? poChildren(model).find((c) => poIs(c, "dgm:ptLst")) : void 0;
18
+ for (const pt of ptLst ? poChildren(ptLst) : []) {
19
+ if (!poIs(pt, "dgm:pt")) continue;
20
+ const id = poAttr(pt, "modelId");
21
+ if (id === void 0) continue;
22
+ const kids = poChildren(pt);
23
+ this.byId.set(id, {
24
+ id,
25
+ type: poAttr(pt, "type") ?? "node",
26
+ ...pick(kids, "dgm:t", "text"),
27
+ ...pick(kids, "dgm:spPr", "spPr"),
28
+ ...pick(kids, "dgm:prSet", "prSet")
29
+ });
30
+ }
31
+ const cxnLst = model ? poChildren(model).find((c) => poIs(c, "dgm:cxnLst")) : void 0;
32
+ for (const cxn of cxnLst ? poChildren(cxnLst) : []) {
33
+ if (!poIs(cxn, "dgm:cxn")) continue;
34
+ if ((poAttr(cxn, "type") ?? "parOf") !== "parOf") continue;
35
+ const parent = poAttr(cxn, "srcId");
36
+ const child = poAttr(cxn, "destId");
37
+ if (parent === void 0 || child === void 0) continue;
38
+ const list = this.kids.get(parent) ?? [];
39
+ list.push({
40
+ parent,
41
+ child,
42
+ ord: Number(poAttr(cxn, "srcOrd") ?? "0"),
43
+ ...opt("sibTransId", poAttr(cxn, "sibTransId")),
44
+ ...opt("parTransId", poAttr(cxn, "parTransId"))
45
+ });
46
+ this.kids.set(parent, list);
47
+ }
48
+ for (const list of this.kids.values()) list.sort((a, b) => a.ord - b.ord);
49
+ this.root = [...this.byId.values()].find((p) => p.type === "doc");
50
+ }
51
+ /** The point with this id, if the model holds one. */
52
+ point(id) {
53
+ return this.byId.get(id);
54
+ }
55
+ /**
56
+ * The children of a point, in the order the connections give them.
57
+ *
58
+ * @param id The parent's model id.
59
+ * @param ptType Which kind of child to return — `node` skips the
60
+ * transitions, `sibTrans` returns them instead.
61
+ */
62
+ children(id, ptType = "node") {
63
+ const out = [];
64
+ for (const edge of this.kids.get(id) ?? []) {
65
+ const wanted = ptType === "node" ? edge.child : ptType === "sibTrans" ? edge.sibTransId : edge.parTransId;
66
+ const pt = wanted === void 0 ? void 0 : this.byId.get(wanted);
67
+ if (pt && (ptType !== "node" || pt.type !== "parTrans" && pt.type !== "sibTrans")) out.push(pt);
68
+ }
69
+ return out;
70
+ }
71
+ /**
72
+ * How many generations of `node` points the model holds below its root.
73
+ *
74
+ * §21.4.3.3 — a layout branches on this (`func="maxDepth" op="gte" val="2"`):
75
+ * the same part lays a chevron out as one box when the nodes have no
76
+ * children and as a labelled box over a body when they do.
77
+ */
78
+ get depth() {
79
+ const walk = (id, seen) => {
80
+ if (seen.has(id)) return 0;
81
+ seen.add(id);
82
+ let best = 0;
83
+ for (const kid of this.children(id, "node")) best = Math.max(best, walk(kid.id, seen));
84
+ return best + 1;
85
+ };
86
+ return this.root ? walk(this.root.id, /* @__PURE__ */ new Set()) - 1 : 0;
87
+ }
88
+ /** The plain text of a point's `dgm:t`, paragraphs joined by newlines. */
89
+ static textOf(pt) {
90
+ if (!pt?.text) return "";
91
+ const lines = [];
92
+ for (const p of poChildren(pt.text)) {
93
+ if (!poIs(p, "a:p")) continue;
94
+ let line = "";
95
+ for (const r of poChildren(p)) if (poIs(r, "a:br")) {
96
+ lines.push(line);
97
+ line = "";
98
+ } else if (poIs(r, "a:r")) line += poText(poChildren(r).find((c) => poIs(c, "a:t")));
99
+ lines.push(line);
100
+ }
101
+ return lines.join("\n");
102
+ }
103
+ };
104
+ function pick(kids, tag, as) {
105
+ const found = kids.find((c) => poIs(c, tag));
106
+ return found ? { [as]: found } : {};
107
+ }
108
+ function opt(name, v) {
109
+ return v === void 0 || v === "" ? {} : { [name]: v };
110
+ }
111
+ function findDescendant(tree, tag) {
112
+ for (const node of tree) {
113
+ if (poIs(node, tag)) return node;
114
+ const found = findDescendant(poChildren(node), tag);
115
+ if (found) return found;
116
+ }
117
+ }
118
+ //#endregion
119
+ export { DiagramData };
@@ -0,0 +1,46 @@
1
+ import { PoNode } from '../../po-helpers.js';
2
+ import { DiagramData, DiagramPoint } from './data-model.js';
3
+ /** One box the engine laid out, in the diagram's own frame (EMU). */
4
+ export interface LaidNode {
5
+ readonly point: DiagramPoint;
6
+ readonly shapeType: string;
7
+ /** The layout node's `styleLbl` — which run of colours the box takes. */
8
+ readonly styleLbl?: string;
9
+ /** The box's place among its siblings, which is where in that run it is. */
10
+ readonly index: number;
11
+ /** The point size the layout states for the box's text, when it states one. */
12
+ readonly fontSizePt?: number;
13
+ /** Whether the `tx` algorithm asks for the text to be bulleted. */
14
+ readonly bulleted?: boolean;
15
+ /**
16
+ * §21.4.3.9 `dgm:shape@hideGeom` — the box reserves its room but its outline
17
+ * is never drawn. The picture lists put an invisible spacer above each node.
18
+ */
19
+ readonly hideGeom?: boolean;
20
+ /** §21.4.3.2 `txAnchorVert` — where in its box the `tx` algorithm sits text. */
21
+ readonly anchor?: string;
22
+ /** §21.4.3.2 `parTxLTRAlign` — how the layout ranges a node's own label. */
23
+ readonly align?: string;
24
+ /**
25
+ * §21.4.3.5 `dgm:shape@rot` — how far the box's geometry is turned, in
26
+ * 60 000ths of a degree clockwise. The cycle-matrix layout builds its disc
27
+ * out of one quarter-wedge stated four times at 0°, 90°, 180° and 270°.
28
+ */
29
+ readonly rotation60k?: number;
30
+ readonly x: number;
31
+ readonly y: number;
32
+ readonly cx: number;
33
+ readonly cy: number;
34
+ }
35
+ /**
36
+ * Lay a diagram out from its data and layout parts.
37
+ *
38
+ * @param layout The parsed `layout1.xml` tree.
39
+ * @param data The parsed data part.
40
+ * @param cx The frame's width in EMU, as the drawing states it.
41
+ * @param cy The frame's height in EMU.
42
+ * @returns The boxes to draw, or an empty list when the layout uses an
43
+ * algorithm this slice does not run — the caller then reports the
44
+ * diagram as a loss exactly as before.
45
+ */
46
+ export declare function layoutDiagram(layout: ReadonlyArray<PoNode>, data: DiagramData, cx: number, cy: number): Array<LaidNode>;