@superdoc-dev/cli 0.8.0-next.29 → 0.8.0-next.30

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 +180 -44
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -207069,7 +207069,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
207069
207069
  init_remark_gfm_BhnWr3yf_es();
207070
207070
  });
207071
207071
 
207072
- // ../../packages/superdoc/dist/chunks/src-BjD8Jue-.es.js
207072
+ // ../../packages/superdoc/dist/chunks/src-DjPB83T8.es.js
207073
207073
  function deleteProps(obj, propOrProps) {
207074
207074
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
207075
207075
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -252143,7 +252143,8 @@ function imageNodeToBlock(node3, nextBlockId, positions, _trackedMeta, _trackedC
252143
252143
  ...rotation !== undefined && { rotation },
252144
252144
  ...flipH !== undefined && { flipH },
252145
252145
  ...flipV !== undefined && { flipV },
252146
- ...hyperlink ? { hyperlink } : {}
252146
+ ...hyperlink ? { hyperlink } : {},
252147
+ sourceAnchor: sourceAnchorFromAttrs(attrs)
252147
252148
  };
252148
252149
  }
252149
252150
  function handleImageNode2(node3, context) {
@@ -252170,6 +252171,7 @@ function chartNodeToDrawingBlock(node3, nextBlockId, positions) {
252170
252171
  flipV: false
252171
252172
  };
252172
252173
  const normalizedWrap = normalizeWrap2(rawAttrs.wrap);
252174
+ const sourceAnchor = isPlainObject3(rawAttrs.sourceAnchor) ? rawAttrs.sourceAnchor : undefined;
252173
252175
  const anchor = normalizeAnchor$1(rawAttrs.anchorData, rawAttrs, normalizedWrap?.behindDoc);
252174
252176
  const pos = positions.get(node3);
252175
252177
  const attrsWithPm = { ...rawAttrs };
@@ -252193,7 +252195,8 @@ function chartNodeToDrawingBlock(node3, nextBlockId, positions) {
252193
252195
  zIndex: resolvedZIndex,
252194
252196
  drawingContentId: typeof rawAttrs.drawingContentId === "string" ? rawAttrs.drawingContentId : undefined,
252195
252197
  drawingContent: toDrawingContentSnapshot(rawAttrs.drawingContent),
252196
- attrs: attrsWithPm
252198
+ attrs: attrsWithPm,
252199
+ sourceAnchor
252197
252200
  };
252198
252201
  }
252199
252202
  function handleChartNode(node3, context) {
@@ -252218,6 +252221,10 @@ function normalizeCellSpacing(raw) {
252218
252221
  type: (raw.type ?? "px").toLowerCase() === "dxa" ? "dxa" : "px"
252219
252222
  };
252220
252223
  }
252224
+ function sourceAnchorFromNode$1(node3) {
252225
+ const sourceAnchor = node3.attrs?.sourceAnchor;
252226
+ return sourceAnchor && typeof sourceAnchor === "object" && !Array.isArray(sourceAnchor) ? sourceAnchor : undefined;
252227
+ }
252221
252228
  function normalizeLegacyBorderStyle(value) {
252222
252229
  switch ((value ?? "").trim().toLowerCase()) {
252223
252230
  case "none":
@@ -252436,7 +252443,8 @@ function tableNodeToBlock(node3, { nextBlockId, positions, storyKey, trackedChan
252436
252443
  attrs: Object.keys(tableAttrs).length > 0 ? tableAttrs : undefined,
252437
252444
  columnWidths,
252438
252445
  ...anchor ? { anchor } : {},
252439
- ...wrap5 ? { wrap: wrap5 } : {}
252446
+ ...wrap5 ? { wrap: wrap5 } : {},
252447
+ sourceAnchor: sourceAnchorFromNode$1(node3)
252440
252448
  };
252441
252449
  }
252442
252450
  function handleTableNode(node3, context) {
@@ -252458,6 +252466,10 @@ function handleTableNode(node3, context) {
252458
252466
  recordBlockKind?.(tableBlock.kind);
252459
252467
  }
252460
252468
  }
252469
+ function sourceAnchorFromNode(node3) {
252470
+ const sourceAnchor = node3.attrs?.sourceAnchor;
252471
+ return sourceAnchor && typeof sourceAnchor === "object" && !Array.isArray(sourceAnchor) ? sourceAnchor : undefined;
252472
+ }
252461
252473
  function mergeAdjacentRuns(runs2) {
252462
252474
  if (runs2.length <= 1)
252463
252475
  return runs2;
@@ -252532,6 +252544,7 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
252532
252544
  const { paragraphAttrs, resolvedParagraphProperties } = computeParagraphAttrs(para, converterContext, previousParagraphFont);
252533
252545
  const blocks2 = [];
252534
252546
  const paraAttrs = para.attrs ?? {};
252547
+ const sourceAnchor = sourceAnchorFromNode(para);
252535
252548
  const rawParagraphProps = typeof paraAttrs.paragraphProperties === "object" && paraAttrs.paragraphProperties !== null ? paraAttrs.paragraphProperties : undefined;
252536
252549
  const isSectPrMarker = Boolean(rawParagraphProps?.sectPr) || paraAttrs.pageBreakSource === "sectPr";
252537
252550
  const extracted = extractDefaultFontProperties(converterContext, resolvedParagraphProperties);
@@ -252570,7 +252583,8 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
252570
252583
  kind: "paragraph",
252571
252584
  id: baseBlockId,
252572
252585
  runs: [emptyRun],
252573
- attrs: emptyParagraphAttrs
252586
+ attrs: emptyParagraphAttrs,
252587
+ sourceAnchor
252574
252588
  });
252575
252589
  if (!trackedChangesConfig)
252576
252590
  return blocks2;
@@ -252638,7 +252652,8 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
252638
252652
  kind: "paragraph",
252639
252653
  id: nextId2(),
252640
252654
  runs: runs2,
252641
- attrs: deepClone3(paragraphAttrs)
252655
+ attrs: deepClone3(paragraphAttrs),
252656
+ sourceAnchor
252642
252657
  });
