@superdoc-dev/cli 0.17.0-next.6 → 0.17.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 +8 -8
package/dist/index.js CHANGED
@@ -68327,7 +68327,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
68327
68327
  emptyOptions2 = {};
68328
68328
  });
68329
68329
 
68330
- // ../../packages/superdoc/dist/chunks/SuperConverter-BaKhr4cp.es.js
68330
+ // ../../packages/superdoc/dist/chunks/SuperConverter-e4tY-2EB.es.js
68331
68331
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
68332
68332
  const fieldValue = extension$1.config[field];
68333
68333
  if (typeof fieldValue === "function")
@@ -104893,12 +104893,14 @@ function applyTocMetadata(blocks, metadata) {
104893
104893
  };
104894
104894
  if (metadata.instruction)
104895
104895
  block.attrs.tocInstruction = metadata.instruction;
104896
+ if (metadata.tocId)
104897
+ block.attrs.tocId = metadata.tocId;
104896
104898
  }
104897
104899
  });
104898
104900
  }
104899
104901
  function processTocChildren(children, metadata, context, outputArrays) {
104900
104902
  const paragraphConverter = context.converters.paragraphToFlowBlocks;
104901
- const { docPartGallery, docPartObjectId, tocInstruction } = metadata;
104903
+ const { docPartGallery, docPartObjectId, tocInstruction, tocId } = metadata;
104902
104904
  const { blocks, recordBlockKind } = outputArrays;
104903
104905
  children.forEach((child) => {
104904
104906
  if (child.type === "paragraph") {
@@ -104923,7 +104925,8 @@ function processTocChildren(children, metadata, context, outputArrays) {
104923
104925
  applyTocMetadata(paragraphBlocks, {
104924
104926
  gallery: docPartGallery,
104925
104927
  uniqueId: docPartObjectId,
104926
- instruction: tocInstruction
104928
+ instruction: tocInstruction,
104929
+ tocId
104927
104930
  });
104928
104931
  applySdtMetadataToParagraphBlocks(paragraphBlocks.filter((b) => b.kind === "paragraph"), metadata.sdtMetadata);
104929
104932
  paragraphBlocks.forEach((block) => {
@@ -104938,7 +104941,8 @@ function processTocChildren(children, metadata, context, outputArrays) {
104938
104941
  docPartGallery,
104939
104942
  docPartObjectId,
104940
104943
  tocInstruction: finalInstruction,
104941
- sdtMetadata: metadata.sdtMetadata
104944
+ sdtMetadata: metadata.sdtMetadata,
104945
+ tocId
104942
104946
  }, context, outputArrays);
104943
104947
  }
104944
104948
  });
@@ -104946,7 +104950,11 @@ function processTocChildren(children, metadata, context, outputArrays) {
104946
104950
  function handleTableOfContentsNode(node3, context) {
104947
104951
  if (!Array.isArray(node3.content))
104948
104952
  return;
104949
- processTocChildren(node3.content, { tocInstruction: getNodeInstruction(node3) }, {
104953
+ const sdBlockId = node3.attrs?.sdBlockId;
104954
+ processTocChildren(node3.content, {
104955
+ tocInstruction: getNodeInstruction(node3),
104956
+ tocId: typeof sdBlockId === "string" ? sdBlockId : undefined
104957
+ }, {
104950
104958
  nextBlockId: context.nextBlockId,
104951
104959
  positions: context.positions,
104952
104960
  bookmarks: context.bookmarks,
@@ -105275,7 +105283,8 @@ function processDocumentPartObject(child, sectionMetadata, context, output, conv
105275
105283
  docPartGallery,
105276
105284
  docPartObjectId,
105277
105285
  tocInstruction,
105278
- sdtMetadata: docPartSdtMetadata
105286
+ sdtMetadata: docPartSdtMetadata,
105287
+ tocId: docPartObjectId ?? undefined
105279
105288
  }, {
105280
105289
  nextBlockId: context.nextBlockId,
105281
105290
  positions: context.positions,
@@ -105346,12 +105355,15 @@ function handleDocumentPartObjectNode(node3, context) {
105346
105355
  const tocInstruction = getNodeInstruction(node3);
105347
105356
  const docPartSdtMetadata = resolveNodeSdtMetadata(node3, "docPartObject");
105348
105357
  const paragraphToFlowBlocks$1 = converters$1.paragraphToFlowBlocks;
105358
+ const sdBlockId = node3.attrs?.sdBlockId;
105359
+ const tocId = docPartObjectId && docPartObjectId.length > 0 ? docPartObjectId : typeof sdBlockId === "string" && sdBlockId.length > 0 ? sdBlockId : undefined;
105349
105360
  if (docPartGallery === "Table of Contents")
105350
105361
  processTocChildren(Array.from(node3.content), {
105351
105362
  docPartGallery,
105352
105363
  docPartObjectId,
105353
105364
  tocInstruction,
105354
- sdtMetadata: docPartSdtMetadata
105365
+ sdtMetadata: docPartSdtMetadata,
105366
+ tocId
105355
105367
  }, {
105356
105368
  nextBlockId,
105357
105369
  positions,
@@ -105399,7 +105411,8 @@ function handleDocumentPartObjectNode(node3, context) {
105399
105411
  docPartGallery: docPartGallery ?? "",
105400
105412
  docPartObjectId,
105401
105413
  tocInstruction: getNodeInstruction(child) ?? tocInstruction,
105402
- sdtMetadata: docPartSdtMetadata
105414
+ sdtMetadata: docPartSdtMetadata,
105415
+ tocId
105403
105416
  };
105404
105417
  const tocContext = {
105405
105418
  nextBlockId,
@@ -134192,7 +134205,7 @@ var isRegExp = (value) => {
134192
134205
  state.kern = kernNode.attributes["w:val"];
134193
134206
  }
134194
134207
  }, SuperConverter;
134195
- var init_SuperConverter_BaKhr4cp_es = __esm(() => {
134208
+ var init_SuperConverter_e4tY_2EB_es = __esm(() => {
134196
134209
  init_rolldown_runtime_Bg48TavK_es();
134197
134210
  init_jszip_C49i9kUs_es();
134198
134211
  init_xml_js_CqGKpaft_es();
@@ -173976,7 +173989,7 @@ var init_SuperConverter_BaKhr4cp_es = __esm(() => {
173976
173989
  };
173977
173990
  });
173978
173991
 
173979
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-B3wNa0zb.es.js
173992
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-3iIgFoKe.es.js
173980
173993
  function parseSizeUnit(val = "0") {
173981
173994
  const length3 = val.toString() || "0";
173982
173995
  const value = Number.parseFloat(length3);
@@ -184334,8 +184347,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
184334
184347
  }
184335
184348
  };
184336
184349
  };
184337
- var init_create_headless_toolbar_B3wNa0zb_es = __esm(() => {
184338
- init_SuperConverter_BaKhr4cp_es();
184350
+ var init_create_headless_toolbar_3iIgFoKe_es = __esm(() => {
184351
+ init_SuperConverter_e4tY_2EB_es();
184339
184352
  init_uuid_B2wVPhPi_es();
184340
184353
  init_constants_D9qj59G2_es();
184341
184354
  init_dist_B8HfvhaK_es();
@@ -233498,7 +233511,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
233498
233511
  init_remark_gfm_BhnWr3yf_es();
233499
233512
  });
233500
233513
 
233501
- // ../../packages/superdoc/dist/chunks/src-jCy2h55W.es.js
233514
+ // ../../packages/superdoc/dist/chunks/src-M0JgzZDj.es.js
233502
233515
  function deleteProps(obj, propOrProps) {
233503
233516
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
233504
233517
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -242592,9 +242605,6 @@ function replaceCommand(wrap5, moveForward) {
242592
242605
  return true;
242593
242606
  };
242594
242607
  }
242595
- function buildSdtBlockSelector(escapedSdtId) {
242596
- return `.${DOM_CLASS_NAMES.BLOCK_SDT}[${DATA_ATTRS.SDT_ID}="${escapedSdtId}"]`;
242597
- }
242598
242608
  function buildAnnotationSelector() {
242599
242609
  return `.${DOM_CLASS_NAMES.ANNOTATION}[${DATA_ATTRS.PM_START}]`;
242600
242610
  }
@@ -312799,6 +312809,7 @@ var Node$13 = class Node$14 {
312799
312809
  this.syncInlineStyleLayers(options.editorState, options.domPositionIndex);
312800
312810
  this.applyProofingAnnotations(options.proofingAnnotations, options.rebuildDomPositionIndex);
312801
312811
  options.reapplyStructuredContentHover?.();
312812
+ options.reapplyTocGroupHover?.();
312802
312813
  }
312803
312814
  destroy() {
312804
312815
  this.#proofingDecorator.clear();
@@ -312808,6 +312819,83 @@ var Node$13 = class Node$14 {
312808
312819
  this.#commentHighlightDecorator.destroy();
312809
312820
  this.#decorationBridge.destroy();
312810
312821
  }
312822
+ }, HoverGroupCoordinator = class {
312823
+ #spec;
312824
+ #current = null;
312825
+ constructor(spec) {
312826
+ this.handleMouseEnter = (event) => {
312827
+ const entry = event.target?.closest?.(this.#spec.entrySelector);
312828
+ if (!entry)
312829
+ return;
312830
+ const id2 = this.#spec.getId(entry);
312831
+ if (!id2)
312832
+ return;
312833
+ this.#set(id2);
312834
+ };
312835
+ this.handleMouseLeave = (event) => {
312836
+ const entry = event.target?.closest?.(this.#spec.entrySelector);
312837
+ if (!entry)
312838
+ return;
312839
+ const id2 = this.#spec.getId(entry);
312840
+ if (!id2)
312841
+ return;
312842
+ const relatedTarget = event.relatedTarget;
312843
+ if (relatedTarget) {
312844
+ const nextEntry = relatedTarget.closest?.(this.#spec.entrySelector);
312845
+ if (nextEntry && this.#spec.getId(nextEntry) === id2)
312846
+ return;
312847
+ }
312848
+ this.clear();
312849
+ };
312850
+ this.#spec = spec;
312851
+ }
312852
+ reapply() {
312853
+ if (!this.#current)
312854
+ return;
312855
+ const { id: id2 } = this.#current;
312856
+ const elements = this.#spec.queryGroup(id2);
312857
+ if (elements.length === 0) {
312858
+ this.#current = null;
312859
+ return;
312860
+ }
312861
+ this.#applyClass(elements);
312862
+ this.#spec.onApply?.(elements);
312863
+ this.#current = {
312864
+ id: id2,
312865
+ elements
312866
+ };
312867
+ }
312868
+ clear() {
312869
+ if (!this.#current)
312870
+ return;
312871
+ for (const element3 of this.#current.elements) {
312872
+ element3.classList.remove(this.#spec.hoverClass);
312873
+ this.#spec.onClear?.(element3);
312874
+ }
312875
+ this.#current = null;
312876
+ }
312877
+ #set(id2) {
312878
+ if (this.#current?.id === id2)
312879
+ return;
312880
+ this.clear();
312881
+ const elements = this.#spec.queryGroup(id2);
312882
+ if (elements.length === 0)
312883
+ return;
312884
+ this.#applyClass(elements);
312885
+ this.#spec.onApply?.(elements);
312886
+ this.#current = {
312887
+ id: id2,
312888
+ elements
312889
+ };
312890
+ }
312891
+ #applyClass(elements) {
312892
+ const filter = this.#spec.shouldApplyTo;
312893
+ for (const element3 of elements) {
312894
+ if (filter && !filter(element3))
312895
+ continue;
312896
+ element3.classList.add(this.#spec.hoverClass);
312897
+ }
312898
+ }
312811
312899
  }, ProofingStore = class {
312812
312900
  #issuesBySegment = /* @__PURE__ */ new Map;
312813
312901
  addIssue(issue) {
@@ -313418,6 +313506,9 @@ var Node$13 = class Node$14 {
313418
313506
  color: inherit !important;
313419
313507
  text-decoration: none !important;
313420
313508
  cursor: default;
313509
+ /* Disable native link drag so our pointer loop can run text-selection. */
313510
+ -webkit-user-drag: none;
313511
+ user-drag: none;
313421
313512
  }
313422
313513
 
313423
313514
  .superdoc-toc-entry .superdoc-link:hover {
@@ -313429,6 +313520,31 @@ var Node$13 = class Node$14 {
313429
313520
  outline: none;
313430
313521
  }
313431
313522
 
313523
+ /* TOC hover. .toc-group-hover is set by PresentationEditor on every entry
313524
+ sharing a data-toc-id so the whole TOC greys out together. The ::after
313525
+ stripe (height set via --toc-gap-below) fills the paragraph-spacing gap
313526
+ between adjacent entries so the hover reads as one continuous block. */
313527
+ .superdoc-toc-entry:hover,
313528
+ .superdoc-toc-entry.toc-group-hover {
313529
+ background-color: var(--sd-content-controls-block-hover-bg, #f2f2f2);
313530
+ }
313531
+
313532
+ /* Pointer-events stay on (default) so the stripe extends the parent entry's
313533
+ hit-test area through the paragraph-spacing gap. Without this, moving the
313534
+ cursor between two adjacent entries fires mouseout on the upper entry with
313535
+ relatedTarget = the page (not a TOC entry), the coordinator drops the
313536
+ group-hover class, and the grey disappears for a frame before the next
313537
+ entry's mouseover restores it — visible as a flicker. */
313538
+ .superdoc-toc-entry.toc-group-hover::after {
313539
+ content: '';
313540
+ position: absolute;
313541
+ left: 0;
313542
+ right: 0;
313543
+ top: 100%;
313544
+ height: var(--toc-gap-below, 0px);
313545
+ background-color: var(--sd-content-controls-block-hover-bg, #f2f2f2);
313546
+ }
313547
+
313432
313548
  /* Remove focus outlines from layout engine elements */
313433
313549
  .superdoc-layout,
313434
313550
  .superdoc-page,
@@ -317406,8 +317522,12 @@ menclose::after {
317406
317522
  applyResolvedFragmentFrame(fragmentEl, resolvedItem, fragment2);
317407
317523
  else
317408
317524
  applyFragmentFrame(fragmentEl, fragment2);
317409
- if (isTocEntry)
317410
- fragmentEl.classList.add("superdoc-toc-entry");
317525
+ if (isTocEntry) {
317526
+ fragmentEl.classList.add(DOM_CLASS_NAMES.TOC_ENTRY);
317527
+ const tocId = block.attrs?.tocId;
317528
+ if (typeof tocId === "string" && tocId.length > 0)
317529
+ fragmentEl.dataset.tocId = tocId;
317530
+ }
317411
317531
  if (paraContinuesFromPrev)
317412
317532
  fragmentEl.dataset.continuesFromPrev = "true";
317413
317533
  if (paraContinuesOnNext)
@@ -325602,6 +325722,7 @@ menclose::after {
325602
325722
  #cellAnchor = null;
325603
325723
  #cellDragMode = "none";
325604
325724
  #pendingMarginClick = null;
325725
+ #pendingTocLinkNav = null;
325605
325726
  #lastSelectedImageBlockId = null;
325606
325727
  #suppressFocusInFromDraggable = false;
325607
325728
  #pendingStructuredContentLabelGesture = null;
@@ -326143,10 +326264,14 @@ menclose::after {
326143
326264
  return;
326144
326265
  }
326145
326266
  const linkEl = target?.closest?.("a.superdoc-link");
326146
- if (linkEl) {
326147
- this.#handleLinkClick(event, linkEl);
326148
- return;
326149
- }
326267
+ this.#pendingTocLinkNav = null;
326268
+ if (linkEl)
326269
+ if (linkEl.closest(`.${DOM_CLASS_NAMES.TOC_ENTRY}`))
326270
+ this.#pendingTocLinkNav = linkEl;
326271
+ else {
326272
+ this.#handleLinkClick(event, linkEl);
326273
+ return;
326274
+ }
326150
326275
  const annotationEl = target?.closest?.(buildAnnotationSelector());
326151
326276
  const isDraggableAnnotation = target?.closest?.(DRAGGABLE_SELECTOR) != null;
326152
326277
  const isNativeDragSource = target?.closest?.(DRAG_SOURCE_SELECTOR) != null;
@@ -326485,6 +326610,10 @@ menclose::after {
326485
326610
  event
326486
326611
  });
326487
326612
  this.#suppressFocusInFromDraggable = false;
326613
+ const pendingTocLink = this.#pendingTocLinkNav;
326614
+ this.#pendingTocLinkNav = null;
326615
+ if (pendingTocLink && !this.#dragThresholdExceeded)
326616
+ this.#handleLinkClick(event, pendingTocLink);
326488
326617
  if (!this.#isDragging) {
326489
326618
  this.#stopAutoScroll();
326490
326619
  return;
@@ -330959,13 +331088,13 @@ menclose::after {
330959
331088
  return;
330960
331089
  console.log(...args$1);
330961
331090
  }, 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;
330962
- var init_src_jCy2h55W_es = __esm(() => {
331091
+ var init_src_M0JgzZDj_es = __esm(() => {
330963
331092
  init_rolldown_runtime_Bg48TavK_es();
330964
- init_SuperConverter_BaKhr4cp_es();
331093
+ init_SuperConverter_e4tY_2EB_es();
330965
331094
  init_jszip_C49i9kUs_es();
330966
331095
  init_xml_js_CqGKpaft_es();
330967
331096
  init_uuid_B2wVPhPi_es();
330968
- init_create_headless_toolbar_B3wNa0zb_es();
331097
+ init_create_headless_toolbar_3iIgFoKe_es();
330969
331098
  init_constants_D9qj59G2_es();
330970
331099
  init_dist_B8HfvhaK_es();
330971
331100
  init_unified_Dsuw2be5_es();
@@ -349895,6 +350024,8 @@ function print() { __p += __j.call(arguments, '') }
349895
350024
  TABLE_FRAGMENT: "superdoc-table-fragment",
349896
350025
  DOCUMENT_SECTION: "superdoc-document-section",
349897
350026
  SDT_GROUP_HOVER: "sdt-group-hover",
350027
+ TOC_ENTRY: "superdoc-toc-entry",
350028
+ TOC_GROUP_HOVER: "toc-group-hover",
349898
350029
  IMAGE_FRAGMENT: "superdoc-image-fragment",
349899
350030
  INLINE_IMAGE: "superdoc-inline-image",
349900
350031
  LIST_MARKER: "superdoc-list-marker",
@@ -352208,7 +352339,8 @@ function print() { __p += __j.call(arguments, '') }
352208
352339
  const menuRef = exports_vue.ref(null);
352209
352340
  const menuPosition = exports_vue.ref({
352210
352341
  top: "0px",
352211
- left: "0px"
352342
+ left: "0px",
352343
+ maxHeight: "none"
352212
352344
  });
352213
352345
  const optionRefs = exports_vue.ref([]);
352214
352346
  const keyboardIndex = exports_vue.ref(-1);
@@ -352245,6 +352377,7 @@ function print() { __p += __j.call(arguments, '') }
352245
352377
  position: "fixed",
352246
352378
  top: menuPosition.value.top,
352247
352379
  left: menuPosition.value.left,
352380
+ maxHeight: menuPosition.value.maxHeight,
352248
352381
  zIndex: 2000
352249
352382
  };
352250
352383
  });
@@ -352260,17 +352393,30 @@ function print() { __p += __j.call(arguments, '') }
352260
352393
  if (!triggerRef.value)
352261
352394
  return;
352262
352395
  const rect = triggerRef.value.getBoundingClientRect();
352263
- const menuWidth = menuRef.value?.offsetWidth ?? 0;
352396
+ const menuEl = menuRef.value;
352397
+ const menuWidth = menuEl?.offsetWidth ?? 0;
352398
+ const menuHeight = menuEl?.scrollHeight ?? menuEl?.offsetHeight ?? 0;
352264
352399
  const viewportWidth = window.innerWidth || document.documentElement.clientWidth || 0;
352400
+ const viewportHeight = window.innerHeight || document.documentElement.clientHeight || 0;
352265
352401
  const gutter = 8;
352402
+ const gap = 4;
352403
+ const belowTop = rect.bottom + gap;
352404
+ const aboveBottom = rect.top - gap;
352405
+ const availableBelow = Math.max(0, viewportHeight - belowTop - gutter);
352406
+ const availableAbove = Math.max(0, aboveBottom - gutter);
352407
+ const openAbove = availableBelow < menuHeight && availableAbove > availableBelow;
352408
+ const maxHeight = openAbove ? availableAbove : availableBelow;
352409
+ const menuRenderHeight = menuHeight ? Math.min(menuHeight, maxHeight) : maxHeight;
352410
+ const top$1 = openAbove ? Math.max(gutter, aboveBottom - menuRenderHeight) : belowTop;
352266
352411
  let left$1 = rect.left;
352267
352412
  if (props.placement === "bottom-end")
352268
352413
  left$1 = rect.right - menuWidth;
352269
352414
  const maxLeft = Math.max(gutter, viewportWidth - menuWidth - gutter);
352270
352415
  left$1 = Math.min(Math.max(gutter, left$1), maxLeft);
352271
352416
  menuPosition.value = {
352272
- top: `${rect.bottom + 4}px`,
352273
- left: `${left$1}px`
352417
+ top: `${top$1}px`,
352418
+ left: `${left$1}px`,
352419
+ maxHeight: `${maxHeight}px`
352274
352420
  };
352275
352421
  };
352276
352422
  const onTriggerClick = () => {
@@ -352336,8 +352482,13 @@ function print() { __p += __j.call(arguments, '') }
352336
352482
  el.setAttribute("tabindex", index2 === keyboardIndex.value ? "0" : "-1");
352337
352483
  });
352338
352484
  const target = optionRefs.value[keyboardIndex.value];
352339
- if (target && typeof target.focus === "function")
352485
+ if (target && typeof target.focus === "function") {
352340
352486
  target.focus();
352487
+ target.scrollIntoView?.({
352488
+ block: "nearest",
352489
+ inline: "nearest"
352490
+ });
352491
+ }
352341
352492
  };
352342
352493
  const moveKeyboardIndex = (direction) => {
352343
352494
  const navigableIndexes = getNavigableIndexes();
@@ -352472,6 +352623,7 @@ function print() { __p += __j.call(arguments, '') }
352472
352623
  if (hasRenderOptions.value)
352473
352624
  return;
352474
352625
  keyboardIndex.value = getInitialKeyboardIndex();
352626
+ await exports_vue.nextTick();
352475
352627
  focusKeyboardIndex();
352476
352628
  }, { immediate: true });
352477
352629
  exports_vue.watch(isOpen, (open2) => {
@@ -352535,7 +352687,7 @@ function print() { __p += __j.call(arguments, '') }
352535
352687
  })]))]);
352536
352688
  };
352537
352689
  }
352538
- }, [["__scopeId", "data-v-302f7d86"]]);
352690
+ }, [["__scopeId", "data-v-69732782"]]);
352539
352691
  SdTooltip_default = /* @__PURE__ */ __plugin_vue_export_helper_default(/* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
352540
352692
  __name: "SdTooltip",
352541
352693
  props: {
@@ -359399,7 +359551,8 @@ function print() { __p += __j.call(arguments, '') }
359399
359551
  #lastSelectedFieldAnnotation = null;
359400
359552
  #lastSelectedStructuredContentBlock = null;
359401
359553
  #lastSelectedStructuredContentInline = null;
359402
- #lastHoveredStructuredContentBlock = null;
359554
+ #sdtHoverCoordinator = null;
359555
+ #tocHoverCoordinator = null;
359403
359556
  #remoteCursorManager = null;
359404
359557
  #cursorUpdateTimer = null;
359405
359558
  #remoteCursorOverlay = null;
@@ -359470,8 +359623,11 @@ function print() { __p += __j.call(arguments, '') }
359470
359623
  ensureEditorNativeSelectionStyles(doc$12);
359471
359624
  ensureEditorFieldAnnotationInteractionStyles(doc$12);
359472
359625
  ensureEditorMovableObjectInteractionStyles(doc$12);
359473
- this.#painterHost.addEventListener("mouseover", this.#handleStructuredContentBlockMouseEnter);
359474
- this.#painterHost.addEventListener("mouseout", this.#handleStructuredContentBlockMouseLeave);
359626
+ this.#initializeHoverCoordinators();
359627
+ this.#painterHost.addEventListener("mouseover", this.#sdtHoverCoordinator.handleMouseEnter);
359628
+ this.#painterHost.addEventListener("mouseout", this.#sdtHoverCoordinator.handleMouseLeave);
359629
+ this.#painterHost.addEventListener("mouseover", this.#tocHoverCoordinator.handleMouseEnter);
359630
+ this.#painterHost.addEventListener("mouseout", this.#tocHoverCoordinator.handleMouseLeave);
359475
359631
  this.#domIndexObserverManager = new DomPositionIndexObserverManager({
359476
359632
  windowRoot: this.#visibleHost?.ownerDocument?.defaultView ?? window,
359477
359633
  getPainterHost: () => this.#painterHost,
@@ -363462,74 +363618,50 @@ function print() { __p += __j.call(arguments, '') }
363462
363618
  }
363463
363619
  this.#setSelectedStructuredContentBlockClass(elements, id2);
363464
363620
  }
363465
- #handleStructuredContentBlockMouseEnter = (event) => {
363466
- const block = event.target.closest(`.${DOM_CLASS_NAMES.BLOCK_SDT}`);
363467
- if (!block || !(block instanceof HTMLElement))
363468
- return;
363469
- if (block.classList.contains("ProseMirror-selectednode"))
363621
+ #initializeHoverCoordinators() {
363622
+ if (this.#sdtHoverCoordinator || this.#tocHoverCoordinator)
363470
363623
  return;
363471
- const rawId = block.dataset.sdtId;
363472
- if (!rawId)
363473
- return;
363474
- this.#setHoveredStructuredContentBlockClass(rawId);
363475
- };
363476
- #handleStructuredContentBlockMouseLeave = (event) => {
363477
- const block = event.target.closest(`.${DOM_CLASS_NAMES.BLOCK_SDT}`);
363478
- if (!block)
363624
+ this.#sdtHoverCoordinator = new HoverGroupCoordinator({
363625
+ entrySelector: `.${DOM_CLASS_NAMES.BLOCK_SDT}`,
363626
+ getId: (entry) => entry.dataset.sdtId,
363627
+ queryGroup: (id2) => this.#painterAdapter.getStructuredContentBlockElementsById(id2),
363628
+ hoverClass: DOM_CLASS_NAMES.SDT_GROUP_HOVER,
363629
+ shouldApplyTo: (element3) => !element3.classList.contains("ProseMirror-selectednode")
363630
+ });
363631
+ this.#tocHoverCoordinator = new HoverGroupCoordinator({
363632
+ entrySelector: `.${DOM_CLASS_NAMES.TOC_ENTRY}`,
363633
+ getId: (entry) => entry.dataset.tocId,
363634
+ queryGroup: (id2) => this.#queryTocEntryElementsById(id2),
363635
+ hoverClass: DOM_CLASS_NAMES.TOC_GROUP_HOVER,
363636
+ onApply: (elements) => this.#applyTocGapFill(elements),
363637
+ onClear: (element3) => element3.style.removeProperty("--toc-gap-below")
363638
+ });
363639
+ }
363640
+ #applyTocGapFill(elements) {
363641
+ if (elements.length < 2)
363479
363642
  return;
363480
- const relatedTarget = event.relatedTarget;
363481
- if (relatedTarget && block.dataset.sdtId) {
363482
- const escapedCheckId = typeof CSS !== "undefined" && CSS.escape ? CSS.escape(block.dataset.sdtId) : block.dataset.sdtId.replace(/"/g, "\\\"");
363483
- if (relatedTarget.closest(buildSdtBlockSelector(escapedCheckId)))
363484
- return;
363643
+ const measured = elements.map((element3) => ({
363644
+ element: element3,
363645
+ rect: element3.getBoundingClientRect()
363646
+ })).sort((a2, b$1) => a2.rect.top - b$1.rect.top);
363647
+ for (let i4 = 0;i4 < measured.length - 1; i4++) {
363648
+ const current = measured[i4];
363649
+ const next2 = measured[i4 + 1];
363650
+ const currentPage = current.element.closest("[data-page-index]");
363651
+ if (!currentPage || currentPage !== next2.element.closest("[data-page-index]"))
363652
+ continue;
363653
+ const rawGap = next2.rect.top - current.rect.bottom;
363654
+ const scaleY = current.rect.height && current.element.offsetHeight ? current.rect.height / current.element.offsetHeight : 1;
363655
+ const gap = scaleY > 0 ? rawGap / scaleY : rawGap;
363656
+ if (gap > 0)
363657
+ current.element.style.setProperty("--toc-gap-below", `${gap + 1}px`);
363485
363658
  }
363486
- this.#clearHoveredStructuredContentBlockClass();
363487
- };
363488
- #clearHoveredStructuredContentBlockClass() {
363489
- if (!this.#lastHoveredStructuredContentBlock)
363490
- return;
363491
- this.#lastHoveredStructuredContentBlock.elements.forEach((element3) => {
363492
- element3.classList.remove(DOM_CLASS_NAMES.SDT_GROUP_HOVER);
363493
- });
363494
- this.#lastHoveredStructuredContentBlock = null;
363495
363659
  }
363496
- #setHoveredStructuredContentBlockClass(id2) {
363497
- if (this.#lastHoveredStructuredContentBlock?.id === id2)
363498
- return;
363499
- this.#clearHoveredStructuredContentBlockClass();
363660
+ #queryTocEntryElementsById(id2) {
363500
363661
  if (!this.#painterHost)
363501
- return;
363502
- const elements = this.#painterAdapter.getStructuredContentBlockElementsById(id2);
363503
- if (elements.length === 0)
363504
- return;
363505
- elements.forEach((element3) => {
363506
- if (!element3.classList.contains("ProseMirror-selectednode"))
363507
- element3.classList.add(DOM_CLASS_NAMES.SDT_GROUP_HOVER);
363508
- });
363509
- this.#lastHoveredStructuredContentBlock = {
363510
- id: id2,
363511
- elements
363512
- };
363513
- }
363514
- #reapplySdtGroupHover() {
363515
- if (!this.#lastHoveredStructuredContentBlock || !this.#painterHost)
363516
- return;
363517
- const { id: id2 } = this.#lastHoveredStructuredContentBlock;
363518
- if (!id2)
363519
- return;
363520
- const elements = this.#painterAdapter.getStructuredContentBlockElementsById(id2);
363521
- if (elements.length === 0) {
363522
- this.#lastHoveredStructuredContentBlock = null;
363523
- return;
363524
- }
363525
- elements.forEach((element3) => {
363526
- if (!element3.classList.contains("ProseMirror-selectednode"))
363527
- element3.classList.add(DOM_CLASS_NAMES.SDT_GROUP_HOVER);
363528
- });
363529
- this.#lastHoveredStructuredContentBlock = {
363530
- id: id2,
363531
- elements
363532
- };
363662
+ return [];
363663
+ const escapedId = escapeAttrValue(id2);
363664
+ return Array.from(this.#painterHost.querySelectorAll(`.${DOM_CLASS_NAMES.TOC_ENTRY}[data-toc-id="${escapedId}"]`));
363533
363665
  }
363534
363666
  #refreshEditorDomAugmentations() {
363535
363667
  this.#postPaintPipeline.refreshAfterPaint({
@@ -363538,7 +363670,8 @@ function print() { __p += __j.call(arguments, '') }
363538
363670
  domPositionIndex: this.#domPositionIndex,
363539
363671
  proofingAnnotations: this.#buildProofingAnnotations(),
363540
363672
  rebuildDomPositionIndex: () => this.#rebuildDomPositionIndex(),
363541
- reapplyStructuredContentHover: () => this.#reapplySdtGroupHover()
363673
+ reapplyStructuredContentHover: () => this.#sdtHoverCoordinator?.reapply(),
363674
+ reapplyTocGroupHover: () => this.#tocHoverCoordinator?.reapply()
363542
363675
  });
363543
363676
  }
363544
363677
  #clearSelectedStructuredContentInlineClass() {
@@ -365926,11 +366059,11 @@ function print() { __p += __j.call(arguments, '') }
365926
366059
  ]);
365927
366060
  });
365928
366061
 
365929
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-ClaBD_rO.es.js
366062
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BbHhTe5g.es.js
365930
366063
  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;
365931
- var init_create_super_doc_ui_ClaBD_rO_es = __esm(() => {
365932
- init_SuperConverter_BaKhr4cp_es();
365933
- init_create_headless_toolbar_B3wNa0zb_es();
366064
+ var init_create_super_doc_ui_BbHhTe5g_es = __esm(() => {
366065
+ init_SuperConverter_e4tY_2EB_es();
366066
+ init_create_headless_toolbar_3iIgFoKe_es();
365934
366067
  headlessToolbarConstants = {
365935
366068
  DEFAULT_TEXT_ALIGN_OPTIONS: [
365936
366069
  {
@@ -366212,16 +366345,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
366212
366345
 
366213
366346
  // ../../packages/superdoc/dist/super-editor.es.js
366214
366347
  var init_super_editor_es = __esm(() => {
366215
- init_src_jCy2h55W_es();
366216
- init_SuperConverter_BaKhr4cp_es();
366348
+ init_src_M0JgzZDj_es();
366349
+ init_SuperConverter_e4tY_2EB_es();
366217
366350
  init_jszip_C49i9kUs_es();
366218
366351
  init_xml_js_CqGKpaft_es();
366219
- init_create_headless_toolbar_B3wNa0zb_es();
366352
+ init_create_headless_toolbar_3iIgFoKe_es();
366220
366353
  init_constants_D9qj59G2_es();
366221
366354
  init_dist_B8HfvhaK_es();
366222
366355
  init_unified_Dsuw2be5_es();
366223
366356
  init_DocxZipper_FUsfThjV_es();
366224
- init_create_super_doc_ui_ClaBD_rO_es();
366357
+ init_create_super_doc_ui_BbHhTe5g_es();
366225
366358
  init_ui_C5PAS9hY_es();
366226
366359
  init_eventemitter3_BnGqBE_Q_es();
366227
366360
  init_errors_CNaD6vcg_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.17.0-next.6",
3
+ "version": "0.17.0-next.8",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -25,19 +25,19 @@
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
27
  "@superdoc/document-api": "0.0.1",
28
- "@superdoc/super-editor": "0.0.1",
29
- "superdoc": "1.39.0"
28
+ "superdoc": "1.39.0",
29
+ "@superdoc/super-editor": "0.0.1"
30
30
  },
31
31
  "module": "src/index.ts",
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
35
  "optionalDependencies": {
36
- "@superdoc-dev/cli-darwin-arm64": "0.17.0-next.6",
37
- "@superdoc-dev/cli-darwin-x64": "0.17.0-next.6",
38
- "@superdoc-dev/cli-windows-x64": "0.17.0-next.6",
39
- "@superdoc-dev/cli-linux-arm64": "0.17.0-next.6",
40
- "@superdoc-dev/cli-linux-x64": "0.17.0-next.6"
36
+ "@superdoc-dev/cli-darwin-arm64": "0.17.0-next.8",
37
+ "@superdoc-dev/cli-darwin-x64": "0.17.0-next.8",
38
+ "@superdoc-dev/cli-windows-x64": "0.17.0-next.8",
39
+ "@superdoc-dev/cli-linux-arm64": "0.17.0-next.8",
40
+ "@superdoc-dev/cli-linux-x64": "0.17.0-next.8"
41
41
  },
42
42
  "scripts": {
43
43
  "predev": "node scripts/ensure-superdoc-build.js",