@vestra-player/sdk 1.6.11 → 1.6.12

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.12
4
+
5
+ **Who must change: nobody.** A behaviour fix of `toggle` in fullscreen, an example fix and a development warning; no new API, `apiVersion` stays `vestra/1`.
6
+
7
+ - **`Panel.toggle` and `PanelSlot.toggle` slide a collapsed column out.** In fullscreen a sidebar or adjust column the user wants shown is collapsed at the right edge (`reason: "fullscreen"`). Toggling it then turned it off; it now shows it, which player 0.7.6 answers by sliding the column out, as its own Adjust button and Alt+1…4 do. Toggling a column that is on screen still turns it off. With players before 0.7.6 a show of a collapsed column changes nothing on screen, as before.
8
+ - **[adjust-panel](docs/examples/adjust-panel.md)** declares `events`: without it `plugin.player.state` changes only after the plugin's own calls, so a panel activated before a file was opened stayed disabled at 1×. A new test opens the file after activation. Its presets are four (0.5×, 1×, 1.5×, 2×), which fit the adjust column at its least width. No other example reads `player.state` without `events`.
9
+ - **A development warning for state followed without `events`.** A plugin that registers an `onChange` or a `bind` whose function reads changing state (`player.state`, a panel position, and the like) without the `events` capability gets one line in its log, once per plugin: changes made elsewhere never reach it. Only a warning; behaviour is unchanged. `TestHost` already behaved like the player here (it delivers `source.state` and the other state events only to a plugin that subscribed, which needs `events`): a new test pins that down. The example's old tests passed because they opened the file before starting the plugin or did not check `enabled`. No SDK example or test relied on the opposite, so nobody must change.
3
10
  ## 1.6.11
4
11
 
5
12
  **Who must change: nobody.** Additions only: a mount slot, a panel position, a button icon and `TestHost` support; `apiVersion` stays `vestra/1`, no new capability. A plugin that mounts `"adjust"` sets `minPlayerVersion` to `0.7.6`: older players refuse the slot (`invalid`), which fails the activation like any refused mount.