252643
252658
  partIndex += 1;
252644
252659
  };
@@ -252750,7 +252765,8 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
252750
252765
  fontFamily: defaultFont,
252751
252766
  fontSize: defaultSize
252752
252767
  }],
252753
- attrs: deepClone3(paragraphAttrs)
252768
+ attrs: deepClone3(paragraphAttrs),
252769
+ sourceAnchor
252754
252770
  });
252755
252771
  blocks2.forEach((block) => {
252756
252772
  if (block.kind === "paragraph" && block.runs.length > 1)
@@ -253670,7 +253686,8 @@ function layoutParagraphBlock(ctx$1, anchors) {
253670
253686
  isAnchored: true,
253671
253687
  behindDoc: entry.block.anchor?.behindDoc === true,
253672
253688
  zIndex: getFragmentZIndex(entry.block),
253673
- metadata
253689
+ metadata,
253690
+ sourceAnchor: entry.block.sourceAnchor
253674
253691
  };
253675
253692
  if (pmRange.pmStart != null)
253676
253693
  fragment2.pmStart = pmRange.pmStart;
@@ -253691,7 +253708,8 @@ function layoutParagraphBlock(ctx$1, anchors) {
253691
253708
  isAnchored: true,
253692
253709
  behindDoc: entry.block.anchor?.behindDoc === true,
253693
253710
  zIndex: getFragmentZIndex(entry.block),
253694
- drawingContentId: entry.block.drawingContentId
253711
+ drawingContentId: entry.block.drawingContentId,
253712
+ sourceAnchor: entry.block.sourceAnchor
253695
253713
  };
253696
253714
  if (pmRange.pmStart != null)
253697
253715
  fragment2.pmStart = pmRange.pmStart;
@@ -253756,6 +253774,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
253756
253774
  x,
253757
253775
  y: state.cursorY + yOffset,
253758
253776
  width: fragmentWidth,
253777
+ sourceAnchor: block.sourceAnchor,
253759
253778
  ...computeFragmentPmRange(block, lines, 0, lines.length)
253760
253779
  };
253761
253780
  if (measure.marker || remeasuredMarkerInfo) {
@@ -253888,6 +253907,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
253888
253907
  x: adjustedX,
253889
253908
  y: state.cursorY + borderExpansion.top,
253890
253909
  width: adjustedWidth,
253910
+ sourceAnchor: block.sourceAnchor,
253891
253911
  ...computeFragmentPmRange(block, lines, fromLine, slice2.toLine)
253892
253912
  };
253893
253913
  if (didRemeasureForColumnWidth)
@@ -253988,7 +254008,8 @@ function layoutImageBlock({ block, measure, columns, ensurePage, advanceColumn,
253988
254008
  height,
253989
254009
  pmStart: pmRange.pmStart,
253990
254010
  pmEnd: pmRange.pmEnd,
253991
- metadata
254011
+ metadata,
254012
+ sourceAnchor: block.sourceAnchor
253992
254013
  };
253993
254014
  state.page.fragments.push(fragment2);
253994
254015
  state.cursorY += requiredHeight;
@@ -254048,7 +254069,8 @@ function layoutDrawingBlock({ block, measure, columns, ensurePage, advanceColumn
254048
254069
  drawingContentId: block.drawingContentId,
254049
254070
  zIndex: getFragmentZIndex(block),
254050
254071
  pmStart: pmRange.pmStart,
254051
- pmEnd: pmRange.pmEnd
254072
+ pmEnd: pmRange.pmEnd,
254073
+ sourceAnchor: block.sourceAnchor
254052
254074
  };
254053
254075
  state.page.fragments.push(fragment2);
254054
254076
  state.cursorY += requiredHeight;
@@ -254796,7 +254818,8 @@ function layoutMonolithicTable(context) {
254796
254818
  width,
254797
254819
  height,
254798
254820
  metadata,
254799
- columnWidths
254821
+ columnWidths,
254822
+ sourceAnchor: context.block.sourceAnchor
254800
254823
  };
254801
254824
  applyTableFragmentPmRange(fragment2, context.block, context.measure);
254802
254825
  state.page.fragments.push(fragment2);
@@ -254872,7 +254895,8 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
254872
254895
  width,
254873
254896
  height,
254874
254897
  metadata,
254875
- columnWidths
254898
+ columnWidths,
254899
+ sourceAnchor: block.sourceAnchor
254876
254900
  };
254877
254901
  applyTableFragmentPmRange(fragment2, block, measure);
254878
254902
  state.page.fragments.push(fragment2);
@@ -254944,7 +254968,8 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
254944
254968
  repeatHeaderCount,
254945
254969
  partialRow: continuationPartialRow,
254946
254970
  metadata: generateFragmentMetadata(measure, block, rowIndex, rowIndex + 1, repeatHeaderCount, scaledWidths$1, continuationPartialRow),
254947
- columnWidths: scaledWidths$1
254971
+ columnWidths: scaledWidths$1,
254972
+ sourceAnchor: block.sourceAnchor
254948
254973
  };
254949
254974
  applyTableFragmentPmRange(fragment$1, block, measure);
254950
254975
  state.page.fragments.push(fragment$1);
@@ -254999,7 +255024,8 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
254999
255024
  repeatHeaderCount,
255000
255025
  partialRow: forcedPartialRow,
255001
255026
  metadata: generateFragmentMetadata(measure, block, bodyStartRow, forcedEndRow, repeatHeaderCount, scaledWidths$1, forcedPartialRow),
255002
- columnWidths: scaledWidths$1
255027
+ columnWidths: scaledWidths$1,
255028
+ sourceAnchor: block.sourceAnchor
255003
255029
  };
