@superdoc-dev/cli 0.14.0-next.4 → 0.14.0-next.6

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 +248 -64
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -1916,7 +1916,7 @@ More content with **bold** and *italic*.`
1916
1916
  idempotency: "conditional",
1917
1917
  supportsDryRun: true,
1918
1918
  supportsTrackedMode: true,
1919
- possibleFailureCodes: ["INVALID_TARGET"],
1919
+ possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
1920
1920
  throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET", "INVALID_INPUT", ...T_STORY]
1921
1921
  }),
1922
1922
  referenceDocPath: "format/apply.mdx",
@@ -1989,7 +1989,7 @@ More content with **bold** and *italic*.`
1989
1989
  idempotency: "conditional",
1990
1990
  supportsDryRun: true,
1991
1991
  supportsTrackedMode: true,
1992
- possibleFailureCodes: ["INVALID_TARGET"],
1992
+ possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
1993
1993
  throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET", "INVALID_INPUT", ...T_STORY]
1994
1994
  }),
1995
1995
  referenceDocPath: "format/apply.mdx",
@@ -67793,7 +67793,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
67793
67793
  emptyOptions2 = {};
67794
67794
  });
67795
67795
 
67796
- // ../../packages/superdoc/dist/chunks/SuperConverter-BzpaXL4Z.es.js
67796
+ // ../../packages/superdoc/dist/chunks/SuperConverter-DA0uKCdy.es.js
67797
67797
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
67798
67798
  const fieldValue = extension$1.config[field];
67799
67799
  if (typeof fieldValue === "function")
