@vestra-player/sdk 1.7.1 → 1.7.2
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 +10 -0
- package/README.md +6 -9
- package/bin/vestra-plugin.mjs +4 -4
- package/dist/api-requests.d.ts +8 -8
- package/dist/api-requests.js +8 -8
- package/dist/capability-check.d.ts +15 -15
- package/dist/capability-check.js +4 -4
- package/dist/capability-rules.d.ts +4 -5
- package/dist/capability-rules.js +4 -5
- package/dist/commands.d.ts +34 -44
- package/dist/commands.js +21 -27
- package/dist/docs-tree.json.gz +0 -0
- package/dist/docs.d.ts +1 -1
- package/dist/docs.js +13 -3
- package/dist/i18n-tools.js +1 -1
- package/dist/i18n.js +1 -1
- package/dist/media.d.ts +7 -7
- package/dist/palettes.d.ts +5 -5
- package/dist/palettes.js +5 -5
- package/dist/plugin/appearance.js +1 -1
- package/dist/plugin/bindings.d.ts +2 -3
- package/dist/plugin/bindings.js +2 -3
- package/dist/plugin/commands.js +10 -11
- package/dist/plugin/connection.d.ts +18 -19
- package/dist/plugin/connection.js +23 -24
- package/dist/plugin/index.d.ts +5 -5
- package/dist/plugin/index.js +1 -1
- package/dist/plugin/osd.d.ts +1 -1
- package/dist/plugin/osd.js +1 -1
- package/dist/plugin/passes.d.ts +4 -4
- package/dist/plugin/passes.js +4 -4
- package/dist/plugin/patch.d.ts +8 -8
- package/dist/plugin/patch.js +12 -12
- package/dist/plugin/player/events.js +5 -5
- package/dist/plugin/resolvers.js +3 -3
- package/dist/plugin/scope.d.ts +4 -4
- package/dist/plugin/scope.js +4 -4
- package/dist/plugin/services.d.ts +2 -3
- package/dist/plugin/services.js +2 -3
- package/dist/plugin/shaders.js +5 -6
- package/dist/plugin/state.js +10 -10
- package/dist/plugin/testing/commands.d.ts +4 -5
- package/dist/plugin/testing/commands.js +4 -5
- package/dist/plugin/testing/i18n.d.ts +1 -1
- package/dist/plugin/testing/i18n.js +1 -1
- package/dist/plugin/testing/index.d.ts +147 -165
- package/dist/plugin/testing/index.js +137 -155
- package/dist/plugin/testing/internals.d.ts +2 -2
- package/dist/plugin/testing/internals.js +2 -2
- package/dist/plugin/timeline.d.ts +1 -1
- package/dist/plugin/timeline.js +2 -2
- package/dist/plugin/types/base.d.ts +90 -111
- package/dist/plugin/types/commands.d.ts +142 -174
- package/dist/plugin/types/packages.d.ts +48 -63
- package/dist/plugin/types/playback.d.ts +45 -59
- package/dist/plugin/types/plugin-wire.d.ts +38 -45
- package/dist/plugin/types/processing.d.ts +52 -65
- package/dist/plugin/types/services.d.ts +18 -25
- package/dist/plugin/types/snapshots.d.ts +34 -46
- package/dist/plugin/types/sources.d.ts +14 -16
- package/dist/plugin/types/subtitles.d.ts +7 -8
- package/dist/plugin/types/ui-content.d.ts +111 -116
- package/dist/plugin/types/ui-layout.d.ts +52 -63
- package/dist/plugin/types/ui-locale.d.ts +41 -45
- package/dist/plugin/types/ui-shell.d.ts +69 -87
- package/dist/plugin/values.d.ts +15 -18
- package/dist/plugin/values.js +16 -19
- package/dist/plugin/view/base.d.ts +2 -2
- package/dist/plugin/view/base.js +7 -8
- package/dist/plugin/view/layout.d.ts +2 -2
- package/dist/plugin/view/panel.js +2 -4
- package/dist/plugin/view/writer.d.ts +8 -8
- package/dist/plugin/view/writer.js +37 -39
- package/dist/plugin/when.d.ts +3 -3
- package/dist/plugin/wire-facade.js +6 -7
- package/dist/processing.d.ts +26 -30
- package/dist/processing.js +4 -4
- package/dist/source-resolvers.d.ts +2 -2
- package/dist/source.d.ts +1 -2
- package/dist/subtitles.d.ts +1 -1
- package/dist/ts-plugin.d.ts +5 -5
- package/dist/wire.d.ts +63 -70
- package/dist/wire.js +21 -25
- package/llms.txt +7 -10
- package/package.json +1 -1
- package/slint/vestra/bar-buttons.slint +6 -8
- package/slint/vestra/focus.slint +1 -1
- package/slint/vestra/widgets.slint +2 -4
|
@@ -244,7 +244,7 @@ export { LOCALES };
|
|
|
244
244
|
* recorded.
|
|
245
245
|
*
|
|
246
246
|
* @capability None.
|
|
247
|
-
* @see [Test a plugin](../../../docs/
|
|
247
|
+
* @see [Test a plugin](../../../docs/guides/testing.md)
|
|
248
248
|
* @since 1.0.0
|
|
249
249
|
* @category Testing
|
|
250
250
|
*/
|
|
@@ -286,8 +286,8 @@ export class TestHost {
|
|
|
286
286
|
/** Tool windows by id (see {@link TestHost.window}). */
|
|
287
287
|
windows = new Map();
|
|
288
288
|
/**
|
|
289
|
-
* The plugin's mounted panels by slot, in mount order (
|
|
290
|
-
*
|
|
289
|
+
* The plugin's mounted panels by slot, in mount order (one panel per slot).
|
|
290
|
+
* See {@link TestHost.mounted}.
|
|
291
291
|
*/
|
|
292
292
|
panels = new Map();
|
|
293
293
|
/**
|
|
@@ -333,15 +333,15 @@ export class TestHost {
|
|
|
333
333
|
*/
|
|
334
334
|
osd = [];
|
|
335
335
|
/**
|
|
336
|
-
* The action buttons of each `osd.show` message, in step with `osd`
|
|
337
|
-
*
|
|
338
|
-
*
|
|
336
|
+
* The action buttons of each `osd.show` message, in step with `osd` (index
|
|
337
|
+
* for index): each button's title as shown and its command; `[]` for a
|
|
338
|
+
* message without actions.
|
|
339
339
|
*/
|
|
340
340
|
osdActions = [];
|
|
341
341
|
/**
|
|
342
|
-
* Press button `index` of the newest OSD message, as the user does
|
|
343
|
-
*
|
|
344
|
-
*
|
|
342
|
+
* Press button `index` of the newest OSD message, as the user does: its
|
|
343
|
+
* command runs as if picked from a menu, and settles. A disabled or busy
|
|
344
|
+
* command does nothing, as in the player.
|
|
345
345
|
*
|
|
346
346
|
* @param index - 0 or 1.
|
|
347
347
|
*
|
|
@@ -382,11 +382,10 @@ export class TestHost {
|
|
|
382
382
|
* messages, dialog texts, settings page and panel titles show its
|
|
383
383
|
* translations, the way the player shows them.
|
|
384
384
|
*
|
|
385
|
-
* The player's own texts (core actions' messages and menus, its
|
|
386
|
-
*
|
|
387
|
-
*
|
|
388
|
-
*
|
|
389
|
-
* passing; set `locale` to test what a user sees now.
|
|
385
|
+
* The player's own texts (core actions' messages and menus, its refusals) are
|
|
386
|
+
* English, or the player's Simplified Chinese for `"zh-Hans"`. While `locale`
|
|
387
|
+
* was never set they stay in Chinese; set `locale` to test what a user sees
|
|
388
|
+
* now.
|
|
390
389
|
*
|
|
391
390
|
* @example Check a menu path in Simplified Chinese
|
|
392
391
|
* The test starts the plugin with a Chinese interface and checks the
|
|
@@ -668,8 +667,7 @@ export class TestHost {
|
|
|
668
667
|
.sort((a, b) => a.time - b.time);
|
|
669
668
|
},
|
|
670
669
|
/**
|
|
671
|
-
* Each plugin's ranges by plugin id; layers without ranges are absent
|
|
672
|
-
* (SDK 1.6.9).
|
|
670
|
+
* Each plugin's ranges by plugin id; layers without ranges are absent.
|
|
673
671
|
*/
|
|
674
672
|
rangeLayers: new Map(),
|
|
675
673
|
/** Every layer's ranges merged, sorted by start, with the plugin's id. */
|
|
@@ -744,10 +742,10 @@ export class TestHost {
|
|
|
744
742
|
}
|
|
745
743
|
/**
|
|
746
744
|
* Runtime images written to views (`plugin.ui.image`,
|
|
747
|
-
* `plugin.ui.remoteImage`), whole values and
|
|
748
|
-
*
|
|
749
|
-
*
|
|
750
|
-
*
|
|
745
|
+
* `plugin.ui.remoteImage`), whole values and images nested in rows, newest
|
|
746
|
+
* last. The SDK refuses images of released scopes before anything is sent.
|
|
747
|
+
* The test host does not read the files, so it does not check the player's
|
|
748
|
+
* per-view budget (`IMAGE_LIMITS.viewBytes`).
|
|
751
749
|
*/
|
|
752
750
|
images = [];
|
|
753
751
|
/**
|
|
@@ -1080,14 +1078,13 @@ export class TestHost {
|
|
|
1080
1078
|
this.videoRender.values = { ...RENDER_DEFAULTS, shaders: [] };
|
|
1081
1079
|
}
|
|
1082
1080
|
/**
|
|
1083
|
-
* What the player pushes when mpv cannot compile a shader (code `failed`)
|
|
1084
|
-
*
|
|
1085
|
-
* `videoRender.gpu` to false and `rendering.reason` to `window-fallback`
|
|
1086
|
-
*
|
|
1087
|
-
*
|
|
1088
|
-
*
|
|
1089
|
-
*
|
|
1090
|
-
* {@link TestHost.previousCrash}.
|
|
1081
|
+
* What the player pushes when mpv cannot compile a shader (code `failed`) or
|
|
1082
|
+
* switches to software rendering (`unsupported`, which also sets
|
|
1083
|
+
* `videoRender.gpu` to false and `rendering.reason` to `window-fallback` with
|
|
1084
|
+
* `message`). Pushed only when this plugin is the owner. `previous-crash` is
|
|
1085
|
+
* a shortcut that only sets the handle's status and reaches `onError`: the
|
|
1086
|
+
* real player never pushes it, it refuses the `set` request itself. To test
|
|
1087
|
+
* that, set {@link TestHost.previousCrash}.
|
|
1091
1088
|
*
|
|
1092
1089
|
* @example Make a shader fail to compile
|
|
1093
1090
|
* The plugin's render options report `failed`, as when mpv rejects a
|
|
@@ -1113,11 +1110,11 @@ export class TestHost {
|
|
|
1113
1110
|
return failVideoRender(this, this.#inner, code, message);
|
|
1114
1111
|
}
|
|
1115
1112
|
/**
|
|
1116
|
-
* The shader channel (`plugin.video.shaders(id)
|
|
1117
|
-
*
|
|
1118
|
-
*
|
|
1119
|
-
*
|
|
1120
|
-
*
|
|
1113
|
+
* The shader channel (`plugin.video.shaders(id)`): the lists the player holds
|
|
1114
|
+
* for this plugin's handles by id (the real paths, after following links),
|
|
1115
|
+
* and how many shaders other plugins hold, which count against
|
|
1116
|
+
* {@link VIDEO_PROCESSING_LIMITS}`.shaders` (`limit`). Files must be under
|
|
1117
|
+
* {@link TestHost.fileRoots}; under software rendering
|
|
1121
1118
|
* (`videoRender.gpu = false`) a non-empty list fails with `unsupported`.
|
|
1122
1119
|
*
|
|
1123
1120
|
* @since 1.5.39
|
|
@@ -1139,11 +1136,10 @@ export class TestHost {
|
|
|
1139
1136
|
* rendering (`unsupported`; use {@link TestHost.failVideoRender}, which
|
|
1140
1137
|
* also tells the handles). Pushed only to a handle that holds shaders.
|
|
1141
1138
|
*
|
|
1142
|
-
* `code` (
|
|
1143
|
-
*
|
|
1144
|
-
*
|
|
1145
|
-
*
|
|
1146
|
-
* {@link TestHost.previousCrash}.
|
|
1139
|
+
* `code` (default `failed`) is the error code pushed. `previous-crash` is a
|
|
1140
|
+
* shortcut that only sets the handle's status and reaches `onError`: the real
|
|
1141
|
+
* player never pushes it, it refuses the `set` request itself after
|
|
1142
|
+
* an abnormal end. To test that, set {@link TestHost.previousCrash}.
|
|
1147
1143
|
*
|
|
1148
1144
|
* @capability None.
|
|
1149
1145
|
*
|
|
@@ -1174,11 +1170,10 @@ export class TestHost {
|
|
|
1174
1170
|
return failVideoShaders(this, this.#inner, id, message, code);
|
|
1175
1171
|
}
|
|
1176
1172
|
/**
|
|
1177
|
-
* Play a run after an abnormal end with plugin shaders on
|
|
1178
|
-
*
|
|
1179
|
-
* `
|
|
1180
|
-
*
|
|
1181
|
-
* (default): shaders apply.
|
|
1173
|
+
* Play a run after an abnormal end with plugin shaders on: while set, a
|
|
1174
|
+
* non-empty `video.shaders` list and a render options `set` with a non-empty
|
|
1175
|
+
* `shaders` list are refused with `previous-crash` and this message; clearing
|
|
1176
|
+
* still works. `null` (default): shaders apply.
|
|
1182
1177
|
*
|
|
1183
1178
|
* @example Check that the plugin stops retrying while shaders are off
|
|
1184
1179
|
* The plugin's shader handle turns `failed` with `previous-crash`, as
|
|
@@ -1487,10 +1482,10 @@ export class TestHost {
|
|
|
1487
1482
|
},
|
|
1488
1483
|
};
|
|
1489
1484
|
/**
|
|
1490
|
-
* The player's rendering choice behind `plugin.rendering
|
|
1491
|
-
*
|
|
1492
|
-
*
|
|
1493
|
-
*
|
|
1485
|
+
* The player's rendering choice behind `plugin.rendering`. The mode drawing
|
|
1486
|
+
* now is {@link TestHost.videoRender | videoRender.gpu}, as for
|
|
1487
|
+
* `plugin.app.system()`; the rest is preset here and changed by the plugin's
|
|
1488
|
+
* calls, as the player would:
|
|
1494
1489
|
*
|
|
1495
1490
|
* - `setPreference` saves `preference` and never changes the mode. It
|
|
1496
1491
|
* refuses `"gpu"` while `gpu.available` is false: with `unsupported`
|
|
@@ -1545,8 +1540,8 @@ export class TestHost {
|
|
|
1545
1540
|
restarts: 0,
|
|
1546
1541
|
};
|
|
1547
1542
|
/**
|
|
1548
|
-
* The GPU's video upscaler behind `plugin.video.upscaling
|
|
1549
|
-
*
|
|
1543
|
+
* The GPU's video upscaler behind `plugin.video.upscaling`, answered as the
|
|
1544
|
+
* player would:
|
|
1550
1545
|
*
|
|
1551
1546
|
* - `state()` and `set(true)` set `checked` (the player's one GPU check; a
|
|
1552
1547
|
* plugin that should not wake the GPU while it starts can assert it is
|
|
@@ -1609,10 +1604,10 @@ export class TestHost {
|
|
|
1609
1604
|
};
|
|
1610
1605
|
/**
|
|
1611
1606
|
* Make the upscaler's reason `decoding` with `cause`, with the player's
|
|
1612
|
-
* message
|
|
1613
|
-
*
|
|
1614
|
-
*
|
|
1615
|
-
*
|
|
1607
|
+
* message, and set `upscaling.hwdecCurrent` to match (`d3d11va-copy`, `no`,
|
|
1608
|
+
* `nvdec`). `plugins` are named for `copy-back` only, as the player does.
|
|
1609
|
+
* Returns the reason; call {@link TestHost.upscalingChanged} to tell a
|
|
1610
|
+
* listening plugin.
|
|
1616
1611
|
*
|
|
1617
1612
|
* @example Test the window's advice for each cause
|
|
1618
1613
|
* The plugin's window explains why upscaling waits. The test fakes the
|
|
@@ -1636,10 +1631,9 @@ export class TestHost {
|
|
|
1636
1631
|
}
|
|
1637
1632
|
/**
|
|
1638
1633
|
* Send `video.upscaling.changed` with the state {@link TestHost.upscaling}
|
|
1639
|
-
* describes now (without `enabled`), as the player does when it changes
|
|
1640
|
-
*
|
|
1641
|
-
*
|
|
1642
|
-
* that does not listen.
|
|
1634
|
+
* describes now (without `enabled`), as the player does when it changes; a
|
|
1635
|
+
* plugin listening with `plugin.video.upscaling.onChange` receives it.
|
|
1636
|
+
* Nothing reaches a plugin that does not listen.
|
|
1643
1637
|
*
|
|
1644
1638
|
* @capability None.
|
|
1645
1639
|
*
|
|
@@ -1733,7 +1727,7 @@ export class TestHost {
|
|
|
1733
1727
|
// ------------------------------------------------------------ core actions
|
|
1734
1728
|
/** The `player.setStepSeek` value in effect (default 5). */
|
|
1735
1729
|
stepSeek = 5;
|
|
1736
|
-
/** The `player.setStepSeek` `keyframes` in effect (default `false
|
|
1730
|
+
/** The `player.setStepSeek` `keyframes` in effect (default `false`). */
|
|
1737
1731
|
stepSeekKeyframes = false;
|
|
1738
1732
|
/**
|
|
1739
1733
|
* Test data: the keyframe times (seconds, ascending) of the current
|
|
@@ -1976,10 +1970,10 @@ export class TestHost {
|
|
|
1976
1970
|
/**
|
|
1977
1971
|
* Simulate the user changing the main window (resizing, maximizing or
|
|
1978
1972
|
* restoring it, entering or leaving fullscreen, closing the
|
|
1979
|
-
* picture-in-picture window) and broadcast it. `maximized`
|
|
1980
|
-
*
|
|
1981
|
-
* sidebar (`effective: false`, `reason: "fullscreen"`) and
|
|
1982
|
-
* fullscreen docks it again.
|
|
1973
|
+
* picture-in-picture window) and broadcast it. `maximized` reads `false`
|
|
1974
|
+
* while fullscreen. Like the player, entering fullscreen collapses an
|
|
1975
|
+
* attached, visible sidebar (`effective: false`, `reason: "fullscreen"`) and
|
|
1976
|
+
* leaving fullscreen docks it again.
|
|
1983
1977
|
*
|
|
1984
1978
|
* @example Go fullscreen, report picture-in-picture support, maximize
|
|
1985
1979
|
* The plugin sees the main window fullscreen at 1920×1080, then learns
|
|
@@ -2010,9 +2004,9 @@ export class TestHost {
|
|
|
2010
2004
|
}
|
|
2011
2005
|
/**
|
|
2012
2006
|
* The pointer reached the right edge in fullscreen (`true`) or left the
|
|
2013
|
-
* popped-out columns (`false`): the attached sidebar and the adjust column
|
|
2014
|
-
*
|
|
2015
|
-
*
|
|
2007
|
+
* popped-out columns (`false`): the attached sidebar and the adjust column,
|
|
2008
|
+
* those switched on, pop out or collapse (reference §6.3). No effect outside
|
|
2009
|
+
* fullscreen, or on a column switched off or floating.
|
|
2016
2010
|
*
|
|
2017
2011
|
* @capability None.
|
|
2018
2012
|
*
|
|
@@ -2108,18 +2102,18 @@ export class TestHost {
|
|
|
2108
2102
|
/**
|
|
2109
2103
|
* Press a binding like the host's table would: panel-focus bindings first
|
|
2110
2104
|
* when `panel` is true, then global ones; within a scope the earliest
|
|
2111
|
-
* registration first (the player's own commands before the plugin's), as
|
|
2112
|
-
*
|
|
2113
|
-
*
|
|
2114
|
-
*
|
|
2115
|
-
*
|
|
2116
|
-
*
|
|
2117
|
-
*
|
|
2118
|
-
* `
|
|
2119
|
-
*
|
|
2120
|
-
*
|
|
2121
|
-
*
|
|
2122
|
-
*
|
|
2105
|
+
* registration first (the player's own commands before the plugin's), as the
|
|
2106
|
+
* conflict rule orders them. A disabled command lets the key pass to the next
|
|
2107
|
+
* command bound to it: the one it shadowed, then the global
|
|
2108
|
+
* scope. The first enabled one runs; `press` resolves after it ran (`"ran"`).
|
|
2109
|
+
* When only disabled commands hold the key, the first of them decides, as in
|
|
2110
|
+
* the player: with a `reason` it shows the reason on the OSD and eats the key
|
|
2111
|
+
* (`"reason"`, see `host.osd`); without one the key goes on to the focused
|
|
2112
|
+
* control (`"passed"`, nothing runs). Unlike the player, which only logs a
|
|
2113
|
+
* key that reaches a busy command, `press` then rejects, so a test notices.
|
|
2114
|
+
* Rejects when nothing is bound. Bindings use the reference syntax
|
|
2115
|
+
* (`"Space"`, `"Ctrl+O"`, `"Mouse:WheelUp"`), and user overrides in
|
|
2116
|
+
* `bindings.overlay` apply.
|
|
2123
2117
|
*
|
|
2124
2118
|
* @returns What the key did: `"ran"`, `"reason"` or `"passed"`.
|
|
2125
2119
|
*
|
|
@@ -2166,14 +2160,13 @@ export class TestHost {
|
|
|
2166
2160
|
.map(([key, ids]) => [key.split(" ")[1], ...ids]);
|
|
2167
2161
|
}
|
|
2168
2162
|
/**
|
|
2169
|
-
* Change the keys of one of the plugin's commands, or of one of the
|
|
2170
|
-
*
|
|
2171
|
-
*
|
|
2172
|
-
*
|
|
2173
|
-
*
|
|
2174
|
-
*
|
|
2175
|
-
*
|
|
2176
|
-
* `plugin.commands.keys` reads changed, `commands.keys`.
|
|
2163
|
+
* Change the keys of one of the plugin's commands, or of one of the player's
|
|
2164
|
+
* core commands by its `host/<id>`, as the user does in Keyboard Shortcuts:
|
|
2165
|
+
* `inputs` replaces its keys (`[]` clears them, as Ignore Default Shortcuts
|
|
2166
|
+
* does for every default), `null` gives it its own defaults back. It writes
|
|
2167
|
+
* {@link TestHost.bindings | bindings.overlay}, and the plugin hears it as
|
|
2168
|
+
* from the player: `bindings.changed` and, when what `plugin.commands.keys`
|
|
2169
|
+
* reads changed, `commands.keys`.
|
|
2177
2170
|
*
|
|
2178
2171
|
* @example Check that a key hint follows a rebinding
|
|
2179
2172
|
* The view showed W for Brightness −; after the user moves it to
|
|
@@ -2222,17 +2215,15 @@ export class TestHost {
|
|
|
2222
2215
|
/** Every `packages.setEnabled` / `uninstall` / `install`, newest last. */
|
|
2223
2216
|
packageCalls = [];
|
|
2224
2217
|
/**
|
|
2225
|
-
* Packages `validate` and `validateArchive` accept: path (directory or
|
|
2226
|
-
*
|
|
2227
|
-
*
|
|
2228
|
-
*
|
|
2229
|
-
*
|
|
2230
|
-
*
|
|
2231
|
-
* {@link "@vestra-player/sdk"!InstallOptions.enabled}: a first install
|
|
2232
|
-
*
|
|
2233
|
-
*
|
|
2234
|
-
* {@link TestHost.installKeepsDisabled} to `false` for the older players'
|
|
2235
|
-
* rule (every install runs).
|
|
2218
|
+
* Packages `validate` and `validateArchive` accept: path (directory or `.vxp`
|
|
2219
|
+
* file) → its manifest. Other paths fail with `missing`. `install` adds or
|
|
2220
|
+
* upgrades the entry in {@link TestHost.packages} following the player's
|
|
2221
|
+
* source rules: the same source upgrades, another source needs `replace`
|
|
2222
|
+
* (`conflict` otherwise), a built-in id is `unsupported`. The installed
|
|
2223
|
+
* entry's `state` follows
|
|
2224
|
+
* {@link "@vestra-player/sdk"!InstallOptions.enabled}: a first install runs,
|
|
2225
|
+
* an update of a `disabled` entry stays `disabled` unless `enabled` is
|
|
2226
|
+
* `true`, and `enabled: false` installs it `disabled`.
|
|
2236
2227
|
*
|
|
2237
2228
|
* @example Offer a package file the plugin can install
|
|
2238
2229
|
* The plugin can validate and install `/downloads/someone.demo-1.0.0.vxp`
|
|
@@ -2250,25 +2241,20 @@ export class TestHost {
|
|
|
2250
2241
|
*/
|
|
2251
2242
|
candidates = new Map();
|
|
2252
2243
|
/**
|
|
2253
|
-
* Which
|
|
2254
|
-
*
|
|
2255
|
-
*
|
|
2256
|
-
*
|
|
2257
|
-
*
|
|
2258
|
-
*
|
|
2259
|
-
*
|
|
2260
|
-
* updates a disabled plugin sets it to `false`; one that keeps testing
|
|
2261
|
-
* both runs once with each.
|
|
2262
|
-
*
|
|
2263
|
-
* @example Keep a test written for players up to 0.6.3
|
|
2244
|
+
* Which install rule `packages.install` plays. `true` (default): an update
|
|
2245
|
+
* or reinstall keeps a `disabled` plugin disabled unless the plugin passes
|
|
2246
|
+
* {@link "@vestra-player/sdk"!InstallOptions.enabled}. `false`: every
|
|
2247
|
+
* install runs the plugin and `enabled` is ignored (it is still checked and
|
|
2248
|
+
* recorded in {@link TestHost.packageCalls}).
|
|
2249
|
+
*
|
|
2250
|
+
* @example Every install runs
|
|
2264
2251
|
* The plugin under test installs an update over a plugin the user
|
|
2265
|
-
* disabled and expects it to run afterwards
|
|
2266
|
-
*
|
|
2267
|
-
* where the update stays disabled.
|
|
2252
|
+
* disabled and expects it to run afterwards. With `false` the host plays
|
|
2253
|
+
* that rule; the default keeps the update disabled.
|
|
2268
2254
|
* ```ts
|
|
2269
2255
|
* declare const host: TestHost;
|
|
2270
2256
|
* // ---cut---
|
|
2271
|
-
* host.installKeepsDisabled = false; // every install runs
|
|
2257
|
+
* host.installKeepsDisabled = false; // every install runs
|
|
2272
2258
|
* ```
|
|
2273
2259
|
*
|
|
2274
2260
|
* @capability None.
|
|
@@ -2450,10 +2436,10 @@ export class TestHost {
|
|
|
2450
2436
|
}
|
|
2451
2437
|
/**
|
|
2452
2438
|
* The plugin's mounted panel (bottom bar, sidebar, adjust column or
|
|
2453
|
-
* backdrop): the one in `slot`, or without it the only one (
|
|
2454
|
-
*
|
|
2455
|
-
*
|
|
2456
|
-
*
|
|
2439
|
+
* backdrop): the one in `slot`, or without it the only one (a plugin mounts
|
|
2440
|
+
* one panel per slot; with several, name the slot). Throws when there is
|
|
2441
|
+
* none. Its `props` use Slint (kebab-case) names; `emit` fires a callback on
|
|
2442
|
+
* the panel's global.
|
|
2457
2443
|
*
|
|
2458
2444
|
* @example Select a row in the plugin's sidebar panel
|
|
2459
2445
|
* The test checks the panel sits in the sidebar and selects its third
|
|
@@ -2508,12 +2494,12 @@ export class TestHost {
|
|
|
2508
2494
|
* for: on a loaded machine it can finish after `settle()` returns. Poll
|
|
2509
2495
|
* the result you assert on instead (second example).
|
|
2510
2496
|
*
|
|
2511
|
-
* `settle()` does not wait for the SDK's once-a-second full update pass
|
|
2512
|
-
*
|
|
2513
|
-
*
|
|
2514
|
-
*
|
|
2515
|
-
* `plugin.update()`
|
|
2516
|
-
*
|
|
2497
|
+
* `settle()` does not wait for the SDK's once-a-second full update pass.
|
|
2498
|
+
* After `setSource` (or another player state change) only the bindings that
|
|
2499
|
+
* read a changed field of `plugin.player.state` run again; state the plugin
|
|
2500
|
+
* changed outside a handler without `plugin.update()` shows only in the next
|
|
2501
|
+
* full pass. Have the plugin call `plugin.update()` after such a change, or
|
|
2502
|
+
* wait `settle(1000)`.
|
|
2517
2503
|
*
|
|
2518
2504
|
* @param ms - Extra time to wait, for debounces and timers (default 0).
|
|
2519
2505
|
*
|
|
@@ -2581,19 +2567,17 @@ export class TestHost {
|
|
|
2581
2567
|
}
|
|
2582
2568
|
// ------------------------------------------------------------ simulated host
|
|
2583
2569
|
/**
|
|
2584
|
-
* Why the player would keep this plugin running while nothing uses it
|
|
2585
|
-
*
|
|
2586
|
-
*
|
|
2587
|
-
*
|
|
2588
|
-
*
|
|
2589
|
-
* player
|
|
2590
|
-
*
|
|
2591
|
-
*
|
|
2592
|
-
*
|
|
2593
|
-
*
|
|
2594
|
-
*
|
|
2595
|
-
* streams, jobs and the like (which also keep a plugin running) are not
|
|
2596
|
-
* listed.
|
|
2570
|
+
* Why the player would keep this plugin running while nothing uses it (lazy
|
|
2571
|
+
* activation), one line per reason: an event it listens to that is not one
|
|
2572
|
+
* the player wakes it for (with what listens and where it was added), its
|
|
2573
|
+
* panel in the bottom bar or the backdrop, its open windows (these as the
|
|
2574
|
+
* player's log says them), and its sidebar tab while that is the current tab.
|
|
2575
|
+
* The player counts the current tab as busy work, not as something live: it
|
|
2576
|
+
* keeps the plugin running only while the tab is shown, and a sidebar panel
|
|
2577
|
+
* in a background tab is no reason at all (the plugin may go to standby;
|
|
2578
|
+
* showing the tab starts it again). Empty: the player may stop it while idle
|
|
2579
|
+
* and start it again on its next use. Filter chains, streams, jobs and the
|
|
2580
|
+
* like (which also keep a plugin running) are not listed.
|
|
2597
2581
|
*
|
|
2598
2582
|
* @capability None.
|
|
2599
2583
|
* @since 1.5.40
|
|
@@ -2641,21 +2625,19 @@ export class TestHost {
|
|
|
2641
2625
|
* Rejects when `manifest.json` cannot be read or parsed, when `activate`
|
|
2642
2626
|
* throws, or when a registration made during activation fails (for example
|
|
2643
2627
|
* `limit`, `conflict`, `invalid`). Stricter than the player's runner for
|
|
2644
|
-
* commands
|
|
2645
|
-
*
|
|
2646
|
-
*
|
|
2647
|
-
* bad declaration.
|
|
2628
|
+
* commands: there the SDK logs a command declaration the player refuses during
|
|
2629
|
+
* activation, skips it and activates the rest of the plugin (`onError` hears
|
|
2630
|
+
* it); `startPlugin` fails, so a test shows the bad declaration.
|
|
2648
2631
|
*
|
|
2649
2632
|
* @param activate - The plugin's default-exported `activate` function.
|
|
2650
2633
|
* @param options - Where the plugin lives and how to start it.
|
|
2651
2634
|
* @returns `host`: the {@link TestHost}; `plugin`: the object passed to
|
|
2652
|
-
*
|
|
2653
|
-
*
|
|
2654
|
-
*
|
|
2655
|
-
*
|
|
2656
|
-
*
|
|
2657
|
-
*
|
|
2658
|
-
* temporary files never fails a test.
|
|
2635
|
+
* `activate` (call the plugin API on it directly); `stop()`: dispose the plugin
|
|
2636
|
+
* like the player stopping it (scopes released, stores flushed), wait until the
|
|
2637
|
+
* host is idle and remove the host's temporary files; `stop({ reason })`:
|
|
2638
|
+
* `reason` is the `StopReason` the player sends; `disconnect()` stops it as
|
|
2639
|
+
* when the player is lost (`host-lost`, requests refused with `disabled`).
|
|
2640
|
+
* Removing the temporary files never fails a test.
|
|
2659
2641
|
*
|
|
2660
2642
|
* @example Test that a setting survives a restart
|
|
2661
2643
|
* The test turns on the 10-step option, stops the plugin, starts it again
|
|
@@ -2703,7 +2685,7 @@ export class TestHost {
|
|
|
2703
2685
|
* to call directly, and `stop` to end it like the player.
|
|
2704
2686
|
*
|
|
2705
2687
|
* @capability None.
|
|
2706
|
-
* @see [Test a plugin](../../../docs/
|
|
2688
|
+
* @see [Test a plugin](../../../docs/guides/testing.md)
|
|
2707
2689
|
* @since 1.0.0
|
|
2708
2690
|
* @category Testing
|
|
2709
2691
|
*/
|
|
@@ -2773,18 +2755,18 @@ export async function startPlugin(activate, options = {}) {
|
|
|
2773
2755
|
plugin: instance.plugin,
|
|
2774
2756
|
/**
|
|
2775
2757
|
* Stop the plugin, wait for the host, and remove temporary files.
|
|
2776
|
-
* `stop({ reason })
|
|
2777
|
-
*
|
|
2778
|
-
*
|
|
2779
|
-
*
|
|
2780
|
-
*
|
|
2758
|
+
* `stop({ reason })`: `reason` is the reason the player gives
|
|
2759
|
+
* (`plugin.stopReason`, the `onDispose` cleanups' `info.reason`); `stop()`:
|
|
2760
|
+
* none (`undefined`). It still
|
|
2761
|
+
* takes no declared parameter, so it can be passed as a callback
|
|
2762
|
+
* (`t.after(stop)`, `promise.then(stop)`).
|
|
2781
2763
|
*/
|
|
2782
2764
|
stop,
|
|
2783
2765
|
/**
|
|
2784
|
-
* Lose the player
|
|
2785
|
-
*
|
|
2786
|
-
*
|
|
2787
|
-
*
|
|
2766
|
+
* Lose the player: as when it crashes or is killed, the runner stops the
|
|
2767
|
+
* plugin with reason `host-lost`; requests still waiting for their answer
|
|
2768
|
+
* and every later request are refused with `disabled`. Then waits and
|
|
2769
|
+
* removes the temporary files like `stop`.
|
|
2788
2770
|
*/
|
|
2789
2771
|
async disconnect() {
|
|
2790
2772
|
host.loseConnection();
|
|
@@ -11,8 +11,8 @@ export declare class Internals {
|
|
|
11
11
|
/** The plugin's translations for `locale` (see `loadCatalog`). */
|
|
12
12
|
catalog: Catalog;
|
|
13
13
|
/**
|
|
14
|
-
* Row patches
|
|
15
|
-
*
|
|
14
|
+
* Row patches: the `seq` of each property's last write, by view and property
|
|
15
|
+
* (none: 0, the initial properties).
|
|
16
16
|
*/
|
|
17
17
|
readonly writes: Map<string, number>;
|
|
18
18
|
/** The parts of a whole value held until its last part, by view and property. */
|
|
@@ -14,8 +14,8 @@ export class Internals {
|
|
|
14
14
|
/** The plugin's translations for `locale` (see `loadCatalog`). */
|
|
15
15
|
catalog = new Catalog();
|
|
16
16
|
/**
|
|
17
|
-
* Row patches
|
|
18
|
-
*
|
|
17
|
+
* Row patches: the `seq` of each property's last write, by view and property
|
|
18
|
+
* (none: 0, the initial properties).
|
|
19
19
|
*/
|
|
20
20
|
writes = new Map();
|
|
21
21
|
/** The parts of a whole value held until its last part, by view and property. */
|
|
@@ -33,7 +33,7 @@ import type { Timeline, TimelineMark, TimelineRange } from "./types.ts";
|
|
|
33
33
|
export declare const TIMELINE_LIMITS: Readonly<{
|
|
34
34
|
/** Marks in one layer (`TimelineLayer.set`) (1000). */
|
|
35
35
|
readonly marks: 1000;
|
|
36
|
-
/** Ranges in one layer (`TimelineLayer.setRanges
|
|
36
|
+
/** Ranges in one layer (`TimelineLayer.setRanges`) (100). */
|
|
37
37
|
readonly ranges: 100;
|
|
38
38
|
/** Characters of a mark's or a range's title, as shown (100). */
|
|
39
39
|
readonly titleChars: 100;
|
package/dist/plugin/timeline.js
CHANGED
|
@@ -32,7 +32,7 @@ import { failure, quiet } from "./errors.js";
|
|
|
32
32
|
export const TIMELINE_LIMITS = Object.freeze({
|
|
33
33
|
/** Marks in one layer (`TimelineLayer.set`) (1000). */
|
|
34
34
|
marks: 1000,
|
|
35
|
-
/** Ranges in one layer (`TimelineLayer.setRanges
|
|
35
|
+
/** Ranges in one layer (`TimelineLayer.setRanges`) (100). */
|
|
36
36
|
ranges: 100,
|
|
37
37
|
/** Characters of a mark's or a range's title, as shown (100). */
|
|
38
38
|
titleChars: 100,
|
|
@@ -219,7 +219,7 @@ class Layer {
|
|
|
219
219
|
this.#latestRanges.stop();
|
|
220
220
|
timelineOf(this.#scope.runtime).layer = false;
|
|
221
221
|
await this.#scope.runtime.host.timeline.set([]).catch(() => { });
|
|
222
|
-
// Only a layer that sent ranges
|
|
222
|
+
// Only a layer that sent ranges.
|
|
223
223
|
if (this.#ranged)
|
|
224
224
|
await this.#scope.runtime.host.timeline.setRanges([]).catch(() => { });
|
|
225
225
|
}
|