255004
255030
  applyTableFragmentPmRange(fragment$1, block, measure);
255005
255031
  state.page.fragments.push(fragment$1);
@@ -255027,7 +255053,8 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
255027
255053
  repeatHeaderCount,
255028
255054
  partialRow: partialRow || undefined,
255029
255055
  metadata: generateFragmentMetadata(measure, block, bodyStartRow, endRow, repeatHeaderCount, scaledWidths, partialRow),
255030
- columnWidths: scaledWidths
255056
+ columnWidths: scaledWidths,
255057
+ sourceAnchor: block.sourceAnchor
255031
255058
  };
255032
255059
  applyTableFragmentPmRange(fragment2, block, measure);
255033
255060
  state.page.fragments.push(fragment2);
@@ -255058,7 +255085,8 @@ function createAnchoredTableFragment(block, measure, x, y$1) {
255058
255085
  y: y$1,
255059
255086
  width: measure.totalWidth ?? 0,
255060
255087
  height: measure.totalHeight ?? 0,
255061
- metadata
255088
+ metadata,
255089
+ sourceAnchor: block.sourceAnchor
255062
255090
  };
255063
255091
  applyTableFragmentPmRange(fragment2, block, measure);
255064
255092
  return fragment2;
@@ -256787,7 +256815,8 @@ function layoutDocument(blocks2, measures, options = {}) {
256787
256815
  isAnchored: true,
256788
256816
  behindDoc: imgBlock.anchor?.behindDoc === true,
256789
256817
  zIndex: getFragmentZIndex(imgBlock),
256790
- metadata
256818
+ metadata,
256819
+ sourceAnchor: imgBlock.sourceAnchor
256791
256820
  };
256792
256821
  const attrs = imgBlock.attrs;
256793
256822
  if (attrs?.pmStart != null)
@@ -256829,7 +256858,8 @@ function layoutDocument(blocks2, measures, options = {}) {
256829
256858
  isAnchored: true,
256830
256859
  behindDoc: drawBlock.anchor?.behindDoc === true,
256831
256860
  zIndex: getFragmentZIndex(drawBlock),
256832
- drawingContentId: drawBlock.drawingContentId
256861
+ drawingContentId: drawBlock.drawingContentId,
256862
+ sourceAnchor: drawBlock.sourceAnchor
256833
256863
  };
256834
256864
  const attrs = drawBlock.attrs;
256835
256865
  if (attrs?.pmStart != null)
@@ -260453,6 +260483,45 @@ function compactSnapshotObject(input2) {
260453
260483
  }
260454
260484
  return out;
260455
260485
  }
