@superdoc-dev/mcp 0.12.0-next.6 → 0.12.0-next.8

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 +239 -106
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -52172,7 +52172,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
52172
52172
  emptyOptions2 = {};
52173
52173
  });
52174
52174
 
52175
- // ../../packages/superdoc/dist/chunks/SuperConverter-BaKhr4cp.es.js
52175
+ // ../../packages/superdoc/dist/chunks/SuperConverter-e4tY-2EB.es.js
52176
52176
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
52177
52177
  const fieldValue = extension$1.config[field];
52178
52178
  if (typeof fieldValue === "function")
@@ -88738,12 +88738,14 @@ function applyTocMetadata(blocks, metadata) {
88738
88738
  };
88739
88739
  if (metadata.instruction)
88740
88740
  block.attrs.tocInstruction = metadata.instruction;
88741
+ if (metadata.tocId)
88742
+ block.attrs.tocId = metadata.tocId;
88741
88743
  }
88742
88744
  });
88743
88745
  }
88744
88746
  function processTocChildren(children, metadata, context, outputArrays) {
88745
88747
  const paragraphConverter = context.converters.paragraphToFlowBlocks;
88746
- const { docPartGallery, docPartObjectId, tocInstruction } = metadata;
88748
+ const { docPartGallery, docPartObjectId, tocInstruction, tocId } = metadata;
88747
88749
  const { blocks, recordBlockKind } = outputArrays;
88748
88750
  children.forEach((child) => {
88749
88751
  if (child.type === "paragraph") {
@@ -88768,7 +88770,8 @@ function processTocChildren(children, metadata, context, outputArrays) {
88768
88770
  applyTocMetadata(paragraphBlocks, {
88769
88771
  gallery: docPartGallery,
88770
88772
  uniqueId: docPartObjectId,
88771
- instruction: tocInstruction
88773
+ instruction: tocInstruction,
88774
+ tocId
88772
88775
  });
88773
88776
  applySdtMetadataToParagraphBlocks(paragraphBlocks.filter((b) => b.kind === "paragraph"), metadata.sdtMetadata);
88774
88777
  paragraphBlocks.forEach((block) => {
@@ -88783,7 +88786,8 @@ function processTocChildren(children, metadata, context, outputArrays) {
88783
88786
  docPartGallery,
88784
88787
  docPartObjectId,
88785
88788
  tocInstruction: finalInstruction,
88786
- sdtMetadata: metadata.sdtMetadata
88789
+ sdtMetadata: metadata.sdtMetadata,
88790
+ tocId
88787
88791
  }, context, outputArrays);
88788
88792
  }
88789
88793
  });
@@ -88791,7 +88795,11 @@ function processTocChildren(children, metadata, context, outputArrays) {
88791
88795
  function handleTableOfContentsNode(node2, context) {
88792
88796
  if (!Array.isArray(node2.content))
88793
88797
  return;
88794
- processTocChildren(node2.content, { tocInstruction: getNodeInstruction(node2) }, {
88798
+ const sdBlockId = node2.attrs?.sdBlockId;
88799
+ processTocChildren(node2.content, {
88800
+ tocInstruction: getNodeInstruction(node2),
88801
+ tocId: typeof sdBlockId === "string" ? sdBlockId : undefined
88802
+ }, {
88795
88803
  nextBlockId: context.nextBlockId,
88796
88804
  positions: context.positions,
88797
88805
  bookmarks: context.bookmarks,
@@ -89120,7 +89128,8 @@ function processDocumentPartObject(child, sectionMetadata, context, output, conv
89120
89128
  docPartGallery,
89121
89129
  docPartObjectId,
89122
89130
  tocInstruction,
89123
- sdtMetadata: docPartSdtMetadata
89131
+ sdtMetadata: docPartSdtMetadata,
89132
+ tocId: docPartObjectId ?? undefined
89124
89133
  }, {
89125
89134
  nextBlockId: context.nextBlockId,
89126
89135
  positions: context.positions,
@@ -89191,12 +89200,15 @@ function handleDocumentPartObjectNode(node2, context) {
89191
89200
  const tocInstruction = getNodeInstruction(node2);
89192
89201
  const docPartSdtMetadata = resolveNodeSdtMetadata(node2, "docPartObject");
89193
89202
  const paragraphToFlowBlocks$1 = converters$1.paragraphToFlowBlocks;
89203
+ const sdBlockId = node2.attrs?.sdBlockId;
89204
+ const tocId = docPartObjectId && docPartObjectId.length > 0 ? docPartObjectId : typeof sdBlockId === "string" && sdBlockId.length > 0 ? sdBlockId : undefined;
89194
89205
  if (docPartGallery === "Table of Contents")
89195
89206
  processTocChildren(Array.from(node2.content), {
89196
89207
  docPartGallery,
89197
89208
  docPartObjectId,
89198
89209
  tocInstruction,
89199
- sdtMetadata: docPartSdtMetadata
89210
+ sdtMetadata: docPartSdtMetadata,
89211
+ tocId
89200
89212
  }, {
89201
89213
  nextBlockId,
89202
89214
  positions,
@@ -89244,7 +89256,8 @@ function handleDocumentPartObjectNode(node2, context) {
89244
89256
  docPartGallery: docPartGallery ?? "",
89245
89257
  docPartObjectId,
89246
89258
  tocInstruction: getNodeInstruction(child) ?? tocInstruction,
89247
- sdtMetadata: docPartSdtMetadata
89259
+ sdtMetadata: docPartSdtMetadata,
89260
+ tocId
89248
89261
  };
89249
89262
  const tocContext = {
89250
89263
  nextBlockId,
@@ -118037,7 +118050,7 @@ var isRegExp = (value) => {
118037
118050
  state.kern = kernNode.attributes["w:val"];
118038
118051
  }
118039
118052
  }, SuperConverter;
118040
- var init_SuperConverter_BaKhr4cp_es = __esm(() => {
118053
+ var init_SuperConverter_e4tY_2EB_es = __esm(() => {
118041
118054
  init_rolldown_runtime_Bg48TavK_es();
118042
118055
  init_jszip_C49i9kUs_es();
118043
118056
  init_xml_js_CqGKpaft_es();
@@ -157821,7 +157834,7 @@ var init_SuperConverter_BaKhr4cp_es = __esm(() => {
157821
157834
  };
157822
157835
  });
157823
157836
 
157824
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-B3wNa0zb.es.js
157837
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-3iIgFoKe.es.js
157825
157838
  function parseSizeUnit(val = "0") {
157826
157839
  const length = val.toString() || "0";
157827
157840
  const value = Number.parseFloat(length);
@@ -168179,8 +168192,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
168179
168192
  }
168180
168193
  };
168181
168194
  };
168182
- var init_create_headless_toolbar_B3wNa0zb_es = __esm(() => {
168183
- init_SuperConverter_BaKhr4cp_es();
168195
+ var init_create_headless_toolbar_3iIgFoKe_es = __esm(() => {
168196
+ init_SuperConverter_e4tY_2EB_es();
168184
168197
  init_uuid_B2wVPhPi_es();
168185
168198
  init_constants_D9qj59G2_es();
168186
168199
  init_dist_B8HfvhaK_es();
@@ -222864,7 +222877,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
222864
222877
  init_remark_gfm_BhnWr3yf_es();
222865
222878
  });
222866
222879
 
222867
- // ../../packages/superdoc/dist/chunks/src-jCy2h55W.es.js
222880
+ // ../../packages/superdoc/dist/chunks/src-M0JgzZDj.es.js
222868
222881
  function deleteProps(obj, propOrProps) {
222869
222882
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
222870
222883
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -231958,9 +231971,6 @@ function replaceCommand(wrap4, moveForward) {
231958
231971
  return true;
231959
231972
  };
231960
231973
  }
231961
- function buildSdtBlockSelector(escapedSdtId) {
231962
- return `.${DOM_CLASS_NAMES.BLOCK_SDT}[${DATA_ATTRS.SDT_ID}="${escapedSdtId}"]`;
231963
- }
231964
231974
  function buildAnnotationSelector() {
231965
231975
  return `.${DOM_CLASS_NAMES.ANNOTATION}[${DATA_ATTRS.PM_START}]`;
231966
231976
  }
@@ -302032,6 +302042,7 @@ var Node$13 = class Node$14 {
302032
302042
  this.syncInlineStyleLayers(options.editorState, options.domPositionIndex);
302033
302043
  this.applyProofingAnnotations(options.proofingAnnotations, options.rebuildDomPositionIndex);
302034
302044
  options.reapplyStructuredContentHover?.();
302045
+ options.reapplyTocGroupHover?.();
302035
302046
  }
302036
302047
  destroy() {
302037
302048
  this.#proofingDecorator.clear();
@@ -302041,6 +302052,83 @@ var Node$13 = class Node$14 {
302041
302052
  this.#commentHighlightDecorator.destroy();
302042
302053
  this.#decorationBridge.destroy();
302043
302054
  }
302055
+ }, HoverGroupCoordinator = class {
302056
+ #spec;
302057
+ #current = null;
302058
+ constructor(spec) {
302059
+ this.handleMouseEnter = (event) => {
302060
+ const entry = event.target?.closest?.(this.#spec.entrySelector);
302061
+ if (!entry)
302062
+ return;
302063
+ const id2 = this.#spec.getId(entry);
302064
+ if (!id2)
302065
+ return;
302066
+ this.#set(id2);
302067
+ };
302068
+ this.handleMouseLeave = (event) => {
302069
+ const entry = event.target?.closest?.(this.#spec.entrySelector);
302070
+ if (!entry)
302071
+ return;
302072
+ const id2 = this.#spec.getId(entry);
302073
+ if (!id2)
302074
+ return;
302075
+ const relatedTarget = event.relatedTarget;
302076
+ if (relatedTarget) {
302077
+ const nextEntry = relatedTarget.closest?.(this.#spec.entrySelector);
302078
+ if (nextEntry && this.#spec.getId(nextEntry) === id2)
302079
+ return;
302080
+ }
302081
+ this.clear();
302082
+ };
302083
+ this.#spec = spec;
302084
+ }
302085
+ reapply() {
302086
+ if (!this.#current)
302087
+ return;
302088
+ const { id: id2 } = this.#current;
302089
+ const elements = this.#spec.queryGroup(id2);
302090
+ if (elements.length === 0) {
302091
+ this.#current = null;
302092
+ return;
302093
+ }
302094
+ this.#applyClass(elements);
302095
+ this.#spec.onApply?.(elements);
302096
+ this.#current = {
302097
+ id: id2,
302098
+ elements
302099
+ };
302100
+ }
302101
+ clear() {
302102
+ if (!this.#current)
302103
+ return;
302104
+ for (const element3 of this.#current.elements) {
302105
+ element3.classList.remove(this.#spec.hoverClass);
302106
+ this.#spec.onClear?.(element3);
302107
+ }
302108
+ this.#current = null;
302109
+ }
302110
+ #set(id2) {
302111
+ if (this.#current?.id === id2)
302112
+ return;
302113
+ this.clear();
302114
+ const elements = this.#spec.queryGroup(id2);
302115
+ if (elements.length === 0)
302116
+ return;
302117
+ this.#applyClass(elements);
302118
+ this.#spec.onApply?.(elements);
302119
+ this.#current = {
302120
+ id: id2,
302121
+ elements
302122
+ };
302123
+ }
302124
+ #applyClass(elements) {
302125
+ const filter = this.#spec.shouldApplyTo;
302126
+ for (const element3 of elements) {
302127
+ if (filter && !filter(element3))
302128
+ continue;
302129
+ element3.classList.add(this.#spec.hoverClass);
302130
+ }
302131
+ }
302044
302132
  }, ProofingStore = class {
302045
302133
  #issuesBySegment = /* @__PURE__ */ new Map;
302046
302134
  addIssue(issue2) {
@@ -302651,6 +302739,9 @@ var Node$13 = class Node$14 {
302651
302739
  color: inherit !important;
302652
302740
  text-decoration: none !important;
302653
302741
  cursor: default;
302742
+ /* Disable native link drag so our pointer loop can run text-selection. */
302743
+ -webkit-user-drag: none;
302744
+ user-drag: none;
302654
302745
  }
302655
302746
 
302656
302747
  .superdoc-toc-entry .superdoc-link:hover {
@@ -302662,6 +302753,31 @@ var Node$13 = class Node$14 {
302662
302753
  outline: none;
302663
302754
  }
302664
302755
 
302756
+ /* TOC hover. .toc-group-hover is set by PresentationEditor on every entry
302757
+ sharing a data-toc-id so the whole TOC greys out together. The ::after
302758
+ stripe (height set via --toc-gap-below) fills the paragraph-spacing gap
302759
+ between adjacent entries so the hover reads as one continuous block. */
302760
+ .superdoc-toc-entry:hover,
302761
+ .superdoc-toc-entry.toc-group-hover {
302762
+ background-color: var(--sd-content-controls-block-hover-bg, #f2f2f2);
302763
+ }
302764
+
302765
+ /* Pointer-events stay on (default) so the stripe extends the parent entry's
302766
+ hit-test area through the paragraph-spacing gap. Without this, moving the
302767
+ cursor between two adjacent entries fires mouseout on the upper entry with
302768
+ relatedTarget = the page (not a TOC entry), the coordinator drops the
302769
+ group-hover class, and the grey disappears for a frame before the next
302770
+ entry's mouseover restores it — visible as a flicker. */
302771
+ .superdoc-toc-entry.toc-group-hover::after {
302772
+ content: '';
302773
+ position: absolute;
302774
+ left: 0;
302775
+ right: 0;
302776
+ top: 100%;
302777
+ height: var(--toc-gap-below, 0px);
302778
+ background-color: var(--sd-content-controls-block-hover-bg, #f2f2f2);
302779
+ }
302780
+
302665
302781
  /* Remove focus outlines from layout engine elements */
302666
302782
  .superdoc-layout,
302667
302783
  .superdoc-page,
@@ -306639,8 +306755,12 @@ menclose::after {
306639
306755
  applyResolvedFragmentFrame(fragmentEl, resolvedItem, fragment);
306640
306756
  else
306641
306757
  applyFragmentFrame(fragmentEl, fragment);
306642
- if (isTocEntry)
306643
- fragmentEl.classList.add("superdoc-toc-entry");
306758
+ if (isTocEntry) {
306759
+ fragmentEl.classList.add(DOM_CLASS_NAMES.TOC_ENTRY);
306760
+ const tocId = block.attrs?.tocId;
306761
+ if (typeof tocId === "string" && tocId.length > 0)
306762
+ fragmentEl.dataset.tocId = tocId;
306763
+ }
306644
306764
  if (paraContinuesFromPrev)
306645
306765
  fragmentEl.dataset.continuesFromPrev = "true";
306646
306766
  if (paraContinuesOnNext)
@@ -314835,6 +314955,7 @@ menclose::after {
314835
314955
  #cellAnchor = null;
314836
314956
  #cellDragMode = "none";
314837
314957
  #pendingMarginClick = null;
314958
+ #pendingTocLinkNav = null;
314838
314959
  #lastSelectedImageBlockId = null;
314839
314960
  #suppressFocusInFromDraggable = false;
314840
314961
  #pendingStructuredContentLabelGesture = null;
@@ -315376,10 +315497,14 @@ menclose::after {
315376
315497
  return;
315377
315498
  }
315378
315499
  const linkEl = target?.closest?.("a.superdoc-link");
315379
- if (linkEl) {
315380
- this.#handleLinkClick(event, linkEl);
315381
- return;
315382
- }
315500
+ this.#pendingTocLinkNav = null;
315501
+ if (linkEl)
315502
+ if (linkEl.closest(`.${DOM_CLASS_NAMES.TOC_ENTRY}`))
315503
+ this.#pendingTocLinkNav = linkEl;
315504
+ else {
315505
+ this.#handleLinkClick(event, linkEl);
315506
+ return;
315507
+ }
315383
315508
  const annotationEl = target?.closest?.(buildAnnotationSelector());
315384
315509
  const isDraggableAnnotation = target?.closest?.(DRAGGABLE_SELECTOR) != null;
315385
315510
  const isNativeDragSource = target?.closest?.(DRAG_SOURCE_SELECTOR) != null;
@@ -315718,6 +315843,10 @@ menclose::after {
315718
315843
  event
315719
315844
  });
315720
315845
  this.#suppressFocusInFromDraggable = false;
315846
+ const pendingTocLink = this.#pendingTocLinkNav;
315847
+ this.#pendingTocLinkNav = null;
315848
+ if (pendingTocLink && !this.#dragThresholdExceeded)
315849
+ this.#handleLinkClick(event, pendingTocLink);
315721
315850
  if (!this.#isDragging) {
315722
315851
  this.#stopAutoScroll();
315723
315852
  return;
@@ -320192,13 +320321,13 @@ menclose::after {
320192
320321
  return;
320193
320322
  console.log(...args$1);
320194
320323
  }, 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;
320195
- var init_src_jCy2h55W_es = __esm(() => {
320324
+ var init_src_M0JgzZDj_es = __esm(() => {
320196
320325
  init_rolldown_runtime_Bg48TavK_es();
320197
- init_SuperConverter_BaKhr4cp_es();
320326
+ init_SuperConverter_e4tY_2EB_es();
320198
320327
  init_jszip_C49i9kUs_es();
320199
320328
  init_xml_js_CqGKpaft_es();
320200
320329
  init_uuid_B2wVPhPi_es();
320201
- init_create_headless_toolbar_B3wNa0zb_es();
320330
+ init_create_headless_toolbar_3iIgFoKe_es();
320202
320331
  init_constants_D9qj59G2_es();
320203
320332
  init_dist_B8HfvhaK_es();
320204
320333
  init_unified_Dsuw2be5_es();
@@ -339128,6 +339257,8 @@ function print() { __p += __j.call(arguments, '') }
339128
339257
  TABLE_FRAGMENT: "superdoc-table-fragment",
339129
339258
  DOCUMENT_SECTION: "superdoc-document-section",
339130
339259
  SDT_GROUP_HOVER: "sdt-group-hover",
339260
+ TOC_ENTRY: "superdoc-toc-entry",
339261
+ TOC_GROUP_HOVER: "toc-group-hover",
339131
339262
  IMAGE_FRAGMENT: "superdoc-image-fragment",
339132
339263
  INLINE_IMAGE: "superdoc-inline-image",
339133
339264
  LIST_MARKER: "superdoc-list-marker",
@@ -341441,7 +341572,8 @@ function print() { __p += __j.call(arguments, '') }
341441
341572
  const menuRef = exports_vue.ref(null);
341442
341573
  const menuPosition = exports_vue.ref({
341443
341574
  top: "0px",
341444
- left: "0px"
341575
+ left: "0px",
341576
+ maxHeight: "none"
341445
341577
  });
341446
341578
  const optionRefs = exports_vue.ref([]);
341447
341579
  const keyboardIndex = exports_vue.ref(-1);
@@ -341478,6 +341610,7 @@ function print() { __p += __j.call(arguments, '') }
341478
341610
  position: "fixed",
341479
341611
  top: menuPosition.value.top,
341480
341612
  left: menuPosition.value.left,
341613
+ maxHeight: menuPosition.value.maxHeight,
341481
341614
  zIndex: 2000
341482
341615
  };
341483
341616
  });
@@ -341493,17 +341626,30 @@ function print() { __p += __j.call(arguments, '') }
341493
341626
  if (!triggerRef.value)
341494
341627
  return;
341495
341628
  const rect = triggerRef.value.getBoundingClientRect();
341496
- const menuWidth = menuRef.value?.offsetWidth ?? 0;
341629
+ const menuEl = menuRef.value;
341630
+ const menuWidth = menuEl?.offsetWidth ?? 0;
341631
+ const menuHeight = menuEl?.scrollHeight ?? menuEl?.offsetHeight ?? 0;
341497
341632
  const viewportWidth = window.innerWidth || document.documentElement.clientWidth || 0;
341633
+ const viewportHeight = window.innerHeight || document.documentElement.clientHeight || 0;
341498
341634
  const gutter = 8;
341635
+ const gap = 4;
341636
+ const belowTop = rect.bottom + gap;
341637
+ const aboveBottom = rect.top - gap;
341638
+ const availableBelow = Math.max(0, viewportHeight - belowTop - gutter);
341639
+ const availableAbove = Math.max(0, aboveBottom - gutter);
341640
+ const openAbove = availableBelow < menuHeight && availableAbove > availableBelow;
341641
+ const maxHeight = openAbove ? availableAbove : availableBelow;
341642
+ const menuRenderHeight = menuHeight ? Math.min(menuHeight, maxHeight) : maxHeight;
341643
+ const top$1 = openAbove ? Math.max(gutter, aboveBottom - menuRenderHeight) : belowTop;
341499
341644
  let left$1 = rect.left;
341500
341645
  if (props.placement === "bottom-end")
341501
341646
  left$1 = rect.right - menuWidth;
341502
341647
  const maxLeft = Math.max(gutter, viewportWidth - menuWidth - gutter);
341503
341648
  left$1 = Math.min(Math.max(gutter, left$1), maxLeft);
341504
341649
  menuPosition.value = {
341505
- top: `${rect.bottom + 4}px`,
341506
- left: `${left$1}px`
341650
+ top: `${top$1}px`,
341651
+ left: `${left$1}px`,
341652
+ maxHeight: `${maxHeight}px`
341507
341653
  };
341508
341654
  };
341509
341655
  const onTriggerClick = () => {
@@ -341569,8 +341715,13 @@ function print() { __p += __j.call(arguments, '') }
341569
341715
  el.setAttribute("tabindex", index2 === keyboardIndex.value ? "0" : "-1");
341570
341716
  });
341571
341717
  const target = optionRefs.value[keyboardIndex.value];
341572
- if (target && typeof target.focus === "function")
341718
+ if (target && typeof target.focus === "function") {
341573
341719
  target.focus();
341720
+ target.scrollIntoView?.({
341721
+ block: "nearest",
341722
+ inline: "nearest"
341723
+ });
341724
+ }
341574
341725
  };
341575
341726
  const moveKeyboardIndex = (direction) => {
341576
341727
  const navigableIndexes = getNavigableIndexes();
@@ -341705,6 +341856,7 @@ function print() { __p += __j.call(arguments, '') }
341705
341856
  if (hasRenderOptions.value)
341706
341857
  return;
341707
341858
  keyboardIndex.value = getInitialKeyboardIndex();
341859
+ await exports_vue.nextTick();
341708
341860
  focusKeyboardIndex();
341709
341861
  }, { immediate: true });
341710
341862
  exports_vue.watch(isOpen, (open) => {
@@ -341768,7 +341920,7 @@ function print() { __p += __j.call(arguments, '') }
341768
341920
  })]))]);
341769
341921
  };
341770
341922
  }
341771
- }, [["__scopeId", "data-v-302f7d86"]]);
341923
+ }, [["__scopeId", "data-v-69732782"]]);
341772
341924
  SdTooltip_default = /* @__PURE__ */ __plugin_vue_export_helper_default(/* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
341773
341925
  __name: "SdTooltip",
341774
341926
  props: {
@@ -348632,7 +348784,8 @@ function print() { __p += __j.call(arguments, '') }
348632
348784
  #lastSelectedFieldAnnotation = null;
348633
348785
  #lastSelectedStructuredContentBlock = null;
348634
348786
  #lastSelectedStructuredContentInline = null;
348635
- #lastHoveredStructuredContentBlock = null;
348787
+ #sdtHoverCoordinator = null;
348788
+ #tocHoverCoordinator = null;
348636
348789
  #remoteCursorManager = null;
348637
348790
  #cursorUpdateTimer = null;
348638
348791
  #remoteCursorOverlay = null;
@@ -348703,8 +348856,11 @@ function print() { __p += __j.call(arguments, '') }
348703
348856
  ensureEditorNativeSelectionStyles(doc$12);
348704
348857
  ensureEditorFieldAnnotationInteractionStyles(doc$12);
348705
348858
  ensureEditorMovableObjectInteractionStyles(doc$12);
348706
- this.#painterHost.addEventListener("mouseover", this.#handleStructuredContentBlockMouseEnter);
348707
- this.#painterHost.addEventListener("mouseout", this.#handleStructuredContentBlockMouseLeave);
348859
+ this.#initializeHoverCoordinators();
348860
+ this.#painterHost.addEventListener("mouseover", this.#sdtHoverCoordinator.handleMouseEnter);
348861
+ this.#painterHost.addEventListener("mouseout", this.#sdtHoverCoordinator.handleMouseLeave);
348862
+ this.#painterHost.addEventListener("mouseover", this.#tocHoverCoordinator.handleMouseEnter);
348863
+ this.#painterHost.addEventListener("mouseout", this.#tocHoverCoordinator.handleMouseLeave);
348708
348864
  this.#domIndexObserverManager = new DomPositionIndexObserverManager({
348709
348865
  windowRoot: this.#visibleHost?.ownerDocument?.defaultView ?? window,
348710
348866
  getPainterHost: () => this.#painterHost,
@@ -352695,74 +352851,50 @@ function print() { __p += __j.call(arguments, '') }
352695
352851
  }
352696
352852
  this.#setSelectedStructuredContentBlockClass(elements, id2);
352697
352853
  }
352698
- #handleStructuredContentBlockMouseEnter = (event) => {
352699
- const block = event.target.closest(`.${DOM_CLASS_NAMES.BLOCK_SDT}`);
352700
- if (!block || !(block instanceof HTMLElement))
352701
- return;
352702
- if (block.classList.contains("ProseMirror-selectednode"))
352854
+ #initializeHoverCoordinators() {
352855
+ if (this.#sdtHoverCoordinator || this.#tocHoverCoordinator)
352703
352856
  return;
352704
- const rawId = block.dataset.sdtId;
352705
- if (!rawId)
352706
- return;
352707
- this.#setHoveredStructuredContentBlockClass(rawId);
352708
- };
352709
- #handleStructuredContentBlockMouseLeave = (event) => {
352710
- const block = event.target.closest(`.${DOM_CLASS_NAMES.BLOCK_SDT}`);
352711
- if (!block)
352857
+ this.#sdtHoverCoordinator = new HoverGroupCoordinator({
352858
+ entrySelector: `.${DOM_CLASS_NAMES.BLOCK_SDT}`,
352859
+ getId: (entry) => entry.dataset.sdtId,
352860
+ queryGroup: (id2) => this.#painterAdapter.getStructuredContentBlockElementsById(id2),
352861
+ hoverClass: DOM_CLASS_NAMES.SDT_GROUP_HOVER,
352862
+ shouldApplyTo: (element3) => !element3.classList.contains("ProseMirror-selectednode")
352863
+ });
352864
+ this.#tocHoverCoordinator = new HoverGroupCoordinator({
352865
+ entrySelector: `.${DOM_CLASS_NAMES.TOC_ENTRY}`,
352866
+ getId: (entry) => entry.dataset.tocId,
352867
+ queryGroup: (id2) => this.#queryTocEntryElementsById(id2),
352868
+ hoverClass: DOM_CLASS_NAMES.TOC_GROUP_HOVER,
352869
+ onApply: (elements) => this.#applyTocGapFill(elements),
352870
+ onClear: (element3) => element3.style.removeProperty("--toc-gap-below")
352871
+ });
352872
+ }
352873
+ #applyTocGapFill(elements) {
352874
+ if (elements.length < 2)
352712
352875
  return;
352713
- const relatedTarget = event.relatedTarget;
352714
- if (relatedTarget && block.dataset.sdtId) {
352715
- const escapedCheckId = typeof CSS !== "undefined" && CSS.escape ? CSS.escape(block.dataset.sdtId) : block.dataset.sdtId.replace(/"/g, "\\\"");
352716
- if (relatedTarget.closest(buildSdtBlockSelector(escapedCheckId)))
352717
- return;
352876
+ const measured = elements.map((element3) => ({
352877
+ element: element3,
352878
+ rect: element3.getBoundingClientRect()
352879
+ })).sort((a2, b$1) => a2.rect.top - b$1.rect.top);
352880
+ for (let i4 = 0;i4 < measured.length - 1; i4++) {
352881
+ const current = measured[i4];
352882
+ const next2 = measured[i4 + 1];
352883
+ const currentPage = current.element.closest("[data-page-index]");
352884
+ if (!currentPage || currentPage !== next2.element.closest("[data-page-index]"))
352885
+ continue;
352886
+ const rawGap = next2.rect.top - current.rect.bottom;
352887
+ const scaleY = current.rect.height && current.element.offsetHeight ? current.rect.height / current.element.offsetHeight : 1;
352888
+ const gap = scaleY > 0 ? rawGap / scaleY : rawGap;
352889
+ if (gap > 0)
352890
+ current.element.style.setProperty("--toc-gap-below", `${gap + 1}px`);
352718
352891
  }
352719
- this.#clearHoveredStructuredContentBlockClass();
352720
- };
352721
- #clearHoveredStructuredContentBlockClass() {
352722
- if (!this.#lastHoveredStructuredContentBlock)
352723
- return;
352724
- this.#lastHoveredStructuredContentBlock.elements.forEach((element3) => {
352725
- element3.classList.remove(DOM_CLASS_NAMES.SDT_GROUP_HOVER);
352726
- });
352727
- this.#lastHoveredStructuredContentBlock = null;
352728
352892
  }
352729
- #setHoveredStructuredContentBlockClass(id2) {
352730
- if (this.#lastHoveredStructuredContentBlock?.id === id2)
352731
- return;
352732
- this.#clearHoveredStructuredContentBlockClass();
352893
+ #queryTocEntryElementsById(id2) {
352733
352894
  if (!this.#painterHost)
352734
- return;
352735
- const elements = this.#painterAdapter.getStructuredContentBlockElementsById(id2);
352736
- if (elements.length === 0)
352737
- return;
352738
- elements.forEach((element3) => {
352739
- if (!element3.classList.contains("ProseMirror-selectednode"))
352740
- element3.classList.add(DOM_CLASS_NAMES.SDT_GROUP_HOVER);
352741
- });
352742
- this.#lastHoveredStructuredContentBlock = {
352743
- id: id2,
352744
- elements
352745
- };
352746
- }
352747
- #reapplySdtGroupHover() {
352748
- if (!this.#lastHoveredStructuredContentBlock || !this.#painterHost)
352749
- return;
352750
- const { id: id2 } = this.#lastHoveredStructuredContentBlock;
352751
- if (!id2)
352752
- return;
352753
- const elements = this.#painterAdapter.getStructuredContentBlockElementsById(id2);
352754
- if (elements.length === 0) {
352755
- this.#lastHoveredStructuredContentBlock = null;
352756
- return;
352757
- }
352758
- elements.forEach((element3) => {
352759
- if (!element3.classList.contains("ProseMirror-selectednode"))
352760
- element3.classList.add(DOM_CLASS_NAMES.SDT_GROUP_HOVER);
352761
- });
352762
- this.#lastHoveredStructuredContentBlock = {
352763
- id: id2,
352764
- elements
352765
- };
352895
+ return [];
352896
+ const escapedId = escapeAttrValue(id2);
352897
+ return Array.from(this.#painterHost.querySelectorAll(`.${DOM_CLASS_NAMES.TOC_ENTRY}[data-toc-id="${escapedId}"]`));
352766
352898
  }
352767
352899
  #refreshEditorDomAugmentations() {
352768
352900
  this.#postPaintPipeline.refreshAfterPaint({
@@ -352771,7 +352903,8 @@ function print() { __p += __j.call(arguments, '') }
352771
352903
  domPositionIndex: this.#domPositionIndex,
352772
352904
  proofingAnnotations: this.#buildProofingAnnotations(),
352773
352905
  rebuildDomPositionIndex: () => this.#rebuildDomPositionIndex(),
352774
- reapplyStructuredContentHover: () => this.#reapplySdtGroupHover()
352906
+ reapplyStructuredContentHover: () => this.#sdtHoverCoordinator?.reapply(),
352907
+ reapplyTocGroupHover: () => this.#tocHoverCoordinator?.reapply()
352775
352908
  });
352776
352909
  }
352777
352910
  #clearSelectedStructuredContentInlineClass() {
@@ -355159,11 +355292,11 @@ function print() { __p += __j.call(arguments, '') }
355159
355292
  ]);
355160
355293
  });
355161
355294
 
355162
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-ClaBD_rO.es.js
355295
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BbHhTe5g.es.js
355163
355296
  var headlessToolbarConstants, MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
355164
- var init_create_super_doc_ui_ClaBD_rO_es = __esm(() => {
355165
- init_SuperConverter_BaKhr4cp_es();
355166
- init_create_headless_toolbar_B3wNa0zb_es();
355297
+ var init_create_super_doc_ui_BbHhTe5g_es = __esm(() => {
355298
+ init_SuperConverter_e4tY_2EB_es();
355299
+ init_create_headless_toolbar_3iIgFoKe_es();
355167
355300
  headlessToolbarConstants = {
355168
355301
  DEFAULT_TEXT_ALIGN_OPTIONS: [
355169
355302
  {
@@ -355445,16 +355578,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
355445
355578
 
355446
355579
  // ../../packages/superdoc/dist/super-editor.es.js
355447
355580
  var init_super_editor_es = __esm(() => {
355448
- init_src_jCy2h55W_es();
355449
- init_SuperConverter_BaKhr4cp_es();
355581
+ init_src_M0JgzZDj_es();
355582
+ init_SuperConverter_e4tY_2EB_es();
355450
355583
  init_jszip_C49i9kUs_es();
355451
355584
  init_xml_js_CqGKpaft_es();
355452
- init_create_headless_toolbar_B3wNa0zb_es();
355585
+ init_create_headless_toolbar_3iIgFoKe_es();
355453
355586
  init_constants_D9qj59G2_es();
355454
355587
  init_dist_B8HfvhaK_es();
355455
355588
  init_unified_Dsuw2be5_es();
355456
355589
  init_DocxZipper_FUsfThjV_es();
355457
- init_create_super_doc_ui_ClaBD_rO_es();
355590
+ init_create_super_doc_ui_BbHhTe5g_es();
355458
355591
  init_ui_C5PAS9hY_es();
355459
355592
  init_eventemitter3_BnGqBE_Q_es();
355460
355593
  init_errors_CNaD6vcg_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/mcp",
3
- "version": "0.12.0-next.6",
3
+ "version": "0.12.0-next.8",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20"
@@ -19,8 +19,8 @@
19
19
  "@types/bun": "^1.3.8",
20
20
  "@types/node": "22.19.2",
21
21
  "typescript": "^5.9.2",
22
- "@superdoc/document-api": "0.0.1",
23
22
  "@superdoc/super-editor": "0.0.1",
23
+ "@superdoc/document-api": "0.0.1",
24
24
  "superdoc": "1.39.0"
25
25
  },
26
26
  "publishConfig": {