@vestra-player/sdk 1.8.0 → 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.
Files changed (86) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +2 -2
  3. package/bin/vestra-plugin.mjs +11 -100
  4. package/capability-scan.json +3 -1
  5. package/dist/api-requests.d.ts +11 -36
  6. package/dist/api-requests.js +18 -47
  7. package/dist/capability-scan.d.ts +1 -1
  8. package/dist/capability-scan.js +8 -9
  9. package/dist/docs-tree.json.gz +0 -0
  10. package/dist/docs.d.ts +1 -1
  11. package/dist/docs.js +1 -1
  12. package/dist/index.d.ts +4 -5
  13. package/dist/manifest.d.ts +5 -0
  14. package/dist/manifest.js +9 -24
  15. package/dist/member-uses.d.ts +61 -0
  16. package/dist/member-uses.js +160 -0
  17. package/dist/player-runtime.d.ts +1 -2
  18. package/dist/player-runtime.js +1 -2
  19. package/dist/plugin/appearance.d.ts +1 -1
  20. package/dist/plugin/appearance.js +2 -2
  21. package/dist/plugin/bindings.d.ts +1 -1
  22. package/dist/plugin/bindings.js +2 -2
  23. package/dist/plugin/commands.js +1 -12
  24. package/dist/plugin/connection.d.ts +26 -7
  25. package/dist/plugin/connection.js +68 -36
  26. package/dist/plugin/drops.js +1 -1
  27. package/dist/plugin/index.js +9 -15
  28. package/dist/plugin/media.js +0 -12
  29. package/dist/plugin/mpv.js +0 -7
  30. package/dist/plugin/packages.js +1 -2
  31. package/dist/plugin/player/events.d.ts +4 -3
  32. package/dist/plugin/player/events.js +7 -6
  33. package/dist/plugin/player.d.ts +21 -13
  34. package/dist/plugin/player.js +56 -21
  35. package/dist/plugin/services.d.ts +4 -4
  36. package/dist/plugin/services.js +7 -29
  37. package/dist/plugin/settings.js +1 -1
  38. package/dist/plugin/shaders.js +0 -2
  39. package/dist/plugin/stream.d.ts +2 -1
  40. package/dist/plugin/stream.js +2 -2
  41. package/dist/plugin/testing/commands.d.ts +3 -10
  42. package/dist/plugin/testing/commands.js +6 -15
  43. package/dist/plugin/testing/index.d.ts +26 -116
  44. package/dist/plugin/testing/index.js +30 -104
  45. package/dist/plugin/testing/processing.js +1 -1
  46. package/dist/plugin/testing/services.js +0 -1
  47. package/dist/plugin/timeline.d.ts +2 -3
  48. package/dist/plugin/timeline.js +4 -8
  49. package/dist/plugin/types/base.d.ts +40 -86
  50. package/dist/plugin/types/commands.d.ts +10 -67
  51. package/dist/plugin/types/packages.d.ts +17 -55
  52. package/dist/plugin/types/playback.d.ts +126 -144
  53. package/dist/plugin/types/plugin-wire.d.ts +6 -36
  54. package/dist/plugin/types/processing.d.ts +10 -49
  55. package/dist/plugin/types/services.d.ts +11 -70
  56. package/dist/plugin/types/snapshots.d.ts +7 -60
  57. package/dist/plugin/types/sources.d.ts +2 -11
  58. package/dist/plugin/types/subtitles.d.ts +5 -26
  59. package/dist/plugin/types/ui-content.d.ts +1 -16
  60. package/dist/plugin/types/ui-layout.d.ts +53 -79
  61. package/dist/plugin/types/ui-locale.d.ts +5 -23
  62. package/dist/plugin/types/ui-shell.d.ts +13 -59
  63. package/dist/plugin/view/layout.js +1 -1
  64. package/dist/plugin/view.js +0 -2
  65. package/dist/plugin/window.d.ts +1 -1
  66. package/dist/plugin/window.js +1 -1
  67. package/dist/plugin/wire-facade.js +1 -2
  68. package/dist/processing.d.ts +2 -3
  69. package/dist/protocol.d.ts +14 -0
  70. package/dist/protocol.js +14 -0
  71. package/dist/request-queue.js +1 -1
  72. package/dist/subtitles.d.ts +1 -1
  73. package/dist/ts-plugin.d.ts +8 -15
  74. package/dist/ts-plugin.js +3 -141
  75. package/dist/wire.d.ts +7 -12
  76. package/dist/wire.js +6 -8
  77. package/llms.txt +4 -4
  78. package/package.json +1 -2
  79. package/dist/capabilities.d.ts +0 -107
  80. package/dist/capabilities.js +0 -69
  81. package/dist/capability-check.d.ts +0 -176
  82. package/dist/capability-check.js +0 -461
  83. package/dist/capability-rules.d.ts +0 -125
  84. package/dist/capability-rules.js +0 -192
  85. package/dist/host-capabilities.d.ts +0 -10
  86. package/dist/host-capabilities.js +0 -492
