@kitlangton/knobs 0.4.0-next.0 → 0.4.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +351 -43
  2. package/dist/dev/{chunk-stbcgz1y.js → chunk-1qzffbpa.js} +443 -451
  3. package/dist/dev/{chunk-7xgkerd2.js → chunk-3ygqgy1x.js} +23 -1
  4. package/dist/dev/{chunk-pmkvb9ep.js → chunk-8mabjeyk.js} +1920 -507
  5. package/dist/dev/{chunk-t68smqkc.js → chunk-ayb292zj.js} +13 -11
  6. package/dist/dev/index.js +10 -5
  7. package/dist/index.js +25 -1
  8. package/dist/panel.js +2900 -1320
  9. package/dist/react.js +294 -6
  10. package/dist/solid.js +292 -4
  11. package/dist/themes.js +1509 -7
  12. package/dist/types/core/adapter.d.ts +6 -2
  13. package/dist/types/core/appearance.d.ts +44 -0
  14. package/dist/types/core/glide.d.ts +7 -0
  15. package/dist/types/core/motion.d.ts +66 -0
  16. package/dist/types/core/root.d.ts +13 -0
  17. package/dist/types/core/store.d.ts +18 -5
  18. package/dist/types/core/theme.d.ts +10 -3
  19. package/dist/types/index.d.ts +2 -1
  20. package/dist/types/panel/gpu/color.d.ts +6 -0
  21. package/dist/types/panel/motion.d.ts +1 -1
  22. package/dist/types/panel/styles.d.ts +2 -3
  23. package/dist/types/themes/define.d.ts +104 -0
  24. package/dist/types/themes/index.d.ts +11 -0
  25. package/dist/types/themes/knobs.d.ts +5 -0
  26. package/dist/types/themes/void.d.ts +8 -0
  27. package/dist/types/tokens/color.d.ts +42 -0
  28. package/dist/types/tokens/css.d.ts +13 -0
  29. package/dist/types/tokens/evaluate.d.ts +8 -0
  30. package/dist/types/tokens/index.d.ts +4 -0
  31. package/dist/types/tokens/schema.d.ts +1100 -0
  32. package/dist/types/ui/bento-css.d.ts +1 -1
  33. package/dist/types/ui/compare-css.d.ts +1 -1
  34. package/dist/types/ui/index.d.ts +3 -3
  35. package/dist/types/ui/look.d.ts +18 -13
  36. package/dist/types/ui/overlay-css.d.ts +1 -1
  37. package/dist/types/ui/readout-css.d.ts +1 -1
  38. package/dist/types/ui/readout-model.d.ts +5 -1
  39. package/dist/types/ui/rgba.d.ts +11 -0
  40. package/dist/types/ui/walkthrough-blocks.d.ts +43 -0
  41. package/dist/types/ui/walkthrough-media.d.ts +4 -0
  42. package/dist/types/ui/walkthrough-model.d.ts +237 -3
  43. package/dist/types/ui/walkthrough.d.ts +3 -1
  44. package/dist/ui-react.js +3193 -791
  45. package/dist/ui-solid.js +3193 -791
  46. package/dist/ui.js +3340 -935
  47. package/package.json +1 -1
package/README.md CHANGED
@@ -49,7 +49,7 @@ const detach = splat.attach(document.querySelector<HTMLElement>("#splat")!)
49
49
 
50
50
  // Or mount an inline panel inside a container:
51
51
  const unmount = splat.mount(document.querySelector<HTMLElement>("#sidebar")!, {
52
- theme: "auto",
52
+ appearance: "system",
53
53
  density: "compact",
54
54
  })
55
55
 
@@ -856,7 +856,7 @@ A panel inside an app should look like the app's own controls. Four things get i
856
856
  | `--k-shadow-strength` | `.48` (light: `.16`) | How dark the WebGPU renderer draws the panel's drop shadow. Set it beside `--k-shadow` when you change that, so both renderers match (a host blending a dark look into a light one moves both together) |
857
857
  | `--k-frame` | `card` | `flat`: no card inside the host's own card (see below) |
858
858
  | `--k-disabled-opacity` | `.32` | How far a disabled row dims |
859
- | `--k-warn`, `--k-critical` | `#ff9f0a`, `#ff453a` (light: `#c56a00`, `#e0352b`) | Readouts' warning and critical colours (meters past `warn` / `critical`, log levels), and a destructive confirm |
859
+ | `--k-warn`, `--k-critical` | unset; knobs/ui falls back to `#ff9f0a`, `#ff453a` (light: `#c56a00`, `#e0352b`) | Readouts' warning and critical colours (meters past `warn` / `critical`, log levels), and a destructive confirm. Only knobs/ui pieces read them |
860
860
  | `--k-control-h` | row − 2 × unit | Height of the controls inside a row: segments, menus, switches, number cells, key caps, toolbar buttons |
861
861
  | `--k-value-size` | font size − `.5px` | Size of every readout (sliders, cells, ranges, dials, seeds, editor summaries) |
862
862
  | `--k-button-bg`, `--k-button-line`, `--k-button-hover-bg`, `--k-button-hover-line` | each button's own | Fill and outline of custom actions, Export/Import, toolbar buttons, action rows and preset chips, at rest and hovered. With a fill or outline set, an action row is a sized button in its row and the presets strip a row of buttons (`data-buttons` on the panel) |
@@ -1049,14 +1049,14 @@ Both renderers draw the page. With `?gpu`, the overlay draws the header's conten
1049
1049
 
1050
1050
  ## Workspaces (`knobs/ui`)
1051
1051
 
1052
- `knobs/ui` has the pieces a tool's workspace is built from: resizable split panes and docks, and an outliner tree. They are plain DOM and framework-neutral, use the same tokens as panels (`--k-*`, `--k-control-h`, a `preset` such as `labPreset`), and work on their own or next to panels. A panel can mount inside a pane.
1052
+ `knobs/ui` has the pieces a tool's workspace is built from: resizable split panes and docks, and an outliner tree. They are plain DOM and framework-neutral, use the same tokens as panels (`--k-*`, and a `theme` and `appearance`, as panels take), and work on their own or next to panels. A panel can mount inside a pane.
1053
1053
 
