@harbour-enterprises/superdoc 2.0.0-next.3 → 2.0.0-next.4

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 (27) hide show
  1. package/dist/chunks/{PdfViewer-4xn9rggA.es.js → PdfViewer-D3PZ6zBK.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-C6tuSJXA.cjs → PdfViewer-DW9Jjot9.cjs} +1 -1
  3. package/dist/chunks/{index-CSZ7bAL7.es.js → index-NcWPPbrQ.es.js} +3 -3
  4. package/dist/chunks/{index-k0xTe_8v.cjs → index-VXujz1iS.cjs} +3 -3
  5. package/dist/chunks/{index-lLnrqNSJ-CMJxa5vJ.cjs → index-YoL4XmHs-DgX6YU__.cjs} +1 -1
  6. package/dist/chunks/{index-lLnrqNSJ-DoACeFqL.es.js → index-YoL4XmHs-DnigArXx.es.js} +1 -1
  7. package/dist/chunks/{super-editor.es-BY4paJvP.cjs → super-editor.es-CeYiIfGN.cjs} +123 -23
  8. package/dist/chunks/{super-editor.es-B1DZfUz0.es.js → super-editor.es-o4f9FxT-.es.js} +123 -23
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-Bd6dIe0l.js → converter-Cv-PWHhI.js} +1 -1
  11. package/dist/super-editor/chunks/{docx-zipper-Dzdi5pfi.js → docx-zipper-aIZi_y1u.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-C3sjGwAb.js → editor-R1nZ8Y4J.js} +124 -24
  13. package/dist/super-editor/chunks/{index-lLnrqNSJ.js → index-YoL4XmHs.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-Bn20lflQ.js → toolbar-DTrmhth_.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +125 -25
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -42428,7 +42428,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42428
42428
  static getStoredSuperdocVersion(docx) {
42429
42429
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42430
42430
  }
42431
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "2.0.0-next.3") {
42431
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "2.0.0-next.4") {
42432
42432
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42433
42433
  }
42434
42434
  /**
@@ -68384,7 +68384,7 @@ ${err.toString()}`);
68384
68384
  const shouldSkipNodeView = (editor) => {
68385
68385
  return isHeadless(editor);
68386
68386
  };
68387
- const summaryVersion = "2.0.0-next.3";
68387
+ const summaryVersion = "2.0.0-next.4";
68388
68388
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
68389
68389
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
68390
68390
  function mapAttributes(attrs) {
@@ -69173,7 +69173,7 @@ ${err.toString()}`);
69173
69173
  { default: remarkStringify2 },
69174
69174
  { default: remarkGfm2 }
69175
69175
  ] = await Promise.all([
69176
- Promise.resolve().then(() => indexLLnrqNSJ),
69176
+ Promise.resolve().then(() => indexYoL4XmHs),
69177
69177
  Promise.resolve().then(() => indexDRCvimau),
69178
69178
  Promise.resolve().then(() => indexC_x_N6Uh),
69179
69179
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -69378,7 +69378,7 @@ ${err.toString()}`);
69378
69378
  * Process collaboration migrations
69379
69379
  */
69380
69380
  processCollaborationMigrations() {
69381
- console.debug("[checkVersionMigrations] Current editor version", "2.0.0-next.3");
69381
+ console.debug("[checkVersionMigrations] Current editor version", "2.0.0-next.4");
69382
69382
  if (!this.options.ydoc) return;
69383
69383
  const metaMap = this.options.ydoc.getMap("meta");
69384
69384
  let docVersion = metaMap.get("version");
@@ -81744,7 +81744,8 @@ ${l}
81744
81744
  }
81745
81745
  const text2 = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? "" : run2.text ?? "";
81746
81746
  const runLength = text2.length;
81747
- const displayText = applyTextTransform$2(text2, run2.textTransform);
81747
+ const transform = isTabRun$1(run2) || "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? void 0 : run2.textTransform;
81748
+ const displayText = applyTextTransform$2(text2, transform);
81748
81749
  if (currentCharOffset + runLength >= charOffset) {
81749
81750
  const offsetInRun = charOffset - currentCharOffset;
81750
81751
  ctx2.font = getRunFontString(run2);
@@ -81794,7 +81795,8 @@ ${l}
81794
81795
  return segmentBaseX + (offsetInSegment >= segmentChars ? segment.width ?? 0 : 0);
81795
81796
  }
