@twip/web 0.1.0-alpha.1 → 0.1.0-pre.2
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 +35 -0
- package/dist/THIRD-PARTY-NOTICES.md +1013 -225
- package/dist/commands.d.ts +637 -0
- package/dist/commands.js +188 -0
- package/dist/editor.d.ts +218 -0
- package/dist/editor.js +460 -0
- package/dist/errors.d.ts +21 -0
- package/dist/errors.js +26 -0
- package/dist/events.d.ts +126 -0
- package/dist/events.js +1 -0
- package/dist/fonts/google.d.ts +3 -0
- package/dist/fonts/google.js +39 -0
- package/dist/fonts/library.d.ts +65 -0
- package/dist/fonts/library.js +130 -0
- package/dist/host/a11y.d.ts +3 -0
- package/dist/host/a11y.js +62 -0
- package/dist/host/chrome.d.ts +28 -0
- package/dist/host/chrome.js +144 -0
- package/dist/host/clipboard.d.ts +16 -0
- package/dist/host/clipboard.js +128 -0
- package/dist/host/dom.d.ts +45 -0
- package/dist/host/dom.js +122 -0
- package/dist/host/frames.d.ts +14 -0
- package/dist/host/frames.js +87 -0
- package/dist/host/gpu.d.ts +58 -0
- package/dist/host/gpu.js +79 -0
- package/dist/host/ime.d.ts +3 -0
- package/dist/host/ime.js +11 -0
- package/dist/host/input.d.ts +12 -0
- package/dist/host/input.js +86 -0
- package/dist/host/keys.d.ts +16 -0
- package/dist/host/keys.js +27 -0
- package/dist/host/mount.d.ts +11 -0
- package/dist/host/mount.js +72 -0
- package/dist/host/pointer.d.ts +4 -0
- package/dist/host/pointer.js +171 -0
- package/dist/host/scroll.d.ts +14 -0
- package/dist/host/scroll.js +95 -0
- package/dist/index.d.ts +27 -98
- package/dist/index.js +10 -0
- package/dist/review.d.ts +156 -0
- package/dist/review.js +38 -0
- package/dist/services/accessibility.d.ts +52 -0
- package/dist/services/accessibility.js +71 -0
- package/dist/services/dialogs.d.ts +181 -0
- package/dist/services/dialogs.js +18 -0
- package/dist/services/elements.d.ts +146 -0
- package/dist/services/elements.js +18 -0
- package/dist/services/find.d.ts +50 -0
- package/dist/services/find.js +12 -0
- package/dist/services/menus.d.ts +82 -0
- package/dist/services/menus.js +8 -0
- package/dist/services/navigation.d.ts +58 -0
- package/dist/services/navigation.js +12 -0
- package/dist/services/ruler.d.ts +95 -0
- package/dist/services/ruler.js +16 -0
- package/dist/services/spelling.d.ts +34 -0
- package/dist/services/spelling.js +14 -0
- package/dist/services/view.d.ts +70 -0
- package/dist/services/view.js +19 -0
- package/dist/state.d.ts +483 -0
- package/dist/state.js +1 -0
- package/dist/transport/direct.d.ts +31 -0
- package/dist/transport/direct.js +405 -0
- package/dist/transport/module.d.ts +51 -0
- package/dist/transport/module.js +17 -0
- package/dist/transport/protocol.d.ts +265 -0
- package/dist/transport/protocol.js +132 -0
- package/dist/transport/worker.d.ts +54 -0
- package/dist/transport/worker.js +203 -0
- package/dist/twip-wasm.js +1 -1
- package/dist/twip_wasm.wasm +0 -0
- package/dist/types.d.ts +134 -0
- package/dist/types.js +16 -0
- package/dist/worker/entry.d.ts +1 -0
- package/dist/worker/entry.js +53 -0
- package/dist/worker.d.ts +1 -0
- package/dist/worker.js +2 -0
- package/package.json +17 -7
- package/dist/AccessibleNode.d.ts +0 -51
- package/dist/AccessibleNode.mjs +0 -177
- package/dist/Alignment.d.ts +0 -38
- package/dist/Alignment.mjs +0 -90
- package/dist/BorderEdges.d.ts +0 -50
- package/dist/BorderEdges.mjs +0 -114
- package/dist/BorderStyle.d.ts +0 -27
- package/dist/BorderStyle.mjs +0 -81
- package/dist/Bytes.d.ts +0 -19
- package/dist/Bytes.mjs +0 -76
- package/dist/CaretPosition.d.ts +0 -34
- package/dist/CaretPosition.mjs +0 -148
- package/dist/CellAlignment.d.ts +0 -25
- package/dist/CellAlignment.mjs +0 -75
- package/dist/CellShift.d.ts +0 -30
- package/dist/CellShift.mjs +0 -78
- package/dist/Clipboard.d.ts +0 -22
- package/dist/Clipboard.mjs +0 -90
- package/dist/ColumnSide.d.ts +0 -24
- package/dist/ColumnSide.mjs +0 -72
- package/dist/ControlKind.d.ts +0 -28
- package/dist/ControlKind.mjs +0 -84
- package/dist/ControlLock.d.ts +0 -42
- package/dist/ControlLock.mjs +0 -96
- package/dist/DocumentStatus.d.ts +0 -34
- package/dist/DocumentStatus.mjs +0 -148
- package/dist/Editor.d.ts +0 -773
- package/dist/Editor.mjs +0 -2269
- package/dist/EditorMode.d.ts +0 -34
- package/dist/EditorMode.mjs +0 -84
- package/dist/Element.d.ts +0 -57
- package/dist/Element.mjs +0 -201
- package/dist/ElementKind.d.ts +0 -28
- package/dist/ElementKind.mjs +0 -78
- package/dist/ElementList.d.ts +0 -20
- package/dist/ElementList.mjs +0 -71
- package/dist/ElementText.d.ts +0 -34
- package/dist/ElementText.mjs +0 -84
- package/dist/Event.d.ts +0 -45
- package/dist/Event.mjs +0 -159
- package/dist/EventKind.d.ts +0 -39
- package/dist/EventKind.mjs +0 -93
- package/dist/EventList.d.ts +0 -20
- package/dist/EventList.mjs +0 -71
- package/dist/Fonts.d.ts +0 -29
- package/dist/Fonts.mjs +0 -107
- package/dist/Highlight.d.ts +0 -41
- package/dist/Highlight.mjs +0 -117
- package/dist/MarginPreset.d.ts +0 -38
- package/dist/MarginPreset.mjs +0 -90
- package/dist/MarkSeverity.d.ts +0 -25
- package/dist/MarkSeverity.mjs +0 -75
- package/dist/Modifiers.d.ts +0 -34
- package/dist/Modifiers.mjs +0 -148
- package/dist/OpenError.d.ts +0 -30
- package/dist/OpenError.mjs +0 -78
- package/dist/Orientation.d.ts +0 -30
- package/dist/Orientation.mjs +0 -78
- package/dist/PageNumber.d.ts +0 -34
- package/dist/PageNumber.mjs +0 -84
- package/dist/PaperSize.d.ts +0 -50
- package/dist/PaperSize.mjs +0 -108
- package/dist/ParagraphBorders.d.ts +0 -34
- package/dist/ParagraphBorders.mjs +0 -84
- package/dist/PictureWrap.d.ts +0 -34
- package/dist/PictureWrap.mjs +0 -90
- package/dist/PointerKind.d.ts +0 -23
- package/dist/PointerKind.mjs +0 -75
- package/dist/Rect.d.ts +0 -34
- package/dist/Rect.mjs +0 -148
- package/dist/Request.d.ts +0 -55
- package/dist/Request.mjs +0 -207
- package/dist/RequestKind.d.ts +0 -45
- package/dist/RequestKind.mjs +0 -105
- package/dist/RequestList.d.ts +0 -20
- package/dist/RequestList.mjs +0 -71
- package/dist/RowHeightRule.d.ts +0 -34
- package/dist/RowHeightRule.mjs +0 -84
- package/dist/RowSide.d.ts +0 -24
- package/dist/RowSide.mjs +0 -72
- package/dist/SaveError.d.ts +0 -24
- package/dist/SaveError.mjs +0 -72
- package/dist/SelectionInfo.d.ts +0 -39
- package/dist/SelectionInfo.mjs +0 -166
- package/dist/SelectionKind.d.ts +0 -37
- package/dist/SelectionKind.mjs +0 -93
- package/dist/TableAlignment.d.ts +0 -25
- package/dist/TableAlignment.mjs +0 -75
- package/dist/TableSelection.d.ts +0 -38
- package/dist/TableSelection.mjs +0 -90
- package/dist/TableWidthUnit.d.ts +0 -31
- package/dist/TableWidthUnit.mjs +0 -81
- package/dist/TextUnit.d.ts +0 -25
- package/dist/TextUnit.mjs +0 -75
- package/dist/diplomat-runtime.d.ts +0 -15
- package/dist/diplomat-runtime.mjs +0 -786
- package/dist/diplomat-wasm.mjs +0 -18
- package/dist/gpu.d.ts +0 -15
- package/dist/gpu.mjs +0 -42
- package/dist/index.mjs +0 -101
|
@@ -0,0 +1,637 @@
|
|
|
1
|
+
import type { RichText } from './review.js';
|
|
2
|
+
import type { ControlKind, ControlOptions, DataBinding } from './services/elements.js';
|
|
3
|
+
import type { TabAlignment, TabLeader } from './services/ruler.js';
|
|
4
|
+
import type { HighlightColor, LineSpacing, MarkupView, ObjectWrap, RowHeight, TableWidth, UnderlineStyle } from './state.js';
|
|
5
|
+
import type { Color, CommentId, ElementId, Points, RevisionId, StyleId } from './types.js';
|
|
6
|
+
/** Which elements a field command acts on: the given ids, or the selection's by default. */
|
|
7
|
+
export interface FieldTargets {
|
|
8
|
+
/** The fields; default: the selection's. */
|
|
9
|
+
ids?: ElementId[];
|
|
10
|
+
}
|
|
11
|
+
/** How a picture placeholder looks before it is filled. */
|
|
12
|
+
export interface PlaceholderLook {
|
|
13
|
+
/** Which placeholders: one, those with a tag or a key prefix, or the default for the rest. */
|
|
14
|
+
match: {
|
|
15
|
+
id: ElementId;
|
|
16
|
+
} | {
|
|
17
|
+
tag: string;
|
|
18
|
+
} | {
|
|
19
|
+
prefix: string;
|
|
20
|
+
} | 'default';
|
|
21
|
+
/** A fill, label and icon, or an image. */
|
|
22
|
+
look: {
|
|
23
|
+
fill?: Color;
|
|
24
|
+
label?: string;
|
|
25
|
+
iconSvg?: string;
|
|
26
|
+
} | {
|
|
27
|
+
image: Uint8Array;
|
|
28
|
+
mime: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Every edit, one method per command. Each resolves after its change commits, with `getState()` already at that
|
|
33
|
+
* revision, and rejects with `EditorError`. Commands act on the selection at the time they run. Each is one undo
|
|
34
|
+
* step unless its documentation says otherwise: *typing* joins consecutive `insertText` and `delete` calls in one
|
|
35
|
+
* paragraph into one step; *view* changes no document and adds no undo step.
|
|
36
|
+
*/
|
|
37
|
+
export interface Commands {
|
|
38
|
+
/** Inserts text at the selection, replacing it. Typing. */
|
|
39
|
+
insertText(text: string): Promise<void>;
|
|
40
|
+
/** Starts a new paragraph (Enter). */
|
|
41
|
+
insertParagraph(): Promise<void>;
|
|
42
|
+
/** Inserts a line break (Shift+Enter). */
|
|
43
|
+
insertLineBreak(): Promise<void>;
|
|
44
|
+
/** Inserts a page break (Ctrl+Enter); in the body, not in a table. */
|
|
45
|
+
insertPageBreak(): Promise<void>;
|
|
46
|
+
/** Inserts a column break (Ctrl+Shift+Enter); in the body, not in a table. */
|
|
47
|
+
insertColumnBreak(): Promise<void>;
|
|
48
|
+
/** Inserts a section break; in the body, not in a table. */
|
|
49
|
+
insertSectionBreak(kind: 'nextPage' | 'continuous' | 'evenPage' | 'oddPage'): Promise<void>;
|
|
50
|
+
/** Inserts a tab character. Typing. */
|
|
51
|
+
insertTab(): Promise<void>;
|
|
52
|
+
/** Inserts one character, optionally in a symbol font. */
|
|
53
|
+
insertSymbol(options: {
|
|
54
|
+
char: string;
|
|
55
|
+
font?: string;
|
|
56
|
+
}): Promise<void>;
|
|
57
|
+
/** Deletes backward or forward, by character (the default) or word. Typing. */
|
|
58
|
+
delete(options: {
|
|
59
|
+
direction: 'backward' | 'forward';
|
|
60
|
+
unit?: 'character' | 'word';
|
|
61
|
+
}): Promise<void>;
|
|
62
|
+
/** Cuts the selection to the clipboard. */
|
|
63
|
+
cut(): Promise<void>;
|
|
64
|
+
/** Copies the selection to the clipboard; also when read only. */
|
|
65
|
+
copy(): Promise<void>;
|
|
66
|
+
/** Pastes from the system clipboard, formatted (the default) or as text. Fails `not-allowed` where the browser denies reading it. */
|
|
67
|
+
paste(options?: {
|
|
68
|
+
as?: 'formatted' | 'text';
|
|
69
|
+
}): Promise<void>;
|
|
70
|
+
/** Pastes the given text. */
|
|
71
|
+
pasteText(text: string): Promise<void>;
|
|
72
|
+
/** Undoes the last step. */
|
|
73
|
+
undo(): Promise<void>;
|
|
74
|
+
/** Redoes the last undone step. */
|
|
75
|
+
redo(): Promise<void>;
|
|
76
|
+
/** Repeats the last edit (F4). */
|
|
77
|
+
repeat(): Promise<void>;
|
|
78
|
+
/** Selects the whole story. */
|
|
79
|
+
selectAll(): Promise<void>;
|
|
80
|
+
/** Selects the unit around the selection; the table units in a table. */
|
|
81
|
+
select(unit: 'word' | 'sentence' | 'paragraph' | 'cell' | 'row' | 'column' | 'table'): Promise<void>;
|
|
82
|
+
/** Moves or extends the selection. */
|
|
83
|
+
moveSelection(options: {
|
|
84
|
+
by: 'character' | 'word' | 'line' | 'paragraph' | 'lineEdge' | 'document' | 'screen' | 'page' | 'rowEdge' | 'columnEdge';
|
|
85
|
+
direction: 'backward' | 'forward';
|
|
86
|
+
extend?: boolean;
|
|
87
|
+
}): Promise<void>;
|
|
88
|
+
/** Moves to the next or previous cell; `next` from the last cell adds a row (one step). */
|
|
89
|
+
moveToCell(direction: 'next' | 'previous'): Promise<void>;
|
|
90
|
+
/** Sets the selection mode (F8 extends, Ctrl+Shift+F8 selects a block). */
|
|
91
|
+
setSelectionMode(mode: 'normal' | 'extend' | 'block'): Promise<void>;
|
|
92
|
+
/** Returns to an earlier edit location (Shift+F5). */
|
|
93
|
+
goBack(): Promise<void>;
|
|
94
|
+
/** Leaves a header or footer, a text box, or object selection (Esc). */
|
|
95
|
+
escape(): Promise<void>;
|
|
96
|
+
/** Selects the next or previous floating object. */
|
|
97
|
+
selectNextObject(direction: 'next' | 'previous'): Promise<void>;
|
|
98
|
+
/** Moves the caret to a page, from 1. */
|
|
99
|
+
goToPage(page: number): Promise<void>;
|
|
100
|
+
/** Sets bold (Ctrl+B). */
|
|
101
|
+
setBold(on: boolean): Promise<void>;
|
|
102
|
+
/** Sets italic (Ctrl+I). */
|
|
103
|
+
setItalic(on: boolean): Promise<void>;
|
|
104
|
+
/** Sets the underline style (Ctrl+U: single). */
|
|
105
|
+
setUnderline(style: UnderlineStyle): Promise<void>;
|
|
106
|
+
/** Sets strikethrough. */
|
|
107
|
+
setStrikethrough(on: boolean): Promise<void>;
|
|
108
|
+
/** Sets double strikethrough. */
|
|
109
|
+
setDoubleStrikethrough(on: boolean): Promise<void>;
|
|
110
|
+
/** Sets subscript (Ctrl+=). */
|
|
111
|
+
setSubscript(on: boolean): Promise<void>;
|
|
112
|
+
/** Sets superscript (Ctrl+Shift+=). */
|
|
113
|
+
setSuperscript(on: boolean): Promise<void>;
|
|
114
|
+
/** Sets small caps (Ctrl+Shift+K). */
|
|
115
|
+
setSmallCaps(on: boolean): Promise<void>;
|
|
116
|
+
/** Sets all caps (Ctrl+Shift+A). */
|
|
117
|
+
setAllCaps(on: boolean): Promise<void>;
|
|
118
|
+
/** Sets hidden text (Ctrl+Shift+H). */
|
|
119
|
+
setHidden(on: boolean): Promise<void>;
|
|
120
|
+
/** Sets the font family (non-empty). */
|
|
121
|
+
setFont(family: string): Promise<void>;
|
|
122
|
+
/** Sets the font size, 1 to 1638 in 0.5 steps. */
|
|
123
|
+
setFontSize(size: Points): Promise<void>;
|
|
124
|
+
/** Grows the font to the next standard size (Ctrl+Shift+>). */
|
|
125
|
+
growFont(): Promise<void>;
|
|
126
|
+
/** Shrinks the font to the previous standard size (Ctrl+Shift+<). */
|
|
127
|
+
shrinkFont(): Promise<void>;
|
|
128
|
+
/** Sets the font colour. */
|
|
129
|
+
setFontColor(color: Color | 'auto'): Promise<void>;
|
|
130
|
+
/** Sets or removes (`null`) the highlight. */
|
|
131
|
+
setHighlight(color: HighlightColor | null): Promise<void>;
|
|
132
|
+
/** Sets the character spacing, -1584 to 1584. */
|
|
133
|
+
setCharacterSpacing(spacing: Points): Promise<void>;
|
|
134
|
+
/** Raises (positive) or lowers the text, -1584 to 1584. */
|
|
135
|
+
setCharacterPosition(position: Points): Promise<void>;
|
|
136
|
+
/** Clears character formatting (Ctrl+Space). */
|
|
137
|
+
clearFormatting(): Promise<void>;
|
|
138
|
+
/** Changes the case of the selection (Shift+F3 cycles). */
|
|
139
|
+
changeCase(to: 'lower' | 'upper' | 'sentence' | 'title' | 'toggle'): Promise<void>;
|
|
140
|
+
/** Holds the selection's formatting for {@link Commands.pasteFormatting} (Ctrl+Shift+C). */
|
|
141
|
+
copyFormatting(): Promise<void>;
|
|
142
|
+
/** Applies the held formatting to the selection (Ctrl+Shift+V). */
|
|
143
|
+
pasteFormatting(): Promise<void>;
|
|
144
|
+
/** Sets the alignment (Ctrl+L, E, R, J). */
|
|
145
|
+
setAlignment(alignment: 'left' | 'center' | 'right' | 'justify'): Promise<void>;
|
|
146
|
+
/** Sets the line spacing: 0.06 to 132 lines, or 0.7 to 1584 points. */
|
|
147
|
+
setLineSpacing(spacing: LineSpacing): Promise<void>;
|
|
148
|
+
/** Sets the space before and after, 0 to 1584; unset fields keep their value. */
|
|
149
|
+
setParagraphSpacing(options: {
|
|
150
|
+
before?: Points | 'auto';
|
|
151
|
+
after?: Points | 'auto';
|
|
152
|
+
}): Promise<void>;
|
|
153
|
+
/** Sets the indents, -1584 to 1584; `firstLine` and `hanging` are exclusive. Unset fields keep their value. */
|
|
154
|
+
setIndents(options: {
|
|
155
|
+
left?: Points;
|
|
156
|
+
right?: Points;
|
|
157
|
+
firstLine?: Points;
|
|
158
|
+
hanging?: Points;
|
|
159
|
+
}): Promise<void>;
|
|
160
|
+
/** Increases the left indent (Ctrl+M). */
|
|
161
|
+
increaseIndent(): Promise<void>;
|
|
162
|
+
/** Decreases the left indent (Ctrl+Shift+M). */
|
|
163
|
+
decreaseIndent(): Promise<void>;
|
|
164
|
+
/** Applies an existing paragraph style. */
|
|
165
|
+
setParagraphStyle(styleId: StyleId): Promise<void>;
|
|
166
|
+
/** Makes the paragraphs a bullet or numbered list, or removes the list (`null`). */
|
|
167
|
+
setList(kind: 'bullet' | 'numbered' | null): Promise<void>;
|
|
168
|
+
/** Changes the list level (Tab, Shift+Tab at an item's start); in a list. */
|
|
169
|
+
setListLevel(change: 'increase' | 'decrease'): Promise<void>;
|
|
170
|
+
/** Sets the pagination flags; unset fields keep their value. */
|
|
171
|
+
setParagraphFlow(options: {
|
|
172
|
+
keepWithNext?: boolean;
|
|
173
|
+
keepLinesTogether?: boolean;
|
|
174
|
+
pageBreakBefore?: boolean;
|
|
175
|
+
widowControl?: boolean;
|
|
176
|
+
}): Promise<void>;
|
|
177
|
+
/** Sets the paragraph borders (a half-point single line). */
|
|
178
|
+
setParagraphBorders(preset: 'box' | 'bottom' | 'none'): Promise<void>;
|
|
179
|
+
/** Sets or removes (`null`) the paragraph shading. */
|
|
180
|
+
setParagraphShading(color: Color | null): Promise<void>;
|
|
181
|
+
/** Adds a tab stop at 0 to 1584, replacing one at the same position. Left aligned with no leader by default. */
|
|
182
|
+
addTabStop(options: {
|
|
183
|
+
position: Points;
|
|
184
|
+
alignment?: TabAlignment;
|
|
185
|
+
leader?: TabLeader;
|
|
186
|
+
}): Promise<void>;
|
|
187
|
+
/** Moves the tab stop at `from` (within 0.5 pt). */
|
|
188
|
+
moveTabStop(options: {
|
|
189
|
+
from: Points;
|
|
190
|
+
to: Points;
|
|
191
|
+
}): Promise<void>;
|
|
192
|
+
/** Deletes the tab stop at a position; an inherited one is cleared in the paragraph. */
|
|
193
|
+
deleteTabStop(position: Points): Promise<void>;
|
|
194
|
+
/** Clears the paragraphs' own and inherited tab stops. */
|
|
195
|
+
clearTabStops(): Promise<void>;
|
|
196
|
+
/** Sets the document's default tab spacing, 1 to 1584. */
|
|
197
|
+
setDefaultTabStop(spacing: Points): Promise<void>;
|
|
198
|
+
/** Sets the margins, 0 to 1584; unset fields keep their value. */
|
|
199
|
+
setMargins(options: {
|
|
200
|
+
top?: Points;
|
|
201
|
+
bottom?: Points;
|
|
202
|
+
left?: Points;
|
|
203
|
+
right?: Points;
|
|
204
|
+
gutter?: Points;
|
|
205
|
+
}): Promise<void>;
|
|
206
|
+
/** Sets the orientation. */
|
|
207
|
+
setOrientation(orientation: 'portrait' | 'landscape'): Promise<void>;
|
|
208
|
+
/** Sets the paper size, in portrait, 36 to 1584. */
|
|
209
|
+
setPaperSize(options: {
|
|
210
|
+
width: Points;
|
|
211
|
+
height: Points;
|
|
212
|
+
}): Promise<void>;
|
|
213
|
+
/** Sets the text columns: 1 to 45, with spacing and a separator line. */
|
|
214
|
+
setColumns(options: {
|
|
215
|
+
count: number;
|
|
216
|
+
spacing?: Points;
|
|
217
|
+
separator?: boolean;
|
|
218
|
+
}): Promise<void>;
|
|
219
|
+
/** Sets the header and footer distances; unset fields keep their value. */
|
|
220
|
+
setHeaderFooterDistance(options: {
|
|
221
|
+
header?: Points;
|
|
222
|
+
footer?: Points;
|
|
223
|
+
}): Promise<void>;
|
|
224
|
+
/** Sets a different first page header and footer. */
|
|
225
|
+
setDifferentFirstPage(on: boolean): Promise<void>;
|
|
226
|
+
/** Sets different odd and even page headers and footers. */
|
|
227
|
+
setDifferentOddEvenPages(on: boolean): Promise<void>;
|
|
228
|
+
/** Moves a section text column's boundary. */
|
|
229
|
+
moveColumnBoundary(options: {
|
|
230
|
+
column: number;
|
|
231
|
+
to: Points;
|
|
232
|
+
}): Promise<void>;
|
|
233
|
+
/** Edits the caret page's header, creating it when the page has none. */
|
|
234
|
+
editHeader(): Promise<void>;
|
|
235
|
+
/** Edits the caret page's footer, creating it when the page has none. */
|
|
236
|
+
editFooter(): Promise<void>;
|
|
237
|
+
/** Returns to the body (Esc). */
|
|
238
|
+
closeHeaderFooter(): Promise<void>;
|
|
239
|
+
/** Inserts a page number at the caret, or in the header or footer. */
|
|
240
|
+
insertPageNumber(options: {
|
|
241
|
+
format: 'page' | 'pageOfTotal' | 'total';
|
|
242
|
+
where?: 'caret' | 'header' | 'footer';
|
|
243
|
+
alignment?: 'left' | 'center' | 'right';
|
|
244
|
+
}): Promise<void>;
|
|
245
|
+
/** Inserts a table of 1 to 32767 rows and 1 to 63 columns. */
|
|
246
|
+
insertTable(options: {
|
|
247
|
+
rows: number;
|
|
248
|
+
columns: number;
|
|
249
|
+
}): Promise<void>;
|
|
250
|
+
/** Inserts a picture (PNG, JPEG, GIF, BMP or TIFF). */
|
|
251
|
+
insertPicture(options: {
|
|
252
|
+
data: Uint8Array;
|
|
253
|
+
altText?: string;
|
|
254
|
+
}): Promise<void>;
|
|
255
|
+
/** Inserts a text box. */
|
|
256
|
+
insertTextBox(): Promise<void>;
|
|
257
|
+
/** Inserts a footnote. */
|
|
258
|
+
insertFootnote(): Promise<void>;
|
|
259
|
+
/** Inserts an endnote. */
|
|
260
|
+
insertEndnote(): Promise<void>;
|
|
261
|
+
/** Inserts a link; `text` replaces the selection (default: the selection, or the address). */
|
|
262
|
+
insertHyperlink(options: {
|
|
263
|
+
address: string;
|
|
264
|
+
text?: string;
|
|
265
|
+
}): Promise<void>;
|
|
266
|
+
/** Changes the link at the selection. */
|
|
267
|
+
editHyperlink(options: {
|
|
268
|
+
address?: string;
|
|
269
|
+
text?: string;
|
|
270
|
+
}): Promise<void>;
|
|
271
|
+
/** Removes the link at the selection, keeping its text. */
|
|
272
|
+
removeHyperlink(): Promise<void>;
|
|
273
|
+
/** Inserts a field. With a selection and an empty code, wraps it (Ctrl+F9). */
|
|
274
|
+
insertField(options: {
|
|
275
|
+
code: string;
|
|
276
|
+
display?: string;
|
|
277
|
+
showCode?: boolean;
|
|
278
|
+
}): Promise<{
|
|
279
|
+
id: ElementId;
|
|
280
|
+
}>;
|
|
281
|
+
/** Inserts rows above or below, 1 by default. */
|
|
282
|
+
insertRows(options: {
|
|
283
|
+
where: 'above' | 'below';
|
|
284
|
+
count?: number;
|
|
285
|
+
}): Promise<void>;
|
|
286
|
+
/** Inserts columns left or right, 1 by default. */
|
|
287
|
+
insertColumns(options: {
|
|
288
|
+
where: 'left' | 'right';
|
|
289
|
+
count?: number;
|
|
290
|
+
}): Promise<void>;
|
|
291
|
+
/** Deletes the selected rows. */
|
|
292
|
+
deleteRows(): Promise<void>;
|
|
293
|
+
/** Deletes the selected columns. */
|
|
294
|
+
deleteColumns(): Promise<void>;
|
|
295
|
+
/** Deletes the table. */
|
|
296
|
+
deleteTable(): Promise<void>;
|
|
297
|
+
/** Deletes the selected cells, shifting the rest up or left. */
|
|
298
|
+
deleteCells(shift: 'up' | 'left'): Promise<void>;
|
|
299
|
+
/** Merges a rectangular block of cells. */
|
|
300
|
+
mergeCells(): Promise<void>;
|
|
301
|
+
/** Splits the selected cells. */
|
|
302
|
+
splitCells(options: {
|
|
303
|
+
columns: number;
|
|
304
|
+
rows?: number;
|
|
305
|
+
}): Promise<void>;
|
|
306
|
+
/** Splits the table above the current row. */
|
|
307
|
+
splitTable(): Promise<void>;
|
|
308
|
+
/** Gives the selected rows equal heights. */
|
|
309
|
+
distributeRows(): Promise<void>;
|
|
310
|
+
/** Gives the selected columns equal widths. */
|
|
311
|
+
distributeColumns(): Promise<void>;
|
|
312
|
+
/** Moves the selected rows up or down (Alt+Shift+Up, Down). */
|
|
313
|
+
moveRows(direction: 'up' | 'down'): Promise<void>;
|
|
314
|
+
/** Fits the columns to their contents or the window, or fixes their widths. */
|
|
315
|
+
autoFitColumns(to: 'contents' | 'window' | 'fixed'): Promise<void>;
|
|
316
|
+
/** Sets the cells' vertical alignment. */
|
|
317
|
+
setCellAlignment(vertical: 'top' | 'center' | 'bottom'): Promise<void>;
|
|
318
|
+
/** Sets or removes (`null`) the cell shading. */
|
|
319
|
+
setCellShading(color: Color | null): Promise<void>;
|
|
320
|
+
/** Sets the cell borders on some edges; no border removes them. */
|
|
321
|
+
setCellBorders(options: {
|
|
322
|
+
edges: 'all' | 'outside' | 'inside' | 'insideHorizontal' | 'insideVertical' | 'top' | 'bottom' | 'left' | 'right' | 'none';
|
|
323
|
+
border?: {
|
|
324
|
+
style: 'single' | 'double' | 'dotted' | 'dashed' | 'thick';
|
|
325
|
+
width: Points;
|
|
326
|
+
color: Color | 'auto';
|
|
327
|
+
};
|
|
328
|
+
}): Promise<void>;
|
|
329
|
+
/** Sets the cell margins, 0 to 1584; unset fields keep their value. */
|
|
330
|
+
setCellMargins(options: {
|
|
331
|
+
top?: Points;
|
|
332
|
+
bottom?: Points;
|
|
333
|
+
left?: Points;
|
|
334
|
+
right?: Points;
|
|
335
|
+
}): Promise<void>;
|
|
336
|
+
/** Repeats the rows as a header row. */
|
|
337
|
+
setHeaderRow(on: boolean): Promise<void>;
|
|
338
|
+
/** Sets the row height. */
|
|
339
|
+
setRowHeight(height: RowHeight): Promise<void>;
|
|
340
|
+
/** Lets rows break across pages. */
|
|
341
|
+
setRowCanBreak(on: boolean): Promise<void>;
|
|
342
|
+
/** Sets the column width, 1 to 1584. */
|
|
343
|
+
setColumnWidth(width: Points): Promise<void>;
|
|
344
|
+
/** Moves a column boundary of the caret's row. */
|
|
345
|
+
moveTableColumnBoundary(options: {
|
|
346
|
+
index: number;
|
|
347
|
+
to: Points;
|
|
348
|
+
}): Promise<void>;
|
|
349
|
+
/** Moves a row boundary of the caret's table. */
|
|
350
|
+
moveTableRowBoundary(options: {
|
|
351
|
+
index: number;
|
|
352
|
+
to: Points;
|
|
353
|
+
}): Promise<void>;
|
|
354
|
+
/** Sets the table width. */
|
|
355
|
+
setTableWidth(width: TableWidth): Promise<void>;
|
|
356
|
+
/** Sets the table alignment. */
|
|
357
|
+
setTableAlignment(alignment: 'left' | 'center' | 'right'): Promise<void>;
|
|
358
|
+
/** Sets the table indent, -1584 to 1584. */
|
|
359
|
+
setTableIndent(indent: Points): Promise<void>;
|
|
360
|
+
/** Applies an existing table style. */
|
|
361
|
+
setTableStyle(styleId: StyleId): Promise<void>;
|
|
362
|
+
/** Sets which parts of the table style apply; unset fields keep their value. */
|
|
363
|
+
setTableStyleOptions(options: {
|
|
364
|
+
headerRow?: boolean;
|
|
365
|
+
totalRow?: boolean;
|
|
366
|
+
firstColumn?: boolean;
|
|
367
|
+
lastColumn?: boolean;
|
|
368
|
+
bandedRows?: boolean;
|
|
369
|
+
bandedColumns?: boolean;
|
|
370
|
+
}): Promise<void>;
|
|
371
|
+
/** Sets the object's size, 1 to 1584. */
|
|
372
|
+
setObjectSize(options: {
|
|
373
|
+
width?: Points;
|
|
374
|
+
height?: Points;
|
|
375
|
+
lockAspect?: boolean;
|
|
376
|
+
}): Promise<void>;
|
|
377
|
+
/** Resets the object to its original size. */
|
|
378
|
+
resetObjectSize(): Promise<void>;
|
|
379
|
+
/** Sets how text wraps around the object. */
|
|
380
|
+
setObjectWrap(wrap: ObjectWrap): Promise<void>;
|
|
381
|
+
/** Locks a floating object's anchor. */
|
|
382
|
+
setAnchorLocked(on: boolean): Promise<void>;
|
|
383
|
+
/** Sets the alternative text, or marks the object decorative. */
|
|
384
|
+
setAltText(options: {
|
|
385
|
+
text: string;
|
|
386
|
+
decorative?: boolean;
|
|
387
|
+
}): Promise<void>;
|
|
388
|
+
/** Deletes the object. */
|
|
389
|
+
deleteObject(): Promise<void>;
|
|
390
|
+
/** Changes a field's code or display. */
|
|
391
|
+
setField(options: {
|
|
392
|
+
id: ElementId;
|
|
393
|
+
code?: string;
|
|
394
|
+
display?: string | RichText;
|
|
395
|
+
}): Promise<void>;
|
|
396
|
+
/** Supplies field results; `token` joins the step a `fieldsUpdateRequested` event started. */
|
|
397
|
+
setFieldResults(options: {
|
|
398
|
+
results: {
|
|
399
|
+
id: ElementId;
|
|
400
|
+
display: string | RichText;
|
|
401
|
+
}[];
|
|
402
|
+
token?: number;
|
|
403
|
+
}): Promise<void>;
|
|
404
|
+
/** Updates fields (F9); emits `fieldsUpdateRequested` for the fields the application computes. */
|
|
405
|
+
updateFields(options?: FieldTargets): Promise<void>;
|
|
406
|
+
/** Locks or unlocks fields (Ctrl+F11, Ctrl+Shift+F11). */
|
|
407
|
+
setFieldsLocked(options: {
|
|
408
|
+
locked: boolean;
|
|
409
|
+
} & FieldTargets): Promise<void>;
|
|
410
|
+
/** Replaces fields by their results (Ctrl+Shift+F9). */
|
|
411
|
+
unlinkFields(options?: FieldTargets): Promise<void>;
|
|
412
|
+
/** Shows field codes or results (Alt+F9, Shift+F9). View. */
|
|
413
|
+
showFieldCodes(options: {
|
|
414
|
+
show: boolean;
|
|
415
|
+
} & FieldTargets): Promise<void>;
|
|
416
|
+
/** What design mode shows for each field code. View. */
|
|
417
|
+
setFieldLabels(options: {
|
|
418
|
+
labels: Record<string, string>;
|
|
419
|
+
merge?: boolean;
|
|
420
|
+
}): Promise<void>;
|
|
421
|
+
/** Inserts a content control, optionally around the selection. */
|
|
422
|
+
insertControl(options: {
|
|
423
|
+
kind: ControlKind;
|
|
424
|
+
tag?: string;
|
|
425
|
+
title?: string;
|
|
426
|
+
lock?: 'none' | 'control' | 'content' | 'both';
|
|
427
|
+
placeholder?: string;
|
|
428
|
+
binding?: DataBinding;
|
|
429
|
+
options?: ControlOptions;
|
|
430
|
+
wrapSelection?: boolean;
|
|
431
|
+
}): Promise<{
|
|
432
|
+
id: ElementId;
|
|
433
|
+
}>;
|
|
434
|
+
/** Changes a content control; a `null` binding removes it. */
|
|
435
|
+
setControl(options: {
|
|
436
|
+
id: ElementId;
|
|
437
|
+
tag?: string;
|
|
438
|
+
title?: string;
|
|
439
|
+
lock?: 'none' | 'control' | 'content' | 'both';
|
|
440
|
+
placeholder?: string;
|
|
441
|
+
binding?: DataBinding | null;
|
|
442
|
+
options?: ControlOptions;
|
|
443
|
+
}): Promise<void>;
|
|
444
|
+
/** Removes a content control, optionally keeping its content. */
|
|
445
|
+
removeControl(options: {
|
|
446
|
+
id: ElementId;
|
|
447
|
+
keepContent?: boolean;
|
|
448
|
+
}): Promise<void>;
|
|
449
|
+
/** Fills a content control with exactly one of text, an image (fitted to its box) or DOCX content. */
|
|
450
|
+
fillControl(options: {
|
|
451
|
+
id: ElementId;
|
|
452
|
+
text?: string;
|
|
453
|
+
image?: Uint8Array;
|
|
454
|
+
docx?: Uint8Array;
|
|
455
|
+
}): Promise<void>;
|
|
456
|
+
/** Checks or unchecks a checkbox control. */
|
|
457
|
+
setCheckbox(options: {
|
|
458
|
+
id: ElementId;
|
|
459
|
+
checked: boolean;
|
|
460
|
+
}): Promise<void>;
|
|
461
|
+
/** Wraps the selected paragraphs or table rows in a repeating section. */
|
|
462
|
+
wrapInRepeatingSection(options?: {
|
|
463
|
+
tag?: string;
|
|
464
|
+
title?: string;
|
|
465
|
+
}): Promise<{
|
|
466
|
+
id: ElementId;
|
|
467
|
+
}>;
|
|
468
|
+
/** Removes a field, or a control with its content. */
|
|
469
|
+
removeElement(id: ElementId): Promise<void>;
|
|
470
|
+
/** Replaces text in element codes, tags or titles: case-sensitive, every occurrence. */
|
|
471
|
+
replaceInElements(options: {
|
|
472
|
+
find: string;
|
|
473
|
+
replace: string;
|
|
474
|
+
in: 'code' | 'tag' | 'title';
|
|
475
|
+
kind?: 'field' | 'control';
|
|
476
|
+
ids?: ElementId[];
|
|
477
|
+
}): Promise<{
|
|
478
|
+
changed: number;
|
|
479
|
+
}>;
|
|
480
|
+
/** Draws wavy marks with a tooltip on elements. View. */
|
|
481
|
+
markElements(options: {
|
|
482
|
+
marks: {
|
|
483
|
+
id: ElementId;
|
|
484
|
+
severity: 'error' | 'warning' | 'info';
|
|
485
|
+
message: string;
|
|
486
|
+
}[];
|
|
487
|
+
clear?: boolean;
|
|
488
|
+
}): Promise<void>;
|
|
489
|
+
/** Sets how picture placeholders look. View. */
|
|
490
|
+
setPlaceholderLooks(options: {
|
|
491
|
+
looks: PlaceholderLook[];
|
|
492
|
+
merge?: boolean;
|
|
493
|
+
}): Promise<void>;
|
|
494
|
+
/** Fills the selected placeholder, or every unfilled one with `key`. */
|
|
495
|
+
fillPlaceholder(options: {
|
|
496
|
+
key?: string;
|
|
497
|
+
image: Uint8Array;
|
|
498
|
+
}): Promise<void>;
|
|
499
|
+
/** Writes a custom XML data part (well-formed). */
|
|
500
|
+
writeDataPart(options: {
|
|
501
|
+
namespace: string;
|
|
502
|
+
itemId?: string;
|
|
503
|
+
xml: string;
|
|
504
|
+
}): Promise<{
|
|
505
|
+
itemId: string;
|
|
506
|
+
}>;
|
|
507
|
+
/** Removes a custom XML data part. */
|
|
508
|
+
removeDataPart(options: {
|
|
509
|
+
namespace: string;
|
|
510
|
+
itemId?: string;
|
|
511
|
+
}): Promise<void>;
|
|
512
|
+
/** Turns change tracking on or off (Ctrl+Shift+E). */
|
|
513
|
+
setTrackChanges(on: boolean): Promise<void>;
|
|
514
|
+
/** Sets how tracked changes are shown. View. */
|
|
515
|
+
setMarkupView(view: MarkupView): Promise<void>;
|
|
516
|
+
/** Accepts a revision; a move resolves as a pair. */
|
|
517
|
+
acceptRevision(id: RevisionId): Promise<void>;
|
|
518
|
+
/** Rejects a revision; a move resolves as a pair. */
|
|
519
|
+
rejectRevision(id: RevisionId): Promise<void>;
|
|
520
|
+
/** Accepts the revisions in the selection. */
|
|
521
|
+
acceptRevisionsInSelection(): Promise<void>;
|
|
522
|
+
/** Rejects the revisions in the selection. */
|
|
523
|
+
rejectRevisionsInSelection(): Promise<void>;
|
|
524
|
+
/** Accepts every revision, or one author's. */
|
|
525
|
+
acceptAllRevisions(options?: {
|
|
526
|
+
author?: string;
|
|
527
|
+
}): Promise<void>;
|
|
528
|
+
/** Rejects every revision, or one author's. */
|
|
529
|
+
rejectAllRevisions(options?: {
|
|
530
|
+
author?: string;
|
|
531
|
+
}): Promise<void>;
|
|
532
|
+
/** Selects the next or previous revision. */
|
|
533
|
+
selectRevision(direction: 'next' | 'previous'): Promise<void>;
|
|
534
|
+
/** Comments on the selection, or the word at the caret (Ctrl+Alt+M). */
|
|
535
|
+
addComment(body: string | RichText): Promise<{
|
|
536
|
+
id: CommentId;
|
|
537
|
+
}>;
|
|
538
|
+
/** Replies to a comment. */
|
|
539
|
+
replyToComment(options: {
|
|
540
|
+
to: CommentId;
|
|
541
|
+
body: string | RichText;
|
|
542
|
+
}): Promise<{
|
|
543
|
+
id: CommentId;
|
|
544
|
+
}>;
|
|
545
|
+
/** Changes a comment's body. */
|
|
546
|
+
editComment(options: {
|
|
547
|
+
id: CommentId;
|
|
548
|
+
body: string | RichText;
|
|
549
|
+
}): Promise<void>;
|
|
550
|
+
/** Deletes a reply, or the whole thread when it's the first comment. */
|
|
551
|
+
deleteComment(id: CommentId): Promise<void>;
|
|
552
|
+
/** Resolves or reopens a thread. */
|
|
553
|
+
resolveComment(options: {
|
|
554
|
+
id: CommentId;
|
|
555
|
+
done: boolean;
|
|
556
|
+
}): Promise<void>;
|
|
557
|
+
/** Sets the active thread. View. */
|
|
558
|
+
setActiveComment(id: CommentId | null): Promise<void>;
|
|
559
|
+
/** Selects and reveals a comment's range. */
|
|
560
|
+
selectComment(id: CommentId): Promise<void>;
|
|
561
|
+
/** Sets the colour an author's changes are marked with. View. */
|
|
562
|
+
setAuthorColor(options: {
|
|
563
|
+
author: string;
|
|
564
|
+
color: Color;
|
|
565
|
+
}): Promise<void>;
|
|
566
|
+
/** Sets the zoom: 10 to 500 percent, or a fit. */
|
|
567
|
+
setZoom(zoom: number | 'pageWidth' | 'wholePage'): Promise<void>;
|
|
568
|
+
/** Shows or hides formatting marks (Ctrl+Shift+8), gridlines and text boundaries. */
|
|
569
|
+
setViewOptions(options: {
|
|
570
|
+
formattingMarks?: boolean;
|
|
571
|
+
gridlines?: boolean;
|
|
572
|
+
textBoundaries?: boolean;
|
|
573
|
+
}): Promise<void>;
|
|
574
|
+
/** Switches between editing and design mode. */
|
|
575
|
+
setMode(mode: 'editing' | 'design'): Promise<void>;
|
|
576
|
+
}
|
|
577
|
+
/** A command id: the method name, the batch op's `type`, the catalog id and the key in `state.commands`. */
|
|
578
|
+
export type CommandId = keyof Commands;
|
|
579
|
+
/**
|
|
580
|
+
* An op's fields besides `type`. A single argument (a primitive, {@link RichText}, bytes, an array, or a union with a
|
|
581
|
+
* primitive) goes in `value`; an options object, and a tagged value such as {@link LineSpacing} or
|
|
582
|
+
* {@link TableWidth}, is spread into the op.
|
|
583
|
+
*/
|
|
584
|
+
export type OpArgs<K extends CommandId> = Parameters<Commands[K]> extends [] ? {} : [Exclude<Parameters<Commands[K]>[0], undefined>] extends [string | number | boolean | null] ? {
|
|
585
|
+
value: Exclude<Parameters<Commands[K]>[0], undefined>;
|
|
586
|
+
} : [Exclude<Parameters<Commands[K]>[0], undefined>] extends [RichText | Uint8Array | readonly unknown[]] ? {
|
|
587
|
+
value: Exclude<Parameters<Commands[K]>[0], undefined>;
|
|
588
|
+
} : [Exclude<Parameters<Commands[K]>[0], undefined>] extends [object] ? Exclude<Parameters<Commands[K]>[0], undefined> : {
|
|
589
|
+
value: Exclude<Parameters<Commands[K]>[0], undefined>;
|
|
590
|
+
};
|
|
591
|
+
/** A batch op: the command id as `type`, plus its arguments. A command with one argument puts it in `value`. */
|
|
592
|
+
export type Op = {
|
|
593
|
+
[K in CommandId]: {
|
|
594
|
+
type: K;
|
|
595
|
+
} & OpArgs<K>;
|
|
596
|
+
}[CommandId];
|
|
597
|
+
/** A command that takes no arguments: `commands[id]()` runs it. */
|
|
598
|
+
export type NoArgumentCommandId = {
|
|
599
|
+
[K in CommandId]: Parameters<Commands[K]> extends [] ? K : never;
|
|
600
|
+
}[CommandId];
|
|
601
|
+
/**
|
|
602
|
+
* A command's catalog entry. `takesArguments` tells the two kinds apart, so an entry filtered on
|
|
603
|
+
* `!takesArguments` has a {@link NoArgumentCommandId} and runs as `commands[entry.id]()`.
|
|
604
|
+
*/
|
|
605
|
+
export type CommandInfo = (CommandEntry & {
|
|
606
|
+
id: NoArgumentCommandId;
|
|
607
|
+
takesArguments: false;
|
|
608
|
+
}) | (CommandEntry & {
|
|
609
|
+
id: Exclude<CommandId, NoArgumentCommandId>;
|
|
610
|
+
takesArguments: true;
|
|
611
|
+
});
|
|
612
|
+
/** What every catalog entry has. */
|
|
613
|
+
export interface CommandEntry {
|
|
614
|
+
/** The command. */
|
|
615
|
+
id: CommandId;
|
|
616
|
+
/** The English label. */
|
|
617
|
+
label: string;
|
|
618
|
+
/** The group it belongs to, for building menus and ribbons. */
|
|
619
|
+
group: 'text' | 'clipboard' | 'history' | 'selection' | 'character' | 'paragraph' | 'tabs' | 'page' | 'headerFooter' | 'insert' | 'table' | 'object' | 'field' | 'control' | 'data' | 'review' | 'view';
|
|
620
|
+
/** Display strings: `'Ctrl+B'`, `'⌘B'`. */
|
|
621
|
+
shortcuts: {
|
|
622
|
+
windows: string[];
|
|
623
|
+
mac: string[];
|
|
624
|
+
};
|
|
625
|
+
/** Whether it takes arguments. */
|
|
626
|
+
takesArguments: boolean;
|
|
627
|
+
/** Whether it changes the document. */
|
|
628
|
+
mutates: boolean;
|
|
629
|
+
/** Its undo grouping. */
|
|
630
|
+
undo: 'step' | 'typing' | 'view';
|
|
631
|
+
}
|
|
632
|
+
/** Builds a command's op from its method arguments. */
|
|
633
|
+
export declare function toOp(id: CommandId, arg: unknown): Op;
|
|
634
|
+
/** The inverse of {@link toOp}: the command id and its method argument. */
|
|
635
|
+
export declare function fromOp(op: Op): [CommandId, unknown];
|
|
636
|
+
/** Builds the `commands` object: every method turns its arguments into an op and runs it. */
|
|
637
|
+
export declare function createCommands(run: (op: Op) => Promise<unknown>): Commands;
|