# Prism: writing an interface theme This document is self-contained. Read it fully, then write the theme. Use only what it lists. The game checks every theme in Rust and REFUSES any name, property, value, class, path or output that is not in its closed lists. An invented name is a rejected theme. ## ABSOLUTE RULES - DO NOT INVENT ANYTHING. Every token, node attribute, CSS property, input path, output, slot and part you write must appear in the lists at the end of this document. - If the request needs something the lists do not offer, SAY SO ("a theme cannot do X") and propose the nearest thing that is allowed. Never fake it. - Write the files, run the checker (see Workflow), read each message, fix, run again. Stop only when the checker prints no problem. - Write code, identifiers and comments in English. Answer the user in their language. ## What a theme is - A theme is a FOLDER of DATA, not a program. It restyles and rearranges the game's interface. It does not run while the game draws. - It has up to four files: a manifest (`theme.json`), design tokens (`tokens.css`), optional extra CSS for the theme's own classes (`theme.css`), and an optional template script (`theme.ts`) that decides where the parts of a screen stand. - `theme.ts` runs ONCE when the theme loads, under budgets, and returns a tree of nodes of a closed list. The game draws the tree with one generic engine. - Rust validates everything before anything reaches the page. What passes is applied; nothing else is. ## What a theme is not - Not JavaScript in the page. No DOM access, no network, no files. The script sees only the language and the builders. - Not new behaviour. A theme moves and styles what the game already does. It cannot add an action, remove Play, or call anything that is not an `output` of the contract. - Not a new screen. It templates the screens and components listed in the Contracts block. - Not able to hide the map picture. The picture behind the menus must stay visible (see Hard rules). - Not free-form CSS. `theme.css` is a validated subset (see CSS allow-list). ## Folder layout A theme lives in `themes//`. ``: lower-case letters, digits and hyphens, at most 32 characters, starting with a letter or digit. The folder name IS the id. ```text themes// theme.json REQUIRED the manifest tokens.css REQUIRED design tokens (file name set by "tokens" in theme.json, default tokens.css) theme.css optional styles for the theme's own classes theme.ts optional the templates: defineTheme({ screens, components }) preview.png optional picker preview (named by "preview" in theme.json) images/... optional png, jpg, webp, gif or svg, at most 4 MiB each; named from tokens, theme.css and theme.ts ``` A theme without `theme.ts` inherits the game's default templates (the `_base` theme) for every screen and component. A theme with `theme.ts` replaces only the templates it writes. Never create a folder named `_base`. The game searches `themes/` next to the game, then `/themes`. In the repository the shipped themes are in `content/themes/`. A player installs a theme by copying its folder into `/themes/`; deleting the folder removes it. ### theme.json - REQUIRED: `id` (equals the folder name), `name` (1 to 48 characters). - Optional: `description` (0 to 240), `version` (letters, digits and `. _ + -`, at most 32), `author` (0 to 64), `order` (0 to 1000, default 100: position in the picker), `themeApi` (a whole number from 1, default 1: the theme contract version the theme was written for), `tokens` (a `.css` file name), `preview` (an image of the folder), `accent` (`"preference"` default: the accent follows the player's setting; `"fixed"`: the accent is always the theme's `--pv-accent`), `localized` (`{ "fr": { "name": "...", "description": "..." } }`, language codes such as `en`, `fr`, `zh`, `ko`, at most 16). - Write `"themeApi": 2` in a new theme (the game speaks 2). A theme that asks for a newer contract than the game speaks is refused. A theme declaring 1 (or nothing) keeps loading, but the templates of the screens and faces added in version 2 (`since:2` in the contracts below) and `"accent": "map"` are refused with `requires themeApi 2: …`. ### tokens.css - ONE `:root { --pv-name: value; ... }` block, plus at most two `@media (max-width: px) { :root { ... } }` blocks (n from 320 to 4000). Nothing else: no other selector, at-rule, nesting, `@import`, `@font-face`, `url()` or `expression`. `/* comments */` are allowed. - Every declaration is a `--pv-*` token of the Tokens block, with a value of that token's type (color, length, font, weight, opacity, easing, clip, layers, filter, image, duration, shadow, ratio, case, scheme, choice) inside the token's range. `var()` is allowed only to reference a color token inside a color. Every token is declared at most once. - A token you leave out keeps the game's neutral value: a theme can be partial. Start by setting the palette (`--pv-bg`, `--pv-plate*`, `--pv-line`, `--pv-text*`, `--pv-accent`, `--pv-ink`) and the shapes. - Limits: 64 KiB per file, 200 declarations, 600 characters per value. ### theme.css - Styles the classes that `theme.ts` uses and reaches the game's own parts by their `data-*` marks. Validated, then rewritten: each `.name` becomes `.tpl--name` and every selector is placed under `[data-direction=""]`, so a theme cannot touch the rest of the game. - Limits: 256 KiB, 2048 rules, 40 declarations per rule. - Selectors start with a class of the theme (`.name`) and may continue with `[data-x]`, `[data-x="value"]`, the pseudo-classes of the CSS allow-list, descendant and `>` combinators, commas, and one final `::before` or `::after` (with `content`). NEVER an element selector, `*`, `#id`, `:root`, `body`, or a class of the game. - No `!important`, no `@import`, no `@font-face`, no escapes `\`. Images: `url("images/x.png")` only, for a file of the theme's `images/` folder. - `@media` takes `(min-width | max-width | min-height | max-height: px)` and `(prefers-reduced-motion: reduce | no-preference)`, at most two conditions joined by `and`. `@keyframes` are allowed (names are renamed per theme). - Colours, sizes and fonts come from `var(--pv-*)`. Variables you may define: `--tpl-` (set by a node's `vars`), the plate variables `--plate`, `--edge`, `--clip`, `--clip-edge`, and `--pv-*` tokens of the allowed types. ### theme.ts - A TypeScript file that calls `defineTheme({ screens: { library: fn, settings: fn }, components: { 'library.footer': fn } })` exactly once. The keys of `screens` are screen names without the `screen.` prefix; the keys of `components` are contract names (see Contracts). - Each `fn` receives a typed context `c` and returns ONE node. Type it with `ThemeContext<'screen.library'>` (or the contract name). The types come from `content/mods/sdk/theme.d.ts` (served at `/dev/sdk/theme.d.ts`), so a wrong path or class is an error before Rust sees it. - A file that declares top-level names of its own (functions, constants) adds `export {};` at the top to be a module. - The script runs once and only its returned tree survives. Use functions, arrays and loops freely to build it; a function, `NaN` or cycle left in the result is refused. - Builders (all on `c`): `box`, `row`, `column`, `stack`, `grid`, `scroll`, `spacer`, `text`, `icon`, `image`, `button`, `toggle`, `meter`, `dropdown`, `slot`, `each`, `when`. Values: `c.bind('path')`, `c.t('i18n.key', { arg })`, `c.fmt.rate | count | percent | duration | fixed('path', digits?)`. Conditions: `c.field('path')` then `.eq .ne .in .gt .ge .lt .le .truthy() .falsy()`, joined with `.and() .or() .not()`. Events: `on: c.on.press('output', ...args)`, `c.on.change(...)`, `c.on.pick(...)`. - The exact attributes of each node are in the Nodes block. - A minimal call, as text: ```text c.row({ class: ['screen', 'pv-screen'] }, c.slot('list'), c.slot('footer')) c.when(c.field('selection.shown').truthy(), [c.slot('header'), c.slot('tabs')], c.slot('header')) c.each('map.equalizer', item => item.box({ class: 'eq-bar', vars: { '--tpl-live': item.bind('live') } })) c.button({ class: 'go', label: 'Go', on: c.on.press('confirm') }) ``` ## Workflow Follow these steps in order. Do not skip the check. 1. Create the folder `themes//` (the id is the folder name). 2. Write `theme.json`: `id`, `name`, `"themeApi": 2`, and a `description`. 3. Write `tokens.css`: a palette, then shapes. Only tokens of the Tokens block, values of the right type. 4. If the request changes the layout: write `theme.css` for the classes first, then `theme.ts` that uses them. Every class you put on a node in `theme.ts` must be defined in `theme.css` or be a game class listed for that screen or contract. 5. Run the checker on the folder that HOLDS the theme folders: ```bash cargo run -p modding --example check_theme -- themes ``` Without a clone of the repository, the installed game runs the same check: `prism.exe --check-theme `. With no argument it checks `content/themes`. It prints `N theme(s) loaded`, one line per theme, then one line per problem `"": : : `, and exits with code 1 if there is any problem. 6. Read each message left to right: the theme, the FILE (`theme.json`, `tokens.css`, `theme.css`, `theme.ts`), the place in it (a line number, a token, or for `theme.ts` the template, the chain of nodes and the attribute), then the reason in full words. The reason says what is allowed. Fix exactly that, in that file. 7. Run again. Repeat until there is no `problem:` line. A `warning:` line is a problem too (exit code 1): fix it. 8. A problem in `theme.json`, `tokens.css` or `theme.css` REMOVES the whole theme. A problem in `theme.ts` removes only the template concerned: the theme still loads with the game's default for it. A script error removes all the templates of the theme. 9. If you cannot run the checker, say so. Re-read each file against the Hard rules and the lists below before you answer, and tell the user the theme was not checked. ## Hard rules Closed lists - Nodes, node attributes, roles, icons, CSS properties, pseudo-classes, token names and token values come from closed lists. Nothing outside them is accepted. - Every input path you `bind` or test with `field` must exist in the input of that screen or contract. Operators fit the field type; an enum is compared only with its own values. - Every output you call (`on.press('confirm')`) must be an output of that screen or contract, with its arguments in order and of the right type. A component template cannot call an output of a screen. - A `slot` name must be a slot of that screen or contract, or a contract you may mount with `{ from }`. - A `part` must be a part of the contract. A screen has no parts. Required - A screen template MUST place EVERY required slot of its screen (inside a `when` it counts). A missing one is refused: `the required slot "footer" is not placed`. - A component template MUST bind every `required` output of its contract to a control. For `library.footer`, a `button` must call `confirm`, or Play would disappear. - A `button` needs a `label` or children (it needs a name). An `image` needs `alt` and a `src`. An `each` needs the path of a list. Classes - Every `class` is lower-case letters, digits and `-`, starting with a letter, at most 40 characters, at most 8 per node. - Every `class` must be EITHER defined in `theme.css` OR a game class listed for the screen or contract (`hostClasses`). Neither is refused. BOTH is refused as ambiguous: rename the theme's. - Do not target game classes in `theme.css`. Reach the game's elements with their `data-*` marks (`[data-part='play']`). Faces - `library.setCard`, `library.chartRow` and `leaderboard.card` are FACES: the game owns the button, the keyboard, the menus and the actions; the theme draws only what is inside. - A face MUST NOT contain a `button`, `toggle` or `dropdown`, a `slot` that mounts another contract, or an event. Use `box`, `row`, `column`, `text`, `icon`, `image`, `meter`, `slot` (its own places), `each`, `when`. Map picture - The picture behind the menus must stay visible. At least 20 % of its light must reach the screen, averaged over the window. Each `--pv-shade` gradient may cover at most 90 % on average (never an opaque flat colour). In `--pv-art-filter`: `brightness()` at least 0.25, `opacity()` at least 0.4, `contrast()` at least 0.5. Tint, dim and blur are allowed; hiding is refused. Motion - NO infinite animation on an idle screen. `animation-iteration-count: infinite` (or `infinite` in the `animation` shorthand) repaints the page every frame and is reported as a warning. Play decorative motion once per selection by attaching it to `[data-entering]` (give the node `data: { entering: c.bind('selection.entering') }`), or with a finite count on `:hover` / `:focus-visible`. - Put moving animations inside `@media (prefers-reduced-motion: no-preference)`. - Prefer `transform` and `opacity` to `height`, `width` or `top` for anything that moves. A bar driven by live data (`map.equalizer[].live`) uses `transform: scaleY(calc(var(--tpl-live) / 100))` and NO `transition`: the page already smooths the values. - A `filter` or `box-shadow` on an element that has a `clip-path` is clipped away. Put `filter: drop-shadow(...)` on the PARENT of the clipped element. Budgets - `theme.ts` at most 128 KiB of source. The script runs once in at most 500 ms and 16 MiB of memory, builds at most 4000 nodes (counted with repetitions), and returns at most 1 MiB of JSON. Over a budget, the theme loads without templates. - The validated templates of one theme: at most 1500 nodes, 24 levels deep, 64 templates, 200 characters per literal text, 64 children per node, 8 entries in `data` and in `vars`, 12 tracks in a grid. - Do not loop or recurse without end. Use plain loops over small arrays. ## A complete minimal theme A theme that moves the Play strip to the top of the selected-map panel. All four files; copy the shape. `theme.json` ```json { "id": "first-layout", "name": "First layout", "description": "The list on the left and the Play strip moved to the top of the selected-map panel: a theme.ts and a theme.css on top of a palette.", "version": "1.0.0", "author": "Prism docs", "themeApi": 2, "accent": "fixed", "tokens": "tokens.css", "localized": { "fr": { "name": "Première mise en page", "description": "La liste à gauche et le pied Play déplacé en haut du panneau de la map choisie : un theme.ts et un theme.css sur une palette." } } } ``` `tokens.css` ```css /* First layout: a warm palette. The layout itself is theme.ts and theme.css. */ :root { --pv-color-scheme: dark; --pv-bg: #17110e; --pv-plate: rgb(36 27 22 / .86); --pv-plate-raised: rgb(52 39 31 / .92); --pv-plate-hover: rgb(72 54 43 / .96); --pv-plate-active: rgb(251 146 60 / .18); --pv-plate-active-hover: rgb(251 146 60 / .28); --pv-line: rgb(255 255 255 / .14); --pv-track: rgb(255 255 255 / .1); --pv-text: #fbf3ec; --pv-text-2: #d3c3b5; --pv-text-3: #a08f80; --pv-ink: #24120a; --pv-accent: #fb923c; --pv-accent-2: #5eead4; --pv-clip-lg: inset(0 round 12px); --pv-clip-md: inset(0 round 9px); --pv-clip-sm: inset(0 round 5px); --pv-radius-input: 8px; --pv-radius-panel: 12px; } ``` `theme.ts` ```ts theme // First layout: the library (the list) on the left, the selected map on the right with the Play strip ABOVE its heading. // // theme.ts runs ONCE, when the theme loads, and returns data: a tree of nodes that Rust checks against the contract of `screen.library`. // The validator refuses a template that drops a place the screen requires, so every place is still placed here: only their order and their wrappers change. // The file declares names of its own (functions), so it is a module. export {}; // The `c` of the library screen: its input paths, its places and its classes are typed by theme.d.ts. type Screen = ThemeContext<'screen.library'>; // The entry point: one template for the screen `screen.library`. defineTheme({ screens: { library: libraryScreen } }); // The screen: two columns side by side, the list first. `pv-screen` is a class of the screen (the game styles it), `screen` is this theme's, defined in theme.css. // `--selection-color` is a variable of the screen: the colour of the selected row, read from the input. function libraryScreen(c: Screen): ThemeNode { return c.row( { class: ['screen', 'pv-screen'], vars: { '--selection-color': c.bind('browser.color') } }, library(c), selectedMap(c), ); } // The selected map: the Play strip first (the `footer` place: rating, judgement, Play), then the heading, the tabs and their panels. // While nothing is selected, `when` draws the heading alone: it is the invitation to pick a map. function selectedMap(c: Screen): ThemeNode { return c.column( { as: 'section', class: 'map', aria: { label: c.t('ui.selected_map'), busy: c.bind('selection.busy') }, vars: { '--difficulty-color': c.bind('browser.color') } }, c.when( c.field('selection.shown').truthy(), [c.box({ class: 'play' }, c.slot('footer')), c.box({ class: 'details' }, c.slot('header'), c.slot('tabs'), c.slot('panels'))], c.slot('header'), ), ); } // The library: the toolbar, the search and the list. The playlists and the visualizer cover the list, so they are placed next to it // (`browser-body`, `browser-list` and `browser-playlists` are classes of the screen: the game stacks the lists with them). function library(c: Screen): ThemeNode { const covered = c.field('browser.covered').truthy(); return c.column( { as: 'section', class: 'library', aria: { label: c.t('ui.available_beatmapsets') } }, c.slot('intent'), c.slot('toolbar'), c.box( { class: 'browser-body' }, c.box({ class: 'browser-list', classWhen: { covered }, inert: covered }, c.slot('search'), c.slot('list')), c.when(c.field('browser.view').eq('playlists'), c.box({ class: 'browser-playlists', focusable: true }, c.slot('playlistSearch'), c.slot('playlists'))), c.when(c.field('browser.visualizer').truthy(), c.slot('visualizer')), ), ); } ``` `theme.css` ```css /* The classes of theme.ts: two columns, the library first, the selected map second. */ .screen { display: flex; flex-direction: row; align-items: stretch; gap: var(--pv-s6); height: 100%; min-height: 0; } .map { display: flex; flex-direction: column; flex: 1 1 0; min-width: 0; min-height: 0; } .library { display: flex; flex-direction: column; flex: 1 1 0; min-width: 0; min-height: 0; } .map > .details { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; overflow: hidden; } /* The Play strip stays pinned above the heading; a hairline under it separates it from the map. */ .map > .play { border-bottom: 1px solid var(--pv-line); padding-bottom: var(--pv-s3); } ``` Why it passes: every place of the screen is placed (only their order and wrappers change); the classes `screen`, `map`, `library`, `details`, `play` are defined in `theme.css`; `pv-screen`, `browser-body`, `browser-list` and `browser-playlists` are game classes of the screen; `footer` is placed, so Play stays. To go further, read `content/themes/stage/` (`theme.ts` first): the shipped theme written as a program, with one function per zone. ## Common errors Each line is `"": : : `. `` and `` are filled by the game. The theme is REMOVED when the file is `theme.json`, `tokens.css` or `theme.css` (a `warning:` keeps it). A `theme.ts` problem removes one template, except `interrupted` and a script error, which remove all of them. | Message | Fix | | --- | --- | | `theme.json: themeApi 99 is newer than this game speaks (theme API ): update the game, or use a version of the theme written for API ` | Write `"themeApi": ` (the version the game speaks) or remove the field. | | `theme.ts: screen.settings: requires themeApi 2: the screen "screen.settings" was added in theme API 2 and this theme declares themeApi 1; set "themeApi": 2 in theme.json …` | Write `"themeApi": 2` in theme.json (the template is dropped, the theme still loads). | | `theme.json: the id "" must be the folder name` | Make `id` equal to the folder name. | | `the folder name must be lower-case letters, digits and hyphens (at most 32)` | Rename the folder. | | `tokens.css: line 5: --pv-acent is not a theme token` | The token name is not in the Tokens block: fix the typo. | | `tokens.css: line 5: --pv-accent: a hex colour has 3, 4, 6 or 8 digits` | The value does not fit the token's type: write a value of that type (see its row in Tokens). | | `tokens.css: a second :root block (put width-dependent values in @media blocks)` | One `:root` only; use `@media (max-width: px)` (320 to 4000, two blocks at most). | | `tokens.css: line : --pv- is declared twice` | Delete one of the two. | | `tokens.css: the map picture must stay visible: a --pv-shade layer covers 100% of the picture on average; at most 90%` | Lower the opacity of the `--pv-shade` layer below 1, or remove it. Also: `--pv-shade and --pv-art-filter leave % of it on average; at least 20% is required`: lighten the shade or the filter. | | `theme.css: line 2: the selector "button": element selectors are not allowed: select the theme's classes` | Select a class of the theme (`.name`); reach game elements with `.name [data-part='x']`. | | `theme.css: line 1: isolation: this property is not allowed in theme.css` | Use a property of the CSS allow-list. | | ``theme.css: line : : `!important` and `!` are not allowed`` | Remove `!important`; repeat a `[data-*]` mark to raise specificity. | | `theme.css: line : : this token is set in tokens.css, not in theme.css (a rule may set the colours, lengths, fonts, weights, shadows, durations and easings)` | Move that `--pv-*` token to `tokens.css`. | | ``theme.css: line : the selector "": a selector starts with one of the theme's classes (`.name`)`` | Start the selector with a class of the theme. | | ``theme.css: warning: line 3: an infinite animation repaints the page every frame, even on an idle screen; play it a few times (a finite `animation-iteration-count`), or once per selection under `[data-entering]` `` | Use a finite count, or hook the animation to `[data-entering]`. The word `infinite` on any line triggers it. | | `theme.ts: interrupted` | The script ran over its 500 ms budget (an endless loop). Remove the unbounded loop. | | `theme.ts never called defineTheme({ screens, components })` | Call `defineTheme` once at the top level. | | ``theme.ts: defineTheme(): component "": (): attribute `` is required`` | Add the attribute the builder needs (a `button` needs `on`). | | ``theme.ts: screen.library: the required slot "footer" is not placed (place it with slot("footer"); inside a `when` it counts)`` | Add `c.slot('footer')` (every required place of the screen). | | `theme.ts: library.footer: the required output "confirm" is not bound to any control (a button must call it)` | Add `c.button({ label: 'Play', on: c.on.press('confirm') })`. | | `theme.ts: screen.library › … (on.press › output): "back" is not an output of screen.library (outputs: )` | Call an output from the list, or remove the button. | | `theme.ts: screen.library › … (value › bind): the path "map.titel" is not in the screen: no field "titel" in "map" (fields: )` | Use a path from the Contracts block; the message lists the fields at that level. | | `theme.ts: screen.library › … (class[0]): the class "unknown" is neither defined by theme.css nor a class of the game here (game classes: )` | Define `.unknown` in `theme.css`, or use a listed game class. | | `the class "" is both a class of the game and a class of theme.css: rename the theme's` | Rename the class of the theme in both files. | | `theme.ts: library.setCard › … › button: a button is not allowed in library.setCard: the host draws and owns the card's own button, keyboard, menus and actions, a theme draws what is inside it (box, row, column, text, icon, image, meter, slot, each, when)` | Remove the `button`, `toggle`, `dropdown` or mounting `slot` from the face; use `text`, `icon`, `image`, `meter`, `each`, `when`. | | `"" is not a slot of the (slots: )` | Use a slot name from that screen or contract in the Contracts block. | | `"" is not in the theme's images/ folder` | Add the file to `images/` or fix the name. | ## Tokens The complete list of tokens: name, type, range or options, and role. Use these names and no others. ```text # --pv- [bounds]. Bounds apply to px values; choices list their words (first = default). # color: #rgb|#rgba|#rrggbb|#rrggbbaa, rgb()/rgba()/hsl()/hsla(), color-mix(in srgb, c [n%], c [n%]), transparent|white|black, var(--pv-) # length: px|em|rem|%|vw|vh|vmin|vmax or 0, clamp(a,b,c)/min(a,b)/max(a,b); >= 0 unless 'signed'; px bounds # font: 1..8 families (quoted or plain words), last generic: sans-serif|serif|monospace|system-ui|ui-monospace|cursive # weight: integer 1..1000. opacity: 0..1. duration: 0..3s (ms|s). ratio: unitless in bounds # easing: ease|ease-in|ease-out|ease-in-out|linear|cubic-bezier(x1,y1,x2,y2) x 0..1, y -4..4 # clip: none|polygon(x y, ...) 3..16 points (length or calc(n% +/- npx))|inset(1..4 offsets [round 1..4 radii]) # layers: none|1..4 linear-gradient()/repeating-linear-gradient(), angle -720..720deg or 'to side [side]', 2..12 stops # filter: none|<=6 of saturate brightness contrast grayscale sepia opacity (<=4 or 400%), hue-rotate(ndeg), blur(<=12px), drop-shadow(x y [blur] color) (offsets <=48px) # image: none|image("rel/path.png") in the theme folder (png, jpg, jpeg, webp, gif, svg). shadow: none|1..4 of [inset] x y [blur [spread]] color (px, <=128) # case: none|uppercase|lowercase|capitalize. scheme: dark|light. choice: one listed word # file: ':root' block + <=2 '@media (max-width: <320..4000>px)' blocks; <=64 KiB, <=200 declarations, <=600 chars/value; image tokens in base :root only # rules: --pv-shade+--pv-art-filter leave >=20% of the map picture (shade layer <=90% coverage; brightness>=0.25, opacity>=0.4, contrast>=0.5); --pv-graph-combo, --pv-graph-accuracy, --pv-graph-density-mid pairwise >=30deg hue (greys >=0.25 lightness) --pv-bg color --pv-plate color --pv-plate-raised color --pv-plate-hover color --pv-plate-active color --pv-plate-active-hover color --pv-line color --pv-track color --pv-text color --pv-text-2 color --pv-text-3 color --pv-ink color --pv-accent color --pv-accent-2 color --pv-ok color --pv-warn color --pv-danger color --pv-offset-ok color --pv-offset-warn color --pv-offset-high color --pv-offset-bad color --pv-tier-platinum color --pv-tier-diamond color --pv-tier-prism color --pv-tier-prism-b color --pv-tier-prism-c color --pv-gold color --pv-silver color --pv-bronze color --pv-graph-surface color --pv-graph-grid color --pv-graph-zero color --pv-graph-cursor color --pv-clip-lg clip --pv-clip-md clip --pv-clip-sm clip --pv-clip-edge-lg clip --pv-clip-edge-md clip --pv-clip-edge-sm clip --pv-clip-meter clip --pv-graph-bar-clip clip --pv-art-clip clip --pv-inset-lg length --pv-inset-md length --pv-inset-sm length --pv-edge-w length <=64px --pv-meter-h length <=64px --pv-radius-input length <=64px --pv-radius-panel length 0..40px --pv-graph-line-w length <=64px --pv-graph-bar-gap length <=64px --pv-h-sm length --pv-h-md length --pv-h-lg length --pv-art-inset length --pv-art-left length --pv-art-w length --pv-art-pad length --pv-set-row length 8..400px --pv-set-gap length 0..100px --pv-diff-row length 8..400px --pv-diff-gap length 0..100px --pv-set-grid-w length 0..600px --pv-set-grid-aspect ratio 0.3..3 --pv-shift-base length --pv-rail-w length 40..600px --pv-drawer-w length 40..600px --pv-page-pad length 0..160px --pv-page-max length 800..8000px --pv-display-ls length signed --pv-label-ls length signed --pv-title-ls length signed --pv-hero-ls length signed --pv-fs-xs length >=12px --pv-fs-sm length >=12px --pv-fs-md length >=12px --pv-fs-lg length >=12px --pv-fs-xl length >=12px --pv-fs-2xl length >=12px --pv-fs-3xl length >=12px --pv-fs-hero length >=12px --pv-fs-meta length >=12px --pv-fs-accuracy length >=12px --pv-fs-title length >=12px --pv-fs-rating length >=12px --pv-font-display font --pv-font-body font --pv-font-num font --pv-font-label font --pv-font-mono font --pv-fw-display weight --pv-fw-num weight --pv-fw-label weight --pv-art-opacity opacity --pv-ease easing --pv-ease-spring easing --pv-display-case case --pv-label-case case --pv-color-scheme scheme --pv-meter-ticks layers --pv-art-mask layers --pv-graph-scan layers --pv-shade layers --pv-art-filter filter --pv-page-scrim color --pv-page-art-blur length 0..40px --pv-plate-filter filter --pv-plate-sheen layers --pv-overlay-image image --pv-thumb color --pv-switch color --pv-bg-image image --pv-graph-low color --pv-graph-mid color --pv-graph-high color --pv-graph-peak color --pv-graph-bar-stroke color --pv-layout-list choice right|left|center --pv-layout-tabs choice top|rail|dock|sidebar --pv-layout-play choice bottom|top --pv-layout-density choice comfortable|compact|dense --pv-layout-chrome choice none|titlebar|nav --pv-layout-drawer choice left|right|bottom --pv-layout-rows choice cover|strip|text|list --pv-layout-profile choice top|rail --pv-layout-cards choice rich|compact --pv-layout-buttons choice plate|bracket|link --pv-layout-focus choice ring|blink --pv-layout-icons choice none|icon --pv-layout-visualize choice label|icon --pv-layout-groups choice plain|inset --pv-layout-controls choice plain|pill --pv-layout-hero choice plate|open --pv-layout-settings choice side|top|index|rail --pv-layout-settings-rows choice inline|stacked --pv-layout-pause choice panel|side|open|prompt --pv-tier-dark opacity --pv-graph-progression choice steps|lines|area|bars --pv-graph-grid-style choice lines|none|dots|scanlines --pv-graph-cursor-shape choice dashed|solid|band --pv-graph-marker choice none|dot|diamond|square --pv-graph-miss-style choice bands|ticks --pv-graph-curve-w length 1..6px --pv-graph-fill-opacity opacity --pv-graph-combo color #rrggbb --pv-graph-accuracy color #rrggbb --pv-graph-density-low color #rrggbb --pv-graph-density-mid color #rrggbb --pv-graph-density-high color #rrggbb --pv-rating-dark opacity --pv-accent-hover color --pv-accent-press color --pv-accent-soft color --pv-info color --pv-ok-soft color --pv-warn-soft color --pv-danger-soft color --pv-info-soft color --pv-danger-hover color --pv-danger-press color --pv-text-disabled color --pv-text-placeholder color --pv-text-link color --pv-border color --pv-border-strong color --pv-border-focus color --pv-scrim color --pv-surface-1 color --pv-surface-2 color --pv-surface-3 color --pv-surface-4 color --pv-surface-sunken color --pv-elev-0 shadow --pv-elev-1 shadow --pv-elev-2 shadow --pv-elev-3 shadow --pv-elev-4 shadow --pv-shadow-1 shadow --pv-shadow-2 shadow --pv-shadow-3 shadow --pv-shadow-4 shadow --pv-glow-accent shadow --pv-glow-danger shadow --pv-fs-2xs length >=12px --pv-fs-4xl length >=12px --pv-lh-tight ratio 0.8..3 --pv-lh-snug ratio 0.8..3 --pv-lh-normal ratio 0.8..3 --pv-lh-loose ratio 0.8..3 --pv-ls-tight length signed --pv-ls-normal length signed --pv-ls-wide length signed --pv-fw-regular weight --pv-fw-medium weight --pv-fw-semibold weight --pv-fw-bold weight --pv-fw-body weight --pv-s0 length 0..400px --pv-s1 length 0..400px --pv-s2 length 0..400px --pv-s3 length 0..400px --pv-s4 length 0..400px --pv-s5 length 0..400px --pv-s6 length 0..400px --pv-s7 length 0..400px --pv-s8 length 0..400px --pv-s9 length 0..400px --pv-s10 length 0..400px --pv-gap-sm length 0..400px --pv-gap-md length 0..400px --pv-gap-lg length 0..400px --pv-gutter length 0..400px --pv-radius-xs length 0..1000px --pv-radius-sm length 0..1000px --pv-radius-md length 0..1000px --pv-radius-lg length 0..1000px --pv-radius-xl length 0..1000px --pv-radius-pill length 0..1000px --pv-bw-1 length 0..16px --pv-bw-2 length 0..16px --pv-bw-3 length 0..16px --pv-focus-ring-w length 0..16px --pv-focus-ring-offset length -16..16px --pv-focus-ring-color color --pv-dur-1 duration --pv-dur-2 duration --pv-dur-3 duration --pv-dur-4 duration --pv-stagger-step duration --pv-ease-in easing --pv-ease-out easing --pv-ease-in-out easing --pv-ease-emphasis easing --pv-motion-intensity opacity --pv-row-h length 16..200px --pv-control-h-sm length 16..200px --pv-control-h-md length 16..200px --pv-control-h-lg length 16..200px --pv-control-pad-x length 0..400px --pv-card-bg color --pv-card-bg-hover color --pv-card-fg color --pv-card-border color --pv-card-border-w length 0..400px --pv-card-radius length 0..400px --pv-card-pad length 0..400px --pv-card-gap length 0..400px --pv-card-shadow shadow --pv-button-bg color --pv-button-bg-hover color --pv-button-bg-press color --pv-button-fg color --pv-button-border color --pv-button-primary-bg color --pv-button-primary-bg-hover color --pv-button-primary-bg-press color --pv-button-primary-fg color --pv-button-danger-bg color --pv-button-danger-bg-hover color --pv-button-danger-fg color --pv-button-h length 0..400px --pv-button-pad-x length 0..400px --pv-button-radius length 0..400px --pv-button-border-w length 0..400px --pv-button-fs length >=12px --pv-button-fw weight --pv-button-disabled-opacity opacity --pv-input-bg color --pv-input-fg color --pv-input-border color --pv-input-border-hover color --pv-input-border-focus color --pv-input-placeholder color --pv-input-h length 0..400px --pv-input-pad-x length 0..400px --pv-input-radius length 0..400px --pv-input-border-w length 0..400px --pv-tab-fg color --pv-tab-fg-hover color --pv-tab-fg-active color --pv-tab-bg color --pv-tab-bg-hover color --pv-tab-bg-active color --pv-tab-indicator color --pv-tab-h length 0..400px --pv-tab-pad-x length 0..400px --pv-tab-radius length 0..400px --pv-tab-indicator-w length 0..400px --pv-tab-gap length 0..400px --pv-tooltip-bg color --pv-tooltip-fg color --pv-tooltip-border color --pv-tooltip-radius length 0..400px --pv-tooltip-pad-x length 0..400px --pv-tooltip-pad-y length 0..400px --pv-tooltip-max-w length 0..400px --pv-tooltip-fs length >=12px --pv-tooltip-shadow shadow --pv-list-row-bg color --pv-list-row-bg-hover color --pv-list-row-bg-selected color --pv-list-row-bg-selected-hover color --pv-list-row-fg color --pv-list-row-fg-muted color --pv-list-row-border color --pv-list-row-accent color --pv-list-row-h length 0..400px --pv-list-row-pad-x length 0..400px --pv-list-row-radius length 0..400px --pv-list-row-gap length 0..400px ``` ## Contracts Every screen and component you may template: its input paths, outputs, slots (the REQUIRED ones are marked), host classes, parts, musts and whether it is a face. ```text # Screens and components of the contracts table (since:N = needs "themeApi": N in theme.json; absent = 1). s=string n=number b=boolean; a|b = closed set; x? = may be null; x[] = list; ref:T = opaque type. # slots: name[*]=required, :contract = mounts that contract. out: output(args) [*]=required. in: nested paths (dotted in c.bind). Component states: state={extra fields}. # musts: id=kind:part detail @states (part=data-part exists, absent, emits=gesture calls output, shows=path, enabled, disabled, excludes=needle never inside). # template key: screens. for screen.; components[''] for components. face = the host owns the card root; no button/toggle/dropdown/slot-of-contract/outputs inside. ## screen.chat (screens.chat) since:2 slots: tabs* users* close* panes* out: channel.select(channel:s) users.toggle() close() host: card bar push panes pv-plate pv-plate--lg vars: - replaceable: - in: channels[]{id:s label:s unread:n direct:b clan:b selected:b} active:s gate:ready|login|offline|server|unsupported usersShown:b unread:n ## screen.clan (screens.clan) since:2 slots: back* title* online* gate* failed* tag manage* facts members* none* tabs* chat* ranking* out: back() site.open() refresh() settings.open() side.select(side:s) ranking.sort(sort:s) ranking.page(offset:n) host: clan pv-screen pv-ui pv-plate pv-plate--lg page-head label-line push body cols left right band title-line place lead-badge note vars: - replaceable: - in: gate:page|offline-note|login mine:loading|none|clan side:chat|ranking failure?{text:s} clan?{name:s tag:s rank?:n top:b leader:b members:n memberLimit:n online:n totalPp:s averagePp:s} ranking{sort:total|average|members loaded:b empty:b loading:b total:n entries:n page:n pages:n} chat{available:b} ## screen.download (screens.download) since:2 slots: title* sources* choices* search* notices* results* catalog* queue* out: tab.select(tab:s) link.paste() search.focus() queue.clear() host: download pv-screen top body panel previewing vars: - replaceable: download.card catalog.card in: tab:s mode:results|prism|catalog section:s previewing:b results{count:n loading:b failed:b} queue{total:n active:n finished:n} folder?:s ## screen.help (screens.help) since:2 slots: back* title* search* topics* content* out: back() topic.jump(id:s) search.focus() search.clear() host: help-page pv-screen pv-ui page-head push body vars: - replaceable: - in: topics[]{id:s title:s current:b} total:n search{active:b query:s found:n} ## screen.library (screens.library) slots: toolbar:library.toolbar views online visualize intent* search*:library.search searchField searchTools list* playlistSearch*:library.search playlists* visualizer* header*:selected.header tabs*:selected.tabs panels* infoPanel leaderboardPanel modsPanel trainingPanel historyPanel mapsPanel editorPanel footer*:library.footer out: drawer.toggle() random() mods.open() settings.open() mod.set(key:s,on:b) rate.set(value:n) mods.reset() preview.seek(at:n) preview.toggle() host: song-select pv-screen map-browser browser-body browser-list covered browser-playlists selected-map selected-body no-selection vars: --selection-color --difficulty-color --row-distance replaceable: library.setCard library.chartRow leaderboard.card rate.control maps.toPlay in: selection{state:map|playlist|pick|empty shown:b color:s busy:b entering:b changed:b tab:s} browser{view:maps|playlists|mapsToPlay covered:b visualizer:b color:s} map?{artist:s title:s difficulty:s keysText:s keys:n creator?:s background?:s rating{value?:n text:s unit:s label:s} rate?:n duration{text:s seconds?:n} bpm:s bpmValue?:n notes:s holds:s holdShare?:n nps{average:s peak:s averageValue?:n peakValue?:n} skillsets[]{label:s short:s display:s hue:s level:n} patterns[]{label:s short:s display:s hue:s level:n rank:n position:n} equalizer[]{i:n level:n live:n} listening:b fresh:b difficultyCount:n record?{plays:n bestAccuracy?:n bestPerformance?:s lastPlayed?:s top?{accuracy:n performance?:s combo:n misses:n rate:n rateText:s date:s}}} mods[]{key:s id:s name:s short:s description:s group:s groupLabel:s icon:s enabled:b conflicts[]:s} modsOn:n preview{shown:b playing:b position:n duration:n progress:n positionText:s durationText:s steps[]{i:n at:n level:n passed:b}} online{state:offline|signedOut|connecting|online name?:s avatar?:s players?:n friendsOnline:n friends[]{name:s avatar?:s status:online|inLobby|playing} unread:n} rateControl{state=ready|atDefault|atMin|atMax value:n text:s min:n max:n minText:s maxText:s step:n typed:n steps{down:n up:n} ready{} atDefault{} atMin{} atMax{}} keys{play:s menu:s up:s down:s previousSet:s nextSet:s random:s palette:s visualize:s chat:s} ## screen.lobby (screens.lobby) since:2 slots: title* code* switches* notice* playersHead compare* roster* files* map* panel* draft:lobby.draft leave* spectate* ready* out: leave() ready.set(ready:b) spectate.set(spectate:b) code.copy() map.open() host: room band grid people players-panel side actions push pv-plate pv-plate--lg pv-plate--md vars: - replaceable: player.card in: lobby{name:s code:s codeHidden:b open:b hostRotation:b started:b} self{host:b ready:b spectating:b waiting:b} players{count:n rivals:n results:n} map{chosen:b title:s artist:s rate:n shared:b} files{count:n replays:n} draft{active:b} ## screen.mods (screens.mods) since:2 slots: title* actions* folder* list* interfaces messages* out: mod.install() mods.folder() mods.reload() skins.open() host: mods-page settings-heading vars: - replaceable: - in: mods{count:n active:n disabled:n failed:n} folder:s interfaces:n messages:n ## screen.profile (screens.profile) since:2 slots: avatar title* account* badges* rating* accuracy* trackers* choices* loading* tabs* panel* out: tab.select(tab:s) plays.open(view:s) refresh() host: profile pv-screen pv-ui pv-plate pv-plate--lg pv-plate--md identity-band wraps identity name-line figures section-bar status vars: - replaceable: - in: state:pending|unavailable|empty|ready sessionOpen:b tab:s tabs[]{id:s label:s count:n selected:b} view:best|recent|pinned|left player{name:s initial:s charts:n plays:n playTime:s} account?{name:s offline:b} rating?{value:n unit:s digits:n performance:b} accuracy?:n skillsets[]{name:s value:n text:s color:s share:n main:b} crowded:b loading{active:b done:n total:n progress:n} ## screen.replay (screens.replay) since:2 slots: back* title* judgement* performance* rating* compare* watch* sideBySide* export* share* train* standings* notices* transport* banner comparison* player* stats* tiers* graphs* status* out: back() watch() watch.sideBySide() share(replayId:s) compare.pick(replayId:s) compare.clear() host: replay-page pv-screen page-header replay-controls replay-actions replay-scroll replay-content replay-layout score-overview pv-plate pv-plate--lg vars: --map-color replaceable: - in: status:loading|ready|error|unavailable loading:b mock:b lobby:b playback:stopped|loading|playing map{title:s artist:s difficulty:s keys:s creator:s picture?:s color:s rate:s mods:s} score?{replayId:s player:s received:b playedAt:s accuracy:n maxCombo:n misses:n ranked:b pauses?:n performance?:n performanceUnit:s rating?:n ratingUnit:s ratingName:s meanOffsetMs?:n} judgement:s tiers[]{id:s name:s color:s count:n share:n} comparison{shown:b chosen:b player:s rate:s newRecord:b firstPlay:b failed:b references[]{replayId:s player:s rate:s mods:s accuracy:n maxCombo:n picked:b}} ## screen.result (screens.result) since:2 slots: title* tiers* close* out: dismiss() host: results vars: - replaceable: - in: aborted:b auto:b ranked:b judgement:s accuracy:n maxCombo:n clear:aborted|perfect|fullCombo|clear newBest:b hits:n misses:n tiers[]{id:s name:s color:s count:n} ## screen.settings (screens.settings) since:2 slots: title* search* actions* close* notices* rail* panel* hints out: close() category.select(id:s) search.focus() search.clear() host: settings-page settings-top settings-top-actions settings-layout vars: - replaceable: - in: category{id:gameplay|controls|audio|display|library|online|system label:s blurb:s changed:n index:n hasSummary:b} categories[]{id:gameplay|controls|audio|display|library|online|system label:s blurb:s changed:n selected:b} search{active:b query:s found:n} changed:n ## screen.skins (screens.skins) since:2 slots: title* notices* interfaces* skinsHead* skins* problems* out: interface.use(id:s) skin.use(id:s) skin.customize() skins.import() skins.folder() skins.reload() host: skins-page settings-heading skins-section vars: - replaceable: - in: interfaces{count:n current:s currentName:s} skins{count:n shown:n selected:s searching:b importers:n} problems:n ## screen.title (screens.title) since:2 slots: logo name* press* band version nowPlaying out: enter() host: title-center title-foot title-glow vars: --beat replaceable: - in: version:s leaving:b nowPlaying{known:b title:s artist:s} ## screen.tournaments (screens.tournaments) since:2 slots: back* title* online* gate* failed* notice* tabs* filters* list* detail* qualifier entries* bracket* standings* match* mine* out: back() nav.up() refresh() settings.open() view.select(view:s) filter.select(filter:s) page.select(offset:n) tournament.open(slug:s) match.open(matchId:s) register(teamName:s?) join.team(code:s) withdraw() member.remove(userId:s) session.take(sessionId:s) session.join() session.leave(sessionId:s) host: tournaments pv-screen pv-ui pv-plate page-head label-line push body bar cards card facts bracket-scroll bracket-col mark note pager countdown vars: - replaceable: - in: gate:page|offline-note|login view:list|detail|match|mine filter:all|registration|running|finished loading:b failure?{text:s} notice?{text:s} list{total:n page:n pages:n empty:b items[]{slug:s name:s format:s status:draft|registration|seeding|running|finished|cancelled statusText:s mode:s entries:n maxEntries?:n when:s winner?:s}} tournament?{slug:s name:s description?:s format:s status:draft|registration|seeding|running|finished|cancelled statusText:s mode:s metric:s bestOf:n entries:n maxEntries?:n registration:s starts:s entered:b canRegister:b canWithdraw:b entriesList[]{id:s seed?:s name:s status:s members[]{userId:s username:s captain:b self:b}} bracket[]{bracket:winners|losers|grand_final name:s matches[]{id:s round:s state:pending|ready|running|done|void bestOf:n sides[]{name:s score?:s winner:b seed?:s} when?:s referee?:s forfeit?:s}} standings[]?{rank:n name:s points:s maps[]{slot:s value:s} tiebreaks[]?{label:s value:s}} forfeitAfterMin:n pool[]{slot:s tag:s tiebreaker:b playbackRate:s map:s} qualifier?{rules:s phaseText:s attempts?:s sessions[]{id:s n:n when:s countdown:s seats:s state:scheduled|frozen|open|running|closed|cancelled stateText:s seat?{state:subscribed|played|no_show|withdrawn text:s} canTake:b canLeave:b playable:b joinable:b}}} game?{id:s round:s bestOf:n sides[]{name:s score?:s winner:b seed?:s} games[]{number:n map:s playbackRate:s pickedBy?:s winner?:n scores[]{side:n value:s}}} mine[]{slug:s name:s status:s entryStatus:registered|incomplete|disqualified|withdrawn entryText:s nextMatch?{id:s opponent:s when:s countdown:s} joinCode?:s qualifier?{attempts:s next?{session:s when:s countdown:s playable:b joinable:b}}} ## catalog.card (components['catalog.card']) face since:2 slots: permissions progress below out: install.ask() install.cancel(kind:skin|mod|playlist,id:s) parts: cover:img install:button cancel:button installed:img host: - in: state=available|update|installed|downloading|installing kind:skin|mod|playlist id:s name:s versionText:s byText:s size:s hash:s description?:s tags[]:s cover?:s shots[]{url:s alt:s} permissions[]:s badge?:s available{} update{from:s} installed{disabled:b} downloading{percent?:n} installing{} musts: install-button=part:install button focusable @available,update; install-click=emits:install click->install.ask() @available,update; install-enter=emits:install Enter->install.ask() @available,update; no-install-when-running=absent:install @installed,downloading,installing; cancel-button=part:cancel button focusable @downloading; cancel-click=emits:cancel click->install.cancel(kind,id) @downloading; installed-mark=part:installed img @installed ## download.card (components['download.card']) face since:2 slots: contents out: download.start() download.action(action:s) download.retry(jobId:n) settings.open(target:s) preview.open() pack.toggle(id:n) parts: toggle:button download:button retry:button lock:button installed:img queued:img progress:text reason:status preview:button host: - in: state=idle|locked|unavailable|queued|active|failed|installed shape:set|pack kind:osu|quaver|etterna|mod id:n title:s edge:s set?{artist:s creator?:s creatorText?:s cover:s badges[]:s keySummary:s difficulties[]{keysText:s keys:n rating?:s color:s title:s skills[]{badge:s color:s}} more:n bpm?:s plays?:s longNotes?:s extra?{tags[]:s size?:s details[]{label:s value:s}}} pack?{cover?:s nsfw:b songs:s size:s plays:s tags:s skills[]{key:s label:s value:s color:s main:b} open:b} progress?:n reason?{text:s detail?:s message?:s} startDisabled:b actions[]{id:s label:s} previewable:b idle{redownload:b} locked{lock:quaver|mod} unavailable{} queued{} active{phase:downloading|extracting percent?:n} failed{jobId:n} installed{} musts: download-button=part:download button focusable @idle; download-click=emits:download click->download.start() @idle; download-enter=emits:download Enter->download.start() @idle; no-download-when-running=absent:download @queued,active,failed,installed,locked,unavailable; retry-click=emits:retry click->download.retry(jobId) @failed; retry-enter=emits:retry Enter->download.retry(jobId) @failed; lock-button=part:lock button focusable @locked; installed-mark=part:installed img @installed; queued-mark=part:queued img @queued; progress-shown=shows:progress percent @active ## leaderboard.card (components['leaderboard.card']) face slots: tiers pauses out: replay.open(replayId:s)* replay.watch(replayId:n)* replay.retry(replayId:n) replay.share(replayId:s) ghost.pick(ghostId:s,chosen:b) play.report(scoreId:n,player:s) parts: open:button rank:text name:text rate:text mods:text combo:text misses:text accuracy:text performance:text date:time ghost:button share:button watch:button retry:button loading:img report:button host: - in: state=local|localGhost|online|onlineGhost|onlineLoading|onlineFailed|onlineStatic|own rank:n podium?:gold|silver|bronze player{name?:s label:s} badges{received:b mirror:b osuImport:b unranked:b} rate{value:n text:s} mods?:s pauses?:ref:@pvng/library:PauseCounts combo:n misses?:n tiers[]?{name:s color:s gradient[]?:s symbol?:ref:@pvng/desktop:JudgementSymbol count:n} accuracy{value:n text:s} performance?{text:s unavailable:b} nonstandard:b date{ms:n iso:s text:s} report?{scoreId:n player:s label:s} local{replayId:s} localGhost{replayId:s ghost{id:s chosen:b disabled?:b title:s}} online{replayId:n watchLabel:s} onlineGhost{replayId:n watchLabel:s ghost{id:s chosen:b disabled?:b title:s}} onlineLoading{replayId:n watchLabel:s ghost?{id:s chosen:b disabled?:b title:s}} onlineFailed{replayId:n watchLabel:s ghost?{id:s chosen:b disabled?:b title:s}} onlineStatic{} own{} musts: open-is-button=part:open button focusable @local,localGhost,online,onlineGhost,onlineLoading,onlineFailed; no-open-without-replay=absent:open @onlineStatic,own; open-local-click=emits:open click->replay.open(replayId) @local,localGhost; open-local-enter=emits:open Enter->replay.open(replayId) @local,localGhost; open-online-click=emits:open click->replay.watch(replayId) @online,onlineGhost,onlineLoading,onlineFailed; open-online-enter=emits:open Enter->replay.watch(replayId) @online,onlineGhost,onlineLoading,onlineFailed; rate-shown=shows:rate rate.text; name-shown=shows:name player.label; accuracy-shown=shows:accuracy accuracy.text; date-shown=shows:date date.text; no-misses-with-tiers=absent:misses @local,localGhost; ghost-toggle=part:ghost button focusable @localGhost,onlineGhost; ghost-click=emits:ghost click->ghost.pick(ghost.id,ghost.chosen) @localGhost,onlineGhost; ghost-enter=emits:ghost Enter->ghost.pick(ghost.id,ghost.chosen) @localGhost,onlineGhost; no-ghost-unoffered=absent:ghost @local,online,onlineStatic,own; share-click=emits:share click->replay.share(replayId) @local,localGhost; share-enter=emits:share Enter->replay.share(replayId) @local,localGhost; no-share-online=absent:share @online,onlineGhost,onlineLoading,onlineFailed,onlineStatic,own; watch-click=emits:watch click->replay.watch(replayId) @online,onlineGhost; watch-enter=emits:watch Enter->replay.watch(replayId) @online,onlineGhost; wait-while-loading=part:loading img @onlineLoading; no-watch-while-loading=absent:watch @onlineLoading,onlineFailed,onlineStatic,own,local,localGhost; retry-click=emits:retry click->replay.retry(replayId) @onlineFailed; retry-enter=emits:retry Enter->replay.retry(replayId) @onlineFailed; no-report-own-or-local=absent:report @local,localGhost,own ## library.chartRow (components['library.chartRow']) face since:2 slots: goal missing out: activate(position:n,difficulty:n,alreadySelected:b,dragDistance:n)* pickPlaylistMap(path:s,variant:n)* menu.open(x:n,y:n) parts: keys:text name:text rate:text similar:text rateOf:text pattern:text rating:text plays:text host: - in: state=normal|selected|playlist position:n difficulty:n path:s variant:n selected:b themed:b name:s keysText:s color:s missing?:audio|background|both noAudio:b noted:b goal?:open|reached rate?{text:s title:s} similar?{text:s title:s} rateOf?{label:s help:s} pattern?{short:s color:s names:s} rating:s ratingUnit:s stars[]{lit:b} plays?{text:s title:s} normal{} selected{} playlist{} musts: button=part:root button focusable; activate-click=emits:root click->activate(position,difficulty,selected,0±1) @normal,selected; activate-enter=emits:root Enter->activate(position,difficulty,selected,0±1) @normal,selected; pick-playlist-map=emits:root click->pickPlaylistMap(path,variant) @playlist; name=shows:name name; keys=shows:keys keysText; rating=shows:rating rating ## library.footer (components['library.footer']) slots: - out: rating.pick(value:s) judgement.pick(value:s) judgement.settings() confirm()* playlist.start(playlistId:n) marathon.start(playlistId:n) parts: rating:button judgement:button refusal:alert play:button unranked:none reason:none start:button marathon:button host: - in: state=mapReady|mapBlocked|mapRefused|mapNoPlay|playlistReady|playlistBlocked rating{value:s options[]{value:s label:s group:s detail:s}} judgement{value:s label:s ariaLabel:s options[]{value:s label:s group:s detail:s}} refusal?:s mapReady{play{label:s intent:play|train|pick-lobby-map} unrankedSlot:b unranked:b} mapBlocked{play{label:s intent:play|train|pick-lobby-map} unrankedSlot:b unranked:b reason{kind:lobby|loading|section|staircase|busy text:s}} mapRefused{play{label:s intent:play|train|pick-lobby-map} unrankedSlot:b unranked:b} mapNoPlay{} playlistReady{playlistId:n} playlistBlocked{playlistId:n reason{kind:empty|running text:s}} musts: rating-picker=part:rating button focusable; judgement-picker=part:judgement button focusable; rating-stays-on=enabled:rating; judgement-stays-on=enabled:judgement; play-is-a-button=part:play button focusable @mapReady; play-click=emits:play click->confirm() @mapReady; play-enter=emits:play Enter->confirm() @mapReady; play-label=shows:play play.label @mapReady,mapBlocked,mapRefused; play-off=disabled:play @mapBlocked,mapRefused; play-reason=shows:play reason.text @mapBlocked; play-refusal=shows:play refusal @mapRefused; refusal-alert=part:refusal alert @mapRefused; no-play-in-playlist=absent:play @mapNoPlay; marathon-is-a-button=part:marathon button focusable @playlistReady; marathon-click=emits:marathon click->marathon.start(playlistId) @playlistReady; playlist-start-click=emits:start click->playlist.start(playlistId) @playlistReady; playlist-off=disabled:marathon @playlistBlocked; playlist-start-off=disabled:start @playlistBlocked; playlist-reason=shows:marathon reason.text @playlistBlocked; playlist-start-reason=shows:start reason.text @playlistBlocked ## library.search (components['library.search']) slots: filterWindow out: query.set(text:s) query.commit(text:s) sort.set(key:s) sort.toggleDirection() group.set(key:s) group.collapseAll() group.expandAll() reshuffle() filter.edit(key:s) filter.remove(key:s) history.restore(id:s) history.pin(id:s) history.remove(id:s) history.clear() history.pause() history.resume() duplicates.review() duplicates.reveal() parts: bar:none field:combobox clear:button history:region sort:button direction:button group:button filters:group status:status syntax:status error:alert host: library-search search-bar filter-chips bar-menu pv-plate in: state=ready|filtered|blocked|invalid mode:maps|playlists query:s sort{value:s label:s options[]{value:s label:s group:s} descending:b active:b caption:s directionLabel:s} group?{value:s label:s options[]{value:s label:s group:s} grouped:b allFolded:b canFoldAll:b caption:s} filters[]{key:s label:s value:s tip:s removeLabel:s unavailable:b} fieldKeys[]:s history?{enabled:b entries[]{id:s query:s label:s pinned:b}} reviewing:b syntax{pending?:s unrecognised?:s} ready{} filtered{} blocked{status:s error?:s} invalid{error:s} musts: field=part:field combobox focusable; sort=part:sort button focusable; direction=emits:direction click->sort.toggleDirection(); filters-listed=part:filters group @filtered,blocked; filters-absent=absent:filters @ready; status-shown=shows:status status @blocked; error-alert=part:error alert @invalid; error-shown=shows:error error @invalid ## library.setCard (components['library.setCard']) face slots: goal missing out: toggle(position:n)* selectPlaylist(playlistId:n)* filter.name(key:host/artist|host/creator,name:s) menu.open(x:n,y:n) more.show(id:s,x:n,y:n,by:pointer|focus) more.hide() parts: art:presentation title:text artist:text meta:text creator:text keys:text rating:text strip:presentation more:img host: - in: state=collapsed|selected|expanded|playlist|loading collapsed{position:n id:s selected:b expanded:b themed:b title:s artist:s creator?{name:s text:s} color:s thumbnail:s mosaic[]?:s similar?{text:s title:s} newText?:s countText:s missing?:audio|background|both noted:b plays?{text:s title:s} keysText:s goal?:open|reached advice?{kind:comfort|push|stretch text:s} rating{text:s range:s unit:s} strip{tier:dot|rating|full|pattern chipWidth:n gap:n maxWidth:n minWidth:n chips[]{key:n color:s keysText:s short:s pattern?{short:s color:s}} more?{count:n label:s}}} selected{position:n id:s selected:b expanded:b themed:b title:s artist:s creator?{name:s text:s} color:s thumbnail:s mosaic[]?:s similar?{text:s title:s} newText?:s countText:s missing?:audio|background|both noted:b plays?{text:s title:s} keysText:s goal?:open|reached advice?{kind:comfort|push|stretch text:s} rating{text:s range:s unit:s} strip{tier:dot|rating|full|pattern chipWidth:n gap:n maxWidth:n minWidth:n chips[]{key:n color:s keysText:s short:s pattern?{short:s color:s}} more?{count:n label:s}}} expanded{position:n id:s selected:b expanded:b themed:b title:s artist:s creator?{name:s text:s} color:s thumbnail:s mosaic[]?:s similar?{text:s title:s} newText?:s countText:s missing?:audio|background|both noted:b plays?{text:s title:s} keysText:s goal?:open|reached advice?{kind:comfort|push|stretch text:s} rating{text:s range:s unit:s} strip{tier:dot|rating|full|pattern chipWidth:n gap:n maxWidth:n minWidth:n chips[]{key:n color:s keysText:s short:s pattern?{short:s color:s}} more?{count:n label:s}}} playlist{position:n id:s selected:b expanded:b themed:b title:s artist:s creator?{name:s text:s} color:s thumbnail:s mosaic[]?:s similar?{text:s title:s} newText?:s countText:s missing?:audio|background|both noted:b plays?{text:s title:s} keysText:s goal?:open|reached advice?{kind:comfort|push|stretch text:s} rating{text:s range:s unit:s} strip{tier:dot|rating|full|pattern chipWidth:n gap:n maxWidth:n minWidth:n chips[]{key:n color:s keysText:s short:s pattern?{short:s color:s}} more?{count:n label:s}} playlistId:n} loading{} musts: button=part:root button focusable @collapsed,selected,expanded,playlist; toggle-click=emits:root click->toggle(position) @collapsed,selected,expanded; toggle-enter=emits:root Enter->toggle(position) @collapsed,selected,expanded; select-playlist=emits:root click->selectPlaylist(playlistId) @playlist; select-playlist-enter=emits:root Enter->selectPlaylist(playlistId) @playlist; title=shows:title title @collapsed,selected,expanded,playlist; artist=shows:artist artist @collapsed,selected,expanded,playlist; count=shows:meta countText @collapsed,selected,expanded,playlist; keys=shows:keys keysText @collapsed,selected,expanded,playlist; rating=shows:rating rating.range @collapsed,selected,expanded,playlist; loading-empty=absent:title @loading; loading-no-badge=absent:more @loading ## library.toolbar (components['library.toolbar']) slots: online out: view.set(view:maps|playlists|mapsToPlay)* random() demo() visualize() multiplayer() menu.open(x:n,y:n) menu.run(id:s) parts: views:radiogroup playlists:radio mapsToPlay:radio random:button menu:button action:button multiplayer:button visualize:button host: library-toolbar bar bar-side online viz viz-label tb-label active in: state=maps|mapsBusy|mapsEmpty|playlists|mapsToPlay views[]{value:maps|playlists|mapsToPlay label:s count:n countText:s exact?:s disabled:b} visualizer{open:b available:b label:s iconOnly:b} menu[]{id:s label:s unavailable?:s} menuOpen:b maps{} mapsBusy{} mapsEmpty{locked:b} playlists{} mapsToPlay{} musts: playlists-click=emits:playlists click->view.set("playlists") @maps,mapsEmpty; maps-to-play-click=emits:mapsToPlay click->view.set("mapsToPlay") @maps; random-click=emits:random click->random() @maps; random-off=disabled:random @mapsBusy,mapsEmpty; no-random-in-playlists=absent:random @playlists,mapsToPlay; multiplayer-is-a-button=part:multiplayer button focusable; multiplayer-click=emits:multiplayer click->multiplayer(); visualize=part:visualize button ## lobby.draft (components['lobby.draft']) slots: - out: start(bestOf:n,bansPerSide:n,first:a|b,pickRule:alternate|loser_picks,turnSecs:n) ban(slot:s) pick(slot:s) forfeit(side:a|b) abort() pool.add() pool.remove(slot:s) parts: heading:heading denial:status problem:status start:button poolAdd:button poolRemove:button pool:list map:listitem ban:button pick:button turn:status score:status forfeit:button abort:button host: - in: state=setup|banning|picking|playing|finished host:b denial?:not_in_lobby|not_host|not_captain|not_your_turn|wrong_phase|bad_config|bad_sides|unknown_map|map_taken|map_reserved|not_members|started|draft_active|no_draft|feature_unavailable|unknown setup{poolLimit:n pool[]{slot:s title:s artist:s art?:s difficulty?:s rateText:s noteHash:s playbackRate:n judgement:s} candidate?{title:s artist:s rateText:s inPool:b} sides?{a[]:s b[]:s}} banning{series{bestOf:n a:n b:n} sides{a{captain?:s members[]:s mine:b} b{captain?:s members[]:s mine:b}} bansPerSide:n pickRule:alternate|loser_picks|unknown maps[]{slot:s title:s artist:s art?:s difficulty?:s rateText:s status:open|banned|picked|played by?:a|b winner?:a|b game?:n auto:b current:b tiebreaker:b} turn?{side:a|b kind:ban|pick mine:b secondsLeft?:n}} picking{series{bestOf:n a:n b:n} sides{a{captain?:s members[]:s mine:b} b{captain?:s members[]:s mine:b}} bansPerSide:n pickRule:alternate|loser_picks|unknown maps[]{slot:s title:s artist:s art?:s difficulty?:s rateText:s status:open|banned|picked|played by?:a|b winner?:a|b game?:n auto:b current:b tiebreaker:b} turn?{side:a|b kind:ban|pick mine:b secondsLeft?:n}} playing{series{bestOf:n a:n b:n} sides{a{captain?:s members[]:s mine:b} b{captain?:s members[]:s mine:b}} bansPerSide:n pickRule:alternate|loser_picks|unknown maps[]{slot:s title:s artist:s art?:s difficulty?:s rateText:s status:open|banned|picked|played by?:a|b winner?:a|b game?:n auto:b current:b tiebreaker:b} turn?{side:a|b kind:ban|pick mine:b secondsLeft?:n} game{number:n slot:s title:s}} finished{series{bestOf:n a:n b:n} sides{a{captain?:s members[]:s mine:b} b{captain?:s members[]:s mine:b}} bansPerSide:n pickRule:alternate|loser_picks|unknown maps[]{slot:s title:s artist:s art?:s difficulty?:s rateText:s status:open|banned|picked|played by?:a|b winner?:a|b game?:n auto:b current:b tiebreaker:b} turn?{side:a|b kind:ban|pick mine:b secondsLeft?:n} winner?:a|b reason:won|forfeit|aborted|unknown} musts: heading=part:heading heading; setup-start=part:start button focusable @setup; setup-start-click=emits:start click->start(3,1,"a","alternate",60) @setup; pool-add-click=emits:poolAdd click->pool.add() @setup; pool-remove-click=emits:poolRemove click->pool.remove("M1") @setup; problem=part:problem status @setup; ban-click=emits:ban click->ban("M2") @banning; pick-click=emits:pick click->pick("M3") @picking; turn=part:turn status @banning,picking; score=part:score status @playing,finished; forfeit-click=emits:forfeit click->forfeit("a") @banning,picking,playing; abort-click=emits:abort click->abort() @banning,picking,playing; no-times-sign=excludes:pool "×" @banning,picking,playing,finished; no-check-mark=excludes:pool "✓" @banning,picking,playing,finished; denial=part:denial status @setup,banning,picking,playing,finished ## maps.toPlay (components['maps.toPlay']) slots: - out: goTo(index:n,title:s,rate:n)* filter.keys(keys:n) filter.pattern(pattern:s) retry() parts: heading:heading keys:group key:button patterns:group pattern:button list:list entry:listitem goTo:button message:status retry:button host: - in: state=loading|ready|notEnough|noLevel|empty|unavailable|retry keys?:n keyOptions[]{value:n label:s active:b} pattern:s patterns[]{id:s label:s color?:s plays:n levelText?:s listed:b active:b} ratingName:s loading{} ready{entries[]{id:s index:n title:s artist:s difficulty:s keys:n pattern:s patternColor?:s kind:comfort|push|stretch rate:n rateText:s ratingText:s ratingAtRateText:s expectedText:s bandText:s current:b}} notEnough{have:n need:n} noLevel{} empty{} unavailable{reason:judgement|noRating} retry{reason:busy|failed} musts: heading=part:heading heading; keys=part:keys group @ready,notEnough,noLevel,empty; key-click=emits:key click->filter.keys(4) @ready,notEnough,noLevel,empty; patterns=part:patterns group @ready,notEnough,noLevel,empty; strongest-click=emits:pattern click->filter.pattern("") @ready,notEnough,noLevel,empty; list=part:list list @ready; go-to-reachable=part:goTo button focusable @ready; go-to-click=emits:goTo click->goTo(12,"Strong 280",1.15) @ready; go-to-enter=emits:goTo Enter->goTo(12,"Strong 280",1.15) @ready; no-times-sign=excludes:list "×" @ready; message=part:message status @loading,notEnough,noLevel,empty,unavailable,retry; no-list-without-numbers=absent:goTo @loading,notEnough,noLevel,empty,unavailable,retry; retry-click=emits:retry click->retry() @retry ## player.card (components['player.card']) face since:2 slots: avatar playerName clan friend flag title rank marks status tiers out: replay.watch(userId:s) parts: avatar:img name:text rank:text status:text ready:status accuracy:text watch:button host: - in: state=lobby|round|user userId:s name:s initial:s channel:s self:b index:n tone:n place:n picture:b host:b spectator:b waiting:b hasMap?:b rank?{value:n text:s top:b label:s tip:s} country?:s title?{name:s style?:s colour?:s} clan?{tag:s name:s} friend?{mutual:b} watchable:b side?:a|b strip:b lobby{ready:b last?{accuracy:s detail:s tiers[]?{name:s color:s gradient[]?:s symbol?:ref:@pvng/desktop:JudgementSymbol count:n}}} round{standing?{kind:result|live figures{accuracy:s detail:s tiers[]?{name:s color:s gradient[]?:s symbol?:ref:@pvng/desktop:JudgementSymbol count:n}}} note:noScore|waiting|spectating|none} user{status:online|inLobby|playing statusText:s} musts: name-shown=shows:name name; status-shown=shows:status statusText @user ## rate.control (components['rate.control']) slots: aside out: set(value:n)* parts: heading:heading value:spinbutton decrease:button increase:button slider:slider reset:button mark:button host: - in: state=ready|atDefault|atMin|atMax value:n text:s min:n max:n minText:s maxText:s step:n typed:n steps{down:n up:n} ready{} atDefault{} atMin{} atMax{} musts: value-field=part:value spinbutton focusable; value-shows-rate=shows:value text; no-times-sign=excludes:root "×"; enter-commits=emits:value Enter->set(value); arrow-up=emits:value ArrowUp->set(steps.up); arrow-down=emits:value ArrowDown->set(steps.down); slider=part:slider slider focusable; increase-asks-step=emits:increase click->set(steps.up) @ready,atDefault,atMin; decrease-asks-step=emits:decrease click->set(steps.down) @ready,atDefault,atMax; no-decrease-at-min=disabled:decrease @atMin; no-increase-at-max=disabled:increase @atMax; reset-to-one=emits:reset click->set(1) @ready,atMin,atMax; no-reset-at-default=disabled:reset @atDefault ## selected.header (components['selected.header']) slots: - out: name.filter(key:host/artist|host/creator,name:s) rateCopy.go(index:n,title:s) folders.add()* parts: heading:none title:heading artist:text difficulty:text rating:group stats:none rateCopy:button rateStatus:status addFolders:button host: song-heading pv-plate pv-plate--lg pv-plate--sm pv-stat artist difficulty-name name-filter rate-copy main-rating rating-value favourite-mark map-metrics map-stat rate-status no-selection in: state=map|rateCopy|playlist|pick|empty|emptyBusy color:s map{artist:s title:s difficulty:s keysText:s creator?:s favourite:b missing?{kind:audio|background|both chart:s} rating{value?:n unit:s label:s title:s} stats[]{label:s text:s numbers[]:n clock:b icon:clock|activity|music|rectangle-vertical|library|zap} rateStatus{error?:s unavailable?:s previous?:s}} rateCopy{artist:s title:s difficulty:s keysText:s creator?:s favourite:b missing?{kind:audio|background|both chart:s} rateCopy{label:s help:s baseIndex:n baseTitle:s} rating{value?:n unit:s label:s title:s} stats[]{label:s text:s numbers[]:n clock:b icon:clock|activity|music|rectangle-vertical|library|zap} rateStatus{error?:s unavailable?:s previous?:s}} playlist{name:s countText:s creator?:s missingText?:s rating{value?:n unit:s label:s title:s} stats[]{label:s text:s numbers[]:n clock:b icon:clock|activity|music|rectangle-vertical|library|zap}} pick{} empty{} emptyBusy{} musts: title=part:title heading; title-shows=shows:title title @map,rateCopy; playlist-name=shows:title name @playlist; rating-named=part:rating group @map,rateCopy,playlist; rating-label=shows:rating rating.label @map,rateCopy,playlist; rate-status=part:rateStatus status @map,rateCopy,playlist; rate-copy-reachable=part:rateCopy button focusable @rateCopy; rate-copy-click=emits:rateCopy click->rateCopy.go(rateCopy.baseIndex,rateCopy.baseTitle) @rateCopy; add-folders-off=disabled:addFolders @emptyBusy; add-folders=part:addFolders button focusable @empty; add-folders-click=emits:addFolders click->folders.add() @empty; add-folders-enter=emits:addFolders Enter->folders.add() @empty ## selected.tabs (components['selected.tabs']) slots: actions out: select(id:s)* playlist.select(id:s) parts: tablist:tablist tab:tab actions:none more:button moreLabel:none host: chart-bar in: state=chart|playlist active:s vertical:b tabs[]{id:s label:s icon:s dirty:b controls:s} chart{} playlist{} musts: tablist=part:tablist tablist; tab=part:tab tab focusable; tab-click=emits:tab click->select("info") @chart; playlist-tab-click=emits:tab click->playlist.select("info") @playlist ``` ## Nodes The node kinds and their attributes. ```text # theme.ts: defineTheme({ screens: { : (c) => node }, components: { '': (c) => node } }); c = ThemeContext<'screen.' | ''>. Builders below are members of c (and untyped globals). # attrs of a node = {common + layout/container/own}; children = ThemeChild[] (node | null | undefined | false | list). # Part, HostClass, CssVar, Slot, Contract = the names of the screen or component being templated (see the contracts). S = the scope of its input paths. Opaque: ThemeValue (bind, t, fmt), ThemeCond (field(...).cmp), ThemeEvent (on.press|change|pick), ThemeNode. type type ThemeText = string | number | boolean | ThemeValue | readonly ThemeText[] type type ThemeChild = ThemeNode | null | undefined | false | readonly ThemeChild[] type type ThemeArg = T | ThemeValue type type ThemeStep = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" box(...children: ThemeChild[]): ThemeNode box(attrs: ThemeContainerAttrs, ...children: ThemeChild[]): ThemeNode row(...children: ThemeChild[]): ThemeNode row(attrs: ThemeContainerAttrs, ...children: ThemeChild[]): ThemeNode column(...children: ThemeChild[]): ThemeNode column(attrs: ThemeContainerAttrs, ...children: ThemeChild[]): ThemeNode stack(...children: ThemeChild[]): ThemeNode stack(attrs: ThemeContainerAttrs, ...children: ThemeChild[]): ThemeNode grid(...children: ThemeChild[]): ThemeNode grid(attrs: ThemeLayout & { columns?: readonly string[]; rows?: readonly string[] }, ...children: ThemeChild[]): ThemeNode scroll(...children: ThemeChild[]): ThemeNode scroll(attrs: ThemeLayout & { axis?: "y" | "x" | "both" }, ...children: ThemeChild[]): ThemeNode spacer(attrs?: ThemeAttrs & { size?: ThemeStep }): ThemeNode text(value: ThemeText, attrs?: ThemeAttrs & { as?: ThemeTextTag; tween?: boolean; letters?: boolean; scramble?: boolean }): ThemeNode icon(name: ThemeIcon | ThemeValue, attrs?: ThemeAttrs & { size?: number }): ThemeNode image(src: string | ThemeValue, attrs: ThemeAttrs & { alt: ThemeText; fit?: "cover" | "contain" }): ThemeNode button(attrs: ThemeAttrs & { variant?: "primary" | "plain" | "quiet"; label?: ThemeText; disabled?: ThemeCond; pressed?: ThemeCond; describedBy?: Part; on: ThemeEvent<"press"> }, ...children: ThemeChild[]): ThemeNode toggle(attrs: ThemeAttrs & { label: ThemeText; checked: ThemeCond; on: ThemeEvent<"change"> }): ThemeNode meter(attrs: ThemeAttrs & { value: ThemeText; min?: number; max?: number; label: ThemeText }): ThemeNode dropdown(attrs: ThemeAttrs & { label: ThemeText; ariaLabel?: ThemeText; value: ThemeText; options: keyof S["paths"] & string | keyof S["lists"] & string; displayValue?: ThemeText; on: ThemeEvent<"pick"> }): ThemeNode slot(name: Slot): ThemeNode slot(contract: Contract, options: { from: ThemeFrom }): ThemeNode each(of: L, build: (item: ThemeBuilders) => ThemeNode | readonly ThemeNode[], options?: { as?: string; key?: keyof S["lists"][L]["paths"] & string }): ThemeNode when(test: ThemeCond, then: ThemeNode | readonly ThemeNode[], otherwise?: ThemeNode | readonly ThemeNode[]): ThemeNode interface ThemeAttrs: class?: HostClass | string | readonly (HostClass | string)[]; classWhen?: { readonly [name: string]: ThemeCond } | readonly { class: string; if: ThemeCond }[]; part?: Part; role?: ThemeRole; aria?: { busy?: ThemeText; live?: "polite" | "assertive" | "off"; label?: ThemeText; pressed?: ThemeText; expanded?: ThemeText; current?: ThemeText; describedby?: ThemeText }; hidden?: ThemeCond; inert?: ThemeCond; data?: { readonly [name: string]: ThemeText }; vars?: { readonly [K in CssVar | `--tpl-${string}`]?: ThemeText } interface ThemeLayout: gap?: ThemeStep; pad?: ThemeStep; align?: "start" | "center" | "end" | "stretch" | "baseline"; justify?: "start" | "center" | "end" | "between" | "around" | "evenly"; wrap?: boolean; grow?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; focusable?: boolean (extends ThemeAttrs) interface ThemeContainerAttrs: as?: ThemeContainerTag (extends ThemeLayout) grid attrs += { columns?: readonly string[]; rows?: readonly string[] } scroll attrs += { axis?: "y" | "x" | "both" } spacer attrs += { size?: ThemeStep } text attrs += { as?: ThemeTextTag; tween?: boolean; letters?: boolean; scramble?: boolean } icon attrs += { size?: number } image attrs += { alt: ThemeText; fit?: "cover" | "contain" } button attrs += { variant?: "primary" | "plain" | "quiet"; label?: ThemeText; disabled?: ThemeCond; pressed?: ThemeCond; describedBy?: Part; on: ThemeEvent<"press"> } toggle attrs += { label: ThemeText; checked: ThemeCond; on: ThemeEvent<"change"> } meter attrs += { value: ThemeText; min?: number; max?: number; label: ThemeText } dropdown attrs += { label: ThemeText; ariaLabel?: ThemeText; value: ThemeText; options: keyof S["paths"] & string | keyof S["lists"] & string; displayValue?: ThemeText; on: ThemeEvent<"pick"> } context (c): bind

