@vestra-player/sdk 1.9.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.
- package/CHANGELOG.md +29 -7
- package/bin/vestra-plugin.mjs +89 -8
- package/capability-scan.json +18 -0
- package/dist/api-requests.d.ts +4 -3
- package/dist/api-requests.js +10 -3
- package/dist/condition-table.d.ts +1889 -0
- package/dist/condition-table.js +562 -0
- package/dist/docs-tree.json.gz +0 -0
- package/dist/i18n-tools.d.ts +7 -0
- package/dist/i18n-tools.js +66 -3
- package/dist/player-runtime.d.ts +3 -0
- package/dist/player-runtime.js +3 -0
- package/dist/plugin/connection.d.ts +12 -1
- package/dist/plugin/connection.js +58 -1
- package/dist/plugin/index.d.ts +7 -0
- package/dist/plugin/index.js +13 -0
- package/dist/plugin/mpv.js +39 -5
- package/dist/plugin/player/events.d.ts +14 -5
- package/dist/plugin/player/events.js +19 -3
- package/dist/plugin/player.d.ts +16 -0
- package/dist/plugin/player.js +77 -1
- package/dist/plugin/scope.d.ts +4 -1
- package/dist/plugin/scope.js +8 -0
- package/dist/plugin/testing/commands.js +18 -22
- package/dist/plugin/testing/index.d.ts +107 -0
- package/dist/plugin/testing/index.js +168 -21
- package/dist/plugin/testing/media.d.ts +6 -0
- package/dist/plugin/testing/media.js +15 -2
- package/dist/plugin/testing/source-events.d.ts +28 -0
- package/dist/plugin/testing/source-events.js +66 -0
- package/dist/plugin/testing/transport.js +5 -0
- package/dist/plugin/testing/triggers.d.ts +82 -0
- package/dist/plugin/testing/triggers.js +448 -0
- package/dist/plugin/timeline.d.ts +3 -3
- package/dist/plugin/timeline.js +3 -3
- package/dist/plugin/triggers.d.ts +55 -0
- package/dist/plugin/triggers.js +233 -0
- package/dist/plugin/types/base.d.ts +37 -1
- package/dist/plugin/types/commands.d.ts +374 -1
- package/dist/plugin/types/playback.d.ts +257 -9
- package/dist/plugin/when.d.ts +78 -4
- package/dist/plugin/when.js +182 -14
- package/dist/slint-version.d.ts +7 -0
- package/dist/slint-version.js +7 -0
- package/dist/wire.d.ts +15 -0
- package/dist/wire.js +11 -0
- package/llms.txt +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.10.0
|
|
4
|
+
|
|
5
|
+
**Events, triggers and the state stream: a plugin can learn what happens in the player without staying up for it.** Who must change: nobody. Everything below is an addition or a correction of the docs, except two behaviour changes (the update pass after an `mpv.observe` listener, and a timeline layer's range limit); `subscribe()` and `onChange()` keep working unchanged. Needs player 0.10.0 for the source events, triggers, what the player keeps through standby, and 1000 ranges; an older player sends no source events, refuses the `triggers.*` requests and more than 100 ranges, and everything else works with it.
|
|
6
|
+
|
|
7
|
+
**Four ways to get the player's state.** Read it once (`player.read()`, `player.refresh()`, unchanged); hear a discrete event (`player.on("source.ready", fn)`, new events below); hand the player a condition and be told when it turns true and when it turns false (`plugin.trigger()`, new); or follow every change while something shows it (`player.stream(fn)`, new). The first three let the plugin go to standby: the player wakes it for an event or a trigger. Only the stream keeps it running, while it is open ([How plugins work](docs/guides/how-plugins-work.md)).
|
|
8
|
+
|
|
9
|
+
- **Source events** (new, need player 0.10.0): `source.opening` (a source starts to open; `{ state, previous }`, `previous` naming the source open before it, `null` when none was), `source.ready` (it is loaded: duration, tracks and seekability known; `{ state }`) and `source.ended` (it left playback; `{ state, reason, error? }`, `reason` one of `natural`, `stopped`, `replaced`, `error`, `quit`, and `state` that source's last state, with its last position). Once each per source, in that order; a replaced source's `ended` comes before the next one's `opening`. `state` is a `PlayerState`, so it can be passed as `ifCurrent`; for `opening` and `ready` it also becomes `player.state`. `player.on` takes them with typed data (`SourceEvent`, `SourceEventPayloads`), without `subscribe()`. They wake a plugin in standby, so a listener does not keep its plugin running; a plugin in standby gets no `ended` with `quit`. `TestHost` sends them when a source opens, becomes ready and ends ([Events](docs/reference/events.md)).
|
|
10
|
+
- **Triggers** (new, need player 0.10.0): `plugin.trigger(name?)`, called on the plugin (not on a scope made with `plugin.scope()`) in the synchronous part of `activate()`, with `.firesOn(condition)`, `.enter(fn)`, `.leave(fn)` and `.off()`. The player keeps the condition and evaluates it, also while the plugin is in standby, and wakes the plugin when it flips; `enter` and `leave` get `{ state, range? }`, and one trigger's functions run one after another. A condition already true when given is entered at once; the same condition given again changes nothing, so `activate()` may hand it over at every start. Without a name a trigger is known by its place among the unnamed ones, and its condition is cleared when the plugin is updated; with a name it survives an update. A notification nobody handles removes its condition. At most 64 triggers per plugin (`TRIGGER_LIMITS`).
|
|
11
|
+
- **The `when` language grows**: `duration`, `volume`, `rate` (one interval `{ min?, max? }`, `min ≤ value < max`), `audioTrack(id)`, `subtitleTrack(id)` (the primary subtitle track), `audioDevice(id)`, `muted`, `maximized` (never while fullscreen), `pip` and `looping` (an A-B loop is set). They work in a trigger and in a command's `enabled` and `checked` alike (player 0.10.0). Two more are for triggers only, and the player refuses them in a command's state: `time({ min?, max? })` (the wall clock in Unix milliseconds; never before the bound) and `position.in(ranges, { lead })` (the position is in one of the ranges, or less than `lead` media seconds before its start; at most 1000 ranges, bound to the source current when the player receives it; `enter` gets the matched range). A fact that cannot be read counts as false ([Command state](docs/guides/command-state.md)).
|
|
12
|
+
- **`plugin.player.stream(fn)`** (new, with `StateStream`): follow the player's state while something shows it continuously (a window with the position, a meter). `fn` gets the current state once (one read right after the call), then every change the player sends; `player.state` is updated before each call and an update pass runs after it. It needs no `subscribe()`: the stream's own subscription ends with its last `stop()` (or its scope), and `player.state` then keeps the last snapshot. While a stream is open the player keeps the plugin running (a listener, named in its log as `a stream opened at main.ts:12`); after the last `stop()` nothing of it does, so a plugin that holds nothing else goes to standby after its idle time. A stream open when the plugin becomes ready counts as a listener held at the ready: the plugin keeps running for that run. Uses the existing `events.subscribe` and `events.unsubscribe` messages, so it works with older players too.
|
|
13
|
+
- **The player keeps a plugin's static state through standby** (player 0.10.0; nothing changes in the SDK): its timeline layer (marks and ranges) and the always-on-top and cursor settings it wrote no longer keep it running. The layer stays drawn and the settings in effect while the plugin is stopped; after a wake its next write replaces them; a new source still clears every layer; a crash, disable, uninstall, reload, update and the quit remove them. `TestHost.keepsRunning` never counted them.
|
|
14
|
+
- **`TestHost`** keeps and evaluates trigger conditions as the player does and gains `triggers` (what it keeps), `now` and `advance(ms)` (a virtual clock that also moves the playback position, so a range is entered at its time without waiting), `park()` and `parked` (the plugin stops and its subscriptions, conditions, layer and window settings stay; an event or a flip wakes it again), and `upgrade(activate?)` (unnamed conditions cleared, named ones kept). The runner calls `PluginInstance.activate(entry)` (new) instead of `entry` itself, so the triggers `activate()` declares are known.
|
|
15
|
+
- **`plugin.mpv.observe`: an update pass follows each listener**, as after every other handler the SDK calls (the guide always said so; since 1.8.0 the listener ran without one, so a binding that read a value the listener set showed it only at the next full pass). `player.on` stays the one listener without a full pass; the guide now says so.
|
|
16
|
+
- **`plugin.mpv.observe`: every listener gets the current value first.** A second listener of a property the plugin already observes (one `mpv.observe` per property) got nothing until the next change; it now gets the value kept from the first, just after `observe` returns, unless a newer one reaches it first.
|
|
17
|
+
- **`AudioTrack.streamIndex`** (new): the container stream number of an embedded audio track (`ffmpeg -map 0:<n>`), `null` for an external track or when the player cannot tell, as `SubtitleTrack.streamIndex`. Optional in the type (the SDK always sets it), so that an `AudioTrack` a plugin writes out in full, such as a test fixture, still type-checks. The player already sends it; `TestHost` passes on what `setSource({ audioTracks })` gives.
|
|
18
|
+
- **Timeline ranges: 1000 per layer** (was 100), as many as marks: `TIMELINE_LIMITS.ranges` is 1000, and `TestHost` refuses the 1001st. An older player still refuses more than 100.
|
|
19
|
+
- **`vestra-plugin i18n extract` and `i18n check` fail, saying why**, when a text is called through a name of its own (`const { text } = plugin.i18n; text("…")`) while the plugin directory does not resolve the types of `@vestra-player/sdk`: such a call was left out of `messages.pot` silently. The message names each call and what to do (install the dependencies, or call `plugin.i18n.text` directly).
|
|
20
|
+
- **`vestra-plugin check` compiles the plugin's `.slint` files** as the player does at install (Slint 1.18.1, the `@vestra` library, `fluent-dark`) when the npm package `slint-ui` at that version is installed in the plugin project; an error fails the check with file, line and column. The SDK does not install the compiler (a native module of about 25 MB under Slint's own licence): `npm install -D slint-ui@1.18.1`. Without it the check says the files were not compiled and passes ([CLI](docs/reference/cli.md)).
|
|
21
|
+
- **Docs.** The design rules and the player's interface spec no longer ask for `font-feature: tnum` (Slint 1.18 has no such property; a time or counter whose digits must not shift uses `Theme.font-mono`). `Mpv` no longer names the capability `mpv` (gone in 1.9.0): the capability scan's `player` category discloses it. The mpv reference's rules table shows `all` where it showed an unrendered `${code(…)}`. The 1.8.0 and 1.9.0 entries below no longer name internal planning documents. What keeps a plugin running: an mpv filter or observer, and a filter chain taken up after the ready, keep it running for the rest of that run, also after they are removed (the player judges again at the next start); a listener added after the ready keeps it running while the listener exists ([How plugins work](docs/guides/how-plugins-work.md#what-keeps-a-plugin-running), [mpv](docs/reference/mpv.md#properties-and-observers)). What stays while a plugin is stopped now names its trigger conditions besides the kept layer and window settings.
|
|
22
|
+
|
|
23
|
+
The API surface snapshot gains `AudioTrack.streamIndex`, the source events (`SourceEvent`, `SourceEventPayloads`), `Player.stream` and `StateStream`, the trigger types (`Plugin.trigger`, `Trigger`, `TriggerEvent`, `PositionRange`, the new `When` members) and the test host's (`TestHost.triggers`, `now`, `advance`, `park`, `parked`, `upgrade`, `KeptTrigger`, `TRIGGER_LIMITS`); `TIMELINE_LIMITS`' line changes its `ranges` value from 100 to 1000 (the one changed line, the ruled limit change).
|
|
24
|
+
|
|
3
25
|
## 1.9.0
|
|
4
26
|
|
|
5
|
-
**Who must change: every plugin with a `capabilities` field, and every plugin that follows the player's state.** Manifest capabilities are gone
|
|
27
|
+
**Who must change: every plugin with a `capabilities` field, and every plugin that follows the player's state.** Manifest capabilities are gone. A manifest says who the plugin is; what the store shows the user comes only from the capability scan of the code ([Capability scan](docs/reference/scan.md)). The two declarations that changed how a plugin ran are now calls, and nothing else is declared or checked. Needs player 0.9.0, which removes its gate in the same release; `apiVersion` stays `vestra/1`.
|
|
6
28
|
|
|
7
29
|
**Migration** (first lines of `activate`, then delete the field):
|
|
8
30
|
|
|
@@ -16,14 +38,14 @@ export default async function activate(plugin: Plugin) {
|
|
|
16
38
|
|
|
17
39
|
Keep only the lines whose declaration the manifest had; a plugin that had neither adds nothing. Set `minPlayerVersion` to `0.9.0`: an older player requires the field. Remove `@vestra-player/sdk/ts-plugin` from `tsconfig.json`, `capabilities` from `startPlugin(…)` options in tests, and `--json` from `vestra-plugin check`.
|
|
18
40
|
|
|
19
|
-
**New: the explicit calls
|
|
41
|
+
**New: the explicit calls.**
|
|
20
42
|
|
|
21
43
|
- **`plugin.player.subscribe()`** (sync, idempotent): turns on event delivery for this run and subscribes the state copy now. Until it is called, a listener of `source.state`, `playback.backend`, `window.state`, `timeline.changed`, `appearance.changed` or `resolvers.fileTypes` never runs, as without `events` before (the one-time warning in the log now names `subscribe()`); a listener added earlier starts to hear events at the call. The other events (`packages.changed`, `bindings.changed`, `commands.keys`, `video.upscaling.changed`, `video.motion.changed`) arrive from the first listener, as they did with their own declarations.
|
|
22
44
|
- **`await plugin.player.read()`** (idempotent; a failed read is tried again by the next call): reads `source.state` and `timeline.marks` and turns on the re-reads after the plugin's own actions (`host.run`, closing a `Media`, a stream's end), as `playback.read` did. Before it, `plugin.player.state` is the empty state. `subscribe()` after `read()` reads the state once more, since a change between the two sent no event.
|
|
23
45
|
- **Command keys and the layout state start on first use** (`plugin.commands.keys`, `plugin.panels.*.state`), with no declaration.
|
|
24
|
-
- **Wire order** (the one
|
|
46
|
+
- **Wire order** (the one intended shift): the start-up `window.state` read now comes first, because it is answered before `activate` begins; the player-state requests follow it, one round trip later. Proof: with the explicit calls first in `activate`, all 19 golden scenarios equal their declared traces after that one transformation (recorded on both paths while both still existed; `test/explicit-calls.test.ts` keeps the request sequences); in this release the 14 traces it changes were regenerated (list below) and the others are byte-identical.
|
|
25
47
|
|
|
26
|
-
**Removed: everything that reads declarations** (
|
|
48
|
+
**Removed: everything that reads declarations** (no legacy path).
|
|
27
49
|
|
|
28
50
|
- **Manifest field `capabilities`**: an error everywhere the SDK reads a manifest (`vestra-plugin check`/`build`/`pack`, `startPlugin`), with a message that names the change and the two calls (`CAPABILITIES_REMOVED`). An error, not a warning, because the player refuses unknown manifest fields and an ignored list would leave a plugin that silently stops hearing events or reading the state; the message says exactly what to write instead.
|
|
29
51
|
- **Early refusals with `capability`** (`media.sources`, `playback.control` for `media.sources.open`, `mpv`, `secrets`, `rendering.manage`, `video.upscaling`, `video.motion`, `processing.video`, `timeline.marks`, `commands.run`, `palette.lead`): the calls are sent and the player answers. `capability` remains the player's (and `TestHost`'s) code for the built-in-only requests (`commands.list`, `commands.run`, `palette.lead.*`) from a plugin that is not built in.
|
|
@@ -38,15 +60,15 @@ Keep only the lines whose declaration the manifest had; a plugin that had neithe
|
|
|
38
60
|
|
|
39
61
|
**Kept**: the capability scan and `capability-scan.json` (its test now covers every method the SDK sends instead of the removed table), `API_REQUESTS` (the message and event tables), the message and event reference pages (by area; the events table says which events wait for `subscribe()`).
|
|
40
62
|
|
|
41
|
-
**Golden traces regenerated** (the
|
|
63
|
+
**Golden traces regenerated** (the intended `window.state` shift; nothing else differs): `builtins-info`, `builtins-playback`, `builtins-playlist`, `builtins-subtitles`, `builtins-video`, `examples-adjust-panel`, `examples-blur`, `examples-bookmark`, `examples-menus`, `examples-signal-generator`, `styles-speed-a`, `styles-speed-b`, `styles-speed-c`, `host-start-taken`. The 11 examples and the three style plugins were migrated (field deleted, the calls inserted, `minPlayerVersion` 0.9.0); built-ins at the pinned player commit, which still declare, start through the same calls (`test/explicit.ts`) until they are migrated and re-pinned.
|
|
42
64
|
|
|
43
65
|
## 1.8.0
|
|
44
66
|
|
|
45
|
-
**Who must change: nobody.** Pure additions and a product-data sync
|
|
67
|
+
**Who must change: nobody.** Pure additions and a product-data sync: the 31 existing capabilities, their members, what each needs and every existing behaviour of the SDK and of `TestHost` are as in 1.7.20; the existing tests and golden traces pass unchanged. A plugin that does nothing keeps working on every player. A plugin that uses an addition needs the player released with this SDK (`minPlayerVersion`); `apiVersion` stays `vestra/1`.
|
|
46
68
|
|
|
47
69
|
**mpv pass-through** (a new capability and member). `plugin.mpv` sends mpv's own commands and properties to the player's mpv. Intended users: a GPU vendor's motion-smoothing or upscaling plugin (a filter and its options, without a new player method per feature, as 1.7.19 needed), a shader or scaler pack that sets renderer options, a statistics panel that observes mpv's measurements.
|
|
48
70
|
|
|
49
|
-
- **Capability `mpv`** (new, the 32nd; **risky**: the store highlights it; not built-in only; residency `live`), shown as "Control the playback engine (mpv) directly: send its commands and change its options". It crosses a boundary
|
|
71
|
+
- **Capability `mpv`** (new, the 32nd; **risky**: the store highlights it; not built-in only; residency `live`), shown as "Control the playback engine (mpv) directly: send its commands and change its options". It crosses a boundary: what it sets is the user's player beyond the plugin's own contributions and stays after the plugin stops. It is the last row of the player's table; no existing capability changes.
|
|
50
72
|
- **`Mpv`** (`plugin.mpv`): `command(args)` (the command's name and its arguments as an array; resolves with mpv's result), `get(name)`, `set(name, value)`, `observe(name, listener)` (the current value first, then each change, at most every 100 ms; a `Disposable`). Values are `MpvValue` (JSON). Messages: `mpv.command`, `mpv.get`, `mpv.set`, `mpv.observe`, `mpv.unobserve`, and the event `mpv.property`, sent to the observer without a subscription. The channel is the contract; the names and what they do are mpv's and can change with a player version.
|
|
51
73
|
- **Refused** with the new error code **`refused`** (the message names the command or property and why), by a closed rule: what starts a program, loads scripts or configuration, opens a control channel or talks to mpv's other clients, makes the player write or delete files, ends the player, drives its keyboard and mouse, reaches the clipboard, or changes what the player manages itself (the source and the playlist, the position, the tracks, the output and the window, the subtitle style, the renderer options of `plugin.video`, the filter chains as a whole). Reading is not refused, except the clipboard. It is not a sandbox: a plugin does the first four with Node. The table is data shared with the player (`MPV_RULES`, `MPV_LIMITS`, exported from `./runtime` for its agreement test) and printed in the new reference page [mpv](docs/reference/mpv.md). mpv's own errors arrive as `backend` with mpv's words ("mpv: property not found").
|
|
52
74
|
- **Ownership**: a filter is added as `["vf", "add", "@label:…"]` (`af`; `add`, `pre`, `toggle`, `remove`) with a label of the plugin's own, not starting with `vestra-`. The label has one owner (`conflict` for another plugin), the player removes a plugin's filters and observers when it stops, and keeps a plugin that has one running. The player's own filters (the typed chains, the upscaler, motion smoothing) stay beside it; a pass-through filter does not reach snapshots and exports, which the typed chains do. A property a plugin set stays set until the player quits.
|
package/bin/vestra-plugin.mjs
CHANGED
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
* directory. Works in any project that depends on @vestra-player/sdk.
|
|
15
15
|
*
|
|
16
16
|
* check the manifest, then a strict type check of the plugin's .ts
|
|
17
|
-
* files and tests/*.ts
|
|
17
|
+
* files and tests/*.ts; with slint-ui at the player's Slint
|
|
18
|
+
* version installed, every .slint file compiled as the player
|
|
19
|
+
* compiles it at install (errors with line and column)
|
|
18
20
|
* build check, then write dist/: .ts → .js with types stripped, other
|
|
19
21
|
* package files copied, dist/manifest.json with `version`
|
|
20
22
|
* test node --test on tests/*.test.{ts,mjs}
|
|
@@ -101,6 +103,9 @@ const i18n = await import(pathToFileURL(join(sdkRoot, "dist/i18n.js")).href);
|
|
|
101
103
|
const i18nTools = await import(
|
|
102
104
|
pathToFileURL(join(sdkRoot, "dist/i18n-tools.js")).href
|
|
103
105
|
);
|
|
106
|
+
const { PLAYER_SLINT } = await import(
|
|
107
|
+
pathToFileURL(join(sdkRoot, "dist/slint-version.js")).href
|
|
108
|
+
);
|
|
104
109
|
const SDK = "@vestra-player/sdk";
|
|
105
110
|
|
|
106
111
|
/** Never part of a production package. */
|
|
@@ -312,10 +317,79 @@ function checkConfig(target, sources) {
|
|
|
312
317
|
};
|
|
313
318
|
}
|
|
314
319
|
|
|
320
|
+
/**
|
|
321
|
+
* Compile every .slint file of the plugin as the player does when it
|
|
322
|
+
* installs a package (`package_validate.rs`): Slint's own compiler at the
|
|
323
|
+
* player's version, the library `@vestra` (the SDK's copy, `slint/vestra/`),
|
|
324
|
+
* the style `fluent-dark`; an error fails, except "No component found" (a
|
|
325
|
+
* file of globals or of components for others to import, compiled by its
|
|
326
|
+
* importers). The compiler is the npm package `slint-ui` (a native module,
|
|
327
|
+
* about 25 MB, under Slint's own licence), which the SDK does not install:
|
|
328
|
+
* an author or a CI adds it (`npm install -D slint-ui@<version>`). Without
|
|
329
|
+
* it, or at another version, the step says so and passes.
|
|
330
|
+
*/
|
|
331
|
+
async function slintStep(target, say) {
|
|
332
|
+
const { slint } = await sourceFiles(target);
|
|
333
|
+
if (!slint.length) return;
|
|
334
|
+
const manifest = resolveFrom(target.directory, "slint-ui/package.json");
|
|
335
|
+
const version = manifest
|
|
336
|
+
? JSON.parse(await readFile(manifest, "utf8")).version
|
|
337
|
+
: null;
|
|
338
|
+
if (version !== PLAYER_SLINT) {
|
|
339
|
+
say(
|
|
340
|
+
`${target.name}: slint: ${slint.length} .slint file(s) not compiled: ${version ? `slint-ui ${version} is installed, the player uses Slint ${PLAYER_SLINT}` : "slint-ui is not installed"}; to compile them as the player does, npm install -D slint-ui@${PLAYER_SLINT}`,
|
|
341
|
+
);
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
let compiler;
|
|
345
|
+
try {
|
|
346
|
+
// The package itself (CommonJS), by its directory.
|
|
347
|
+
compiler = createRequire(manifest)(dirname(manifest));
|
|
348
|
+
} catch (error) {
|
|
349
|
+
say(
|
|
350
|
+
`${target.name}: slint: not compiled: slint-ui ${version} does not load (${error.message})`,
|
|
351
|
+
);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
const errors = [];
|
|
355
|
+
for (const file of slint) {
|
|
356
|
+
const path = join(target.directory, file);
|
|
357
|
+
try {
|
|
358
|
+
compiler.loadFile(path, {
|
|
359
|
+
style: "fluent-dark",
|
|
360
|
+
libraryPaths: { vestra: join(sdkRoot, "slint", "vestra") },
|
|
361
|
+
quiet: true,
|
|
362
|
+
});
|
|
363
|
+
} catch (error) {
|
|
364
|
+
const diagnostics = error?.diagnostics;
|
|
365
|
+
if (!Array.isArray(diagnostics)) throw error;
|
|
366
|
+
for (const d of diagnostics) {
|
|
367
|
+
if (d.message === "No component found") continue;
|
|
368
|
+
const where = d.fileName
|
|
369
|
+
? relative(target.directory, resolve(target.directory, d.fileName))
|
|
370
|
+
.split(sep)
|
|
371
|
+
.join("/")
|
|
372
|
+
: file.split(sep).join("/");
|
|
373
|
+
errors.push(`${where}:${d.lineNumber}:${d.columnNumber}: ${d.message}`);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
for (const line of [...new Set(errors)])
|
|
378
|
+
say(`${target.name}: slint: ${line}`);
|
|
379
|
+
if (errors.length)
|
|
380
|
+
fail(
|
|
381
|
+
`${target.name}: ${slint.length} .slint file(s) compiled with Slint ${version}: ${new Set(errors).size} error(s), the player would refuse the package`,
|
|
382
|
+
);
|
|
383
|
+
say(
|
|
384
|
+
`${target.name}: slint: ${slint.length} file(s) compiled with Slint ${version}`,
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
|
|
315
388
|
async function check(target) {
|
|
316
389
|
const say = (line) => console.log(line);
|
|
317
390
|
for (const hint of target.hints ?? []) say(`${target.name}: hint: ${hint}`);
|
|
318
391
|
dependencies(target);
|
|
392
|
+
await slintStep(target, say);
|
|
319
393
|
const own = (await files(target.directory)).filter(
|
|
320
394
|
(file) => isTypeScript(file) || file.endsWith(".mts"),
|
|
321
395
|
);
|
|
@@ -457,13 +531,20 @@ async function extraction(target) {
|
|
|
457
531
|
ts.sys,
|
|
458
532
|
target.directory,
|
|
459
533
|
);
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
534
|
+
try {
|
|
535
|
+
return i18nTools.extract({
|
|
536
|
+
directory: target.directory,
|
|
537
|
+
manifest: target.manifest,
|
|
538
|
+
slint,
|
|
539
|
+
typescript: sources,
|
|
540
|
+
compilerOptions: parsed.options,
|
|
541
|
+
});
|
|
542
|
+
} catch (error) {
|
|
543
|
+
// A text that would be left out silently: fail and say why.
|
|
544
|
+
if (error?.code === "sdk-types")
|
|
545
|
+
fail(`${target.name}: i18n: ${error.message}`);
|
|
546
|
+
throw error;
|
|
547
|
+
}
|
|
467
548
|
}
|
|
468
549
|
|
|
469
550
|
async function i18nReport(target) {
|
package/capability-scan.json
CHANGED
|
@@ -178,7 +178,9 @@
|
|
|
178
178
|
"Player.setStepSeek",
|
|
179
179
|
"Player.stats",
|
|
180
180
|
"Player.step",
|
|
181
|
+
"Player.stream",
|
|
181
182
|
"Player.subscribe",
|
|
183
|
+
"Plugin.trigger",
|
|
182
184
|
"Power.preventSleep",
|
|
183
185
|
"RenderOptions.onStatus",
|
|
184
186
|
"RenderOptions.set",
|
|
@@ -210,6 +212,7 @@
|
|
|
210
212
|
"Settings.show",
|
|
211
213
|
"SidebarSlot.setDetached",
|
|
212
214
|
"Snapshot.export",
|
|
215
|
+
"StateStream.stop",
|
|
213
216
|
"Storage.json",
|
|
214
217
|
"Stream.onStop",
|
|
215
218
|
"Stream.stop",
|
|
@@ -228,6 +231,10 @@
|
|
|
228
231
|
"TimelineLayer.setRanges",
|
|
229
232
|
"Tools.available",
|
|
230
233
|
"Tools.run",
|
|
234
|
+
"Trigger.enter",
|
|
235
|
+
"Trigger.firesOn",
|
|
236
|
+
"Trigger.leave",
|
|
237
|
+
"Trigger.off",
|
|
231
238
|
"Ui.image",
|
|
232
239
|
"Ui.markdown",
|
|
233
240
|
"Ui.remoteImage",
|
|
@@ -246,10 +253,18 @@
|
|
|
246
253
|
"View.on",
|
|
247
254
|
"View.set",
|
|
248
255
|
"WebResolverOptions.resolve",
|
|
256
|
+
"When.audioDevice",
|
|
257
|
+
"When.audioTrack",
|
|
249
258
|
"When.can",
|
|
259
|
+
"When.duration",
|
|
250
260
|
"When.language",
|
|
251
261
|
"When.phase",
|
|
262
|
+
"When.position.in",
|
|
263
|
+
"When.rate",
|
|
264
|
+
"When.subtitleTrack",
|
|
252
265
|
"When.theme",
|
|
266
|
+
"When.time",
|
|
267
|
+
"When.volume",
|
|
253
268
|
"Window.close",
|
|
254
269
|
"Window.hide",
|
|
255
270
|
"Window.onClose",
|
|
@@ -340,6 +355,9 @@
|
|
|
340
355
|
"timeline.marks",
|
|
341
356
|
"timeline.set",
|
|
342
357
|
"timeline.setRanges",
|
|
358
|
+
"triggers.declare",
|
|
359
|
+
"triggers.off",
|
|
360
|
+
"triggers.set",
|
|
343
361
|
"ui.close",
|
|
344
362
|
"ui.interaction",
|
|
345
363
|
"ui.markdownScan",
|
package/dist/api-requests.d.ts
CHANGED
|
@@ -24,9 +24,10 @@ export interface ApiRequest {
|
|
|
24
24
|
export declare const API_REQUESTS: Readonly<Record<string, readonly ApiRequest[]>>;
|
|
25
25
|
/**
|
|
26
26
|
* The events whose listener subscribes (`events.subscribe` with the event
|
|
27
|
-
* name): the plugin API's `HostEvent`. Other names a
|
|
28
|
-
* (`commands.execute`, `ui.callback`) arrive unasked and
|
|
29
|
-
*
|
|
27
|
+
* name): the plugin API's `HostEvent` and `SourceEvent`. Other names a
|
|
28
|
+
* plugin listens to (`commands.execute`, `ui.callback`) arrive unasked and
|
|
29
|
+
* need nothing.
|
|
30
|
+
* test/wire-facade.test.ts keeps it equal to `EVENT_NEEDS`.
|
|
30
31
|
*
|
|
31
32
|
* @internal
|
|
32
33
|
*/
|
package/dist/api-requests.js
CHANGED
|
@@ -61,6 +61,9 @@ export const API_REQUESTS = Object.freeze({
|
|
|
61
61
|
"Subtitles.load": [{ method: "subtitles.upload.begin" }, readsSubtitles],
|
|
62
62
|
"Subtitles.remove": [{ method: "subtitles.remove" }, readsSubtitles],
|
|
63
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" }],
|
|
64
67
|
"Timeline.marks": [{ method: "timeline.marks" }],
|
|
65
68
|
"Timeline.ranges": [{ method: "timeline.marks" }],
|
|
66
69
|
"Timeline.layer": [
|
|
@@ -166,9 +169,10 @@ export const API_REQUESTS = Object.freeze({
|
|
|
166
169
|
});
|
|
167
170
|
/**
|
|
168
171
|
* The events whose listener subscribes (`events.subscribe` with the event
|
|
169
|
-
* name): the plugin API's `HostEvent`. Other names a
|
|
170
|
-
* (`commands.execute`, `ui.callback`) arrive unasked and
|
|
171
|
-
*
|
|
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`.
|
|
172
176
|
*
|
|
173
177
|
* @internal
|
|
174
178
|
*/
|
|
@@ -184,4 +188,7 @@ export const SUBSCRIBED_EVENTS = Object.freeze([
|
|
|
184
188
|
"resolvers.fileTypes",
|
|
185
189
|
"video.upscaling.changed",
|
|
186
190
|
"video.motion.changed",
|
|
191
|
+
"source.opening",
|
|
192
|
+
"source.ready",
|
|
193
|
+
"source.ended",
|
|
187
194
|
]);
|