@diegopluna/narvi 0.3.3 → 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 (66) hide show
  1. package/dist/components/app-shell/AppShellMain.svelte +14 -2
  2. package/dist/components/app-shell/AppShellPanel.svelte +108 -12
  3. package/dist/components/app-shell/AppShellPanel.svelte.d.ts +11 -1
  4. package/dist/components/app-shell/AppShellSheet.svelte +11 -1
  5. package/dist/components/app-shell/context.d.ts +8 -0
  6. package/dist/components/app-shell/context.js +7 -0
  7. package/dist/components/avatar/AvatarRoot.svelte +20 -7
  8. package/dist/components/avatar/AvatarRoot.svelte.d.ts +10 -3
  9. package/dist/components/badge/Badge.svelte +13 -1
  10. package/dist/components/badge/Badge.svelte.d.ts +6 -0
  11. package/dist/components/button/Button.svelte +71 -32
  12. package/dist/components/button/Button.svelte.d.ts +13 -0
  13. package/dist/components/command/CommandDialog.svelte +24 -2
  14. package/dist/components/command/CommandDialog.svelte.d.ts +12 -0
  15. package/dist/components/command/CommandItem.svelte +15 -4
  16. package/dist/components/command/CommandItem.svelte.d.ts +20 -4
  17. package/dist/components/command/CommandRoot.svelte +57 -2
  18. package/dist/components/command/CommandRoot.svelte.d.ts +25 -1
  19. package/dist/components/composer/ComposerModelPicker.svelte +608 -53
  20. package/dist/components/composer/ComposerModelPicker.svelte.d.ts +56 -1
  21. package/dist/components/composer/ComposerRoot.svelte.d.ts +1 -1
  22. package/dist/components/composer/ComposerSubmit.svelte +12 -2
  23. package/dist/components/composer/ComposerSubmit.svelte.d.ts +6 -0
  24. package/dist/components/composer/index.d.ts +1 -1
  25. package/dist/components/input/Input.svelte.d.ts +1 -1
  26. package/dist/components/menu/MenuCheckboxItem.svelte +14 -5
  27. package/dist/components/menu/MenuCheckboxItem.svelte.d.ts +15 -4
  28. package/dist/components/menu/MenuItem.svelte +9 -3
  29. package/dist/components/menu/MenuItem.svelte.d.ts +11 -4
  30. package/dist/components/menu/MenuRadioItem.svelte +18 -9
  31. package/dist/components/menu/MenuRadioItem.svelte.d.ts +15 -4
  32. package/dist/components/menu/MenuSubTrigger.svelte +9 -3
  33. package/dist/components/menu/MenuSubTrigger.svelte.d.ts +11 -4
  34. package/dist/components/questionnaire/Questionnaire.svelte +100 -9
  35. package/dist/components/questionnaire/Questionnaire.svelte.d.ts +11 -0
  36. package/dist/components/segmented/SegmentedControl.svelte +12 -1
  37. package/dist/components/segmented/SegmentedControl.svelte.d.ts +3 -1
  38. package/dist/components/select/Select.svelte +36 -5
  39. package/dist/components/select/Select.svelte.d.ts +12 -0
  40. package/dist/components/settings-row/SettingsRow.svelte +87 -37
  41. package/dist/components/settings-row/SettingsRow.svelte.d.ts +13 -0
  42. package/dist/components/slider/Slider.svelte.d.ts +2 -2
  43. package/dist/components/split-button/SplitButton.svelte +147 -0
  44. package/dist/components/split-button/SplitButton.svelte.d.ts +36 -0
  45. package/dist/components/tab-strip/TabStrip.svelte +410 -109
  46. package/dist/components/tab-strip/TabStrip.svelte.d.ts +51 -3
  47. package/dist/components/tab-strip/drag.svelte.d.ts +31 -0
  48. package/dist/components/tab-strip/drag.svelte.js +148 -0
  49. package/dist/components/textarea/Textarea.svelte.d.ts +1 -1
  50. package/dist/components/toggle-group/ToggleGroupRoot.svelte.d.ts +1 -1
  51. package/dist/index.d.ts +3 -1
  52. package/dist/index.js +1 -0
  53. package/dist/internal/ItemDescription.svelte +34 -0
  54. package/dist/internal/ItemDescription.svelte.d.ts +10 -0
  55. package/dist/internal/roving.d.ts +3 -1
  56. package/dist/internal/roving.js +6 -3
  57. package/dist/media.stylex.d.ts +6 -0
  58. package/dist/media.stylex.js +6 -0
  59. package/dist/vite.js +4 -0
  60. package/package.json +20 -1
  61. package/skills/building-ui/SKILL.md +48 -20
  62. package/skills/building-ui/references/components.md +43 -42
  63. package/skills/markdown/SKILL.md +1 -1
  64. package/skills/setup/SKILL.md +1 -1
  65. package/skills/styling/SKILL.md +11 -2
  66. package/skills/theming/SKILL.md +1 -1
