superdoc 2.7.0-next.1 → 2.7.0-next.10

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 (41) hide show
  1. package/dist/chunks/{create-super-doc-ui-DCjm-_Xo.es.js → create-super-doc-ui-BTNVc3UD.es.js} +7 -3
  2. package/dist/chunks/{create-super-doc-ui-CwCvqMOa.cjs → create-super-doc-ui-C44xPZxz.cjs} +7 -3
  3. package/dist/collaboration-upgrade-engine.cjs +1 -1
  4. package/dist/collaboration-upgrade-engine.es.js +1 -1
  5. package/dist/document-api/src/content-projection/validation.d.ts +3 -0
  6. package/dist/document-api/src/contract/command-catalog.d.ts +1 -1
  7. package/dist/document-api/src/contract/operation-definitions.d.ts +22 -0
  8. package/dist/document-api/src/contract/operation-registry.d.ts +11 -0
  9. package/dist/document-api/src/get-html/get-html.d.ts +6 -6
  10. package/dist/document-api/src/get-markdown/get-markdown.d.ts +2 -4
  11. package/dist/document-api/src/index.d.ts +11 -0
  12. package/dist/document-api/src/project-html/project-html.d.ts +5 -0
  13. package/dist/document-api/src/project-markdown/project-markdown.d.ts +5 -0
  14. package/dist/document-api/src/ranges/ranges.types.d.ts +5 -2
  15. package/dist/document-api/src/replace/replace.d.ts +15 -3
  16. package/dist/document-api/src/types/address.d.ts +2 -0
  17. package/dist/document-api/src/types/content-projection.d.ts +126 -0
  18. package/dist/document-api/src/types/index.d.ts +1 -0
  19. package/dist/document-api/src/types/mutation-plan.types.d.ts +3 -0
  20. package/dist/document-api/src/types/sd-contract.d.ts +4 -2
  21. package/dist/document-api/src/types/structural-input.d.ts +18 -3
  22. package/dist/layout-engine/painters/dom/src/index.d.ts +2 -0
  23. package/dist/layout-engine/painters/dom/src/web-flow/index.d.ts +3 -0
  24. package/dist/layout-engine/painters/dom/src/web-flow/painter.d.ts +2 -0
  25. package/dist/layout-engine/painters/dom/src/web-flow/render.d.ts +8 -0
  26. package/dist/layout-engine/painters/dom/src/web-flow/styles.d.ts +10 -0
  27. package/dist/layout-engine/painters/dom/src/web-flow/types.d.ts +77 -0
  28. package/dist/public/ui-react.cjs +1 -1
  29. package/dist/public/ui-react.es.js +1 -1
  30. package/dist/public/ui.cjs +1 -1
  31. package/dist/public/ui.es.js +1 -1
  32. package/dist/superdoc/src/composables/use-link-popover.d.ts +3 -14
  33. package/dist/superdoc/src/core/types/index.d.ts +12 -5
  34. package/dist/superdoc/src/helpers/v2-review-mutation-impact.d.ts +2 -3
  35. package/dist/superdoc.cjs +36 -128
  36. package/dist/superdoc.es.js +36 -128
  37. package/dist/word-layout/src/index.d.ts +2 -0
  38. package/dist/word-layout/src/list-marker.d.ts +8 -0
  39. package/dist/word-layout/src/review-aware-numbering.d.ts +41 -0
  40. package/dist-cdn/superdoc.min.js +37 -37
  41. package/package.json +2 -2
