@diegopluna/narvi 0.3.4 → 0.3.5

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 (52) hide show
  1. package/dist/components/app-shell/AppShellPanel.svelte +35 -4
  2. package/dist/components/badge/Badge.svelte +13 -1
  3. package/dist/components/badge/Badge.svelte.d.ts +6 -0
  4. package/dist/components/button/Button.svelte +60 -32
  5. package/dist/components/button/Button.svelte.d.ts +6 -0
  6. package/dist/components/command/CommandDialog.svelte +24 -2
  7. package/dist/components/command/CommandDialog.svelte.d.ts +12 -0
  8. package/dist/components/command/CommandItem.svelte +15 -4
  9. package/dist/components/command/CommandItem.svelte.d.ts +20 -4
  10. package/dist/components/command/CommandRoot.svelte +57 -2
  11. package/dist/components/command/CommandRoot.svelte.d.ts +25 -1
  12. package/dist/components/composer/ComposerModelPicker.svelte +608 -53
  13. package/dist/components/composer/ComposerModelPicker.svelte.d.ts +56 -1
  14. package/dist/components/composer/ComposerRoot.svelte.d.ts +1 -1
  15. package/dist/components/composer/ComposerSubmit.svelte +12 -2
  16. package/dist/components/composer/ComposerSubmit.svelte.d.ts +6 -0
  17. package/dist/components/composer/index.d.ts +1 -1
  18. package/dist/components/input/Input.svelte.d.ts +1 -1
  19. package/dist/components/menu/MenuCheckboxItem.svelte +14 -5
  20. package/dist/components/menu/MenuCheckboxItem.svelte.d.ts +15 -4
  21. package/dist/components/menu/MenuItem.svelte +9 -3
  22. package/dist/components/menu/MenuItem.svelte.d.ts +11 -4
  23. package/dist/components/menu/MenuRadioItem.svelte +18 -9
  24. package/dist/components/menu/MenuRadioItem.svelte.d.ts +15 -4
  25. package/dist/components/menu/MenuSubTrigger.svelte +9 -3
  26. package/dist/components/menu/MenuSubTrigger.svelte.d.ts +11 -4
  27. package/dist/components/questionnaire/Questionnaire.svelte +100 -9
  28. package/dist/components/questionnaire/Questionnaire.svelte.d.ts +11 -0
  29. package/dist/components/select/Select.svelte +11 -1
  30. package/dist/components/select/Select.svelte.d.ts +5 -0
  31. package/dist/components/slider/Slider.svelte.d.ts +2 -2
  32. package/dist/components/split-button/SplitButton.svelte +11 -1
  33. package/dist/components/split-button/SplitButton.svelte.d.ts +7 -0
  34. package/dist/components/tab-strip/TabStrip.svelte +77 -20
  35. package/dist/components/tab-strip/TabStrip.svelte.d.ts +16 -3
  36. package/dist/components/textarea/Textarea.svelte.d.ts +1 -1
  37. package/dist/components/toggle-group/ToggleGroupRoot.svelte.d.ts +1 -1
  38. package/dist/index.d.ts +1 -1
  39. package/dist/internal/ItemDescription.svelte +34 -0
  40. package/dist/internal/ItemDescription.svelte.d.ts +10 -0
  41. package/dist/internal/roving.d.ts +3 -1
  42. package/dist/internal/roving.js +6 -3
  43. package/dist/media.stylex.d.ts +6 -0
  44. package/dist/media.stylex.js +6 -0
  45. package/dist/vite.js +4 -0
  46. package/package.json +20 -1
  47. package/skills/building-ui/SKILL.md +30 -22
  48. package/skills/building-ui/references/components.md +22 -22
  49. package/skills/markdown/SKILL.md +1 -1
  50. package/skills/setup/SKILL.md +1 -1
  51. package/skills/styling/SKILL.md +11 -2
  52. package/skills/theming/SKILL.md +1 -1
@@ -1,6 +1,6 @@
1
1
  const isTyping = (target) => target instanceof HTMLElement &&
2
2
  (target.isContentEditable || target.matches('input, textarea, select'));
