@superdoc-dev/mcp 0.3.0-next.10 → 0.3.0-next.11

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 +3 -3
package/dist/index.js CHANGED
@@ -198622,7 +198622,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
198622
198622
  init_remark_gfm_BhnWr3yf_es();
198623
198623
  });
198624
198624
 
198625
- // ../../packages/superdoc/dist/chunks/src-BjD8Jue-.es.js
198625
+ // ../../packages/superdoc/dist/chunks/src-DjPB83T8.es.js
198626
198626
  function deleteProps(obj, propOrProps) {
198627
198627
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
198628
198628
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -243696,7 +243696,8 @@ function imageNodeToBlock(node2, nextBlockId, positions, _trackedMeta, _trackedC
243696
243696
  ...rotation !== undefined && { rotation },
243697
243697
  ...flipH !== undefined && { flipH },
243698
243698
  ...flipV !== undefined && { flipV },
243699
- ...hyperlink ? { hyperlink } : {}
243699
+ ...hyperlink ? { hyperlink } : {},
243700
+ sourceAnchor: sourceAnchorFromAttrs(attrs)
243700
243701
  };
243701
243702
  }
243702
243703
  function handleImageNode2(node2, context) {
@@ -243723,6 +243724,7 @@ function chartNodeToDrawingBlock(node2, nextBlockId, positions) {
243723
243724
  flipV: false
243724
243725
  };
243725
243726
  const normalizedWrap = normalizeWrap2(rawAttrs.wrap);
243727
+ const sourceAnchor = isPlainObject4(rawAttrs.sourceAnchor) ? rawAttrs.sourceAnchor : undefined;
243726
243728
  const anchor = normalizeAnchor$1(rawAttrs.anchorData, rawAttrs, normalizedWrap?.behindDoc);
243727
243729
  const pos = positions.get(node2);
243728
243730
  const attrsWithPm = { ...rawAttrs };
@@ -243746,7 +243748,8 @@ function chartNodeToDrawingBlock(node2, nextBlockId, positions) {
243746
243748
  zIndex: resolvedZIndex,
243747
243749
  drawingContentId: typeof rawAttrs.drawingContentId === "string" ? rawAttrs.drawingContentId : undefined,
243748
243750
  drawingContent: toDrawingContentSnapshot(rawAttrs.drawingContent),
243749
- attrs: attrsWithPm
243751
+ attrs: attrsWithPm,
243752
+ sourceAnchor
243750
243753
  };
243751
243754
  }
243752
243755
  function handleChartNode(node2, context) {
@@ -243771,6 +243774,10 @@ function normalizeCellSpacing(raw) {
243771
243774
  type: (raw.type ?? "px").toLowerCase() === "dxa" ? "dxa" : "px"
243772
243775
  };
243773
243776
  }
243777
+ function sourceAnchorFromNode$1(node2) {
243778
+ const sourceAnchor = node2.attrs?.sourceAnchor;
243779
+ return sourceAnchor && typeof sourceAnchor === "object" && !Array.isArray(sourceAnchor) ? sourceAnchor : undefined;
243780
+ }
243774
243781
  function normalizeLegacyBorderStyle(value) {
243775
243782
  switch ((value ?? "").trim().toLowerCase()) {
243776
243783
  case "none":
@@ -243989,7 +243996,8 @@ function tableNodeToBlock(node2, { nextBlockId, positions, storyKey, trackedChan
243989
243996
  attrs: Object.keys(tableAttrs).length > 0 ? tableAttrs : undefined,
243990
243997
  columnWidths,
243991
243998
  ...anchor ? { anchor } : {},
243992
- ...wrap4 ? { wrap: wrap4 } : {}
243999
+ ...wrap4 ? { wrap: wrap4 } : {},
244000
+ sourceAnchor: sourceAnchorFromNode$1(node2)
243993
244001
  };
243994
244002
  }
243995
244003
  function handleTableNode(node2, context) {
@@ -244011,6 +244019,10 @@ function handleTableNode(node2, context) {
244011
244019
  recordBlockKind?.(tableBlock.kind);
244012
244020
  }
244013
244021
  }
244022
+ function sourceAnchorFromNode(node2) {
244023
+ const sourceAnchor = node2.attrs?.sourceAnchor;
244024
+ return sourceAnchor && typeof sourceAnchor === "object" && !Array.isArray(sourceAnchor) ? sourceAnchor : undefined;
244025
+ }
244014
244026
  function mergeAdjacentRuns(runs2) {
244015
244027
  if (runs2.length <= 1)
244016
244028
  return runs2;
@@ -244085,6 +244097,7 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
244085
244097
  const { paragraphAttrs, resolvedParagraphProperties } = computeParagraphAttrs(para, converterContext, previousParagraphFont);
244086
244098
  const blocks2 = [];
244087
244099
  const paraAttrs = para.attrs ?? {};
244100
+ const sourceAnchor = sourceAnchorFromNode(para);
244088
244101
  const rawParagraphProps = typeof paraAttrs.paragraphProperties === "object" && paraAttrs.paragraphProperties !== null ? paraAttrs.paragraphProperties : undefined;
244089
244102
  const isSectPrMarker = Boolean(rawParagraphProps?.sectPr) || paraAttrs.pageBreakSource === "sectPr";
244090
244103
  const extracted = extractDefaultFontProperties(converterContext, resolvedParagraphProperties);
@@ -244123,7 +244136,8 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
244123
244136
  kind: "paragraph",
244124
244137
  id: baseBlockId,
244125
244138
  runs: [emptyRun],
244126
- attrs: emptyParagraphAttrs
244139
+ attrs: emptyParagraphAttrs,
244140
+ sourceAnchor
244127
244141
  });
244128
244142
  if (!trackedChangesConfig)
244129
244143
  return blocks2;
@@ -244191,7 +244205,8 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
244191
244205
  kind: "paragraph",
244192
244206
  id: nextId(),
244193
244207
  runs: runs2,
244194
- attrs: deepClone2(paragraphAttrs)
244208
+ attrs: deepClone2(paragraphAttrs),
244209
+ sourceAnchor
244195
244210
  });