81796
81797
  const text2 = run2.text ?? "";
81797
- const displayText = applyTextTransform$2(text2, run2.textTransform);
81798
+ const transform = "textTransform" in run2 ? run2.textTransform : void 0;
81799
+ const displayText = applyTextTransform$2(text2, transform);
81798
81800
  const displaySegmentText = displayText.slice(segment.fromChar, segment.toChar);
81799
81801
  const textUpToTarget = displaySegmentText.slice(0, offsetInSegment);
81800
81802
  ctx2.font = getRunFontString(run2);
@@ -81892,7 +81894,8 @@ ${l}
81892
81894
  }
81893
81895
  const text2 = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? "" : run2.text ?? "";
81894
81896
  const runLength = text2.length;
81895
- const displayText = applyTextTransform$2(text2, run2.textTransform);
81897
+ const transform = isTabRun$1(run2) || "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? void 0 : run2.textTransform;
81898
+ const displayText = applyTextTransform$2(text2, transform);
81896
81899
  if (runLength === 0) continue;
81897
81900
  ctx2.font = getRunFontString(run2);
81898
81901
  for (let i2 = 0; i2 <= runLength; i2++) {
@@ -82370,12 +82373,12 @@ ${l}
82370
82373
  if (markerTextWidth == null && marker.markerText) {
82371
82374
  markerTextWidth = measureMarkerText(marker.markerText, marker);
82372
82375
  }
82373
- if (!Number.isFinite(markerTextWidth) || markerTextWidth < 0) {
82376
+ if (!Number.isFinite(markerTextWidth) || markerTextWidth !== void 0 && markerTextWidth < 0) {
82374
82377
  markerTextWidth = markerBoxWidth;
82375
82378
  }
82376
- markerTextWidth = Math.max(0, markerTextWidth);
82379
+ const finalMarkerTextWidth = Math.max(0, markerTextWidth ?? 0);
82377
82380
  let markerStartPos;
82378
- if (wordLayout?.firstLineIndentMode === true && Number.isFinite(marker.markerX)) {
82381
+ if (wordLayout?.firstLineIndentMode === true && typeof marker.markerX === "number" && Number.isFinite(marker.markerX)) {
82379
82382
  markerStartPos = marker.markerX;
82380
82383
  } else {
82381
82384
  markerStartPos = indentLeft - hanging + firstLine;
@@ -82383,18 +82386,18 @@ ${l}
82383
82386
  if (!Number.isFinite(markerStartPos)) {
82384
82387
  markerStartPos = 0;
82385
82388
  }
82386
- const currentPos = markerStartPos + markerTextWidth;
82389
+ const currentPos = markerStartPos + finalMarkerTextWidth;
82387
82390
  const suffix2 = marker.suffix ?? "tab";
82388
82391
  if (suffix2 === "space") {
82389
- return markerStartPos + markerTextWidth + SPACE_SUFFIX_GAP_PX;
82392
+ return markerStartPos + finalMarkerTextWidth + SPACE_SUFFIX_GAP_PX;
82390
82393
  }
82391
82394
  if (suffix2 === "nothing") {
82392
- return markerStartPos + markerTextWidth;
82395
+ return markerStartPos + finalMarkerTextWidth;
82393
82396
  }
82394
82397
  const markerJustification = marker.justification ?? "left";
82395
82398
  if (markerJustification !== "left") {
82396
82399
  const gutterWidth = typeof marker.gutterWidthPx === "number" && Number.isFinite(marker.gutterWidthPx) && marker.gutterWidthPx > 0 ? marker.gutterWidthPx : LIST_MARKER_GAP$1;
82397
- return markerStartPos + markerTextWidth + Math.max(gutterWidth, LIST_MARKER_GAP$1);
82400
+ return markerStartPos + finalMarkerTextWidth + Math.max(gutterWidth, LIST_MARKER_GAP$1);
82398
82401
  }
82399
82402
  if (wordLayout?.firstLineIndentMode === true) {
82400
82403
  let targetTabStop;
@@ -82418,7 +82421,7 @@ ${l}
82418
82421
  if (tabWidth2 < LIST_MARKER_GAP$1) {
82419
82422
  tabWidth2 = LIST_MARKER_GAP$1;
82420
82423
  }
82421
- return markerStartPos + markerTextWidth + tabWidth2;
82424
+ return markerStartPos + finalMarkerTextWidth + tabWidth2;
82422
82425
  }
82423
82426
  const textStart = indentLeft + firstLine;
82424
82427
  let tabWidth = textStart - currentPos;
@@ -82427,7 +82430,7 @@ ${l}
82427
82430
  } else if (tabWidth < LIST_MARKER_GAP$1) {
82428
82431
  tabWidth = LIST_MARKER_GAP$1;
82429
82432
  }
82430
- return markerStartPos + markerTextWidth + tabWidth;
82433
+ return markerStartPos + finalMarkerTextWidth + tabWidth;
82431
82434
  }
82432
82435
  function getWordLayoutConfig(block) {
82433
82436
  if (!block || block.kind !== "paragraph") {
@@ -83747,6 +83750,94 @@ ${l}
83747
83750
  function getCellTotalLines(cell2) {
83748
83751
  return getCellLines(cell2).length;
83749
83752
  }
83753
+ function mergePmRange(target, range2) {
83754
+ if (typeof range2.pmStart === "number") {
83755
+ target.pmStart = target.pmStart == null ? range2.pmStart : Math.min(target.pmStart, range2.pmStart);
83756
+ }
83757
+ if (typeof range2.pmEnd === "number") {
83758
+ target.pmEnd = target.pmEnd == null ? range2.pmEnd : Math.max(target.pmEnd, range2.pmEnd);
83759
+ }
83760
+ }
83761
+ function computeCellPmRange(cell2, cellMeasure, fromLine, toLine) {
83762
+ const range2 = {};
83763
+ if (!cell2 || !cellMeasure) return range2;
83764
+ const cellBlocks = cell2.blocks ?? (cell2.paragraph ? [cell2.paragraph] : []);
83765
+ const blockMeasures = cellMeasure.blocks ?? (cellMeasure.paragraph ? [cellMeasure.paragraph] : []);
83766
+ const maxBlocks = Math.min(cellBlocks.length, blockMeasures.length);
83767
+ let cumulativeLineCount = 0;
83768
+ for (let i2 = 0; i2 < maxBlocks; i2++) {
83769
+ const block = cellBlocks[i2];
83770
+ const blockMeasure = blockMeasures[i2];
83771
+ if (blockMeasure.kind === "paragraph" && block?.kind === "paragraph") {
83772
+ const paraMeasure = blockMeasure;
83773
+ const lines = paraMeasure.lines;
83774
+ const blockLineCount = lines?.length ?? 0;
83775
+ const blockStartGlobal = cumulativeLineCount;
83776
+ const blockEndGlobal = cumulativeLineCount + blockLineCount;
83777
+ const localFrom = Math.max(fromLine, blockStartGlobal) - blockStartGlobal;
83778
+ const localTo = Math.min(toLine, blockEndGlobal) - blockStartGlobal;
83779
+ if (lines && lines.length > 0 && localFrom < localTo) {
83780
+ mergePmRange(range2, computeFragmentPmRange(block, lines, localFrom, localTo));
83781
+ } else {
83782
+ mergePmRange(range2, extractBlockPmRange(block));
83783
+ }
83784
+ cumulativeLineCount += blockLineCount;
83785
+ continue;
83786
+ }
83787
+ mergePmRange(range2, extractBlockPmRange(block));
83788
+ }
83789
+ return range2;
83790
+ }
83791
+ function computeTableFragmentPmRange(block, measure, fromRow, toRow, partialRow) {
83792
+ const range2 = {};
83793
+ for (let rowIndex = fromRow; rowIndex < toRow; rowIndex++) {
83794
+ const row2 = block.rows[rowIndex];
83795
+ const rowMeasure = measure.rows[rowIndex];
83796
+ if (!row2 || !rowMeasure) continue;
83797
+ const isPartial = partialRow?.rowIndex === rowIndex;
83798
+ const cellCount = Math.min(row2.cells.length, rowMeasure.cells.length);
83799
+ for (let cellIndex = 0; cellIndex < cellCount; cellIndex++) {
83800
+ const cell2 = row2.cells[cellIndex];
83801
+ const cellMeasure = rowMeasure.cells[cellIndex];
83802
+ if (!cell2 || !cellMeasure) continue;
83803
+ const totalLines = getCellTotalLines(cellMeasure);
83804
+ let fromLine = 0;
83805
+ let toLine = totalLines;
83806
+ if (isPartial) {
83807
+ const hasValidFromLineByCell = partialRow?.fromLineByCell && cellIndex < partialRow.fromLineByCell.length;
83808
+ const hasValidToLineByCell = partialRow?.toLineByCell && cellIndex < partialRow.toLineByCell.length;
83809
+ if (hasValidFromLineByCell) {
83810
+ const rawFrom = partialRow.fromLineByCell[cellIndex];
83811
+ if (typeof rawFrom === "number" && rawFrom >= 0) {
83812
+ fromLine = rawFrom;
83813
+ }
83814
+ }
83815
+ if (hasValidToLineByCell) {
83816
+ const rawTo = partialRow.toLineByCell[cellIndex];
83817
+ if (typeof rawTo === "number") {
83818
+ toLine = rawTo === -1 ? totalLines : rawTo;
83819
+ }
83820
+ }
83821
+ }
83822
+ fromLine = Math.max(0, Math.min(fromLine, totalLines));
83823
+ toLine = Math.max(0, Math.min(toLine, totalLines));
83824
+ if (toLine < fromLine) {
83825
+ toLine = fromLine;
83826
+ }
83827
+ mergePmRange(range2, computeCellPmRange(cell2, cellMeasure, fromLine, toLine));
83828
+ }
83829
+ }
83830
+ return range2;
83831
+ }
83832
+ function applyTableFragmentPmRange(fragment, block, measure) {
83833
+ const range2 = computeTableFragmentPmRange(block, measure, fragment.fromRow, fragment.toRow, fragment.partialRow);
83834
+ if (range2.pmStart != null) {
83835
+ fragment.pmStart = range2.pmStart;
83836
+ }
83837
+ if (range2.pmEnd != null) {
83838
+ fragment.pmEnd = range2.pmEnd;
83839
+ }
83840
+ }
83750
83841
  function computePartialRow(rowIndex, blockRow, measure, availableHeight, fromLineByCell) {
83751
83842
  const row2 = measure.rows[rowIndex];
83752
83843
  if (!row2) {
@@ -83891,6 +83982,7 @@ ${l}
83891
83982
  height,
83892
83983
  metadata
83893
83984
  };
83985
+ applyTableFragmentPmRange(fragment, context.block, context.measure);
83894
83986
  state2.page.fragments.push(fragment);
83895
83987
  state2.cursorY += height;
83896
83988
  }
@@ -83969,6 +84061,7 @@ ${l}
83969
84061
  height,
83970
84062
  metadata
83971
84063
  };
84064
+ applyTableFragmentPmRange(fragment, block, measure);
83972
84065
  state2.page.fragments.push(fragment);
83973
84066
  state2.cursorY += height;
83974
84067
  return;
@@ -84032,6 +84125,7 @@ ${l}
84032
84125
  partialRow: continuationPartialRow,
84033
84126
  metadata: generateFragmentMetadata(measure)
84034
84127
  };
84128
+ applyTableFragmentPmRange(fragment2, block, measure);
84035
84129
  state2.page.fragments.push(fragment2);
84036
84130
  state2.cursorY += fragmentHeight2;
84037
84131
  }
@@ -84076,6 +84170,7 @@ ${l}
84076
84170
  partialRow: forcedPartialRow,
84077
84171
  metadata: generateFragmentMetadata(measure)
84078
84172
  };
