@vestra-player/sdk 1.8.0 → 1.10.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 (106) hide show
  1. package/CHANGELOG.md +64 -2
  2. package/README.md +2 -2
  3. package/bin/vestra-plugin.mjs +98 -106
  4. package/capability-scan.json +21 -1
  5. package/dist/api-requests.d.ts +15 -39
  6. package/dist/api-requests.js +28 -50
  7. package/dist/capability-scan.d.ts +1 -1
  8. package/dist/capability-scan.js +8 -9
  9. package/dist/condition-table.d.ts +1889 -0
  10. package/dist/condition-table.js +562 -0
  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/i18n-tools.d.ts +7 -0
  15. package/dist/i18n-tools.js +66 -3
  16. package/dist/index.d.ts +4 -5
  17. package/dist/manifest.d.ts +5 -0
  18. package/dist/manifest.js +9 -24
  19. package/dist/member-uses.d.ts +61 -0
  20. package/dist/member-uses.js +160 -0
  21. package/dist/player-runtime.d.ts +4 -2
  22. package/dist/player-runtime.js +4 -2
  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 +1 -12
  28. package/dist/plugin/connection.d.ts +38 -8
  29. package/dist/plugin/connection.js +126 -37
  30. package/dist/plugin/drops.js +1 -1
  31. package/dist/plugin/index.d.ts +7 -0
  32. package/dist/plugin/index.js +22 -15
  33. package/dist/plugin/media.js +0 -12
  34. package/dist/plugin/mpv.js +39 -12
  35. package/dist/plugin/packages.js +1 -2
  36. package/dist/plugin/player/events.d.ts +17 -7
  37. package/dist/plugin/player/events.js +26 -9
  38. package/dist/plugin/player.d.ts +37 -13
  39. package/dist/plugin/player.js +133 -22
  40. package/dist/plugin/scope.d.ts +4 -1
  41. package/dist/plugin/scope.js +8 -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 +24 -37
  50. package/dist/plugin/testing/index.d.ts +133 -116
  51. package/dist/plugin/testing/index.js +198 -125
  52. package/dist/plugin/testing/media.d.ts +6 -0
  53. package/dist/plugin/testing/media.js +15 -2
  54. package/dist/plugin/testing/processing.js +1 -1
  55. package/dist/plugin/testing/services.js +0 -1
  56. package/dist/plugin/testing/source-events.d.ts +28 -0
  57. package/dist/plugin/testing/source-events.js +66 -0
  58. package/dist/plugin/testing/transport.js +5 -0
  59. package/dist/plugin/testing/triggers.d.ts +82 -0
  60. package/dist/plugin/testing/triggers.js +448 -0
  61. package/dist/plugin/timeline.d.ts +5 -6
  62. package/dist/plugin/timeline.js +7 -11
  63. package/dist/plugin/triggers.d.ts +55 -0
  64. package/dist/plugin/triggers.js +233 -0
  65. package/dist/plugin/types/base.d.ts +77 -87
  66. package/dist/plugin/types/commands.d.ts +384 -68
  67. package/dist/plugin/types/packages.d.ts +17 -55
  68. package/dist/plugin/types/playback.d.ts +382 -152
  69. package/dist/plugin/types/plugin-wire.d.ts +6 -36
  70. package/dist/plugin/types/processing.d.ts +10 -49
  71. package/dist/plugin/types/services.d.ts +11 -70
  72. package/dist/plugin/types/snapshots.d.ts +7 -60
  73. package/dist/plugin/types/sources.d.ts +2 -11
  74. package/dist/plugin/types/subtitles.d.ts +5 -26
  75. package/dist/plugin/types/ui-content.d.ts +1 -16
  76. package/dist/plugin/types/ui-layout.d.ts +53 -79
  77. package/dist/plugin/types/ui-locale.d.ts +5 -23
  78. package/dist/plugin/types/ui-shell.d.ts +13 -59
  79. package/dist/plugin/view/layout.js +1 -1
  80. package/dist/plugin/view.js +0 -2
  81. package/dist/plugin/when.d.ts +78 -4
  82. package/dist/plugin/when.js +182 -14
  83. package/dist/plugin/window.d.ts +1 -1
  84. package/dist/plugin/window.js +1 -1
  85. package/dist/plugin/wire-facade.js +1 -2
  86. package/dist/processing.d.ts +2 -3
  87. package/dist/protocol.d.ts +14 -0
  88. package/dist/protocol.js +14 -0
  89. package/dist/request-queue.js +1 -1
  90. package/dist/slint-version.d.ts +7 -0
  91. package/dist/slint-version.js +7 -0
  92. package/dist/subtitles.d.ts +1 -1
  93. package/dist/ts-plugin.d.ts +8 -15
  94. package/dist/ts-plugin.js +3 -141
  95. package/dist/wire.d.ts +22 -12
  96. package/dist/wire.js +17 -8
  97. package/llms.txt +6 -6
  98. package/package.json +1 -2
  99. package/dist/capabilities.d.ts +0 -107
  100. package/dist/capabilities.js +0 -69
  101. package/dist/capability-check.d.ts +0 -176
  102. package/dist/capability-check.js +0 -461
  103. package/dist/capability-rules.d.ts +0 -125
  104. package/dist/capability-rules.js +0 -192
  105. package/dist/host-capabilities.d.ts +0 -10
  106. package/dist/host-capabilities.js +0 -492