244196
244211
  partIndex += 1;
244197
244212
  };
@@ -244303,7 +244318,8 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
244303
244318
  fontFamily: defaultFont,
244304
244319
  fontSize: defaultSize
244305
244320
  }],
244306
- attrs: deepClone2(paragraphAttrs)
244321
+ attrs: deepClone2(paragraphAttrs),
244322
+ sourceAnchor
244307
244323
  });
244308
244324
  blocks2.forEach((block) => {
244309
244325
  if (block.kind === "paragraph" && block.runs.length > 1)
@@ -245223,7 +245239,8 @@ function layoutParagraphBlock(ctx$1, anchors) {
245223
245239
  isAnchored: true,
245224
245240
  behindDoc: entry.block.anchor?.behindDoc === true,
245225
245241
  zIndex: getFragmentZIndex(entry.block),
245226
- metadata
245242
+ metadata,
245243
+ sourceAnchor: entry.block.sourceAnchor
245227
245244
  };
245228
245245
  if (pmRange.pmStart != null)
245229
245246
  fragment.pmStart = pmRange.pmStart;
@@ -245244,7 +245261,8 @@ function layoutParagraphBlock(ctx$1, anchors) {
245244
245261
  isAnchored: true,
245245
245262
  behindDoc: entry.block.anchor?.behindDoc === true,
245246
245263
  zIndex: getFragmentZIndex(entry.block),
245247
- drawingContentId: entry.block.drawingContentId
245264
+ drawingContentId: entry.block.drawingContentId,
245265
+ sourceAnchor: entry.block.sourceAnchor
245248
245266
  };
245249
245267
  if (pmRange.pmStart != null)
245250
245268
  fragment.pmStart = pmRange.pmStart;
@@ -245309,6 +245327,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
245309
245327
  x,
245310
245328
  y: state.cursorY + yOffset,
245311
245329
  width: fragmentWidth,
245330
+ sourceAnchor: block.sourceAnchor,
245312
245331
  ...computeFragmentPmRange(block, lines, 0, lines.length)
245313
245332
  };
245314
245333
  if (measure.marker || remeasuredMarkerInfo) {
@@ -245441,6 +245460,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
245441
245460
  x: adjustedX,
245442
245461
  y: state.cursorY + borderExpansion.top,
245443
245462
  width: adjustedWidth,
245463
+ sourceAnchor: block.sourceAnchor,
245444
245464
  ...computeFragmentPmRange(block, lines, fromLine, slice2.toLine)
245445
245465
  };
245446
245466
  if (didRemeasureForColumnWidth)
@@ -245541,7 +245561,8 @@ function layoutImageBlock({ block, measure, columns, ensurePage, advanceColumn,
245541
245561
  height,
245542
245562
  pmStart: pmRange.pmStart,
245543
245563
  pmEnd: pmRange.pmEnd,
245544
- metadata
245564
+ metadata,
245565
+ sourceAnchor: block.sourceAnchor
245545
245566
  };
245546
245567
  state.page.fragments.push(fragment);
245547
245568
  state.cursorY += requiredHeight;
@@ -245601,7 +245622,8 @@ function layoutDrawingBlock({ block, measure, columns, ensurePage, advanceColumn
245601
245622
  drawingContentId: block.drawingContentId,
245602
245623
  zIndex: getFragmentZIndex(block),
245603
245624
  pmStart: pmRange.pmStart,
245604
- pmEnd: pmRange.pmEnd
245625
+ pmEnd: pmRange.pmEnd,
245626
+ sourceAnchor: block.sourceAnchor
245605
245627
  };
245606
245628
  state.page.fragments.push(fragment);
245607
245629
  state.cursorY += requiredHeight;
@@ -246349,7 +246371,8 @@ function layoutMonolithicTable(context) {
246349
246371
  width,
246350
246372
  height,
246351
246373
  metadata,
246352
- columnWidths
246374
+ columnWidths,
246375
+ sourceAnchor: context.block.sourceAnchor
246353
246376
  };
246354
246377
  applyTableFragmentPmRange(fragment, context.block, context.measure);
246355
246378
  state.page.fragments.push(fragment);
@@ -246425,7 +246448,8 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
246425
246448
  width,
246426
246449
  height,
246427
246450
  metadata,
246428
- columnWidths
246451
+ columnWidths,
246452
+ sourceAnchor: block.sourceAnchor
246429
246453
  };
246430
246454
  applyTableFragmentPmRange(fragment, block, measure);
246431
246455
  state.page.fragments.push(fragment);
@@ -246497,7 +246521,8 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
246497
246521
  repeatHeaderCount,
246498
246522
  partialRow: continuationPartialRow,
246499
246523
  metadata: generateFragmentMetadata(measure, block, rowIndex, rowIndex + 1, repeatHeaderCount, scaledWidths$1, continuationPartialRow),
246500
- columnWidths: scaledWidths$1
246524
+ columnWidths: scaledWidths$1,
246525
+ sourceAnchor: block.sourceAnchor
246501
246526
  };
246502
246527
  applyTableFragmentPmRange(fragment$1, block, measure);
246503
246528
  state.page.fragments.push(fragment$1);
@@ -246552,7 +246577,8 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
246552
246577
  repeatHeaderCount,
246553
246578
  partialRow: forcedPartialRow,
246554
246579
  metadata: generateFragmentMetadata(measure, block, bodyStartRow, forcedEndRow, repeatHeaderCount, scaledWidths$1, forcedPartialRow),
246555
- columnWidths: scaledWidths$1
246580
+ columnWidths: scaledWidths$1,
246581
+ sourceAnchor: block.sourceAnchor
246556
246582
  };
