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

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 +70 -29
  2. package/package.json +8 -8
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-CMq87UyB.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) => {
@@ -245730,11 +245740,12 @@ function resolveBookmarkTarget(doc$12, target) {
245730
245740
  function nodePositionToPosition(doc$12, pos) {
245731
245741
  const resolved = doc$12.resolve(pos);
245732
245742
  for (let depth = resolved.depth;depth >= 0; depth--) {
245733
- const blockId = resolved.node(depth).attrs?.sdBlockId;
245743
+ const node3 = resolved.node(depth);
245744
+ const blockId = node3.attrs?.sdBlockId;
245734
245745
  if (blockId)
245735
245746
  return {
245736
245747
  blockId,
245737
- offset: pos - resolved.start(depth)
245748
+ offset: pmPositionToTextOffset(node3, resolved.start(depth) - 1, pos)
245738
245749
  };
245739
245750
  }
245740
245751
  return {
@@ -246186,11 +246197,12 @@ function protectionClearEditingRestrictionAdapter(editor, _input, options) {
246186
246197
  function pmPosToPosition(doc$12, pos) {
246187
246198
  const resolved = doc$12.resolve(pos);
246188
246199
  for (let depth = resolved.depth;depth >= 0; depth--) {
246189
- const blockId = resolved.node(depth).attrs?.sdBlockId;
246200
+ const node3 = resolved.node(depth);
246201
+ const blockId = node3.attrs?.sdBlockId;
246190
246202
  if (blockId)
246191
246203
  return {
246192
246204
  blockId,
246193
- offset: pos - resolved.start(depth)
246205
+ offset: pmPositionToTextOffset(node3, resolved.start(depth) - 1, pos)
246194
246206
  };
246195
246207
  }
246196
246208
  return {
@@ -300473,8 +300485,8 @@ menclose::after {
300473
300485
  get manager() {
300474
300486
  return this.#headerFooterManager;
300475
300487
  }
300476
- refreshStructure() {
300477
- this.#headerFooterManager?.refresh();
300488
+ refreshStructure(options) {
300489
+ this.#headerFooterManager?.refresh(options?.purgeCachedEditors ? { purgeCachedEditors: true } : undefined);
300478
300490
  this.#headerFooterAdapter?.invalidateAll();
300479
300491
  }
300480
300492
  invalidateLayoutForRefs(refIds) {
@@ -302067,12 +302079,12 @@ menclose::after {
302067
302079
  return;
302068
302080
  console.log(...args$1);
302069
302081
  }, 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(() => {
302082
+ var init_src_CMq87UyB_es = __esm(() => {
302071
302083
  init_rolldown_runtime_Bg48TavK_es();
302072
- init_SuperConverter_CcvDw1Yc_es();
302084
+ init_SuperConverter_BInxZk0I_es();
302073
302085
  init_jszip_C49i9kUs_es();
302074
302086
  init_uuid_qzgm05fK_es();
302075
- init_create_headless_toolbar_D5yv7LyN_es();
302087
+ init_create_headless_toolbar_rUh3xIsa_es();
302076
302088
  init_constants_DrU4EASo_es();
302077
302089
  init_dist_B8HfvhaK_es();
302078
302090
  init_unified_Dsuw2be5_es();
@@ -328241,6 +328253,7 @@ function print() { __p += __j.call(arguments, '') }
328241
328253
  this.#insertNewFileData();
328242
328254
  if (!this.options.ydoc)
328243
328255
  this.#initComments();
328256
+ this.emit("documentReplaced", { editor: this });
328244
328257
  }
328245
328258
  getInternalXmlFile(name, type = "json") {
328246
328259
  if (!this.converter.convertedXml[name]) {
@@ -333340,7 +333353,9 @@ function print() { __p += __j.call(arguments, '') }
333340
333353
  #hasConverter(editor) {
333341
333354
  return "converter" in editor && editor.converter !== undefined && editor.converter !== null;
333342
333355
  }
333343
- refresh() {
333356
+ refresh(options) {
333357
+ if (options?.purgeCachedEditors)
333358
+ this.#teardownEditors();
333344
333359
  this.#collections = this.#extractCollections();
333345
333360
  const nextDescriptors = this.#collectDescriptors(this.#collections);
333346
333361
  this.#teardownMissingEditors(nextDescriptors);
@@ -336284,6 +336299,7 @@ function print() { __p += __j.call(arguments, '') }
336284
336299
  });
336285
336300
  const handleCollaborationReady = (payload) => {
336286
336301
  this.emit("collaborationReady", payload);
336302
+ this.#refreshHeaderFooterStructureThenRerender();
336287
336303
  if (this.#options.collaborationProvider?.awareness && this.#layoutOptions.presence?.enabled !== false)
336288
336304
  this.#setupCollaborationCursors();
336289
336305
  };
@@ -336292,6 +336308,14 @@ function print() { __p += __j.call(arguments, '') }
336292
336308
  event: "collaborationReady",
336293
336309
  handler: handleCollaborationReady
336294
336310
  });
336311
+ const handleDocumentReplaced = () => {
336312
+ this.#refreshHeaderFooterStructureThenRerender({ purgeCachedEditors: true });
336313
+ };
336314
+ this.#editor.on("documentReplaced", handleDocumentReplaced);
336315
+ this.#editorListeners.push({
336316
+ event: "documentReplaced",
336317
+ handler: handleDocumentReplaced
336318
+ });
336295
336319
  const handleCommentsUpdate = (payload) => {
336296
336320
  if ("activeCommentId" in payload) {
336297
336321
  const activeId = payload.activeCommentId ?? null;
@@ -337152,6 +337176,13 @@ function print() { __p += __j.call(arguments, '') }
337152
337176
  #calculateExtendedSelection(anchor, head, mode) {
337153
337177
  return calculateExtendedSelection(this.#layoutState.blocks, anchor, head, mode);
337154
337178
  }
337179
+ #refreshHeaderFooterStructureThenRerender(options) {
337180
+ this.#headerFooterSession?.refreshStructure(options);
337181
+ this.#flowBlockCache.setHasExternalChanges(true);
337182
+ this.#pendingDocChange = true;
337183
+ this.#selectionSync.onLayoutStart();
337184
+ this.#scheduleRerender();
337185
+ }
337155
337186
  #scheduleRerender() {
337156
337187
  if (this.#renderScheduled)
337157
337188
  return;
@@ -337399,7 +337430,7 @@ function print() { __p += __j.call(arguments, '') }
337399
337430
  }
337400
337431
  this.#sectionMetadata = sectionMetadata;
337401
337432
  const converter = this.#editor.converter;
337402
- const multiSectionId = buildMultiSectionIdentifier(sectionMetadata, converter?.pageStyles, {
337433
+ const multiSectionId = buildMultiSectionIdentifier(sectionMetadata, { alternateHeaders: this.#resolveAlternateHeadersFlag() }, {
337403
337434
  headerIds: converter?.headerIds,
337404
337435
  footerIds: converter?.footerIds
337405
337436
  });
@@ -338064,6 +338095,16 @@ function print() { __p += __j.call(arguments, '') }
338064
338095
  overlay.innerHTML = "";
338065
338096
  overlay.appendChild(fragment2);
338066
338097
  }
338098
+ #resolveAlternateHeadersFlag() {
338099
+ const converter = this.#editor?.converter;
338100
+ if (!converter)
338101
+ return false;
338102
+ const settingsPart = converter.convertedXml?.["word/settings.xml"];
338103
+ const fromSettings = resolveEvenAndOddHeadersFromSettingsPart(settingsPart);
338104
+ if (fromSettings !== null)
338105
+ return fromSettings;
338106
+ return converter.pageStyles?.alternateHeaders === true;
338107
+ }
338067
338108
  #resolveLayoutOptions(blocks2, sectionMetadata) {
338068
338109
  const defaults2 = this.#computeDefaultLayoutDefaults();
338069
338110
  const firstSection = blocks2?.find((block) => block.kind === "sectionBreak" && block?.attrs?.isFirstSection);
@@ -338127,7 +338168,7 @@ function print() { __p += __j.call(arguments, '') }
338127
338168
  };
338128
338169
  }
338129
338170
  this.#hiddenHost.style.width = `${pageSize.w}px`;
338130
- const alternateHeaders = Boolean(this.#editor?.converter?.pageStyles?.alternateHeaders);
338171
+ const alternateHeaders = this.#resolveAlternateHeadersFlag();
338131
338172
  return {
338132
338173
  flowMode: "paginated",
338133
338174
  pageSize,
@@ -340053,11 +340094,11 @@ function print() { __p += __j.call(arguments, '') }
340053
340094
  ];
340054
340095
  });
340055
340096
 
340056
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-CEK13syX.es.js
340097
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DzAnOuIL.es.js
340057
340098
  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();
340099
+ var init_create_super_doc_ui_DzAnOuIL_es = __esm(() => {
340100
+ init_SuperConverter_BInxZk0I_es();
340101
+ init_create_headless_toolbar_rUh3xIsa_es();
340061
340102
  MOD_ALIASES = new Set([
340062
340103
  "Mod",
340063
340104
  "Meta",
@@ -340099,16 +340140,16 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
340099
340140
 
340100
340141
  // ../../packages/superdoc/dist/super-editor.es.js
340101
340142
  var init_super_editor_es = __esm(() => {
340102
- init_src_BpYr_7Wm_es();
340103
- init_SuperConverter_CcvDw1Yc_es();
340143
+ init_src_CMq87UyB_es();
340144
+ init_SuperConverter_BInxZk0I_es();
340104
340145
  init_jszip_C49i9kUs_es();
340105
340146
  init_xml_js_CqGKpaft_es();
340106
- init_create_headless_toolbar_D5yv7LyN_es();
340147
+ init_create_headless_toolbar_rUh3xIsa_es();
340107
340148
  init_constants_DrU4EASo_es();
340108
340149
  init_dist_B8HfvhaK_es();
340109
340150
  init_unified_Dsuw2be5_es();
340110
340151
  init_DocxZipper_Dh4RtvcE_es();
340111
- init_create_super_doc_ui_CEK13syX_es();
340152
+ init_create_super_doc_ui_DzAnOuIL_es();
340112
340153
  init_ui_CGB3qmy3_es();
340113
340154
  init_eventemitter3_UwU_CLPU_es();
340114
340155
  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.92",
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/pm-adapter": "0.0.0",
28
- "superdoc": "1.32.0",
29
28
  "@superdoc/document-api": "0.0.1",
30
- "@superdoc/super-editor": "0.0.1"
29
+ "@superdoc/super-editor": "0.0.1",
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.92",
38
+ "@superdoc-dev/cli-darwin-x64": "0.8.0-next.92",
39
+ "@superdoc-dev/cli-linux-x64": "0.8.0-next.92",
40
+ "@superdoc-dev/cli-windows-x64": "0.8.0-next.92",
41
+ "@superdoc-dev/cli-linux-arm64": "0.8.0-next.92"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",