@superdoc-dev/cli 0.8.0-next.77 → 0.8.0-next.78

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 +76 -27
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -65823,7 +65823,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
65823
65823
  emptyOptions2 = {};
65824
65824
  });
65825
65825
 
65826
- // ../../packages/superdoc/dist/chunks/SuperConverter-ing-1fvK.es.js
65826
+ // ../../packages/superdoc/dist/chunks/SuperConverter-BLL9JGke.es.js
65827
65827
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
65828
65828
  const fieldValue = extension$1.config[field];
65829
65829
  if (typeof fieldValue === "function")
@@ -109625,13 +109625,14 @@ var isRegExp = (value) => {
109625
109625
  default:
109626
109626
  return null;
109627
109627
  }
109628
- }, SKIP_FIELD_PROCESSING_NODE_NAMES$1, shouldSkipFieldProcessing$1 = (node3) => SKIP_FIELD_PROCESSING_NODE_NAMES$1.has(node3?.name), preProcessNodesForFldChar = (nodes = [], docx) => {
109628
+ }, TRACK_CHANGE_ELEMENT_NAMES, TRANSLATED_TRACK_CHANGE_ELEMENT_NAMES, isTrackChangeElement = (node3) => TRACK_CHANGE_ELEMENT_NAMES.has(node3?.name), isTranslatedTrackChangeElement = (node3) => TRANSLATED_TRACK_CHANGE_ELEMENT_NAMES.has(node3?.name), SKIP_FIELD_PROCESSING_NODE_NAMES$1, shouldSkipFieldProcessing$1 = (node3) => SKIP_FIELD_PROCESSING_NODE_NAMES$1.has(node3?.name), preProcessNodesForFldChar = (nodes = [], docx) => {
109629
109629
  const processedNodes = [];
109630
109630
  let collectedNodesStack = [];
109631
109631
  let rawCollectedNodesStack = [];
109632
109632
  let fieldRunRPrStack = [];
109633
109633
  let currentFieldStack = [];
109634
109634
  let unpairedEnd = null;
109635
+ let unpairedEndPreserveRaw = null;
109635
109636
  let collecting = false;
109636
109637
  const rawNodeSourceTokens = /* @__PURE__ */ new WeakMap;
109637
109638
  const finalizeField = () => {
@@ -109640,8 +109641,11 @@ var isRegExp = (value) => {
109640
109641
  const rawCollectedNodes = rawCollectedNodesStack.pop().filter((n) => n !== null);
109641
109642
  const fieldRunRPr = fieldRunRPrStack.pop() ?? null;
109642
109643
  const currentField = currentFieldStack.pop();
109643
- const combinedResult = _processCombinedNodesForFldChar(collectedNodes, currentField.instrText.trim(), docx, currentField.instructionTokens, fieldRunRPr);
109644
- const outputNodes = combinedResult.handled ? combinedResult.nodes : rawCollectedNodes;
109644
+ let outputNodes = rawCollectedNodes;
109645
+ if (!currentField.preserveRaw) {
109646
+ const combinedResult = _processCombinedNodesForFldChar(collectedNodes, currentField.instrText.trim(), docx, currentField.instructionTokens, fieldRunRPr);
109647
+ outputNodes = combinedResult.handled ? combinedResult.nodes : rawCollectedNodes;
109648
+ }
109645
109649
  if (collectedNodesStack.length === 0)
109646
109650
  processedNodes.push(...outputNodes);
109647
109651
  else {
@@ -109749,7 +109753,10 @@ var isRegExp = (value) => {
109749
109753
  node3.elements = childResult.processedNodes;
109750
109754
  if (childResult.unpairedBegin)
109751
109755
  childResult.unpairedBegin.forEach((pendingField) => {
109752
- currentFieldStack.push(pendingField.fieldInfo);
109756
+ const fieldInfo = { ...pendingField.fieldInfo };
109757
+ if (fieldInfo.preserveRaw || isTrackChangeElement(node3))
109758
+ fieldInfo.preserveRaw = true;
109759
+ currentFieldStack.push(fieldInfo);
109753
109760
  collectedNodesStack.push([node3]);
109754
109761
  const rawStack = [rawNode];
109755
109762
  rawCollectedNodesStack.push(rawStack);
@@ -109757,6 +109764,16 @@ var isRegExp = (value) => {
109757
109764
  capturedRawNodes.add(rawNode);
109758
109765
  });
109759
109766
  else if (childResult.unpairedEnd) {
109767
+ const shouldPreserveRaw = childResult.unpairedEndPreserveRaw || isTrackChangeElement(node3);
109768
+ if (collectedNodesStack.length === 0) {
109769
+ processedNodes.push(shouldPreserveRaw ? rawNode : node3);
109770
+ unpairedEnd = true;
109771
+ if (shouldPreserveRaw)
109772
+ unpairedEndPreserveRaw = true;
109773
+ return;
109774
+ }
109775
+ if (shouldPreserveRaw)
109776
+ currentFieldStack[currentFieldStack.length - 1].preserveRaw = true;
109760
109777
  collectedNodesStack[collectedNodesStack.length - 1].push(node3);
109761
109778
  captureRawNodeForCurrentField(rawNode, capturedRawNodes, rawSourceToken);
109762
109779
  finalizeField();
@@ -109795,7 +109812,8 @@ var isRegExp = (value) => {
109795
109812
  return {
109796
109813
  processedNodes,
109797
109814
  unpairedBegin,
109798
- unpairedEnd
109815
+ unpairedEnd,
109816
+ unpairedEndPreserveRaw
109799
109817
  };
109800
109818
  }, _processCombinedNodesForFldChar = (nodesToCombine = [], instrText, docx, instructionTokens, fieldRunRPr) => {
109801
109819
  const instructionType = instrText.trim().split(" ")[0];
@@ -115977,10 +115995,10 @@ var isRegExp = (value) => {
115977
115995
  }
115978
115996
  });
115979
115997
  return subs;
115980
- }, config$5, translator$81, isTrackChangeElement = (node3) => node3?.name === "w:del" || node3?.name === "w:ins", unwrapTrackChangeNode = (node3) => {
115998
+ }, config$5, translator$81, unwrapTrackChangeNode = (node3) => {
115981
115999
  if (!node3)
115982
116000
  return null;
115983
- if (isTrackChangeElement(node3))
116001
+ if (isTranslatedTrackChangeElement(node3))
115984
116002
  return node3;
115985
116003
  if (node3.name === "w:sdt") {
115986
116004
  const content$2 = node3.elements?.find((element) => element.name === "w:sdtContent");
@@ -117415,11 +117433,11 @@ var isRegExp = (value) => {
117415
117433
  };
117416
117434
  return nodeListHandlerFn;
117417
117435
  }, DEFAULT_SECTION_PROPS, importHeadersFooters = (docx, converter, mainEditor, numbering, translatedNumbering, translatedLinkedStyles) => {
117418
- const { elements } = docx["word/_rels/document.xml.rels"]?.elements.find((el) => el.name === "Relationships") || { elements: [] };
117436
+ const elements = docx["word/_rels/document.xml.rels"]?.elements?.find((el) => el.name === "Relationships")?.elements ?? [];
117419
117437
  const headerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header";
117420
117438
  const footerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";
117421
- const headers = elements.filter((el) => el.attributes["Type"] === headerType);
117422
- const footers = elements.filter((el) => el.attributes["Type"] === footerType);
117439
+ const headers = elements.filter((el) => el.attributes?.["Type"] === headerType);
117440
+ const footers = elements.filter((el) => el.attributes?.["Type"] === footerType);
117423
117441
  const allSectPrElements = (findSectPr(docx["word/document.xml"]) || []).flatMap((el) => el.elements);
117424
117442
  if (!mainEditor)
117425
117443
  return;
@@ -118393,7 +118411,7 @@ var isRegExp = (value) => {
118393
118411
  state.kern = kernNode.attributes["w:val"];
118394
118412
  }
118395
118413
  }, SuperConverter;
118396
- var init_SuperConverter_ing_1fvK_es = __esm(() => {
118414
+ var init_SuperConverter_BLL9JGke_es = __esm(() => {
118397
118415
  init_rolldown_runtime_Bg48TavK_es();
118398
118416
  init_jszip_C49i9kUs_es();
118399
118417
  init_xml_js_CqGKpaft_es();
@@ -146303,6 +146321,13 @@ var init_SuperConverter_ing_1fvK_es = __esm(() => {
146303
146321
  })(UTIF, pako$1);
146304
146322
  })();
146305
146323
  }))(), 1);
146324
+ TRACK_CHANGE_ELEMENT_NAMES = new Set([
146325
+ "w:del",
146326
+ "w:ins",
146327
+ "w:moveFrom",
146328
+ "w:moveTo"
146329
+ ]);
146330
+ TRANSLATED_TRACK_CHANGE_ELEMENT_NAMES = new Set(["w:del", "w:ins"]);
146306
146331
  SKIP_FIELD_PROCESSING_NODE_NAMES$1 = new Set(["w:drawing", "w:pict"]);
146307
146332
  FIELD_CONTROL_ELEMENT_NAMES = new Set(["w:fldChar"]);
146308
146333
  INSTRUCTION_ELEMENT_NAMES = new Set(["w:instrText", "w:tab"]);
@@ -155994,7 +156019,7 @@ var init_SuperConverter_ing_1fvK_es = __esm(() => {
155994
156019
  };
155995
156020
  });
155996
156021
 
155997
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-CUl2z6Fd.es.js
156022
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-D7n_Okb2.es.js
155998
156023
  function parseSizeUnit(val = "0") {
155999
156024
  const length3 = val.toString() || "0";
156000
156025
  const value = Number.parseFloat(length3);
@@ -158647,8 +158672,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
158647
158672
  }
158648
158673
  };
158649
158674
  };
158650
- var init_create_headless_toolbar_CUl2z6Fd_es = __esm(() => {
158651
- init_SuperConverter_ing_1fvK_es();
158675
+ var init_create_headless_toolbar_D7n_Okb2_es = __esm(() => {
158676
+ init_SuperConverter_BLL9JGke_es();
158652
158677
  init_constants_DrU4EASo_es();
158653
158678
  init_dist_B8HfvhaK_es();
158654
158679
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -207334,7 +207359,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
207334
207359
  init_remark_gfm_BhnWr3yf_es();
207335
207360
  });
207336
207361
 
207337
- // ../../packages/superdoc/dist/chunks/src-deKdT-sq.es.js
207362
+ // ../../packages/superdoc/dist/chunks/src-C4h4xIas.es.js
207338
207363
  function deleteProps(obj, propOrProps) {
207339
207364
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
207340
207365
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -262083,6 +262108,30 @@ function handleDocumentPartObjectNode(node3, context) {
262083
262108
  }
262084
262109
  if (sectionState)
262085
262110
  sectionState.currentParagraphIndex++;
262111
+ } else if (child.type === "tableOfContents" && Array.isArray(child.content)) {
262112
+ const metadata = {
262113
+ docPartGallery: docPartGallery ?? "",
262114
+ docPartObjectId,
262115
+ tocInstruction: getNodeInstruction(child) ?? tocInstruction,
262116
+ sdtMetadata: docPartSdtMetadata
262117
+ };
262118
+ const tocContext = {
262119
+ nextBlockId,
262120
+ positions,
262121
+ bookmarks,
262122
+ hyperlinkConfig,
262123
+ enableComments,
262124
+ trackedChangesConfig,
262125
+ themeColors,
262126
+ converters: converters$1,
262127
+ converterContext,
262128
+ sectionState
262129
+ };
262130
+ const output = {
262131
+ blocks: blocks2,
262132
+ recordBlockKind
262133
+ };
262134
+ processTocChildren(child.content, metadata, tocContext, output);
262086
262135
  }
262087
262136
  }
262088
262137
  }
@@ -299208,12 +299257,12 @@ menclose::after {
299208
299257
  return;
299209
299258
  console.log(...args$1);
299210
299259
  }, 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;
299211
- var init_src_deKdT_sq_es = __esm(() => {
299260
+ var init_src_C4h4xIas_es = __esm(() => {
299212
299261
  init_rolldown_runtime_Bg48TavK_es();
299213
- init_SuperConverter_ing_1fvK_es();
299262
+ init_SuperConverter_BLL9JGke_es();
299214
299263
  init_jszip_C49i9kUs_es();
299215
299264
  init_uuid_qzgm05fK_es();
299216
- init_create_headless_toolbar_CUl2z6Fd_es();
299265
+ init_create_headless_toolbar_D7n_Okb2_es();
299217
299266
  init_constants_DrU4EASo_es();
299218
299267
  init_dist_B8HfvhaK_es();
299219
299268
  init_unified_Dsuw2be5_es();
@@ -336751,11 +336800,11 @@ function print() { __p += __j.call(arguments, '') }
336751
336800
  ];
336752
336801
  });
336753
336802
 
336754
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-C-wMmL5m.es.js
336803
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BTCvkLyW.es.js
336755
336804
  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;
336756
- var init_create_super_doc_ui_C_wMmL5m_es = __esm(() => {
336757
- init_SuperConverter_ing_1fvK_es();
336758
- init_create_headless_toolbar_CUl2z6Fd_es();
336805
+ var init_create_super_doc_ui_BTCvkLyW_es = __esm(() => {
336806
+ init_SuperConverter_BLL9JGke_es();
336807
+ init_create_headless_toolbar_D7n_Okb2_es();
336759
336808
  MOD_ALIASES = new Set([
336760
336809
  "Mod",
336761
336810
  "Meta",
@@ -336797,16 +336846,16 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
336797
336846
 
336798
336847
  // ../../packages/superdoc/dist/super-editor.es.js
336799
336848
  var init_super_editor_es = __esm(() => {
336800
- init_src_deKdT_sq_es();
336801
- init_SuperConverter_ing_1fvK_es();
336849
+ init_src_C4h4xIas_es();
336850
+ init_SuperConverter_BLL9JGke_es();
336802
336851
  init_jszip_C49i9kUs_es();
336803
336852
  init_xml_js_CqGKpaft_es();
336804
- init_create_headless_toolbar_CUl2z6Fd_es();
336853
+ init_create_headless_toolbar_D7n_Okb2_es();
336805
336854
  init_constants_DrU4EASo_es();
336806
336855
  init_dist_B8HfvhaK_es();
336807
336856
  init_unified_Dsuw2be5_es();
336808
336857
  init_DocxZipper_CUX64E5K_es();
336809
- init_create_super_doc_ui_C_wMmL5m_es();
336858
+ init_create_super_doc_ui_BTCvkLyW_es();
336810
336859
  init_ui_CGB3qmy3_es();
336811
336860
  init_eventemitter3_UwU_CLPU_es();
336812
336861
  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.77",
3
+ "version": "0.8.0-next.78",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -25,20 +25,20 @@
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
27
  "@superdoc/document-api": "0.0.1",
28
+ "@superdoc/pm-adapter": "0.0.0",
28
29
  "superdoc": "1.31.0",
29
- "@superdoc/super-editor": "0.0.1",
30
- "@superdoc/pm-adapter": "0.0.0"
30
+ "@superdoc/super-editor": "0.0.1"
31
31
  },
32
32
  "module": "src/index.ts",
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.77",
38
- "@superdoc-dev/cli-linux-x64": "0.8.0-next.77",
39
- "@superdoc-dev/cli-linux-arm64": "0.8.0-next.77",
40
- "@superdoc-dev/cli-darwin-x64": "0.8.0-next.77",
41
- "@superdoc-dev/cli-windows-x64": "0.8.0-next.77"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.78",
38
+ "@superdoc-dev/cli-darwin-x64": "0.8.0-next.78",
39
+ "@superdoc-dev/cli-linux-x64": "0.8.0-next.78",
40
+ "@superdoc-dev/cli-windows-x64": "0.8.0-next.78",
41
+ "@superdoc-dev/cli-linux-arm64": "0.8.0-next.78"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",