@@ -26,40 +26,41 @@ component: import the namespace (`Dialog`) and use `Dialog.Root`. Docs and live
26
26
 
27
27
  ## Controls and forms
28
28
 
29
- | Component | Use it for | Docs slug |
30
- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------- |
31
- | `Button` | An action; `href` makes it a link; `variant` (12, from `primary` to `success-outline`), `size` (`micro` to `lg`), `shape`, `loading`, `iconOnly` | `button` |
32
- | `Field` | Label, help text and error around one control | `field` |
33
- | `Input` | One line of text | `input` |
34
- | `Textarea` | Several lines of text | `textarea` |
35
- | `Select` | One choice from a short list (`options: { value, label, icon?, group? }[]`, `align`, `optionIcon`) | `select` |
36
- | `Checkbox` | An option on or off, or several from a list | `checkbox` |
37
- | `ChoiceCards` | One choice among a few, each a card with a title and a line of detail | `choice-cards` |
38
- | `Switch` | A setting that takes effect at once | `switch` |
39
- | `SegmentedControl` | One of a few options, all visible (`options: { value, label, title? }[]`) | `segmented-control` |
40
- | `Slider` | A value or a range along a track | `slider` |
41
- | `Toggle` | A button that stays pressed (`tone`: `accent`, or `neutral` for toolbar icons) | `toggle` |
42
- | `ToggleGroup.Root`, `.Item` | Toggles that belong together: one pressed, or any number | `toggle-group` |
43
- | `SettingsGroup` | A titled group of settings: a heading, an action, the rows on one card | `settings-group` |
44
- | `SettingsRow` | One setting: what it is, beside its control | `settings-row` |
45
- | `Tabs` | Views that share one place (`items: TabItem[]`) | `tabs` |
46
- | `SearchButton` | Looks like a search field and opens search (`label`, `shortcut`): for a window's bar | `search-button` |
47
- | `TabStrip` | Tabs for what is open in a pane: closable, addable, scrolling (`tabs`, `bind:value`, `onclose`, `onadd`). The panel is yours | `tab-strip` |
29
+ | Component | Use it for | Docs slug |
30
+ | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------- |
31
+ | `Button` | An action; `href` makes it a link; `variant` (12, from `primary` to `success-outline`), `size` (`micro` to `lg`), `shape`, `loading`, `iconOnly`, `pressed` | `button` |
32
+ | `Field` | Label, help text and error around one control | `field` |
33
+ | `Input` | One line of text | `input` |
34
+ | `Textarea` | Several lines of text | `textarea` |
35
+ | `Select` | One choice from a short list (`options: { value, label, icon?, detail?, detailMono?, group? }[]`, `align`, `optionIcon`) | `select` |
36
+ | `Checkbox` | An option on or off, or several from a list | `checkbox` |
37
+ | `ChoiceCards` | One choice among a few, each a card with a title and a line of detail | `choice-cards` |
38
+ | `Switch` | A setting that takes effect at once | `switch` |
39
+ | `SegmentedControl` | One of a few options, all visible (`options: { value, label, title? }[]`, `onchange`) | `segmented-control` |
40
+ | `Slider` | A value or a range along a track | `slider` |
41
+ | `SplitButton` | A main action joined to a menu of how to do it (`menu`, `menuLabel`, `label`, `variant`) | `split-button` |
42
+ | `Toggle` | A button that stays pressed (`tone`: `accent`, or `neutral` for toolbar icons) | `toggle` |
43
+ | `ToggleGroup.Root`, `.Item` | Toggles that belong together: one pressed, or any number | `toggle-group` |
44
+ | `SettingsGroup` | A titled group of settings: a heading, an action, the rows on one card | `settings-group` |
45
+ | `SettingsRow` | One setting: what it is, beside its control (`leading`, `dimmed`, `mono`) | `settings-row` |
46
+ | `Tabs` | Views that share one place (`items: TabItem[]`) | `tabs` |
47
+ | `SearchButton` | Looks like a search field and opens search (`label`, `shortcut`): for a window's bar | `search-button` |
48
+ | `TabStrip` | Tabs for what is open in a pane: closable, addable, scrolling (`tabs`, `bind:value`, `onclose`, `onadd`); `menu`, `onmove`, `onrename`, `trailing`. The panels are yours | `tab-strip` |
48
49
 
49
50
  ## Overlays (bits-ui; use `child` snippets on triggers)
50
51
 