246557
246583
  applyTableFragmentPmRange(fragment$1, block, measure);
246558
246584
  state.page.fragments.push(fragment$1);
@@ -246580,7 +246606,8 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
246580
246606
  repeatHeaderCount,
246581
246607
  partialRow: partialRow || undefined,
246582
246608
  metadata: generateFragmentMetadata(measure, block, bodyStartRow, endRow, repeatHeaderCount, scaledWidths, partialRow),
246583
- columnWidths: scaledWidths
246609
+ columnWidths: scaledWidths,
246610
+ sourceAnchor: block.sourceAnchor
246584
246611
  };
246585
246612
  applyTableFragmentPmRange(fragment, block, measure);
246586
246613
  state.page.fragments.push(fragment);
@@ -246611,7 +246638,8 @@ function createAnchoredTableFragment(block, measure, x, y$1) {
246611
246638
  y: y$1,
246612
246639
  width: measure.totalWidth ?? 0,
246613
246640
  height: measure.totalHeight ?? 0,
246614
- metadata
246641
+ metadata,
246642
+ sourceAnchor: block.sourceAnchor
246615
246643
  };
246616
246644
  applyTableFragmentPmRange(fragment, block, measure);
246617
246645
  return fragment;
@@ -248340,7 +248368,8 @@ function layoutDocument(blocks2, measures, options = {}) {
248340
248368
  isAnchored: true,
248341
248369
  behindDoc: imgBlock.anchor?.behindDoc === true,
248342
248370
  zIndex: getFragmentZIndex(imgBlock),
248343
- metadata
248371
+ metadata,
248372
+ sourceAnchor: imgBlock.sourceAnchor
248344
248373
  };
248345
248374
  const attrs = imgBlock.attrs;
248346
248375
  if (attrs?.pmStart != null)
@@ -248382,7 +248411,8 @@ function layoutDocument(blocks2, measures, options = {}) {
248382
248411
  isAnchored: true,
248383
248412
  behindDoc: drawBlock.anchor?.behindDoc === true,
248384
248413
  zIndex: getFragmentZIndex(drawBlock),
248385
- drawingContentId: drawBlock.drawingContentId
248414
+ drawingContentId: drawBlock.drawingContentId,
248415
+ sourceAnchor: drawBlock.sourceAnchor
248386
248416
  };
248387
248417
  const attrs = drawBlock.attrs;
248388
248418
  if (attrs?.pmStart != null)
@@ -252006,6 +252036,45 @@ function compactSnapshotObject(input2) {
252006
252036
  }
252007
252037
  return out;
252008
252038
  }
