@betteroffice/docx 0.0.4 → 0.2.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 (70) hide show
  1. package/README.md +4 -7
  2. package/dist/chunk-47Q2FMFF.mjs +1 -0
  3. package/dist/chunk-5F6DLQZP.mjs +1 -0
  4. package/dist/chunk-6LQJAKOC.mjs +1 -0
  5. package/dist/chunk-ACGKK7IB.mjs +1 -0
  6. package/dist/{chunk-NTSSE5QK.mjs → chunk-AFMVSI4Z.mjs} +2 -2
  7. package/dist/chunk-GD4VNJ64.mjs +1 -0
  8. package/dist/{chunk-NJHOPXZW.mjs → chunk-HLDJMU3R.mjs} +1 -1
  9. package/dist/{chunk-YTILOUAA.mjs → chunk-JHJLG4I6.mjs} +1 -1
  10. package/dist/chunk-PGMXWI5X.mjs +1 -0
  11. package/dist/{chunk-NBSLB77E.mjs → chunk-WTFRNX5K.mjs} +1 -1
  12. package/dist/collaboration/index.d.mts +6 -6
  13. package/dist/{content-C3sTRz-u.d.mts → content-CvEtPl0c.d.mts} +124 -22
  14. package/dist/core.d.mts +8 -8
  15. package/dist/core.mjs +1 -1
  16. package/dist/{displayListQueries-DLzpvJV6.d.mts → displayListQueries-DF8F6fMl.d.mts} +87 -50
  17. package/dist/docx/index.d.mts +5 -5
  18. package/dist/docx/index.mjs +1 -1
  19. package/dist/editor/index.d.mts +21 -12
  20. package/dist/editor/index.mjs +1 -1
  21. package/dist/{fontLoader-CMH3bZ2Z.d.mts → fontLoader-b8eicJKV.d.mts} +1 -1
  22. package/dist/{formatting-BEkIBePP.d.mts → formatting-7zKCTu5a.d.mts} +11 -2
  23. package/dist/{frameDelta-B2kC6XiP.d.mts → frameDelta-pA4jrQ1G.d.mts} +16 -10
  24. package/dist/generated/edit/docx_edit_bg.wasm +0 -0
  25. package/dist/generated/layout/docx_layout_bg.wasm +0 -0
  26. package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
  27. package/dist/generated/parse/docx_parse_bg.wasm +0 -0
  28. package/dist/{index-2piKi4gO.d.mts → index-CHl2zLJ7.d.mts} +146 -77
  29. package/dist/layout/index.d.mts +40 -13
  30. package/dist/layout/index.mjs +1 -1
  31. package/dist/layout/pagination/index.d.mts +4 -4
  32. package/dist/layout/pagination/index.mjs +1 -1
  33. package/dist/layout/render/index.d.mts +33 -77
  34. package/dist/layout/render/index.mjs +1 -1
  35. package/dist/plugin-api/RenderedDomContext.d.mts +7 -7
  36. package/dist/plugin-api/index.d.mts +3 -3
  37. package/dist/plugin-api/resolveItemPositions.d.mts +3 -3
  38. package/dist/{rustDisplayList-B0M2eBkU.d.mts → rustDisplayList-BJqaN9tt.d.mts} +74 -50
  39. package/dist/{rustMeasureSource-D1KsQvVC.d.mts → rustMeasureSource-C0EZB055.d.mts} +5 -2
  40. package/dist/{selectiveSave-CVoajSKE.d.mts → selectiveSave-CRh-_Y_C.d.mts} +3 -3
  41. package/dist/styles/index.d.mts +6 -10
  42. package/dist/styles/index.mjs +1 -1
  43. package/dist/{styles-BK3Jecxs.d.mts → styles-7e-mq3c-.d.mts} +1 -1
  44. package/dist/types/content.d.mts +2 -2
  45. package/dist/types/document.d.mts +8 -7
  46. package/dist/{types-C1rv3KM-.d.mts → types-C4A8mWjU.d.mts} +44 -24
  47. package/dist/utils/comments.d.mts +2 -2
  48. package/dist/utils/index.d.mts +11 -13
  49. package/dist/utils/index.mjs +1 -1
  50. package/dist/utils/stylePreview.d.mts +2 -2
  51. package/dist/wasm-7SOSHNGP.mjs +1 -0
  52. package/dist/{wasm-JE7B3ROD.mjs → wasm-ZQAVP7P2.mjs} +1 -1
  53. package/dist/wasm-edit.d.mts +525 -185
  54. package/dist/wasm-edit.mjs +1 -1
  55. package/dist/wasm-layout.d.mts +31 -28
  56. package/dist/wasm-layout.mjs +1 -1
  57. package/dist/wasm-opc.mjs +1 -1
  58. package/dist/wasm-parse.d.mts +2 -1
  59. package/dist/wasm-parse.mjs +1 -1
  60. package/dist/yrs/index.d.mts +5 -5
  61. package/dist/yrs/index.mjs +1 -1
  62. package/dist/yrs/residentEngineWorker.mjs +1 -1
  63. package/package.json +19 -2
  64. package/dist/chunk-4V6MDZIK.mjs +0 -1
  65. package/dist/chunk-6KDV6AIL.mjs +0 -1
  66. package/dist/chunk-B4IR6YP4.mjs +0 -1
  67. package/dist/chunk-GGEGIQRK.mjs +0 -1
  68. package/dist/chunk-T4EZMUXM.mjs +0 -1
  69. package/dist/chunk-WBH3SXI6.mjs +0 -1
  70. package/dist/wasm-F2ETFAYL.mjs +0 -1
@@ -1,4 +1,4 @@
1
- import { C as ColorValue, y as ThemeColorSlot, a as ParagraphFormatting, b as TextFormatting, c as TableFormatting, d as TableRowFormatting, e as TableCellFormatting, B as BorderSpec, m as ShapeType, k as ShapeFill, l as ShapeOutline, D as ShapeTextBody$1, P as PresetGeometryPathCommand } from './formatting-BEkIBePP.mjs';
1
+ import { C as ColorValue, y as ThemeColorSlot, a as ParagraphFormatting, b as TextFormatting, c as TableFormatting, d as TableRowFormatting, e as TableCellFormatting, B as BorderSpec, m as ShapeType, k as ShapeFill, l as ShapeOutline, D as ShapeTextBody$1, P as PresetGeometryPathCommand } from './formatting-7zKCTu5a.mjs';
2
2
  import { WrapType } from './docx/wrapTypes.mjs';
3
3
 