3
- export function roving({ selector, orientation = 'vertical' }) {
3
+ export function roving({ selector, orientation = 'vertical', wrap = false }) {
4
4
  return (container) => {
5
5
  let last = null;
6
6
  const items = () => [...container.querySelectorAll(selector)].filter((item) => !item.hasAttribute('disabled') &&
@@ -38,10 +38,13 @@ export function roving({ selector, orientation = 'vertical' }) {
38
38
  const forward = orientation === 'vertical' ? 'ArrowDown' : rtl ? 'ArrowLeft' : 'ArrowRight';
39
39
  const back = orientation === 'vertical' ? 'ArrowUp' : rtl ? 'ArrowRight' : 'ArrowLeft';
40
40
  let next;
41
+ const step = (by) => wrap
42
+ ? all[(index + by + all.length) % all.length]
43
+ : all[Math.min(Math.max(index + by, 0), all.length - 1)];
41
44
  if (event.key === forward)
42
- next = all[Math.min(index + 1, all.length - 1)];
45
+ next = step(1);
43
46
  else if (event.key === back)
44
- next = all[Math.max(index - 1, 0)];
47
+ next = step(-1);
45
48
  else if (event.key === 'Home')
46
49
  next = all[0];
47
50
  else if (event.key === 'End')
@@ -39,6 +39,12 @@ export declare const media: {
39
39
  * hold, such as an image's opacity.
40
40
  */
41
41
  dark: string;
42
+ /**
43
+ * The app's own dark mode: a `dark` class on the root, as Tailwind and shadcn set it, and
44
+ * as an app does that keeps its own Light, Dark and System setting. For an app that picks its scheme itself, where `dark` would follow the
45
+ * system instead; like it, for what the tokens cannot hold, such as a logo's dark version.
46
+ */
47
+ darkClass: string;
42
48
  /** Forced-colours mode, such as Windows High Contrast: shadows are gone, outlines stay. */
43
49
  forcedColors: string;
44
50
  /** 640px: large phones on their side, small tablets. */
@@ -40,6 +40,12 @@ export const media = stylex.defineConsts({
40
40
  * hold, such as an image's opacity.
41
41
  */
42
42
  dark: '@media (prefers-color-scheme: dark)',
43
+ /**
44
+ * The app's own dark mode: a `dark` class on the root, as Tailwind and shadcn set it, and
45
+ * as an app does that keeps its own Light, Dark and System setting. For an app that picks its scheme itself, where `dark` would follow the
46
+ * system instead; like it, for what the tokens cannot hold, such as a logo's dark version.
47
+ */
48
+ darkClass: ':is(.dark *)',
43
49
  /** Forced-colours mode, such as Windows High Contrast: shadows are gone, outlines stay. */
44
50
  forcedColors: '@media (forced-colors: active)',
45
51
  /** 640px: large phones on their side, small tablets. */
package/dist/vite.js CHANGED
@@ -61,6 +61,10 @@ export function narvi({ tailwind = false, ...options } = {}) {
61
61
  after: ['components', 'utilities']
62
62
  }
63
63
  : { before: [BASE_LAYER], prefix: NARVI_LAYER },
64
+ // The style applied last wins, a shorthand over a longhand too: a caller's `padding` in
65
+ // `sx` sets a part's padding, which StyleX's default would leave to the part's own
66
+ // `paddingInline`, whatever the order
67
+ styleResolution: 'application-order',
64
68
  ...options,
65
69
  // Narvi ships StyleX source, which must reach the compiler: Vite's dependency
66
70
  // pre-bundling would hand the page `stylex.create` calls that throw at runtime.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopluna/narvi",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "packageManager": "pnpm@12.18.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -106,6 +106,7 @@
106
106
  "format": "prettier --write .",
107
107
  "test:unit": "vitest",
108
108
  "test": "npm run test:unit -- --run",
109
+ "bench:markdown": "NODE_ENV=production vitest --run --config src/bench/markdown/vitest.config.ts",
109
110
  "test:browsers": "NARVI_BROWSERS=firefox,webkit vitest --run --project client src/tests/markdown",
110
111
  "deploy": "pnpm build:docs && wrangler deploy"
111
112
  },
@@ -128,6 +129,7 @@
128
129
  "@fontsource/ibm-plex-mono": "^5.3.0",
129
130
  "@fontsource/ibm-plex-sans": "^5.3.0",
130
131
  "@fontsource/instrument-serif": "^5.3.0",
132
+ "@humanspeak/svelte-markdown": "2.2.0",
131
133
  "@lezer/common": "^1.5.5",
132
134
  "@lezer/highlight": "^1.2.5",
133
135
  "@lezer/javascript": "^1.5.6",
@@ -138,22 +140,39 @@
138
140
  "@sveltejs/package": "^2.5.8",
139
141
  "@sveltejs/vite-plugin-svelte": "^7.2.0",
140
142
  "@tanstack/intent": "0.5.6",
143
+ "@types/markdown-it": "14.2.0",
141
144
  "@types/node": "^24",
145
+ "@types/react": "19.2.14",
146
+ "@types/react-dom": "19.2.3",
142
147
  "@vitest/browser-playwright": "^4.1.8",
143
148
  "axe-core": "^4.14.0",
144
149
  "eslint": "^10.4.1",
145
150
  "eslint-config-prettier": "^10.1.8",
146
151
  "eslint-plugin-svelte": "^3.19.0",
147
152
  "globals": "^17.6.0",
153
+ "markdown-it": "15.0.3",
154
+ "marked": "18.1.2",
155
+ "micromark": "4.0.3",
156
+ "micromark-extension-gfm": "3.0.0",
148
157
  "playwright": "^1.60.0",
149
158
  "prettier": "^3.8.3",
150
159
  "prettier-plugin-svelte": "^4.1.0",
151
160
  "publint": "^0.3.21",
161
+ "react": "19.2.9",
162
+ "react-dom": "19.2.9",
163
+ "rehype-stringify": "10.0.1",
164
+ "remark-gfm": "4.0.1",
165
+ "remark-parse": "11.0.0",
166
+ "remark-rehype": "11.1.2",
152
167
  "shiki": "^4.6.0",
168
+ "streamdown": "2.7.1",
153
169
  "svelte": "^5.57.2",
154
170
  "svelte-check": "^4.6.0",
171
+ "svelte-exmarkdown": "5.0.2",
172
+ "svelte-streamdown": "5.0.0",
155
173
  "typescript": "^6.0.3",
156
174
  "typescript-eslint": "^8.60.1",
175
+ "unified": "11.0.5",
157
176
  "vite": "^8.3.0",
158
177
  "vitest": "^4.1.8",
159
178
  "vitest-browser-svelte": "^2.1.1",
@@ -12,7 +12,7 @@ metadata:
12
12
  Grid, and Narvi's conventions for colour, labels and copy.
13
13
  type: core
14
14
  library: '@diegopluna/narvi'
15
- library_version: '0.3.4'
15
+ library_version: '0.3.5'
16
16
  requires:
17
17
  - setup
18
18
  sources:
@@ -35,6 +35,8 @@ sources:
35
35
  - src/lib/components/tab-strip/TabStrip.svelte
36
36
  - src/lib/components/split-button/SplitButton.svelte
37
37
  - src/lib/components/app-shell/AppShellPanel.svelte
38
+ - src/lib/components/composer/ComposerModelPicker.svelte
39
+ - src/lib/components/questionnaire/Questionnaire.svelte
38
40
  ---
39
41
 
40
42
  # Build interfaces with Narvi
@@ -128,7 +130,8 @@ A Select, Menu or Popover opened inside a dialog or a sheet opens over it.
128
130
 
129
131
  A menu that picks one of several uses `Menu.RadioGroup` and `Menu.RadioItem`. Picking an item
130
132
  closes the menu, as a select does (`closeOnSelect={false}` keeps it open), and an item takes
131
- an `icon` snippet and a `shortcut`, as `Menu.Item` does. `Menu.CheckboxItem` takes the same and
133
+ an `icon` snippet, a `shortcut` and a `trailing` snippet ("Default", "Custom"), as `Menu.Item`
134
+ does; a `Select` option's `detail` is the same word in a select's list. `Menu.CheckboxItem` takes the same and
132
135
  closes the menu too; pass `closeOnSelect={false}` for a menu of settings set several at a time.
133
136
  A `Menu.Label` names the `Menu.Group` or `Menu.RadioGroup` it is in; on its own it is a heading
134
137
  only to the eye, with no group needed. On a `ContextMenu.Trigger`, `menuKey={false}` leaves
@@ -312,33 +315,35 @@ line, `lines={2}` for several). Use `Code` and `Kbd` inline, and
312
315
  - Rows on one card with a line between each: `List.Root` (a `ul`, or `as="div"`) holding
313
316
  `List.Item`s, or rows of your own. Don't redraw the card and its lines.
314
317
  - `Badge` shows its tone as a dot; `plain` hides the dot and colours the words in the tone.
318
+ `color` paints the dot alone in a colour of its own (a label's `#d73a4a`): don't draw a dot.
315
319
  `size="sm"` is 18px, a sidebar row's line, so it sits in a row without growing it. An icon in
316
320
  it is sized to 12px.
317
321
  - `Collapsible.Trigger` takes `chevron="start"` to put the chevron before its label, as in a tree.
318
322
  - `Tabs` and `SegmentedControl` options take an `icon` (a component, sized to fit) and a
319
323
  `title` that names a short label in full, as a tooltip and the item's description.
320
- - A `Button` that is loading hides its label under the spinner, which is as large as an icon in
321
- a button of that size, icon-only ones too; `loadingLabel="Connecting…"`
322
- says what it is doing beside the spinner instead. `variant="link"` sits in a sentence, at its
323
- size, with no padding. A ghost, bare, secondary or floating Button that opens a menu or a
324
+ - A loading `Button` hides its label under the spinner; `loadingLabel="Connecting…"` says what
325
+ it does beside it instead. `tooltip` (words or a snippet) gives it a tooltip, as on
326
+ `Composer.Submit` and a `SplitButton` (`menuTooltip` for its chevron, `onopenchange` for its
327
+ menu): don't wrap one in `Tooltip` parts. `variant="link"` sits in a sentence, unpadded. A ghost, bare, secondary or floating Button that opens a menu or a
324
328
  popover holds an open look while it shows, by the `aria-expanded` bits-ui sets: don't style
325
329
  the open trigger yourself. `pressed` makes it a toggle button (`aria-pressed`) held in the same
326
330
  look while true: don't style `aria-pressed` by hand.
327
331
  - A main action with a menu of how to do it (Merge, Sign in) is a `SplitButton`: `menu` snippet,
328
332
  `menuLabel` for the chevron, `label` for the group, both halves disabled together. Without
329
333
  `menu` it stands alone. Don't join two Buttons by hand.
330
- - `Toggle` and `ToggleGroup.Root` take `tone="neutral"` for a toolbar's icons that show or hide
331
- something: pressed, they take the fill of what is chosen instead of lighting in the accent.
332
- - `Menu.Item`, `Menu.SubTrigger` and `Menu.CheckboxItem` take a `description` (a line under the
333
- label), and `Menu.Item` a `trailing` snippet after its shortcut. A `Menu.CheckboxItem` with an
334
+ - `Toggle` and `ToggleGroup.Root` take `tone="neutral"`: pressed, a toolbar's icon takes the fill
335
+ of what is chosen, not the accent.
336
+ - `Menu.Item`, `Menu.SubTrigger`, `Menu.CheckboxItem` and `Menu.RadioItem` take a
337
+ `description` (a line under the label): a string, or a snippet whose icon is 12px and lies in
338
+ the line; say in words what the icon stands for. All but the SubTrigger take `trailing`. A `Menu.CheckboxItem` with an
334
339
  `icon` puts its tick at the end, so its icon lines up with the others'. `Menu.Content` takes a
335
340
  `width` (`'18rem'`) in place of fitting its items, up to 22rem.
336
341
  - `Popover.Content` takes `padding="none"`, `layout="column"` and a `width`;
337
342
  `HoverCard.Content` takes `layout="column"` and `padding`; `Tooltip.Content` takes
338
343
  `layout="column"` for a title over a line that says more.
339
- - `Select` takes an `optionIcon` snippet, given each option, for an icon with props of its own.
340
- An option's `detail` (a hash, a size, a count; `detailMono` for code) is muted at the end of
341
- its row in the list, and kept off the trigger.
344
+ - `Select` takes `optionIcon` for an icon with props, and `prefix` for muted words before the
345
+ choice on its trigger ("Text size"). An option's `detail` (`detailMono` for code) is muted at
346
+ the end of its row, off the trigger. Groups get a hairline between them.
342
347
  - `EmptyState`'s title is a heading (`level`, 2 by default). `Heading` takes a `weight`.
343
348
 
344
349
  ### App and chat screens
@@ -392,9 +397,11 @@ Parts of the shell that are easy to redraw by hand, and shouldn't be:
392
397
  a long press), `onmove(id, index)` (drag, or Alt+Shift+arrow), `onrename(id, label)` with
393
398
  `bind:renaming` (double-click, F2, or a menu's Rename), `trailing` for a tab's own buttons,
394
399
  `beside` for the tab shown in a split, and per tab `tabId`, `panelId`, `title`, `renamable`.
395
- - **AppShell.Panel** goes narrow by its row (the sheet less the sidebar), not the window.
396
- `maximized` lays it over the whole page, header too; the page underneath is kept, inert. Give
397
- the panel its own `AppShell.Header` with `AppShell.Toggle when="closed"`.
400
+ Arrows open the tab they reach (`activation="manual"` only moves focus); `onchange(id)`; a
401
+ name cleared comes as `''`; `addMenu` (Menu parts) makes the add button open a menu.
402
+ - **AppShell.Panel** goes narrow by its row, not the window; `maximized` lays it over the page,
403
+ kept inert, so give it an `AppShell.Header` with `AppShell.Toggle when="closed"`. Beside a
404
+ thread, put it in a flex row of yours (`position: relative`) inside `AppShell.Main`.
398
405
  - **A Sheet** focuses itself as it opens (`focusOnOpen="sheet"`), so a Rail or a list in it
399
406
  shows no focus ring until the keys move in. Pass `focusOnOpen="first"` for a sheet that
400
407
  holds a form.
@@ -408,10 +415,12 @@ Parts of a thread that are easy to redraw by hand, and shouldn't be:
408
415
  its own). The frame shows its focus edge and sends clicks to it. Set `hasContent` from the
409
416
  editor, so `Composer.Submit` knows there is something to send, and `sending` while a message
410
417
  is on its way and can't be stopped: Submit spins, says "Sending" (`sendingLabel`), and nothing
411
- more is sent. `onfiles` receives picked, dropped and pasted files; return `false` to keep them
418
+ more is sent. `sendingText="Creating worktree…"` says it beside the spinner, widening Submit. `onfiles` receives picked, dropped and pasted files; return `false` to keep them
412
419
  on a list of your own instead of the composer's.
413
420
  - **Composer.ModelPicker** takes `bind:open`, and `multiple` with `value: string[]` to pick
414
- several. `Composer.Toggle` works outside a `Composer.Root` too.
421
+ several, `providers` (a `provider` on each model) for a rail of agents beside the list,
422
+ `searchable` for a field that searches them all, and `bind:starred` (values; keep them where
423
+ they last) for stars, ⌘D included, and a Starred place in the rail. A model's `older` folds it into one row; `bind:also` adds models beside the chosen one with Shift or ⌘. `Composer.Toggle` works outside a `Composer.Root` too.
415
424
  - **Composer.Tray** shows its shelf for a child that holds something and isn't `hidden`; pass
416
425
  `waiting` when what is inside hides itself some other way.
417
426
  - **A user's message with attachments:** `<Message.Content bubble={false}>` is a column at the
@@ -425,12 +434,11 @@ Parts of a thread that are easy to redraw by hand, and shouldn't be:
425
434
  Markdown, in place of `text`. `Activity.Step` takes `wrap` for a label that runs on, and
426
435
  `status="neutral"` for a step that settled without going through or failing ("Skipped",
427
436
  `statusLabels.neutral`); it and `WorkFold` pass `data-*` attributes on.
428
- - **A divider with more than words:** `Divider` takes children (a link, a time) and
429
- `role="status"` for words read out as they change. A long label wraps between the rules.
437
+ - **A divider with more than words:** `Divider` takes children (a link, a time) and `role="status"`.
430
438
  - **Answers on their way:** `Approval` and `Questionnaire` take `busy`, which spins the button
431
439
  pressed and holds the rest. A `Question` takes a `description`, and `secret` for an answer
432
- typed into a hidden field and never shown back. ⌘Enter sends only once every question is
433
- answered or skipped.
440
+ never shown back. ⌘Enter sends once every question is answered or skipped. `Questionnaire` takes a `heading` snippet beside its count, and `bare`
441
+ inside a card of yours; its arrow keys are built in (↑/↓ answers, ←/→ questions).
434
442
  - **Closed folds** (`WorkFold`, `Collapsible`, `Activity`, `Reasoning`, `Tool`) stop rendering
435
443
  their content once shut, so `checkVisibility()`, find-in-page and Playwright see it as hidden.
436
444
  Don't add `display: none` of your own.
@@ -49,18 +49,18 @@ component: import the namespace (`Dialog`) and use `Dialog.Root`. Docs and live
49
49
 
50
50
  ## Overlays (bits-ui; use `child` snippets on triggers)
51
51
 
52
- | Component | Use it for | Docs slug |
53
- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | ------------- |
54
- | `Dialog.Root`, `.Trigger`, `.Content` (`size`, `side`, `as`), `.Header`, `.Title`, `.Description`, `.Body`, `.Footer`, `.Close` | A focused task over the page | `dialog` |
55
- | `ConfirmDialog` | A confirmation for an action that matters | `dialog` |
56
- | `Sheet.Root`, `.Trigger`, `.Content` (`side`, `size`, `focusOnOpen`), `.Header`, `.Title`, `.Description`, `.Body`, `.Footer`, `.Close` | A panel that slides in from an edge | `sheet` |
57
- | `Popover.Root`, `.Trigger`, `.Content` (`padding`, `layout`, `width`), `.Close` | Content anchored to the control that opened it | `popover` |
58
- | `HoverCard.Root`, `.Trigger`, `.Content` (`layout`, `padding`) | A preview while the pointer rests on a link or chip | `hover-card` |
59
- | `Menu.Root`, `.Trigger`, `.Content`, `.Item`, `.CheckboxItem`, `.RadioGroup`, `.RadioItem`, `.Group`, `.Label`, `.Separator`, `.Sub` | Actions and choices from a button | `menu` |
60
- | `ContextMenu.Root`, `.Trigger`, `.Content`, filled with `Menu` items | The same, from a right-click | `menu` |
61
- | `Command.Dialog`, `.Root`, `.Input`, `.List`, `.Group`, `.Item`, `.Empty`, `.Separator`, `.Footer` | A search field over everything the app can do (⌘K) | `command` |
62
- | `Tooltip.Provider`, `.Root`, `.Trigger`, `.Content` (`shortcut`, `layout`) | A control's name and its keys. Needs the Provider | `tooltip` |
63
- | `Collapsible.Root`, `.Trigger`, `.Content` | A region the person can fold away | `collapsible` |
52
+ | Component | Use it for | Docs slug |
53
+ | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
54
+ | `Dialog.Root`, `.Trigger`, `.Content` (`size`, `side`, `as`), `.Header`, `.Title`, `.Description`, `.Body`, `.Footer`, `.Close` | A focused task over the page | `dialog` |
55
+ | `ConfirmDialog` | A confirmation for an action that matters | `dialog` |
56
+ | `Sheet.Root`, `.Trigger`, `.Content` (`side`, `size`, `focusOnOpen`), `.Header`, `.Title`, `.Description`, `.Body`, `.Footer`, `.Close` | A panel that slides in from an edge | `sheet` |
57
+ | `Popover.Root`, `.Trigger`, `.Content` (`padding`, `layout`, `width`), `.Close` | Content anchored to the control that opened it | `popover` |
58
+ | `HoverCard.Root`, `.Trigger`, `.Content` (`layout`, `padding`) | A preview while the pointer rests on a link or chip | `hover-card` |
59
+ | `Menu.Root`, `.Trigger`, `.Content`, `.Item`, `.CheckboxItem`, `.RadioGroup`, `.RadioItem`, `.Group`, `.Label`, `.Separator`, `.Sub` | Actions and choices from a button; items take `description` (text or a snippet) and `trailing` | `menu` |
60
+ | `ContextMenu.Root`, `.Trigger`, `.Content`, filled with `Menu` items | The same, from a right-click | `menu` |
61
+ | `Command.Dialog`, `.Root`, `.Input`, `.List`, `.Group`, `.Item`, `.Empty`, `.Separator`, `.Footer` | A search field over everything the app can do (⌘K); drive it from outside with `Input` `bind:value`, `Root` `shouldFilter={false}` and `bind:value` (the highlighted item), and `Dialog` `onescape`, `restoreFocus`; items take a snippet `detail` and a `hint` | `command` |
62
+ | `Tooltip.Provider`, `.Root`, `.Trigger`, `.Content` (`shortcut`, `layout`) | A control's name and its keys. Needs the Provider | `tooltip` |
63
+ | `Collapsible.Root`, `.Trigger`, `.Content` | A region the person can fold away | `collapsible` |
64
64
 
65
65
  ## Feedback and status
66
66
 
@@ -69,7 +69,7 @@ component: import the namespace (`Dialog`) and use `Dialog.Root`. Docs and live
69
69
  | `Toaster`, `toast()` | Short notes about something that happened; one Toaster at the root | `toast` |
70
70
  | `Notice` | A note in place: what is happening or went wrong, and what to do | `notice` |
71
71
  | `EmptyState` | An empty place: what it is for and how to fill it (`title`, `level`, `description`, `media`, `actions`) | `empty-state` |
72
- | `Badge` | A status, category or count (`tone`, `info` among them) | `badge` |
72
+ | `Badge` | A status, category or count (`tone`, `info` among them; `color` for a label's own dot) | `badge` |
73
73
  | `StatusIndicator` | Where a run, thread or machine stands, by shape and colour | `status-indicator` |
74
74
  | `StatusDot` | A small dot of status colour (`tone`, `shape`), beside a name or on a mark | `status-indicator` |
75
75
  | `Progress` | How far along a task is | `progress` |
@@ -152,14 +152,14 @@ first. Don't use a rail without a bar in a window that has traffic lights: they
152
152
 
153
153
  ## AI chat
154
154
 
155
- | Component | Use it for | Docs slug |
156
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------ | -------------- |
157
- | `Conversation.Root`, `.Content`, `.ScrollButton`, `.Empty` | The scrolling log; keeps the newest in view while it streams | `conversation` |
158
- | `Message.Root` (`from`, `streaming`, `textSize`), `.Header`, `.Pending`, `.Content` (`bubble`), `.Bubble`, `.Actions`, `.Action`, `.Copy`, `.Time` | One turn, from the person or the model | `message` |
159
- | `Reasoning.Root` (`streaming`), `.Trigger`, `.Content` | The model's thinking, folded once done | `reasoning` |
160
- | `Tool.Root` (`name`, `state`), `.Trigger`, `.Content`, `.Input`, `.Output` | A tool call: what it asked, how it went, what came back | `tool` |
161
- | `Composer.Tray` (`pending` snippet, `waiting`), `.Root` (`bind:value`, `status`, `sending`, `hasContent`, `onsubmit`, `onstop`, `onfiles`), `.Textarea`, `.Toolbar`, `.Attachments`, `.AttachButton`, `.Toggle`, `.ModelPicker`, `.Submit` | Where the person writes to the model | `composer` |
162
- | `Suggestions.Root`, `.Item` | Prompts to start from | `suggestions` |
155
+ | Component | Use it for | Docs slug |
156
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ | -------------- |
157
+ | `Conversation.Root`, `.Content`, `.ScrollButton`, `.Empty` | The scrolling log; keeps the newest in view while it streams | `conversation` |
158
+ | `Message.Root` (`from`, `streaming`, `textSize`), `.Header`, `.Pending`, `.Content` (`bubble`), `.Bubble`, `.Actions`, `.Action`, `.Copy`, `.Time` | One turn, from the person or the model | `message` |
159
+ | `Reasoning.Root` (`streaming`), `.Trigger`, `.Content` | The model's thinking, folded once done | `reasoning` |
160
+ | `Tool.Root` (`name`, `state`), `.Trigger`, `.Content`, `.Input`, `.Output` | A tool call: what it asked, how it went, what came back | `tool` |
161
+ | `Composer.Tray` (`pending` snippet, `waiting`), `.Root` (`bind:value`, `status`, `sending`, `hasContent`, `onsubmit`, `onstop`, `onfiles`), `.Textarea`, `.Toolbar`, `.Attachments`, `.AttachButton`, `.Toggle`, `.ModelPicker` (`providers`, `searchable`, `starred`), `.Submit` (`sendingText`) | Where the person writes to the model | `composer` |
162
+ | `Suggestions.Root`, `.Item` | Prompts to start from | `suggestions` |
163
163
 
164
164
  ```svelte
165
165
  <Conversation.Root>
@@ -198,7 +198,7 @@ Docs slug: `agent-timeline`.
198
198
  | `WorkFold` | Folds a finished turn's work behind "Worked for 2m 5s" |
199
199
  | `Plan` (`steps: { label, status }[]`) | What the agent means to do, ticked off as it goes |
200
200
  | `Approval` | The agent asks before acting; folds into the decision once answered. A choice's `shortcut` (`mod+enter`, `mod+backspace`, `enter`, `escape`) shows on its button and makes it |
201
- | `Questionnaire` | Questions one at a time, with keys 1–9 to pick and ⌘Enter to send once all are answered; `secret` answers; `busy` |
201
+ | `Questionnaire` | Questions one at a time, with keys 1–9 to pick, arrows between answers and questions, and ⌘Enter to send once all are answered; `secret` answers; `busy`; `heading`; `bare` |
202
202
  | `QueuedMessage` | A message sent while the agent was still working, waiting its turn (`attachments`, `disabled`) |
203
203
  | `ChangesSummary` (`ChangedFile[]`), `ChangeStats` (`additions`, `deletions`) | What a turn changed, and +12 −3 counts |
204
204
  | `Divider` (`label`, or children; `role`) | A labelled break in a timeline: a new day, "Context compacted" |
@@ -12,7 +12,7 @@ metadata:
12
12
  patching the DOM, and decide which links and images text from a model may load.
13
13
  type: core
14
14
  library: '@diegopluna/narvi'
15
- library_version: '0.3.4'
15
+ library_version: '0.3.5'
16
16
  requires:
17
17
  - setup
18
18
  sources:
@@ -11,7 +11,7 @@ metadata:
11
11
  4 when the app uses it.
12
12
  type: lifecycle
13
13
  library: '@diegopluna/narvi'
14
- library_version: '0.3.4'
14
+ library_version: '0.3.5'
15
15
  sources:
16
16
  - src/lib/vite.ts
17
17
  - src/lib/base.css
@@ -12,7 +12,7 @@ metadata:
12
12
  hover, motion and forced-colour preferences.
13
13
  type: core
14
14
  library: '@diegopluna/narvi'
15
- library_version: '0.3.4'
15
+ library_version: '0.3.5'
16
16
  requires:
17
17
  - setup
18
18
  sources:
@@ -137,7 +137,10 @@ Use `media` from `@diegopluna/narvi/media.stylex.js` as keys inside `stylex.crea
137
137
  - `media.hover`: a precise pointer that can hover. Put every hover style behind it, so a tap never
138
138
  leaves one stuck.
139
139
  - `media.motion` and `media.reducedMotion`: put movement behind `motion`.
140
- - `media.dark`, `media.forcedColors` and `media.coarse` (touch).
140
+ - `media.dark`, `media.forcedColors` and `media.coarse` (touch). `media.dark` follows the system;
141
+ for an app that keeps its own Light, Dark and System setting with a `dark` class on the root
142
+ (as Tailwind and shadcn do), use `media.darkClass`, as in a logo's dark version. Don't write
143
+ `':is(.dark *)'` by hand: StyleX ranks a constant above a written-out string.
141
144
  - `media.sm`, `md`, `lg` and `xl`: minimum widths of 640, 768, 1024 and 1280px, mobile first.
142
145
 
143
146
  For layout, the `Stack` and `Grid` components take the same breakpoints in their props
@@ -307,6 +310,12 @@ Build them the way Narvi does: styles in the module script, applied with `stylex
307
310
  loads, which may be only when the screen that imports it opens. Write the call inline, as the
308
311
  key: `[stylex.when.ancestor(':hover', marker)]: 1`. A plain string kept in a variable
309
312
  (`const HOVER = ':is(:hover, [data-open])'`) is fine.
313
+ - **HIGH: StyleX classes passed through `class` instead of `sx`.** `<Button class={classes(styles.x)}>`
314
+ puts a class of yours and one of the Button's for the same property on the element, and which
315
+ wins depends on the stylesheet's order, which changes from build to build. Pass `sx={styles.x}`:
316
+ it merges, and yours wins. The plugin compiles StyleX with `styleResolution: 'application-order'`,
317
+ so in `sx` a shorthand of yours (`padding: 0`) beats a longhand of the component's
318
+ (`paddingInline`) too. Don't override that option in `narvi()`.
310
319
  - **MEDIUM: styles created in the instance `<script>`.** It compiles, but the styles are
311
320
  created again for every instance. Put `stylex.create` in a `<script module>` block.
312
321
  - **MEDIUM: a raw `@media` string mixed with `media` constants on one property.** StyleX ranks a
@@ -11,7 +11,7 @@ metadata:
11
11
  menus and dialogs, and resolve token colours for drawing code that cannot read CSS variables.
12
12
  type: core
13
13
  library: '@diegopluna/narvi'
14
- library_version: '0.3.4'
14
+ library_version: '0.3.5'
15
15
  requires:
16
16
  - setup
17
17
  sources: