@vestra-player/sdk 1.7.20 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +72 -0
- package/README.md +2 -2
- package/bin/vestra-plugin.mjs +139 -100
- package/capability-scan.json +369 -0
- package/dist/api-requests.d.ts +11 -36
- package/dist/api-requests.js +22 -47
- package/dist/capability-scan.d.ts +95 -0
- package/dist/capability-scan.js +249 -0
- package/dist/commands.d.ts +35 -0
- package/dist/commands.js +42 -1
- package/dist/docs-tree.json.gz +0 -0
- package/dist/docs.d.ts +1 -1
- package/dist/docs.js +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/manifest.d.ts +5 -0
- package/dist/manifest.js +9 -24
- package/dist/member-uses.d.ts +61 -0
- package/dist/member-uses.js +160 -0
- package/dist/mpv.d.ts +139 -0
- package/dist/mpv.js +496 -0
- package/dist/player-runtime.d.ts +3 -3
- package/dist/player-runtime.js +3 -3
- package/dist/plugin/appearance.d.ts +1 -1
- package/dist/plugin/appearance.js +2 -2
- package/dist/plugin/bindings.d.ts +1 -1
- package/dist/plugin/bindings.js +2 -2
- package/dist/plugin/commands.js +6 -14
- package/dist/plugin/connection.d.ts +26 -7
- package/dist/plugin/connection.js +68 -36
- package/dist/plugin/drops.js +1 -1
- package/dist/plugin/index.js +9 -15
- package/dist/plugin/media.js +0 -12
- package/dist/plugin/mpv.d.ts +3 -0
- package/dist/plugin/mpv.js +91 -0
- package/dist/plugin/packages.js +1 -2
- package/dist/plugin/player/events.d.ts +4 -3
- package/dist/plugin/player/events.js +7 -6
- package/dist/plugin/player.d.ts +21 -13
- package/dist/plugin/player.js +56 -21
- package/dist/plugin/scope.d.ts +1 -0
- package/dist/plugin/scope.js +2 -0
- package/dist/plugin/services.d.ts +4 -4
- package/dist/plugin/services.js +7 -29
- package/dist/plugin/settings.js +1 -1
- package/dist/plugin/shaders.js +0 -2
- package/dist/plugin/stream.d.ts +2 -1
- package/dist/plugin/stream.js +2 -2
- package/dist/plugin/testing/commands.d.ts +3 -10
- package/dist/plugin/testing/commands.js +43 -24
- package/dist/plugin/testing/index.d.ts +75 -114
- package/dist/plugin/testing/index.js +83 -102
- package/dist/plugin/testing/mpv.d.ts +7 -0
- package/dist/plugin/testing/mpv.js +90 -0
- package/dist/plugin/testing/processing.js +1 -1
- package/dist/plugin/testing/services.js +0 -1
- package/dist/plugin/timeline.d.ts +2 -3
- package/dist/plugin/timeline.js +4 -8
- package/dist/plugin/types/base.d.ts +49 -88
- package/dist/plugin/types/commands.d.ts +44 -77
- package/dist/plugin/types/packages.d.ts +17 -55
- package/dist/plugin/types/playback.d.ts +302 -135
- package/dist/plugin/types/plugin-wire.d.ts +6 -36
- package/dist/plugin/types/processing.d.ts +10 -49
- package/dist/plugin/types/services.d.ts +11 -70
- package/dist/plugin/types/snapshots.d.ts +7 -60
- package/dist/plugin/types/sources.d.ts +2 -11
- package/dist/plugin/types/subtitles.d.ts +5 -26
- package/dist/plugin/types/ui-content.d.ts +1 -16
- package/dist/plugin/types/ui-layout.d.ts +53 -79
- package/dist/plugin/types/ui-locale.d.ts +5 -23
- package/dist/plugin/types/ui-shell.d.ts +13 -59
- package/dist/plugin/view/layout.js +1 -1
- package/dist/plugin/view.js +0 -2
- package/dist/plugin/window.d.ts +1 -1
- package/dist/plugin/window.js +1 -1
- package/dist/plugin/wire-facade.js +1 -2
- package/dist/processing.d.ts +2 -3
- package/dist/protocol.d.ts +14 -0
- package/dist/protocol.js +14 -0
- package/dist/request-queue.js +1 -1
- package/dist/subtitles.d.ts +1 -1
- package/dist/ts-plugin.d.ts +8 -15
- package/dist/ts-plugin.js +3 -141
- package/dist/wire.d.ts +22 -12
- package/dist/wire.js +17 -8
- package/llms.txt +5 -5
- package/package.json +4 -3
- package/slint/vestra/widgets.slint +12 -4
- package/dist/capabilities.d.ts +0 -107
- package/dist/capabilities.js +0 -69
- package/dist/capability-check.d.ts +0 -133
- package/dist/capability-check.js +0 -371
- package/dist/capability-rules.d.ts +0 -125
- package/dist/capability-rules.js +0 -192
- package/dist/host-capabilities.d.ts +0 -10
- package/dist/host-capabilities.js +0 -477
|
@@ -69,8 +69,6 @@ export type Bindable<T> = T | (() => T);
|
|
|
69
69
|
* keeps working; one that reads `plugin.player.state` or another service's
|
|
70
70
|
* state keeps the plugin running so the SDK can evaluate it.
|
|
71
71
|
*
|
|
72
|
-
* @capability commands
|
|
73
|
-
*
|
|
74
72
|
* @example Enable an item while a frame can be saved
|
|
75
73
|
* "Save Snapshot" is greyed out with its reason unless a media file is
|
|
76
74
|
* open at a frame the player can capture. The condition is sent with the
|
|
@@ -105,7 +103,6 @@ export interface Condition {
|
|
|
105
103
|
* const playingFullscreen = when.playing.and(when.fullscreen);
|
|
106
104
|
* ```
|
|
107
105
|
*
|
|
108
|
-
* @capability None (the command it is given to needs `commands`).
|
|
109
106
|
* @since 1.5.40
|
|
110
107
|
*/
|
|
111
108
|
and(...others: Condition[]): Condition;
|
|
@@ -120,7 +117,6 @@ export interface Condition {
|
|
|
120
117
|
* const active = when.playing.or(when.paused);
|
|
121
118
|
* ```
|
|
122
119
|
*
|
|
123
|
-
* @capability None (the command it is given to needs `commands`).
|
|
124
120
|
* @since 1.5.40
|
|
125
121
|
*/
|
|
126
122
|
or(...others: Condition[]): Condition;
|
|
@@ -136,7 +132,6 @@ export interface Condition {
|
|
|
136
132
|
* const windowed = when.fullscreen.not();
|
|
137
133
|
* ```
|
|
138
134
|
*
|
|
139
|
-
* @capability None (the command it is given to needs `commands`).
|
|
140
135
|
* @since 1.5.40
|
|
141
136
|
*/
|
|
142
137
|
not(): Condition;
|
|
@@ -159,8 +154,6 @@ export interface Condition {
|
|
|
159
154
|
* window, a track list) stays a function or a value set with
|
|
160
155
|
* {@link Command.set}.
|
|
161
156
|
*
|
|
162
|
-
* @capability commands
|
|
163
|
-
*
|
|
164
157
|
* @example Check a palette item and follow the palette
|
|
165
158
|
* The Appearance submenu has one radio item per palette; the player
|
|
166
159
|
* checks the one in use, also after another plugin or the user changed
|
|
@@ -207,7 +200,6 @@ export interface When {
|
|
|
207
200
|
* const hasFrame = when.phase("ready", "ended");
|
|
208
201
|
* ```
|
|
209
202
|
*
|
|
210
|
-
* @capability None (the command it is given to needs `commands`).
|
|
211
203
|
* @since 1.5.40
|
|
212
204
|
*/
|
|
213
205
|
phase(...phases: PlayerState["phase"][]): Condition;
|
|
@@ -224,7 +216,6 @@ export interface When {
|
|
|
224
216
|
* const seekable = when.can("seek");
|
|
225
217
|
* ```
|
|
226
218
|
*
|
|
227
|
-
* @capability None (the command it is given to needs `commands`).
|
|
228
219
|
* @since 1.5.40
|
|
229
220
|
*/
|
|
230
221
|
can(control: keyof PlayerState["can"]): Condition;
|
|
@@ -241,7 +232,6 @@ export interface When {
|
|
|
241
232
|
* const light = when.theme("vestra-light");
|
|
242
233
|
* ```
|
|
243
234
|
*
|
|
244
|
-
* @capability None (the command it is given to needs `commands`).
|
|
245
235
|
* @since 1.5.40
|
|
246
236
|
*/
|
|
247
237
|
theme(theme: ThemeId): Condition;
|
|
@@ -259,7 +249,6 @@ export interface When {
|
|
|
259
249
|
* const followSystem = when.language("system");
|
|
260
250
|
* ```
|
|
261
251
|
*
|
|
262
|
-
* @capability None (the command it is given to needs `commands`).
|
|
263
252
|
* @since 1.5.40
|
|
264
253
|
*/
|
|
265
254
|
language(language: LanguagePreference): Condition;
|
|
@@ -621,8 +610,6 @@ export interface CommandOptions {
|
|
|
621
610
|
* again. Disposing it, its scope or stopping the plugin removes the menu
|
|
622
611
|
* item, its keys and its bar button.
|
|
623
612
|
*
|
|
624
|
-
* @capability commands
|
|
625
|
-
*
|
|
626
613
|
* @example Enable an item only while a file is open
|
|
627
614
|
* Video ▸ Export… is greyed out until a file is open. `set` replaces the
|
|
628
615
|
* `enabled` field with a function; the SDK evaluates it again after every
|
|
@@ -681,7 +668,6 @@ export interface Command extends Disposable {
|
|
|
681
668
|
* });
|
|
682
669
|
* ```
|
|
683
670
|
*
|
|
684
|
-
* @capability commands
|
|
685
671
|
* @since 1.0.0
|
|
686
672
|
*/
|
|
687
673
|
set(state: Partial<{
|
|
@@ -701,7 +687,7 @@ export interface Command extends Disposable {
|
|
|
701
687
|
* activation completes, so a listener added anywhere in `activate` hears it.
|
|
702
688
|
* `startPlugin` stays strict: there a refusal during activation fails it, so
|
|
703
689
|
* tests show the bad declaration. Any other failure during activation
|
|
704
|
-
* (
|
|
690
|
+
* (no answer, for example) fails activation.
|
|
705
691
|
*
|
|
706
692
|
* Only the player's answer is skipped. What {@link Commands.add} checks
|
|
707
693
|
* itself still throws from `add` (an unknown `@` menu id, more than 8
|
|
@@ -711,7 +697,6 @@ export interface Command extends Disposable {
|
|
|
711
697
|
*
|
|
712
698
|
* @throws `conflict` (rejects) Another command already has this menu path,
|
|
713
699
|
* or the path would be both a menu item and a submenu.
|
|
714
|
-
* @throws `capability` (rejects) The manifest does not declare `commands`.
|
|
715
700
|
* @throws `invalid` (rejects) The player refused the declaration.
|
|
716
701
|
* @throws `limit` (rejects) More than 160 commands in this plugin, or 1024 in
|
|
717
702
|
* the player.
|
|
@@ -733,8 +718,6 @@ export interface Command extends Disposable {
|
|
|
733
718
|
* command; `startPlugin` fails on it). What `add` checks itself throws from
|
|
734
719
|
* `add`.
|
|
735
720
|
*
|
|
736
|
-
* @capability commands
|
|
737
|
-
*
|
|
738
721
|
* @example Add a menu item with a default key
|
|
739
722
|
* Tools ▸ Say hello, or Ctrl+H, shows a greeting. `add` declares the item;
|
|
740
723
|
* the player calls `run` when the user picks it or presses its key, and the
|
|
@@ -789,7 +772,6 @@ export interface Commands {
|
|
|
789
772
|
* });
|
|
790
773
|
* ```
|
|
791
774
|
*
|
|
792
|
-
* @capability commands
|
|
793
775
|
* @since 1.0.0
|
|
794
776
|
*/
|
|
795
777
|
add(options: CommandOptions): Command;
|
|
@@ -822,9 +804,7 @@ export interface Commands {
|
|
|
822
804
|
* {@link "@vestra-player/sdk/testing"!BUILTIN_COMMANDS | BUILTIN_COMMANDS}
|
|
823
805
|
* rows owned by `host`), for a panel that shows the player's keys beside its
|
|
824
806
|
* own controls; an id the plugin has not added (or another plugin's) reads
|
|
825
|
-
* `[]`.
|
|
826
|
-
* binding table, every plugin's, is {@link Bindings.list}). Without the
|
|
827
|
-
* `commands` capability every command reads `[]`.
|
|
807
|
+
* `[]`. The whole binding table, every plugin's, is {@link Bindings.list}.
|
|
828
808
|
*
|
|
829
809
|
* @example Show a slider's keys beside it
|
|
830
810
|
* The Brightness row shows its two keys, W and E by default, as key caps
|
|
@@ -842,7 +822,6 @@ export interface Commands {
|
|
|
842
822
|
* }));
|
|
843
823
|
* ```
|
|
844
824
|
*
|
|
845
|
-
* @capability commands
|
|
846
825
|
* @player 0.7.6
|
|
847
826
|
* @since 1.6.6
|
|
848
827
|
*/
|
|
@@ -868,14 +847,12 @@ export interface Commands {
|
|
|
868
847
|
* const row = commands.find((each) => each.id === "vestra.subtitles/tuning");
|
|
869
848
|
* if (row?.keys[0]) await plugin.osd.show("Press {}", [row.keys[0]]);
|
|
870
849
|
* } catch (error) {
|
|
871
|
-
* // `capability`: not a built-in plugin
|
|
850
|
+
* // `capability`: not a built-in plugin.
|
|
872
851
|
* if ((error as PluginError).code !== "capability") throw error;
|
|
873
852
|
* }
|
|
874
853
|
* ```
|
|
875
854
|
*
|
|
876
|
-
* @capability
|
|
877
|
-
* @throws `capability` (rejects) The manifest does not declare
|
|
878
|
-
* `commands.run`, or the plugin is not built into the player.
|
|
855
|
+
* @throws `capability` (rejects) The plugin is not built into the player.
|
|
879
856
|
* @player 0.7.6
|
|
880
857
|
* @since 1.7.9
|
|
881
858
|
*/
|
|
@@ -947,9 +924,7 @@ export interface Commands {
|
|
|
947
924
|
* });
|
|
948
925
|
* ```
|
|
949
926
|
*
|
|
950
|
-
* @capability
|
|
951
|
-
* @throws `capability` (rejects) The manifest does not declare
|
|
952
|
-
* `commands.run`, or the plugin is not built into the player.
|
|
927
|
+
* @throws `capability` (rejects) The plugin is not built into the player.
|
|
953
928
|
* @throws `ticket` (rejects) No ticket, or it ended or expired.
|
|
954
929
|
* @throws `missing` (rejects) No listed command has this id, or one of
|
|
955
930
|
* the ids of `then`.
|
|
@@ -1109,8 +1084,6 @@ export interface CommandInfo {
|
|
|
1109
1084
|
* an assistant that runs commands for a sentence. There is one lead in the
|
|
1110
1085
|
* player, and only a built-in plugin can hold it.
|
|
1111
1086
|
*
|
|
1112
|
-
* @capability palette.lead (built-in plugins only)
|
|
1113
|
-
*
|
|
1114
1087
|
* @example Answer typed time stamps from the palette
|
|
1115
1088
|
* The palette's first row reads "Go to: 12:30"; Enter seeks there. `lead`
|
|
1116
1089
|
* puts the row up; the player sends the typed text with Enter, and the
|
|
@@ -1140,9 +1113,7 @@ export interface Palette {
|
|
|
1140
1113
|
* @example See Palette
|
|
1141
1114
|
* {@link Palette}
|
|
1142
1115
|
*
|
|
1143
|
-
* @capability
|
|
1144
|
-
* @throws `capability` (through `ready`) The manifest does not declare
|
|
1145
|
-
* `palette.lead`, or the plugin is not built into the player.
|
|
1116
|
+
* @throws `capability` (through `ready`) The plugin is not built into the player.
|
|
1146
1117
|
* @throws `conflict` (through `ready`) Another plugin holds the lead.
|
|
1147
1118
|
* @throws `invalid` (through `ready`) A text over its length.
|
|
1148
1119
|
* @player 0.7.6
|
|
@@ -1175,21 +1146,44 @@ export interface PaletteLeadOptions {
|
|
|
1175
1146
|
* the top of the main window, as its `state` says.
|
|
1176
1147
|
*/
|
|
1177
1148
|
status?: {
|
|
1178
|
-
/**
|
|
1149
|
+
/**
|
|
1150
|
+
* The status text, on one line: up to 80 characters while working; up
|
|
1151
|
+
* to 160 for an end state, which the strip shows on up to two lines
|
|
1152
|
+
* (since 1.8.0; 80 before).
|
|
1153
|
+
*/
|
|
1179
1154
|
text: string | Text;
|
|
1180
1155
|
/** On the right of the row (up to 40 characters). */
|
|
1181
1156
|
note?: string | Text;
|
|
1157
|
+
/**
|
|
1158
|
+
* What the status strip shows instead of `text` while working (1–80
|
|
1159
|
+
* characters on one line), for a row that says more than the strip
|
|
1160
|
+
* needs: the row reads "Vestra is working · Planning…", the strip
|
|
1161
|
+
* "Planning…". Absent: the strip shows `text`. Only for a working
|
|
1162
|
+
* status: an end state is shown in the strip alone, so its `text` is
|
|
1163
|
+
* the strip's, and `strip` with one is `invalid`. Like a working
|
|
1164
|
+
* `text`, it does not change the strip once {@link Commands.run} has
|
|
1165
|
+
* shown a step of the ticket there.
|
|
1166
|
+
*
|
|
1167
|
+
* Sent only when set: players before it refuse the field (`invalid`,
|
|
1168
|
+
* through `ready`, or `update` rejects).
|
|
1169
|
+
*
|
|
1170
|
+
* @since 1.8.0
|
|
1171
|
+
*/
|
|
1172
|
+
strip?: string | Text;
|
|
1182
1173
|
/**
|
|
1183
1174
|
* Still working or ended. Absent: `"working"`.
|
|
1184
1175
|
*
|
|
1185
1176
|
* - `"working"`: the work goes on. The strip shows the text with a
|
|
1186
1177
|
* moving line and a Stop button (Stop is Enter on the status row)
|
|
1187
1178
|
* and stays until the status changes or is removed.
|
|
1188
|
-
* - `"done"`, `"failed"`, `"note"`: an end state
|
|
1189
|
-
* sentence for the user, such as an answer
|
|
1190
|
-
*
|
|
1191
|
-
*
|
|
1192
|
-
*
|
|
1179
|
+
* - `"done"`, `"failed"`, `"note"`, `"stopped"`: an end state
|
|
1180
|
+
* (finished; failed; a sentence for the user, such as an answer; the
|
|
1181
|
+
* user stopped the work). The player shows it with a check, in the
|
|
1182
|
+
* danger colour, plain, or plain with its icon dimmed, then removes
|
|
1183
|
+
* it by itself after a few seconds (about 2 s, 6 s, 4–10 s by
|
|
1184
|
+
* length, and 2 s; longer while the pointer is on it). `"stopped"`
|
|
1185
|
+
* (since 1.8.0) says that nothing came of the request, which `"note"`
|
|
1186
|
+
* cannot: use it for the text shown after Stop. It is shown once: not kept,
|
|
1193
1187
|
* not shown again later (when the plugin is stopped or woken), and
|
|
1194
1188
|
* the row goes back to its usual form. The plugin needs no timer of
|
|
1195
1189
|
* its own and may call {@link PaletteLead.done} right after setting
|
|
@@ -1199,13 +1193,14 @@ export interface PaletteLeadOptions {
|
|
|
1199
1193
|
* strip, a `"working"` text changes only the palette's status row,
|
|
1200
1194
|
* until an end state, `status: null` or the end of the ticket.
|
|
1201
1195
|
*
|
|
1202
|
-
* Players before the status strip refuse the field (`invalid`)
|
|
1203
|
-
*
|
|
1204
|
-
* (through `ready`,
|
|
1196
|
+
* Players before the status strip refuse the field (`invalid`), and
|
|
1197
|
+
* players before SDK 1.8.0's refuse `"stopped"`; a built-in plugin
|
|
1198
|
+
* ships with its player. Any other value: `invalid` (through `ready`,
|
|
1199
|
+
* or `update` rejects).
|
|
1205
1200
|
*
|
|
1206
1201
|
* @since 1.7.15
|
|
1207
1202
|
*/
|
|
1208
|
-
state?: "working" | "done" | "failed" | "note";
|
|
1203
|
+
state?: "working" | "done" | "failed" | "note" | "stopped";
|
|
1209
1204
|
} | null;
|
|
1210
1205
|
}
|
|
1211
1206
|
/**
|
|
@@ -1236,8 +1231,6 @@ export interface PaletteLeadRun {
|
|
|
1236
1231
|
* status while a request runs, a note while it cannot run); `onRun` hears
|
|
1237
1232
|
* each activation; `done` ends the ticket of a finished request.
|
|
1238
1233
|
*
|
|
1239
|
-
* @capability palette.lead (built-in plugins only)
|
|
1240
|
-
*
|
|
1241
1234
|
* @example Show a status while a request runs
|
|
1242
1235
|
* While the plugin works on a request the row shows "Working… (Enter to
|
|
1243
1236
|
* stop)"; Enter on it stops the work. The status row replaces the lead
|
|
@@ -1266,7 +1259,7 @@ export interface PaletteLead extends Disposable {
|
|
|
1266
1259
|
/**
|
|
1267
1260
|
* Settles when the player has the row.
|
|
1268
1261
|
*
|
|
1269
|
-
* @throws `capability` (rejects)
|
|
1262
|
+
* @throws `capability` (rejects) The plugin is not built into the player.
|
|
1270
1263
|
* @throws `conflict` (rejects) Another plugin holds the lead.
|
|
1271
1264
|
* @throws `invalid` (rejects) A text over its length.
|
|
1272
1265
|
*/
|
|
@@ -1277,7 +1270,6 @@ export interface PaletteLead extends Disposable {
|
|
|
1277
1270
|
* @example See PaletteLead
|
|
1278
1271
|
* {@link PaletteLead}
|
|
1279
1272
|
*
|
|
1280
|
-
* @capability palette.lead (built-in plugins only)
|
|
1281
1273
|
* @throws `invalid` (rejects) A text over its length.
|
|
1282
1274
|
* @throws `capability` (rejects) The row was refused (see `ready`).
|
|
1283
1275
|
* @since 1.7.9
|
|
@@ -1302,7 +1294,6 @@ export interface PaletteLead extends Disposable {
|
|
|
1302
1294
|
* });
|
|
1303
1295
|
* ```
|
|
1304
1296
|
*
|
|
1305
|
-
* @capability palette.lead (built-in plugins only)
|
|
1306
1297
|
* @since 1.7.9
|
|
1307
1298
|
*/
|
|
1308
1299
|
onRun(listener: (run: PaletteLeadRun) => void): Disposable;
|
|
@@ -1327,8 +1318,7 @@ export interface PaletteLead extends Disposable {
|
|
|
1327
1318
|
* });
|
|
1328
1319
|
* ```
|
|
1329
1320
|
*
|
|
1330
|
-
* @capability
|
|
1331
|
-
* @throws `capability` (rejects) The manifest does not declare `palette.lead`.
|
|
1321
|
+
* @throws `capability` (rejects) The plugin is not built into the player.
|
|
1332
1322
|
* @since 1.7.9
|
|
1333
1323
|
*/
|
|
1334
1324
|
done(ticket: string): Promise<void>;
|
|
@@ -1369,8 +1359,6 @@ export type HostAction = "play-pause" | "stop" | "previous" | "next" | "frame-ba
|
|
|
1369
1359
|
* accumulation of repeated presses and the same on-screen text, instead of
|
|
1370
1360
|
* reimplementing them with {@link Player} calls.
|
|
1371
1361
|
*
|
|
1372
|
-
* @capability commands
|
|
1373
|
-
*
|
|
1374
1362
|
* @example Give a custom bar the player's own Stop and Mute
|
|
1375
1363
|
* The plugin's bar buttons stop playback and mute exactly as the player's
|
|
1376
1364
|
* own keys do, with the same on-screen text. Each callback runs a core
|
|
@@ -1418,11 +1406,9 @@ export interface Host {
|
|
|
1418
1406
|
* });
|
|
1419
1407
|
* ```
|
|
1420
1408
|
*
|
|
1421
|
-
* @capability commands
|
|
1422
1409
|
* @throws `unavailable` (rejects) The action is disabled right now (nothing
|
|
1423
1410
|
* open, no window for `fullscreen`).
|
|
1424
1411
|
* @throws `invalid` (rejects) An unknown action, or `seconds` out of range.
|
|
1425
|
-
* @throws `capability` (rejects) The manifest does not declare `commands`.
|
|
1426
1412
|
*
|
|
1427
1413
|
* @since 1.0.0
|
|
1428
1414
|
*/
|
|
@@ -1454,11 +1440,9 @@ export interface Host {
|
|
|
1454
1440
|
* bar.on("forward30", () => plugin.host.run("seek-forward", { seconds: 30 }));
|
|
1455
1441
|
* ```
|
|
1456
1442
|
*
|
|
1457
|
-
* @capability commands
|
|
1458
1443
|
* @throws `unavailable` (rejects) The action is disabled right now (nothing
|
|
1459
1444
|
* open, no window for `fullscreen`).
|
|
1460
1445
|
* @throws `invalid` (rejects) An unknown action, or `seconds` out of range.
|
|
1461
|
-
* @throws `capability` (rejects) The manifest does not declare `commands`.
|
|
1462
1446
|
*/
|
|
1463
1447
|
run(action: "seek-backward" | "seek-forward", options: {
|
|
1464
1448
|
seconds: number;
|
|
@@ -1526,7 +1510,7 @@ export interface BindingInfo extends BindingRef {
|
|
|
1526
1510
|
}
|
|
1527
1511
|
/**
|
|
1528
1512
|
* `plugin.bindings`: list and override every command's bindings, including
|
|
1529
|
-
* the player's.
|
|
1513
|
+
* the player's.
|
|
1530
1514
|
*
|
|
1531
1515
|
* @example Unbind the player's Mute key, then restore it
|
|
1532
1516
|
* The player's Mute command loses its default key, and later gets it
|
|
@@ -1546,7 +1530,6 @@ export interface BindingInfo extends BindingRef {
|
|
|
1546
1530
|
* plugin lists the table, writes overrides and resets them; the player
|
|
1547
1531
|
* applies the change at once to every running plugin.
|
|
1548
1532
|
*
|
|
1549
|
-
* @capability bindings.manage
|
|
1550
1533
|
* @see [Commands, menus and bindings](../../../docs/reference/commands.md)
|
|
1551
1534
|
* @since 1.0.0
|
|
1552
1535
|
* @category Commands
|
|
@@ -1555,15 +1538,6 @@ export interface Bindings {
|
|
|
1555
1538
|
/**
|
|
1556
1539
|
* Every declared command, and overrides whose command is gone.
|
|
1557
1540
|
*
|
|
1558
|
-
* A `focus: "panel"` command of a plugin whose manifest does not declare
|
|
1559
|
-
* `ui.mount` is left out (player 0.8.0): it has no panel, so no key can
|
|
1560
|
-
* reach it. It is still declared: its stored binding is not an orphan,
|
|
1561
|
-
* and `set` accepts it.
|
|
1562
|
-
*
|
|
1563
|
-
* @capability bindings.manage
|
|
1564
|
-
* @throws `capability` (rejects) The manifest does not declare
|
|
1565
|
-
* `bindings.manage`.
|
|
1566
|
-
*
|
|
1567
1541
|
* @example Find the commands that use a key
|
|
1568
1542
|
* A key-settings window shows which commands Ctrl+K is bound to now. `list`
|
|
1569
1543
|
* resolves with every declared command and its current bindings (the
|
|
@@ -1575,6 +1549,7 @@ export interface Bindings {
|
|
|
1575
1549
|
* console.log(users.map((command) => `${command.plugin}/${command.command}`)); // "host" for the player
|
|
1576
1550
|
* ```
|
|
1577
1551
|
*
|
|
1552
|
+
* @throws `disabled` (rejects) The plugin is stopping.
|
|
1578
1553
|
* @since 1.0.0
|
|
1579
1554
|
*/
|
|
1580
1555
|
list(): Promise<{
|
|
@@ -1594,12 +1569,9 @@ export interface Bindings {
|
|
|
1594
1569
|
* no override either.
|
|
1595
1570
|
* At most 16 inputs, syntax as {@link CommandOptions.bindings}.
|
|
1596
1571
|
*
|
|
1597
|
-
* @capability bindings.manage
|
|
1598
1572
|
* @throws `invalid` (rejects) A malformed binding, or more than 16.
|
|
1599
1573
|
* @throws `missing` (rejects) An unknown command that has no override
|
|
1600
1574
|
* either.
|
|
1601
|
-
* @throws `capability` (rejects) The manifest does not declare
|
|
1602
|
-
* `bindings.manage`.
|
|
1603
1575
|
*
|
|
1604
1576
|
* @example Give the player's Mute command a second key
|
|
1605
1577
|
* Mute now answers to M and to Ctrl+M. `set` replaces the command's
|
|
@@ -1615,11 +1587,8 @@ export interface Bindings {
|
|
|
1615
1587
|
/**
|
|
1616
1588
|
* Back to the defaults: one command, or every override when omitted.
|
|
1617
1589
|
*
|
|
1618
|
-
* @capability bindings.manage
|
|
1619
1590
|
* @throws `missing` (rejects) A command that has no override and is not
|
|
1620
1591
|
* declared.
|
|
1621
|
-
* @throws `capability` (rejects) The manifest does not declare
|
|
1622
|
-
* `bindings.manage`.
|
|
1623
1592
|
*
|
|
1624
1593
|
* @example Restore every default key
|
|
1625
1594
|
* A "Restore defaults" button removes all of the user's overrides, so
|
|
@@ -1637,8 +1606,6 @@ export interface Bindings {
|
|
|
1637
1606
|
* override. At most every 200 ms, and only when the list itself changed,
|
|
1638
1607
|
* not when a plugin starts again with the same commands.
|
|
1639
1608
|
*
|
|
1640
|
-
* @capability bindings.manage
|
|
1641
|
-
*
|
|
1642
1609
|
* @example Refresh a key list when bindings change
|
|
1643
1610
|
* The plugin's key list stays current when the user changes a key in the
|
|
1644
1611
|
* player or a plugin with other commands is installed. The listener
|
|
@@ -16,8 +16,6 @@ export interface PackageManifest {
|
|
|
16
16
|
apiVersion: string;
|
|
17
17
|
/** Entry module path inside the package. */
|
|
18
18
|
entry: string;
|
|
19
|
-
/** Declared capabilities. */
|
|
20
|
-
capabilities: string[];
|
|
21
19
|
/** Display name, 1–64 characters. */
|
|
22
20
|
name?: string;
|
|
23
21
|
/** Author, 1–64 characters. */
|
|
@@ -116,18 +114,15 @@ export interface InstallOptions {
|
|
|
116
114
|
* Installing starts a {@link PackageChange}; the player keeps only the 32
|
|
117
115
|
* most recent candidates.
|
|
118
116
|
*
|
|
119
|
-
* @capability plugins.manage
|
|
120
|
-
*
|
|
121
117
|
* @example Show what a package asks for before installing it
|
|
122
|
-
* Before installing, the plugin shows the package's
|
|
123
|
-
*
|
|
124
|
-
* as the player read it.
|
|
118
|
+
* Before installing, the plugin shows the package's id and version. The
|
|
119
|
+
* candidate's `manifest` is the manifest as the player read it.
|
|
125
120
|
* ```ts
|
|
126
121
|
* declare const directory: string;
|
|
127
122
|
* // ---cut---
|
|
128
123
|
* const candidate = await plugin.packages.validate(directory);
|
|
129
|
-
* const { id, version
|
|
130
|
-
* await plugin.osd.show("{} {}
|
|
124
|
+
* const { id, version } = candidate.manifest;
|
|
125
|
+
* await plugin.osd.show("{} {}", [id, version]);
|
|
131
126
|
* ```
|
|
132
127
|
*
|
|
133
128
|
* @since 1.0.0
|
|
@@ -151,7 +146,6 @@ export interface PackageCandidate {
|
|
|
151
146
|
* update keeps a disabled plugin disabled unless `enabled` says otherwise
|
|
152
147
|
* (see {@link InstallOptions.enabled}).
|
|
153
148
|
*
|
|
154
|
-
* @capability plugins.manage
|
|
155
149
|
* @throws `invalid` (rejects) An option is malformed: a `source` the
|
|
156
150
|
* player does not accept, or a `replace` or `enabled` that is not a
|
|
157
151
|
* boolean.
|
|
@@ -166,8 +160,6 @@ export interface PackageCandidate {
|
|
|
166
160
|
* needed).
|
|
167
161
|
* @throws `stale` (rejects) The candidate is older than the 32 the player
|
|
168
162
|
* keeps.
|
|
169
|
-
* @throws `capability` (rejects) The manifest does not declare
|
|
170
|
-
* `plugins.manage`.
|
|
171
163
|
*
|
|
172
164
|
* @example Replace a plugin installed from another source
|
|
173
165
|
* The new package replaces the installed plugin even though it came from
|
|
@@ -213,8 +205,6 @@ export type PackageChangeStatus = "preparing" | "activating" | "restoring" | "co
|
|
|
213
205
|
* resolves with the terminal status and does not reject for a failed
|
|
214
206
|
* change: `message` says why.
|
|
215
207
|
*
|
|
216
|
-
* @capability plugins.manage
|
|
217
|
-
*
|
|
218
208
|
* @example Report each step of an install
|
|
219
209
|
* The OSD shows each step of the install and the end result. `onChange`
|
|
220
210
|
* runs for every new status; `done` resolves when the change is over.
|
|
@@ -237,8 +227,6 @@ export interface PackageChange {
|
|
|
237
227
|
/**
|
|
238
228
|
* The status changed.
|
|
239
229
|
*
|
|
240
|
-
* @capability plugins.manage
|
|
241
|
-
*
|
|
242
230
|
* @example Close a progress window when the change ends
|
|
243
231
|
* The plugin's progress window closes once the install is over, whatever
|
|
244
232
|
* the outcome. The listener receives each new status; the terminal ones
|
|
@@ -269,10 +257,6 @@ export interface PackageChange {
|
|
|
269
257
|
/**
|
|
270
258
|
* Ask to cancel (it may be `tooLate`).
|
|
271
259
|
*
|
|
272
|
-
* @capability plugins.manage
|
|
273
|
-
* @throws `capability` (rejects) The manifest does not declare
|
|
274
|
-
* `plugins.manage`.
|
|
275
|
-
*
|
|
276
260
|
* @example Cancel an install the user no longer wants
|
|
277
261
|
* The install stops if it has not gone too far. `cancel` asks the player;
|
|
278
262
|
* the change then ends `cancelled`. When the change had already committed
|
|
@@ -286,6 +270,7 @@ export interface PackageChange {
|
|
|
286
270
|
* console.log(await change.done); // "cancelled"; "committed" when it was too late
|
|
287
271
|
* ```
|
|
288
272
|
*
|
|
273
|
+
* @throws `disabled` (rejects) The plugin is stopping.
|
|
289
274
|
* @since 1.0.0
|
|
290
275
|
*/
|
|
291
276
|
cancel(): Promise<void>;
|
|
@@ -307,8 +292,6 @@ export interface PluginInfo {
|
|
|
307
292
|
state: "starting" | "running" | "disabled" | "failed" | "stopped";
|
|
308
293
|
/** Why it failed (`state: "failed"`). */
|
|
309
294
|
error: string | null;
|
|
310
|
-
/** Declared capabilities. */
|
|
311
|
-
capabilities: string[];
|
|
312
295
|
/**
|
|
313
296
|
* The package directory (read its `manifest.json` for display fields).
|
|
314
297
|
* A built-in's directory is inside the player installation
|
|
@@ -407,8 +390,8 @@ export interface PluginWarning {
|
|
|
407
390
|
owner?: string;
|
|
408
391
|
}
|
|
409
392
|
/**
|
|
410
|
-
* `plugin.packages`: the plugins the player knows
|
|
411
|
-
*
|
|
393
|
+
* `plugin.packages`: the plugins the player knows, and installing,
|
|
394
|
+
* enabling, reloading and uninstalling them.
|
|
412
395
|
*
|
|
413
396
|
* @example Install a plugin from an unpacked package
|
|
414
397
|
* The plugin installs a package directory it downloaded and unpacked, and
|
|
@@ -428,25 +411,22 @@ export interface PluginWarning {
|
|
|
428
411
|
*
|
|
429
412
|
* @remarks
|
|
430
413
|
* The plugins the player knows: installed, built-in and this run's
|
|
431
|
-
* development loads.
|
|
432
|
-
*
|
|
433
|
-
* other plugins, never on the calling one. Built-in plugins update with
|
|
414
|
+
* development loads. Installing, enabling,
|
|
415
|
+
* reloading and uninstalling act on other plugins, never on the calling one. Built-in plugins update with
|
|
434
416
|
* the player and cannot be installed, disabled or uninstalled.
|
|
435
417
|
*
|
|
436
|
-
* @capability None for `list` and `onChange`; plugins.manage for the rest.
|
|
437
418
|
* @since 1.0.0
|
|
438
419
|
* @category Packages
|
|
439
420
|
*/
|
|
440
421
|
export interface Packages {
|
|
441
422
|
/**
|
|
442
|
-
* Validate a package directory
|
|
423
|
+
* Validate a package directory. A package whose id is
|
|
443
424
|
* reserved for the built-in plugins (`vestra` or `vestra.*`) fails with
|
|
444
425
|
* `reserved`.
|
|
445
426
|
*
|
|
446
427
|
* The player keeps the 32 most recent candidates of all plugins; an older
|
|
447
428
|
* one's `install` fails with `stale` (validate again).
|
|
448
429
|
*
|
|
449
|
-
* @capability plugins.manage
|
|
450
430
|
* @throws `host` (rejects) Not a package directory, or a manifest that
|
|
451
431
|
* breaks the rules (another `apiVersion` included); `message` says why.
|
|
452
432
|
* @throws `invalid` (rejects) A bad request (a path that is not a string).
|
|
@@ -456,8 +436,6 @@ export interface Packages {
|
|
|
456
436
|
* @throws `versionMismatch` (rejects) The package's `minPlayerVersion` is
|
|
457
437
|
* newer than the player.
|
|
458
438
|
* @throws `disabled` (rejects) The calling plugin is stopping.
|
|
459
|
-
* @throws `capability` (rejects) The manifest does not declare
|
|
460
|
-
* `plugins.manage`.
|
|
461
439
|
*
|
|
462
440
|
* @example Check a package directory before installing it
|
|
463
441
|
* The plugin checks a folder it unpacked and installs it if the player
|
|
@@ -479,12 +457,11 @@ export interface Packages {
|
|
|
479
457
|
*/
|
|
480
458
|
validate(directory: string): Promise<PackageCandidate>;
|
|
481
459
|
/**
|
|
482
|
-
* Validate a `.vxp` package file
|
|
460
|
+
* Validate a `.vxp` package file: the same checks as
|
|
483
461
|
* {@link Packages.validate} after unpacking. Check the file's sha256 yourself
|
|
484
462
|
* before calling when you know it. A reserved id fails with `reserved`, as in
|
|
485
463
|
* {@link Packages.validate}.
|
|
486
464
|
*
|
|
487
|
-
* @capability plugins.manage
|
|
488
465
|
* @throws `invalid` (rejects) The path does not end in `.vxp`, or the
|
|
489
466
|
* archive cannot be unpacked (over 64 MB, too many files, a damaged zip,
|
|
490
467
|
* an unsafe path).
|
|
@@ -496,8 +473,6 @@ export interface Packages {
|
|
|
496
473
|
* @throws `versionMismatch` (rejects) The package's `minPlayerVersion` is
|
|
497
474
|
* newer than the player.
|
|
498
475
|
* @throws `disabled` (rejects) The calling plugin is stopping.
|
|
499
|
-
* @throws `capability` (rejects) The manifest does not declare
|
|
500
|
-
* `plugins.manage`.
|
|
501
476
|
*
|
|
502
477
|
* @example Install a downloaded package file
|
|
503
478
|
* A `.vxp` the plugin downloaded is checked and installed. The player
|
|
@@ -515,11 +490,9 @@ export interface Packages {
|
|
|
515
490
|
*/
|
|
516
491
|
validateArchive(file: string): Promise<PackageCandidate>;
|
|
517
492
|
/**
|
|
518
|
-
* Every plugin: running, installed, and this run's development loads.
|
|
493
|
+
* Every plugin: running, installed, and this run's development loads.
|
|
519
494
|
*
|
|
520
|
-
* @
|
|
521
|
-
* @throws `Error` (rejects) Only when the player cannot be asked; no
|
|
522
|
-
* capability is needed.
|
|
495
|
+
* @throws `Error` (rejects) Only when the player cannot be asked.
|
|
523
496
|
*
|
|
524
497
|
* @example Show which plugins are running
|
|
525
498
|
* The plugin lists the running plugins by name. `list` asks the player
|
|
@@ -535,9 +508,7 @@ export interface Packages {
|
|
|
535
508
|
*/
|
|
536
509
|
list(): Promise<PluginInfo[]>;
|
|
537
510
|
/**
|
|
538
|
-
* The new list after any start, stop, failure, install or uninstall.
|
|
539
|
-
*
|
|
540
|
-
* @capability None.
|
|
511
|
+
* The new list after any start, stop, failure, install or uninstall.
|
|
541
512
|
*
|
|
542
513
|
* @example Refresh a plugin list after any change
|
|
543
514
|
* A store window's list updates when a plugin starts, stops, fails, is
|
|
@@ -550,19 +521,16 @@ export interface Packages {
|
|
|
550
521
|
*/
|
|
551
522
|
onChange(listener: (plugins: PluginInfo[]) => void): Disposable;
|
|
552
523
|
/**
|
|
553
|
-
* Stop or start a plugin
|
|
524
|
+
* Stop or start a plugin. An installed plugin stays
|
|
554
525
|
* disabled across launches; a development load only for this run.
|
|
555
526
|
* `invalid` to disable oneself, `missing` unknown.
|
|
556
527
|
* `busy` while it is being installed or reloaded. `unsupported` to disable a built-in
|
|
557
528
|
* ({@link PluginInfo.builtin}): users manage third-party plugins only.
|
|
558
529
|
*
|
|
559
|
-
* @capability plugins.manage
|
|
560
530
|
* @throws `invalid` (rejects) Disabling the calling plugin itself.
|
|
561
531
|
* @throws `missing` (rejects) An unknown id.
|
|
562
532
|
* @throws `busy` (rejects) The plugin is being installed or reloaded.
|
|
563
533
|
* @throws `unsupported` (rejects) A built-in plugin.
|
|
564
|
-
* @throws `capability` (rejects) The manifest does not declare
|
|
565
|
-
* `plugins.manage`.
|
|
566
534
|
*
|
|
567
535
|
* @example Turn a third-party plugin off
|
|
568
536
|
* The plugin stops another plugin and keeps it disabled across launches
|
|
@@ -576,7 +544,7 @@ export interface Packages {
|
|
|
576
544
|
*/
|
|
577
545
|
setEnabled(id: string, enabled: boolean): Promise<void>;
|
|
578
546
|
/**
|
|
579
|
-
* Restart a plugin
|
|
547
|
+
* Restart a plugin: stop it and start it again from the
|
|
580
548
|
* same package with the same data directory, for example to recover one
|
|
581
549
|
* that misbehaves. Built-ins included. A stopped or failed plugin is just
|
|
582
550
|
* started. The disabled flag is never written, so a reload never leaves
|
|
@@ -593,14 +561,11 @@ export interface Packages {
|
|
|
593
561
|
* @player 0.5.1
|
|
594
562
|
* @since 1.5.19
|
|
595
563
|
*
|
|
596
|
-
* @capability plugins.manage
|
|
597
564
|
* @throws `invalid` (rejects) The calling plugin itself, or a disabled
|
|
598
565
|
* plugin.
|
|
599
566
|
* @throws `missing` (rejects) An unknown id.
|
|
600
567
|
* @throws `busy` (rejects) The plugin is being installed or reloaded.
|
|
601
568
|
* @throws `unsupported` (rejects) A player before 0.5.1.
|
|
602
|
-
* @throws `capability` (rejects) The manifest does not declare
|
|
603
|
-
* `plugins.manage`.
|
|
604
569
|
*
|
|
605
570
|
* @example Restart a plugin that misbehaves
|
|
606
571
|
* The other plugin is stopped and started again from the same package and
|
|
@@ -612,13 +577,12 @@ export interface Packages {
|
|
|
612
577
|
*/
|
|
613
578
|
reload(id: string): Promise<void>;
|
|
614
579
|
/**
|
|
615
|
-
* Remove an installed plugin
|
|
580
|
+
* Remove an installed plugin; `removeData` also deletes
|
|
616
581
|
* its data directory, otherwise reinstalling it from the same source
|
|
617
582
|
* reconnects to its data. Its user bindings stay (as orphans).
|
|
618
583
|
* `unsupported` for built-ins and development loads, `missing`
|
|
619
584
|
* unknown, `invalid` for oneself.
|
|
620
585
|
*
|
|
621
|
-
* @capability plugins.manage
|
|
622
586
|
* @throws `unsupported` (rejects) A built-in plugin or a development load.
|
|
623
587
|
* @throws `missing` (rejects) An unknown id.
|
|
624
588
|
* @throws `invalid` (rejects) The calling plugin itself.
|
|
@@ -626,8 +590,6 @@ export interface Packages {
|
|
|
626
590
|
* plugin is being installed or reloaded.
|
|
627
591
|
* @throws `revisionConflict` (rejects) The installed revision of that
|
|
628
592
|
* plugin changed meanwhile; call `uninstall` again.
|
|
629
|
-
* @throws `capability` (rejects) The manifest does not declare
|
|
630
|
-
* `plugins.manage`.
|
|
631
593
|
*
|
|
632
594
|
* @example Uninstall a plugin together with its data
|
|
633
595
|
* The other plugin is removed and its data directory deleted, so a later
|