252039
+ function applySourceAnchorDataset(element3, sourceAnchor) {
252040
+ if (!sourceAnchor) {
252041
+ delete element3.dataset.sourceAnchor;
252042
+ delete element3.dataset.sourceNodeId;
252043
+ delete element3.dataset.sourceOccurrenceId;
252044
+ return;
252045
+ }
252046
+ try {
252047
+ element3.dataset.sourceAnchor = JSON.stringify(sourceAnchor);
252048
+ } catch {
252049
+ delete element3.dataset.sourceAnchor;
252050
+ }
252051
+ if (sourceAnchor.sourceNodeId)
252052
+ element3.dataset.sourceNodeId = sourceAnchor.sourceNodeId;
252053
+ else
252054
+ delete element3.dataset.sourceNodeId;
252055
+ if (sourceAnchor.occurrenceId)
252056
+ element3.dataset.sourceOccurrenceId = sourceAnchor.occurrenceId;
252057
+ else
252058
+ delete element3.dataset.sourceOccurrenceId;
252059
+ }
252060
+ function readSourceAnchorDataset(element3) {
252061
+ if (!element3)
252062
+ return;
252063
+ const encoded = element3.dataset?.sourceAnchor;
252064
+ if (typeof encoded !== "string" || encoded.length === 0)
252065
+ return;
252066
+ try {
252067
+ const parsed = JSON.parse(encoded);
252068
+ return parsed && typeof parsed === "object" ? parsed : undefined;
252069
+ } catch {
252070
+ return;
252071
+ }
252072
+ }
252073
+ function readNearestSourceAnchor(element3) {
252074
+ if (!element3)
252075
+ return;
252076
+ return readSourceAnchorDataset(element3) ?? readSourceAnchorDataset(element3.closest(`.${CLASS_NAMES.fragment}`));
252077
+ }
252009
252078
  function shouldIncludeInlineImageSnapshotElement(element3) {
252010
252079
  if (element3.classList.contains(DOM_CLASS_NAMES.INLINE_IMAGE_CLIP_WRAPPER))
252011
252080
  return true;
@@ -252013,6 +252082,11 @@ function shouldIncludeInlineImageSnapshotElement(element3) {
252013
252082
  return false;
252014
252083
  return !element3.closest(`.${DOM_CLASS_NAMES.INLINE_IMAGE_CLIP_WRAPPER}`);
252015
252084
  }
252085
+ function resolvedPaintCacheSignature(resolvedItem) {
252086
+ if (!resolvedItem)
252087
+ return "";
252088
+ return resolvedItem.paintCacheVersion ?? resolvedItem.version ?? "";
252089
+ }
252016
252090
  function collectPaintSnapshotEntitiesFromDomRoot(rootEl) {
252017
252091
  const entities = createEmptyPaintSnapshotEntities();
252018
252092
  const annotationElements = Array.from(rootEl.querySelectorAll(`.${DOM_CLASS_NAMES.ANNOTATION}[data-pm-start]`));
@@ -252070,7 +252144,8 @@ function collectPaintSnapshotEntitiesFromDomRoot(rootEl) {
252070
252144
  pageIndex,
252071
252145
  kind: "inline",
252072
252146
  pmStart: readSnapshotDatasetNumber(element3.dataset.pmStart),
252073
- pmEnd: readSnapshotDatasetNumber(element3.dataset.pmEnd)
252147
+ pmEnd: readSnapshotDatasetNumber(element3.dataset.pmEnd),
252148
+ sourceAnchor: readNearestSourceAnchor(element3)
252074
252149
  }));
252075
252150
  }
252076
252151
  const fragmentImageElements = Array.from(rootEl.querySelectorAll(`.${DOM_CLASS_NAMES.IMAGE_FRAGMENT}[data-pm-start]`));
@@ -252084,7 +252159,8 @@ function collectPaintSnapshotEntitiesFromDomRoot(rootEl) {
252084
252159
  kind: "fragment",
252085
252160
  pmStart: readSnapshotDatasetNumber(element3.dataset.pmStart),
252086
252161
  pmEnd: readSnapshotDatasetNumber(element3.dataset.pmEnd),
252087
- blockId: element3.getAttribute("data-sd-block-id")
252162
+ blockId: element3.getAttribute("data-sd-block-id"),
252163
+ sourceAnchor: readNearestSourceAnchor(element3)
252088
252164
  }));
252089
252165
  }
252090
252166
  return entities;
@@ -252132,7 +252208,8 @@ function snapshotMarkerStyleFromElement(markerEl) {
252132
252208
  textAlign: readSnapshotStyleValue(style2.textAlign),
252133
252209
  fontWeight: readSnapshotStyleValue(style2.fontWeight),
252134
252210
  fontStyle: readSnapshotStyleValue(style2.fontStyle),
252135
- color: readSnapshotStyleValue(style2.color)
252211
+ color: readSnapshotStyleValue(style2.color),
252212
+ sourceAnchor: readNearestSourceAnchor(markerEl)
252136
252213
  });
252137
252214
  }
252138
252215
  function collectLineMarkersForSnapshot(lineEl) {
@@ -252249,7 +252326,8 @@ function resolveParagraphContent(fragment, block, measure) {
252249
252326
  italic: m$1.run?.italic,
252250
252327
  color: m$1.run?.color,
252251
252328
  letterSpacing: m$1.run?.letterSpacing
252252
- }
252329
+ },
252330
+ sourceAnchor: block.sourceAnchor
252253
252331
  };
252254
252332
  }
252255
252333
  let dropCap;
@@ -252373,7 +252451,8 @@ function resolveTableItem(fragment, fragmentIndex, pageIndex, blockMap) {
252373
252451
  block,
252374
252452
  measure,
252375
252453
  cellSpacingPx: measure.cellSpacingPx ?? getCellSpacingPx(block.attrs?.cellSpacing),
252376
- effectiveColumnWidths: fragment.columnWidths ?? measure.columnWidths
252454
+ effectiveColumnWidths: fragment.columnWidths ?? measure.columnWidths,
252455
+ sourceAnchor: fragment.sourceAnchor ?? block.sourceAnchor
252377
252456
  };
252378
252457
  if (fragment.pmStart != null)
252379
252458
  item.pmStart = fragment.pmStart;
