ooxml-core 1.23.0 → 1.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/README.md +2 -2
  2. package/dist/{PptxHandler-FSKKPZZC.mjs → PptxHandler-5TWAQWPK.mjs} +2 -2
  3. package/dist/{PptxHandler-H7MEWJJJ.mjs → PptxHandler-KBJ4TN3T.mjs} +1 -1
  4. package/dist/{PptxHandler-DNSXWTQV.cjs → PptxHandler-KFEE7O7W.cjs} +2 -2
  5. package/dist/{PresentationBuilder-7TSENZTX.mjs → PresentationBuilder-SCT5AQBP.mjs} +1 -1
  6. package/dist/{PresentationBuilder-RIJWQSEU.mjs → PresentationBuilder-SVHIKT4C.mjs} +2 -2
  7. package/dist/{PresentationBuilder-A5NI35VN.cjs → PresentationBuilder-SXLRXYDI.cjs} +4 -4
  8. package/dist/automation/index.cjs +553 -335
  9. package/dist/automation/index.d.ts +1 -0
  10. package/dist/automation/index.d.ts.map +1 -1
  11. package/dist/automation/index.mjs +552 -336
  12. package/dist/automation/live.d.ts +89 -0
  13. package/dist/automation/live.d.ts.map +1 -0
  14. package/dist/{chunk-4QPOJCJG.mjs → chunk-7N7C5BNM.mjs} +1 -1
  15. package/dist/{chunk-DLFMCZZT.mjs → chunk-CWCDFPKN.mjs} +1 -1
  16. package/dist/{chunk-LF5E5ZOH.mjs → chunk-GVP262WE.mjs} +25 -62
  17. package/dist/{chunk-VQF6HQEE.mjs → chunk-KVKTHGIY.mjs} +1 -1
  18. package/dist/{chunk-BA7Z6ATM.mjs → chunk-NE7626A4.mjs} +4 -4
  19. package/dist/{chunk-Q5PKBQXH.mjs → chunk-ON7XVRHQ.mjs} +26 -63
  20. package/dist/{chunk-HL3FBJ6X.cjs → chunk-XK55DEUD.cjs} +25 -62
  21. package/dist/docx/ui/customization.d.ts +30 -0
  22. package/dist/docx/ui/customization.d.ts.map +1 -0
  23. package/dist/docx/ui/index.cjs +51 -0
  24. package/dist/docx/ui/index.d.ts +1 -0
  25. package/dist/docx/ui/index.d.ts.map +1 -1
  26. package/dist/docx/ui/index.mjs +46 -1
  27. package/dist/embedding/backstage.d.ts +48 -0
  28. package/dist/embedding/backstage.d.ts.map +1 -0
  29. package/dist/embedding/capabilities.d.ts +60 -0
  30. package/dist/embedding/capabilities.d.ts.map +1 -0
  31. package/dist/embedding/customization.d.ts +32 -0
  32. package/dist/embedding/customization.d.ts.map +1 -0
  33. package/dist/embedding/index.cjs +229 -0
  34. package/dist/embedding/index.d.ts +7 -0
  35. package/dist/embedding/index.d.ts.map +1 -0
  36. package/dist/embedding/index.mjs +204 -0
  37. package/dist/embedding/menu-commands.d.ts +66 -0
  38. package/dist/embedding/menu-commands.d.ts.map +1 -0
  39. package/dist/embedding/regions.d.ts +58 -0
  40. package/dist/embedding/regions.d.ts.map +1 -0
  41. package/dist/embedding/storage.d.ts +111 -0
  42. package/dist/embedding/storage.d.ts.map +1 -0
  43. package/dist/index.cjs +233 -0
  44. package/dist/index.d.ts +1 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.mjs +233 -1
  47. package/dist/pptx/automation/index.cjs +25 -67
  48. package/dist/pptx/automation/index.d.ts +3 -2
  49. package/dist/pptx/automation/index.d.ts.map +1 -1
  50. package/dist/pptx/automation/index.mjs +5 -5
  51. package/dist/pptx/chunks/{index-Q5mM8kIR.d.ts → index-4FmgJajb.d.ts} +3 -2
  52. package/dist/pptx/chunks/index-4FmgJajb.d.ts.map +1 -0
  53. package/dist/pptx/chunks/index-C3xhAMSa.d.ts +837 -0
  54. package/dist/pptx/chunks/index-C3xhAMSa.d.ts.map +1 -0
  55. package/dist/pptx/chunks/{index-CPhsd7Df.d.ts → index-nKQ4s7FA.d.ts} +24 -834
  56. package/dist/pptx/chunks/index-nKQ4s7FA.d.ts.map +1 -0
  57. package/dist/pptx/cli/index.cjs +25 -67
  58. package/dist/pptx/cli/index.mjs +4 -4
  59. package/dist/pptx/converter/index.d.ts +1 -1
  60. package/dist/pptx/converter/index.mjs +2 -2
  61. package/dist/pptx/editor/render/find-replace.d.ts +1 -1
  62. package/dist/pptx/editor/render/slide-operations.cjs +1 -1
  63. package/dist/pptx/editor/render/slide-operations.mjs +1 -1
  64. package/dist/pptx/index.cjs +25 -67
  65. package/dist/pptx/index.d.ts +4 -3
  66. package/dist/pptx/index.mjs +5 -5
  67. package/dist/pptx/node/index.cjs +40 -0
  68. package/dist/pptx/node/index.d.ts +13 -0
  69. package/dist/pptx/node/index.d.ts.map +1 -0
  70. package/dist/pptx/node/index.mjs +40 -0
  71. package/dist/visio/collab/compose.d.ts.map +1 -1
  72. package/dist/visio/collab/fixups.d.ts.map +1 -1
  73. package/dist/visio/collab/index.cjs +167 -62
  74. package/dist/visio/collab/index.mjs +167 -62
  75. package/dist/visio/collab/keys.d.ts +2 -0
  76. package/dist/visio/collab/keys.d.ts.map +1 -1
  77. package/dist/visio/collab/pieces.d.ts +7 -0
  78. package/dist/visio/collab/pieces.d.ts.map +1 -1
  79. package/dist/visio/collab/read-ids.d.ts +7 -1
  80. package/dist/visio/collab/read-ids.d.ts.map +1 -1
  81. package/dist/visio/collab/read-parts.d.ts.map +1 -1
  82. package/dist/visio/collab/read-shapes.d.ts +0 -1
  83. package/dist/visio/collab/read-shapes.d.ts.map +1 -1
  84. package/dist/visio/collab/read.d.ts.map +1 -1
  85. package/dist/visio/collab/schema.d.ts +1 -1
  86. package/dist/visio/collab/schema.d.ts.map +1 -1
  87. package/dist/visio/collab/snapshot-contents.d.ts.map +1 -1
  88. package/dist/visio/collab/write-shapes.d.ts.map +1 -1
  89. package/dist/visio/collab/zip-store.d.ts +4 -0
  90. package/dist/visio/collab/zip-store.d.ts.map +1 -0
  91. package/dist/visio/document-level.d.ts +57 -0
  92. package/dist/visio/document-level.d.ts.map +1 -0
  93. package/dist/visio/index.cjs +543 -444
  94. package/dist/visio/index.d.ts +1 -0
  95. package/dist/visio/index.d.ts.map +1 -1
  96. package/dist/visio/index.mjs +543 -444
  97. package/dist/visio/layers.d.ts +3 -0
  98. package/dist/visio/layers.d.ts.map +1 -1
  99. package/dist/visio/package.d.ts +9 -0
  100. package/dist/visio/package.d.ts.map +1 -1
  101. package/dist/visio/parser.d.ts +7 -0
  102. package/dist/visio/parser.d.ts.map +1 -1
  103. package/dist/visio/shape-metadata.d.ts +3 -0
  104. package/dist/visio/shape-metadata.d.ts.map +1 -1
  105. package/dist/visio/ui/contract.d.ts +27 -2
  106. package/dist/visio/ui/contract.d.ts.map +1 -1
  107. package/dist/visio/ui/customization.d.ts +46 -0
  108. package/dist/visio/ui/customization.d.ts.map +1 -0
  109. package/dist/visio/ui/index.cjs +454 -316
  110. package/dist/visio/ui/index.d.ts +1 -0
  111. package/dist/visio/ui/index.d.ts.map +1 -1
  112. package/dist/visio/ui/index.mjs +452 -317
  113. package/dist/xlsx/ui/commands.d.ts +2 -0
  114. package/dist/xlsx/ui/commands.d.ts.map +1 -1
  115. package/dist/xlsx/ui/customization.d.ts +49 -0
  116. package/dist/xlsx/ui/customization.d.ts.map +1 -0
  117. package/dist/xlsx/ui/index.cjs +39 -1
  118. package/dist/xlsx/ui/index.d.ts +1 -0
  119. package/dist/xlsx/ui/index.d.ts.map +1 -1
  120. package/dist/xlsx/ui/index.mjs +37 -2
  121. package/package.json +11 -1
  122. package/dist/pptx/chunks/index-CPhsd7Df.d.ts.map +0 -1
  123. package/dist/pptx/chunks/index-Q5mM8kIR.d.ts.map +0 -1
