@silurus/ooxml 0.71.0 → 0.72.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 +17 -3
- package/THIRD_PARTY_NOTICES.md +73 -0
- package/dist/docx-BPF-eH0O.js +10183 -0
- package/dist/docx.mjs +3 -3
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/{find-cursor-DgyGlCIw.js → find-cursor-DTrEBxjE.js} +7934 -1323
- package/dist/highlight-rect-B--cPQOV.js +881 -0
- package/dist/index.mjs +4 -4
- package/dist/math.mjs +1 -1
- package/dist/{pptx-C2qCkfTT.js → pptx-BMxDfEYI.js} +1337 -1130
- package/dist/pptx.mjs +3 -3
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/render-worker-host-DL_kkykF.js +27 -0
- package/dist/render-worker-host-S0HOWgs0.js +27 -0
- package/dist/render-worker-host-l8yqDUfE.js +27 -0
- package/dist/{segments-BLmJVJRb.js → segments-Da-soh2U.js} +1 -1
- package/dist/types/docx.d.ts +218 -15
- package/dist/types/index.d.ts +338 -24
- package/dist/types/pptx.d.ts +106 -8
- package/dist/types/xlsx.d.ts +30 -1
- package/dist/visible-index-5hdq_oAL.js +50 -0
- package/dist/{xlsx-1PnsOb7Z.js → xlsx-bwQD8c1Q.js} +1307 -1255
- package/dist/xlsx.mjs +3 -3
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +1 -1
- package/dist/docx-B84Lzf0A.js +0 -6396
- package/dist/highlight-rect-CBqVAarx.js +0 -911
- package/dist/render-worker-host-B_mY9aaj.js +0 -27
- package/dist/render-worker-host-CSA5bTZW.js +0 -27
- package/dist/render-worker-host-DL0cvjox.js +0 -27
- package/dist/visible-index-C4c37k-n.js +0 -17
- /package/dist/{mathjax-BRfWlbSJ.js → mathjax-Dk_JzbFj.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { V as e } from "./find-cursor-DTrEBxjE.js";
|
|
2
2
|
//#region packages/core/src/text/bidi/segments.ts
|
|
3
3
|
function t(t, n) {
|
|
4
4
|
return t === !0 ? "rtl" : t === !1 ? "ltr" : e().computeLevels(n, "auto").paragraphLevel === 1 ? "rtl" : "ltr";
|
package/dist/types/docx.d.ts
CHANGED
|
@@ -69,6 +69,14 @@ export declare type BodyElement = {
|
|
|
69
69
|
* separately from `geom` because a section may inherit its geometry yet
|
|
70
70
|
* still restart / re-format its page numbers. */
|
|
71
71
|
pageNumType?: PageNumType | null;
|
|
72
|
+
/** ECMA-376 §17.6.20 `<w:textDirection w:val>` — this ENDING section's
|
|
73
|
+
* flow direction (TRANSITIONAL ST_TextDirection, same enum and semantics
|
|
74
|
+
* as {@link SectionProps.textDirection}), so a vertical (tbRl/btLr)
|
|
75
|
+
* non-final section can coexist with a horizontal final section (issue
|
|
76
|
+
* #1000). Absent ⇒ horizontal ("lrTb" is collapsed by the parser).
|
|
77
|
+
* Carried separately from `geom` (like `pageNumType`) because a section
|
|
78
|
+
* may inherit its page geometry yet still set its own flow direction. */
|
|
79
|
+
textDirection?: string | null;
|
|
72
80
|
};
|
|
73
81
|
|
|
74
82
|
export declare interface BorderSpec {
|
|
@@ -80,17 +88,23 @@ export declare interface BorderSpec {
|
|
|
80
88
|
/**
|
|
81
89
|
* Populate a highlight overlay layer with one box per matched run-slice.
|
|
82
90
|
*
|
|
83
|
-
*
|
|
91
|
+
* Every box is positioned as a PERCENTAGE of `cssWidth`/`cssHeight`, and the
|
|
92
|
+
* container's own size is left untouched (`width:100%;height:100%` from the
|
|
93
|
+
* caller), so the highlights track the canvas's ACTUAL rendered box even when a
|
|
94
|
+
* consumer scales the canvas down with external CSS — mirroring
|
|
95
|
+
* {@link buildDocxTextLayer}.
|
|
96
|
+
*
|
|
97
|
+
* @param layer the overlay div (cleared here; sized `100%` by the caller).
|
|
84
98
|
* @param runs the page's runs (same array the page was rendered/text-layered from).
|
|
85
99
|
* @param matches the page's matches (run-slices + active flag).
|
|
86
|
-
* @param
|
|
87
|
-
* @param
|
|
100
|
+
* @param cssWidth the page's intended CSS width (px, number) — the x-axis % denominator.
|
|
101
|
+
* @param cssHeight the page's intended CSS height (px, number) — the y-axis % denominator.
|
|
88
102
|
* @param measureForFont returns a width-measurer primed with a run's `font`
|
|
89
103
|
* (the viewer closes over a canvas 2d context). Kept as a
|
|
90
104
|
* factory so the font is set once per run, not per glyph.
|
|
91
105
|
* @param colors optional colour overrides.
|
|
92
106
|
*/
|
|
93
|
-
export declare function buildDocxHighlightLayer(layer: HTMLDivElement, runs: DocxTextRunInfo[], matches: DocxHighlightMatch[],
|
|
107
|
+
export declare function buildDocxHighlightLayer(layer: HTMLDivElement, runs: DocxTextRunInfo[], matches: DocxHighlightMatch[], cssWidth: number, cssHeight: number, measureForFont: (font: string) => (s: string) => number, colors?: DocxHighlightColors): void;
|
|
94
108
|
|
|
95
109
|
/**
|
|
96
110
|
* Build the transparent text-selection overlay for a rendered docx page: one
|
|
@@ -103,11 +117,21 @@ export declare function buildDocxHighlightLayer(layer: HTMLDivElement, runs: Doc
|
|
|
103
117
|
* the same `DocxTextRunInfo[]` off-thread and ships it back beside the bitmap, so
|
|
104
118
|
* the overlay is built from identical geometry regardless of thread.
|
|
105
119
|
*
|
|
106
|
-
*
|
|
120
|
+
* Every span is positioned as a PERCENTAGE of `cssWidth`/`cssHeight` (the page's
|
|
121
|
+
* intended CSS-px box), never literal px, and the container's own width/height are
|
|
122
|
+
* left untouched (the caller sizes it `width:100%;height:100%`). This lets the
|
|
123
|
+
* overlay track the canvas's ACTUAL rendered box even when a consumer scales the
|
|
124
|
+
* canvas down with external CSS (`width:100%!important; height:auto`): the
|
|
125
|
+
* `display:inline-block` wrapper shrinks with the canvas, the `100%` container
|
|
126
|
+
* follows, and every `%`-placed span scales with it, so nothing overflows the
|
|
127
|
+
* wrapper into an ancestor's scroll area.
|
|
128
|
+
*
|
|
129
|
+
* @param layer the overlay div (sized `width:100%;height:100%` by the caller).
|
|
107
130
|
* @param runs per-run geometry from `renderPage({ onTextRun })`.
|
|
108
|
-
* @param
|
|
109
|
-
*
|
|
110
|
-
* @param
|
|
131
|
+
* @param cssWidth the page's intended CSS width (px, number) — the %
|
|
132
|
+
* denominator for the x axis.
|
|
133
|
+
* @param cssHeight the page's intended CSS height (px, number) — the %
|
|
134
|
+
* denominator for the y axis.
|
|
111
135
|
* @param onHyperlinkClick IX1 — invoked when a run carrying a resolved
|
|
112
136
|
* {@link HyperlinkTarget} is clicked. A hyperlink run's
|
|
113
137
|
* span keeps its transparent glyphs (the visible link
|
|
@@ -127,7 +151,7 @@ export declare function buildDocxHighlightLayer(layer: HTMLDivElement, runs: Doc
|
|
|
127
151
|
* a 縦中横 span keeps the bare rotate (no regression for
|
|
128
152
|
* callers that do not thread a measurer).
|
|
129
153
|
*/
|
|
130
|
-
export declare function buildDocxTextLayer(layer: HTMLDivElement, runs: DocxTextRunInfo[],
|
|
154
|
+
export declare function buildDocxTextLayer(layer: HTMLDivElement, runs: DocxTextRunInfo[], cssWidth: number, cssHeight: number, onHyperlinkClick?: (target: HyperlinkTarget) => void, measureForFont?: (font: string) => (s: string) => number): void;
|
|
131
155
|
|
|
132
156
|
export declare interface CellBorders {
|
|
133
157
|
top: BorderSpec | null;
|
|
@@ -312,6 +336,14 @@ declare interface ChartModel {
|
|
|
312
336
|
title: string | null;
|
|
313
337
|
categories: string[];
|
|
314
338
|
series: ChartSeries[];
|
|
339
|
+
/**
|
|
340
|
+
* §21.2.2.227 `<c:varyColors val="1"/>` on a SINGLE-series bar/column chart:
|
|
341
|
+
* color each data point (bar) from the theme/palette sequence and list one
|
|
342
|
+
* legend entry per point, matching Office. Set by the shared parser ONLY for
|
|
343
|
+
* that non-pie, single-series case (pie/doughnut already vary by point via
|
|
344
|
+
* `chartType` + `dataPointColors`); absent/false otherwise.
|
|
345
|
+
*/
|
|
346
|
+
varyColors?: boolean | null;
|
|
315
347
|
/** Show data labels on bars / points / slices. */
|
|
316
348
|
showDataLabels: boolean;
|
|
317
349
|
/** Explicit Y-axis minimum (OOXML `<c:valAx><c:min>`). */
|
|
@@ -690,8 +722,9 @@ declare interface ChartModel {
|
|
|
690
722
|
* core `renderChart` consumes (identical to what pptx/xlsx pass), so a docx
|
|
691
723
|
* chart draws at the same quality through the same code path. `widthPt`/
|
|
692
724
|
* `heightPt` are the `<wp:extent>` natural size. An inline chart flows as an
|
|
693
|
-
* inline box of that size; an anchored chart (§20.4.2.3) is painted
|
|
694
|
-
*
|
|
725
|
+
* inline box of that size; an anchored chart (§20.4.2.3) is painted via
|
|
726
|
+
* `registerAnchorFloats` when it wraps text, or by `renderAnchorImages` for
|
|
727
|
+
* wrapNone/no-wrap anchors — all paths use `renderChart`. */
|
|
695
728
|
export declare interface ChartRun {
|
|
696
729
|
chart: ChartModel;
|
|
697
730
|
widthPt: number;
|
|
@@ -703,6 +736,39 @@ export declare interface ChartRun {
|
|
|
703
736
|
anchorYPt?: number;
|
|
704
737
|
anchorXFromMargin?: boolean;
|
|
705
738
|
anchorYFromPara?: boolean;
|
|
739
|
+
/**
|
|
740
|
+
* Wrap mode for anchored charts (ECMA-376 §20.4.2.16/.17):
|
|
741
|
+
* "square" | "topAndBottom" | "none" | "tight" | "through"
|
|
742
|
+
* Inline charts and undetermined cases leave this undefined. The renderer
|
|
743
|
+
* treats "tight" and "through" as "square", matching anchored images.
|
|
744
|
+
*/
|
|
745
|
+
wrapMode?: string;
|
|
746
|
+
/** Padding top (pt). Anchor-only (ECMA-376 §20.4.2.16/.17). */
|
|
747
|
+
distTop?: number;
|
|
748
|
+
/** Padding bottom (pt). Anchor-only (ECMA-376 §20.4.2.16/.17). */
|
|
749
|
+
distBottom?: number;
|
|
750
|
+
/** Padding left (pt). Anchor-only (ECMA-376 §20.4.2.16/.17). */
|
|
751
|
+
distLeft?: number;
|
|
752
|
+
/** Padding right (pt). Anchor-only (ECMA-376 §20.4.2.16/.17). */
|
|
753
|
+
distRight?: number;
|
|
754
|
+
/** wrapText attribute: "bothSides" | "left" | "right" | "largest". */
|
|
755
|
+
wrapSide?: string;
|
|
756
|
+
/**
|
|
757
|
+
* ECMA-376 §20.4.2.3 `wp:anchor/@allowOverlap`. The parser omits this
|
|
758
|
+
* field when true, so renderers must read it as `allowOverlap ?? true`.
|
|
759
|
+
*/
|
|
760
|
+
allowOverlap?: boolean;
|
|
761
|
+
/** ECMA-376 §20.4.3.1 wp:align horizontal: "left" | "center" | "right" |
|
|
762
|
+
* "inside" | "outside". */
|
|
763
|
+
anchorXAlign?: string | null;
|
|
764
|
+
/** Vertical equivalent of anchorXAlign: "top" | "center" | "bottom". */
|
|
765
|
+
anchorYAlign?: string | null;
|
|
766
|
+
/**
|
|
767
|
+
* ECMA-376 §20.4.3.2 `<wp:positionH/@relativeFrom>` / §20.4.3.5
|
|
768
|
+
* `<wp:positionV/@relativeFrom>` — the raw anchor placement containers.
|
|
769
|
+
*/
|
|
770
|
+
anchorXRelativeFrom?: string | null;
|
|
771
|
+
anchorYRelativeFrom?: string | null;
|
|
706
772
|
}
|
|
707
773
|
|
|
708
774
|
declare interface ChartSeries {
|
|
@@ -975,12 +1041,20 @@ export declare interface DocParagraph {
|
|
|
975
1041
|
shading?: string | null;
|
|
976
1042
|
/** Force a page break before this paragraph (w:pageBreakBefore) */
|
|
977
1043
|
pageBreakBefore?: boolean;
|
|
978
|
-
/**
|
|
1044
|
+
/** ECMA-376 §17.3.1.9 `<w:contextualSpacing>` — between adjacent SAME-style
|
|
1045
|
+
* paragraphs, a toggling paragraph drops its OWN contribution to the
|
|
1046
|
+
* collapsed inter-paragraph gap (per-side, Word-adjudicated — issue #1015;
|
|
1047
|
+
* see the renderer's `contextualSpacingAdjust`). */
|
|
979
1048
|
contextualSpacing?: boolean;
|
|
980
1049
|
/** Keep paragraph on same page as the next paragraph (w:keepNext) */
|
|
981
1050
|
keepNext?: boolean;
|
|
982
1051
|
/** Keep all lines of this paragraph on the same page (w:keepLines) */
|
|
983
1052
|
keepLines?: boolean;
|
|
1053
|
+
/** ECMA-376 §17.3.1.29 + §17.3.2.41 — the paragraph MARK's resolved `w:vanish`
|
|
1054
|
+
* (hidden text). An inkless paragraph whose mark is vanished collapses to zero
|
|
1055
|
+
* height in the normal/print view (hidden-text off), the same way the parser
|
|
1056
|
+
* strips hidden runs; the paginator drops it whole. Absent = mark is visible. */
|
|
1057
|
+
markVanish?: boolean;
|
|
984
1058
|
/** Widow/orphan control (w:widowControl). ECMA-376 default is true. */
|
|
985
1059
|
widowControl?: boolean;
|
|
986
1060
|
/** Paragraph borders (w:pBdr) */
|
|
@@ -992,6 +1066,17 @@ export declare interface DocParagraph {
|
|
|
992
1066
|
/** Default font family resolved from the style chain. Used to size empty
|
|
993
1067
|
* paragraphs (no runs) with the intended font's line metrics. */
|
|
994
1068
|
defaultFontFamily?: string | null;
|
|
1069
|
+
/** Default East Asian font family resolved from the style chain. Empty /
|
|
1070
|
+
* anchor-only paragraph marks in East Asian documents use this axis for line
|
|
1071
|
+
* metrics instead of the ASCII fallback. */
|
|
1072
|
+
defaultFontFamilyEastAsia?: string | null;
|
|
1073
|
+
/** ECMA-376 §17.3.1.29 — the paragraph MARK run's resolved `w:color` (direct
|
|
1074
|
+
* pPr/rPr → pStyle chain → docDefaults; hex 6 without `#`, lowercased; an
|
|
1075
|
+
* explicit `auto` surfaces as absent, §17.3.2.6). Word formats a numbering
|
|
1076
|
+
* marker with the level rPr (§17.9.24) layered over the mark's run
|
|
1077
|
+
* properties, so the renderer uses this as the marker-color fallback when
|
|
1078
|
+
* {@link NumberingInfo.color} is absent. */
|
|
1079
|
+
paragraphMarkColor?: string | null;
|
|
995
1080
|
/**
|
|
996
1081
|
* ECMA-376 §17.3.1.6 `<w:bidi>` — right-to-left paragraph. `true` = RTL,
|
|
997
1082
|
* `false` = explicitly LTR, absent = unspecified (inherit). The renderer uses
|
|
@@ -1069,6 +1154,17 @@ export declare interface DocSettings {
|
|
|
1069
1154
|
* tab stops generated after all custom stops. `undefined` ⇒ the renderer
|
|
1070
1155
|
* uses the spec default of 720 twips (36pt). */
|
|
1071
1156
|
defaultTabStop?: number;
|
|
1157
|
+
/** §17.15.1.18 `w:characterSpacingControl@w:val` — East Asian punctuation /
|
|
1158
|
+
* character-spacing control. */
|
|
1159
|
+
characterSpacingControl?: string;
|
|
1160
|
+
/** §17.15.3.1 `w:compat/w:useFELayout` — Far East layout compatibility. */
|
|
1161
|
+
useFeLayout?: boolean;
|
|
1162
|
+
/** §17.15.3.1 `w:compat/w:balanceSingleByteDoubleByteWidth` — balance
|
|
1163
|
+
* single-byte and double-byte widths for East Asian layout. */
|
|
1164
|
+
balanceSingleByteDoubleByteWidth?: boolean;
|
|
1165
|
+
/** §17.15.3.1 `w:compat/w:adjustLineHeightInTable` — apply the section
|
|
1166
|
+
* document-grid line pitch to text in table cells. */
|
|
1167
|
+
adjustLineHeightInTable?: boolean;
|
|
1072
1168
|
}
|
|
1073
1169
|
|
|
1074
1170
|
export declare interface DocTable {
|
|
@@ -1150,6 +1246,9 @@ export declare interface DocTableRow {
|
|
|
1150
1246
|
* lower bound; "exact" = fixed clip. */
|
|
1151
1247
|
rowHeightRule: 'auto' | 'atLeast' | 'exact' | string;
|
|
1152
1248
|
isHeader: boolean;
|
|
1249
|
+
/** ECMA-376 §17.4.6 `<w:cantSplit>` — when true, the row must not be split
|
|
1250
|
+
* across page boundaries. Omitted/false rows may split at page boundaries. */
|
|
1251
|
+
cantSplit?: boolean;
|
|
1153
1252
|
}
|
|
1154
1253
|
|
|
1155
1254
|
export declare class DocxDocument {
|
|
@@ -1333,6 +1432,16 @@ export declare interface DocxDocumentModel {
|
|
|
1333
1432
|
* entry is absent or classified as "auto".
|
|
1334
1433
|
*/
|
|
1335
1434
|
fontFamilyClasses?: Record<string, string>;
|
|
1435
|
+
/**
|
|
1436
|
+
* ECMA-376 §17.8.3.29 — per-font pitch from `word/fontTable.xml`
|
|
1437
|
+
* (`<w:pitch>`, ST_Pitch §17.18.66): font name → "fixed" | "variable" |
|
|
1438
|
+
* "default". Present only for fonts that declare `<w:pitch>`. The renderer
|
|
1439
|
+
* pairs this with {@link fontFamilyClasses}: a `family="modern"` face is
|
|
1440
|
+
* treated as monospace ONLY when its pitch is "fixed"; "variable" /
|
|
1441
|
+
* "default" / absent fall through to name-pattern / CJK-sans classification
|
|
1442
|
+
* (§17.8.3.10 `family` classifies the design, not the pitch — issue #855).
|
|
1443
|
+
*/
|
|
1444
|
+
fontFamilyPitches?: Record<string, string>;
|
|
1336
1445
|
/** ECMA-376 §17.8.3.3-.6 — embedded fonts from `word/fontTable.xml`, resolved
|
|
1337
1446
|
* to their `.odttf` part paths + fontKey. The viewer de-obfuscates (§17.8.1)
|
|
1338
1447
|
* and registers each as a FontFace before pagination so text measures/draws
|
|
@@ -1635,6 +1744,12 @@ export declare class DocxScrollViewer implements ZoomableViewer {
|
|
|
1635
1744
|
* {@link DocxDocument.getBookmarkPage} (ECMA-376 §17.16.23) and scrolls there
|
|
1636
1745
|
* with {@link scrollToPage}. An anchor naming no known bookmark is a safe no-op
|
|
1637
1746
|
* rather than a scroll to a guessed page.
|
|
1747
|
+
*
|
|
1748
|
+
* IX1 — returns `undefined` when `enableHyperlinks` is `false`, the single gate
|
|
1749
|
+
* that disables hyperlink interactivity: {@link buildDocxTextLayer} treats a
|
|
1750
|
+
* missing handler as "render link runs like plain runs", so no hit region,
|
|
1751
|
+
* cursor, tooltip, listener, or navigation is wired (a custom
|
|
1752
|
+
* `onHyperlinkClick` is suppressed too).
|
|
1638
1753
|
*/
|
|
1639
1754
|
private _hyperlinkHandler;
|
|
1640
1755
|
/** A width-measurer primed with a run's `font` — used ONLY to clamp a §17.3.2.10
|
|
@@ -1643,6 +1758,10 @@ export declare class DocxScrollViewer implements ZoomableViewer {
|
|
|
1643
1758
|
* unavailable so the caller still gets a callable (the overlay then sees scale
|
|
1644
1759
|
* 1 and leaves the span un-clamped). */
|
|
1645
1760
|
private _measureForFont;
|
|
1761
|
+
/** A canvas's intended CSS box in px (the % denominators the overlay builders
|
|
1762
|
+
* expect). Reads the inline `style.width`/`height` set by the render path,
|
|
1763
|
+
* falling back to the backing-store size when unset; tolerates the `px` suffix. */
|
|
1764
|
+
private _canvasCssPx;
|
|
1646
1765
|
/** Route an async render failure to `onError`, or `console.error` when none is
|
|
1647
1766
|
* set (so failures are never fully silent), and never after teardown. */
|
|
1648
1767
|
private _reportRenderError;
|
|
@@ -1939,6 +2058,13 @@ export declare interface DocxScrollViewerOptions extends Omit<RenderPageOptions,
|
|
|
1939
2058
|
* new tab via core `openExternalHyperlink` (sanitised, noopener,noreferrer);
|
|
1940
2059
|
* internal → jump to the page whose text contains the bookmark (best-effort). */
|
|
1941
2060
|
onHyperlinkClick?: (target: HyperlinkTarget) => void;
|
|
2061
|
+
/** IX1 — master switch for hyperlink interactivity. Default `true`. When
|
|
2062
|
+
* `false`, the hyperlink machinery is not wired at all: no overlay hit region
|
|
2063
|
+
* is installed for link runs, so there is no pointer cursor, no title tooltip,
|
|
2064
|
+
* no default navigation (external new-tab / internal bookmark jump), and
|
|
2065
|
+
* `onHyperlinkClick` is never called. Links still render exactly as authored
|
|
2066
|
+
* but are inert, like plain text. */
|
|
2067
|
+
enableHyperlinks?: boolean;
|
|
1942
2068
|
/** Error callback. When set, `load()` invokes it and resolves (otherwise the
|
|
1943
2069
|
* error is rethrown — shared viewer error contract). It ALSO fires for async
|
|
1944
2070
|
* per-slot render failures (both main `renderPage` and worker
|
|
@@ -2037,12 +2163,22 @@ export declare interface DocxTextRun {
|
|
|
2037
2163
|
/** ECMA-376 §17.3.2.20 `<w:lang w:bidi>` — complex-script (RTL) language tag,
|
|
2038
2164
|
* lower-cased (e.g. "ar-sa", "ae-ar"). Drives Word's AN digit ordering. */
|
|
2039
2165
|
langBidi?: string;
|
|
2166
|
+
/** ECMA-376 §17.3.2.34 `<w:snapToGrid>` — false opts this run out of the
|
|
2167
|
+
* section character grid; absent inherits participation. */
|
|
2168
|
+
snapToGrid?: boolean;
|
|
2040
2169
|
/** ECMA-376 §17.3.2.35 `<w:spacing w:val>` — character-spacing adjustment in
|
|
2041
2170
|
* POINTS (signed): the extra pitch added after each character before the next
|
|
2042
2171
|
* is rendered. The renderer feeds it to `ctx.letterSpacing` on BOTH the
|
|
2043
2172
|
* measure and paint passes so line breaking / pagination stay consistent.
|
|
2044
2173
|
* Absent ⇒ no extra pitch. */
|
|
2045
2174
|
charSpacing?: number;
|
|
2175
|
+
/** ECMA-376 §17.3.2.14 `<w:fitText>` — manual run-width target in TWIPS
|
|
2176
|
+
* (`w:val`, 1/20 pt) plus the optional `w:id` that links consecutive runs
|
|
2177
|
+
* into one region. The arbitrary-precision XSD integer id is serialized as a
|
|
2178
|
+
* string; numeric synthetic inputs remain supported for layout tests and
|
|
2179
|
+
* direct model construction. An id-less run is always standalone. */
|
|
2180
|
+
fitTextVal?: number;
|
|
2181
|
+
fitTextId?: string | number;
|
|
2046
2182
|
/** ECMA-376 §17.3.2.43 `<w:w w:val>` — horizontal text scale as a FRACTION of
|
|
2047
2183
|
* normal character width (0.67 = 67%, 2.0 = 200%). Stretches each glyph's
|
|
2048
2184
|
* width, not the gap between glyphs. Absent ⇒ 100%. */
|
|
@@ -2096,6 +2232,9 @@ export declare interface DocxTextRunInfo {
|
|
|
2096
2232
|
fontSize: number;
|
|
2097
2233
|
/** CSS `font` shorthand used for canvas drawing (e.g. `"bold 16px Arial"`). */
|
|
2098
2234
|
font: string;
|
|
2235
|
+
/** Uniform per-code-point pitch in CSS px used to draw a horizontal run.
|
|
2236
|
+
* Absent when the pitch is zero or the run uses vertical / 縦中横 paint. */
|
|
2237
|
+
letterSpacingPx?: number;
|
|
2099
2238
|
/** ECMA-376 §17.6.20 (tbRl) — when the page is vertical the canvas is the
|
|
2100
2239
|
* physical landscape page rotated +90° at paint, so this run's `x`/`y` are the
|
|
2101
2240
|
* PHYSICAL top-left the overlay span must sit at, and `transform` is the CSS
|
|
@@ -2305,6 +2444,11 @@ export declare class DocxViewer implements ZoomableViewer {
|
|
|
2305
2444
|
/** Draw the find-highlight boxes for the current page from its runs. Clears
|
|
2306
2445
|
* the overlay when there is no active find. */
|
|
2307
2446
|
private _buildHighlightLayer;
|
|
2447
|
+
/** The canvas's intended CSS box in px (the % denominators the overlay builders
|
|
2448
|
+
* expect). Reads the inline `style.width`/`height` set by the render path
|
|
2449
|
+
* (which mirror the render's logical size), falling back to the backing-store
|
|
2450
|
+
* dimensions when unset. Parsing tolerates the trailing `px`. */
|
|
2451
|
+
private _canvasCssPx;
|
|
2308
2452
|
/** A width-measurer primed with `font`, backed by a private 1×1 canvas so it
|
|
2309
2453
|
* never disturbs the visible canvas's context state. */
|
|
2310
2454
|
private _measureForFont;
|
|
@@ -2323,6 +2467,12 @@ export declare class DocxViewer implements ZoomableViewer {
|
|
|
2323
2467
|
* {@link DocxDocument.getBookmarkPage} (ECMA-376 §17.16.23) and jumps there
|
|
2324
2468
|
* with {@link goToPage}. An anchor naming no known bookmark is a safe no-op
|
|
2325
2469
|
* rather than a jump to a guessed page.
|
|
2470
|
+
*
|
|
2471
|
+
* IX1 — returns `undefined` when `enableHyperlinks` is `false`, the single gate
|
|
2472
|
+
* that disables hyperlink interactivity: {@link buildDocxTextLayer} treats a
|
|
2473
|
+
* missing handler as "render link runs like plain runs", so no hit region,
|
|
2474
|
+
* cursor, tooltip, listener, or navigation is wired (a custom
|
|
2475
|
+
* `onHyperlinkClick` is suppressed too).
|
|
2326
2476
|
*/
|
|
2327
2477
|
private _hyperlinkHandler;
|
|
2328
2478
|
}
|
|
@@ -2352,6 +2502,15 @@ export declare interface DocxViewerOptions extends RenderPageOptions, LoadOption
|
|
|
2352
2502
|
* new tab via core `openExternalHyperlink` (sanitised, noopener,noreferrer);
|
|
2353
2503
|
* internal → jump to the page whose text contains the bookmark (best-effort). */
|
|
2354
2504
|
onHyperlinkClick?: (target: HyperlinkTarget) => void;
|
|
2505
|
+
/** IX1 — master switch for hyperlink interactivity. Default `true`. When
|
|
2506
|
+
* `false`, the hyperlink machinery is not wired at all: no overlay hit region
|
|
2507
|
+
* is installed for link runs, so there is no pointer cursor, no title tooltip,
|
|
2508
|
+
* no default navigation (external new-tab / internal bookmark jump), and
|
|
2509
|
+
* `onHyperlinkClick` is never called. Links still render exactly as authored
|
|
2510
|
+
* (their colour/underline are painted on the canvas) but are inert, like plain
|
|
2511
|
+
* text. Set it to disable clickable links entirely — e.g. in a preview where
|
|
2512
|
+
* navigation must not leave the current view. */
|
|
2513
|
+
enableHyperlinks?: boolean;
|
|
2355
2514
|
/** Called on parse or render errors. */
|
|
2356
2515
|
onError?: (err: Error) => void;
|
|
2357
2516
|
}
|
|
@@ -3072,6 +3231,19 @@ export declare interface NumberingInfo {
|
|
|
3072
3231
|
* this family. Absent ⇒ the renderer falls back to
|
|
3073
3232
|
* {@link NumberingInfo.fontFamily}. */
|
|
3074
3233
|
fontFamilyEastAsia?: string | null;
|
|
3234
|
+
/** ECMA-376 §17.9.24 — the numbering level rPr's `w:color` (hex 6 without
|
|
3235
|
+
* `#`, lowercased). Colors the marker glyph only, never the paragraph's
|
|
3236
|
+
* runs. Absent ⇒ the renderer falls back to
|
|
3237
|
+
* {@link DocParagraph.paragraphMarkColor} (§17.3.1.29 — Word layers the
|
|
3238
|
+
* level rPr over the paragraph mark's run properties) and finally to its
|
|
3239
|
+
* default ink. An explicit `w:val="auto"` is absent here + {@link colorAuto}. */
|
|
3240
|
+
color?: string | null;
|
|
3241
|
+
/** ECMA-376 §17.3.2.6 / ST_HexColorAuto (§17.18.39) — true when the level
|
|
3242
|
+
* rPr carries an EXPLICIT `w:color w:val="auto"`. Auto names no concrete
|
|
3243
|
+
* color but is not "unset": it breaks the paragraph-mark fallback, so the
|
|
3244
|
+
* marker draws the automatic (default) ink instead of
|
|
3245
|
+
* {@link DocParagraph.paragraphMarkColor}. */
|
|
3246
|
+
colorAuto?: boolean;
|
|
3075
3247
|
/** ECMA-376 §17.9.9/§17.9.20 — when the level uses a `<w:lvlPicBulletId>`,
|
|
3076
3248
|
* the marker is this image (zip path, e.g. `word/media/image1.gif`), drawn in
|
|
3077
3249
|
* place of {@link NumberingInfo.text}. Absent ⇒ ordinary text/glyph marker. */
|
|
@@ -3298,6 +3470,10 @@ export declare interface RubyAnnotation {
|
|
|
3298
3470
|
text: string;
|
|
3299
3471
|
/** Annotation font size in pt. Word stores this as half-points in `<w:hps>`. */
|
|
3300
3472
|
fontSizePt: number;
|
|
3473
|
+
/** Distance “between the phonetic guide base text and the phonetic guide
|
|
3474
|
+
* text” in pt. Word stores this as half-points in `<w:hpsRaise>`
|
|
3475
|
+
* (ECMA-376 §17.3.3.12). */
|
|
3476
|
+
hpsRaisePt?: number;
|
|
3301
3477
|
}
|
|
3302
3478
|
|
|
3303
3479
|
export declare interface RunRevision {
|
|
@@ -3497,7 +3673,7 @@ export declare interface ShapeRun {
|
|
|
3497
3673
|
groupHeightPt?: number | null;
|
|
3498
3674
|
/** Draw behind text when true (wp:anchor behindDoc="1"). */
|
|
3499
3675
|
behindDoc?: boolean;
|
|
3500
|
-
/**
|
|
3676
|
+
/** ECMA-376 §20.4.2.3 `wp:anchor/@relativeHeight`: lower values render first. */
|
|
3501
3677
|
zOrder: number;
|
|
3502
3678
|
/** Normalized [0,1] custom-geometry sub-paths. Empty when `presetGeometry`
|
|
3503
3679
|
* is set; the renderer chooses between buildCustomPath and buildShapePath. */
|
|
@@ -3505,8 +3681,10 @@ export declare interface ShapeRun {
|
|
|
3505
3681
|
/** OOXML <a:prstGeom prst> name (e.g. "rect", "ellipse", "rtTriangle").
|
|
3506
3682
|
* When set the renderer calls core's buildShapePath with `adjValues`. */
|
|
3507
3683
|
presetGeometry?: string | null;
|
|
3508
|
-
/**
|
|
3509
|
-
|
|
3684
|
+
/** <a:gd name="adj{n}"> values from prstGeom/avLst in adj1..adj8 order.
|
|
3685
|
+
* `null` preserves omitted named guides so the preset engine can use the
|
|
3686
|
+
* geometry's default for that index. */
|
|
3687
|
+
adjValues?: Array<number | null>;
|
|
3510
3688
|
fill: ShapeFill | null;
|
|
3511
3689
|
stroke: string | null;
|
|
3512
3690
|
strokeWidth?: number;
|
|
@@ -3556,6 +3734,14 @@ export declare interface ShapeRun {
|
|
|
3556
3734
|
textInsetT?: number;
|
|
3557
3735
|
textInsetR?: number;
|
|
3558
3736
|
textInsetB?: number;
|
|
3737
|
+
/** ECMA-376 §20.1.10.83 ST_TextVerticalType — the text-body flow direction from
|
|
3738
|
+
* `<wps:bodyPr vert>` / `<a:bodyPr vert>`. Recognised vertical values:
|
|
3739
|
+
* "vert" (all glyphs 90° CW, chars T→B, lines R→L), "vert270" (all glyphs 270°
|
|
3740
|
+
* CW = 90° CCW, chars B→T, lines L→R), and "eaVert" (East-Asian upright: CJK
|
|
3741
|
+
* stands upright, non-EA rotated 90°, chars T→B, lines R→L). "horz"/absent ⇒
|
|
3742
|
+
* horizontal (unchanged). Unrecognised values ("mongolianVert", "wordArtVert",
|
|
3743
|
+
* …) fall back to horizontal until implemented. */
|
|
3744
|
+
textVert?: string | null;
|
|
3559
3745
|
/** ECMA-376 Part 4 §19.1.2.23 `<v:textpath>` — WordArt text laid on the
|
|
3560
3746
|
* shape path (a text watermark). When set the renderer draws this string,
|
|
3561
3747
|
* scaled to fill the box (`fitshape`), rotated by {@link ShapeRun.rotation},
|
|
@@ -3581,6 +3767,8 @@ export declare interface ShapeText {
|
|
|
3581
3767
|
* (image blocks / legacy single-format paragraphs). Absent for image-only
|
|
3582
3768
|
* paragraphs. */
|
|
3583
3769
|
runs?: ShapeTextRun[];
|
|
3770
|
+
/** ECMA-376 §17.9 paragraph numbering for text-box paragraphs. */
|
|
3771
|
+
numbering?: NumberingInfo | null;
|
|
3584
3772
|
alignment: string;
|
|
3585
3773
|
/** ECMA-376 §17.3.1.33 `<w:spacing w:before>` of this text-box paragraph, in
|
|
3586
3774
|
* pt — reserved ABOVE the paragraph inside the box. Absent/0 ⇒ no offset. */
|
|
@@ -3618,6 +3806,19 @@ export declare interface ShapeText {
|
|
|
3618
3806
|
* base direction for the UAX#9 reordering pass (the body renderer reads the
|
|
3619
3807
|
* identical field). */
|
|
3620
3808
|
bidi?: boolean;
|
|
3809
|
+
/** ECMA-376 §17.3.1.9 `<w:contextualSpacing>` — resolved through the style
|
|
3810
|
+
* chain in the parser. When set, this text-box paragraph drops its OWN
|
|
3811
|
+
* contribution to the collapsed gap against an ADJACENT paragraph that
|
|
3812
|
+
* shares its {@link ShapeText.styleId} (per-side, Word-adjudicated — issue
|
|
3813
|
+
* #1015; identical to {@link DocParagraph.contextualSpacing} via the
|
|
3814
|
+
* renderer's `contextualSpacingAdjust`). Absent ⇒ no suppression. */
|
|
3815
|
+
contextualSpacing?: boolean;
|
|
3816
|
+
/** Resolved paragraph style id of this text-box paragraph — the explicit
|
|
3817
|
+
* `<w:pStyle>`, else the document default paragraph style, else "Normal" (the
|
|
3818
|
+
* same stable id {@link DocParagraph.styleId} carries). Paired with
|
|
3819
|
+
* {@link ShapeText.contextualSpacing} to group adjacent same-style paragraphs
|
|
3820
|
+
* for §17.3.1.9. */
|
|
3821
|
+
styleId?: string | null;
|
|
3621
3822
|
/** Zip path of an inline image inside this text-box paragraph
|
|
3622
3823
|
* (`<w:drawing><wp:inline><a:blip r:embed>`), e.g. `word/media/image1.emf`.
|
|
3623
3824
|
* Absent for a text-only paragraph. */
|
|
@@ -3650,6 +3851,8 @@ export declare interface ShapeTextRun {
|
|
|
3650
3851
|
fontFamilyEastAsia?: string | null;
|
|
3651
3852
|
bold?: boolean;
|
|
3652
3853
|
italic?: boolean;
|
|
3854
|
+
/** ECMA-376 §17.3.3.25 ruby annotation (furigana) for text-box runs. */
|
|
3855
|
+
ruby?: RubyAnnotation | null;
|
|
3653
3856
|
}
|
|
3654
3857
|
|
|
3655
3858
|
export declare interface TableBorders {
|