1054
1054
  ```ts
1055
- import { labPreset } from "knobs/themes"
1055
+ import { themes } from "knobs/themes"
1056
1056
  import { applyMove, split, tree } from "knobs/ui"
1057
1057
  import { mountPanel } from "knobs/panel"
1058
1058
 
1059
- const look = { preset: labPreset, theme: "dark" as const }
1059
+ const look = { theme: themes.void, appearance: "dark" as const }
1060
1060
  const main = split(workspace, {
1061
1061
  ...look,
1062
1062
  id: "workspace", // saves sizes and collapsed panes
@@ -1133,12 +1133,12 @@ import { Split, Tree } from "knobs/ui/react" // or "knobs/ui/solid"
1133
1133
 
1134
1134
  ### Overlays: popovers, tooltips, the command palette, confirms and toasts
1135
1135
 
1136
- `knobs/ui` also has the floating layers a workspace needs. They sit in one fixed layer above the page and the GPU overlay, come in on a spring (scale and blur from where they open, interruptible both ways; opacity only under reduced motion), and use the same tokens. `overlayLook({ preset, theme })` sets the look they all take; each also takes its own `look`.
1136
+ `knobs/ui` also has the floating layers a workspace needs. They sit in one fixed layer above the page and the GPU overlay, come in on a spring (scale and blur from where they open, interruptible both ways; opacity only under reduced motion), and use the same tokens. `overlayLook({ theme, appearance })` sets the look they all take; each also takes its own `look`.
1137
1137
 
1138
1138
  ```ts
1139
1139
  import { commandPalette, commandsFrom, confirm, overlayLook, popover, toast, tooltip, tooltips } from "knobs/ui"
1140
1140
 
1141
- overlayLook({ preset: labPreset, theme: "dark" })
1141
+ overlayLook({ theme: themes.void, appearance: "dark" })
1142
1142
 
1143
1143
  const menu = popover(button, list, { placement: "bottom-end", role: "menu", label: "Games" })
1144
1144
  tooltip(pause, { text: "Pause the live feed", shortcut: "Alt+P" })
@@ -1328,54 +1328,113 @@ Click or `Enter` zooms a tile to fill the view, aspect-fit and centred: one cont
1328
1328
 