260486
+ function applySourceAnchorDataset(element3, sourceAnchor) {
260487
+ if (!sourceAnchor) {
260488
+ delete element3.dataset.sourceAnchor;
260489
+ delete element3.dataset.sourceNodeId;
260490
+ delete element3.dataset.sourceOccurrenceId;
260491
+ return;
260492
+ }
260493
+ try {
260494
+ element3.dataset.sourceAnchor = JSON.stringify(sourceAnchor);
260495
+ } catch {
260496
+ delete element3.dataset.sourceAnchor;
260497
+ }
260498
+ if (sourceAnchor.sourceNodeId)
260499
+ element3.dataset.sourceNodeId = sourceAnchor.sourceNodeId;
260500
+ else
260501
+ delete element3.dataset.sourceNodeId;
260502
+ if (sourceAnchor.occurrenceId)
260503
+ element3.dataset.sourceOccurrenceId = sourceAnchor.occurrenceId;
260504
+ else
260505
+ delete element3.dataset.sourceOccurrenceId;
260506
+ }
260507
+ function readSourceAnchorDataset(element3) {
260508
+ if (!element3)
260509
+ return;
260510
+ const encoded = element3.dataset?.sourceAnchor;
260511
+ if (typeof encoded !== "string" || encoded.length === 0)
260512
+ return;
260513
+ try {
260514
+ const parsed = JSON.parse(encoded);
260515
+ return parsed && typeof parsed === "object" ? parsed : undefined;
260516
+ } catch {
260517
+ return;
260518
+ }
260519
+ }
260520
+ function readNearestSourceAnchor(element3) {
260521
+ if (!element3)
260522
+ return;
260523
+ return readSourceAnchorDataset(element3) ?? readSourceAnchorDataset(element3.closest(`.${CLASS_NAMES.fragment}`));
260524
+ }
260456
260525
  function shouldIncludeInlineImageSnapshotElement(element3) {
260457
260526
  if (element3.classList.contains(DOM_CLASS_NAMES.INLINE_IMAGE_CLIP_WRAPPER))
260458
260527
  return true;
@@ -260460,6 +260529,11 @@ function shouldIncludeInlineImageSnapshotElement(element3) {
260460
260529
  return false;
260461
260530
  return !element3.closest(`.${DOM_CLASS_NAMES.INLINE_IMAGE_CLIP_WRAPPER}`);
260462
260531
  }
260532
+ function resolvedPaintCacheSignature(resolvedItem) {
260533
+ if (!resolvedItem)
260534
+ return "";
260535
+ return resolvedItem.paintCacheVersion ?? resolvedItem.version ?? "";
260536
+ }
260463
260537
  function collectPaintSnapshotEntitiesFromDomRoot(rootEl) {
260464
260538
  const entities = createEmptyPaintSnapshotEntities();
260465
260539
  const annotationElements = Array.from(rootEl.querySelectorAll(`.${DOM_CLASS_NAMES.ANNOTATION}[data-pm-start]`));
@@ -260517,7 +260591,8 @@ function collectPaintSnapshotEntitiesFromDomRoot(rootEl) {
260517
260591
  pageIndex,
260518
260592
  kind: "inline",
260519
260593
  pmStart: readSnapshotDatasetNumber(element3.dataset.pmStart),
260520
- pmEnd: readSnapshotDatasetNumber(element3.dataset.pmEnd)
260594
+ pmEnd: readSnapshotDatasetNumber(element3.dataset.pmEnd),
260595
+ sourceAnchor: readNearestSourceAnchor(element3)
260521
260596
  }));
260522
260597
  }
260523
260598
  const fragmentImageElements = Array.from(rootEl.querySelectorAll(`.${DOM_CLASS_NAMES.IMAGE_FRAGMENT}[data-pm-start]`));
@@ -260531,7 +260606,8 @@ function collectPaintSnapshotEntitiesFromDomRoot(rootEl) {
260531
260606
  kind: "fragment",
260532
260607
  pmStart: readSnapshotDatasetNumber(element3.dataset.pmStart),
260533
260608
  pmEnd: readSnapshotDatasetNumber(element3.dataset.pmEnd),
260534
- blockId: element3.getAttribute("data-sd-block-id")
260609
+ blockId: element3.getAttribute("data-sd-block-id"),
260610
+ sourceAnchor: readNearestSourceAnchor(element3)
260535
260611
  }));
260536
260612
  }
260537
260613
  return entities;
@@ -260579,7 +260655,8 @@ function snapshotMarkerStyleFromElement(markerEl) {
260579
260655
  textAlign: readSnapshotStyleValue(style2.textAlign),
260580
260656
  fontWeight: readSnapshotStyleValue(style2.fontWeight),
260581
260657
  fontStyle: readSnapshotStyleValue(style2.fontStyle),
260582
- color: readSnapshotStyleValue(style2.color)
260658
+ color: readSnapshotStyleValue(style2.color),
260659
+ sourceAnchor: readNearestSourceAnchor(markerEl)
260583
260660
  });
260584
260661
  }
260585
260662
  function collectLineMarkersForSnapshot(lineEl) {
@@ -260696,7 +260773,8 @@ function resolveParagraphContent(fragment2, block, measure) {
260696
260773
  italic: m$1.run?.italic,
260697
260774
  color: m$1.run?.color,
260698
260775
  letterSpacing: m$1.run?.letterSpacing
260699
- }
260776
+ },
260777
+ sourceAnchor: block.sourceAnchor
260700
260778
  };
260701
260779
  }
260702
260780
  let dropCap;
@@ -260820,7 +260898,8 @@ function resolveTableItem(fragment2, fragmentIndex, pageIndex, blockMap) {
260820
260898
  block,
260821
260899
  measure,
260822
260900
  cellSpacingPx: measure.cellSpacingPx ?? getCellSpacingPx(block.attrs?.cellSpacing),
260823
- effectiveColumnWidths: fragment2.columnWidths ?? measure.columnWidths
260901
+ effectiveColumnWidths: fragment2.columnWidths ?? measure.columnWidths,
260902
+ sourceAnchor: fragment2.sourceAnchor ?? block.sourceAnchor
260824
260903
  };
260825
260904
  if (fragment2.pmStart != null)
260826
260905
  item.pmStart = fragment2.pmStart;
@@ -260849,7 +260928,8 @@ function resolveImageItem(fragment2, fragmentIndex, pageIndex, blockMap) {
260849
260928
  zIndex: fragment2.isAnchored ? fragment2.zIndex : undefined,
260850
260929
  blockId: fragment2.blockId,
260851
260930
  fragmentIndex,
260852
- block
260931
+ block,
260932
+ sourceAnchor: fragment2.sourceAnchor ?? block.sourceAnchor
260853
260933
  };
260854
260934
  if (fragment2.pmStart != null)
260855
260935
  item.pmStart = fragment2.pmStart;
