@superdoc-dev/cli 0.8.0-next.113 → 0.8.0-next.114

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 (2) hide show
  1. package/dist/index.js +40 -59
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -66320,7 +66320,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
66320
66320
  emptyOptions2 = {};
66321
66321
  });
66322
66322
 
66323
- // ../../packages/superdoc/dist/chunks/SuperConverter-8A1MBmqJ.es.js
66323
+ // ../../packages/superdoc/dist/chunks/SuperConverter-uW-eKBtZ.es.js
66324
66324
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
66325
66325
  const fieldValue = extension$1.config[field];
66326
66326
  if (typeof fieldValue === "function")
@@ -103351,46 +103351,24 @@ function getBibliographyPartExportPaths(bibliographyPart) {
103351
103351
  bibliographyPart?.itemRelsPath
103352
103352
  ].filter((path2) => typeof path2 === "string" && path2.length > 0);
103353
103353
  }
103354
- function collectReferencedNumIds(convertedXml) {
103355
- const numIds = /* @__PURE__ */ new Set;
103356
- function walkElements$1(elements) {
103357
- if (!Array.isArray(elements))
103358
- return;
103359
- for (const el of elements) {
103360
- if (!el || typeof el !== "object")
103361
- continue;
103362
- if (el.name === "w:numId" && el.attributes?.["w:val"] != null)
103363
- numIds.add(Number(el.attributes["w:val"]));
103364
- if (el.elements)
103365
- walkElements$1(el.elements);
103366
- }
103367
- }
103368
- for (const [path2, xml] of Object.entries(convertedXml))
103369
- if (path2.startsWith("word/") && path2 !== "word/numbering.xml" && xml?.elements)
103370
- walkElements$1(xml.elements);
103371
- return numIds;
103372
- }
103373
- function getAbstractNumIdFromDef(numDef) {
103374
- const abstractEl = numDef.elements?.find((el) => el.name === "w:abstractNumId");
103375
- if (abstractEl?.attributes?.["w:val"] != null)
103376
- return Number(abstractEl.attributes["w:val"]);
103377
- }
103378
- function filterOrphanedNumberingDefinitions(numbering, referencedNumIds) {
103379
- const liveDefinitions = Object.values(numbering.definitions).filter((def) => referencedNumIds.has(Number(def.attributes?.["w:numId"])));
103380
- const referencedAbstractIds = /* @__PURE__ */ new Set;
103381
- for (const def of liveDefinitions) {
103382
- const abstractId = getAbstractNumIdFromDef(def);
103383
- if (abstractId != null)
103384
- referencedAbstractIds.add(abstractId);
103385
- }
103386
- return {
103387
- liveAbstracts: Object.values(numbering.abstracts).filter((abs2) => referencedAbstractIds.has(Number(abs2.attributes?.["w:abstractNumId"]))),
103388
- liveDefinitions
103389
- };
103390
- }
103391
103354
  function generateCustomXml() {
103392
103355
  return DEFAULT_CUSTOM_XML;
103393
103356
  }
103357
+ function hasBodyNumberingReferences(documentXml) {
103358
+ if (!documentXml || typeof documentXml !== "object")
103359
+ return false;
103360
+ const stack = Array.isArray(documentXml.elements) ? [...documentXml.elements] : [];
103361
+ while (stack.length) {
103362
+ const node3 = stack.pop();
103363
+ if (!node3 || typeof node3 !== "object")
103364
+ continue;
103365
+ if (node3.name === "w:numPr")
103366
+ return true;
103367
+ if (Array.isArray(node3.elements))
103368
+ stack.push(...node3.elements);
103369
+ }
103370
+ return false;
103371
+ }
103394
103372
  var isRegExp = (value) => {
103395
103373
  return Object.prototype.toString.call(value) === "[object RegExp]";
103396
103374
  }, dist_default$1, Fragment = class Fragment2 {
@@ -120095,7 +120073,7 @@ var isRegExp = (value) => {
120095
120073
  state.kern = kernNode.attributes["w:val"];
120096
120074
  }
120097
120075
  }, SuperConverter;
