@superdoc-dev/cli 0.7.0-next.37 → 0.7.0-next.39

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 +133 -51
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -65501,7 +65501,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
65501
65501
  emptyOptions2 = {};
65502
65502
  });
65503
65503
 
65504
- // ../../packages/superdoc/dist/chunks/SuperConverter-D8HLuwGQ.es.js
65504
+ // ../../packages/superdoc/dist/chunks/SuperConverter-BCKO82IW.es.js
65505
65505
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
65506
65506
  const fieldValue = extension$1.config[field];
65507
65507
  if (typeof fieldValue === "function")
@@ -116403,12 +116403,19 @@ var isRegExp = (value) => {
116403
116403
  ...attributes ? { attributes } : {},
116404
116404
  elements: []
116405
116405
  };
116406
+ }, ST_ON_OFF_TRUE_VALUES, isStOnOffEnabled = (element) => {
116407
+ if (!element)
116408
+ return false;
116409
+ const rawValue = element.attributes?.["w:val"];
116410
+ if (rawValue == null)
116411
+ return true;
116412
+ return ST_ON_OFF_TRUE_VALUES.has(String(rawValue).trim().toLowerCase());
116406
116413
  }, isAlternatingHeadersOddEven = (docx) => {
116407
116414
  const settings = docx["word/settings.xml"];
116408
116415
  if (!settings || !settings.elements?.length)
116409
116416
  return false;
116410
116417
  const { elements = [] } = settings.elements[0];
116411
- return !!elements.find((el) => el.name === "w:evenAndOddHeaders");
116418
+ return isStOnOffEnabled(elements.find((el) => el.name === "w:evenAndOddHeaders"));
116412
116419
  }, 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$28, DEFAULT_SECTION_PROPS_TWIPS, ensureSectionLayoutDefaults = (sectPr, converter) => {
116413
116420
  if (!sectPr)
116414
116421
  return {
@@ -117269,7 +117276,7 @@ var isRegExp = (value) => {
117269
117276
  state.kern = kernNode.attributes["w:val"];
117270
117277
  }
117271
117278
  }, SuperConverter;
117272
- var init_SuperConverter_D8HLuwGQ_es = __esm(() => {
117279
+ var init_SuperConverter_BCKO82IW_es = __esm(() => {
117273
117280
  init_rolldown_runtime_Bg48TavK_es();
117274
117281
  init_jszip_C49i9kUs_es();
117275
117282
  init_xml_js_CqGKpaft_es();
@@ -153208,6 +153215,11 @@ var init_SuperConverter_D8HLuwGQ_es = __esm(() => {
153208
153215
  gutter: "0"
153209
153216
  })
153210
153217
  });
153218
+ ST_ON_OFF_TRUE_VALUES = new Set([
153219
+ "1",
153220
+ "true",
153221
+ "on"
153222
+ ]);
153211
153223
  SD_NODE_NAME = [
153212
153224
  "shapeContainer",
153213
153225
  "contentBlock",
@@ -154550,7 +154562,7 @@ var init_SuperConverter_D8HLuwGQ_es = __esm(() => {
154550
154562
  };
154551
154563
  });
154552
154564
 
154553
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-CbE9_87q.es.js
154565
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-BdA1QhS3.es.js
154554
154566
  function parseSizeUnit(val = "0") {
154555
154567
  const length3 = val.toString() || "0";
154556
154568
  const value = Number.parseFloat(length3);
@@ -157142,8 +157154,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
157142
157154
  }
157143
157155
  };
157144
157156
  };
157145
- var init_create_headless_toolbar_CbE9_87q_es = __esm(() => {
157146
- init_SuperConverter_D8HLuwGQ_es();
157157
+ var init_create_headless_toolbar_BdA1QhS3_es = __esm(() => {
157158
+ init_SuperConverter_BCKO82IW_es();
157147
157159
  init_constants_CGhJRd87_es();
157148
157160
  init_dist_B8HfvhaK_es();
157149
157161
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -205830,7 +205842,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
205830
205842
  init_remark_gfm_BhnWr3yf_es();
205831
205843
  });
205832
205844
 
205833
- // ../../packages/superdoc/dist/chunks/src-j2qoSUF1.es.js
205845
+ // ../../packages/superdoc/dist/chunks/src-DnUVzELl.es.js
205834
205846
  function deleteProps(obj, propOrProps) {
205835
205847
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
205836
205848
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -248643,11 +248655,7 @@ function computeNextSectionPropsAtBreak(blocks2) {
248643
248655
  h: source.pageSize.h
248644
248656
  };
248645
248657
  if (source.columns)
248646
- props.columns = {
248647
- count: source.columns.count,
248648
- gap: source.columns.gap,
248649
- withSeparator: source.columns.withSeparator
248650
- };
248658
+ props.columns = snapshotColumns(source.columns);
248651
248659
  if (source.orientation)
248652
248660
  props.orientation = source.orientation;
248653
248661
  if (source.vAlign)
@@ -251419,11 +251427,7 @@ function layoutDocument(blocks2, measures, options = {}) {
251419
251427
  if (activeOrientation)
251420
251428
  page.orientation = activeOrientation;
251421
251429
  if (activeColumns.count > 1)
251422
- page.columns = {
251423
- count: activeColumns.count,
251424
- gap: activeColumns.gap,
251425
- withSeparator: activeColumns.withSeparator
251426
- };
251430
+ page.columns = cloneColumnLayout(activeColumns);
251427
251431
  if (activeVAlign && activeVAlign !== "top") {
251428
251432
  page.vAlign = activeVAlign;
251429
251433
  page.baseMargins = {
@@ -252332,11 +252336,7 @@ function layoutDocument(blocks2, measures, options = {}) {
252332
252336
  return {
252333
252337
  pageSize,
252334
252338
  pages,
252335
- columns: activeColumns.count > 1 ? {
252336
- count: activeColumns.count,
252337
- gap: activeColumns.gap,
252338
- withSeparator: activeColumns.withSeparator
252339
- } : undefined
252339
+ columns: activeColumns.count > 1 ? cloneColumnLayout(activeColumns) : undefined
252340
252340
  };
252341
252341
  }
252342
252342
  function computeFragmentBottom(fragment2, block, measure) {
@@ -268883,20 +268883,39 @@ var Node$13 = class Node$14 {
268883
268883
  if (!insertedMark && !deletionMark && !formatMark)
268884
268884
  return;
268885
268885
  const newTrackedChanges = { ...trackedChanges };
268886
- let id2 = insertedMark?.attrs?.id || deletionMark?.attrs?.id || formatMark?.attrs?.id;
268887
- if (!id2)
268886
+ const insertedId = insertedMark?.attrs?.id ?? null;
268887
+ const deletionId = deletionMark?.attrs?.id ?? null;
268888
+ const formatId = formatMark?.attrs?.id ?? null;
268889
+ const primaryId = insertedId || deletionId || formatId;
268890
+ if (!primaryId)
268888
268891
  return trackedChanges;
268889
- let isNewChange = false;
268890
- if (!newTrackedChanges[id2]) {
268891
- newTrackedChanges[id2] = {};
268892
- isNewChange = true;
268893
- }
268894
- if (insertedMark)
268895
- newTrackedChanges[id2].insertion = id2;
268896
- if (deletionMark)
268897
- newTrackedChanges[id2].deletion = deletionMark.attrs?.id;
268898
- if (formatMark)
268899
- newTrackedChanges[id2].format = formatMark.attrs?.id;
268892
+ const registerTrackedChangeId = (changeId, patch3) => {
268893
+ if (!changeId)
268894
+ return false;
268895
+ const existing = newTrackedChanges[changeId];
268896
+ if (existing) {
268897
+ Object.assign(existing, patch3);
268898
+ return false;
268899
+ }
268900
+ newTrackedChanges[changeId] = { ...patch3 };
268901
+ return true;
268902
+ };
268903
+ const buildTrackedChangePayload = ({ event, marks, nodes: nodes$1, deletionNodes: deletionNodes$1 = [] }) => {
268904
+ if (!marks.insertedMark && !marks.deletionMark && !marks.formatMark)
268905
+ return null;
268906
+ const trackedMarkId = marks.insertedMark?.attrs?.id ?? marks.deletionMark?.attrs?.id ?? marks.formatMark?.attrs?.id ?? null;
268907
+ if (!trackedMarkId)
268908
+ return null;
268909
+ return createOrUpdateTrackedChangeComment({
268910
+ documentId: editor.options.documentId,
268911
+ event,
268912
+ marks,
268913
+ deletionNodes: deletionNodes$1,
268914
+ nodes: nodes$1,
268915
+ newEditorState,
268916
+ trackedChangesForId: getTrackChanges(newEditorState, trackedMarkId)
268917
+ });
268918
+ };
268900
268919
  const { step: step3 } = trackedChangeMeta;
268901
268920
  let nodes = step3?.slice?.content?.content || [];
268902
268921
  if (!nodes.length)
@@ -268906,8 +268925,42 @@ var Node$13 = class Node$14 {
268906
268925
  return false;
268907
268926
  }
268908
268927
  });
268909
- const emitParams = nodes.length > 0 || Boolean(deletionNodes?.length) ? createOrUpdateTrackedChangeComment({
268910
- documentId: editor.options.documentId,
268928
+ const hasCandidateNodes = nodes.length > 0 || Boolean(deletionNodes?.length);
268929
+ if (Boolean(insertedMark && deletionMark) && Boolean(insertedId) && Boolean(deletionId) && insertedId !== deletionId) {
268930
+ const isNewInsertion = registerTrackedChangeId(insertedId, { insertion: insertedId });
268931
+ const isNewDeletion = registerTrackedChangeId(deletionId, { deletion: deletionId });
268932
+ const insertionPayload = hasCandidateNodes ? buildTrackedChangePayload({
268933
+ event: isNewInsertion ? "add" : "update",
268934
+ marks: {
268935
+ insertedMark,
268936
+ deletionMark: null,
268937
+ formatMark: null
268938
+ },
268939
+ deletionNodes: [],
268940
+ nodes
268941
+ }) : null;
268942
+ const deletionPayload = deletionMark && (hasCandidateNodes || getTrackChanges(newEditorState, deletionId).length > 0) ? buildTrackedChangePayload({
268943
+ event: isNewDeletion ? "add" : "update",
268944
+ marks: {
268945
+ insertedMark: null,
268946
+ deletionMark,
268947
+ formatMark: null
268948
+ },
268949
+ deletionNodes,
268950
+ nodes: []
268951
+ }) : null;
268952
+ if (emitCommentEvent && insertionPayload)
268953
+ editor.emit("commentsUpdate", insertionPayload);
268954
+ if (emitCommentEvent && deletionPayload)
268955
+ editor.emit("commentsUpdate", deletionPayload);
268956
+ return newTrackedChanges;
268957
+ }
268958
+ const isNewChange = registerTrackedChangeId(primaryId, {
268959
+ ...insertedMark ? { insertion: primaryId } : {},
268960
+ ...deletionMark ? { deletion: deletionId } : {},
268961
+ ...formatMark ? { format: formatId } : {}
268962
+ });
268963
+ const emitParams = hasCandidateNodes ? buildTrackedChangePayload({
268911
268964
  event: isNewChange ? "add" : "update",
268912
268965
  marks: {
268913
268966
  insertedMark,
@@ -268915,8 +268968,7 @@ var Node$13 = class Node$14 {
268915
268968
  formatMark
268916
268969
  },
268917
268970
  deletionNodes,
268918
- nodes,
268919
- newEditorState
268971
+ nodes
268920
268972
  }) : null;
268921
268973
  if (emitParams && emitCommentEvent)
268922
268974
  editor.emit("commentsUpdate", emitParams);
@@ -269014,7 +269066,9 @@ var Node$13 = class Node$14 {
269014
269066
  const { name: trackedChangeType } = type;
269015
269067
  const { author, authorEmail, authorImage, date, importedAuthor } = attrs;
269016
269068
  const id2 = attrs.id;
269017
- let isReplacement = !!(marks.insertedMark && marks.deletionMark);
269069
+ const insertedMarkId = marks.insertedMark?.attrs?.id ?? null;
269070
+ const deletionMarkId = marks.deletionMark?.attrs?.id ?? null;
269071
+ let isReplacement = Boolean(insertedMarkId && deletionMarkId && insertedMarkId === deletionMarkId);
269018
269072
  if (!isReplacement) {
269019
269073
  const hasInsertMark = trackedChangesWithId.some(({ mark: mark2 }) => mark2.type.name === TrackInsertMarkName);
269020
269074
  const hasDeleteMark = trackedChangesWithId.some(({ mark: mark2 }) => mark2.type.name === TrackDeleteMarkName);
@@ -281199,6 +281253,10 @@ menclose::after {
281199
281253
  #applyVirtualizationPins() {
281200
281254
  this.#painter?.setVirtualizationPins(this.#virtualizationPins);
281201
281255
  }
281256
+ }, snapshotColumns = (columns) => {
281257
+ if (!columns)
281258
+ return;
281259
+ return cloneColumnLayout(columns);
281202
281260
  }, SINGLE_COLUMN_DEFAULT, isTextRun$5 = (run2) => {
281203
281261
  const runWithKind = run2;
281204
281262
  return !runWithKind.kind || runWithKind.kind === "text";
@@ -290485,12 +290543,12 @@ menclose::after {
290485
290543
  return;
290486
290544
  console.log(...args$1);
290487
290545
  }, 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;
290488
- var init_src_j2qoSUF1_es = __esm(() => {
290546
+ var init_src_DnUVzELl_es = __esm(() => {
290489
290547
  init_rolldown_runtime_Bg48TavK_es();
290490
- init_SuperConverter_D8HLuwGQ_es();
290548
+ init_SuperConverter_BCKO82IW_es();
290491
290549
  init_jszip_C49i9kUs_es();
290492
290550
  init_uuid_qzgm05fK_es();
290493
- init_create_headless_toolbar_CbE9_87q_es();
290551
+ init_create_headless_toolbar_BdA1QhS3_es();
290494
290552
  init_constants_CGhJRd87_es();
290495
290553
  init_dist_B8HfvhaK_es();
290496
290554
  init_unified_Dsuw2be5_es();
@@ -317058,14 +317116,13 @@ function print() { __p += __j.call(arguments, '') }
317058
317116
  continue;
317059
317117
  if (columns.count <= 1)
317060
317118
  continue;
317061
- const columnWidth = (contentWidth - columns.gap * (columns.count - 1)) / columns.count;
317062
- if (columnWidth <= 1)
317063
- continue;
317064
317119
  const regionHeight = yEnd - yStart;
317065
317120
  if (regionHeight <= 0)
317066
317121
  continue;
317067
- for (let i4 = 0;i4 < columns.count - 1; i4++) {
317068
- const separatorX = leftMargin + (i4 + 1) * columnWidth + i4 * columns.gap + columns.gap / 2;
317122
+ const separatorPositions = this.getColumnSeparatorPositions(columns, leftMargin, contentWidth);
317123
+ if (separatorPositions.length === 0)
317124
+ continue;
317125
+ for (const separatorX of separatorPositions) {
317069
317126
  const separatorEl = this.doc.createElement("div");
317070
317127
  separatorEl.style.position = "absolute";
317071
317128
  separatorEl.style.left = `${separatorX}px`;
@@ -317078,6 +317135,31 @@ function print() { __p += __j.call(arguments, '') }
317078
317135
  }
317079
317136
  }
317080
317137
  }
317138
+ getColumnSeparatorPositions(columns, leftMargin, contentWidth) {
317139
+ if (!(Array.isArray(columns.widths) && columns.widths.length > 0)) {
317140
+ const equalWidth = (contentWidth - columns.gap * (columns.count - 1)) / columns.count;
317141
+ if (equalWidth <= 1)
317142
+ return [];
317143
+ const separatorPositions$1 = [];
317144
+ for (let index2 = 0;index2 < columns.count - 1; index2 += 1)
317145
+ separatorPositions$1.push(leftMargin + (index2 + 1) * equalWidth + index2 * columns.gap + columns.gap / 2);
317146
+ return separatorPositions$1;
317147
+ }
317148
+ const normalizedColumns = normalizeColumnLayout(columns, contentWidth);
317149
+ if (normalizedColumns.count <= 1)
317150
+ return [];
317151
+ const columnWidths = normalizedColumns.widths ?? Array.from({ length: normalizedColumns.count }, () => normalizedColumns.width);
317152
+ if (columnWidths.some((columnWidth) => columnWidth <= 1))
317153
+ return [];
317154
+ const separatorPositions = [];
317155
+ let cursorX = leftMargin;
317156
+ for (let index2 = 0;index2 < normalizedColumns.count - 1; index2 += 1) {
317157
+ const currentColumnWidth = columnWidths[index2] ?? normalizedColumns.width;
317158
+ separatorPositions.push(cursorX + currentColumnWidth + normalizedColumns.gap / 2);
317159
+ cursorX += currentColumnWidth + normalizedColumns.gap;
317160
+ }
317161
+ return separatorPositions;
317162
+ }
317081
317163
  renderDecorationsForPage(pageEl, page, pageIndex) {
317082
317164
  if (this.isSemanticFlow)
317083
317165
  return;
@@ -325359,11 +325441,11 @@ var init_zipper_DbkgrypV_es = __esm(() => {
325359
325441
 
325360
325442
  // ../../packages/superdoc/dist/super-editor.es.js
325361
325443
  var init_super_editor_es = __esm(() => {
325362
- init_src_j2qoSUF1_es();
325363
- init_SuperConverter_D8HLuwGQ_es();
325444
+ init_src_DnUVzELl_es();
325445
+ init_SuperConverter_BCKO82IW_es();
325364
325446
  init_jszip_C49i9kUs_es();
325365
325447
  init_xml_js_CqGKpaft_es();
325366
- init_create_headless_toolbar_CbE9_87q_es();
325448
+ init_create_headless_toolbar_BdA1QhS3_es();
325367
325449
  init_constants_CGhJRd87_es();
325368
325450
  init_dist_B8HfvhaK_es();
325369
325451
  init_unified_Dsuw2be5_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.7.0-next.37",
3
+ "version": "0.7.0-next.39",
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/super-editor": "0.0.1",
28
+ "@superdoc/pm-adapter": "0.0.0",
29
29
  "superdoc": "1.26.0",
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.7.0-next.37",
38
- "@superdoc-dev/cli-darwin-x64": "0.7.0-next.37",
39
- "@superdoc-dev/cli-linux-x64": "0.7.0-next.37",
40
- "@superdoc-dev/cli-linux-arm64": "0.7.0-next.37",
41
- "@superdoc-dev/cli-windows-x64": "0.7.0-next.37"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.7.0-next.39",
38
+ "@superdoc-dev/cli-darwin-x64": "0.7.0-next.39",
39
+ "@superdoc-dev/cli-linux-x64": "0.7.0-next.39",
40
+ "@superdoc-dev/cli-linux-arm64": "0.7.0-next.39",
41
+ "@superdoc-dev/cli-windows-x64": "0.7.0-next.39"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",