@@ -260876,7 +260956,8 @@ function resolveDrawingItem(fragment2, fragmentIndex, pageIndex, blockMap) {
260876
260956
  zIndex: fragment2.isAnchored ? fragment2.zIndex : undefined,
260877
260957
  blockId: fragment2.blockId,
260878
260958
  fragmentIndex,
260879
- block
260959
+ block,
260960
+ sourceAnchor: fragment2.sourceAnchor ?? block.sourceAnchor
260880
260961
  };
260881
260962
  if (fragment2.pmStart != null)
260882
260963
  item.pmStart = fragment2.pmStart;
@@ -261027,6 +261108,15 @@ function computeBlockVersion(blockId, blockMap, cache$2) {
261027
261108
  cache$2.set(blockId, version$1);
261028
261109
  return version$1;
261029
261110
  }
261111
+ function applyPaintVersions(item, visualVersion) {
261112
+ const evidenceVersion = sourceAnchorSignature(item.sourceAnchor);
261113
+ item.version = visualVersion;
261114
+ if (evidenceVersion) {
261115
+ item.evidenceVersion = evidenceVersion;
261116
+ item.paintCacheVersion = `${visualVersion}|source:${evidenceVersion}`;
261117
+ } else
261118
+ item.paintCacheVersion = visualVersion;
261119
+ }
261030
261120
  function resolveFragmentItem(fragment2, fragmentIndex, pageIndex, blockMap, blockVersionCache) {
261031
261121
  const sdtContainerKey = resolveFragmentSdtContainerKey(fragment2, blockMap);
261032
261122
  const version$1 = fragmentSignature(fragment2, computeBlockVersion(fragment2.blockId, blockMap, blockVersionCache));
@@ -261035,21 +261125,27 @@ function resolveFragmentItem(fragment2, fragmentIndex, pageIndex, blockMap, bloc
261035
261125
  const item = resolveTableItem(fragment2, fragmentIndex, pageIndex, blockMap);
261036
261126
  if (sdtContainerKey != null)
261037
261127
  item.sdtContainerKey = sdtContainerKey;
261038
- item.version = version$1;
261128
+ if (fragment2.sourceAnchor != null)
261129
+ item.sourceAnchor = fragment2.sourceAnchor;
261130
+ applyPaintVersions(item, version$1);
261039
261131
  return item;
261040
261132
  }
261041
261133
  case "image": {
261042
261134
  const item = resolveImageItem(fragment2, fragmentIndex, pageIndex, blockMap);
261043
261135
  if (sdtContainerKey != null)
261044
261136
  item.sdtContainerKey = sdtContainerKey;
261045
- item.version = version$1;
261137
+ if (fragment2.sourceAnchor != null)
261138
+ item.sourceAnchor = fragment2.sourceAnchor;
261139
+ applyPaintVersions(item, version$1);
261046
261140
  return item;
261047
261141
  }
261048
261142
  case "drawing": {
261049
261143
  const item = resolveDrawingItem(fragment2, fragmentIndex, pageIndex, blockMap);
261050
261144
  if (sdtContainerKey != null)
261051
261145
  item.sdtContainerKey = sdtContainerKey;
261052
- item.version = version$1;
261146
+ if (fragment2.sourceAnchor != null)
261147
+ item.sourceAnchor = fragment2.sourceAnchor;
261148
+ applyPaintVersions(item, version$1);
261053
261149
  return item;
261054
261150
  }
261055
261151
  default: {
@@ -261069,14 +261165,22 @@ function resolveFragmentItem(fragment2, fragmentIndex, pageIndex, blockMap, bloc
261069
261165
  };
261070
261166
  if (sdtContainerKey != null)
261071
261167
  item.sdtContainerKey = sdtContainerKey;
261168
+ if (fragment2.sourceAnchor != null)
261169
+ item.sourceAnchor = fragment2.sourceAnchor;
261072
261170
  const entry = blockMap.get(fragment2.blockId);
261073
261171
  if (entry) {
261074
261172
  if (fragment2.kind === "para" && entry.block.kind === "paragraph" && entry.measure.kind === "paragraph") {
261075
261173
  item.block = entry.block;
261076
261174
  item.measure = entry.measure;
261175
+ if (item.sourceAnchor == null)
261176
+ item.sourceAnchor = entry.block.sourceAnchor;
261077
261177
  } else if (fragment2.kind === "list-item" && entry.block.kind === "list" && entry.measure.kind === "list") {
261078
- item.block = entry.block;
261178
+ const listBlock = entry.block;
261179
+ const listItem2 = listBlock.items.find((candidate) => candidate.id === fragment2.itemId);
261180
+ item.block = listBlock;
261079
261181
  item.measure = entry.measure;
261182
+ if (item.sourceAnchor == null)
261183
+ item.sourceAnchor = listItem2?.sourceAnchor ?? listItem2?.paragraph.sourceAnchor ?? listBlock.sourceAnchor;
261080
261184
  }
261081
261185
  }
261082
261186
  const borders = resolveFragmentParagraphBorders(fragment2, blockMap);
@@ -261105,7 +261209,7 @@ function resolveFragmentItem(fragment2, fragmentIndex, pageIndex, blockMap, bloc
261105
261209
  if (listItem2.markerWidth != null)
261106
261210
  item.markerWidth = listItem2.markerWidth;
261107
261211
  }
261108
- item.version = version$1;
261212
+ applyPaintVersions(item, version$1);
261109
261213
  return item;
261110
261214
  }
261111
261215
  }
