@superdoc-dev/cli 0.8.0-next.90 → 0.8.0-next.91

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 +64 -25
  2. package/package.json +9 -9
package/dist/index.js CHANGED
@@ -66095,7 +66095,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
66095
66095
  emptyOptions2 = {};
66096
66096
  });
66097
66097
 
66098
- // ../../packages/superdoc/dist/chunks/SuperConverter-CcvDw1Yc.es.js
66098
+ // ../../packages/superdoc/dist/chunks/SuperConverter-BInxZk0I.es.js
66099
66099
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
66100
66100
  const fieldValue = extension$1.config[field];
66101
66101
  if (typeof fieldValue === "function")
@@ -118413,12 +118413,22 @@ var isRegExp = (value) => {
118413
118413
  if (rawValue == null)
118414
118414
  return true;
118415
118415
  return ST_ON_OFF_TRUE_VALUES.has(String(rawValue).trim().toLowerCase());
118416
+ }, resolveEvenAndOddHeadersFromSettingsPart = (settingsPart) => {
118417
+ if (!settingsPart || typeof settingsPart !== "object")
118418
+ return null;
118419
+ const part = settingsPart;
118420
+ const settingsRoot = part.name === "w:settings" ? part : part.elements?.find((entry) => entry?.name === "w:settings");
118421
+ if (!settingsRoot?.elements?.length)
118422
+ return null;
118423
+ const evenOdd = settingsRoot.elements.find((el) => el?.name === "w:evenAndOddHeaders");
118424
+ if (!evenOdd)
118425
+ return null;
118426
+ return isStOnOffEnabled(evenOdd);
118416
118427
  }, isAlternatingHeadersOddEven = (docx) => {
118417
118428
  const settings = docx["word/settings.xml"];
118418
- if (!settings || !settings.elements?.length)
118429
+ if (!settings)
118419
118430
  return false;
118420
- const { elements = [] } = settings.elements[0];
118421
- return isStOnOffEnabled(elements.find((el) => el.name === "w:evenAndOddHeaders"));
118431
+ return resolveEvenAndOddHeadersFromSettingsPart(settings) ?? false;
118422
118432
  }, FULL_WIDTH_PT = "468pt", FULL_WIDTH_PT_VALUE = 468, PX_PER_PT = 1.33, XML_NODE_NAME = "w:pict", SD_NODE_NAME, validXmlAttributes, config, translator$29, DEFAULT_SECTION_PROPS_TWIPS, ensureSectionLayoutDefaults = (sectPr, converter) => {
118423
118433
  if (!sectPr)
118424
118434
  return {
@@ -119280,7 +119290,7 @@ var isRegExp = (value) => {
119280
119290
  state.kern = kernNode.attributes["w:val"];
119281
119291
  }
119282
119292
  }, SuperConverter;
119283
- var init_SuperConverter_CcvDw1Yc_es = __esm(() => {
119293
+ var init_SuperConverter_BInxZk0I_es = __esm(() => {
119284
119294
  init_rolldown_runtime_Bg48TavK_es();
119285
119295
  init_jszip_C49i9kUs_es();
119286
119296
  init_xml_js_CqGKpaft_es();
@@ -157149,7 +157159,7 @@ var init_SuperConverter_CcvDw1Yc_es = __esm(() => {
157149
157159
  };
157150
157160
  });
157151
157161
 
157152
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-D5yv7LyN.es.js
157162
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-rUh3xIsa.es.js
157153
157163
  function parseSizeUnit(val = "0") {
157154
157164
  const length3 = val.toString() || "0";
157155
157165
  const value = Number.parseFloat(length3);
@@ -159816,8 +159826,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
159816
159826
  }
159817
159827
  };
159818
159828
  };
159819
- var init_create_headless_toolbar_D5yv7LyN_es = __esm(() => {
159820
- init_SuperConverter_CcvDw1Yc_es();
159829
+ var init_create_headless_toolbar_rUh3xIsa_es = __esm(() => {
159830
+ init_SuperConverter_BInxZk0I_es();
159821
159831
  init_constants_DrU4EASo_es();
159822
159832
  init_dist_B8HfvhaK_es();
159823
159833
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -208514,7 +208524,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
208514
208524
  init_remark_gfm_BhnWr3yf_es();
208515
208525
  });
208516
208526
 
208517
- // ../../packages/superdoc/dist/chunks/src-BpYr_7Wm.es.js
208527
+ // ../../packages/superdoc/dist/chunks/src-DFx5wrK0.es.js
208518
208528
  function deleteProps(obj, propOrProps) {
208519
208529
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
208520
208530
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -300473,8 +300483,8 @@ menclose::after {
300473
300483
  get manager() {
300474
300484
  return this.#headerFooterManager;
300475
300485
  }
300476
- refreshStructure() {
300477
- this.#headerFooterManager?.refresh();
300486
+ refreshStructure(options) {
300487
+ this.#headerFooterManager?.refresh(options?.purgeCachedEditors ? { purgeCachedEditors: true } : undefined);
300478
300488
  this.#headerFooterAdapter?.invalidateAll();
300479
300489
  }
300480
300490
  invalidateLayoutForRefs(refIds) {
@@ -302067,12 +302077,12 @@ menclose::after {
302067
302077
  return;
302068
302078
  console.log(...args$1);
302069
302079
  }, 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;
302070
- var init_src_BpYr_7Wm_es = __esm(() => {
302080
+ var init_src_DFx5wrK0_es = __esm(() => {
302071
302081
  init_rolldown_runtime_Bg48TavK_es();
302072
- init_SuperConverter_CcvDw1Yc_es();
302082
+ init_SuperConverter_BInxZk0I_es();
302073
302083
  init_jszip_C49i9kUs_es();
302074
302084
  init_uuid_qzgm05fK_es();
302075
- init_create_headless_toolbar_D5yv7LyN_es();
302085
+ init_create_headless_toolbar_rUh3xIsa_es();
302076
302086
  init_constants_DrU4EASo_es();
302077
302087
  init_dist_B8HfvhaK_es();
302078
302088
  init_unified_Dsuw2be5_es();
@@ -328241,6 +328251,7 @@ function print() { __p += __j.call(arguments, '') }
328241
328251
  this.#insertNewFileData();
328242
328252
  if (!this.options.ydoc)
328243
328253
  this.#initComments();
328254
+ this.emit("documentReplaced", { editor: this });
328244
328255
  }
328245
328256
  getInternalXmlFile(name, type = "json") {
328246
328257
  if (!this.converter.convertedXml[name]) {
@@ -333340,7 +333351,9 @@ function print() { __p += __j.call(arguments, '') }
333340
333351
  #hasConverter(editor) {
333341
333352
  return "converter" in editor && editor.converter !== undefined && editor.converter !== null;
333342
333353
  }
333343
- refresh() {
333354
+ refresh(options) {
333355
+ if (options?.purgeCachedEditors)
333356
+ this.#teardownEditors();
333344
333357
  this.#collections = this.#extractCollections();
333345
333358
  const nextDescriptors = this.#collectDescriptors(this.#collections);
333346
333359
  this.#teardownMissingEditors(nextDescriptors);
@@ -336284,6 +336297,7 @@ function print() { __p += __j.call(arguments, '') }
336284
336297
  });
336285
336298
  const handleCollaborationReady = (payload) => {
336286
336299
  this.emit("collaborationReady", payload);
336300
+ this.#refreshHeaderFooterStructureThenRerender();
336287
336301
  if (this.#options.collaborationProvider?.awareness && this.#layoutOptions.presence?.enabled !== false)
336288
336302
  this.#setupCollaborationCursors();
336289
336303
  };
@@ -336292,6 +336306,14 @@ function print() { __p += __j.call(arguments, '') }
336292
336306
  event: "collaborationReady",
336293
336307
  handler: handleCollaborationReady
336294
336308
  });
336309
+ const handleDocumentReplaced = () => {
336310
+ this.#refreshHeaderFooterStructureThenRerender({ purgeCachedEditors: true });
336311
+ };
336312
+ this.#editor.on("documentReplaced", handleDocumentReplaced);
336313
+ this.#editorListeners.push({
336314
+ event: "documentReplaced",
336315
+ handler: handleDocumentReplaced
336316
+ });
336295
336317
  const handleCommentsUpdate = (payload) => {
336296
336318
  if ("activeCommentId" in payload) {
336297
336319
  const activeId = payload.activeCommentId ?? null;
@@ -337152,6 +337174,13 @@ function print() { __p += __j.call(arguments, '') }
337152
337174
  #calculateExtendedSelection(anchor, head, mode) {
337153
337175
  return calculateExtendedSelection(this.#layoutState.blocks, anchor, head, mode);
337154
337176
  }
337177
+ #refreshHeaderFooterStructureThenRerender(options) {
337178
+ this.#headerFooterSession?.refreshStructure(options);
337179
+ this.#flowBlockCache.setHasExternalChanges(true);
337180
+ this.#pendingDocChange = true;
337181
+ this.#selectionSync.onLayoutStart();
337182
+ this.#scheduleRerender();
337183
+ }
337155
337184
  #scheduleRerender() {
337156
337185
  if (this.#renderScheduled)
337157
337186
  return;
@@ -337399,7 +337428,7 @@ function print() { __p += __j.call(arguments, '') }
337399
337428
  }
337400
337429
  this.#sectionMetadata = sectionMetadata;
337401
337430
  const converter = this.#editor.converter;
337402
- const multiSectionId = buildMultiSectionIdentifier(sectionMetadata, converter?.pageStyles, {
337431
+ const multiSectionId = buildMultiSectionIdentifier(sectionMetadata, { alternateHeaders: this.#resolveAlternateHeadersFlag() }, {
337403
337432
  headerIds: converter?.headerIds,
337404
337433
  footerIds: converter?.footerIds
337405
337434
  });
@@ -338064,6 +338093,16 @@ function print() { __p += __j.call(arguments, '') }
338064
338093
  overlay.innerHTML = "";
338065
338094
  overlay.appendChild(fragment2);
338066
338095
  }
338096
+ #resolveAlternateHeadersFlag() {
338097
+ const converter = this.#editor?.converter;
338098
+ if (!converter)
338099
+ return false;
338100
+ const settingsPart = converter.convertedXml?.["word/settings.xml"];
338101
+ const fromSettings = resolveEvenAndOddHeadersFromSettingsPart(settingsPart);
338102
+ if (fromSettings !== null)
338103
+ return fromSettings;
338104
+ return converter.pageStyles?.alternateHeaders === true;
338105
+ }
338067
338106
  #resolveLayoutOptions(blocks2, sectionMetadata) {
338068
338107
  const defaults2 = this.#computeDefaultLayoutDefaults();
338069
338108
  const firstSection = blocks2?.find((block) => block.kind === "sectionBreak" && block?.attrs?.isFirstSection);
@@ -338127,7 +338166,7 @@ function print() { __p += __j.call(arguments, '') }
338127
338166
  };
338128
338167
  }
338129
338168
  this.#hiddenHost.style.width = `${pageSize.w}px`;
338130
- const alternateHeaders = Boolean(this.#editor?.converter?.pageStyles?.alternateHeaders);
338169
+ const alternateHeaders = this.#resolveAlternateHeadersFlag();
338131
338170
  return {
338132
338171
  flowMode: "paginated",
338133
338172
  pageSize,
@@ -340053,11 +340092,11 @@ function print() { __p += __j.call(arguments, '') }
340053
340092
  ];
340054
340093
  });
340055
340094
 
340056
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-CEK13syX.es.js
340095
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DzAnOuIL.es.js
340057
340096
  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;
340058
- var init_create_super_doc_ui_CEK13syX_es = __esm(() => {
340059
- init_SuperConverter_CcvDw1Yc_es();
340060
- init_create_headless_toolbar_D5yv7LyN_es();
340097
+ var init_create_super_doc_ui_DzAnOuIL_es = __esm(() => {
340098
+ init_SuperConverter_BInxZk0I_es();
340099
+ init_create_headless_toolbar_rUh3xIsa_es();
340061
340100
  MOD_ALIASES = new Set([
340062
340101
  "Mod",
340063
340102
  "Meta",
@@ -340099,16 +340138,16 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
340099
340138
 
340100
340139
  // ../../packages/superdoc/dist/super-editor.es.js
340101
340140
  var init_super_editor_es = __esm(() => {
340102
- init_src_BpYr_7Wm_es();
340103
- init_SuperConverter_CcvDw1Yc_es();
340141
+ init_src_DFx5wrK0_es();
340142
+ init_SuperConverter_BInxZk0I_es();
340104
340143
  init_jszip_C49i9kUs_es();
340105
340144
  init_xml_js_CqGKpaft_es();
340106
- init_create_headless_toolbar_D5yv7LyN_es();
340145
+ init_create_headless_toolbar_rUh3xIsa_es();
340107
340146
  init_constants_DrU4EASo_es();
340108
340147
  init_dist_B8HfvhaK_es();
340109
340148
  init_unified_Dsuw2be5_es();
340110
340149
  init_DocxZipper_Dh4RtvcE_es();
340111
- init_create_super_doc_ui_CEK13syX_es();
340150
+ init_create_super_doc_ui_DzAnOuIL_es();
340112
340151
  init_ui_CGB3qmy3_es();
340113
340152
  init_eventemitter3_UwU_CLPU_es();
340114
340153
  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.90",
3
+ "version": "0.8.0-next.91",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -24,21 +24,21 @@
24
24
  "@types/node": "22.19.2",
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
- "@superdoc/pm-adapter": "0.0.0",
28
- "superdoc": "1.32.0",
29
27
  "@superdoc/document-api": "0.0.1",
30
- "@superdoc/super-editor": "0.0.1"
28
+ "@superdoc/super-editor": "0.0.1",
29
+ "@superdoc/pm-adapter": "0.0.0",
30
+ "superdoc": "1.32.0"
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.90",
38
- "@superdoc-dev/cli-darwin-x64": "0.8.0-next.90",
39
- "@superdoc-dev/cli-linux-arm64": "0.8.0-next.90",
40
- "@superdoc-dev/cli-linux-x64": "0.8.0-next.90",
41
- "@superdoc-dev/cli-windows-x64": "0.8.0-next.90"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.91",
38
+ "@superdoc-dev/cli-darwin-x64": "0.8.0-next.91",
39
+ "@superdoc-dev/cli-linux-x64": "0.8.0-next.91",
40
+ "@superdoc-dev/cli-linux-arm64": "0.8.0-next.91",
41
+ "@superdoc-dev/cli-windows-x64": "0.8.0-next.91"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",