@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.
Files changed (96) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/README.md +2 -2
  3. package/bin/vestra-plugin.mjs +139 -100
  4. package/capability-scan.json +369 -0
  5. package/dist/api-requests.d.ts +11 -36
  6. package/dist/api-requests.js +22 -47
  7. package/dist/capability-scan.d.ts +95 -0
  8. package/dist/capability-scan.js +249 -0
  9. package/dist/commands.d.ts +35 -0
  10. package/dist/commands.js +42 -1
  11. package/dist/docs-tree.json.gz +0 -0
  12. package/dist/docs.d.ts +1 -1
  13. package/dist/docs.js +1 -1
  14. package/dist/index.d.ts +4 -5
  15. package/dist/manifest.d.ts +5 -0
  16. package/dist/manifest.js +9 -24
  17. package/dist/member-uses.d.ts +61 -0
  18. package/dist/member-uses.js +160 -0
  19. package/dist/mpv.d.ts +139 -0
  20. package/dist/mpv.js +496 -0
  21. package/dist/player-runtime.d.ts +3 -3
  22. package/dist/player-runtime.js +3 -3
  23. package/dist/plugin/appearance.d.ts +1 -1
  24. package/dist/plugin/appearance.js +2 -2
  25. package/dist/plugin/bindings.d.ts +1 -1
  26. package/dist/plugin/bindings.js +2 -2
  27. package/dist/plugin/commands.js +6 -14
  28. package/dist/plugin/connection.d.ts +26 -7
  29. package/dist/plugin/connection.js +68 -36
  30. package/dist/plugin/drops.js +1 -1
  31. package/dist/plugin/index.js +9 -15
  32. package/dist/plugin/media.js +0 -12
  33. package/dist/plugin/mpv.d.ts +3 -0
  34. package/dist/plugin/mpv.js +91 -0
  35. package/dist/plugin/packages.js +1 -2
  36. package/dist/plugin/player/events.d.ts +4 -3
  37. package/dist/plugin/player/events.js +7 -6
  38. package/dist/plugin/player.d.ts +21 -13
  39. package/dist/plugin/player.js +56 -21
  40. package/dist/plugin/scope.d.ts +1 -0
  41. package/dist/plugin/scope.js +2 -0
  42. package/dist/plugin/services.d.ts +4 -4
  43. package/dist/plugin/services.js +7 -29
  44. package/dist/plugin/settings.js +1 -1
  45. package/dist/plugin/shaders.js +0 -2
  46. package/dist/plugin/stream.d.ts +2 -1
  47. package/dist/plugin/stream.js +2 -2
  48. package/dist/plugin/testing/commands.d.ts +3 -10
  49. package/dist/plugin/testing/commands.js +43 -24
  50. package/dist/plugin/testing/index.d.ts +75 -114
  51. package/dist/plugin/testing/index.js +83 -102
  52. package/dist/plugin/testing/mpv.d.ts +7 -0
  53. package/dist/plugin/testing/mpv.js +90 -0
  54. package/dist/plugin/testing/processing.js +1 -1
  55. package/dist/plugin/testing/services.js +0 -1
  56. package/dist/plugin/timeline.d.ts +2 -3
  57. package/dist/plugin/timeline.js +4 -8
  58. package/dist/plugin/types/base.d.ts +49 -88
  59. package/dist/plugin/types/commands.d.ts +44 -77
  60. package/dist/plugin/types/packages.d.ts +17 -55
  61. package/dist/plugin/types/playback.d.ts +302 -135
  62. package/dist/plugin/types/plugin-wire.d.ts +6 -36
  63. package/dist/plugin/types/processing.d.ts +10 -49
  64. package/dist/plugin/types/services.d.ts +11 -70
  65. package/dist/plugin/types/snapshots.d.ts +7 -60
  66. package/dist/plugin/types/sources.d.ts +2 -11
  67. package/dist/plugin/types/subtitles.d.ts +5 -26
  68. package/dist/plugin/types/ui-content.d.ts +1 -16
  69. package/dist/plugin/types/ui-layout.d.ts +53 -79
  70. package/dist/plugin/types/ui-locale.d.ts +5 -23
  71. package/dist/plugin/types/ui-shell.d.ts +13 -59
  72. package/dist/plugin/view/layout.js +1 -1
  73. package/dist/plugin/view.js +0 -2
  74. package/dist/plugin/window.d.ts +1 -1
  75. package/dist/plugin/window.js +1 -1
  76. package/dist/plugin/wire-facade.js +1 -2
  77. package/dist/processing.d.ts +2 -3
  78. package/dist/protocol.d.ts +14 -0
  79. package/dist/protocol.js +14 -0
  80. package/dist/request-queue.js +1 -1
  81. package/dist/subtitles.d.ts +1 -1
  82. package/dist/ts-plugin.d.ts +8 -15
  83. package/dist/ts-plugin.js +3 -141
  84. package/dist/wire.d.ts +22 -12
  85. package/dist/wire.js +17 -8
  86. package/llms.txt +5 -5
  87. package/package.json +4 -3
  88. package/slint/vestra/widgets.slint +12 -4
  89. package/dist/capabilities.d.ts +0 -107
  90. package/dist/capabilities.js +0 -69
  91. package/dist/capability-check.d.ts +0 -133
  92. package/dist/capability-check.js +0 -371
  93. package/dist/capability-rules.d.ts +0 -125
  94. package/dist/capability-rules.js +0 -192
  95. package/dist/host-capabilities.d.ts +0 -10
  96. package/dist/host-capabilities.js +0 -477
package/dist/ts-plugin.js CHANGED
@@ -1,147 +1,9 @@
1
- import { addCapabilityEdit, CAPABILITY_DIAGNOSTIC, CAPABILITY_UNCHECKED, checkCapabilities, isPluginSource, } from "./capability-check.js";
2
- const FIX_NAME = "vestraAddCapability";
3
- /** The nearest manifest.json at or above a file, with its capabilities. */
4
- function manifestFor(ts, file) {
5
- let directory = file.replaceAll("\\", "/");
6
- for (;;) {
7
- const parent = directory.slice(0, directory.lastIndexOf("/"));
8
- if (!parent || parent === directory)
9
- return undefined;
10
- directory = parent;
11
- const path = `${directory}/manifest.json`;
12
- if (!ts.sys.fileExists(path))
13
- continue;
14
- try {
15
- const manifest = JSON.parse(ts.sys.readFile(path) ?? "");
16
- if (!Array.isArray(manifest.capabilities))
17
- return undefined;
18
- return {
19
- path,
20
- directory,
21
- capabilities: manifest.capabilities.filter((each) => typeof each === "string"),
22
- };
23
- }
24
- catch {
25
- return undefined;
26
- }
27
- }
28
- }
29
- /**
30
- * The manifest's text for the quick fix. The TypeScript server applies a
31
- * code fix only to files it knows, and editors do not hand it JSON files
32
- * (VS Code does not), so the manifest is made known first; its text is then
33
- * the server's: an open buffer when the editor shares one, else the file on
34
- * disk (VS Code: the saved manifest, not unsaved edits).
35
- */
36
- function manifestText(ts, info, path) {
37
- const service = info.project?.projectService;
38
- const script = service && ts.server?.toNormalizedPath
39
- ? service.getOrCreateScriptInfoForNormalizedPath(ts.server.toNormalizedPath(path), false)
40
- : undefined;
41
- const snapshot = script?.getSnapshot();
42
- return snapshot
43
- ? snapshot.getText(0, snapshot.getLength())
44
- : ts.sys.readFile(path);
45
- }
46
1
  /** @internal The plugin factory tsserver calls (`ts-plugin/index.js`). */
