@arbidocs/blocks 0.4.108 → 0.4.110
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/dist/{NativeDocxEditor-UAZUKZ77.js → NativeDocxEditor-4PY4YZYC.js} +3 -3
- package/dist/{NativeDocxEditor-UAZUKZ77.js.map → NativeDocxEditor-4PY4YZYC.js.map} +1 -1
- package/dist/{NativeDocxEditor-YX7B7OFH.cjs → NativeDocxEditor-WODZAURG.cjs} +7 -7
- package/dist/{NativeDocxEditor-YX7B7OFH.cjs.map → NativeDocxEditor-WODZAURG.cjs.map} +1 -1
- package/dist/agents/index.cjs +286 -286
- package/dist/agents/index.js +10 -10
- package/dist/agents/tasks/ConversationListView.d.ts +5 -1
- package/dist/agents/tasks/TaskActivityTimeline.d.ts +5 -1
- package/dist/calendar/EventDetails.d.ts +1 -1
- package/dist/calendar/index.cjs +13 -0
- package/dist/calendar/index.cjs.map +1 -1
- package/dist/calendar/index.js +13 -0
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/types.d.ts +3 -0
- package/dist/calls/CallSidePanel.d.ts +17 -0
- package/dist/calls/CallStage.d.ts +57 -0
- package/dist/calls/ControlBar.d.ts +91 -0
- package/dist/calls/ControlButton.d.ts +44 -0
- package/dist/calls/PreJoin.d.ts +31 -0
- package/dist/calls/cards.d.ts +54 -0
- package/dist/calls/hooks.d.ts +20 -0
- package/dist/calls/index.cjs +1853 -0
- package/dist/calls/index.cjs.map +1 -0
- package/dist/calls/index.d.ts +20 -0
- package/dist/calls/index.js +1737 -0
- package/dist/calls/index.js.map +1 -0
- package/dist/calls/join-choices.d.ts +11 -0
- package/dist/calls/layout.d.ts +106 -0
- package/dist/calls/panels.d.ts +55 -0
- package/dist/calls/status.d.ts +69 -0
- package/dist/calls/tiles.d.ts +59 -0
- package/dist/chat/Message.d.ts +17 -2
- package/dist/chat/TranscriptLine.d.ts +50 -0
- package/dist/chat/index.cjs +147 -126
- package/dist/chat/index.d.ts +3 -1
- package/dist/chat/index.js +5 -4
- package/dist/chat/transcript-runs.d.ts +6 -0
- package/dist/{chunk-QT6EGMAJ.cjs → chunk-2NIL2ASF.cjs} +38 -294
- package/dist/chunk-2NIL2ASF.cjs.map +1 -0
- package/dist/{chunk-XMBYDLZQ.cjs → chunk-2UAJVK3C.cjs} +4 -4
- package/dist/{chunk-XMBYDLZQ.cjs.map → chunk-2UAJVK3C.cjs.map} +1 -1
- package/dist/{chunk-TTXK62YI.cjs → chunk-54WBIVHV.cjs} +5 -5
- package/dist/{chunk-TTXK62YI.cjs.map → chunk-54WBIVHV.cjs.map} +1 -1
- package/dist/{chunk-7C35WXYB.js → chunk-5HFPRI3W.js} +5 -5
- package/dist/chunk-5HFPRI3W.js.map +1 -0
- package/dist/{chunk-S7RHJI5Q.js → chunk-6RHHMBZ5.js} +158 -5
- package/dist/chunk-6RHHMBZ5.js.map +1 -0
- package/dist/{chunk-3Y6NQIDE.js → chunk-A35KT2II.js} +37 -19
- package/dist/chunk-A35KT2II.js.map +1 -0
- package/dist/{chunk-PGDL26TQ.js → chunk-AY32GGKU.js} +10 -4
- package/dist/{chunk-PGDL26TQ.js.map → chunk-AY32GGKU.js.map} +1 -1
- package/dist/{chunk-IXALYQT7.cjs → chunk-C2CWWEHO.cjs} +2 -2
- package/dist/chunk-C2CWWEHO.cjs.map +1 -0
- package/dist/{chunk-S55VDTX3.js → chunk-CECWAIHL.js} +3 -3
- package/dist/{chunk-S55VDTX3.js.map → chunk-CECWAIHL.js.map} +1 -1
- package/dist/{chunk-XQDM6T6C.js → chunk-CXZ7FPTQ.js} +3 -3
- package/dist/{chunk-XQDM6T6C.js.map → chunk-CXZ7FPTQ.js.map} +1 -1
- package/dist/{chunk-C2HRZSAT.cjs → chunk-DJM7DLCT.cjs} +5 -5
- package/dist/chunk-DJM7DLCT.cjs.map +1 -0
- package/dist/{chunk-XQKGYGCJ.js → chunk-DQCYCEDR.js} +3 -3
- package/dist/{chunk-XQKGYGCJ.js.map → chunk-DQCYCEDR.js.map} +1 -1
- package/dist/{chunk-ZYSY4L5L.cjs → chunk-ELDUWTRR.cjs} +4 -4
- package/dist/{chunk-ZYSY4L5L.cjs.map → chunk-ELDUWTRR.cjs.map} +1 -1
- package/dist/{chunk-A2MN2ZLX.js → chunk-GKDWQLVU.js} +13 -274
- package/dist/chunk-GKDWQLVU.js.map +1 -0
- package/dist/{chunk-24ND4S6Y.cjs → chunk-HBBJYRGI.cjs} +162 -5
- package/dist/{chunk-S7RHJI5Q.js.map → chunk-HBBJYRGI.cjs.map} +1 -1
- package/dist/{chunk-P2KPDPFF.js → chunk-IXTQYFIF.js} +23 -15
- package/dist/chunk-IXTQYFIF.js.map +1 -0
- package/dist/{chunk-JQVPGMLU.js → chunk-JB32KYAH.js} +3 -3
- package/dist/{chunk-JQVPGMLU.js.map → chunk-JB32KYAH.js.map} +1 -1
- package/dist/{chunk-PBS5MFIY.cjs → chunk-JK45LSIH.cjs} +3 -3
- package/dist/{chunk-PBS5MFIY.cjs.map → chunk-JK45LSIH.cjs.map} +1 -1
- package/dist/chunk-MWDW5UBW.cjs +199 -0
- package/dist/chunk-MWDW5UBW.cjs.map +1 -0
- package/dist/{chunk-ZPLG7QYF.js → chunk-N5YEF3LC.js} +2 -2
- package/dist/chunk-N5YEF3LC.js.map +1 -0
- package/dist/{chunk-EWSEQEPL.js → chunk-NRUPUDWB.js} +17 -7
- package/dist/chunk-NRUPUDWB.js.map +1 -0
- package/dist/{chunk-DDF5GPIJ.js → chunk-P5ST47VY.js} +3 -3
- package/dist/{chunk-DDF5GPIJ.js.map → chunk-P5ST47VY.js.map} +1 -1
- package/dist/{chunk-EGDWNEAG.js → chunk-PEHLUB52.js} +3 -3
- package/dist/{chunk-EGDWNEAG.js.map → chunk-PEHLUB52.js.map} +1 -1
- package/dist/{chunk-W7NZRZ54.js → chunk-SQNAJPNR.js} +4 -4
- package/dist/{chunk-W7NZRZ54.js.map → chunk-SQNAJPNR.js.map} +1 -1
- package/dist/{chunk-DTBSGG36.cjs → chunk-U6MPHCEB.cjs} +24 -16
- package/dist/chunk-U6MPHCEB.cjs.map +1 -0
- package/dist/{chunk-MP6FK43E.cjs → chunk-VP4KJ4LK.cjs} +17 -6
- package/dist/chunk-VP4KJ4LK.cjs.map +1 -0
- package/dist/{chunk-LLFW2T6S.cjs → chunk-VZKBI2KJ.cjs} +85 -67
- package/dist/chunk-VZKBI2KJ.cjs.map +1 -0
- package/dist/{chunk-5YXG342J.cjs → chunk-W7ZDBPJ3.cjs} +4 -4
- package/dist/{chunk-5YXG342J.cjs.map → chunk-W7ZDBPJ3.cjs.map} +1 -1
- package/dist/{chunk-SKSE4OT6.cjs → chunk-WPVIOGDG.cjs} +5 -5
- package/dist/{chunk-SKSE4OT6.cjs.map → chunk-WPVIOGDG.cjs.map} +1 -1
- package/dist/{chunk-3US5OIDQ.cjs → chunk-XSUOEJB3.cjs} +9 -3
- package/dist/chunk-XSUOEJB3.cjs.map +1 -0
- package/dist/chunk-Z3AZ7Q5X.js +177 -0
- package/dist/chunk-Z3AZ7Q5X.js.map +1 -0
- package/dist/{chunk-Z5VUZ6YD.cjs → chunk-ZV3BKLFY.cjs} +3 -3
- package/dist/{chunk-Z5VUZ6YD.cjs.map → chunk-ZV3BKLFY.cjs.map} +1 -1
- package/dist/citations/index.cjs +10 -10
- package/dist/citations/index.js +1 -1
- package/dist/collaboration/index.cjs +57 -57
- package/dist/collaboration/index.js +3 -3
- package/dist/connect/docx.cjs +6 -6
- package/dist/connect/docx.js +4 -4
- package/dist/connect/index.cjs +87 -87
- package/dist/connect/index.js +16 -16
- package/dist/databases/index.cjs +2 -2
- package/dist/databases/index.js +1 -1
- package/dist/docx/definitions/fragment.d.ts +2 -6
- package/dist/docx/definitions/port.d.ts +2 -57
- package/dist/docx/index.cjs +46 -46
- package/dist/docx/index.js +3 -3
- package/dist/docx/references/commands.d.ts +3 -31
- package/dist/docx/references/numbering.d.ts +3 -47
- package/dist/facts/index.cjs +5 -5
- package/dist/facts/index.js +4 -4
- package/dist/files/GridView.d.ts +4 -1
- package/dist/files/TagPassagePanel.d.ts +2 -0
- package/dist/files/index.cjs +89 -79
- package/dist/files/index.cjs.map +1 -1
- package/dist/files/index.js +88 -78
- package/dist/files/index.js.map +1 -1
- package/dist/home/index.cjs +17 -17
- package/dist/home/index.js +3 -3
- package/dist/index.cjs +739 -718
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -21
- package/dist/index.js.map +1 -1
- package/dist/retrieval/index.cjs +1 -1
- package/dist/retrieval/index.js +1 -1
- package/dist/settings/FirmPool.d.ts +45 -0
- package/dist/settings/index.cjs +134 -37
- package/dist/settings/index.cjs.map +1 -1
- package/dist/settings/index.d.ts +1 -0
- package/dist/settings/index.js +100 -6
- package/dist/settings/index.js.map +1 -1
- package/dist/shell/index.cjs +12 -12
- package/dist/shell/index.js +4 -4
- package/dist/site/index.cjs +5 -5
- package/dist/site/index.js +1 -1
- package/dist/studio/index.cjs +5 -5
- package/dist/studio/index.js +4 -4
- package/dist/workflow-canvas/index.cjs +53 -53
- package/dist/workflow-canvas/index.js +10 -10
- package/dist/workspaces/index.cjs +3 -3
- package/dist/workspaces/index.cjs.map +1 -1
- package/dist/workspaces/index.js +3 -3
- package/dist/workspaces/index.js.map +1 -1
- package/node_modules/@arbidocs/coedit/dist/commands.cjs +356 -0
- package/node_modules/@arbidocs/coedit/dist/commands.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/commands.d.cts +235 -0
- package/node_modules/@arbidocs/coedit/dist/commands.d.ts +235 -0
- package/node_modules/@arbidocs/coedit/dist/commands.js +338 -0
- package/node_modules/@arbidocs/coedit/dist/commands.js.map +1 -0
- package/node_modules/@arbidocs/coedit/package.json +6 -1
- package/package.json +15 -5
- package/src/calls/calls.css +157 -0
- package/dist/chunk-24ND4S6Y.cjs.map +0 -1
- package/dist/chunk-3US5OIDQ.cjs.map +0 -1
- package/dist/chunk-3Y6NQIDE.js.map +0 -1
- package/dist/chunk-7C35WXYB.js.map +0 -1
- package/dist/chunk-A2MN2ZLX.js.map +0 -1
- package/dist/chunk-C2HRZSAT.cjs.map +0 -1
- package/dist/chunk-DTBSGG36.cjs.map +0 -1
- package/dist/chunk-EWSEQEPL.js.map +0 -1
- package/dist/chunk-IXALYQT7.cjs.map +0 -1
- package/dist/chunk-LLFW2T6S.cjs.map +0 -1
- package/dist/chunk-MP6FK43E.cjs.map +0 -1
- package/dist/chunk-P2KPDPFF.js.map +0 -1
- package/dist/chunk-QT6EGMAJ.cjs.map +0 -1
- package/dist/chunk-ZPLG7QYF.js.map +0 -1
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The read side of the Word-editor commands: a document's paragraphs as the commands see them
|
|
3
|
+
* (text in the engine's offset vocabulary, bookmarks, internal links, fields, note references),
|
|
4
|
+
* read from the engine's OOXML tree. The same tree comes from a live editor
|
|
5
|
+
* (`surface.session.part().root`) or from document bytes (`openHeadlessDocument`), so the toolbar
|
|
6
|
+
* and ARBI's headless tools read a document the same way.
|
|
7
|
+
*/
|
|
8
|
+
/** Character style of an inserted term: a dotted underline, so a defined term reads as one. */
|
|
9
|
+
declare const DEFINED_TERM_STYLE = "DefinedTerm";
|
|
10
|
+
/** Character style of a cross-reference: a muted blue with a dotted underline (Word's name). */
|
|
11
|
+
declare const CROSS_REFERENCE_STYLE = "CrossReference";
|
|
12
|
+
/** Character style of a cross-reference whose target is gone: its last text, flagged. */
|
|
13
|
+
declare const BROKEN_CROSS_REFERENCE_STYLE = "CrossReferenceBroken";
|
|
14
|
+
/** A position: a paragraph (the engine's node id) and a UTF-16 offset into its text. */
|
|
15
|
+
interface DocPoint {
|
|
16
|
+
paragraphId: string;
|
|
17
|
+
offset: number;
|
|
18
|
+
}
|
|
19
|
+
/** An internal link in a paragraph. */
|
|
20
|
+
interface DocLink {
|
|
21
|
+
anchor: string;
|
|
22
|
+
text: string;
|
|
23
|
+
/** Where its text starts in the paragraph's text. */
|
|
24
|
+
offset?: number;
|
|
25
|
+
}
|
|
26
|
+
/** A footnote or endnote reference: one character of the paragraph, as the engine counts it. */
|
|
27
|
+
interface DocNote {
|
|
28
|
+
offset: number;
|
|
29
|
+
kind: 'footnote' | 'endnote';
|
|
30
|
+
/** `w:id` of the note. */
|
|
31
|
+
id: string;
|
|
32
|
+
}
|
|
33
|
+
/** One paragraph, in document order. */
|
|
34
|
+
interface DocParagraph {
|
|
35
|
+
id: string;
|
|
36
|
+
/** `w14:paraId`, the id that is the same in every replica of a collaboration room. */
|
|
37
|
+
paraId?: string;
|
|
38
|
+
text: string;
|
|
39
|
+
/** Styled as a heading (a `Heading n` style or an outline level). */
|
|
40
|
+
heading: boolean;
|
|
41
|
+
styleId?: string;
|
|
42
|
+
/** A paragraph of the body itself, not inside a table. */
|
|
43
|
+
topLevel: boolean;
|
|
44
|
+
/** Names of the bookmarks that start in it. */
|
|
45
|
+
bookmarks: string[];
|
|
46
|
+
/** Its internal links (`w:hyperlink w:anchor`). */
|
|
47
|
+
links: DocLink[];
|
|
48
|
+
/** Its complex fields: where each sits (its one-character offset), its instruction and result. */
|
|
49
|
+
fields?: DocField[];
|
|
50
|
+
/** Its runs in a watched character style (a broken cross-reference's mark), with their text. */
|
|
51
|
+
marks?: DocMark[];
|
|
52
|
+
/** Its footnote and endnote references. */
|
|
53
|
+
notes?: DocNote[];
|
|
54
|
+
}
|
|
55
|
+
/** A stretch of a paragraph's text in a watched character style. */
|
|
56
|
+
interface DocMark {
|
|
57
|
+
styleId: string;
|
|
58
|
+
offset: number;
|
|
59
|
+
text: string;
|
|
60
|
+
}
|
|
61
|
+
/** Character styles whose runs a paragraph read reports as marks. */
|
|
62
|
+
declare const WATCHED_STYLES: Set<string>;
|
|
63
|
+
/** A complex field of a paragraph. */
|
|
64
|
+
interface DocField {
|
|
65
|
+
offset: number;
|
|
66
|
+
instruction: string;
|
|
67
|
+
result: string;
|
|
68
|
+
}
|
|
69
|
+
type OoxmlNodeLike = {
|
|
70
|
+
id: string;
|
|
71
|
+
kind: string;
|
|
72
|
+
localName?: string;
|
|
73
|
+
value?: string;
|
|
74
|
+
attributes?: readonly {
|
|
75
|
+
localName: string;
|
|
76
|
+
value: string;
|
|
77
|
+
}[];
|
|
78
|
+
children?: readonly OoxmlNodeLike[];
|
|
79
|
+
};
|
|
80
|
+
/** How a field (or a note reference) counts in a paragraph's text (the engine's model vocabulary). */
|
|
81
|
+
declare const FIELD_ATOM = "\uFFFC";
|
|
82
|
+
/** The paragraphs of a part's body, read from the engine's OOXML tree. */
|
|
83
|
+
declare function readParagraphs(root: OoxmlNodeLike): DocParagraph[];
|
|
84
|
+
/** Style id to style name (`Heading1` → `heading 1`), from a styles part's tree. */
|
|
85
|
+
declare function styleNames(root: OoxmlNodeLike | null | undefined): Map<string, string>;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Cross-reference targets: the document's numbered paragraphs (clauses, sub-clauses, numbered
|
|
89
|
+
* captions) and its headings, with the number Word's `REF \r` shows for each.
|
|
90
|
+
*
|
|
91
|
+
* The number is what the editor computes for a `REF … \r` field — and it has to be exactly that,
|
|
92
|
+
* because the engine shows a field's live value only while the field's cached result matches what
|
|
93
|
+
* it computes (otherwise it keeps the cached text for good). So this mirrors the engine: the
|
|
94
|
+
* paragraph's own list level, preceded by each higher level whose number its level text does not
|
|
95
|
+
* already show (`%1.%2` already shows level 1; `(%3)` does not show `2.1`), and one trailing
|
|
96
|
+
* period dropped (`2.` reads `2`).
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
/** A paragraph's resolved list numbering (the engine's list item). */
|
|
100
|
+
interface ListItemInfo {
|
|
101
|
+
numId: string;
|
|
102
|
+
ilvl: number;
|
|
103
|
+
markerText: string;
|
|
104
|
+
numFmt: string;
|
|
105
|
+
}
|
|
106
|
+
/** A list level's definition: its level text (`%1.%2`) and number format. */
|
|
107
|
+
interface LevelInfo {
|
|
108
|
+
lvlText: string;
|
|
109
|
+
numFmt: string;
|
|
110
|
+
}
|
|
111
|
+
type LevelOf = (numId: string, ilvl: number) => LevelInfo | null;
|
|
112
|
+
/**
|
|
113
|
+
* The number `REF \r` shows for a paragraph, or null when it is not numbered. `order` is every
|
|
114
|
+
* paragraph id in document order (for the markers of the levels above it).
|
|
115
|
+
*/
|
|
116
|
+
declare function paragraphNumber(order: readonly string[], items: ReadonlyMap<string, ListItemInfo>, levelOf: LevelOf, paragraphId: string): string | null;
|
|
117
|
+
/** One place a cross-reference can point at. */
|
|
118
|
+
interface CrossReferenceTarget {
|
|
119
|
+
paragraphId: string;
|
|
120
|
+
/** A numbered paragraph (clause, sub-clause, caption) or an unnumbered heading. */
|
|
121
|
+
kind: 'numbered' | 'heading';
|
|
122
|
+
/** What `REF \r` shows (`8.2`), or null for an unnumbered heading. */
|
|
123
|
+
number: string | null;
|
|
124
|
+
/** The paragraph's list marker as painted (`8.2`, `(a)`), or empty. */
|
|
125
|
+
marker: string;
|
|
126
|
+
/** The paragraph's text (without its marker). */
|
|
127
|
+
text: string;
|
|
128
|
+
heading: boolean;
|
|
129
|
+
/** Its list level (0 for a top-level clause), or 0 for a heading. */
|
|
130
|
+
level: number;
|
|
131
|
+
}
|
|
132
|
+
/** Every numbered paragraph and every heading, in document order. */
|
|
133
|
+
declare function listTargets(paragraphs: readonly DocParagraph[], items: ReadonlyMap<string, ListItemInfo>, levelOf: LevelOf): CrossReferenceTarget[];
|
|
134
|
+
/** Targets whose number or text contains the query (case-insensitive). */
|
|
135
|
+
declare function filterTargets(targets: readonly CrossReferenceTarget[], query: string): CrossReferenceTarget[];
|
|
136
|
+
/** What the engine's numbering needs of a document: its parts' trees. */
|
|
137
|
+
interface NumberingSource {
|
|
138
|
+
/** The main document part's root. */
|
|
139
|
+
root(): OoxmlNodeLike;
|
|
140
|
+
stylesRoot(): unknown;
|
|
141
|
+
numberingRoot(): unknown;
|
|
142
|
+
settingsRoot(): unknown;
|
|
143
|
+
}
|
|
144
|
+
/** A document's list numbering as the engine resolves it. */
|
|
145
|
+
interface DocumentNumbering {
|
|
146
|
+
/** Each numbered paragraph's list item, by paragraph (node) id. */
|
|
147
|
+
listItems(): ReadonlyMap<string, ListItemInfo>;
|
|
148
|
+
levelOf: LevelOf;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* The numbering of a document, as the editor paints it: from a live editor's session or from a
|
|
152
|
+
* headless document view alike.
|
|
153
|
+
*/
|
|
154
|
+
declare function documentNumbering(source: NumberingSource): DocumentNumbering;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* The cross-references of a document (`REF` fields to `_Ref` bookmarks), each with what it shows
|
|
158
|
+
* and what its target now is: current, stale (a clause renumbered, a heading reworded) or broken
|
|
159
|
+
* (the target is gone).
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
/** Prefix of Word's hidden cross-reference bookmarks. */
|
|
163
|
+
declare const REF_BOOKMARK_PREFIX = "_Ref";
|
|
164
|
+
type CrossReferenceMode = 'number' | 'text';
|
|
165
|
+
/** What reading cross-references needs of a document. */
|
|
166
|
+
interface ReferencesReader {
|
|
167
|
+
paragraphs(): DocParagraph[];
|
|
168
|
+
/** Each numbered paragraph's list item, by paragraph id. */
|
|
169
|
+
listItems(): ReadonlyMap<string, ListItemInfo>;
|
|
170
|
+
levelOf: LevelOf;
|
|
171
|
+
}
|
|
172
|
+
/** One `REF` field to a `_Ref` bookmark. */
|
|
173
|
+
interface CrossReference {
|
|
174
|
+
paragraphId: string;
|
|
175
|
+
offset: number;
|
|
176
|
+
instruction: string;
|
|
177
|
+
bookmark: string;
|
|
178
|
+
mode: CrossReferenceMode;
|
|
179
|
+
/** The field's cached result (what it shows). */
|
|
180
|
+
cached: string;
|
|
181
|
+
/** The paragraph the bookmark is in, or null when it is gone (the reference is broken). */
|
|
182
|
+
target: string | null;
|
|
183
|
+
/** What the reference should show now, or null when that cannot be computed. */
|
|
184
|
+
value: string | null;
|
|
185
|
+
}
|
|
186
|
+
/** A `REF` field whose cached result no longer says what its target now is. */
|
|
187
|
+
interface StaleReference {
|
|
188
|
+
paragraphId: string;
|
|
189
|
+
offset: number;
|
|
190
|
+
instruction: string;
|
|
191
|
+
/** The current value, or null when the target is gone (the reference is broken). */
|
|
192
|
+
value: string | null;
|
|
193
|
+
/** The field's cached result (what it last showed). */
|
|
194
|
+
cached: string;
|
|
195
|
+
bookmark: string;
|
|
196
|
+
mode: CrossReferenceMode;
|
|
197
|
+
}
|
|
198
|
+
/** A cross-reference whose target was deleted: its last text, marked in the Broken style. */
|
|
199
|
+
interface BrokenReference {
|
|
200
|
+
paragraphId: string;
|
|
201
|
+
offset: number;
|
|
202
|
+
text: string;
|
|
203
|
+
}
|
|
204
|
+
/** Every cross-reference of the document, in document order. */
|
|
205
|
+
declare function crossReferences(port: ReferencesReader): CrossReference[];
|
|
206
|
+
/**
|
|
207
|
+
* The cross-references whose cached result is out of date: a clause renumbered, a heading
|
|
208
|
+
* reworded, or the target gone. The editor paints a field's live value only while its cached
|
|
209
|
+
* result matches what it computes, so a stale cache shows the OLD number after the document is
|
|
210
|
+
* reopened (and Word shows the cached result until its fields are updated).
|
|
211
|
+
*/
|
|
212
|
+
declare function staleCrossReferences(port: ReferencesReader): StaleReference[];
|
|
213
|
+
/** The broken cross-references marked in the document, in document order. */
|
|
214
|
+
declare function brokenCrossReferences(port: Pick<ReferencesReader, 'paragraphs'>): BrokenReference[];
|
|
215
|
+
|
|
216
|
+
/** A document's parts as trees: a live editor's session or a headless view (`openHeadlessDocument`). */
|
|
217
|
+
interface DocumentTrees {
|
|
218
|
+
part(): {
|
|
219
|
+
root: unknown;
|
|
220
|
+
};
|
|
221
|
+
stylesRoot(): unknown;
|
|
222
|
+
numberingRoot(): unknown;
|
|
223
|
+
settingsRoot(): unknown;
|
|
224
|
+
}
|
|
225
|
+
/** A read-only snapshot of a document: its paragraphs, numbering and style names. */
|
|
226
|
+
interface DocumentReader extends ReferencesReader, DocumentNumbering {
|
|
227
|
+
/** A style's name (`heading 1`) by its id, or the id when the document does not name it. */
|
|
228
|
+
styleName(styleId: string): string;
|
|
229
|
+
}
|
|
230
|
+
/** Read a document whose trees do not change while the reader is used (a headless view). */
|
|
231
|
+
declare function documentReader(view: DocumentTrees): DocumentReader;
|
|
232
|
+
/** Read a document from its bytes (a collaboration room's `readRoom`). Throws on a bad package. */
|
|
233
|
+
declare function readDocument(bytes: Uint8Array): DocumentReader;
|
|
234
|
+
|
|
235
|
+
export { BROKEN_CROSS_REFERENCE_STYLE, type BrokenReference, CROSS_REFERENCE_STYLE, type CrossReference, type CrossReferenceMode, type CrossReferenceTarget, DEFINED_TERM_STYLE, type DocField, type DocLink, type DocMark, type DocNote, type DocParagraph, type DocPoint, type DocumentNumbering, type DocumentReader, type DocumentTrees, FIELD_ATOM, type LevelInfo, type LevelOf, type ListItemInfo, type NumberingSource, type OoxmlNodeLike, REF_BOOKMARK_PREFIX, type ReferencesReader, type StaleReference, WATCHED_STYLES, brokenCrossReferences, crossReferences, documentNumbering, documentReader, filterTargets, listTargets, paragraphNumber, readDocument, readParagraphs, staleCrossReferences, styleNames };
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The read side of the Word-editor commands: a document's paragraphs as the commands see them
|
|
3
|
+
* (text in the engine's offset vocabulary, bookmarks, internal links, fields, note references),
|
|
4
|
+
* read from the engine's OOXML tree. The same tree comes from a live editor
|
|
5
|
+
* (`surface.session.part().root`) or from document bytes (`openHeadlessDocument`), so the toolbar
|
|
6
|
+
* and ARBI's headless tools read a document the same way.
|
|
7
|
+
*/
|
|
8
|
+
/** Character style of an inserted term: a dotted underline, so a defined term reads as one. */
|
|
9
|
+
declare const DEFINED_TERM_STYLE = "DefinedTerm";
|
|
10
|
+
/** Character style of a cross-reference: a muted blue with a dotted underline (Word's name). */
|
|
11
|
+
declare const CROSS_REFERENCE_STYLE = "CrossReference";
|
|
12
|
+
/** Character style of a cross-reference whose target is gone: its last text, flagged. */
|
|
13
|
+
declare const BROKEN_CROSS_REFERENCE_STYLE = "CrossReferenceBroken";
|
|
14
|
+
/** A position: a paragraph (the engine's node id) and a UTF-16 offset into its text. */
|
|
15
|
+
interface DocPoint {
|
|
16
|
+
paragraphId: string;
|
|
17
|
+
offset: number;
|
|
18
|
+
}
|
|
19
|
+
/** An internal link in a paragraph. */
|
|
20
|
+
interface DocLink {
|
|
21
|
+
anchor: string;
|
|
22
|
+
text: string;
|
|
23
|
+
/** Where its text starts in the paragraph's text. */
|
|
24
|
+
offset?: number;
|
|
25
|
+
}
|
|
26
|
+
/** A footnote or endnote reference: one character of the paragraph, as the engine counts it. */
|
|
27
|
+
interface DocNote {
|
|
28
|
+
offset: number;
|
|
29
|
+
kind: 'footnote' | 'endnote';
|
|
30
|
+
/** `w:id` of the note. */
|
|
31
|
+
id: string;
|
|
32
|
+
}
|
|
33
|
+
/** One paragraph, in document order. */
|
|
34
|
+
interface DocParagraph {
|
|
35
|
+
id: string;
|
|
36
|
+
/** `w14:paraId`, the id that is the same in every replica of a collaboration room. */
|
|
37
|
+
paraId?: string;
|
|
38
|
+
text: string;
|
|
39
|
+
/** Styled as a heading (a `Heading n` style or an outline level). */
|
|
40
|
+
heading: boolean;
|
|
41
|
+
styleId?: string;
|
|
42
|
+
/** A paragraph of the body itself, not inside a table. */
|
|
43
|
+
topLevel: boolean;
|
|
44
|
+
/** Names of the bookmarks that start in it. */
|
|
45
|
+
bookmarks: string[];
|
|
46
|
+
/** Its internal links (`w:hyperlink w:anchor`). */
|
|
47
|
+
links: DocLink[];
|
|
48
|
+
/** Its complex fields: where each sits (its one-character offset), its instruction and result. */
|
|
49
|
+
fields?: DocField[];
|
|
50
|
+
/** Its runs in a watched character style (a broken cross-reference's mark), with their text. */
|
|
51
|
+
marks?: DocMark[];
|
|
52
|
+
/** Its footnote and endnote references. */
|
|
53
|
+
notes?: DocNote[];
|
|
54
|
+
}
|
|
55
|
+
/** A stretch of a paragraph's text in a watched character style. */
|
|
56
|
+
interface DocMark {
|
|
57
|
+
styleId: string;
|
|
58
|
+
offset: number;
|
|
59
|
+
text: string;
|
|
60
|
+
}
|
|
61
|
+
/** Character styles whose runs a paragraph read reports as marks. */
|
|
62
|
+
declare const WATCHED_STYLES: Set<string>;
|
|
63
|
+
/** A complex field of a paragraph. */
|
|
64
|
+
interface DocField {
|
|
65
|
+
offset: number;
|
|
66
|
+
instruction: string;
|
|
67
|
+
result: string;
|
|
68
|
+
}
|
|
69
|
+
type OoxmlNodeLike = {
|
|
70
|
+
id: string;
|
|
71
|
+
kind: string;
|
|
72
|
+
localName?: string;
|
|
73
|
+
value?: string;
|
|
74
|
+
attributes?: readonly {
|
|
75
|
+
localName: string;
|
|
76
|
+
value: string;
|
|
77
|
+
}[];
|
|
78
|
+
children?: readonly OoxmlNodeLike[];
|
|
79
|
+
};
|
|
80
|
+
/** How a field (or a note reference) counts in a paragraph's text (the engine's model vocabulary). */
|
|
81
|
+
declare const FIELD_ATOM = "\uFFFC";
|
|
82
|
+
/** The paragraphs of a part's body, read from the engine's OOXML tree. */
|
|
83
|
+
declare function readParagraphs(root: OoxmlNodeLike): DocParagraph[];
|
|
84
|
+
/** Style id to style name (`Heading1` → `heading 1`), from a styles part's tree. */
|
|
85
|
+
declare function styleNames(root: OoxmlNodeLike | null | undefined): Map<string, string>;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Cross-reference targets: the document's numbered paragraphs (clauses, sub-clauses, numbered
|
|
89
|
+
* captions) and its headings, with the number Word's `REF \r` shows for each.
|
|
90
|
+
*
|
|
91
|
+
* The number is what the editor computes for a `REF … \r` field — and it has to be exactly that,
|
|
92
|
+
* because the engine shows a field's live value only while the field's cached result matches what
|
|
93
|
+
* it computes (otherwise it keeps the cached text for good). So this mirrors the engine: the
|
|
94
|
+
* paragraph's own list level, preceded by each higher level whose number its level text does not
|
|
95
|
+
* already show (`%1.%2` already shows level 1; `(%3)` does not show `2.1`), and one trailing
|
|
96
|
+
* period dropped (`2.` reads `2`).
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
/** A paragraph's resolved list numbering (the engine's list item). */
|
|
100
|
+
interface ListItemInfo {
|
|
101
|
+
numId: string;
|
|
102
|
+
ilvl: number;
|
|
103
|
+
markerText: string;
|
|
104
|
+
numFmt: string;
|
|
105
|
+
}
|
|
106
|
+
/** A list level's definition: its level text (`%1.%2`) and number format. */
|
|
107
|
+
interface LevelInfo {
|
|
108
|
+
lvlText: string;
|
|
109
|
+
numFmt: string;
|
|
110
|
+
}
|
|
111
|
+
type LevelOf = (numId: string, ilvl: number) => LevelInfo | null;
|
|
112
|
+
/**
|
|
113
|
+
* The number `REF \r` shows for a paragraph, or null when it is not numbered. `order` is every
|
|
114
|
+
* paragraph id in document order (for the markers of the levels above it).
|
|
115
|
+
*/
|
|
116
|
+
declare function paragraphNumber(order: readonly string[], items: ReadonlyMap<string, ListItemInfo>, levelOf: LevelOf, paragraphId: string): string | null;
|
|
117
|
+
/** One place a cross-reference can point at. */
|
|
118
|
+
interface CrossReferenceTarget {
|
|
119
|
+
paragraphId: string;
|
|
120
|
+
/** A numbered paragraph (clause, sub-clause, caption) or an unnumbered heading. */
|
|
121
|
+
kind: 'numbered' | 'heading';
|
|
122
|
+
/** What `REF \r` shows (`8.2`), or null for an unnumbered heading. */
|
|
123
|
+
number: string | null;
|
|
124
|
+
/** The paragraph's list marker as painted (`8.2`, `(a)`), or empty. */
|
|
125
|
+
marker: string;
|
|
126
|
+
/** The paragraph's text (without its marker). */
|
|
127
|
+
text: string;
|
|
128
|
+
heading: boolean;
|
|
129
|
+
/** Its list level (0 for a top-level clause), or 0 for a heading. */
|
|
130
|
+
level: number;
|
|
131
|
+
}
|
|
132
|
+
/** Every numbered paragraph and every heading, in document order. */
|
|
133
|
+
declare function listTargets(paragraphs: readonly DocParagraph[], items: ReadonlyMap<string, ListItemInfo>, levelOf: LevelOf): CrossReferenceTarget[];
|
|
134
|
+
/** Targets whose number or text contains the query (case-insensitive). */
|
|
135
|
+
declare function filterTargets(targets: readonly CrossReferenceTarget[], query: string): CrossReferenceTarget[];
|
|
136
|
+
/** What the engine's numbering needs of a document: its parts' trees. */
|
|
137
|
+
interface NumberingSource {
|
|
138
|
+
/** The main document part's root. */
|
|
139
|
+
root(): OoxmlNodeLike;
|
|
140
|
+
stylesRoot(): unknown;
|
|
141
|
+
numberingRoot(): unknown;
|
|
142
|
+
settingsRoot(): unknown;
|
|
143
|
+
}
|
|
144
|
+
/** A document's list numbering as the engine resolves it. */
|
|
145
|
+
interface DocumentNumbering {
|
|
146
|
+
/** Each numbered paragraph's list item, by paragraph (node) id. */
|
|
147
|
+
listItems(): ReadonlyMap<string, ListItemInfo>;
|
|
148
|
+
levelOf: LevelOf;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* The numbering of a document, as the editor paints it: from a live editor's session or from a
|
|
152
|
+
* headless document view alike.
|
|
153
|
+
*/
|
|
154
|
+
declare function documentNumbering(source: NumberingSource): DocumentNumbering;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* The cross-references of a document (`REF` fields to `_Ref` bookmarks), each with what it shows
|
|
158
|
+
* and what its target now is: current, stale (a clause renumbered, a heading reworded) or broken
|
|
159
|
+
* (the target is gone).
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
/** Prefix of Word's hidden cross-reference bookmarks. */
|
|
163
|
+
declare const REF_BOOKMARK_PREFIX = "_Ref";
|
|
164
|
+
type CrossReferenceMode = 'number' | 'text';
|
|
165
|
+
/** What reading cross-references needs of a document. */
|
|
166
|
+
interface ReferencesReader {
|
|
167
|
+
paragraphs(): DocParagraph[];
|
|
168
|
+
/** Each numbered paragraph's list item, by paragraph id. */
|
|
169
|
+
listItems(): ReadonlyMap<string, ListItemInfo>;
|
|
170
|
+
levelOf: LevelOf;
|
|
171
|
+
}
|
|
172
|
+
/** One `REF` field to a `_Ref` bookmark. */
|
|
173
|
+
interface CrossReference {
|
|
174
|
+
paragraphId: string;
|
|
175
|
+
offset: number;
|
|
176
|
+
instruction: string;
|
|
177
|
+
bookmark: string;
|
|
178
|
+
mode: CrossReferenceMode;
|
|
179
|
+
/** The field's cached result (what it shows). */
|
|
180
|
+
cached: string;
|
|
181
|
+
/** The paragraph the bookmark is in, or null when it is gone (the reference is broken). */
|
|
182
|
+
target: string | null;
|
|
183
|
+
/** What the reference should show now, or null when that cannot be computed. */
|
|
184
|
+
value: string | null;
|
|
185
|
+
}
|
|
186
|
+
/** A `REF` field whose cached result no longer says what its target now is. */
|
|
187
|
+
interface StaleReference {
|
|
188
|
+
paragraphId: string;
|
|
189
|
+
offset: number;
|
|
190
|
+
instruction: string;
|
|
191
|
+
/** The current value, or null when the target is gone (the reference is broken). */
|
|
192
|
+
value: string | null;
|
|
193
|
+
/** The field's cached result (what it last showed). */
|
|
194
|
+
cached: string;
|
|
195
|
+
bookmark: string;
|
|
196
|
+
mode: CrossReferenceMode;
|
|
197
|
+
}
|
|
198
|
+
/** A cross-reference whose target was deleted: its last text, marked in the Broken style. */
|
|
199
|
+
interface BrokenReference {
|
|
200
|
+
paragraphId: string;
|
|
201
|
+
offset: number;
|
|
202
|
+
text: string;
|
|
203
|
+
}
|
|
204
|
+
/** Every cross-reference of the document, in document order. */
|
|
205
|
+
declare function crossReferences(port: ReferencesReader): CrossReference[];
|
|
206
|
+
/**
|
|
207
|
+
* The cross-references whose cached result is out of date: a clause renumbered, a heading
|
|
208
|
+
* reworded, or the target gone. The editor paints a field's live value only while its cached
|
|
209
|
+
* result matches what it computes, so a stale cache shows the OLD number after the document is
|
|
210
|
+
* reopened (and Word shows the cached result until its fields are updated).
|
|
211
|
+
*/
|
|
212
|
+
declare function staleCrossReferences(port: ReferencesReader): StaleReference[];
|
|
213
|
+
/** The broken cross-references marked in the document, in document order. */
|
|
214
|
+
declare function brokenCrossReferences(port: Pick<ReferencesReader, 'paragraphs'>): BrokenReference[];
|
|
215
|
+
|
|
216
|
+
/** A document's parts as trees: a live editor's session or a headless view (`openHeadlessDocument`). */
|
|
217
|
+
interface DocumentTrees {
|
|
218
|
+
part(): {
|
|
219
|
+
root: unknown;
|
|
220
|
+
};
|
|
221
|
+
stylesRoot(): unknown;
|
|
222
|
+
numberingRoot(): unknown;
|
|
223
|
+
settingsRoot(): unknown;
|
|
224
|
+
}
|
|
225
|
+
/** A read-only snapshot of a document: its paragraphs, numbering and style names. */
|
|
226
|
+
interface DocumentReader extends ReferencesReader, DocumentNumbering {
|
|
227
|
+
/** A style's name (`heading 1`) by its id, or the id when the document does not name it. */
|
|
228
|
+
styleName(styleId: string): string;
|
|
229
|
+
}
|
|
230
|
+
/** Read a document whose trees do not change while the reader is used (a headless view). */
|
|
231
|
+
declare function documentReader(view: DocumentTrees): DocumentReader;
|
|
232
|
+
/** Read a document from its bytes (a collaboration room's `readRoom`). Throws on a bad package. */
|
|
233
|
+
declare function readDocument(bytes: Uint8Array): DocumentReader;
|
|
234
|
+
|
|
235
|
+
export { BROKEN_CROSS_REFERENCE_STYLE, type BrokenReference, CROSS_REFERENCE_STYLE, type CrossReference, type CrossReferenceMode, type CrossReferenceTarget, DEFINED_TERM_STYLE, type DocField, type DocLink, type DocMark, type DocNote, type DocParagraph, type DocPoint, type DocumentNumbering, type DocumentReader, type DocumentTrees, FIELD_ATOM, type LevelInfo, type LevelOf, type ListItemInfo, type NumberingSource, type OoxmlNodeLike, REF_BOOKMARK_PREFIX, type ReferencesReader, type StaleReference, WATCHED_STYLES, brokenCrossReferences, crossReferences, documentNumbering, documentReader, filterTargets, listTargets, paragraphNumber, readDocument, readParagraphs, staleCrossReferences, styleNames };
|