@vestra-player/sdk 1.5.12 → 1.5.14

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.
@@ -320,16 +320,19 @@ export interface Plugin extends Scope {
320
320
  /** The manifest id, e.g. `"community.bookmark"`. */
321
321
  readonly id: string;
322
322
  /**
323
- * A writable directory for this plugin's own files (settings, remembered
324
- * folders). Kept across restarts, disabling and upgrades. Write files atomically: to a temporary name, then rename.
325
- * Throws `unavailable` when the player provided none.
326
- *
327
- * Location: `~/Library/Application Support/Vestra/plugin-data/<id>/` on
328
- * macOS, `%APPDATA%\Vestra\plugin-data\<id>\` on Windows (the environment
329
- * variable `VESTRA_PLUGIN_DATA` moves the root). Another plugin's data
330
- * directory is `join(dirname(plugin.dataDirectory), id)`. It is deleted
331
- * only by `packages.uninstall(id, { removeData: true })`. No capability.
332
- * For JSON settings prefer {@link Scope.storage}.
323
+ * A writable directory for this plugin's own files (settings, caches,
324
+ * remembered folders), created by the player before it starts the plugin.
325
+ * Each installation has its own directory (player 0.2.0): it is kept across
326
+ * restarts, disabling, upgrades and rollbacks, and a reinstall of the same
327
+ * id from a different source gets a new, empty one. It is deleted only by
328
+ * `packages.uninstall(id, { removeData: true })`. No capability.
329
+ *
330
+ * The path's format is not part of the API: do not derive another
331
+ * plugin's directory from it (a plugin manager reads
332
+ * {@link PluginInfo.dataDirectory}). Write files atomically (to a
333
+ * temporary name, then rename); for JSON settings prefer
334
+ * {@link Scope.storage}. Throws `unavailable` when the player provided
335
+ * none. See [How a plugin runs](../../docs/concepts/plugins.md#the-data-directory).
333
336
  */
334
337
  readonly dataDirectory: string;
335
338
  }
@@ -388,9 +391,10 @@ export type MenuId = "open" | "playback" | "subtitles" | "video" | "audio" | "sc
388
391
  * item never moves the player's menu. Directly inside a built-in menu,
389
392
  * `order` 0 (the default) sorts after every other order: an item without
390
393
  * `order` goes at the end, after the player's own items (which all use 100