@@ -1,33 +1,24 @@
1
1
  /**
2
- * Which player requests each member of the plugin API sends: the SDK's half
3
- * of the capability rule (the player's half, what each request needs, is
4
- * `HOST_CAPABILITIES`). A member is written `Interface.member` as in
5
- * `CAPABILITY_INFO`; members declared on `Scope` are written `Plugin.…`.
2
+ * Which player requests each member of the plugin API sends, written
3
+ * `Interface.member`; members declared on `Scope` are written `Plugin.…`.
4
+ * The generated reference pages read it: the Stability column of the
5
+ * message table (docs/reference/messages.md) and the members of each event
6
+ * (docs/reference/events.md). For a listener the row is the
7
+ * `events.subscribe` with its event name.
6
8
  *
7
- * List the requests that decide the member's capabilities: the one it
8
- * sends to do its work, and for a listener the `events.subscribe` with its
9
- * event name. A string parameter that the player's rule reads (`event`,
10
- * `stage`) is given in `params`. `also: true` marks a request whose
11
- * capability the member needs on top of its own (documented at the member,
12
- * not listed in its capability's `CAPABILITY_INFO.apis`).
13
- *
14
- * Members that need no capability are left out, apart from a few that show
15
- * a rule's "none" case. Members of objects that another listed member
16
- * returns (a `Window` from `Windows.create`, a `Panel` from `Panels.mount`)
17
- * are left out too: the call that created the object already needs the
18
- * capability.
19
- *
20
- * Order matters for `CAPABILITY_INFO`: each capability lists its members in
21
- * this table's order. test/capability-rules.test.ts checks every method and
22
- * parameter against the player's table.
9
+ * A row lists the request the member sends to do its work. Members whose
10
+ * requests come from a handle another member returned (a `Window` from
11
+ * `Windows.create`) are listed in the message table's `WRAPPED_BY`
12
+ * (scripts/doc-tables/messages.mjs) instead.
23
13
  *
24
14
  * @internal
25
15
  */
26
16
  const submit = [{ method: "source.submit" }, { method: "source.operation" }];
27
- const readsSubtitles = { method: "subtitles.state", also: true };
28
- const listen = (event, also) => also
29
- ? { method: "events.subscribe", params: { event }, also }
30
- : { method: "events.subscribe", params: { event } };
17
+ const readsSubtitles = { method: "subtitles.state" };
18
+ const listen = (event) => ({
19
+ method: "events.subscribe",
20
+ params: { event },
21
+ });
31
22
  /** @internal */