@@ -252402,7 +252481,8 @@ function resolveImageItem(fragment, fragmentIndex, pageIndex, blockMap) {
252402
252481
  zIndex: fragment.isAnchored ? fragment.zIndex : undefined,
252403
252482
  blockId: fragment.blockId,
252404
252483
  fragmentIndex,
252405
- block
252484
+ block,
252485
+ sourceAnchor: fragment.sourceAnchor ?? block.sourceAnchor
252406
252486
  };
252407
252487
  if (fragment.pmStart != null)
252408
252488
  item.pmStart = fragment.pmStart;
@@ -252429,7 +252509,8 @@ function resolveDrawingItem(fragment, fragmentIndex, pageIndex, blockMap) {
252429
252509
  zIndex: fragment.isAnchored ? fragment.zIndex : undefined,
252430
252510
  blockId: fragment.blockId,
252431
252511
  fragmentIndex,
252432
- block
252512
+ block,
252513
+ sourceAnchor: fragment.sourceAnchor ?? block.sourceAnchor
252433
252514
  };
252434
252515
  if (fragment.pmStart != null)
252435
252516
  item.pmStart = fragment.pmStart;
@@ -252580,6 +252661,15 @@ function computeBlockVersion(blockId, blockMap, cache$2) {
252580
252661
  cache$2.set(blockId, version$1);
252581
252662
  return version$1;
252582
252663
  }
252664
+ function applyPaintVersions(item, visualVersion) {
252665
+ const evidenceVersion = sourceAnchorSignature(item.sourceAnchor);
252666
+ item.version = visualVersion;
252667
+ if (evidenceVersion) {
252668
+ item.evidenceVersion = evidenceVersion;
252669
+ item.paintCacheVersion = `${visualVersion}|source:${evidenceVersion}`;
252670
+ } else
252671
+ item.paintCacheVersion = visualVersion;
252672
+ }
252583
252673
  function resolveFragmentItem(fragment, fragmentIndex, pageIndex, blockMap, blockVersionCache) {
252584
252674
  const sdtContainerKey = resolveFragmentSdtContainerKey(fragment, blockMap);
252585
252675
  const version$1 = fragmentSignature(fragment, computeBlockVersion(fragment.blockId, blockMap, blockVersionCache));
@@ -252588,21 +252678,27 @@ function resolveFragmentItem(fragment, fragmentIndex, pageIndex, blockMap, block
252588
252678
  const item = resolveTableItem(fragment, fragmentIndex, pageIndex, blockMap);
252589
252679
  if (sdtContainerKey != null)
252590
252680
  item.sdtContainerKey = sdtContainerKey;
252591
- item.version = version$1;
252681
+ if (fragment.sourceAnchor != null)
252682
+ item.sourceAnchor = fragment.sourceAnchor;
252683
+ applyPaintVersions(item, version$1);
252592
252684
  return item;
252593
252685
  }
252594
252686
  case "image": {
252595
252687
  const item = resolveImageItem(fragment, fragmentIndex, pageIndex, blockMap);
252596
252688
  if (sdtContainerKey != null)
252597
252689
  item.sdtContainerKey = sdtContainerKey;
252598
- item.version = version$1;
252690
+ if (fragment.sourceAnchor != null)
252691
+ item.sourceAnchor = fragment.sourceAnchor;
252692
+ applyPaintVersions(item, version$1);
252599
252693
  return item;
252600
252694
  }
252601
252695
  case "drawing": {
252602
252696
  const item = resolveDrawingItem(fragment, fragmentIndex, pageIndex, blockMap);
252603
252697
  if (sdtContainerKey != null)
252604
252698
  item.sdtContainerKey = sdtContainerKey;
252605
- item.version = version$1;
252699
+ if (fragment.sourceAnchor != null)
252700
+ item.sourceAnchor = fragment.sourceAnchor;
252701
+ applyPaintVersions(item, version$1);
252606
252702
  return item;
252607
252703
  }
252608
252704
  default: {
@@ -252622,14 +252718,22 @@ function resolveFragmentItem(fragment, fragmentIndex, pageIndex, blockMap, block
252622
252718
  };
252623
252719
  if (sdtContainerKey != null)
252624
252720
  item.sdtContainerKey = sdtContainerKey;
252721
+ if (fragment.sourceAnchor != null)
252722
+ item.sourceAnchor = fragment.sourceAnchor;
252625
252723
  const entry = blockMap.get(fragment.blockId);
252626
252724
  if (entry) {
252627
252725
  if (fragment.kind === "para" && entry.block.kind === "paragraph" && entry.measure.kind === "paragraph") {
252628
252726
  item.block = entry.block;
252629
252727
  item.measure = entry.measure;
252728
+ if (item.sourceAnchor == null)
252729
+ item.sourceAnchor = entry.block.sourceAnchor;
252630
252730
  } else if (fragment.kind === "list-item" && entry.block.kind === "list" && entry.measure.kind === "list") {
252631
- item.block = entry.block;
252731
+ const listBlock = entry.block;
252732
+ const listItem2 = listBlock.items.find((candidate) => candidate.id === fragment.itemId);
252733
+ item.block = listBlock;
252632
252734
  item.measure = entry.measure;
252735
+ if (item.sourceAnchor == null)
252736
+ item.sourceAnchor = listItem2?.sourceAnchor ?? listItem2?.paragraph.sourceAnchor ?? listBlock.sourceAnchor;
252633
252737
  }
252634
252738
  }
252635
252739
  const borders = resolveFragmentParagraphBorders(fragment, blockMap);
@@ -252658,7 +252762,7 @@ function resolveFragmentItem(fragment, fragmentIndex, pageIndex, blockMap, block
252658
252762
  if (listItem2.markerWidth != null)
252659
252763
  item.markerWidth = listItem2.markerWidth;
252660
252764
  }
252661
- item.version = version$1;
252765
+ applyPaintVersions(item, version$1);
252662
252766
  return item;
252663
252767
  }
252664
252768
  }