391
- * or more). Give a positive order to sit between them (the player's orders
392
- * are listed in its menu table, doc/product/menus.md), or a negative one to
393
- * come first. Deeper levels (a plugin's own submenu) have no such rule.
394
+ * or more). Give a positive order to sit between them (the player's items
395
+ * in menu order are in
396
+ * [Built-in commands](../../docs/reference/commands.md#built-in-commands)),
397
+ * or a negative one to come first. Deeper levels (a plugin's own submenu) have no such rule.
394
398
  * Players before 0.3.0 place every submenu at its smallest order, so there
395
399
  * an item without `order` moves the whole menu to the top; to avoid that,
396
400
  * give it an order in the menu's range (Video: 400–499).
@@ -471,8 +475,8 @@ export interface CommandOptions {
471
475
  *
472
476
  * Platforms: on macOS `Ctrl+X` fires for both ⌃X and ⌘X while `Cmd+X`
473
477
  * means ⌘X only; on Windows `Cmd` is the Windows logo key, so write
474
- * `Ctrl+…` for bindings that work on both. Avoid keys the system takes
475
- * first (⌃F1–⌃F8, ⌃Arrow keys, ⌘Tab on macOS).
478
+ * `Ctrl+…` for bindings that work on both. Avoid the
479
+ * [keys the system takes first](../../docs/reference/commands.md#keys-the-system-takes-first).
476
480
  *
477
481
  * Conflicts are not errors: the user's overrides win, then the player's
478
482
  * own commands, then the plugin loaded first; a shadowed binding takes
@@ -812,6 +816,15 @@ export interface Ui {
812
816
  * The text is at most 256 KB; very long documents are cut off after 4000
813
817
  * blocks.
814
818
  *
819
+ * `MarkdownView` scrolls one document. `MarkdownBlocks` (SDK 1.5.4, players
820
+ * after 0.4.0) draws one without scrolling, as tall as its content, for a
821
+ * layout of your own or a `ListView` row. For a list of documents, write
822
+ * the whole list with one document per row: the player parses only the
823
+ * documents that changed and updates the list in place (rows added or
824
+ * removed at the end, a growing document's changed blocks), so re-sending
825
+ * the list on every streamed chunk keeps the scroll position and costs
826
+ * little.
827
+ *
815
828
  * @capability None.
816
829
  * @player 0.2.0 (set `"minPlayerVersion": "0.2.0"` in the manifest)
817
830
  *
@@ -826,6 +839,44 @@ export interface Ui {
826
839
  * `base` is neither an `http(s):` address nor an absolute path.
827
840
  * @throws `unsupported` (rejects) The player is older than 0.2.0.
828
841
  *
842
+ * @example A chat: one Markdown document per row, with Copy buttons
843
+ * `ui/chat.slint`:
844
+ *
845
+ * ```slint
846
+ * import { ListView } from "std-widgets.slint";
847
+ * import { MarkdownBlocks, MarkdownBlock } from "@vestra/markdown.slint";
848
+ * export struct Message { id: string, role: string, body: [MarkdownBlock] }
849
+ * export component Chat inherits Window {
850
+ * in property <[Message]> messages;
851
+ * callback copy-code(string);
852
+ * ListView {
853
+ * for message in root.messages: VerticalLayout {
854
+ * padding: 8px;
855
+ * MarkdownBlocks {
856
+ * blocks: message.body;
857
+ * code-copy: true;
858
+ * copy-code(code) => { root.copy-code(code); }
859
+ * }
860
+ * }
861
+ * }
862
+ * }
863
+ * ```
864
+ *
865
+ * ```ts
866
+ * const chat = plugin.windows.create("ui/chat.slint");
867
+ * const history: { id: string; role: string; text: string }[] = [];
868
+ * chat.on("copyCode", (code: string) => plugin.clipboard.writeText(code));
869
+ * async function render() {
870
+ * const messages = [];
871
+ * for (const { id, role, text } of history)
872
+ * messages.push({ id, role, body: await plugin.ui.markdown(text) });
873
+ * chat.set({ messages });
874
+ * }
875
+ * history.push({ id: "1", role: "user", text: "Show me `ls`." });
876
+ * await render();
877
+ * await chat.show();
878
+ * ```
879
+ *
829
880
  * @example Show a README from the web
830
881
  * ```ts
831
882
  * const readmeUrl = "https://example.com/plugin/README.md";
@@ -1029,8 +1080,8 @@ export interface View {
1029
1080
  * {@link View.bind} or {@link View.set}.
1030
1081
  * 3. {@link Window.show} opens the window with those properties.
1031
1082
  * {@link Window.hide} hides it and keeps its state.
1032
- * 4. {@link Window.close}, or the user (title-bar button; ⌘W on macOS,
1033
- * Ctrl+W or Ctrl+F4 on Windows), destroys the window instance; only the
1083
+ * 4. {@link Window.close}, or the user (title-bar button or the
1084
+ * [standard close keys](../../docs/reference/commands.md#keys-the-system-takes-first)), destroys the window instance; only the
1034
1085
  * user's close calls {@link Window.onClose}. The handle stays usable: the
1035
1086
  * next `show()` opens a fresh instance with the current properties.
1036
1087
  * 5. `dispose()`, disposing the owning scope or the plugin stopping closes
@@ -1184,8 +1235,8 @@ export interface Window extends View, Disposable {
1184
1235
  * Run code when the user closes the window.
1185
1236
  *
1186
1237
  * @remarks
1187
- * Called for the title-bar close button and the standard close keys (⌘W
1188
- * on macOS, Ctrl+W or Ctrl+F4 on Windows). When it runs, the window
1238
+ * Called for the title-bar close button and the
1239
+ * [standard close keys](../../docs/reference/commands.md#keys-the-system-takes-first). When it runs, the window
1189
1240
  * instance is gone and {@link Window.opened} is already `false`; a later
1190
1241
  * `show()` opens a fresh one. It is not called for the plugin's own
1191
1242
  * {@link Window.close} or `dispose()`, nor when the plugin stops. Errors
@@ -1514,8 +1565,8 @@ export interface PanelSlot {
1514
1565
  * Detached, the sidebar panel is shown in a separate window (300×408 by
1515
1566
  * default, at least 300×250) with the panel's `title`. The plugin's
1516
1567
  * properties and callbacks stay the same, but the window holds a new
1517
- * instance of the component. Closing the floating window (its close button,
1518
- * ⌘W, Ctrl+W, Ctrl+F4) is the same as `setVisible(false)`.
1568
+ * instance of the component. Closing the floating window (its close button
1569
+ * or the [standard close keys](../../docs/reference/commands.md#keys-the-system-takes-first)) is the same as `setVisible(false)`.
1519
1570
  *
1520
1571
  * @capability ui.mount
1521
1572
  *
@@ -3714,8 +3765,8 @@ export interface Host {
3714
3765
  * {@link Osd.panel}.
3715
3766
  *
3716
3767
  * @remarks
3717
- * The block sits under the OSD message line, on a translucent black
3718
- * background, and takes no input. Its font scales with the video area. When
3768
+ * The block sits under the OSD message line, on a translucent dark plate
3769
+ * (see {@link Osd} for sizes), and takes no input. When
3719
3770
  * several plugins have one, they are stacked from top to bottom. `dispose()`,
3720
3771
  * disposing the scope or stopping the plugin removes it.
3721
3772
  *
@@ -3789,8 +3840,25 @@ export interface OsdPanelOptions {
3789
3840
  * ({@link Osd.show}) is one line at the top left of the video that
3790
3841
  * disappears after 2 seconds; a newer message, from any plugin, replaces it.
3791
3842
  * The information block ({@link Osd.panel}) stays until the plugin changes
3792
- * or removes it. Both are white text with a dark outline whose size follows
3793
- * the height of the video area.
3843
+ * or removes it.
3844
+ *
3845
+ * How the player draws them (a player before 0.4.0 drew bold white text
3846
+ * with a black outline instead):
3847
+ *
3848
+ * - **Message**: white text on a translucent dark plate with rounded
3849
+ * corners and a gradient line along its bottom edge, 10px from the
3850
+ * video area's left and top edges.
3851
+ * - **Font size** follows the video area: 3 % of its height, rounded and
3852
+ * clamped to 12–48px (about 18px in the default window, 32px in
3853
+ * fullscreen at 1080 pixels high). The plate's padding and corners scale
3854
+ * with it.
3855
+ * - **Information block**: 4px below the message plate, on the same kind of
3856
+ * plate; its font scales in proportion (11px when the message is 16px),
3857
+ * clamped to 9–28px.
3858
+ *
3859
+ * How long a text may be is in
3860
+ * [Limits: on-screen display](../../docs/reference/limits.md#on-screen-display)
3861
+ * ({@link "@vestra-player/sdk/testing"!OSD_LIMITS | OSD_LIMITS}).
3794
3862
  *
3795
3863
  * @capability ui.osd
3796
3864
  *