@vestra-player/sdk 1.7.1 → 1.7.3

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