32
23
  export const API_REQUESTS = Object.freeze({
33
24
  "Player.state": [{ method: "source.state" }],
@@ -39,7 +30,7 @@ export const API_REQUESTS = Object.freeze({
39
30
  "Player.open": submit,
40
31
  "Player.openStream": [
41
32
  { method: "producer.prepare" },
42
- { method: "source.submit", also: true },
33
+ { method: "source.submit" },
43
34
  ],
44
35
  "Player.setPaused": submit,
45
36
  "Player.seek": submit,
@@ -70,6 +61,9 @@ export const API_REQUESTS = Object.freeze({
70
61
  "Subtitles.load": [{ method: "subtitles.upload.begin" }, readsSubtitles],
71
62
  "Subtitles.remove": [{ method: "subtitles.remove" }, readsSubtitles],
72
63
  "Subtitles.setStyle": [{ method: "subtitles.style" }, readsSubtitles],
64
+ "Plugin.trigger": [{ method: "triggers.declare" }],
65
+ "Trigger.firesOn": [{ method: "triggers.set" }],
66
+ "Trigger.off": [{ method: "triggers.off" }],
73
67
  "Timeline.marks": [{ method: "timeline.marks" }],
74
68
  "Timeline.ranges": [{ method: "timeline.marks" }],
75
69
  "Timeline.layer": [
@@ -119,7 +113,7 @@ export const API_REQUESTS = Object.freeze({
119
113
  "Packages.uninstall": [{ method: "packages.uninstall" }],
120
114
  "Plugin.video.filter": [
121
115
  { method: "processing.replace", params: { stage: "video" } },
122
- listen("source.state", true),
116
+ listen("source.state"),
123
117
  ],
124
118
  "Plugin.video.view": [{ method: "video.view.set" }],
125
119
  "Plugin.video.render": [{ method: "video.render.set" }],
@@ -132,8 +126,6 @@ export const API_REQUESTS = Object.freeze({
132
126
  { method: "snapshot.capture" },
133
127
  ],
134
128
  "Snapshot.export": [{ method: "jobs.state" }, { method: "jobs.start" }],
135
- // Parts of remembered files: also media.sources (documented at the
136
- // members; the player checks it for jobs.start with parts and jobs.check).
137
129
  "MediaCapture.export": [{ method: "jobs.state" }, { method: "jobs.start" }],
138
130
  "MediaCapture.exportCheck": [{ method: "jobs.check" }],
139
131
  "MediaSources.remember": [{ method: "media.sources.remember" }],
@@ -141,8 +133,7 @@ export const API_REQUESTS = Object.freeze({
141
133
  "MediaSources.locate": [{ method: "media.sources.locate" }],
142
134
  "MediaSources.forget": [{ method: "media.sources.forget" }],
143
135
  "MediaSources.list": [{ method: "media.sources.list" }],
144
- // An open like Player.open: playback.control (the player's rule for
145
- // media.sources.open), with which source.operation needs it too.
136
+ // An open like Player.open, followed with source.operation.
146
137
  "MediaSources.open": [
147
138
  { method: "media.sources.open" },
148
139
  { method: "source.operation" },
@@ -178,9 +169,10 @@ export const API_REQUESTS = Object.freeze({
178
169
  });
179
170
  /**
180
171
  * The events whose listener subscribes (`events.subscribe` with the event
181
- * name): the plugin API's `HostEvent`. Other names a plugin listens to
182
- * (`commands.execute`, `ui.callback`) arrive unasked and need nothing.
183
- * test/wire-facade.test.ts keeps it equal to `HostEvent`.
172
+ * name): the plugin API's `HostEvent` and `SourceEvent`. Other names a
173
+ * plugin listens to (`commands.execute`, `ui.callback`) arrive unasked and
174
+ * need nothing.
175
+ * test/wire-facade.test.ts keeps it equal to `EVENT_NEEDS`.
184
176
  *
185
177
  * @internal
186
178
  */
@@ -196,21 +188,7 @@ export const SUBSCRIBED_EVENTS = Object.freeze([
196
188
  "resolvers.fileTypes",
197
189
  "video.upscaling.changed",
198
190
  "video.motion.changed",
191
+ "source.opening",
192
+ "source.ready",
193
+ "source.ended",
199
194
  ]);
200
- /**
201
- * Members whose requests depend on an argument, which `API_REQUESTS` cannot
202
- * list: the event name of a listener (`event`: a subscribed event's
203
- * `events.subscribe`, nothing for the others) or the method name of a request
204
- * (`method`: that method, with the string fields of the second argument as its
205
- * parameters). The capability check reads the argument when its type is one
206
- * string (a literal, a constant), and reports the call as unchecked otherwise
207
- * (a computed name, a union of several, the member taken by destructuring or as
208
- * a value).
209
- *
210
- * @internal
211
- */
212
- export const ARGUMENT_APIS = Object.freeze({
213
- "Player.on": "event",
214
- "Wire.on": "event",
215
- "Wire.request": "method",
216
- });
@@ -10,7 +10,7 @@ export interface ScanList {
10
10
  readonly about: string;
11
11
  /** API members, `Interface.member` (`Clipboard.readText`, `Scope.video.filter`). */
12
12
  readonly members: readonly string[];
13
- /** Methods of the player's protocol, as its capability table names them (`packages.*`). */
13
+ /** Methods of the player's protocol, by name or prefix (`packages.*`). */
14
14
  readonly requests: readonly string[];
15
15
  }
16
16
  /** @internal `capability-scan.json`. */
@@ -5,24 +5,23 @@
5
5
  * prints the result; the plugin repository's index and the store show it.
6
6
  *
7
7
  * The table is `capability-scan.json` at the package's root, maintained by
8
- * hand: every method of the public API and every method of the player's
9
- * capability table is in one category's list or in `none`'s
10
- * (test/capability-scan.test.ts). Nothing here is read at run time: the
11
- * manifest's capabilities gate the API as before.
8
+ * hand: every method of the public API is in one category's list or in
9
+ * `none`'s, and every request the SDK sends has a category by name or
10
+ * prefix (test/capability-scan.test.ts). Nothing here is read at run time;
11
+ * since 1.9.0 the scan is the only disclosure (manifests declare nothing).
12
12
  *
13
- * TypeScript files are scanned by type, with the capability checker's
14
- * resolution (`findMemberUses`, capability-check.ts): a member counts
13
+ * TypeScript files are scanned by type (`findMemberUses`, member-uses.ts): a member counts
15
14
  * however its object was reached. JavaScript files have no types and are
16
15
  * scanned by name, best effort (`scanNamesInto`); the result says which
17
16
  * way each file was read.
18
17
  *
19
18
  * The TypeScript module is passed in, never imported (as in
20
- * capability-check.ts). Node only: it reads the table from disk.
19
+ * member-uses.ts). Node only: it reads the table from disk.
21
20
  *
22
21
  * @internal
23
22
  */
24
23
  import { readFileSync } from "node:fs";
25
- import { findMemberUses } from "./capability-check.js";
24
+ import { findMemberUses } from "./member-uses.js";
26
25
  /** @internal The scan's categories, in the order results list them. */
27
26
  export const SCAN_CATEGORIES = [
28
27
  "player",
@@ -107,7 +106,7 @@ class Findings {
107
106
  this.unchecked.push({
108
107
  file: this.#relative(file),
109
108
  line,
110
- message: `a request of ${JSON.stringify(method)}, which the player's capability table does not know`,
109
+ message: `a request of ${JSON.stringify(method)}, which capability-scan.json does not list`,
111
110
  });
112
111
  else if (category !== null)
113
112
  this.add(category, { request: method, file, line, by });