@@ -0,0 +1,77 @@
1
+ import { FlowBlock, LayoutSourceIdentity } from '../../../../contracts/src/index.js';
2
+ /** Opaque adapter-issued identity. The painter never derives this value from DOM or block ids. */
3
+ export type WebFlowStableDomKey = string;
4
+ export interface WebFlowPaintItem {
5
+ readonly stableDomKey: WebFlowStableDomKey;
6
+ readonly renderFingerprint: string;
7
+ readonly block: FlowBlock;
8
+ readonly layoutEpoch?: number;
9
+ readonly layoutIdentities?: readonly LayoutSourceIdentity[];
10
+ readonly editable?: boolean;
11
+ }
12
+ export type WebFlowPaintCommand = {
13
+ readonly kind: 'replace-all';
14
+ readonly epoch: number;
15
+ readonly items: readonly WebFlowPaintItem[];
16
+ } | {
17
+ readonly kind: 'splice';
18
+ readonly expectedBaseEpoch: number;
19
+ readonly epoch: number;
20
+ readonly storyKey: string;
21
+ readonly expectedRemovedKeys: readonly WebFlowStableDomKey[];
22
+ readonly expectedLeftKey: WebFlowStableDomKey | null;
23
+ readonly expectedRightKey: WebFlowStableDomKey | null;
24
+ readonly items: readonly WebFlowPaintItem[];
25
+ /** Identity-only updates for retained nodes downstream of a structural splice. */
26
+ readonly retainedRebases?: readonly WebFlowPaintItem[];
27
+ };
28
+ export interface WebFlowPaintWorkSummary {
29
+ readonly kind: WebFlowPaintCommand['kind'];
30
+ readonly retainedNodes: number;
31
+ readonly createdNodes: number;
32
+ readonly removedNodes: number;
33
+ readonly rebasedNodes: number;
34
+ readonly touchedItems: number;
35
+ }
36
+ export interface WebFlowDomBinding {
37
+ readonly key: WebFlowStableDomKey;
38
+ readonly renderFingerprint: string;
39
+ readonly blockId: string;
40
+ readonly node: HTMLElement;
41
+ }
42
+ export interface WebFlowPaintSnapshot {
43
+ readonly epoch: number | null;
44
+ readonly version: number;
45
+ readonly bindings: readonly WebFlowDomBinding[];
46
+ }
47
+ export interface WebFlowAppliedPaint {
48
+ readonly work: WebFlowPaintWorkSummary;
49
+ /** Bindings directly owned by this command; localized splices never scan the retained root. */
50
+ readonly touchedBindings: readonly WebFlowDomBinding[];
51
+ /** Bindings whose DOM node or retained identity changed in this command. */
52
+ readonly changedBindings: readonly WebFlowDomBinding[];
53
+ }
54
+ export interface WebFlowPaintTransaction {
55
+ readonly command: WebFlowPaintCommand;
56
+ /** Installs the candidate synchronously. The caller must then finalize or roll it back. */
57
+ apply(): WebFlowAppliedPaint;
58
+ /** Publishes the applied state and releases the rollback journal. */
59
+ finalize(): WebFlowAppliedPaint;
60
+ /** Restores the exact pre-apply DOM and retained state. */
61
+ rollback(): void;
62
+ }
63
+ export interface WebFlowPainterHandle {
64
+ prepare(command: WebFlowPaintCommand): WebFlowPaintTransaction;
65
+ snapshot(): WebFlowPaintSnapshot;
66
+ /** Rebuilds the last committed derived DOM after an externally owned mutation. */
67
+ restoreCommittedDomAfterUnownedMutation(): WebFlowPaintSnapshot;
68
+ dispose(): void;
69
+ }
70
+ export interface WebFlowPainterOptions {
71
+ readonly resolvePhysical?: (cssFontFamily: string, face: {
72
+ weight: '400' | '700';
73
+ style: 'normal' | 'italic';
74
+ }) => string;
75
+ /** Fires synchronously when the mutation observer first detects unowned DOM. */
76
+ readonly onUnownedMutation?: (kind: 'text' | 'dom') => void;
77
+ }
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-CwCvqMOa.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-C44xPZxz.cjs");
3
3
  let react = require("react");
4
4
  //#region src/public/ui/react.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-DCjm-_Xo.es.js";
1
+ import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-BTNVc3UD.es.js";
2
2
  import { createContext, createElement, useCallback, useContext, useEffect, useRef, useState } from "react";
3
3
  //#region src/public/ui/react.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-CwCvqMOa.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-C44xPZxz.cjs");
