superdoc 2.4.0-next.9 → 2.5.0

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 (113) hide show
  1. package/README.md +12 -90
  2. package/dist/chunks/{FindReplaceSurface-9VkPw_-X.cjs → FindReplaceSurface-0p7EtMZh.cjs} +4 -3
  3. package/dist/chunks/{FindReplaceSurface-BuvaIrQ5.es.js → FindReplaceSurface-40AnrqWk.es.js} +4 -2
  4. package/dist/chunks/{PasswordPromptSurface-Bu5xHm91.cjs → PasswordPromptSurface-31lYPcCK.cjs} +4 -3
  5. package/dist/chunks/{PasswordPromptSurface-Bz9_sKhX.es.js → PasswordPromptSurface-CwYeO3iQ.es.js} +4 -2
  6. package/dist/chunks/{PdfViewer-CdVGB6Fe.es.js → PdfViewer-D8h7LRZy.es.js} +103 -19
  7. package/dist/chunks/{PdfViewer-D4eD2dV1.cjs → PdfViewer-Dug6yDRC.cjs} +105 -20
  8. package/dist/chunks/_plugin-vue_export-helper-BOaGB7Aw.es.js +8 -0
  9. package/dist/chunks/_plugin-vue_export-helper-SDR04tiH.cjs +13 -0
  10. package/dist/chunks/{blank-docx-DP8RUPW-.cjs → blank-docx-BuFAbRjs.cjs} +2 -0
  11. package/dist/chunks/{blank-docx-XRX6Ker2.es.js → blank-docx-DzQccOlW.es.js} +2 -0
  12. package/dist/chunks/constants-B6VBlmKp.es.js +4 -0
  13. package/dist/chunks/constants-DpXuDx_g.cjs +9 -0
  14. package/dist/chunks/{create-super-doc-ui-ByvmsAAG.cjs → create-super-doc-ui-Bom7oDPv.cjs} +2027 -1158
  15. package/dist/chunks/{create-super-doc-ui-DBXOhHdW.es.js → create-super-doc-ui-DbzVC0rr.es.js} +2216 -1107
  16. package/dist/chunks/{eventemitter3-Bt2s0X0a.es.js → eventemitter3-CMOjDs74.es.js} +124 -16
  17. package/dist/chunks/{eventemitter3-DqY4aSMf.cjs → eventemitter3-D38u8ta_.cjs} +125 -16
  18. package/dist/chunks/jszip-RC64TPzL.cjs +4758 -0
  19. package/dist/chunks/jszip-VxCFV9YS.es.js +4717 -0
  20. package/dist/chunks/{rolldown-runtime-D7PMmH3s.es.js → rolldown-runtime-B5TtN50X.es.js} +13 -4
  21. package/dist/chunks/{rolldown-runtime-1Y-nnZJ3.cjs → rolldown-runtime-DtsSbkrh.cjs} +12 -3
  22. package/dist/chunks/{uuid-CFp0WGVU.cjs → uuid-BhG0ngwk.cjs} +10 -6
  23. package/dist/chunks/{uuid-B2Sqk-3p.es.js → uuid-H0Xcmmhy.es.js} +8 -3
  24. package/dist/collaboration-upgrade-engine.cjs +34 -9
  25. package/dist/collaboration-upgrade-engine.es.js +30 -5
  26. package/dist/document-api/src/citations/citations.types.d.ts +9 -0
  27. package/dist/document-api/src/comments/comments.types.d.ts +7 -0
  28. package/dist/document-api/src/types/receipt.d.ts +9 -5
  29. package/dist/document-api/src/types/track-changes.types.d.ts +17 -0
  30. package/dist/layout-engine/contracts/src/graphic-placement.d.ts +35 -6
  31. package/dist/layout-engine/contracts/src/incremental-dependency.d.ts +22 -2
  32. package/dist/layout-engine/contracts/src/index.d.ts +370 -15
  33. package/dist/layout-engine/contracts/src/inline-box.d.ts +19 -0
  34. package/dist/layout-engine/contracts/src/paragraph-visible-text.d.ts +19 -0
  35. package/dist/layout-engine/contracts/src/resolved-layout.d.ts +5 -0
  36. package/dist/layout-engine/dom-contract/src/class-names.d.ts +2 -0
  37. package/dist/layout-engine/layout-bridge/src/footnote-scorer.d.ts +1 -1
  38. package/dist/layout-engine/layout-bridge/src/hydrateTableTextboxMeasures.d.ts +9 -0
  39. package/dist/layout-engine/layout-bridge/src/incrementalLayout.d.ts +42 -11
  40. package/dist/layout-engine/layout-bridge/src/index.d.ts +4 -2
  41. package/dist/layout-engine/layout-bridge/src/inline-box-key.d.ts +3 -0
  42. package/dist/layout-engine/layout-bridge/src/layoutHeaderFooter.d.ts +11 -4
  43. package/dist/layout-engine/layout-bridge/src/remeasure.d.ts +2 -2
  44. package/dist/layout-engine/layout-bridge/src/run-visual-marks.d.ts +2 -0
  45. package/dist/layout-engine/layout-bridge/src/text-measurement.d.ts +0 -12
  46. package/dist/layout-engine/layout-engine/src/anchors.d.ts +4 -0
  47. package/dist/layout-engine/layout-engine/src/execution.d.ts +21 -0
  48. package/dist/layout-engine/layout-engine/src/floating-objects.d.ts +15 -2
  49. package/dist/layout-engine/layout-engine/src/floating-table-anchor.d.ts +2 -0
  50. package/dist/layout-engine/layout-engine/src/footnote-anchor-index.d.ts +17 -0
  51. package/dist/layout-engine/layout-engine/src/index.d.ts +13 -10
  52. package/dist/layout-engine/layout-engine/src/inline-drawing-alignment.d.ts +9 -0
  53. package/dist/layout-engine/layout-engine/src/layout-drawing.d.ts +3 -3
  54. package/dist/layout-engine/layout-engine/src/layout-paragraph.d.ts +2 -2
  55. package/dist/layout-engine/layout-engine/src/layout-textbox.d.ts +3 -3
  56. package/dist/layout-engine/layout-engine/src/pageNumbering.d.ts +3 -41
  57. package/dist/layout-engine/layout-engine/src/paginator.d.ts +7 -2
  58. package/dist/layout-engine/layout-engine/src/resolvePageTokens.d.ts +2 -0
  59. package/dist/layout-engine/layout-engine/src/section-breaks.d.ts +1 -0
  60. package/dist/layout-engine/layout-engine/src/section-props.d.ts +5 -0
  61. package/dist/layout-engine/painters/dom/src/chart-renderer.d.ts +3 -3
  62. package/dist/layout-engine/painters/dom/src/images/image-outline.d.ts +7 -0
  63. package/dist/layout-engine/painters/dom/src/images/render-placeholder.d.ts +12 -0
  64. package/dist/layout-engine/painters/dom/src/renderer.d.ts +54 -0
  65. package/dist/layout-engine/painters/dom/src/runs/inline-box.d.ts +8 -0
  66. package/dist/layout-engine/painters/dom/src/runs/text-effects.d.ts +30 -0
  67. package/dist/layout-engine/painters/dom/src/runs/text-run.d.ts +6 -4
  68. package/dist/layout-engine/painters/dom/src/shapes/preset-text-warp-data.d.ts +32 -0
  69. package/dist/layout-engine/painters/dom/src/shapes/wordart-warp.d.ts +39 -0
  70. package/dist/layout-engine/painters/dom/src/table/border-utils.d.ts +20 -27
  71. package/dist/layout-engine/painters/dom/src/table/renderTableFragment.d.ts +1 -1
  72. package/dist/layout-engine/style-engine/src/ooxml/word-style-model/parse-theme.d.ts +7 -0
  73. package/dist/public/ui-react.cjs +66 -2
  74. package/dist/public/ui-react.es.js +66 -1
  75. package/dist/public/ui.cjs +1 -1
  76. package/dist/public/ui.es.js +1 -1
  77. package/dist/style.css +134 -98
  78. package/dist/style.layered.css +134 -98
  79. package/dist/superdoc/src/components/CommentsLayer/CommentDialog.vue.d.ts +2 -0
  80. package/dist/superdoc/src/components/CommentsLayer/commentsList/ReviewDirectoryListItem.vue.d.ts +16 -0
  81. package/dist/superdoc/src/components/CommentsLayer/commentsList/commentsList.vue.d.ts +3 -1
  82. package/dist/superdoc/src/components/CommentsLayer/commentsList/super-comments-list.d.ts +12 -0
  83. package/dist/superdoc/src/core/SuperDoc.d.ts +10 -7
  84. package/dist/superdoc/src/core/config/normalize-ui-config.d.ts +5 -0
  85. package/dist/superdoc/src/core/extensions/index.d.ts +1 -1
  86. package/dist/superdoc/src/core/extensions/types.d.ts +63 -5
  87. package/dist/superdoc/src/core/types/index.d.ts +423 -37
  88. package/dist/superdoc/src/core/v2-integration/v2-integration.d.ts +3 -3
  89. package/dist/superdoc/src/helpers/comment-small-screen.d.ts +10 -0
  90. package/dist/superdoc/src/helpers/v2-review-mutation-impact.d.ts +3 -5
  91. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarButton.vue.d.ts +4 -4
  92. package/dist/superdoc/src/internal/toolbar/built-in-toolbar.d.ts +11 -0
  93. package/dist/superdoc/src/internal/toolbar/compatibility-catalog.d.ts +1 -1
  94. package/dist/superdoc/src/public/index.d.cts +20 -0
  95. package/dist/superdoc/src/public/index.d.ts +10 -0
  96. package/dist/superdoc/src/public/ui/types.d.ts +5 -5
  97. package/dist/superdoc/src/stores/comments-store.d.ts +81 -78
  98. package/dist/superdoc/src/stores/superdoc-store.d.ts +243 -234
  99. package/dist/superdoc.cjs +6748 -2162
  100. package/dist/superdoc.es.js +6621 -2035
  101. package/dist-cdn/style.layered.css +1 -1
  102. package/dist-cdn/superdoc.min.css +1 -1
  103. package/dist-cdn/superdoc.min.js +37 -37
  104. package/package.json +14 -18
  105. package/AGENTS.md +0 -337
  106. package/dist/chunks/_plugin-vue_export-helper-CZ1Nl59K.cjs +0 -11
  107. package/dist/chunks/_plugin-vue_export-helper-DSMAhhwD.es.js +0 -6
  108. package/dist/chunks/constants-BfH0br5u.es.js +0 -3
  109. package/dist/chunks/constants-D7TNtyJd.cjs +0 -14
  110. package/dist/chunks/jszip-C8srOKAO.es.js +0 -4650
  111. package/dist/chunks/jszip-Cs9JBLlJ.cjs +0 -4691
  112. package/dist/superdoc/src/helpers/v2-remote-review-hydration.d.ts +0 -12
  113. package/dist/superdoc/src/helpers/v2-review-mutation-reconciler.d.ts +0 -19