1329
1329
  The handle has `update(items)`, `zoom(id | null)`, `zoomed`, `active`, `focus(id?)`, `picks`, `pick(ids)`, `plan`, `moving`, `stats()` (the frame loop's script time) and `dispose()`; `onZoom` and `onActive` report changes. It takes the pieces' tokens and `restyle`, in dark and light; tiles round at `--k-ui-bento-radius` (3px), square under `--k-frame: flat`; `--k-ui-bento-bg` and `--k-ui-scrim` set the page under the tiles and the zoom. `planBento(aspects, { width, height, … })` is the layout on its own, with `bentoNeighbour`, `bentoWindow` and `fitRect`. `Bento` in `knobs/ui/react` and `knobs/ui/solid` follows `items` and `picks`. The demo is `examples/ideas.html` (`?n=500` for a big set, `?groups`, `?hero=3`, `?perf` for a frame-time readout, `?bench` to scroll and zoom on its own and report).
1330
1330
 
1331
+ ### Walkthrough
1332
+
1333
+ ```ts
1334
+ import { walkthrough, type WalkthroughDoc } from "knobs/ui"
1335
+
1336
+ const doc: WalkthroughDoc = {
1337
+ id: "2026-10-19-onboarding-prs",
1338
+ title: "Onboarding audit: before / after",
1339
+ sections: [
1340
+ {
1341
+ title: "Refresh models globally",
1342
+ link: "https://github.com/anomalyco/opencode/pull/57148",
1343
+ status: "ready",
1344
+ steps: [{ title: "Desktop model picker", media: { kind: "compare", before: "a.mp4", after: "b.mp4" } }],
1345
+ },
1346
+ ],
1347
+ }
1348
+ const w = walkthrough(container, { doc, onFeedback: (fb) => send(fb) })
1349
+ ```
1350
+
1351
+ **`walkthrough(container, { doc })`** is the page an agent writes to show its work: a plain document (JSON) of sections and steps, each step one card holding a caption, its media and what it asks (a note, or a pick between options). Notes come from a bar docked at the bottom, typed, spoken or inked, each carrying what was on show (a video's time and chapter, a compare's loop and zoom, a diff's file) and a short log of what led up to it; `onFeedback`, `w.feedback` and `w.markdown()` hand it back. `j` / `k` move between steps, `←` / `→` seek, `f` goes full window, `n` writes a note, `1`–`9` pick. Media is a bare URL (a video or picture), or `compare`, `video`, `image`, `diff`, `code`, `terminal`, `metric`, `callout`, `text`, `history`, `stack`, `table`, or `mount` (your own, `(el) => cleanup`; the one that isn't JSON). A step's card is the surface, so media inside draw no card of their own. Wherever media name a step (`step` on a history event, a stack item or a table cell) they take its key, id or number (`"1.2"`), and clicking goes there as `j` / `k` do. The demo is `examples/walkthrough.html`.
1352
+
1353
+ **`history`**: dated events down a spine, a tone dot each (`good`, `warn`, `bad`, `info`, `dim`), under quiet group headings. `provenance` says whether an event was seen in the record (`"verified"`) or worked out from behaviour (`"inferred"`, a ring for a dot and a dashed tag), and `source` where (`"verified · git"`). `evidence` is small tags, linked or not; `type: "release"` draws a diamond, `"audit"` a square. Groups take `events` or `rows`; a bare `events` list is one group. In a narrow card the date goes over the event.
1354
+
1355
+ ```json
1356
+ { "kind": "history", "groups": [{ "heading": "v2 dropped it", "summary": "Jun 26 – Jul 30", "events": [
1357
+ { "date": "Jun 26, 2026", "age": "116d ago", "title": "The v2 TUI rewrite leaves out DialogRetryAction",
1358
+ "detail": "`session/index.tsx` replaced without the listener.", "tone": "bad",
1359
+ "provenance": "verified", "source": "git", "evidence": [{ "label": "e6f660fecf" }] },
1360
+ { "date": "Oct 20, 2026", "title": "/install still 307s to v1", "tone": "warn",
1361
+ "provenance": "inferred", "source": "edge", "step": "4.8" } ] }] }
1362
+ ```
1363
+
1364
+ **`stack`**: PRs in merge order as a branch graph. `branch` is `"head → base"` (or `head` and `base`); an item whose base is another's head hangs under it, joined by a drawn rail, and the rest sit on the trunk (`base`, else the branch most items merge into), named at the top. An item on a branch that's neither shows it. `delta` is `"+164 / -18"` or `{ add, del }`, drawn green and red; `status` and `tone` make its chip; `step` (or `stepId`) makes its title go to that step; `href` links its PR number.
1365
+
1366
+ ```json
1367
+ { "kind": "stack", "base": "dev", "items": [
1368
+ { "order": "01", "pr": "#57146", "href": "https://github.com/anomalyco/opencode/pull/57146", "title": "Typed free-limit error",
1369
+ "branch": "free-limit-card → dev", "delta": "+193 / -8", "status": "Stack base", "tone": "good", "step": "4.1" },
1370
+ { "pr": "#57466", "title": "Restore the Desktop dialog", "branch": "free-limit-desktop → free-limit-card",
1371
+ "delta": { "add": 446, "del": 47 }, "status": "Stacked on #57146", "tone": "good", "summary": "Modal, notice and prompt recall." } ] }
1372
+ ```
1373
+
1374
+ **`table`**: a real `<table>` for audits and matrices. Rows are cells by column key, bare or under `cells`; a cell is text, a number, or `{ text, href?, code?, badge?, tone?, step? }` (a `badge` is a tone chip). Columns take `mono` and `align` (number columns go right by themselves). Figures are tabular; a tall table keeps its head stuck, a wide one scrolls across, its edges fade where there's more, and its bars show thin on hover. `caption` goes under it.
1375
+
1376
+ ```json
1377
+ { "kind": "table", "caption": "From a clean HOME, Oct 20", "columns": [
1378
+ { "key": "channel", "label": "Entry point", "mono": true }, { "key": "days", "label": "Days on v2" },
1379
+ { "key": "state", "label": "State", "align": "right" } ],
1380
+ "rows": [ { "cells": { "channel": { "text": "npm i -g @opencode-ai/cli", "code": true }, "days": 39,
1381
+ "state": { "text": "Broken", "badge": "bad" } } },
1382
+ { "channel": "brew install …/opencode-v2", "days": 31, "state": { "text": "Pending", "badge": "info", "step": "4.6" } } ] }
1383
+ ```
1384
+
1385
+ **`chapters`** on a `video` (or a `compare`): timestamp pills under it. A click seeks there and plays, and goes in the note's log; one highlight springs to the chapter playing as it plays (.4 s, no bounce), and a note's `media` names it (`chapter`). A chapter ends at `end`, else `start + duration`, else the next one's start. On a compare they're also its timeline's markers. A video's `captions` (or `captionsSrc`) is a WebVTT URL, shown by default.
1386
+
1387
+ ```json
1388
+ { "kind": "video", "src": "journey.mp4", "poster": "journey.png", "captions": "captions.vtt", "chapters": [
1389
+ { "id": "scorecard", "label": "Scorecard", "start": 0, "duration": 9.57 },
1390
+ { "label": "Today (broken)", "start": 9.57 }, { "label": "After", "start": 35.38 } ] }
1391
+ ```
1392
+
1331
1393
  ## Theming, Density & WebGPU Renderer
1332
1394
 
1333
- Panels support `theme: "dark" | "light" | "auto"`, `density: "compact" | "default" | "comfortable"`, and `renderer: "gpu" | "dom" | "auto"` (or `?gpu` in the URL), configured on `defineControls`, `mountPanel`, or `<KnobsPanel />`. The header title defaults to the controls id, written as words (`"synth-voice"` reads "Synth voice"); pass `title` to override it or `title: false` to hide it.
1395
+ Panels take a `theme`, an `appearance`, `density: "compact" | "default" | "comfortable"` and `renderer: "gpu" | "dom" | "auto"` (or `?gpu` in the URL), on `defineControls`, `mountPanel` or `<KnobsPanel />`; every `knobs/ui` piece takes the same `theme` and `appearance`, and `restyle(target, look)` changes them on what's already on screen. The header title defaults to the controls id, written as words (`"synth-voice"` reads "Synth voice"); pass `title` to override it or `title: false` to hide it.
1396
+
1397
+ ### Themes and appearance
1398
+
1399
+ Two themes ship in `knobs/themes`: **Knobs** (the default: a near-black glass panel, a white accent, alpha hairlines) and **Void** (true black and flat, solid hairlines, text capped at `#ededed`, a black stage behind compared media; for OLED screens and video review). Each has a dark and a light appearance.
1400
+
1401
+ ```ts
1402
+ import { defineTheme, themes } from "knobs/themes"
1403
+
1404
+ mountPanel(controls, column, { theme: themes.void })
1405
+ split(workspace, { theme: themes.void, appearance: "dark", panes })
1406
+
1407
+ // A theme of your own from a few dials, both appearances generated (checked against APCA).
1408
+ const ocean = defineTheme({
1409
+ name: "ocean",
1410
+ extends: themes.knobs, // optional
1411
+ gray: { hue: 240, chroma: 0.008 },
1412
+ accent: "#4f8cff", // or { dark, light }
1413
+ contrast: 60, // 0–100
1414
+ radius: 6,
1415
+ density: "compact",
1416
+ material: "solid", // "glass" | "solid" | "flat"
1417
+ tokens: { dark: { "bg-page": "#05070a" } }, // any token, per appearance
1418
+ })
1419
+ ```
1334
1420
 
1335
- When `renderer: "gpu"` (or `?gpu`) is active, all floating and inline panels share a single page-level WebGPU overlay canvas and `GPUDevice` with 480 Hz spring physics, velocity-driven directional motion blur, native-rasterized glyph atlas text, and per-column rolling digit smear, while keeping an invisible semantic DOM mirror for keyboard navigation and screen readers. The DOM renderer's transitions run on the same springs (sampled into CSS `linear()` easings), so both renderers move alike. The canvas can't sample the page, so each glass panel gets a `backdrop-filter` element just under the canvas; a panel lying over another panel firms up instead. When WebGPU is unavailable, panels fall back to the DOM/CSS renderer automatically.
1421
+ `appearance` is `"dark"`, `"light"`, `"system"` (the OS setting) or `"inherit"`, the default: the page decides, through a `color-scheme`, a `.dark`/`.light` class, `[data-theme]` or `[data-appearance]` on an ancestor, or an outer knobs element, else the OS. A theme is a value: `theme.dark` and `theme.light` hold every token resolved, `theme.gpu` the colours as floats for WebGPU, and `theme.css()` its stylesheet. The old `theme: "dark" | "light" | "auto"` still works as an appearance, and `preset` (`labPreset`, `problemsPreset`) still lays its tokens over the theme; both are deprecated. `examples/themes.html` shows every piece in both themes and appearances, with a builder for `defineTheme`'s dials that copies the call as code.
1336
1422
 
1337
- The overlay is one canvas at the top of the page, so a panel's DOM overlays (search, inline editors) can only stay above it if they aren't trapped in a stacking context. An inline panel inside an ancestor that creates one (a `transform`, `filter`, `opacity` below 1, a `z-index` on a positioned or flex item, `contain`, `isolation`, …) therefore draws with the DOM renderer, which looks the same, and is marked `data-gpu-trapped`. To keep such a panel on the GPU, take the stacking context off its ancestors. `knobs/ui` panes don't create any.
1423
+ ### Overriding tokens
1338
1424
 
1339
- Override CSS variables on `:root` or `.knobs-panel`:
1425
+ Set any token on `:root`, `.knobs-panel` or any ancestor; a host's value wins at whatever level it's set. Tokens derived from others (hover and selected fills from the surfaces, the slider handle from the accent, sizes from `--k-density`) are derived on each panel and knobs/ui piece, so an override anywhere above them carries through. The full list, with each theme's values, is under [Tokens](#tokens); the old names (`--k-surface`, `--k-text`, `--ku-*`) still work for now.
1340
1426
 
1341
1427
  ```css
1342
1428
  :root {
1343
1429
  --k-bg: #1c1c1e;
1344
- --k-surface: rgba(255, 255, 255, 0.055);
1345
- --k-surface-hi: rgba(255, 255, 255, 0.11);
1346
- --k-line: rgba(255, 255, 255, 0.1);
1347
- --k-text: rgba(255, 255, 255, 0.92);
1348
- --k-label: rgba(255, 255, 255, 0.64);
1349
- --k-accent: #fff;
1350
- --k-modified: #ff9f0a;
1351
- --k-width: 288px;
1352
- --k-pad: 10px;
1353
- --k-inset: 10px;
1354
- --k-row: 32px;
1355
- --k-gap: 4px;
1356
- --k-radius: 8px;
1357
- --k-panel-radius: 12px;
1358
- --k-font-size: 12px;
1359
- --k-label-weight: 500;
1360
- --k-blur: 1; /* motion strength: readout blur and pill stretch */
1361
- --k-motion-blur: 0; /* up to 1: moving fill edges and pills smear by their speed */
1362
- --k-range-blur: .5; /* up to 1: a range band's gliding ends smear by their speed */
1363
- --k-curve-blur: .5; /* up to 1: morphing curves, easings and gradients smear by their speed */
1364
- --k-step-resist: 0.25; /* a stepped slider's pull off its stop (0 snaps, 1 follows) */
1365
- --k-glow: 0.5;
1366
- --k-roll: 420; /* readout roll (ms) */
1367
- --k-drag-roll: 0; /* roll while dragging (ms; 0 snaps) */
1368
- --k-cascade: 12; /* preset ripple between rows (ms; 0 moves them together) */
1369
- --k-glass: 0.6; /* 0 is opaque; up to 1 thins the panel over a blurred backdrop */
1370
- --k-glass-tone: 0.5; /* backdrop brightness under full glass (light theme: 1.08) */
1371
- --k-spring: 0.24 0.16; /* duration and bounce values settle on (GPU); pair with: */
1372
- --k-fill-ease: linear(...); /* springCss(value).easing, for CSS transitions */
1373
- --k-fill-ms: 300; /* springCss(value).duration */
1374
- --k-reveal-ease: cubic-bezier(.2, .8, .2, 1); /* how editors and messages open */
1375
- --k-rim: rgba(255, 255, 255, 0.09);
1430
+ --k-accent: #4f8cff;
1431
+ --k-radius: 6px;
1432
+ --k-density: 0.875;
1376
1433
  }
1377
1434
  ```
1378
1435
 
1436
+ The panel's motion dials are tokens too: `--k-blur` (readout blur and pill stretch), `--k-motion-blur`, `--k-range-blur`, `--k-curve-blur`, `--k-step-resist`, `--k-roll` and `--k-drag-roll` (readout roll, ms), `--k-cascade` (preset ripple, ms), `--k-glass-tone`, `--k-reveal-ease`, and the spring values settle on, `--k-spring` (GPU) with `--k-fill-ease` and `--k-fill-ms` (`springCss(value)`, for CSS).
1437
+
1379
1438
  Changing a token glides: colours, lengths, weights, glass and glow move on the panel spring (`--k-fill-ease` over `--k-fill-ms`), so a theme switch or a preset of tokens animates in both renderers. While a control is dragged they follow it step for step.
1380
1439
 
1381
1440
  A floating panel opens out of its chip like liquid glass. The press squeezes the cog (to 0.94, easing in over 60 ms); then each edge of the glass rides its own spring from the chip to the panel. The edges facing the way it travels lead on a stiff spring (as stiff as their axis carries the travel) and the others trail on a softer one, so the glass stretches toward the panel, overshoots a little and settles in under 300 ms, its corners going from the cog's circle to the panel's radius. The content follows a beat behind: blurred 8 px, faded and at 97%, revealed top first, landing exactly crisp. Closing runs it backwards and faster: the content blurs out first, then the glass pulls into the cog with its far edges trailing (about 200 ms). Esc, the close button or the chip itself folds it back; toggling mid-way reverses from wherever the shape is, keeping its velocity. The WebGPU overlay blurs, fades and scales the content in its shader, so both renderers match. A reload brings an open panel back in place, with no morph.
@@ -1400,6 +1459,254 @@ A reset that went back to the active preset rather than the defaults carries `ba
1400
1459
 
1401
1460
  `patch` holds only the fields that changed. The die page (`examples/die.ts`) rolls its demo dice this way.
1402
1461
 
1462
+ ## Tokens
1463
+
1464
+ Generated from the token schema (`bun run scripts/tokens-table.ts`), with the Knobs theme's values. Inputs are the dials a theme turns, semantic tokens are what pieces read, hooks style one component.
1465
+
1466
+ <!-- tokens:start -->
1467
+
1468
+ ### Accent
1469
+
1470
+ | Token | Tier | Dark | Light | |
1471
+ |---|---|---|---|---|
1472
+ | `--k-accent` | input | `#ffffff` | `#1c1c1e` | The one accent: primary actions, handles, focus. Hover, soft and selection derive from it in CSS. |
1473
+ | `--k-accent-hover` | semantic | `#e5e5e5` | `#2e2e30` | Hovered accent. Derived: `color-mix(in oklch,var(--k-accent) 90%,var(--k-bg))`. |
1474
+ | `--k-accent-soft` | semantic | `#ffffff26` | `#1c1c1e26` | Accent tint behind accent content. Derived: `color-mix(in oklch,var(--k-accent) 15%,transparent)`. |
1475
+ | `--k-accent-fg` | semantic | `#ffffff` | `#1c1c1e` | Accent as text on bg (≥ Lc 60). |
1476
+ | `--k-on-accent` | semantic | `#111111` | `#ffffff` | Content placed on a solid accent. |
1477
+
1478
+ ### Inputs
1479
+
1480
+ | Token | Tier | Dark | Light | |
1481
+ |---|---|---|---|---|
1482
+ | `--k-contrast` | input | `1` | `1` | Contrast multiplier for fills and alpha borders (1 = default; the theme's 0–100 dial maps 50 → 1). |
1483
+
1484
+ ### Shape
1485
+
1486
+ | Token | Tier | Dark | Light | |
1487
+ |---|---|---|---|---|
1488
+ | `--k-radius` | input | `8px` | `8px` | Control corner radius. 0 squares everything, including capsules. Scales with density. |
1489
+ | `--k-radius-panel` | semantic | `calc(var(--k-radius) + var(--k-unit))` | `calc(var(--k-radius) + var(--k-unit))` | Panel and card radius, concentric with controls. Derived: `calc(var(--k-radius) + var(--k-unit))`. |
1490
+ | `--k-round` | semantic | `calc(var(--k-radius) * 999)` | `calc(var(--k-radius) * 999)` | Capsule radius that squares when --k-radius is 0. Use instead of 999px. Derived: `calc(var(--k-radius) * 999)`. |
1491
+
1492
+ ### Size
1493
+
1494
+ | Token | Tier | Dark | Light | |
1495
+ |---|---|---|---|---|
1496
+ | `--k-density` | input | `1` | `1` | Size multiplier: compact .875, default 1, comfortable 1.1875. |
1497
+ | `--k-unit` | semantic | `4px` | `4px` | The spacing unit. |
1498
+ | `--k-row` | semantic | `round(calc(32px * var(--k-density)),2px)` | `round(calc(32px * var(--k-density)),2px)` | Row height. Derived: `round(calc(32px * var(--k-density)),2px)`. |
1499
+ | `--k-width` | semantic | `288px` | `288px` | Panel width. |
1500
+
1501
+ ### Type
1502
+
1503
+ | Token | Tier | Dark | Light | |
1504
+ |---|---|---|---|---|
1505
+ | `--k-font` | input | `system-ui,-apple-system,"SF Pro Text",sans-serif` | `system-ui,-apple-system,"SF Pro Text",sans-serif` | UI font stack. |
1506
+ | `--k-mono` | input | `"SF Mono",SFMono-Regular,ui-monospace,Menlo,monospace` | `"SF Mono",SFMono-Regular,ui-monospace,Menlo,monospace` | Monospace font stack. |
1507
+ | `--k-font-size` | semantic | `round(calc(12px * (1 + (var(--k-density) - 1) * .5)),1px)` | `round(calc(12px * (1 + (var(--k-density) - 1) * .5)),1px)` | Body size; a 5-step scale derives privately. Derived: `round(calc(12px * (1 + (var(--k-density) - 1) * .5)),1px)`. |
1508
+ | `--k-value-font` | semantic | `var(--k-font)` | `var(--k-font)` | Font for readouts and values (labPreset: mono). Derived: `var(--k-font)`. |
1509
+
1510
+ ### Surfaces
1511
+
1512
+ | Token | Tier | Dark | Light | |
1513
+ |---|---|---|---|---|
1514
+ | `--k-bg-page` | semantic | `#0a0a0b` | `#e6e6e8` | The page behind panels; workspace backdrops. |
1515
+ | `--k-bg-inset` | semantic | `#151516` | `#ededef` | Wells sunk into a panel: tracks, inputs, segmented backgrounds. |
1516
+ | `--k-bg` | semantic | `#1c1c1d` | `#f5f5f7` | The panel surface. |
1517
+ | `--k-bg-raised` | semantic | `#232324` | `#ffffff` | Raised within a panel: the active segment, cards on a panel. |
1518
+ | `--k-bg-overlay` | semantic | `#29292a` | `#ffffff` | Floating surfaces: menus, popovers, tooltips. |
1519
+
1520
+ ### Fills
1521
+
1522
+ | Token | Tier | Dark | Light | |
1523
+ |---|---|---|---|---|
1524
+ | `--k-fill` | semantic | `#f4f5f90e` | `#1a1a1d0e` | Resting fill for controls. Derived: `color-mix(in oklch,var(--k-fg) calc(5.5% * var(--k-contrast)),transparent)`. |
1525
+ | `--k-fill-hover` | semantic | `#f4f5f914` | `#1a1a1d14` | Hovered fill. Derived: `color-mix(in oklch,var(--k-fg) calc(8% * var(--k-contrast)),transparent)`. |
1526
+ | `--k-fill-selected` | semantic | `#f4f5f91c` | `#1a1a1d1c` | Pressed or selected fill. Derived: `color-mix(in oklch,var(--k-fg) calc(11% * var(--k-contrast)),transparent)`. |
1527
+
1528
+ ### Foreground
1529
+
1530
+ | Token | Tier | Dark | Light | |
1531
+ |---|---|---|---|---|
1532
+ | `--k-fg` | semantic | `#f4f5f9` | `#1a1a1d` | Primary text and icons (≥ Lc 90 on bg). |
1533
+ | `--k-fg-2` | semantic | `#d0d0d5` | `#59595d` | Secondary text: labels (≥ Lc 75). |
1534
+ | `--k-fg-3` | semantic | `#9e9ea3` | `#96969b` | Tertiary text: metadata, units, captions (≥ Lc 45). |
1535
+ | `--k-fg-4` | semantic | `#7d7e81` | `#b4b5b9` | Placeholder and disabled text (≥ Lc 30). |
1536
+
1537
+ ### Borders
1538
+
1539
+ | Token | Tier | Dark | Light | |
1540
+ |---|---|---|---|---|
1541
+ | `--k-border-subtle` | semantic | `#f4f5f90f` | `#1a1a1d0f` | Hairline edges and dividers (below Lc 15 by design). Derived: `color-mix(in oklch,var(--k-fg) calc(6% * var(--k-contrast)),transparent)`. |
1542
+ | `--k-border` | semantic | `#f4f5f91a` | `#1a1a1d1a` | Default borders. Derived: `color-mix(in oklch,var(--k-fg) calc(10% * var(--k-contrast)),transparent)`. |
1543
+ | `--k-border-strong` | semantic | `#58585c` | `#d3d3d7` | Interactive edges (≥ Lc 15; solid). |
1544
+
1545
+ ### Status
1546
+
1547
+ | Token | Tier | Dark | Light | |
1548
+ |---|---|---|---|---|
1549
+ | `--k-ok` | semantic | `#59d38c` | `#0a7e3a` | Success. |
1550
+ | `--k-warn` | semantic | `#f7bc50` | `#b66c00` | Warning. |
1551
+ | `--k-danger` | semantic | `#fa6863` | `#cc2827` | Error, destructive. Put text on danger-soft rather than bare bg. |
1552
+ | `--k-info` | semantic | `#55b8f8` | `#0071b3` | Informational. |
1553
+ | `--k-ok-soft` | semantic | `#59d38c26` | `#0a7e3a26` | Success tint. Derived: `color-mix(in oklch,var(--k-ok) 15%,transparent)`. |
1554
+ | `--k-warn-soft` | semantic | `#f7bc5026` | `#b66c0026` | Warning tint. Derived: `color-mix(in oklch,var(--k-warn) 15%,transparent)`. |
1555
+ | `--k-danger-soft` | semantic | `#fa686326` | `#cc282726` | Danger tint. Derived: `color-mix(in oklch,var(--k-danger) 15%,transparent)`. |
1556
+ | `--k-info-soft` | semantic | `#55b8f826` | `#0071b326` | Info tint. Derived: `color-mix(in oklch,var(--k-info) 15%,transparent)`. |
1557
+
1558
+ ### Interaction
1559
+
1560
+ | Token | Tier | Dark | Light | |
1561
+ |---|---|---|---|---|
1562
+ | `--k-focus` | semantic | `#ffffff` | `#1c1c1e` | Focus ring colour (drawn as a 2px bg gap, then 2px of focus). Derived: `var(--k-accent)`. |
1563
+ | `--k-selection` | semantic | `#ffffff3d` | `#1c1c1e3d` | Selected rows and ranges. Derived: `color-mix(in oklch,var(--k-accent) 24%,transparent)`. |
1564
+ | `--k-scrim` | semantic | `#00000099` | `#00000040` | Dimming behind modal layers. |
1565
+
1566
+ ### Data
1567
+
1568
+ | Token | Tier | Dark | Light | |
1569
+ |---|---|---|---|---|
1570
+ | `--k-diff-add` | semantic | `#59d38c` | `#0a7e3a` | Added lines; line and word tints derive privately (12% / 38%). Derived: `var(--k-ok)`. |
1571
+ | `--k-diff-del` | semantic | `#fa6863` | `#cc2827` | Deleted lines. Derived: `var(--k-danger)`. |
1572
+ | `--k-diff-mod` | semantic | `#f7bc50` | `#b66c00` | Modified lines. Derived: `var(--k-warn)`. |
1573
+ | `--k-series-1` | semantic | `#6db0f4` | `#2378c2` | Chart series 1. |
1574
+ | `--k-series-2` | semantic | `#66c189` | `#008b4f` | Chart series 2. |
1575
+ | `--k-series-3` | semantic | `#d79f4c` | `#9c6900` | Chart series 3. |
1576
+ | `--k-series-4` | semantic | `#ed8c84` | `#b84d49` | Chart series 4. |
1577
+ | `--k-series-5` | semantic | `#bc97e8` | `#885cb5` | Chart series 5. |
1578
+ | `--k-series-6` | semantic | `#25c2c2` | `#008686` | Chart series 6. |
1579
+
1580
+ ### Material
1581
+
1582
+ | Token | Tier | Dark | Light | |
1583
+ |---|---|---|---|---|
1584
+ | `--k-shadow-raised` | semantic | `0 1px 2px light-dark(#0000001f,#00000029)` | `0 1px 2px light-dark(#0000001f,#00000029)` | Small lift for raised controls. |
1585
+ | `--k-shadow-overlay` | semantic | `0 12px 36px light-dark(#00000024,#00000085),0 1px 2px light-dark(#00000014,#0000004d)` | `0 12px 36px light-dark(#00000024,#00000085),0 1px 2px light-dark(#00000014,#0000004d)` | Floating panels, menus, popovers. |
1586
+ | `--k-glass` | semantic | `0.6` | `0.6` | Backdrop glass amount (0 = opaque). |
1587
+ | `--k-glow` | semantic | `0.5` | `0.5` | Specular glow amount. |
1588
+ | `--k-rim` | semantic | `#ffffff1a` | `#ffffff99` | Top-edge highlight hairline. |
1589
+
1590
+ ### Motion
1591
+
1592
+ | Token | Tier | Dark | Light | |
1593
+ |---|---|---|---|---|
1594
+ | `--k-spring` | semantic | `0.3 0` | `0.3 0` | Default spring as `duration bounce` (the motion module's `default`). |
1595
+ | `--k-hover-in` | semantic | `0` | `0` | Hover wash fade-in, unitless milliseconds. |
1596
+ | `--k-hover-out` | semantic | `120` | `120` | Hover wash fade-out, unitless milliseconds. |
1597
+ | `--k-z` | semantic | `2147480000` | `2147480000` | Base of knobs' stacking ladder; layers add small offsets. |
1598
+
1599
+ ### Hooks
1600
+
1601
+ | Token | Tier | Dark | Light | |
1602
+ |---|---|---|---|---|
1603
+ | `--k-slider-track` | hook | `#f4f5f90e` | `#1a1a1d0e` | Slider track. Derived: `var(--k-fill)`. |
1604
+ | `--k-slider-fill` | hook | `#fcfcfd49` | `#1b1b1e49` | Slider value fill. Derived: `color-mix(in oklch,var(--k-accent) 20%,var(--k-fill-selected))`. |
1605
+ | `--k-slider-handle` | hook | `#ffffff` | `#1c1c1e` | Slider handle and range thumbs. Derived: `var(--k-accent)`. |
1606
+ | `--k-toggle-thumb-off` | hook | `#ffffff` | `#ffffff` | A switch's thumb while off, and the ring around colour and gradient thumbs. Derived: `#ffffff`. |
1607
+ | `--k-toggle-track` | hook | `#f4f5f91c` | `#1a1a1d1c` | Toggle track, off. Derived: `var(--k-fill-selected)`. |
1608
+ | `--k-toggle-track-on` | hook | `#ffffff` | `#1c1c1e` | Toggle track, on. Derived: `var(--k-accent)`. |
1609
+ | `--k-toggle-thumb` | hook | `#111111` | `#ffffff` | Toggle thumb. Derived: `var(--k-on-accent)`. |
1610
+ | `--k-segmented-track` | hook | `#151516` | `#ededef` | Segmented control background. Derived: `var(--k-bg-inset)`. |
1611
+ | `--k-segmented-active` | hook | `#232324` | `#ffffff` | Active segment. Derived: `var(--k-bg-raised)`. |
1612
+ | `--k-timeline-playhead` | hook | `#ffffff` | `#1c1c1e` | Timeline playhead. Derived: `var(--k-accent)`. |
1613
+ | `--k-split-gutter` | hook | `#f4f5f90f` | `#1a1a1d0f` | Split pane divider. Derived: `var(--k-border-subtle)`. |
1614
+ | `--k-compare-divider` | hook | `#f4f5f9` | `#1a1a1d` | Before/after divider line. Derived: `var(--k-fg)`. |
1615
+ | `--k-compare-stage` | hook | `#f4f5f90e` | `#1a1a1d0e` | Compare stage background. Derived: `var(--k-fill)`. |
1616
+ | `--k-activity-rail` | hook | `#58585c` | `#d3d3d7` | Activity rail line. Derived: `var(--k-border-strong)`. |
1617
+ | `--k-picker-card` | hook | `#f4f5f90e` | `#1a1a1d0e` | Picker card. Derived: `var(--k-fill)`. |
1618
+ | `--k-pane-bg` | hook | `#1c1c1d` | `#f5f5f7` | knobs/ui pane card. Derived: `var(--k-bg)`. |
1619
+ | `--k-button-bg` | hook | `#f4f5f90e` | `#1a1a1d0e` | Button fill. Derived: `var(--k-fill)`. |
1620
+ | `--k-button-border` | hook | `#00000000` | `#00000000` | Button border. Derived: `transparent`. |
1621
+ | `--k-button-fg` | hook | `#f4f5f9` | `#1a1a1d` | Button text. Derived: `var(--k-fg)`. |
1622
+ | `--k-row-hover` | hook | `#f4f5f907` | `#1a1a1d07` | Row hover wash. Derived: `color-mix(in oklch,var(--k-fill) 50%,transparent)`. |
1623
+ | `--k-group-label` | hook | `#9e9ea3` | `#96969b` | Folder and group headings. Derived: `var(--k-fg-3)`. |
1624
+ | `--k-modified` | hook | `#9e9ea3` | `#96969b` | Marker for values changed from their default. Derived: `var(--k-fg-3)`. |
1625
+
1626
+ ### Renamed
1627
+
1628
+ | Old | New |
1629
+ |---|---|
1630
+ | `--ku-accent` | `--k-accent` |
1631
+ | `--ku-radius` | `--k-radius` |
1632
+ | `--ku-font` | `--k-font` |
1633
+ | `--ku-mono` | `--k-mono` |
1634
+ | `--k-page` | `--k-bg-page` |
1635
+ | `--ku-page` | `--k-bg-page` |
1636
+ | `--ku-bg` | `--k-bg` |
1637
+ | `--k-surface` | `--k-fill` |
1638
+ | `--ku-surface` | `--k-fill` |
1639
+ | `--k-surface-hi` | `--k-fill-selected` |
1640
+ | `--ku-surface-hi` | `--k-fill-selected` |
1641
+ | `--k-text` | `--k-fg` |
1642
+ | `--ku-text` | `--k-fg` |
1643
+ | `--k-label` | `--k-fg-2` |
1644
+ | `--ku-label` | `--k-fg-2` |
1645
+ | `--k-dim` | `--k-fg-3` |
1646
+ | `--ku-dim` | `--k-fg-3` |
1647
+ | `--k-edge` | `--k-border-subtle` |
1648
+ | `--k-line` | `--k-border` |
1649
+ | `--ku-line` | `--k-border` |
1650
+ | `--k-line-hi` | `--k-border-strong` |
1651
+ | `--ku-line-hi` | `--k-border-strong` |
1652
+ | `--ku-warn` | `--k-warn` |
1653
+ | `--k-critical` | `--k-danger` |
1654
+ | `--ku-critical` | `--k-danger` |
1655
+ | `--k-ui-select` | `--k-selection` |
1656
+ | `--ku-select` | `--k-selection` |
1657
+ | `--k-panel-radius` | `--k-radius-panel` |
1658
+ | `--ku-panel-radius` | `--k-radius-panel` |
1659
+ | `--ku-row` | `--k-row` |
1660
+ | `--ku-font-size` | `--k-font-size` |
1661
+ | `--ku-value-font` | `--k-value-font` |
1662
+ | `--k-lift-shadow` | `--k-shadow-raised` |
1663
+ | `--k-shadow` | `--k-shadow-overlay` |
1664
+ | `--ku-shadow` | `--k-shadow-overlay` |
1665
+ | `--ku-rim` | `--k-rim` |
1666
+ | `--ku-hover-in` | `--k-hover-in` |
1667
+ | `--ku-hover-out` | `--k-hover-out` |
1668
+ | `--k-fill-rest` | `--k-slider-fill` |
1669
+ | `--k-handle` | `--k-slider-handle` |
1670
+ | `--k-thumb` | `--k-toggle-thumb-off` |
1671
+ | `--k-seg-bg` | `--k-segmented-track` |
1672
+ | `--ku-seg-bg` | `--k-segmented-track` |
1673
+ | `--k-seg-active` | `--k-segmented-active` |
1674
+ | `--k-ui-divider` | `--k-split-gutter` |
1675
+ | `--ku-divider` | `--k-split-gutter` |
1676
+ | `--k-compare-line` | `--k-compare-divider` |
1677
+ | `--k-activity-line` | `--k-activity-rail` |
1678
+ | `--k-ui-pane` | `--k-pane-bg` |
1679
+ | `--ku-pane-bg` | `--k-pane-bg` |
1680
+ | `--k-button-line` | `--k-button-border` |
1681
+ | `--k-button-color` | `--k-button-fg` |
1682
+ | `--k-group-ink` | `--k-group-label` |
1683
+ | `--k-group-color` | `--k-group-label` |
1684
+ | `--k-tray-pad` | `--_k-tray-pad` |
1685
+ | `--k-pad` | `--_k-pad` |
1686
+ | `--k-inset` | `--_k-inset` |
1687
+ | `--ku-inset` | `--_k-inset` |
1688
+ | `--k-gap` | `--_k-gap` |
1689
+ | `--k-radius-md` | `--_k-radius-md` |
1690
+ | `--k-radius-sm` | `--_k-radius-sm` |
1691
+ | `--k-control-h` | `--_k-control-h` |
1692
+ | `--ku-control-h` | `--_k-control-h` |
1693
+ | `--k-value-size` | `--_k-value-size` |
1694
+ | `--ku-value-size` | `--_k-value-size` |
1695
+ | `--k-text-title` | `--_k-text-title` |
1696
+ | `--k-text-body` | `--_k-text-body` |
1697
+ | `--k-text-control` | `--_k-text-control` |
1698
+ | `--k-text-meta` | `--_k-text-meta` |
1699
+ | `--ku-text-meta` | `--_k-text-meta` |
1700
+ | `--k-text-cap` | `--_k-text-cap` |
1701
+ | `--k-font-weight` | `--_k-weight` |
1702
+ | `--ku-font-weight` | `--_k-weight` |
1703
+ | `--k-label-weight` | `--_k-weight-label` |
1704
+ | `--ku-label-weight` | `--_k-weight-label` |
1705
+ | `--k-title-weight` | `--_k-weight-title` |
1706
+ | `--ku-title-weight` | `--_k-weight-title` |
1707
+
1708
+ <!-- tokens:end -->
1709
+
1403
1710
  ## Show, hide and unlock
1404
1711
 
1405
1712
  **Backtick.** `` ` `` shows and hides every panel and chip on the page at once, the way a page's
@@ -1573,6 +1880,7 @@ The package has two core exports selected through the standard `development` con
1573
1880
  | `optionPicker(container, { options, selected?, chosen?, onSelect?, onChoose?, body?, digits? })` | Options 1–n on a gliding card, the selected one's parameters (a panel) open under it. |
1574
1881
  | `bento(container, { items, gap?, tolerance?, rowHeight?, fit?, blur?, picks?, onPick?, onZoom?, onActive? })` | An ideas grid: a bento of images and live content that zooms an item to fill the view; picks with Space. |
1575
1882
  | `planBento(aspects, { width, height, gap?, tolerance?, rowHeight?, groups?, hero? })` | The bento's layout on its own: rects, mode, coverage and crop. |
1883
+ | `walkthrough(container, { doc, onFeedback?, storage?, keys?, rail?, advance? })` / `mediaSlot(container, { media, steps? })` | The review page an agent writes (sections, steps, media from compares to histories, stacks and tables, notes and picks handed back); one step's media on its own. |
1576
1884
  | `overlayLook({ preset?, theme? })` | The look every overlay takes. |
1577
1885
  | `hints.register(root, () => targets, { listen?, rank? })` / `data-hint` | Joins the page's hint mode (`s`); `hints.start()`, `hints.stop()`. |
1578
1886
  | `restyle(target, { preset?, theme?, density? })` | Re-themes the pieces and panels already on screen, live; on a document, later overlays too. |