3
3
  exports.BUILT_IN_COMMAND_IDS = require_create_super_doc_ui.BUILT_IN_COMMAND_IDS;
4
4
  exports.createSuperDocUI = require_create_super_doc_ui.createSuperDocUI;
5
5
  exports.shallowEqual = require_create_super_doc_ui.shallowEqual;
@@ -1,2 +1,2 @@
1
- import { n as shallowEqual, r as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-DCjm-_Xo.es.js";
1
+ import { n as shallowEqual, r as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-BTNVc3UD.es.js";
2
2
  export { BUILT_IN_COMMAND_IDS, createSuperDocUI, shallowEqual };
@@ -127,10 +127,9 @@ export type HyperlinkGetResult = {
127
127
  };
128
128
  /**
129
129
  * Result of `doc.bookmarks.get()` as read here (Document API `BookmarkInfo`).
130
- * `range.from.blockId` is the bookmark's `w14:paraId`, used to find/reveal
131
- * the target paragraph. `address.story` is populated for non-body
132
- * bookmarks (omitted for body) — used to scope this fix to body targets,
133
- * since `revealBodyTarget`/`pageIndexForBodyTarget` are body-only.
130
+ * `range.from.blockId` identifies the model paragraph sent to the viewport.
131
+ * `address.story` is populated for non-body bookmarks (omitted for body),
132
+ * which keeps anchor navigation scoped to body targets.
134
133
  */
135
134
  export type BookmarkGetResult = {
136
135
  address?: {
@@ -184,16 +183,6 @@ export type LinkPopoverDocumentApi = {
184
183
  }) => BookmarkGetResult | Promise<BookmarkGetResult | null | undefined> | null | undefined;
185
184
  } | null | undefined;
186
185
  };
187
- /**
188
- * Result of `activeEditor.pageMetrics.revealBodyTarget()` as read here
189
- * (`V2EditorHostRevealBodyTargetResult`). Only available in editing/
190
- * suggesting mode — the host rejects with `editing-not-mounted` in
191
- * viewing mode.
192
- */
193
- export type RevealBodyTargetResult = {
194
- status?: "rejected" | "revealed" | undefined;
195
- reason?: string | undefined;
196
- };
197
186
  /**
198
187
  * The `v2-link-click` payload the shell relays from the v2 host's
199
188
  * `onLinkClick` callback.
@@ -2543,7 +2543,11 @@ export type ViewLayout = 'print' | 'web';
2543
2543
  * Mirrors OOXML document view settings.
2544
2544
  */
2545
2545
  export interface ViewOptions {
2546
- /** Document view layout (OOXML ST_View compatible). */
2546
+ /**
2547
+ * Document view layout (OOXML ST_View compatible). In the browser editor,
2548
+ * `'web'` selects the retained semantic DOM surface. Browser normal flow
2549
+ * rewraps content as the editor container changes width.
2550
+ */
2547
2551
  layout?: ViewLayout;
2548
2552
  }
2549
2553
  export interface ExportParams {
@@ -3378,6 +3382,11 @@ export interface Config {
3378
3382
  experimental?: {
3379
3383
  unifiedHistory?: boolean;
3380
3384
  v2Host?: boolean;
3385
+ /**
3386
+ * Temporary V2 web-surface rollout control. The value is snapshotted at
3387
+ * mount and changing it requires a remount. This is not a stable renderer API.
3388
+ */
3389
+ v2WebSurface?: 'dense-control' | 'retained-dom';
3381
3390
  /**
3382
3391
  * Derived-invalidation deferral for direct single-paragraph edits (v2
3383
3392
  * engine only). Field display text settles off the keystroke path under
@@ -3605,10 +3614,8 @@ export interface Config {
3605
3614
  */
3606
3615
  workerStartupTimeoutMs?: number;
3607
3616
  /**
3608
- * Opt-in toggle for the layout engine. Auto-disabled when web layout is
3609
- * requested without `layoutEngineOptions.flowMode === 'semantic'`; the
3610
- * loader logs a warning and falls back to the legacy ProseMirror render
3611
- * path in that case.
3617
+ * Compatibility toggle retained for existing configurations. V2 always
3618
+ * uses the OOXML kernel; `viewOptions.layout` selects the mounted renderer.
3612
3619
  */
3613
3620
  useLayoutEngine?: boolean;
3614
3621
  /**
@@ -2,9 +2,8 @@
2
2
  * Classify the tracked-change identities carried by a v2 mutation event.
3
3
  *
4
4
  * Receipt entities are the durable invalidation contract between the document
5
- * kernel and derived review UI. Consumers apply removals/remaps locally; the
6
- * next committed window supplies surviving or restored rows. History follows
7
- * the same bounded path and never enumerates invisible review identities.
5
+ * kernel and derived review UI. Direct receipts carry entity refs; mutation
6
+ * plans carry the same identities through `trackedChanges` and per-step ids.
8
7
  */
9
8
  export function getV2TrackedChangeMutationImpact(event: any): {
10
9
  allResolved?: any;
package/dist/superdoc.cjs CHANGED
@@ -4,7 +4,7 @@ const require_blank_docx = require("./chunks/blank-docx-BuFAbRjs.cjs");
4
4
  const require_eventemitter3 = require("./chunks/eventemitter3-D38u8ta_.cjs");
5
5
  const require_uuid = require("./chunks/uuid-BhG0ngwk.cjs");
6
6
  const require_jszip = require("./chunks/jszip-RC64TPzL.cjs");
7
- const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-CwCvqMOa.cjs");
7
+ const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-C44xPZxz.cjs");
8
8
  const require__plugin_vue_export_helper = require("./chunks/_plugin-vue_export-helper-SDR04tiH.cjs");
9
9
  const require_constants = require("./chunks/constants-DpXuDx_g.cjs");
10
10
  let vue = require("vue");
@@ -18195,10 +18195,9 @@ function scrollToElement(targetElement, options = {
18195
18195
  */
18196
18196
  /**
18197
18197
  * Result of `doc.bookmarks.get()` as read here (Document API `BookmarkInfo`).
18198
- * `range.from.blockId` is the bookmark's `w14:paraId`, used to find/reveal
18199
- * the target paragraph. `address.story` is populated for non-body
18200
- * bookmarks (omitted for body) — used to scope this fix to body targets,
18201
- * since `revealBodyTarget`/`pageIndexForBodyTarget` are body-only.
18198
+ * `range.from.blockId` identifies the model paragraph sent to the viewport.
18199
+ * `address.story` is populated for non-body bookmarks (omitted for body),
18200
+ * which keeps anchor navigation scoped to body targets.
18202
18201
  * @typedef {Object} BookmarkGetResult
18203
18202
  * @property {{ story?: { kind?: string, storyType?: string } }} [address]
18204
18203
  * @property {{ from?: { blockId?: string } }} [range]
@@ -18217,15 +18216,6 @@ function scrollToElement(targetElement, options = {
18217
18216
  * @property {{ get?: (input: { target: { kind: 'entity', entityType: 'bookmark', name: string } }) => BookmarkGetResult | Promise<BookmarkGetResult | null | undefined> | null | undefined } | null} [bookmarks]
18218
18217
  */
18219
18218
  /**
18220
- * Result of `activeEditor.pageMetrics.revealBodyTarget()` as read here
18221
- * (`V2EditorHostRevealBodyTargetResult`). Only available in editing/
18222
- * suggesting mode — the host rejects with `editing-not-mounted` in
18223
- * viewing mode.
18224
- * @typedef {Object} RevealBodyTargetResult
18225
- * @property {'revealed' | 'rejected'} [status]
18226
- * @property {string} [reason]
18227
- */
18228
- /**
18229
18219
  * The `v2-link-click` payload the shell relays from the v2 host's
18230
18220
  * `onLinkClick` callback.
18231
18221
  * @typedef {Object} LinkClickPayload
@@ -18567,20 +18557,8 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getResolver
18567
18557
  handle.result?.then?.((outcome) => clearCurrentPopover(handle, outcome), () => clearCurrentPopover(handle));
18568
18558
  }
18569
18559
  /**
18570
- * Look up a real `<a name>` anchor, or a bookmark-marker span, in the
18571
- * currently mounted DOM. The marker span
18572
- * (`data-bookmark-marker`/`data-bookmark-name`) is a best-effort fast
18573
- * path only: layout-engine measuring drops those zero-width marker runs
18574
- * from paint whenever the wrapping paragraph has other visible content
18575
- * (the standard shape for a TOC bookmark wrapping heading text,
18576
- * `<w:bookmarkStart .../><w:r>Heading</w:r><w:bookmarkEnd/>`) — but it
18577
- * DOES survive for a standalone/empty bookmark paragraph (a supported v2
18578
- * shape, see `v2-layout-adapter/src/empty-paragraph.test.ts` and
18579
- * `isSyntheticStandaloneBookmarkParagraph` in
18580
- * `v2-host/src/compose-exact-complete-render.ts`), where it lets a
18581
- * mounted bookmark scroll immediately without a Document API round trip.
18582
- * `findPaintedParagraphByParaId` remains the reliable fallback for the
18583
- * common (marker-not-painted) case.
18560
+ * Find a mounted named anchor for runtimes that do not expose the bookmark
18561
+ * model. Model-backed runtimes never use DOM identity for navigation.
18584
18562
  * @param {HTMLElement | null} container
18585
18563
  * @param {string} escapedAnchorName
18586
18564
  * @returns {HTMLElement | null}
@@ -18589,44 +18567,6 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getResolver
18589
18567
  return container?.querySelector?.(`a[name='${escapedAnchorName}'], [data-bookmark-marker='start'][data-bookmark-name='${escapedAnchorName}']`) ?? null;
18590
18568
  }
18591
18569
  /**
18592
- * Find the painted paragraph element for a `w14:paraId`, mirroring the
18593
- * attribute chain `paintedParaIdElement` uses in v2-host
18594
- * (`create-v2-editor-host.ts`) to confirm a paragraph is painted.
18595
- * @param {HTMLElement | null} container
18596
- * @param {string} paraId
18597
- * @returns {HTMLElement | null}
18598
- */
18599
- function findPaintedParagraphByParaId(container, paraId) {
18600
- if (!container) return null;
18601
- const escaped = cssEscape(paraId);
18602
- return container.querySelector(`[data-source-node-id='${escaped}']`) ?? container.querySelector(`[data-layout-paraid='${escaped}']`) ?? container.querySelector(`[data-block-id$='/${escaped}']`) ?? container.querySelector(`[data-layout-block-ref$='/${escaped}']`) ?? null;
18603
- }
18604
- /**
18605
- * Poll for an element across a bounded number of animation frames. Used
18606
- * after `scrollToPage()` in review/viewing mode, where — unlike
18607
- * `revealBodyTarget` in editing mode — there is no promise that resolves
18608
- * once the deep-jumped page's geometry reconciles and paints.
18609
- * @param {() => HTMLElement | null} lookup
18610
- * @param {number} maxTicks
18611
- * @returns {Promise<HTMLElement | null>}
18612
- */
18613
- function pollForElement(lookup, maxTicks = 30) {
18614
- return new Promise((resolve) => {
18615
- const raf = typeof window !== "undefined" ? window.requestAnimationFrame : null;
18616
- let ticks = 0;
18617
- const tick = () => {
18618
- const found = lookup();
18619
- if (found || ticks >= maxTicks || typeof raf !== "function") {
18620
- resolve(found ?? null);
18621
- return;
18622
- }
18623
- ticks += 1;
18624
- raf(tick);
18625
- };
18626
- tick();
18627
- });
18628
- }
18629
- /**
18630
18570
  * Move the editable caret to the start of a resolved target paragraph after
18631
18571
  * navigating to it. Mirrors V1's `goToAnchor`, whose final step places the
18632
18572
  * caret at the bookmark position: without it a V2 TOC click only scrolls, so
@@ -18666,87 +18606,59 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getResolver
18666
18606
  } catch {}
18667
18607
  }
18668
18608
  /**
18669
- * Navigate to an internal `#anchor` link (TOC entries, bookmark links).
18670
- * Tries a real `<a name>` anchor in the currently mounted DOM first, then
18671
- * resolves the bookmark's target paragraph through the Document API and
18672
- * scrolls to that paragraph by its `paraId` — not to a bookmark-marker
18673
- * element, which layout-engine measuring may have excluded from paint.
18674
- *
18675
- * In editing/suggesting mode (`placeCaret`), also moves the caret to the
18676
- * start of the resolved target paragraph, matching V1's `goToAnchor`.
18677
- *
18678
- * If the paragraph isn't mounted (the v2 layout engine only mounts a
18679
- * sliding window of pages), asks the host to reveal it:
18680
- * - In editing/suggesting mode, `pageMetrics.revealBodyTarget` deep-jumps
18681
- * into unmounted pages and resolves once the target is painted. Any
18682
- * rejection here OTHER than `editing-not-mounted` is a real failure of
18683
- * this strong, paint-confirmed path and is left as a no-op rather than
18684
- * silently degrading to the weaker path below.
18685
- * - In viewing mode the host is mounted in "review" mode, where
18686
- * `revealBodyTarget` always rejects with reason `editing-not-mounted`
18687
- * (or is simply unpublished); only then falls back to
18688
- * `pageIndexForBodyTarget` + `scrollToPage` (neither gated on mount
18689
- * mode) and polls for paint, since neither returns a paint-complete
18690
- * promise.
18691
- *
18692
- * Out of scope: bookmarks outside the body story (headers/footers/
18693
- * footnotes) — `revealBodyTarget`/`pageIndexForBodyTarget` are body-only.
18609
+ * Navigate to a body bookmark through its model address. A mounted-anchor
18610
+ * fallback is reserved for runtimes without a callable bookmark model.
18694
18611
  * @param {string | null | undefined} anchorUrl
18695
18612
  * @param {{ placeCaret?: boolean }} [options]
18696
18613
  */
18697
18614
  async function navigateToAnchor(anchorUrl, { placeCaret = false } = {}) {
18698
18615
  if (typeof anchorUrl !== "string" || !anchorUrl.startsWith("#")) return;
18699
18616
  const anchorName = anchorUrl.slice(1);
18700
- const escapedAnchorName = cssEscape(anchorName);
18701
- const mountedAnchor = findMountedAnchor(getUi()?.viewport?.getHost?.() ?? null, escapedAnchorName);
18702
- if (mountedAnchor) {
18703
- scrollToElement(mountedAnchor);
18704
- return;
18705
- }
18706
18617
  /** @type {LinkPopoverDocumentApi | null | undefined} */
18707
18618
  const doc = getActiveEditor()?.doc;
18619
+ const bookmarkGet = doc?.bookmarks?.get;
18620
+ if (typeof bookmarkGet !== "function") {
18621
+ const mountedAnchor = findMountedAnchor(getUi()?.viewport?.getHost?.() ?? null, cssEscape(anchorName));
18622
+ if (mountedAnchor) scrollToElement(mountedAnchor, {
18623
+ block: "start",
18624
+ behavior: "instant"
18625
+ });
18626
+ return;
18627
+ }
18708
18628
  /** @type {BookmarkGetResult | null} */
18709
18629
  let bookmark = null;
18710
18630
  try {
18711
- bookmark = await Promise.resolve(doc?.bookmarks?.get?.({ target: {
18631
+ bookmark = await Promise.resolve(bookmarkGet.call(doc.bookmarks, { target: {
18712
18632
  kind: "entity",
18713
18633
  entityType: "bookmark",
18714
18634
  name: anchorName
18715
18635
  } }));
18716
18636
  bookmark ??= null;
18717
18637
  } catch {
18718
- bookmark = null;
18638
+ return;
18719
18639
  }
18720
18640
  const story = bookmark?.address?.story;
18721
18641
  if (story && story.storyType !== "body") return;
18722
18642
  const blockId = bookmark?.range?.from?.blockId;
18723
18643
  if (typeof blockId !== "string") return;
18724
18644
  if (placeCaret) await placeCaretAtHeadingStart(blockId);
18725
- const mountedParagraph = findPaintedParagraphByParaId(getUi()?.viewport?.getHost?.() ?? null, blockId);
18726
- if (mountedParagraph) {
18727
- scrollToElement(mountedParagraph);
18728
- return;
18729
- }
18730
- const pageMetrics = getActiveEditor()?.pageMetrics;
18731
- const revealBodyTarget = pageMetrics?.revealBodyTarget;
18732
- let revealResult;
18645
+ const viewport = getUi()?.viewport;
18646
+ const scrollIntoView = viewport?.scrollIntoView;
18647
+ if (typeof scrollIntoView !== "function") return;
18733
18648
  try {
18734
- revealResult = await revealBodyTarget?.({ paraId: blockId });
18735
- } catch {
18736
- revealResult = void 0;
18737
- }
18738
- if (revealResult?.status === "revealed") {
18739
- const revealedParagraph = findPaintedParagraphByParaId(getUi()?.viewport?.getHost?.() ?? null, blockId);
18740
- if (revealedParagraph) scrollToElement(revealedParagraph);
18741
- return;
18742
- }
18743
- if (revealBodyTarget && revealResult?.reason !== "editing-not-mounted") return;
18744
- const pageIndexForBodyTarget = pageMetrics?.pageIndexForBodyTarget;
18745
- const scrollToPage = pageMetrics?.scrollToPage;
18746
- const pageIndex = pageIndexForBodyTarget?.({ paraId: blockId });
18747
- if (typeof pageIndex !== "number" || !scrollToPage?.(pageIndex)) return;
18748
- const revealedByScroll = await pollForElement(() => findPaintedParagraphByParaId(getUi()?.viewport?.getHost?.() ?? null, blockId));
18749
- if (revealedByScroll) scrollToElement(revealedByScroll);
18649
+ await Promise.resolve(scrollIntoView.call(viewport, {
18650
+ target: {
18651
+ kind: "text",
18652
+ blockId,
18653
+ range: {
18654
+ start: 0,
18655
+ end: 0
18656
+ }
18657
+ },
18658
+ block: "start",
18659
+ behavior: "instant"
18660
+ }));
18661
+ } catch {}
18750
18662
  }
18751
18663
  /**
18752
18664
  * @param {LinkPopoverContext} ctx
@@ -43572,10 +43484,6 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
43572
43484
  this.config.layoutEngineOptions = this.config.layoutEngineOptions || {};
43573
43485
  const isWebLayout = this.config.viewOptions?.layout === "web";
43574
43486
  const isSemanticFlow = this.config.layoutEngineOptions?.flowMode === "semantic";
43575
- if (isWebLayout && this.config.useLayoutEngine && !isSemanticFlow) {
43576
- console.warn("[SuperDoc] Web layout uses PM fallback unless layoutEngineOptions.flowMode is set to 'semantic'. Automatically disabling layout engine.");
43577
- this.config.useLayoutEngine = false;
43578
- }
43579
43487
  if (!isWebLayout && isSemanticFlow) {
43580
43488
  console.warn("[SuperDoc] flowMode 'semantic' is only valid with web layout. Coercing to 'paginated'.");
43581
43489
  this.config.layoutEngineOptions.flowMode = "paginated";
@@ -43606,7 +43514,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
43606
43514
  this.config.colors = shuffleArray(this.config.colors);
43607
43515
  this.userColorMap = /* @__PURE__ */ new Map();
43608
43516
  this.colorIndex = 0;
43609
- this.version = "2.7.0-next.1";
43517
+ this.version = "2.7.0-next.10";
43610
43518
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
43611
43519
  this.superdocId = config.superdocId || require_uuid.v4();
43612
43520
  this.colors = this.config.colors ?? [];