@office-open/core 0.11.0 → 0.12.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.
- package/dist/chart/index.d.mts +2 -2
- package/dist/chart/index.mjs +1 -1
- package/dist/{chart-Kf_utasF.mjs → chart-DED4tXC9.mjs} +828 -283
- package/dist/chart-DED4tXC9.mjs.map +1 -0
- package/dist/data-type-CZMKVaaT.d.mts.map +1 -1
- package/dist/descriptor/index.d.mts +1 -1
- package/dist/descriptor/index.mjs +1 -1
- package/dist/{descriptor-BX8xW8na.mjs → descriptor-BqaNZrrZ.mjs} +38 -10
- package/dist/{descriptor-BX8xW8na.mjs.map → descriptor-BqaNZrrZ.mjs.map} +1 -1
- package/dist/drawing/index.d.mts +2 -2
- package/dist/drawing/index.mjs +2 -2
- package/dist/{drawing-FBzd2I0m.mjs → drawing-BCAyrCCw.mjs} +3056 -3130
- package/dist/drawing-BCAyrCCw.mjs.map +1 -0
- package/dist/{generators-CElPsAhd.mjs → ext-uri-BHBcIrW7.mjs} +599 -343
- package/dist/ext-uri-BHBcIrW7.mjs.map +1 -0
- package/dist/index-BAxlDUQ1.d.mts +590 -0
- package/dist/index-BAxlDUQ1.d.mts.map +1 -0
- package/dist/{index-DxwLMnBF.d.mts → index-BP541uS-.d.mts} +136 -31
- package/dist/index-BP541uS-.d.mts.map +1 -0
- package/dist/{index-CLX7gU9J.d.mts → index-BQLIofaF.d.mts} +3 -2
- package/dist/index-BQLIofaF.d.mts.map +1 -0
- package/dist/{index-k8WKLXnA.d.mts → index-CaNwM5_e.d.mts} +19 -20
- package/dist/index-CaNwM5_e.d.mts.map +1 -0
- package/dist/{index-CnjCK-lF.d.mts → index-DPkf_CtG.d.mts} +566 -597
- package/dist/index-DPkf_CtG.d.mts.map +1 -0
- package/dist/{index-BsTUn4K1.d.mts → index-DcukVskh.d.mts} +9 -6
- package/dist/index-DcukVskh.d.mts.map +1 -0
- package/dist/{index-Cgz88FU0.d.mts → index-Di6XPdGl.d.mts} +26 -12
- package/dist/index-Di6XPdGl.d.mts.map +1 -0
- package/dist/{index-C0ClOhmZ.d.mts → index-L6AXewfV.d.mts} +11 -8
- package/dist/index-L6AXewfV.d.mts.map +1 -0
- package/dist/index.d.mts +140 -29
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +849 -87
- package/dist/index.mjs.map +1 -1
- package/dist/{output-D_G_JR_8.d.mts → output-yyxdkG0C.d.mts} +2 -3
- package/dist/output-yyxdkG0C.d.mts.map +1 -0
- package/dist/patch/index.d.mts +2 -2
- package/dist/patch/index.mjs +2 -2
- package/dist/{patch-3KLx2yEP.mjs → patch-AkQY17CD.mjs} +71 -26
- package/dist/patch-AkQY17CD.mjs.map +1 -0
- package/dist/smartart/index.d.mts +2 -2
- package/dist/smartart/index.mjs +1 -1
- package/dist/{smartart-BxnkROOp.mjs → smartart-n1kYJ6Jg.mjs} +27 -26
- package/dist/smartart-n1kYJ6Jg.mjs.map +1 -0
- package/dist/{style-matrix-DAP6XrLv.mjs → style-matrix-B6jhPAT3.mjs} +4 -4
- package/dist/style-matrix-B6jhPAT3.mjs.map +1 -0
- package/dist/theme/index.d.mts +4 -4
- package/dist/theme/index.mjs +3 -2
- package/dist/{theme-OAuRcA9_.mjs → theme-BKnXRmvn.mjs} +37 -71
- package/dist/theme-BKnXRmvn.mjs.map +1 -0
- package/dist/{theme-options-BbWccl85.d.mts → theme-options-kO89NUEX.d.mts} +17 -17
- package/dist/theme-options-kO89NUEX.d.mts.map +1 -0
- package/dist/util/index.d.mts +3 -3
- package/dist/util/index.mjs +3 -3
- package/dist/{util-C94-JKtp.mjs → util-ptE16MEk.mjs} +69 -37
- package/dist/util-ptE16MEk.mjs.map +1 -0
- package/dist/{values-aVoirbWB.d.mts → values-BECDm4zr.d.mts} +15 -31
- package/dist/values-BECDm4zr.d.mts.map +1 -0
- package/dist/vector/index.d.mts +2 -2
- package/dist/vector/index.mjs +2 -2
- package/dist/{vector-TpjW6ZSc.mjs → vector-DhLGZjP5.mjs} +104 -147
- package/dist/vector-DhLGZjP5.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/chart-Kf_utasF.mjs.map +0 -1
- package/dist/drawing-FBzd2I0m.mjs.map +0 -1
- package/dist/generators-CElPsAhd.mjs.map +0 -1
- package/dist/index-BsTUn4K1.d.mts.map +0 -1
- package/dist/index-C0ClOhmZ.d.mts.map +0 -1
- package/dist/index-CLX7gU9J.d.mts.map +0 -1
- package/dist/index-Cgz88FU0.d.mts.map +0 -1
- package/dist/index-CnjCK-lF.d.mts.map +0 -1
- package/dist/index-DpPeyf5f.d.mts +0 -316
- package/dist/index-DpPeyf5f.d.mts.map +0 -1
- package/dist/index-DxwLMnBF.d.mts.map +0 -1
- package/dist/index-k8WKLXnA.d.mts.map +0 -1
- package/dist/output-D_G_JR_8.d.mts.map +0 -1
- package/dist/patch-3KLx2yEP.mjs.map +0 -1
- package/dist/smartart-BxnkROOp.mjs.map +0 -1
- package/dist/style-matrix-DAP6XrLv.mjs.map +0 -1
- package/dist/theme-OAuRcA9_.mjs.map +0 -1
- package/dist/theme-options-BbWccl85.d.mts.map +0 -1
- package/dist/util-C94-JKtp.mjs.map +0 -1
- package/dist/values-aVoirbWB.d.mts.map +0 -1
- package/dist/vector-TpjW6ZSc.mjs.map +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Buffer } from "\
|
|
2
|
-
|
|
1
|
+
import { Buffer } from "\0polyfill-node.buffer";
|
|
3
2
|
//#region src/opc/output.d.ts
|
|
4
3
|
interface OutputByType {
|
|
5
4
|
base64: string;
|
|
@@ -21,4 +20,4 @@ declare const OoxmlMimeType: {
|
|
|
21
20
|
declare const convertOutput: <T extends OutputType>(data: Uint8Array, type: T, mimeType?: string) => OutputByType[T];
|
|
22
21
|
//#endregion
|
|
23
22
|
export { convertOutput as i, OutputByType as n, OutputType as r, OoxmlMimeType as t };
|
|
24
|
-
//# sourceMappingURL=output-
|
|
23
|
+
//# sourceMappingURL=output-yyxdkG0C.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-yyxdkG0C.d.mts","names":[],"sources":["../src/opc/output.ts"],"mappings":";;UAUiB;EACf;EACA;EACA;EACA;EACA;EACA,YAAY;EACZ,aAAa;EACb,MAAM;EACN,YAAY;;KAGF,mBAAmB;cAGlB;;;;;cAMA,gBAAiB,UAAU,YACtC,MAAM,YACN,MAAM,GACN,sBACC,aAAa"}
|
package/dist/patch/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export { type BasePatchOptions, DOCX_NS, PPTX_NS, type PlaceholderDelimiters, type RenderedParagraphNode, type ReplacerOptions, TokenNotFoundError, type XmlNamespaceOptions, appendContentType, appendOverride, appendRelationship, applyCorePropertiesOverride, createReplacer, createRunRenderer, createSplitInject, createTextElementContents, createTokenReplacer, createTraverser, getFirstLevelElements, getNextRelationshipIndex, nextNumericId, patchSpaceAttribute, toJson };
|
|
1
|
+
import { C as PPTX_NS, S as DOCX_NS, _ as createTraverser, a as getNextRelationshipIndex, b as ReplacerOptions, c as removeOverride, d as nextNumericId, f as patchSpaceAttribute, g as createTokenReplacer, h as createSplitInject, i as appendRelationship, l as createTextElementContents, m as TokenNotFoundError, n as PlaceholderDelimiters, o as appendContentType, p as toJson, r as applyCorePropertiesOverride, s as appendOverride, t as BasePatchOptions, u as getFirstLevelElements, v as RenderedParagraphNode, w as XmlNamespaceOptions, x as createReplacer, y as createRunRenderer } from "../index-CaNwM5_e.mjs";
|
|
2
|
+
export { type BasePatchOptions, DOCX_NS, PPTX_NS, type PlaceholderDelimiters, type RenderedParagraphNode, type ReplacerOptions, TokenNotFoundError, type XmlNamespaceOptions, appendContentType, appendOverride, appendRelationship, applyCorePropertiesOverride, createReplacer, createRunRenderer, createSplitInject, createTextElementContents, createTokenReplacer, createTraverser, getFirstLevelElements, getNextRelationshipIndex, nextNumericId, patchSpaceAttribute, removeOverride, toJson };
|
package/dist/patch/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
export { DOCX_NS, PPTX_NS, TokenNotFoundError, appendContentType, appendOverride, appendRelationship, applyCorePropertiesOverride, createReplacer, createRunRenderer, createSplitInject, createTextElementContents, createTokenReplacer, createTraverser, getFirstLevelElements, getNextRelationshipIndex, nextNumericId, patchSpaceAttribute, toJson };
|
|
1
|
+
import { _ as toJson, a as appendOverride, c as createTraverser, d as TokenNotFoundError, f as createSplitInject, g as patchSpaceAttribute, h as nextNumericId, i as appendContentType, l as createRunRenderer, m as getFirstLevelElements, n as appendRelationship, o as removeOverride, p as createTextElementContents, r as getNextRelationshipIndex, s as createReplacer, t as applyCorePropertiesOverride, u as createTokenReplacer, v as DOCX_NS, y as PPTX_NS } from "../patch-AkQY17CD.mjs";
|
|
2
|
+
export { DOCX_NS, PPTX_NS, TokenNotFoundError, appendContentType, appendOverride, appendRelationship, applyCorePropertiesOverride, createReplacer, createRunRenderer, createSplitInject, createTextElementContents, createTokenReplacer, createTraverser, getFirstLevelElements, getNextRelationshipIndex, nextNumericId, patchSpaceAttribute, removeOverride, toJson };
|
|
@@ -36,6 +36,30 @@ const FIELD_MAP = [
|
|
|
36
36
|
{
|
|
37
37
|
name: "dcterms:modified",
|
|
38
38
|
key: "modified"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "cp:category",
|
|
42
|
+
key: "category"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "cp:contentStatus",
|
|
46
|
+
key: "contentStatus"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "cp:contentType",
|
|
50
|
+
key: "contentType"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "dc:identifier",
|
|
54
|
+
key: "identifier"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "dc:language",
|
|
58
|
+
key: "language"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "cp:version",
|
|
62
|
+
key: "version"
|
|
39
63
|
}
|
|
40
64
|
];
|
|
41
65
|
/**
|
|
@@ -46,12 +70,13 @@ const FIELD_MAP = [
|
|
|
46
70
|
function parseCorePropsElement(el) {
|
|
47
71
|
if (!el) return {};
|
|
48
72
|
const props = {};
|
|
73
|
+
if (el.name === "coreProperties") props.defaultNamespace = true;
|
|
49
74
|
for (const field of FIELD_MAP) {
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
75
|
+
const localName = field.name.slice(field.name.indexOf(":") + 1);
|
|
76
|
+
const child = el.elements?.find((e) => e.type === "element" && (e.name === field.name || e.name === localName));
|
|
77
|
+
if (child) props[field.key] = textOf(child);
|
|
53
78
|
}
|
|
54
|
-
const revEl = el.elements?.find((e) => e.name === "cp:revision");
|
|
79
|
+
const revEl = el.elements?.find((e) => e.name === "cp:revision" || e.name === "revision");
|
|
55
80
|
if (revEl) {
|
|
56
81
|
const rev = textOf(revEl);
|
|
57
82
|
if (rev) {
|
|
@@ -59,6 +84,8 @@ function parseCorePropsElement(el) {
|
|
|
59
84
|
if (!Number.isNaN(n)) props.revision = n;
|
|
60
85
|
}
|
|
61
86
|
}
|
|
87
|
+
if (props.created === void 0) props.created = null;
|
|
88
|
+
if (props.modified === void 0) props.modified = null;
|
|
62
89
|
return props;
|
|
63
90
|
}
|
|
64
91
|
/**
|
|
@@ -69,19 +96,26 @@ function parseCorePropsElement(el) {
|
|
|
69
96
|
* only when present.
|
|
70
97
|
*/
|
|
71
98
|
function buildCorePropertiesXmlString(opts) {
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
if (opts.
|
|
75
|
-
if (opts.
|
|
76
|
-
if (opts.
|
|
77
|
-
if (opts.
|
|
78
|
-
if (opts.
|
|
79
|
-
if (opts.
|
|
80
|
-
if (opts.
|
|
99
|
+
const cp = (name) => opts.defaultNamespace ? name : `cp:${name}`;
|
|
100
|
+
const p = opts.defaultNamespace ? ["<coreProperties xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcmitype=\"http://purl.org/dcmitype/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\">"] : ["<cp:coreProperties xmlns:cp=\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcmitype=\"http://purl.org/dcmitype/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"];
|
|
101
|
+
if (opts.title !== void 0) p.push(`<dc:title>${escapeXml(opts.title)}</dc:title>`);
|
|
102
|
+
if (opts.subject !== void 0) p.push(`<dc:subject>${escapeXml(opts.subject)}</dc:subject>`);
|
|
103
|
+
if (opts.creator !== void 0) p.push(`<dc:creator>${escapeXml(opts.creator)}</dc:creator>`);
|
|
104
|
+
if (opts.keywords !== void 0) p.push(`<${cp("keywords")}>${escapeXml(opts.keywords)}</${cp("keywords")}>`);
|
|
105
|
+
if (opts.description !== void 0) p.push(`<dc:description>${escapeXml(opts.description)}</dc:description>`);
|
|
106
|
+
if (opts.lastPrinted !== void 0) p.push(`<${cp("lastPrinted")}>${escapeXml(opts.lastPrinted)}</${cp("lastPrinted")}>`);
|
|
107
|
+
if (opts.lastModifiedBy !== void 0) p.push(`<${cp("lastModifiedBy")}>${escapeXml(opts.lastModifiedBy)}</${cp("lastModifiedBy")}>`);
|
|
108
|
+
if (opts.revision !== void 0) p.push(`<${cp("revision")}>${opts.revision}</${cp("revision")}>`);
|
|
81
109
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
82
|
-
p.push(`<dcterms:created xsi:type="dcterms:W3CDTF">${opts.created ?? now}</dcterms:created>`);
|
|
83
|
-
p.push(`<dcterms:modified xsi:type="dcterms:W3CDTF">${opts.modified ?? now}</dcterms:modified>`);
|
|
84
|
-
p.push("
|
|
110
|
+
if (opts.created !== null) p.push(`<dcterms:created xsi:type="dcterms:W3CDTF">${opts.created ?? now}</dcterms:created>`);
|
|
111
|
+
if (opts.modified !== null) p.push(`<dcterms:modified xsi:type="dcterms:W3CDTF">${opts.modified ?? now}</dcterms:modified>`);
|
|
112
|
+
if (opts.category !== void 0) p.push(`<${cp("category")}>${escapeXml(opts.category)}</${cp("category")}>`);
|
|
113
|
+
if (opts.contentStatus !== void 0) p.push(`<${cp("contentStatus")}>${escapeXml(opts.contentStatus)}</${cp("contentStatus")}>`);
|
|
114
|
+
if (opts.contentType !== void 0) p.push(`<${cp("contentType")}>${escapeXml(opts.contentType)}</${cp("contentType")}>`);
|
|
115
|
+
if (opts.identifier !== void 0) p.push(`<dc:identifier>${escapeXml(opts.identifier)}</dc:identifier>`);
|
|
116
|
+
if (opts.language !== void 0) p.push(`<dc:language>${escapeXml(opts.language)}</dc:language>`);
|
|
117
|
+
if (opts.version !== void 0) p.push(`<${cp("version")}>${escapeXml(opts.version)}</${cp("version")}>`);
|
|
118
|
+
p.push(`</${cp("coreProperties")}>`);
|
|
85
119
|
return p.join("");
|
|
86
120
|
}
|
|
87
121
|
//#endregion
|
|
@@ -222,18 +256,18 @@ function createTokenReplacer(createTextElementContents, options) {
|
|
|
222
256
|
const offsetEndIndex = Math.min(endIndex, end) - start;
|
|
223
257
|
const partToReplace = text.substring(offsetStartIndex, offsetEndIndex + 1);
|
|
224
258
|
if (partToReplace === "") continue;
|
|
225
|
-
|
|
259
|
+
const firstPart = text.replace(partToReplace, replacementText);
|
|
260
|
+
patchTextElement(partElement, firstPart);
|
|
226
261
|
replaceMode = ReplaceMode.MIDDLE;
|
|
227
262
|
continue;
|
|
228
263
|
}
|
|
229
264
|
break;
|
|
230
|
-
case ReplaceMode.MIDDLE:
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
break;
|
|
265
|
+
case ReplaceMode.MIDDLE: if (endIndex <= end) {
|
|
266
|
+
const lastPart = text.substring(endIndex - start + 1);
|
|
267
|
+
patchTextElement(partElement, lastPart);
|
|
268
|
+
runChildren[index] = preserveSpace ? patchSpaceAttribute(partElement) : partElement;
|
|
269
|
+
replaceMode = ReplaceMode.END;
|
|
270
|
+
} else patchTextElement(partElement, "");
|
|
237
271
|
}
|
|
238
272
|
}
|
|
239
273
|
}
|
|
@@ -473,6 +507,17 @@ const appendOverride = (element, partName, contentType) => {
|
|
|
473
507
|
type: "element"
|
|
474
508
|
});
|
|
475
509
|
};
|
|
510
|
+
/**
|
|
511
|
+
* Remove an `<Override>` from a `[Content_Types].xml` root by `PartName`
|
|
512
|
+
* (case-insensitive). Sibling to {@link appendOverride} for patch paths that
|
|
513
|
+
* drop a part from the package.
|
|
514
|
+
*/
|
|
515
|
+
const removeOverride = (element, partName) => {
|
|
516
|
+
const els = typesChildren(element);
|
|
517
|
+
if (!els) return;
|
|
518
|
+
const kept = els.filter((el) => !(el.type === "element" && el.name === "Override" && String(el?.attributes?.PartName ?? "").toLowerCase() === partName.toLowerCase()));
|
|
519
|
+
if (kept.length !== els.length) element.elements.find((e) => e.name === "Types").elements = kept;
|
|
520
|
+
};
|
|
476
521
|
//#endregion
|
|
477
522
|
//#region src/patch/relationship-manager.ts
|
|
478
523
|
const getIdFromRelationshipId = (relationshipId) => {
|
|
@@ -505,6 +550,6 @@ function applyCorePropertiesOverride(corePropsDoc, overrides) {
|
|
|
505
550
|
});
|
|
506
551
|
}
|
|
507
552
|
//#endregion
|
|
508
|
-
export {
|
|
553
|
+
export { toJson as _, appendOverride as a, buildCorePropertiesXmlString as b, createTraverser as c, TokenNotFoundError as d, createSplitInject as f, patchSpaceAttribute as g, nextNumericId as h, appendContentType as i, createRunRenderer as l, getFirstLevelElements as m, appendRelationship as n, removeOverride as o, createTextElementContents as p, getNextRelationshipIndex as r, createReplacer as s, applyCorePropertiesOverride as t, createTokenReplacer as u, DOCX_NS as v, parseCorePropsElement as x, PPTX_NS as y };
|
|
509
554
|
|
|
510
|
-
//# sourceMappingURL=patch-
|
|
555
|
+
//# sourceMappingURL=patch-AkQY17CD.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch-AkQY17CD.mjs","names":[],"sources":["../src/opc/core.ts","../src/patch/xml-namespace.ts","../src/patch/xml-patch-utils.ts","../src/patch/paragraph-split-inject.ts","../src/patch/paragraph-token-replacer.ts","../src/patch/run-renderer.ts","../src/patch/xml-traverser.ts","../src/patch/xml-replacer.ts","../src/patch/content-types-manager.ts","../src/patch/relationship-manager.ts","../src/patch/core-properties-override.ts"],"sourcesContent":["import { textOf, escapeXml } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\n\n/**\n * Core document properties (docProps/core.xml).\n *\n * Shared across docx/pptx/xlsx: each format's top-level Options extends this,\n * parse emits the same shape, and patch overrides it — read/write symmetry\n * (CONTRIBUTING §Property Naming). Field names follow the OPC core-properties\n * XSD element local names (`creator` = dc:creator, … — never `author`).\n */\nexport interface CorePropertiesOptions {\n title?: string;\n subject?: string;\n creator?: string;\n keywords?: string;\n description?: string;\n lastModifiedBy?: string;\n revision?: number;\n lastPrinted?: string;\n /**\n * Creation timestamp (W3CDTF), round-tripped from dcterms:created. null =\n * the source core.xml carried none — emit nothing; undefined (fresh) =\n * default to now.\n */\n created?: string | null;\n /** Last modified timestamp (W3CDTF); same null/undefined semantics as {@link created}. */\n modified?: string | null;\n /** Document category, round-tripped from cp:category. */\n category?: string;\n /** Document status (e.g. \"Draft\"), round-tripped from cp:contentStatus. */\n contentStatus?: string;\n /** Content type (e.g. \"Document\"), round-tripped from cp:contentType. */\n contentType?: string;\n /** Unique document identifier, round-tripped from dc:identifier. */\n identifier?: string;\n /** Document language (RFC 3066), round-tripped from dc:language. */\n language?: string;\n /** Document version number, round-tripped from cp:version. */\n version?: string;\n /**\n * Emit the core-properties vocabulary as the default namespace — the ISO\n * strict binding, where the source root is `<coreProperties xmlns=…>` and\n * cp:-prefixed children appear prefix-less (dc:/dcterms: keep their\n * prefixes). Round-trip only.\n */\n defaultNamespace?: true;\n}\n\nconst FIELD_MAP: Array<{ name: string; key: keyof CorePropertiesOptions }> = [\n { name: \"dc:title\", key: \"title\" },\n { name: \"dc:subject\", key: \"subject\" },\n { name: \"dc:creator\", key: \"creator\" },\n { name: \"dc:description\", key: \"description\" },\n { name: \"cp:keywords\", key: \"keywords\" },\n { name: \"cp:lastModifiedBy\", key: \"lastModifiedBy\" },\n { name: \"cp:lastPrinted\", key: \"lastPrinted\" },\n { name: \"dcterms:created\", key: \"created\" },\n { name: \"dcterms:modified\", key: \"modified\" },\n { name: \"cp:category\", key: \"category\" },\n { name: \"cp:contentStatus\", key: \"contentStatus\" },\n { name: \"cp:contentType\", key: \"contentType\" },\n { name: \"dc:identifier\", key: \"identifier\" },\n { name: \"dc:language\", key: \"language\" },\n { name: \"cp:version\", key: \"version\" },\n];\n\n/**\n * Parse core properties from an already-parsed XML element.\n * Shared by docx/pptx/xlsx to extract Dublin Core metadata into the unified\n * {@link CorePropertiesOptions} shape.\n */\nexport function parseCorePropsElement(el: Element | undefined): CorePropertiesOptions {\n if (!el) return {};\n\n const props: CorePropertiesOptions = {};\n // ISO/strict binds the core-properties namespace as the default — a\n // prefix-less root means stringify must re-emit that form.\n if (el.name === \"coreProperties\") props.defaultNamespace = true;\n\n for (const field of FIELD_MAP) {\n // ISO/strict files bind the core-properties namespace as the DEFAULT\n // namespace, so cp:/dcterms: children appear prefix-less — match by\n // local name too (field local names are unique across the map).\n const localName = field.name.slice(field.name.indexOf(\":\") + 1);\n const child = el.elements?.find(\n (e) => e.type === \"element\" && (e.name === field.name || e.name === localName),\n );\n // Presence-based: Word writes whitespace-only text (\"<dc:title>\\n</dc:title>\"),\n // which the XML parser reduces to an empty element — capture \"\" so the\n // field survives round-trip instead of being silently dropped.\n if (child) (props as Record<string, unknown>)[field.key] = textOf(child);\n }\n\n const revEl = el.elements?.find((e) => e.name === \"cp:revision\" || e.name === \"revision\");\n if (revEl) {\n const rev = textOf(revEl);\n if (rev) {\n const n = Number(rev);\n if (!Number.isNaN(n)) props.revision = n;\n }\n }\n\n // A parsed core part that carries no timestamps marks them explicitly\n // absent (null) — the emit path then omits them instead of defaulting to\n // now, which a fresh document (undefined) still does.\n if (props.created === undefined) props.created = null;\n if (props.modified === undefined) props.modified = null;\n\n return props;\n}\n\n/**\n * Build a cp:coreProperties XML string directly (fast path).\n *\n * Shared by pptx and xlsx to bypass the toXml() → xml() pipeline.\n * created/modified default to now when not supplied; all other fields emit\n * only when present.\n */\nexport function buildCorePropertiesXmlString(opts: CorePropertiesOptions): string {\n // ISO/strict round-trip: the core-properties namespace is the default, so\n // its children carry no prefix (dc:/dcterms: keep theirs).\n const cp = (name: string): string => (opts.defaultNamespace ? name : `cp:${name}`);\n const p: string[] = opts.defaultNamespace\n ? [\n '<coreProperties xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcmitype=\"http://purl.org/dcmitype/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\">',\n ]\n : [\n '<cp:coreProperties xmlns:cp=\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcmitype=\"http://purl.org/dcmitype/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">',\n ];\n // Empty-string values are meaningful (element present, text empty) — only\n // undefined omits the element.\n if (opts.title !== undefined) p.push(`<dc:title>${escapeXml(opts.title)}</dc:title>`);\n if (opts.subject !== undefined) p.push(`<dc:subject>${escapeXml(opts.subject)}</dc:subject>`);\n if (opts.creator !== undefined) p.push(`<dc:creator>${escapeXml(opts.creator)}</dc:creator>`);\n if (opts.keywords !== undefined)\n p.push(`<${cp(\"keywords\")}>${escapeXml(opts.keywords)}</${cp(\"keywords\")}>`);\n if (opts.description !== undefined)\n p.push(`<dc:description>${escapeXml(opts.description)}</dc:description>`);\n if (opts.lastPrinted !== undefined)\n p.push(`<${cp(\"lastPrinted\")}>${escapeXml(opts.lastPrinted)}</${cp(\"lastPrinted\")}>`);\n if (opts.lastModifiedBy !== undefined)\n p.push(`<${cp(\"lastModifiedBy\")}>${escapeXml(opts.lastModifiedBy)}</${cp(\"lastModifiedBy\")}>`);\n if (opts.revision !== undefined)\n p.push(`<${cp(\"revision\")}>${opts.revision}</${cp(\"revision\")}>`);\n\n const now = new Date().toISOString();\n if (opts.created !== null)\n p.push(`<dcterms:created xsi:type=\"dcterms:W3CDTF\">${opts.created ?? now}</dcterms:created>`);\n if (opts.modified !== null)\n p.push(\n `<dcterms:modified xsi:type=\"dcterms:W3CDTF\">${opts.modified ?? now}</dcterms:modified>`,\n );\n // Trailing slots mirror Word's emission order (category last in real files).\n if (opts.category !== undefined)\n p.push(`<${cp(\"category\")}>${escapeXml(opts.category)}</${cp(\"category\")}>`);\n if (opts.contentStatus !== undefined)\n p.push(`<${cp(\"contentStatus\")}>${escapeXml(opts.contentStatus)}</${cp(\"contentStatus\")}>`);\n if (opts.contentType !== undefined)\n p.push(`<${cp(\"contentType\")}>${escapeXml(opts.contentType)}</${cp(\"contentType\")}>`);\n if (opts.identifier !== undefined)\n p.push(`<dc:identifier>${escapeXml(opts.identifier)}</dc:identifier>`);\n if (opts.language !== undefined) p.push(`<dc:language>${escapeXml(opts.language)}</dc:language>`);\n if (opts.version !== undefined)\n p.push(`<${cp(\"version\")}>${escapeXml(opts.version)}</${cp(\"version\")}>`);\n p.push(`</${cp(\"coreProperties\")}>`);\n return p.join(\"\");\n}\n","/**\n * Namespace configuration for XML patch operations.\n *\n * Parameterises element names so the same patch algorithm works for both\n * DOCX (`w:*`) and PPTX (`a:*`) documents.\n */\n\nexport interface XmlNamespaceOptions {\n paragraph: string;\n run: string;\n text: string;\n runProperties: string;\n}\n\nexport const DOCX_NS: XmlNamespaceOptions = {\n paragraph: \"w:p\",\n run: \"w:r\",\n text: \"w:t\",\n runProperties: \"w:rPr\",\n};\n\nexport const PPTX_NS: XmlNamespaceOptions = {\n paragraph: \"a:p\",\n run: \"a:r\",\n text: \"a:t\",\n runProperties: \"a:rPr\",\n};\n","/**\n * XML utility functions for patch operations.\n */\nimport { parse } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\n\nexport const toJson = (xmlData: string): Element => {\n const xmlObj = parse(xmlData, {\n captureSpacesBetweenElements: true,\n compact: false,\n }) as Element;\n return xmlObj;\n};\n\n/**\n * Creates the inner content of a text element (`w:t` / `a:t`).\n *\n * Returns `[{ type: \"text\", text }]` for non-empty text, `[]` for empty.\n * The `xml:space` attribute is handled separately by `patchSpaceAttribute`.\n */\nexport const createTextElementContents = (text: string): Element[] =>\n text === \"\" ? [] : [{ text, type: \"text\" }];\n\nexport const patchSpaceAttribute = (element: Element): Element => ({\n ...element,\n attributes: {\n \"xml:space\": \"preserve\",\n },\n});\n\nexport const getFirstLevelElements = (relationships: Element, id: string): Element[] =>\n relationships.elements?.find((e) => e.name === id)?.elements ?? [];\n\n/**\n * Next sequential numeric id: the largest `attr` value among direct children\n * named `childName`, plus one. `seed` is the floor — e.g. PPTX `<p:sldId>`\n * values start at 255, so the first appended id is at least 256.\n *\n * Unifies the per-package `maxCommentId` / `maxSldId` / `maxSheetId` helpers.\n */\nexport const nextNumericId = (\n parent: Element | undefined,\n childName: string,\n attr: string,\n seed = 0,\n): number => {\n let maxId = seed;\n for (const child of parent?.elements ?? []) {\n if (child.name !== childName) continue;\n const id = Number(child.attributes?.[attr]);\n if (Number.isFinite(id)) maxId = Math.max(maxId, id);\n }\n return maxId + 1;\n};\n","/**\n * Paragraph split and inject utilities for run-level text replacement.\n *\n * Parameterised by `XmlNamespaceOptions` so it works for both DOCX and PPTX.\n */\nimport type { Element } from \"@office-open/xml\";\n\nimport type { XmlNamespaceOptions } from \"./xml-namespace\";\nimport { patchSpaceAttribute } from \"./xml-patch-utils\";\n\nexport class TokenNotFoundError extends Error {\n public constructor(token: string) {\n super(`Token ${token} not found`);\n this.name = \"TokenNotFoundError\";\n }\n}\n\nexport function createSplitInject(\n ns: XmlNamespaceOptions,\n createTextElementContents: (text: string) => Element[],\n options?: { readonly preserveSpace?: boolean },\n) {\n const preserveSpace = options?.preserveSpace ?? true;\n const findRunElementIndexWithToken = (paragraphElement: Element, token: string): number => {\n for (const [i, element] of (paragraphElement.elements ?? []).entries()) {\n if (element.type === \"element\" && element.name === ns.run) {\n const textElement = (element.elements ?? []).filter(\n (e) => e.type === \"element\" && e.name === ns.text,\n );\n\n for (const text of textElement) {\n const firstChild = text.elements?.[0];\n if (!firstChild) {\n continue;\n }\n\n if ((firstChild.text as string).includes(token)) {\n return i;\n }\n }\n }\n }\n\n throw new TokenNotFoundError(token);\n };\n\n const splitRunElement = (\n runElement: Element,\n token: string,\n ): { readonly left: Element; readonly right: Element } => {\n let splitIndex = -1;\n\n const splitElements =\n runElement.elements\n ?.map((e, i) => {\n if (splitIndex !== -1) {\n return e;\n }\n\n if (e.type === \"element\" && e.name === ns.text) {\n const text = (e.elements?.[0]?.text as string) ?? \"\";\n const splitText = text.split(token);\n const newElements = splitText.map((t) => ({\n ...e,\n ...(preserveSpace ? patchSpaceAttribute(e) : {}),\n elements: createTextElementContents(t),\n }));\n\n if (splitText.length > 1) {\n splitIndex = i;\n }\n\n return newElements;\n } else {\n return e;\n }\n })\n .flat() ?? [];\n\n const leftRunElement: Element = {\n ...runElement,\n elements: splitElements.slice(0, splitIndex + 1),\n };\n\n const rightRunElement: Element = {\n ...runElement,\n elements: splitElements.slice(splitIndex + 1),\n };\n\n return { left: leftRunElement, right: rightRunElement };\n };\n\n return { findRunElementIndexWithToken, splitRunElement };\n}\n","/**\n * Paragraph token replacer for substituting text within paragraph runs.\n *\n * Fully generic — operates on Element nodes without namespace-specific logic.\n */\nimport type { Element } from \"@office-open/xml\";\n\nimport type { RenderedParagraphNode } from \"./run-renderer\";\nimport { patchSpaceAttribute } from \"./xml-patch-utils\";\n\nconst ReplaceMode = {\n START: 0,\n MIDDLE: 1,\n END: 2,\n} as const;\n\nexport function createTokenReplacer(\n createTextElementContents: (text: string) => Element[],\n options?: { readonly preserveSpace?: boolean },\n) {\n const preserveSpace = options?.preserveSpace ?? true;\n\n const patchTextElement = (element: Element, text: string): Element => {\n element.elements = createTextElementContents(text);\n return element;\n };\n\n return ({\n paragraphElement,\n renderedParagraph,\n originalText,\n replacementText,\n }: {\n paragraphElement: Element;\n renderedParagraph: RenderedParagraphNode;\n originalText: string;\n replacementText: string;\n }): Element => {\n const startIndex = renderedParagraph.text.indexOf(originalText);\n const endIndex = startIndex + originalText.length - 1;\n\n let replaceMode: (typeof ReplaceMode)[keyof typeof ReplaceMode] = ReplaceMode.START;\n\n for (const run of renderedParagraph.runs) {\n const runChildren = paragraphElement.elements?.[run.index]?.elements;\n if (!runChildren) continue;\n for (const { text, index, start, end } of run.parts) {\n const partElement = runChildren[index];\n if (!partElement) continue;\n switch (replaceMode) {\n case ReplaceMode.START: {\n if (startIndex >= start && startIndex <= end) {\n const offsetStartIndex = startIndex - start;\n const offsetEndIndex = Math.min(endIndex, end) - start;\n const partToReplace = text.substring(offsetStartIndex, offsetEndIndex + 1);\n if (partToReplace === \"\") {\n continue;\n }\n\n const firstPart = text.replace(partToReplace, replacementText);\n patchTextElement(partElement, firstPart);\n replaceMode = ReplaceMode.MIDDLE;\n continue;\n }\n break;\n }\n case ReplaceMode.MIDDLE: {\n if (endIndex <= end) {\n const lastPart = text.substring(endIndex - start + 1);\n patchTextElement(partElement, lastPart);\n runChildren[index] = preserveSpace ? patchSpaceAttribute(partElement) : partElement;\n replaceMode = ReplaceMode.END;\n } else {\n patchTextElement(partElement, \"\");\n }\n break;\n }\n }\n }\n }\n\n return paragraphElement;\n };\n}\n","/**\n * Run renderer for extracting text content from OOXML paragraph structures.\n *\n * Parameterised by `XmlNamespaceOptions` so it works for both DOCX and PPTX.\n */\nimport type { Element } from \"@office-open/xml\";\n\nimport type { XmlNamespaceOptions } from \"./xml-namespace\";\n\nexport interface ElementWrapper {\n element: Element;\n index: number;\n parent: ElementWrapper | undefined;\n}\n\nexport interface RenderedParagraphNode {\n text: string;\n runs: readonly RenderedRunNode[];\n index: number;\n pathToParagraph: readonly number[];\n}\n\ninterface StartAndEnd {\n start: number;\n end: number;\n}\n\ntype IParts = {\n text: string;\n index: number;\n} & StartAndEnd;\n\nexport type RenderedRunNode = {\n text: string;\n parts: readonly IParts[];\n index: number;\n} & StartAndEnd;\n\nexport function createRunRenderer(ns: XmlNamespaceOptions) {\n const renderParagraphNode = (node: ElementWrapper): RenderedParagraphNode => {\n if (node.element.name !== ns.paragraph) {\n throw new Error(`Invalid node type: ${node.element.name}`);\n }\n\n if (!node.element.elements) {\n return {\n index: -1,\n pathToParagraph: [],\n runs: [],\n text: \"\",\n };\n }\n\n let currentRunStringLength = 0;\n\n const runs: RenderedRunNode[] = [];\n for (const [i, element] of node.element.elements.entries()) {\n if (element.name === ns.run) {\n const renderedRunNode = renderRunNode(element, i, currentRunStringLength);\n currentRunStringLength += renderedRunNode.text.length;\n runs.push(renderedRunNode);\n }\n }\n\n const text = runs.reduce((acc, curr) => acc + curr.text, \"\");\n\n return {\n index: node.index,\n pathToParagraph: buildNodePath(node),\n runs,\n text,\n };\n };\n\n const renderRunNode = (\n node: Element,\n index: number,\n currentRunStringIndex: number,\n ): RenderedRunNode => {\n if (!node.elements) {\n return {\n end: currentRunStringIndex,\n index: -1,\n parts: [],\n start: currentRunStringIndex,\n text: \"\",\n };\n }\n\n let currentTextStringIndex = currentRunStringIndex;\n\n const parts: IParts[] = [];\n for (const [i, element] of node.elements.entries()) {\n if (element.name !== ns.text) continue;\n const textChildren = element.elements;\n if (!textChildren || textChildren.length === 0) continue;\n const firstChild = textChildren[0];\n if (!firstChild) continue;\n const text = firstChild.text ?? \"\";\n const textStr = String(text);\n const partStart = currentTextStringIndex;\n currentTextStringIndex += textStr.length;\n parts.push({ end: currentTextStringIndex - 1, index: i, start: partStart, text: textStr });\n }\n\n const text = parts.reduce((acc, curr) => acc + curr.text, \"\");\n\n return {\n end: currentTextStringIndex - 1,\n index,\n parts,\n start: currentRunStringIndex,\n text,\n };\n };\n\n return renderParagraphNode;\n}\n\nconst buildNodePath = (node: ElementWrapper): readonly number[] => {\n const path: number[] = [];\n let current: ElementWrapper | undefined = node;\n while (current) {\n path.push(current.index);\n current = current.parent;\n }\n path.reverse();\n return path;\n};\n","/**\n * XML traverser for searching paragraph content in OOXML documents.\n *\n * Parameterised by `XmlNamespaceOptions` so it works for both DOCX and PPTX.\n */\nimport type { Element } from \"@office-open/xml\";\n\nimport { createRunRenderer, type ElementWrapper, type RenderedParagraphNode } from \"./run-renderer\";\nimport type { XmlNamespaceOptions } from \"./xml-namespace\";\n\nexport function createTraverser(ns: XmlNamespaceOptions) {\n const renderParagraphNode = createRunRenderer(ns);\n\n const traverse = (node: Element): readonly RenderedParagraphNode[] => {\n const renderedParagraphs: RenderedParagraphNode[] = [];\n const queue: ElementWrapper[] = [];\n\n // Seed with root as virtual wrapper so paths include the root level\n const rootChildren = node.elements;\n if (rootChildren) {\n const root: ElementWrapper = { element: node, index: 0, parent: undefined };\n for (const [i, child] of rootChildren.entries()) {\n queue.push({ element: child, index: i, parent: root });\n }\n }\n\n let qi = 0;\n while (qi < queue.length) {\n const current = queue[qi++];\n if (!current) break;\n\n if (current.element.name === ns.paragraph) {\n renderedParagraphs.push(renderParagraphNode(current));\n }\n\n const children = current.element.elements;\n if (children) {\n for (const [i, child] of children.entries()) {\n queue.push({ element: child, index: i, parent: current });\n }\n }\n }\n\n return renderedParagraphs;\n };\n\n const findLocationOfText = (node: Element, text: string): readonly RenderedParagraphNode[] =>\n traverse(node).filter((p) => p.text.includes(text));\n\n return { traverse, findLocationOfText };\n}\n","/**\n * Parameterised XML replacer for placeholder substitution in OOXML documents.\n *\n * Accepts namespace config and a format callback so both DOCX and PPTX can\n * use the same replacement algorithm.\n */\nimport type { Element } from \"@office-open/xml\";\n\nimport { createSplitInject } from \"./paragraph-split-inject\";\nimport { createTokenReplacer } from \"./paragraph-token-replacer\";\nimport type { XmlNamespaceOptions } from \"./xml-namespace\";\nimport { createTextElementContents } from \"./xml-patch-utils\";\nimport { createTraverser } from \"./xml-traverser\";\n\nexport interface ReplacerOptions {\n ns: XmlNamespaceOptions;\n formatChild: (child: unknown, context: unknown) => Element[];\n preserveSpace?: boolean;\n}\n\ninterface ReplacerResult {\n element: Element;\n didFindOccurrence: boolean;\n}\n\nconst SPLIT_TOKEN = \"\\u0275\";\n\nexport function createReplacer(config: ReplacerOptions) {\n const { ns, formatChild } = config;\n const { findLocationOfText } = createTraverser(ns);\n\n const replaceTokenInParagraphElement = createTokenReplacer(createTextElementContents, {\n preserveSpace: config.preserveSpace,\n });\n const { findRunElementIndexWithToken, splitRunElement } = createSplitInject(\n ns,\n createTextElementContents,\n { preserveSpace: config.preserveSpace },\n );\n\n const replacer = ({\n json,\n patch,\n patchText,\n context,\n keepOriginalStyles = true,\n }: {\n json: Element;\n patch: {\n type: string;\n children: readonly unknown[];\n };\n patchText: string;\n context: unknown;\n keepOriginalStyles?: boolean;\n }): ReplacerResult => {\n const renderedParagraphs = findLocationOfText(json, patchText);\n\n if (renderedParagraphs.length === 0) {\n return { didFindOccurrence: false, element: json };\n }\n\n for (const renderedParagraph of renderedParagraphs) {\n const textJson = patch.children.flatMap((c) => formatChild(c, context));\n\n switch (patch.type) {\n case \"document\": {\n const parentElement = goToParentElementFromPath(json, renderedParagraph.pathToParagraph);\n const elementIndex = getLastElementIndexFromPath(renderedParagraph.pathToParagraph);\n parentElement.elements!.splice(elementIndex, 1, ...textJson);\n break;\n }\n case \"paragraph\":\n default: {\n const paragraphElement = goToElementFromPath(json, renderedParagraph.pathToParagraph);\n replaceTokenInParagraphElement({\n originalText: patchText,\n paragraphElement,\n renderedParagraph,\n replacementText: SPLIT_TOKEN,\n });\n\n const index = findRunElementIndexWithToken(paragraphElement, SPLIT_TOKEN);\n\n const runElementToBeReplaced = paragraphElement.elements![index];\n if (!runElementToBeReplaced) break;\n const { left, right } = splitRunElement(runElementToBeReplaced, SPLIT_TOKEN);\n\n let newRunElements = textJson;\n let patchedRightElement = right;\n\n if (keepOriginalStyles) {\n const runElementNonTextualElements = runElementToBeReplaced.elements!.filter(\n (e) => e.type === \"element\" && e.name === ns.runProperties,\n );\n\n newRunElements = textJson.map((e) => {\n if (\n e.type !== \"element\" ||\n e.name !== ns.run ||\n e.elements?.some((c) => c.type === \"element\" && c.name === ns.runProperties)\n ) {\n return e;\n }\n return {\n ...e,\n elements: [...runElementNonTextualElements, ...(e.elements ?? [])],\n };\n });\n\n patchedRightElement = {\n ...right,\n elements: [...runElementNonTextualElements, ...right.elements!],\n };\n }\n\n paragraphElement.elements!.splice(index, 1, left, ...newRunElements, patchedRightElement);\n break;\n }\n }\n }\n\n return { didFindOccurrence: true, element: json };\n };\n\n return replacer;\n}\n\nconst goToElementFromPath = (json: Element, path: readonly number[]): Element => {\n let element = json;\n for (let i = 1; i < path.length; i++) {\n const index = path[i];\n if (index === undefined) break;\n const nextElements = element.elements!;\n const next = nextElements[index];\n if (!next) break;\n element = next;\n }\n return element;\n};\n\nconst goToParentElementFromPath = (json: Element, path: readonly number[]): Element =>\n goToElementFromPath(json, path.slice(0, -1));\n\n// pathToParagraph is built by the renderer and always non-empty; the `!` is a contract narrow.\nconst getLastElementIndexFromPath = (path: readonly number[]): number => path[path.length - 1]!;\n","/**\n * Content types manager for OOXML [Content_Types].xml management.\n */\nimport type { Element } from \"@office-open/xml\";\n\n/**\n * The `<Types>` child array, initialized in place when absent (so a `<Default>`\n * or `<Override>` can always be appended). Returns `undefined` if `element` has\n * no `<Types>` child (malformed `[Content_Types].xml`).\n */\nconst typesChildren = (element: Element): Element[] | undefined => {\n const types = element.elements?.find((e) => e.name === \"Types\");\n if (!types) return undefined;\n return types.elements ?? (types.elements = []);\n};\n\nexport const appendContentType = (\n element: Element,\n contentType: string,\n extension: string,\n): void => {\n const els = typesChildren(element);\n if (!els) return;\n\n // OPC Default Extension matching is case-insensitive (ECMA-376-2 §10.1.2):\n // an existing `JPG` must block a colliding `jpg`, or Word rejects the package.\n const exist = els.some(\n (el) =>\n el.type === \"element\" &&\n el.name === \"Default\" &&\n String(el?.attributes?.Extension ?? \"\").toLowerCase() === extension.toLowerCase(),\n );\n if (exist) {\n return;\n }\n\n els.push({\n attributes: {\n ContentType: contentType,\n Extension: extension,\n },\n name: \"Default\",\n type: \"element\",\n });\n};\n\n/**\n * Append an `<Override>` element to a `[Content_Types].xml` root, deduped by\n * `PartName`. Sibling to {@link appendContentType} (which handles `<Default>`):\n * unifies the per-package Override-dedup blocks in docx/pptx/xlsx patchers.\n */\nexport const appendOverride = (element: Element, partName: string, contentType: string): void => {\n const els = typesChildren(element);\n if (!els) return;\n\n // OPC Override PartName matching is case-insensitive (ECMA-376-2 §10.1.4).\n const exists = els.some(\n (el) =>\n el.type === \"element\" &&\n el.name === \"Override\" &&\n String(el?.attributes?.PartName ?? \"\").toLowerCase() === partName.toLowerCase(),\n );\n if (exists) return;\n\n els.push({\n attributes: {\n PartName: partName,\n ContentType: contentType,\n },\n name: \"Override\",\n type: \"element\",\n });\n};\n\n/**\n * Remove an `<Override>` from a `[Content_Types].xml` root by `PartName`\n * (case-insensitive). Sibling to {@link appendOverride} for patch paths that\n * drop a part from the package.\n */\nexport const removeOverride = (element: Element, partName: string): void => {\n const els = typesChildren(element);\n if (!els) return;\n\n const kept = els.filter(\n (el) =>\n !(\n el.type === \"element\" &&\n el.name === \"Override\" &&\n String(el?.attributes?.PartName ?? \"\").toLowerCase() === partName.toLowerCase()\n ),\n );\n if (kept.length !== els.length) {\n element.elements!.find((e) => e.name === \"Types\")!.elements = kept;\n }\n};\n","/**\n * Relationship manager for OOXML .rels file management.\n */\nimport type { Element } from \"@office-open/xml\";\n\nimport { getFirstLevelElements } from \"./xml-patch-utils\";\n\nconst getIdFromRelationshipId = (relationshipId: string): number => {\n const output = parseInt(relationshipId.substring(3), 10);\n return isNaN(output) ? 0 : output;\n};\n\nexport const getNextRelationshipIndex = (relationships: Element): number => {\n const relationshipElements = getFirstLevelElements(relationships, \"Relationships\");\n\n return (\n relationshipElements\n .map((e) => getIdFromRelationshipId(e.attributes?.Id?.toString() ?? \"\"))\n .reduce((acc, curr) => Math.max(acc, curr), 0) + 1\n );\n};\n\nexport const appendRelationship = (\n relationships: Element,\n id: number | string,\n type: string,\n target: string,\n targetMode?: string,\n): readonly Element[] => {\n const relationshipElements = getFirstLevelElements(relationships, \"Relationships\");\n relationshipElements.push({\n attributes: {\n Id: `rId${id}`,\n Target: target,\n TargetMode: targetMode,\n Type: type,\n },\n name: \"Relationship\",\n type: \"element\",\n });\n\n return relationshipElements;\n};\n","/**\n * Merge core-properties overrides onto an existing docProps/core.xml document.\n *\n * The patch layer unzips docProps/core.xml into an parse document structure\n * (its `.elements` holds the `cp:coreProperties` root). This helper parses the\n * existing values, layers `overrides` on top (override wins), and returns the\n * re-serialized XML — without the XML declaration, which the caller prepends.\n */\nimport type { Element } from \"@office-open/xml\";\n\nimport { buildCorePropertiesXmlString, parseCorePropsElement } from \"../opc/core\";\nimport type { CorePropertiesOptions } from \"../opc/core\";\n\nexport function applyCorePropertiesOverride(\n corePropsDoc: Element,\n overrides: Partial<CorePropertiesOptions>,\n): string {\n const rootEl = (corePropsDoc.elements?.find((e) => e.name === \"cp:coreProperties\") ??\n corePropsDoc) as Element;\n const existing = parseCorePropsElement(rootEl);\n const merged: CorePropertiesOptions = { ...existing, ...overrides };\n return buildCorePropertiesXmlString(merged);\n}\n"],"mappings":";;AAiDA,MAAM,YAAuE;CAC3E;EAAE,MAAM;EAAY,KAAK;CAAQ;CACjC;EAAE,MAAM;EAAc,KAAK;CAAU;CACrC;EAAE,MAAM;EAAc,KAAK;CAAU;CACrC;EAAE,MAAM;EAAkB,KAAK;CAAc;CAC7C;EAAE,MAAM;EAAe,KAAK;CAAW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ACvD,OAAO,MAAM,MAAM,IAAI,IAAI;AAC7B;AAEA,MAAa,4BAA4B,kBAAmC;CAG1E,OAF6B,sBAAsB,eAAe,eAG7C,CAAC,CACjB,KAAK,MAAM,wBAAwB,EAAE,YAAY,IAAI,SAAS,KAAK,EAAE,CAAC,CAAC,CACvE,QAAQ,KAAK,SAAS,KAAK,IAAI,KAAK,IAAI,GAAG,CAAC,IAAI;AAEvD;AAEA,MAAa,sBACX,eACA,IACA,MACA,QACA,eACuB;CACvB,MAAM,uBAAuB,sBAAsB,eAAe,eAAe;CACjF,qBAAqB,KAAK;EACxB,YAAY;GACV,IAAI,MAAM;GACV,QAAQ;GACR,YAAY;GACZ,MAAM;EACR;EACA,MAAM;EACN,MAAM;CACR,CAAC;CAED,OAAO;AACT;;;AC7BA,SAAgB,4BACd,cACA,WACQ;CAKR,OAAO,6BAA6B;EADI,GADvB,sBAFD,aAAa,UAAU,MAAM,MAAM,EAAE,SAAS,mBAAmB,KAC/E,YAEgD;EAAG,GAAG;CACpB,CAAM;AAC5C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { AlgorithmOptions, AlgorithmParameterOptions, AlgorithmType, COLOR_CATEGORIES, ChildOrder, ChooseOptions, ColorDefinitionOptions, ConditionFunction, ConditionOperator, ConstraintOperator, ConstraintOptions, ConstraintRelationship, ConstraintType, DEFAULT_DRAWING_XML, DataModelOptions, DiagramDirection, DiagramIterationOptions, ForEachOptions, LAYOUT_CATEGORIES, LayoutDefinitionOptions, LayoutNodeChild, LayoutNodeOptions, LayoutRuleOptions, LayoutShapeOptions, ModelConnectionOptions, ModelPointOptions, OtherwiseOptions, PointPropertySetOptions, ResizeHandles, STYLE_CATEGORIES, SampleDataOptions, SmartArtCollection, SmartArtData, StyleDefinitionOptions, StyleLabelOptions, TextProperties3DOptions, TreeNode, VariableListOptions, WhenOptions, colorsDefDesc, createDataModel, definitionId, getColorXml, getLayoutXml, getStyleXml, layoutDefDesc, parseColorDefinition, parseDataModelOptions, parseLayoutDefinition, parseStyleDefinition, stringifyColorDefinition, stringifyColorDefinitionPart, stringifyConnection, stringifyDataModel, stringifyDataModelOptions, stringifyLayoutDefinition, stringifyLayoutDefinitionPart, stringifyPoint, stringifyStyleDefinition, stringifyStyleDefinitionPart, stringifyTransPoint, styleDefDesc, withDiagramNamespaces };
|
|
1
|
+
import { $ as stringifyConnection, A as LayoutNodeChild, B as parseLayoutDefinition, C as ConstraintOptions, D as DiagramIterationOptions, E as DiagramDirection, F as ResizeHandles, G as ModelConnectionOptions, H as stringifyLayoutDefinitionPart, I as SampleDataOptions, J as stringifyDataModel, K as ModelPointOptions, L as VariableListOptions, M as LayoutRuleOptions, N as LayoutShapeOptions, O as ForEachOptions, P as OtherwiseOptions, Q as stringifyTransPoint, R as WhenOptions, S as ConstraintOperator, T as ConstraintType, U as withDiagramNamespaces, V as stringifyLayoutDefinition, W as DataModelOptions, X as PointPropertySetOptions, Y as stringifyDataModelOptions, Z as stringifyPoint, _ as AlgorithmType, a as SmartArtRawParts, at as DEFAULT_DRAWING_XML, b as ConditionFunction, c as StyleLabelOptions, ct as getStyleXml, d as stringifyStyleDefinition, dt as STYLE_CATEGORIES, et as ColorDefinitionOptions, f as stringifyStyleDefinitionPart, g as AlgorithmParameterType, h as AlgorithmParameterOptions, i as SmartArtData, it as stringifyColorDefinitionPart, j as LayoutNodeOptions, k as LayoutDefinitionOptions, l as TextProperties3DOptions, lt as COLOR_CATEGORIES, m as AlgorithmOptions, n as createDataModel, nt as parseColorDefinition, o as definitionId, ot as getColorXml, p as styleDefDesc, q as parseDataModelOptions, r as SmartArtCollection, rt as stringifyColorDefinition, s as StyleDefinitionOptions, st as getLayoutXml, t as TreeNode, tt as colorsDefDesc, u as parseStyleDefinition, ut as LAYOUT_CATEGORIES, v as ChildOrder, w as ConstraintRelationship, x as ConditionOperator, y as ChooseOptions, z as layoutDefDesc } from "../index-Di6XPdGl.mjs";
|
|
2
|
+
export { AlgorithmOptions, AlgorithmParameterOptions, AlgorithmParameterType, AlgorithmType, COLOR_CATEGORIES, ChildOrder, ChooseOptions, ColorDefinitionOptions, ConditionFunction, ConditionOperator, ConstraintOperator, ConstraintOptions, ConstraintRelationship, ConstraintType, DEFAULT_DRAWING_XML, DataModelOptions, DiagramDirection, DiagramIterationOptions, ForEachOptions, LAYOUT_CATEGORIES, LayoutDefinitionOptions, LayoutNodeChild, LayoutNodeOptions, LayoutRuleOptions, LayoutShapeOptions, ModelConnectionOptions, ModelPointOptions, OtherwiseOptions, PointPropertySetOptions, ResizeHandles, STYLE_CATEGORIES, SampleDataOptions, SmartArtCollection, SmartArtData, SmartArtRawParts, StyleDefinitionOptions, StyleLabelOptions, TextProperties3DOptions, TreeNode, VariableListOptions, WhenOptions, colorsDefDesc, createDataModel, definitionId, getColorXml, getLayoutXml, getStyleXml, layoutDefDesc, parseColorDefinition, parseDataModelOptions, parseLayoutDefinition, parseStyleDefinition, stringifyColorDefinition, stringifyColorDefinitionPart, stringifyConnection, stringifyDataModel, stringifyDataModelOptions, stringifyLayoutDefinition, stringifyLayoutDefinitionPart, stringifyPoint, stringifyStyleDefinition, stringifyStyleDefinitionPart, stringifyTransPoint, styleDefDesc, withDiagramNamespaces };
|
package/dist/smartart/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as stringifyDataModelOptions, D as COLOR_CATEGORIES, E as stringifyConnection, O as LAYOUT_CATEGORIES, S as stringifyDataModel, T as stringifyTransPoint, _ as parseLayoutDefinition, a as getColorXml, b as withDiagramNamespaces, c as parseStyleDefinition, d as styleDefDesc, f as colorsDefDesc, g as layoutDefDesc, h as stringifyColorDefinitionPart, i as DEFAULT_DRAWING_XML, k as STYLE_CATEGORIES, l as stringifyStyleDefinition, m as stringifyColorDefinition, n as SmartArtCollection, o as getLayoutXml, p as parseColorDefinition, r as definitionId, s as getStyleXml, t as createDataModel, u as stringifyStyleDefinitionPart, v as stringifyLayoutDefinition, w as stringifyPoint, x as parseDataModelOptions, y as stringifyLayoutDefinitionPart } from "../smartart-
|
|
1
|
+
import { C as stringifyDataModelOptions, D as COLOR_CATEGORIES, E as stringifyConnection, O as LAYOUT_CATEGORIES, S as stringifyDataModel, T as stringifyTransPoint, _ as parseLayoutDefinition, a as getColorXml, b as withDiagramNamespaces, c as parseStyleDefinition, d as styleDefDesc, f as colorsDefDesc, g as layoutDefDesc, h as stringifyColorDefinitionPart, i as DEFAULT_DRAWING_XML, k as STYLE_CATEGORIES, l as stringifyStyleDefinition, m as stringifyColorDefinition, n as SmartArtCollection, o as getLayoutXml, p as parseColorDefinition, r as definitionId, s as getStyleXml, t as createDataModel, u as stringifyStyleDefinitionPart, v as stringifyLayoutDefinition, w as stringifyPoint, x as parseDataModelOptions, y as stringifyLayoutDefinitionPart } from "../smartart-n1kYJ6Jg.mjs";
|
|
2
2
|
export { COLOR_CATEGORIES, DEFAULT_DRAWING_XML, LAYOUT_CATEGORIES, STYLE_CATEGORIES, SmartArtCollection, colorsDefDesc, createDataModel, definitionId, getColorXml, getLayoutXml, getStyleXml, layoutDefDesc, parseColorDefinition, parseDataModelOptions, parseLayoutDefinition, parseStyleDefinition, stringifyColorDefinition, stringifyColorDefinitionPart, stringifyConnection, stringifyDataModel, stringifyDataModelOptions, stringifyLayoutDefinition, stringifyLayoutDefinitionPart, stringifyPoint, stringifyStyleDefinition, stringifyStyleDefinitionPart, stringifyTransPoint, styleDefDesc, withDiagramNamespaces };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { $ as xsdDiagramDirection, L as xsdAnimLevel, rt as xsdHierBranch, xt as xsdResizeHandles } from "./ext-uri-BHBcIrW7.mjs";
|
|
2
|
+
import { En as shape3DDesc, Ln as parseColorList, On as createColorList, Tn as scene3DDesc } from "./drawing-BCAyrCCw.mjs";
|
|
3
|
+
import { i as stringifyShapeStyle, n as parseShapeStyle } from "./style-matrix-B6jhPAT3.mjs";
|
|
3
4
|
import { OOXML_XML_DECLARATION, attr, attrBool, attrNum, attrs, escapeXml, findChild, stringify } from "@office-open/xml";
|
|
4
5
|
//#region src/smartart/categories.ts
|
|
5
6
|
/** Layout ID → OOXML category type */
|
|
@@ -535,7 +536,7 @@ function stringifyRules(list) {
|
|
|
535
536
|
}
|
|
536
537
|
function stringifyVariables(o) {
|
|
537
538
|
const emit = (tag, value) => value === void 0 ? "" : `<dgm:${tag}${attrs({ val: value })}/>`;
|
|
538
|
-
return "<dgm:varLst>" + emit("orgChart", booleanAttr(o.organizationChart)) + emit("chMax", o.childMaximum) + emit("chPref", o.childPreferred) + emit("bulletEnabled", booleanAttr(o.bulletEnabled)) + emit("dir", o.direction) + emit("hierBranch", o.hierarchyBranchStyle) + emit("animOne", o.animateOne) + emit("animLvl", o.animateLevel) + emit("resizeHandles", o.resizeHandles) + "</dgm:varLst>";
|
|
539
|
+
return "<dgm:varLst>" + emit("orgChart", booleanAttr(o.organizationChart)) + emit("chMax", o.childMaximum) + emit("chPref", o.childPreferred) + emit("bulletEnabled", booleanAttr(o.bulletEnabled)) + emit("dir", o.direction !== void 0 ? xsdDiagramDirection.to(o.direction) : void 0) + emit("hierBranch", o.hierarchyBranchStyle !== void 0 ? xsdHierBranch.to(o.hierarchyBranchStyle) : void 0) + emit("animOne", o.animateOne) + emit("animLvl", o.animateLevel !== void 0 ? xsdAnimLevel.to(o.animateLevel) : void 0) + emit("resizeHandles", o.resizeHandles !== void 0 ? xsdResizeHandles.to(o.resizeHandles) : void 0) + "</dgm:varLst>";
|
|
539
540
|
}
|
|
540
541
|
/** Boolean options emit "1"/"0" when set; undefined stays absent. */
|
|
541
542
|
function booleanAttr(value) {
|
|
@@ -565,7 +566,7 @@ function stringifyChildren(children) {
|
|
|
565
566
|
return out;
|
|
566
567
|
}
|
|
567
568
|
function stringifyLayoutNode(o) {
|
|
568
|
-
const body = stringifyChildren(o.children) + (o.ext ? `<
|
|
569
|
+
const body = stringifyChildren(o.children) + (o.ext ? `<dgm:extLst>${o.ext}</dgm:extLst>` : "");
|
|
569
570
|
return `<dgm:layoutNode${attrs({
|
|
570
571
|
name: o.name,
|
|
571
572
|
styleLbl: o.styleLabel,
|
|
@@ -626,7 +627,7 @@ function stringifyLayoutDefinition(o) {
|
|
|
626
627
|
const body = (o.titles ?? []).map((t) => stringifyLocalizedString("title", t)).join("") + (o.descriptions ?? []).map((d) => stringifyLocalizedString("desc", d)).join("") + (o.categories?.length ? `<dgm:catLst>${o.categories.map((c) => selfClose("dgm:cat", {
|
|
627
628
|
type: c.type,
|
|
628
629
|
pri: c.pri
|
|
629
|
-
})).join("")}</dgm:catLst>` : "") + stringifySampleData("sampData", o.sampleData) + stringifySampleData("styleData", o.styleData) + stringifySampleData("clrData", o.colorData) + stringifyLayoutNode(o.layoutNode) + (o.ext ? `<
|
|
630
|
+
})).join("")}</dgm:catLst>` : "") + stringifySampleData("sampData", o.sampleData) + stringifySampleData("styleData", o.styleData) + stringifySampleData("clrData", o.colorData) + stringifyLayoutNode(o.layoutNode) + (o.ext ? `<dgm:extLst>${o.ext}</dgm:extLst>` : "");
|
|
630
631
|
return `<dgm:layoutDef${attrs({
|
|
631
632
|
uniqueId: o.uniqueId,
|
|
632
633
|
minVer: o.minVer,
|
|
@@ -635,12 +636,15 @@ function stringifyLayoutDefinition(o) {
|
|
|
635
636
|
}
|
|
636
637
|
const DGM_NS = "http://schemas.openxmlformats.org/drawingml/2006/diagram";
|
|
637
638
|
const A_NS = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
639
|
+
const R_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
638
640
|
/**
|
|
639
641
|
* Inject the part-level dgm/a namespace declarations into the root element of
|
|
640
|
-
* a serialized layoutDef/styleDef/colorsDef body
|
|
642
|
+
* a serialized layoutDef/styleDef/colorsDef body; r joins only when the body
|
|
643
|
+
* actually uses the prefix (dgm:shape @r:blip preview references).
|
|
641
644
|
*/
|
|
642
645
|
function withDiagramNamespaces(xml) {
|
|
643
|
-
|
|
646
|
+
const r = xml.includes("xmlns:r=") ? "" : /\sr:[\w]+=/.test(xml) ? ` xmlns:r="${R_NS}"` : "";
|
|
647
|
+
return xml.replace(/^<dgm:(layoutDef|styleDef|colorsDef)/, `<dgm:$1 xmlns:dgm="${DGM_NS}" xmlns:a="${A_NS}"${r}`);
|
|
644
648
|
}
|
|
645
649
|
function readIteration(el) {
|
|
646
650
|
const result = {};
|
|
@@ -785,15 +789,15 @@ function parseVariables(el) {
|
|
|
785
789
|
const bulletEnabled = readBool("bulletEnabled");
|
|
786
790
|
if (bulletEnabled !== void 0) result.bulletEnabled = bulletEnabled;
|
|
787
791
|
const direction = readEnum("dir");
|
|
788
|
-
if (direction) result.direction = direction;
|
|
792
|
+
if (direction) result.direction = xsdDiagramDirection.from(direction);
|
|
789
793
|
const hierBranch = readEnum("hierBranch");
|
|
790
|
-
if (hierBranch) result.hierarchyBranchStyle = hierBranch;
|
|
794
|
+
if (hierBranch) result.hierarchyBranchStyle = xsdHierBranch.from(hierBranch);
|
|
791
795
|
const animOne = readEnum("animOne");
|
|
792
796
|
if (animOne) result.animateOne = animOne;
|
|
793
797
|
const animLvl = readEnum("animLvl");
|
|
794
|
-
if (animLvl) result.animateLevel = animLvl;
|
|
798
|
+
if (animLvl) result.animateLevel = xsdAnimLevel.from(animLvl);
|
|
795
799
|
const resizeHandles = readEnum("resizeHandles");
|
|
796
|
-
if (resizeHandles) result.resizeHandles = resizeHandles;
|
|
800
|
+
if (resizeHandles) result.resizeHandles = xsdResizeHandles.from(resizeHandles);
|
|
797
801
|
return result;
|
|
798
802
|
}
|
|
799
803
|
function parseChildren(el) {
|
|
@@ -823,10 +827,7 @@ function parseChildren(el) {
|
|
|
823
827
|
case "dgm:layoutNode":
|
|
824
828
|
children.push({ layoutNode: parseLayoutNode(child) });
|
|
825
829
|
break;
|
|
826
|
-
case "dgm:choose":
|
|
827
|
-
children.push({ choose: parseChoose(child) });
|
|
828
|
-
break;
|
|
829
|
-
default: break;
|
|
830
|
+
case "dgm:choose": children.push({ choose: parseChoose(child) });
|
|
830
831
|
}
|
|
831
832
|
return children.length ? children : void 0;
|
|
832
833
|
}
|
|
@@ -842,7 +843,7 @@ function parseLayoutNode(el) {
|
|
|
842
843
|
if (moveWith) result.moveWith = moveWith;
|
|
843
844
|
const children = parseChildren(el);
|
|
844
845
|
if (children) result.children = children;
|
|
845
|
-
const extLst = findChild(el, "a:extLst");
|
|
846
|
+
const extLst = findChild(el, "dgm:extLst") ?? findChild(el, "a:extLst");
|
|
846
847
|
if (extLst) result.ext = stringify(extLst);
|
|
847
848
|
return result;
|
|
848
849
|
}
|
|
@@ -942,7 +943,7 @@ function parseLayoutDefinition(el) {
|
|
|
942
943
|
if (colorData) result.colorData = colorData;
|
|
943
944
|
const layoutNode = findChild(root, "dgm:layoutNode");
|
|
944
945
|
if (layoutNode) result.layoutNode = parseLayoutNode(layoutNode);
|
|
945
|
-
const extLst = findChild(root, "a:extLst");
|
|
946
|
+
const extLst = findChild(root, "dgm:extLst") ?? findChild(root, "a:extLst");
|
|
946
947
|
if (extLst) result.ext = stringify(extLst);
|
|
947
948
|
return result;
|
|
948
949
|
}
|
|
@@ -1000,7 +1001,7 @@ function stringifyColorDefinition(o) {
|
|
|
1000
1001
|
const body = (o.titles ?? []).map((t) => stringifyLocalized$1("title", t)).join("") + (o.descriptions ?? []).map((d) => stringifyLocalized$1("desc", d)).join("") + (o.categories?.length ? `<dgm:catLst>${o.categories.map((c) => `<dgm:cat${attrs({
|
|
1001
1002
|
type: c.type,
|
|
1002
1003
|
pri: c.pri
|
|
1003
|
-
})}/>`).join("")}</dgm:catLst>` : "") + (o.styleLabels ?? []).map(stringifyColorStyleLabel).join("") + (o.ext ? `<
|
|
1004
|
+
})}/>`).join("")}</dgm:catLst>` : "") + (o.styleLabels ?? []).map(stringifyColorStyleLabel).join("") + (o.ext ? `<dgm:extLst>${o.ext}</dgm:extLst>` : "");
|
|
1004
1005
|
return `<dgm:colorsDef${attrs({
|
|
1005
1006
|
uniqueId: o.uniqueId,
|
|
1006
1007
|
minVer: o.minVer
|
|
@@ -1050,7 +1051,7 @@ function parseColorDefinition(el) {
|
|
|
1050
1051
|
const styleLabels = [];
|
|
1051
1052
|
for (const child of root.elements ?? []) if (child.name === "dgm:styleLbl") styleLabels.push(parseColorStyleLabel(child));
|
|
1052
1053
|
if (styleLabels.length) result.styleLabels = styleLabels;
|
|
1053
|
-
const extLst = findChild(root, "a:extLst");
|
|
1054
|
+
const extLst = findChild(root, "dgm:extLst") ?? findChild(root, "a:extLst");
|
|
1054
1055
|
if (extLst) result.ext = stringify(extLst);
|
|
1055
1056
|
return result;
|
|
1056
1057
|
}
|
|
@@ -1101,7 +1102,7 @@ function stringifyStyleLabel(o, ctx) {
|
|
|
1101
1102
|
if (o.shape3d) body += renamespaceTag("sp3d", shape3DDesc.stringify(o.shape3d, ctx) ?? "");
|
|
1102
1103
|
if (o.textProperties) body += stringifyTextProperties(o.textProperties, ctx);
|
|
1103
1104
|
if (o.style) body += renamespaceTag("style", stringifyShapeStyle(o.style, ctx));
|
|
1104
|
-
if (o.ext) body += `<
|
|
1105
|
+
if (o.ext) body += `<dgm:extLst>${o.ext}</dgm:extLst>`;
|
|
1105
1106
|
return `<dgm:styleLbl${attrs({ name: o.name })}>${body}</dgm:styleLbl>`;
|
|
1106
1107
|
}
|
|
1107
1108
|
function stringifyLocalized(tag, o) {
|
|
@@ -1118,7 +1119,7 @@ function stringifyStyleDefinition(o) {
|
|
|
1118
1119
|
const body = (o.titles ?? []).map((t) => stringifyLocalized("title", t)).join("") + (o.descriptions ?? []).map((d) => stringifyLocalized("desc", d)).join("") + (o.categories?.length ? `<dgm:catLst>${o.categories.map((c) => `<dgm:cat${attrs({
|
|
1119
1120
|
type: c.type,
|
|
1120
1121
|
pri: c.pri
|
|
1121
|
-
})}/>`).join("")}</dgm:catLst>` : "") + (o.scene3d ? renamespaceTag("scene3d", scene3DDesc.stringify(o.scene3d, DIRECT_WRITE_CTX) ?? "") : "") + (o.styleLabels ?? []).map((l) => stringifyStyleLabel(l, DIRECT_WRITE_CTX)).join("") + (o.ext ? `<
|
|
1122
|
+
})}/>`).join("")}</dgm:catLst>` : "") + (o.scene3d ? renamespaceTag("scene3d", scene3DDesc.stringify(o.scene3d, DIRECT_WRITE_CTX) ?? "") : "") + (o.styleLabels ?? []).map((l) => stringifyStyleLabel(l, DIRECT_WRITE_CTX)).join("") + (o.ext ? `<dgm:extLst>${o.ext}</dgm:extLst>` : "");
|
|
1122
1123
|
return `<dgm:styleDef${attrs({
|
|
1123
1124
|
uniqueId: o.uniqueId,
|
|
1124
1125
|
minVer: o.minVer
|
|
@@ -1145,7 +1146,7 @@ function parseStyleLabel(el) {
|
|
|
1145
1146
|
if (txPr) result.textProperties = parseTextProperties(txPr);
|
|
1146
1147
|
const style = findChild(el, "dgm:style");
|
|
1147
1148
|
if (style) result.style = parseShapeStyle(style, DIRECT_READ_CTX);
|
|
1148
|
-
const extLst = findChild(el, "a:extLst");
|
|
1149
|
+
const extLst = findChild(el, "dgm:extLst") ?? findChild(el, "a:extLst");
|
|
1149
1150
|
if (extLst) result.ext = stringify(extLst);
|
|
1150
1151
|
return result;
|
|
1151
1152
|
}
|
|
@@ -1187,7 +1188,7 @@ function parseStyleDefinition(el) {
|
|
|
1187
1188
|
const styleLabels = [];
|
|
1188
1189
|
for (const child of root.elements ?? []) if (child.name === "dgm:styleLbl") styleLabels.push(parseStyleLabel(child));
|
|
1189
1190
|
if (styleLabels.length) result.styleLabels = styleLabels;
|
|
1190
|
-
const extLst = findChild(root, "a:extLst");
|
|
1191
|
+
const extLst = findChild(root, "dgm:extLst") ?? findChild(root, "a:extLst");
|
|
1191
1192
|
if (extLst) result.ext = stringify(extLst);
|
|
1192
1193
|
return result;
|
|
1193
1194
|
}
|
|
@@ -1283,7 +1284,7 @@ const DEFAULT_LAYOUT = {
|
|
|
1283
1284
|
childOrder: "b",
|
|
1284
1285
|
children: [
|
|
1285
1286
|
{ variables: {
|
|
1286
|
-
direction: "
|
|
1287
|
+
direction: "normal",
|
|
1287
1288
|
resizeHandles: "exact"
|
|
1288
1289
|
} },
|
|
1289
1290
|
{ choose: {
|
|
@@ -1475,7 +1476,7 @@ const STYLE_SCENE_3D = {
|
|
|
1475
1476
|
camera: { preset: "orthographicFront" },
|
|
1476
1477
|
lightRig: {
|
|
1477
1478
|
rig: "threePt",
|
|
1478
|
-
direction: "
|
|
1479
|
+
direction: "top"
|
|
1479
1480
|
}
|
|
1480
1481
|
};
|
|
1481
1482
|
/**
|
|
@@ -1646,4 +1647,4 @@ const createDataModel = (nodes, layout = "default", style = "simple1", color = "
|
|
|
1646
1647
|
//#endregion
|
|
1647
1648
|
export { stringifyDataModelOptions as C, COLOR_CATEGORIES as D, stringifyConnection as E, LAYOUT_CATEGORIES as O, stringifyDataModel as S, stringifyTransPoint as T, parseLayoutDefinition as _, getColorXml as a, withDiagramNamespaces as b, parseStyleDefinition as c, styleDefDesc as d, colorsDefDesc as f, layoutDefDesc as g, stringifyColorDefinitionPart as h, DEFAULT_DRAWING_XML as i, STYLE_CATEGORIES as k, stringifyStyleDefinition as l, stringifyColorDefinition as m, SmartArtCollection as n, getLayoutXml as o, parseColorDefinition as p, definitionId as r, getStyleXml as s, createDataModel as t, stringifyStyleDefinitionPart as u, stringifyLayoutDefinition as v, stringifyPoint as w, parseDataModelOptions as x, stringifyLayoutDefinitionPart as y };
|
|
1648
1649
|
|
|
1649
|
-
//# sourceMappingURL=smartart-
|
|
1650
|
+
//# sourceMappingURL=smartart-n1kYJ6Jg.mjs.map
|