84173
+ applyTableFragmentPmRange(fragment2, block, measure);
84079
84174
  state2.page.fragments.push(fragment2);
84080
84175
  state2.cursorY += fragmentHeight2;
84081
84176
  pendingPartialRow = forcedPartialRow;
@@ -84111,6 +84206,7 @@ ${l}
84111
84206
  partialRow: partialRow || void 0,
84112
84207
  metadata: generateFragmentMetadata(measure)
84113
84208
  };
84209
+ applyTableFragmentPmRange(fragment, block, measure);
84114
84210
  state2.page.fragments.push(fragment);
84115
84211
  state2.cursorY += fragmentHeight;
84116
84212
  if (partialRow && !partialRow.isLastPart) {
@@ -84128,7 +84224,7 @@ ${l}
84128
84224
  columnBoundaries: generateColumnBoundaries(measure),
84129
84225
  coordinateSystem: "fragment"
84130
84226
  };
84131
- return {
84227
+ const fragment = {
84132
84228
  kind: "table",
84133
84229
  blockId: block.id,
84134
84230
  fromRow: 0,
@@ -84139,6 +84235,8 @@ ${l}
84139
84235
  height: measure.totalHeight ?? 0,
84140
84236
  metadata
84141
84237
  };
84238
+ applyTableFragmentPmRange(fragment, block, measure);
84239
+ return fragment;
84142
84240
  }