package/dist/index.cjs CHANGED
@@ -9613,6 +9613,238 @@ function findRibbonAddInCommand(tab, id) {
9613
9613
  return command && !command.disabled ? command : void 0;
9614
9614
  }
9615
9615
 
9616
+ // embedding/index.ts
9617
+ var embedding_exports = {};
9618
+ __export(embedding_exports, {
9619
+ EDITOR_CAPABILITY_IDS: () => EDITOR_CAPABILITY_IDS,
9620
+ FILE_COMMAND_EVENT: () => FILE_COMMAND_EVENT,
9621
+ acceptedHostBackstagePages: () => acceptedHostBackstagePages,
9622
+ capabilityHiddenActions: () => capabilityHiddenActions,
9623
+ disabledCapabilities: () => disabledCapabilities,
9624
+ documentMimeType: () => documentMimeType,
9625
+ documentSaveMeta: () => documentSaveMeta,
9626
+ fileCommandDetail: () => fileCommandDetail,
9627
+ hostBackstageItemId: () => hostBackstageItemId,
9628
+ hostBackstagePageId: () => hostBackstagePageId,
9629
+ hostBackstageRegionId: () => hostBackstageRegionId,
9630
+ hostMenuEntryId: () => hostMenuEntryId,
9631
+ isCapabilityEnabled: () => isCapabilityEnabled,
9632
+ isDocumentStorage: () => isDocumentStorage,
9633
+ isHostMenuEntry: () => isHostMenuEntry,
9634
+ mergeHiddenActions: () => mergeHiddenActions,
9635
+ placeHostBackstagePages: () => placeHostBackstagePages,
9636
+ recoveryStoreOf: () => recoveryStoreOf,
9637
+ resolveHostMenuCommands: () => resolveHostMenuCommands,
9638
+ sameRegionContext: () => sameRegionContext,
9639
+ sameRenderer: () => sameRenderer,
9640
+ saveToStorage: () => saveToStorage,
9641
+ withHostMenuCommands: () => withHostMenuCommands,
9642
+ withoutHiddenEntries: () => withoutHiddenEntries
9643
+ });
9644
+
9645
+ // embedding/storage.ts
9646
+ var FILE_COMMAND_EVENT = "file-command";
9647
+ function fileCommandDetail(command, fileName) {
9648
+ return fileName === void 0 ? { command } : { command, fileName };
9649
+ }
9650
+ function recoveryStoreOf(storage) {
9651
+ if (!storage?.readRecovery || !storage.writeRecovery || !storage.clearRecovery) return void 0;
9652
+ return storage;
9653
+ }
9654
+ function isDocumentStorage(value) {
9655
+ return typeof value === "object" && value !== null && typeof value.save === "function";
9656
+ }
9657
+ var MIME_TYPES = {
9658
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
9659
+ docm: "application/vnd.ms-word.document.macroEnabled.12",
9660
+ dotx: "application/vnd.openxmlformats-officedocument.wordprocessingml.template",
9661
+ doc: "application/msword",
9662
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
9663
+ xlsm: "application/vnd.ms-excel.sheet.macroEnabled.12",
9664
+ xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
9665
+ xls: "application/vnd.ms-excel",
9666
+ csv: "text/csv",
9667
+ pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
9668
+ pptm: "application/vnd.ms-powerpoint.presentation.macroEnabled.12",
9669
+ ppsx: "application/vnd.openxmlformats-officedocument.presentationml.slideshow",
9670
+ potx: "application/vnd.openxmlformats-officedocument.presentationml.template",
9671
+ ppt: "application/vnd.ms-powerpoint",
9672
+ vsdx: "application/vnd.ms-visio.drawing",
9673
+ vsdm: "application/vnd.ms-visio.drawing.macroEnabled.12",
9674
+ vsd: "application/vnd.visio",
9675
+ txt: "text/plain",
9676
+ json: "application/json"
9677
+ };
9678
+ function documentMimeType(fileName) {
9679
+ const extension = /\.([^./\\]+)$/.exec(fileName)?.[1]?.toLowerCase() ?? "";
9680
+ return MIME_TYPES[extension] ?? "application/octet-stream";
9681
+ }
9682
+ function documentSaveMeta(fileName, reason = "save", mimeType = documentMimeType(fileName)) {
9683
+ return { fileName, mimeType, reason };
9684
+ }
9685
+ async function saveToStorage(storage, bytes, meta) {
9686
+ const result = await storage.save(bytes, meta);
9687
+ const name = result?.fileName?.trim();
9688
+ return name ? name : meta.fileName;
9689
+ }
9690
+
9691
+ // embedding/backstage.ts
9692
+ function hostBackstageItemId(id) {
9693
+ return `host.${id}`;
9694
+ }
9695
+ function hostBackstagePageId(itemId) {
9696
+ return itemId.startsWith("host.") ? itemId.slice(5) : void 0;
9697
+ }
9698
+ function acceptedHostBackstagePages(pages) {
9699
+ const seen = /* @__PURE__ */ new Set();
9700
+ const accepted = [];
9701
+ for (const page of pages ?? []) {
9702
+ if (!page || typeof page.id !== "string" || !page.id || seen.has(page.id)) continue;
9703
+ seen.add(page.id);
9704
+ accepted.push({ page, index: accepted.length });
9705
+ }
9706
+ return accepted.sort((a2, b) => (a2.page.order ?? 0) - (b.page.order ?? 0) || a2.index - b.index).map(({ page }) => page);
9707
+ }
9708
+ function placeHostBackstagePages(items, pages, toEntry) {
9709
+ const entries = [...items];
9710
+ for (const page of acceptedHostBackstagePages(pages)) {
9711
+ const group2 = page.group ?? "main";
9712
+ let at2 = entries.length;
9713
+ while (at2 > 0 && (entries[at2 - 1]?.group ?? "main") !== group2) at2--;
9714
+ entries.splice(at2 === 0 ? entries.length : at2, 0, toEntry(page));
9715
+ }
9716
+ return entries;
9717
+ }
9718
+
9719
+ // embedding/capabilities.ts
9720
+ var EDITOR_CAPABILITY_IDS = [
9721
+ /** Changing the document. `false` opens it read-only, whatever the edit prop says. */
9722
+ "edit",
9723
+ /** Saving a copy in another format (File > Export, Save As, Download). */
9724
+ "export",
9725
+ /** Printing (File > Print, the Print commands and Ctrl+P). */
9726
+ "print",
9727
+ /** Sharing the document with other people (File > Share, Share buttons). */
9728
+ "share",
9729
+ /** Copying content out (Copy, Cut and their shortcuts). */
9730
+ "copy",
9731
+ /** Adding and editing comments. */
9732
+ "comment",
9733
+ /** Tracked changes: turning tracking on, accepting and rejecting. */
9734
+ "review",
9735
+ /** Find and Replace. */
9736
+ "find",
9737
+ /** File > New and File > Open. */
9738
+ "open",
9739
+ /** File > Save. */
9740
+ "save",
9741
+ /** File > Options and Customize Ribbon. */
9742
+ "settings"
9743
+ ];
9744
+ function isCapabilityEnabled(capabilities, id) {
9745
+ return capabilities?.[id] !== false;
9746
+ }
9747
+ function disabledCapabilities(capabilities) {
9748
+ if (!capabilities) return [];
9749
+ return Object.keys(capabilities).filter((id) => capabilities[id] === false);
9750
+ }
9751
+ function capabilityHiddenActions(capabilities, map) {
9752
+ const hidden = /* @__PURE__ */ new Set();
9753
+ for (const id of disabledCapabilities(capabilities))
9754
+ for (const action of map[id] ?? []) hidden.add(action);
9755
+ return [...hidden];
9756
+ }
9757
+ function mergeHiddenActions(...lists) {
9758
+ const merged = /* @__PURE__ */ new Set();
9759
+ for (const list2 of lists) for (const action of list2 ?? []) merged.add(action);
9760
+ return [...merged];
9761
+ }
9762
+
9763
+ // embedding/menu-commands.ts
9764
+ function hostMenuEntryId(id) {
9765
+ return `host:${id}`;
9766
+ }
9767
+ function isHostMenuEntry(entry3) {
9768
+ return typeof entry3 === "object" && entry3 !== null && entry3.host === true;
9769
+ }
9770
+ function resolveHostMenuCommands(commands, context) {
9771
+ const top = [];
9772
+ const bottom = [];
9773
+ const seen = /* @__PURE__ */ new Set();
9774
+ for (const command of commands ?? []) {
9775
+ if (!command?.id || seen.has(command.id)) continue;
9776
+ seen.add(command.id);
9777
+ if (command.when && !command.when(context)) continue;
9778
+ const disabled = typeof command.disabled === "function" ? command.disabled(context) : command.disabled === true;
9779
+ const entry3 = {
9780
+ id: hostMenuEntryId(command.id),
9781
+ host: true,
9782
+ label: command.label,
9783
+ labelKey: "",
9784
+ disabled,
9785
+ onSelect: () => {
9786
+ if (!disabled) command.onSelect(context);
9787
+ }
9788
+ };
9789
+ if (command.icon) entry3.icon = command.icon;
9790
+ (command.group === "bottom" ? bottom : top).push(entry3);
9791
+ }
9792
+ return { top, bottom };
9793
+ }
9794
+ function withHostMenuCommands(entries, commands, context) {
9795
+ const { top, bottom } = resolveHostMenuCommands(commands, context);
9796
+ const middle = entries.map(
9797
+ (entry3, index) => index === 0 ? { ...entry3, separatorBefore: top.length > 0 } : entry3
9798
+ );
9799
+ const first2 = bottom[0];
9800
+ if (first2 && top.length + middle.length > 0) first2.separatorBefore = true;
9801
+ return [...top, ...middle, ...bottom];
9802
+ }
9803
+ function withoutHiddenEntries(entries, hidden) {
9804
+ const kept = [];
9805
+ let separator = false;
9806
+ for (const entry3 of entries) {
9807
+ separator ||= entry3.separatorBefore === true;
9808
+ if (hidden(entry3)) continue;
9809
+ const starts = separator && kept.length > 0;
9810
+ kept.push(
9811
+ entry3.separatorBefore === true === starts ? entry3 : { ...entry3, separatorBefore: starts }
9812
+ );
9813
+ separator = false;
9814
+ }
9815
+ return kept;
9816
+ }
9817
+
9818
+ // embedding/regions.ts
9819
+ function hostBackstageRegionId(id) {
9820
+ return `backstage.host.${id}`;
9821
+ }
9822
+ function sameRenderer(a2, b) {
9823
+ if (a2 === b) return true;
9824
+ if (!a2 || !b || typeof a2 !== "object" || typeof b !== "object" || a2.element !== b.element)
9825
+ return false;
9826
+ const left = a2.properties ?? {};
9827
+ const right = b.properties ?? {};
9828
+ const keys = Object.keys(left);
9829
+ return keys.length === Object.keys(right).length && keys.every((key) => Object.is(left[key], right[key]));
9830
+ }
9831
+ function sameRegionContext(a2, b, callbackKeys = /* @__PURE__ */ new Set(["close"])) {
9832
+ const left = a2;
9833
+ const right = b;
9834
+ for (const key of /* @__PURE__ */ new Set([...Object.keys(left), ...Object.keys(right)])) {
9835
+ if (callbackKeys.has(key)) continue;
9836
+ const x = left[key];
9837
+ const y = right[key];
9838
+ if (Array.isArray(x) && Array.isArray(y)) {
9839
+ if (!sameItems(x, y)) return false;
9840
+ } else if (!Object.is(x, y)) return false;
9841
+ }
9842
+ return true;
9843
+ }
9844
+ function sameItems(a2, b) {
9845
+ return a2 === b || a2.length === b.length && a2.every((item, index) => Object.is(item, b[index]));
9846
+ }
9847
+
9616
9848
  // drawingml/index.ts