@@ -1,13 +1,13 @@
1
- import { ChartModel, DrawingGeometry } from '../../../contracts/src/index.js';
1
+ import { ChartModel, DrawingGeometry, RenderPlaceholder } from '../../../contracts/src/index.js';
2
2
  /**
3
3
  * Create a chart element from a ChartDrawing block.
4
4
  * Routes to the correct renderer based on chart type, with placeholder fallback.
5
5
  */
6
- export declare function createChartElement(doc: Document, chartData: ChartModel | undefined, geometry: DrawingGeometry): HTMLElement;
6
+ export declare function createChartElement(doc: Document, chartData: ChartModel | undefined, geometry: DrawingGeometry, placeholder?: RenderPlaceholder): HTMLElement;
7
7
  /**
8
8
  * Create a placeholder for charts with missing data or unsupported types.
9
9
  * Preserves layout dimensions and is print-visible.
10
10
  */
11
- export declare function createChartPlaceholder(doc: Document, container: HTMLElement, label: string): HTMLElement;
11
+ export declare function createChartPlaceholder(doc: Document, container: HTMLElement, label: string, placeholder?: RenderPlaceholder): HTMLElement;
12
12
  /** Format a numeric tick value for chart axis labels. */
13
13
  export declare function formatTickValue(value: number): string;