Binary file
@@ -208,6 +208,8 @@ export class Runtime {
208
208
  /** The plugin was disposed: no safety pass is armed any more. */
209
209
  #stopped = false;
210
210
  #events = new Map();
211
+ /** The missing `events` warning was given (once per plugin). */
212
+ #warnedEvents = false;
211
213
  views = new Map();
212
214
  commands = new Map();
213
215
  services = new Map();
@@ -617,6 +619,10 @@ export class Runtime {
617
619
  group.active++;
618
620
  group.whys.set(token, listenerWhy(this.callSite()));
619
621
  }
622
+ if (created && needs === "events" && !this.can(needs))
623
+ group.unheard = true;
624
+ if (!mirror && group.unheard)
625
+ this.#warnUnheard(event);
620
626
  if (created && (needs === null || this.can(needs))) {
621
627
  group.told = group.active > 0;
622
628
  const whys = group.told ? allWhys(group) : undefined;
@@ -658,6 +664,8 @@ export class Runtime {
658
664
  const group = this.#events.get(event);
659
665
  if (!group)
660
666
  return { dispose: async () => { } };
667
+ if (group.unheard)
668
+ this.#warnUnheard(event);
661
669
  group.active++;
662
670
  const token = {};
663
671
  group.whys.set(token, why ?? listenerWhy(this.callSite()));
@@ -675,6 +683,19 @@ export class Runtime {
675
683
  },
676
684
  };
677
685
  }
686
+ /**
687
+ * A development warning, once per plugin, no behaviour change (SDK
688
+ * 1.6.12): the plugin follows `event` (an `onChange`, a `bind` that reads
689
+ * the state) without the `events` capability, so changes made elsewhere
690
+ * (the user, the player, another plugin) never reach it; the state moves
691
+ * only after its own calls.
692
+ */
693
+ #warnUnheard(event) {
694
+ if (this.#warnedEvents)
695
+ return;
696
+ this.#warnedEvents = true;
697
+ console.warn(`[${this.manifest.id}] follows ${event} (onChange, or a bind() that reads the state) without the "events" capability: changes made elsewhere will not reach it, only its own calls refresh the state. Declare "events" in manifest.json.`);
698
+ }
678
699
  /**
679
700
  * Tell the player when `group` changes between mirror and listener, and
680
701
  * why it listens when that changed.
@@ -2705,7 +2705,9 @@ export interface PanelSlot {
2705
2705
  *
2706
2706
  * @remarks
2707
2707
  * Reads the state from the player first, so it is right even without
2708
- * `events`.
2708
+ * `events`. A sidebar or adjust column wanted shown but collapsed at the
2709
+ * right edge of fullscreen (`reason: "fullscreen"`) slides out instead of
2710
+ * being turned off (SDK 1.6.12; player 0.7.6 pops it out).
2709
2711
  *
2710
2712
  * @capability ui.mount
2711
2713
  *
@@ -3010,7 +3012,10 @@ export interface Panel extends View, Disposable {
3010
3012
  * Reads the state from the player first. When the position is shown
3011
3013
  * (`preferred`) and this panel's tab is the current one, it hides the
3012
3014
  * position; otherwise it does {@link Panel.show}: a panel in a background
3013
- * tab comes to the front instead of the sidebar closing. A "Show list"
3015
+ * tab comes to the front instead of the sidebar closing, and a column
3016
+ * collapsed at the right edge of fullscreen (`reason: "fullscreen"`) slides
3017
+ * out instead of being turned off (SDK 1.6.12; player 0.7.6 pops it out),
3018
+ * like the player's own Alt+1…4 and Adjust button. A "Show list"
3014
3019
  * command checked by `state.preferred && state.active` matches it. Waits
3015
3020
  * for {@link Panel.ready} first.
3016
3021
  *
package/dist/plugin/ui.js CHANGED
@@ -917,7 +917,9 @@ class PanelHandle extends ViewBase {
917
917
  throw failure("invalid", "the player shows the backdrop by itself");
918
918
  await layoutOf(this.scope.runtime).read();
919
919
  const state = this.state;
920
- if (state?.preferred && state.active)
920
+ // Collapsed at the edge of fullscreen (wanted shown, not on screen):
921
+ // slide it out rather than turn it off (player 0.7.6 pops it out).
922
+ if (state?.preferred && state.active && state.reason !== "fullscreen")
921
923
  await layoutOf(this.scope.runtime).set(this.#slot, { visible: false });
922
924
  else
923
925
  await this.show();
@@ -1117,7 +1119,11 @@ function slot(scope, name) {
1117
1119
  async toggle() {
1118
1120
  await service().read();
1119
1121
  const current = service().state[name];
1120
- await service().set(name, { visible: !(current?.preferred ?? true) });
1122
+ // Collapsed at the edge of fullscreen: slide it out (see Panel.toggle).
1123
+ const collapsed = current?.reason === "fullscreen";
1124
+ await service().set(name, {
1125
+ visible: collapsed || !(current?.preferred ?? true),
1126
+ });
1121
1127
  },
1122
1128
  setDetached: (detached) => service().set(name, { detached }),
1123
1129
  activate: (plugin) => service().set(name, { active: plugin }),
package/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # Vestra Player SDK
2
2
 
3
- > @vestra-player/sdk 1.6.11: write plugins for Vestra Player in TypeScript (plugin API `vestra/1`). A plugin is a folder with `manifest.json` and an entry module whose default export `activate(plugin)` the player calls. The documentation is a tree of short pages read by path, like `go doc`: the same pages and API as https://vestrasys.github.io/vestra-player-sdk/.
3
+ > @vestra-player/sdk 1.6.12: write plugins for Vestra Player in TypeScript (plugin API `vestra/1`). A plugin is a folder with `manifest.json` and an entry module whose default export `activate(plugin)` the player calls. The documentation is a tree of short pages read by path, like `go doc`: the same pages and API as https://vestrasys.github.io/vestra-player-sdk/.
4
4
 
5
5
  ## Read the documentation
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vestra-player/sdk",
3
- "version": "1.6.11",
3
+ "version": "1.6.12",
4
4
  "description": "Plugin API types, test host and plugin CLI for Vestra Player (apiVersion vestra/1)",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {