@vestra-player/sdk 1.6.21 → 1.7.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 +55 -0
- package/bin/vestra-plugin.mjs +34 -12
- package/dist/api-requests.d.ts +22 -0
- package/dist/api-requests.js +38 -0
- package/dist/capability-check.d.ts +48 -0
- package/dist/capability-check.js +219 -51
- package/dist/capability-rules.d.ts +21 -0
- package/dist/capability-rules.js +32 -1
- package/dist/commands.d.ts +9 -1
- package/dist/commands.js +8 -8
- package/dist/docs-tree.json.gz +0 -0
- package/dist/plugin/commands.js +43 -13
- package/dist/plugin/connection.d.ts +37 -0
- package/dist/plugin/connection.js +34 -0
- package/dist/plugin/index.js +12 -2
- package/dist/plugin/media.js +3 -1
- package/dist/plugin/packages.js +3 -1
- package/dist/plugin/passes.d.ts +38 -1
- package/dist/plugin/passes.js +89 -5
- package/dist/plugin/player/events.d.ts +9 -0
- package/dist/plugin/player/events.js +43 -0
- package/dist/plugin/player/rules.d.ts +7 -0
- package/dist/plugin/player/rules.js +11 -0
- package/dist/plugin/player.d.ts +37 -4
- package/dist/plugin/player.js +85 -12
- package/dist/plugin/resolvers.js +2 -3
- package/dist/plugin/runtime.d.ts +2 -3
- package/dist/plugin/runtime.js +8 -2
- package/dist/plugin/scope.d.ts +9 -0
- package/dist/plugin/scope.js +24 -0
- package/dist/plugin/services.js +4 -5
- package/dist/plugin/state.d.ts +3 -0
- package/dist/plugin/state.js +81 -0
- package/dist/plugin/stream.d.ts +27 -3
- package/dist/plugin/testing/commands.js +3 -3
- package/dist/plugin/testing/core-actions.js +1 -1
- package/dist/plugin/testing/services.js +1 -1
- package/dist/plugin/types/base.d.ts +78 -2
- package/dist/plugin/types/commands.d.ts +17 -1
- package/dist/plugin/types/playback.d.ts +156 -1
- package/dist/plugin/types/plugin-wire.d.ts +589 -0
- package/dist/plugin/types/plugin-wire.js +1 -0
- package/dist/plugin/types/ui-content.d.ts +23 -4
- package/dist/plugin/types/ui-layout.d.ts +1 -1
- package/dist/plugin/types/ui-shell.d.ts +4 -3
- package/dist/plugin/types.d.ts +4 -2
- package/dist/plugin/view/base.d.ts +10 -3
- package/dist/plugin/view/base.js +30 -6
- package/dist/plugin/view/binder.js +8 -1
- package/dist/plugin/view/writer.d.ts +49 -4
- package/dist/plugin/view/writer.js +383 -17
- package/dist/plugin/wire-facade.d.ts +4 -0
- package/dist/plugin/wire-facade.js +190 -0
- package/dist/ts-plugin.d.ts +3 -0
- package/dist/ts-plugin.js +18 -6
- package/dist/wire.d.ts +233 -20
- package/llms.txt +3 -3
- package/package.json +1 -1
- package/slint/vestra/focus.slint +33 -0
|
@@ -381,6 +381,7 @@ export interface Panels {
|
|
|
381
381
|
* after 0.4.0): each panel is a tab, labelled `title` (else the plugin's
|
|
382
382
|
* name), and the player draws a 31px tab strip above the current one
|
|
383
383
|
* while there are two or more (with one panel, nothing changes).
|
|
384
|
+
* Before player 0.7.3 a ninth tab was refused with `conflict`.
|
|
384
385
|
* Showing, hiding and detaching apply to the whole sidebar. If the
|
|
385
386
|
* bridge global declares `in property <bool> tabbed`, the player sets
|
|
386
387
|
* it to `true` while it draws the strip, so a panel with a tab strip of
|
|
@@ -412,9 +413,9 @@ export interface Panels {
|
|
|
412
413
|
* rightmost), 317 wide by default, 280 to half the window, with text tabs
|
|
413
414
|
* and the key that opens each tab under its title (the key of the command
|
|
414
415
|
* your other commands name as their {@link CommandOptions.home | home}). It
|
|
415
|
-
* has no close or detach button:
|
|
416
|
-
*
|
|
417
|
-
* it. It starts closed. In a window too narrow to dock it beside a video at
|
|
416
|
+
* has no close or detach button: Adjustments and Effects (`host/adjust`,
|
|
417
|
+
* a menu item and the bottom bar's sliders button), your panel's own
|
|
418
|
+
* command ({@link Panel.toggle}) and the menus open and close it. It starts closed. In a window too narrow to dock it beside a video at
|
|
418
419
|
* least 480 wide, it floats over the right of the video, 300 wide; in
|
|
419
420
|
* fullscreen it slides out from the right edge, left of the sidebar. Its
|
|
420
421
|
* width, open state, current tab and tab order are remembered across
|
package/dist/plugin/types.d.ts
CHANGED
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
* and are re-exported here with `export type *`: this module exports the
|
|
14
14
|
* same names as before the split.
|
|
15
15
|
*/
|
|
16
|
-
import type { Json } from "../wire.ts";
|
|
16
|
+
import type { Json, PackageInfo, PropertyWrite, RowOp, WindowFacts, WireMark, WireRange, WireRenderingReason, WireSource, WireTimeline, WireUpscalingReason, WireUpscalingState } from "../wire.ts";
|
|
17
|
+
import type { CommandKeys } from "../commands.ts";
|
|
17
18
|
import type { AudioNode, ConvolutionPlane, VideoNode } from "../processing.ts";
|
|
18
19
|
import type { SubtitleStyle } from "../subtitles.ts";
|
|
19
20
|
import type { ResolvedMedia } from "../source-resolvers.ts";
|
|
20
|
-
export type { Json, AudioNode, ConvolutionPlane, VideoNode, SubtitleStyle, ResolvedMedia, };
|
|
21
|
+
export type { Json, PropertyWrite, RowOp, AudioNode, ConvolutionPlane, VideoNode, SubtitleStyle, ResolvedMedia, CommandKeys, PackageInfo, WindowFacts, WireMark, WireRange, WireRenderingReason, WireSource, WireTimeline, WireUpscalingReason, WireUpscalingState, };
|
|
21
22
|
export type * from "./types/base.ts";
|
|
22
23
|
export type * from "./types/commands.ts";
|
|
23
24
|
export type * from "./types/ui-content.ts";
|
|
@@ -31,3 +32,4 @@ export type * from "./types/snapshots.ts";
|
|
|
31
32
|
export type * from "./types/sources.ts";
|
|
32
33
|
export type * from "./types/packages.ts";
|
|
33
34
|
export type * from "./types/services.ts";
|
|
35
|
+
export type * from "./types/plugin-wire.ts";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Json, PropertyWrite } from "../../wire.ts";
|
|
2
2
|
import type { ScopeImpl } from "../scope.ts";
|
|
3
|
-
import type {
|
|
3
|
+
import type { PropValue, Props, View } from "../types.ts";
|
|
4
|
+
import { DIRECT } from "./writer.ts";
|
|
5
|
+
import type { DirectWrites } from "./writer.ts";
|
|
4
6
|
/** Property and callback plumbing shared by windows, panels and settings pages. */
|
|
5
7
|
export declare abstract class ViewBase implements View {
|
|
6
8
|
#private;
|
|
@@ -12,9 +14,14 @@ export declare abstract class ViewBase implements View {
|
|
|
12
14
|
protected abstract write(property: string, write: PropertyWrite): Promise<void>;
|
|
13
15
|
/** {@link ViewWriter.wired}: initial properties in wire form. */
|
|
14
16
|
protected wired(values: Record<string, PropValue>, refuse?: boolean): Record<string, Json>;
|
|
15
|
-
on<A extends Json[]>(callback: string, handler: (...args: A) => unknown): Disposable;
|
|
17
|
+
on<A extends Json[]>(callback: string, handler: (...args: A) => unknown): import("../types.ts").Disposable;
|
|
16
18
|
set(props: Props): void;
|
|
17
|
-
bind(props: () => Props): Disposable;
|
|
19
|
+
bind(props: () => Props): import("../types.ts").Disposable;
|
|
20
|
+
/**
|
|
21
|
+
* `plugin.wire.view(v)` (SDK 1.7.0): the writer's direct writes, for a
|
|
22
|
+
* scope of the plugin that made this view.
|
|
23
|
+
*/
|
|
24
|
+
[DIRECT](scope: ScopeImpl): DirectWrites;
|
|
18
25
|
/** {@link ViewBinder.snapshot}: current desired properties. */
|
|
19
26
|
protected snapshot(): Record<string, PropValue>;
|
|
20
27
|
protected evaluate(): void;
|
package/dist/plugin/view/base.js
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `ViewBase`: what windows, panels and settings pages share — callbacks, and
|
|
3
|
-
* a {@link ViewWriter} (L1) with a {@link ViewBinder} (L2) over it.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* a {@link ViewWriter} (L1) with a {@link ViewBinder} (L2) over it. A view
|
|
4
|
+
* joins the update passes on its first `bind()` (SDK 1.7.0,
|
|
5
|
+
* doc/specs/sdk-refactor.md §4 Step 2 in the player repository); until
|
|
6
|
+
* then `set()` goes straight to the writer, which sends whole values and
|
|
7
|
+
* keeps no row-patch bases for it.
|
|
6
8
|
*/
|
|
7
9
|
import { readFileSync } from "node:fs";
|
|
8
10
|
import { resolve } from "node:path";
|
|
11
|
+
import { failure } from "../errors.js";
|
|
9
12
|
import { PATCH_FEATURE } from "../patch.js";
|
|
10
13
|
import { ViewBinder } from "./binder.js";
|
|
11
|
-
import { kebab, ViewWriter } from "./writer.js";
|
|
14
|
+
import { DIRECT, kebab, ViewWriter } from "./writer.js";
|
|
12
15
|
/** Property and callback plumbing shared by windows, panels and settings pages. */
|
|
13
16
|
export class ViewBase {
|
|
14
17
|
scope;
|
|
15
18
|
handlers = new Map();
|
|
16
19
|
#writer;
|
|
17
20
|
#binder;
|
|
21
|
+
/** Its place in the update passes, from the first `bind()` on. */
|
|
18
22
|
#binding;
|
|
23
|
+
/** Its place in the order of evaluation, kept from when it was made. */
|
|
24
|
+
#slot;
|
|
19
25
|
closed = false;
|
|
20
26
|
constructor(scope) {
|
|
21
27
|
this.scope = scope;
|
|
@@ -26,7 +32,7 @@ export class ViewBase {
|
|
|
26
32
|
patches: () => this.scope.runtime.features.has(PATCH_FEATURE),
|
|
27
33
|
});
|
|
28
34
|
this.#binder = new ViewBinder(scope, this.#writer, () => this.closed);
|
|
29
|
-
this.#
|
|
35
|
+
this.#slot = scope.runtime.passes.slot();
|
|
30
36
|
}
|
|
31
37
|
/** {@link ViewWriter.wired}: initial properties in wire form. */
|
|
32
38
|
wired(values, refuse = false) {
|
|
@@ -44,8 +50,26 @@ export class ViewBase {
|
|
|
44
50
|
this.#writer.set(props);
|
|
45
51
|
}
|
|
46
52
|
bind(props) {
|
|
53
|
+
if (!this.#binding && !this.closed) {
|
|
54
|
+
// The first bind: the view takes part in the update passes, and its
|
|
55
|
+
// writer compares and patches from now on.
|
|
56
|
+
this.#writer.track();
|
|
57
|
+
this.#binding = this.scope.runtime.bind(() => this.evaluate(), this.#slot);
|
|
58
|
+
}
|
|
47
59
|
return this.#binder.bind(props);
|
|
48
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* `plugin.wire.view(v)` (SDK 1.7.0): the writer's direct writes, for a
|
|
63
|
+
* scope of the plugin that made this view.
|
|
64
|
+
*/
|
|
65
|
+
[DIRECT](scope) {
|
|
66
|
+
if (scope.runtime !== this.scope.runtime)
|
|
67
|
+
throw failure("invalid", "view takes a window, panel or settings page of this plugin");
|
|
68
|
+
return {
|
|
69
|
+
write: (property, write) => this.#writer.direct(property, write),
|
|
70
|
+
writeRows: (property, ops) => this.#writer.directRows(property, ops),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
49
73
|
/** {@link ViewBinder.snapshot}: current desired properties. */
|
|
50
74
|
snapshot() {
|
|
51
75
|
return this.#binder.snapshot();
|
|
@@ -73,7 +97,7 @@ export class ViewBase {
|
|
|
73
97
|
async release() {
|
|
74
98
|
this.closed = true;
|
|
75
99
|
this.#writer.stop();
|
|
76
|
-
await this.#binding
|
|
100
|
+
await this.#binding?.dispose();
|
|
77
101
|
}
|
|
78
102
|
}
|
|
79
103
|
/** Find `export component X` / `export global Y` so most mounts need no names. */
|
|
@@ -39,7 +39,14 @@ export class ViewBinder {
|
|
|
39
39
|
if (!result)
|
|
40
40
|
continue;
|
|
41
41
|
for (const [key, value] of Object.entries(result.value))
|
|
42
|
-
|
|
42
|
+
try {
|
|
43
|
+
this.#writer.assign(key, value);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
// A property written directly (`plugin.wire.view`): reported
|
|
47
|
+
// once, the binding's other values still count.
|
|
48
|
+
this.#scope.report(error);
|
|
49
|
+
}
|
|
43
50
|
}
|
|
44
51
|
catch (error) {
|
|
45
52
|
this.#scope.report(error);
|
|
@@ -1,10 +1,24 @@
|
|
|
1
|
-
import type { Json, PropertyWrite } from "../../wire.ts";
|
|
1
|
+
import type { Json, PropertyWrite, RowOp } from "../../wire.ts";
|
|
2
2
|
import type { PropValue, Props } from "../types.ts";
|
|
3
3
|
/** Slint names are kebab-case; plugin code may use camelCase. */
|
|
4
4
|
export declare const kebab: (name: string) => string;
|
|
5
5
|
export declare const encode: (props: Props) => {
|
|
6
6
|
[k: string]: PropValue;
|
|
7
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* How `plugin.wire.view(v)` (`wire-facade.ts`) reaches a view's writer
|
|
10
|
+
* without importing the view classes (which load the binder): a view
|
|
11
|
+
* answers this key with its {@link DirectWrites}, given a scope of the
|
|
12
|
+
* plugin that made it.
|
|
13
|
+
*/
|
|
14
|
+
export declare const DIRECT: unique symbol;
|
|
15
|
+
/** A view's direct writes, as `plugin.wire.view(v)` hands them out. */
|
|
16
|
+
export interface DirectWrites {
|
|
17
|
+
write(property: string, write: PropertyWrite): Promise<boolean>;
|
|
18
|
+
writeRows(property: string, ops: readonly RowOp[]): Promise<boolean>;
|
|
19
|
+
}
|
|
20
|
+
/** The message of a write on the other track of a property. */
|
|
21
|
+
export declare const bothTracks: (property: string, written: boolean) => string;
|
|
8
22
|
/** Where a {@link ViewWriter}'s writes go, and what it asks of its view. */
|
|
9
23
|
export interface WriterTarget {
|
|
10
24
|
/** The view shows its properties: writes may be sent. */
|
|
@@ -23,6 +37,12 @@ export interface WriterTarget {
|
|
|
23
37
|
export declare class ViewWriter {
|
|
24
38
|
#private;
|
|
25
39
|
constructor(target: WriterTarget);
|
|
40
|
+
/**
|
|
41
|
+
* The view's first `bind()`: compare and patch from now on. What was
|
|
42
|
+
* sent before is known as whole values, so the first patchable write of
|
|
43
|
+
* an array goes whole and patches follow it.
|
|
44
|
+
*/
|
|
45
|
+
track(): void;
|
|
26
46
|
/**
|
|
27
47
|
* Initial properties in wire form. A released image is left out (the
|
|
28
48
|
* property keeps its default) and reported, like a failed write. With a
|
|
@@ -34,10 +54,35 @@ export declare class ViewWriter {
|
|
|
34
54
|
* with `refuse` (a window's `show`), thrown.
|
|
35
55
|
*/
|
|
36
56
|
wired(values: Record<string, PropValue>, refuse?: boolean): Record<string, Json>;
|
|
37
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* `View.set`: each value is sent once even if equal to what was sent. A
|
|
59
|
+
* property written directly is refused (`invalid`), before anything is
|
|
60
|
+
* kept.
|
|
61
|
+
*/
|
|
38
62
|
set(props: Props): void;
|
|
39
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* A bound value (Slint name): sent by the next flush if it changed. A
|
|
65
|
+
* property written directly is refused (`invalid`, the first time; the
|
|
66
|
+
* binder reports it) and the value is never kept.
|
|
67
|
+
*/
|
|
40
68
|
assign(key: string, value: PropValue): void;
|
|
69
|
+
/**
|
|
70
|
+
* `plugin.wire.view(v).write`: one property's `PropertyWrite`, sent as
|
|
71
|
+
* given after the property's earlier direct writes (a whole value drops
|
|
72
|
+
* those still waiting, which resolve `false`). With a player that takes
|
|
73
|
+
* row patches, a whole value without `seq` gets one, so that row
|
|
74
|
+
* operations can follow it, and an array larger than one request goes in
|
|
75
|
+
* parts (`more`). The property is marked: `set()` and `bind()` refuse it
|
|
76
|
+
* from now on. Rejects with `unavailable` while the view does not show.
|
|
77
|
+
*/
|
|
78
|
+
direct(property: string, write: PropertyWrite): Promise<boolean>;
|
|
79
|
+
/**
|
|
80
|
+
* `plugin.wire.view(v).writeRows`: row operations on the property's last
|
|
81
|
+
* direct write (or on its initial value), in as many patches as one
|
|
82
|
+
* request carries, each applying on the one before. Needs a player that
|
|
83
|
+
* takes row patches (`unsupported` otherwise).
|
|
84
|
+
*/
|
|
85
|
+
directRows(property: string, ops: readonly RowOp[]): Promise<boolean>;
|
|
41
86
|
/** Every property's value now, by Slint name. */
|
|
42
87
|
values(): Record<string, PropValue>;
|
|
43
88
|
/** The host already shows these values (e.g. sent as initial properties). */
|
|
@@ -53,6 +98,6 @@ export declare class ViewWriter {
|
|
|
53
98
|
* a broken view cannot spin.
|
|
54
99
|
*/
|
|
55
100
|
flush(): void;
|
|
56
|
-
/** The view closed: no retry after a back-off. */
|
|
101
|
+
/** The view closed: no retry after a back-off, no direct write waiting. */
|
|
57
102
|
stop(): void;
|
|
58
103
|
}
|