@@ -278099,6 +278203,7 @@ menclose::after {
278099
278203
  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;
278100
278204
  }, buildDrawingBlock = (rawAttrs, nextBlockId, positions, node2, geometry, drawingKind, extraProps) => {
278101
278205
  const normalizedWrap = normalizeWrap$2(rawAttrs.wrap);
278206
+ const sourceAnchor = isPlainObject4(rawAttrs.sourceAnchor) ? rawAttrs.sourceAnchor : undefined;
278102
278207
  const baseAnchor = normalizeAnchorData$1(rawAttrs.anchorData, rawAttrs, normalizedWrap?.behindDoc);
278103
278208
  const pos = positions.get(node2);
278104
278209
  const attrsWithPm = { ...rawAttrs };
@@ -278129,6 +278234,7 @@ menclose::after {
278129
278234
  textAlign: typeof rawAttrs.textAlign === "string" ? rawAttrs.textAlign : undefined,
278130
278235
  textVerticalAlign: normalizeTextVerticalAlign(rawAttrs.textVerticalAlign),
278131
278236
  textInsets: normalizeTextInsets(rawAttrs.textInsets),
278237
+ sourceAnchor,
278132
278238
  ...extraProps
278133
278239
  };
278134
278240
  }, getAttrs$1 = (node2) => {
@@ -278150,7 +278256,10 @@ menclose::after {
278150
278256
  width: pickNumber(value) ?? null,
278151
278257
  isFullWidth: false
278152
278258
  };
278153
- }, 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) => {
278259
+ }, 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) => {
278260
+ const sourceAnchor = attrs.sourceAnchor;
278261
+ return isPlainObject$1(sourceAnchor) ? sourceAnchor : undefined;
278262
+ }, isAllowedObjectFit = (value) => {
278154
278263
  return value === "contain" || value === "cover" || value === "fill" || value === "scale-down";
278155
278264
  }, isHiddenDrawing = (attrs) => {
278156
278265
  if (toBoolean$1(attrs.hidden) === true)
@@ -278717,7 +278826,8 @@ menclose::after {
278717
278826
  paragraph: blocks2[0]?.kind === "paragraph" ? blocks2[0] : undefined,
278718
278827
  rowSpan: rowSpan ?? undefined,
278719
278828
  colSpan: colSpan ?? undefined,
278720
- attrs: Object.keys(cellAttrs).length > 0 ? cellAttrs : undefined
278829
+ attrs: Object.keys(cellAttrs).length > 0 ? cellAttrs : undefined,
278830
+ sourceAnchor: sourceAnchorFromNode$1(cellNode)
278721
278831
  };
278722
278832
  }, parseTableRow = (args$1) => {
278723
278833
  const { rowNode, rowIndex, context, defaultCellPadding, tableProperties, numRows } = args$1;
@@ -278751,7 +278861,8 @@ menclose::after {
278751
278861
  return {
278752
278862
  id: context.nextBlockId(`row-${rowIndex}`),
278753
278863
  cells,
278754
- attrs
278864
+ attrs,
278865
+ sourceAnchor: sourceAnchorFromNode$1(rowNode)
278755
278866
  };
278756
278867
  }, isHiddenShape = (node2) => {
278757
278868
  if (!node2.type.toLowerCase().includes("shape"))
@@ -282072,7 +282183,21 @@ menclose::after {
282072
282183
  hash$3 = Math.imul(hash$3, 16777619);
282073
282184
  hash$3 ^= hash$3 >>> 13;
282074
282185
  return hash$3 >>> 0;
282075
- }, deriveBlockVersion = (block) => {
282186
+ }, stableSerializeEvidenceValue = (value) => {
282187
+ if (value === undefined)
282188
+ return "";
282189
+ if (value === null)
282190
+ return "null";
282191
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean")
282192
+ return JSON.stringify(value);
282193
+ if (Array.isArray(value))
282194
+ return `[${value.map((item) => stableSerializeEvidenceValue(item)).join(",")}]`;
282195
+ if (typeof value === "object") {
282196
+ const record3 = value;
282197
+ return `{${Object.keys(record3).sort().filter((key2) => record3[key2] !== undefined).map((key2) => `${JSON.stringify(key2)}:${stableSerializeEvidenceValue(record3[key2])}`).join(",")}}`;
282198
+ }
282199
+ return JSON.stringify(String(value));
282200
+ }, sourceAnchorSignature = (sourceAnchor) => sourceAnchor ? stableSerializeEvidenceValue(sourceAnchor) : "", deriveBlockVersion = (block) => {
282076
282201
  if (block.kind === "paragraph") {
282077
282202
  const markerVersion = hasListMarkerProperties(block.attrs) ? `marker:${block.attrs.numberingProperties.numId ?? ""}:${block.attrs.numberingProperties.ilvl ?? 0}:${block.attrs.wordLayout?.marker?.markerText ?? ""}` : "";
282078
282203
  const runsVersion = block.runs.map((run2) => {
@@ -287805,7 +287930,7 @@ menclose::after {
287805
287930
  return;
287806
287931
  console.log(...args$1);
287807
287932
  }, 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;
287808
- var init_src_BjD8Jue_es = __esm(() => {
287933
+ var init_src_DjPB83T8_es = __esm(() => {
287809
287934
  init_rolldown_runtime_Bg48TavK_es();
287810
287935
  init_SuperConverter_4akUYfWt_es();
287811
287936
  init_jszip_C49i9kUs_es();
@@ -314508,7 +314633,8 @@ function print() { __p += __j.call(arguments, '') }
314508
314633
  inTableParagraph: options.inTableParagraph === true,
314509
314634
  style: style2,
314510
314635
  markers,
314511
- tabs
314636
+ tabs,
314637
+ sourceAnchor: readNearestSourceAnchor(lineEl) ?? readNearestSourceAnchor(options.wrapperEl) ?? options.sourceAnchor
314512
314638
  }));
314513
314639
  page.lineCount += 1;
314514
314640
  builder.lineCount += 1;
@@ -314545,7 +314671,8 @@ function print() { __p += __j.call(arguments, '') }
314545
314671
  inTableParagraph: Boolean(lineEl.closest(".superdoc-table-paragraph")),
314546
314672
  style: snapshotLineStyleFromElement(lineEl),
314547
314673
  markers,
314548
- tabs
314674
+ tabs,
314675
+ sourceAnchor: readNearestSourceAnchor(lineEl)
314549
314676
  }));
314550
314677
  }
314551
314678
  const pageNumberRaw = pageEl.dataset?.pageNumber;
@@ -315370,7 +315497,7 @@ function print() { __p += __j.call(arguments, '') }
315370
315497
  const sdtBoundary = sdtBoundaries.get(index2);
315371
315498
  const betweenInfo = betweenBorderFlags.get(index2);
315372
315499
  const resolvedItem = this.getResolvedFragmentItem(pageIndex, index2);
315373
- const resolvedSig = resolvedItem?.version ?? "";
315500
+ const resolvedSig = resolvedPaintCacheSignature(resolvedItem);
315374
315501
  if (current) {
315375
315502
  existing.delete(key2);
315376
315503
  const geometryChanged = hasFragmentGeometryChanged(current.fragment, fragment);
@@ -315470,7 +315597,7 @@ function print() { __p += __j.call(arguments, '') }
315470
315597
  const resolvedItem = this.getResolvedFragmentItem(pageIndex, index2);
315471
315598
  const fragmentEl = this.renderFragment(fragment, contextBase, sdtBoundary, betweenBorderFlags.get(index2), resolvedItem);
315472
315599
  el.appendChild(fragmentEl);
315473
- const initSig = resolvedItem?.version ?? "";
315600
+ const initSig = resolvedPaintCacheSignature(resolvedItem);
315474
315601
  return {
315475
315602
  key: fragmentKey(fragment),
315476
315603
  signature: initSig,
@@ -315642,6 +315769,7 @@ function print() { __p += __j.call(arguments, '') }
315642
315769
  const markerEl = this.doc.createElement("span");
315643
315770
  markerEl.classList.add("superdoc-paragraph-marker");
315644
315771
  markerEl.textContent = resolvedMarker.text;
315772
+ applySourceAnchorDataset(markerEl, resolvedMarker.sourceAnchor ?? resolvedItem?.sourceAnchor ?? fragment.sourceAnchor);
315645
315773
  markerEl.style.pointerEvents = "none";
315646
315774
  markerContainer.style.position = "relative";
315647
315775
  if (resolvedMarker.justification === "right") {
@@ -315681,7 +315809,8 @@ function print() { __p += __j.call(arguments, '') }
315681
315809
  }
315682
315810
  this.capturePaintSnapshotLine(lineEl, context, {
315683
315811
  inTableFragment: false,
315684
- inTableParagraph: false
315812
+ inTableParagraph: false,
315813
+ sourceAnchor: resolvedItem?.sourceAnchor ?? fragment.sourceAnchor
315685
315814
  });
315686
315815
  fragmentEl.appendChild(lineEl);
315687
315816
  });
@@ -315777,6 +315906,7 @@ function print() { __p += __j.call(arguments, '') }
315777
315906
  const markerEl = this.doc.createElement("span");
315778
315907
  markerEl.classList.add("superdoc-paragraph-marker");
315779
315908
  markerEl.textContent = marker.markerText ?? "";
315909
+ applySourceAnchorDataset(markerEl, block.sourceAnchor ?? resolvedItem?.sourceAnchor ?? fragment.sourceAnchor);
315780
315910
  markerEl.style.pointerEvents = "none";
315781
315911
  const markerJustification = marker.justification ?? "left";
315782
315912
  markerContainer.style.position = "relative";
@@ -315818,7 +315948,8 @@ function print() { __p += __j.call(arguments, '') }
315818
315948
  }
315819
315949
  this.capturePaintSnapshotLine(lineEl, context, {
315820
315950
  inTableFragment: false,
315821
- inTableParagraph: false
315951
+ inTableParagraph: false,
315952
+ sourceAnchor: resolvedItem?.sourceAnchor ?? fragment.sourceAnchor
315822
315953
  });
315823
315954
  fragmentEl.appendChild(lineEl);
315824
315955
  });