47
- export default function init(modules) {
48
- const ts = modules.typescript;
2
+ export default function init(_modules) {
49
3
  return {
50
4
  create(info) {
51
- const service = info.languageService;
52
- const log = (message) => info.project?.projectService?.logger?.info(`[@vestra-player/sdk/ts-plugin] ${message}`);
53
- const none = { findings: [], unchecked: [] };
54
- const results = (file) => {
55
- const manifest = manifestFor(ts, file);
56
- const program = service.getProgram();
57
- if (!manifest || !program || !isPluginSource(manifest.directory, file))
58
- return none;
59
- try {
60
- return checkCapabilities(ts, program, {
61
- files: [file],
62
- capabilities: manifest.capabilities,
63
- });
64
- }
65
- catch (error) {
66
- log(`check failed: ${error.stack ?? String(error)}`);
67
- return none;
68
- }
69
- };
70
- const findings = (file) => results(file).findings;
71
- const proxy = Object.create(null);
72
- for (const key of Object.keys(service)) {
73
- const member = service[key];
74
- proxy[key] =
75
- typeof member === "function" ? member.bind(service) : member;
76
- }
77
- proxy.getSemanticDiagnostics = (file) => {
78
- const prior = service.getSemanticDiagnostics(file);
79
- const source = service.getProgram()?.getSourceFile(file);
80
- const { findings: missing, unchecked } = results(file);
81
- return [
82
- ...prior,
83
- ...missing.map((finding) => ({
84
- file: source,
85
- start: finding.start,
86
- length: finding.length,
87
- messageText: finding.message,
88
- category: ts.DiagnosticCategory.Error,
89
- code: CAPABILITY_DIAGNOSTIC,
90
- source: "vestra",
91
- })),
92
- ...unchecked.map((call) => ({
93
- file: source,
94
- start: call.start,
95
- length: call.length,
96
- messageText: call.message,
97
- category: ts.DiagnosticCategory.Warning,
98
- code: CAPABILITY_UNCHECKED,
99
- source: "vestra",
100
- })),
101
- ];
102
- };
103
- proxy.getSupportedCodeFixes = (file) => [
104
- ...service.getSupportedCodeFixes(file),
105
- String(CAPABILITY_DIAGNOSTIC),
106
- ];
107
- proxy.getCodeFixesAtPosition = (file, start, end, errorCodes, format, preferences) => {
108
- const prior = service.getCodeFixesAtPosition(file, start, end, errorCodes, format, preferences);
109
- if (!errorCodes.includes(CAPABILITY_DIAGNOSTIC))
110
- return prior;
111
- const manifest = manifestFor(ts, file);
112
- if (!manifest)
113
- return prior;
114
- const text = manifestText(ts, info, manifest.path);
115
- if (text === undefined)
116
- return prior;
117
- const wanted = new Set(findings(file)
118
- .filter((finding) => finding.start <= end && finding.start + finding.length >= start)
119
- .map((finding) => finding.capability));
120
- const fixes = [];
121
- for (const capability of wanted) {
122
- const edit = addCapabilityEdit(ts, text, capability);
123
- if (!edit)
124
- continue;
125
- fixes.push({
126
- fixName: FIX_NAME,
127
- description: `Add '${capability}' to manifest.json`,
128
- changes: [
129
- {
130
- fileName: manifest.path,
131
- textChanges: [
132
- {
133
- span: { start: edit.start, length: edit.length },
134
- newText: edit.newText,
135
- },
136
- ],
137
- },
138
- ],
139
- });
140
- }
141
- return [...prior, ...fixes];
142
- };
143
- log("enabled");
144
- return proxy;
5
+ info.project?.projectService?.logger?.info("[@vestra-player/sdk/ts-plugin] does nothing since SDK 1.9.0 (no manifest capabilities); remove it from tsconfig.json");
6
+ return info.languageService;
145
7
  },
146
8
  };
147
9
  }
package/dist/wire.d.ts CHANGED
@@ -17,7 +17,6 @@ export interface PluginInfo {
17
17
  id: string;
18
18
  apiVersion: string;
19
19
  entry: string;
20
- capabilities: string[];
21
20
  }
22
21
  export interface PackageValidation {
23
22
  token: string;
@@ -170,7 +169,7 @@ export type PropertyWrite = {
170
169
  *
171
170
  * Common codes: `stale` (the condition no longer holds; nothing was done),
172
171
  * `invalid` (bad argument), `missing` (unknown target), `capability`
173
- * (undeclared capability), `busy`, `conflict`, `unavailable`, `unsupported`
172
+ * (a built-in-only request from another plugin), `busy`, `conflict`, `unavailable`, `unsupported`
174
173
  * (refused, not executed), `backend` (load or parse failure), `failed`,
175
174
  * `timeout`, `aborted`, `limit` (a player limit such as the command count),
176
175
  * `disabled` (the plugin is stopping).
@@ -201,7 +200,6 @@ export type PropertyWrite = {
201
200
  * A definite refusal, as opposed to a lost reply: the SDK does not retry
202
201
  * it, and the plugin sees an `Error` with `code`.
203
202
  *
204
- * @capability None.
205
203
  * @since 1.0.0
206
204
  * @category Testing
207
205
  */
@@ -238,8 +236,6 @@ export interface PackageInfo {
238
236
  state: "starting" | "running" | "disabled" | "failed" | "stopped";
239
237
  /** Why it failed, when `state` is `failed`; else `null`. */
240
238
  error: string | null;
241
- /** The capabilities its manifest declares. */
242
- capabilities: string[];
243
239
  /** Its directory on disk. */
244
240
  directory: string;
245
241
  /** One of the player's built-in plugins. */
@@ -436,7 +432,7 @@ export interface WireTimeline {
436
432
  /** The ranges. */
437
433
  ranges?: WireRange[];
438
434
  }
439
- /** A panel position (`ui.mount`'s `slot`). */
435
+ /** A panel position (`ui.mount`'s `slot` parameter). */
440
436
  export type MountSlot = "bottom" | "sidebar" | "backdrop" | "adjust";
441
437
  /** The backdrop as `layout.state` reports it; `null` without one. */
442
438
  export interface LayoutBackdrop {
@@ -782,7 +778,7 @@ export declare function createWire(transport: Transport): {
782
778
  }[]>;
783
779
  set: (id: string | null) => Promise<void>;
784
780
  };
785
- /** The binding table: list, user overlay (`bindings.manage`). */
781
+ /** The binding table: list, user overlay. */
786
782
  bindings: {
787
783
  list: () => Promise<BindingTable>;
788
784
  set: (plugin: string, command: string, inputs: string[]) => Promise<void>;
@@ -791,19 +787,19 @@ export declare function createWire(transport: Transport): {
791
787
  command: string;
792
788
  }) => Promise<void>;
793
789
  };
794
- /** File drops: providers by extension, panel listeners (`ui.drop`). */
790
+ /** File drops: providers by extension, panel listeners. */
795
791
  drops: {
796
792
  provide: (id: string, extensions: string[]) => Promise<void>;
797
793
  withdraw: (id: string) => Promise<void>;
798
794
  listen: (listen: boolean) => Promise<void>;
799
795
  };
800
- /** The palette (`ui.theme` to change it). */
796
+ /** The palette: read it, change it. */
801
797
  appearance: {
802
798
  set: (theme: string) => Promise<void>;
803
799
  /** The interface language for the next start. */
804
800
  setLanguage: (language: string) => Promise<void>;
805
801
  };
806
- /** Settings pages in the player's options window (`ui.settings`). */
802
+ /** Settings pages in the player's options window. */
807
803
  settings: {
808
804
  register: (options: {
809
805
  id: string;
@@ -920,6 +916,21 @@ export declare function createWire(transport: Transport): {
920
916
  openPath: (path: string) => Promise<void>;
921
917
  openUrl: (url: string) => Promise<void>;
922
918
  };
919
+ /**
920
+ * The mpv pass-through (`mpv`): commands and properties as mpv names
921
+ * them. The observed values arrive as `mpv.property` events.
922
+ */
923
+ mpv: {
924
+ command: (args: (string | number | boolean)[]) => Promise<{
925
+ result: Json;
926
+ }>;
927
+ get: (name: string) => Promise<{
928
+ value: Json;
929
+ }>;
930
+ set: (name: string, value: Json) => Promise<void>;
931
+ observeProperty: (name: string) => Promise<void>;
932
+ unobserveProperty: (name: string) => Promise<void>;
933
+ };
923
934
  /** The system's secret store, per plugin (`secrets`). */
924
935
  secrets: {
925
936
  get: (name: string) => Promise<string | null>;
@@ -942,8 +953,7 @@ export declare function createWire(transport: Transport): {
942
953
  system: () => Promise<WireSystemInfo>;
943
954
  };
944
955
  /**
945
- * The rendering choice: `state` needs no capability, `setPreference` and
946
- * `restart` need `rendering.manage`.
956
+ * The rendering choice: `state`, `setPreference` and `restart`.
947
957
  */
948
958
  rendering: {
949
959
  state: () => Promise<WireRenderingState>;
package/dist/wire.js CHANGED
@@ -26,7 +26,7 @@ export const API_VERSION = "vestra/1";
26
26
  *
27
27
  * Common codes: `stale` (the condition no longer holds; nothing was done),
28
28
  * `invalid` (bad argument), `missing` (unknown target), `capability`
29
- * (undeclared capability), `busy`, `conflict`, `unavailable`, `unsupported`
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),
32
32
  * `disabled` (the plugin is stopping).
@@ -57,7 +57,6 @@ export const API_VERSION = "vestra/1";
57
57
  * A definite refusal, as opposed to a lost reply: the SDK does not retry
58
58
  * it, and the plugin sees an `Error` with `code`.
59
59
  *
60
- * @capability None.
61
60
  * @since 1.0.0
62
61
  * @category Testing
63
62
  */
@@ -110,25 +109,25 @@ export function createWire(transport) {
110
109
  devices: () => transport.request("player.audioDevices"),
111
110
  set: (id) => transport.request("player.setAudioDevice", { id }),
112
111
  },
113
- /** The binding table: list, user overlay (`bindings.manage`). */
112
+ /** The binding table: list, user overlay. */
114
113
  bindings: {
115
114
  list: () => transport.request("bindings.list"),
116
115
  set: (plugin, command, inputs) => transport.request("bindings.set", { plugin, command, inputs }),
117
116
  reset: (ref) => transport.request("bindings.reset", ref ?? {}),
118
117
  },
119
- /** File drops: providers by extension, panel listeners (`ui.drop`). */
118
+ /** File drops: providers by extension, panel listeners. */
120
119
  drops: {
121
120
  provide: (id, extensions) => transport.request("drops.provide", { id, extensions }),
122
121
  withdraw: (id) => transport.request("drops.withdraw", { id }),
123
122
  listen: (listen) => transport.request("drops.listen", { listen }),
124
123
  },
125
- /** The palette (`ui.theme` to change it). */
124
+ /** The palette: read it, change it. */
126
125
  appearance: {
127
126
  set: (theme) => transport.request("appearance.set", { theme }),
128
127
  /** The interface language for the next start. */
129
128
  setLanguage: (language) => transport.request("appearance.setLanguage", { language }),
130
129
  },
131
- /** Settings pages in the player's options window (`ui.settings`). */
130
+ /** Settings pages in the player's options window. */
132
131
  settings: {
133
132
  register: (options) => transport.request("settings.register", options),
134
133
  set: (id, property, write) => transport.request("settings.set", { id, property, ...write }),
@@ -222,6 +221,17 @@ export function createWire(transport) {
222
221
  openPath: (path) => transport.request("system.openPath", { path }),
223
222
  openUrl: (url) => transport.request("system.openUrl", { url }),
224
223
  },
224
+ /**
225
+ * The mpv pass-through (`mpv`): commands and properties as mpv names
226
+ * them. The observed values arrive as `mpv.property` events.
227
+ */
228
+ mpv: {
229
+ command: (args) => transport.request("mpv.command", { args }),
230
+ get: (name) => transport.request("mpv.get", { name }),
231
+ set: (name, value) => transport.request("mpv.set", { name, value }),
232
+ observeProperty: (name) => transport.request("mpv.observe", { name }),
233
+ unobserveProperty: (name) => transport.request("mpv.unobserve", { name }),
234
+ },
225
235
  /** The system's secret store, per plugin (`secrets`). */
226
236
  secrets: {
227
237
  get: (name) => transport.request("secrets.get", { name }),
@@ -242,8 +252,7 @@ export function createWire(transport) {
242
252
  system: () => transport.request("app.system"),
243
253
  },
244
254
  /**
245
- * The rendering choice: `state` needs no capability, `setPreference` and
246
- * `restart` need `rendering.manage`.
255
+ * The rendering choice: `state`, `setPreference` and `restart`.
247
256
  */
248
257
  rendering: {
249
258
  state: () => transport.request("rendering.state"),
package/llms.txt CHANGED
@@ -1,12 +1,12 @@
1
1
  # Vestra Player SDK
2
2
 
3
- > @vestra-player/sdk 1.7.20: 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/.
3
+ > @vestra-player/sdk 1.9.0: 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
 
7
7
  - **Command line** (any coding agent): `npx -p @vestra-player/sdk vestra-plugin docs [path] [--page N]` prints one node of the tree; `npx -p @vestra-player/sdk vestra-plugin docs --search <words>` lists the matching paths. In a project that depends on the SDK, `npx vestra-plugin docs` is enough.
8
8
  - **In a Node.js program**: `import { docs, searchDocs } from "@vestra-player/sdk/docs"`; `docs(path, { page })` and `searchDocs(query, { page })` return the same text.
9
- - **Paths**: `/` lists the top level; every answer lists the paths one level down with a one-line summary. `/API/<category>/<symbol>/<member>` is one declaration with its signature, parameters, return value, errors, capability, player version and examples, for example `/API/Media/Snapshot/dispose`. `/Guides/<group>/<page>` is a page of the site, for example `/Guides/Guides/Test a plugin` (the file name works too: `/Guides/Guides/testing`). Case, spaces and punctuation do not matter, the leading `/` is optional, `.` works like `/`, a name alone finds its declaration (`TestHost`, `Snapshot.export`, `plugin.player`), and `#heading` opens the page of a long answer that has that section.
9
+ - **Paths**: `/` lists the top level; every answer lists the paths one level down with a one-line summary. `/API/<category>/<symbol>/<member>` is one declaration with its signature, parameters, return value, errors, the SDK and player versions it needs, and examples, for example `/API/Media/Snapshot/dispose`. `/Guides/<group>/<page>` is a page of the site, for example `/Guides/Guides/Test a plugin` (the file name works too: `/Guides/Guides/testing`). Case, spaces and punctuation do not matter, the leading `/` is optional, `.` works like `/`, a name alone finds its declaration (`TestHost`, `Snapshot.export`, `plugin.player`), and `#heading` opens the page of a long answer that has that section.
10
10
  - **Size**: every answer is at most 8 KB; a longer one ends with the number of its next page (`--page 2`).
11
11
  - **Before writing code**, read `/Guides/Tutorial` and `/Guides/Guides/Design rules`, then the API of what you use. Test with `/Guides/Guides/Test a plugin`.
12
12
 
@@ -20,7 +20,7 @@
20
20
 
21
21
  - `/Guides/Tutorial`: Write a first plugin for Vestra Player: a menu item that shows the playback position, then the three styles a plugin can use, and how to test and publish it.
22
22
  - `/Guides/Guides`: One page per task, from adding a window to publishing a plugin, plus the design rules and troubleshooting.
23
- - `/Guides/Reference`: Lookup tables that span many symbols, from manifest fields and capabilities to the test host, mostly generated from the SDK's code.
23
+ - `/Guides/Reference`: Lookup tables that span many symbols, from manifest fields to the test host, mostly generated from the SDK's code.
24
24
  - `/Guides/Examples`: Complete, tested example plugins with a screenshot each and a step-by-step walkthrough of their code.
25
25
 
26
26
  ## API
@@ -28,12 +28,12 @@
28
28
  - `/API/Commands`: 23 entries: CommandState, Bindable, Condition, When, MenuId, BarButtonIcon, CommandButton, CommandOptions, Command, Commands, CommandRunOptions, CommandRunResult, CommandList, CommandInfo, Palette,…
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`: 34 entries: CommandKeys, MarkKind, TimelineMark, RangeStyle, TimelineRange, TimelineLayer, Timeline, AudioTrack, PlayerState, AudioDevice, Chapter, Conditional, Media, Scrub, StreamFrame,…
31
+ - `/API/Playback`: 36 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
37
  - `/API/UI`: 44 entries: ImageRef, ImageOptions, MarkdownRef, MarkdownOptions, PropValue, PropData, Props, Ui, View, Window, Windows, SlotState, SlotPanel, PanelState, PanelSlot, SidebarSlot, Panel,…
38
- - `/API/Testing`: 34 entries: CapabilityInfo, CAPABILITY_INFO, MESSAGE_LIMIT, COMMAND_LIMITS, MENU_IDS, BAR_BUTTON_ICONS, BAR_BUTTON_LIMITS, BuiltinSubmenu, BUILTIN_SUBMENUS, BuiltinCommand, BUILTIN_COMMANDS, LOCALES,…
38
+ - `/API/Testing`: 32 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.7.20",
3
+ "version": "1.9.0",
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,6 +33,7 @@
33
33
  "default": "./ts-plugin/index.js"
34
34
  },
35
35
  "./llms.txt": "./llms.txt",
36
+ "./capability-scan.json": "./capability-scan.json",
36
37
  "./package.json": "./package.json"
37
38
  },
38
39
  "bin": {
@@ -46,13 +47,13 @@
46
47
  "README.md",
47
48
  "CHANGELOG.md",
48
49
  "LICENSE",
49
- "llms.txt"
50
+ "llms.txt",
51
+ "capability-scan.json"
50
52
  ],
51
53
  "scripts": {
52
54
  "api-surface": "node scripts/api-surface.mjs",
53
55
  "bench": "node scripts/bench.mjs",
54
56
  "build": "node scripts/build.mjs",
55
- "capabilities:sync": "node scripts/capabilities-sync.mjs",
56
57
  "check": "tsc -p tsconfig.check.json && node scripts/check-layers.mjs",
57
58
  "doc-lint": "node scripts/doc-lint.mjs",
58
59
  "docs": "typedoc",
@@ -149,9 +149,12 @@ export component ToolTipArea {
149
149
  // Dialog button: text (21px, or 18px when `small`), or an icon button when
150
150
  // `text` is empty and `icon` holds Path data drawn in an icon-width × icon-height
151
151
  // viewbox (filled, or 1.5px round-capped lines when `stroked`, as the
152
- // @vestra/icons.slint set). The caller sizes icon buttons.
152
+ // @vestra/icons.slint set). The caller sizes icon buttons. `key`: the key that
153
+ // presses it, in a `KeyHint` 6px after the text ([Run `Enter`]); empty (the
154
+ // default) draws nothing and takes no space.
153
155
  export component Button {
154
156
  in property <string> text;
157
+ in property <string> key;
155
158
  in property <string> icon;
156
159
  in property <length> icon-width: 14px;
157
160
  in property <length> icon-height: 12px;
@@ -170,7 +173,7 @@ export component Button {
170
173
  preferred-height: self.min-height;
171
174
  // A longer (translated) label widens the button instead of overflowing it.
172
175
  preferred-width: root.icon-only ? self.min-width
173
- : max(self.min-width, label.preferred-width + 2 * Theme.button-padding);
176
+ : max(self.min-width, row.preferred-width);
174
177
  accessible-role: button;
175
178
  accessible-label: root.text;
176
179
  accessible-enabled: root.enabled;
@@ -183,16 +186,21 @@ export component Button {
183
186
  background: !root.enabled ? Theme.button-disabled
184
187
  : touch.pressed ? Theme.button-press
185
188
  : touch.has-hover ? Theme.button-hover : Theme.button-bg;
186
- HorizontalLayout {
189
+ row := HorizontalLayout {
187
190
  padding-left: Theme.button-padding;
188
191
  padding-right: Theme.button-padding;
192
+ spacing: root.key == "" ? 0px : 6px;
189
193
  alignment: center;
190
- label := Text {
194
+ Text {
191
195
  text: root.text;
192
196
  color: root.enabled ? Theme.text-list : Theme.text-dim;
193
197
  font-size: Theme.font-body;
194
198
  vertical-alignment: center;
195
199
  }
200
+ VerticalLayout {
201
+ alignment: center;
202
+ KeyHint { text: root.key; }
203
+ }
196
204
  }
197
205
  }
198
206
  if root.icon-only: Path {
@@ -1,107 +0,0 @@
1
- /**
2
- * What one manifest capability is for: the members it opens, the
3
- * capabilities they also need, and how the plugin store describes it. An
4
- * entry of {@link CAPABILITY_INFO}.
5
- *
6
- * @since 1.5.14
7
- *
8
- * @category Testing
9
- */
10
- export interface CapabilityInfo {
11
- /**
12
- * The members this capability opens, as `Interface.member` (for example
13
- * `Commands.add` is `plugin.commands.add`). A call to one of them without
14
- * the capability fails with code `capability`; `Plugin.video.filter` is
15
- * `plugin.video.filter`. A member can be listed
16
- * under more than one capability when it needs all of them
17
- * (`Panel.onChange` needs `ui.mount` and `events`).
18
- */
19
- readonly apis: readonly string[];
20
- /**
21
- * Capabilities every member in {@link CapabilityInfo.apis} also needs:
22
- * declare them as well. What only one member or one option needs
23
- * (`Plugin.video.filter` also needs `events`) is documented at that member.
24
- */
25
- readonly requires: readonly string[];
26
- /**
27
- * How the plugin store and the player's install confirmation describe the
28
- * capability to the user, in English (the player translates it). Two
29
- * capabilities can share one description (`media.read` and
30
- * `media.control`); the store then shows it once.
31
- */
32
- readonly label: string;
33
- /**
34
- * `true` when the store highlights the capability as one to think about
35
- * before installing (it reaches outside the plugin's own features: the
36
- * clipboard, every shortcut, the keychain, other plugins).
37
- */
38
- readonly risky: boolean;
39
- /**
40
- * `true` when only the player's built-in plugins may declare it
41
- * (`commands.run`, `palette.lead`): the player refuses a package of any
42
- * other plugin that declares it, and its calls fail with `capability`.
43
- * `vestra-plugin check` reports it.
44
- *
45
- * @since 1.7.9
46
- */
47
- readonly builtinOnly: boolean;
48
- }
49
- /**
50
- * Every manifest capability the player knows (`vestra/1`), in the player's
51
- * order, with the members it opens, the capabilities they also need and the
52
- * store's wording. Built from the player's own capability table (its
53
- * `src/host/capabilities.json`, copied into the SDK) and the requests each
54
- * member sends, the same rule `vestra-plugin check` and the SDK's
55
- * TypeScript plugin apply; the player's tests check that the copy is
56
- * current.
57
- *
58
- * A member not listed under any capability needs none (`plugin.tools`,
59
- * `plugin.storage`, `plugin.system`, `plugin.app`, `plugin.ui`,
60
- * `plugin.i18n`, reading `plugin.window.state`, `plugin.appearance.theme`,
61
- * `plugin.packages.list` and `plugin.rendering.state`).
62
- *
63
- * @example Check in a test that the manifest declares every required capability
64
- * The test fails, naming the missing capability, when the manifest declares
65
- * a capability without one its members also need. It reads the plugin's own
66
- * `manifest.json` and looks each declared name up in `CAPABILITY_INFO`,
67
- * whose `requires` lists the capabilities that must be declared with it;
68
- * at run time the player would refuse such a call with code `capability`.
69
- * ```ts
70
- * import assert from "node:assert/strict";
71
- * import { readFile } from "node:fs/promises";
72
- * import { CAPABILITY_INFO } from "@vestra-player/sdk/testing";
73
- *
74
- * const manifest: { capabilities: string[] } = JSON.parse(
75
- * await readFile(new URL("../manifest.json", import.meta.url), "utf8"),
76
- * );
77
- * for (const capability of manifest.capabilities)
78
- * // An unknown name has no entry: `vestra-plugin check` reports it.
79
- * for (const needed of CAPABILITY_INFO[capability]?.requires ?? [])
80
- * assert.ok(manifest.capabilities.includes(needed), needed);
81
- * ```
82
- *
83
- * @since 1.5.14
84
- *
85
- * @category Testing
86
- */
87
- export declare const CAPABILITY_INFO: Readonly<Record<string, CapabilityInfo>>;
88
- /**
89
- * Manifest capabilities the player knows (`vestra/1`): the keys of
90
- * {@link CAPABILITY_INFO}, in the player's order. The same list as the
91
- * player's `host/capabilities.json`; the player's tests check that they agree.
92
- */
93
- export declare const CAPABILITIES: readonly string[];
94
- /** The plugin API version this SDK implements (`manifest.apiVersion`). */
95
- export declare const API_VERSION = "vestra/1";
96
- /**
97
- * The longest message a plugin may send the player, in UTF-8 bytes of one
98
- * protocol line with its newline (1 MiB). The player stops a plugin that
99
- * writes a longer one, so the plugin's side refuses such a request before
100
- * sending it: it rejects with code `limit`. Property values meet
101
- * {@link UI_VALUE_LIMITS} before this.
102
- *
103
- * @since 1.5.14
104
- *
105
- * @category Testing
106
- */
107
- export declare const MESSAGE_LIMIT: number;
@@ -1,69 +0,0 @@
1
- import { capabilityInfo } from "./capability-rules.js";
2
- /**
3
- * Every manifest capability the player knows (`vestra/1`), in the player's
4
- * order, with the members it opens, the capabilities they also need and the
5
- * store's wording. Built from the player's own capability table (its
6
- * `src/host/capabilities.json`, copied into the SDK) and the requests each
7
- * member sends, the same rule `vestra-plugin check` and the SDK's
8
- * TypeScript plugin apply; the player's tests check that the copy is
9
- * current.
10
- *
11
- * A member not listed under any capability needs none (`plugin.tools`,
12
- * `plugin.storage`, `plugin.system`, `plugin.app`, `plugin.ui`,
13
- * `plugin.i18n`, reading `plugin.window.state`, `plugin.appearance.theme`,
14
- * `plugin.packages.list` and `plugin.rendering.state`).
15
- *
16
- * @example Check in a test that the manifest declares every required capability
17
- * The test fails, naming the missing capability, when the manifest declares
18
- * a capability without one its members also need. It reads the plugin's own
19
- * `manifest.json` and looks each declared name up in `CAPABILITY_INFO`,
20
- * whose `requires` lists the capabilities that must be declared with it;
21
- * at run time the player would refuse such a call with code `capability`.
22
- * ```ts
23
- * import assert from "node:assert/strict";
24
- * import { readFile } from "node:fs/promises";
25
- * import { CAPABILITY_INFO } from "@vestra-player/sdk/testing";
26
- *
27
- * const manifest: { capabilities: string[] } = JSON.parse(
28
- * await readFile(new URL("../manifest.json", import.meta.url), "utf8"),
29
- * );
30
- * for (const capability of manifest.capabilities)
31
- * // An unknown name has no entry: `vestra-plugin check` reports it.
32
- * for (const needed of CAPABILITY_INFO[capability]?.requires ?? [])
33
- * assert.ok(manifest.capabilities.includes(needed), needed);
34
- * ```
35
- *
36
- * @since 1.5.14
37
- *
38
- * @category Testing
39
- */
40
- export const CAPABILITY_INFO = Object.freeze(Object.fromEntries(Object.entries(capabilityInfo()).map(([name, info]) => [
41
- name,
42
- Object.freeze({
43
- apis: Object.freeze(info.apis),
44
- requires: Object.freeze(info.requires),
45
- label: info.label,
46
- risky: info.risky,
47
- builtinOnly: info.builtinOnly,
48
- }),
49
- ])));
50
- /**
51
- * Manifest capabilities the player knows (`vestra/1`): the keys of
52
- * {@link CAPABILITY_INFO}, in the player's order. The same list as the
53
- * player's `host/capabilities.json`; the player's tests check that they agree.
54
- */
55
- export const CAPABILITIES = Object.freeze(Object.keys(CAPABILITY_INFO));
56
- /** The plugin API version this SDK implements (`manifest.apiVersion`). */
57
- export const API_VERSION = "vestra/1";
58
- /**
59
- * The longest message a plugin may send the player, in UTF-8 bytes of one
60
- * protocol line with its newline (1 MiB). The player stops a plugin that
61
- * writes a longer one, so the plugin's side refuses such a request before
62
- * sending it: it rejects with code `limit`. Property values meet
63
- * {@link UI_VALUE_LIMITS} before this.
64
- *
65
- * @since 1.5.14
66
- *
67
- * @category Testing
68
- */
69
- export const MESSAGE_LIMIT = 1024 * 1024;