@@ -286546,6 +286650,7 @@ menclose::after {
286546
286650
  return anchor.isAnchored || anchor.hRelativeFrom != null || anchor.vRelativeFrom != null || anchor.alignH != null || anchor.alignV != null || anchor.offsetH != null || anchor.offsetV != null || anchor.behindDoc != null ? anchor : undefined;
286547
286651
  }, buildDrawingBlock = (rawAttrs, nextBlockId, positions, node3, geometry, drawingKind, extraProps) => {
286548
286652
  const normalizedWrap = normalizeWrap$2(rawAttrs.wrap);
286653
+ const sourceAnchor = isPlainObject3(rawAttrs.sourceAnchor) ? rawAttrs.sourceAnchor : undefined;
286549
286654
  const baseAnchor = normalizeAnchorData$1(rawAttrs.anchorData, rawAttrs, normalizedWrap?.behindDoc);
286550
286655
  const pos = positions.get(node3);
286551
286656
  const attrsWithPm = { ...rawAttrs };
@@ -286576,6 +286681,7 @@ menclose::after {
286576
286681
  textAlign: typeof rawAttrs.textAlign === "string" ? rawAttrs.textAlign : undefined,
286577
286682
  textVerticalAlign: normalizeTextVerticalAlign(rawAttrs.textVerticalAlign),
286578
286683
  textInsets: normalizeTextInsets(rawAttrs.textInsets),
286684
+ sourceAnchor,
286579
286685
  ...extraProps
286580
286686
  };
286581
286687
  }, getAttrs$1 = (node3) => {
@@ -286597,7 +286703,10 @@ menclose::after {
286597
286703
  width: pickNumber(value) ?? null,
286598
286704
  isFullWidth: false
286599
286705
  };
286600
- }, WRAP_TYPES$1, WRAP_TEXT_VALUES$1, H_RELATIVE_VALUES$1, V_RELATIVE_VALUES$1, H_ALIGN_VALUES, V_ALIGN_VALUES, isPlainObject$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), isAllowedObjectFit = (value) => {
286706
+ }, WRAP_TYPES$1, WRAP_TEXT_VALUES$1, H_RELATIVE_VALUES$1, V_RELATIVE_VALUES$1, H_ALIGN_VALUES, V_ALIGN_VALUES, isPlainObject$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), sourceAnchorFromAttrs = (attrs) => {
286707
+ const sourceAnchor = attrs.sourceAnchor;
286708
+ return isPlainObject$1(sourceAnchor) ? sourceAnchor : undefined;
286709
+ }, isAllowedObjectFit = (value) => {
286601
286710
  return value === "contain" || value === "cover" || value === "fill" || value === "scale-down";
286602
286711
  }, isHiddenDrawing = (attrs) => {
286603
286712
  if (toBoolean$1(attrs.hidden) === true)
@@ -287164,7 +287273,8 @@ menclose::after {
287164
287273
  paragraph: blocks2[0]?.kind === "paragraph" ? blocks2[0] : undefined,
287165
287274
  rowSpan: rowSpan ?? undefined,
287166
287275
  colSpan: colSpan ?? undefined,
287167
- attrs: Object.keys(cellAttrs).length > 0 ? cellAttrs : undefined
287276
+ attrs: Object.keys(cellAttrs).length > 0 ? cellAttrs : undefined,
287277
+ sourceAnchor: sourceAnchorFromNode$1(cellNode)
287168
287278
  };
287169
287279
  }, parseTableRow = (args$1) => {
287170
287280
  const { rowNode, rowIndex, context, defaultCellPadding, tableProperties, numRows } = args$1;
@@ -287198,7 +287308,8 @@ menclose::after {
287198
287308
  return {
287199
287309
  id: context.nextBlockId(`row-${rowIndex}`),
287200
287310
  cells,
287201
- attrs
287311
+ attrs,
287312
+ sourceAnchor: sourceAnchorFromNode$1(rowNode)
287202
287313
  };
287203
287314
  }, isHiddenShape = (node3) => {
287204
287315
  if (!node3.type.toLowerCase().includes("shape"))
@@ -290519,7 +290630,21 @@ menclose::after {
290519
290630
  hash$3 = Math.imul(hash$3, 16777619);
290520
290631
  hash$3 ^= hash$3 >>> 13;
290521
290632
  return hash$3 >>> 0;
290522
- }, deriveBlockVersion = (block) => {
290633
+ }, stableSerializeEvidenceValue = (value) => {
290634
+ if (value === undefined)
290635
+ return "";
290636
+ if (value === null)
290637
+ return "null";
290638
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean")
290639
+ return JSON.stringify(value);
290640
+ if (Array.isArray(value))
290641
+ return `[${value.map((item) => stableSerializeEvidenceValue(item)).join(",")}]`;
290642
+ if (typeof value === "object") {
290643
+ const record = value;
290644
+ return `{${Object.keys(record).sort().filter((key2) => record[key2] !== undefined).map((key2) => `${JSON.stringify(key2)}:${stableSerializeEvidenceValue(record[key2])}`).join(",")}}`;
290645
+ }
290646
+ return JSON.stringify(String(value));
290647
+ }, sourceAnchorSignature = (sourceAnchor) => sourceAnchor ? stableSerializeEvidenceValue(sourceAnchor) : "", deriveBlockVersion = (block) => {
290523
290648
  if (block.kind === "paragraph") {
290524
290649
  const markerVersion = hasListMarkerProperties(block.attrs) ? `marker:${block.attrs.numberingProperties.numId ?? ""}:${block.attrs.numberingProperties.ilvl ?? 0}:${block.attrs.wordLayout?.marker?.markerText ?? ""}` : "";
290525
290650
  const runsVersion = block.runs.map((run2) => {
@@ -296252,7 +296377,7 @@ menclose::after {
296252
296377
  return;
296253
296378
  console.log(...args$1);
296254
296379
  }, 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;
296255
- var init_src_BjD8Jue_es = __esm(() => {
296380
+ var init_src_DjPB83T8_es = __esm(() => {
296256
296381
  init_rolldown_runtime_Bg48TavK_es();
296257
296382
  init_SuperConverter_4akUYfWt_es();
296258
296383
  init_jszip_C49i9kUs_es();
@@ -322955,7 +323080,8 @@ function print() { __p += __j.call(arguments, '') }
322955
323080
  inTableParagraph: options.inTableParagraph === true,
322956
323081
  style: style2,
322957
323082
  markers,
322958
- tabs
323083
+ tabs,
323084
+ sourceAnchor: readNearestSourceAnchor(lineEl) ?? readNearestSourceAnchor(options.wrapperEl) ?? options.sourceAnchor
322959
323085
  }));
322960
323086
  page.lineCount += 1;
322961
323087
  builder.lineCount += 1;
@@ -322992,7 +323118,8 @@ function print() { __p += __j.call(arguments, '') }
322992
323118
  inTableParagraph: Boolean(lineEl.closest(".superdoc-table-paragraph")),
322993
323119
  style: snapshotLineStyleFromElement(lineEl),
322994
323120
  markers,
322995
- tabs
323121
+ tabs,
323122
+ sourceAnchor: readNearestSourceAnchor(lineEl)
322996
323123
  }));
322997
323124
  }
322998
323125
  const pageNumberRaw = pageEl.dataset?.pageNumber;
@@ -323817,7 +323944,7 @@ function print() { __p += __j.call(arguments, '') }
323817
323944
  const sdtBoundary = sdtBoundaries.get(index2);
323818
323945
  const betweenInfo = betweenBorderFlags.get(index2);
323819
323946
  const resolvedItem = this.getResolvedFragmentItem(pageIndex, index2);
323820
- const resolvedSig = resolvedItem?.version ?? "";
323947
+ const resolvedSig = resolvedPaintCacheSignature(resolvedItem);
323821
323948
  if (current) {
323822
323949
  existing.delete(key2);
323823
323950
  const geometryChanged = hasFragmentGeometryChanged(current.fragment, fragment2);
@@ -323917,7 +324044,7 @@ function print() { __p += __j.call(arguments, '') }
323917
324044
  const resolvedItem = this.getResolvedFragmentItem(pageIndex, index2);
323918
324045
  const fragmentEl = this.renderFragment(fragment2, contextBase, sdtBoundary, betweenBorderFlags.get(index2), resolvedItem);
323919
324046
  el.appendChild(fragmentEl);
323920
- const initSig = resolvedItem?.version ?? "";
324047
+ const initSig = resolvedPaintCacheSignature(resolvedItem);
323921
324048
  return {
323922
324049
  key: fragmentKey(fragment2),
323923
324050
  signature: initSig,
@@ -324089,6 +324216,7 @@ function print() { __p += __j.call(arguments, '') }
324089
324216
  const markerEl = this.doc.createElement("span");
324090
324217
  markerEl.classList.add("superdoc-paragraph-marker");
324091
324218
  markerEl.textContent = resolvedMarker.text;
324219
+ applySourceAnchorDataset(markerEl, resolvedMarker.sourceAnchor ?? resolvedItem?.sourceAnchor ?? fragment2.sourceAnchor);
324092
324220
  markerEl.style.pointerEvents = "none";
324093
324221
  markerContainer.style.position = "relative";
324094
324222
  if (resolvedMarker.justification === "right") {
@@ -324128,7 +324256,8 @@ function print() { __p += __j.call(arguments, '') }
324128
324256
  }
324129
324257
  this.capturePaintSnapshotLine(lineEl, context, {
324130
324258
  inTableFragment: false,
324131
- inTableParagraph: false
324259
+ inTableParagraph: false,
324260
+ sourceAnchor: resolvedItem?.sourceAnchor ?? fragment2.sourceAnchor
324132
324261
  });
324133
324262
  fragmentEl.appendChild(lineEl);
324134
324263
  });
@@ -324224,6 +324353,7 @@ function print() { __p += __j.call(arguments, '') }
324224
324353
  const markerEl = this.doc.createElement("span");
324225
324354
  markerEl.classList.add("superdoc-paragraph-marker");
324226
324355
  markerEl.textContent = marker.markerText ?? "";
324356
+ applySourceAnchorDataset(markerEl, block.sourceAnchor ?? resolvedItem?.sourceAnchor ?? fragment2.sourceAnchor);
324227
324357
  markerEl.style.pointerEvents = "none";
324228
324358
  const markerJustification = marker.justification ?? "left";
324229
324359
  markerContainer.style.position = "relative";
@@ -324265,7 +324395,8 @@ function print() { __p += __j.call(arguments, '') }
324265
324395
  }
324266
324396
  this.capturePaintSnapshotLine(lineEl, context, {
324267
324397
  inTableFragment: false,
324268
- inTableParagraph: false
324398
+ inTableParagraph: false,
324399
+ sourceAnchor: resolvedItem?.sourceAnchor ?? fragment2.sourceAnchor
324269
324400
  });
324270
324401
  fragmentEl.appendChild(lineEl);
324271
324402
  });