@@ -315906,6 +316037,7 @@ function print() { __p += __j.call(arguments, '') }
315906
316037
  fragmentEl.style.top = `${fragment.y}px`;
315907
316038
  fragmentEl.style.width = `${fragment.markerWidth + fragment.width}px`;
315908
316039
  fragmentEl.dataset.blockId = fragment.blockId;
316040
+ applySourceAnchorDataset(fragmentEl, fragment.sourceAnchor);
315909
316041
  }
315910
316042
  fragmentEl.dataset.itemId = fragment.itemId;
315911
316043
  const paragraphMetadata = item.paragraph.attrs?.sdt;
@@ -315917,6 +316049,7 @@ function print() { __p += __j.call(arguments, '') }
315917
316049
  fragmentEl.dataset.continuesOnNext = "true";
315918
316050
  const markerEl = this.doc.createElement("span");
315919
316051
  markerEl.classList.add("superdoc-list-marker");
316052
+ applySourceAnchorDataset(markerEl, item.marker.sourceAnchor ?? item.sourceAnchor ?? resolvedItem?.sourceAnchor ?? fragment.sourceAnchor);
315920
316053
  const wordLayout = item.paragraph.attrs?.wordLayout;
315921
316054
  const marker = wordLayout?.marker;
315922
316055
  if (marker) {
@@ -315972,7 +316105,8 @@ function print() { __p += __j.call(arguments, '') }
315972
316105
  const lineEl = this.renderLine(paraForList, line, context, fragment.width, fragment.fromLine + idx, true, expandedRunsForList);
315973
316106
  this.capturePaintSnapshotLine(lineEl, context, {
315974
316107
  inTableFragment: false,
315975
- inTableParagraph: false
316108
+ inTableParagraph: false,
316109
+ sourceAnchor: resolvedItem?.sourceAnchor ?? fragment.sourceAnchor
315976
316110
  });
315977
316111
  contentEl.appendChild(lineEl);
315978
316112
  });