120098
- var init_SuperConverter_8A1MBmqJ_es = __esm(() => {
120076
+ var init_SuperConverter_uW_eKBtZ_es = __esm(() => {
120099
120077
  init_rolldown_runtime_Bg48TavK_es();
120100
120078
  init_jszip_C49i9kUs_es();
120101
120079
  init_xml_js_CqGKpaft_es();
@@ -157877,14 +157855,17 @@ var init_SuperConverter_8A1MBmqJ_es = __esm(() => {
157877
157855
  }
157878
157856
  #exportNumberingFile() {
157879
157857
  const numberingPath = "word/numbering.xml";
157858
+ const sourceHadNumberingXml = Boolean(this.convertedXml[numberingPath]);
157880
157859
  let numberingXml = this.convertedXml[numberingPath];
157881
157860
  if (!numberingXml)
157882
157861
  numberingXml = baseNumbering;
157883
157862
  const currentNumberingXml = numberingXml.elements[0];
157884
- const referencedNumIds = collectReferencedNumIds(this.convertedXml);
157863
+ if (!sourceHadNumberingXml && !hasBodyNumberingReferences(this.convertedXml["word/document.xml"]))
157864
+ return;
157885
157865
  if (this.numbering?.definitions && this.numbering?.abstracts) {
157886
- const { liveAbstracts, liveDefinitions } = filterOrphanedNumberingDefinitions(this.numbering, referencedNumIds);
157887
- currentNumberingXml.elements = [...liveAbstracts, ...liveDefinitions];
157866
+ const abstracts = Object.values(this.numbering.abstracts);
157867
+ const definitions = Object.values(this.numbering.definitions);
157868
+ currentNumberingXml.elements = [...abstracts, ...definitions];
157888
157869
  } else
157889
157870
  currentNumberingXml.elements = [];
157890
157871
  this.convertedXml[numberingPath] = numberingXml;
@@ -158085,7 +158066,7 @@ var init_SuperConverter_8A1MBmqJ_es = __esm(() => {
158085
158066
  };
158086
158067
  });
158087
158068
 
158088
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-1RfXz7Wm.es.js
158069
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-DanjyDw8.es.js
158089
158070
  function parseSizeUnit(val = "0") {
158090
158071
  const length3 = val.toString() || "0";
158091
158072
  const value = Number.parseFloat(length3);
@@ -160807,8 +160788,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
160807
160788
  }
160808
160789
  };
160809
160790
  };
160810
- var init_create_headless_toolbar_1RfXz7Wm_es = __esm(() => {
160811
- init_SuperConverter_8A1MBmqJ_es();
160791
+ var init_create_headless_toolbar_DanjyDw8_es = __esm(() => {
160792
+ init_SuperConverter_uW_eKBtZ_es();
160812
160793
  init_constants_DrU4EASo_es();
160813
160794
  init_dist_B8HfvhaK_es();
160814
160795
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -209519,7 +209500,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
209519
209500
  init_remark_gfm_BhnWr3yf_es();
209520
209501
  });
209521
209502
 
209522
- // ../../packages/superdoc/dist/chunks/src-Bnec7ggt.es.js
209503
+ // ../../packages/superdoc/dist/chunks/src-COP-2qVr.es.js
209523
209504
  function deleteProps(obj, propOrProps) {
209524
209505
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
209525
209506
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -303987,13 +303968,13 @@ menclose::after {
303987
303968
  return;
303988
303969
  console.log(...args$1);
303989
303970
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
303990
- var init_src_Bnec7ggt_es = __esm(() => {
303971
+ var init_src_COP_2qVr_es = __esm(() => {
303991
303972
  init_rolldown_runtime_Bg48TavK_es();
303992
- init_SuperConverter_8A1MBmqJ_es();
303973
+ init_SuperConverter_uW_eKBtZ_es();
303993
303974
  init_jszip_C49i9kUs_es();
303994
303975
  init_xml_js_CqGKpaft_es();
303995
303976
  init_uuid_qzgm05fK_es();
303996
- init_create_headless_toolbar_1RfXz7Wm_es();
303977
+ init_create_headless_toolbar_DanjyDw8_es();
303997
303978
  init_constants_DrU4EASo_es();
303998
303979
  init_dist_B8HfvhaK_es();
303999
303980
  init_unified_Dsuw2be5_es();
@@ -329860,7 +329841,7 @@ function print() { __p += __j.call(arguments, '') }
329860
329841
  }
329861
329842
  });
329862
329843
  const numberingData = this.converter.convertedXml["word/numbering.xml"];
329863
- const numbering = this.converter.schemaToXml(numberingData.elements[0]);
329844
+ const numbering = numberingData?.elements?.[0] ? this.converter.schemaToXml(numberingData.elements[0]) : null;
329864
329845
  const appXmlData = this.converter.convertedXml["docProps/app.xml"];
329865
329846
  const appXml = appXmlData?.elements?.[0] ? this.converter.schemaToXml(appXmlData.elements[0]) : null;
329866
329847
  const coreXmlData = this.converter.convertedXml["docProps/core.xml"];
@@ -329870,7 +329851,7 @@ function print() { __p += __j.call(arguments, '') }
329870
329851
  "word/document.xml": String(documentXml),
329871
329852
  "docProps/custom.xml": String(customXml),
329872
329853
  "word/_rels/document.xml.rels": String(rels),
329873
- "word/numbering.xml": String(numbering),
329854
+ ...numbering ? { "word/numbering.xml": String(numbering) } : {},
329874
329855
  "word/styles.xml": String(styles),
329875
329856
  ...updatedHeadersFooters,
329876
329857
  ...appXml ? { "docProps/app.xml": String(appXml) } : {},
@@ -342058,11 +342039,11 @@ function print() { __p += __j.call(arguments, '') }
342058
342039
  ];
342059
342040
  });
342060
342041
 
342061
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BLwvPPRc.es.js
342042
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-UV-HR537.es.js
342062
342043
  var MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
342063
- var init_create_super_doc_ui_BLwvPPRc_es = __esm(() => {
342064
- init_SuperConverter_8A1MBmqJ_es();
342065
- init_create_headless_toolbar_1RfXz7Wm_es();
342044
+ var init_create_super_doc_ui_UV_HR537_es = __esm(() => {
342045
+ init_SuperConverter_uW_eKBtZ_es();
342046
+ init_create_headless_toolbar_DanjyDw8_es();
342066
342047
  MOD_ALIASES = new Set([
342067
342048
  "Mod",
342068
342049
  "Meta",
@@ -342104,16 +342085,16 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
342104
342085
 
342105
342086
  // ../../packages/superdoc/dist/super-editor.es.js
342106
342087
  var init_super_editor_es = __esm(() => {
342107
- init_src_Bnec7ggt_es();
342108
- init_SuperConverter_8A1MBmqJ_es();
342088
+ init_src_COP_2qVr_es();
342089
+ init_SuperConverter_uW_eKBtZ_es();
342109
342090
  init_jszip_C49i9kUs_es();
342110
342091
  init_xml_js_CqGKpaft_es();
342111
- init_create_headless_toolbar_1RfXz7Wm_es();
342092
+ init_create_headless_toolbar_DanjyDw8_es();
342112
342093
  init_constants_DrU4EASo_es();
342113
342094
  init_dist_B8HfvhaK_es();
342114
342095
  init_unified_Dsuw2be5_es();
342115
342096
  init_DocxZipper_Bphhij1P_es();
342116
- init_create_super_doc_ui_BLwvPPRc_es();
342097
+ init_create_super_doc_ui_UV_HR537_es();
342117
342098
  init_ui_CGB3qmy3_es();
342118
342099
  init_eventemitter3_UwU_CLPU_es();
342119
342100
  init_errors_C_DoKMoN_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.8.0-next.113",
3
+ "version": "0.8.0-next.114",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -34,11 +34,11 @@
34
34
  "access": "public"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.113",
38
- "@superdoc-dev/cli-darwin-x64": "0.8.0-next.113",
39
- "@superdoc-dev/cli-windows-x64": "0.8.0-next.113",
40
- "@superdoc-dev/cli-linux-x64": "0.8.0-next.113",
41
- "@superdoc-dev/cli-linux-arm64": "0.8.0-next.113"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.114",
38
+ "@superdoc-dev/cli-darwin-x64": "0.8.0-next.114",
39
+ "@superdoc-dev/cli-windows-x64": "0.8.0-next.114",
40
+ "@superdoc-dev/cli-linux-x64": "0.8.0-next.114",
41
+ "@superdoc-dev/cli-linux-arm64": "0.8.0-next.114"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",