9617
9849
  var drawingml_exports = {};
9618
9850
  __export(drawingml_exports, {
@@ -46824,6 +47056,7 @@ exports.color = color_exports;
46824
47056
  exports.diagram = diagram_exports;
46825
47057
  exports.digest = digest_exports;
46826
47058
  exports.drawingml = drawingml_exports;
47059
+ exports.embedding = embedding_exports;
46827
47060
  exports.geometry = geometry_exports;
46828
47061
  exports.i18n = i18n_exports;
46829
47062
  exports.math = math_exports;
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * as chart from './chart/index.js';
3
3
  export * as text from './text/index.js';
4
4
  export * as i18n from './i18n/index.js';
5
5
  export * as ribbon from './ribbon/index.js';
6
+ export * as embedding from './embedding/index.js';
6
7
  export * as drawingml from './drawingml/index.js';
7
8
  export * as diagram from './diagram/index.js';
8
9
  export * as digest from './digest/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC"}
package/dist/index.mjs CHANGED
@@ -9607,6 +9607,238 @@ function findRibbonAddInCommand(tab, id) {
9607
9607
  return command && !command.disabled ? command : void 0;
9608
9608
  }
9609
9609
 
9610
+ // embedding/index.ts
9611
+ var embedding_exports = {};
9612
+ __export(embedding_exports, {
9613
+ EDITOR_CAPABILITY_IDS: () => EDITOR_CAPABILITY_IDS,
9614
+ FILE_COMMAND_EVENT: () => FILE_COMMAND_EVENT,
9615
+ acceptedHostBackstagePages: () => acceptedHostBackstagePages,
9616
+ capabilityHiddenActions: () => capabilityHiddenActions,
9617
+ disabledCapabilities: () => disabledCapabilities,
9618
+ documentMimeType: () => documentMimeType,
9619
+ documentSaveMeta: () => documentSaveMeta,
9620
+ fileCommandDetail: () => fileCommandDetail,
9621
+ hostBackstageItemId: () => hostBackstageItemId,
9622
+ hostBackstagePageId: () => hostBackstagePageId,
9623
+ hostBackstageRegionId: () => hostBackstageRegionId,
9624
+ hostMenuEntryId: () => hostMenuEntryId,
9625
+ isCapabilityEnabled: () => isCapabilityEnabled,
9626
+ isDocumentStorage: () => isDocumentStorage,
9627
+ isHostMenuEntry: () => isHostMenuEntry,
9628
+ mergeHiddenActions: () => mergeHiddenActions,
9629
+ placeHostBackstagePages: () => placeHostBackstagePages,
9630
+ recoveryStoreOf: () => recoveryStoreOf,
9631
+ resolveHostMenuCommands: () => resolveHostMenuCommands,
9632
+ sameRegionContext: () => sameRegionContext,
9633
+ sameRenderer: () => sameRenderer,
9634
+ saveToStorage: () => saveToStorage,
9635
+ withHostMenuCommands: () => withHostMenuCommands,
9636
+ withoutHiddenEntries: () => withoutHiddenEntries
9637
+ });
9638
+
9639
+ // embedding/storage.ts
9640
+ var FILE_COMMAND_EVENT = "file-command";
9641
+ function fileCommandDetail(command, fileName) {
9642
+ return fileName === void 0 ? { command } : { command, fileName };
9643
+ }
9644
+ function recoveryStoreOf(storage) {
9645
+ if (!storage?.readRecovery || !storage.writeRecovery || !storage.clearRecovery) return void 0;
9646
+ return storage;
9647
+ }
9648
+ function isDocumentStorage(value) {
9649
+ return typeof value === "object" && value !== null && typeof value.save === "function";
9650
+ }
9651
+ var MIME_TYPES = {
9652
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
9653
+ docm: "application/vnd.ms-word.document.macroEnabled.12",
9654
+ dotx: "application/vnd.openxmlformats-officedocument.wordprocessingml.template",
9655
+ doc: "application/msword",
9656
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
9657
+ xlsm: "application/vnd.ms-excel.sheet.macroEnabled.12",
9658
+ xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
9659
+ xls: "application/vnd.ms-excel",
9660
+ csv: "text/csv",
9661
+ pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
9662
+ pptm: "application/vnd.ms-powerpoint.presentation.macroEnabled.12",
9663
+ ppsx: "application/vnd.openxmlformats-officedocument.presentationml.slideshow",
9664
+ potx: "application/vnd.openxmlformats-officedocument.presentationml.template",
9665
+ ppt: "application/vnd.ms-powerpoint",
9666
+ vsdx: "application/vnd.ms-visio.drawing",
9667
+ vsdm: "application/vnd.ms-visio.drawing.macroEnabled.12",
9668
+ vsd: "application/vnd.visio",
9669
+ txt: "text/plain",
9670
+ json: "application/json"
9671
+ };
9672
+ function documentMimeType(fileName) {
9673
+ const extension = /\.([^./\\]+)$/.exec(fileName)?.[1]?.toLowerCase() ?? "";
9674
+ return MIME_TYPES[extension] ?? "application/octet-stream";
9675
+ }
9676
+ function documentSaveMeta(fileName, reason = "save", mimeType = documentMimeType(fileName)) {
9677
+ return { fileName, mimeType, reason };
9678
+ }
9679
+ async function saveToStorage(storage, bytes, meta) {
9680
+ const result = await storage.save(bytes, meta);
9681
+ const name = result?.fileName?.trim();
9682
+ return name ? name : meta.fileName;
9683
+ }
9684
+
9685
+ // embedding/backstage.ts
9686
+ function hostBackstageItemId(id) {
9687
+ return `host.${id}`;
9688
+ }
9689
+ function hostBackstagePageId(itemId) {
9690
+ return itemId.startsWith("host.") ? itemId.slice(5) : void 0;
9691
+ }
9692
+ function acceptedHostBackstagePages(pages) {
9693
+ const seen = /* @__PURE__ */ new Set();
9694
+ const accepted = [];
9695
+ for (const page of pages ?? []) {
9696
+ if (!page || typeof page.id !== "string" || !page.id || seen.has(page.id)) continue;
9697
+ seen.add(page.id);
9698
+ accepted.push({ page, index: accepted.length });
9699
+ }
9700
+ return accepted.sort((a2, b) => (a2.page.order ?? 0) - (b.page.order ?? 0) || a2.index - b.index).map(({ page }) => page);
9701
+ }
9702
+ function placeHostBackstagePages(items, pages, toEntry) {
9703
+ const entries = [...items];
9704
+ for (const page of acceptedHostBackstagePages(pages)) {
9705
+ const group2 = page.group ?? "main";
9706
+ let at2 = entries.length;
9707
+ while (at2 > 0 && (entries[at2 - 1]?.group ?? "main") !== group2) at2--;
9708
+ entries.splice(at2 === 0 ? entries.length : at2, 0, toEntry(page));
9709
+ }
9710
+ return entries;
9711
+ }
9712
+
9713
+ // embedding/capabilities.ts
9714
+ var EDITOR_CAPABILITY_IDS = [
9715
+ /** Changing the document. `false` opens it read-only, whatever the edit prop says. */
9716
+ "edit",
9717
+ /** Saving a copy in another format (File > Export, Save As, Download). */
9718
+ "export",
9719
+ /** Printing (File > Print, the Print commands and Ctrl+P). */
9720
+ "print",
9721
+ /** Sharing the document with other people (File > Share, Share buttons). */
9722
+ "share",
9723
+ /** Copying content out (Copy, Cut and their shortcuts). */
9724
+ "copy",
9725
+ /** Adding and editing comments. */
9726
+ "comment",
9727
+ /** Tracked changes: turning tracking on, accepting and rejecting. */
9728
+ "review",
9729
+ /** Find and Replace. */
9730
+ "find",
9731
+ /** File > New and File > Open. */
9732
+ "open",
9733
+ /** File > Save. */
9734
+ "save",
9735
+ /** File > Options and Customize Ribbon. */
9736
+ "settings"
9737
+ ];
9738
+ function isCapabilityEnabled(capabilities, id) {
9739
+ return capabilities?.[id] !== false;
9740
+ }
9741
+ function disabledCapabilities(capabilities) {
9742
+ if (!capabilities) return [];
9743
+ return Object.keys(capabilities).filter((id) => capabilities[id] === false);
9744
+ }
9745
+ function capabilityHiddenActions(capabilities, map) {
9746
+ const hidden = /* @__PURE__ */ new Set();
9747
+ for (const id of disabledCapabilities(capabilities))
9748
+ for (const action of map[id] ?? []) hidden.add(action);
9749
+ return [...hidden];
9750
+ }
9751
+ function mergeHiddenActions(...lists) {
9752
+ const merged = /* @__PURE__ */ new Set();
9753
+ for (const list2 of lists) for (const action of list2 ?? []) merged.add(action);
9754
+ return [...merged];
9755
+ }
9756
+
9757
+ // embedding/menu-commands.ts
9758
+ function hostMenuEntryId(id) {
9759
+ return `host:${id}`;
9760
+ }
9761
+ function isHostMenuEntry(entry3) {
9762
+ return typeof entry3 === "object" && entry3 !== null && entry3.host === true;
9763
+ }
9764
+ function resolveHostMenuCommands(commands, context) {
9765
+ const top = [];
9766
+ const bottom = [];
9767
+ const seen = /* @__PURE__ */ new Set();
9768
+ for (const command of commands ?? []) {
9769
+ if (!command?.id || seen.has(command.id)) continue;
9770
+ seen.add(command.id);
9771
+ if (command.when && !command.when(context)) continue;
9772
+ const disabled = typeof command.disabled === "function" ? command.disabled(context) : command.disabled === true;
9773
+ const entry3 = {
9774
+ id: hostMenuEntryId(command.id),
9775
+ host: true,
9776
+ label: command.label,
9777
+ labelKey: "",
9778
+ disabled,
9779
+ onSelect: () => {
9780
+ if (!disabled) command.onSelect(context);
9781
+ }
9782
+ };
9783
+ if (command.icon) entry3.icon = command.icon;
9784
+ (command.group === "bottom" ? bottom : top).push(entry3);
9785
+ }
9786
+ return { top, bottom };
9787
+ }
9788
+ function withHostMenuCommands(entries, commands, context) {
9789
+ const { top, bottom } = resolveHostMenuCommands(commands, context);
9790
+ const middle = entries.map(
9791
+ (entry3, index) => index === 0 ? { ...entry3, separatorBefore: top.length > 0 } : entry3
9792
+ );
9793
+ const first2 = bottom[0];
9794
+ if (first2 && top.length + middle.length > 0) first2.separatorBefore = true;
9795
+ return [...top, ...middle, ...bottom];
9796
+ }
9797
+ function withoutHiddenEntries(entries, hidden) {
9798
+ const kept = [];
9799
+ let separator = false;
9800
+ for (const entry3 of entries) {
9801
+ separator ||= entry3.separatorBefore === true;
9802
+ if (hidden(entry3)) continue;
9803
+ const starts = separator && kept.length > 0;
9804
+ kept.push(
9805
+ entry3.separatorBefore === true === starts ? entry3 : { ...entry3, separatorBefore: starts }
9806
+ );
9807
+ separator = false;
9808
+ }
9809
+ return kept;
9810
+ }
9811
+
9812
+ // embedding/regions.ts
9813
+ function hostBackstageRegionId(id) {
9814
+ return `backstage.host.${id}`;
9815
+ }
9816
+ function sameRenderer(a2, b) {
9817
+ if (a2 === b) return true;
9818
+ if (!a2 || !b || typeof a2 !== "object" || typeof b !== "object" || a2.element !== b.element)
9819
+ return false;
9820
+ const left = a2.properties ?? {};
9821
+ const right = b.properties ?? {};
9822
+ const keys = Object.keys(left);
9823
+ return keys.length === Object.keys(right).length && keys.every((key) => Object.is(left[key], right[key]));
9824
+ }
9825
+ function sameRegionContext(a2, b, callbackKeys = /* @__PURE__ */ new Set(["close"])) {
9826
+ const left = a2;
9827
+ const right = b;
9828
+ for (const key of /* @__PURE__ */ new Set([...Object.keys(left), ...Object.keys(right)])) {
9829
+ if (callbackKeys.has(key)) continue;
9830
+ const x = left[key];
9831
+ const y = right[key];
9832
+ if (Array.isArray(x) && Array.isArray(y)) {
9833
+ if (!sameItems(x, y)) return false;
9834
+ } else if (!Object.is(x, y)) return false;
9835
+ }
9836
+ return true;
9837
+ }
9838
+ function sameItems(a2, b) {
9839
+ return a2 === b || a2.length === b.length && a2.every((item, index) => Object.is(item, b[index]));
9840
+ }
9841
+
9610
9842
  // drawingml/index.ts
9611
9843
  var drawingml_exports = {};
9612
9844
  __export(drawingml_exports, {
@@ -46813,4 +47045,4 @@ var EQUATION_GALLERY = [
46813
47045
  }
46814
47046
  ];
46815
47047
 
46816
- export { chart_exports as chart, color_exports as color, diagram_exports as diagram, digest_exports as digest, drawingml_exports as drawingml, geometry_exports as geometry, i18n_exports as i18n, math_exports as math, opc_exports as opc, ribbon_exports as ribbon, text_exports as text, units_exports as units, xml_exports as xml };
47048
+ export { chart_exports as chart, color_exports as color, diagram_exports as diagram, digest_exports as digest, drawingml_exports as drawingml, embedding_exports as embedding, geometry_exports as geometry, i18n_exports as i18n, math_exports as math, opc_exports as opc, ribbon_exports as ribbon, text_exports as text, units_exports as units, xml_exports as xml };
@@ -108144,56 +108144,6 @@ var init_master_roundtrip_writer = __esm({
108144
108144
  }
108145
108145
  });
108146
108146
 
108147
- // pptx/core/ppt/writer/svg-rasterize-node.ts
108148
- function isNodeCanvasModule(value) {
108149
- const candidate = value;
108150
- return typeof candidate?.createCanvas === "function" && typeof candidate.loadImage === "function";
108151
- }
108152
- function loadNodeCanvas() {
108153
- nodeCanvas ??= (async () => {
108154
- const runtime = globalThis.process;
108155
- if (!runtime?.versions?.node) {
108156
- return void 0;
108157
- }
108158
- try {
108159
- const imported = await import(
108160
- /* webpackIgnore: true */
108161
- /* @vite-ignore */
108162
- NODE_CANVAS_SPECIFIER
108163
- );
108164
- const withDefault = imported;
108165
- if (isNodeCanvasModule(imported)) {
108166
- return imported;
108167
- }
108168
- return isNodeCanvasModule(withDefault.default) ? withDefault.default : void 0;
108169
- } catch {
108170
- return void 0;
108171
- }
108172
- })();
108173
- return nodeCanvas;
108174
- }
108175
- async function rasterizeSvgInNode(svg, sizeFor) {
108176
- const canvasModule = await loadNodeCanvas();
108177
- if (!canvasModule) {
108178
- return void 0;
108179
- }
108180
- try {
108181
- const image = await canvasModule.loadImage(svg);
108182
- const { width, height } = sizeFor(image.width, image.height);
108183
- const canvas = canvasModule.createCanvas(width, height);
108184
- canvas.getContext("2d").drawImage(image, 0, 0, width, height);
108185
- return new Uint8Array(canvas.toBuffer("image/png"));
108186
- } catch {
108187
- return void 0;
108188
- }
108189
- }
108190
- var NODE_CANVAS_SPECIFIER, nodeCanvas;
108191
- var init_svg_rasterize_node = __esm({
108192
- "pptx/core/ppt/writer/svg-rasterize-node.ts"() {
108193
- NODE_CANVAS_SPECIFIER = ["@napi-rs", "canvas"].join("/");
108194
- }
108195
- });
108196
-
108197
108147
  // pptx/core/ppt/writer/svg-rasterize.ts
108198
108148
  function hasDomRasteriser() {
108199
108149
  return typeof document !== "undefined" && typeof Image !== "undefined" && typeof URL !== "undefined" && typeof URL.createObjectURL === "function";
@@ -108241,17 +108191,23 @@ async function rasterizeSvgInDom(svg, fallbackW, fallbackH) {
108241
108191
  URL.revokeObjectURL(url2);
108242
108192
  }
108243
108193
  }
108244
- async function rasterizeSvg(svg, fallbackWidthPx, fallbackHeightPx) {
108245
- const png = hasDomRasteriser() ? await rasterizeSvgInDom(svg, fallbackWidthPx, fallbackHeightPx) : await rasterizeSvgInNode(
108246
- svg,
108247
- (w, h2) => svgRasterSize(w, h2, fallbackWidthPx, fallbackHeightPx)
108248
- );
108194
+ async function rasterizeSvg(svg, fallbackWidthPx, fallbackHeightPx, rasterize) {
108195
+ let png;
108196
+ if (rasterize) {
108197
+ const sizeFor = (w, h2) => svgRasterSize(w, h2, fallbackWidthPx, fallbackHeightPx);
108198
+ try {
108199
+ png = await rasterize(svg, sizeFor);
108200
+ } catch {
108201
+ png = void 0;
108202
+ }
108203
+ } else if (hasDomRasteriser()) {
108204
+ png = await rasterizeSvgInDom(svg, fallbackWidthPx, fallbackHeightPx);
108205
+ }
108249
108206
  return png ? { extension: "png", bytes: png } : void 0;
108250
108207
  }
108251
108208
  var MAX_EDGE_PX;
108252
108209
  var init_svg_rasterize = __esm({
108253
108210
  "pptx/core/ppt/writer/svg-rasterize.ts"() {
108254
- init_svg_rasterize_node();
108255
108211
  MAX_EDGE_PX = 2048;
108256
108212
  }
108257
108213
  });
@@ -108294,25 +108250,25 @@ function pathFormat(path3) {
108294
108250
  const ext = /\.([^./\\]+)$/u.exec(path3)?.[1]?.toLowerCase();
108295
108251
  return ext === "jpg" ? "jpeg" : ext === "tif" ? "tiff" : ext;
108296
108252
  }
108297
- async function toPicture(bytes, el) {
108253
+ async function toPicture(bytes, el, options) {
108298
108254
  const format = sniffImageFormat(bytes);
108299
108255
  if (format === "tiff") {
108300
108256
  return tiffToPicture(bytes);
108301
108257
  }
108302
108258
  if (format === "svg") {
108303
- return rasterizeSvg(bytes, el.width || 1, el.height || 1);
108259
+ return rasterizeSvg(bytes, el.width || 1, el.height || 1, options.rasterizeSvg);
108304
108260
  }
108305
108261
  return bytesToPicture(bytes);
108306
108262
  }
108307
- async function resolveOne(el, source, readPart) {
108263
+ async function resolveOne(el, source, readPart, options) {
108308
108264
  const inline = decodeBase64DataUrl(source.inline);
108309
108265
  const inlineFormat = inline ? sniffImageFormat(inline) : void 0;
108310
108266
  const partFormat = source.partPath ? pathFormat(source.partPath) : void 0;
108311
108267
  if (inline && (!partFormat || partFormat === inlineFormat)) {
108312
- return inlineFormat === "tiff" || inlineFormat === "svg" ? toPicture(inline, el) : void 0;
108268
+ return inlineFormat === "tiff" || inlineFormat === "svg" ? toPicture(inline, el, options) : void 0;
108313
108269
  }
108314
108270
  const part = source.partPath ? await readPart(source.partPath) : void 0;
108315
- const fromPart = part ? await toPicture(part, el) : void 0;
108271
+ const fromPart = part ? await toPicture(part, el, options) : void 0;
108316
108272
  if (fromPart) {
108317
108273
  return fromPart;
108318
108274
  }
@@ -108320,14 +108276,14 @@ async function resolveOne(el, source, readPart) {
108320
108276
  return void 0;
108321
108277
  }
108322
108278
  const fetched = await fetchBlobUrl(source.inline);
108323
- const fromFetch = fetched ? await toPicture(fetched, el) : void 0;
108279
+ const fromFetch = fetched ? await toPicture(fetched, el, options) : void 0;
108324
108280
  if (fromFetch || !source.svgPath) {
108325
108281
  return fromFetch;
108326
108282
  }
108327
108283
  const svg = await readPart(source.svgPath);
108328
- return svg ? rasterizeSvg(svg, el.width || 1, el.height || 1) : void 0;
108284
+ return svg ? rasterizeSvg(svg, el.width || 1, el.height || 1, options.rasterizeSvg) : void 0;
108329
108285
  }
108330
- async function resolvePictureSources(slides, readPart) {
108286
+ async function resolvePictureSources(slides, readPart, options = {}) {
108331
108287
  const pending = [];
108332
108288
  const walk3 = (elements3) => {
108333
108289
  for (const el of elements3) {
@@ -108345,7 +108301,7 @@ async function resolvePictureSources(slides, readPart) {
108345
108301
  const resolved = /* @__PURE__ */ new Map();
108346
108302
  await Promise.all(
108347
108303
  pending.map(async ([el, source]) => {
108348
- const picture = await resolveOne(el, source, readPart);
108304
+ const picture = await resolveOne(el, source, readPart, options);
108349
108305
  if (picture) {
108350
108306
  resolved.set(el, picture);
108351
108307
  }
@@ -134339,7 +134295,8 @@ var init_PptxHandlerRuntimeSaveLegacyPpt = __esm({
134339
134295
  * Serialise `slides` to a legacy binary PowerPoint 97-2003 (`.ppt`) file.
134340
134296
  *
134341
134297
  * @param slides - The (possibly mutated) live slide array.
134342
- * @param options - Only `pptPassword` is consulted; every OOXML-specific
134298
+ * @param options - `pptPassword` and `rasterizeSvg` (the `.ppt`-only
134299
+ * options), `customShows` and `slideMasters`; every OOXML-specific
134343
134300
  * option (conformance, embedded fonts, table styles, ...) has no binary
134344
134301
  * `.ppt` counterpart and is ignored.
134345
134302
  * @param saveAsPptx - Serialises the same slides as a Transitional `.pptx`
@@ -134355,7 +134312,8 @@ var init_PptxHandlerRuntimeSaveLegacyPpt = __esm({
134355
134312
  const resolvedMedia = await this.resolveAudioMediaBytes(slides);
134356
134313
  const resolvedPictures = await resolvePictureSources(
134357
134314
  slides,
134358
- async (path3) => this.zip.file(path3)?.async("uint8array")
134315
+ async (path3) => this.zip.file(path3)?.async("uint8array"),
134316
+ { rasterizeSvg: options?.rasterizeSvg }
134359
134317
  );
134360
134318
  const deck = convertDeckToWriteModel(
134361
134319
  slides,
@@ -1,9 +1,10 @@
1
1
  import { r as TextSegment } from "../chunks/text-D49FKllA.js";
2
2
  import { t as PptxThemeColorRef } from "../chunks/color-ref-DT599vEx.js";
3
3
  import { $ as ParsedTableStyleFill, Jt as PptxChartMarkerSymbol, Lt as PptxChartErrBars, Z as ParsedTableStyleBorders, _ as PptxElementWithText, at as ParsedTableStyleText, ir as ShapeStyle, m as PptxElement, pn as PptxChartUserShape, st as PptxTableCell3D, t as ChartPptxElement } from "../chunks/elements-iUzpAeqR.js";
4
- import { $i as TableStylePartName, Gd as OleNestedDeckSlideDetail, cf as OlePayloadEditorKind, if as OleSheetGrid } from "../chunks/index-Q5mM8kIR.js";
4
+ import { $i as TableStylePartName, Gd as OleNestedDeckSlideDetail, cf as OlePayloadEditorKind, if as OleSheetGrid } from "../chunks/index-4FmgJajb.js";
5
5
  import { C as PptxSlide, Ct as PptxCustomProperty, St as PptxCoreProperties, ct as PptxThemeColorScheme, d as PptxData, ft as PptxThemeFontScheme, vt as PptxAppProperties, x as PptxPresentationProperties } from "../chunks/text-operations-CfLVZ7DK.js";
6
- import { C as PptxJsonAssetStats, tn as ChartAxisEdit, yt as PresentationDiff } from "../chunks/index-CPhsd7Df.js";
6
+ import { A as PresentationDiff, ft as ChartAxisEdit } from "../chunks/index-nKQ4s7FA.js";
7
+ import { C as PptxJsonAssetStats } from "../chunks/index-C3xhAMSa.js";
7
8
  import { d as ZodType, g as $ZodTypeInternals, h as $ZodShape, m as output, s as ZodObject } from "../chunks/schemas-fuDGetRe.js";
8
9
  import { Doc, Text } from "yjs";
9
10
  declare namespace types_d_exports {