@vestra-player/sdk 1.10.1 → 1.11.0-rc.1
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 +21 -0
- package/bin/vestra-plugin.mjs +1 -131
- package/dist/api-requests.d.ts +1 -1
- package/dist/api-requests.js +9 -2
- package/dist/docs-tree.json.gz +0 -0
- package/dist/manifest.d.ts +0 -5
- package/dist/manifest.js +1 -8
- package/dist/mpv.js +1 -1
- package/dist/plugin/appearance.d.ts +2 -2
- package/dist/plugin/appearance.js +3 -3
- package/dist/plugin/connection.d.ts +38 -28
- package/dist/plugin/connection.js +101 -98
- package/dist/plugin/index.js +8 -6
- package/dist/plugin/passes.js +1 -1
- package/dist/plugin/player/events.d.ts +18 -9
- package/dist/plugin/player/events.js +36 -11
- package/dist/plugin/player.d.ts +31 -28
- package/dist/plugin/player.js +42 -68
- package/dist/plugin/scope.d.ts +2 -9
- package/dist/plugin/scope.js +21 -27
- package/dist/plugin/subtitles.d.ts +6 -1
- package/dist/plugin/subtitles.js +18 -2
- package/dist/plugin/testing/commands.js +1 -1
- package/dist/plugin/testing/facts.d.ts +46 -0
- package/dist/plugin/testing/facts.js +106 -0
- package/dist/plugin/testing/index.d.ts +12 -14
- package/dist/plugin/testing/index.js +52 -18
- package/dist/plugin/testing/media.js +6 -0
- package/dist/plugin/testing/revoke.d.ts +15 -0
- package/dist/plugin/testing/revoke.js +13 -0
- package/dist/plugin/testing/transport.js +8 -0
- package/dist/plugin/timeline.d.ts +2 -2
- package/dist/plugin/timeline.js +3 -3
- package/dist/plugin/types/base.d.ts +15 -15
- package/dist/plugin/types/commands.d.ts +8 -8
- package/dist/plugin/types/playback.d.ts +240 -116
- package/dist/plugin/types/plugin-wire.d.ts +2 -2
- package/dist/plugin/types/processing.d.ts +2 -3
- package/dist/plugin/types/subtitles.d.ts +9 -8
- package/dist/plugin/types/ui-layout.d.ts +32 -17
- package/dist/plugin/types/ui-locale.d.ts +9 -9
- package/dist/plugin/types/ui-shell.d.ts +7 -6
- package/dist/plugin/view/layout.d.ts +33 -1
- package/dist/plugin/view/layout.js +63 -34
- package/dist/plugin/window.d.ts +9 -1
- package/dist/plugin/window.js +14 -2
- package/dist/processing.d.ts +2 -2
- package/dist/request-queue.d.ts +7 -3
- package/dist/request-queue.js +19 -5
- package/dist/ts-plugin.d.ts +3 -4
- package/dist/ts-plugin.js +1 -1
- package/dist/wire.d.ts +1 -1
- package/dist/wire.js +1 -1
- package/llms.txt +3 -3
- package/package.json +2 -4
- package/capability-scan.json +0 -389
- package/dist/capability-scan.d.ts +0 -95
- package/dist/capability-scan.js +0 -249
- package/dist/member-uses.d.ts +0 -61
- package/dist/member-uses.js +0 -160
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { MainWindow, Scope } from "./base.ts";
|
|
2
2
|
import type { PluginInfo } from "./packages.ts";
|
|
3
|
+
import type { Player } from "./playback.ts";
|
|
3
4
|
import type { Ui } from "./ui-content.ts";
|
|
4
5
|
import type { Dialogs, Panels, Settings } from "./ui-shell.ts";
|
|
5
6
|
import type { Disposable } from "./base.ts";
|
|
@@ -317,6 +318,17 @@ export interface SlotState {
|
|
|
317
318
|
/** The sidebar floats in its own window; always `false` for the bottom bar. */
|
|
318
319
|
detached: boolean;
|
|
319
320
|
}
|
|
321
|
+
/**
|
|
322
|
+
* One position of the panel layout, as `layout.changed` reports it: its
|
|
323
|
+
* state and its panels, in tab order, with the active one marked.
|
|
324
|
+
*
|
|
325
|
+
* @since 1.11.0
|
|
326
|
+
* @category UI
|
|
327
|
+
*/
|
|
328
|
+
export interface LayoutPosition extends SlotState {
|
|
329
|
+
/** The position's panels in tab order; `active` marks the one shown. */
|
|
330
|
+
readonly panels: readonly SlotPanel[];
|
|
331
|
+
}
|
|
320
332
|
/**
|
|
321
333
|
* One panel of a position ({@link PanelSlot.panels}): a tab of the sidebar.
|
|
322
334
|
*
|
|
@@ -369,9 +381,10 @@ export interface PanelState {
|
|
|
369
381
|
* the sidebar's visibility, width, detached state and floating window
|
|
370
382
|
* position across launches.
|
|
371
383
|
*
|
|
372
|
-
* `state` is read when first used.
|
|
373
|
-
* change (the user, other plugins, the window size)
|
|
374
|
-
*
|
|
384
|
+
* `state` is read when first used. While an `onChange` listener exists it
|
|
385
|
+
* follows every change (the user, other plugins, the window size), and it
|
|
386
|
+
* takes each `layout.changed` a {@link Player.on} listener hears;
|
|
387
|
+
* otherwise it refreshes only after this plugin's own changes.
|
|
375
388
|
*
|
|
376
389
|
* @example Add a "Show sidebar" item that works with any sidebar panel
|
|
377
390
|
* Tools ▸ Show sidebar shows or hides the sidebar, whichever plugin's
|
|
@@ -416,8 +429,9 @@ export interface PanelSlot {
|
|
|
416
429
|
* Run code when the position's state changes.
|
|
417
430
|
*
|
|
418
431
|
* @remarks
|
|
419
|
-
*
|
|
420
|
-
*
|
|
432
|
+
* The listener runs on every change, whoever caused it (it keeps the
|
|
433
|
+
* plugin running while it exists; `layout.changed` with {@link Player.on}
|
|
434
|
+
* does not). Called with `null` when the panel there is unmounted, and also
|
|
421
435
|
* when only the tabs changed ({@link PanelSlot.panels}: a panel added or
|
|
422
436
|
* removed, another tab current). Errors go to {@link Scope.onError}.
|
|
423
437
|
*
|
|
@@ -426,8 +440,8 @@ export interface PanelSlot {
|
|
|
426
440
|
*
|
|
427
441
|
* @example Tell the user when the window is too narrow for the sidebar
|
|
428
442
|
* When the sidebar should show but the window has no room for it, the
|
|
429
|
-
* OSD says so.
|
|
430
|
-
*
|
|
443
|
+
* OSD says so. The listener runs on every change of the position,
|
|
444
|
+
* whoever caused it. The player reports `reason: "space"` when
|
|
431
445
|
* the preference is to show the sidebar but the window is too small.
|
|
432
446
|
* ```ts
|
|
433
447
|
* plugin.panels.sidebar.onChange((state) => {
|
|
@@ -472,8 +486,8 @@ export interface PanelSlot {
|
|
|
472
486
|
* Flip the user's preference, using the player's current value.
|
|
473
487
|
*
|
|
474
488
|
* @remarks
|
|
475
|
-
* Reads the state from the player first, so it is right even
|
|
476
|
-
*
|
|
489
|
+
* Reads the state from the player first, so it is right even when the
|
|
490
|
+
* copy does not follow the player. It is a switch, the same in every mode: in fullscreen a column
|
|
477
491
|
* switched on is revealed by the pointer at the right edge, and is not popped
|
|
478
492
|
* out by the toggle (`setVisible(true)` pops it out). Switching it off while
|
|
479
493
|
* it is out slides it in at once.
|
|
@@ -486,7 +500,7 @@ export interface PanelSlot {
|
|
|
486
500
|
* @example Toggle the control bar from a checkable menu item
|
|
487
501
|
* Screen ▸ Control bar shows or hides the bottom bar and carries a check
|
|
488
502
|
* mark while it is shown. `toggle` reads the player's current preference
|
|
489
|
-
* first, so it is right even
|
|
503
|
+
* first, so it is right even when nothing follows the layout; `checked` is evaluated
|
|
490
504
|
* again after the command runs and follows `state`.
|
|
491
505
|
* ```ts
|
|
492
506
|
* plugin.commands.add({
|
|
@@ -697,9 +711,9 @@ export interface Panel extends View, Disposable {
|
|
|
697
711
|
* one; `null` until {@link Panel.ready} resolved (and after `dispose`).
|
|
698
712
|
*
|
|
699
713
|
* @remarks
|
|
700
|
-
* Read when first used;
|
|
701
|
-
* user switching tabs, other plugins, the window size),
|
|
702
|
-
* only this plugin's own changes. A sidebar panel in a background tab
|
|
714
|
+
* Read when first used; while an `onChange` listener exists it follows
|
|
715
|
+
* every change (the user switching tabs, other plugins, the window size),
|
|
716
|
+
* otherwise only this plugin's own changes. A sidebar panel in a background tab
|
|
703
717
|
* has `active: false`, `effective: false` and `reason: "otherTab"`.
|
|
704
718
|
*
|
|
705
719
|
* A background tab does not keep the plugin running. If the panel is all that
|
|
@@ -723,8 +737,9 @@ export interface Panel extends View, Disposable {
|
|
|
723
737
|
* Run code when this panel's state changes.
|
|
724
738
|
*
|
|
725
739
|
* @remarks
|
|
726
|
-
*
|
|
727
|
-
*
|
|
740
|
+
* The listener runs on every change, whoever caused it (it keeps the
|
|
741
|
+
* plugin running while it exists). Called with `null` when the panel is
|
|
742
|
+
* unmounted. Errors go
|
|
728
743
|
* to {@link Scope.onError}.
|
|
729
744
|
*
|
|
730
745
|
* @param listener - Receives the new state.
|
|
@@ -732,8 +747,8 @@ export interface Panel extends View, Disposable {
|
|
|
732
747
|
*
|
|
733
748
|
* @example Notice when the list moves to a background tab
|
|
734
749
|
* The plugin logs when the user switches the sidebar to another plugin's
|
|
735
|
-
* tab, for example to pause work the list does.
|
|
736
|
-
*
|
|
750
|
+
* tab, for example to pause work the list does. The listener runs on
|
|
751
|
+
* every change. `reason: "otherTab"` exists only in a
|
|
737
752
|
* panel's own state: the SDK sets it when the sidebar's current tab is
|
|
738
753
|
* another plugin's (the position's state never has it).
|
|
739
754
|
* ```ts
|
|
@@ -32,8 +32,8 @@ export type ThemeId = "vestra" | "vestra-light";
|
|
|
32
32
|
* {@link Osd.show}).
|
|
33
33
|
*
|
|
34
34
|
* To run code when the palette or the language changes, listen with
|
|
35
|
-
* `plugin.player.on("appearance.changed", …)
|
|
36
|
-
*
|
|
35
|
+
* `plugin.player.on("appearance.changed", …)`: `theme` and `language`
|
|
36
|
+
* already hold the event's values when the listener runs.
|
|
37
37
|
*
|
|
38
38
|
* @example Offer the light palette as a menu item
|
|
39
39
|
* Settings ▸ Light colours switches every view of the player to the light
|
|
@@ -56,9 +56,9 @@ export type ThemeId = "vestra" | "vestra-light";
|
|
|
56
56
|
*/
|
|
57
57
|
export interface Appearance {
|
|
58
58
|
/**
|
|
59
|
-
* The palette in use. Read before activation;
|
|
60
|
-
* other plugins' changes
|
|
61
|
-
* plugin's own.
|
|
59
|
+
* The palette in use. Read before activation; while the plugin listens
|
|
60
|
+
* to `appearance.changed` it follows other plugins' changes, otherwise
|
|
61
|
+
* only this plugin's own.
|
|
62
62
|
*/
|
|
63
63
|
readonly theme: ThemeId;
|
|
64
64
|
/**
|
|
@@ -93,8 +93,8 @@ export interface Appearance {
|
|
|
93
93
|
* @remarks
|
|
94
94
|
* This is the choice for the next start. The language of this run is
|
|
95
95
|
* {@link I18n.locale} and never changes while the player runs. Read before
|
|
96
|
-
* activation;
|
|
97
|
-
* only this plugin's own. Players before 0.4.3 report `"system"`.
|
|
96
|
+
* activation; while the plugin listens to `appearance.changed` it
|
|
97
|
+
* follows other plugins' changes, otherwise only this plugin's own. Players before 0.4.3 report `"system"`.
|
|
98
98
|
*
|
|
99
99
|
* @since 1.5.9
|
|
100
100
|
*/
|
|
@@ -105,8 +105,8 @@ export interface Appearance {
|
|
|
105
105
|
* @remarks
|
|
106
106
|
* The player keeps the choice in its interface state; the language
|
|
107
107
|
* changes when the player starts again (tell the user, for example "Takes
|
|
108
|
-
* effect after restart"). Every plugin
|
|
109
|
-
* {@link Appearance.language}.
|
|
108
|
+
* effect after restart"). Every plugin that listens to
|
|
109
|
+
* `appearance.changed` sees the change in {@link Appearance.language}.
|
|
110
110
|
*
|
|
111
111
|
* @player 0.4.3
|
|
112
112
|
*
|
|
@@ -249,8 +249,9 @@ export interface Settings {
|
|
|
249
249
|
* The player decides when the backdrop shows: while the source is empty or
|
|
250
250
|
* loading, and while ready media has no video picture (audio files). The
|
|
251
251
|
* plugin decides what to draw, from {@link Player.state} and
|
|
252
|
-
* {@link Player.stats}.
|
|
253
|
-
*
|
|
252
|
+
* {@link Player.stats}. While an `onChange` listener exists `state`
|
|
253
|
+
* follows every change; otherwise it refreshes only when this plugin
|
|
254
|
+
* mounts.
|
|
254
255
|
*
|
|
255
256
|
* @example React when a video picture appears
|
|
256
257
|
* The OSD says "Video is playing" when the backdrop gives way to a video
|
|
@@ -789,12 +790,12 @@ export interface Dialogs {
|
|
|
789
790
|
*
|
|
790
791
|
* @example Show live playback numbers over the video
|
|
791
792
|
* A block over the video shows the position and the duration, updated
|
|
792
|
-
* as playback moves.
|
|
793
|
-
* state
|
|
794
|
-
*
|
|
793
|
+
* as playback moves. A stream's listener runs after the SDK updated the
|
|
794
|
+
* state; `set` never throws and sends only the newest text while one is
|
|
795
|
+
* in flight, so calling it on every change is fine.
|
|
795
796
|
* ```ts
|
|
796
797
|
* const info = plugin.osd.panel();
|
|
797
|
-
* plugin.player.
|
|
798
|
+
* plugin.player.stream((state) =>
|
|
798
799
|
* // A template with data arguments; the player translates "{} / {} s".
|
|
799
800
|
* info.set("{} / {} s", [state.position?.toFixed(1) ?? "–", state.duration?.toFixed(1) ?? "–"]),
|
|
800
801
|
* );
|
|
@@ -1,6 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The player's panel positions (`layout.state` / `layout.set`): one
|
|
3
|
+
* `LayoutService` per plugin, read by `plugin.panels.bottom` / `sidebar` /
|
|
4
|
+
* `adjust` / `backdrop` and by each panel's `state`.
|
|
5
|
+
*/
|
|
6
|
+
import type { LayoutSlot } from "../../wire.ts";
|
|
1
7
|
import type { Runtime } from "../runtime.ts";
|
|
2
8
|
import type { ScopeImpl } from "../scope.ts";
|
|
3
|
-
import type { BackdropSlot, PanelSlot, SidebarSlot, SlotPanel, SlotState } from "../types.ts";
|
|
9
|
+
import type { BackdropSlot, FactEventPayloads, PanelSlot, SidebarSlot, SlotPanel, SlotState } from "../types.ts";
|
|
10
|
+
/** `layout.state`'s reply (and `layout.changed`'s data) on the wire. */
|
|
11
|
+
type WireLayout = {
|
|
12
|
+
bottom: LayoutSlot | null;
|
|
13
|
+
sidebar: LayoutSlot | null;
|
|
14
|
+
adjust?: LayoutSlot | null;
|
|
15
|
+
backdrop?: {
|
|
16
|
+
effective?: boolean;
|
|
17
|
+
} | null;
|
|
18
|
+
};
|
|
19
|
+
/** `layout.changed`'s data as the listener gets it (`ScopeImpl.fact`). */
|
|
20
|
+
export declare const layoutChanged: (runtime: Runtime, data: unknown) => {
|
|
21
|
+
slots: {
|
|
22
|
+
readonly bottom: import("../types.ts").LayoutPosition | null;
|
|
23
|
+
readonly sidebar: import("../types.ts").LayoutPosition | null;
|
|
24
|
+
readonly adjust: import("../types.ts").LayoutPosition | null;
|
|
25
|
+
readonly backdrop: {
|
|
26
|
+
readonly effective: boolean;
|
|
27
|
+
} | null;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
4
30
|
/** The positions `layout.state` reports and `layout.set` changes. */
|
|
5
31
|
export type LayoutName = "bottom" | "sidebar" | "adjust";
|
|
6
32
|
export type Layout = {
|
|
@@ -34,6 +60,11 @@ export declare class LayoutService {
|
|
|
34
60
|
dispose: () => Promise<void>;
|
|
35
61
|
};
|
|
36
62
|
read(): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* `layout.changed`'s data (SDK 1.11.0): the copy takes it first when it
|
|
65
|
+
* is in use; the listener gets `{ slots }`.
|
|
66
|
+
*/
|
|
67
|
+
event(raw: WireLayout): FactEventPayloads["layout.changed"];
|
|
37
68
|
set(slot: LayoutName, change: {
|
|
38
69
|
visible?: boolean;
|
|
39
70
|
detached?: boolean;
|
|
@@ -45,3 +76,4 @@ export declare const layoutOf: (runtime: Runtime) => LayoutService;
|
|
|
45
76
|
export declare function slot(scope: ScopeImpl, name: "bottom" | "adjust"): PanelSlot;
|
|
46
77
|
export declare function slot(scope: ScopeImpl, name: "sidebar"): SidebarSlot;
|
|
47
78
|
export declare function backdrop(scope: ScopeImpl): BackdropSlot;
|
|
79
|
+
export {};
|
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
/** The SDK's view of a wire layout. */
|
|
2
|
+
function layoutOfWire(raw) {
|
|
3
|
+
const view = (slot) => slot && {
|
|
4
|
+
preferred: slot.preferred,
|
|
5
|
+
effective: slot.effective,
|
|
6
|
+
reason: slot.reason,
|
|
7
|
+
detached: slot.detached,
|
|
8
|
+
};
|
|
9
|
+
const tabs = (slot) => slot?.panels
|
|
10
|
+
? Object.freeze(slot.panels.map((panel) => Object.freeze({
|
|
11
|
+
plugin: panel.plugin,
|
|
12
|
+
title: panel.title,
|
|
13
|
+
active: panel.owner === slot.owner,
|
|
14
|
+
})))
|
|
15
|
+
: null;
|
|
16
|
+
const adjust = raw.adjust ?? null;
|
|
17
|
+
return {
|
|
18
|
+
bottom: view(raw.bottom),
|
|
19
|
+
sidebar: view(raw.sidebar),
|
|
20
|
+
adjust: view(adjust),
|
|
21
|
+
tabs: {
|
|
22
|
+
bottom: tabs(raw.bottom),
|
|
23
|
+
sidebar: tabs(raw.sidebar),
|
|
24
|
+
adjust: tabs(adjust),
|
|
25
|
+
},
|
|
26
|
+
backdrop: raw.backdrop
|
|
27
|
+
? Object.freeze({ effective: raw.backdrop.effective === true })
|
|
28
|
+
: null,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** `layout.changed`'s data as the listener gets it (`ScopeImpl.fact`). */
|
|
32
|
+
export const layoutChanged = (runtime, data) => layoutOf(runtime).event(data);
|
|
1
33
|
/**
|
|
2
34
|
* Both positions, one per plugin: read with `layout.state` after every
|
|
3
35
|
* `window.state` event (one read in flight; events during it cause one more)
|
|
@@ -29,7 +61,7 @@ export class LayoutService {
|
|
|
29
61
|
return;
|
|
30
62
|
this.#started = true;
|
|
31
63
|
// A mirror: panels listen through `watch`.
|
|
32
|
-
this.#runtime.on("window.state", () => void this.read(), "
|
|
64
|
+
this.#runtime.on("window.state", () => void this.read(), "held", true);
|
|
33
65
|
void this.read();
|
|
34
66
|
}
|
|
35
67
|
watch(listener) {
|
|
@@ -56,45 +88,42 @@ export class LayoutService {
|
|
|
56
88
|
const raw = await this.#runtime.host.layout.state().catch(() => null);
|
|
57
89
|
if (!raw)
|
|
58
90
|
continue;
|
|
59
|
-
|
|
60
|
-
preferred: slot.preferred,
|
|
61
|
-
effective: slot.effective,
|
|
62
|
-
reason: slot.reason,
|
|
63
|
-
detached: slot.detached,
|
|
64
|
-
};
|
|
65
|
-
const tabs = (slot) => slot?.panels
|
|
66
|
-
? Object.freeze(slot.panels.map((panel) => Object.freeze({
|
|
67
|
-
plugin: panel.plugin,
|
|
68
|
-
title: panel.title,
|
|
69
|
-
active: panel.owner === slot.owner,
|
|
70
|
-
})))
|
|
71
|
-
: null;
|
|
72
|
-
const adjust = raw.adjust ?? null;
|
|
73
|
-
const next = {
|
|
74
|
-
bottom: view(raw.bottom),
|
|
75
|
-
sidebar: view(raw.sidebar),
|
|
76
|
-
adjust: view(adjust),
|
|
77
|
-
tabs: {
|
|
78
|
-
bottom: tabs(raw.bottom),
|
|
79
|
-
sidebar: tabs(raw.sidebar),
|
|
80
|
-
adjust: tabs(adjust),
|
|
81
|
-
},
|
|
82
|
-
backdrop: raw.backdrop
|
|
83
|
-
? Object.freeze({ effective: raw.backdrop.effective === true })
|
|
84
|
-
: null,
|
|
85
|
-
};
|
|
86
|
-
if (JSON.stringify(next) === JSON.stringify(this.state))
|
|
87
|
-
continue;
|
|
88
|
-
this.state = next;
|
|
89
|
-
for (const listener of [...this.#listeners])
|
|
90
|
-
listener(next);
|
|
91
|
-
this.#runtime.invalidate();
|
|
91
|
+
this.#accept(layoutOfWire(raw));
|
|
92
92
|
} while (this.#again);
|
|
93
93
|
}
|
|
94
94
|
finally {
|
|
95
95
|
this.#reading = false;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
+
#accept(next) {
|
|
99
|
+
if (JSON.stringify(next) === JSON.stringify(this.state))
|
|
100
|
+
return;
|
|
101
|
+
this.state = next;
|
|
102
|
+
for (const listener of [...this.#listeners])
|
|
103
|
+
listener(next);
|
|
104
|
+
this.#runtime.invalidate();
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* `layout.changed`'s data (SDK 1.11.0): the copy takes it first when it
|
|
108
|
+
* is in use; the listener gets `{ slots }`.
|
|
109
|
+
*/
|
|
110
|
+
event(raw) {
|
|
111
|
+
const next = layoutOfWire(raw);
|
|
112
|
+
if (this.#started)
|
|
113
|
+
this.#accept(next);
|
|
114
|
+
const position = (name) => {
|
|
115
|
+
const slot = next[name];
|
|
116
|
+
return slot && Object.freeze({ ...slot, panels: next.tabs[name] ?? [] });
|
|
117
|
+
};
|
|
118
|
+
return {
|
|
119
|
+
slots: Object.freeze({
|
|
120
|
+
bottom: position("bottom"),
|
|
121
|
+
sidebar: position("sidebar"),
|
|
122
|
+
adjust: position("adjust"),
|
|
123
|
+
backdrop: next.backdrop,
|
|
124
|
+
}),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
98
127
|
async set(slot, change) {
|
|
99
128
|
this.start();
|
|
100
129
|
await this.#runtime.host.layout.set({ slot, ...change });
|
package/dist/plugin/window.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ import type { WindowFacts } from "../wire.ts";
|
|
|
4
4
|
import type { MainWindow, WindowState } from "./types.ts";
|
|
5
5
|
/**
|
|
6
6
|
* One per plugin: read before activation, then kept current from
|
|
7
|
-
* `window.state` events
|
|
7
|
+
* `window.state` events while something holds them (`onChange`, a
|
|
8
|
+
* `window.state` listener), from `window.changed`, and after this
|
|
9
|
+
* plugin's own changes.
|
|
8
10
|
*/
|
|
9
11
|
export declare class WindowService {
|
|
10
12
|
#private;
|
|
@@ -27,5 +29,11 @@ export declare class WindowService {
|
|
|
27
29
|
dispose: () => Promise<void>;
|
|
28
30
|
};
|
|
29
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* `window.changed`'s data as the listener gets it (`ScopeImpl.fact`,
|
|
34
|
+
* SDK 1.11.0): the copy takes the facts first, so `plugin.window.state`
|
|
35
|
+
* holds them when the listener runs.
|
|
36
|
+
*/
|
|
37
|
+
export declare function windowChanged(runtime: Runtime, data: unknown): WindowState;
|
|
30
38
|
export declare const windowOf: (runtime: Runtime) => WindowService;
|
|
31
39
|
export declare function mainWindow(scope: ScopeImpl): MainWindow;
|
package/dist/plugin/window.js
CHANGED
|
@@ -15,7 +15,9 @@ const view = (facts) => Object.freeze({
|
|
|
15
15
|
});
|
|
16
16
|
/**
|
|
17
17
|
* One per plugin: read before activation, then kept current from
|
|
18
|
-
* `window.state` events
|
|
18
|
+
* `window.state` events while something holds them (`onChange`, a
|
|
19
|
+
* `window.state` listener), from `window.changed`, and after this
|
|
20
|
+
* plugin's own changes.
|
|
19
21
|
*/
|
|
20
22
|
export class WindowService {
|
|
21
23
|
#runtime;
|
|
@@ -50,7 +52,7 @@ export class WindowService {
|
|
|
50
52
|
this.accept(facts);
|
|
51
53
|
else
|
|
52
54
|
void this.read();
|
|
53
|
-
}, "
|
|
55
|
+
}, "held", true);
|
|
54
56
|
void this.read();
|
|
55
57
|
}
|
|
56
58
|
/** The palette, as the `window.state` reply carried it (`plugin.appearance`). */
|
|
@@ -99,6 +101,16 @@ export class WindowService {
|
|
|
99
101
|
};
|
|
100
102
|
}
|
|
101
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* `window.changed`'s data as the listener gets it (`ScopeImpl.fact`,
|
|
106
|
+
* SDK 1.11.0): the copy takes the facts first, so `plugin.window.state`
|
|
107
|
+
* holds them when the listener runs.
|
|
108
|
+
*/
|
|
109
|
+
export function windowChanged(runtime, data) {
|
|
110
|
+
const facts = data;
|
|
111
|
+
windowOf(runtime).accept(facts);
|
|
112
|
+
return view(facts);
|
|
113
|
+
}
|
|
102
114
|
export const windowOf = (runtime) => runtime.service("window", () => new WindowService(runtime));
|
|
103
115
|
export function mainWindow(scope) {
|
|
104
116
|
const service = () => windowOf(scope.runtime);
|
package/dist/processing.d.ts
CHANGED
|
@@ -13,8 +13,8 @@ import type { Transport } from "./wire.ts";
|
|
|
13
13
|
* The video plays a little brighter and more saturated, slightly sharper
|
|
14
14
|
* and turned a quarter clockwise. The nodes run in array order; `set` sends
|
|
15
15
|
* the whole chain as this plugin's desired value (last write wins), and the
|
|
16
|
-
* player applies it to every source until it changes
|
|
17
|
-
*
|
|
16
|
+
* player applies it to every source until it changes (the chain follows
|
|
17
|
+
* the source by itself while it is set).
|
|
18
18
|
* ```ts
|
|
19
19
|
* const chain: VideoNode[] = [
|
|
20
20
|
* // Live fields: moving them later changes the picture in place.
|
package/dist/request-queue.d.ts
CHANGED
|
@@ -58,9 +58,13 @@ export declare class RequestQueue {
|
|
|
58
58
|
get waiting(): number;
|
|
59
59
|
request<T>(method: string, params?: Json, options?: RequestOptions): Promise<T>;
|
|
60
60
|
/**
|
|
61
|
-
* The plugin stops
|
|
62
|
-
* the runner gives the requests in
|
|
63
|
-
*
|
|
61
|
+
* The plugin stops (the player sent `runtime.stop`): every waiting
|
|
62
|
+
* request rejects with `error` (the one the runner gives the requests in
|
|
63
|
+
* flight), and every later one is refused here with `disabled`, neither
|
|
64
|
+
* sent nor queued: after `runtime.stop` the player has let go of the
|
|
65
|
+
* plugin and would drop it unanswered (it undoes what the plugin held by
|
|
66
|
+
* itself), so the plugin's cleanup and a late write (a debounced setting,
|
|
67
|
+
* a settings page's last patch) learn at once that it was not sent.
|
|
64
68
|
*/
|
|
65
69
|
close(error?: Error): void;
|
|
66
70
|
}
|
package/dist/request-queue.js
CHANGED
|
@@ -73,6 +73,13 @@ function lineBytes(method, params) {
|
|
|
73
73
|
return undefined;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* The refusal of a request made after the plugin received `runtime.stop`
|
|
78
|
+
* (`RequestQueue.close`).
|
|
79
|
+
*/
|
|
80
|
+
function stopped(method) {
|
|
81
|
+
return new HostError("disabled", `${method} not sent: the plugin is stopping (the player sent runtime.stop)`);
|
|
82
|
+
}
|
|
76
83
|
/** The transport behind a per-plugin limit of requests in flight. */
|
|
77
84
|
export class RequestQueue {
|
|
78
85
|
#transport;
|
|
@@ -84,7 +91,10 @@ export class RequestQueue {
|
|
|
84
91
|
#waiting = [];
|
|
85
92
|
#head = 0;
|
|
86
93
|
#count = 0;
|
|
87
|
-
/**
|
|
94
|
+
/**
|
|
95
|
+
* Set by `close` (the player sent `runtime.stop`): later requests are
|
|
96
|
+
* refused here, never sent nor queued.
|
|
97
|
+
*/
|
|
88
98
|
#closed = false;
|
|
89
99
|
/** The most in flight at once (the SDK's own tests). */
|
|
90
100
|
peak = 0;
|
|
@@ -104,7 +114,7 @@ export class RequestQueue {
|
|
|
104
114
|
request(method, params, options) {
|
|
105
115
|
const signal = options?.signal;
|
|
106
116
|
if (this.#closed)
|
|
107
|
-
return
|
|
117
|
+
return Promise.reject(stopped(method));
|
|
108
118
|
if (signal?.aborted)
|
|
109
119
|
return Promise.reject(abortError());
|
|
110
120
|
const line = lineBytes(method, params);
|
|
@@ -141,9 +151,13 @@ export class RequestQueue {
|
|
|
141
151
|
});
|
|
142
152
|
}
|
|
143
153
|
/**
|
|
144
|
-
* The plugin stops
|
|
145
|
-
* the runner gives the requests in
|
|
146
|
-
*
|
|
154
|
+
* The plugin stops (the player sent `runtime.stop`): every waiting
|
|
155
|
+
* request rejects with `error` (the one the runner gives the requests in
|
|
156
|
+
* flight), and every later one is refused here with `disabled`, neither
|
|
157
|
+
* sent nor queued: after `runtime.stop` the player has let go of the
|
|
158
|
+
* plugin and would drop it unanswered (it undoes what the plugin held by
|
|
159
|
+
* itself), so the plugin's cleanup and a late write (a debounced setting,
|
|
160
|
+
* a settings page's last patch) learn at once that it was not sent.
|
|
147
161
|
*/
|
|
148
162
|
close(error = new HostError("disabled", "plugin stopped")) {
|
|
149
163
|
if (this.#closed)
|
package/dist/ts-plugin.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The TypeScript language-service plugin `@vestra-player/sdk/ts-plugin`.
|
|
3
|
-
* Up to 1.8 it showed
|
|
4
|
-
* the
|
|
5
|
-
*
|
|
6
|
-
* nothing and is kept only so that a tsconfig.json that lists it
|
|
3
|
+
* Up to 1.8 it showed a manifest checker's findings in the editor. SDK 1.9.0
|
|
4
|
+
* removed that checker: the plugin now changes nothing and is kept only so
|
|
5
|
+
* that a tsconfig.json that lists it
|
|
7
6
|
*
|
|
8
7
|
* { "compilerOptions": { "plugins": [{ "name": "@vestra-player/sdk/ts-plugin" }] } }
|
|
9
8
|
*
|
package/dist/ts-plugin.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export default function init(_modules) {
|
|
3
3
|
return {
|
|
4
4
|
create(info) {
|
|
5
|
-
info.project?.projectService?.logger?.info("[@vestra-player/sdk/ts-plugin] does nothing since SDK 1.9.0
|
|
5
|
+
info.project?.projectService?.logger?.info("[@vestra-player/sdk/ts-plugin] does nothing since SDK 1.9.0; remove it from tsconfig.json");
|
|
6
6
|
return info.languageService;
|
|
7
7
|
},
|
|
8
8
|
};
|
package/dist/wire.d.ts
CHANGED
|
@@ -168,7 +168,7 @@ export type PropertyWrite = {
|
|
|
168
168
|
* recovery path (asking the host about the operation again).
|
|
169
169
|
*
|
|
170
170
|
* Common codes: `stale` (the condition no longer holds; nothing was done),
|
|
171
|
-
* `invalid` (bad argument), `missing` (unknown target), `
|
|
171
|
+
* `invalid` (bad argument), `missing` (unknown target), `builtin-only`
|
|
172
172
|
* (a built-in-only request from another plugin), `busy`, `conflict`, `unavailable`, `unsupported`
|
|
173
173
|
* (refused, not executed), `backend` (load or parse failure), `failed`,
|
|
174
174
|
* `timeout`, `aborted`, `limit` (a player limit such as the command count),
|
package/dist/wire.js
CHANGED
|
@@ -25,7 +25,7 @@ export const API_VERSION = "vestra/1";
|
|
|
25
25
|
* recovery path (asking the host about the operation again).
|
|
26
26
|
*
|
|
27
27
|
* Common codes: `stale` (the condition no longer holds; nothing was done),
|
|
28
|
-
* `invalid` (bad argument), `missing` (unknown target), `
|
|
28
|
+
* `invalid` (bad argument), `missing` (unknown target), `builtin-only`
|
|
29
29
|
* (a built-in-only request from another plugin), `busy`, `conflict`, `unavailable`, `unsupported`
|
|
30
30
|
* (refused, not executed), `backend` (load or parse failure), `failed`,
|
|
31
31
|
* `timeout`, `aborted`, `limit` (a player limit such as the command count),
|
package/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Vestra Player SDK
|
|
2
2
|
|
|
3
|
-
> @vestra-player/sdk 1.
|
|
3
|
+
> @vestra-player/sdk 1.11.0-rc.1: write plugins for Vestra Player in TypeScript (plugin API `vestra/1`). A plugin is a folder with `manifest.json` and an entry module whose default export `activate(plugin)` the player calls. The documentation is a tree of short pages read by path, like `go doc`: the same pages and API as https://vestrasys.github.io/vestra-player-sdk/.
|
|
4
4
|
|
|
5
5
|
## Read the documentation
|
|
6
6
|
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
- `/API/Commands`: 26 entries: CommandState, Bindable, Condition, When, PositionRange, TriggerEvent, Trigger, MenuId, BarButtonIcon, CommandButton, CommandOptions, Command, Commands, CommandRunOptions,…
|
|
29
29
|
- `/API/Media`: 12 entries: CaptureOptions, Snapshot, ExportOptions, ExportEncoding, JobState, ExportJob, MediaCapture, SourceReference, MediaSources, ExportPart, PartsExportOptions, ExportCheck
|
|
30
30
|
- `/API/Packages`: 10 entries: PackageManifest, PackageSource, InstallOptions, PackageCandidate, PackageChangeStatus, PackageChange, PluginInfo, PluginDisplay, PluginWarning, Packages
|
|
31
|
-
- `/API/Playback`:
|
|
31
|
+
- `/API/Playback`: 41 entries: CommandKeys, MarkKind, TimelineMark, RangeStyle, TimelineRange, TimelineLayer, Timeline, AudioTrack, PlayerState, AudioDevice, Chapter, Conditional, Media, Scrub, StreamFrame,…
|
|
32
32
|
- `/API/Plugin`: 21 entries: Disposable, PluginError, Scope, Plugin, StopReason, DisposeInfo, WindowState, MainWindow, AppInfo, App, SystemInfo, DisplayInfo, Wire, WireView, WireCommands, WireCommandOptions,…
|
|
33
33
|
- `/API/Processing`: 24 entries: FilterStatus, VideoFilter, AudioFilter, ViewSettings, VideoView, RenderSettings, RenderOptions, VideoShaders, UpscalingReasonCode, UpscalingReason, UpscalingDecodingCause,…
|
|
34
34
|
- `/API/Services`: 15 entries: Clipboard, Power, ToolResult, Tools, JsonStore, Storage, SessionStorage, System, Secrets, RenderingMode, RenderingPreference, RenderingReasonCode, RenderingReason, RenderingState,…
|
|
35
35
|
- `/API/Sources`: 7 entries: ResolverOptions, WebResolverOptions, FileResolverOptions, ResolvedStream, Resolver, Resolvers, ResolvedMedia
|
|
36
36
|
- `/API/Subtitles`: 5 entries: SubtitleTrack, SubtitlesState, SubtitleConditional, Subtitles, SubtitleStyle
|
|
37
|
-
- `/API/UI`:
|
|
37
|
+
- `/API/UI`: 45 entries: ImageRef, ImageOptions, MarkdownRef, MarkdownOptions, PropValue, PropData, Props, Ui, View, Window, Windows, SlotState, LayoutPosition, SlotPanel, PanelState, PanelSlot, SidebarSlot,…
|
|
38
38
|
- `/API/Testing`: 34 entries: COMMAND_LIMITS, MENU_IDS, BAR_BUTTON_ICONS, BAR_BUTTON_LIMITS, BuiltinSubmenu, BUILTIN_SUBMENUS, BuiltinCommand, BUILTIN_COMMANDS, LOCALES, LIST_SEPARATORS, TEXT_LIMITS, THEME_PALETTES,…
|
|
39
39
|
- `/API/Docs`: 4 entries: DOCS_PAGE_BYTES, DocsOptions, docs, searchDocs
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vestra-player/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0-rc.1",
|
|
4
4
|
"description": "Plugin API types, test host and plugin CLI for Vestra Player (apiVersion vestra/1)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"default": "./ts-plugin/index.js"
|
|
34
34
|
},
|
|
35
35
|
"./llms.txt": "./llms.txt",
|
|
36
|
-
"./capability-scan.json": "./capability-scan.json",
|
|
37
36
|
"./package.json": "./package.json"
|
|
38
37
|
},
|
|
39
38
|
"bin": {
|
|
@@ -47,8 +46,7 @@
|
|
|
47
46
|
"README.md",
|
|
48
47
|
"CHANGELOG.md",
|
|
49
48
|
"LICENSE",
|
|
50
|
-
"llms.txt"
|
|
51
|
-
"capability-scan.json"
|
|
49
|
+
"llms.txt"
|
|
52
50
|
],
|
|
53
51
|
"scripts": {
|
|
54
52
|
"api-surface": "node scripts/api-surface.mjs",
|