What a plugin's Slint file can import from the player's library. How Slint and TypeScript talk is in Open a tool window and remember its state; which token to use where is in Design rules.
import { Theme } from "@vestra/theme.slint";
import { Icon } from "@vestra/icons.slint";
import { Button, KeyHint, Slider, ToolTipArea, ToolTipKey, UrlInputRow } from "@vestra/widgets.slint";
import { MarkdownView, MarkdownBlocks, MarkdownBlock } from "@vestra/markdown.slint";
import { VestraFocus } from "@vestra/focus.slint";
Use the tokens. The values below are the player's current ones; a token keeps its meaning when a value changes.
Theme colours follow the user's palette: vestra, the dark default, and vestra-light, whose video area stays dark. The player sets the palette on every view, so read colours from Theme (read-only out properties) and never write a colour value yourself. The same values are THEME_PALETTES, for tests.
| Token | Value in vestra |
Value in vestra-light |
Note |
|---|---|---|---|
Theme.bg-bar |
#16141c |
#f7f6fa |
|
Theme.bg-video |
#0a090e |
#0e0d12 |
|
Theme.bg-list |
#1a1821 |
#ffffff |
|
Theme.bg-panel |
#201d28 |
#f1eff5 |
|
Theme.line |
#2b2734 |
#dcd8e4 |
|
Theme.hover-bg |
#28232f |
#e9e6f0 |
|
Theme.press-bg |
#110f16 |
#dcd8e6 |
|
Theme.selected-bg |
#2f2840 |
#efe4fb |
|
Theme.text |
#f5f3fa |
#1c1924 |
|
Theme.text-dim |
#8e88a0 |
#6f6a7f |
|
Theme.text-list |
#bdb8cb |
#3b3748 |
|
Theme.text-played |
#6e6980 |
#9a95a8 |
|
Theme.accent |
#f72aa6 |
#d4128a |
|
Theme.accent-press |
#c41a83 |
#a80d6c |
|
Theme.accent-disabled |
#5a1d48 |
#ecbcd9 |
|
Theme.icon-disabled |
#3b3646 |
#c9c5d2 |
|
Theme.playing |
#2bb6ff |
#0773ba |
|
Theme.button-bg |
#2f2a3b |
#e6e3ec |
|
Theme.button-hover |
#3a3448 |
#dcd8e4 |
|
Theme.button-press |
#25202e |
#cfcadb |
|
Theme.button-disabled |
#1b1922 |
#efedf3 |
|
Theme.danger |
#ff5a5f |
#c42b2b |
Errors and destructive actions: a failed status line, a Delete button. |
Theme.accent-fill |
gradient 90°: #fcc402 0%, #fb5a35 20%, #fa0aa8 45%, #7a0afa 72%, #10a8fc 100% |
gradient 90°: #f5a700 0%, #f0442f 20%, #e0089a 45%, #6a08e8 72%, #0a95e6 100% |
Brand gradient for "progress" fills (seek bar, volume, sliders, accents). |
std-widgets.slint controls follow the palette; do not set Palette.color-scheme yourself.
The video area is dark in both palettes. Text and icons drawn over it (a backdrop, an overlay) use the OSD's colours, which have no Theme token: text #ffffff on a translucent dark plate #0b0a10c4. A check mark on an accent background is white in both palettes.
Corner radii, font sizes and control sizes are constants, the same in both palettes. radius-control rounds controls, menu rows and hover plates; radius-panel menus, panels and the OSD.
| Token | Value | Note |
|---|---|---|
Theme.radius-control |
4px |
|
Theme.radius-panel |
8px |
|
Theme.font-xs |
9px |
|
Theme.font-body |
11px |
|
Theme.font-tab |
12px |
|
Theme.font-title |
13px |
|
Theme.button-height |
21px |
|
Theme.button-min-width |
66px |
|
Theme.button-padding |
8px |
|
Theme.button-primary-height |
24px |
|
Theme.button-small-height |
18px |
|
Theme.button-small-min-width |
41px |
|
Theme.input-height |
21px |
|
Theme.checkbox-row-height |
18px |
|
Theme.label-height |
14px |
|
Theme.form-row-gap |
26px |
|
Theme.dialog-padding |
14px |
default-font-family it sets stays first. A character the font lacks falls back, character by character, to a font for its script.Theme.font-mono is the system's monospace family: Menlo on macOS, Consolas on Windows.All sizes are logical pixels (Slint's px): one logical pixel is two physical pixels on a Retina display or at 200 % scaling.
| Surface | Width | Height |
|---|---|---|
| Tool window | The Window component's width (fixed, not resizable), or preferred-width (initial) within min-width/max-width. |
Same with height. The title is the component's title. |
| Bottom bar | The video column's width. | The component's preferred height (within its minimum and maximum). It may draw above its slot into the video area (negative y); the player does not clip it. |
| Sidebar | Set by the user with the splitter (at least 317; the video keeps at least 318). | The window's full height. |
| Floating sidebar | 300 by default, at least 300. | 408 by default, at least 250. |
| Backdrop | The whole video area. | The whole video area. |
| Settings page | 440. | The component's height; the Options window scrolls taller pages. |
The sizes the player's own windows use, in logical pixels:
Theme.button-height, Theme.input-height); a small button 18 high; form rows 24–26 apart; padding 8–14.Theme.playing.The player's picture, audio and subtitle tools share this layout:
| Part | Size and style |
|---|---|
| Window | 301 wide, at most 320 × 280; background Theme.bg-bar; content 8 from the left and right edges (285 usable) |
| Tabs (if any) | 31 high, 74 wide, text Theme.font-tab in Theme.text-dim; the current tab in Theme.text with a short Theme.accent-fill line under it |
| Page | background Theme.bg-panel |
| Row | 24 high: label 65 wide, right-aligned, Theme.font-body; Slider with panel: true, 154 × 12; a small "Default" button, 41 × 18 |
| Toggle buttons (flip, rotate) | 46 × 22; choice buttons 51 × 22 (69 wide for longer labels) |
@vestra/icons.slint is the player's own icon set: round-capped, round-joined lines, 1.5px wide (1.25px for the small glyphs), never filled, each in its own box.
Icon { name: "play"; color: Theme.text; } // its box size
Icon { name: "close"; width: 20px; height: 20px; } // scaled
width and height to scale it. An unknown name draws nothing.Path of your own, Icons.commands(name) returns the path data, Icons.box-width(name) and Icons.box-height(name) the box (the path's viewbox) and Icons.line(name) the line width.| Name | Box (px) | Line |
|---|---|---|
play |
12 × 14 | 1.5px |
pause |
12 × 14 | 1.5px |
stop |
12 × 12 | 1.5px |
back |
14 × 10 | 1.5px |
forward |
14 × 10 | 1.5px |
open |
14 × 12 | 1.5px |
volume |
13 × 10 | 1.5px |
mute |
13 × 10 | 1.5px |
playlist |
13 × 10 | 1.5px |
detach |
14 × 12 | 1.5px |
attach |
14 × 12 | 1.5px |
close |
14 × 13 | 1.5px |
failed |
10 × 10 | 1.25px |
move-top |
14 × 12 | 1.5px |
move-up |
14 × 12 | 1.5px |
move-down |
14 × 12 | 1.5px |
move-bottom |
14 × 12 | 1.5px |
search |
14 × 12 | 1.5px |
chapter |
12 × 12 | 1.25px |
bookmark |
12 × 12 | 1.25px |
check-task |
11 × 11 | 1.5px |
check-box |
9 × 9 | 1.5px |
menu-check |
14 × 14 | 1.5px |
submenu |
5 × 8 | 1.25px |
scroll-up |
8 × 5 | 1.25px |
scroll-down |
8 × 5 | 1.25px |
caret-down |
8 × 5 | 1.25px |
sort-asc |
7 × 4 | 1.1px |
sort-desc |
7 × 4 | 1.1px |
tag-remove |
7 × 7 | 1.25px |
preview-play |
8 × 9 | 1.25px |
add |
10 × 10 | 1.5px |
remove |
10 × 10 | 1.5px |
sort |
10 × 10 | 1.5px |
fullscreen |
14 × 12 | 1.5px |
exit-fullscreen |
14 × 12 | 1.5px |
store |
14 × 12 | 1.5px |
ai |
14 × 12 | 1.5px |
sliders |
14 × 12 | 1.5px |
search-ai |
14 × 12 | 1.5px |
@vestra/widgets.slint: compact controls drawn with the theme. Other controls come from std-widgets.slint.
KeyHint: A key cap: the label of a shortcut as the player's menus write it (plugin.commands.keys: W, Ctrl+B, ⌘B on macOS), in small monospace text-dim type inside a 1px border. Put it at the right end of a control's row, the minus key before the plus key (W E). An empty text draws nothing and takes no space, so a command without a key (or one the user cleared) shows no cap; the element stays the same either way.
| Member | Kind | Default | Note |
|---|---|---|---|
text |
in string |
ToolTipArea: Hover for about half a second to show text beside the pointer. The tip closes when the pointer leaves, or presses on content that does not take the press itself; it shows again on the next hover. It is Slint's input-transparent tooltip: every press reaches the control under the pointer, and the tip does not take the keyboard focus. With keys the tip names the control's keys after its title, each as a key cap and what it does: "Brightness [W] − [E] +"; detail follows dimmed ("· double-click: Default"). Changing keys or detail changes the tip's text, never which elements exist while hovering.
| Member | Kind | Default | Note |
|---|---|---|---|
text |
in string |
||
keys |
in [ToolTipKey] |
||
detail |
in string |
||
showing |
out bool |
The tip is showing (read-only); it follows the tip's delay closely, not exactly. |
Button: Dialog button: text (21px, or 18px when small), or an icon button when text is empty and icon holds Path data drawn in an icon-width × icon-height viewbox (filled, or 1.5px round-capped lines when stroked, as the @vestra/icons.slint set). The caller sizes icon buttons. key: the key that presses it, in a KeyHint 6px after the text ([Run Enter]); empty (the default) draws nothing and takes no space.
| Member | Kind | Default | Note |
|---|---|---|---|
text |
in string |
||
key |
in string |
||
icon |
in string |
||
icon-width |
in length |
14px |
|
icon-height |
in length |
12px |
|
stroked |
in bool |
||
enabled |
in bool |
true |
|
small |
in bool |
||
checked |
in bool |
Icon buttons: the "on" state, drawn in the accent colour. | |
clicked |
callback () |
Slider: 2px line slider. Bar style (default): 8px round thumb, a white core in a 2px accent ring, gradient fill. Panel style (panel: true): 14×12 thumb, gradient fill. The track is Theme.line in both. Keyboard (focused by Tab or focus(); a click does not take the focus, so the bar's volume slider leaves the arrows to seeking), as std-widgets' Slider: Left/Down and Right/Up move by step, Page Down/Up by 10 steps, Home/End to the ends; changed follows every move and released the key's release. Screen readers can increment, decrement or set the value.
| Member | Kind | Default | Note |
|---|---|---|---|
value |
in-out float |
||
minimum |
in float |
0 |
|
maximum |
in float |
1 |
|
step |
in float |
(root.maximum - root.minimum) / 20 |
One key press: a twentieth of the range unless set. |
enabled |
in bool |
true |
|
panel |
in bool |
||
focusable |
in bool |
true |
false: Tab skips the slider (the bottom bar's seek and volume sliders, so Tab never moves the arrows from seeking to the slider); focus() still works. |
has-focus |
out bool |
keys.has-focus |
|
changed |
callback (float) |
||
released |
callback (float) |
||
set-value |
function (v: float) |
Clamped to the range; changed only when the value moves. |
UrlInputRow: Link input: a multi-line input and [Open] [Cancel]. Enter or the confirm button accepts (Shift+Enter starts a new line), Esc or Cancel cancels. No validation here: the plugin checks the address.
| Member | Kind | Default | Note |
|---|---|---|---|
text |
in-out string |
||
placeholder |
in string |
||
confirm-text |
in string |
@tr("Open") |
|
cancel-text |
in string |
@tr("Cancel") |
|
enabled |
in bool |
true |
|
accepted |
callback (string) |
||
cancelled |
callback () |
||
focus-input |
function () |
||
select-all |
function () |
Check: Check box with a label that wraps onto more lines when the row is narrower than the label (the box stays beside the first line). A click or Space flips checked, then toggled reports the new state, as std-widgets' CheckBox: bind it two-way (checked <=> Bridge.on), or set it again from the plugin's data in a changed handler, since the click replaces a one-way binding. Plugin-decided (self-toggle: false, like Radio): a click or Space does not flip the box; toggled reports the state asked for (!checked) and the plugin sets checked when it agrees, for example after a confirmation, so a one-way binding (checked: Bridge.on) stays. Both modes also call clicked. Default style: a 13px box, accent when checked. Panel style (panel: true, the picture and audio workbenches' switches): a 12px box on bg-bar with a 6px playing square.
| Member | Kind | Default | Note |
|---|---|---|---|
text |
in string |
||
checked |
in-out bool |
||
enabled |
in bool |
true |
|
panel |
in bool |
||
self-toggle |
in bool |
true |
false: the plugin owns checked (see above). |
has-focus |
out bool |
keys.has-focus |
|
toggled |
callback (bool) |
The state after the click (self-toggle) or the state asked for. | |
clicked |
callback () |
||
toggle |
function () |
What a click does; also Space and the screen reader's default action. |
RadioMark: The 12px radio dot alone, for rows a plugin lays out itself, such as the palette list with its previews. hover lights the ring; focused draws the focus ring.
| Member | Kind | Default | Note |
|---|---|---|---|
checked |
in bool |
||
hover |
in bool |
||
enabled |
in bool |
true |
|
focused |
in bool |
Radio: One radio choice: the mark, 4px, an 11px label. The plugin owns the state: checked is what it shows, a click or Space asks with clicked. For a set of choices from one list use RadioGroup, which also takes the arrow keys. (focusable and focused are RadioGroup's: its radios are one Tab stop, the group's.)
| Member | Kind | Default | Note |
|---|---|---|---|
text |
in string |
||
checked |
in bool |
||
enabled |
in bool |
true |
|
focusable |
in bool |
true |
|
focused |
in bool |
||
has-focus |
out bool |
keys.has-focus |
|
clicked |
callback () |
RadioGroup: Radio choices from a list of labels, in a row (12px apart) or a column (vertical). One Tab stop; a click, or the arrow keys while the group has the focus (they wrap around), pick one: current-index changes and selected reports it, as std-widgets' RadioGroup.
| Member | Kind | Default | Note |
|---|---|---|---|
model |
in [string] |
||
current-index |
in-out int |
-1 |
|
vertical |
in bool |
||
enabled |
in bool |
true |
|
spacing |
in length |
root.vertical ? 0px : 12px |
|
has-focus |
out bool |
keys.has-focus |
|
selected |
callback (int) |
||
select |
function (index: int) |
Tab: One page tab: at least 74px, 12px label, dimmed unless selected; the selected tab has a 28px gradient stroke under its label, the others a rounded plate on hover. emphasis draws an unselected label in the accent colour (something waits there). Tabs lays them out; use Tab alone only for a strip with other content.
| Member | Kind | Default | Note |
|---|---|---|---|
text |
in string |
||
selected |
in bool |
||
emphasis |
in bool |
||
focused |
in bool |
||
clicked |
callback () |
Tabs: A 31px tab strip on bg-bar (the picture, audio and properties windows): one Tab per label, left-aligned. A click, or Left/Right/Home/End while the strip has the focus, picks a tab: current-index changes and selected reports it. The pages are the plugin's (show the one for current-index). Its min-width is the tabs' width, for a window that must fit them.
| Member | Kind | Default | Note |
|---|---|---|---|
model |
in [string] |
||
current-index |
in-out int |
0 |
|
emphasis |
in [bool] |
Per tab (same order as model, may be shorter): Tab's emphasis, the accent label of a tab where something waits ("Updates (2)"). |
|
has-focus |
out bool |
keys.has-focus |
|
selected |
callback (int) |
||
select |
function (index: int) |
Choice: Compact 21px drop-down: the current label (11px, elided) and a small V; a click opens the list below it (Slint keeps the popup inside the window, moving it up when there is no room below). The list is a ListView (rows are created only while visible, so long lists such as output devices or plugin ids stay cheap) of at most max-visible-rows 20px rows; it is at least popup-min-width wide. Slint moves the popup into the window but does not shorten it: in a window shorter than the list, set window-height: root.height (the window's height) and the list is cut to fit, scrolling to reach every row. A Choice in a mounted panel or settings page cannot see its window's height; keep max-visible-rows small there. Keyboard: closed and focused (Tab or focus()), Up/Down/Home/End change the choice, Space, Enter, F4 or Alt+Down open the list; open, the arrows, Page Up/Down and Home/End move the lit row, Enter or Space picks it, Escape or a click outside closes the list without a change. A pick sets current-index and selected reports it (only a change), as std-widgets' ComboBox; the pick replaces a one-way binding, so bind current-index two-way or set it again in a changed handler. The labels are what the list shows: give translated text (@tr in the .slint file, or text values plugin.i18n.text from the plugin).
| Member | Kind | Default | Note |
|---|---|---|---|
model |
in [string] |
||
current-index |
in-out int |
0 |
|
enabled |
in bool |
true |
|
max-visible-rows |
in int |
10 |
|
popup-min-width |
in length |
0px |
|
window-height |
in length |
0px |
The window's height, when known: the list is never taller. |
has-focus |
out bool |
keys.has-focus |
|
open |
out bool |
popup.is-open |
|
current-text |
out string |
root.current-index >= 0 && root.current-index < root.model.length ? root.model[root.current-index] : "" |
|
selected |
callback (int) |
||
select |
function (index: int) |
||
show-list |
function () |
||
close-list |
function () |
Struct ToolTipKey: One key in a tooltip (ToolTipArea.keys): its label (KeyHint) and what it does, a word or a sign (−, +). An empty key is left out.
A component's public functions are called from your own Slint code, through an element id: row.focus-input() puts the keyboard focus into UrlInputRow's input (call it when the window opens, for example from init), row.select-all() selects its text.
@vestra/markdown.slint shows a document made by plugin.ui.markdown: give blocks its value. Links report link-clicked(url), resolved against the document's base; the plugin decides what to open (usually plugin.system). code-copy: true adds a Copy button to code blocks that reports copy-code(code); the plugin copies it (plugin.clipboard).
Selectable text: selectable: true on MarkdownView or MarkdownBlocks lets the user select and copy text, one block at a time, with a right-click menu of Copy and Select All (and Copy Link in a block with one link). A block without links then shows its plain text; a block with links keeps its styles and clickable links. Code blocks are always selectable.
MarkdownBlock has two fields a plugin may read: plain, the block's text without styles (each link followed by its address, text (url)), and links, the addresses of its links in order.
MarkdownBlocks: Markdown blocks without scrolling, as tall as their content.
| Member | Kind | Default | Note |
|---|---|---|---|
blocks |
in [MarkdownBlock] |
||
code-copy |
in bool |
false |
A Copy button on code blocks, reporting copy-code(code). |
selectable |
in bool |
false |
Text the user can select and copy (see the top of this file). |
link-clicked |
callback (string) |
||
copy-code |
callback (string) |
MarkdownView: A scrolling Markdown document: a ListView of its blocks, so only the blocks in view exist (a long document no longer builds every block). It draws as MarkdownBlocks in a column with inset padding would: inset above the first block, below the last and at both sides, 8px between.
| Member | Kind | Default | Note |
|---|---|---|---|
blocks |
in [MarkdownBlock] |
||
inset |
in length |
10px |
Space around the document. |
code-copy |
in bool |
false |
A Copy button on code blocks, reporting copy-code(code). |
selectable |
in bool |
false |
Text the user can select and copy (see the top of this file). A selection is lost when its block scrolls out of view (the ListView drops the row). |
link-clicked |
callback (string) |
||
copy-code |
callback (string) |
Struct MarkdownRow: One table row (cells are plain text).
Struct MarkdownBlock: One displayed block. Plugins only pass these through; the fields are filled by the player.
@vestra/focus.slint exports one global, VestraFocus, filled by the player:
| Member | Kind | Note |
|---|---|---|
release |
callback () |
Gives the keyboard focus back to the video, at once, inside the handler: the video area in the main window (from the sidebar, the adjust column, the bottom bar or their fullscreen overlays); the window's own key scope in the floating sidebar window, so unaccepted keys reach the player's shortcuts; nothing elsewhere (the Options window, tool windows). |
Call it after the user played or opened an item from the keyboard or by double click, and on Esc in a list, so the arrows control the player again. A click on an empty part of a panel gives the panel the focus; a panel needs release() when one of its own controls took the focus and accepts the keys the player would use.
@vestra/bar-buttons.slint holds the bottom bar's strip of command buttons (CommandOptions.button) and the player's own, each a cell 41 wide and 40 high. The player places the strip; a bar reads BarButtonsHost.width and reports content-min-width, and content-full-width when it drops controls of its own (Design rules).
BarButtons: Deprecated (the player places its strip): the strip a bar placed at its right end with the width it could spare. A bar that still places it shows this one instead of the player's (no palette cell, no »): the cells that fit in room, lost from its outer (left) end inward, the sidebar toggle last; it is as wide as the cells it shows.
| Member | Kind | Default | Note |
|---|---|---|---|
room |
in length |
The width the bar can give the strip; the cells that fit show. | |
first-shown |
out int |
BarButtonsHost.buttons.length - root.count |
The index (in the player's list, ascending order) of the leftmost plugin button shown; the ones before it are hidden for want of room. |
Struct BarButtonItem: One button as the player shows it.