@@ -0,0 +1,7 @@
1
+ import { ImageOutline } from '../../../../contracts/src/index.js';
2
+ /**
3
+ * Paint a DrawingML picture frame without changing the image's layout box.
4
+ * `a:ln` is centered on the picture geometry; a negatively offset CSS outline
5
+ * reproduces that geometry while keeping width/height authoritative.
6
+ */
7
+ export declare const applyImageOutline: (target: HTMLElement, outline?: ImageOutline) => void;
@@ -0,0 +1,12 @@
1
+ import { RenderPlaceholder } from '../../../../contracts/src/index.js';
2
+ export type CreateRenderPlaceholderOptions = {
3
+ doc: Document;
4
+ placeholder: RenderPlaceholder;
5
+ };
6
+ /** Stamp the shared diagnostic and accessibility contract on a placeholder. */
7
+ export declare const applyRenderPlaceholderSemantics: (element: HTMLElement, placeholder: RenderPlaceholder) => void;
8
+ /**
9
+ * Paint an observable, print-visible replacement for content that the
10
+ * projection layer deliberately kept fail-closed.
11
+ */
12
+ export declare const createRenderPlaceholder: ({ doc, placeholder }: CreateRenderPlaceholderOptions) => HTMLSpanElement;
@@ -261,6 +261,8 @@ export declare class DomPainter {
261
261
  private totalPages;
262
262
  private sectionPageCounts;
263
263
  private linkIdCounter;
264
+ private shapeImageFillCounter;
265
+ private wordArtPathCounter;
264
266
  private sdtLabelsRendered;
265
267
  /**
266
268
  * WeakMap storing tooltip data for hyperlink elements before DOM insertion.
@@ -520,11 +522,52 @@ export declare class DomPainter {
520
522
  * Apply fill and stroke styles to a fallback shape container
521
523
  */
522
524
  private applyFallbackShapeStyle;
525
+ /**
526
+ * Shape stroke widths reach the painter in physical CSS pixels. Preset SVGs
527
+ * use a normalized 100 × 100 viewBox while VML custom geometry often uses a
528
+ * coordsize in the thousands. In both cases allowing the viewBox transform to
529
+ * scale the stroke changes the authored line weight, sometimes by orders of
530
+ * magnitude. Keep geometry scalable and paint the resolved width verbatim.
531
+ */
532
+ private applyPhysicalStrokeSemantics;
533
+ /**
534
+ * Produce a stable 8-bit preview color for inactive header/footer graphics.
535
+ * CSS color-mix() retains fractional sRGB channels and Chromium floors some
536
+ * half-channel values during rasterization; Word rounds those channels. Keep
537
+ * the authored color separate and expose the rounded blend as a paint hint.
538
+ */
539
+ private mixResolvedHexColorWithWhite;
540
+ /** Paint a DrawingML picture fill through the existing SVG geometry. */
541
+ private applyShapeImageFill;
542
+ private appendShapeFillImage;
543
+ private resolveShapeTileOrigin;
523
544
  private hasShapeTextContent;
524
545
  private createShapeTextElement;
525
546
  private createTextboxContentElement;
526
547
  private shouldUseWordArtTextRenderer;
527
548
  private createWordArtTextElement;
549
+ private createWordArtEnvelopeGroup;
550
+ /**
551
+ * Approximates DrawingML's point-wise text-envelope transform with narrow
552
+ * vector strips. Each strip maps a slice of the unwarped text block between
553
+ * the authored upper and lower guide paths. Unlike a per-glyph affine
554
+ * transform, this bends the glyph outlines themselves while preserving SVG
555
+ * text paint (fills, outlines, glow and shadow) and browser font shaping.
556
+ */
557
+ private createWordArtEnvelopeMesh;
558
+ /**
559
+ * DrawingML composes glow and shadow after the text outline has been
560
+ * deformed by the warp. The envelope renderer repeats a clipped source
561
+ * through many transformed `<use>` elements; leaving a CSS filter on that
562
+ * source clips and transforms the effect independently in every mesh strip.
563
+ * Promote a shared run filter to the completed mesh so the browser paints
564
+ * one effect around the final warped silhouette. Mixed run effects remain on
565
+ * their source runs because collapsing them would change authored styling.
566
+ */
567
+ private promoteUniformWordArtEnvelopeFilter;
568
+ private measureWordArtLineMetrics;
569
+ private measureWordArtLineWidth;
570
+ private createWordArtReflection;
528
571
  private buildWordArtLines;
529
572
  private resolveShapeTextPartText;
530
573
  private getWordArtTextAnchor;
@@ -540,6 +583,8 @@ export declare class DomPainter {
540
583
  * @param _groupScaleY - Reserved parent-group scale factor
541
584
  */
542
585
  private createFallbackTextElement;
586
+ private shapeTextAllowsOverflow;
587
+ private applyShapeTextFlow;
543
588
  private tryCreatePresetSvg;
544
589
  /**
545
590
  * Creates an SVG string from custom geometry path data (a:custGeom).
@@ -566,6 +611,9 @@ export declare class DomPainter {
566
611
  */
567
612
  private createChartElement;
568
613
  private resolveTableRenderData;
614
+ private createTableCellLineRenderer;
615
+ /** Render drawing content nested in any canonical table, including a textbox-owned table. */
616
+ private renderDrawingContentForTable;
569
617
  private renderTableFragment;
570
618
  private renderLine;
571
619
  private createRunRenderContext;
@@ -600,6 +648,12 @@ export declare class DomPainter {
600
648
  * Uses resolved data for spatial properties and delegates PM attributes to the legacy path.
601
649
  */
602
650
  private isAnchoredMediaFragment;
651
+ /**
652
+ * Marks fragments whose paint coordinates are independent from body flow.
653
+ * DOM consumers such as header/footer hit-testing must not infer page margins
654
+ * from floating objects that happen to paint above the first flow block.
655
+ */
656
+ private applyFragmentFlowClass;
603
657
  private shouldRenderBehindPageContent;
604
658
  private isHeaderWordArtWatermark;
605
659
  private isVmlTextWatermarkImage;
@@ -0,0 +1,8 @@
1
+ import { Line, LineInlineBox, ParagraphBlock, Run, TextRun } from '../../../../contracts/src/index.js';
2
+ export declare const markInlineBoxRun: (run: TextRun, lineFrom: number, lineTo: number) => TextRun;
3
+ /** Splits text runs at the segment boundaries emitted for inline-box edges. */
4
+ export declare const splitInlineBoxRuns: (block: ParagraphBlock, line: Line) => Run[] | null;
5
+ /** Returns the resolved inline advance preceding an explicitly positioned text segment. */
6
+ export declare const inlineBoxAdvanceBeforeOffset: (boxes: readonly LineInlineBox[] | undefined, offset: number) => number;
7
+ /** Paints measured LTR inline-box slices on the canonical text leaves. */
8
+ export declare const paintInlineBoxes: (boxes: readonly LineInlineBox[] | undefined, lineElement: HTMLElement, isRtl: boolean) => void;
@@ -0,0 +1,30 @@
1
+ import { TextEffects } from '../../../../contracts/src/index.js';
2
+ type TextInkBounds = {
3
+ left: number;
4
+ top: number;
5
+ right: number;
6
+ bottom: number;
7
+ };
8
+ export declare function reflectionDirection(direction: number): 'above' | 'below' | 'left' | 'right';
9
+ export declare function resolveTextReflectionTransform(reflection: NonNullable<TextEffects['reflection']>, ink: TextInkBounds): {
10
+ transform: string;
11
+ maskDirection: 'top' | 'bottom' | 'left' | 'right';
12
+ };
13
+ /**
14
+ * Resolve reflection geometry without choosing a DOM or SVG transform syntax.
15
+ * Both ordinary HTML runs and SVG WordArt use the same DrawingML direction,
16
+ * distance, scale, and ink-edge anchoring contract.
17
+ */
18
+ export declare function resolveTextReflectionPlacement(reflection: NonNullable<TextEffects['reflection']>, ink: TextInkBounds): {
19
+ translateX: number;
20
+ translateY: number;
21
+ maskDirection: 'top' | 'bottom' | 'left' | 'right';
22
+ };
23
+ /** Resolve authored reflection opacity stops against visible glyph ink, not CSS leading. */
24
+ export declare function resolveTextReflectionMask(reflection: NonNullable<TextEffects['reflection']>, ink: TextInkBounds, box: {
25
+ width: number;
26
+ height: number;
27
+ }): string;
28
+ /** Apply paint-only Word text effects without changing glyph metrics. */
29
+ export declare function applyTextEffects(element: HTMLElement, effects: TextEffects | undefined): void;
30
+ export {};
@@ -15,6 +15,11 @@ import { RunRenderContext, TrackedChangesRenderConfig } from './types.js';
15
15
  * makes the tab border and the text underline rasterize to the same line weight.
16
16
  */
17
17
  export declare const underlineThicknessPx: (fontSize: number) => number;
18
+ type ResolvePhysicalFont = (cssFontFamily: string, face: {
19
+ weight: '400' | '700';
20
+ style: 'normal' | 'italic';
21
+ }) => string;
22
+ export declare const applyRunTypographyStyles: (element: HTMLElement, run: TextRun, resolvePhysical?: ResolvePhysicalFont) => void;
18
23
  /**
19
24
  * Applies run styling properties to a DOM element.
20
25
  *
@@ -25,10 +30,7 @@ export declare const underlineThicknessPx: (fontSize: number) => number;
25
30
  * inline colors are now applied to all runs (including links) to
26
31
  * ensure OOXML hyperlink character styles appear correctly.
27
32
  */
28
- export declare const applyRunStyles: (element: HTMLElement, run: Run, _isLink?: boolean, resolvePhysical?: (cssFontFamily: string, face: {
29
- weight: "400" | "700";
30
- style: "normal" | "italic";
31
- }) => string) => void;
33
+ export declare const applyRunStyles: (element: HTMLElement, run: Run, _isLink?: boolean, resolvePhysical?: ResolvePhysicalFont) => void;
32
34
  export declare const resolveRunText: (run: Run, context: FragmentRenderContext) => string;
33
35
  export declare const extractLinkData: (run: Run) => import('./types.js').LinkRenderData | null;
34
36
  export declare const renderTextRun: (run: TextRun, context: FragmentRenderContext, renderContext: RunRenderContext, trackedConfig?: TrackedChangesRenderConfig) => HTMLElement | null;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * ECMA-376 preset text-warp geometry data.
3
+ *
4
+ * Generated from the standard's accompanying
5
+ * OfficeOpenXML-DrawingMLGeometries.zip / presetTextWarpDefinitions.xml.
6
+ * Do not hand-edit; regenerate through the evidence-plan script.
7
+ */
8
+ export type PresetTextWarpCommand = {
9
+ kind: 'moveTo' | 'lnTo' | 'quadBezTo' | 'cubicBezTo';
10
+ points: Array<{
11
+ x: string;
12
+ y: string;
13
+ }>;
14
+ } | {
15
+ kind: 'arc';
16
+ wR: string;
17
+ hR: string;
18
+ stAng: string;
19
+ swAng: string;
20
+ };
21
+ export type PresetTextWarpDefinition = {
22
+ adjustments: Array<{
23
+ name: string;
24
+ fmla: string;
25
+ }>;
26
+ guides: Array<{
27
+ name: string;
28
+ fmla: string;
29
+ }>;
30
+ paths: PresetTextWarpCommand[][];
31
+ };
32
+ export declare const PRESET_TEXT_WARP_DEFINITIONS: Record<string, PresetTextWarpDefinition>;
@@ -0,0 +1,39 @@
1
+ import { ShapeTextWarp } from '../../../../contracts/src/index.js';
2
+ export type WordArtWarpPoint = {
3
+ x: number;
4
+ y: number;
5
+ };
6
+ export type WordArtWarpGeometry = {
7
+ paths: WordArtWarpPoint[][];
8
+ /** One boundary bends a baseline; two or more boundaries define a glyph envelope. */
9
+ kind: 'baseline' | 'envelope';
10
+ };
11
+ export type WordArtWarpPath = {
12
+ d: string;
13
+ fidelity: 'baseline' | 'envelope';
14
+ /** Polyline length of the evaluated preset path in layout coordinates. */
15
+ length: number;
16
+ };
17
+ export type WordArtBaselineBand = {
18
+ geometry: WordArtWarpGeometry;
19
+ path: WordArtWarpPath;
20
+ };
21
+ export declare function resolveWordArtWarpGeometry(warp: ShapeTextWarp, width: number, height: number, top?: number): WordArtWarpGeometry | null;
22
+ /**
23
+ * Resolve the centerline between two adjacent authored warp boundaries.
24
+ *
25
+ * A small family of DrawingML presets uses shared boundaries to compose
26
+ * successive text bands (for example textButton's upper/center/lower paths).
27
+ * Word lays each line on the corresponding band centerline and preserves the
28
+ * glyph outlines instead of stretching the ink through the whole envelope.
29
+ */
30
+ export declare function resolveWordArtAdjacentBandBaseline(geometry: WordArtWarpGeometry, bandIndex: number): WordArtBaselineBand | null;
31
+ /** Baseline compatibility surface used by the SVG textPath renderer and diagnostics. */
32
+ export declare function resolveWordArtWarpPath(warp: ShapeTextWarp, width: number, height: number, top?: number): WordArtWarpPath | null;
33
+ export declare function pointAtPath(points: readonly WordArtWarpPoint[], progress: number): WordArtWarpPoint;
34
+ /**
35
+ * Resolve the DrawingML text-warp percentage on a flattened boundary path.
36
+ * ECMA-376 §20.1.9.19 steps 6–8 require travelled distance after flattening,
37
+ * not the curve's command, sample, or angle parameter.
38
+ */
39
+ export declare function pointAtWarpParameter(points: readonly WordArtWarpPoint[], progress: number): WordArtWarpPoint;
@@ -1,5 +1,20 @@
1
1
  import { BorderSpec, CellBorders, TableBorderValue, TableBorders, TableFragment } from '../../../../contracts/src/index.js';
2
2
  import { TableCellGridPosition } from './grid-geometry.js';
3
+ type BorderSide = 'Top' | 'Right' | 'Bottom' | 'Left';
4
+ type ThinDoubleBorderOverlayGeometry = {
5
+ left: string;
6
+ top: string;
7
+ width: string;
8
+ height: string;
9
+ };
10
+ /**
11
+ * Paints thin double borders in an unclipped sibling SVG. CSS gradients are
12
+ * clipped at cell seams and cannot form Word's continuous rectangular rings.
13
+ * The SVG preserves authored geometry once it is large enough, while the V2
14
+ * wrapper's inverse-zoom variable keeps sub-pixel components at Word's
15
+ * one-screen-pixel minimum across editor zoom levels.
16
+ */
17
+ export declare const createThinDoubleBorderOverlay: (doc: Document, source: HTMLElement, geometry: ThinDoubleBorderOverlayGeometry) => SVGSVGElement | null;
3
18
  /**
4
19
  * Applies a border specification to one side of an HTML element.
5
20
  *
@@ -18,7 +33,7 @@ import { TableCellGridPosition } from './grid-geometry.js';
18
33
  * // Sets cell.style.borderTop = '2px solid #FF0000'
19
34
  * ```
20
35
  */
21
- export declare const applyBorder: (element: HTMLElement, side: "Top" | "Right" | "Bottom" | "Left", border?: BorderSpec) => void;
36
+ export declare const applyBorder: (element: HTMLElement, side: BorderSide, border?: BorderSpec) => void;
22
37
  /**
23
38
  * Applies border specifications to all four sides of a table cell element.
24
39
  *
@@ -79,32 +94,9 @@ export declare const borderValueToSpec: (value?: TableBorderValue | null) => Bor
79
94
  * ```
80
95
  */
81
96
  export declare const resolveTableBorderValue: (explicit: TableBorderValue | undefined | null, fallback?: TableBorderValue | undefined | null) => BorderSpec | undefined;
82
- export declare const isPresentBorder: (b?: BorderSpec) => b is BorderSpec;
83
- /**
84
- * True when a border is EXPLICITLY set to none/nil (`w:val="nil"`/`"none"`), as opposed to
85
- * simply unset/absent. The distinction matters for shared interior edges (§17.4.66): an
86
- * explicit none on BOTH adjacent cells suppresses the divider, while an unset side inherits
87
- * the table's insideH/insideV. Accepts either a CellBorders BorderSpec (`{style:'none'}`) or
88
- * a TableBorderValue (`{none:true}`).
89
- */
90
- export declare const isExplicitNoneBorder: (b?: unknown) => boolean;
91
- /**
92
- * OOXML cell-border conflict resolution (ECMA-376 §17.4.66).
93
- *
94
- * With zero cell spacing, two cells sharing an edge each specify a border; the spec
95
- * collapses them to a SINGLE displayed border:
96
- * 1. If either side is nil/none/absent, the opposing (present) border is displayed.
97
- * 2. Otherwise the border with greater weight wins, where
98
- * weight = (#lines in the style) × (style number).
99
- * 3. Equal weight → the style higher on the precedence list (single first) wins.
100
- * 4. Identical style → the color with the smaller brightness (R+B+2G, then B+2G, then
101
- * G) wins; finally the first border (reading order) wins.
102
- *
103
- * @param a - One side's border (the owning cell's, e.g. the lower/right cell)
104
- * @param b - The opposing side's border (e.g. the upper/left neighbor)
105
- * @returns The single BorderSpec to display, or undefined if neither is present.
106
- */
107
- export declare const resolveBorderConflict: (a?: BorderSpec, b?: BorderSpec) => BorderSpec | undefined;
97
+ export declare const isPresentBorder: (border?: BorderSpec) => border is BorderSpec;
98
+ export declare const isExplicitNoneBorder: (border?: unknown) => boolean;
99
+ export declare const resolveBorderConflict: (first?: BorderSpec, second?: BorderSpec) => BorderSpec | undefined;
108
100
  /**
109
101
  * Creates a border overlay element for a table fragment.
110
102
  *
@@ -183,3 +175,4 @@ export declare const swapTableBordersLR: (borders: TableBorders | undefined) =>
183
175
  * Swap left↔right on cell borders for RTL tables (ECMA-376 Part 4 §14.3.1, §14.3.5).
184
176
  */
185
177
  export declare const swapCellBordersLR: (borders: CellBorders | undefined) => CellBorders | undefined;
178
+ export {};
@@ -39,7 +39,7 @@ export type TableRenderDependencies = {
39
39
  /** Built-in SDT chrome rendering mode. */
40
40
  chrome?: 'default' | 'none';
41
41
  /** Function to render a line of paragraph content */
42
- renderLine: (block: ParagraphBlock, line: Line, context: FragmentRenderContext, lineIndex: number, isLastLine: boolean) => HTMLElement;
42
+ renderLine: (block: ParagraphBlock, line: Line, context: FragmentRenderContext, lineIndex: number, isLastLine: boolean, resolvedListTextStartPx?: number) => HTMLElement;
43
43
  /** Optional callback invoked after a table line's final styles/markers are applied. */
44
44
  captureLineSnapshot?: (lineEl: HTMLElement, context: FragmentRenderContext, options?: {
45
45
  inTableParagraph?: boolean;
@@ -11,11 +11,18 @@ export interface WordThemeFontFamily {
11
11
  readonly ea?: string;
12
12
  readonly cs?: string;
13
13
  }
14
+ /** Authored DrawingML format definitions, indexed by the matching style reference. */
15
+ export interface WordThemeFormatScheme {
16
+ readonly fillStyles: readonly string[];
17
+ readonly backgroundFillStyles: readonly string[];
18
+ readonly lineStyles?: readonly string[];
19
+ }
14
20
  export declare const DEFAULT_WORD_THEME_PALETTE: WordThemeColorPalette;
15
21
  export declare const DEFAULT_WORD_THEME_FONT_SCHEME: WordThemeFontScheme;
16
22
  export interface ThemeParseResult {
17
23
  palette?: WordThemeColorPalette;
18
24
  fontScheme?: WordThemeFontScheme;
25
+ formatScheme?: WordThemeFormatScheme;
19
26
  }
20
27
  /**
21
28
  * Parse the theme root (`a:theme`) into colors + font scheme. Returns an
@@ -1,17 +1,45 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_rolldown_runtime = require("../chunks/rolldown-runtime-1Y-nnZJ3.cjs");
3
- const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-ByvmsAAG.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-Bom7oDPv.cjs");
4
3
  let react = require("react");
4
+ //#region src/public/ui/react.ts
5
+ /**
6
+ * v2-native React bindings for the `superdoc/ui` controller.
7
+ *
8
+ * Provider + hooks over the SuperDoc-owned controller (`superdoc.ui`). For a
9
+ * real `SuperDoc` this layer never creates or destroys a controller; it binds
10
+ * to the one the instance already owns. It falls back to building (and then
11
+ * owning) one only for a structural host that carries no `ui`, since
12
+ * `SuperDocHost` leaves that property optional. Authored with
13
+ * `React.createElement` (no JSX) so the
14
+ * library build needs no JSX transform, and `react` stays an external/optional
15
+ * peer. No v1 editor or private v2 runtime imports.
16
+ */
5
17
  var SuperDocUIContext = (0, react.createContext)(null);
18
+ /**
19
+ * Destroy a controller this provider built itself. Controllers read off
20
+ * `superdoc.ui` are never passed here: the instance owns those.
21
+ */
6
22
  function disposeOwnedUi(ref) {
7
23
  const ui = ref.current;
8
24
  if (!ui) return;
9
25
  ui.destroy();
10
26
  ref.current = null;
11
27
  }
28
+ /**
29
+ * Root provider. Call {@link useSetSuperDoc} from your editor-mount
30
+ * component's ready callback to bind a running SuperDoc instance; the hooks
31
+ * below then read that instance's own controller (`superdoc.ui`).
32
+ *
33
+ * The provider is a consumer, not an owner. SuperDoc creates the controller
34
+ * and destroys it in `superdoc.destroy()`, so unmounting or rebinding the
35
+ * provider leaves it running for the built-in toolbar and any other consumer
36
+ * of the same instance. Every React hook therefore observes the same command
37
+ * state the rest of the application sees.
38
+ */
12
39
  function SuperDocUIProvider(props) {
13
40
  const [ui, setUi] = (0, react.useState)(null);
14
41
  const [host, setHost] = (0, react.useState)(null);
42
+ /** Only ever holds a controller this provider created for a host lacking one. */
15
43
  const ownedUiRef = (0, react.useRef)(null);
16
44
  const setSuperDoc = (0, react.useCallback)((superdoc) => {
17
45
  const hostUi = superdoc.ui;
@@ -37,15 +65,33 @@ function useContextValue() {
37
65
  if (!value) throw new Error("[superdoc/ui/react] hooks must be used within <SuperDocUIProvider>.");
38
66
  return value;
39
67
  }
68
+ /**
69
+ * Read the controller, or `null` until a SuperDoc instance is bound.
70
+ *
71
+ * Borrowed: the bound instance owns teardown, so the returned type omits
72
+ * `destroy()`. A provider-built fallback controller is disposed by the provider.
73
+ */
40
74
  function useSuperDocUI() {
41
75
  return useContextValue().ui;
42
76
  }
77
+ /** Read the raw bound SuperDoc host, or `null` until one is bound. */
43
78
  function useSuperDocHost() {
44
79
  return useContextValue().host;
45
80
  }
81
+ /** Get the stable callback used to bind a running SuperDoc instance. */
46
82
  function useSetSuperDoc() {
47
83
  return useContextValue().setSuperDoc;
48
84
  }
85
+ /**
86
+ * Normalize a `pick` result into a {@link SliceSource}. Domain handles and the
87
+ * command/font hooks already expose the snapshot-shaped contract
88
+ * (`getSnapshot` + `observe`) and pass through unchanged. A raw `ui.select(...)`
89
+ * {@link Subscribable} (`get` + `subscribe`) is adapted: it `subscribe`s FIRST,
90
+ * then emits the current value, so a synchronous recompute triggered by the
91
+ * first listener is not missed (the substrate's `subscribe` does not emit on
92
+ * attach). Exported for unit tests; not re-exported by the `superdoc/ui/react`
93
+ * facade, so it stays off the public surface.
94
+ */
49
95
  function toSliceSource(source) {
50
96
  const candidate = source;
51
97
  if (typeof candidate.getSnapshot === "function" && typeof candidate.observe === "function") return source;
@@ -59,6 +105,13 @@ function toSliceSource(source) {
59
105
  }
60
106
  };
61
107
  }
108
+ /**
109
+ * Subscribe to a derived slice of controller state. `pick` selects a value
110
+ * source from the controller: a domain handle / snapshot source
111
+ * ({@link SliceSource}) or a raw `ui.select(...)` {@link Subscribable}, both
112
+ * normalized via {@link toSliceSource}. `initial` is returned until the
113
+ * controller is bound.
114
+ */
62
115
  function useSuperDocSlice(pick, initial) {
63
116
  const ui = useSuperDocUI();
64
117
  const [value, setValue] = (0, react.useState)(() => ui ? toSliceSource(pick(ui)).getSnapshot() : initial);
@@ -83,9 +136,11 @@ var EMPTY_SELECTION = {
83
136
  activeChangeIds: [],
84
137
  quotedText: ""
85
138
  };
139
+ /** Subscribe to the selection slice. */
86
140
  function useSuperDocSelection() {
87
141
  return useSuperDocSlice((ui) => ui.selection, EMPTY_SELECTION);
88
142
  }
143
+ /** Subscribe to the comments slice. */
89
144
  function useSuperDocComments() {
90
145
  return useSuperDocSlice((ui) => ui.comments, {
91
146
  status: "pending",
@@ -96,6 +151,7 @@ function useSuperDocComments() {
96
151
  activeId: null
97
152
  });
98
153
  }
154
+ /** Subscribe to the content-controls slice. */
99
155
  function useSuperDocContentControls() {
100
156
  return useSuperDocSlice((ui) => ui.contentControls, {
101
157
  status: "pending",
@@ -105,6 +161,7 @@ function useSuperDocContentControls() {
105
161
  activeIds: []
106
162
  });
107
163
  }
164
+ /** Subscribe to the track-changes slice. */
108
165
  function useSuperDocTrackChanges() {
109
166
  return useSuperDocSlice((ui) => ui.trackChanges, {
110
167
  status: "pending",
@@ -114,6 +171,7 @@ function useSuperDocTrackChanges() {
114
171
  authors: []
115
172
  });
116
173
  }
174
+ /** Subscribe to the toolbar snapshot slice. */
117
175
  function useSuperDocToolbar() {
118
176
  return useSuperDocSlice((ui) => ui.toolbar, {
119
177
  context: null,
@@ -121,6 +179,7 @@ function useSuperDocToolbar() {
121
179
  copyFormatActive: false
122
180
  });
123
181
  }
182
+ /** Subscribe to a single command's enable/active state. */
124
183
  function useSuperDocCommand(id) {
125
184
  return useSuperDocSlice((ui) => ({
126
185
  getSnapshot: () => ui.commands.get(id).getState(),
@@ -131,6 +190,7 @@ function useSuperDocCommand(id) {
131
190
  supported: false
132
191
  });
133
192
  }
193
+ /** Subscribe to the document slice. */
134
194
  function useSuperDocDocument() {
135
195
  return useSuperDocSlice((ui) => ui.document, {
136
196
  ready: false,
@@ -138,18 +198,21 @@ function useSuperDocDocument() {
138
198
  dirty: false
139
199
  });
140
200
  }
201
+ /** Subscribe to available font-family options. */
141
202
  function useSuperDocFontOptions() {
142
203
  return useSuperDocSlice((ui) => ({
143
204
  getSnapshot: () => ui.fonts.getFamilyOptions(),
144
205
  observe: (cb) => ui.fonts.observe((slice) => cb(slice.options))
145
206
  }), []);
146
207
  }
208
+ /** Subscribe to available font-size options. */
147
209
  function useSuperDocFontSizeOptions() {
148
210
  return useSuperDocSlice((ui) => ({
149
211
  getSnapshot: () => ui.fonts.getSizeOptions(),
150
212
  observe: (cb) => ui.fonts.observe((slice) => cb(slice.sizeOptions))
151
213
  }), []);
152
214
  }
215
+ /** Subscribe to the zoom slice. */
153
216
  function useSuperDocZoom() {
154
217
  return useSuperDocSlice((ui) => ui.zoom, {
155
218
  mode: null,
@@ -158,6 +221,7 @@ function useSuperDocZoom() {
158
221
  max: 100
159
222
  });
160
223
  }
224
+ //#endregion
161
225
  exports.SuperDocUIProvider = SuperDocUIProvider;
162
226
  exports.useSetSuperDoc = useSetSuperDoc;
163
227
  exports.useSuperDocCommand = useSuperDocCommand;