@@ -324353,6 +324484,7 @@ function print() { __p += __j.call(arguments, '') }
324353
324484
  fragmentEl.style.top = `${fragment2.y}px`;
324354
324485
  fragmentEl.style.width = `${fragment2.markerWidth + fragment2.width}px`;
324355
324486
  fragmentEl.dataset.blockId = fragment2.blockId;
324487
+ applySourceAnchorDataset(fragmentEl, fragment2.sourceAnchor);
324356
324488
  }
324357
324489
  fragmentEl.dataset.itemId = fragment2.itemId;
324358
324490
  const paragraphMetadata = item.paragraph.attrs?.sdt;
@@ -324364,6 +324496,7 @@ function print() { __p += __j.call(arguments, '') }
324364
324496
  fragmentEl.dataset.continuesOnNext = "true";
324365
324497
  const markerEl = this.doc.createElement("span");
324366
324498
  markerEl.classList.add("superdoc-list-marker");
324499
+ applySourceAnchorDataset(markerEl, item.marker.sourceAnchor ?? item.sourceAnchor ?? resolvedItem?.sourceAnchor ?? fragment2.sourceAnchor);
324367
324500
  const wordLayout = item.paragraph.attrs?.wordLayout;
324368
324501
  const marker = wordLayout?.marker;