@@ -317933,6 +318067,7 @@ function print() { __p += __j.call(arguments, '') }
317933
318067
  el.style.width = `${fragment.width}px`;
317934
318068
  el.dataset.blockId = fragment.blockId;
317935
318069
  el.dataset.layoutEpoch = String(this.layoutEpoch);
318070
+ applySourceAnchorDataset(el, fragment.sourceAnchor);
317936
318071
  if (typeof fragment.blockId === "string" && fragment.blockId.startsWith("footnote-"))
317937
318072
  el.setAttribute("contenteditable", "false");
317938
318073
  if (fragment.kind === "para") {
@@ -318013,6 +318148,7 @@ function print() { __p += __j.call(arguments, '') }
318013
318148
  el.style.width = `${item.width}px`;
318014
318149
  el.dataset.blockId = item.blockId;
318015
318150
  el.dataset.layoutEpoch = String(this.layoutEpoch);
318151
+ applySourceAnchorDataset(el, item.sourceAnchor ?? fragment.sourceAnchor);
318016
318152
  this.applyFragmentWrapperZIndex(el, fragment, item.zIndex);
318017
318153
  if (item.fragmentKind === "image" || item.fragmentKind === "drawing" || item.fragmentKind === "table")
318018
318154
  el.style.height = `${item.height}px`;
@@ -324753,7 +324889,7 @@ var init_zipper_CSxGBanD_es = __esm(() => {
324753
324889
 
324754
324890
  // ../../packages/superdoc/dist/super-editor.es.js
324755
324891
  var init_super_editor_es = __esm(() => {
324756
- init_src_BjD8Jue_es();
324892
+ init_src_DjPB83T8_es();
324757
324893
  init_SuperConverter_4akUYfWt_es();
324758
324894
  init_jszip_C49i9kUs_es();
324759
324895
  init_xml_js_CqGKpaft_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/mcp",
3
- "version": "0.3.0-next.10",
3
+ "version": "0.3.0-next.11",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20"
@@ -20,8 +20,8 @@
20
20
  "@types/node": "22.19.2",
21
21
  "typescript": "^5.9.2",
22
22
  "@superdoc/document-api": "0.0.1",
23
- "superdoc": "1.29.0",
24
- "@superdoc/super-editor": "0.0.1"
23
+ "@superdoc/super-editor": "0.0.1",
24
+ "superdoc": "1.29.0"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"