superdoc 2.24.0 → 2.25.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 (72) hide show
  1. package/dist/chunks/{FindReplaceSurface-BUw19rV8.cjs → FindReplaceSurface-8V8AjgR4.cjs} +1 -1
  2. package/dist/chunks/{FindReplaceSurface-B5dzB2sG.es.js → FindReplaceSurface-RUiTFDt3.es.js} +1 -1
  3. package/dist/chunks/{PasswordPromptSurface-DaIztq50.cjs → PasswordPromptSurface-B5DHV6qr.cjs} +1 -1
  4. package/dist/chunks/{PasswordPromptSurface-Ciu8aSmK.es.js → PasswordPromptSurface-BDpxqdzp.es.js} +1 -1
  5. package/dist/chunks/{PdfViewer-B8y_9or_.es.js → PdfViewer-DjdsIh6n.es.js} +1 -1
  6. package/dist/chunks/{PdfViewer-DRzLH3eS.cjs → PdfViewer-omriDChK.cjs} +1 -1
  7. package/dist/chunks/{_plugin-vue_export-helper-DHiJKCsy.es.js → _plugin-vue_export-helper-7ZiLY07t.es.js} +4 -1
  8. package/dist/chunks/{_plugin-vue_export-helper-CYxINHh_.cjs → _plugin-vue_export-helper-BUdjGKyl.cjs} +9 -0
  9. package/dist/chunks/{create-super-doc-ui-bTFGKVRb.cjs → create-super-doc-ui-ABeUNZlq.cjs} +105 -8
  10. package/dist/chunks/{create-super-doc-ui-8UTu16Lw.es.js → create-super-doc-ui-CCNvH6mr.es.js} +105 -8
  11. package/dist/collaboration-upgrade-engine.cjs +1 -1
  12. package/dist/collaboration-upgrade-engine.es.js +1 -1
  13. package/dist/document-api/src/comments/comments.d.ts +2 -1
  14. package/dist/document-api/src/comments/comments.types.d.ts +2 -0
  15. package/dist/document-api/src/content-controls/content-controls.types.d.ts +4 -2
  16. package/dist/document-api/src/contract/command-catalog.d.ts +1 -1
  17. package/dist/document-api/src/contract/operation-definitions.d.ts +1 -1
  18. package/dist/document-api/src/hyperlinks/hyperlinks.types.d.ts +9 -2
  19. package/dist/document-api/src/images/images.types.d.ts +3 -3
  20. package/dist/document-api/src/index.d.ts +1 -0
  21. package/dist/document-api/src/lists/lists.types.d.ts +11 -11
  22. package/dist/document-api/src/permission-ranges/permission-ranges.d.ts +9 -1
  23. package/dist/document-api/src/permission-ranges/permission-ranges.types.d.ts +17 -0
  24. package/dist/document-api/src/protection/protection.types.d.ts +2 -2
  25. package/dist/document-api/src/receipt-bridge.d.ts +3 -0
  26. package/dist/document-api/src/selection/selection.types.d.ts +3 -2
  27. package/dist/document-api/src/types/blocks.types.d.ts +2 -2
  28. package/dist/document-api/src/types/mutation-plan.types.d.ts +45 -5
  29. package/dist/document-api/src/types/receipt.d.ts +12 -0
  30. package/dist/document-api/src/types/sd-contract.d.ts +3 -0
  31. package/dist/document-api/src/types/track-changes.types.d.ts +8 -0
  32. package/dist/layout-engine/contracts/src/incremental-dependency.d.ts +2 -2
  33. package/dist/layout-engine/contracts/src/index.d.ts +4 -0
  34. package/dist/layout-engine/layout-bridge/src/font-metrics-cache.d.ts +2 -23
  35. package/dist/layout-engine/layout-bridge/src/incrementalLayout.d.ts +11 -4
  36. package/dist/layout-engine/layout-bridge/src/index.d.ts +3 -3
  37. package/dist/layout-engine/layout-bridge/src/measurement-environment.d.ts +12 -0
  38. package/dist/layout-engine/layout-bridge/src/resolveLiveCrossReferences.d.ts +1 -1
  39. package/dist/layout-engine/layout-bridge/src/text-measurement.d.ts +8 -0
  40. package/dist/layout-engine/painters/dom/src/decoration-geometry.d.ts +17 -0
  41. package/dist/layout-engine/painters/dom/src/index.d.ts +5 -0
  42. package/dist/layout-engine/painters/dom/src/renderer.d.ts +0 -31
  43. package/dist/layout-engine/painters/dom/src/runs/text-run.d.ts +2 -17
  44. package/dist/layout-engine/painters/dom/src/runs/text-style-facts.d.ts +9 -0
  45. package/dist/layout-engine/painters/dom/src/runs/tracked-changes.d.ts +6 -9
  46. package/dist/layout-engine/painters/dom/src/styles.d.ts +21 -0
  47. package/dist/public/ui-react.cjs +1 -1
  48. package/dist/public/ui-react.es.js +1 -1
  49. package/dist/public/ui-vue.cjs +1 -1
  50. package/dist/public/ui-vue.es.js +1 -1
  51. package/dist/public/ui.cjs +1 -1
  52. package/dist/public/ui.es.js +1 -1
  53. package/dist/shared/font-system/src/registry.d.ts +5 -1
  54. package/dist/shared/font-system/src/resolver.d.ts +2 -0
  55. package/dist/style.css +1 -4239
  56. package/dist/style.layered.css +1 -4239
  57. package/dist/superdoc/src/composables/use-link-popover.d.ts +9 -0
  58. package/dist/superdoc/src/core/superdoc-ui-owner.d.ts +1 -0
  59. package/dist/superdoc/src/core/types/index.d.ts +1 -1
  60. package/dist/superdoc/src/core/v2-integration/internal-vue-runtime.d.ts +1 -0
  61. package/dist/superdoc/src/index.d.cts +2 -0
  62. package/dist/superdoc/src/index.d.ts +1 -0
  63. package/dist/superdoc/src/public/index.d.cts +8 -0
  64. package/dist/superdoc/src/public/index.d.ts +2 -0
  65. package/dist/superdoc/src/stores/comments-store.d.ts +7 -4
  66. package/dist/superdoc/src/stores/superdoc-store.d.ts +21 -12
  67. package/dist/superdoc.cjs +355 -133
  68. package/dist/superdoc.es.js +354 -134
  69. package/dist-cdn/style.layered.css +1 -1
  70. package/dist-cdn/superdoc.min.css +1 -1
  71. package/dist-cdn/superdoc.min.js +42 -42
  72. package/package.json +2 -2