324369
324502
  if (marker) {
@@ -324419,7 +324552,8 @@ function print() { __p += __j.call(arguments, '') }
324419
324552
  const lineEl = this.renderLine(paraForList, line, context, fragment2.width, fragment2.fromLine + idx, true, expandedRunsForList);
324420
324553
  this.capturePaintSnapshotLine(lineEl, context, {
324421
324554
  inTableFragment: false,
324422
- inTableParagraph: false
324555
+ inTableParagraph: false,
324556
+ sourceAnchor: resolvedItem?.sourceAnchor ?? fragment2.sourceAnchor
324423
324557
  });
324424
324558
  contentEl.appendChild(lineEl);
324425
324559
  });
@@ -326380,6 +326514,7 @@ function print() { __p += __j.call(arguments, '') }
326380
326514
  el.style.width = `${fragment2.width}px`;
326381
326515
  el.dataset.blockId = fragment2.blockId;
326382
326516
  el.dataset.layoutEpoch = String(this.layoutEpoch);
326517
+ applySourceAnchorDataset(el, fragment2.sourceAnchor);
326383
326518
  if (typeof fragment2.blockId === "string" && fragment2.blockId.startsWith("footnote-"))
326384
326519
  el.setAttribute("contenteditable", "false");
326385
326520
  if (fragment2.kind === "para") {
@@ -326460,6 +326595,7 @@ function print() { __p += __j.call(arguments, '') }
326460
326595
  el.style.width = `${item.width}px`;
326461
326596
  el.dataset.blockId = item.blockId;
326462
326597
  el.dataset.layoutEpoch = String(this.layoutEpoch);
326598
+ applySourceAnchorDataset(el, item.sourceAnchor ?? fragment2.sourceAnchor);
326463
326599
  this.applyFragmentWrapperZIndex(el, fragment2, item.zIndex);
326464
326600
  if (item.fragmentKind === "image" || item.fragmentKind === "drawing" || item.fragmentKind === "table")
326465
326601
  el.style.height = `${item.height}px`;
@@ -333200,7 +333336,7 @@ var init_zipper_CSxGBanD_es = __esm(() => {
333200
333336
 
333201
333337
  // ../../packages/superdoc/dist/super-editor.es.js
333202
333338
  var init_super_editor_es = __esm(() => {
333203
- init_src_BjD8Jue_es();
333339
+ init_src_DjPB83T8_es();
333204
333340
  init_SuperConverter_4akUYfWt_es();
333205
333341
  init_jszip_C49i9kUs_es();
333206
333342
  init_xml_js_CqGKpaft_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.8.0-next.29",
3
+ "version": "0.8.0-next.30",
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/pm-adapter": "0.0.0",
29
28
  "@superdoc/super-editor": "0.0.1",
30
- "superdoc": "1.29.0"
29
+ "superdoc": "1.29.0",
30
+ "@superdoc/pm-adapter": "0.0.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.29",
38
- "@superdoc-dev/cli-darwin-x64": "0.8.0-next.29",
39
- "@superdoc-dev/cli-linux-x64": "0.8.0-next.29",
40
- "@superdoc-dev/cli-linux-arm64": "0.8.0-next.29",
41
- "@superdoc-dev/cli-windows-x64": "0.8.0-next.29"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.30",
38
+ "@superdoc-dev/cli-darwin-x64": "0.8.0-next.30",
39
+ "@superdoc-dev/cli-linux-x64": "0.8.0-next.30",
40
+ "@superdoc-dev/cli-linux-arm64": "0.8.0-next.30",
41
+ "@superdoc-dev/cli-windows-x64": "0.8.0-next.30"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",