@docx-editor.dev/core 2.14.1 → 2.15.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 +42 -0
- package/dist/automation.cjs +1 -1
- package/dist/automation.d.ts +6 -5
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.ts +16 -10
- package/dist/binding.js +1 -1
- package/dist/chunk-24APKZAN.cjs +11 -0
- package/dist/chunk-2YH4MSHX.cjs +2 -0
- package/dist/chunk-5Y7AADI6.js +1 -0
- package/dist/chunk-AREFLNUP.js +11 -0
- package/dist/chunk-AS7YZNQE.cjs +2 -0
- package/dist/chunk-AVGCKH6A.cjs +20 -0
- package/dist/chunk-CDYVDQRI.cjs +5 -0
- package/dist/chunk-FGBADUSK.cjs +1 -0
- package/dist/chunk-HOEWFH5U.cjs +1 -0
- package/dist/chunk-KFELX7CN.js +2 -0
- package/dist/{chunk-OKEDGR65.js → chunk-KXPVOPR5.js} +1 -1
- package/dist/chunk-LGFKIF4M.cjs +1 -0
- package/dist/chunk-M52QXFKI.js +1 -0
- package/dist/chunk-MNUKSXRO.js +1 -0
- package/dist/chunk-PBOIGBDO.js +2 -0
- package/dist/chunk-PMHGONET.cjs +1 -0
- package/dist/chunk-PXKZUTHX.cjs +2 -0
- package/dist/chunk-Q4AB7E4O.cjs +1 -0
- package/dist/chunk-QJYH6AYD.js +1 -0
- package/dist/chunk-QRC37MWG.cjs +20 -0
- package/dist/chunk-RJSB6RJ7.js +20 -0
- package/dist/chunk-SB54HLFJ.js +20 -0
- package/dist/chunk-VP7SDFCM.js +1 -0
- package/dist/chunk-XCESLTJL.js +2 -0
- package/dist/{chunk-KIAP7PFQ.cjs → chunk-YL4Q5LZP.cjs} +1 -1
- package/dist/chunk-Z4527AXR.js +5 -0
- package/dist/collaboration/replication.cjs +1 -1
- package/dist/collaboration/replication.d.ts +4 -3
- package/dist/collaboration/replication.js +1 -1
- package/dist/collaboration.d.ts +4 -3
- package/dist/contracts/editor.d.ts +7 -7
- package/dist/contracts/interaction.d.ts +7 -7
- package/dist/contracts/modules.d.ts +8 -7
- package/dist/{custom-node-writes-DntmaAVW.d.ts → custom-node-writes-C9ArIlJh.d.ts} +2 -2
- package/dist/{editor-a6VvsfYU.d.ts → editor-sRxrFJd8.d.ts} +29 -21
- package/dist/editor.cjs +1 -1
- package/dist/editor.d.ts +27 -58
- package/dist/editor.js +1 -1
- package/dist/export.cjs +2 -0
- package/dist/export.d.ts +337 -0
- package/dist/export.js +2 -0
- package/dist/font-resolver-BYEHQGTw.d.ts +251 -0
- package/dist/headless-document-view-DELC4E5v.d.ts +134 -0
- package/dist/hf-references-DTrHkktY.d.ts +70 -0
- package/dist/{index-C5ZnSRkF.d.ts → index-C3Gvq4jN.d.ts} +55 -246
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +18 -16
- package/dist/index.js +1 -1
- package/dist/{shaped-measurer-CFPnXFs9.d.cts → layout-shaping-DoGR5cf8.d.ts} +86 -12
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +1106 -729
- package/dist/layout.js +1 -1
- package/dist/{note-properties-CDFiNXcD.d.ts → note-properties-DSe8igrz.d.ts} +2 -2
- package/dist/{omml-equation-BY49UOIF.d.ts → omml-equation-BpRmfDAf.d.ts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.ts +6 -6
- package/dist/output.js +1 -1
- package/dist/{protocol-gOY5GA8K.d.cts → protocol-DZzKxH5r.d.ts} +18 -12
- package/dist/{review-items-CCS1h93f.d.ts → review-items-DYRx187i.d.ts} +2 -2
- package/dist/{review-reads-BjZYeMd4.d.ts → review-reads-LbGUdNzn.d.ts} +22 -25
- package/dist/{revision-projection-BeXVrSSV.d.ts → revision-projection-DHRJH48u.d.ts} +1 -1
- package/dist/{semantic-cell-selection-BK91NCCG.d.ts → semantic-cell-selection-BXVWCBYm.d.ts} +4 -4
- package/dist/{semantic-interaction-BmQ7h2cq.d.ts → semantic-interaction-DZsDmPg5.d.ts} +1 -1
- package/dist/{semantic-paint-WJD2KeG1.d.ts → semantic-paint-f7SqN4oW.d.ts} +2 -2
- package/dist/{semantic-records-BpozY7-j.d.cts → semantic-records-EIdwId-a.d.ts} +301 -205
- package/dist/store.cjs +1 -1
- package/dist/store.d.ts +15 -65
- package/dist/store.js +1 -1
- package/dist/{tree-op-types-D6HzlPR4.d.ts → tree-op-types-egdarvH_.d.ts} +7 -3
- package/dist/{tree-package-fragment-CWFjgH6a.d.ts → tree-package-fragment-DjkH4ESI.d.ts} +4 -70
- package/dist/{tree-session-contract-B2HfGt79.d.ts → tree-session-contract-CGOOgPjW.d.ts} +29 -23
- package/dist/{tree-store-APgWx6qn.d.ts → tree-store-DKJB0IcA.d.ts} +2 -2
- package/package.json +7 -2
- package/dist/automation.d.cts +0 -82
- package/dist/binding.d.cts +0 -153
- package/dist/chunk-2PIHW2QM.cjs +0 -1
- package/dist/chunk-2QTY5S6T.js +0 -1
- package/dist/chunk-4Z5MODAE.cjs +0 -2
- package/dist/chunk-5TKAPFZT.cjs +0 -2
- package/dist/chunk-DRQHIQ4R.cjs +0 -1
- package/dist/chunk-F2K6SDHA.cjs +0 -20
- package/dist/chunk-FBA57EUJ.js +0 -2
- package/dist/chunk-KTAQ7BRQ.js +0 -20
- package/dist/chunk-LBAHXZCU.cjs +0 -5
- package/dist/chunk-MCDUQYWP.js +0 -5
- package/dist/chunk-MQP26KCF.js +0 -1
- package/dist/chunk-NDJGSR6M.cjs +0 -19
- package/dist/chunk-NJNFJPGB.cjs +0 -11
- package/dist/chunk-O5M4CR4P.cjs +0 -2
- package/dist/chunk-UKUOZXUD.js +0 -19
- package/dist/chunk-VQ4R5LTU.js +0 -2
- package/dist/chunk-ZBEJHJN2.js +0 -11
- package/dist/chunk-ZVTW7RGD.js +0 -2
- package/dist/collaboration/replication.d.cts +0 -216
- package/dist/collaboration.d.cts +0 -176
- package/dist/contracts/document.d.cts +0 -273
- package/dist/contracts/editor.d.cts +0 -10
- package/dist/contracts/interaction.d.cts +0 -10
- package/dist/contracts/modules.d.cts +0 -130
- package/dist/contracts/types.d.cts +0 -562
- package/dist/custom-node-writes-C46r3_5O.d.cts +0 -310
- package/dist/document-properties-D6Ahr8D6.d.cts +0 -28
- package/dist/document-properties-D6Ahr8D6.d.ts +0 -28
- package/dist/editor-AJ06hyyg.d.cts +0 -1994
- package/dist/editor.d.cts +0 -393
- package/dist/failure-BnGjoXf0.d.cts +0 -64
- package/dist/index-Cbw4lkOt.d.cts +0 -3391
- package/dist/index.d.cts +0 -23
- package/dist/layout.d.cts +0 -2486
- package/dist/note-properties-Y6qYh2Hv.d.cts +0 -67
- package/dist/omml-equation-DB8d-jCq.d.cts +0 -84
- package/dist/output.d.cts +0 -74
- package/dist/protocol-BsmQgblT.d.ts +0 -1358
- package/dist/review-items-CaAkgi5s.d.cts +0 -360
- package/dist/review-reads-DEsV0OOW.d.cts +0 -163
- package/dist/revision-projection-DXbrfNGD.d.cts +0 -156
- package/dist/semantic-cell-selection-BMhku3B1.d.cts +0 -451
- package/dist/semantic-interaction-DUAnxbgf.d.cts +0 -160
- package/dist/semantic-paint-DufNL1Zr.d.cts +0 -247
- package/dist/semantic-records-92UnKeU_.d.ts +0 -2821
- package/dist/shaped-measurer-BWbindlI.d.ts +0 -168
- package/dist/store.d.cts +0 -2500
- package/dist/tree-op-types-BUulYD5y.d.cts +0 -3099
- package/dist/tree-package-fragment-Dhyw7oPm.d.cts +0 -732
- package/dist/tree-session-contract-BY9xd7s_.d.cts +0 -613
- package/dist/tree-store-DEEQ9wz_.d.cts +0 -416
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { T as TextMeasurer, S as SemanticLayout, B as BlockFragmentRecord, C as ContentControlBoundaryRecord, a as StyleSpanRecord } from './semantic-records-BpozY7-j.cjs';
|
|
2
|
-
|
|
3
|
-
/** A caret position in the model. */
|
|
4
|
-
interface SemanticPosition {
|
|
5
|
-
readonly paragraphId: string;
|
|
6
|
-
readonly offset: number;
|
|
7
|
-
}
|
|
8
|
-
/** A caret position with the geometry that renders it. */
|
|
9
|
-
interface CaretGeometry {
|
|
10
|
-
readonly position: SemanticPosition;
|
|
11
|
-
/** Page-relative, in the same coordinate space as the line boxes. */
|
|
12
|
-
readonly x: number;
|
|
13
|
-
readonly y: number;
|
|
14
|
-
readonly height: number;
|
|
15
|
-
readonly lineId: string;
|
|
16
|
-
readonly pageIndex: number;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* A selection as two semantic positions — never as DOM nodes.
|
|
20
|
-
*
|
|
21
|
-
* `anchor` is where the selection started and `head` is where it currently ends, so `head` before
|
|
22
|
-
* `anchor` is an ordinary backwards selection rather than an error. Collapsed when the two are
|
|
23
|
-
* equal, which is what a caret is.
|
|
24
|
-
*/
|
|
25
|
-
interface SemanticSelection {
|
|
26
|
-
readonly anchor: SemanticPosition;
|
|
27
|
-
readonly head: SemanticPosition;
|
|
28
|
-
}
|
|
29
|
-
/** One painted selection rectangle, in page-relative layout points. */
|
|
30
|
-
interface SelectionRect {
|
|
31
|
-
readonly pageIndex: number;
|
|
32
|
-
readonly x: number;
|
|
33
|
-
readonly y: number;
|
|
34
|
-
readonly width: number;
|
|
35
|
-
readonly height: number;
|
|
36
|
-
}
|
|
37
|
-
declare function caretStops(layout: SemanticLayout, measurer?: TextMeasurer): CaretGeometry[];
|
|
38
|
-
/**
|
|
39
|
-
* Caret stops for one story's block fragments (header/footer), in reading order.
|
|
40
|
-
*
|
|
41
|
-
* Coordinates stay story-relative — the same space `hitTestFragments` and furniture paint
|
|
42
|
-
* use — so arrow motion follows tab-stop geometry and projected field atoms without mixing
|
|
43
|
-
* body sheet offsets.
|
|
44
|
-
*/
|
|
45
|
-
declare function caretStopsForBlocks(layout: SemanticLayout, pageIndex: number, fragments: readonly BlockFragmentRecord[], measurer?: TextMeasurer): CaretGeometry[];
|
|
46
|
-
/**
|
|
47
|
-
* How caret geometry is resolved.
|
|
48
|
-
*
|
|
49
|
-
* `preferPage` disambiguates a paragraph that paints on SEVERAL pages — a shared header appears
|
|
50
|
-
* once per page, and without a preference the caret could be placed on any of its copies.
|
|
51
|
-
*/
|
|
52
|
-
interface CaretAtOptions {
|
|
53
|
-
readonly measurer?: TextMeasurer;
|
|
54
|
-
/**
|
|
55
|
-
* Prefer geometry from this sheet when the same paragraph paints on multiple pages
|
|
56
|
-
* (shared header/footer copies).
|
|
57
|
-
*/
|
|
58
|
-
readonly preferredPageIndex?: number;
|
|
59
|
-
}
|
|
60
|
-
/** Geometry for one model position, or null when it is not laid out. */
|
|
61
|
-
declare function caretAt(layout: SemanticLayout, position: SemanticPosition, measurerOrOptions?: TextMeasurer | CaretAtOptions): CaretGeometry | null;
|
|
62
|
-
/**
|
|
63
|
-
* The caret position nearest a point, in PAGE-CONTENT coordinates.
|
|
64
|
-
*
|
|
65
|
-
* Never returns null for a point inside the document: a click in the margin, past the end of
|
|
66
|
-
* a line, or below the last line still has an obvious intended caret, and refusing to answer
|
|
67
|
-
* would make those clicks do nothing.
|
|
68
|
-
*
|
|
69
|
-
* The rules live in `semantic-hit-test.ts`, which answers with the cell address and the
|
|
70
|
-
* on-glyphs flag a pointer controller needs too; this keeps the geometry-only shape for
|
|
71
|
-
* callers that want nothing else.
|
|
72
|
-
*/
|
|
73
|
-
declare function hitTestSemantic(layout: SemanticLayout, point: {
|
|
74
|
-
readonly x: number;
|
|
75
|
-
readonly y: number;
|
|
76
|
-
readonly pageIndex?: number;
|
|
77
|
-
}): CaretGeometry | null;
|
|
78
|
-
/**
|
|
79
|
-
* Innermost content-control boundary at a page-content point, or null outside every control.
|
|
80
|
-
*
|
|
81
|
-
* Prefers the deepest nesting depth when nested boundaries share geometry.
|
|
82
|
-
*/
|
|
83
|
-
declare function contentControlAtSemantic(layout: SemanticLayout, point: {
|
|
84
|
-
readonly x: number;
|
|
85
|
-
readonly y: number;
|
|
86
|
-
readonly pageIndex?: number;
|
|
87
|
-
}): ContentControlBoundaryRecord | null;
|
|
88
|
-
/** Layout-published content-control boundaries in document order. */
|
|
89
|
-
declare function contentControlsInLayout(layout: SemanticLayout): readonly ContentControlBoundaryRecord[];
|
|
90
|
-
/**
|
|
91
|
-
* One caret movement, in Word's own vocabulary.
|
|
92
|
-
*
|
|
93
|
-
* Visual rather than logical where the two differ: `left` means left on screen, which in
|
|
94
|
-
* right-to-left text is forward through the string.
|
|
95
|
-
*/
|
|
96
|
-
type NavigationCommand = 'left' | 'right' | 'up' | 'down' | 'wordLeft' | 'wordRight' | 'lineStart' | 'lineEnd' | 'documentStart' | 'documentEnd' | 'pageUp' | 'pageDown';
|
|
97
|
-
/**
|
|
98
|
-
* The text of one paragraph, read back from the layout records.
|
|
99
|
-
*
|
|
100
|
-
* Word boundaries need characters, and the records carry them: every span holds the text it
|
|
101
|
-
* was laid out from, keyed by the source range it covers. Reading them back keeps word
|
|
102
|
-
* motion in the interaction lane instead of making it a second consumer of the model.
|
|
103
|
-
*/
|
|
104
|
-
declare function paragraphTextFromLayout(layout: SemanticLayout, paragraphId: string): string;
|
|
105
|
-
/**
|
|
106
|
-
* Paragraph offsets a WORD may not run through: the edges of every struck half on screen.
|
|
107
|
-
*
|
|
108
|
-
* Deleted text is the one thing a view paints that does not exist in the document the reader
|
|
109
|
-
* is heading towards — it is the OTHER version, spliced in beside the proposal so the two can
|
|
110
|
-
* be compared. Its characters are therefore not adjacent to their neighbours in any single
|
|
111
|
-
* version, however adjacent they look.
|
|
112
|
-
*
|
|
113
|
-
* A replacement is where that stops being pedantic. Word writes one as a deletion immediately
|
|
114
|
-
* followed by an insertion, with no separator between them, so `ALL CAPS` struck and `fsdfsd`
|
|
115
|
-
* added read as the single word `CAPSfsdfsd`: a double-click on the old text selected the new
|
|
116
|
-
* text with it, across a decision the reader had not taken. Feeding these to `wordBoundary`
|
|
117
|
-
* makes each half its own word.
|
|
118
|
-
*
|
|
119
|
-
* Only the halves this view actually renders contribute. `proposed` paints no deletion, so it
|
|
120
|
-
* has no seams and this answers empty — which is also why the walk reads the LAYOUT rather
|
|
121
|
-
* than the tree.
|
|
122
|
-
*/
|
|
123
|
-
declare function deletedTextBoundaries(layout: SemanticLayout, paragraphId: string): ReadonlySet<number>;
|
|
124
|
-
/** Story-scoped stops are required when navigating inside an open header or footer. */
|
|
125
|
-
interface MoveCaretOptions {
|
|
126
|
-
/** Precomputed active-story stops; body navigation keeps the indexed default. */
|
|
127
|
-
readonly stops?: readonly CaretGeometry[];
|
|
128
|
-
readonly measurer?: TextMeasurer;
|
|
129
|
-
}
|
|
130
|
-
/** Move a caret; vertical movement carries a desired X through shorter lines. */
|
|
131
|
-
declare function moveCaret(layout: SemanticLayout, position: SemanticPosition, command: NavigationCommand, desiredX?: number | null, options?: MoveCaretOptions): {
|
|
132
|
-
position: SemanticPosition;
|
|
133
|
-
desiredX: number | null;
|
|
134
|
-
} | null;
|
|
135
|
-
/**
|
|
136
|
-
* The anchor an IME composition is attached to.
|
|
137
|
-
*
|
|
138
|
-
* Composition needs a position that survives the intermediate transactions it produces, so
|
|
139
|
-
* it is expressed in model coordinates and re-resolved against each new layout rather than
|
|
140
|
-
* cached as geometry.
|
|
141
|
-
*/
|
|
142
|
-
declare function compositionAnchor(layout: SemanticLayout, position: SemanticPosition,
|
|
143
|
-
/** For an exact mid-span x (layout publishes no eager caret edges; see caretAt). */
|
|
144
|
-
measurer?: TextMeasurer): CaretGeometry | null;
|
|
145
|
-
/** The style spans a selection touches, for reporting active formatting. */
|
|
146
|
-
declare function spansInSelection(layout: SemanticLayout, selection: SemanticSelection,
|
|
147
|
-
/**
|
|
148
|
-
* Reading order of the ACTIVE story. See {@link orderPositions}.
|
|
149
|
-
*
|
|
150
|
-
* REQUIRED. A default here can only be one story's order, and whichever one it is will be
|
|
151
|
-
* wrong for every caret in another — which is exactly how this read came to answer about the
|
|
152
|
-
* body while the caret sat in a header. Requiring it is what makes the compiler find a call
|
|
153
|
-
* site that forgot, and it already found one.
|
|
154
|
-
*
|
|
155
|
-
* A caller with no story in hand passes {@link everyStoryOrder}, which covers all of them: a
|
|
156
|
-
* selection cannot span two stories, so only the order WITHIN one is ever compared.
|
|
157
|
-
*/
|
|
158
|
-
order: readonly string[]): StyleSpanRecord[];
|
|
159
|
-
|
|
160
|
-
export { type CaretGeometry as C, type MoveCaretOptions as M, type NavigationCommand as N, type SemanticPosition as S, type SemanticSelection as a, type SelectionRect as b, type CaretAtOptions as c, caretAt as d, caretStops as e, caretStopsForBlocks as f, compositionAnchor as g, contentControlAtSemantic as h, contentControlsInLayout as i, deletedTextBoundaries as j, hitTestSemantic as k, moveCaret as m, paragraphTextFromLayout as p, spansInSelection as s };
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import { C as ContentControlBoundaryRecord, S as SemanticLayout } from './semantic-records-BpozY7-j.cjs';
|
|
2
|
-
import { V as ValidatedImageBytesHandle, t as RenderableImageMime } from './tree-op-types-BUulYD5y.cjs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Everything a host can say about ONE author's presentation. Every field is optional and
|
|
6
|
-
* every field is presentation-only — nothing here is ever serialised into the document.
|
|
7
|
-
*
|
|
8
|
-
* Deliberately about the PAINTED DOCUMENT (which only the painter can style) plus the
|
|
9
|
-
* author's identity data. Review-card DESIGN is not configured here: the review chrome
|
|
10
|
-
* follows `color` as its accent automatically, and everything further is composition —
|
|
11
|
-
* a custom card reading this style through the review surface's `useReviewAuthor`, or
|
|
12
|
-
* CSS on the cards' `data-review-author`/`data-review-author-slot` hooks.
|
|
13
|
-
*
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
interface RevisionAuthorStyle {
|
|
17
|
-
/**
|
|
18
|
-
* Ink and decoration colour of this author's changes in the document — and the accent
|
|
19
|
-
* the review chrome keys on (avatar disc, card variable, marker).
|
|
20
|
-
*/
|
|
21
|
-
color?: string;
|
|
22
|
-
/** Background wash behind this author's changes in the document. */
|
|
23
|
-
background?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Class names added to every painted span of this author's changes, for styling the
|
|
26
|
-
* typed fields do not cover. Keep the rules metric-safe (outlines, shadows, accents):
|
|
27
|
-
* the engine measures the text it paints, and a class that resizes glyphs drifts the
|
|
28
|
-
* page from its layout.
|
|
29
|
-
*/
|
|
30
|
-
spanClassName?: string;
|
|
31
|
-
/** Avatar image for this author; the packaged card renders it in place of initials. */
|
|
32
|
-
avatarUrl?: string;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Per-author style assignments.
|
|
36
|
-
*
|
|
37
|
-
* Keys match `w:author` exactly; a value is a CSS colour or a full
|
|
38
|
-
* {@link RevisionAuthorStyle}. `others` says what authors WITHOUT an entry take: the
|
|
39
|
-
* `--doc-review-author-N` ramp by default, or `'kind'` to leave them on the kind colours —
|
|
40
|
-
* which is how "highlight these reviewers, leave everyone else green and red" is said.
|
|
41
|
-
*
|
|
42
|
-
* @public
|
|
43
|
-
*/
|
|
44
|
-
interface RevisionAuthorAssignments {
|
|
45
|
-
/** Authors without an entry: the ramp (default), or the `'kind'` colours. */
|
|
46
|
-
readonly others?: 'kind' | 'author';
|
|
47
|
-
readonly authors: Readonly<Record<string, string | RevisionAuthorStyle>>;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* How painted tracked changes are coloured.
|
|
51
|
-
*
|
|
52
|
-
* - `'author'` (the DEFAULT) — every change takes its author's colour from the
|
|
53
|
-
* `--doc-review-author-N` ramp. An attached document seeds slots by order of first
|
|
54
|
-
* appearance, then keeps those assignments stable for that session. Word's own default,
|
|
55
|
-
* and the reason it is this engine's: a paragraph three people edited has to read as three
|
|
56
|
-
* people. Restyle a slot under `.docx-editor` to change the ramp.
|
|
57
|
-
* - `'kind'` — insertions and deletions take the two kind colours
|
|
58
|
-
* (`--doc-revision-insertion` / `--doc-revision-deletion`), so "added" and "removed" are
|
|
59
|
-
* what a reader tells apart at a glance, whoever proposed them.
|
|
60
|
-
* - {@link RevisionAuthorAssignments} — style the named authors; `others` decides whether
|
|
61
|
-
* the rest take the ramp (the default) or the kind colours.
|
|
62
|
-
*
|
|
63
|
-
* Presentation only: nothing here is ever serialised into the document.
|
|
64
|
-
*
|
|
65
|
-
* @public
|
|
66
|
-
*/
|
|
67
|
-
type RevisionStyles = 'kind' | 'author' | RevisionAuthorAssignments;
|
|
68
|
-
/**
|
|
69
|
-
* One document author, resolved: who, which ramp slot, and what they draw in.
|
|
70
|
-
*
|
|
71
|
-
* @public
|
|
72
|
-
*/
|
|
73
|
-
interface ReviewAuthorInfo {
|
|
74
|
-
/** The `w:author` string, exactly as the file carries it. */
|
|
75
|
-
readonly author: string;
|
|
76
|
-
/**
|
|
77
|
-
* Stable session rank, seeded by order of first appearance — an UNBOUNDED index.
|
|
78
|
-
*
|
|
79
|
-
* The ramp defines {@link REVIEW_AUTHOR_SLOTS} colours and every DOM hook wraps into it,
|
|
80
|
-
* so the ninth author ranks 8 here and carries `data-review-author-slot="0"`. Building a
|
|
81
|
-
* selector from this value needs the same wrap: `slot % 8`.
|
|
82
|
-
*/
|
|
83
|
-
readonly slot: number;
|
|
84
|
-
/**
|
|
85
|
-
* The colour this author is DRAWN IN by the review chrome — their declared colour, or
|
|
86
|
-
* their ramp slot's token.
|
|
87
|
-
*
|
|
88
|
-
* Not necessarily what the document paints. `'kind'`, and `others: 'kind'` for an author
|
|
89
|
-
* with no declaration, colour the painted text by insertion/deletion instead, while the
|
|
90
|
-
* cards keep the per-author accent this reports.
|
|
91
|
-
*/
|
|
92
|
-
readonly color: string;
|
|
93
|
-
/** The host-supplied style, normalised; absent when the author rides the ramp. */
|
|
94
|
-
readonly style?: RevisionAuthorStyle;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/** Host port for safe blob URLs — only called for {@link ImageResourceState.kind} `ready`. */
|
|
98
|
-
interface PaintImageUrlPort {
|
|
99
|
-
create(handle: ValidatedImageBytesHandle, mime: RenderableImageMime): string;
|
|
100
|
-
revoke(url: string): void;
|
|
101
|
-
}
|
|
102
|
-
/** Localized refusal labels; adapters supply i18n-backed implementations. */
|
|
103
|
-
interface DrawingPaintStrings {
|
|
104
|
-
readonly unsupportedFormat: (format: string) => string;
|
|
105
|
-
readonly nonPictureGraphic: (kind: string) => string;
|
|
106
|
-
readonly missingResource: string;
|
|
107
|
-
readonly externalResource: string;
|
|
108
|
-
readonly invalidResource: string;
|
|
109
|
-
readonly contentMismatch: string;
|
|
110
|
-
readonly decodeFailed: string;
|
|
111
|
-
readonly resourceLimit: string;
|
|
112
|
-
readonly pendingResource: string;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* When a field's result is drawn on its grey block, following Word's own View option.
|
|
117
|
-
*
|
|
118
|
-
* `when-selected` is Word's default and the reason the option exists at all: a document dense
|
|
119
|
-
* with cross-references turns largely grey under `always`, and under `never` a reader cannot
|
|
120
|
-
* tell computed text from typed text at all.
|
|
121
|
-
*/
|
|
122
|
-
type FieldShadingMode = 'never' | 'when-selected' | 'always';
|
|
123
|
-
/** Word's default: shaded only while the caret is inside the field. */
|
|
124
|
-
declare const DEFAULT_FIELD_SHADING: FieldShadingMode;
|
|
125
|
-
/**
|
|
126
|
-
* How a layout is painted into DOM. Every field is optional.
|
|
127
|
-
*
|
|
128
|
-
* The painted pages ARE the editable surface, so everything here is presentation-only — nothing
|
|
129
|
-
* set through these options is ever serialised back into the document.
|
|
130
|
-
*/
|
|
131
|
-
interface PaintOptions {
|
|
132
|
-
/** Points to CSS pixels. 96/72 renders a point as a CSS point at 100% zoom. */
|
|
133
|
-
readonly scale?: number;
|
|
134
|
-
/** Generated paragraphs that paint as non-editable navigation surfaces. */
|
|
135
|
-
readonly readOnlyParagraphIds?: ReadonlySet<string>;
|
|
136
|
-
/**
|
|
137
|
-
* Empty-TOC begin paragraphs that paint subtle identifiable furniture. Paint-only — never
|
|
138
|
-
* serialised into the document.
|
|
139
|
-
*/
|
|
140
|
-
readonly emptyTocPlaceholderIds?: ReadonlySet<string>;
|
|
141
|
-
/** Marks painted pages as presentational, so assistive tech reads the editable projection. */
|
|
142
|
-
readonly ariaHidden?: boolean;
|
|
143
|
-
/**
|
|
144
|
-
* Page indices to build in detail (task 9.4).
|
|
145
|
-
*
|
|
146
|
-
* Omitted means all of them. A page left out keeps its size and position but no content,
|
|
147
|
-
* so the document's height and page count are unchanged and scrolling to it reveals it
|
|
148
|
-
* instead of reflowing everything underneath.
|
|
149
|
-
*/
|
|
150
|
-
readonly materialize?: ReadonlySet<number>;
|
|
151
|
-
/**
|
|
152
|
-
* Family-alias lookup for fonts the host registered on behalf of THIS document (see
|
|
153
|
-
* {@link PaintContext.fontAlias}). Painted runs emit the alias ahead of the declared
|
|
154
|
-
* family, so a file can never shadow a family name the host page uses.
|
|
155
|
-
*/
|
|
156
|
-
readonly fontAlias?: (family: string) => string | undefined;
|
|
157
|
-
/** See {@link PaintContext.defaultFontFamily}. */
|
|
158
|
-
readonly defaultFontFamily?: string;
|
|
159
|
-
/** See {@link PaintContext.fieldShading}. */
|
|
160
|
-
readonly fieldShading?: FieldShadingMode;
|
|
161
|
-
/** See {@link PaintContext.shadeFormFields}. */
|
|
162
|
-
readonly shadeFormFields?: boolean;
|
|
163
|
-
/**
|
|
164
|
-
* How tracked changes are coloured: by AUTHOR through the `--doc-review-author-N`
|
|
165
|
-
* ramp (the default, as in Word), by kind, or by author with host-pinned colours.
|
|
166
|
-
* See {@link RevisionStyles}.
|
|
167
|
-
*/
|
|
168
|
-
readonly revisionStyles?: RevisionStyles;
|
|
169
|
-
/**
|
|
170
|
-
* Relationship id of the header/footer story currently open for editing.
|
|
171
|
-
*
|
|
172
|
-
* When set, the matching `[data-docx-hf]` container is editable and every body
|
|
173
|
-
* `.docx-page-content` box is inert; all other furniture stays read-only.
|
|
174
|
-
*
|
|
175
|
-
* Deliberately OUTSIDE the paint-reuse key: entering a header must not rebuild
|
|
176
|
-
* body sheets. Chrome is applied to already-painted nodes in place, the way TOC
|
|
177
|
-
* hover is.
|
|
178
|
-
*/
|
|
179
|
-
readonly activeHeaderFooterRId?: string;
|
|
180
|
-
/**
|
|
181
|
-
* Sheet that hosts the active visual occurrence of a shared furniture part.
|
|
182
|
-
*
|
|
183
|
-
* Required with {@link activeHeaderFooterRId} so only one painted copy receives
|
|
184
|
-
* `data-docx-hf-active` / the engine caret when the same rId appears on many pages.
|
|
185
|
-
* Also outside the paint-reuse key — moving the caret across shared copies retints
|
|
186
|
-
* markers in place rather than replacing every page.
|
|
187
|
-
*/
|
|
188
|
-
readonly activeHeaderFooterPageIndex?: number;
|
|
189
|
-
/**
|
|
190
|
-
* On-demand content-control boundary chrome (show-all and/or caret-entry).
|
|
191
|
-
*
|
|
192
|
-
* Furniture only — never contributes layout records or changes page geometry. Omitted or
|
|
193
|
-
* empty means no control chrome is painted. Folded into the paint-reuse key so a toggle
|
|
194
|
-
* rebuilds furniture without a layout pass.
|
|
195
|
-
*/
|
|
196
|
-
readonly contentControlChrome?: {
|
|
197
|
-
readonly showAll?: boolean;
|
|
198
|
-
/** Control ids whose boundaries are visible because the caret is inside them. */
|
|
199
|
-
readonly activeIds?: ReadonlySet<string>;
|
|
200
|
-
/**
|
|
201
|
-
* Control ids whose boundaries are visible because the pointer is over them.
|
|
202
|
-
* Used for TOC hover chrome without projecting a persistent caret-active state.
|
|
203
|
-
*
|
|
204
|
-
* Deliberately OUTSIDE the paint-reuse key: hover must never rebuild a page. The
|
|
205
|
-
* surface toggles `data-hover` / `data-boundary-visible` on the painted chrome it
|
|
206
|
-
* already has, and this set only tells a page that rebuilds for some OTHER reason
|
|
207
|
-
* which of its controls is currently under the pointer.
|
|
208
|
-
*/
|
|
209
|
-
readonly hoverIds?: ReadonlySet<string>;
|
|
210
|
-
/**
|
|
211
|
-
* Control ids whose boundary furniture is painted by something else.
|
|
212
|
-
*
|
|
213
|
-
* An empty TOC paints its own placeholder box on the begin paragraph, so drawing the
|
|
214
|
-
* control boundary as well left two rounded rectangles (of different heights) plus a
|
|
215
|
-
* label chip stacked over one empty region.
|
|
216
|
-
*/
|
|
217
|
-
readonly suppressedIds?: ReadonlySet<string>;
|
|
218
|
-
/** Checkbox control ids whose canonical `w14:checked` state is on. */
|
|
219
|
-
readonly checkedIds?: ReadonlySet<string>;
|
|
220
|
-
/** Non-SDT structured regions that intentionally reuse content-control chrome. */
|
|
221
|
-
readonly additionalBoundaries?: readonly ContentControlBoundaryRecord[];
|
|
222
|
-
/** Control ids that represent TOC regions (hover-only chrome; never caret-sticky). */
|
|
223
|
-
readonly tocControlIds?: ReadonlySet<string>;
|
|
224
|
-
/**
|
|
225
|
-
* No control may be written right now — viewing mode, or a protected document.
|
|
226
|
-
*
|
|
227
|
-
* The widget is a `<button>` the ENGINE paints, and a click on it commits a tree op, so
|
|
228
|
-
* an enabled-looking checkbox on a read-only document is not a cosmetic lie: it is the
|
|
229
|
-
* write itself. Disabling it here also stops the pointer lane, which already skips a
|
|
230
|
-
* widget carrying `data-disabled-reason`.
|
|
231
|
-
*/
|
|
232
|
-
readonly readOnly?: boolean;
|
|
233
|
-
};
|
|
234
|
-
readonly drawingStrings?: DrawingPaintStrings;
|
|
235
|
-
readonly imageUrlPort?: PaintImageUrlPort;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* Paint a whole layout into a container, reusing the pages that did not change.
|
|
240
|
-
*
|
|
241
|
-
* The DOM is built with `createElement` and `textContent` only — no file-derived string is
|
|
242
|
-
* ever parsed as markup — and stray children (nothing this module painted) are removed, so
|
|
243
|
-
* the container's content is always exactly the painted pages.
|
|
244
|
-
*/
|
|
245
|
-
declare function paintSemanticLayout(container: HTMLElement, layout: SemanticLayout, options?: PaintOptions): void;
|
|
246
|
-
|
|
247
|
-
export { DEFAULT_FIELD_SHADING as D, type FieldShadingMode as F, type PaintOptions as P, type ReviewAuthorInfo as R, type RevisionAuthorAssignments as a, type RevisionAuthorStyle as b, type RevisionStyles as c, type DrawingPaintStrings as d, paintSemanticLayout as p };
|