@@ -30,8 +30,7 @@ export interface WebResolverOptions {
30
30
  * A resolver for local files by extension: when anyone opens such a file with
31
31
  * {@link Player.open} (the Open dialog, the playlist, next / previous, the
32
32
  * recent list, a drop that calls `open`), the player asks this plugin for a
33
- * stream it generates instead of playing the file. Needs `source.resolve` and
34
- * `producer.av`.
33
+ * stream it generates instead of playing the file.
35
34
  *
36
35
  * @remarks
37
36
  * The open keeps everything of the original call: its `ifCurrent`, its
@@ -136,8 +135,6 @@ export interface ResolvedStream {
136
135
  * scope or stopping the plugin unregisters it and aborts resolutions in
137
136
  * flight; the extensions or hosts are free again for other plugins.
138
137
  *
139
- * @capability source.resolve
140
- *
141
138
  * @example Report when another plugin already handles the format
142
139
  * The plugin tells the user when its `.ch8` resolver could not register
143
140
  * because another plugin holds that extension. `ready` rejects with
@@ -172,15 +169,12 @@ export interface Resolver extends Disposable {
172
169
  * scheme + host, or this plugin already registered this id.
173
170
  * @throws `busy` (rejects) The player already holds 16 resolvers.
174
171
  * @throws `invalid` (rejects) A malformed declaration.
175
- * @throws `capability` (rejects) The manifest does not declare
176
- * `source.resolve`.
177
172
  */
178
173
  readonly ready: Promise<void>;
179
174
  }
180
175
  /**
181
176
  * `plugin.resolvers`: turn web page URLs into playable streams, or local
182
- * files into streams this plugin generates. Needs `source.resolve` (file
183
- * resolvers also `producer.av`).
177
+ * files into streams this plugin generates.
184
178
  *
185
179
  * @example Play pages of a video site
186
180
  * Opening a `https://video.example.com/…` page plays its video. When the
@@ -210,7 +204,6 @@ export interface Resolver extends Disposable {
210
204
  * anyone opens a matching address or file (the Open dialog, the playlist,
211
205
  * another plugin), so the plugin does not intercept opens itself.
212
206
  *
213
- * @capability source.resolve (file resolvers also `producer.av`)
214
207
  * @see [Control playback](../../../docs/guides/control-playback.md)
215
208
  * @since 1.0.0
216
209
  * @category Sources
@@ -223,8 +216,6 @@ export interface Resolvers {
223
216
  * (`conflict` otherwise). A rejected `resolve` fails the open with the
224
217
  * error's message.
225
218
  *
226
- * @capability source.resolve
227
- *
228
219
  * @example Play a site's pages through the plugin
229
220
  * Opening a `https://video.example.com/…` address plays the page's video.
230
221
  * `add` returns at once and registers in the background (`ready` reports
@@ -83,9 +83,8 @@ export interface SubtitleConditional {
83
83
  ifCurrent?: SubtitlesState;
84
84
  }
85
85
  /**
86
- * `plugin.subtitles`: tracks, uploads and style. Reading needs
87
- * `subtitles.read`; changes need `subtitles.control` and also
88
- * `subtitles.read`, since they read the current selection first.
86
+ * `plugin.subtitles`: tracks, uploads and style. Changes read the current
87
+ * selection first.
89
88
  *
90
89
  * @example Load an SRT file as the secondary subtitle
91
90
  * An English SRT file shows as a second subtitle line next to the
@@ -117,7 +116,7 @@ export interface SubtitleConditional {
117
116
  * selection, uploaded files and the style. `state` is the SDK's snapshot of
118
117
  * the player's subtitle state (`null` until first read). The player has no
119
118
  * subtitle event: the SDK reads the state again when the source, its phase
120
- * or the backend changes (with `events`) and after this plugin's own
119
+ * or the backend changes (after `plugin.player.subscribe()`) and after this plugin's own
121
120
  * changes, so a selection the user or another plugin changed shows only
122
121
  * after `refresh()`. A change without `ifCurrent` reads the state first
123
122
  * and applies to it; pass `ifCurrent` to make it fail with `stale` when the
@@ -125,9 +124,6 @@ export interface SubtitleConditional {
125
124
  * player confirms; `select`, `remove` and `setStyle` resolve with the new
126
125
  * state, `load` with the new track.
127
126
  *
128
- * @capability `subtitles.read` to read; `subtitles.control` and
129
- * `subtitles.read` to change; `events` to re-read on source changes.
130
- *
131
127
  * @see [Load subtitles from a plugin](../../../docs/guides/subtitles.md)
132
128
  * @since 1.0.0
133
129
  * @category Subtitles
@@ -138,8 +134,6 @@ export interface Subtitles {
138
134
  /**
139
135
  * The subtitle state changed.
140
136
  *
141
- * @capability events and subtitles.read
142
- *
143
137
  * @example Show the subtitle language after a new file opens
144
138
  * When a new file starts, the OSD names the language of its primary
145
139
  * subtitle. The SDK reads the subtitle state again when the source or its
@@ -159,19 +153,16 @@ export interface Subtitles {
159
153
  /**
160
154
  * Read the state from the player now.
161
155
  *
162
- * @capability subtitles.read
163
- * @throws `capability` (rejects) The manifest does not declare
164
- * `subtitles.read`.
165
- *
166
156
  * @example Count the subtitle tracks of the file
167
157
  * The plugin reads how many subtitle tracks the file has before building a
168
158
  * menu. `refresh` asks the player and resolves with the current state, also
169
- * without `events`; `state` holds it afterwards.
159
+ * without `plugin.player.subscribe()`; `state` holds it afterwards.
170
160
  * ```ts
171
161
  * const { tracks } = await plugin.subtitles.refresh();
172
162
  * await plugin.osd.show("{} subtitle tracks", [tracks.length]);
173
163
  * ```
174
164
  *
165
+ * @throws `disabled` (rejects) The plugin is stopping.
175
166
  * @since 1.0.0
176
167
  */
177
168
  refresh(): Promise<SubtitlesState>;
@@ -180,7 +171,6 @@ export interface Subtitles {
180
171
  * the primary one (`invalid` otherwise). A new source clears it.
181
172
  * `track: null` turns the role off.
182
173
  *
183
- * @capability subtitles.control and subtitles.read
184
174
  * @throws `stale` (rejects) With `ifCurrent`: the source or the subtitle
185
175
  * selection changed since that state.
186
176
  * @throws `invalid` (rejects) An unknown track; as secondary, a bitmap
@@ -189,8 +179,6 @@ export interface Subtitles {
189
179
  * @throws `unavailable` (rejects) Nothing loaded, or the source is still
190
180
  * loading or not yet confirmed.
191
181
  * @throws `busy` (rejects) Too many subtitle operations at once.
192
- * @throws `capability` (rejects) The manifest does not declare
193
- * `subtitles.control` and `subtitles.read`.
194
182
  *
195
183
  * @example Turn on the first English subtitle
196
184
  * The first English track becomes the primary subtitle, but only in the
@@ -228,7 +216,6 @@ export interface Subtitles {
228
216
  * every plugin together at most 16 tracks; see `SUBTITLE_LIMITS` in
229
217
  * `@vestra-player/sdk/testing`.
230
218
  *
231
- * @capability subtitles.control and subtitles.read
232
219
  * @throws `invalid` (rejects) A bad `format` or `title`, or a file over the
233
220
  * limits.
234
221
  * @throws `stale` (rejects) With `ifCurrent`: the source changed since
@@ -241,8 +228,6 @@ export interface Subtitles {
241
228
  * limit of `SUBTITLE_LIMITS` is reached (4 tracks of this plugin, 16
242
229
  * loads of this plugin or 16 tracks in the source, or another of its
243
230
  * limits); nothing is loaded.
244
- * @throws `capability` (rejects) The manifest does not declare
245
- * `subtitles.control` and `subtitles.read`.
246
231
  *
247
232
  * @example Load a downloaded SRT and select it
248
233
  * A subtitle file the plugin downloaded becomes a track of the current file
@@ -270,15 +255,12 @@ export interface Subtitles {
270
255
  /**
271
256
  * Remove a track this plugin loaded.
272
257
  *
273
- * @capability subtitles.control and subtitles.read
274
258
  * @throws `invalid` (rejects) The track was not loaded by this plugin.
275
259
  * @throws `stale` (rejects) With `ifCurrent`: the source changed since
276
260
  * that state.
277
261
  * @throws `unavailable` (rejects) Nothing is loaded, or the source is
278
262
  * still loading.
279
263
  * @throws `busy` (rejects) Too many subtitle operations at once.
280
- * @throws `capability` (rejects) The manifest does not declare
281
- * `subtitles.control` and `subtitles.read`.
282
264
  *
283
265
  * @example Remove the subtitle the plugin loaded
284
266
  * The plugin's downloaded subtitle disappears from the track list. A plugin
@@ -299,7 +281,6 @@ export interface Subtitles {
299
281
  * layer, the player uses the one whose manifest id sorts last, whatever
300
282
  * the order of the calls.
301
283
  *
302
- * @capability subtitles.control and subtitles.read
303
284
  * @throws `invalid` (rejects) A field out of range.
304
285
  * @throws `unsupported` (rejects) A font that is not in `state.fonts`, or a
305
286
  * primary subtitle that is a bitmap track.
@@ -308,8 +289,6 @@ export interface Subtitles {
308
289
  * @throws `unavailable` (rejects) Nothing is loaded, or the source is
309
290
  * still loading.
310
291
  * @throws `busy` (rejects) Too many subtitle operations at once.
311
- * @throws `capability` (rejects) The manifest does not declare
312
- * `subtitles.control` and `subtitles.read`.
313
292
  *
314
293
  * @example Take the plugin's style off again
315
294
  * The plugin removes its style layer, so the subtitles go back to the
@@ -248,8 +248,6 @@ export type Props = Record<string, PropValue>;
248
248
  * Both work in tool windows, panels (the backdrop and the floating sidebar
249
249
  * included) and settings pages.
250
250
  *
251
- * @capability None.
252
- *
253
251
  * @example Show a Markdown file in a window (examples/markdown)
254
252
  * A menu item opens a window with a formatted Markdown file that ships
255
253
  * with the plugin. The plugin reads the file, turns it into a document
@@ -274,7 +272,7 @@ export interface Ui {
274
272
  * @remarks
275
273
  * Returns at once without touching the file. The player checks the file each
276
274
  * time it receives the reference (a property write, a window or settings page
277
- * opening, the main window being rebuilt): it must be inside this plugin's
275
+ * opening, a new instance of a panel): it must be inside this plugin's
278
276
  * package directory or {@link Plugin.dataDirectory} after following links, at
279
277
  * most 16 MB and 4096×4096 pixels, and PNG or JPEG by content (the extension
280
278
  * does not matter). A failed check of a whole-value image is a failed
@@ -291,8 +289,6 @@ export interface Ui {
291
289
  * and write the new reference: the SDK does not send a value that did not
292
290
  * change, so the player would not look at the file again.
293
291
  *
294
- * @capability None.
295
- *
296
292
  * @param path - Absolute path of the image file, inside the package
297
293
  * directory or the data directory.
298
294
  * @param options - `maxSide`: decode the image scaled down, aspect kept, so
@@ -331,8 +327,6 @@ export interface Ui {
331
327
  * keeps 32 MB and fetches an address again after 24 hours, so a list that
332
328
  * shows the same thumbnails again reads them from disk.
333
329
  *
334
- * @capability None (the plugin process has network access).
335
- *
336
330
  * @param url - The image's `https:` address.
337
331
  * @param options - As for {@link Ui.image}.
338
332
  * @returns The reference, owned by this scope, once the file is in the
@@ -403,7 +397,6 @@ export interface Ui {
403
397
  * `MarkdownBlock.links` (its link addresses) are readable in Slint. See
404
398
  * [Reference: theme › Markdown](../../../docs/reference/theme.md#markdown).
405
399
  *
406
- * @capability None.
407
400
  * @player 0.2.0
408
401
  *
409
402
  * @param text - The Markdown source (CommonMark with GitHub tables, task
@@ -518,8 +511,6 @@ export interface Ui {
518
511
  * binding (`value: root.level`) is broken by Slint the first time the user
519
512
  * moves the control.
520
513
  *
521
- * @capability That of the view: `ui.window`, `ui.mount` or `ui.settings`.
522
- *
523
514
  * @example Wire a window's label and buttons to the plugin (examples/bookmark)
524
515
  * A Bookmark window shows the saved position and two buttons that save
525
516
  * it and jump back to it. `bind` keeps the label and the buttons' enabled
@@ -560,8 +551,6 @@ export interface View {
560
551
  * makes `show` reject. **Panels and settings pages** forward every
561
552
  * callback of their bridge global, so bind whenever you like.
562
553
  *
563
- * @capability That of the view: `ui.window`, `ui.mount` or `ui.settings`.
564
- *
565
554
  * @param callback - The Slint callback's name, in camelCase
566
555
  * (`toggleEffect`) or as written in Slint (`toggle-effect`).
567
556
  * @param handler - Receives the callback's arguments.
@@ -622,8 +611,6 @@ export interface View {
622
611
  * (the property keeps its default) and the failure goes to the plugin's
623
612
  * `onError`.
624
613
  *
625
- * @capability That of the view: `ui.window`, `ui.mount` or `ui.settings`.
626
- *
627
614
  * @param props - Properties by name; see {@link Props}.
628
615
  *
629
616
  * @throws `invalid` (throws) A property of `props` is written directly
@@ -680,8 +667,6 @@ export interface View {
680
667
  * writes directly ({@link WireView.write}) is left out of what the function
681
668
  * returns, reported once to `onError` with `invalid`: one track per property.
682
669
  *
683
- * @capability That of the view: `ui.window`, `ui.mount` or `ui.settings`.
684
- *
685
670
  * @param props - Returns the properties, by name.
686
671
  * @returns A handle that stops this binding (the values last sent stay).
687
672
  *
@@ -39,8 +39,6 @@ import type { View } from "./ui-content.ts";
39
39
  * Testing: `host.window(id)` of `@vestra-player/sdk/testing` has the
40
40
  * window's `props`, `visible`, `emit(callback, ...args)` and `userClose()`.
41
41
  *
42
- * @capability ui.window
43
- *
44
42
  * @example Open a window from a menu command (examples/bookmark)
45
43
  * Playback ▸ Bookmark… opens the Bookmark window. `create` only makes a
46
44
  * handle; the command's `run` calls `show`, which compiles the Slint file
@@ -92,11 +90,8 @@ export interface Window extends View, Disposable {
92
90
  * `show`, `hide` and `close` of one window run one after another in call
93
91
  * order. After `dispose()`, `show` does nothing.
94
92
  *
95
- * @capability ui.window
96
- *
97
93
  * @returns Resolves once the player has shown the window.
98
94
  *
99
- * @throws `capability` (rejects) The manifest does not declare `ui.window`.
100
95
  * @throws `unavailable` (rejects) The player runs without a user interface.
101
96
  * @throws `host` (rejects) The Slint file is missing, outside the package
102
97
  * directory or does not compile; it exports more than one component; or
@@ -134,8 +129,6 @@ export interface Window extends View, Disposable {
134
129
  * `true` and {@link Window.show} brings the window back as it was. Does
135
130
  * nothing when the window is not open.
136
131
  *
137
- * @capability ui.window
138
- *
139
132
  * @returns Resolves once the window is hidden.
140
133
  *
141
134
  * @throws `missing` (rejects) The user closed the window just before (the
@@ -174,8 +167,6 @@ export interface Window extends View, Disposable {
174
167
  * the window is not open. Unlike `dispose()`, the handle, its handlers and
175
168
  * its bindings stay.
176
169
  *
177
- * @capability ui.window
178
- *
179
170
  * @returns Resolves once the window is closed.
180
171
  *
181
172
  * @throws `missing` (rejects) The user closed the window just before.
@@ -212,8 +203,6 @@ export interface Window extends View, Disposable {
212
203
  *
213
204
  * Stop what the window needed here: timers, polling, a live preview.
214
205
  *
215
- * @capability ui.window
216
- *
217
206
  * @param listener - Called with no arguments; may be async.
218
207
  * @returns A handle that removes the listener.
219
208
  *
@@ -246,8 +235,6 @@ export interface Window extends View, Disposable {
246
235
  * question, use {@link Dialogs.confirm}. A plugin can have any number of
247
236
  * windows.
248
237
  *
249
- * @capability ui.window
250
- *
251
238
  * @example Create a window and open it from a menu (examples/bookmark)
252
239
  * A Bookmark window opens from Playback ▸ Bookmark…. `create` returns a
253
240
  * handle without opening anything; its bindings and callbacks are set up
@@ -273,8 +260,6 @@ export interface Windows {
273
260
  *
274
261
  * Bind every callback with {@link View.on} before the first `show()`.
275
262
  *
276
- * @capability ui.window (checked by {@link Window.show}).
277
- *
278
263
  * @param file - Path relative to the package directory, with `/` on every
279
264
  * system, for example `"ui/picture.slint"`. It must stay inside the
280
265
  * package.
@@ -379,17 +364,15 @@ export interface PanelState {
379
364
  *
380
365
  * @remarks
381
366
  * The position does not belong to the plugin that mounted the panel: any
382
- * plugin with `ui.mount` may read and toggle it, so a "Show playlist" command
367
+ * plugin may read and toggle it, so a "Show playlist" command
383
368
  * can live in a different plugin than the playlist. The player remembers
384
369
  * the sidebar's visibility, width, detached state and floating window
385
370
  * position across launches.
386
371
  *
387
- * `state` is read when first used. With `events` it then follows every
388
- * change (the user, other plugins, the window size); without `events` it
372
+ * `state` is read when first used. After `plugin.player.subscribe()`, it then follows every
373
+ * change (the user, other plugins, the window size); without `plugin.player.subscribe()`, it
389
374
  * refreshes only after this plugin's own changes.
390
375
  *
391
- * @capability ui.mount; `events` to follow changes made elsewhere.
392
- *
393
376
  * @example Add a "Show sidebar" item that works with any sidebar panel
394
377
  * Tools ▸ Show sidebar shows or hides the sidebar, whichever plugin's
395
378
  * panel is in it, with a check mark while it is shown. The position does
@@ -414,8 +397,8 @@ export interface PanelState {
414
397
  */
415
398
  export interface PanelSlot {
416
399
  /**
417
- * The current state; `null` while no plugin has a panel there (or without
418
- * `ui.mount`). With sidebar tabs it is the whole position's: shown,
400
+ * The current state; `null` while no plugin has a panel there. With
401
+ * sidebar tabs it is the whole position's: shown,
419
402
  * hidden and floating apply to all tabs, which {@link PanelSlot.panels}
420
403
  * lists.
421
404
  */
@@ -433,19 +416,17 @@ export interface PanelSlot {
433
416
  * Run code when the position's state changes.
434
417
  *
435
418
  * @remarks
436
- * Needs `events`: without it the listener runs only after this plugin's own
419
+ * Needs `plugin.player.subscribe()`: without it the listener runs only after this plugin's own
437
420
  * changes. Called with `null` when the panel there is unmounted, and also
438
421
  * when only the tabs changed ({@link PanelSlot.panels}: a panel added or
439
422
  * removed, another tab current). Errors go to {@link Scope.onError}.
440
423
  *
441
- * @capability ui.mount and events
442
- *
443
424
  * @param listener - Receives the new state.
444
425
  * @returns A handle that removes the listener.
445
426
  *
446
427
  * @example Tell the user when the window is too narrow for the sidebar
447
428
  * When the sidebar should show but the window has no room for it, the
448
- * OSD says so. With `events`, the listener runs on every change of the
429
+ * OSD says so. After `plugin.player.subscribe()`, the listener runs on every change of the
449
430
  * position, whoever caused it. The player reports `reason: "space"` when
450
431
  * the preference is to show the sidebar but the window is too small.
451
432
  * ```ts
@@ -466,15 +447,12 @@ export interface PanelSlot {
466
447
  * may still leave the panel off screen (`reason: "space"`); in fullscreen,
467
448
  * `true` pops the sidebar overlay out at once.
468
449
  *
469
- * @capability ui.mount
470
- *
471
450
  * @param visible - The new preference.
472
451
  * @returns Resolves once the layout has the new preference, with `state`
473
452
  * refreshed.
474
453
  *
475
454
  * @throws `missing` (rejects) No panel is mounted at this position.
476
455
  * @throws `unavailable` (rejects) The player runs without a user interface.
477
- * @throws `capability` (rejects) The manifest does not declare `ui.mount`.
478
456
  *
479
457
  * @example Hide the bottom bar for a clean picture
480
458
  * The control bar disappears, as if the user had hidden it from the menu,
@@ -495,23 +473,20 @@ export interface PanelSlot {
495
473
  *
496
474
  * @remarks
497
475
  * Reads the state from the player first, so it is right even without
498
- * `events`. It is a switch, the same in every mode: in fullscreen a column
476
+ * `plugin.player.subscribe()`. It is a switch, the same in every mode: in fullscreen a column
499
477
  * switched on is revealed by the pointer at the right edge, and is not popped
500
478
  * out by the toggle (`setVisible(true)` pops it out). Switching it off while
501
479
  * it is out slides it in at once.
502
480
  *
503
- * @capability ui.mount
504
- *
505
481
  * @returns Resolves once the layout has the new preference.
506
482
  *
507
483
  * @throws `missing` (rejects) No panel is mounted at this position.
508
484
  * @throws `unavailable` (rejects) The player runs without a user interface.
509
- * @throws `capability` (rejects) The manifest does not declare `ui.mount`.
510
485
  *
511
486
  * @example Toggle the control bar from a checkable menu item
512
487
  * Screen ▸ Control bar shows or hides the bottom bar and carries a check
513
488
  * mark while it is shown. `toggle` reads the player's current preference
514
- * first, so it is right even without `events`; `checked` is evaluated
489
+ * first, so it is right even without `plugin.player.subscribe()`; `checked` is evaluated
515
490
  * again after the command runs and follows `state`.
516
491
  * ```ts
517
492
  * plugin.commands.add({
@@ -536,8 +511,6 @@ export interface PanelSlot {
536
511
  * its tab. To show this plugin's own panel, use {@link Panel.show}. The
537
512
  * bottom bar has one panel: activating it changes nothing.
538
513
  *
539
- * @capability ui.mount
540
- *
541
514
  * @param plugin - The manifest id of the plugin whose panel to show, one
542
515
  * of {@link PanelSlot.panels}.
543
516
  * @returns Resolves once the layout has the new current tab, with `state`
@@ -546,7 +519,6 @@ export interface PanelSlot {
546
519
  * @throws `missing` (rejects) No panel is mounted at this position, or
547
520
  * none of `plugin`.
548
521
  * @throws `unavailable` (rejects) The player runs without a user interface.
549
- * @throws `capability` (rejects) The manifest does not declare `ui.mount`.
550
522
  *
551
523
  * @example Switch the sidebar to the playlist's tab
552
524
  * A command makes the playlist the sidebar's current tab without showing
@@ -576,8 +548,6 @@ export interface PanelSlot {
576
548
  * instance of the component. Closing the floating window (its close button
577
549
  * or the [standard close keys](../../../docs/reference/commands.md#keys-the-system-takes-first)) is the same as `setVisible(false)`.
578
550
  *
579
- * @capability ui.mount
580
- *
581
551
  * @example Add a "Detach sidebar" item
582
552
  * Tools ▸ Detach sidebar floats the sidebar in its own window and docks
583
553
  * it again, with a check mark while it floats. `setDetached` moves all
@@ -602,14 +572,11 @@ export interface SidebarSlot extends PanelSlot {
602
572
  /**
603
573
  * Float the sidebar panel in its own window, or attach it back.
604
574
  *
605
- * @capability ui.mount
606
- *
607
575
  * @param detached - `true` to float, `false` to dock.
608
576
  * @returns Resolves once the layout has changed, with `state` refreshed.
609
577
  *
610
578
  * @throws `missing` (rejects) No panel is mounted in the sidebar.
611
579
  * @throws `unavailable` (rejects) The player runs without a user interface.
612
- * @throws `capability` (rejects) The manifest does not declare `ui.mount`.
613
580
  *
614
581
  * @example Float the sidebar or dock it back
615
582
  * The sidebar moves into its own window, or back into the main window
@@ -633,24 +600,29 @@ export interface SidebarSlot extends PanelSlot {
633
600
  * the global, so {@link View.on} has no "bind before show" rule.
634
601
  *
635
602
  * **Life cycle.** `mount()` returns at once; in the next microtask the SDK
636
- * sends the mount with every property bound or set so far. The player queues
637
- * mounts and rebuilds its main window with the panel; {@link Panel.ready}
638
- * then resolves. Rebuilding happens whenever any plugin mounts or unmounts a
639
- * panel, and detaching the sidebar puts a new instance in a floating window.
640
- * The player restores the bridge properties to the values last written, but
641
- * state kept only inside the component (a scroll position, a property the
642
- * plugin never writes) starts over: keep what matters in bridge properties.
603
+ * sends the mount with every property bound or set so far. The player
604
+ * compiles each panel's file on its own, when the panel is first shown (see
605
+ * {@link Panel.ready}), and puts it in its position without rebuilding the
606
+ * main window: mounting or unmounting a panel leaves the other panels as they
607
+ * are. A panel keeps its component instance while its place exists, so a
608
+ * switch back to its tab finds it as it was. It gets a new instance when its
609
+ * place is made again (its column closed and opened, the column's fullscreen
610
+ * overlay, the sidebar moving to or from its floating window) and when the
611
+ * player unloaded it to make room (a column keeps at most 4 panels loaded)
612
+ * and shows it again. A new instance starts with the bridge properties last
613
+ * written, but state kept only inside the component (a scroll position, a
614
+ * property the plugin never writes) starts over: keep what matters in bridge
615
+ * properties. Each panel's file is compiled with its own globals: two panels
616
+ * that import the same file do not share a global.
643
617
  * `dispose()`, disposing the scope or stopping the plugin unmounts it.
644
618
  *
645
619
  * Testing: `host.mounted()` of `@vestra-player/sdk/testing` has the panel's
646
620
  * `slot`, `props` and `emit(callback, ...args)`.
647
621
  *
648
- * @capability ui.mount
649
- *
650
622
  * @example Mount a sidebar list with a right-click menu (examples/panel-menu)
651
623
  * The sidebar gets an "Example list" tab whose rows can be selected and
652
624
  * have a context menu. `mount` returns at once and the player adds the
653
- * panel when it rebuilds its main window; `bind` keeps the rows and the
625
+ * panel as a tab; `bind` keeps the rows and the
654
626
  * selection on the panel's bridge global, and the `context-menu` callback
655
627
  * opens a menu of the plugin's commands where the user clicked.
656
628
  *
@@ -666,10 +638,25 @@ export interface SidebarSlot extends PanelSlot {
666
638
  */
667
639
  export interface Panel extends View, Disposable {
668
640
  /**
669
- * Resolves once the player has mounted the panel and the main window shows
670
- * it; rejects when the mount failed.
641
+ * Resolves once the player has mounted the panel; rejects when the mount
642
+ * failed.
671
643
  *
672
644
  * @remarks
645
+ * **When the file compiles** (player 0.9.0). A panel shown at once (the
646
+ * bottom bar, the backdrop, the current tab of an open sidebar or adjust
647
+ * column) is compiled before `ready` settles: a file that does not compile
648
+ * rejects `ready` with `ui-prepare`. A tab mounted in the background (a
649
+ * sidebar tab that is not current, any tab of a closed column) compiles
650
+ * nothing at the mount, and `ready` resolves. Its file is compiled when the
651
+ * tab is first shown; the adjust column compiles its first tabs (up to 4,
652
+ * the current one among them) when it opens, and a tab mounted among them
653
+ * while it is open right after its mount. A failure then is not a
654
+ * rejection: it goes to {@link Scope.onError} as a `ui-prepare` error, and
655
+ * the tab stays empty until the plugin mounts the panel again (disposes it
656
+ * and mounts it anew, or restarts). So a broken file in a background tab
657
+ * does not fail activation; show the tab ({@link PanelSlot.activate}) to
658
+ * see its compile result.
659
+ *
673
660
  * Mounts made while `activate` runs must succeed before the plugin is
674
661
  * ready: a rejection fails activation, except `conflict` for a taken
675
662
  * position (below), which the player and `TestHost`
@@ -687,9 +674,11 @@ export interface Panel extends View, Disposable {
687
674
  * standby when idle; showing the tab starts it again (see
688
675
  * {@link Panel.state}).
689
676
  *
690
- * @throws `ui-prepare` (rejects) The Slint file does not compile, or a bound
691
- * property is not declared on the bridge global; `message` has the
692
- * diagnostics.
677
+ * @throws `ui-prepare` (rejects) For a panel shown at once: the Slint file
678
+ * does not compile, or a bound property is not declared on the bridge
679
+ * global; `message` has the diagnostics. For a tab mounted in the
680
+ * background the same failure goes to {@link Scope.onError} when the tab is
681
+ * first compiled (above).
693
682
  * @throws `conflict` (rejects) Another plugin's panel holds the bottom bar or
694
683
  * the backdrop (shown, or being mounted); `message` names the position and
695
684
  * the holder (「底栏已被 vestra.playback 使用」). Not an activation failure. Never
@@ -701,7 +690,6 @@ export interface Panel extends View, Disposable {
701
690
  * @throws `host` (rejects) The file is missing or outside the package
702
691
  * directory.
703
692
  * @throws `unavailable` (rejects) The player runs without a user interface.
704
- * @throws `capability` (rejects) The manifest does not declare `ui.mount`.
705
693
  */
706
694
  readonly ready: Promise<void>;
707
695
  /**
@@ -709,8 +697,8 @@ export interface Panel extends View, Disposable {
709
697
  * one; `null` until {@link Panel.ready} resolved (and after `dispose`).
710
698
  *
711
699
  * @remarks
712
- * Read when first used; with `events` it then follows every change (the
713
- * user switching tabs, other plugins, the window size), without `events`
700
+ * Read when first used; after `plugin.player.subscribe()`, it then follows every change (the
701
+ * user switching tabs, other plugins, the window size), without it
714
702
  * only this plugin's own changes. A sidebar panel in a background tab
715
703
  * has `active: false`, `effective: false` and `reason: "otherTab"`.
716
704
  *
@@ -722,8 +710,9 @@ export interface Panel extends View, Disposable {
722
710
  * which takes the tab over, and {@link Panel.ready} resolves again. Anything
723
711
  * the plugin kept only in memory is gone: restore the view from storage
724
712
  * (session storage survives standby). While it is in the background, the
725
- * player may also drop the panel's component and build it again from the
726
- * bridge properties last written, as it does on any rebuild.
713
+ * player may also unload the panel's component (a column keeps at most 4
714
+ * panels loaded) and make a new instance from the bridge properties last
715
+ * written when the tab is shown again.
727
716
  *
728
717
  * @throws Never; `null` stands for "not mounted".
729
718
  *
@@ -734,18 +723,16 @@ export interface Panel extends View, Disposable {
734
723
  * Run code when this panel's state changes.
735
724
  *
736
725
  * @remarks
737
- * Needs `events`: without it the listener runs only after this plugin's
726
+ * Needs `plugin.player.subscribe()`: without it the listener runs only after this plugin's
738
727
  * own changes. Called with `null` when the panel is unmounted. Errors go
739
728
  * to {@link Scope.onError}.
740
729
  *
741
- * @capability ui.mount and events
742
- *
743
730
  * @param listener - Receives the new state.
744
731
  * @returns A handle that removes the listener.
745
732
  *
746
733
  * @example Notice when the list moves to a background tab
747
734
  * The plugin logs when the user switches the sidebar to another plugin's
748
- * tab, for example to pause work the list does. With `events` the
735
+ * tab, for example to pause work the list does. After `plugin.player.subscribe()`, the
749
736
  * listener runs on every change. `reason: "otherTab"` exists only in a
750
737
  * panel's own state: the SDK sets it when the sidebar's current tab is
751
738
  * another plugin's (the position's state never has it).
@@ -767,8 +754,6 @@ export interface Panel extends View, Disposable {
767
754
  * (remembered; in fullscreen the sidebar overlay pops out). Waits for
768
755
  * {@link Panel.ready} first.
769
756
  *
770
- * @capability ui.mount
771
- *
772
757
  * @returns Resolves once the layout shows the panel's tab, with `state`
773
758
  * refreshed.
774
759
  *
@@ -804,8 +789,6 @@ export interface Panel extends View, Disposable {
804
789
  * at once. A "Show list" command checked by `state.preferred && state.active`
805
790
  * matches it. Waits for {@link Panel.ready} first.
806
791
  *
807
- * @capability ui.mount
808
- *
809
792
  * @returns Resolves once the layout has changed, with `state` refreshed.
810
793
  *
811
794
  * @throws `invalid` (rejects) The panel is the backdrop.
@@ -848,8 +831,6 @@ export interface Panel extends View, Disposable {
848
831
  *
849
832
  * Never throws: a failed write is reported to {@link Scope.onError}.
850
833
  *
851
- * @capability ui.mount
852
- *
853
834
  * @param locks - The locks to change; omitted ones keep their value.
854
835
  *
855
836
  * @example Keep the bar on screen while a search field has focus
@@ -883,8 +864,6 @@ export interface Panel extends View, Disposable {
883
864
  * makes context-only commands possible. Call it when the right button is
884
865
  * released, as the main menu does. Waits for {@link Panel.ready} first.
885
866
  *
886
- * @capability ui.mount
887
- *
888
867
  * @param items - At most 32 commands of this plugin, or `null` for a
889
868
  * separator.
890
869
  * @param at - Where to open it, in the window's logical pixels: in Slint,
@@ -926,8 +905,6 @@ export interface Panel extends View, Disposable {
926
905
  * bottom bar floats over the video and drops there count as drops on the
927
906
  * video area.
928
907
  *
929
- * @capability ui.drop
930
- *
931
908
  * @param listener - Receives the paths in the order the file manager gave
932
909
  * them, the point in panel coordinates (logical pixels from the panel's
933
910
  * top-left corner) and the keys held.
@@ -1003,8 +980,6 @@ export interface DropHandler {
1003
980
  * provider gets one call with all of its paths. Files nobody takes are
1004
981
  * ignored. A panel with {@link Panel.onDrop} takes drops on itself first.
1005
982
  *
1006
- * @capability ui.drop
1007
- *
1008
983
  * @example Collect dropped CHIP-8 programs
1009
984
  * `.ch8` files dropped on the player are added to the plugin's list. The
1010
985
  * provider claims the extension; the player calls `drop` with the dropped
@@ -1061,7 +1036,6 @@ export interface Drops {
1061
1036
  * });
1062
1037
  * ```
1063
1038
  *
1064
- * @capability ui.drop
1065
1039
  * @since 1.0.0
1066
1040
  */
1067
1041
  provide(handler: DropHandler): Disposable;