84143
84241
  function isPageRelativeAnchor(block) {
84144
84242
  const vRelativeFrom = block.anchor?.vRelativeFrom;
@@ -86598,7 +86696,8 @@ ${l}
86598
86696
  function measureRunSliceWidth(run2, fromChar, toChar) {
86599
86697
  const context = getCtx();
86600
86698
  const fullText = runText(run2);
86601
- const text2 = applyTextTransform$1(fullText.slice(fromChar, toChar), run2.textTransform, fullText, fromChar);
86699
+ const transform = isTextRun$2(run2) ? run2.textTransform : void 0;
86700
+ const text2 = applyTextTransform$1(fullText.slice(fromChar, toChar), transform, fullText, fromChar);
86602
86701
  if (!context) {
86603
86702
  const textRun = isTextRun$2(run2) ? run2 : null;
86604
86703
  const size2 = textRun?.fontSize ?? 16;
@@ -89899,14 +89998,15 @@ ${l}
89899
89998
  if (!schema) return [];
89900
89999
  const types2 = [];
89901
90000
  try {
89902
- schema.nodes.forEach((nodeType, name) => {
90001
+ for (const name in schema.nodes) {
89903
90002
  if (name === "text") {
89904
- return;
90003
+ continue;
89905
90004
  }
89906
- if (nodeType.isAtom || nodeType.isLeaf) {
90005
+ const nodeType = schema.nodes[name];
90006
+ if (nodeType && (nodeType.isAtom || nodeType.isLeaf)) {
89907
90007
  types2.push(name);
89908
90008
  }
89909
- });
90009
+ }
89910
90010
  } catch {
89911
90011
  return [];
89912
90012
  }
@@ -100803,7 +100903,7 @@ ${l}
100803
100903
  return result;
100804
100904
  };
100805
100905
  const applyTextTransform = (text2, run2, startOffset) => {
100806
- const transform = run2.textTransform;
100906
+ const transform = "textTransform" in run2 ? run2.textTransform : void 0;
100807
100907
  if (!text2 || !transform || transform === "none") return text2;
100808
100908
  if (transform === "uppercase") return text2.toUpperCase();
100809
100909
  if (transform === "lowercase") return text2.toLowerCase();
@@ -157665,7 +157765,7 @@ ${style2}
157665
157765
  this.config.colors = shuffleArray(this.config.colors);
157666
157766
  this.userColorMap = /* @__PURE__ */ new Map();
157667
157767
  this.colorIndex = 0;
157668
- this.version = "2.0.0-next.3";
157768
+ this.version = "2.0.0-next.4";
157669
157769
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
157670
157770
  this.superdocId = config2.superdocId || v4();
157671
157771
  this.colors = this.config.colors;
@@ -160138,7 +160238,7 @@ ${style2}
160138
160238
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
160139
160239
  );
160140
160240
  }
160141
- const indexLLnrqNSJ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
160241
+ const indexYoL4XmHs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
160142
160242
  __proto__: null,
160143
160243
  unified
160144
160244
  }, Symbol.toStringTag, { value: "Module" }));