@@ -1,3 +1,4 @@
1
+ import { LayoutMeasurementContext } from './measurement-environment.js';
1
2
  import { FlowBlock, Line, Run } from '../../contracts/src/index.js';
2
3
  import { FontMeasureContext } from '../../../shared/font-system/src/index.js';
3
4
  /**
@@ -7,6 +8,13 @@ import { FontMeasureContext } from '../../../shared/font-system/src/index.js';
7
8
  * @returns CSS font string (e.g., "italic bold 16px Arial")
8
9
  */
9
10
  export declare function getRunFontString(run: Run, fontContext?: FontMeasureContext): string;
11
+ /** Native caret text box for inline-image paragraphs, including wrapped text lines. */
12
+ export declare function measureInlineImageCaretTextBox(block: FlowBlock, line: Line, charOffset: number, fontContext?: FontMeasureContext, measurementContext?: LayoutMeasurementContext): {
13
+ ascent: number;
14
+ height: number;
15
+ bottomAligned: boolean;
16
+ bottomInset: number;
17
+ } | null;
10
18
  export declare function measureCharacterX(block: FlowBlock, line: Line, charOffset: number, availableWidthOverride?: number, alignmentOverride?: string, fontContext?: FontMeasureContext): number;
11
19
  /**
12
20
  * Convert a character offset within a line back to a ProseMirror position.
@@ -0,0 +1,17 @@
1
+ import { Fragment, ResolvedPage, ResolvedPaintItem } from '../../../contracts/src/index.js';
2
+ import { PageDecorationPayload } from './renderer.js';
3
+ export type DecorationPageGeometry = Pick<ResolvedPage, 'height' | 'margins' | 'baseMargins' | 'footnoteReserved' | 'index'>;
4
+ export declare function resolveDecorationBandGeometry(data: PageDecorationPayload, kind: 'header' | 'footer'): {
5
+ effectiveHeight: number;
6
+ effectiveOffset: number;
7
+ footerYOffset: number;
8
+ };
9
+ /** Page-local coordinates shared by canonical painting and neutral edit geometry. */
10
+ export declare function resolveDecorationFragmentPosition(page: DecorationPageGeometry, kind: 'header' | 'footer', data: PageDecorationPayload, fragment: Fragment, item: ResolvedPaintItem | undefined, band?: {
11
+ effectiveHeight: number;
12
+ effectiveOffset: number;
13
+ footerYOffset: number;
14
+ }, behindDocument?: boolean): {
15
+ x: number;
16
+ y: number;
17
+ };
@@ -133,3 +133,8 @@ export type DomPainterHandle = {
133
133
  * `mode-ownership.test.ts` battery pins the surface deleted.
134
134
  */
135
135
  export declare const createDomPainter: (options: DomPainterOptions) => DomPainterHandle;
136
+ export { resolveRunTypographyStyles, resolveRunDecorationStyles } from './runs/text-style-facts.js';
137
+ export { resolveTrackedChangeDecorationFacts, getTrackedChangeLayers, resolveTrackedChangesConfig, } from './runs/tracked-changes.js';
138
+ export { buildLinkRenderData } from './runs/links.js';
139
+ export { INLINE_TRACKED_CHANGE_DEFAULTS } from './styles.js';
140
+ export { resolveDecorationFragmentPosition } from './decoration-geometry.js';
@@ -433,26 +433,6 @@ export declare class DomPainter {
433
433
  private resolveSeparatorColumnGeometry;
434
434
  private renderDecorationsForPage;
435
435
  private renderDecorationsForPageWork;
436
- /**
437
- * Check if a fragment is vertically anchored to the page.
438
- * Used to determine special Y positioning for page-relative anchored content
439
- * in header/footer decoration sections.
440
- */
441
- private isPageRelativeAnchoredFragment;
442
- private isPageRelativeParagraphFrame;
443
- private isPageRelativeHorizontalAnchoredFragment;
444
- /**
445
- * Header/footer layout emits normalized anchor Y coordinates:
446
- * - headers: local to the header container origin
447
- * - footers: local to the top of the footer band (pageHeight - bottomMargin)
448
- *
449
- * Footer containers can grow upward when content overflows the reserved footer
450
- * band, so their top edge is not always the same as the footer band origin.
451
- * This helper returns the page-space origin that normalized anchor Y values
452
- * are measured from.
453
- */
454
- private getDecorationAnchorPageOriginY;
455
- private getFooterFragmentAnchorPageOriginY;
456
436
  private renderDecorationSectionWork;
457
437
  private resetState;
458
438
  dispose(): void;
@@ -681,15 +661,4 @@ export declare class DomPainter {
681
661
  private applyFragmentWrapperZIndex;
682
662
  private applyResolvedFragmentFrame;
683
663
  private applyFragmentColumnOwnership;
684
- /**
685
- * Estimates the height of a fragment when explicit height is not available.
686
- *
687
- * This method provides fallback height calculations for footer bottom-alignment
688
- * from resolved layout data, or using the fragment's height property for
689
- * tables, images, and drawings.
690
- *
691
- * @param fragment - The fragment to estimate height for
692
- * @returns Estimated height in pixels, or 0 if height cannot be determined
693
- */
694
- private estimateFragmentHeight;
695
664
  }
@@ -2,6 +2,8 @@ import { Run, TextRun } from '../../../../contracts/src/index.js';
2
2
  import { FragmentRenderContext } from '../renderer.js';
3
3
  import { BROWSER_DEFAULT_FONT_SIZE } from '../styles.js';
4
4
  import { RunRenderContext, TrackedChangesRenderConfig } from './types.js';
5
+ import { ResolvePhysicalFont } from './text-style-facts.js';
6
+ export { underlineThicknessPx } from './text-style-facts.js';
5
7
  export type CheckboxGlyphs = {
6
8
  checked: string;
7
9
  unchecked: string;
@@ -10,23 +12,6 @@ export type CheckboxGlyphs = {
10
12
  export declare const checkboxGlyphs: (run: TextRun) => CheckboxGlyphs | null;
11
13
  /** Stamps the authored states needed to reflect an accepted checkbox toggle. */
12
14
  export declare const applyCheckboxGlyphMetadata: (element: HTMLElement, run: TextRun) => CheckboxGlyphs | null;
13
- /**
14
- * Underline thickness in px, scaled to font size. Shared by text runs
15
- * (`text-decoration-thickness`) and tab underlines (border width) so a run's
16
- * underline renders as a single uniform weight across text and tab characters,
17
- * matching Word, on any display density (SD-3330). The divisor approximates the
18
- * font's natural underline weight (≈ what `text-decoration-thickness: auto`
19
- * produces) while staying deterministic across platforms.
20
- *
21
- * Rounded to an integer px because CSS borders snap to integer device pixels
22
- * while `text-decoration-thickness` keeps fractional values; using an integer
23
- * makes the tab border and the text underline rasterize to the same line weight.
24
- */
25
- export declare const underlineThicknessPx: (fontSize: number) => number;
26
- type ResolvePhysicalFont = (cssFontFamily: string, face: {
27
- weight: '400' | '700';
28
- style: 'normal' | 'italic';
29
- }) => string;
30
15
  export declare const applyRunTypographyStyles: (element: HTMLElement, run: TextRun, resolvePhysical?: ResolvePhysicalFont) => void;
31
16
  /**
32
17
  * Applies run styling properties to a DOM element.
@@ -0,0 +1,9 @@
1
+ import { TextRun } from '../../../../contracts/src/index.js';
2
+ export type ResolvePhysicalFont = (family: string, face: {
3
+ weight: '400' | '700';
4
+ style: 'normal' | 'italic';
5
+ }) => string;
6
+ /** The same paint-ready typography is consumed by the DOM painter and worker sinks. */
7
+ export declare function resolveRunTypographyStyles(run: TextRun, resolvePhysical?: ResolvePhysicalFont): Record<string, string>;
8
+ export declare const underlineThicknessPx: (fontSize: number) => number;
9
+ export declare function resolveRunDecorationStyles(run: TextRun): Record<string, string>;
@@ -21,17 +21,9 @@ export declare const resolveTrackedChangeVisualColor: (layer: TrackedChangeMeta)
21
21
  * `colorWithAlpha` can safely extend (named/non-hex visual colors still set
22
22
  * border/text but never fabricate a derived background).
23
23
  */
24
+ export declare const resolveTrackedChangeColorVariables: (layer: TrackedChangeMeta) => Record<string, string>;
24
25
  export declare const applyTrackedChangeColorVariables: (elem: HTMLElement, layer: TrackedChangeMeta) => void;
25
26
  export declare const TRACK_CHANGE_MODIFIER_CLASS: Record<TrackedChangeKind, Record<TrackedChangesMode, string | undefined>>;
26
- /**
27
- * Stamps the semantic class + datasets for a tracked-change layer. Shared by
28
- * inline, row-level, and cell-level paint paths so the dataset/class vocabulary
29
- * stays identical. Only fields that are present are stamped; this never reads
30
- * or writes the author `color` dataset. The semantic datasets are namespaced
31
- * (`data-track-change-semantic-*`, `-type`, `-subtype`, `-target-kind`,
32
- * `-semantic-anchor-scope`) so they never collide with the existing author/
33
- * structural datasets even when row + cell metadata coexist.
34
- */
35
27
  export declare const applySemanticTrackedChangeMetadata: (elem: HTMLElement, meta: TrackedChangeMeta) => void;
36
28
  type TrackedChangeCarrier = Partial<Pick<TextRun, 'trackedChange' | 'trackedChanges'>>;
37
29
  type TrackedChangeDecoratable = Run | TrackedChangeCarrier;
@@ -86,5 +78,10 @@ export declare const applyRowTrackedChangeToCell: (elem: HTMLElement, meta: Trac
86
78
  * @param config - Tracked-changes mode/enabled (same source inline runs use).
87
79
  */
88
80
  export declare const applyCellTrackedChangeToCell: (elem: HTMLElement, meta: TrackedChangeMeta, config: TrackedChangesRenderConfig) => void;
81
+ export declare const resolveTrackedChangeDecorationFacts: (run: TrackedChangeDecoratable, config: TrackedChangesRenderConfig) => {
82
+ classes: string[];
83
+ style: Record<string, string>;
84
+ attributes: Record<string, string>;
85
+ };
89
86
  export declare const applyTrackedChangeDecorations: (elem: HTMLElement, run: TrackedChangeDecoratable, config: TrackedChangesRenderConfig) => void;
90
87
  export {};
@@ -31,6 +31,27 @@ export declare const fragmentStyles: Partial<CSSStyleDeclaration>;
31
31
  * element itself gets z-index for layering within the line (e.g. above tab leaders).
32
32
  */
33
33
  export declare const lineStyles: (lineHeight: number) => Partial<CSSStyleDeclaration>;
34
+ /** Default inline tracking paint values shared with non-DOM drawing consumers. */
35
+ export declare const INLINE_TRACKED_CHANGE_DEFAULTS: {
36
+ readonly insert: {
37
+ readonly border: "#1f6feb";
38
+ readonly background: "#1f6feb22";
39
+ readonly borderWidth: 1;
40
+ readonly strikeWidth: 0;
41
+ };
42
+ readonly delete: {
43
+ readonly border: "#cb0e47";
44
+ readonly background: "#cb0e4722";
45
+ readonly borderWidth: 1;
46
+ readonly strikeWidth: 2;
47
+ };
48
+ readonly format: {
49
+ readonly border: "gold";
50
+ readonly background: "transparent";
51
+ readonly borderWidth: 2;
52
+ readonly strikeWidth: 0;
53
+ };
54
+ };
34
55
  /** One document-scoped stylesheet the paint surface requires: head marker attribute + CSS payload. */
35
56
  export type SurfaceStylePreflightEntry = {
36
57
  markerAttribute: string;
@@ -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-bTFGKVRb.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-ABeUNZlq.cjs");
3
3
  const require_slice_source = require("../chunks/slice-source-CFaqq0Vo.cjs");
4
4
  let react = require("react");
5
5
  //#region src/public/ui/react.ts
@@ -1,4 +1,4 @@
1
- import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-8UTu16Lw.es.js";
1
+ import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-CCNvH6mr.es.js";
2
2
  import { t as toSliceSource } from "../chunks/slice-source-gfOhG2MW.es.js";
3
3
  import { createContext, createElement, useCallback, useContext, useEffect, useRef, useState } from "react";
4
4
  //#region src/public/ui/react.ts
@@ -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-bTFGKVRb.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-ABeUNZlq.cjs");
3
3
  const require_slice_source = require("../chunks/slice-source-CFaqq0Vo.cjs");
4
4
  let superdoc_entry_vue = require("vue");
5
5
  //#region src/public/ui/vue.ts
@@ -1,4 +1,4 @@
1
- import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-8UTu16Lw.es.js";
1
+ import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-CCNvH6mr.es.js";
2
2
  import { t as toSliceSource } from "../chunks/slice-source-gfOhG2MW.es.js";
3
3
  import { computed, inject, onScopeDispose, provide, shallowRef, toRaw, toValue, watch } from "vue";
4
4
  //#region src/public/ui/vue.ts
@@ -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-bTFGKVRb.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-ABeUNZlq.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 { a as BUILT_IN_COMMAND_IDS, t as createSuperDocUI, u as shallowEqual } from "../chunks/create-super-doc-ui-8UTu16Lw.es.js";
1
+ import { a as BUILT_IN_COMMAND_IDS, t as createSuperDocUI, u as shallowEqual } from "../chunks/create-super-doc-ui-CCNvH6mr.es.js";
2
2
  export { BUILT_IN_COMMAND_IDS, createSuperDocUI, shallowEqual };
@@ -75,7 +75,9 @@ export declare class FontRegistry {
75
75
  * constructor: the family is recorded as `unloaded` and will resolve to
76
76
  * `fallback_used` when awaited.
77
77
  */
78
- register(descriptor: FontFaceDescriptor): RegisterFaceResult;
78
+ register(descriptor: FontFaceDescriptor, options?: {
79
+ preserveDescriptors?: boolean;
80
+ }): RegisterFaceResult;
79
81
  /** True if this registry created a managed face for the family. */
80
82
  isManaged(family: string): boolean;
81
83
  /**
@@ -126,6 +128,8 @@ export declare class FontRegistry {
126
128
  * Distinct from {@link isAvailable}, which asks whether a face is LOADED right now.
127
129
  */
128
130
  hasFace(family: string, weight: '400' | '700', style: 'normal' | 'italic'): boolean;
131
+ /** Face facts captured without retaining this registry or consulting later load state. */
132
+ snapshotFaces(): Pick<FontRegistry, 'hasFace' | 'getFaceStatus'>;
129
133
  /**
130
134
  * Synchronous availability check: is a real face for this family loaded and
131
135
  * usable in the set *right now*? Used by the gate's late-load handler to detect
@@ -124,6 +124,8 @@ export declare class FontResolver {
124
124
  * fonts must not leak into the next). Bumps {@link version} only if something was actually cleared.
125
125
  */
126
126
  reset(): void;
127
+ /** Immutable resolution owner for geometry retained with an already displayed scene. */
128
+ snapshot(): Pick<FontResolver, 'resolvePhysicalFamilyForFace' | 'signature'>;
127
129
  /** Monotonic version; bumps on every mapping change. A lightweight "did it change" signal. */
128
130
  get version(): number;
129
131
  /**