@pngwasi/config-editor 0.0.0-stage → 0.1.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.
@@ -0,0 +1,2500 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /** One open document of a `ConfigDocuments` view. */
4
+ export interface DocumentSpec {
5
+ /** Identifies the document across `update({ documents })` calls and in every callback. Not empty, unique in the list. */
6
+ id: string;
7
+ /** The tab's label (a file name or path); its extension gives the language when `language` is not set. */
8
+ fileName: string;
9
+ /** The text, in the document's language. A new one updates the editor, keeping the caret. */
10
+ value: string;
11
+ /** Default: from `fileName`'s extension, else `"yaml"`. A new language mounts a new editor. */
12
+ language?: LanguageName;
13
+ /** Text to diff against and to tell unsaved edits by. Default: `value` as the document was added. */
14
+ baseline?: string;
15
+ /** View mode for this document; switches live. */
16
+ readOnly?: boolean;
17
+ /** Why the document is read-only, while `readOnly` is on: its tab's tooltip and accessible description say it, and so does the "Cannot edit in a read-only editor" notice. Updates live. */
18
+ readOnlyReason?: string;
19
+ /** Whether the user may close it (close button, middle click, `Delete` on its tab ask `onClose`). Default `true`; `false` for a document that must stay open: its tab has no close button. Without `onClose` no tab has one. Switches live. */
20
+ closable?: boolean;
21
+ /** JSON Schema as JSON or YAML text; documents with the same text share one compiled schema. One that does not compile throws, as it does for a `ConfigEditor`. */
22
+ schema?: string;
23
+ /** Edit in another language than `language`; switches live. A list with the same `editAs` changes nothing: to ask for it again (after an undo stepped back across the switch), call `editAs(id, language)`. */
24
+ editAs?: LanguageName;
25
+ /** The text on screen when the document's editor opens, in the `editAs` language, in place of `value` converted: what the user had on screen before the view went away (`editor(id).text`). `value` and `baseline` stay yours; it converts back like an edit, so `onChange` hears it once it converts, and until then `onSyncChange` says `false`. Undo starts at it. The document's editor mounts at once, shown or not: an unsaved edit, so `isDirty`, the tab's dot, `onSyncChange`, `save()` and `saveAll()` answer as if it were shown. Ignored without `editAs`. */
26
+ editAsText?: string;
27
+ /** Settings for this document's editor, over the view's: the keys given replace the view's (which still apply to the rest, and follow its `update`). Switch live. The view's `styled` applies to every editor. */
28
+ settings?: EditorSettings;
29
+ /** Problems the host found in this document (see `HostDiagnostic`); a new list replaces the markers. */
30
+ hostDiagnostics?: HostDiagnostic[];
31
+ /** Fields of this document the user cannot change; update live. */
32
+ readOnlyPaths?: FieldPath[];
33
+ /** Stretches of this document (in its language) the user cannot change; update live. */
34
+ readOnlyRanges?: TextRangeInput[];
35
+ /** Secret placeholders, as `ConfigEditor`'s `secrets`. Read when the document's editor mounts (the first time it is shown, or at once when it is listed with `editAsText`). */
36
+ secrets?: SecretOptions;
37
+ }
38
+
39
+ /** What `onClose` receives: the user asked to close a document. Nothing closes by itself: remove it from the list (asking first when `dirty`). */
40
+ export interface CloseRequest {
41
+ id: string;
42
+ /** Whether it has unsaved edits (its text differs from its baseline). */
43
+ dirty: boolean;
44
+ }
45
+
46
+ /** What `new ConfigDocuments` takes: the documents and callbacks, and the settings (`EditorSettings`) of every editor and of the tabs (`theme`, `colors` with the `tab-*` tokens; `styled` injects the stylesheet once for the view). A document's own `settings` override them. */
47
+ export interface DocumentsOptions extends EditorSettings {
48
+ /** The open documents, in tab order. */
49
+ documents: DocumentSpec[];
50
+ /** The document shown first. Default: the first one. */
51
+ activeId?: string;
52
+ /** Extra class on the view's root. */
53
+ className?: string;
54
+ /** The tab list's accessible name. Default `"Open files"`. */
55
+ label?: string;
56
+ /** Set it when you list every `onChange` text back as the document's `value` in `update({ documents })`, possibly late and in any order: a `value` its editor gave that has not come back yet is then its echo and keeps what the editor holds. A text it never gave applies; go back to one it gave with `replaceValue(id, text)`. Without it (the default) every listed `value` applies. Fixed for the view's life. */
57
+ echoes?: boolean;
58
+ /** Called with a document's id when it becomes the active one (a tab, `Alt+PageDown` / `Alt+PageUp`, `select()`, or the active one closing). */
59
+ onSelect?: (id: string) => void;
60
+ /** Called when the user asks to close a document (close button, middle click, `Delete` on its tab); only `closable` documents ask. Without it, tabs have no close button. */
61
+ onClose?: (request: CloseRequest) => void;
62
+ /** Called when the user asks for a new document: the "+" button after the last tab, shown only with it (it stays at the strip's end when the tabs overflow). It only asks: add the new document to the list; the next one added is selected and its editor focused. No key adds one (`Ctrl+T` / `Ctrl+N` are the browser's). */
63
+ onAdd?: () => void;
64
+ /** Called with a document's id and text after every edit: store it as the document's `value`. */
65
+ onChange?: (id: string, value: string) => void;
66
+ /** Called when the user saves a document (`Ctrl+S` / `Cmd+S`) or you call `save(id)` / `saveAll()`. */
67
+ onSave?: (id: string, value: string, language: LanguageName) => void;
68
+ /** Called with a document's id and whether it differs from its baseline: when it is added, then each time that changes. */
69
+ onDirtyChange?: (id: string, dirty: boolean) => void;
70
+ /** Called with a document's id and its editor's own problems (as `ConfigEditor`'s `onProblems`): once its editor mounts (when the document is first shown, or at once when it is listed with `editAsText`), then each time they change. */
71
+ onProblems?: (id: string, problems: Diagnostic[]) => void;
72
+ /** Called with a document's id and the language on screen in its editor: once when the editor mounts (the first time the document is shown, or at once when it is listed with `editAsText`), then each time that changes (a switch made, one that waited until the text converted, undo or redo across a switch). */
73
+ onEditAsChange?: (id: string, language: LanguageName) => void;
74
+ /** Called with a document's id and whether the text on screen is written back to its `value`: once when its editor mounts, then each time that changes (see `ConfigEditor`'s `onSyncChange`). */
75
+ onSyncChange?: (id: string, inSync: boolean) => void;
76
+ }
77
+
78
+ /**
79
+ * What `view.update` takes: the documents, the active one, the settings and
80
+ * the callbacks, any of them. A key left out (or `undefined`) stays as it
81
+ * is; `null` removes a callback or returns a setting to its default;
82
+ * settings merge key by key. `className`, `label` and `echoes` cannot change.
83
+ */
84
+ export interface DocumentsUpdate extends SettingsUpdate {
85
+ /** Replaces the list: a document keeps its editor while its `id` stays listed. */
86
+ documents?: DocumentSpec[];
87
+ /** Shows this document, leaving the focus where it is. */
88
+ activeId?: string;
89
+ onSelect?: ((id: string) => void) | null;
90
+ /** Replaces or removes it; it cannot be added to a view mounted without one (its tabs have no close buttons). */
91
+ onClose?: ((request: CloseRequest) => void) | null;
92
+ /** Replaces or removes it; it cannot be added to a view mounted without one (its strip has no "+"). */
93
+ onAdd?: (() => void) | null;
94
+ onChange?: ((id: string, value: string) => void) | null;
95
+ /** `null` gives `Ctrl+S` back to the browser. */
96
+ onSave?: ((id: string, value: string, language: LanguageName) => void) | null;
97
+ onDirtyChange?: ((id: string, dirty: boolean) => void) | null;
98
+ onProblems?: ((id: string, problems: Diagnostic[]) => void) | null;
99
+ onEditAsChange?: ((id: string, language: LanguageName) => void) | null;
100
+ onSyncChange?: ((id: string, inSync: boolean) => void) | null;
101
+ /** The view is built from it: create a new one to change it. */
102
+ className?: never;
103
+ /** The view is built from it: create a new one to change it. */
104
+ label?: never;
105
+ /** The view is built from it: create a new one to change it. */
106
+ echoes?: never;
107
+ }
108
+
109
+
110
+
111
+ /** What `new ConfigEditor` takes: the document and its callbacks, and every setting of `EditorSettings`. */
112
+ export interface EditorOptions extends EditorSettings {
113
+ /** The document, in `language`. */
114
+ value?: string;
115
+ /** Language of the document. Default `"yaml"`. */
116
+ language?: LanguageName;
117
+ /** Edit in another language; `value` and `onChange` stay in `language`. */
118
+ editAs?: LanguageName;
119
+ /** JSON Schema (as JSON or YAML text) for completion, hover docs and validation. */
120
+ schema?: string;
121
+ /** Text the diff gutter compares against. Default: the initial `value`. */
122
+ baseline?: string;
123
+ /** File name shown in the toolbar. */
124
+ fileName?: string;
125
+ /** View mode; switches live (`update`). */
126
+ readOnly?: boolean;
127
+ /** Why the editor is read-only (a file the host manages, a missing permission), while `readOnly` is on: shown with the "Cannot edit in a read-only editor" notice when the user tries to edit, and in the text area's accessible description. Updates live. */
128
+ readOnlyReason?: string;
129
+ /** Extra class on the editor root. */
130
+ className?: string;
131
+ /** Set it when you hand every `onChange` text back through `update({ value })`, possibly late and in any order (a store that re-renders after a delay, a fetch per edit): a `value` that `onChange` gave and that has not come back yet is then its echo and keeps the document, so nothing typed is lost. A text it never gave applies; go back to one it gave with `replaceValue`. Without it (the default) every `value` applies. Fixed for the editor's life. */
132
+ echoes?: boolean;
133
+ /** Called with the document, in `language`, after every edit, and the text's `revision`: pass it back as `valueRevision` with the value for an exact echo match (no pause, see `valueRevision`). */
134
+ onChange?: (value: string, revision: number) => void;
135
+ /** Called with the language on screen: once on mount, then each time an `editAs` switch completes and when undo or redo steps back across one (it waits while the document cannot convert yet, the host's language staying on screen). */
136
+ onEditAsChange?: (language: LanguageName) => void;
137
+ /** Called with whether the text on screen is written back to the document (`value`): once on mount, then each time that changes. `false` while an `editAs` edit cannot convert back (`value` stays the last document, `onChange` waits), from whatever brought it there (typing, paste, undo, a switch, a reload, a new `value`); read after each pause in typing. Always `true` while editing in `language`. */
138
+ onSyncChange?: (inSync: boolean) => void;
139
+ /** Called with how the document differs from `baseline`: on mount, then whenever that changes. */
140
+ onChangeSummary?: (summary: ChangeSummary) => void;
141
+ /** Called with the editor's own problems (syntax, schema, secret placeholders, conversion; `origin: "editor"`, never the host's `hostDiagnostics`), as checked after each pause in typing: once on mount, then each time they change, never while they stay the same. With the `showDiagnostics` setting off it finds none. */
142
+ onProblems?: (problems: Diagnostic[]) => void;
143
+ /** Called with the path of what the caret is on each time it changes (and once on mount), for a breadcrumb. */
144
+ onPathChange?: (path: EditorPath) => void;
145
+ /** Problems the host found (its own checks: a service, a build step), shown next to the editor's own; `update` replaces them. */
146
+ hostDiagnostics?: HostDiagnostic[];
147
+ /** Called once per thing in `schema` the editor cannot use, such as a `patternProperties` regex its engine cannot compile. Without it, each is a console warning. */
148
+ onSchemaWarning?: (message: string) => void;
149
+ /** Called when the user presses `Ctrl+S` / `Cmd+S` (the browser's dialog prevented) or you call `save()`, with the document in `language`. Nothing saves by itself. Without it, `Ctrl+S` is the browser's. */
150
+ onSave?: (value: string, language: LanguageName) => void;
151
+ /** Called with whether the document differs from `baseline`: once on mount, then each time that changes. */
152
+ onDirtyChange?: (dirty: boolean) => void;
153
+ /** Called when a new `baseline` arrives under unsaved edits (the editor asks the user to reload or keep their text), and when that is settled. */
154
+ onBaselineConflict?: (event: BaselineConflict) => void;
155
+ /** Fields the user cannot change (each with everything inside it), on top of those the schema marks `readOnly`. They hold while editing as another language too; `update` replaces them. */
156
+ readOnlyPaths?: FieldPath[];
157
+ /** Stretches of the document (in `language`) the user cannot change; they follow the text through edits; `update` replaces them. */
158
+ readOnlyRanges?: TextRangeInput[];
159
+ /** The text `readOnlyRanges` and `hostDiagnostics` ranges were given for, when it is not `value` (a check of a text the document has moved past): they are checked in it and moved to `value`. Default: `value`. */
160
+ rangesFor?: string;
161
+ /** The `revision` of `value`, read by `update` (see `EditorUpdate.valueRevision`); none at construction. */
162
+ valueRevision?: number;
163
+ /** How secret placeholders (`«secret 3f2a»`) are matched, described and completed in fields the schema marks `writeOnly` or `x-secret`. */
164
+ secrets?: SecretOptions;
165
+ /** The `channel` of an editor this one replaces (a framework re-creating its editor for a new `language` or `fileName`), with `echoes` as that editor had it: the texts it sent that the host has not handed back yet are this editor's echoes too, so none of them rolls back what was typed. With no `readOnlyRanges` given, this editor holds the ones that editor held, where they are now. The object is this editor's from then on. */
166
+ channel?: HostChannel;
167
+ }
168
+
169
+ /** Secret placeholders: tokens the host writes in place of real secrets. */
170
+ export interface SecretOptions {
171
+ /** A regular expression (Rust `regex` syntax) matching placeholder tokens. Default `«secret [0-9a-f]+»`. Only tokens in the host's own `value` are real. */
172
+ placeholder?: string;
173
+ /** Decides which matched tokens are real placeholders. */
174
+ isPlaceholder?: (token: string) => boolean;
175
+ /** Hover text of a placeholder. Default "Keeps the current secret unless you replace it". */
176
+ hint?: string;
177
+ /** Reference forms offered in a secret field's value. Default `["${", "file:"]`. */
178
+ referencePrefixes?: string[];
179
+ }
180
+
181
+ /** A stretch of the host's document: string indices, or one-based lines and columns. */
182
+ export type TextRangeInput = { start: number; end: number } | { startLine: number; startColumn: number; endLine?: number; endColumn?: number };
183
+
184
+ /**
185
+ * A baseline conflict's progress: `"opened"` (the notice asks the user),
186
+ * `"reloaded"` (the document is the new baseline, reported through
187
+ * `onChange`), `"kept-mine"` (the document stays, diffed against the new
188
+ * baseline), `"settled"` (the document came to equal the new baseline, or the
189
+ * baseline was set back).
190
+ */
191
+ export type BaselineConflict = "opened" | "reloaded" | "kept-mine" | "settled";
192
+
193
+ /** A problem the host found, by `path` (preferred: it follows the field through edits and `editAs`) or `range`; with neither, it is about the whole document. */
194
+ export interface HostDiagnostic {
195
+ path?: FieldPath;
196
+ /** A stretch of the document in `language`: string indices, or one-based lines and columns. With no `endColumn` (and no `endLine` past `startLine`) it is a point: it marks the whole secret placeholder it is on, else one character there (at a line's end, the place just past it). While editing as another language it marks the field it starts in. */
197
+ range?: TextRangeInput;
198
+ /** Default `"error"`. */
199
+ severity?: Severity;
200
+ message: string;
201
+ /** Shown with the message, e.g. `"E_PORT"`. */
202
+ code?: string;
203
+ /** Who reported it, shown with the message; default `"host"`. */
204
+ source?: string;
205
+ /** A page explaining the problem, opened from its message. */
206
+ docsUrl?: string;
207
+ }
208
+
209
+ export type Severity = "error" | "warning" | "info" | "hint";
210
+
211
+ /**
212
+ * Settings to change: each key left out (or `undefined`) stays, `null`
213
+ * returns it to its default; `strings` merges text by text and `colors`
214
+ * token by token (a text or token set to `null` returns to its default).
215
+ */
216
+ export type SettingsUpdate = {
217
+ [K in Exclude<keyof EditorSettings, "strings" | "colors">]?: EditorSettings[K] | null;
218
+ } & {
219
+ strings?: { [K in keyof EditorStrings]?: EditorStrings[K] | null } | null;
220
+ colors?: { [K in keyof ThemeColorMap]?: ThemeColorMap[K] | null } | null;
221
+ };
222
+
223
+ /**
224
+ * What `editor.update` takes: the constructor's options, any of them. A key
225
+ * left out (or `undefined`) stays as it is; `null` removes a callback,
226
+ * clears a list, turns `editAs` and `readOnly` off, or returns a setting to
227
+ * its default; settings merge key by key. The options the editor is built
228
+ * from (`language`, `schema`, `fileName`, `className`, `secrets`, `echoes`) cannot
229
+ * change: create a new editor.
230
+ */
231
+ export interface EditorUpdate extends SettingsUpdate {
232
+ /** Replaces the document (in `language`), as a host update, whatever it is (the text given last included): the caret stays when the text is unchanged. With `echoes`, a text `onChange` gave that has not come back yet is its echo and keeps the document, and so does the text given last, given again (a render with a store behind the typing): reset to it with `replaceValue`. */
233
+ value?: string;
234
+ /** With `echoes`: the `revision` `onChange` gave `value` with, for a host that stores the newest revision it hears and never goes back to an older one. The echo is then matched exactly, with no pause: that revision and every earlier one are confirmed. Leave it out for a text of your own. Without it, an echo is told apart by its text, and an echo left behind by the document is checked again a pause (250 ms) later. */
235
+ valueRevision?: number;
236
+ /** The text this update's `readOnlyRanges` and `hostDiagnostics` ranges were given for, when it is not the document (a check of a text the user has typed past): they are checked in it and moved to the document. Default: `value`, else the document. */
237
+ rangesFor?: string;
238
+ /** The text the diff gutter compares against. */
239
+ baseline?: string;
240
+ /** Edit in another language; `null` edits in `language` again. */
241
+ editAs?: LanguageName | null;
242
+ /** View mode; `null` is `false`. */
243
+ readOnly?: boolean | null;
244
+ /** Why the editor is read-only; `null` says no reason. */
245
+ readOnlyReason?: string | null;
246
+ /** Replaces the host's problems; `null` or `[]` clears them. */
247
+ hostDiagnostics?: HostDiagnostic[] | null;
248
+ /** Replaces the fields the user cannot change; `null` or `[]` clears them. */
249
+ readOnlyPaths?: FieldPath[] | null;
250
+ /** Replaces the stretches the user cannot change (in `rangesFor`, else `value`, else the document); `null` or `[]` clears them. The ones given last, given again with no new text, stay where the editor moved them as the user typed. */
251
+ readOnlyRanges?: TextRangeInput[] | null;
252
+ onChange?: ((value: string, revision: number) => void) | null;
253
+ onEditAsChange?: ((language: LanguageName) => void) | null;
254
+ onSyncChange?: ((inSync: boolean) => void) | null;
255
+ onChangeSummary?: ((summary: ChangeSummary) => void) | null;
256
+ onProblems?: ((problems: Diagnostic[]) => void) | null;
257
+ onPathChange?: ((path: EditorPath) => void) | null;
258
+ onSchemaWarning?: ((message: string) => void) | null;
259
+ /** `null` gives `Ctrl+S` back to the browser. */
260
+ onSave?: ((value: string, language: LanguageName) => void) | null;
261
+ onDirtyChange?: ((dirty: boolean) => void) | null;
262
+ onBaselineConflict?: ((event: BaselineConflict) => void) | null;
263
+ /** The editor is built from it: create a new one to change it. */
264
+ language?: never;
265
+ /** The editor is built from it: create a new one to change it. */
266
+ schema?: never;
267
+ /** The editor is built from it: create a new one to change it. */
268
+ fileName?: never;
269
+ /** The editor is built from it: create a new one to change it. */
270
+ className?: never;
271
+ /** The editor is built from it: create a new one to change it. */
272
+ secrets?: never;
273
+ /** The editor is built from it: create a new one to change it. */
274
+ echoes?: never;
275
+ /** The editor is built from it: create a new one to change it. */
276
+ channel?: never;
277
+ }
278
+
279
+ /**
280
+ * What a mounted editor answers and does: a `ConfigEditor`, and a
281
+ * document's editor in a `ConfigDocuments` (`view.editor(id)`).
282
+ */
283
+ export interface EditorView {
284
+ /** The document, in its language (a document's editor: the host's `value`, then each edit). `null` only from a document's editor whose document was removed (a `ConfigEditor` always answers a string). */
285
+ readonly value: string | null;
286
+ /** The text on screen: in the `editAs` language while editing as another one (what `rangeOf` and `pathAt` index into). `null` only from a document's editor whose document was removed. */
287
+ readonly text: string | null;
288
+ /** Whether the document differs from its baseline. */
289
+ readonly isDirty: boolean;
290
+ /** The path of what the caret is on, or `null` (a document's editor: until it has been shown once, or listed with `editAsText`). */
291
+ readonly currentPath: EditorPath | null;
292
+ /** The folded blocks, one-based `{ startLine, endLine }` (`startLine` stays visible). */
293
+ readonly foldedLines: LineRange[];
294
+ /** The settings in effect: every key of `EditorSettings`, set. */
295
+ readonly settings: Required<EditorSettings>;
296
+ /** Scrolls to the field at `path`, selects it and focuses the editor; `false` when there is no such field. */
297
+ reveal(path: FieldPath): boolean;
298
+ /** Selects `range` (string indices into the text on screen, as `rangeOf` gives them), scrolls it into view inside the editor and focuses the editor without moving the page, as `reveal` does for a field: any stretch, comments and blank lines included. A range past the end is clamped. `false` before the editor mounts and for an empty document. */
299
+ revealRange(range: { start: number; end: number }): boolean;
300
+ /** Where the field at `path` is written in the text on screen, or `null`. */
301
+ rangeOf(path: FieldPath): EditorRange | null;
302
+ /** The path of what the text on screen holds at string index `offset`, or `null`. */
303
+ pathAt(offset: number): EditorPath | null;
304
+ /** Folds the block the field at `path` opens; `false` when there is none to fold. */
305
+ fold(path: FieldPath): boolean;
306
+ /** Opens the folds around the field at `path`; `false` when none was closed. */
307
+ unfold(path: FieldPath): boolean;
308
+ /** Folds every block (`Ctrl+K Ctrl+0`). */
309
+ foldAll(): void;
310
+ /** Opens every fold (`Ctrl+K Ctrl+J`). */
311
+ unfoldAll(): void;
312
+ /** Focuses the editor, keeping its selection. */
313
+ focus(): void;
314
+ /** Saves as `Ctrl+S` does (calls `onSave`); `false` when nothing was sent (no `onSave`, or an `editAs` edit that cannot convert back yet). */
315
+ save(): boolean;
316
+ /** The unified diff (`diff -u`) of the baseline against the document, with `context` unchanged lines around each change (default 3); empty when they are the same. */
317
+ unifiedDiff(context?: number): string;
318
+ }
319
+
320
+ /** How the document differs from the baseline, by lines, as the diff gutter shows it. */
321
+ export interface ChangeSummary {
322
+ added: number;
323
+ removed: number;
324
+ modified: number;
325
+ /** Separate changes (runs of changed lines); "Revert this change" restores one. */
326
+ hunks: number;
327
+ }
328
+
329
+ /** A field: a JSON pointer (`"/web/hosts/1"`) or its keys and indices (`["web", "hosts", 1]`). The same in every language. */
330
+ export type FieldPath = string | (string | number)[];
331
+
332
+ /** A path the editor reports: as a JSON pointer and as keys and indices. */
333
+ export interface EditorPath {
334
+ /** `""` for the whole document. */
335
+ pointer: string;
336
+ segments: (string | number)[];
337
+ }
338
+
339
+ /** A stretch of the text on screen (`text`, folded lines included): string indices (`start`, `end`, UTF-16 units) and one-based lines and columns. */
340
+ export interface EditorRange {
341
+ start: number;
342
+ end: number;
343
+ startLine: number;
344
+ startColumn: number;
345
+ endLine: number;
346
+ endColumn: number;
347
+ }
348
+
349
+ /** One-based lines `startLine..=endLine`: a fold keeps `startLine` visible and hides the rest. */
350
+ export interface LineRange {
351
+ startLine: number;
352
+ endLine: number;
353
+ }
354
+
355
+ /** A language, as `languages()` lists it. */
356
+ export interface LanguageInfo {
357
+ /** The canonical name, what `language` and `editAs` take (they also take an extension: `"yml"`). */
358
+ name: LanguageName;
359
+ /** Short UI label, such as `"YAML"`. */
360
+ label: string;
361
+ /** One or two letters for the toolbar icon. */
362
+ icon: string;
363
+ /** Lowercase, without the dot; the first is preferred. */
364
+ extensions: string[];
365
+ /** The name the toolbar shows when `fileName` is not given, such as `"untitled.yaml"`. */
366
+ defaultFileName: string;
367
+ }
368
+
369
+ /** A bundled theme, as `themes()` lists it. */
370
+ export interface ThemeInfo {
371
+ /** The slug `theme` takes, such as `"vscode-dark"`. */
372
+ name: ThemeName;
373
+ /** Display name, such as `"VS Code Dark"`. */
374
+ label: string;
375
+ /** Whether it is a dark theme. */
376
+ dark: boolean;
377
+ }
378
+
379
+ export interface Diagnostic {
380
+ line?: number;
381
+ column?: number;
382
+ /** Just past the marker, on `endLine` when it is set. */
383
+ endColumn?: number;
384
+ /** The line the marker ends on, only when it covers several lines. */
385
+ endLine?: number;
386
+ message: string;
387
+ severity: Severity;
388
+ /** Who found it: the editor (syntax, schema, secret placeholders, conversion) or the host (`hostDiagnostics`). */
389
+ origin: "editor" | "host";
390
+ /** `true` on the warning of a key the schema marks `deprecated` (the marker is the key). */
391
+ deprecated?: boolean;
392
+ }
393
+
394
+ export interface Conversion {
395
+ text: string;
396
+ /** JSON pointers of values the target reads back differently. */
397
+ losses: string[];
398
+ }
399
+
400
+ export interface CustomLanguage {
401
+ label: string;
402
+ /** One or two letters for the toolbar icon. */
403
+ icon?: string;
404
+ extensions?: string[];
405
+ /** Parse to a JSON value, or throw `{ message, line?, column? }`. */
406
+ parse(text: string): unknown;
407
+ /** Text for a JSON value (the document model, usually an object). */
408
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
409
+ serialize?(value: any): string;
410
+ /** `{ line, startColumn, endColumn }` (one-based) of the key at a JSON pointer; `null` or `undefined` leaves it to the default (a flat language finds keys on their lines). */
411
+ keySpan?(text: string, pointer: string): { line: number; startColumn: number; endColumn: number } | null | undefined | void;
412
+ valueSpan?(text: string, pointer: string): { line: number; startColumn: number; endColumn: number } | null | undefined | void;
413
+ /** Ranges of one line as JavaScript string indices (as `indexOf` gives): kind is "key" | "string" | "value" | "literal" | "comment" | "punctuation" | "reference" (an anchor, an alias) | "interpolation" (an expression in a string). */
414
+ highlight?(line: string): { start: number; end: number; kind: string }[] | null | undefined | void;
415
+ /** Comment markers, as in VS Code's language configuration: `Ctrl+/` writes the first line comment, and unwraps lines each wrapped in `blockComment`. */
416
+ comments?: { lineComment?: string | string[]; blockComment?: [string, string] };
417
+ /** Bracket pairs Enter opens across lines, e.g. `[["{", "}"], ["[", "]"]]`. */
418
+ brackets?: [string, string][];
419
+ /** What separates a key from its value, e.g. `["="]` or `[":"]`: key renames, `Tab` through empty values. Without the callbacks below they also give a flat language (one `KEY=value` entry per line) schema completion and hover. */
420
+ separators?: string[];
421
+ /** The brackets around a map written on one line, e.g. `["{", "}"]`: an Edit-as save edits such a map where it is, its entries and the line's comment kept. */
422
+ mapBrackets?: [string, string];
423
+ /** The brackets around a list written on one line, e.g. `["[", "]"]`, edited in place as maps are. */
424
+ listBrackets?: [string, string];
425
+ /** What separates the items and entries between those brackets, one character, e.g. `","`. */
426
+ itemSeparator?: string;
427
+ /** What starts a list item written on lines of its own, followed by a space or the line's end, e.g. `"-"`: a save moves such items with their lines and comments. */
428
+ itemMarker?: string;
429
+ /** The quotes (of `"` and `'`) inside which a backslash is text, not an escape, e.g. `["'"]`. */
430
+ literalQuotes?: string[];
431
+ /** One of `separators` with the spacing a new entry writes it with, e.g. `": "` (default: the first separator as it is, `KEY=`). */
432
+ writtenSeparator?: string;
433
+ /** Where the caret at string index `offset` is, for schema completion: typing a key in the object at `path` (`at: "key"`), or in the value of the key that ends `path` (`at: "value"`; a path ending in an index: an array item), with `prefix` typed before it. `null`: nothing to suggest. Replaces the flat default of `separators`. */
434
+ contextAt?(text: string, offset: number): CustomLanguageContext | null | undefined | void;
435
+ /** How a suggested key is written, with the caret's string index in `text`; `kind` is what the schema expects as its value. Lines after the first are indented as the caret's line. `null` leaves the key out. */
436
+ insertKey?(key: string, kind: "scalar" | "object" | "array"): { text: string; caret: number } | null | undefined | void;
437
+ /** The key at string index `offset` (under the mouse), for hover docs: its name, its full path (ending with it), and the string index it starts at. `null`: no key there. */
438
+ keyAt?(text: string, offset: number): { key: string; path: (string | number)[]; start: number } | null | undefined | void;
439
+ /** Strings and comments written over several lines (string indices, as `indexOf` gives): their lines are colored as such up to `end`, the rest of the last line by `highlight`; nothing is suggested inside. */
440
+ multilineRanges?(text: string): { start: number; end: number; kind: "string" | "comment" }[] | null | undefined | void;
441
+ }
442
+
443
+ /** Where the caret is in a custom language's document; see `CustomLanguage.contextAt`. */
444
+ export interface CustomLanguageContext {
445
+ /** The object holding the caret (`at: "key"`), or the key whose value it is in (`at: "value"`). */
446
+ path: (string | number)[];
447
+ at: "key" | "value";
448
+ /** The key or value typed before the caret, which suggestions filter by and replace. */
449
+ prefix: string;
450
+ }
451
+
452
+
453
+ // Generated from crates/config-editor-leptos/src/settings.rs by js/config-editor/tests/settings.rs; do not edit. Regenerate with `UPDATE_GENERATED=1 cargo test -p config-editor-js --test settings`.
454
+ // Generated from crates/config-editor-leptos/src/strings.rs by js/config-editor/tests/settings.rs; do not edit. Regenerate with `UPDATE_GENERATED=1 cargo test -p config-editor-js --test settings`.
455
+
456
+ /**
457
+ * How an editor looks and which of its features are on: everything a host sets once and may switch at any time, apart from the document itself.
458
+ *
459
+ * Every key is optional: one left out takes its default.
460
+ */
461
+ export interface EditorSettings {
462
+ /**
463
+ * The bundled color theme.
464
+ *
465
+ * @default "vscode-dark"
466
+ */
467
+ theme?: ThemeName;
468
+ /**
469
+ * Colors overriding the theme's, by token (`bg`, `key`, `string`, `selection`, …), for a custom palette.
470
+ *
471
+ * @default {}
472
+ */
473
+ colors?: ThemeColorMap;
474
+ /**
475
+ * Inject the preset stylesheet. Off, serve it as a file (`preset.css` in the crate and the npm package, as a strict Content-Security-Policy needs) or style the `config-editor__*` markup yourself (the preset is `PRESET_CSS`, `presetCss()` in JavaScript).
476
+ *
477
+ * @default true
478
+ */
479
+ styled?: boolean;
480
+ /**
481
+ * Show the built-in toolbar: the file name, its language and the schema's state.
482
+ *
483
+ * @default false
484
+ */
485
+ showToolbar?: boolean;
486
+ /**
487
+ * Show the built-in status footer: the suggestions hint, problem and change counts, and the line count.
488
+ *
489
+ * @default false
490
+ */
491
+ showFooter?: boolean;
492
+ /**
493
+ * Show syntax and schema problems inline, in the footer and on hover (`F8` moves between them).
494
+ *
495
+ * @default true
496
+ */
497
+ showDiagnostics?: boolean;
498
+ /**
499
+ * Show line changes against the baseline in the gutter (`Alt+F5` / `Alt+F3` move between them). Off, the change summary stays at zero. In Rust, needs the `diff` Cargo feature.
500
+ *
501
+ * @default true
502
+ */
503
+ showDiff?: boolean;
504
+ /**
505
+ * Schema completions (`Ctrl+Space`).
506
+ *
507
+ * @default true
508
+ */
509
+ completions?: boolean;
510
+ /**
511
+ * Open suggestions while typing and after accepting a key. Off, only `Ctrl+Space` opens them.
512
+ *
513
+ * @default true
514
+ */
515
+ autoTriggerCompletions?: boolean;
516
+ /**
517
+ * Show the schema's title, description, type, default and examples when hovering a key, at the caret with `Ctrl+K Ctrl+I` (read to screen readers), or on a tap on a touch screen.
518
+ *
519
+ * @default true
520
+ */
521
+ hoverDocs?: boolean;
522
+ /**
523
+ * Syntax colors.
524
+ *
525
+ * @default true
526
+ */
527
+ highlighting?: boolean;
528
+ /**
529
+ * Auto-close quotes and brackets, wrap selections, and delete empty pairs on Backspace.
530
+ *
531
+ * @default true
532
+ */
533
+ autoClosing?: boolean;
534
+ /**
535
+ * Find and replace (`Ctrl+F`, `Ctrl+H`, `F3`). Off, those keys are left to the browser. In Rust, needs the `search` Cargo feature.
536
+ *
537
+ * @default true
538
+ */
539
+ search?: boolean;
540
+ /**
541
+ * Go to line (`Ctrl+G`). Off, the key is left to the browser. In Rust, needs the `search` Cargo feature.
542
+ *
543
+ * @default true
544
+ */
545
+ goToLine?: boolean;
546
+ /**
547
+ * Folding by structure: chevrons in the gutter, `Ctrl+Shift+[` and `Ctrl+Shift+]` at the caret, `Ctrl+K Ctrl+0` and `Ctrl+K Ctrl+J` for everything (`Cmd` on macOS). View only: the text stays whole. Switching it off opens every fold. In Rust, needs the `folding` Cargo feature.
548
+ *
549
+ * @default true
550
+ */
551
+ folding?: boolean;
552
+ /**
553
+ * Sticky scroll, as in VS Code: the lines opening the blocks around the top line stay at the top while the text scrolls; a click goes back to one. Works with `folding` off too. In Rust, needs the `folding` Cargo feature.
554
+ *
555
+ * @default true
556
+ */
557
+ stickyScroll?: boolean;
558
+ /**
559
+ * The most lines sticky scroll shows, 1 to 20 (others are taken as the nearest), and never more than fit in a quarter of the text area (at least one).
560
+ *
561
+ * @default 5
562
+ */
563
+ stickyScrollMaxLines?: number;
564
+ /**
565
+ * Whether `Ctrl+S` / `Cmd+S` saves, when a save callback is set. Off, the key is left to the browser and only the handle's `save` saves.
566
+ *
567
+ * @default true
568
+ */
569
+ saveShortcut?: boolean;
570
+ /**
571
+ * Every built-in text (hints, tooltips, notices and their buttons, footer counts, accessible names and announcements), English by default: give only the texts to change. See `EditorStrings`.
572
+ *
573
+ * @default English texts
574
+ */
575
+ strings?: EditorStrings;
576
+ }
577
+
578
+ /**
579
+ * Every built-in text of the editor and its documents' tabs, in English by default; change any to reword or translate the editor.
580
+ *
581
+ * Every key is optional: one left out takes its default.
582
+ */
583
+ export interface EditorStrings {
584
+ /**
585
+ * The footer's suggestions hint; `{key}` is where the chord goes.
586
+ *
587
+ * @default "{key} for suggestions"
588
+ */
589
+ suggestionsHint?: string;
590
+ /**
591
+ * `suggestions_hint` on a touch screen, which has no `suggestions_key`; shown only while suggestions open as you type.
592
+ *
593
+ * @default "suggestions appear as you type"
594
+ */
595
+ suggestionsHintTouch?: string;
596
+ /**
597
+ * The chord that opens suggestions, as the footer draws it: keys between `+`.
598
+ *
599
+ * @default "Ctrl+Space"
600
+ */
601
+ suggestionsKey?: string;
602
+ /**
603
+ * The footer's problem count when there are none.
604
+ *
605
+ * @default "No errors"
606
+ */
607
+ noProblems?: string;
608
+ /**
609
+ * One error, in the footer's problem count.
610
+ *
611
+ * @default "{count} error"
612
+ */
613
+ errorsOne?: string;
614
+ /**
615
+ * Several errors, in the footer's problem count.
616
+ *
617
+ * @default "{count} errors"
618
+ */
619
+ errorsOther?: string;
620
+ /**
621
+ * One warning, in the footer's problem count.
622
+ *
623
+ * @default "{count} warning"
624
+ */
625
+ warningsOne?: string;
626
+ /**
627
+ * Several warnings, in the footer's problem count.
628
+ *
629
+ * @default "{count} warnings"
630
+ */
631
+ warningsOther?: string;
632
+ /**
633
+ * One info, in the footer's problem count.
634
+ *
635
+ * @default "{count} info"
636
+ */
637
+ infosOne?: string;
638
+ /**
639
+ * Several infos, in the footer's problem count.
640
+ *
641
+ * @default "{count} info"
642
+ */
643
+ infosOther?: string;
644
+ /**
645
+ * One hint, in the footer's problem count.
646
+ *
647
+ * @default "{count} hint"
648
+ */
649
+ hintsOne?: string;
650
+ /**
651
+ * Several hints, in the footer's problem count.
652
+ *
653
+ * @default "{count} hints"
654
+ */
655
+ hintsOther?: string;
656
+ /**
657
+ * After the problem count when every problem has its place.
658
+ *
659
+ * @default "hover or focus underlined text"
660
+ */
661
+ problemsHint?: string;
662
+ /**
663
+ * `problems_hint` on a touch screen, which has no hover.
664
+ *
665
+ * @default "tap underlined text"
666
+ */
667
+ problemsHintTouch?: string;
668
+ /**
669
+ * After the problem count when the editor's own problems were cut; `{count}` is how many of them are shown (the host's are all shown).
670
+ *
671
+ * @default "only the editor's first {count} are shown"
672
+ */
673
+ problemsCut?: string;
674
+ /**
675
+ * The problem that says the list was cut, after `{count}` problems.
676
+ *
677
+ * @default "Only the first {count} problems are shown; more follow."
678
+ */
679
+ problemsMore?: string;
680
+ /**
681
+ * The problem that says the schema check stopped early, so more problems may follow than are listed (a schema whose explanation would grow faster than the document).
682
+ *
683
+ * @default "The schema check stopped early; more problems may follow."
684
+ */
685
+ problemsIncomplete?: string;
686
+ /**
687
+ * After the problem count when the problems have more underlines than are drawn; `{count}` is how many are (the most serious first).
688
+ *
689
+ * @default "only {count} underlines are drawn, the most serious first"
690
+ */
691
+ underlinesCut?: string;
692
+ /**
693
+ * The footer's change count against the baseline, for one change.
694
+ *
695
+ * @default "{count} change"
696
+ */
697
+ changesOne?: string;
698
+ /**
699
+ * The footer's change count, for several changes.
700
+ *
701
+ * @default "{count} changes"
702
+ */
703
+ changesOther?: string;
704
+ /**
705
+ * The change count's tooltip when one line changed; `{lines}` lists the added, modified and removed counts.
706
+ *
707
+ * @default "{lines} line · Alt+F5 for the next"
708
+ */
709
+ changeDetailsOne?: string;
710
+ /**
711
+ * The change count's tooltip when several lines changed.
712
+ *
713
+ * @default "{lines} lines · Alt+F5 for the next"
714
+ */
715
+ changeDetailsOther?: string;
716
+ /**
717
+ * Added lines, in the change count's tooltip.
718
+ *
719
+ * @default "{count} added"
720
+ */
721
+ changedAdded?: string;
722
+ /**
723
+ * Modified lines, in the change count's tooltip.
724
+ *
725
+ * @default "{count} modified"
726
+ */
727
+ changedModified?: string;
728
+ /**
729
+ * Removed lines, in the change count's tooltip.
730
+ *
731
+ * @default "{count} removed"
732
+ */
733
+ changedRemoved?: string;
734
+ /**
735
+ * The footer's line count, for one line.
736
+ *
737
+ * @default "{count} line"
738
+ */
739
+ linesOne?: string;
740
+ /**
741
+ * The footer's line count, for several lines.
742
+ *
743
+ * @default "{count} lines"
744
+ */
745
+ linesOther?: string;
746
+ /**
747
+ * The footer's indicator while Tab moves the focus.
748
+ *
749
+ * @default "Tab moves focus"
750
+ */
751
+ tabFocus?: string;
752
+ /**
753
+ * Its tooltip; clicking it turns the mode off.
754
+ *
755
+ * @default "Tab moves focus (Ctrl+M to indent with Tab)"
756
+ */
757
+ tabFocusTitle?: string;
758
+ /**
759
+ * Announced when `Ctrl+M` makes Tab move the focus.
760
+ *
761
+ * @default "Tab moves focus: Tab and Shift+Tab now leave the editor. Ctrl+M to indent with Tab again."
762
+ */
763
+ tabFocusOn?: string;
764
+ /**
765
+ * Announced when `Ctrl+M` makes Tab indent again.
766
+ *
767
+ * @default "Tab indents: Tab and Shift+Tab indent again. Ctrl+M to move focus with Tab."
768
+ */
769
+ tabFocusOff?: string;
770
+ /**
771
+ * The toolbar's schema state.
772
+ *
773
+ * @default "Schema connected"
774
+ */
775
+ schemaConnected?: string;
776
+ /**
777
+ * The Edit-as notice when the host's file has comments, which the edited language does not show but saving keeps.
778
+ *
779
+ * @default "The {host} file's comments and formatting are not shown while editing as {edit}; saving keeps them."
780
+ */
781
+ editAsHostComments?: string;
782
+ /**
783
+ * The same when the host's file has processing instructions too (XML `<?…?>`), which the edited language does not show either.
784
+ *
785
+ * @default "The {host} file's comments, processing instructions and formatting are not shown while editing as {edit}; saving keeps them."
786
+ */
787
+ editAsHostInstructions?: string;
788
+ /**
789
+ * The Edit-as notice when comments are typed in the edited language, which saving drops, and the host's language has comments.
790
+ *
791
+ * @default "Comments typed in {edit} are not saved: the {host} file keeps only its own comments."
792
+ */
793
+ editAsTypedComments?: string;
794
+ /**
795
+ * The same when the host's language has no comments (JSON).
796
+ *
797
+ * @default "Comments typed in {edit} are not saved: {host} has no comments."
798
+ */
799
+ editAsTypedCommentsNone?: string;
800
+ /**
801
+ * The Edit-as notice's close button.
802
+ *
803
+ * @default "Dismiss"
804
+ */
805
+ editAsDismiss?: string;
806
+ /**
807
+ * The notice shown when the host's baseline changes under unsaved edits.
808
+ *
809
+ * @default "This file changed outside the editor."
810
+ */
811
+ baselineChanged?: string;
812
+ /**
813
+ * What the notice's choices do, after its message.
814
+ *
815
+ * @default "Reload it, losing your changes, or keep your text and compare it with the new version."
816
+ */
817
+ baselineChangedDetail?: string;
818
+ /**
819
+ * The notice's button that takes the new baseline as the text.
820
+ *
821
+ * @default "Reload"
822
+ */
823
+ reload?: string;
824
+ /**
825
+ * Announced after Reload took the changed baseline.
826
+ *
827
+ * @default "Reloaded"
828
+ */
829
+ reloaded?: string;
830
+ /**
831
+ * Its tooltip.
832
+ *
833
+ * @default "Replace your text with the new version ({cmd}+Z brings yours back)"
834
+ */
835
+ reloadTitle?: string;
836
+ /**
837
+ * The notice's button that keeps the text against the new baseline.
838
+ *
839
+ * @default "Keep mine"
840
+ */
841
+ keepMine?: string;
842
+ /**
843
+ * Its tooltip.
844
+ *
845
+ * @default "Keep your text; the changes are now shown against the new version (Escape)"
846
+ */
847
+ keepMineTitle?: string;
848
+ /**
849
+ * How to reach the notice's choices from the keyboard, shown on it (and announced with it); not on touch screens.
850
+ *
851
+ * @default "In the editor, F6 moves to the choices and back."
852
+ */
853
+ baselineChangedKeys?: string;
854
+ /**
855
+ * The find widget's accessible name.
856
+ *
857
+ * @default "Find and replace"
858
+ */
859
+ findWidget?: string;
860
+ /**
861
+ * The button showing the replace row.
862
+ *
863
+ * @default "Toggle replace"
864
+ */
865
+ toggleReplace?: string;
866
+ /**
867
+ * Its tooltip.
868
+ *
869
+ * @default "Toggle replace ({cmd}+H)"
870
+ */
871
+ toggleReplaceTitle?: string;
872
+ /**
873
+ * The query field's accessible name and placeholder.
874
+ *
875
+ * @default "Find"
876
+ */
877
+ find?: string;
878
+ /**
879
+ * The match-case toggle.
880
+ *
881
+ * @default "Match case"
882
+ */
883
+ matchCase?: string;
884
+ /**
885
+ * Its tooltip.
886
+ *
887
+ * @default "Match case (Alt+C)"
888
+ */
889
+ matchCaseTitle?: string;
890
+ /**
891
+ * The whole-word toggle.
892
+ *
893
+ * @default "Match whole word"
894
+ */
895
+ wholeWord?: string;
896
+ /**
897
+ * Its tooltip.
898
+ *
899
+ * @default "Match whole word (Alt+W)"
900
+ */
901
+ wholeWordTitle?: string;
902
+ /**
903
+ * The regular-expression toggle.
904
+ *
905
+ * @default "Use regular expression"
906
+ */
907
+ useRegex?: string;
908
+ /**
909
+ * Its tooltip.
910
+ *
911
+ * @default "Use regular expression (Alt+R)"
912
+ */
913
+ useRegexTitle?: string;
914
+ /**
915
+ * The previous-match button.
916
+ *
917
+ * @default "Previous match"
918
+ */
919
+ previousMatch?: string;
920
+ /**
921
+ * Its tooltip.
922
+ *
923
+ * @default "Previous match (Shift+Enter)"
924
+ */
925
+ previousMatchTitle?: string;
926
+ /**
927
+ * The next-match button.
928
+ *
929
+ * @default "Next match"
930
+ */
931
+ nextMatch?: string;
932
+ /**
933
+ * Its tooltip.
934
+ *
935
+ * @default "Next match (Enter)"
936
+ */
937
+ nextMatchTitle?: string;
938
+ /**
939
+ * The find widget's close button.
940
+ *
941
+ * @default "Close"
942
+ */
943
+ close?: string;
944
+ /**
945
+ * Its tooltip.
946
+ *
947
+ * @default "Close (Escape)"
948
+ */
949
+ closeTitle?: string;
950
+ /**
951
+ * The replacement field's accessible name and placeholder, and the button replacing the current match.
952
+ *
953
+ * @default "Replace"
954
+ */
955
+ replace?: string;
956
+ /**
957
+ * The replace button's tooltip.
958
+ *
959
+ * @default "Replace (Enter)"
960
+ */
961
+ replaceTitle?: string;
962
+ /**
963
+ * The replace-all button.
964
+ *
965
+ * @default "All"
966
+ */
967
+ replaceAll?: string;
968
+ /**
969
+ * Its accessible name.
970
+ *
971
+ * @default "Replace all"
972
+ */
973
+ replaceAllLabel?: string;
974
+ /**
975
+ * Its tooltip.
976
+ *
977
+ * @default "Replace all ({cmd}+Alt+Enter)"
978
+ */
979
+ replaceAllTitle?: string;
980
+ /**
981
+ * The match count: match `{current}` of `{total}`.
982
+ *
983
+ * @default "{current} of {total}"
984
+ */
985
+ matchPosition?: string;
986
+ /**
987
+ * The match count when nothing matches.
988
+ *
989
+ * @default "No results"
990
+ */
991
+ noResults?: string;
992
+ /**
993
+ * The match count when the regular expression is invalid.
994
+ *
995
+ * @default "Invalid pattern"
996
+ */
997
+ invalidPattern?: string;
998
+ /**
999
+ * After Replace All, for one match.
1000
+ *
1001
+ * @default "Replaced {count} occurrence"
1002
+ */
1003
+ replacedOne?: string;
1004
+ /**
1005
+ * After Replace All, for several.
1006
+ *
1007
+ * @default "Replaced {count} occurrences"
1008
+ */
1009
+ replacedOther?: string;
1010
+ /**
1011
+ * Added when Replace All left matches in protected text alone.
1012
+ *
1013
+ * @default "; skipped {count} in read-only text or secret placeholders"
1014
+ */
1015
+ replaceSkipped?: string;
1016
+ /**
1017
+ * After Replace All when every match is in read-only text or a secret placeholder.
1018
+ *
1019
+ * @default "Every match is in read-only text or secret placeholders; nothing was replaced"
1020
+ */
1021
+ nothingReplaced?: string;
1022
+ /**
1023
+ * The go-to-line field's accessible name.
1024
+ *
1025
+ * @default "Go to line"
1026
+ */
1027
+ goToLine?: string;
1028
+ /**
1029
+ * Its placeholder.
1030
+ *
1031
+ * @default "line or line:column"
1032
+ */
1033
+ goToLinePlaceholder?: string;
1034
+ /**
1035
+ * Its hint: the range of lines.
1036
+ *
1037
+ * @default "Line 1–{lines}, or line:column"
1038
+ */
1039
+ goToLineHint?: string;
1040
+ /**
1041
+ * Its hint when the text is no position.
1042
+ *
1043
+ * @default "Type a line number between 1 and {lines}"
1044
+ */
1045
+ goToLineInvalid?: string;
1046
+ /**
1047
+ * The change preview's title for an added line.
1048
+ *
1049
+ * @default "Added line"
1050
+ */
1051
+ addedLine?: string;
1052
+ /**
1053
+ * For a modified line.
1054
+ *
1055
+ * @default "Modified line"
1056
+ */
1057
+ modifiedLine?: string;
1058
+ /**
1059
+ * For one removed line.
1060
+ *
1061
+ * @default "Removed line"
1062
+ */
1063
+ removedLine?: string;
1064
+ /**
1065
+ * For several removed lines.
1066
+ *
1067
+ * @default "Removed lines"
1068
+ */
1069
+ removedLines?: string;
1070
+ /**
1071
+ * For one line removed after the last one.
1072
+ *
1073
+ * @default "Removed line at end of document"
1074
+ */
1075
+ removedLineAtEnd?: string;
1076
+ /**
1077
+ * For several lines removed after the last one.
1078
+ *
1079
+ * @default "Removed lines at end of document"
1080
+ */
1081
+ removedLinesAtEnd?: string;
1082
+ /**
1083
+ * The gutter marker of an added line.
1084
+ *
1085
+ * @default "Show added line {line}"
1086
+ */
1087
+ showAdded?: string;
1088
+ /**
1089
+ * Its tooltip.
1090
+ *
1091
+ * @default "Show added line"
1092
+ */
1093
+ showAddedTitle?: string;
1094
+ /**
1095
+ * The gutter marker of a modified line.
1096
+ *
1097
+ * @default "Show before and after for modified line {line}"
1098
+ */
1099
+ showModified?: string;
1100
+ /**
1101
+ * Its tooltip.
1102
+ *
1103
+ * @default "Show before and after"
1104
+ */
1105
+ showModifiedTitle?: string;
1106
+ /**
1107
+ * The gutter marker of removed lines.
1108
+ *
1109
+ * @default "Show removed lines before line {line}"
1110
+ */
1111
+ showRemoved?: string;
1112
+ /**
1113
+ * Its tooltip, and that of lines removed at the end.
1114
+ *
1115
+ * @default "Show removed lines"
1116
+ */
1117
+ showRemovedTitle?: string;
1118
+ /**
1119
+ * The gutter marker of lines removed after the last one.
1120
+ *
1121
+ * @default "Show removed lines at end of document"
1122
+ */
1123
+ showRemovedAtEnd?: string;
1124
+ /**
1125
+ * The change preview's heading: its `{title}` and `{line}`.
1126
+ *
1127
+ * @default "{title} · line {line}"
1128
+ */
1129
+ previewHeading?: string;
1130
+ /**
1131
+ * The change preview's accessible name.
1132
+ *
1133
+ * @default "{title}, line {line}"
1134
+ */
1135
+ previewLabel?: string;
1136
+ /**
1137
+ * Announced on `Alt+F5` / `Shift+Alt+F5`: the change's `{title}` (as the preview's), its `{line}`, and its `{position}` of `{total}`.
1138
+ *
1139
+ * @default "{title}, line {line}: change {position} of {total}"
1140
+ */
1141
+ changePosition?: string;
1142
+ /**
1143
+ * Announced on `Alt+F5` / `Alt+F3` when nothing differs from the baseline.
1144
+ *
1145
+ * @default "No changes"
1146
+ */
1147
+ noChanges?: string;
1148
+ /**
1149
+ * Announced when a change is reverted.
1150
+ *
1151
+ * @default "Reverted"
1152
+ */
1153
+ reverted?: string;
1154
+ /**
1155
+ * The preview's revert button.
1156
+ *
1157
+ * @default "Revert"
1158
+ */
1159
+ revert?: string;
1160
+ /**
1161
+ * Its tooltip, for a one-line change.
1162
+ *
1163
+ * @default "Revert this change (R)"
1164
+ */
1165
+ revertTitle?: string;
1166
+ /**
1167
+ * Its tooltip, for a change over lines `{first}` to `{last}`.
1168
+ *
1169
+ * @default "Revert this change (lines {first}–{last}) (R)"
1170
+ */
1171
+ revertLinesTitle?: string;
1172
+ /**
1173
+ * Its tooltip, for a changed line with removed lines.
1174
+ *
1175
+ * @default "Revert this change (line {line} and the removed lines) (R)"
1176
+ */
1177
+ revertLineAndRemovedTitle?: string;
1178
+ /**
1179
+ * The preview's close button.
1180
+ *
1181
+ * @default "Close change preview"
1182
+ */
1183
+ closePreview?: string;
1184
+ /**
1185
+ * The preview's column of the baseline's lines.
1186
+ *
1187
+ * @default "Before"
1188
+ */
1189
+ before?: string;
1190
+ /**
1191
+ * The preview's column of the current lines.
1192
+ *
1193
+ * @default "Current"
1194
+ */
1195
+ current?: string;
1196
+ /**
1197
+ * The chevron of an open range.
1198
+ *
1199
+ * @default "Fold line {line}"
1200
+ */
1201
+ fold?: string;
1202
+ /**
1203
+ * The chevron or chip of a closed fold.
1204
+ *
1205
+ * @default "Unfold lines {first}–{last}"
1206
+ */
1207
+ unfold?: string;
1208
+ /**
1209
+ * A closed fold's line number when it hides changes or problems.
1210
+ *
1211
+ * @default "Folded lines have changes"
1212
+ */
1213
+ foldedChanges?: string;
1214
+ /**
1215
+ * After a closed fold's chip label when it hides one problem; `{severity}` names it.
1216
+ *
1217
+ * @default "hides a problem: {severity}"
1218
+ */
1219
+ foldedProblemOne?: string;
1220
+ /**
1221
+ * After a closed fold's chip label when it hides `{count}` problems; `{severity}` names the most serious of them.
1222
+ *
1223
+ * @default "hides {count} problems, the most serious: {severity}"
1224
+ */
1225
+ foldedProblemOther?: string;
1226
+ /**
1227
+ * Announced when the range of lines `{first}` to `{last}` folds.
1228
+ *
1229
+ * @default "Folded lines {first}–{last}"
1230
+ */
1231
+ foldedLines?: string;
1232
+ /**
1233
+ * Announced when the fold of lines `{first}` to `{last}` opens.
1234
+ *
1235
+ * @default "Unfolded lines {first}–{last}"
1236
+ */
1237
+ unfoldedLines?: string;
1238
+ /**
1239
+ * Announced when `{count}` ranges (two or more) fold at once.
1240
+ *
1241
+ * @default "Folded {count} ranges"
1242
+ */
1243
+ foldedRanges?: string;
1244
+ /**
1245
+ * Announced when `{count}` folds (two or more) open at once.
1246
+ *
1247
+ * @default "Unfolded {count} ranges"
1248
+ */
1249
+ unfoldedRanges?: string;
1250
+ /**
1251
+ * Announced when a fold key (`Ctrl+Shift+[`, `Ctrl+K Ctrl+0`) finds nothing to fold.
1252
+ *
1253
+ * @default "Nothing to fold"
1254
+ */
1255
+ nothingToFold?: string;
1256
+ /**
1257
+ * Announced when an unfold key (`Ctrl+Shift+]`, `Ctrl+K Ctrl+J`) finds nothing to open.
1258
+ *
1259
+ * @default "Nothing to unfold"
1260
+ */
1261
+ nothingToUnfold?: string;
1262
+ /**
1263
+ * The hover card's mark of a required key.
1264
+ *
1265
+ * @default "required"
1266
+ */
1267
+ required?: string;
1268
+ /**
1269
+ * The hover card's mark of a deprecated key.
1270
+ *
1271
+ * @default "deprecated"
1272
+ */
1273
+ deprecated?: string;
1274
+ /**
1275
+ * The hover card's default row.
1276
+ *
1277
+ * @default "Default"
1278
+ */
1279
+ defaultValue?: string;
1280
+ /**
1281
+ * The hover card's examples row.
1282
+ *
1283
+ * @default "Examples"
1284
+ */
1285
+ examples?: string;
1286
+ /**
1287
+ * The hover card's row listing the titles of the options (`oneOf`, `anyOf`) a field's object may take, while none matches it yet.
1288
+ *
1289
+ * @default "One of"
1290
+ */
1291
+ oneOf?: string;
1292
+ /**
1293
+ * The hover card's link to the schema's documentation.
1294
+ *
1295
+ * @default "Documentation"
1296
+ */
1297
+ documentation?: string;
1298
+ /**
1299
+ * Announced when a second `Ctrl+K Ctrl+I` moves the focus into the hover card, to scroll it.
1300
+ *
1301
+ * @default "In the docs: arrows, Page Up, Page Down, Home and End scroll them. Escape returns to the text."
1302
+ */
1303
+ hoverFocused?: string;
1304
+ /**
1305
+ * The focused hover card's accessible name: the `{key}` it documents.
1306
+ *
1307
+ * @default "About {key}"
1308
+ */
1309
+ hoverLabel?: string;
1310
+ /**
1311
+ * The problem tip's accessible name while it has the focus (a second `Ctrl+K Ctrl+I`).
1312
+ *
1313
+ * @default "Problems here"
1314
+ */
1315
+ problemTipLabel?: string;
1316
+ /**
1317
+ * The link under a host problem's message.
1318
+ *
1319
+ * @default "Open docs ↗ (Alt+Enter)"
1320
+ */
1321
+ openDocs?: string;
1322
+ /**
1323
+ * `open_docs` on a touch screen, which has no keys to name.
1324
+ *
1325
+ * @default "Open docs ↗"
1326
+ */
1327
+ openDocsTouch?: string;
1328
+ /**
1329
+ * A problem's docs link as a screen reader names it, told apart from the others in a tip: its `{link}` text (`open_docs`) and its problem's `{message}`.
1330
+ *
1331
+ * @default "{link}: {message}"
1332
+ */
1333
+ openDocsLabel?: string;
1334
+ /**
1335
+ * An error, as a screen reader hears it.
1336
+ *
1337
+ * @default "Error"
1338
+ */
1339
+ error?: string;
1340
+ /**
1341
+ * A warning, as a screen reader hears it.
1342
+ *
1343
+ * @default "Warning"
1344
+ */
1345
+ warning?: string;
1346
+ /**
1347
+ * An info, as a screen reader hears it.
1348
+ *
1349
+ * @default "Info"
1350
+ */
1351
+ info?: string;
1352
+ /**
1353
+ * A hint, as a screen reader hears it.
1354
+ *
1355
+ * @default "Hint"
1356
+ */
1357
+ hint?: string;
1358
+ /**
1359
+ * Who reported a host problem: the `{source}` of the problem texts below (empty for the editor's own problems).
1360
+ *
1361
+ * @default " from {source}"
1362
+ */
1363
+ problemSource?: string;
1364
+ /**
1365
+ * A problem at the caret, for screen readers.
1366
+ *
1367
+ * @default "{severity}{source}: {message}"
1368
+ */
1369
+ problem?: string;
1370
+ /**
1371
+ * Announced on `F8`: problem `{position}` of `{total}`.
1372
+ *
1373
+ * @default "{severity} {position} of {total}{source}: {message}"
1374
+ */
1375
+ problemPosition?: string;
1376
+ /**
1377
+ * Announced on `F8` when there are no problems.
1378
+ *
1379
+ * @default "No problems"
1380
+ */
1381
+ walkNoProblems?: string;
1382
+ /**
1383
+ * After a problem's text for screen readers: its `{code}` (from the host).
1384
+ *
1385
+ * @default " Code {code}."
1386
+ */
1387
+ problemCode?: string;
1388
+ /**
1389
+ * After a problem's text (or the hover card's docs) for screen readers: its documentation's `{url}`, and the key that opens it.
1390
+ *
1391
+ * @default " Documentation: {url} (Alt+Enter opens it)."
1392
+ */
1393
+ problemDocs?: string;
1394
+ /**
1395
+ * An underlined problem's accessible name.
1396
+ *
1397
+ * @default "{language} {severity}{source} on line {line}: {message}"
1398
+ */
1399
+ problemMarker?: string;
1400
+ /**
1401
+ * What protected text at the caret is, for screen readers: its `{label}` and `{message}`.
1402
+ *
1403
+ * @default "{label}: {message}"
1404
+ */
1405
+ protectedNote?: string;
1406
+ /**
1407
+ * The text area.
1408
+ *
1409
+ * @default "{language} source"
1410
+ */
1411
+ sourceLabel?: string;
1412
+ /**
1413
+ * The suggestions list.
1414
+ *
1415
+ * @default "{language} suggestions"
1416
+ */
1417
+ suggestionsLabel?: string;
1418
+ /**
1419
+ * The layer of underlined problems.
1420
+ *
1421
+ * @default "Inline {language} diagnostics"
1422
+ */
1423
+ problemsLabel?: string;
1424
+ /**
1425
+ * The editor's frame.
1426
+ *
1427
+ * @default "{language} editor"
1428
+ */
1429
+ editorLabel?: string;
1430
+ /**
1431
+ * Said, and shown at the caret, when typing in a read-only editor.
1432
+ *
1433
+ * @default "Cannot edit in a read-only editor"
1434
+ */
1435
+ readOnlyEditor?: string;
1436
+ /**
1437
+ * The same, for an editor the host said why it is read-only (`read_only_reason`): `{reason}`.
1438
+ *
1439
+ * @default "Cannot edit in a read-only editor: {reason}"
1440
+ */
1441
+ readOnlyEditorReason?: string;
1442
+ /**
1443
+ * Why a field is read-only when neither the schema nor the host says.
1444
+ *
1445
+ * @default "This field is read-only"
1446
+ */
1447
+ readOnlyField?: string;
1448
+ /**
1449
+ * Why text in a read-only range the host gave cannot change.
1450
+ *
1451
+ * @default "This text is read-only"
1452
+ */
1453
+ readOnlyText?: string;
1454
+ /**
1455
+ * Why renaming or moving the key above a read-only field is refused, when nothing says why the field is read-only.
1456
+ *
1457
+ * @default "Holds a read-only field"
1458
+ */
1459
+ holdsReadOnly?: string;
1460
+ /**
1461
+ * The same, for a field the schema says why is read-only (`x-readonly-reason`): `{reason}`.
1462
+ *
1463
+ * @default "Holds a read-only field: {reason}"
1464
+ */
1465
+ holdsReadOnlyReason?: string;
1466
+ /**
1467
+ * A save refused because it would change a read-only value.
1468
+ *
1469
+ * @default "{pointer} is read-only and this change would alter it"
1470
+ */
1471
+ saveRefused?: string;
1472
+ /**
1473
+ * A save waiting for the text to be valid: the language cannot say where the read-only field at `{pointer}` is written, so its value is checked only in a text that parses.
1474
+ *
1475
+ * @default "Not saved: {pointer} is read-only, and it can be checked only once the text is valid"
1476
+ */
1477
+ saveWaits?: string;
1478
+ /**
1479
+ * A save waiting because the read-only field at `{pointer}` no longer reads as the host gave it, held where the editor cannot tell why; `{reason}` is the `save_held_reason` text when the schema says why the field is read-only (`x-readonly-reason`), else empty. The texts after it name each cause a hold records, with the same placeholders.
1480
+ *
1481
+ * @default "Not saved: the read-only field {pointer} no longer reads as the host gave it{reason}; put it back as it was to save"
1482
+ */
1483
+ saveHeld?: string;
1484
+ /**
1485
+ * The same, because its key or a block holding it is written twice, and the other copy is read in its place.
1486
+ *
1487
+ * @default "Not saved: the read-only field {pointer} is written twice, and the other copy is read in its place{reason}; remove the copy to save"
1488
+ */
1489
+ saveHeldDuplicate?: string;
1490
+ /**
1491
+ * The same, because a key on its path was renamed (by an edit or an undo).
1492
+ *
1493
+ * @default "Not saved: a key holding the read-only field {pointer} was renamed{reason}; give the key its old name back to save"
1494
+ */
1495
+ saveHeldRenamed?: string;
1496
+ /**
1497
+ * The same, because its text now sits under another parent.
1498
+ *
1499
+ * @default "Not saved: the read-only field {pointer} moved under another parent{reason}; move it back to save"
1500
+ */
1501
+ saveHeldMoved?: string;
1502
+ /**
1503
+ * The same, for a list item whose place in its list now holds another item (items were added, removed or moved before it).
1504
+ *
1505
+ * @default "Not saved: the read-only field {pointer} is now another item of its list, because items were added, removed or moved before it{reason}; put the items back in order to save"
1506
+ */
1507
+ saveHeldListItem?: string;
1508
+ /**
1509
+ * The same, because its line is commented out.
1510
+ *
1511
+ * @default "Not saved: the read-only field {pointer} is commented out{reason}; remove the comment mark to save"
1512
+ */
1513
+ saveHeldCommented?: string;
1514
+ /**
1515
+ * The same, because the text no longer has it.
1516
+ *
1517
+ * @default "Not saved: the read-only field {pointer} is no longer in the text{reason}; write it back as the host gave it to save"
1518
+ */
1519
+ saveHeldRemoved?: string;
1520
+ /**
1521
+ * The same, because text was added into it or beside it (a key in its block, a line taken into its value).
1522
+ *
1523
+ * @default "Not saved: the read-only field {pointer} now reads text that was added into it or beside it{reason}; remove that text to save"
1524
+ */
1525
+ saveHeldAdded?: string;
1526
+ /**
1527
+ * The same, in a language that cannot say where the field is written: its value reads otherwise.
1528
+ *
1529
+ * @default "Not saved: the read-only field {pointer} now reads another value than the host gave{reason}; put its value back as it was to save"
1530
+ */
1531
+ saveHeldSpanless?: string;
1532
+ /**
1533
+ * The same, for a field in a read-only range the host gave: the range's text no longer reads as that field.
1534
+ *
1535
+ * @default "Not saved: the read-only text the host gave no longer reads as {pointer}{reason}; put that text back where it was to save"
1536
+ */
1537
+ saveHeldRange?: string;
1538
+ /**
1539
+ * The same, for a field the host made read-only after it was changed: the text reads it otherwise than the host's text does.
1540
+ *
1541
+ * @default "Not saved: {pointer} was changed before the host made it read-only{reason}; put it back as the host gave it to save"
1542
+ */
1543
+ saveHeldBeforeLock?: string;
1544
+ /**
1545
+ * What a `save_held…` text says of why the field is read-only, when the schema says (`x-readonly-reason`): its `{reason}`.
1546
+ *
1547
+ * @default " ({reason})"
1548
+ */
1549
+ saveHeldReason?: string;
1550
+ /**
1551
+ * A save waiting because the secret field at `{pointer}` now reads text beside a placeholder the host gave as its whole value (an edit beside it, or an undo, made the parse read them together).
1552
+ *
1553
+ * @default "Not saved: {pointer} now reads other text beside its secret placeholder; remove that text so the placeholder stands alone to save"
1554
+ */
1555
+ saveHeldPlaceholder?: string;
1556
+ /**
1557
+ * The gutter lock's label, before the reason.
1558
+ *
1559
+ * @default "Read-only"
1560
+ */
1561
+ readOnlyLabel?: string;
1562
+ /**
1563
+ * The gutter key's label, before the hint.
1564
+ *
1565
+ * @default "Secret placeholder"
1566
+ */
1567
+ secretLabel?: string;
1568
+ /**
1569
+ * The hover text of a secret placeholder, unless the host gives one.
1570
+ *
1571
+ * @default "Keeps the current secret unless you replace it"
1572
+ */
1573
+ secretHint?: string;
1574
+ /**
1575
+ * What a schema problem says instead of a secret field's value.
1576
+ *
1577
+ * @default "the secret value"
1578
+ */
1579
+ secretValue?: string;
1580
+ /**
1581
+ * What a schema problem writes in place of each secret inside a value it quotes (a list or map holding one).
1582
+ *
1583
+ * @default "…"
1584
+ */
1585
+ secretInside?: string;
1586
+ /**
1587
+ * A placeholder the host did not give, in a secret field.
1588
+ *
1589
+ * @default "{pointer}: unknown secret placeholder; it stands for no current secret, so write the new value instead"
1590
+ */
1591
+ unknownPlaceholder?: string;
1592
+ /**
1593
+ * One of the host's placeholders outside the field it stands in.
1594
+ *
1595
+ * @default "{pointer}: this placeholder stands for the secret of {owner}, not this field's; here it is plain text"
1596
+ */
1597
+ movedPlaceholder?: string;
1598
+ /**
1599
+ * One of another document's placeholders (in a documents view), `{source}` its file name.
1600
+ *
1601
+ * @default "This placeholder stands for a secret of {source}, not of this document; here it is plain text"
1602
+ */
1603
+ foreignPlaceholder?: string;
1604
+ /**
1605
+ * One of the host's placeholders written in its own field more often than the host gave it there: a copy of it.
1606
+ *
1607
+ * @default "{pointer}: this placeholder is in this field already; another copy of it is plain text"
1608
+ */
1609
+ extraPlaceholder?: string;
1610
+ /**
1611
+ * One of the host's field placeholders written in a comment.
1612
+ *
1613
+ * @default "This placeholder stands for the secret of {owner}; in a comment it is plain text"
1614
+ */
1615
+ placeholderInComment?: string;
1616
+ /**
1617
+ * A placeholder the host wrote in a comment, in a field.
1618
+ *
1619
+ * @default "{pointer}: this placeholder stands for a secret in a comment, not this field's; here it is plain text"
1620
+ */
1621
+ commentPlaceholder?: string;
1622
+ /**
1623
+ * Text written beside a placeholder the host gave as a field's whole value: the edit refused, the field flagged, a save waiting.
1624
+ *
1625
+ * @default "{pointer}: a secret placeholder stands for the whole secret, so nothing can be written beside it: replace it whole to write a new value"
1626
+ */
1627
+ gluedPlaceholder?: string;
1628
+ /**
1629
+ * The detail of the `${…}` reference suggestion.
1630
+ *
1631
+ * @default "Read the secret from an environment variable"
1632
+ */
1633
+ envReference?: string;
1634
+ /**
1635
+ * The detail of the `file:` reference suggestion.
1636
+ *
1637
+ * @default "Read the secret from a file"
1638
+ */
1639
+ fileReference?: string;
1640
+ /**
1641
+ * The detail of another reference suggestion.
1642
+ *
1643
+ * @default "A reference starting with {prefix}"
1644
+ */
1645
+ otherReference?: string;
1646
+ /**
1647
+ * The type column of a reference suggestion.
1648
+ *
1649
+ * @default "reference"
1650
+ */
1651
+ referenceType?: string;
1652
+ /**
1653
+ * The detail of the end tag XML suggests.
1654
+ *
1655
+ * @default "Closes <{name}>"
1656
+ */
1657
+ closesTag?: string;
1658
+ /**
1659
+ * Its type column.
1660
+ *
1661
+ * @default "end tag"
1662
+ */
1663
+ endTag?: string;
1664
+ /**
1665
+ * Said when Ctrl+Space finds nothing to offer, and when typing empties a list opened with Ctrl+Space or moved in; a list that opened by itself closes silently.
1666
+ *
1667
+ * @default "No suggestions"
1668
+ */
1669
+ noSuggestions?: string;
1670
+ /**
1671
+ * A key the schema does not allow (`{key}`); its object's pointer goes before it (`/web: `), as before every schema problem but at the root.
1672
+ *
1673
+ * @default "\"{key}\" is not allowed here"
1674
+ */
1675
+ keyNotAllowed?: string;
1676
+ /**
1677
+ * Text in an element the schema wants elements in (XML); the element's pointer goes before it.
1678
+ *
1679
+ * @default "text is not allowed here, only elements"
1680
+ */
1681
+ textNotAllowed?: string;
1682
+ /**
1683
+ * A deprecated key.
1684
+ *
1685
+ * @default "{pointer}: \"{key}\" is deprecated"
1686
+ */
1687
+ keyDeprecated?: string;
1688
+ /**
1689
+ * A deprecated key whose schema says what to use instead.
1690
+ *
1691
+ * @default "{pointer}: \"{key}\" is deprecated. {message}"
1692
+ */
1693
+ keyDeprecatedInstead?: string;
1694
+ /**
1695
+ * A value not among the allowed ones.
1696
+ *
1697
+ * @default "{value} is not one of {allowed}"
1698
+ */
1699
+ notOneOf?: string;
1700
+ /**
1701
+ * A value of none of the accepted types.
1702
+ *
1703
+ * @default "{value} is not of type {types}"
1704
+ */
1705
+ wrongType?: string;
1706
+ /**
1707
+ * A value out of its `format` (checked up to draft-07): `{format}` is its name, quoted.
1708
+ *
1709
+ * @default "{value} is not a valid {format}"
1710
+ */
1711
+ notFormat?: string;
1712
+ /**
1713
+ * A list with no item its `contains` schema allows.
1714
+ *
1715
+ * @default "no item of the list matches its \"contains\" schema"
1716
+ */
1717
+ noItemContained?: string;
1718
+ /**
1719
+ * A list with fewer items its `contains` schema allows than its `minContains` (`{limit}`).
1720
+ *
1721
+ * @default "fewer than {limit} items of the list match its \"contains\" schema"
1722
+ */
1723
+ tooFewContained?: string;
1724
+ /**
1725
+ * A list with more items its `contains` schema allows than its `maxContains` (`{limit}`).
1726
+ *
1727
+ * @default "more than {limit} items of the list match its \"contains\" schema"
1728
+ */
1729
+ tooManyContained?: string;
1730
+ /**
1731
+ * A list with fewer items (`{count}`) than its `minItems` (`{limit}`).
1732
+ *
1733
+ * @default "the number of items must be at least {limit}, and is {count}"
1734
+ */
1735
+ tooFewItems?: string;
1736
+ /**
1737
+ * A list with more items (`{count}`) than its `maxItems` (`{limit}`).
1738
+ *
1739
+ * @default "the number of items must be at most {limit}, and is {count}"
1740
+ */
1741
+ tooManyItems?: string;
1742
+ /**
1743
+ * An object with fewer keys (`{count}`) than its `minProperties` (`{limit}`).
1744
+ *
1745
+ * @default "the number of keys must be at least {limit}, and is {count}"
1746
+ */
1747
+ tooFewKeys?: string;
1748
+ /**
1749
+ * An object with more keys (`{count}`) than its `maxProperties` (`{limit}`).
1750
+ *
1751
+ * @default "the number of keys must be at most {limit}, and is {count}"
1752
+ */
1753
+ tooManyKeys?: string;
1754
+ /**
1755
+ * A list holding an item (`{item}`, as JSON) more than once where its `uniqueItems` wants each item different.
1756
+ *
1757
+ * @default "the list holds {item} more than once: each item must differ"
1758
+ */
1759
+ repeatedItem?: string;
1760
+ /**
1761
+ * A value its `not` schema (`{schema}`, as JSON) matches, where no plainer words below say why.
1762
+ *
1763
+ * @default "{value} is not allowed here"
1764
+ */
1765
+ mustNotMatch?: string;
1766
+ /**
1767
+ * A text matching the pattern its `not` schema refuses (`not: {pattern: …}`): the pattern (`{pattern}`), quoted as JSON.
1768
+ *
1769
+ * @default "{value} must not match the pattern {pattern}"
1770
+ */
1771
+ mustNotMatchPattern?: string;
1772
+ /**
1773
+ * A value of a type its `not` schema refuses (`not: {type: …}`): the types (`{types}`), each quoted, joined by `, `.
1774
+ *
1775
+ * @default "{value} must not be of type {types}"
1776
+ */
1777
+ mustNotBeType?: string;
1778
+ /**
1779
+ * A value its `not` schema refuses among others by name (`not: {enum: […]}` of two or more values): the refused values (`{values}`), as JSON, joined by `, `. One refused value (`not: {const: …}`) is told by `must_not_match`.
1780
+ *
1781
+ * @default "{value} is one of the values not allowed here: {values}"
1782
+ */
1783
+ mustNotBe?: string;
1784
+ /**
1785
+ * An object holding keys its `not` schema refuses one by one (`not: {anyOf: [{required: [a]}, {required: [b]}]}`): the ones it holds (`{keys}`), each quoted, joined by `, `; the object is `{value}`.
1786
+ *
1787
+ * @default "{keys} must not be set here"
1788
+ */
1789
+ mustNotHave?: string;
1790
+ /**
1791
+ * An object holding both keys its `not` schema keeps apart (`not: {required: [a, b]}`, or a key's dependent schema's `not`): the first (`{key}`) and the other (`{other}`), each quoted.
1792
+ *
1793
+ * @default "{key} can't be used together with {other}"
1794
+ */
1795
+ keysUsedTogether?: string;
1796
+ /**
1797
+ * An object holding all of three or more keys its `not` schema keeps apart (`not: {required: [a, b, c]}`): the keys (`{keys}`), each quoted, joined by `, `.
1798
+ *
1799
+ * @default "{keys} can't all be used together"
1800
+ */
1801
+ keysAllUsedTogether?: string;
1802
+ /**
1803
+ * A value that matches none of a schema's options (`{keyword}`: `oneOf` or `anyOf`), with why each fails (`{reasons}`, each worded by `option_needs`, `option_refuses` or `option_problem`, joined by `; `).
1804
+ *
1805
+ * @default "matches none of the {keyword} options: {reasons}"
1806
+ */
1807
+ noOptionMatches?: string;
1808
+ /**
1809
+ * A value that matches more than one of a `oneOf`'s options (`{options}`, their names joined by `, `).
1810
+ *
1811
+ * @default "matches more than one of the oneOf options ({options}); only one may match"
1812
+ */
1813
+ severalOptionsMatch?: string;
1814
+ /**
1815
+ * An option (`{option}`) that needs a key the value does not have.
1816
+ *
1817
+ * @default "{option} needs \"{key}\""
1818
+ */
1819
+ optionNeeds?: string;
1820
+ /**
1821
+ * An option (`{option}`) that does not allow a key the value has.
1822
+ *
1823
+ * @default "{option} does not allow \"{key}\""
1824
+ */
1825
+ optionRefuses?: string;
1826
+ /**
1827
+ * An option (`{option}`) and another problem it has with the value.
1828
+ *
1829
+ * @default "{option}: {problem}"
1830
+ */
1831
+ optionProblem?: string;
1832
+ /**
1833
+ * The name of an option with no title or description (`{number}`, from 1).
1834
+ *
1835
+ * @default "option {number}"
1836
+ */
1837
+ optionNumber?: string;
1838
+ /**
1839
+ * A schema that does not compile.
1840
+ *
1841
+ * @default "Invalid JSON Schema: {error}"
1842
+ */
1843
+ invalidSchema?: string;
1844
+ /**
1845
+ * A schema whose text is empty, or only spaces and line breaks.
1846
+ *
1847
+ * @default "Invalid JSON Schema: the schema text is empty"
1848
+ */
1849
+ emptySchema?: string;
1850
+ /**
1851
+ * A secret placeholder pattern the editor cannot use (it does not compile, or matches empty text): no token is taken for a placeholder.
1852
+ *
1853
+ * @default "secrets.placeholder: {error}"
1854
+ */
1855
+ invalidPlaceholder?: string;
1856
+ /**
1857
+ * A host's problem with a field the editor cannot find in the text, listed with the field's path.
1858
+ *
1859
+ * @default "{path}: {message}"
1860
+ */
1861
+ problemAtPath?: string;
1862
+ /**
1863
+ * A value the host's language reads back differently (Edit-as).
1864
+ *
1865
+ * @default "{pointer}: {host} cannot keep this value exactly, as it reads back differently: change it, or edit it as {host}, to save"
1866
+ */
1867
+ hostCannotKeep?: string;
1868
+ /**
1869
+ * A value the edited language cannot show exactly (Edit-as).
1870
+ *
1871
+ * @default "{pointer}: {edit} cannot show this value exactly; editing it here may change it"
1872
+ */
1873
+ editCannotShow?: string;
1874
+ /**
1875
+ * An edit the host's language cannot save (Edit-as).
1876
+ *
1877
+ * @default "Not saved as {host}: {error}"
1878
+ */
1879
+ notSaved?: string;
1880
+ /**
1881
+ * A null the host's language cannot write (Edit-as).
1882
+ *
1883
+ * @default "{host} has no null value: give it a value or remove it to save (at {pointer})"
1884
+ */
1885
+ noNull?: string;
1886
+ /**
1887
+ * An infinity or NaN the host's language has no number for (Edit-as).
1888
+ *
1889
+ * @default "{host} has no infinity or NaN: write a finite number or remove it to save (at {pointer})"
1890
+ */
1891
+ noNonFinite?: string;
1892
+ /**
1893
+ * An Edit-as switch waiting until the document converts.
1894
+ *
1895
+ * @default "Cannot switch to {edit} yet: {error}"
1896
+ */
1897
+ cannotSwitch?: string;
1898
+ /**
1899
+ * An Edit-as switch refused: the host's language or the other one cannot write documents.
1900
+ *
1901
+ * @default "Cannot edit as {edit}: {error}"
1902
+ */
1903
+ switchRefused?: string;
1904
+ /**
1905
+ * XML text beside child elements, which no other language can show (Edit-as).
1906
+ *
1907
+ * @default "{pointer}: text beside child elements cannot be shown in another language"
1908
+ */
1909
+ mixedContent?: string;
1910
+ /**
1911
+ * The tab list's accessible name, unless the host gives one.
1912
+ *
1913
+ * @default "Open files"
1914
+ */
1915
+ tabList?: string;
1916
+ /**
1917
+ * Shown in place of an editor while no document is open.
1918
+ *
1919
+ * @default "No open files"
1920
+ */
1921
+ noDocuments?: string;
1922
+ /**
1923
+ * A tab's close button.
1924
+ *
1925
+ * @default "Close {name}"
1926
+ */
1927
+ closeTab?: string;
1928
+ /**
1929
+ * Its tooltip.
1930
+ *
1931
+ * @default "Close (Delete)"
1932
+ */
1933
+ closeTabTitle?: string;
1934
+ /**
1935
+ * The "+" button after the tabs (with `on_add`): its accessible name and tooltip.
1936
+ *
1937
+ * @default "New file"
1938
+ */
1939
+ addDocument?: string;
1940
+ /**
1941
+ * The dirty dot's tooltip, and what a tab's accessible name adds for it.
1942
+ *
1943
+ * @default "unsaved changes"
1944
+ */
1945
+ unsaved?: string;
1946
+ /**
1947
+ * What a read-only document's tab adds to its accessible name.
1948
+ *
1949
+ * @default "read-only"
1950
+ */
1951
+ readOnlyTab?: string;
1952
+ /**
1953
+ * The tooltip of a read-only document's tab with a reason (`Document::read_only_reason`): its file `{name}` and the `{reason}`.
1954
+ *
1955
+ * @default "{name}\nRead-only: {reason}"
1956
+ */
1957
+ readOnlyTabTitle?: string;
1958
+ }
1959
+
1960
+ /** A token `colors` accepts: one of the theme's colors (from `ThemeColor` in the crate). */
1961
+ export type ThemeColorToken =
1962
+ | "bg"
1963
+ | "panel"
1964
+ | "border"
1965
+ | "text"
1966
+ | "muted"
1967
+ | "accent"
1968
+ | "error"
1969
+ | "warning"
1970
+ | "info"
1971
+ | "hint"
1972
+ | "toolbar-text"
1973
+ | "line-number"
1974
+ | "line-active"
1975
+ | "added"
1976
+ | "modified"
1977
+ | "removed"
1978
+ | "active-line"
1979
+ | "error-line"
1980
+ | "added-line"
1981
+ | "modified-line"
1982
+ | "selection"
1983
+ | "caret"
1984
+ | "comment"
1985
+ | "key"
1986
+ | "punctuation"
1987
+ | "string"
1988
+ | "literal"
1989
+ | "value"
1990
+ | "reference"
1991
+ | "interpolation"
1992
+ | "raised"
1993
+ | "raised-border"
1994
+ | "raised-text"
1995
+ | "raised-muted"
1996
+ | "raised-hover"
1997
+ | "completion-active"
1998
+ | "completion-key"
1999
+ | "completion-type"
2000
+ | "completion-type-active"
2001
+ | "completion-detail"
2002
+ | "completion-icon-border"
2003
+ | "completion-icon-text"
2004
+ | "completion-match-active"
2005
+ | "tooltip-text"
2006
+ | "control-bg"
2007
+ | "control-text"
2008
+ | "control-disabled-text"
2009
+ | "focus-ring"
2010
+ | "file-icon-bg"
2011
+ | "file-icon-text"
2012
+ | "status-error"
2013
+ | "status-warning"
2014
+ | "status-info"
2015
+ | "status-hint"
2016
+ | "status-changes"
2017
+ | "diff-focus-ring"
2018
+ | "diff-peek-divider"
2019
+ | "diff-removed-bg"
2020
+ | "diff-removed-text"
2021
+ | "diff-current-bg"
2022
+ | "diff-current-text"
2023
+ | "scrollbar-thumb"
2024
+ | "popup-shadow"
2025
+ | "peek-shadow"
2026
+ | "hover-shadow"
2027
+ | "search-match"
2028
+ | "search-match-current"
2029
+ | "search-match-current-border"
2030
+ | "input-bg"
2031
+ | "input-border"
2032
+ | "toggle-active"
2033
+ | "locked"
2034
+ | "secret-chip"
2035
+ | "secret-chip-border"
2036
+ | "fold-toggle"
2037
+ | "fold-chip"
2038
+ | "fold-chip-text"
2039
+ | "tab-bar"
2040
+ | "tab-bg"
2041
+ | "tab-active-bg"
2042
+ | "tab-text"
2043
+ | "tab-active-text"
2044
+ | "tab-border"
2045
+ | "tab-active-border"
2046
+ | "tab-dirty";
2047
+
2048
+ /** Color overrides: a CSS color per token, e.g. `{ bg: "#101418", key: "#7dd3fc" }`. */
2049
+ export type ThemeColorMap = Partial<Record<ThemeColorToken, string>>;
2050
+
2051
+ /** A built-in language name (from `Language::ALL` in the crate; its file extensions name it too, `"yml"`, `"tf"`) or one from `registerLanguage`. */
2052
+ export type LanguageName =
2053
+ | "yaml"
2054
+ | "json"
2055
+ | "toml"
2056
+ | "hcl"
2057
+ | "xml"
2058
+ | (string & {});
2059
+
2060
+ /** A bundled theme slug (from `EditorTheme::ALL` in the crate). See `themes()`. */
2061
+ export type ThemeName =
2062
+ | "vscode-dark"
2063
+ | "vscode-light"
2064
+ | "obsidian"
2065
+ | "obsidian-light"
2066
+ | "dracula"
2067
+ | "nord"
2068
+ | "atom-one-dark"
2069
+ | "github-light"
2070
+ | "github-dark"
2071
+ | "solarized-light"
2072
+ | "vira-inspired"
2073
+ | (string & {});
2074
+
2075
+
2076
+
2077
+ /**
2078
+ * Several documents as tabs, one editor per document, mounted into an
2079
+ * element.
2080
+ *
2081
+ * ```js
2082
+ * import { ConfigDocuments, loadConfigEditor } from "@pngwasi/config-editor";
2083
+ * await loadConfigEditor();
2084
+ * let files = [
2085
+ * { id: "main", fileName: "config.yaml", value: mainText, schema },
2086
+ * { id: "tls", fileName: "conf.d/tls.toml", value: tlsText, schema },
2087
+ * ];
2088
+ * const tabs = new ConfigDocuments(document.getElementById("files"), {
2089
+ * documents: files,
2090
+ * onChange: (id, value) => {
2091
+ * files = files.map((file) => (file.id === id ? { ...file, value } : file));
2092
+ * tabs.update({ documents: files });
2093
+ * },
2094
+ * onSave: (id, value) => upload(id, value),
2095
+ * onClose: ({ id, dirty }) => { if (!dirty || confirm("Discard changes?")) close(id); },
2096
+ * });
2097
+ * ```
2098
+ */
2099
+ export class ConfigDocuments {
2100
+ free(): void;
2101
+ /**
2102
+ * Unmounts the view and its editors. The instance cannot be used
2103
+ * afterwards.
2104
+ */
2105
+ destroy(): void;
2106
+ /**
2107
+ * Edits the document `id` as `language` (its own language to go back),
2108
+ * as a new `editAs` in the list does, and also when `language` is what
2109
+ * its `editAs` already says: a list with an unchanged `editAs` changes
2110
+ * nothing, so after an undo stepped back across the switch this asks
2111
+ * for it again. A switch the text cannot make yet waits; asking for
2112
+ * the language on screen ends one waiting. Give the document the same
2113
+ * `editAs` in your list, or the next `update({ documents })` switches
2114
+ * back. `false` when no document has that id.
2115
+ */
2116
+ editAs(id: string, language: LanguageName): boolean;
2117
+ /**
2118
+ * The editor of the document `id`: paths, folds, focus and saving for
2119
+ * that document (`null` when no document has that id). Until the
2120
+ * document has been shown once (or listed with `editAsText`), which
2121
+ * mounts its editor, its `value`,
2122
+ * `text`, `unifiedDiff`, `settings`, `isDirty` and `save` answer for
2123
+ * the document as listed and its paths, folds and `reveal` answer
2124
+ * `null` (or `false`); once the document is removed all of them do
2125
+ * (one listed again with the same id is another document).
2126
+ */
2127
+ editor(id: string): EditorView | null;
2128
+ /**
2129
+ * Focuses the active document's editor, keeping its selection.
2130
+ */
2131
+ focus(): void;
2132
+ /**
2133
+ * Whether the document `id` differs from its baseline.
2134
+ */
2135
+ isDirty(id: string): boolean;
2136
+ /**
2137
+ * Mounts the view into `element` (its content is replaced).
2138
+ */
2139
+ constructor(element: HTMLElement, options: DocumentsOptions);
2140
+ /**
2141
+ * Replaces the text of the document `id` with `value`, the host's own
2142
+ * whatever it is: with `echoes`, a document's `value` in
2143
+ * `update({ documents })` that its editor gave and has not seen come
2144
+ * back yet is its echo; this never is (a revert to such a text). List
2145
+ * the document with that text from then on. Its editor keeps the
2146
+ * caret on the same text when possible, and its read-only ranges on
2147
+ * the text they cover (see `host_locks`); `onChange` does not hear it.
2148
+ * Returns whether it replaced the text: `false` when no document has
2149
+ * that id, when the document holds that text already (a second
2150
+ * Discard: nothing changes, and a framework binding reports nothing),
2151
+ * or when the host gave it a newer one meanwhile.
2152
+ */
2153
+ replaceValue(id: string, value: string): boolean;
2154
+ /**
2155
+ * Saves every document with unsaved edits through `onSave`; returns
2156
+ * the ids sent.
2157
+ */
2158
+ saveAll(): string[];
2159
+ /**
2160
+ * Saves the document `id` as `Ctrl+S` in its editor does: calls
2161
+ * `onSave`. `false` when nothing was sent (no `onSave`, no such
2162
+ * document, or an `editAs` edit that cannot convert back yet).
2163
+ */
2164
+ save(id: string): boolean;
2165
+ /**
2166
+ * Shows the document `id` and focuses its editor; `false` when no
2167
+ * document has that id.
2168
+ */
2169
+ select(id: string): boolean;
2170
+ /**
2171
+ * Changes the view, live: `documents`, `activeId`, the settings and
2172
+ * the callbacks, any of them. A key left out or `undefined` stays as
2173
+ * it is; `null` removes a callback or returns a setting to its default.
2174
+ * Settings merge key by key (`strings` text by text, `colors` token by
2175
+ * token), under each
2176
+ * document's own `settings`. A new `documents` list replaces the list:
2177
+ * a document keeps its editor (caret, undo history, scroll, folds)
2178
+ * while its `id` stays listed, its text, baseline, file name and
2179
+ * read-only state update in place, and a new `language` or `schema`
2180
+ * mounts a new editor. With `echoes`, a document's `value` that its
2181
+ * editor gave and has not seen listed back yet is its echo and keeps
2182
+ * what the editor holds (see `replaceValue`). `activeId` shows that document, leaving the
2183
+ * focus where it is (an id not listed throws). `className`, `label` and `echoes`, and an `onClose` or
2184
+ * `onAdd` for a view mounted without one (its tabs have no close
2185
+ * buttons, its strip no "+"), throw: create a new view instead (the value the
2186
+ * view was built with, given again, changes nothing; one left out was built with its default:
2187
+ * `null`, `echoes: false`, `className: ""`). Every key is checked before any applies,
2188
+ * but for a document's `readOnlyRanges` that cannot be read in its text: they hold no
2189
+ * other document back, the list applies, and this throws naming them after.
2190
+ */
2191
+ update(options: DocumentsUpdate): void;
2192
+ /**
2193
+ * The active document's id (`undefined` while none is open).
2194
+ */
2195
+ readonly activeId: string | undefined;
2196
+ /**
2197
+ * The view's settings in effect: every key of `EditorSettings`, set.
2198
+ */
2199
+ readonly settings: Required<EditorSettings>;
2200
+ }
2201
+
2202
+ /**
2203
+ * A config editor mounted into an element.
2204
+ *
2205
+ * ```js
2206
+ * import { ConfigEditor, loadConfigEditor } from "@pngwasi/config-editor";
2207
+ * await loadConfigEditor();
2208
+ * const editor = new ConfigEditor(document.getElementById("config"), {
2209
+ * language: "yaml",
2210
+ * value: "listen: 7835\n",
2211
+ * schema: schemaJson,
2212
+ * onChange: (text) => save(text),
2213
+ * });
2214
+ * ```
2215
+ */
2216
+ export class ConfigEditor {
2217
+ free(): void;
2218
+ /**
2219
+ * Unmounts the editor. The instance cannot be used afterwards. An edit
2220
+ * still waiting to be saved (while editing as another language) is sent
2221
+ * to `onChange` first.
2222
+ */
2223
+ destroy(): void;
2224
+ /**
2225
+ * Focuses the editor, keeping its selection.
2226
+ */
2227
+ focus(): void;
2228
+ /**
2229
+ * Folds every block (`Ctrl+K Ctrl+0`).
2230
+ */
2231
+ foldAll(): void;
2232
+ /**
2233
+ * Folds the block the field at `path` opens; `false` when there is none
2234
+ * to fold.
2235
+ */
2236
+ fold(path: FieldPath): boolean;
2237
+ /**
2238
+ * Mounts an editor into `element` (its content is replaced).
2239
+ */
2240
+ constructor(element: HTMLElement, options: EditorOptions);
2241
+ /**
2242
+ * The path of what the text on screen holds at string index `offset`.
2243
+ */
2244
+ pathAt(offset: number): EditorPath | null;
2245
+ /**
2246
+ * Where the field at `path` is written in the text on screen, or `null`.
2247
+ */
2248
+ rangeOf(path: FieldPath): EditorRange | null;
2249
+ /**
2250
+ * Replaces the document with `value`, the host's own text whatever it
2251
+ * is: with `echoes`, `update({ value })` takes a text `onChange` gave
2252
+ * that has not come back yet for its echo; this never does (a revert to
2253
+ * such a text). Echoes still on their way are skipped when they come.
2254
+ * The caret stays on the same text when possible, and the read-only
2255
+ * ranges on the text they cover (see `host_locks`); `onChange` does
2256
+ * not hear it. Returns whether it replaced the document: `false` when
2257
+ * it is that text already (a second Discard: nothing changes, and a
2258
+ * framework binding reports nothing), or the host gave a newer one
2259
+ * meanwhile.
2260
+ */
2261
+ replaceValue(value: string): boolean;
2262
+ /**
2263
+ * Selects `range` (string indices `{ start, end }` into the text on
2264
+ * screen, as `rangeOf` gives them: in the `editAs` language while
2265
+ * editing as another one), scrolls it into view inside the editor and
2266
+ * focuses the editor without moving the page, as `reveal` does for a
2267
+ * field: any stretch, comments and blank lines included. A range past
2268
+ * the end is clamped to it. `false` before the editor mounts and for an
2269
+ * empty document.
2270
+ */
2271
+ revealRange(range: { start: number; end: number }): boolean;
2272
+ /**
2273
+ * Scrolls to the field at `path`, selects it and focuses the editor;
2274
+ * `false` when the document has no such field.
2275
+ */
2276
+ reveal(path: FieldPath): boolean;
2277
+ /**
2278
+ * Saves as `Ctrl+S` does: calls `onSave` with the document in
2279
+ * `language`. `false` when nothing was sent: without `onSave`, after
2280
+ * `destroy`, or while an `editAs` edit cannot convert back (the caret
2281
+ * goes to the problem).
2282
+ */
2283
+ save(): boolean;
2284
+ /**
2285
+ * Opens every fold (`Ctrl+K Ctrl+J`).
2286
+ */
2287
+ unfoldAll(): void;
2288
+ /**
2289
+ * Opens the folds around the field at `path`; `false` when none was
2290
+ * closed.
2291
+ */
2292
+ unfold(path: FieldPath): boolean;
2293
+ /**
2294
+ * The unified diff (`diff -u`) of the baseline against the document,
2295
+ * with `context` unchanged lines around each change (default 3); empty
2296
+ * when they are the same.
2297
+ */
2298
+ unifiedDiff(context?: number): string;
2299
+ /**
2300
+ * Changes what the editor shows, live (the caret, undo history and
2301
+ * folds stay): the constructor's options, any of them. A key left out
2302
+ * or `undefined` stays as it is; `null` removes a callback, clears
2303
+ * `hostDiagnostics`, `readOnlyPaths` and `readOnlyRanges`, turns
2304
+ * `editAs` and `readOnly` off and returns a setting to its default.
2305
+ * Settings merge key by key, `strings` text by text, `colors` token by
2306
+ * token. A new `value`
2307
+ * replaces the document as a host update (the caret kept when the
2308
+ * text is unchanged). With `echoes`, a text `onChange` gave that has
2309
+ * not come back yet is its echo and keeps the document. Ranges are in
2310
+ * `rangesFor`, else `value` (an echo included), else the document,
2311
+ * and are moved from that text to the document; `readOnlyRanges` equal
2312
+ * to the last ones, given with no new text, stay where the editor
2313
+ * moved them (see `host_locks`). The text `onChange` gave last, given
2314
+ * while an edit still held is sent first, keeps the document.
2315
+ * `language`, `schema`, `fileName`, `className`,
2316
+ * `secrets` and `echoes` are what the editor is built from: they throw (create
2317
+ * a new editor instead), but for the value it was built with given again
2318
+ * (`Object.is`; `language` naming the editor's own; an option left out
2319
+ * was built with its default: `null`, `echoes: false`, …).
2320
+ * Every key is checked before any applies.
2321
+ */
2322
+ update(options: EditorUpdate): void;
2323
+ /**
2324
+ * The editor's channel to its host, for an editor that replaces this
2325
+ * one (its `channel` option): still there after `destroy`.
2326
+ */
2327
+ readonly channel: HostChannel;
2328
+ /**
2329
+ * The path of what the caret is on.
2330
+ */
2331
+ readonly currentPath: EditorPath | null;
2332
+ /**
2333
+ * The folded blocks, as one-based `{ startLine, endLine }`: the line
2334
+ * that stays visible and the last hidden one.
2335
+ */
2336
+ readonly foldedLines: LineRange[];
2337
+ /**
2338
+ * Whether the document differs from the baseline.
2339
+ */
2340
+ readonly isDirty: boolean;
2341
+ /**
2342
+ * The settings in effect: every key of `EditorSettings`, set.
2343
+ */
2344
+ readonly settings: Required<EditorSettings>;
2345
+ /**
2346
+ * The text on screen: in the `editAs` language while editing as another
2347
+ * one (what `rangeOf` and `pathAt` index into). After `destroy()`, the
2348
+ * last document.
2349
+ */
2350
+ readonly text: string;
2351
+ /**
2352
+ * The document, in `language`.
2353
+ */
2354
+ readonly value: string;
2355
+ }
2356
+
2357
+ /**
2358
+ * An editor's channel to its host: the texts `onChange` sent that the
2359
+ * host has not handed back yet, and the host's read-only ranges as given.
2360
+ * A framework binding re-creating its editor (a new `language`,
2361
+ * `fileName`, …) passes the old editor's `channel` to the new one, so the
2362
+ * echoes still on their way are told apart there too, and none rolls
2363
+ * back what was typed.
2364
+ */
2365
+ export class HostChannel {
2366
+ private constructor();
2367
+ free(): void;
2368
+ }
2369
+
2370
+ /**
2371
+ * How `current` differs from `baseline`, by lines, as the diff gutter and
2372
+ * `onChangeSummary` count it (line endings ignored). A final line break
2373
+ * added or removed is the empty last line added or removed, where
2374
+ * `unifiedDiff` writes it as `diff -u` does (the last line changed).
2375
+ */
2376
+ export function changeSummary(baseline: string, current: string): ChangeSummary;
2377
+
2378
+ /**
2379
+ * Converts `text` from one language to another. With a schema, lone XML
2380
+ * elements where it expects a list convert as one-item lists.
2381
+ */
2382
+ export function convert(from: LanguageName, text: string, to: LanguageName, schema?: string): Conversion;
2383
+
2384
+ /**
2385
+ * The language of a file, from its extension (`"config/app.yml"` →
2386
+ * `"yaml"`), registered languages included; `null` when none claims it.
2387
+ */
2388
+ export function languageForFile(path: string): LanguageName | null;
2389
+
2390
+ /**
2391
+ * The built-in and registered languages, each with its canonical name
2392
+ * (what `language` and `editAs` take), label, toolbar icon, extensions and
2393
+ * the file name the toolbar shows when none is given.
2394
+ */
2395
+ export function languages(): LanguageInfo[];
2396
+
2397
+ /**
2398
+ * Parses `text` into plain data (objects, arrays, strings, numbers,
2399
+ * booleans, `null`): the model schema validation sees, the same for every
2400
+ * language. Throws the first syntax error, with its line and column.
2401
+ */
2402
+ export function parse(language: LanguageName, text: string): unknown;
2403
+
2404
+ /**
2405
+ * The path of what `text` holds at string index `index` (in `text`, a
2406
+ * byte order mark counted): the key under or
2407
+ * just before it, else the value or container holding it (`""` at the top
2408
+ * level); `null` past the end of the text.
2409
+ */
2410
+ export function pathAt(language: LanguageName, text: string, index: number): EditorPath | null;
2411
+
2412
+ /**
2413
+ * The stylesheet the editor injects (layout and every bundled theme), for
2414
+ * a page that sets `styled: false` and serves or adapts it itself.
2415
+ */
2416
+ export function presetCss(): string;
2417
+
2418
+ /**
2419
+ * Where the field at `path` is written in `text`, or `null` when it has no
2420
+ * such field: the key and its value when they share a line, the key alone
2421
+ * when the value is a block below it, the value alone for a list item.
2422
+ */
2423
+ export function rangeOf(language: LanguageName, text: string, path: FieldPath): EditorRange | null;
2424
+
2425
+ /**
2426
+ * [`rangeOf`](range_of) for each of `paths`, in order: the text read once
2427
+ * for all of them (each `rangeOf` reads it again, so thousands of paths
2428
+ * of a long document take seconds one by one).
2429
+ */
2430
+ export function rangesOf(language: LanguageName, text: string, paths: FieldPath[]): (EditorRange | null)[];
2431
+
2432
+ /**
2433
+ * Registers a language implemented in JavaScript and returns its name for
2434
+ * `language` / `editAs` (its label, lowercased). Registering the same label
2435
+ * again replaces its definition, in the editors already open too, and
2436
+ * takes no more memory.
2437
+ */
2438
+ export function registerLanguage(definition: CustomLanguage): string;
2439
+
2440
+ /**
2441
+ * What the editor cannot use in a JSON Schema, one message each, such as a
2442
+ * `patternProperties` regex its engine cannot compile. An invalid schema
2443
+ * throws.
2444
+ */
2445
+ export function schemaWarnings(schema: string): string[];
2446
+
2447
+ /**
2448
+ * Writes plain data as a document in `language`. Throws when the value is
2449
+ * not JSON data or the language cannot express it (TOML has no `null`).
2450
+ * As `JSON.stringify` does, an object member set to `undefined` is left
2451
+ * out, and an `undefined` or a hole in an array throws.
2452
+ */
2453
+ export function serialize(language: LanguageName, value: unknown): string;
2454
+
2455
+ /**
2456
+ * The bundled themes, for a picker: each one's slug (what `theme` takes),
2457
+ * display name, and whether it is dark.
2458
+ */
2459
+ export function themes(): ThemeInfo[];
2460
+
2461
+ /**
2462
+ * The unified diff (`diff -u`) of `baseline` against `current`, with
2463
+ * `context` unchanged lines around each change (default 3): `--- baseline`
2464
+ * and `+++ current` headers, then `@@` hunks. Empty when they are the same.
2465
+ */
2466
+ export function unifiedDiff(baseline: string, current: string, context?: number): string;
2467
+
2468
+ /**
2469
+ * Syntax and schema problems in `text`, as the editor shows them. Without a
2470
+ * schema only syntax is checked.
2471
+ */
2472
+ export function validate(language: LanguageName, text: string, schema?: string): Diagnostic[];
2473
+
2474
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
2475
+
2476
+ export interface InitOutput {
2477
+ readonly memory: WebAssembly.Memory;
2478
+ }
2479
+
2480
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
2481
+
2482
+ /**
2483
+ * Instantiates the given `module`, which can either be bytes or
2484
+ * a precompiled `WebAssembly.Module`.
2485
+ *
2486
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
2487
+ *
2488
+ * @returns {InitOutput}
2489
+ */
2490
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
2491
+
2492
+ /**
2493
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
2494
+ * for everything else, calls `WebAssembly.instantiate` directly.
2495
+ *
2496
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
2497
+ *
2498
+ * @returns {Promise<InitOutput>}
2499
+ */
2500
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;