@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.
- package/README.md +4 -7
- package/dist/chunk-47Q2FMFF.mjs +1 -0
- package/dist/chunk-5F6DLQZP.mjs +1 -0
- package/dist/chunk-6LQJAKOC.mjs +1 -0
- package/dist/chunk-ACGKK7IB.mjs +1 -0
- package/dist/{chunk-NTSSE5QK.mjs → chunk-AFMVSI4Z.mjs} +2 -2
- package/dist/chunk-GD4VNJ64.mjs +1 -0
- package/dist/{chunk-NJHOPXZW.mjs → chunk-HLDJMU3R.mjs} +1 -1
- package/dist/{chunk-YTILOUAA.mjs → chunk-JHJLG4I6.mjs} +1 -1
- package/dist/chunk-PGMXWI5X.mjs +1 -0
- package/dist/{chunk-NBSLB77E.mjs → chunk-WTFRNX5K.mjs} +1 -1
- package/dist/collaboration/index.d.mts +6 -6
- package/dist/{content-C3sTRz-u.d.mts → content-CvEtPl0c.d.mts} +124 -22
- package/dist/core.d.mts +8 -8
- package/dist/core.mjs +1 -1
- package/dist/{displayListQueries-DLzpvJV6.d.mts → displayListQueries-DF8F6fMl.d.mts} +87 -50
- package/dist/docx/index.d.mts +5 -5
- package/dist/docx/index.mjs +1 -1
- package/dist/editor/index.d.mts +21 -12
- package/dist/editor/index.mjs +1 -1
- package/dist/{fontLoader-CMH3bZ2Z.d.mts → fontLoader-b8eicJKV.d.mts} +1 -1
- package/dist/{formatting-BEkIBePP.d.mts → formatting-7zKCTu5a.d.mts} +11 -2
- package/dist/{frameDelta-B2kC6XiP.d.mts → frameDelta-pA4jrQ1G.d.mts} +16 -10
- package/dist/generated/edit/docx_edit_bg.wasm +0 -0
- package/dist/generated/layout/docx_layout_bg.wasm +0 -0
- package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
- package/dist/generated/parse/docx_parse_bg.wasm +0 -0
- package/dist/{index-2piKi4gO.d.mts → index-CHl2zLJ7.d.mts} +146 -77
- package/dist/layout/index.d.mts +40 -13
- package/dist/layout/index.mjs +1 -1
- package/dist/layout/pagination/index.d.mts +4 -4
- package/dist/layout/pagination/index.mjs +1 -1
- package/dist/layout/render/index.d.mts +33 -77
- package/dist/layout/render/index.mjs +1 -1
- package/dist/plugin-api/RenderedDomContext.d.mts +7 -7
- package/dist/plugin-api/index.d.mts +3 -3
- package/dist/plugin-api/resolveItemPositions.d.mts +3 -3
- package/dist/{rustDisplayList-B0M2eBkU.d.mts → rustDisplayList-BJqaN9tt.d.mts} +74 -50
- package/dist/{rustMeasureSource-D1KsQvVC.d.mts → rustMeasureSource-C0EZB055.d.mts} +5 -2
- package/dist/{selectiveSave-CVoajSKE.d.mts → selectiveSave-CRh-_Y_C.d.mts} +3 -3
- package/dist/styles/index.d.mts +6 -10
- package/dist/styles/index.mjs +1 -1
- package/dist/{styles-BK3Jecxs.d.mts → styles-7e-mq3c-.d.mts} +1 -1
- package/dist/types/content.d.mts +2 -2
- package/dist/types/document.d.mts +8 -7
- package/dist/{types-C1rv3KM-.d.mts → types-C4A8mWjU.d.mts} +44 -24
- package/dist/utils/comments.d.mts +2 -2
- package/dist/utils/index.d.mts +11 -13
- package/dist/utils/index.mjs +1 -1
- package/dist/utils/stylePreview.d.mts +2 -2
- package/dist/wasm-7SOSHNGP.mjs +1 -0
- package/dist/{wasm-JE7B3ROD.mjs → wasm-ZQAVP7P2.mjs} +1 -1
- package/dist/wasm-edit.d.mts +525 -185
- package/dist/wasm-edit.mjs +1 -1
- package/dist/wasm-layout.d.mts +31 -28
- package/dist/wasm-layout.mjs +1 -1
- package/dist/wasm-opc.mjs +1 -1
- package/dist/wasm-parse.d.mts +2 -1
- package/dist/wasm-parse.mjs +1 -1
- package/dist/yrs/index.d.mts +5 -5
- package/dist/yrs/index.mjs +1 -1
- package/dist/yrs/residentEngineWorker.mjs +1 -1
- package/package.json +19 -2
- package/dist/chunk-4V6MDZIK.mjs +0 -1
- package/dist/chunk-6KDV6AIL.mjs +0 -1
- package/dist/chunk-B4IR6YP4.mjs +0 -1
- package/dist/chunk-GGEGIQRK.mjs +0 -1
- package/dist/chunk-T4EZMUXM.mjs +0 -1
- package/dist/chunk-WBH3SXI6.mjs +0 -1
- 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-
|
|
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:
|
|
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
|
|
373
|
-
*
|
|
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
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
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
|
-
/**
|
|
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
|
|
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 (
|
|
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`
|
|
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
|
|
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-
|
|
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,
|
|
5
|
-
export { B as BlockContent, m as BookmarkEnd, n as BookmarkStart,
|
|
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-
|
|
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,
|
|
11
|
-
export { a as ParagraphFormatting, b as TextFormatting, f as Theme, x as ThemeColorScheme, z as ThemeFont, A as ThemeFontScheme } from './formatting-
|
|
12
|
-
export { d as Relationship, a as Style, S as StyleDefinitions } from './styles-
|
|
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
|
|
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-
|
|
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-
|
|
2
|
-
import { R as RustDisplayListQueryEngine } from './rustDisplayList-
|
|
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
|
|
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
|
|
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
|
-
/**
|
|
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
|
|
34
|
-
* one-atom
|
|
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
|
|
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
|
|
56
|
-
*
|
|
57
|
-
*
|
|
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
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
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
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
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
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
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
|
-
*
|
|
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
|
-
/**
|
|
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:
|
|
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
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
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
|
|
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?:
|
|
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?:
|
|
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
|
|
208
|
+
/** body document range → highlight rects */
|
|
184
209
|
rangeRects(from: number, to: number): DisplayListRect[];
|
|
185
210
|
/**
|
|
186
|
-
* Header/footer
|
|
187
|
-
* `'header' | 'footer'`; `rId` identifies the HF
|
|
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
|
-
* `[]`
|
|
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
|
|
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 };
|