ooxml-core 1.8.4 → 1.9.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/PptxHandler-AT7FVG5Q.mjs +2 -0
- package/dist/{PptxHandler-BL4B7CZO.mjs → PptxHandler-EX4WBIQQ.mjs} +2 -2
- package/dist/PptxHandler-VFSCECPL.cjs +11 -0
- package/dist/automation/index.cjs +6652 -4002
- package/dist/automation/index.mjs +6652 -4002
- package/dist/chunk-AT66SA5M.cjs +44423 -0
- package/dist/{chunk-TTPZITQN.mjs → chunk-FIELY5PI.mjs} +1 -1
- package/dist/{chunk-ZAP5WLEN.mjs → chunk-IGOA57LE.mjs} +1 -1
- package/dist/chunk-LCS3J3QI.mjs +87604 -0
- package/dist/{chunk-NIHPA63A.mjs → chunk-M76PHYRR.mjs} +54 -37
- package/dist/chunk-OB277ZGE.mjs +44107 -0
- package/dist/{chunk-GAGSCAR3.mjs → chunk-OXHMZS7B.mjs} +552 -178
- package/dist/chunk-SWF7KVL5.cjs +87610 -0
- package/dist/{chunk-Z7IQR4S4.mjs → chunk-WSO4T2LJ.mjs} +246 -21
- package/dist/docx/block-parser.d.ts.map +1 -1
- package/dist/docx/cell-blocks.d.ts +4 -0
- package/dist/docx/cell-blocks.d.ts.map +1 -0
- package/dist/docx/document-paragraphs.d.ts.map +1 -1
- package/dist/docx/document-parts.d.ts +2 -0
- package/dist/docx/document-parts.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +189 -20
- package/dist/docx/embedded.mjs +189 -20
- package/dist/docx/index.cjs +219 -24
- package/dist/docx/index.mjs +219 -24
- package/dist/docx/layout/adapt-table.d.ts.map +1 -1
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/flow-paragraph.d.ts +5 -0
- package/dist/docx/layout/flow-paragraph.d.ts.map +1 -1
- package/dist/docx/layout/flow-table.d.ts +2 -1
- package/dist/docx/layout/flow-table.d.ts.map +1 -1
- package/dist/docx/layout/footnote-columns.d.ts +22 -0
- package/dist/docx/layout/footnote-columns.d.ts.map +1 -0
- package/dist/docx/layout/footnote-flow.d.ts +27 -0
- package/dist/docx/layout/footnote-flow.d.ts.map +1 -0
- package/dist/docx/layout/footnote-split.d.ts +7 -0
- package/dist/docx/layout/footnote-split.d.ts.map +1 -0
- package/dist/docx/layout/index.cjs +1099 -92
- package/dist/docx/layout/index.mjs +1099 -92
- package/dist/docx/layout/input.d.ts +17 -1
- package/dist/docx/layout/input.d.ts.map +1 -1
- package/dist/docx/layout/legacy-footnote-flow.d.ts +18 -0
- package/dist/docx/layout/legacy-footnote-flow.d.ts.map +1 -0
- package/dist/docx/layout/line-metrics.d.ts.map +1 -1
- package/dist/docx/layout/page-cursor.d.ts +13 -8
- package/dist/docx/layout/page-cursor.d.ts.map +1 -1
- package/dist/docx/layout/page-flow.d.ts.map +1 -1
- package/dist/docx/layout/paragraph-layout.d.ts.map +1 -1
- package/dist/docx/layout/paragraph-tokens.d.ts +2 -0
- package/dist/docx/layout/paragraph-tokens.d.ts.map +1 -1
- package/dist/docx/layout/reference-footnotes.d.ts +7 -0
- package/dist/docx/layout/reference-footnotes.d.ts.map +1 -0
- package/dist/docx/layout/result.d.ts +31 -0
- package/dist/docx/layout/result.d.ts.map +1 -1
- package/dist/docx/layout/section-flow.d.ts +2 -0
- package/dist/docx/layout/section-flow.d.ts.map +1 -1
- package/dist/docx/layout/table-cell-layout.d.ts +11 -0
- package/dist/docx/layout/table-cell-layout.d.ts.map +1 -0
- package/dist/docx/layout/table-footnotes.d.ts +27 -0
- package/dist/docx/layout/table-footnotes.d.ts.map +1 -0
- package/dist/docx/layout/table-layout.d.ts +10 -4
- package/dist/docx/layout/table-layout.d.ts.map +1 -1
- package/dist/docx/load/index.cjs +194 -25
- package/dist/docx/load/index.mjs +194 -25
- package/dist/docx/model-run.d.ts +2 -0
- package/dist/docx/model-run.d.ts.map +1 -1
- package/dist/docx/model.d.ts +7 -0
- package/dist/docx/model.d.ts.map +1 -1
- package/dist/docx/notes.d.ts +5 -0
- package/dist/docx/notes.d.ts.map +1 -1
- package/dist/docx/parse-table.d.ts.map +1 -1
- package/dist/docx/parse.d.ts.map +1 -1
- package/dist/docx/save.d.ts.map +1 -1
- package/dist/docx/section-model.d.ts +2 -0
- package/dist/docx/section-model.d.ts.map +1 -1
- package/dist/docx/sections.d.ts.map +1 -1
- package/dist/docx/settings.d.ts +2 -0
- package/dist/docx/settings.d.ts.map +1 -1
- package/dist/docx/table-model.d.ts +3 -1
- package/dist/docx/table-model.d.ts.map +1 -1
- package/dist/docx/ui/index.cjs +55 -0
- package/dist/docx/ui/index.d.ts +1 -0
- package/dist/docx/ui/index.d.ts.map +1 -1
- package/dist/docx/ui/index.mjs +55 -1
- package/dist/docx/ui/table-structure-guard.d.ts +4 -0
- package/dist/docx/ui/table-structure-guard.d.ts.map +1 -0
- package/dist/docx/write-footnote-columns.d.ts +3 -0
- package/dist/docx/write-footnote-columns.d.ts.map +1 -0
- package/dist/docx/write-notes.d.ts.map +1 -1
- package/dist/docx/write-run.d.ts.map +1 -1
- package/dist/docx/write-sections.d.ts.map +1 -1
- package/dist/index.cjs +8 -5
- package/dist/index.mjs +8 -5
- package/dist/opc/clone-part-graph.d.ts +4 -0
- package/dist/opc/clone-part-graph.d.ts.map +1 -1
- package/dist/opc/index.cjs +8 -5
- package/dist/opc/index.mjs +8 -5
- package/dist/pptx/automation/index.cjs +621 -207
- package/dist/pptx/automation/index.d.ts +3 -3
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-Cn-GzYGp.d.ts → index-B4cnSPNz.d.ts} +33 -4
- package/dist/pptx/chunks/index-B4cnSPNz.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-CKIUurnd.d.ts → index-BZh-IMkN.d.ts} +14 -9
- package/dist/pptx/chunks/{index-CKIUurnd.d.ts.map → index-BZh-IMkN.d.ts.map} +1 -1
- package/dist/pptx/chunks/{text-operations-BHfAm5K9.d.ts → text-operations-BLodkuXE.d.ts} +29 -12
- package/dist/pptx/chunks/text-operations-BLodkuXE.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +622 -213
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.cjs +53 -36
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/find-replace.cjs +416 -45
- package/dist/pptx/editor/render/find-replace.d.ts +35 -4
- package/dist/pptx/editor/render/find-replace.d.ts.map +1 -1
- package/dist/pptx/editor/render/find-replace.mjs +416 -46
- package/dist/pptx/editor/render/slide-operations.cjs +87 -0
- package/dist/pptx/editor/render/slide-operations.d.ts +17 -1
- package/dist/pptx/editor/render/slide-operations.d.ts.map +1 -1
- package/dist/pptx/editor/render/slide-operations.mjs +83 -1
- package/dist/pptx/editor/render/slide-search.cjs +6 -10
- package/dist/pptx/editor/render/slide-search.d.ts +1 -1
- package/dist/pptx/editor/render/slide-search.mjs +6 -10
- package/dist/pptx/editor/render/template-editing.d.ts +1 -1
- package/dist/pptx/editor/render/template-editing.d.ts.map +1 -1
- package/dist/pptx/index.cjs +889 -237
- package/dist/pptx/index.d.ts +4 -4
- package/dist/pptx/index.mjs +5 -5
- package/dist/teams/index.cjs +593 -34
- package/dist/teams/index.mjs +593 -34
- package/dist/visio/accessibility.d.ts +10 -0
- package/dist/visio/accessibility.d.ts.map +1 -0
- package/dist/visio/cell-formula.d.ts +2 -0
- package/dist/visio/cell-formula.d.ts.map +1 -1
- package/dist/visio/connector-curve-aligned.d.ts +5 -0
- package/dist/visio/connector-curve-aligned.d.ts.map +1 -0
- package/dist/visio/connector-curve-spans.d.ts +14 -0
- package/dist/visio/connector-curve-spans.d.ts.map +1 -0
- package/dist/visio/connector-jumps.d.ts +5 -0
- package/dist/visio/connector-jumps.d.ts.map +1 -0
- package/dist/visio/connector-route-walk.d.ts +2 -1
- package/dist/visio/connector-route-walk.d.ts.map +1 -1
- package/dist/visio/edit-alt-text-scope.d.ts +5 -0
- package/dist/visio/edit-alt-text-scope.d.ts.map +1 -0
- package/dist/visio/edit-alt-text.d.ts +3 -0
- package/dist/visio/edit-alt-text.d.ts.map +1 -0
- package/dist/visio/edit-commands.d.ts +7 -2
- package/dist/visio/edit-commands.d.ts.map +1 -1
- package/dist/visio/edit-formatting-commands.d.ts +5 -0
- package/dist/visio/edit-formatting-commands.d.ts.map +1 -1
- package/dist/visio/edit-formatting-paint.d.ts.map +1 -1
- package/dist/visio/edit-formatting-scope.d.ts.map +1 -1
- package/dist/visio/edit-line-jump-cache.d.ts +4 -0
- package/dist/visio/edit-line-jump-cache.d.ts.map +1 -0
- package/dist/visio/edit-master-index.d.ts.map +1 -1
- package/dist/visio/edit-metadata-commands.d.ts +10 -2
- package/dist/visio/edit-metadata-commands.d.ts.map +1 -1
- package/dist/visio/edit-metadata.d.ts +3 -1
- package/dist/visio/edit-metadata.d.ts.map +1 -1
- package/dist/visio/edit-page-alt-text.d.ts +4 -0
- package/dist/visio/edit-page-alt-text.d.ts.map +1 -0
- package/dist/visio/edit-page-layout.d.ts.map +1 -1
- package/dist/visio/edit-page-rename.d.ts.map +1 -1
- package/dist/visio/edit-page-setup-commands.d.ts +7 -1
- package/dist/visio/edit-page-setup-commands.d.ts.map +1 -1
- package/dist/visio/edit-page-size.d.ts.map +1 -1
- package/dist/visio/edit-pages.d.ts.map +1 -1
- package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
- package/dist/visio/edit-scope.d.ts.map +1 -1
- package/dist/visio/edit-shape-create.d.ts.map +1 -1
- package/dist/visio/edit-stencil-connector-write.d.ts.map +1 -1
- package/dist/visio/edit-style-admission.d.ts.map +1 -1
- package/dist/visio/edit-text.d.ts.map +1 -1
- package/dist/visio/edit.d.ts +1 -1
- package/dist/visio/edit.d.ts.map +1 -1
- package/dist/visio/index.cjs +1091 -233
- package/dist/visio/index.d.ts +2 -1
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +1091 -234
- package/dist/visio/line-jumps.d.ts +1 -5
- package/dist/visio/line-jumps.d.ts.map +1 -1
- package/dist/visio/model.d.ts +13 -0
- package/dist/visio/model.d.ts.map +1 -1
- package/dist/visio/page-layout.d.ts +11 -2
- package/dist/visio/page-layout.d.ts.map +1 -1
- package/dist/visio/parser.d.ts.map +1 -1
- package/dist/visio/shape-metadata.d.ts +6 -0
- package/dist/visio/shape-metadata.d.ts.map +1 -1
- package/dist/visio/shapes.d.ts.map +1 -1
- package/dist/visio/text-field-case.d.ts +2 -0
- package/dist/visio/text-field-case.d.ts.map +1 -0
- package/dist/visio/text-field-display.d.ts.map +1 -1
- package/dist/visio/text-field-numeric.d.ts +4 -0
- package/dist/visio/text-field-numeric.d.ts.map +1 -0
- package/dist/visio/ui/connector-preview.d.ts +1 -1
- package/dist/visio/ui/connector-preview.d.ts.map +1 -1
- package/dist/visio/ui/data-graphic-rules.d.ts +2 -0
- package/dist/visio/ui/data-graphic-rules.d.ts.map +1 -1
- package/dist/visio/ui/data-graphics.d.ts +3 -2
- package/dist/visio/ui/data-graphics.d.ts.map +1 -1
- package/dist/visio/ui/edit-commands.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +16898 -15855
- package/dist/visio/ui/index.mjs +16898 -15856
- package/dist/visio/ui/scene-details.d.ts.map +1 -1
- package/dist/visio/ui/scene-validation.d.ts.map +1 -1
- package/dist/visio/ui/snapshot-scene.d.ts +2 -1
- package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
- package/dist/visio/xml-attribute-whitespace.d.ts +5 -0
- package/dist/visio/xml-attribute-whitespace.d.ts.map +1 -0
- package/dist/xlsx/edit/index.d.ts +1 -0
- package/dist/xlsx/edit/index.d.ts.map +1 -1
- package/dist/xlsx/edit/insert-guard.d.ts.map +1 -1
- package/dist/xlsx/edit/merge.d.ts.map +1 -1
- package/dist/xlsx/edit/page-breaks.d.ts +5 -0
- package/dist/xlsx/edit/page-breaks.d.ts.map +1 -0
- package/dist/xlsx/edit/pivots.d.ts +8 -0
- package/dist/xlsx/edit/pivots.d.ts.map +1 -0
- package/dist/xlsx/edit/print-titles.d.ts +7 -0
- package/dist/xlsx/edit/print-titles.d.ts.map +1 -0
- package/dist/xlsx/edit/session.d.ts.map +1 -1
- package/dist/xlsx/edit/sheets.d.ts.map +1 -1
- package/dist/xlsx/edit/shift-formulas.d.ts.map +1 -1
- package/dist/xlsx/edit/shift-sheet.d.ts.map +1 -1
- package/dist/xlsx/edit/sparkline-ranges.d.ts +11 -0
- package/dist/xlsx/edit/sparkline-ranges.d.ts.map +1 -0
- package/dist/xlsx/edit/sparkline-xml.d.ts +13 -0
- package/dist/xlsx/edit/sparkline-xml.d.ts.map +1 -0
- package/dist/xlsx/edit/sparklines.d.ts +16 -0
- package/dist/xlsx/edit/sparklines.d.ts.map +1 -0
- package/dist/xlsx/edit/table-edits.d.ts.map +1 -1
- package/dist/xlsx/edit/tables.d.ts.map +1 -1
- package/dist/xlsx/edit/types.d.ts +22 -1
- package/dist/xlsx/edit/types.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/text-regex.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +3159 -1164
- package/dist/xlsx/index.d.ts +1 -0
- package/dist/xlsx/index.d.ts.map +1 -1
- package/dist/xlsx/index.mjs +3140 -1165
- package/dist/xlsx/layout/cell-view.d.ts +2 -0
- package/dist/xlsx/layout/cell-view.d.ts.map +1 -1
- package/dist/xlsx/layout/header-footer.d.ts +58 -0
- package/dist/xlsx/layout/header-footer.d.ts.map +1 -0
- package/dist/xlsx/layout/index.d.ts +5 -0
- package/dist/xlsx/layout/index.d.ts.map +1 -1
- package/dist/xlsx/layout/print-breaks.d.ts +11 -0
- package/dist/xlsx/layout/print-breaks.d.ts.map +1 -0
- package/dist/xlsx/layout/print-layout.d.ts +34 -0
- package/dist/xlsx/layout/print-layout.d.ts.map +1 -0
- package/dist/xlsx/layout/print-merges.d.ts +18 -0
- package/dist/xlsx/layout/print-merges.d.ts.map +1 -0
- package/dist/xlsx/layout/print-repeat.d.ts +12 -0
- package/dist/xlsx/layout/print-repeat.d.ts.map +1 -0
- package/dist/xlsx/layout/print-titles.d.ts +20 -0
- package/dist/xlsx/layout/print-titles.d.ts.map +1 -0
- package/dist/xlsx/layout/sparkline-data.d.ts.map +1 -1
- package/dist/xlsx/layout/sparkline-view.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +7784 -6976
- package/dist/xlsx/load/index.mjs +7784 -6976
- package/dist/xlsx/model-pivots.d.ts +46 -0
- package/dist/xlsx/model-pivots.d.ts.map +1 -0
- package/dist/xlsx/model.d.ts +5 -0
- package/dist/xlsx/model.d.ts.map +1 -1
- package/dist/xlsx/pivot/admission.d.ts +5 -0
- package/dist/xlsx/pivot/admission.d.ts.map +1 -0
- package/dist/xlsx/pivot/aggregate.d.ts +19 -0
- package/dist/xlsx/pivot/aggregate.d.ts.map +1 -0
- package/dist/xlsx/pivot/cache-xml.d.ts +9 -0
- package/dist/xlsx/pivot/cache-xml.d.ts.map +1 -0
- package/dist/xlsx/pivot/data.d.ts +12 -0
- package/dist/xlsx/pivot/data.d.ts.map +1 -0
- package/dist/xlsx/pivot/hierarchy.d.ts +7 -0
- package/dist/xlsx/pivot/hierarchy.d.ts.map +1 -0
- package/dist/xlsx/pivot/index.d.ts +3 -0
- package/dist/xlsx/pivot/index.d.ts.map +1 -0
- package/dist/xlsx/pivot/read.d.ts +5 -0
- package/dist/xlsx/pivot/read.d.ts.map +1 -0
- package/dist/xlsx/pivot/table-xml.d.ts +5 -0
- package/dist/xlsx/pivot/table-xml.d.ts.map +1 -0
- package/dist/xlsx/pivot/write.d.ts +11 -0
- package/dist/xlsx/pivot/write.d.ts.map +1 -0
- package/dist/xlsx/read/load.d.ts.map +1 -1
- package/dist/xlsx/read/sheet-props.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/index.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/pivots.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/pivots.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/print-layout.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/print-layout.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/sparklines.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/sparklines.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/tools.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/page-breaks.d.ts +3 -0
- package/dist/xlsx/ui/commands/page-breaks.d.ts.map +1 -0
- package/dist/xlsx/ui/index.cjs +2001 -288
- package/dist/xlsx/ui/index.d.ts +1 -0
- package/dist/xlsx/ui/index.d.ts.map +1 -1
- package/dist/xlsx/ui/index.mjs +2001 -289
- package/dist/xlsx/write/page-setup.d.ts.map +1 -1
- package/dist/xlsx/write/save.d.ts.map +1 -1
- package/dist/xlsx/write/sheet-parts.d.ts +1 -0
- package/dist/xlsx/write/sheet-parts.d.ts.map +1 -1
- package/dist/xlsx/write/workbook-part.d.ts +1 -1
- package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
- package/dist/xlsx/write/worksheet.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/pptx/chunks/index-Cn-GzYGp.d.ts.map +0 -1
- package/dist/pptx/chunks/text-operations-BHfAm5K9.d.ts.map +0 -1
package/dist/docx/index.cjs
CHANGED
|
@@ -62,8 +62,8 @@ function named(element, local, ns, lenient = true) {
|
|
|
62
62
|
}
|
|
63
63
|
var children = (parent, local, ns, lenient = true) => elements(parent).filter((element) => named(element, local, ns, lenient));
|
|
64
64
|
var first = (parent, local, ns, lenient = true) => parent ? children(parent, local, ns, lenient)[0] : void 0;
|
|
65
|
-
function attr(element, local, ns,
|
|
66
|
-
return element?.getAttributeNS(ns, local) ?? element?.getAttribute(`${
|
|
65
|
+
function attr(element, local, ns, prefix2) {
|
|
66
|
+
return element?.getAttributeNS(ns, local) ?? element?.getAttribute(`${prefix2}:${local}`) ?? void 0;
|
|
67
67
|
}
|
|
68
68
|
var relAttr = (element, local) => attr(element, local, NS.r, "r");
|
|
69
69
|
|
|
@@ -690,24 +690,24 @@ var parseLigatures = (props) => {
|
|
|
690
690
|
};
|
|
691
691
|
function extensionPrefix(doc, ns, preferred) {
|
|
692
692
|
const root = doc.documentElement;
|
|
693
|
-
let
|
|
694
|
-
for (let index = 1; root.lookupNamespaceURI(
|
|
695
|
-
|
|
696
|
-
root.setAttributeNS(XMLNS, `xmlns:${
|
|
697
|
-
return
|
|
693
|
+
let prefix2 = preferred;
|
|
694
|
+
for (let index = 1; root.lookupNamespaceURI(prefix2) && root.lookupNamespaceURI(prefix2) !== ns; index++)
|
|
695
|
+
prefix2 = `${preferred}${index}`;
|
|
696
|
+
root.setAttributeNS(XMLNS, `xmlns:${prefix2}`, ns);
|
|
697
|
+
return prefix2;
|
|
698
698
|
}
|
|
699
699
|
function writeLigatures(doc, props, value) {
|
|
700
700
|
for (const element2 of ligatureElements(props)) props.removeChild(element2);
|
|
701
701
|
if (value === void 0) return;
|
|
702
|
-
const
|
|
702
|
+
const prefix2 = extensionPrefix(doc, WORD_2010_NS, "w14");
|
|
703
703
|
const mc = extensionPrefix(doc, MC, "mc");
|
|
704
704
|
const ignored = new Set(
|
|
705
705
|
(doc.documentElement.getAttributeNS(MC, "Ignorable") ?? "").split(/\s+/).filter(Boolean)
|
|
706
706
|
);
|
|
707
|
-
ignored.add(
|
|
707
|
+
ignored.add(prefix2);
|
|
708
708
|
doc.documentElement.setAttributeNS(MC, `${mc}:Ignorable`, [...ignored].join(" "));
|
|
709
|
-
const element = doc.createElementNS(WORD_2010_NS, `${
|
|
710
|
-
element.setAttributeNS(WORD_2010_NS, `${
|
|
709
|
+
const element = doc.createElementNS(WORD_2010_NS, `${prefix2}:ligatures`);
|
|
710
|
+
element.setAttributeNS(WORD_2010_NS, `${prefix2}:val`, value);
|
|
711
711
|
props.appendChild(element);
|
|
712
712
|
}
|
|
713
713
|
|
|
@@ -2551,7 +2551,7 @@ async function applyCoreProperties(zip, next, prior) {
|
|
|
2551
2551
|
const root = doc.documentElement;
|
|
2552
2552
|
for (const field of PROPERTY_FIELDS) {
|
|
2553
2553
|
if ((next?.[field] ?? "") === (prior?.[field] ?? "")) continue;
|
|
2554
|
-
const [
|
|
2554
|
+
const [prefix2, ns] = PREFIX[field];
|
|
2555
2555
|
let element = child(root, field);
|
|
2556
2556
|
const value = next?.[field] ?? "";
|
|
2557
2557
|
if (!value) {
|
|
@@ -2559,7 +2559,7 @@ async function applyCoreProperties(zip, next, prior) {
|
|
|
2559
2559
|
continue;
|
|
2560
2560
|
}
|
|
2561
2561
|
if (!element) {
|
|
2562
|
-
element = doc.createElementNS(ns, `${
|
|
2562
|
+
element = doc.createElementNS(ns, `${prefix2}:${field}`);
|
|
2563
2563
|
root.appendChild(element);
|
|
2564
2564
|
}
|
|
2565
2565
|
element.textContent = value;
|
|
@@ -3467,6 +3467,36 @@ function writeTable(doc, table, node, base, writeParagraph, replaceSlots2) {
|
|
|
3467
3467
|
return node;
|
|
3468
3468
|
}
|
|
3469
3469
|
|
|
3470
|
+
// docx/write-footnote-columns.ts
|
|
3471
|
+
var W15 = "http://schemas.microsoft.com/office/word/2012/wordml";
|
|
3472
|
+
var XMLNS2 = "http://www.w3.org/2000/xmlns/";
|
|
3473
|
+
var MC2 = "http://schemas.openxmlformats.org/markup-compatibility/2006";
|
|
3474
|
+
function prefix(doc, preferred, namespace) {
|
|
3475
|
+
let name = preferred;
|
|
3476
|
+
for (let suffix = 1; doc.documentElement.lookupNamespaceURI(name) && doc.documentElement.lookupNamespaceURI(name) !== namespace; suffix++)
|
|
3477
|
+
name = preferred + suffix;
|
|
3478
|
+
doc.documentElement.setAttributeNS(XMLNS2, "xmlns:" + name, namespace);
|
|
3479
|
+
return name;
|
|
3480
|
+
}
|
|
3481
|
+
function writeFootnoteColumns(doc, section, value) {
|
|
3482
|
+
if (value !== void 0 && (!Number.isInteger(value) || value < 0 || value > 2147483647))
|
|
3483
|
+
throw new Error("Footnote column count must be an integer from 0 to 2147483647.");
|
|
3484
|
+
const old = elements(section).filter(
|
|
3485
|
+
(element2) => element2.namespaceURI === W15 && element2.localName === "footnoteColumns"
|
|
3486
|
+
);
|
|
3487
|
+
for (const element2 of old) section.removeChild(element2);
|
|
3488
|
+
if (value === void 0) return;
|
|
3489
|
+
const w15 = prefix(doc, "w15", W15), mc = prefix(doc, "mc", MC2);
|
|
3490
|
+
const ignored = new Set(
|
|
3491
|
+
(doc.documentElement.getAttributeNS(MC2, "Ignorable") ?? "").split(/\s+/).filter(Boolean)
|
|
3492
|
+
);
|
|
3493
|
+
ignored.add(w15);
|
|
3494
|
+
doc.documentElement.setAttributeNS(MC2, mc + ":Ignorable", [...ignored].join(" "));
|
|
3495
|
+
const element = doc.createElementNS(W15, w15 + ":footnoteColumns");
|
|
3496
|
+
element.setAttributeNS(WORD_NS, "w:val", String(value));
|
|
3497
|
+
section.appendChild(element);
|
|
3498
|
+
}
|
|
3499
|
+
|
|
3470
3500
|
// docx/page-borders.ts
|
|
3471
3501
|
var SIDES3 = ["top", "left", "bottom", "right"];
|
|
3472
3502
|
var ATTRIBUTES = ["offsetFrom", "display", "zOrder"];
|
|
@@ -3610,6 +3640,7 @@ var WRITABLE = /* @__PURE__ */ new Set([
|
|
|
3610
3640
|
"footerDistanceTwips",
|
|
3611
3641
|
"gutterTwips",
|
|
3612
3642
|
"columns",
|
|
3643
|
+
"footnoteColumns",
|
|
3613
3644
|
"titlePage",
|
|
3614
3645
|
"verticalAlign",
|
|
3615
3646
|
"pageNumbering",
|
|
@@ -3673,6 +3704,8 @@ var AFTER_TITLEPG = [
|
|
|
3673
3704
|
var AFTER_PGBORDERS = ["lnNumType", ...AFTER_LNNUM];
|
|
3674
3705
|
var AFTER_TYPE = ["pgSz", ...AFTER_PGSZ];
|
|
3675
3706
|
function writeSectionProperties(doc, sectPr, section, base) {
|
|
3707
|
+
if (section.footnoteColumns !== base?.footnoteColumns)
|
|
3708
|
+
writeFootnoteColumns(doc, sectPr, section.footnoteColumns);
|
|
3676
3709
|
if (section.type === "nextPage")
|
|
3677
3710
|
for (const type of children2(sectPr, "type")) sectPr.removeChild(type);
|
|
3678
3711
|
else setW5(child2(doc, sectPr, "type", AFTER_TYPE), "val", section.type);
|
|
@@ -5910,7 +5943,7 @@ function readBuiltInChartStyle(root) {
|
|
|
5910
5943
|
for (const content of children(root, "AlternateContent", NS.mc)) {
|
|
5911
5944
|
for (const choice of children(content, "Choice", NS.mc)) {
|
|
5912
5945
|
const requires = choice.getAttribute("Requires")?.trim().split(/\s+/);
|
|
5913
|
-
if (!requires?.length || !requires.every((
|
|
5946
|
+
if (!requires?.length || !requires.every((prefix2) => choice.lookupNamespaceURI(prefix2) === C14))
|
|
5914
5947
|
continue;
|
|
5915
5948
|
const modern = first(choice, "style", C14)?.getAttribute("val");
|
|
5916
5949
|
if (modern && /^\d+$/.test(modern) && Number(modern) >= 101 && Number(modern) <= 148)
|
|
@@ -6230,12 +6263,12 @@ var CHART_ROOT_BINDINGS = /* @__PURE__ */ new Map([
|
|
|
6230
6263
|
var DECLARATION = / xmlns:([A-Za-z_][\w.-]*)="([^"]*)"/g;
|
|
6231
6264
|
function stripDeclarations(xml, bindings) {
|
|
6232
6265
|
const conflicting = /* @__PURE__ */ new Set();
|
|
6233
|
-
for (const [,
|
|
6234
|
-
if (
|
|
6235
|
-
conflicting.add(
|
|
6266
|
+
for (const [, prefix2, uri] of xml.matchAll(DECLARATION))
|
|
6267
|
+
if (prefix2 !== void 0 && bindings.has(prefix2) && bindings.get(prefix2) !== uri)
|
|
6268
|
+
conflicting.add(prefix2);
|
|
6236
6269
|
return xml.replace(
|
|
6237
6270
|
DECLARATION,
|
|
6238
|
-
(match,
|
|
6271
|
+
(match, prefix2, uri) => bindings.get(prefix2) === uri && !conflicting.has(prefix2) ? "" : match
|
|
6239
6272
|
);
|
|
6240
6273
|
}
|
|
6241
6274
|
var innerXml = (element) => stripDeclarations(elements(element).map(buildXml).join(""), CHART_ROOT_BINDINGS);
|
|
@@ -7588,11 +7621,11 @@ function cssFontFamily(name) {
|
|
|
7588
7621
|
// chart/render/chart-svg-appearance.ts
|
|
7589
7622
|
var nextPaintId = 0;
|
|
7590
7623
|
function chartGradientPaint(model, width = 1024, height = 768) {
|
|
7591
|
-
const
|
|
7624
|
+
const prefix2 = `xlsx-chart-${++nextPaintId}`;
|
|
7592
7625
|
const appearance = { ...model.appearance };
|
|
7593
7626
|
const defs = [];
|
|
7594
7627
|
const shadowPaint = (shadow, suffix) => {
|
|
7595
|
-
const id = `${
|
|
7628
|
+
const id = `${prefix2}-${suffix}`;
|
|
7596
7629
|
const pad = Math.max(4, shadow.blur * 3 + Math.abs(shadow.dx) + Math.abs(shadow.dy));
|
|
7597
7630
|
defs.push(
|
|
7598
7631
|
`<filter id="${id}" filterUnits="userSpaceOnUse" x="${n(-pad)}" y="${n(-pad)}" width="${n(width + pad * 2)}" height="${n(height + pad * 2)}" color-interpolation-filters="sRGB">${svgDropShadowElement(shadow, { number: n, color: (value) => esc(value) })}</filter>`
|
|
@@ -7607,7 +7640,7 @@ function chartGradientPaint(model, width = 1024, height = 768) {
|
|
|
7607
7640
|
};
|
|
7608
7641
|
}
|
|
7609
7642
|
const paint = (gradient, suffix, bounds) => {
|
|
7610
|
-
const def = buildChartGradientDef(`${
|
|
7643
|
+
const def = buildChartGradientDef(`${prefix2}-${suffix}`, gradient, bounds);
|
|
7611
7644
|
defs.push(chartGradientMarkup(def));
|
|
7612
7645
|
return `url(#${def.id})`;
|
|
7613
7646
|
};
|
|
@@ -9313,6 +9346,10 @@ function createRun(doc, run, base, old, allocator) {
|
|
|
9313
9346
|
node.appendChild(code);
|
|
9314
9347
|
return node;
|
|
9315
9348
|
}
|
|
9349
|
+
if (run.noteSeparator) {
|
|
9350
|
+
node.appendChild(makeW(doc, run.noteSeparator));
|
|
9351
|
+
return node;
|
|
9352
|
+
}
|
|
9316
9353
|
if (run.noteMark) {
|
|
9317
9354
|
node.appendChild(makeW(doc, run.noteMark === "footnote" ? "footnoteRef" : "endnoteRef"));
|
|
9318
9355
|
return node;
|
|
@@ -11234,7 +11271,12 @@ async function applyNoteEdits(zip, model, base, pendingMedia, docPrIds) {
|
|
|
11234
11271
|
const original = baseNotes.get(note.id);
|
|
11235
11272
|
return !original || JSON.stringify(original.blocks) !== JSON.stringify(note.blocks);
|
|
11236
11273
|
});
|
|
11237
|
-
|
|
11274
|
+
const separators = kind === "footnote" ? model.footnoteSeparators : void 0;
|
|
11275
|
+
const baseSeparators = kind === "footnote" ? base.footnoteSeparators : void 0;
|
|
11276
|
+
const editedSeparators = ["separator", "continuationSeparator"].filter(
|
|
11277
|
+
(type) => separators?.[type] && JSON.stringify(separators[type].blocks) !== JSON.stringify(baseSeparators?.[type]?.blocks)
|
|
11278
|
+
);
|
|
11279
|
+
if (!edited.length && !removed.length && !editedSeparators.length) continue;
|
|
11238
11280
|
const file = zip.file(part);
|
|
11239
11281
|
const doc = parseXml2(file ? await file.async("string") : await createNotesPart(zip, kind));
|
|
11240
11282
|
const elements2 = new Map(
|
|
@@ -11246,6 +11288,24 @@ async function applyNoteEdits(zip, model, base, pendingMedia, docPrIds) {
|
|
|
11246
11288
|
doc.documentElement.removeChild(element);
|
|
11247
11289
|
}
|
|
11248
11290
|
const allocator = await allocatorForPart(zip, part, doc, docPrIds);
|
|
11291
|
+
for (const type of editedSeparators) {
|
|
11292
|
+
const separator = separators[type];
|
|
11293
|
+
let element = children2(doc.documentElement, kind).find((node) => getW(node, "type") === type);
|
|
11294
|
+
if (!element) {
|
|
11295
|
+
element = doc.createElementNS(WORD_NS3, `w:${kind}`);
|
|
11296
|
+
element.setAttributeNS(WORD_NS3, "w:id", separator.id);
|
|
11297
|
+
element.setAttributeNS(WORD_NS3, "w:type", type);
|
|
11298
|
+
doc.documentElement.appendChild(element);
|
|
11299
|
+
}
|
|
11300
|
+
applyBlocks(
|
|
11301
|
+
doc,
|
|
11302
|
+
element,
|
|
11303
|
+
separator.blocks,
|
|
11304
|
+
baseSeparators?.[type]?.blocks ?? [],
|
|
11305
|
+
allocator,
|
|
11306
|
+
contentWidthTwips
|
|
11307
|
+
);
|
|
11308
|
+
}
|
|
11249
11309
|
for (const note of edited) {
|
|
11250
11310
|
let element = elements2.get(note.id);
|
|
11251
11311
|
const original = baseNotes.get(note.id);
|
|
@@ -11413,6 +11473,43 @@ async function applyTrackChangesSetting(zip, enabled2) {
|
|
|
11413
11473
|
}
|
|
11414
11474
|
await applySettingsFlag(zip, "trackRevisions", enabled2);
|
|
11415
11475
|
}
|
|
11476
|
+
async function applyCompatibilityMode(zip, mode) {
|
|
11477
|
+
if (mode !== void 0 && (!Number.isInteger(mode) || mode <= 0 || mode > 2147483647))
|
|
11478
|
+
throw new RangeError("Compatibility mode must be a positive integer.");
|
|
11479
|
+
const file = zip.file(SETTINGS_PATH);
|
|
11480
|
+
if (!file && mode === void 0) return;
|
|
11481
|
+
const doc = parseXml2(
|
|
11482
|
+
await file?.async("string") ?? `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:settings xmlns:w="${WORD_NS}"/>`
|
|
11483
|
+
);
|
|
11484
|
+
const root = doc.documentElement;
|
|
11485
|
+
let compat = children2(root, "compat")[0];
|
|
11486
|
+
if (!compat && mode !== void 0) {
|
|
11487
|
+
compat = makeW(doc, "compat");
|
|
11488
|
+
const rank = SETTINGS_ORDER.indexOf("compat");
|
|
11489
|
+
const after = Array.from(root.childNodes).find(
|
|
11490
|
+
(node) => node.nodeType === 1 && SETTINGS_ORDER.indexOf(node.localName ?? "") > rank
|
|
11491
|
+
);
|
|
11492
|
+
root.insertBefore(compat, after ?? null);
|
|
11493
|
+
}
|
|
11494
|
+
const uri = "http://schemas.microsoft.com/office/word";
|
|
11495
|
+
if (compat) {
|
|
11496
|
+
for (const setting of children2(compat, "compatSetting"))
|
|
11497
|
+
if (setting.getAttributeNS(WORD_NS, "name") === "compatibilityMode" && setting.getAttributeNS(WORD_NS, "uri") === uri)
|
|
11498
|
+
compat.removeChild(setting);
|
|
11499
|
+
if (mode !== void 0) {
|
|
11500
|
+
const setting = makeW(doc, "compatSetting");
|
|
11501
|
+
setting.setAttributeNS(WORD_NS, "w:name", "compatibilityMode");
|
|
11502
|
+
setting.setAttributeNS(WORD_NS, "w:uri", uri);
|
|
11503
|
+
setting.setAttributeNS(WORD_NS, "w:val", String(mode));
|
|
11504
|
+
compat.appendChild(setting);
|
|
11505
|
+
}
|
|
11506
|
+
}
|
|
11507
|
+
zip.file(SETTINGS_PATH, buildXml(doc));
|
|
11508
|
+
if (!file) {
|
|
11509
|
+
await ensureContentTypeOverride(zip, SETTINGS_PATH, SETTINGS_CONTENT_TYPE);
|
|
11510
|
+
await ensureDocumentRelationship(zip, SETTINGS_RELATIONSHIP_TYPE, "settings.xml");
|
|
11511
|
+
}
|
|
11512
|
+
}
|
|
11416
11513
|
|
|
11417
11514
|
// docx/page-background.ts
|
|
11418
11515
|
var HEX = /^[0-9a-fA-F]{6}$/;
|
|
@@ -11444,6 +11541,7 @@ function documentBlockLists(model) {
|
|
|
11444
11541
|
(slots) => Object.values(slots ?? {}).flatMap((content) => content ? [content.blocks] : [])
|
|
11445
11542
|
)
|
|
11446
11543
|
),
|
|
11544
|
+
...Object.values(model.footnoteSeparators ?? {}).map((note) => note.blocks),
|
|
11447
11545
|
...[...model.footnotes ?? [], ...model.endnotes ?? []].map((note) => note.blocks)
|
|
11448
11546
|
];
|
|
11449
11547
|
}
|
|
@@ -11476,6 +11574,14 @@ function mapDocumentParagraphs(model, map) {
|
|
|
11476
11574
|
...section.footers ? { footers: slots(section.footers) } : {}
|
|
11477
11575
|
}))
|
|
11478
11576
|
} : {},
|
|
11577
|
+
...model.footnoteSeparators ? {
|
|
11578
|
+
footnoteSeparators: Object.fromEntries(
|
|
11579
|
+
Object.entries(model.footnoteSeparators).map(([kind, note]) => [
|
|
11580
|
+
kind,
|
|
11581
|
+
{ ...note, blocks: mapBlockParagraphs(note.blocks, map) }
|
|
11582
|
+
])
|
|
11583
|
+
)
|
|
11584
|
+
} : {},
|
|
11479
11585
|
...model.footnotes ? {
|
|
11480
11586
|
footnotes: model.footnotes.map((note) => ({
|
|
11481
11587
|
...note,
|
|
@@ -11656,6 +11762,8 @@ async function saveDocx(model, pendingMedia) {
|
|
|
11656
11762
|
await applyNumberingCatalog(zip, model, binding);
|
|
11657
11763
|
await applyCoreProperties(zip, model.properties, binding?.base.properties);
|
|
11658
11764
|
if (binding) await applyStyleNumbering(zip, model, binding.base);
|
|
11765
|
+
if (model.compatibilityMode !== binding?.base.compatibilityMode)
|
|
11766
|
+
await applyCompatibilityMode(zip, model.compatibilityMode);
|
|
11659
11767
|
if (Boolean(model.evenAndOddHeaders) !== Boolean(binding?.base.evenAndOddHeaders))
|
|
11660
11768
|
await applySettingsFlag(zip, "evenAndOddHeaders", Boolean(model.evenAndOddHeaders));
|
|
11661
11769
|
if (model.pageColor !== binding?.base.pageColor)
|
|
@@ -11726,6 +11834,20 @@ function parseCell(cell, parseParagraph3, id) {
|
|
|
11726
11834
|
if (margins) result.margins = margins;
|
|
11727
11835
|
const nested = children2(cell, "tbl").map(nestedPreview);
|
|
11728
11836
|
if (nested.length) result.nestedTables = nested;
|
|
11837
|
+
if (nested.length) {
|
|
11838
|
+
let paragraphIndex = 0, tableIndex = 0;
|
|
11839
|
+
result.sourceBlocks = Array.from(cell.childNodes).flatMap(
|
|
11840
|
+
(child3) => {
|
|
11841
|
+
if (child3.nodeType !== 1) return [];
|
|
11842
|
+
const element = child3;
|
|
11843
|
+
if (element.namespaceURI !== WORD_NS) return [];
|
|
11844
|
+
if (element.localName === "p") return [result.paragraphs[paragraphIndex++]];
|
|
11845
|
+
if (element.localName === "tbl")
|
|
11846
|
+
return [parseTable(element, `${id}-nested${tableIndex++}`, parseParagraph3)];
|
|
11847
|
+
return [];
|
|
11848
|
+
}
|
|
11849
|
+
);
|
|
11850
|
+
}
|
|
11729
11851
|
return result;
|
|
11730
11852
|
}
|
|
11731
11853
|
function parseLook(element) {
|
|
@@ -11943,6 +12065,7 @@ function parseRun2(node, revision) {
|
|
|
11943
12065
|
let breakKind;
|
|
11944
12066
|
let noteReference;
|
|
11945
12067
|
let noteMark;
|
|
12068
|
+
let noteSeparator;
|
|
11946
12069
|
let fieldChar;
|
|
11947
12070
|
const fieldCode = content.length > 0 && content.every((child3) => named2(child3, "instrText")) ? content.map((child3) => textContent(child3)).join("") : void 0;
|
|
11948
12071
|
const only = content.length === 1 ? content[0] : void 0;
|
|
@@ -11958,6 +12081,8 @@ function parseRun2(node, revision) {
|
|
|
11958
12081
|
if (id) noteReference = { kind: "endnote", id };
|
|
11959
12082
|
} else if (named2(only, "footnoteRef")) noteMark = "footnote";
|
|
11960
12083
|
else if (named2(only, "endnoteRef")) noteMark = "endnote";
|
|
12084
|
+
else if (named2(only, "separator")) noteSeparator = "separator";
|
|
12085
|
+
else if (named2(only, "continuationSeparator")) noteSeparator = "continuationSeparator";
|
|
11961
12086
|
else if (named2(only, "fldChar")) {
|
|
11962
12087
|
const type = getW(only, "fldCharType");
|
|
11963
12088
|
if (type === "begin" || type === "separate" || type === "end") fieldChar = type;
|
|
@@ -11975,6 +12100,7 @@ function parseRun2(node, revision) {
|
|
|
11975
12100
|
if (breakKind) run.break = breakKind;
|
|
11976
12101
|
if (noteReference) run.noteReference = noteReference;
|
|
11977
12102
|
if (noteMark) run.noteMark = noteMark;
|
|
12103
|
+
if (noteSeparator) run.noteSeparator = noteSeparator;
|
|
11978
12104
|
if (fieldChar) {
|
|
11979
12105
|
run.fieldChar = fieldChar;
|
|
11980
12106
|
const flags = parseFieldFlags(only);
|
|
@@ -12151,6 +12277,14 @@ function pageBordersOf(element) {
|
|
|
12151
12277
|
return borders ? { pageBorders: borders } : {};
|
|
12152
12278
|
}
|
|
12153
12279
|
function parseOneSection(section, endsAtBlockId) {
|
|
12280
|
+
const footnoteColumns = parseUnsignedInteger(
|
|
12281
|
+
getW(
|
|
12282
|
+
elements(section).find(
|
|
12283
|
+
(element) => element.localName === "footnoteColumns" && element.namespaceURI === "http://schemas.microsoft.com/office/word/2012/wordml"
|
|
12284
|
+
),
|
|
12285
|
+
"val"
|
|
12286
|
+
)
|
|
12287
|
+
);
|
|
12154
12288
|
const size = first2(section, "pgSz");
|
|
12155
12289
|
const margins = first2(section, "pgMar");
|
|
12156
12290
|
const typeValue = enumValue(isStSectionMark, getW(first2(section, "type"), "val"), "w:type");
|
|
@@ -12175,6 +12309,7 @@ function parseOneSection(section, endsAtBlockId) {
|
|
|
12175
12309
|
...footerDistance !== void 0 ? { footerDistanceTwips: footerDistance } : {},
|
|
12176
12310
|
...gutter !== void 0 ? { gutterTwips: gutter } : {},
|
|
12177
12311
|
columns: parseColumns(section),
|
|
12312
|
+
...footnoteColumns !== void 0 ? { footnoteColumns } : {},
|
|
12178
12313
|
...onOffElement(first2(section, "titlePg")) === true ? { titlePage: true } : {},
|
|
12179
12314
|
...vAlignValue ? { verticalAlign: vAlignValue } : {},
|
|
12180
12315
|
...pgNum ? {
|
|
@@ -12212,6 +12347,32 @@ function parseRawSections(body, blocks) {
|
|
|
12212
12347
|
return sections;
|
|
12213
12348
|
}
|
|
12214
12349
|
|
|
12350
|
+
// docx/cell-blocks.ts
|
|
12351
|
+
function cellSourceBlocks(cell) {
|
|
12352
|
+
if (!cell.sourceBlocks) return cell.paragraphs;
|
|
12353
|
+
const originalIds = new Set(
|
|
12354
|
+
cell.sourceBlocks.filter((block) => block.type === "paragraph").map((block) => block.id)
|
|
12355
|
+
);
|
|
12356
|
+
const positions = new Map(cell.paragraphs.map((paragraph, index) => [paragraph.id, index]));
|
|
12357
|
+
const blocks = [];
|
|
12358
|
+
let cursor = 0;
|
|
12359
|
+
for (const source of cell.sourceBlocks) {
|
|
12360
|
+
if (source.type === "table") {
|
|
12361
|
+
blocks.push(source);
|
|
12362
|
+
continue;
|
|
12363
|
+
}
|
|
12364
|
+
const position = positions.get(source.id);
|
|
12365
|
+
if (position !== void 0 && position >= cursor) {
|
|
12366
|
+
blocks.push(...cell.paragraphs.slice(cursor, position + 1));
|
|
12367
|
+
cursor = position + 1;
|
|
12368
|
+
}
|
|
12369
|
+
while (cursor < cell.paragraphs.length && !originalIds.has(cell.paragraphs[cursor].id))
|
|
12370
|
+
blocks.push(cell.paragraphs[cursor++]);
|
|
12371
|
+
}
|
|
12372
|
+
blocks.push(...cell.paragraphs.slice(cursor));
|
|
12373
|
+
return blocks;
|
|
12374
|
+
}
|
|
12375
|
+
|
|
12215
12376
|
// docx/notes.ts
|
|
12216
12377
|
var skippedTypes = /* @__PURE__ */ new Set(["separator", "continuationSeparator"]);
|
|
12217
12378
|
function parseNotesPart(xml, kind, parseBlocks) {
|
|
@@ -12228,6 +12389,29 @@ function parseNotesPart(xml, kind, parseBlocks) {
|
|
|
12228
12389
|
}
|
|
12229
12390
|
return notes;
|
|
12230
12391
|
}
|
|
12392
|
+
function parseFootnoteSeparators(xml, parseBlocks) {
|
|
12393
|
+
const root = parseXml2(xml).documentElement;
|
|
12394
|
+
const result = {};
|
|
12395
|
+
for (const element of children2(root, "footnote")) {
|
|
12396
|
+
const type = getW(element, "type");
|
|
12397
|
+
if (type !== "separator" && type !== "continuationSeparator") continue;
|
|
12398
|
+
for (const run of Array.from(element.getElementsByTagNameNS(root.namespaceURI, "r"))) {
|
|
12399
|
+
const content = Array.from(run.childNodes).filter((child3) => child3.nodeType === 1).filter((child3) => child3.localName !== "rPr");
|
|
12400
|
+
if (content.length < 2 || !content.some((child3) => skippedTypes.has(child3.localName)))
|
|
12401
|
+
continue;
|
|
12402
|
+
const props = children2(run, "rPr")[0];
|
|
12403
|
+
for (const child3 of content) {
|
|
12404
|
+
const split = run.cloneNode(false);
|
|
12405
|
+
if (props) split.appendChild(props.cloneNode(true));
|
|
12406
|
+
split.appendChild(child3.cloneNode(true));
|
|
12407
|
+
run.parentNode.insertBefore(split, run);
|
|
12408
|
+
}
|
|
12409
|
+
run.parentNode.removeChild(run);
|
|
12410
|
+
}
|
|
12411
|
+
result[type] = { id: getW(element, "id") ?? type, blocks: parseBlocks(element, `fn-${type}-`) };
|
|
12412
|
+
}
|
|
12413
|
+
return result;
|
|
12414
|
+
}
|
|
12231
12415
|
var romanNumerals = [
|
|
12232
12416
|
[1e3, "M"],
|
|
12233
12417
|
[900, "CM"],
|
|
@@ -12291,7 +12475,7 @@ function walkBlocks(blocks, kind, order) {
|
|
|
12291
12475
|
if (block.type === "paragraph") walkParagraph(block, kind, order);
|
|
12292
12476
|
else
|
|
12293
12477
|
for (const row of block.rows)
|
|
12294
|
-
for (const cell of row) walkBlocks(cell
|
|
12478
|
+
for (const cell of row) walkBlocks(cellSourceBlocks(cell), kind, order);
|
|
12295
12479
|
}
|
|
12296
12480
|
}
|
|
12297
12481
|
function numberNotesInOrder(blocks, kind) {
|
|
@@ -12314,6 +12498,10 @@ async function readPart(zip, path2) {
|
|
|
12314
12498
|
function parseSettings(xml) {
|
|
12315
12499
|
if (!xml) return { evenAndOddHeaders: false, autoHyphenation: false };
|
|
12316
12500
|
const root = parseXml2(xml).documentElement;
|
|
12501
|
+
const compatibility = (first2(root, "compat") ? children2(first2(root, "compat"), "compatSetting") : []).find(
|
|
12502
|
+
(setting) => getW(setting, "name") === "compatibilityMode" && getW(setting, "uri") === "http://schemas.microsoft.com/office/word"
|
|
12503
|
+
);
|
|
12504
|
+
const compatibilityMode = compatibility ? Number(getW(compatibility, "val")) : void 0;
|
|
12317
12505
|
const footnoteNumFmt = enumValue(
|
|
12318
12506
|
isStNumberFormat,
|
|
12319
12507
|
getW(first2(first2(root, "footnotePr"), "numFmt"), "val"),
|
|
@@ -12325,6 +12513,7 @@ function parseSettings(xml) {
|
|
|
12325
12513
|
"w:endnotePr/w:numFmt"
|
|
12326
12514
|
);
|
|
12327
12515
|
return {
|
|
12516
|
+
...compatibilityMode !== void 0 && Number.isInteger(compatibilityMode) && compatibilityMode > 0 ? { compatibilityMode } : {},
|
|
12328
12517
|
evenAndOddHeaders: onOffElement(first2(root, "evenAndOddHeaders")) === true,
|
|
12329
12518
|
autoHyphenation: onOffElement(first2(root, "autoHyphenation")) === true,
|
|
12330
12519
|
...footnoteNumFmt ? { footnoteNumFmt } : {},
|
|
@@ -12389,9 +12578,10 @@ async function parseDocumentParts(zip, body, blocks, drawings) {
|
|
|
12389
12578
|
const endnotesXml = await readPart(zip, "word/endnotes.xml");
|
|
12390
12579
|
const notesParser = async (path2) => {
|
|
12391
12580
|
const context = await partContext(zip, path2, drawings);
|
|
12392
|
-
return (container,
|
|
12581
|
+
return (container, prefix2) => withParseWarnings(warnings, () => parseBlocksFromContainer(container, prefix2, context));
|
|
12393
12582
|
};
|
|
12394
12583
|
const footnotes = footnotesXml ? parseNotesPart(footnotesXml, "footnote", await notesParser("word/footnotes.xml")) : void 0;
|
|
12584
|
+
const footnoteSeparators = footnotesXml ? parseFootnoteSeparators(footnotesXml, await notesParser("word/footnotes.xml")) : void 0;
|
|
12395
12585
|
const endnotes = endnotesXml ? parseNotesPart(endnotesXml, "endnote", await notesParser("word/endnotes.xml")) : void 0;
|
|
12396
12586
|
if (sections.some((section) => section.columns.count > 1))
|
|
12397
12587
|
warnings.push(
|
|
@@ -12403,7 +12593,9 @@ async function parseDocumentParts(zip, body, blocks, drawings) {
|
|
|
12403
12593
|
);
|
|
12404
12594
|
return {
|
|
12405
12595
|
sections,
|
|
12596
|
+
...settings.compatibilityMode !== void 0 ? { compatibilityMode: settings.compatibilityMode } : {},
|
|
12406
12597
|
...footnotes ? { footnotes } : {},
|
|
12598
|
+
...footnoteSeparators ? { footnoteSeparators } : {},
|
|
12407
12599
|
...endnotes ? { endnotes } : {},
|
|
12408
12600
|
...settings.footnoteNumFmt ? { footnoteNumFmt: settings.footnoteNumFmt } : {},
|
|
12409
12601
|
...settings.endnoteNumFmt ? { endnoteNumFmt: settings.endnoteNumFmt } : {},
|
|
@@ -12591,7 +12783,9 @@ async function readPackage(input) {
|
|
|
12591
12783
|
);
|
|
12592
12784
|
const parts = await parseDocumentParts(zip, body, blocks, drawings);
|
|
12593
12785
|
model.sections = parts.sections;
|
|
12786
|
+
if (parts.compatibilityMode !== void 0) model.compatibilityMode = parts.compatibilityMode;
|
|
12594
12787
|
if (parts.footnotes) model.footnotes = parts.footnotes;
|
|
12788
|
+
if (parts.footnoteSeparators) model.footnoteSeparators = parts.footnoteSeparators;
|
|
12595
12789
|
if (parts.endnotes) model.endnotes = parts.endnotes;
|
|
12596
12790
|
if (parts.footnoteNumFmt) model.footnoteNumFmt = parts.footnoteNumFmt;
|
|
12597
12791
|
if (parts.endnoteNumFmt) model.endnoteNumFmt = parts.endnoteNumFmt;
|
|
@@ -12638,6 +12832,7 @@ async function readPackage(input) {
|
|
|
12638
12832
|
(slots) => Object.values(slots ?? {}).flatMap((content) => content?.blocks ?? [])
|
|
12639
12833
|
)
|
|
12640
12834
|
),
|
|
12835
|
+
...Object.values(model.footnoteSeparators ?? {}).flatMap((note) => note.blocks),
|
|
12641
12836
|
...[...model.footnotes ?? [], ...model.endnotes ?? []].flatMap((note) => note.blocks)
|
|
12642
12837
|
];
|
|
12643
12838
|
await resolveDocumentDiagrams(
|