@vestra-player/sdk 1.7.1 → 1.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +6 -9
- package/bin/vestra-plugin.mjs +4 -4
- package/dist/api-requests.d.ts +8 -8
- package/dist/api-requests.js +8 -8
- package/dist/capability-check.d.ts +15 -15
- package/dist/capability-check.js +4 -4
- package/dist/capability-rules.d.ts +4 -5
- package/dist/capability-rules.js +4 -5
- package/dist/commands.d.ts +34 -44
- package/dist/commands.js +21 -27
- package/dist/docs-tree.json.gz +0 -0
- package/dist/docs.d.ts +1 -1
- package/dist/docs.js +13 -3
- package/dist/i18n-tools.js +1 -1
- package/dist/i18n.js +1 -1
- package/dist/media.d.ts +7 -7
- package/dist/palettes.d.ts +5 -5
- package/dist/palettes.js +5 -5
- package/dist/plugin/appearance.js +1 -1
- package/dist/plugin/bindings.d.ts +2 -3
- package/dist/plugin/bindings.js +2 -3
- package/dist/plugin/commands.js +10 -11
- package/dist/plugin/connection.d.ts +18 -19
- package/dist/plugin/connection.js +23 -24
- package/dist/plugin/index.d.ts +5 -5
- package/dist/plugin/index.js +1 -1
- package/dist/plugin/osd.d.ts +1 -1
- package/dist/plugin/osd.js +1 -1
- package/dist/plugin/passes.d.ts +4 -4
- package/dist/plugin/passes.js +4 -4
- package/dist/plugin/patch.d.ts +8 -8
- package/dist/plugin/patch.js +12 -12
- package/dist/plugin/player/events.js +5 -5
- package/dist/plugin/resolvers.js +3 -3
- package/dist/plugin/scope.d.ts +4 -4
- package/dist/plugin/scope.js +4 -4
- package/dist/plugin/services.d.ts +2 -3
- package/dist/plugin/services.js +2 -3
- package/dist/plugin/shaders.js +5 -6
- package/dist/plugin/state.js +10 -10
- package/dist/plugin/testing/commands.d.ts +4 -5
- package/dist/plugin/testing/commands.js +4 -5
- package/dist/plugin/testing/i18n.d.ts +1 -1
- package/dist/plugin/testing/i18n.js +1 -1
- package/dist/plugin/testing/index.d.ts +147 -165
- package/dist/plugin/testing/index.js +141 -155
- package/dist/plugin/testing/internals.d.ts +9 -2
- package/dist/plugin/testing/internals.js +9 -2
- package/dist/plugin/testing/layout.d.ts +46 -3
- package/dist/plugin/testing/layout.js +102 -7
- package/dist/plugin/testing/services.js +10 -2
- package/dist/plugin/testing/slint-types.d.ts +75 -0
- package/dist/plugin/testing/slint-types.js +974 -0
- package/dist/plugin/timeline.d.ts +1 -1
- package/dist/plugin/timeline.js +2 -2
- package/dist/plugin/types/base.d.ts +90 -111
- package/dist/plugin/types/commands.d.ts +142 -174
- package/dist/plugin/types/packages.d.ts +48 -63
- package/dist/plugin/types/playback.d.ts +45 -59
- package/dist/plugin/types/plugin-wire.d.ts +38 -45
- package/dist/plugin/types/processing.d.ts +52 -65
- package/dist/plugin/types/services.d.ts +18 -25
- package/dist/plugin/types/snapshots.d.ts +34 -46
- package/dist/plugin/types/sources.d.ts +14 -16
- package/dist/plugin/types/subtitles.d.ts +7 -8
- package/dist/plugin/types/ui-content.d.ts +111 -116
- package/dist/plugin/types/ui-layout.d.ts +52 -63
- package/dist/plugin/types/ui-locale.d.ts +41 -45
- package/dist/plugin/types/ui-shell.d.ts +69 -87
- package/dist/plugin/values.d.ts +15 -18
- package/dist/plugin/values.js +16 -19
- package/dist/plugin/view/base.d.ts +2 -2
- package/dist/plugin/view/base.js +7 -8
- package/dist/plugin/view/layout.d.ts +2 -2
- package/dist/plugin/view/panel.js +2 -4
- package/dist/plugin/view/writer.d.ts +8 -8
- package/dist/plugin/view/writer.js +37 -39
- package/dist/plugin/when.d.ts +3 -3
- package/dist/plugin/wire-facade.js +6 -7
- package/dist/processing.d.ts +26 -30
- package/dist/processing.js +4 -4
- package/dist/source-resolvers.d.ts +2 -2
- package/dist/source.d.ts +1 -2
- package/dist/subtitles.d.ts +1 -1
- package/dist/ts-plugin.d.ts +5 -5
- package/dist/wire.d.ts +63 -70
- package/dist/wire.js +21 -25
- package/llms.txt +7 -10
- package/package.json +1 -1
- package/slint/vestra/bar-buttons.slint +6 -8
- package/slint/vestra/focus.slint +1 -1
- package/slint/vestra/widgets.slint +2 -4
|
@@ -3,15 +3,13 @@ import type { FileResolverOptions, WebResolverOptions } from "./sources.ts";
|
|
|
3
3
|
import type { ConfirmOptions, Dialogs, Osd, OsdPanel } from "./ui-shell.ts";
|
|
4
4
|
import type { Disposable } from "./base.ts";
|
|
5
5
|
/**
|
|
6
|
-
* The player's palettes: `vestra`, the dark default, and `vestra-light
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* The player's palettes: `vestra`, the dark default, and `vestra-light`, a
|
|
7
|
+
* light palette whose video area stays dark. Both draw on the logo's colours.
|
|
8
|
+
* Read colours from `Theme` instead of branching on the id: a later version may
|
|
9
|
+
* add palettes.
|
|
10
10
|
*
|
|
11
11
|
* @remarks
|
|
12
|
-
* The player treats an id it does not have as `vestra
|
|
13
|
-
* older SDK that still ask for a palette removed in SDK 1.4.0 keep working,
|
|
14
|
-
* and a player older than 0.4.0 answers `vestra-light` with `vestra`.
|
|
12
|
+
* The player treats an id it does not have as `vestra`.
|
|
15
13
|
*
|
|
16
14
|
* @since 1.0.0
|
|
17
15
|
* @category UI
|
|
@@ -52,7 +50,7 @@ export type ThemeId = "vestra" | "vestra-light";
|
|
|
52
50
|
* });
|
|
53
51
|
* ```
|
|
54
52
|
*
|
|
55
|
-
* @see [
|
|
53
|
+
* @see [Theme](../../../docs/reference/theme.md)
|
|
56
54
|
* @since 1.0.0
|
|
57
55
|
* @category UI
|
|
58
56
|
*/
|
|
@@ -68,15 +66,14 @@ export interface Appearance {
|
|
|
68
66
|
*
|
|
69
67
|
* @remarks
|
|
70
68
|
* Needs `events`: without it the listener never runs for other plugins'
|
|
71
|
-
* changes. Views need no help to follow the palette; use this for things
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* say which of the two changed.
|
|
69
|
+
* changes. Views need no help to follow the palette; use this for things the
|
|
70
|
+
* plugin draws itself (a rendered image, colours it computes). Errors go to
|
|
71
|
+
* {@link Scope.onError}. When the player starts a stopped plugin for a
|
|
72
|
+
* palette change, {@link Appearance.theme} already has the new palette at
|
|
73
|
+
* start and the listener still hears the change. A
|
|
74
|
+
* language change does not call it, except in one case: a plugin started for
|
|
75
|
+
* a language change alone may hear the unchanged palette once, since the
|
|
76
|
+
* player's event does not say which of the two changed.
|
|
80
77
|
*
|
|
81
78
|
* @capability events
|
|
82
79
|
*
|
|
@@ -196,12 +193,11 @@ export type Locale = "en" | "zh-Hans" | "ja" | "ko" | "de" | "fr" | "es";
|
|
|
196
193
|
*/
|
|
197
194
|
export type LanguagePreference = "system" | Locale;
|
|
198
195
|
/**
|
|
199
|
-
* Arguments of a template sentence ({@link Osd.show},
|
|
200
|
-
* {@link
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
* {@link TextList} argument (SDK 1.5.11, player 0.4.3) is translated too,
|
|
196
|
+
* Arguments of a template sentence ({@link Osd.show}, {@link OsdPanel.set},
|
|
197
|
+
* {@link ConfirmOptions.args}, {@link I18n.text}): an array for `{}` and `{0}`,
|
|
198
|
+
* `{1}` placeholders, or an object for `{name}` placeholders. At most 16.
|
|
199
|
+
* Strings and finite numbers are data, shown as they are (whole numbers without
|
|
200
|
+
* a fraction); a {@link Text} or {@link TextList} argument is translated too,
|
|
205
201
|
* so a sentence can be built from translated parts.
|
|
206
202
|
*
|
|
207
203
|
* @since 1.5.9
|
|
@@ -215,12 +211,12 @@ export type TemplateArgs = readonly TextArg[] | Readonly<Record<string, TextArg>
|
|
|
215
211
|
*
|
|
216
212
|
* @remarks
|
|
217
213
|
* Accepted wherever the player shows a plugin's text: command titles, path
|
|
218
|
-
* segments and reasons, {@link Osd.show} and {@link OsdPanel.set} (as the
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
214
|
+
* segments and reasons, {@link Osd.show} and {@link OsdPanel.set} (as the text
|
|
215
|
+
* or an argument), the texts of {@link Dialogs.confirm}, file dialog titles and
|
|
216
|
+
* `saveFile`'s `fileName`, and property values where Slint expects a `string`
|
|
217
|
+
* (at any depth: a `[string]` model, a struct field). Nested in another text's
|
|
218
|
+
* arguments it is translated too. Limits: `TEXT_LIMITS` in
|
|
219
|
+
* `@vestra-player/sdk/testing`.
|
|
224
220
|
*
|
|
225
221
|
* The wire form `{ $vestraText, args }` is what the player reads; write it
|
|
226
222
|
* with {@link I18n.text}, so that `vestra-plugin i18n extract` finds the
|
|
@@ -300,16 +296,16 @@ export type TextValue = string | Text | TextList;
|
|
|
300
296
|
* its arguments (`osd.show("Speed {}×", [rate])`), never a sentence
|
|
301
297
|
* composed in TypeScript.
|
|
302
298
|
*
|
|
303
|
-
* Where words and data cannot be separated that way (a menu item with a
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
299
|
+
* Where words and data cannot be separated that way (a menu item with a number,
|
|
300
|
+
* a `[string]` model, a sentence made of translated parts), the plugin passes a
|
|
301
|
+
* text value ({@link I18n.text}, {@link I18n.list}): data the player
|
|
302
|
+
* translates, never a translated string.
|
|
307
303
|
*
|
|
308
304
|
* The language is fixed when the player starts: {@link I18n.locale} never
|
|
309
305
|
* changes during a run. Read it for what is not text, such as the order of
|
|
310
306
|
* names or a date format. `vestra-plugin i18n extract` collects the texts
|
|
311
307
|
* into `locales/messages.pot`; see the
|
|
312
|
-
* [i18n guide](../../../docs/
|
|
308
|
+
* [i18n guide](../../../docs/guides/i18n.md).
|
|
313
309
|
*
|
|
314
310
|
* @capability None.
|
|
315
311
|
*
|
|
@@ -406,23 +402,23 @@ export interface I18n {
|
|
|
406
402
|
list(items: readonly TextArg[], style?: ListStyle): TextList;
|
|
407
403
|
/**
|
|
408
404
|
* An `Error` whose words the player shows translated: throw it where the
|
|
409
|
-
* player shows a plugin's failure to the user, such as from a
|
|
410
|
-
*
|
|
411
|
-
* fails while it starts). The
|
|
412
|
-
* plugin's catalog (as
|
|
413
|
-
* `
|
|
414
|
-
* Elsewhere it is an ordinary `Error`.
|
|
405
|
+
* player shows a plugin's failure to the user, such as from a file or web
|
|
406
|
+
* resolver's `resolve` ({@link FileResolverOptions},
|
|
407
|
+
* {@link WebResolverOptions}) (also when a stream fails while it starts). The
|
|
408
|
+
* player shows `text` translated with this plugin's catalog (as
|
|
409
|
+
* `player.state.error` and the failure message); `message` is the English
|
|
410
|
+
* rendering, for logs. Elsewhere it is an ordinary `Error`.
|
|
415
411
|
*
|
|
416
412
|
* @param source - English source text, as {@link I18n.text}'s.
|
|
417
413
|
* @param args - Values for its placeholders.
|
|
418
414
|
* @throws `invalid` A malformed or over-limit value.
|
|
419
415
|
*
|
|
420
416
|
* @example Fail an open with a message the user can read
|
|
421
|
-
* Opening a `.ch8` file the plugin cannot load shows "The program file
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
417
|
+
* Opening a `.ch8` file the plugin cannot load shows "The program file was
|
|
418
|
+
* not found." in the user's language. The player shows the message of an
|
|
419
|
+
* error thrown from `resolve`; `i18n.error` makes an `Error` whose text the
|
|
420
|
+
* player translates with this plugin's catalog, while its `message` stays
|
|
421
|
+
* English for logs.
|
|
426
422
|
* ```ts
|
|
427
423
|
* import { readFile } from "node:fs/promises";
|
|
428
424
|
* declare function startEmulator(program: Uint8Array): ResolvedStream;
|
|
@@ -98,7 +98,7 @@ export type SettingsCategory = "general" | "playback" | "subtitles" | "video" |
|
|
|
98
98
|
* }
|
|
99
99
|
* ```
|
|
100
100
|
*
|
|
101
|
-
* @see {@link Settings.page}, [
|
|
101
|
+
* @see {@link Settings.page}, [Add settings and translations](../../../docs/guides/i18n.md)
|
|
102
102
|
* @since 1.0.0
|
|
103
103
|
* @category UI
|
|
104
104
|
*/
|
|
@@ -159,7 +159,7 @@ export type SettingsPage = View & Disposable & {
|
|
|
159
159
|
* page.on("resumeToggled", (on: boolean) => store.save({ ...store.value, resume: on }));
|
|
160
160
|
* ```
|
|
161
161
|
*
|
|
162
|
-
* @see {@link SettingsPage}, [
|
|
162
|
+
* @see {@link SettingsPage}, [Add settings and translations](../../../docs/guides/i18n.md)
|
|
163
163
|
* @since 1.0.0
|
|
164
164
|
* @category UI
|
|
165
165
|
*/
|
|
@@ -332,14 +332,14 @@ export interface BackdropSlot {
|
|
|
332
332
|
* or the sidebar moves to or from its floating window, while the global is
|
|
333
333
|
* one stable address.
|
|
334
334
|
*
|
|
335
|
-
* A plugin mounts at most one panel per slot
|
|
336
|
-
*
|
|
337
|
-
* `"
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
*
|
|
335
|
+
* A plugin mounts at most one panel per slot: a
|
|
336
|
+
* playback plugin can have its control bar in `"bottom"` and its controls in
|
|
337
|
+
* `"adjust"`. Each {@link Panel} has its own bridge, state, `toggle()` and
|
|
338
|
+
* `setInteraction()`; disposing one leaves the others, and stopping the plugin
|
|
339
|
+
* unmounts them all. The bottom bar and the backdrop hold one panel for all
|
|
340
|
+
* plugins; the sidebar and the adjust column one tab per plugin.
|
|
341
|
+
* {@link Panels.bottom}, {@link Panels.sidebar} and {@link Panels.adjust}
|
|
342
|
+
* describe the positions, whoever mounted there.
|
|
343
343
|
*
|
|
344
344
|
* @capability ui.mount
|
|
345
345
|
*
|
|
@@ -356,7 +356,7 @@ export interface BackdropSlot {
|
|
|
356
356
|
*
|
|
357
357
|
* {@includeCode ../../../examples/panel-menu/ui/panel.slint}
|
|
358
358
|
*
|
|
359
|
-
* @see {@link Panel}, {@link PanelSlot}, [
|
|
359
|
+
* @see {@link Panel}, {@link PanelSlot}, [Example: Adjust panel](../../../docs/examples/adjust-panel.md), [Example: Panel menu](../../../docs/examples/panel-menu.md)
|
|
360
360
|
* @since 1.0.0
|
|
361
361
|
* @category UI
|
|
362
362
|
*/
|
|
@@ -377,28 +377,23 @@ export interface Panels {
|
|
|
377
377
|
* {@link Panel.setInteraction} locks keep it).
|
|
378
378
|
* - `"sidebar"`: right of the video, the window's full height, as wide as the
|
|
379
379
|
* user drags it (at least 317). The user can detach it into a floating
|
|
380
|
-
* window titled `title`. Several plugins may mount here (
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
-
*
|
|
387
|
-
* it to `true` while it draws the strip, so a panel with a tab strip of
|
|
388
|
-
* its own can hide it. Panel coordinates (drops) start below the strip.
|
|
380
|
+
* window titled `title`. Several plugins may mount here: each panel is a tab, labelled `title` (else the plugin's name),
|
|
381
|
+
* and the player draws a 31px tab strip above the current one while there
|
|
382
|
+
* are two or more (with one panel, nothing changes). Showing, hiding and
|
|
383
|
+
* detaching apply to the whole sidebar. If the bridge global declares
|
|
384
|
+
* `in property <bool> tabbed`, the player sets it to `true` while it draws
|
|
385
|
+
* the strip, so a panel with a tab strip of its own can hide it. Panel
|
|
386
|
+
* coordinates (drops) start below the strip.
|
|
389
387
|
* - `"backdrop"`: the whole video area, under the OSD, while there is no
|
|
390
388
|
* video picture (see {@link Panels.backdrop}). One plugin at a time (as
|
|
391
389
|
* for the bottom bar, another one's mount rejects with `conflict`); it
|
|
392
390
|
* takes no pointer or keyboard input. While it is mounted, the player does
|
|
393
391
|
* not show the cover art of audio files itself (from the next file
|
|
394
392
|
* opened on), so the plugin can draw it.
|
|
395
|
-
* - `"adjust"
|
|
396
|
-
*
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
* `title` (else the plugin's name). Declare `minPlayerVersion: "0.7.6"`:
|
|
400
|
-
* older players refuse the slot (`invalid`, "unknown mount slot"), and a
|
|
401
|
-
* mount refused during `activate` fails the activation.
|
|
393
|
+
* - `"adjust"`: **controls that change what is playing**: the picture, the
|
|
394
|
+
* sound, the subtitles, the speed (the player's own Picture, Audio,
|
|
395
|
+
* Subtitles and Playback panels, a colour grading tool). Several plugins
|
|
396
|
+
* may mount here, one tab each, labelled `title` (else the plugin's name).
|
|
402
397
|
*
|
|
403
398
|
* **Choosing between `"sidebar"` and `"adjust"`.** The slot says what the
|
|
404
399
|
* panel is for; the player decides how it looks and may change that at any
|
|
@@ -437,13 +432,11 @@ export interface Panels {
|
|
|
437
432
|
* @returns A {@link Panel} owned by this scope; await {@link Panel.ready}
|
|
438
433
|
* for the result.
|
|
439
434
|
*
|
|
440
|
-
* @throws `Error` without a code (throws) This plugin already has a panel
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
*
|
|
444
|
-
*
|
|
445
|
-
* does not name one. A file that cannot be read throws Node's file system
|
|
446
|
-
* error (`code` `ENOENT` and so on).
|
|
435
|
+
* @throws `Error` without a code (throws) This plugin already has a panel in
|
|
436
|
+
* this slot (a panel in another slot is fine), or the file
|
|
437
|
+
* exports no component or global, or several and `options` does not name one.
|
|
438
|
+
* A file that cannot be read throws Node's file system error (`code` `ENOENT`
|
|
439
|
+
* and so on).
|
|
447
440
|
* @throws The errors of {@link Panel.ready} (rejects `ready`) The player
|
|
448
441
|
* refused the mount.
|
|
449
442
|
*
|
|
@@ -481,21 +474,16 @@ export interface Panels {
|
|
|
481
474
|
/** The sidebar position, including its floating state; any plugin may read and toggle it. */
|
|
482
475
|
readonly sidebar: SidebarSlot;
|
|
483
476
|
/**
|
|
484
|
-
* The adjust column
|
|
485
|
-
*
|
|
486
|
-
*
|
|
487
|
-
* detaches.
|
|
477
|
+
* The adjust column, whoever mounted there; any plugin may read and toggle
|
|
478
|
+
* it. The same shape as {@link Panels.sidebar} without floating: the adjust
|
|
479
|
+
* column never detaches.
|
|
488
480
|
*
|
|
489
481
|
* @remarks
|
|
490
|
-
* `state` is `null` while no plugin has a panel there.
|
|
491
|
-
*
|
|
492
|
-
*
|
|
493
|
-
*
|
|
494
|
-
*
|
|
495
|
-
* "userHidden"`) until the user opens it. To open the column at your own
|
|
496
|
-
* panel, call {@link Panel.show} (or {@link Panel.toggle}, which closes it
|
|
497
|
-
* again when your tab is already the current one, the behaviour of the
|
|
498
|
-
* player's own `Alt+1…4`).
|
|
482
|
+
* `state` is `null` while no plugin has a panel there. The column starts
|
|
483
|
+
* hidden (`preferred: false`, `reason: "userHidden"`) until the user opens
|
|
484
|
+
* it. To open the column at your own panel, call {@link Panel.show} (or
|
|
485
|
+
* {@link Panel.toggle}, which closes it again when your tab is already the
|
|
486
|
+
* current one, the behaviour of the player's own `Alt+1…4`).
|
|
499
487
|
*
|
|
500
488
|
* @example Open the adjust column at this plugin's tab with a key
|
|
501
489
|
* One command opens the column at the plugin's tab, and pressing it again
|
|
@@ -520,8 +508,7 @@ export interface Panels {
|
|
|
520
508
|
* });
|
|
521
509
|
* ```
|
|
522
510
|
*
|
|
523
|
-
* @player 0.7.6
|
|
524
|
-
* have no `adjust`: reading its `state` throws a `TypeError`).
|
|
511
|
+
* @player 0.7.6
|
|
525
512
|
* @since 1.6.11
|
|
526
513
|
*/
|
|
527
514
|
readonly adjust: PanelSlot;
|
|
@@ -556,13 +543,12 @@ export interface ConfirmOptions {
|
|
|
556
543
|
/** A checkbox under the text, such as "Don't ask again"; 1–40 characters. */
|
|
557
544
|
checkbox?: TextValue;
|
|
558
545
|
/**
|
|
559
|
-
* Values for the placeholders of `message` and `detail
|
|
560
|
-
*
|
|
561
|
-
*
|
|
562
|
-
*
|
|
563
|
-
*
|
|
564
|
-
*
|
|
565
|
-
* text.
|
|
546
|
+
* Values for the placeholders of `message` and `detail`. Any of the texts may
|
|
547
|
+
* instead be a {@link Text}, which carries its own arguments; `args` only
|
|
548
|
+
* fills the string ones. Every text of the dialog is English source text that
|
|
549
|
+
* the player shows translated from the plugin's catalog; `message` and
|
|
550
|
+
* `detail` are templates like {@link Osd.show}'s. The length limits apply to
|
|
551
|
+
* the shown text.
|
|
566
552
|
*
|
|
567
553
|
* @since 1.5.9
|
|
568
554
|
*/
|
|
@@ -614,7 +600,7 @@ export interface ConfirmOptions {
|
|
|
614
600
|
* }
|
|
615
601
|
* ```
|
|
616
602
|
*
|
|
617
|
-
* @see [
|
|
603
|
+
* @see [Platforms](../../../docs/reference/platforms.md)
|
|
618
604
|
* @since 1.0.0
|
|
619
605
|
* @category UI
|
|
620
606
|
*/
|
|
@@ -792,10 +778,9 @@ export interface Dialogs {
|
|
|
792
778
|
/** The dialog's title (English source text or a {@link Text}), at most 256 bytes. */
|
|
793
779
|
title?: TextValue;
|
|
794
780
|
/**
|
|
795
|
-
* The proposed file name: a plain name, at most 256 bytes. A string is
|
|
796
|
-
*
|
|
797
|
-
*
|
|
798
|
-
* becomes `-`).
|
|
781
|
+
* The proposed file name: a plain name, at most 256 bytes. A string is data
|
|
782
|
+
* (not translated); a {@link Text} is shown translated,
|
|
783
|
+
* `text("Playlist.m3u8")` (a `/` or `\\` in a translation becomes `-`).
|
|
799
784
|
*/
|
|
800
785
|
fileName?: TextValue;
|
|
801
786
|
}): Promise<string | null>;
|
|
@@ -845,9 +830,8 @@ export interface OsdPanel extends Disposable {
|
|
|
845
830
|
* @param text - The text, with `\n` between lines: at most 32 lines and
|
|
846
831
|
* 4096 bytes once translated and formatted. `null` hides the block. A
|
|
847
832
|
* template, like {@link Osd.show}'s.
|
|
848
|
-
* @param args - Values for its placeholders
|
|
849
|
-
*
|
|
850
|
-
* @param options - `maxColumns`: cut long lines (SDK 1.5.11).
|
|
833
|
+
* @param args - Values for its placeholders; `null` or omitted for none.
|
|
834
|
+
* @param options - `maxColumns`: cut long lines.
|
|
851
835
|
*
|
|
852
836
|
* @example Show two loop points, then hide the block
|
|
853
837
|
* The block shows "A: 12.0 s" and "B: 18.5 s" on two lines, then
|
|
@@ -873,9 +857,8 @@ export interface OsdPanelOptions {
|
|
|
873
857
|
/**
|
|
874
858
|
* Cut every line longer than this many columns, after translation and
|
|
875
859
|
* formatting, ending it with `…`: a wide character (Chinese, Japanese,
|
|
876
|
-
* Korean, full-width forms) is two columns, a combining mark none, any
|
|
877
|
-
*
|
|
878
|
-
* whole lines). Measure the video area to choose it.
|
|
860
|
+
* Korean, full-width forms) is two columns, a combining mark none, any other
|
|
861
|
+
* one. An integer from 8 to 1000. Measure the video area to choose it.
|
|
879
862
|
*/
|
|
880
863
|
maxColumns?: number;
|
|
881
864
|
}
|
|
@@ -923,7 +906,7 @@ export interface OsdPanelOptions {
|
|
|
923
906
|
* say("Blur on");
|
|
924
907
|
* ```
|
|
925
908
|
*
|
|
926
|
-
* @see {@link OsdPanel}, [
|
|
909
|
+
* @see {@link OsdPanel}, [Limits: on-screen display](../../../docs/reference/limits.md#on-screen-display)
|
|
927
910
|
* @since 1.0.0
|
|
928
911
|
* @category UI
|
|
929
912
|
*/
|
|
@@ -935,27 +918,26 @@ export interface Osd {
|
|
|
935
918
|
* Replaces the message on screen, whichever plugin showed it. A message
|
|
936
919
|
* that is on screen when the plugin stops still disappears on time.
|
|
937
920
|
*
|
|
938
|
-
* The text is a template in English: the player shows its translation
|
|
939
|
-
*
|
|
940
|
-
*
|
|
941
|
-
*
|
|
942
|
-
*
|
|
943
|
-
*
|
|
944
|
-
*
|
|
945
|
-
*
|
|
946
|
-
*
|
|
921
|
+
* The text is a template in English: the player shows its translation from
|
|
922
|
+
* the plugin's catalog, with the placeholders (`{}`, `{0}`, `{name}`; `{{`
|
|
923
|
+
* and `}}` for braces) filled from `args`. Without `args` the text shows as
|
|
924
|
+
* it is (braces included). Untranslated, the English template is formatted.
|
|
925
|
+
* Never compose the sentence in TypeScript (`` `Speed ${rate}×` ``):
|
|
926
|
+
* translators can only translate whole templates. An argument that is itself
|
|
927
|
+
* words is a {@link Text}, and a message made of a varying number of parts is
|
|
928
|
+
* a {@link TextList} of texts; `text` may also be a `Text` (then without
|
|
929
|
+
* `args`).
|
|
947
930
|
*
|
|
948
931
|
* @capability ui.osd
|
|
949
932
|
*
|
|
950
|
-
* @param text - The template, 1–200 characters once translated and
|
|
951
|
-
*
|
|
952
|
-
*
|
|
953
|
-
*
|
|
954
|
-
* ({@link OsdShowOptions}). Older players show the message without them.
|
|
933
|
+
* @param text - The template, 1–200 characters once translated and formatted;
|
|
934
|
+
* line breaks become spaces. With `options.actions` the message ends in up to
|
|
935
|
+
* two buttons, each running one of the plugin's own commands
|
|
936
|
+
* ({@link OsdShowOptions}).
|
|
955
937
|
*
|
|
956
|
-
* @param args - Values for its placeholders
|
|
957
|
-
*
|
|
958
|
-
* @param options - Action buttons after the text
|
|
938
|
+
* @param args - Values for its placeholders. Pass `null` with a `Text` and
|
|
939
|
+
* options.
|
|
940
|
+
* @param options - Action buttons after the text.
|
|
959
941
|
* @returns Resolves once the message is on screen.
|
|
960
942
|
*
|
|
961
943
|
* @throws `invalid` (rejects) The shown text is empty, only white space,
|
|
@@ -1024,7 +1006,7 @@ export interface Osd {
|
|
|
1024
1006
|
panel(): OsdPanel;
|
|
1025
1007
|
}
|
|
1026
1008
|
/**
|
|
1027
|
-
* One button at the end of an OSD message ({@link Osd.show}
|
|
1009
|
+
* One button at the end of an OSD message ({@link Osd.show}).
|
|
1028
1010
|
*
|
|
1029
1011
|
* @since 1.6.9
|
|
1030
1012
|
* @category UI
|
|
@@ -1047,7 +1029,7 @@ export interface OsdAction {
|
|
|
1047
1029
|
command: string;
|
|
1048
1030
|
}
|
|
1049
1031
|
/**
|
|
1050
|
-
* Options of {@link Osd.show}
|
|
1032
|
+
* Options of {@link Osd.show}.
|
|
1051
1033
|
*
|
|
1052
1034
|
* @remarks
|
|
1053
1035
|
* A message with actions stays about 4 seconds instead of 2, and does not
|
package/dist/plugin/values.d.ts
CHANGED
|
@@ -12,17 +12,15 @@ import type { Json } from "../wire.ts";
|
|
|
12
12
|
* makes `Window.show` reject; a panel or settings page opens without it and
|
|
13
13
|
* the failure goes to the plugin's `onError`.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* thread. Before player 0.6.0 the limits were 4,096 rows, 16,384 values and
|
|
22
|
-
* 1 MiB of text, so a long list had to be sent as a window of rows.
|
|
15
|
+
* They allow a whole list: a plugin binds all of its rows (a playlist of 50,000
|
|
16
|
+
* entries fits) and the view draws them with a Slint `ListView`, which builds
|
|
17
|
+
* only the rows on screen. The SDK sends a changed array as row patches, and an
|
|
18
|
+
* array larger than one request (about 512 KiB of rows) as its first rows
|
|
19
|
+
* followed by `insert` patches of the rest; the player converts large writes
|
|
20
|
+
* off its interface thread.
|
|
23
21
|
*
|
|
24
|
-
* In a row, `null` where the view declares an `image` shows no picture
|
|
25
|
-
*
|
|
22
|
+
* In a row, `null` where the view declares an `image` shows no picture: rows
|
|
23
|
+
* without a thumbnail need no placeholder image.
|
|
26
24
|
*
|
|
27
25
|
* @example Bind a whole list
|
|
28
26
|
* The view draws every row with a `ListView`; the SDK sends what changed.
|
|
@@ -42,25 +40,24 @@ export declare const UI_VALUE_LIMITS: {
|
|
|
42
40
|
/** Nesting depth; the value itself is depth 0 (8). */
|
|
43
41
|
readonly depth: 8;
|
|
44
42
|
/**
|
|
45
|
-
* Values in all, counting every array, object, string, number, boolean
|
|
46
|
-
*
|
|
47
|
-
* (1,048,576; 16,384 before player 0.6.0).
|
|
43
|
+
* Values in all, counting every array, object, string, number, boolean and
|
|
44
|
+
* null, the value itself included; a Markdown document is one (1,048,576).
|
|
48
45
|
*/
|
|
49
46
|
readonly values: number;
|
|
50
|
-
/** Rows of one array (100,000
|
|
47
|
+
/** Rows of one array (100,000). */
|
|
51
48
|
readonly arrayRows: 100000;
|
|
52
49
|
/** UTF-8 bytes of one string or object field name (64 KiB). */
|
|
53
50
|
readonly stringBytes: number;
|
|
54
51
|
/**
|
|
55
52
|
* UTF-8 bytes of all strings and field names together, the text of the
|
|
56
|
-
* value's Markdown documents included (32 MiB
|
|
53
|
+
* value's Markdown documents included (32 MiB).
|
|
57
54
|
*/
|
|
58
55
|
readonly textBytes: number;
|
|
59
56
|
};
|
|
60
57
|
/**
|
|
61
58
|
* The player's runtime image limits (`src/host/src/ui/ui_image.rs`): a file's
|
|
62
|
-
* bytes and sides, the decoded pixels each plugin caches, and
|
|
63
|
-
*
|
|
59
|
+
* bytes and sides, the decoded pixels each plugin caches, and the decoded
|
|
60
|
+
* pixels the nested images of one view may show.
|
|
64
61
|
*
|
|
65
62
|
* @since 1.5.19
|
|
66
63
|
* @category Testing
|
|
@@ -72,7 +69,7 @@ export declare const IMAGE_LIMITS: Readonly<{
|
|
|
72
69
|
side: 4096;
|
|
73
70
|
/** The decoded pixel bytes the player caches for each plugin's images. */
|
|
74
71
|
pluginBytes: number;
|
|
75
|
-
/** The decoded pixel bytes the nested images of one view may show
|
|
72
|
+
/** The decoded pixel bytes the nested images of one view may show. */
|
|
76
73
|
viewBytes: number;
|
|
77
74
|
}>;
|
|
78
75
|
/**
|
package/dist/plugin/values.js
CHANGED
|
@@ -10,17 +10,15 @@
|
|
|
10
10
|
* makes `Window.show` reject; a panel or settings page opens without it and
|
|
11
11
|
* the failure goes to the plugin's `onError`.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* thread. Before player 0.6.0 the limits were 4,096 rows, 16,384 values and
|
|
20
|
-
* 1 MiB of text, so a long list had to be sent as a window of rows.
|
|
13
|
+
* They allow a whole list: a plugin binds all of its rows (a playlist of 50,000
|
|
14
|
+
* entries fits) and the view draws them with a Slint `ListView`, which builds
|
|
15
|
+
* only the rows on screen. The SDK sends a changed array as row patches, and an
|
|
16
|
+
* array larger than one request (about 512 KiB of rows) as its first rows
|
|
17
|
+
* followed by `insert` patches of the rest; the player converts large writes
|
|
18
|
+
* off its interface thread.
|
|
21
19
|
*
|
|
22
|
-
* In a row, `null` where the view declares an `image` shows no picture
|
|
23
|
-
*
|
|
20
|
+
* In a row, `null` where the view declares an `image` shows no picture: rows
|
|
21
|
+
* without a thumbnail need no placeholder image.
|
|
24
22
|
*
|
|
25
23
|
* @example Bind a whole list
|
|
26
24
|
* The view draws every row with a `ListView`; the SDK sends what changed.
|
|
@@ -40,18 +38,17 @@ export const UI_VALUE_LIMITS = {
|
|
|
40
38
|
/** Nesting depth; the value itself is depth 0 (8). */
|
|
41
39
|
depth: 8,
|
|
42
40
|
/**
|
|
43
|
-
* Values in all, counting every array, object, string, number, boolean
|
|
44
|
-
*
|
|
45
|
-
* (1,048,576; 16,384 before player 0.6.0).
|
|
41
|
+
* Values in all, counting every array, object, string, number, boolean and
|
|
42
|
+
* null, the value itself included; a Markdown document is one (1,048,576).
|
|
46
43
|
*/
|
|
47
44
|
values: 1024 * 1024,
|
|
48
|
-
/** Rows of one array (100,000
|
|
45
|
+
/** Rows of one array (100,000). */
|
|
49
46
|
arrayRows: 100_000,
|
|
50
47
|
/** UTF-8 bytes of one string or object field name (64 KiB). */
|
|
51
48
|
stringBytes: 64 * 1024,
|
|
52
49
|
/**
|
|
53
50
|
* UTF-8 bytes of all strings and field names together, the text of the
|
|
54
|
-
* value's Markdown documents included (32 MiB
|
|
51
|
+
* value's Markdown documents included (32 MiB).
|
|
55
52
|
*/
|
|
56
53
|
textBytes: 32 * 1024 * 1024,
|
|
57
54
|
};
|
|
@@ -67,8 +64,8 @@ function documentText(value) {
|
|
|
67
64
|
}
|
|
68
65
|
/**
|
|
69
66
|
* The player's runtime image limits (`src/host/src/ui/ui_image.rs`): a file's
|
|
70
|
-
* bytes and sides, the decoded pixels each plugin caches, and
|
|
71
|
-
*
|
|
67
|
+
* bytes and sides, the decoded pixels each plugin caches, and the decoded
|
|
68
|
+
* pixels the nested images of one view may show.
|
|
72
69
|
*
|
|
73
70
|
* @since 1.5.19
|
|
74
71
|
* @category Testing
|
|
@@ -80,7 +77,7 @@ export const IMAGE_LIMITS = Object.freeze({
|
|
|
80
77
|
side: 4096,
|
|
81
78
|
/** The decoded pixel bytes the player caches for each plugin's images. */
|
|
82
79
|
pluginBytes: 64 * 1024 * 1024,
|
|
83
|
-
/** The decoded pixel bytes the nested images of one view may show
|
|
80
|
+
/** The decoded pixel bytes the nested images of one view may show. */
|
|
84
81
|
viewBytes: 32 * 1024 * 1024,
|
|
85
82
|
});
|
|
86
83
|
/**
|
|
@@ -108,7 +105,7 @@ export function valueLimitProblem(value) {
|
|
|
108
105
|
if (budget.values === L.values)
|
|
109
106
|
return `UI value exceeds ${L.values} total nodes`;
|
|
110
107
|
budget.values += 1;
|
|
111
|
-
// An image (nested
|
|
108
|
+
// An image (also nested) is one value, like a document.
|
|
112
109
|
if (isObject(value) && "$vestraImage" in value)
|
|
113
110
|
return null;
|
|
114
111
|
const doc = documentText(value);
|
|
@@ -18,8 +18,8 @@ export declare abstract class ViewBase implements View {
|
|
|
18
18
|
set(props: Props): void;
|
|
19
19
|
bind(props: () => Props): import("../types.ts").Disposable;
|
|
20
20
|
/**
|
|
21
|
-
* `plugin.wire.view(v)
|
|
22
|
-
*
|
|
21
|
+
* `plugin.wire.view(v)`: the writer's direct writes, for a scope of the
|
|
22
|
+
* plugin that made this view.
|
|
23
23
|
*/
|
|
24
24
|
[DIRECT](scope: ScopeImpl): DirectWrites;
|
|
25
25
|
/** {@link ViewBinder.snapshot}: current desired properties. */
|
package/dist/plugin/view/base.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `ViewBase`: what windows, panels and settings pages share — callbacks, and
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* keeps no row-patch bases for it.
|
|
2
|
+
* `ViewBase`: what windows, panels and settings pages share — callbacks, and a
|
|
3
|
+
* {@link ViewWriter} (L1) with a {@link ViewBinder} (L2) over it. A view joins
|
|
4
|
+
* the update passes on its first `bind()` (doc/specs/sdk-refactor.md §4 Step 2
|
|
5
|
+
* in the player repository); until then `set()` goes straight to the writer,
|
|
6
|
+
* which sends whole values and keeps no row-patch bases for it.
|
|
8
7
|
*/
|
|
9
8
|
import { readFileSync } from "node:fs";
|
|
10
9
|
import { resolve } from "node:path";
|
|
@@ -59,8 +58,8 @@ export class ViewBase {
|
|
|
59
58
|
return this.#binder.bind(props);
|
|
60
59
|
}
|
|
61
60
|
/**
|
|
62
|
-
* `plugin.wire.view(v)
|
|
63
|
-
*
|
|
61
|
+
* `plugin.wire.view(v)`: the writer's direct writes, for a scope of the
|
|
62
|
+
* plugin that made this view.
|
|
64
63
|
*/
|
|
65
64
|
[DIRECT](scope) {
|
|
66
65
|
if (scope.runtime !== this.scope.runtime)
|
|
@@ -6,9 +6,9 @@ export type LayoutName = "bottom" | "sidebar" | "adjust";
|
|
|
6
6
|
export type Layout = {
|
|
7
7
|
bottom: SlotState | null;
|
|
8
8
|
sidebar: SlotState | null;
|
|
9
|
-
/**
|
|
9
|
+
/** The adjust column. */
|
|
10
10
|
adjust: SlotState | null;
|
|
11
|
-
/** `PanelSlot.panels
|
|
11
|
+
/** `PanelSlot.panels`. */
|
|
12
12
|
tabs: {
|
|
13
13
|
bottom: readonly SlotPanel[] | null;
|
|
14
14
|
sidebar: readonly SlotPanel[] | null;
|