@@ -108800,7 +108800,42 @@ var isRegExp = (value) => {
108800
108800
  if (trackedRuns.length === 1)
108801
108801
  return trackedRuns[0];
108802
108802
  return trackedRuns;
108803
- }, config$30, translator$5, translator$184, translator$71, translator$179, translator$65, translator$204, translator$83, translator$84, translator$141, translator$207, translator$100, translator$186, translator$188, propertyTranslators$11, translator$189, translator$109, propertyTranslators$10, CT_TC_MAR_CHILD_ORDER, baseConfig$1, orderedConfig$1, translator$190, translator$183, translator$180, translator$75, translator$72, translator$73, propertyTranslators$9, translator$191, getTableCellVMerge = (node3) => {
108803
+ }, config$30, translator$5, translator$184, translator$71, translator$179, translator$65, translator$204, translator$83, translator$84, translator$141, translator$207, translator$100, translator$186, translator$188, propertyTranslators$11, translator$189, translator$109, propertyTranslators$10, CT_TC_MAR_CHILD_ORDER, baseConfig$1, orderedConfig$1, translator$190, translator$183, translator$180, translator$75, translator$72, translator$73, propertyTranslators$9, translator$191, normalizeRowCellChildren = (row) => {
108804
+ const out = [];
108805
+ const children = Array.isArray(row?.elements) ? row.elements : [];
108806
+ for (const child of children) {
108807
+ if (!child || typeof child.name !== "string")
108808
+ continue;
108809
+ if (child.name === "w:tc") {
108810
+ out.push({
108811
+ node: child,
108812
+ cellSdt: null
108813
+ });
108814
+ continue;
108815
+ }
108816
+ if (child.name === "w:sdt") {
108817
+ const sdtPr = child.elements?.find((el) => el?.name === "w:sdtPr") ?? null;
108818
+ const sdtEndPr = child.elements?.find((el) => el?.name === "w:sdtEndPr") ?? null;
108819
+ const innerCells = child.elements?.find((el) => el?.name === "w:sdtContent")?.elements?.filter((el) => el?.name === "w:tc") ?? [];
108820
+ if (innerCells.length === 1 && sdtPr)
108821
+ out.push({
108822
+ node: innerCells[0],
108823
+ cellSdt: {
108824
+ scope: "cell",
108825
+ sdtPr,
108826
+ sdtEndPr
108827
+ }
108828
+ });
108829
+ else
108830
+ for (const innerTc of innerCells)
108831
+ out.push({
108832
+ node: innerTc,
108833
+ cellSdt: null
108834
+ });
108835
+ }
108836
+ }
108837
+ return out;
108838
+ }, getTableCellVMerge = (node3) => {
108804
108839
  const vMerge = node3.elements.find((el) => el.name === "w:tcPr")?.elements?.find((el) => el.name === "w:vMerge");
108805
108840
  if (!vMerge)
108806
108841
  return null;
@@ -108816,7 +108851,7 @@ var isRegExp = (value) => {
108816
108851
  const value = typeof raw === "string" ? parseInt(raw, 10) : raw;
108817
108852
  return Number.isFinite(value) && value > 0 ? value : 1;
108818
108853
  }, findTableCellAtColumn = (row, targetColumn) => {
108819
- const cells = row.elements?.filter((el) => el.name === "w:tc") ?? [];
108854
+ const cells = normalizeRowCellChildren(row).map((entry) => entry.node);
108820
108855
  let currentColumn = getGridBefore(row);
108821
108856
  for (const cell of cells) {
108822
108857
  const colSpan = getTableCellGridSpan(cell);
@@ -108977,7 +109012,7 @@ var isRegExp = (value) => {
108977
109012
  const pendingRowSpans = Array.isArray(activeRowSpans) ? activeRowSpans.slice() : [];
108978
109013
  while (pendingRowSpans.length < totalColumns)
108979
109014
  pendingRowSpans.push(0);
108980
- const cellNodes = row.elements.filter((el) => el.name === "w:tc");
109015
+ const cellEntries = normalizeRowCellChildren(row);
108981
109016
  const content$2 = [];
108982
109017
  let currentColumnIndex = 0;
108983
109018
  const fillUntil = (target, reason) => {
@@ -108996,7 +109031,7 @@ var isRegExp = (value) => {
108996
109031
  };
108997
109032
  fillUntil(safeGridBefore, "gridBefore");
108998
109033
  skipOccupiedColumns();
108999
- cellNodes?.forEach((node3) => {
109034
+ cellEntries.forEach(({ node: node3, cellSdt }) => {
109000
109035
  skipOccupiedColumns();
109001
109036
  const startColumn = currentColumnIndex;
109002
109037
  if (node3._vMergeConsumed)
@@ -109013,6 +109048,11 @@ var isRegExp = (value) => {
109013
109048
  columnWidth
109014
109049
  }
109015
109050
  });
109051
+ if (result && cellSdt)
109052
+ result.attrs = {
109053
+ ...result.attrs || {},
109054
+ cellSdt
109055
+ };
109016
109056
  if (result) {
109017
109057
  content$2.push(result);
109018
109058
  const colspan = Math.max(1, result.attrs?.colspan || 1);
@@ -109078,6 +109118,28 @@ var isRegExp = (value) => {
109078
109118
  content: trimmedContent
109079
109119
  }
109080
109120
  });
109121
+ let cellCursor = 0;
109122
+ for (let i$1 = 0;i$1 < elements.length; i$1 += 1) {
109123
+ const exportedEl = elements[i$1];
109124
+ if (!exportedEl || exportedEl.name !== "w:tc")
109125
+ continue;
109126
+ const sourceCell = trimmedContent[cellCursor];
109127
+ cellCursor += 1;
109128
+ const cellSdt = sourceCell?.attrs?.cellSdt;
109129
+ if (!cellSdt || cellSdt.scope !== "cell" || !cellSdt.sdtPr)
109130
+ continue;
109131
+ const sdtChildren = [cellSdt.sdtPr];
109132
+ if (cellSdt.sdtEndPr)
109133
+ sdtChildren.push(cellSdt.sdtEndPr);
109134
+ sdtChildren.push({
109135
+ name: "w:sdtContent",
109136
+ elements: [exportedEl]
109137
+ });
109138
+ elements[i$1] = {
109139
+ name: "w:sdt",
109140
+ elements: sdtChildren
109141
+ };
109142
+ }
109081
109143
  if (node3.attrs?.tableRowProperties) {
109082
109144
  const tableRowProperties = { ...node3.attrs.tableRowProperties };
109083
109145
  if (leadingPlaceholders > 0)
@@ -121870,12 +121932,12 @@ var isRegExp = (value) => {
121870
121932
  return text$2;
121871
121933
  return String(text$2).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
121872
121934
  }
121873
- #generateXml(node3) {
121935
+ #generateXml(node3, insideDeletion = false) {
121874
121936
  if (!node3)
121875
121937
  return null;
121876
121938
  let { name } = node3;
121877
121939
  const { elements, attributes } = node3;
121878
- if (name === "w:delInstrText")
121940
+ if (name === "w:delInstrText" && !insideDeletion)
121879
121941
  name = "w:instrText";
121880
121942
  let tag = `<${name}`;
121881
121943
  for (let attr in attributes) {
@@ -121890,8 +121952,9 @@ var isRegExp = (value) => {
121890
121952
  let tags = [tag];
121891
121953
  if (!name && node3.type === "text")
121892
121954
  return this.#replaceSpecialCharacters(node3.text ?? "");
121955
+ const nextInsideDeletion = insideDeletion || name === "w:del";
121893
121956
  if (elements) {
121894
- if (name === "w:instrText") {
121957
+ if (name === "w:instrText" || name === "w:delInstrText") {
121895
121958
  const textContent = (elements || []).map((child) => typeof child?.text === "string" ? child.text : "").join("");
121896
121959
  tags.push(this.#replaceSpecialCharacters(textContent));
121897
121960
  } else if (name === "w:t" || name === "w:delText" || name === "wp:posOffset")
@@ -121907,7 +121970,7 @@ var isRegExp = (value) => {
121907
121970
  }
121908
121971
  else if (elements)
121909
121972
  for (let child of elements) {
121910
- const newElements = this.#generateXml(child);
121973
+ const newElements = this.#generateXml(child, nextInsideDeletion);
121911
121974
  if (!newElements)
121912
121975
  continue;
121913
121976
  if (typeof newElements === "string") {
@@ -122658,7 +122721,7 @@ var isRegExp = (value) => {
122658
122721
  state.kern = kernNode.attributes["w:val"];
122659
122722
  }
122660
122723
  }, SuperConverter;
122661
- var init_SuperConverter_BzpaXL4Z_es = __esm(() => {
122724
+ var init_SuperConverter_DA0uKCdy_es = __esm(() => {
122662
122725
  init_rolldown_runtime_Bg48TavK_es();
122663
122726
  init_jszip_C49i9kUs_es();
122664
122727
  init_xml_js_CqGKpaft_es();
@@ -125939,7 +126002,7 @@ var init_SuperConverter_BzpaXL4Z_es = __esm(() => {
125939
126002
  idempotency: "conditional",
125940
126003
  supportsDryRun: true,
125941
126004
  supportsTrackedMode: true,
125942
- possibleFailureCodes: ["INVALID_TARGET"],
126005
+ possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
125943
126006
  throws: [
125944
126007
  ...T_NOT_FOUND_CAPABLE2,
125945
126008
  "INVALID_TARGET",
@@ -126015,7 +126078,7 @@ var init_SuperConverter_BzpaXL4Z_es = __esm(() => {
126015
126078
  idempotency: "conditional",
126016
126079
  supportsDryRun: true,
126017
126080
  supportsTrackedMode: true,
126018
- possibleFailureCodes: ["INVALID_TARGET"],
126081
+ possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
126019
126082
  throws: [
126020
126083
  ...T_NOT_FOUND_CAPABLE2,
126021
126084
  "INVALID_TARGET",
@@ -160972,7 +161035,7 @@ var init_SuperConverter_BzpaXL4Z_es = __esm(() => {
160972
161035
  };
160973
161036
  });
160974
161037
 
160975
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-6lLMNI-b.es.js
161038
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-CHdUF-l4.es.js
160976
161039
  function parseSizeUnit(val = "0") {
160977
161040
  const length3 = val.toString() || "0";
160978
161041
  const value = Number.parseFloat(length3);
@@ -171204,8 +171267,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
171204
171267
  }
171205
171268
  };
171206
171269
  };
171207
- var init_create_headless_toolbar_6lLMNI_b_es = __esm(() => {
171208
- init_SuperConverter_BzpaXL4Z_es();
171270
+ var init_create_headless_toolbar_CHdUF_l4_es = __esm(() => {
171271
+ init_SuperConverter_DA0uKCdy_es();
171209
171272
  init_uuid_qzgm05fK_es();
171210
171273
  init_constants_DrU4EASo_es();
171211
171274
  init_dist_B8HfvhaK_es();
@@ -220415,7 +220478,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
220415
220478
  init_remark_gfm_BhnWr3yf_es();
220416
220479
  });
220417
220480
 
220418
- // ../../packages/superdoc/dist/chunks/src-BVHa1VXC.es.js
220481
+ // ../../packages/superdoc/dist/chunks/src-CWBwwVmR.es.js
220419
220482
  function deleteProps(obj, propOrProps) {
220420
220483
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
220421
220484
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -230148,6 +230211,64 @@ function recordDeletedValue(value, path2, diff, ignoreKeys) {
230148
230211
  function joinPath(base5, key2) {
230149
230212
  return base5 ? `${base5}.${key2}` : key2;
230150
230213
  }
230214
+ function applyAttrsDiff(baseAttrs, attrsDiff) {
230215
+ const result = cloneAttrs(baseAttrs ?? {});
230216
+ if (!attrsDiff)
230217
+ return result;
230218
+ for (const [path2, value] of Object.entries(attrsDiff.added ?? {}))
230219
+ setAtPath(result, path2, value);
230220
+ for (const [path2, change] of Object.entries(attrsDiff.modified ?? {}))
230221
+ setAtPath(result, path2, change.to);
230222
+ for (const path2 of Object.keys(attrsDiff.deleted ?? {}))
230223
+ deleteAtPath(result, path2);
230224
+ return result;
230225
+ }
230226
+ function cloneAttrs(value) {
230227
+ if (!isPlainObject$4(value))
230228
+ return {};
230229
+ const clone = {};
230230
+ for (const [key2, child] of Object.entries(value))
230231
+ clone[key2] = cloneDeep(child);
230232
+ return clone;
230233
+ }
230234
+ function cloneDeep(value) {
230235
+ if (Array.isArray(value))
230236
+ return value.map(cloneDeep);
230237
+ if (isPlainObject$4(value)) {
230238
+ const clone = {};
230239
+ for (const [key2, child] of Object.entries(value))
230240
+ clone[key2] = cloneDeep(child);
230241
+ return clone;
230242
+ }
230243
+ return value;
230244
+ }
230245
+ function splitPath(path2) {
230246
+ return path2.split(".");
230247
+ }
230248
+ function setAtPath(target, path2, value) {
230249
+ const segments = splitPath(path2);
230250
+ let cursor = target;
230251
+ for (let i4 = 0;i4 < segments.length - 1; i4++) {
230252
+ const key2 = segments[i4];
230253
+ const next2 = cursor[key2];
230254
+ if (!isPlainObject$4(next2))
230255
+ cursor[key2] = {};
230256
+ cursor = cursor[key2];
230257
+ }
230258
+ cursor[segments[segments.length - 1]] = cloneDeep(value);
230259
+ }
230260
+ function deleteAtPath(target, path2) {
230261
+ const segments = splitPath(path2);
230262
+ let cursor = target;
230263
+ for (let i4 = 0;i4 < segments.length - 1; i4++) {
230264
+ const key2 = segments[i4];
230265
+ const next2 = cursor[key2];
230266
+ if (!isPlainObject$4(next2))
230267
+ return;
230268
+ cursor = next2;
230269
+ }
230270
+ delete cursor[segments[segments.length - 1]];
230271
+ }
230151
230272
  function isPlainObject$4(value) {
230152
230273
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
230153
230274
  }
@@ -230182,7 +230303,10 @@ function omitKeys(attrs, keysToOmit) {
230182
230303
  return result;
230183
230304
  }
230184
230305
  function normalizeParagraphAttrs(attrs) {
230185
- return omitKeys(attrs, VOLATILE_PARAGRAPH_ATTRS);
230306
+ return omitKeys(attrs, NON_SEMANTIC_BLOCK_ATTRS);
230307
+ }
230308
+ function normalizeBlockAttrs(attrs) {
230309
+ return omitKeys(attrs, NON_SEMANTIC_BLOCK_ATTRS);
230186
230310
  }
230187
230311
  function normalizeImageNodeJSON(nodeJSON) {
230188
230312
  const attrs = nodeJSON.attrs;
@@ -230247,14 +230371,54 @@ function normalizeDocJSON(docJSON) {
230247
230371
  function normalizeDocNodeJSON(nodeJSON) {
230248
230372
  if (nodeJSON.type === "paragraph")
230249
230373
  return normalizeParagraphNodeJSON(nodeJSON);
230374
+ const attrs = nodeJSON.attrs;
230250
230375
  const content3 = nodeJSON.content;
230376
+ const normalizedAttrs = attrs ? normalizeBlockAttrs(attrs) : undefined;
230251
230377
  if (content3)
230252
230378
  return {
230253
230379
  ...nodeJSON,
230380
+ ...normalizedAttrs ? { attrs: normalizedAttrs } : {},
230254
230381
  content: content3.map(normalizeDocNodeJSON)
230255
230382
  };
230383
+ if (normalizedAttrs)
230384
+ return {
230385
+ ...nodeJSON,
230386
+ attrs: normalizedAttrs
230387
+ };
230256
230388
  return nodeJSON;
230257
230389
  }
230390
+ function normalizeParagraphAttrsLegacy(attrs) {
230391
+ return omitKeys(attrs, LEGACY_VOLATILE_PARAGRAPH_ATTRS);
230392
+ }
230393
+ function normalizeParagraphNodeJSONLegacy(nodeJSON) {
230394
+ const attrs = nodeJSON.attrs ?? {};
230395
+ const content3 = nodeJSON.content;
230396
+ return {
230397
+ ...nodeJSON,
230398
+ attrs: normalizeParagraphAttrsLegacy(attrs),
230399
+ ...content3 ? { content: content3.map(normalizeContentNodeJSON) } : {}
230400
+ };
230401
+ }
230402
+ function normalizeDocNodeJSONLegacy(nodeJSON) {
230403
+ if (nodeJSON.type === "paragraph")
230404
+ return normalizeParagraphNodeJSONLegacy(nodeJSON);
230405
+ const content3 = nodeJSON.content;
230406
+ if (content3)
230407
+ return {
230408
+ ...nodeJSON,
230409
+ content: content3.map(normalizeDocNodeJSONLegacy)
230410
+ };
230411
+ return nodeJSON;
230412
+ }
230413
+ function normalizeDocJSONLegacy(docJSON) {
230414
+ const content3 = docJSON.content;
230415
+ if (!content3)
230416
+ return docJSON;
230417
+ return {
230418
+ ...docJSON,
230419
+ content: content3.map(normalizeDocNodeJSONLegacy)
230420
+ };
230421
+ }
230258
230422
  function diffSequences(oldSeq, newSeq, options) {
230259
230423
  if (!options)
230260
230424
  throw new Error("diffSequences requires an options object.");
@@ -230814,7 +230978,7 @@ function buildDeletedDiff(nodeInfo, deletedNodesSet) {
230814
230978
  function buildModifiedDiff(oldNodeInfo, newNodeInfo) {
230815
230979
  if (isParagraphNodeInfo(oldNodeInfo) && isParagraphNodeInfo(newNodeInfo))
230816
230980
  return buildModifiedParagraphDiff(oldNodeInfo, newNodeInfo);
230817
- const attrsDiff = getAttributesDiff(oldNodeInfo.node.attrs, newNodeInfo.node.attrs);
230981
+ const attrsDiff = getAttributesDiff(oldNodeInfo.node.attrs, newNodeInfo.node.attrs, NON_PARAGRAPH_BLOCK_IGNORED_ATTRS);
230818
230982
  if (!attrsDiff)
230819
230983
  return null;
230820
230984
  return {
@@ -231388,12 +231552,9 @@ function replayNonParagraphDiff({ tr, diff, schema }) {
231388
231552
  skipWithWarning(`Node type mismatch at pos ${pos} for modification.`);
231389
231553
  return result;
231390
231554
  }
231391
- if (!diff.newNodeJSON?.attrs) {
231392
- skipWithWarning(`Missing newNodeJSON.attrs at pos ${pos} for modification.`);
231393
- return result;
231394
- }
231395
231555
  try {
231396
- tr.setNodeMarkup(pos, undefined, diff.newNodeJSON.attrs, node3.marks);
231556
+ const mergedAttrs = applyAttrsDiff(node3.attrs, diff.attrsDiff);
231557
+ tr.setNodeMarkup(pos, undefined, mergedAttrs, node3.marks);
231397
231558
  result.applied += 1;
231398
231559
  return result;
231399
231560
  } catch (error3) {
@@ -231404,7 +231565,7 @@ function replayNonParagraphDiff({ tr, diff, schema }) {
231404
231565
  skipWithWarning(`Unsupported diff action for non-paragraph node at pos ${pos}.`);
231405
231566
  return result;
231406
231567
  }
231407
- function applyAttrsDiff({ attrs, diff }) {
231568
+ function applyAttrsDiff$1({ attrs, diff }) {
231408
231569
  const updated = JSON.parse(JSON.stringify(attrs ?? {}));
231409
231570
  Object.entries(diff.added || {}).forEach(([path2, value]) => {
231410
231571
  setNestedValue(updated, path2, value);
@@ -231682,19 +231843,15 @@ function replayParagraphDiff({ tr, diff, schema }) {
231682
231843
  skipWithWarning(`Node type mismatch at pos ${pos} for paragraph modification.`);
231683
231844
  return result;
231684
231845
  }
231685
- if (diff.attrsDiff) {
231686
- if (!diff.newNodeJSON?.attrs) {
231687
- skipWithWarning(`Missing newNodeJSON attrs at pos ${pos} for paragraph modification.`);
231688
- return result;
231689
- }
231846
+ if (diff.attrsDiff)
231690
231847
  try {
231691
- tr.setNodeMarkup(pos, undefined, diff.newNodeJSON.attrs, node3.marks);
231848
+ const mergedAttrs = applyAttrsDiff(node3.attrs, diff.attrsDiff);
231849
+ tr.setNodeMarkup(pos, undefined, mergedAttrs, node3.marks);
231692
231850
  result.applied += 1;
231693
231851
  } catch (error3) {
231694
231852
  skipWithWarning(`Failed to update paragraph attrs at pos ${pos}.`);
231695
231853
  return result;
231696
231854
  }
231697
- }
231698
231855
  const paragraphEndPos = pos + 1 + node3.content.size;
231699
231856
  const contentDiffs = [...diff.contentDiff ?? []].sort((a2, b$1) => {
231700
231857
  const aPos = a2.startPos ?? paragraphEndPos;
@@ -248032,6 +248189,16 @@ function buildCanonicalDiffableState(doc$12, comments, styles, numbering, header
248032
248189
  partsState: partsState ? structuredClone(partsState) : null
248033
248190
  };
248034
248191
  }
248192
+ function buildLegacyCanonicalDiffableState(doc$12, comments, styles, numbering, headerFooters, partsState) {
248193
+ return {
248194
+ body: normalizeDocJSONLegacy(doc$12.toJSON()),
248195
+ comments: comments.map(canonicalizeComment),
248196
+ styles: styles ? styles : null,
248197
+ numbering: numbering ? numbering : null,
248198
+ headerFooters: headerFooters ? structuredClone(headerFooters) : null,
248199
+ partsState: partsState ? structuredClone(partsState) : null
248200
+ };
248201
+ }
248035
248202
  function sortKeysDeep(value) {
248036
248203
  if (value === null || value === undefined)
248037
248204
  return value;
@@ -248152,6 +248319,9 @@ function getEditorPartsState(editor, headerFooters) {
248152
248319
  function buildCanonicalStateForCoverage(doc$12, comments, styles, numbering, headerFooters, partsState, coverage) {
248153
248320
  return buildCanonicalDiffableState(doc$12, comments, styles, numbering, coverage.headerFooters ? headerFooters : null, coverage.headerFooters ? partsState : null);
248154
248321
  }
248322
+ function buildLegacyCanonicalStateForCoverage(doc$12, comments, styles, numbering, headerFooters, partsState, coverage) {
248323
+ return buildLegacyCanonicalDiffableState(doc$12, comments, styles, numbering, coverage.headerFooters ? headerFooters : null, coverage.headerFooters ? partsState : null);
248324
+ }
248155
248325
  function captureSnapshot(editor) {
248156
248326
  const doc$12 = editor.state.doc;
248157
248327
  const comments = getEditorComments(editor);
@@ -248196,8 +248366,10 @@ function compareToSnapshot(editor, targetSnapshot) {
248196
248366
  throw err;
248197
248367
  throw new DiffServiceError("INVALID_INPUT", `Snapshot payload contains malformed data that failed during canonicalization: ${err instanceof Error ? err.message : String(err)}`);
248198
248368
  }
248199
- if (reDerivedFingerprint !== targetSnapshot.fingerprint)
248200
- throw new DiffServiceError("INVALID_INPUT", `Target snapshot fingerprint does not match re-derived value. The snapshot may have been tampered with.`);
248369
+ if (reDerivedFingerprint !== targetSnapshot.fingerprint) {
248370
+ if (computeFingerprint(buildLegacyCanonicalStateForCoverage(targetDoc, targetComments, targetStyles, targetNumbering, targetHeaderFooters, targetSnapshot.version === SNAPSHOT_VERSION_V2 ? targetPartsState : null, targetCoverage)) !== targetSnapshot.fingerprint)
248371
+ throw new DiffServiceError("INVALID_INPUT", `Target snapshot fingerprint does not match re-derived value. The snapshot may have been tampered with.`);
248372
+ }
248201
248373
  const baseDoc = editor.state.doc;
248202
248374
  const baseComments = getEditorComments(editor);
248203
248375
  const baseStyles = getEditorStyles(editor);
@@ -248244,8 +248416,10 @@ function applyDiffPayload(editor, diffPayload, options) {
248244
248416
  const baseHeaderFooters = getEditorHeaderFooters(editor);
248245
248417
  const basePartsState = getEditorPartsState(editor, baseHeaderFooters);
248246
248418
  const currentFingerprint = computeFingerprint(buildCanonicalStateForCoverage(baseDoc, baseComments, baseStyles, baseNumbering2, baseHeaderFooters, diffPayload.version === PAYLOAD_VERSION_V2 ? basePartsState : null, diffPayload.coverage));
248247
- if (currentFingerprint !== diffPayload.baseFingerprint)
248248
- throw new DiffServiceError("PRECONDITION_FAILED", `Document fingerprint mismatch. Expected "${diffPayload.baseFingerprint}", got "${currentFingerprint}". The document may have changed since the diff was computed. Re-run diff.compare against the current state.`);
248419
+ if (currentFingerprint !== diffPayload.baseFingerprint) {
248420
+ if (computeFingerprint(buildLegacyCanonicalStateForCoverage(baseDoc, baseComments, baseStyles, baseNumbering2, baseHeaderFooters, diffPayload.version === PAYLOAD_VERSION_V2 ? basePartsState : null, diffPayload.coverage)) !== diffPayload.baseFingerprint)
248421
+ throw new DiffServiceError("PRECONDITION_FAILED", `Document fingerprint mismatch. Expected "${diffPayload.baseFingerprint}", got "${currentFingerprint}". The document may have changed since the diff was computed. Re-run diff.compare against the current state.`);
248422
+ }
248249
248423
  const rawDiff = parseDiffPayloadContents(diffPayload.payload);
248250
248424
  const comments = editor.converter ? Array.isArray(editor.converter.comments) ? editor.converter.comments : [] : [];
248251
248425
  const trackedRequested = options?.changeMode === "tracked";
@@ -293344,7 +293518,7 @@ var Node$13 = class Node$14 {
293344
293518
  id: { default: null },
293345
293519
  edGrp: { default: null },
293346
293520
  displacedByCustomXml: { default: null }
293347
- }), PermEnd, PermEndBlock, IGNORED_ATTRIBUTE_KEYS, TRACK_CHANGE_MARK_NAMES$1, TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS, VOLATILE_PARAGRAPH_ATTRS, VOLATILE_IMAGE_ORIGINAL_ATTR_KEYS, SIMILARITY_THRESHOLD = 0.65, MIN_LENGTH_FOR_SIMILARITY = 4, COMMENT_ATTRS_DIFF_IGNORED_KEYS, SLOT_VARIANTS, PART_KINDS, DOCUMENT_RELS_PATH$2 = "word/_rels/document.xml.rels", DOCUMENT_RELS_PATH$1 = "word/_rels/document.xml.rels", BODY_RELATIONSHIP_EXCLUSIONS, setNestedValue = (target, path2, value) => {
293521
+ }), PermEnd, PermEndBlock, IGNORED_ATTRIBUTE_KEYS, TRACK_CHANGE_MARK_NAMES$1, TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS, NON_SEMANTIC_BLOCK_ATTRS, VOLATILE_IMAGE_ORIGINAL_ATTR_KEYS, LEGACY_VOLATILE_PARAGRAPH_ATTRS, SIMILARITY_THRESHOLD = 0.65, MIN_LENGTH_FOR_SIMILARITY = 4, NON_PARAGRAPH_BLOCK_IGNORED_ATTRS, COMMENT_ATTRS_DIFF_IGNORED_KEYS, SLOT_VARIANTS, PART_KINDS, DOCUMENT_RELS_PATH$2 = "word/_rels/document.xml.rels", DOCUMENT_RELS_PATH$1 = "word/_rels/document.xml.rels", BODY_RELATIONSHIP_EXCLUSIONS, setNestedValue = (target, path2, value) => {
293348
293522
  if (!path2.includes(".")) {
293349
293523
  target[path2] = value;
293350
293524
  return;
@@ -293435,7 +293609,7 @@ var Node$13 = class Node$14 {
293435
293609
  return { warning: `No run nodes found in ${from$1}-${to} for run-attr update.` };
293436
293610
  const failures = [];
293437
293611
  runEntries.forEach(({ pos, node: node3 }) => {
293438
- const updatedAttrs = applyAttrsDiff({
293612
+ const updatedAttrs = applyAttrsDiff$1({
293439
293613
  attrs: node3.attrs,
293440
293614
  diff
293441
293615
  });
@@ -317259,13 +317433,13 @@ menclose::after {
317259
317433
  return;
317260
317434
  console.log(...args$1);
317261
317435
  }, 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, TRACKED_MARK_NAMES;
317262
- var init_src_BVHa1VXC_es = __esm(() => {
317436
+ var init_src_CWBwwVmR_es = __esm(() => {
317263
317437
  init_rolldown_runtime_Bg48TavK_es();
317264
- init_SuperConverter_BzpaXL4Z_es();
317438
+ init_SuperConverter_DA0uKCdy_es();
317265
317439
  init_jszip_C49i9kUs_es();
317266
317440
  init_xml_js_CqGKpaft_es();
317267
317441
  init_uuid_qzgm05fK_es();
317268
- init_create_headless_toolbar_6lLMNI_b_es();
317442
+ init_create_headless_toolbar_CHdUF_l4_es();
317269
317443
  init_constants_DrU4EASo_es();
317270
317444
  init_dist_B8HfvhaK_es();
317271
317445
  init_unified_Dsuw2be5_es();
@@ -322117,6 +322291,10 @@ ${err.toString()}`);
322117
322291
  default: null,
322118
322292
  rendered: false
322119
322293
  },
322294
+ cellSdt: {
322295
+ default: null,
322296
+ rendered: false
322297
+ },
322120
322298
  __placeholder: {
322121
322299
  default: null,
322122
322300
  parseDOM: (element3) => {
@@ -322326,6 +322504,10 @@ ${err.toString()}`);
322326
322504
  tableCellPropertiesInlineKeys: {
322327
322505
  default: null,
322328
322506
  rendered: false
322507
+ },
322508
+ cellSdt: {
322509
+ default: null,
322510
+ rendered: false
322329
322511
  }
322330
322512
  };
322331
322513
  },
@@ -332726,7 +332908,7 @@ ${err.toString()}`);
332726
332908
  customizer = typeof customizer == "function" ? customizer : undefined$1;
332727
332909
  return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
332728
332910
  }
332729
- function cloneDeep(value) {
332911
+ function cloneDeep$1(value) {
332730
332912
  return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
332731
332913
  }
332732
332914
  function cloneDeepWith(value, customizer) {
@@ -333803,7 +333985,7 @@ function print() { __p += __j.call(arguments, '') }
333803
333985
  lodash.ceil = ceil;
333804
333986
  lodash.clamp = clamp$2;
333805
333987
  lodash.clone = clone;
333806
- lodash.cloneDeep = cloneDeep;
333988
+ lodash.cloneDeep = cloneDeep$1;
333807
333989
  lodash.cloneDeepWith = cloneDeepWith;
333808
333990
  lodash.cloneWith = cloneWith;
333809
333991
  lodash.conformsTo = conformsTo;
@@ -335986,7 +336168,9 @@ function print() { __p += __j.call(arguments, '') }
335986
336168
  "trackFormat"
335987
336169
  ]);
335988
336170
  TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS = new Set(["id", "sourceId"]);
335989
- VOLATILE_PARAGRAPH_ATTRS = new Set([
336171
+ NON_SEMANTIC_BLOCK_ATTRS = new Set([
336172
+ "sdBlockId",
336173
+ "sdBlockRev",
335990
336174
  "paraId",
335991
336175
  "textId",
335992
336176
  "rsidR",
@@ -335996,6 +336180,16 @@ function print() { __p += __j.call(arguments, '') }
335996
336180
  "rsidDel"
335997
336181
  ]);
335998
336182
  VOLATILE_IMAGE_ORIGINAL_ATTR_KEYS = new Set(["wp14:anchorId", "wp14:editId"]);
336183
+ LEGACY_VOLATILE_PARAGRAPH_ATTRS = new Set([
336184
+ "paraId",
336185
+ "textId",
336186
+ "rsidR",
336187
+ "rsidRDefault",
336188
+ "rsidP",
336189
+ "rsidRPr",
336190
+ "rsidDel"
336191
+ ]);
336192
+ NON_PARAGRAPH_BLOCK_IGNORED_ATTRS = Array.from(NON_SEMANTIC_BLOCK_ATTRS);
335999
336193
  COMMENT_ATTRS_DIFF_IGNORED_KEYS = [
336000
336194
  "textJson",
336001
336195
  "elements",
@@ -340782,17 +340976,7 @@ function print() { __p += __j.call(arguments, '') }
340782
340976
  headerRowFill: null
340783
340977
  }
340784
340978
  };
340785
- IDENTITY_BLOCK_ATTRS = new Set([
340786
- "sdBlockId",
340787
- "sdBlockRev",
340788
- "paraId",
340789
- "textId",
340790
- "rsidR",
340791
- "rsidRDefault",
340792
- "rsidP",
340793
- "rsidRPr",
340794
- "rsidDel"
340795
- ]);
340979
+ IDENTITY_BLOCK_ATTRS = NON_SEMANTIC_BLOCK_ATTRS;
340796
340980
  WORD_DEFAULT_TBL_LOOK = {
340797
340981
  firstRow: true,
340798
340982
  lastRow: false,
@@ -351353,11 +351537,11 @@ function print() { __p += __j.call(arguments, '') }
351353
351537
  ]);
351354
351538
  });
351355
351539
 
351356
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DLpJoHdY.es.js
351540
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DfP4AvAu.es.js
351357
351541
  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;
351358
- var init_create_super_doc_ui_DLpJoHdY_es = __esm(() => {
351359
- init_SuperConverter_BzpaXL4Z_es();
351360
- init_create_headless_toolbar_6lLMNI_b_es();
351542
+ var init_create_super_doc_ui_DfP4AvAu_es = __esm(() => {
351543
+ init_SuperConverter_DA0uKCdy_es();
351544
+ init_create_headless_toolbar_CHdUF_l4_es();
351361
351545
  MOD_ALIASES = new Set([
351362
351546
  "Mod",
351363
351547
  "Meta",
@@ -351399,16 +351583,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
351399
351583
 
351400
351584
  // ../../packages/superdoc/dist/super-editor.es.js
351401
351585
  var init_super_editor_es = __esm(() => {
351402
- init_src_BVHa1VXC_es();
351403
- init_SuperConverter_BzpaXL4Z_es();
351586
+ init_src_CWBwwVmR_es();
351587
+ init_SuperConverter_DA0uKCdy_es();
351404
351588
  init_jszip_C49i9kUs_es();
351405
351589
  init_xml_js_CqGKpaft_es();
351406
- init_create_headless_toolbar_6lLMNI_b_es();
351590
+ init_create_headless_toolbar_CHdUF_l4_es();
351407
351591
  init_constants_DrU4EASo_es();
351408
351592
  init_dist_B8HfvhaK_es();
351409
351593
  init_unified_Dsuw2be5_es();
351410
351594
  init_DocxZipper_CZMPWpOp_es();
351411
- init_create_super_doc_ui_DLpJoHdY_es();
351595
+ init_create_super_doc_ui_DfP4AvAu_es();
351412
351596
  init_ui_C5PAS9hY_es();
351413
351597
  init_eventemitter3_BnGqBE_Q_es();
351414
351598
  init_errors_CNaD6vcg_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.14.0-next.4",
3
+ "version": "0.14.0-next.6",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -26,19 +26,19 @@
26
26
  "typescript": "^5.9.2",
27
27
  "@superdoc/document-api": "0.0.1",
28
28
  "@superdoc/pm-adapter": "0.0.0",
29
- "@superdoc/super-editor": "0.0.1",
30
- "superdoc": "1.36.1"
29
+ "superdoc": "1.36.1",
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.14.0-next.4",
38
- "@superdoc-dev/cli-darwin-x64": "0.14.0-next.4",
39
- "@superdoc-dev/cli-windows-x64": "0.14.0-next.4",
40
- "@superdoc-dev/cli-linux-x64": "0.14.0-next.4",
41
- "@superdoc-dev/cli-linux-arm64": "0.14.0-next.4"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.14.0-next.6",
38
+ "@superdoc-dev/cli-darwin-x64": "0.14.0-next.6",
39
+ "@superdoc-dev/cli-linux-x64": "0.14.0-next.6",
40
+ "@superdoc-dev/cli-windows-x64": "0.14.0-next.6",
41
+ "@superdoc-dev/cli-linux-arm64": "0.14.0-next.6"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",