4
4
  interface ShapeFillPaint {
@@ -233,6 +233,14 @@ interface NumberingInstance {
233
233
  interface ListRendering {
234
234
  /** Computed marker text (e.g., "1.", "a)", "•") */
235
235
  marker: string;
236
+ /**
237
+ * Level indents the paragraph inherits when neither direct formatting nor
238
+ * the style chain sets its own; applied at layout time so the paragraph's
239
+ * authored properties stay authored.
240
+ */
241
+ indentLeft?: number;
242
+ indentFirstLine?: number;
243
+ hangingIndent?: boolean;
236
244
  /** List level (0-8) */
237
245
  level: number;
238
246
  /** Numbering ID */
@@ -317,7 +325,7 @@ interface TableCell {
317
325
  /** Tracked structural changes (cell insert/delete/merge) */
318
326
  structuralChange?: TableStructuralChangeInfo;
319
327
  /** Cell content (paragraphs, tables, etc.) */
320
- content: (Paragraph | Table)[];
328
+ content: BlockContent[];
321
329
  }
322
330
  /**
323
331
  * Table row (`w:tr`) — an ordered list of `TableCell` plus row-level
@@ -355,6 +363,11 @@ interface Table {
355
363
  rows: TableRow[];
356
364
  }
357
365
 
366
+ interface RawXml {
367
+ type: 'rawXml';
368
+ xml: string;
369
+ }
370
+
358
371
  /**
359
372
  * Watermark — the MS Word "Design → Watermark" feature.
360
373
  *
@@ -369,8 +382,8 @@ interface Table {
369
382
  * file, scaled, optionally "washed out" (lightened).
370
383
  *
371
384
  * We model the watermark as a dedicated field on the owning `HeaderFooter`
372
- * rather than as editable run content, so it stays out of the ProseMirror text
373
- * flow while still round-tripping through parse → render → serialize.
385
+ * rather than as editable run content, so it stays out of the text flow while
386
+ * still round-tripping through parse → render → serialize.
374
387
  */
375
388
  /**
376
389
  * Text watermark (e.g. "CONFIDENTIAL", "DRAFT").
@@ -471,6 +484,11 @@ interface HeaderFooter {
471
484
  hdrFtrType: HeaderFooterType;
472
485
  /** Content (paragraphs, tables, etc.) */
473
486
  content: BlockContent[];
487
+ /** Root bindings and attributes retained outside the standard boilerplate. */
488
+ customRootBindings?: {
489
+ name: string;
490
+ value: string;
491
+ }[];
474
492
  /**
475
493
  * Watermark stored on this header (MS Word "Design → Watermark"). Lives
476
494
  * here, not in `content`, so it stays out of the editable text flow while
@@ -540,16 +558,12 @@ interface Footnote {
540
558
  * and stays editable on round-trip.
541
559
  */
542
560
  content: BlockContent[];
543
- /**
544
- * Verbatim original XML of the entire `<w:footnote>` element, captured at
545
- * parse time ONLY when the note body carries a block-level construct the
546
- * model still can't represent — note-level bookmarks
547
- * (`w:bookmarkStart`/`w:bookmarkEnd`) or `w:customXml`. Block-level `w:sdt`
548
- * is NOT a trigger: it round-trips through the model as `BlockSdt`. When
549
- * present the serializer re-emits these bytes instead of rebuilding from
550
- * `content`, restoring pre-#646 fidelity for the unmodeled constructs.
551
- * See `parseNoteBlockContent` / `serializeNote` for the gate (#646 F3).
552
- */
561
+ /** Inherited root bindings required by foreign note content. */
562
+ customRootBindings?: {
563
+ name: string;
564
+ value: string;
565
+ }[];
566
+ /** Verbatim note XML for unmodeled bookmarks or custom XML. */
553
567
  verbatimXml?: string;
554
568
  }
555
569
  /**
@@ -567,7 +581,12 @@ interface Endnote {
567
581
  * on `Footnote.content`.
568
582
  */
569
583
  content: BlockContent[];
570
- /** Verbatim original XML — see `Footnote.verbatimXml` (#646 F3). */
584
+ /** Inherited root bindings required by foreign note content. */
585
+ customRootBindings?: {
586
+ name: string;
587
+ value: string;
588
+ }[];
589
+ /** Verbatim note XML for unmodeled blocks. */
571
590
  verbatimXml?: string;
572
591
  }
573
592
 
@@ -809,7 +828,7 @@ interface SectionProperties {
809
828
  /**
810
829
  * Block-level content types
811
830
  */
812
- type BlockContent = Paragraph | Table | BlockSdt;
831
+ type BlockContent = Paragraph | Table | BlockSdt | RawXml;
813
832
  /**
814
833
  * One section of the document — a `SectionProperties` plus the block
815
834
  * content (`Paragraph`s and `Table`s) that lives under those properties.
@@ -845,6 +864,11 @@ interface DocumentBody {
845
864
  sections?: Section[];
846
865
  /** Final section properties (from body's sectPr) */
847
866
  finalSectionProperties?: SectionProperties;
867
+ /** Root bindings and attributes retained outside the standard boilerplate. */
868
+ customRootBindings?: {
869
+ name: string;
870
+ value: string;
871
+ }[];
848
872
  /** Comments from comments.xml */
849
873
  comments?: Comment[];
850
874
  /** Stable reviewer palette metadata. Undefined = derive colors by author order. */
@@ -1212,9 +1236,9 @@ interface TrackedChangeInfo {
1212
1236
  date?: string;
1213
1237
  }
1214
1238
  /**
1215
- * Tracked-change attribute triple as it appears on PM node attrs
1239
+ * Tracked-change attribute triple as it appears on node attrs
1216
1240
  * (`paragraph.pPrIns`, `tableRow.trIns`, etc). Mirrors `TrackedChangeInfo`
1217
- * but with a `null` date (PM attr defaults) and a `revisionId` name that
1241
+ * but with a `null` date (attr defaults) and a `revisionId` name that
1218
1242
  * matches OOXML's `w:id` more idiomatically on the editor side.
1219
1243
  *
1220
1244
  * Round-trip pairs with `TrackedChangeInfo` via
@@ -1227,7 +1251,7 @@ interface RevisionInfo {
1227
1251
  }
1228
1252
  /**
1229
1253
  * Tracked-cell marker — the OOXML `<w:cellIns>` / `<w:cellDel>` /
1230
- * `<w:cellMerge>` shape attached to a `TableCell` PM node and surfaced
1254
+ * `<w:cellMerge>` shape attached to a `TableCell` node and surfaced
1231
1255
  * to the layout model and painter for visual rendering.
1232
1256
  *
1233
1257
  * `kind` matches the OOXML element name (ins / del / merge).
@@ -1475,6 +1499,18 @@ interface NoteRefMarkContent {
1475
1499
  interface SeparatorContent {
1476
1500
  type: 'separator' | 'continuationSeparator';
1477
1501
  }
1502
+ interface HorizontalRuleContent {
1503
+ type: 'horizontalRule';
1504
+ rule: {
1505
+ width: number | null;
1506
+ widthPercent: number | null;
1507
+ height: number;
1508
+ alignment: string;
1509
+ noShade: boolean;
1510
+ color: string;
1511
+ xml: string;
1512
+ };
1513
+ }
1478
1514
  /** Legacy `w:ffData` projected as inert form-control state. */
1479
1515
  interface FieldFormData {
1480
1516
  name?: string;
@@ -1561,7 +1597,7 @@ interface ChartContent {
1561
1597
  /**
1562
1598
  * All possible run content types
1563
1599
  */
1564
- type RunContent = TextContent | TabContent | BreakContent | SymbolContent | NoteReferenceContent | NoteRefMarkContent | SeparatorContent | CommentReferenceContent | FieldCharContent | InstrTextContent | SoftHyphenContent | NoBreakHyphenContent | DrawingContent | ShapeContent | ChartContent;
1600
+ type RunContent = TextContent | TabContent | BreakContent | SymbolContent | NoteReferenceContent | NoteRefMarkContent | SeparatorContent | HorizontalRuleContent | CommentReferenceContent | FieldCharContent | InstrTextContent | SoftHyphenContent | NoBreakHyphenContent | DrawingContent | ShapeContent | ChartContent;
1565
1601
  /**
1566
1602
  * A run (`w:r`) — a contiguous span of inline content sharing one set of
1567
1603
  * character properties (bold, italic, font, color, etc.). Runs are the
@@ -1603,7 +1639,7 @@ interface Run {
1603
1639
  * this union carries a `type` discriminator so consumers can narrow at
1604
1640
  * runtime.
1605
1641
  */
1606
- type ParagraphContent = Run | Hyperlink | BookmarkStart | BookmarkEnd | SimpleField | ComplexField | InlineSdt | CommentRangeStart | CommentRangeEnd | Insertion | Deletion | MoveFrom | MoveTo | MoveFromRangeStart | MoveFromRangeEnd | MoveToRangeStart | MoveToRangeEnd | MathEquation;
1642
+ type ParagraphContent = Run | Hyperlink | BookmarkStart | BookmarkEnd | SimpleField | ComplexField | InlineSdt | CommentRangeStart | CommentRangeEnd | Insertion | Deletion | MoveFrom | MoveTo | MoveFromRangeStart | MoveFromRangeEnd | MoveToRangeStart | MoveToRangeEnd | MathEquation | RawXml;
1607
1643
  /**
1608
1644
  * Paragraph (`w:p`) — the primary block-level container in a Word document.
1609
1645
  *
@@ -1918,6 +1954,8 @@ interface Image {
1918
1954
  padding?: ImagePadding;
1919
1955
  /** Source-image crop (fractional, OOXML `a:srcRect`). */
1920
1956
  crop?: ImageCrop;
1957
+ /** Picture preset geometry; undefined means rect. */
1958
+ shapeType?: string;
1921
1959
  /** Opacity in [0, 1] (OOXML `a:alphaModFix amt`). Undefined = fully opaque. */
1922
1960
  opacity?: number;
1923
1961
  /** Whether this is a decorative image */
@@ -1977,6 +2015,36 @@ interface ChartPoint {
1977
2015
  };
1978
2016
  label?: string;
1979
2017
  }
2018
+ /** Run properties from a `c:txPr`; unset fields inherit from the chart. */
2019
+ interface ChartTextProperties {
2020
+ font?: string;
2021
+ sizePt?: number;
2022
+ bold?: boolean;
2023
+ italic?: boolean;
2024
+ color?: string;
2025
+ spacingPt?: number;
2026
+ }
2027
+ /** One `c:dLbl`: an index plus the switches it overrides. */
2028
+ interface ChartPointLabel {
2029
+ index?: number;
2030
+ text?: string;
2031
+ labels: ChartDataLabels;
2032
+ }
2033
+ /** A `c:dLbls`; every switch is optional so an unset one inherits. */
2034
+ interface ChartDataLabels {
2035
+ delete?: boolean;
2036
+ showValue?: boolean;
2037
+ showCategoryName?: boolean;
2038
+ showSeriesName?: boolean;
2039
+ showPercent?: boolean;
2040
+ showLegendKey?: boolean;
2041
+ showBubbleSize?: boolean;
2042
+ separator?: string;
2043
+ position?: string;
2044
+ numberFormat?: string;
2045
+ text?: ChartTextProperties;
2046
+ points?: ChartPointLabel[];
2047
+ }
1980
2048
  interface ChartSeries {
1981
2049
  name?: string;
1982
2050
  categories: string[];
@@ -1995,6 +2063,11 @@ interface ChartSeries {
1995
2063
  color?: string;
1996
2064
  };
1997
2065
  smooth?: boolean;
2066
+ /** `c:xVal` of a scatter or bubble series. */
2067
+ xValues?: number[];
2068
+ /** `c:bubbleSize` of a bubble series. */
2069
+ bubbleSizes?: number[];
2070
+ dataLabels?: ChartDataLabels;
1998
2071
  }
1999
2072
  interface ChartAxis {
2000
2073
  id?: string;
@@ -2016,6 +2089,9 @@ interface ChartAxis {
2016
2089
  minorTickMark?: string;
2017
2090
  tickLabelPosition?: string;
2018
2091
  hidden?: boolean;
2092
+ majorGridlines?: boolean;
2093
+ minorGridlines?: boolean;
2094
+ text?: ChartTextProperties;
2019
2095
  }
2020
2096
  /** One chart-family element inside `c:plotArea`. */
2021
2097
  interface ChartPlotGroup {
@@ -2029,10 +2105,27 @@ interface ChartPlotGroup {
2029
2105
  firstSliceAngle?: number;
2030
2106
  holeSize?: number;
2031
2107
  showDataLabels?: boolean;
2108
+ /** `c:scatterStyle`. */
2109
+ scatterStyle?: 'none' | 'line' | 'lineMarker' | 'marker' | 'smooth' | 'smoothMarker';
2110
+ /** `c:radarStyle`. */
2111
+ radarStyle?: 'standard' | 'marker' | 'filled';
2112
+ /** `c:bubbleScale`, a percentage of the default bubble size. */
2113
+ bubbleScale?: number;
2114
+ /** `c:sizeRepresents`. */
2115
+ sizeRepresents?: 'area' | 'w';
2116
+ /** `c:wireframe` of a surface chart. */
2117
+ wireframe?: boolean;
2118
+ hiLowLines?: boolean;
2119
+ upDownBars?: boolean;
2120
+ /** `c:marker` of a line chart, which switches every series marker off. */
2121
+ marker?: boolean;
2122
+ dataLabels?: ChartDataLabels;
2032
2123
  }
2033
2124
  interface ChartLegend {
2034
2125
  position?: 'left' | 'right' | 'top' | 'bottom';
2035
2126
  visible?: boolean;
2127
+ /** `c:txPr` on the legend; unset fields inherit from the chart. */
2128
+ text?: ChartTextProperties;
2036
2129
  }
2037
2130
  interface Chart {
2038
2131
  type: 'chart';
@@ -2064,6 +2157,15 @@ interface Chart {
2064
2157
  decorative?: boolean;
2065
2158
  /** Stable z-order for anchored charts. Undefined = source order. */
2066
2159
  relativeHeight?: number;
2160
+ /** `c:txPr` on `c:chartSpace`: the root of chart text inheritance. */
2161
+ text?: ChartTextProperties;
2162
+ /** `c:txPr` on `c:title`. */
2163
+ titleText?: ChartTextProperties;
2164
+ /**
2165
+ * The `w:drawing` that places the chart, replayed verbatim on save. Absent
2166
+ * on package-level entries, which no drawing owns.
2167
+ */
2168
+ drawingXml?: string;
2067
2169
  }
2068
2170
 
2069
- export { type FooterReference as $, type AbstractNumbering as A, type BlockContent as B, type CellMarker as C, type DrawingScene as D, type EndnoteProperties as E, type FootnoteProperties as F, type CommentRangeEnd as G, type HeaderFooter as H, type CommentRangeStart as I, type CommentReferenceContent as J, type ComplexField as K, type ContentPosition as L, DEFAULT_WATERMARK_PRESETS as M, type NoteKind as N, type Deletion as O, type Paragraph as P, type DrawingContent as Q, type RevisionInfo as R, type SectionProperties as S, type DrawingSceneNode as T, type EndnotePosition as U, type Field as V, type Watermark as W, type FieldCharContent as X, type FieldFormData as Y, type FieldInlineContent as Z, type FieldType as _, type SdtControlState as a, type SymbolContent as a$, type FootnotePosition as a0, type HeaderFooterType as a1, type HeaderReference as a2, type Hyperlink as a3, type HyperlinkContent as a4, type Image as a5, type ImageCrop as a6, type ImageEffect as a7, type ImageHyperlink as a8, type ImagePadding as a9, type NumberingInstance as aA, type PageNumberingProperties as aB, type PageOrientation as aC, type ParagraphContent as aD, type ParagraphPropertyChange as aE, type PictureWatermark as aF, type PropertyChangeInfo as aG, type Run as aH, type RunContent as aI, type RunPropertyChange as aJ, type SdtCheckboxGlyph as aK, type SdtDataBinding as aL, type SdtDateState as aM, type SdtGalleryState as aN, type SdtType as aO, type Section as aP, type SectionStart as aQ, type SeparatorContent as aR, type Shape as aS, type ShapeContent as aT, type ShapeFillPaint as aU, type ShapeStrokePaint as aV, type ShapeTextBody as aW, type SimpleField as aX, type SoftHyphenContent as aY, type StructuredFieldContent as aZ, type StructuredFieldTree as a_, type ImagePosition as aa, type ImageRotationBounds as ab, type ImageSize as ac, type ImageTransform as ad, type ImageWrap as ae, type ImageWrapPoint as af, type InlineSdt as ag, type Insertion as ah, type InstrTextContent as ai, type LevelSuffix as aj, type LineNumberRestart as ak, type ListLevel as al, type ListRendering as am, type MathEquation as an, type MoveFrom as ao, type MoveFromRangeEnd as ap, type MoveFromRangeStart as aq, type MoveTo as ar, type MoveToRangeEnd as as, type MoveToRangeStart as at, type NoBreakHyphenContent as au, type NoteNumberRestart as av, type NoteRefMarkContent as aw, type NoteReferenceContent as ax, type NoteSeparatorReference as ay, type NumberFormat as az, type SdtProperties as b, type TabContent as b0, type Table as b1, type TableCell as b2, type TableCellPropertyChange as b3, type TablePropertyChange as b4, type TableRow as b5, type TableRowPropertyChange as b6, type TableStructuralChangeInfo as b7, type TextBox as b8, type TextContent as b9, type TextWatermark as ba, type TrackedChangeInfo as bb, type TrackedRunChange as bc, type VerticalAlign as bd, pictureWatermarkDisplayEmu as be, type ShapeEffect as c, type ShapeTextBodyProperties as d, type Chart as e, type Comment as f, type DocumentBody as g, type NumberingDefinitions as h, type Footnote as i, type Endnote as j, type BookmarkRange as k, type BlockSdt as l, type BookmarkEnd as m, type BookmarkStart as n, type BreakContent as o, type ChartAxis as p, type ChartContent as q, type ChartGrouping as r, type ChartLegend as s, type ChartPlotGroup as t, type ChartPoint as u, type ChartSeries as v, type ChartType as w, type Column as x, type CommentAnchorRange as y, type CommentAuthor as z };
2171
+ export { type FieldInlineContent as $, type AbstractNumbering as A, type BlockContent as B, type CellMarker as C, type DrawingScene as D, type EndnoteProperties as E, type FootnoteProperties as F, type CommentAnchorRange as G, type HeaderFooter as H, type CommentAuthor as I, type CommentRangeEnd as J, type CommentRangeStart as K, type CommentReferenceContent as L, type ComplexField as M, type NoteKind as N, type ContentPosition as O, type Paragraph as P, DEFAULT_WATERMARK_PRESETS as Q, type RevisionInfo as R, type SdtControlState as S, type Deletion as T, type DrawingContent as U, type DrawingSceneNode as V, type Watermark as W, type EndnotePosition as X, type Field as Y, type FieldCharContent as Z, type FieldFormData as _, type SdtProperties as a, type SoftHyphenContent as a$, type FieldType as a0, type FooterReference as a1, type FootnotePosition as a2, type HeaderFooterType as a3, type HeaderReference as a4, type HorizontalRuleContent as a5, type Hyperlink as a6, type HyperlinkContent as a7, type Image as a8, type ImageCrop as a9, type NoteReferenceContent as aA, type NoteSeparatorReference as aB, type NumberFormat as aC, type NumberingInstance as aD, type PageNumberingProperties as aE, type PageOrientation as aF, type ParagraphContent as aG, type ParagraphPropertyChange as aH, type PictureWatermark as aI, type PropertyChangeInfo as aJ, type Run as aK, type RunContent as aL, type RunPropertyChange as aM, type SdtCheckboxGlyph as aN, type SdtDataBinding as aO, type SdtDateState as aP, type SdtGalleryState as aQ, type SdtType as aR, type Section as aS, type SectionStart as aT, type SeparatorContent as aU, type Shape as aV, type ShapeContent as aW, type ShapeFillPaint as aX, type ShapeStrokePaint as aY, type ShapeTextBody as aZ, type SimpleField as a_, type ImageEffect as aa, type ImageHyperlink as ab, type ImagePadding as ac, type ImagePosition as ad, type ImageRotationBounds as ae, type ImageSize as af, type ImageTransform as ag, type ImageWrap as ah, type ImageWrapPoint as ai, type InlineSdt as aj, type Insertion as ak, type InstrTextContent as al, type LevelSuffix as am, type LineNumberRestart as an, type ListLevel as ao, type ListRendering as ap, type MathEquation as aq, type MoveFrom as ar, type MoveFromRangeEnd as as, type MoveFromRangeStart as at, type MoveTo as au, type MoveToRangeEnd as av, type MoveToRangeStart as aw, type NoBreakHyphenContent as ax, type NoteNumberRestart as ay, type NoteRefMarkContent as az, type ShapeEffect as b, type StructuredFieldContent as b0, type StructuredFieldTree as b1, type SymbolContent as b2, type TabContent as b3, type Table as b4, type TableCell as b5, type TableCellPropertyChange as b6, type TablePropertyChange as b7, type TableRow as b8, type TableRowPropertyChange as b9, type TableStructuralChangeInfo as ba, type TextBox as bb, type TextContent as bc, type TextWatermark as bd, type TrackedChangeInfo as be, type TrackedRunChange as bf, type VerticalAlign as bg, pictureWatermarkDisplayEmu as bh, type RawXml as bi, type ShapeTextBodyProperties as c, type Chart as d, type Comment as e, type SectionProperties as f, type DocumentBody as g, type NumberingDefinitions as h, type Footnote as i, type Endnote as j, type BookmarkRange as k, type BlockSdt as l, type BookmarkEnd as m, type BookmarkStart as n, type BreakContent as o, type ChartAxis as p, type ChartContent as q, type ChartDataLabels as r, type ChartGrouping as s, type ChartLegend as t, type ChartPlotGroup as u, type ChartPoint as v, type ChartPointLabel as w, type ChartSeries as x, type ChartType as y, type Column as z };
package/dist/core.d.mts CHANGED
@@ -1,15 +1,15 @@
1
- export { a as attemptSelectiveSave, c as createDocx, p as parseDocx, r as repackDocx, u as updateMultipleFiles } from './selectiveSave-CVoajSKE.mjs';
1
+ export { a as attemptSelectiveSave, c as createDocx, p as parseDocx, r as repackDocx, u as updateMultipleFiles } from './selectiveSave-CRh-_Y_C.mjs';
2
2
  import { Document } from './types/document.mjs';
3
3
  export { DocxPackage } from './types/document.mjs';
4
- import { g as DocumentBody, S as SectionProperties, b1 as Table } from './content-C3sTRz-u.mjs';
5
- export { B as BlockContent, m as BookmarkEnd, n as BookmarkStart, f as Comment, G as CommentRangeEnd, I as CommentRangeStart, O as Deletion, j as Endnote, V as Field, $ as FooterReference, i as Footnote, H as HeaderFooter, a2 as HeaderReference, a3 as Hyperlink, a5 as Image, ah as Insertion, al as ListLevel, ao as MoveFrom, ar as MoveTo, h as NumberingDefinitions, P as Paragraph, aD as ParagraphContent, aH as Run, aI as RunContent, aS as Shape, b2 as TableCell, b5 as TableRow, b8 as TextBox, b9 as TextContent, bb as TrackedChangeInfo, bc as TrackedRunChange } from './content-C3sTRz-u.mjs';
4
+ import { g as DocumentBody, f as SectionProperties, b4 as Table } from './content-CvEtPl0c.mjs';
5
+ export { B as BlockContent, m as BookmarkEnd, n as BookmarkStart, e as Comment, J as CommentRangeEnd, K as CommentRangeStart, T as Deletion, j as Endnote, Y as Field, a1 as FooterReference, i as Footnote, H as HeaderFooter, a4 as HeaderReference, a6 as Hyperlink, a8 as Image, ak as Insertion, ao as ListLevel, ar as MoveFrom, au as MoveTo, h as NumberingDefinitions, P as Paragraph, aG as ParagraphContent, aK as Run, aL as RunContent, aV as Shape, b5 as TableCell, b8 as TableRow, bb as TextBox, bc as TextContent, be as TrackedChangeInfo, bf as TrackedRunChange } from './content-CvEtPl0c.mjs';
6
6
  export { emuToPixels, emuToTwips, formatPx, halfPointsToPixels, pixelsToEmu, pixelsToTwips, pointsToPixels, twipsToEmu, twipsToPixels } from './utils/units.mjs';
7
- export { T as ThemeMatrixCell, b as blendColors, c as canRenderFont, a as colorsEqual, d as createRgbColor, e as createThemeColor, f as darkenColor, g as ensureHexPrefix, h as generateThemeTintShadeMatrix, i as getContrastingColor, j as getLoadedFonts, k as getThemeTintShadeHex, l as isBlack, m as isFontLoaded, n as isFontsLoading, o as isGoogleFontsEnabled, p as isWhite, q as lightenColor, r as loadFont, s as loadFontFromBuffer, t as loadFonts, u as onFontsLoaded, v as parseColorString, w as preloadCommonFonts, x as resolveColor, y as resolveHighlightColor, z as resolveHighlightToCss, A as resolveShadingColor, B as setGoogleFontsEnabled } from './fontLoader-CMH3bZ2Z.mjs';
7
+ export { T as ThemeMatrixCell, b as blendColors, c as canRenderFont, a as colorsEqual, d as createRgbColor, e as createThemeColor, f as darkenColor, g as ensureHexPrefix, h as generateThemeTintShadeMatrix, i as getContrastingColor, j as getLoadedFonts, k as getThemeTintShadeHex, l as isBlack, m as isFontLoaded, n as isFontsLoading, o as isGoogleFontsEnabled, p as isWhite, q as lightenColor, r as loadFont, s as loadFontFromBuffer, t as loadFonts, u as onFontsLoaded, v as parseColorString, w as preloadCommonFonts, x as resolveColor, y as resolveHighlightColor, z as resolveHighlightToCss, A as resolveShadingColor, B as setGoogleFontsEnabled } from './fontLoader-b8eicJKV.mjs';
8
8
  export { D as DocxInput, t as toArrayBuffer } from './docxInput-DTbCa48g.mjs';
9
9
  export { EditorPluginCore, PanelConfig, PluginPanelProps, PositionCoordinates, RenderedDomContext } from './plugin-api/index.mjs';
10
- export { B as BlockExtent, F as FootnoteContent, a as Layout, L as LayoutBlock, P as Page, R as ResolvedLine, c as ResolvedSegment } from './types-C1rv3KM-.mjs';
11
- export { a as ParagraphFormatting, b as TextFormatting, f as Theme, x as ThemeColorScheme, z as ThemeFont, A as ThemeFontScheme } from './formatting-BEkIBePP.mjs';
12
- export { d as Relationship, a as Style, S as StyleDefinitions } from './styles-BK3Jecxs.mjs';
10
+ export { B as BlockExtent, F as FootnoteContent, L as Layout, b as LayoutBlock, P as Page, R as ResolvedLine, c as ResolvedSegment } from './types-C4A8mWjU.mjs';
11
+ export { a as ParagraphFormatting, b as TextFormatting, f as Theme, x as ThemeColorScheme, z as ThemeFont, A as ThemeFontScheme } from './formatting-7zKCTu5a.mjs';
12
+ export { d as Relationship, a as Style, S as StyleDefinitions } from './styles-7e-mq3c-.mjs';
13
13
  import './docx/wrapTypes.mjs';
14
14
 
15
15
  /**
@@ -253,6 +253,6 @@ declare class ErrorManager extends Subscribable<ErrorManagerSnapshot> {
253
253
  * @packageDocumentation
254
254
  * @public
255
255
  */
256
- declare const VERSION = "0.0.2";
256
+ declare const VERSION: string;
257
257
 
258
258
  export { type CellCoordinates, Document, DocumentBody, ErrorManager, type ErrorManagerSnapshot, type ErrorNotification, type ErrorSeverity, type PrintOptions, SectionProperties, Subscribable, TABLE_DATA_ATTRIBUTES, Table, TableSelectionManager, type TableSelectionSnapshot, VERSION, deleteTableFromDocument, findTableFromClick, formatPageRange, getDefaultPrintOptions, getTableFromDocument, isPrintSupported, openPrintWindow, parsePageRange, serializeDocumentBody, serializeDocument as serializeDocx, serializeSectionProperties, triggerPrint, updateTableInDocument };
package/dist/core.mjs CHANGED
@@ -1 +1 @@
1
- export{i as attemptSelectiveSave,h as createDocx,a as parseDocx,f as repackDocx,c as serializeDocumentBody,b as serializeDocx,d as serializeSectionProperties,g as updateMultipleFiles}from'./chunk-NTSSE5QK.mjs';export{f as blendColors,r as colorsEqual,o as createRgbColor,n as createThemeColor,d as darkenColor,p as ensureHexPrefix,h as generateThemeTintShadeMatrix,c as getContrastingColor,g as getThemeTintShadeHex,k as isBlack,l as isWhite,e as lightenColor,m as parseColorString,a as resolveColor,i as resolveHighlightColor,q as resolveHighlightToCss,j as resolveShadingColor}from'./chunk-LTVVQMHB.mjs';export{b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,c as pixelsToEmu,h as pixelsToTwips,d as pointsToPixels,j as twipsToEmu,g as twipsToPixels}from'./chunk-CTBUQRYQ.mjs';export{n as canRenderFont,k as getLoadedFonts,g as isFontLoaded,j as isFontsLoading,i as isGoogleFontsEnabled,e as loadFont,o as loadFontFromBuffer,f as loadFonts,l as onFontsLoaded,v as preloadCommonFonts,h as setGoogleFontsEnabled,a as toArrayBuffer}from'./chunk-YTILOUAA.mjs';import'./chunk-6KDV6AIL.mjs';import'./chunk-NJHOPXZW.mjs';import'./chunk-B4IR6YP4.mjs';import'./chunk-T4EZMUXM.mjs';import {b as b$1}from'./chunk-TTRUPDAB.mjs';var ce={includeHeaders:true,includeFooters:true,includePageNumbers:true,pageRange:null,scale:1,printBackground:true,margins:"default"};function me(){return {...ce}}function de(){typeof window<"u"&&window.print();}var fe="@media print { body { margin: 0; padding: 0; } @page { margin: 0; } }";function ge(t="Document",r){if(typeof window>"u")return null;let e=window.open("","_blank");if(!e)return null;e.opener=null;let n=e.document;n.title=t;let o=n.createElement("style");o.textContent=fe,n.head.appendChild(o);let i=new DOMParser().parseFromString(r,"text/html");for(let l of Array.from(i.body.childNodes))n.body.appendChild(n.importNode(l,true));return e}function he(t,r){if(!t||!t.trim())return null;let e=t.trim();if(/^\d+$/.test(e)){let o=parseInt(e,10);return o>=1&&o<=r?{start:o,end:o}:null}let n=e.match(/^(\d+)-(\d+)$/);if(n){let o=parseInt(n[1],10),i=parseInt(n[2],10);if(o>=1&&i<=r&&o<=i)return {start:o,end:i}}return null}function Te(t,r){return t?t.start===t.end?`Page ${t.start}`:`Pages ${t.start}-${t.end}`:`All (${r} pages)`}function be(){return typeof window<"u"&&typeof window.print=="function"}var s=class{constructor(r){b$1(this,"listeners",new Set);b$1(this,"snapshot");b$1(this,"subscribe",r=>(this.listeners.add(r),()=>{this.listeners.delete(r);}));b$1(this,"getSnapshot",()=>this.snapshot);this.snapshot=r;}setSnapshot(r){this.snapshot=r,this.notify();}notify(){for(let r of this.listeners)r();}};var c={TABLE_INDEX:"data-table-index",ROW_INDEX:"data-row",COLUMN_INDEX:"data-col",TABLE_CELL:"data-table-cell"};function g(t,r){if(!(t instanceof Element))return null;let e=t;for(;e&&e!==r;){if(e.tagName==="TD"||e.tagName==="TH"){let n=e.getAttribute(c.ROW_INDEX),o=e.getAttribute(c.COLUMN_INDEX);if(n!==null&&o!==null){let i=e;for(;i&&i!==r;){if(i.tagName==="TABLE"){let l=i.getAttribute(c.TABLE_INDEX);if(l!==null)return {tableIndex:parseInt(l,10),rowIndex:parseInt(n,10),columnIndex:parseInt(o,10)};break}i=i.parentElement;}}break}e=e.parentElement;}return null}function h(t,r){if(!t.package?.document?.content)return null;let e=0;for(let n of t.package.document.content)if(n.type==="table"){if(e===r)return n;e++;}return null}function T(t,r,e){if(!t.package?.document?.content)return t;let n=0,o=t.package.document.content.map(i=>{if(i.type==="table"){if(n===r)return n++,e;n++;}return i});return {...t,package:{...t.package,document:{...t.package.document,content:o}}}}function b(t,r){if(!t.package?.document?.content)return t;let e=0,n=t.package.document.content.filter(o=>{if(o.type==="table"){let i=e===r;return e++,!i}return true});return {...t,package:{...t.package,document:{...t.package.document,content:n}}}}var m=class extends s{constructor(){super({selectedCell:null});}selectCell(r){this.setSnapshot({selectedCell:r});}clearSelection(){this.setSnapshot({selectedCell:null});}isCellSelected(r,e,n){let{selectedCell:o}=this.getSnapshot();return o?o.tableIndex===r&&o.rowIndex===e&&o.columnIndex===n:false}getSelectedCell(){return this.getSnapshot().selectedCell}};var d=class extends s{constructor(){super({notifications:[]});b$1(this,"notifications",[]);b$1(this,"idCounter",0);b$1(this,"timers",new Set);}showError(e,n){return this.addNotification(e,"error",n)}showWarning(e,n){return this.addNotification(e,"warning",n)}showInfo(e,n){return this.addNotification(e,"info",n)}dismiss(e){this.notifications=this.notifications.map(o=>o.id===e?{...o,dismissed:true}:o),this.emitSnapshot();let n=setTimeout(()=>{this.timers.delete(n),this.notifications=this.notifications.filter(o=>o.id!==e),this.emitSnapshot();},300);this.timers.add(n);}clearAll(){this.notifications=[];for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.emitSnapshot();}destroy(){for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.notifications=[];}addNotification(e,n,o){let i=`error-${++this.idCounter}-${Date.now()}`,l={id:i,message:e,severity:n,details:o,timestamp:Date.now()};if(this.notifications=[...this.notifications,l],this.emitSnapshot(),n!=="error"){let f=setTimeout(()=>{this.timers.delete(f),this.dismiss(i);},5e3);this.timers.add(f);}return i}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};var Me="0.0.2";export{d as ErrorManager,s as Subscribable,c as TABLE_DATA_ATTRIBUTES,m as TableSelectionManager,Me as VERSION,b as deleteTableFromDocument,g as findTableFromClick,Te as formatPageRange,me as getDefaultPrintOptions,h as getTableFromDocument,be as isPrintSupported,ge as openPrintWindow,he as parsePageRange,de as triggerPrint,T as updateTableInDocument};
1
+ export{i as attemptSelectiveSave,h as createDocx,a as parseDocx,f as repackDocx,c as serializeDocumentBody,b as serializeDocx,d as serializeSectionProperties,g as updateMultipleFiles}from'./chunk-AFMVSI4Z.mjs';export{f as blendColors,r as colorsEqual,o as createRgbColor,n as createThemeColor,d as darkenColor,p as ensureHexPrefix,h as generateThemeTintShadeMatrix,c as getContrastingColor,g as getThemeTintShadeHex,k as isBlack,l as isWhite,e as lightenColor,m as parseColorString,a as resolveColor,i as resolveHighlightColor,q as resolveHighlightToCss,j as resolveShadingColor}from'./chunk-LTVVQMHB.mjs';export{b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,c as pixelsToEmu,h as pixelsToTwips,d as pointsToPixels,j as twipsToEmu,g as twipsToPixels}from'./chunk-CTBUQRYQ.mjs';export{n as canRenderFont,k as getLoadedFonts,g as isFontLoaded,j as isFontsLoading,i as isGoogleFontsEnabled,e as loadFont,o as loadFontFromBuffer,f as loadFonts,l as onFontsLoaded,v as preloadCommonFonts,h as setGoogleFontsEnabled,a as toArrayBuffer}from'./chunk-JHJLG4I6.mjs';import'./chunk-6LQJAKOC.mjs';import'./chunk-HLDJMU3R.mjs';import'./chunk-ACGKK7IB.mjs';import'./chunk-5F6DLQZP.mjs';import {b as b$1}from'./chunk-TTRUPDAB.mjs';var g="0.2.0";var ct={includeHeaders:true,includeFooters:true,includePageNumbers:true,pageRange:null,scale:1,printBackground:true,margins:"default"};function ft(){return {...ct}}function gt(){typeof window<"u"&&window.print();}var yt="@media print { body { margin: 0; padding: 0; } @page { margin: 0; } }";function xt(e="Document",s){if(typeof window>"u")return null;let t=window.open("","_blank");if(!t)return null;t.opener=null;let i=t.document;i.title=e;let o=i.createElement("style");o.textContent=yt,i.head.appendChild(o);let n=new DOMParser().parseFromString(s,"text/html");for(let l of Array.from(n.body.childNodes))i.body.appendChild(i.importNode(l,true));return t}function ht(e,s){if(!e||!e.trim())return null;let t=e.trim();if(/^\d+$/.test(t)){let o=parseInt(t,10);return o>=1&&o<=s?{start:o,end:o}:null}let i=t.match(/^(\d+)-(\d+)$/);if(i){let o=parseInt(i[1],10),n=parseInt(i[2],10);if(o>=1&&n<=s&&o<=n)return {start:o,end:n}}return null}function bt(e,s){return e?e.start===e.end?`Page ${e.start}`:`Pages ${e.start}-${e.end}`:`All (${s} pages)`}function Tt(){return typeof window<"u"&&typeof window.print=="function"}var a=class{constructor(s){b$1(this,"listeners",new Set);b$1(this,"snapshot");b$1(this,"subscribe",s=>(this.listeners.add(s),()=>{this.listeners.delete(s);}));b$1(this,"getSnapshot",()=>this.snapshot);this.snapshot=s;}setSnapshot(s){this.snapshot=s,this.notify();}notify(){for(let s of this.listeners)s();}};var m={TABLE_INDEX:"data-table-index",ROW_INDEX:"data-row",COLUMN_INDEX:"data-col",TABLE_CELL:"data-table-cell"};function y(e,s){if(!(e instanceof Element))return null;let t=e;for(;t&&t!==s;){if(t.tagName==="TD"||t.tagName==="TH"){let i=t.getAttribute(m.ROW_INDEX),o=t.getAttribute(m.COLUMN_INDEX);if(i!==null&&o!==null){let n=t;for(;n&&n!==s;){if(n.tagName==="TABLE"){let l=n.getAttribute(m.TABLE_INDEX);if(l!==null)return {tableIndex:parseInt(l,10),rowIndex:parseInt(i,10),columnIndex:parseInt(o,10)};break}n=n.parentElement;}}break}t=t.parentElement;}return null}function x(e,s){if(!e.package?.document?.content)return null;let t=0;for(let i of e.package.document.content)if(i.type==="table"){if(t===s)return i;t++;}return null}function h(e,s,t){if(!e.package?.document?.content)return e;let i=0,o=e.package.document.content.map(n=>{if(n.type==="table"){if(i===s)return i++,t;i++;}return n});return {...e,package:{...e.package,document:{...e.package.document,content:o}}}}function b(e,s){if(!e.package?.document?.content)return e;let t=0,i=e.package.document.content.filter(o=>{if(o.type==="table"){let n=t===s;return t++,!n}return true});return {...e,package:{...e.package,document:{...e.package.document,content:i}}}}var u=class extends a{constructor(){super({selectedCell:null});}selectCell(s){this.setSnapshot({selectedCell:s});}clearSelection(){this.setSnapshot({selectedCell:null});}isCellSelected(s,t,i){let{selectedCell:o}=this.getSnapshot();return o?o.tableIndex===s&&o.rowIndex===t&&o.columnIndex===i:false}getSelectedCell(){return this.getSnapshot().selectedCell}};var c=class extends a{constructor(){super({notifications:[]});b$1(this,"notifications",[]);b$1(this,"idCounter",0);b$1(this,"timers",new Set);}showError(t,i){return this.addNotification(t,"error",i)}showWarning(t,i){return this.addNotification(t,"warning",i)}showInfo(t,i){return this.addNotification(t,"info",i)}dismiss(t){this.notifications=this.notifications.map(o=>o.id===t?{...o,dismissed:true}:o),this.emitSnapshot();let i=setTimeout(()=>{this.timers.delete(i),this.notifications=this.notifications.filter(o=>o.id!==t),this.emitSnapshot();},300);this.timers.add(i);}clearAll(){this.notifications=[];for(let t of this.timers)clearTimeout(t);this.timers.clear(),this.emitSnapshot();}destroy(){for(let t of this.timers)clearTimeout(t);this.timers.clear(),this.notifications=[];}addNotification(t,i,o){let n=`error-${++this.idCounter}-${Date.now()}`,l={id:n,message:t,severity:i,details:o,timestamp:Date.now()};if(this.notifications=[...this.notifications,l],this.emitSnapshot(),i!=="error"){let f=setTimeout(()=>{this.timers.delete(f),this.dismiss(n);},5e3);this.timers.add(f);}return n}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};var Wt=g;export{c as ErrorManager,a as Subscribable,m as TABLE_DATA_ATTRIBUTES,u as TableSelectionManager,Wt as VERSION,b as deleteTableFromDocument,y as findTableFromClick,bt as formatPageRange,ft as getDefaultPrintOptions,x as getTableFromDocument,Tt as isPrintSupported,xt as openPrintWindow,ht as parsePageRange,gt as triggerPrint,h as updateTableInDocument};
@@ -1,5 +1,5 @@
1
- import { I as ImagePrimitive, D as DisplayList } from './frameDelta-B2kC6XiP.mjs';
2
- import { R as RustDisplayListQueryEngine } from './rustDisplayList-B0M2eBkU.mjs';
1
+ import { I as ImagePrimitive, D as DisplayList } from './frameDelta-pA4jrQ1G.mjs';
2
+ import { R as RustDisplayListQueryEngine } from './rustDisplayList-BJqaN9tt.mjs';
3
3
 
4
4
  /**
5
5
  * Locate an image primitive in a built DisplayList by its document position.
@@ -8,14 +8,13 @@ import { R as RustDisplayListQueryEngine } from './rustDisplayList-B0M2eBkU.mjs'
8
8
  * rect to place its resize handles, and on the canvas path the painted DOM
9
9
  * image (`.layout-run-image`) is parked/hidden — its rect is unusable. The
10
10
  * display list carries every inline image as an `ImagePrimitive` stamped with
11
- * `docStart` (= the image atom's PM position, the same value the DOM path reads
11
+ * `docStart` (= the image atom's document position, the same value the DOM path reads
12
12
  * from `data-doc-start`), so the primitive found here is the geometry source
13
13
  * that replaces `imageInfo.element.getBoundingClientRect()`.
14
14
  *
15
15
  * Body primitives only: header/footer image primitives carry doc positions in a
16
- * different PM doc (the HF editor), so a body image pmPos must never match one.
16
+ * different doc (the HF editor), so a body image pmPos must never match one.
17
17
  *
18
- * @experimental part of the rust-canvas-engine change; shape may evolve.
19
18
  */
20
19
 
21
20
  type DisplayListImageRegion = 'body' | 'header' | 'footer';
@@ -23,15 +22,15 @@ interface LocatedImagePrimitive {
23
22
  primitive: ImagePrimitive;
24
23
  /** page the primitive paints on (page-local px are relative to this page) */
25
24
  pageIndex: number;
26
- /** PM-document region containing the image. Undefined reads as body. */
25
+ /** Document region containing the image. Undefined reads as body. */
27
26
  region?: DisplayListImageRegion;
28
27
  /** Header/footer relationship id when `region` is not body. */
29
28
  rId?: string;
30
29
  }
31
30
  /**
32
31
  * First body image primitive whose `docStart` equals `pos`, or null. `pos` is
33
- * the image node's PM position (a NodeSelection's `from`, or the left edge of a
34
- * one-atom TextSelection).
32
+ * the image node's document position (a node selection's `from`, or the left
33
+ * edge of a one-atom text selection).
35
34
  */
36
35
  declare function findImagePrimitiveByDocPos(list: DisplayList, pos: number, region?: DisplayListImageRegion, rId?: string): LocatedImagePrimitive | null;
37
36
  /** Topmost positioned image under a page-local point, or null. */
@@ -49,67 +48,93 @@ declare function captureInlinePositionEmuFromDisplayList(queries: DisplayListQue
49
48
  } | undefined;
50
49
 
51
50
  /**
52
- * Synchronous query facade over a built DisplayList, backed by the Rust
51
+ * Synchronous query facade over one built DisplayList, backed by the Rust
53
52
  * hit-testing module (`crates/docx-layout/src/hit.rs`).
54
53
  *
55
- * This is the sole pointer/selection geometry source for the canvas
56
- * renderer (it replaced the deleted painted-DOM resolvers): geometry comes
57
- * from the immutable display list, never from DOM rects.
54
+ * This is the canvas renderer's only source of pointer and selection geometry:
55
+ * every rect comes from the immutable display list, never from DOM rects. A
56
+ * facade is created per display-list build, since the list never mutates in
57
+ * place, and it holds no state a caller has to keep in sync.
58
58
  *
59
- * Perf model: when the embedded wasm carries the session-handle exports, this
60
- * facade parses the display list into the Rust store exactly ONCE
61
- * (`openDisplayList` → handle) and routes every hit-test / range-rect query
62
- * through the by-handle exports — no per-query re-serialization or re-parse.
63
- * The handle is acquired LAZILY: at the first query that needs it, or when the
64
- * host calls `prime()` from idle time. Keystroke-driven facade replacement
65
- * therefore costs no serialization on the input path; superseded generations
66
- * chain their adoption donor so a deferred pickup still ships one page-delta
67
- * instead of a full re-open. When the session exports are absent (before the
68
- * integrator re-embeds the wasm) it falls back to the JSON-arg exports,
69
- * stringifying the list once and reusing the string for every query. Either
70
- * way the query RESULTS are byte-identical — the handle path is pure perf.
59
+ * **Two sources.** A resident editing engine queries its own display list
60
+ * directly and takes no display-list JSON at all. Otherwise the shared layout
61
+ * wasm answers, and the facade prefers a SESSION HANDLE: the list is parsed
62
+ * into the Rust store once (`openDisplayList`) and every later query goes by
63
+ * handle, with no per-query re-serialization. When the session exports are
64
+ * absent it stringifies the list once and reuses that string for the JSON-arg
65
+ * exports. The two paths run the same hit and range logic, so results are
66
+ * byte-identical and only the cost differs.
71
67
  *
72
- * Handle lifecycle: the handle is opened once per facade (per display-list
73
- * build) and released by `dispose()`. Callers that drop the facade without
74
- * disposing (e.g. a React `useMemo` replacement) are covered by a
75
- * `FinalizationRegistry` that closes the handle when the facade is collected;
76
- * the Rust store additionally caps live handles and evicts the oldest, so a
77
- * missed finalize can never grow memory unbounded.
68
+ * **Handle acquisition is lazy** — on the first query that needs one, or when
69
+ * a host calls `prime()` from idle time — so replacing the facade on every
70
+ * keystroke costs no serialization on the input path. A new facade also tries
71
+ * to ADOPT its predecessor's parsed list, shipping a page delta for the pages
72
+ * that changed instead of reopening the whole list; superseded generations
73
+ * chain their donor, so a deferred pickup still costs one delta. The donor's
74
+ * own later queries degrade to its JSON-arg path.
78
75
  *
79
- * Queries are synchronous; until the lazily-imported wasm module resolves they
80
- * return `null`/`[]`. In practice the module is already loaded by the time a
81
- * queries instance exists, because building the display list itself went
82
- * through the same module (`loadRustDisplayListQueryEngine` shares the promise
83
- * with `buildRustDisplayList`).
76
+ * **Handle release.** `dispose()` frees the handle immediately. A facade
77
+ * dropped without it — a `useMemo` replacement, say — is covered by a
78
+ * `FinalizationRegistry`, and the Rust store additionally caps live handles
79
+ * and evicts the oldest, so a missed finalize cannot grow memory without
80
+ * bound.
84
81
  *
85
- * @experimental part of the rust-canvas-engine change; shape may evolve.
82
+ * **Failure.** A wasm TRAP poisons the whole instance: a guard held across the
83
+ * query leaks and every later call into it fails, so the engine is marked dead,
84
+ * all queries stop, and `onDisplayListQuerySourceFailure` subscribers are told
85
+ * to rebuild the session. An ordinary error just falls back — a bad handle is
86
+ * dropped and the query retried over JSON.
87
+ *
88
+ * Queries are synchronous and return `null`/`[]` until the lazily imported
89
+ * wasm module resolves. In practice it is already loaded by the time a facade
90
+ * exists, because building the display list went through the same module.
86
91
  */
87
92
 
88
- /** Query surface implemented by the editing wasm over its resident list. */
93
+ /**
94
+ * Query surface of an editing engine that already holds the display list.
95
+ * None of these take display-list JSON, so this source never opens a handle
96
+ * and never serializes anything.
97
+ */
89
98
  interface ResidentDisplayListQueryEngine {
90
99
  displayHitTestRegionsJson(pageIndex: number, x: number, y: number): string;
91
100
  displayVerticalMoveJson(position: number, direction: 'up' | 'down', goalX: number): string;
92
101
  displayRangeRectsJson(from: number, to: number): string;
93
- displayRangeRectsRegionJson(region: 'body' | 'header' | 'footer', rId: string, from: number, to: number): string;
102
+ displayRangeRectsRegionJson(region: DisplayListHitRegion, partId: string, from: number, to: number): string;
94
103
  }
95
104
  /** which part of a page owns a hit — mirrors `HitRegion` in hit.rs */
96
- type DisplayListHitRegion = 'body' | 'header' | 'footer';
105
+ type DisplayListHitRegion = 'body' | 'header' | 'footer' | 'footnote' | 'endnote';
106
+ /**
107
+ * What a click at a hit point would act on — mirrors `HoverTarget` in hit.rs.
108
+ * `'text'` is the typeable area (a run's box, or the content box around it),
109
+ * which is what a pointer cursor keys off; `pos` cannot say, since it resolves
110
+ * everywhere on a page that carries text.
111
+ */
112
+ type DisplayListHoverTarget = 'text' | 'image' | 'none';
97
113
  /**
98
114
  * Region-aware hit result. For `header`/`footer` the position refers to the
99
- * HF ProseMirror doc identified by `rId`, NOT the body doc — the caller must
100
- * route the selection to that HF editor, exactly like the DOM path scopes
101
- * clicks to `.layout-page-header|footer`.
115
+ * header/footer document identified by `rId`, and for `footnote`/`endnote` to
116
+ * the note story named by `noteId` — NOT the body document, so the caller must
117
+ * route the selection to that editor. `pos` is null when the point is inside
118
+ * the region but resolves to no position.
102
119
  */
103
120
  interface DisplayListRegionHit {
104
121
  region: DisplayListHitRegion;
105
122
  rId?: string;
123
+ /** note whose story a `footnote`/`endnote` position addresses */
124
+ noteId?: number;
106
125
  pos: number | null;
126
+ /** Absent from a wasm build predating it; read that as "not text". */
127
+ target?: DisplayListHoverTarget;
107
128
  }
129
+ /**
130
+ * Result of an up/down caret move. `goalX` is the page-local x to feed back
131
+ * into the next move so a run of them holds one column.
132
+ */
108
133
  interface DisplayListVerticalMove {
109
134
  position: number;
110
135
  goalX: number;
111
136
  }
112
- /** one highlight rectangle of a PM range, page-local px */
137
+ /** one highlight rectangle of a document range, page-local px */
113
138
  interface DisplayListRect {
114
139
  pageIndex: number;
115
140
  x: number;
@@ -174,23 +199,30 @@ interface DisplayListQueries {
174
199
  /** Visual line containing `pos`, or null. */
175
200
  visualLineAtPosition(pos: number): DisplayListVisualLine | null;
176
201
  /** Topmost image under a page-local point. Body by default. */
177
- imageAtPoint(pageIndex: number, x: number, y: number, region?: DisplayListHitRegion, rId?: string): DisplayListImageGeometry | null;
202
+ imageAtPoint(pageIndex: number, x: number, y: number, region?: DisplayListImageRegion, rId?: string): DisplayListImageGeometry | null;
178
203
  /** Image whose atom starts at `pos`. Body by default. */
179
- imageByPos(pos: number, region?: DisplayListHitRegion, rId?: string): DisplayListImageGeometry | null;
204
+ imageByPos(pos: number, region?: DisplayListImageRegion, rId?: string): DisplayListImageGeometry | null;
180
205
  /** region-aware point → doc position (page-local coordinates) */
181
206
  hitTestRegions(pageIndex: number, x: number, y: number): DisplayListRegionHit | null;
182
207
  verticalMove(position: number, direction: 'up' | 'down', goalX?: number): DisplayListVerticalMove | null;
183
- /** body PM range → highlight rects */
208
+ /** body document range → highlight rects */
184
209
  rangeRects(from: number, to: number): DisplayListRect[];
185
210
  /**
186
- * Header/footer PM range → highlight rects for the region's band. `region` is
187
- * `'header' | 'footer'`; `rId` identifies the HF ProseMirror doc, and
211
+ * Header/footer document range → highlight rects for the region's band. `region` is
212
+ * `'header' | 'footer'`; `rId` identifies the HF doc, and
188
213
  * `from`/`to` are positions in THAT doc. The same HF doc paints on every page
189
214
  * carrying the part, so this returns one rect-set per such page (each tagged
190
215
  * with its `pageIndex`) — the caller picks the page it is editing. Returns
191
- * `[]` until the region-aware exports are embedded (feature-detected).
216
+ * `[]` when the region-aware exports are absent, which is feature-detected.
192
217
  */
193
218
  hfRangeRects(region: 'header' | 'footer', rId: string, from: number, to: number): DisplayListRect[];
219
+ /**
220
+ * Note document range → highlight rects for that note's story. `from`/`to`
221
+ * are positions in the `fn:{noteId}` / `en:{noteId}` document, never the
222
+ * body's. A note paints on one page only, so every rect shares its
223
+ * `pageIndex`.
224
+ */
225
+ noteRangeRects(region: 'footnote' | 'endnote', noteId: number, from: number, to: number): DisplayListRect[];
194
226
  /**
195
227
  * Caret geometry for a collapsed HF selection — the HF twin of `caretRect`.
196
228
  * Resolves `[pos, pos+1)` in the HF doc (left edge is the caret), falling back
@@ -198,6 +230,11 @@ interface DisplayListQueries {
198
230
  * caret rect per page carrying the part; the caller picks the edited page.
199
231
  */
200
232
  hfCaretRects(region: 'header' | 'footer', rId: string, pos: number): DisplayListRect[];
233
+ /**
234
+ * Caret geometry for a collapsed selection in a note story — the note twin of
235
+ * `hfCaretRects`. A note paints on one page, so this returns at most one rect.
236
+ */
237
+ noteCaretRects(region: 'footnote' | 'endnote', noteId: number, pos: number): DisplayListRect[];
201
238
  /** Header/footer sidebar anchors, one per page carrying the part. */
202
239
  hfAnchorRects(region: 'header' | 'footer', rId: string, pos: number): DisplayListRect[];
203
240
  /**
@@ -248,4 +285,4 @@ declare function onDisplayListQuerySourceFailure(listener: (error: Error) => voi
248
285
  */
249
286
  declare function createDisplayListQueries(list: DisplayList, engine?: RustDisplayListQueryEngine | ResidentDisplayListQueryEngine, previous?: DisplayListQueries | null): DisplayListQueries;
250
287
 
251
- export { type DisplayListRect as D, type LocatedImagePrimitive as L, type ResidentDisplayListQueryEngine as R, type DisplayListQueries as a, type DisplayListRegionHit as b, type DisplayListHitRegion as c, type DisplayListImageGeometry as d, type DisplayListImageRegion as e, type DisplayListParagraphGeometry as f, type DisplayListQuerySourceState as g, type DisplayListVerticalMove as h, type DisplayListVisualLine as i, captureInlinePositionEmuFromDisplayList as j, createDisplayListQueries as k, findImagePrimitiveAtPoint as l, findImagePrimitiveByDocPos as m, isDisplayListQuerySourceDead as n, onDisplayListQuerySourceFailure as o };
288
+ export { type DisplayListRect as D, type LocatedImagePrimitive as L, type ResidentDisplayListQueryEngine as R, type DisplayListQueries as a, type DisplayListRegionHit as b, type DisplayListHitRegion as c, type DisplayListHoverTarget as d, type DisplayListImageGeometry as e, type DisplayListImageRegion as f, type DisplayListParagraphGeometry as g, type DisplayListQuerySourceState as h, type DisplayListVerticalMove as i, type DisplayListVisualLine as j, captureInlinePositionEmuFromDisplayList as k, createDisplayListQueries as l, findImagePrimitiveAtPoint as m, findImagePrimitiveByDocPos as n, isDisplayListQuerySourceDead as o, onDisplayListQuerySourceFailure as p };