>(path: P): ThemeValue field

(path: P): ThemeFieldOf t(key: string, args?: { readonly [name: string]: ThemeText }): ThemeValue on: ThemeOn fmt: ThemeFmt on.press(output: O, ...args: ThemeArgs): ThemeEvent<"press"> on.change(output: O, ...args: ThemeArgs>): ThemeEvent<"change"> on.pick(output: O, ...args: ThemeArgs>): ThemeEvent<"pick"> fmt.rate(path: ThemeNumeric, digits?: 0 | 1 | 2 | 3 | 4 | 5 | 6): ThemeValue fmt.count(path: ThemeNumeric, digits?: 0 | 1 | 2 | 3 | 4 | 5 | 6): ThemeValue fmt.percent(path: ThemeNumeric, digits?: 0 | 1 | 2 | 3 | 4 | 5 | 6): ThemeValue fmt.duration(path: ThemeNumeric, digits?: 0 | 1 | 2 | 3 | 4 | 5 | 6): ThemeValue fmt.fixed(path: ThemeNumeric, digits?: 0 | 1 | 2 | 3 | 4 | 5 | 6): ThemeValue field(path).truthy(): ThemeCond field(path).falsy(): ThemeCond field(path).eq(value: T): ThemeCond field(path).ne(value: T): ThemeCond field(path).in(values: readonly T[]): ThemeCond field(path).gt(value: number): ThemeCond field(path).ge(value: number): ThemeCond field(path).lt(value: number): ThemeCond field(path).le(value: number): ThemeCond cond.and(...others: ThemeCond[]): ThemeCond cond.or(...others: ThemeCond[]): ThemeCond cond.not(): ThemeCond role: group|region|toolbar|tablist|tabpanel|status|search|list|listitem|navigation|none|presentation|img gap|pad|size: 0|1|2|3|4|5|6|7|8|9|10 (--pv-s) as (containers): div|section|header|footer|nav|aside|main|article|ul|li as (text): span|p|h1|h2|h3|strong|em|label|small icon: any lucide name (lucide.dev/icons), e.g. a-arrow-down|a-arrow-up|a-large-small|accessibility|activity|air-vent data-* names refused: part contract state direction gap align justify wrap grow pad size axis variant kind slot limits: depth<=24; nodes<=1500/theme; templates<=64; text<=200 chars; children<=64; classes<=8; data+vars entries<=8; grid tracks<=12 script: <=500ms, 16 MiB heap, source<=128 KiB, <=4000 nodes built, JSON<=1 MiB; runs once; no function, NaN or cycle in the result ``` ## CSS allow-list The selectors, at-rules, properties and value forms `theme.css` accepts. - **Limits**: file <= 256 KiB; <= 2048 rules (style rules + keyframe steps); <= 40 declarations per rule; <= 200 words/numbers per value; functions nest <= 5; strings <= 80 chars (no `\`); class, keyframes name <= 40 chars (a-z 0-9 -, start with a letter); data-name <= 24, data value <= 40; no `!important`, no nesting, comments allowed. - **Selectors**: `.class` first (compound `.a.b`), `[data-x]`, `[data-x="v"]`; `:hover` `:focus-visible` `:focus-within` `:active` `:disabled` `:first-child` `:last-child`; `:not(.a)` `:is(.a)` `:where(.a)` (classes only, not nested); `::before` `::after` (once, last, with `content`); combinators: descendant, `>`; comma lists. Refused: elements, `*`, `#id`, `+`, `~`, `&`. - **At-rules**: `@keyframes` `@media` only. `@media (: )` <= 2 joined by `and`; features `max-width` `min-width` `max-height` `min-height` `prefers-reduced-motion` (px 1..10000; reduced-motion reduce|no-preference); style rules only inside. `@keyframes name` steps `from`|`to`|`n%`, <= 24; every animation name must be defined in the file. - **Values**: length px|em|rem|vw|vh|vmin|vmax|ch or 0 (|n| <= 10000); % (<= 10000); number (<= 100000); angle deg|turn|rad (<= 3600); time s|ms (<= 60000); fr (<= 1000); "string"; colour #rgb|#rgba|#rrggbb|#rrggbbaa; `url("images/")` of a picture the theme has; plain words are accepted unless the property is a closed list; `var(--x[, fallback])` anywhere. - **Properties** (any other property is refused; `*` = every property with that prefix): length: letter-spacing word-spacing; length+color: box-shadow text-shadow; length+number+color: outline, outline-*; length+percentage: background-* bottom column-gap flex-basis gap height inset left margin, margin-* mask-position mask-size max-height max-width min-height min-width object-position padding, padding-* right row-gap top transform-origin width; length+percentage+number: flex font-* line-height; length+percentage+number+color: border, border-* (except border-image*) text-*; length+percentage+number+color+angle+url+gradient: background; length+percentage+number+fraction+string+grid: grid, grid-*; length+percentage+number+string: font; percentage+number: opacity; number: aspect-ratio flex-grow flex-shrink order; number+time+easing: animation-* transition, transition-*; color: background-color color; string: content font-family; url+gradient: background-image mask-image; transform: transform; filter+backdrop: filter; backdrop: backdrop-filter; shape: clip-path; words: align-* flex-direction flex-flow flex-wrap justify-* overflow-wrap place-* white-space word-break. - **Closed words**: cursor: auto|default|pointer|text|move|not-allowed|grab|grabbing|wait|help|crosshair|progress|zoom-in|zoom-out|none; display: flex|grid|block|none|inline-flex|inline-block|inline|inline-grid|contents; mask-repeat: repeat|no-repeat|repeat-x|repeat-y|round|space; mix-blend-mode: normal|multiply|screen|overlay|darken|lighten|color-dodge|color-burn|hard-light|soft-light|difference|exclusion|hue|saturation|color|luminosity|plus-lighter; object-fit: fill|contain|cover|none|scale-down; overflow: visible|hidden|auto|scroll|clip; overflow-x: visible|hidden|auto|scroll|clip; overflow-y: visible|hidden|auto|scroll|clip; pointer-events: auto|none; position: static|relative|absolute|sticky; visibility: visible|hidden|collapse; writing-mode: horizontal-tb|vertical-rl|vertical-lr|sideways-rl|sideways-lr; z-index: integer -50..50|auto; content: string (no attr(), counters). - **Functions**: backdrop: blur saturate; color: rgb rgba hsl hsla hwb color-mix; easing: cubic-bezier steps; filter: blur brightness contrast drop-shadow grayscale hue-rotate saturate sepia; gradient: linear-gradient repeating-linear-gradient radial-gradient repeating-radial-gradient conic-gradient repeating-conic-gradient; grid: repeat minmax fit-content; math: calc min max clamp var; shape: polygon inset; transform: translate translatex translatey translatez translate3d scale scalex scaley scale3d rotate rotatex rotatey rotatez skew skewx skewy. - **Variables**: `--tpl-` (<= 32 chars, any value); design tokens of kind case|clip|color|duration|easing|filter|font|length|opacity|ratio|shadow|weight (subtree only; the other kinds and --pv-art-filter stay in tokens.css); plate variables --plate --edge --clip --clip-edge. Class names become `.tpl--name` and every rule is scoped under `[data-direction=""]`.