51
- | Component | Use it for | Docs slug |
52
- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | ------------- |
53
- | `Dialog.Root`, `.Trigger`, `.Content` (`size`, `side`, `as`), `.Header`, `.Title`, `.Description`, `.Body`, `.Footer`, `.Close` | A focused task over the page | `dialog` |
54
- | `ConfirmDialog` | A confirmation for an action that matters | `dialog` |
55
- | `Sheet.Root`, `.Trigger`, `.Content` (`side`, `size`, `focusOnOpen`), `.Header`, `.Title`, `.Description`, `.Body`, `.Footer`, `.Close` | A panel that slides in from an edge | `sheet` |
56
- | `Popover.Root`, `.Trigger`, `.Content` (`padding`, `layout`, `width`), `.Close` | Content anchored to the control that opened it | `popover` |
57
- | `HoverCard.Root`, `.Trigger`, `.Content` (`layout`, `padding`) | A preview while the pointer rests on a link or chip | `hover-card` |
58
- | `Menu.Root`, `.Trigger`, `.Content`, `.Item`, `.CheckboxItem`, `.RadioGroup`, `.RadioItem`, `.Group`, `.Label`, `.Separator`, `.Sub` | Actions and choices from a button | `menu` |
59
- | `ContextMenu.Root`, `.Trigger`, `.Content`, filled with `Menu` items | The same, from a right-click | `menu` |
60
- | `Command.Dialog`, `.Root`, `.Input`, `.List`, `.Group`, `.Item`, `.Empty`, `.Separator`, `.Footer` | A search field over everything the app can do (⌘K) | `command` |
61
- | `Tooltip.Provider`, `.Root`, `.Trigger`, `.Content` (`shortcut`, `layout`) | A control's name and its keys. Needs the Provider | `tooltip` |
62
- | `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` |
63
64
 
64
65
  ## Feedback and status
65
66
 
@@ -68,7 +69,7 @@ component: import the namespace (`Dialog`) and use `Dialog.Root`. Docs and live
68
69
  | `Toaster`, `toast()` | Short notes about something that happened; one Toaster at the root | `toast` |
69
70
  | `Notice` | A note in place: what is happening or went wrong, and what to do | `notice` |
70
71
  | `EmptyState` | An empty place: what it is for and how to fill it (`title`, `level`, `description`, `media`, `actions`) | `empty-state` |
71
- | `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` |
72
73
  | `StatusIndicator` | Where a run, thread or machine stands, by shape and colour | `status-indicator` |
73
74
  | `StatusDot` | A small dot of status colour (`tone`, `shape`), beside a name or on a mark | `status-indicator` |
74
75
  | `Progress` | How far along a task is | `progress` |
@@ -77,7 +78,7 @@ component: import the namespace (`Dialog`) and use `Dialog.Root`. Docs and live
77
78
  | `Shimmer` | Text that says work is under way | `shimmer` |
78
79
  | `RollingText` | A phrase that rolls to its next value ("Reading…", "Running…") | none |
79
80
  | `Announcer` | Says a short message to screen readers without showing anything | `announcer` |
80
- | `Avatar.Root`, `.Image`, `.Fallback` | A person: a picture, or initials | `avatar` |
81
+ | `Avatar.Root`, `.Image`, `.Fallback` | A person: a picture, or initials (`size` `xs` is 20px; `label={null}` beside a written name) | `avatar` |
81
82
 
82
83
  ## App shell
83
84
 
@@ -151,14 +152,14 @@ first. Don't use a rail without a bar in a window that has traffic lights: they
151
152
 
152
153
  ## AI chat
153
154
 
154
- | Component | Use it for | Docs slug |
155
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------ | -------------- |
156
- | `Conversation.Root`, `.Content`, `.ScrollButton`, `.Empty` | The scrolling log; keeps the newest in view while it streams | `conversation` |
157
- | `Message.Root` (`from`, `streaming`, `textSize`), `.Header`, `.Pending`, `.Content` (`bubble`), `.Bubble`, `.Actions`, `.Action`, `.Copy`, `.Time` | One turn, from the person or the model | `message` |
158
- | `Reasoning.Root` (`streaming`), `.Trigger`, `.Content` | The model's thinking, folded once done | `reasoning` |
159
- | `Tool.Root` (`name`, `state`), `.Trigger`, `.Content`, `.Input`, `.Output` | A tool call: what it asked, how it went, what came back | `tool` |
160
- | `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` |
161
- | `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` |
162
163
 
163
164
  ```svelte
164
165
  <Conversation.Root>
@@ -197,7 +198,7 @@ Docs slug: `agent-timeline`.
197
198
  | `WorkFold` | Folds a finished turn's work behind "Worked for 2m 5s" |
198
199
  | `Plan` (`steps: { label, status }[]`) | What the agent means to do, ticked off as it goes |
199
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 |
200
- | `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` |
201
202
  | `QueuedMessage` | A message sent while the agent was still working, waiting its turn (`attachments`, `disabled`) |
202
203
  | `ChangesSummary` (`ChangedFile[]`), `ChangeStats` (`additions`, `deletions`) | What a turn changed, and +12 −3 counts |
203
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.3'
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.3'
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.3'
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.3'
14
+ library_version: '0.3.5'
15
15
  requires:
16
16
  - setup
17
17
  sources: