@superdoc-dev/mcp 0.10.0-next.5 → 0.10.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 +158 -87
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -211378,7 +211378,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
211378
211378
  init_remark_gfm_BhnWr3yf_es();
211379
211379
  });
211380
211380
 
211381
- // ../../packages/superdoc/dist/chunks/src-B9A7ox0h.es.js
211381
+ // ../../packages/superdoc/dist/chunks/src-D1Zc7Jgj.es.js
211382
211382
  function deleteProps(obj, propOrProps) {
211383
211383
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
211384
211384
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -212729,12 +212729,80 @@ function findContainingBlockAncestor(element3) {
212729
212729
  }
212730
212730
  return null;
212731
212731
  }
212732
+ function isZeroWidthMarker(node2) {
212733
+ if (node2.type.name === "fieldAnnotation" && node2.attrs?.hidden === true)
212734
+ return true;
212735
+ return ZERO_WIDTH_MARKER_NODE_NAMES.has(node2.type.name);
212736
+ }
212737
+ function findFirstTextPosInNode(node2, nodePos) {
212738
+ if (node2.isText)
212739
+ return nodePos;
212740
+ for (let index2 = 0, offset$1 = 0;index2 < node2.childCount; index2 += 1) {
212741
+ const child = node2.child(index2);
212742
+ const found2 = findFirstTextPosInNode(child, nodePos + 1 + offset$1);
212743
+ if (found2 != null)
212744
+ return found2;
212745
+ offset$1 += child.nodeSize;
212746
+ }
212747
+ return null;
212748
+ }
212749
+ function findFirstContentCursorPosInNode(node2, nodePos) {
212750
+ if (isZeroWidthMarker(node2))
212751
+ return null;
212752
+ if (node2.isText || node2.isAtom)
212753
+ return nodePos;
212754
+ if (node2.isTextblock && node2.childCount === 0)
212755
+ return nodePos + 1;
212756
+ for (let index2 = 0, offset$1 = 0;index2 < node2.childCount; index2 += 1) {
212757
+ const child = node2.child(index2);
212758
+ const found2 = findFirstContentCursorPosInNode(child, nodePos + 1 + offset$1);
212759
+ if (found2 != null)
212760
+ return found2;
212761
+ offset$1 += child.nodeSize;
212762
+ }
212763
+ if (node2.isTextblock)
212764
+ return nodePos + 1;
212765
+ return null;
212766
+ }
212767
+ function findLastTextPosInNode(node2, nodePos) {
212768
+ if (node2.isText)
212769
+ return nodePos + (node2.text?.length ?? 0);
212770
+ for (let index2 = node2.childCount - 1, offset$1 = node2.content.size;index2 >= 0; index2 -= 1) {
212771
+ const child = node2.child(index2);
212772
+ offset$1 -= child.nodeSize;
212773
+ const found2 = findLastTextPosInNode(child, nodePos + 1 + offset$1);
212774
+ if (found2 != null)
212775
+ return found2;
212776
+ }
212777
+ return null;
212778
+ }
212779
+ function findLastContentCursorPosInNode(node2, nodePos) {
212780
+ if (isZeroWidthMarker(node2))
212781
+ return null;
212782
+ if (node2.isText)
212783
+ return nodePos + (node2.text?.length ?? 0);
212784
+ if (node2.isAtom)
212785
+ return node2.isInline ? nodePos + node2.nodeSize : nodePos;
212786
+ if (node2.isTextblock && node2.childCount === 0)
212787
+ return nodePos + 1;
212788
+ for (let index2 = node2.childCount - 1, offset$1 = node2.content.size;index2 >= 0; index2 -= 1) {
212789
+ const child = node2.child(index2);
212790
+ offset$1 -= child.nodeSize;
212791
+ const found2 = findLastContentCursorPosInNode(child, nodePos + 1 + offset$1);
212792
+ if (found2 != null)
212793
+ return found2;
212794
+ }
212795
+ if (node2.isTextblock)
212796
+ return nodePos + node2.nodeSize - 1;
212797
+ return null;
212798
+ }
212732
212799
  function collectSDTNodes(doc$12) {
212733
212800
  const sdtNodes = [];
212734
212801
  doc$12.descendants((node2, pos) => {
212735
212802
  if (node2.type.name === "structuredContent" || node2.type.name === "structuredContentBlock")
212736
212803
  sdtNodes.push({
212737
212804
  type: node2.type.name,
212805
+ node: node2,
212738
212806
  lockMode: node2.attrs.lockMode,
212739
212807
  pos,
212740
212808
  end: pos + node2.nodeSize
@@ -212790,6 +212858,15 @@ function isAtBlockSdtWrapperDeletePosition(state, sdt, pos) {
212790
212858
  return false;
212791
212859
  return $pos.before(textblockDepth) === $pos.start(sdtDepth);
212792
212860
  }
212861
+ function selectionCoversSdtContent(sdt, from$1, to) {
212862
+ if (from$1 === sdt.pos + 1 && to === sdt.end - 1)
212863
+ return true;
212864
+ if (sdt.type !== "structuredContentBlock")
212865
+ return false;
212866
+ const contentStart = findFirstContentCursorPosInNode(sdt.node, sdt.pos);
212867
+ const contentEnd = findLastContentCursorPosInNode(sdt.node, sdt.pos);
212868
+ return contentStart != null && contentEnd != null && from$1 === contentStart && to === contentEnd;
212869
+ }
212793
212870
  function createStructuredContentLockPlugin() {
212794
212871
  return new Plugin({
212795
212872
  key: STRUCTURED_CONTENT_LOCK_KEY,
@@ -212817,7 +212894,7 @@ function createStructuredContentLockPlugin() {
212817
212894
  if (sdtNodes.length === 0)
212818
212895
  return false;
212819
212896
  if (from$1 !== to && !(selection instanceof NodeSelection)) {
212820
- const exactContentSDT = sdtNodes.find((s2) => from$1 === s2.pos + 1 && to === s2.end - 1);
212897
+ const exactContentSDT = sdtNodes.find((s2) => selectionCoversSdtContent(s2, from$1, to));
212821
212898
  if (exactContentSDT) {
212822
212899
  const isContentLocked = exactContentSDT.lockMode === "contentLocked" || exactContentSDT.lockMode === "sdtContentLocked";
212823
212900
  const isWrapperDeletable = exactContentSDT.lockMode !== "sdtLocked" && exactContentSDT.lockMode !== "sdtContentLocked";
@@ -213950,80 +214027,70 @@ function shallowEqual$2(a2, b$1) {
213950
214027
  return false;
213951
214028
  return true;
213952
214029
  }
213953
- function isSdtContentFullyLocked(node2) {
213954
- return node2.attrs.lockMode === "sdtContentLocked";
213955
- }
213956
- function findAncestorDepth$2($pos, predicate) {
214030
+ function findAncestorDepth$3($pos, predicate) {
213957
214031
  for (let depth = $pos.depth;depth > 0; depth -= 1)
213958
214032
  if (predicate($pos.node(depth)))
213959
214033
  return depth;
213960
214034
  return null;
213961
214035
  }
213962
- function isZeroWidthMarker(node2) {
213963
- if (node2.type.name === "fieldAnnotation" && node2.attrs?.hidden === true)
213964
- return true;
213965
- return ZERO_WIDTH_MARKER_NODE_NAMES.has(node2.type.name);
213966
- }
213967
- function findFirstTextPosInNode(node2, nodePos) {
213968
- if (node2.isText)
213969
- return nodePos;
213970
- for (let index2 = 0, offset$1 = 0;index2 < node2.childCount; index2 += 1) {
213971
- const child = node2.child(index2);
213972
- const found2 = findFirstTextPosInNode(child, nodePos + 1 + offset$1);
213973
- if (found2 != null)
213974
- return found2;
213975
- offset$1 += child.nodeSize;
214036
+ function findSiblingAcrossHiddenMarkers$1(doc$12, pos, direction) {
214037
+ let currentPos = pos;
214038
+ let node2 = direction === "before" ? doc$12.resolve(currentPos).nodeBefore : doc$12.resolve(currentPos).nodeAfter;
214039
+ while (node2 && isZeroWidthMarker(node2)) {
214040
+ currentPos += direction === "before" ? -node2.nodeSize : node2.nodeSize;
214041
+ node2 = direction === "before" ? doc$12.resolve(currentPos).nodeBefore : doc$12.resolve(currentPos).nodeAfter;
213976
214042
  }
213977
- return null;
214043
+ return {
214044
+ node: node2,
214045
+ nodePos: direction === "before" && node2 ? currentPos - node2.nodeSize : currentPos
214046
+ };
213978
214047
  }
213979
- function findFirstContentCursorPosInNode(node2, nodePos) {
213980
- if (isZeroWidthMarker(node2))
214048
+ function isAtTextBlockBoundary($from, direction) {
214049
+ const textblockDepth = findAncestorDepth$3($from, (node2) => node2.isTextblock);
214050
+ if (textblockDepth == null)
213981
214051
  return null;
213982
- if (node2.isText || node2.isAtom)
213983
- return nodePos;
213984
- if (node2.isTextblock && node2.childCount === 0)
213985
- return nodePos + 1;
213986
- for (let index2 = 0, offset$1 = 0;index2 < node2.childCount; index2 += 1) {
213987
- const child = node2.child(index2);
213988
- const found2 = findFirstContentCursorPosInNode(child, nodePos + 1 + offset$1);
213989
- if (found2 != null)
213990
- return found2;
213991
- offset$1 += child.nodeSize;
213992
- }
213993
- if (node2.isTextblock)
213994
- return nodePos + 1;
213995
- return null;
214052
+ const textblock = $from.node(textblockDepth);
214053
+ const textblockPos = $from.before(textblockDepth);
214054
+ const boundary = direction === "before" ? findFirstContentCursorPosInNode(textblock, textblockPos) ?? $from.start(textblockDepth) : findLastContentCursorPosInNode(textblock, textblockPos) ?? $from.end(textblockDepth);
214055
+ if ($from.pos !== boundary)
214056
+ return null;
214057
+ return {
214058
+ textblockDepth,
214059
+ textblockPos
214060
+ };
213996
214061
  }
213997
- function findLastTextPosInNode(node2, nodePos) {
213998
- if (node2.isText)
213999
- return nodePos + (node2.text?.length ?? 0);
214000
- for (let index2 = node2.childCount - 1, offset$1 = node2.content.size;index2 >= 0; index2 -= 1) {
214001
- const child = node2.child(index2);
214002
- offset$1 -= child.nodeSize;
214003
- const found2 = findLastTextPosInNode(child, nodePos + 1 + offset$1);
214004
- if (found2 != null)
214005
- return found2;
214006
- }
214007
- return null;
214062
+ function selectAdjacentBlockSdtContent(direction) {
214063
+ return ({ state, dispatch }) => {
214064
+ const { selection } = state;
214065
+ if (!selection.empty)
214066
+ return false;
214067
+ const boundary = isAtTextBlockBoundary(selection.$from, direction);
214068
+ if (!boundary)
214069
+ return false;
214070
+ const siblingBoundaryPos = direction === "before" ? boundary.textblockPos : selection.$from.after(boundary.textblockDepth);
214071
+ const { node: node2, nodePos } = findSiblingAcrossHiddenMarkers$1(state.doc, siblingBoundaryPos, direction);
214072
+ if (node2?.type.name !== "structuredContentBlock")
214073
+ return false;
214074
+ if (node2.content.size === 0)
214075
+ return false;
214076
+ const contentStart = findFirstContentCursorPosInNode(node2, nodePos);
214077
+ const contentEnd = findLastContentCursorPosInNode(node2, nodePos);
214078
+ if (contentStart == null || contentEnd == null)
214079
+ return false;
214080
+ if (contentStart >= contentEnd)
214081
+ return false;
214082
+ if (dispatch)
214083
+ dispatch(state.tr.setSelection(TextSelection.create(state.doc, contentStart, contentEnd)).scrollIntoView());
214084
+ return true;
214085
+ };
214008
214086
  }
214009
- function findLastContentCursorPosInNode(node2, nodePos) {
214010
- if (isZeroWidthMarker(node2))
214011
- return null;
214012
- if (node2.isText)
214013
- return nodePos + (node2.text?.length ?? 0);
214014
- if (node2.isAtom)
214015
- return node2.isInline ? nodePos + node2.nodeSize : nodePos;
214016
- if (node2.isTextblock && node2.childCount === 0)
214017
- return nodePos + 1;
214018
- for (let index2 = node2.childCount - 1, offset$1 = node2.content.size;index2 >= 0; index2 -= 1) {
214019
- const child = node2.child(index2);
214020
- offset$1 -= child.nodeSize;
214021
- const found2 = findLastContentCursorPosInNode(child, nodePos + 1 + offset$1);
214022
- if (found2 != null)
214023
- return found2;
214024
- }
214025
- if (node2.isTextblock)
214026
- return nodePos + node2.nodeSize - 1;
214087
+ function isSdtContentFullyLocked(node2) {
214088
+ return node2.attrs.lockMode === "sdtContentLocked";
214089
+ }
214090
+ function findAncestorDepth$2($pos, predicate) {
214091
+ for (let depth = $pos.depth;depth > 0; depth -= 1)
214092
+ if (predicate($pos.node(depth)))
214093
+ return depth;
214027
214094
  return null;
214028
214095
  }
214029
214096
  function findAncestorDepth$1($pos, predicate) {
@@ -272702,7 +272769,7 @@ var Node$13 = class Node$14 {
272702
272769
  const transaction = view.state.tr.setSelection(selection);
272703
272770
  view.dispatch(transaction);
272704
272771
  }
272705
- }, StructuredContentInlineView, findChildren$12, SD_BLOCK_ID_ATTRIBUTE_NAME = "sdBlockId", SD_BLOCK_REV_ATTRIBUTE_NAME = "sdBlockRev", BLOCK_NODE_METADATA_UPDATE_META = "blockNodeMetadataUpdate", BlockNodePluginKey, BlockNode, nodeAllowsSdBlockIdAttr = (node2) => {
272772
+ }, StructuredContentInlineView, ZERO_WIDTH_MARKER_NODE_NAMES, findChildren$12, SD_BLOCK_ID_ATTRIBUTE_NAME = "sdBlockId", SD_BLOCK_REV_ATTRIBUTE_NAME = "sdBlockRev", BLOCK_NODE_METADATA_UPDATE_META = "blockNodeMetadataUpdate", BlockNodePluginKey, BlockNode, nodeAllowsSdBlockIdAttr = (node2) => {
272706
272773
  return !!(node2?.isBlock && node2?.type?.spec?.attrs?.[SD_BLOCK_ID_ATTRIBUTE_NAME]);
272707
272774
  }, nodeAllowsSdBlockRevAttr = (node2) => {
272708
272775
  return !!(node2?.isBlock && node2?.type?.spec?.attrs?.[SD_BLOCK_REV_ATTRIBUTE_NAME]);
@@ -274358,7 +274425,7 @@ var Node$13 = class Node$14 {
274358
274425
  dispatch(tr.scrollIntoView());
274359
274426
  }
274360
274427
  return true;
274361
- }, deleteBlockSdtAtTextBlockStart = () => ({ state, dispatch }) => {
274428
+ }, selectBlockSdtBeforeTextBlockStart = () => selectAdjacentBlockSdtContent("before"), selectBlockSdtAfterTextBlockEnd = () => selectAdjacentBlockSdtContent("after"), deleteBlockSdtAtTextBlockStart = () => ({ state, dispatch }) => {
274362
274429
  const { selection } = state;
274363
274430
  if (!selection.empty)
274364
274431
  return false;
@@ -274387,7 +274454,7 @@ var Node$13 = class Node$14 {
274387
274454
  dispatch(tr.setSelection(Selection.near(tr.doc.resolve(selectionPos), -1)).scrollIntoView());
274388
274455
  }
274389
274456
  return true;
274390
- }, ZERO_WIDTH_MARKER_NODE_NAMES, moveIntoBlockSdtBeforeTextBlockStart = () => moveIntoAdjacentBlockSdt("before"), moveIntoBlockSdtAfterTextBlockEnd = () => moveIntoAdjacentBlockSdt("after"), deleteSkipEmptyRun = () => ({ state, dispatch }) => {
274457
+ }, moveIntoBlockSdtBeforeTextBlockStart = () => moveIntoAdjacentBlockSdt("before"), moveIntoBlockSdtAfterTextBlockEnd = () => moveIntoAdjacentBlockSdt("after"), deleteSkipEmptyRun = () => ({ state, dispatch }) => {
274391
274458
  const sel = state.selection;
274392
274459
  if (!sel.empty)
274393
274460
  return false;
@@ -285754,6 +285821,7 @@ var Node$13 = class Node$14 {
285754
285821
  },
285755
285822
  () => commands$1.deleteBlockSdtAtTextBlockStart(),
285756
285823
  () => commands$1.selectInlineSdtBeforeRunStart(),
285824
+ () => commands$1.selectBlockSdtBeforeTextBlockStart(),
285757
285825
  () => commands$1.moveIntoBlockSdtBeforeTextBlockStart(),
285758
285826
  () => commands$1.backspaceEmptyRunParagraph(),
285759
285827
  () => commands$1.backspaceSkipEmptyRun(),
@@ -285772,6 +285840,7 @@ var Node$13 = class Node$14 {
285772
285840
  return editor.commands.first(({ commands: commands$1 }) => [
285773
285841
  () => commands$1.deleteBlockSdtAtTextBlockStart(),
285774
285842
  () => commands$1.selectInlineSdtAfterRunEnd(),
285843
+ () => commands$1.selectBlockSdtAfterTextBlockEnd(),
285775
285844
  () => commands$1.moveIntoBlockSdtAfterTextBlockEnd(),
285776
285845
  () => commands$1.deleteSkipEmptyRun(),
285777
285846
  () => commands$1.deleteAtomAfter(),
@@ -308360,7 +308429,7 @@ menclose::after {
308360
308429
  return;
308361
308430
  console.log(...args$1);
308362
308431
  }, 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;
308363
- var init_src_B9A7ox0h_es = __esm(() => {
308432
+ var init_src_D1Zc7Jgj_es = __esm(() => {
308364
308433
  init_rolldown_runtime_Bg48TavK_es();
308365
308434
  init_SuperConverter_C6hKp29w_es();
308366
308435
  init_jszip_C49i9kUs_es();
@@ -310118,6 +310187,22 @@ ${err.toString()}`);
310118
310187
  return true;
310119
310188
  }
310120
310189
  };
310190
+ ZERO_WIDTH_MARKER_NODE_NAMES = new Set([
310191
+ "bookmarkStart",
310192
+ "bookmarkEnd",
310193
+ "commentRangeStart",
310194
+ "commentRangeEnd",
310195
+ "commentReference",
310196
+ "permStart",
310197
+ "permEnd",
310198
+ "permStartBlock",
310199
+ "permEndBlock",
310200
+ "tableOfContentsEntry",
310201
+ "indexEntry",
310202
+ "authorityEntry",
310203
+ "passthroughInline",
310204
+ "passthroughBlock"
310205
+ ]);
310121
310206
  ({ findChildren: findChildren$12 } = helpers_exports);
310122
310207
  BlockNodePluginKey = new PluginKey("blockNodePlugin");
310123
310208
  BlockNode = Extension.create({
@@ -311386,22 +311471,6 @@ ${err.toString()}`);
311386
311471
  macBaseKeymap[key2] = pcBaseKeymap[key2];
311387
311472
  typeof navigator != "undefined" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os != "undefined" && os.platform && os.platform();
311388
311473
  DELETABLE_INLINE_ATOMS$1 = new Set(["noBreakHyphen"]);
311389
- ZERO_WIDTH_MARKER_NODE_NAMES = new Set([
311390
- "bookmarkStart",
311391
- "bookmarkEnd",
311392
- "commentRangeStart",
311393
- "commentRangeEnd",
311394
- "commentReference",
311395
- "permStart",
311396
- "permEnd",
311397
- "permStartBlock",
311398
- "permEndBlock",
311399
- "tableOfContentsEntry",
311400
- "indexEntry",
311401
- "authorityEntry",
311402
- "passthroughInline",
311403
- "passthroughBlock"
311404
- ]);
311405
311474
  DELETABLE_INLINE_ATOMS = new Set(["noBreakHyphen"]);
311406
311475
  commands_exports = /* @__PURE__ */ __export2({
311407
311476
  SELECT_INLINE_SDT_BEFORE_RUN_START_META: () => SELECT_INLINE_SDT_BEFORE_RUN_START_META,
@@ -311452,6 +311521,8 @@ ${err.toString()}`);
311452
311521
  resetAttributes: () => resetAttributes,
311453
311522
  restoreSelection: () => restoreSelection,
311454
311523
  selectAll: () => selectAll$1,
311524
+ selectBlockSdtAfterTextBlockEnd: () => selectBlockSdtAfterTextBlockEnd,
311525
+ selectBlockSdtBeforeTextBlockStart: () => selectBlockSdtBeforeTextBlockStart,
311455
311526
  selectInlineSdtAfterRunEnd: () => selectInlineSdtAfterRunEnd,
311456
311527
  selectInlineSdtBeforeRunStart: () => selectInlineSdtBeforeRunStart,
311457
311528
  selectNodeBackward: () => selectNodeBackward$1,
@@ -342613,7 +342684,7 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
342613
342684
 
342614
342685
  // ../../packages/superdoc/dist/super-editor.es.js
342615
342686
  var init_super_editor_es = __esm(() => {
342616
- init_src_B9A7ox0h_es();
342687
+ init_src_D1Zc7Jgj_es();
342617
342688
  init_SuperConverter_C6hKp29w_es();
342618
342689
  init_jszip_C49i9kUs_es();
342619
342690
  init_xml_js_CqGKpaft_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/mcp",
3
- "version": "0.10.0-next.5",
3
+ "version": "0.10.0-next.6",
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/super-editor": "0.0.1",
24
- "superdoc": "1.37.0"
23
+ "superdoc": "1.37.0",
24
+ "@superdoc/super-editor": "0.0.1"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"