@diegopluna/narvi 0.4.1 → 0.5.1

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 (180) hide show
  1. package/README.md +3 -1
  2. package/dist/base.css +3 -0
  3. package/dist/components/app-shell/AppShellPanel.svelte +3 -2
  4. package/dist/components/button/Button.svelte +29 -17
  5. package/dist/components/checkbox/Checkbox.svelte +106 -54
  6. package/dist/components/checkbox/Checkbox.svelte.d.ts +22 -8
  7. package/dist/components/choice-cards/ChoiceCards.svelte +68 -39
  8. package/dist/components/choice-cards/ChoiceCards.svelte.d.ts +12 -8
  9. package/dist/components/collapsible/CollapsibleContent.svelte +71 -17
  10. package/dist/components/collapsible/CollapsibleContent.svelte.d.ts +14 -10
  11. package/dist/components/collapsible/CollapsibleRoot.svelte +13 -9
  12. package/dist/components/collapsible/CollapsibleRoot.svelte.d.ts +8 -9
  13. package/dist/components/collapsible/CollapsibleTrigger.svelte +24 -15
  14. package/dist/components/collapsible/CollapsibleTrigger.svelte.d.ts +10 -14
  15. package/dist/components/color-field/ColorField.svelte +13 -7
  16. package/dist/components/command/CommandDialog.svelte +30 -20
  17. package/dist/components/command/CommandDialog.svelte.d.ts +4 -3
  18. package/dist/components/command/CommandEmpty.svelte +11 -9
  19. package/dist/components/command/CommandEmpty.svelte.d.ts +6 -17
  20. package/dist/components/command/CommandGroup.svelte +32 -11
  21. package/dist/components/command/CommandGroup.svelte.d.ts +7 -11
  22. package/dist/components/command/CommandInput.svelte +25 -10
  23. package/dist/components/command/CommandInput.svelte.d.ts +8 -12
  24. package/dist/components/command/CommandItem.svelte +67 -29
  25. package/dist/components/command/CommandItem.svelte.d.ts +6 -32
  26. package/dist/components/command/CommandList.svelte +8 -10
  27. package/dist/components/command/CommandList.svelte.d.ts +6 -8
  28. package/dist/components/command/CommandRoot.svelte +247 -57
  29. package/dist/components/command/CommandRoot.svelte.d.ts +14 -28
  30. package/dist/components/command/CommandSeparator.svelte +18 -0
  31. package/dist/components/command/CommandSeparator.svelte.d.ts +7 -0
  32. package/dist/components/command/context.d.ts +27 -0
  33. package/dist/components/command/context.js +16 -0
  34. package/dist/components/command/index.d.ts +6 -4
  35. package/dist/components/command/index.js +5 -4
  36. package/dist/components/command/score.d.ts +27 -0
  37. package/dist/components/command/score.js +77 -0
  38. package/dist/components/command/styles.d.ts +32 -9
  39. package/dist/components/command/styles.js +42 -14
  40. package/dist/components/composer/ComposerModelPicker.svelte +350 -346
  41. package/dist/components/composer/ComposerModelPicker.svelte.d.ts +6 -3
  42. package/dist/components/composer/ComposerRoot.svelte.d.ts +1 -1
  43. package/dist/components/dialog/ConfirmDialog.svelte +73 -53
  44. package/dist/components/dialog/DialogClose.svelte +17 -0
  45. package/dist/components/dialog/DialogClose.svelte.d.ts +10 -0
  46. package/dist/components/dialog/DialogContent.svelte +35 -33
  47. package/dist/components/dialog/DialogContent.svelte.d.ts +6 -20
  48. package/dist/components/dialog/DialogDescription.svelte +9 -12
  49. package/dist/components/dialog/DialogDescription.svelte.d.ts +6 -8
  50. package/dist/components/dialog/DialogRoot.svelte +20 -0
  51. package/dist/components/dialog/DialogRoot.svelte.d.ts +7 -0
  52. package/dist/components/dialog/DialogTitle.svelte +12 -8
  53. package/dist/components/dialog/DialogTitle.svelte.d.ts +8 -8
  54. package/dist/components/dialog/DialogTrigger.svelte +17 -0
  55. package/dist/components/dialog/DialogTrigger.svelte.d.ts +10 -0
  56. package/dist/components/dialog/index.d.ts +6 -5
  57. package/dist/components/dialog/index.js +3 -6
  58. package/dist/components/dialog/styles.d.ts +1 -2
  59. package/dist/components/dialog/styles.js +11 -8
  60. package/dist/components/hover-card/HoverCardContent.svelte +35 -29
  61. package/dist/components/hover-card/HoverCardContent.svelte.d.ts +8 -12
  62. package/dist/components/hover-card/HoverCardRoot.svelte +7 -7
  63. package/dist/components/hover-card/HoverCardRoot.svelte.d.ts +5 -4
  64. package/dist/components/hover-card/HoverCardTrigger.svelte +18 -0
  65. package/dist/components/hover-card/HoverCardTrigger.svelte.d.ts +10 -0
  66. package/dist/components/hover-card/index.d.ts +2 -3
  67. package/dist/components/hover-card/index.js +1 -5
  68. package/dist/components/input/Input.svelte.d.ts +1 -1
  69. package/dist/components/markdown/MarkdownBlock.svelte +6 -3
  70. package/dist/components/markdown/MarkdownTable.svelte +15 -7
  71. package/dist/components/menu/ContextMenuContent.svelte +15 -15
  72. package/dist/components/menu/ContextMenuContent.svelte.d.ts +6 -9
  73. package/dist/components/menu/ContextMenuTrigger.svelte +14 -16
  74. package/dist/components/menu/ContextMenuTrigger.svelte.d.ts +8 -14
  75. package/dist/components/menu/MenuCheckboxItem.svelte +22 -11
  76. package/dist/components/menu/MenuCheckboxItem.svelte.d.ts +8 -22
  77. package/dist/components/menu/MenuContent.svelte +16 -18
  78. package/dist/components/menu/MenuContent.svelte.d.ts +6 -18
  79. package/dist/components/menu/MenuGroup.svelte +4 -4
  80. package/dist/components/menu/MenuGroup.svelte.d.ts +5 -4
  81. package/dist/components/menu/MenuItem.svelte +25 -12
  82. package/dist/components/menu/MenuItem.svelte.d.ts +6 -21
  83. package/dist/components/menu/MenuLabel.svelte +7 -11
  84. package/dist/components/menu/MenuLabel.svelte.d.ts +6 -8
  85. package/dist/components/menu/MenuRadioGroup.svelte +4 -4
  86. package/dist/components/menu/MenuRadioGroup.svelte.d.ts +5 -4
  87. package/dist/components/menu/MenuRadioItem.svelte +16 -14
  88. package/dist/components/menu/MenuRadioItem.svelte.d.ts +6 -19
  89. package/dist/components/menu/MenuSeparator.svelte +6 -10
  90. package/dist/components/menu/MenuSeparator.svelte.d.ts +6 -7
  91. package/dist/components/menu/MenuSubContent.svelte +22 -19
  92. package/dist/components/menu/MenuSubContent.svelte.d.ts +8 -15
  93. package/dist/components/menu/MenuSubTrigger.svelte +7 -11
  94. package/dist/components/menu/MenuSubTrigger.svelte.d.ts +6 -15
  95. package/dist/components/menu/MenuTrigger.svelte +17 -0
  96. package/dist/components/menu/MenuTrigger.svelte.d.ts +10 -0
  97. package/dist/components/menu/context-menu.d.ts +2 -2
  98. package/dist/components/menu/context-menu.js +3 -2
  99. package/dist/components/menu/group.js +1 -1
  100. package/dist/components/menu/index.d.ts +5 -4
  101. package/dist/components/menu/index.js +5 -5
  102. package/dist/components/menu/row.d.ts +20 -0
  103. package/dist/components/menu/row.js +12 -0
  104. package/dist/components/popover/PopoverClose.svelte +17 -0
  105. package/dist/components/popover/PopoverClose.svelte.d.ts +10 -0
  106. package/dist/components/popover/PopoverContent.svelte +30 -29
  107. package/dist/components/popover/PopoverContent.svelte.d.ts +6 -17
  108. package/dist/components/popover/PopoverTrigger.svelte +17 -0
  109. package/dist/components/popover/PopoverTrigger.svelte.d.ts +10 -0
  110. package/dist/components/popover/index.d.ts +6 -4
  111. package/dist/components/popover/index.js +6 -5
  112. package/dist/components/progress/Progress.svelte +16 -22
  113. package/dist/components/progress/Progress.svelte.d.ts +6 -5
  114. package/dist/components/reasoning/ReasoningRoot.svelte.d.ts +1 -1
  115. package/dist/components/resize-handle/ResizeHandle.svelte +80 -14
  116. package/dist/components/resize-handle/ResizeHandle.svelte.d.ts +15 -1
  117. package/dist/components/segmented/SegmentedControl.svelte +100 -91
  118. package/dist/components/segmented/SegmentedControl.svelte.d.ts +6 -4
  119. package/dist/components/select/Select.svelte +97 -59
  120. package/dist/components/select/Select.svelte.d.ts +3 -2
  121. package/dist/components/sheet/SheetContent.svelte +31 -38
  122. package/dist/components/sheet/SheetContent.svelte.d.ts +7 -22
  123. package/dist/components/sheet/index.d.ts +3 -5
  124. package/dist/components/sheet/index.js +3 -5
  125. package/dist/components/sheet/styles.js +26 -5
  126. package/dist/components/sidebar/SidebarItem.svelte +2 -3
  127. package/dist/components/slider/Slider.svelte +86 -65
  128. package/dist/components/slider/Slider.svelte.d.ts +9 -8
  129. package/dist/components/split-button/SplitButton.svelte +20 -3
  130. package/dist/components/split-button/SplitButton.svelte.d.ts +1 -1
  131. package/dist/components/switch/Switch.svelte +77 -49
  132. package/dist/components/switch/Switch.svelte.d.ts +15 -8
  133. package/dist/components/tab-strip/TabStrip.svelte +87 -68
  134. package/dist/components/tabs/Tabs.svelte +129 -99
  135. package/dist/components/tabs/Tabs.svelte.d.ts +6 -4
  136. package/dist/components/textarea/Textarea.svelte.d.ts +1 -1
  137. package/dist/components/toast/Toaster.svelte +132 -115
  138. package/dist/components/toast/Toaster.svelte.d.ts +5 -0
  139. package/dist/components/toast/toasts.svelte.d.ts +10 -23
  140. package/dist/components/toast/toasts.svelte.js +62 -40
  141. package/dist/components/toggle/Toggle.svelte +15 -9
  142. package/dist/components/toggle/Toggle.svelte.d.ts +8 -17
  143. package/dist/components/toggle-group/ToggleGroupItem.svelte +20 -9
  144. package/dist/components/toggle-group/ToggleGroupItem.svelte.d.ts +10 -10
  145. package/dist/components/toggle-group/ToggleGroupRoot.svelte +33 -18
  146. package/dist/components/toggle-group/ToggleGroupRoot.svelte.d.ts +4 -4
  147. package/dist/components/tool/ToolRoot.svelte.d.ts +1 -1
  148. package/dist/components/tooltip/TooltipContent.svelte +38 -28
  149. package/dist/components/tooltip/TooltipContent.svelte.d.ts +6 -15
  150. package/dist/components/tooltip/TooltipProvider.svelte +34 -10
  151. package/dist/components/tooltip/TooltipProvider.svelte.d.ts +18 -4
  152. package/dist/components/tooltip/TooltipRoot.svelte +52 -23
  153. package/dist/components/tooltip/TooltipRoot.svelte.d.ts +10 -10
  154. package/dist/components/tooltip/TooltipTrigger.svelte +14 -17
  155. package/dist/components/tooltip/TooltipTrigger.svelte.d.ts +10 -4
  156. package/dist/components/tooltip/index.d.ts +1 -1
  157. package/dist/components/tooltip/index.js +1 -1
  158. package/dist/components/work-fold/WorkFold.svelte +14 -5
  159. package/dist/index.d.ts +5 -5
  160. package/dist/index.js +1 -1
  161. package/dist/internal/TooltipScope.svelte +4 -4
  162. package/dist/internal/layer.d.ts +11 -9
  163. package/dist/internal/layer.js +21 -15
  164. package/dist/internal/loose.d.ts +30 -5
  165. package/dist/internal/loose.js +1 -1
  166. package/dist/internal/markers.stylex.d.ts +0 -4
  167. package/dist/internal/markers.stylex.js +0 -2
  168. package/dist/internal/toggle.d.ts +3 -0
  169. package/dist/internal/toggle.js +6 -2
  170. package/dist/internal/tooltip-trigger.d.ts +7 -6
  171. package/dist/internal/tooltip-trigger.js +9 -12
  172. package/dist/vite.d.ts +7 -1
  173. package/dist/vite.js +20 -5
  174. package/package.json +3 -2
  175. package/skills/building-ui/SKILL.md +22 -22
  176. package/skills/building-ui/references/components.md +30 -4
  177. package/skills/markdown/SKILL.md +1 -1
  178. package/skills/setup/SKILL.md +4 -8
  179. package/skills/styling/SKILL.md +1 -1
  180. package/skills/theming/SKILL.md +3 -7
@@ -8,11 +8,11 @@ description: >
8
8
  metadata:
9
9
  purpose: >
10
10
  Build interfaces from Narvi's components and compound parts instead of hand-written markup
11
- and CSS, with correct composition of bits-ui based popups, responsive layout through Stack and
11
+ and CSS, with correct composition of ui-sdk based popups, responsive layout through Stack and
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.4.1'
15
+ library_version: '0.5.1'
16
16
  requires:
17
17
  - setup
18
18
  sources:
@@ -36,6 +36,7 @@ sources:
36
36
  - src/lib/components/tab-strip/TabStrip.svelte
37
37
  - src/lib/components/split-button/SplitButton.svelte
38
38
  - src/lib/components/app-shell/*.svelte
39
+ - src/lib/components/resize-handle/ResizeHandle.svelte
39
40
  - src/lib/components/composer/ComposerModelPicker.svelte
40
41
  - src/lib/components/questionnaire/Questionnaire.svelte
41
42
  - src/lib/components/approval/Approval.svelte
@@ -91,8 +92,8 @@ them. The Root holds the state, and most of them take `bind:open` or `bind:value
91
92
 
92
93
  ### Render a Narvi Button as a trigger
93
94
 
94
- Popups are built on bits-ui. A `Trigger` or `Close` renders its own `<button>` unless you give it a
95
- `child` snippet. To use a Narvi Button, spread the `props` the snippet receives onto it, so it
95
+ Popups are built on ui-sdk. A `Trigger` or `Close` renders its own `<button>` unless you give it a
96
+ `child` snippet (ui-sdk's `render`, under Narvi's name). To use a Narvi Button, spread the `props` the snippet receives onto it, so it
96
97
  gets the ARIA attributes, the handlers and the ref:
97
98
 
98
99
  ```svelte
@@ -154,10 +155,9 @@ Children that render nothing (an `{#if}` that is false) leave no empty body.
154
155
 
155
156
  ### Forms
156
157
 
157
- Wrap a text control (`Input`, `Textarea` or `Select`) in `Field`. Those three read Field's
158
- context, so it gives them a label, help text (`description`) and an error message (`error`), and
159
- wires up `id`, `aria-describedby` and `aria-invalid`. Don't hand-write a `<label>` or the ARIA
160
- wiring for them.
158
+ Wrap a text control (`Input`, `Textarea` or `Select`), a `Checkbox` or a `Switch` in `Field`. They
159
+ read its context, so it gives them a label, help text (`description`) and an error (`error`), and
160
+ wires up `id`, `aria-describedby` and `aria-invalid`. Don't hand-write their `<label>` or ARIA.
161
161
 
162
162
  ```svelte
163
163
  <Field label="Email" description="We only write when a run needs you." error={emailError}>
@@ -179,11 +179,12 @@ wiring for them.
179
179
  - For one choice among a few that each need a line of detail, use `ChoiceCards`
180
180
  (`options: { value, label, detail?, icon?, disabled? }[]`, `bind:value`, `aria-label`).
181
181
 
182
- The other controls don't read Field, so label them directly:
182
+ `Checkbox` and `Switch` can also take their label as children, without a Field. The other
183
+ controls don't read Field, so label them directly:
183
184
 
184
- - `Checkbox` and `Switch` take their label as children: `<Switch bind:checked>Night shift</Switch>`.
185
- To act on a change, `onCheckedChange={(checked) => save(checked)}` gets the new value; the
186
- native `onchange` gets the event. `Select`'s and `SegmentedControl`'s `onchange` get the new
185
+ - `Checkbox` and `Switch` with children: `<Switch bind:checked>Night shift</Switch>`. To act on
186
+ a change, `onCheckedChange={(checked) => save(checked)}` gets the new value (then `details`);
187
+ the native `onchange` gets the event. `Select`'s and `SegmentedControl`'s `onchange` get the new
187
188
  value, as the person picks it: narrow it to your type there rather than in a `bind:value` setter.
188
189
  - `SegmentedControl`, `ToggleGroup.Root` and `Slider` need an `aria-label` (or
189
190
  `aria-labelledby`), for example `<SegmentedControl aria-label="Theme" … />`.
@@ -290,7 +291,8 @@ and `Kbd` inline, `Link` inside text, `Button href` for a link that looks like a
290
291
  ### Feedback
291
292
 
292
293
  - Toasts: mount one `<Toaster />` near the root, then call `toast('Copied the link')` from
293
- anywhere; `toast.info`, `.success`, `.warning`, `.error` and `.loading` set the tone.
294
+ anywhere; `toast.info`, `.success`, `.warning`, `.error` and `.loading` set the tone. The
295
+ newest is on top; F6 moves focus there (`<Toaster shortcut={null} />` if the app uses F6).
294
296
  - A toast can take an `action` (`{ label: 'Undo', onclick(event) }`), which closes it unless
295
297
  it calls `event.preventDefault()`.
296
298
  - Give work a key of your own with `id`: another toast with that id replaces it where it
@@ -333,7 +335,7 @@ and `Kbd` inline, `Link` inside text, `Button href` for a link that looks like a
333
335
  `SplitButton` (`menuTooltip` for its chevron; `onopenchange`): don't wrap one in `Tooltip`
334
336
  parts. `justify="start"` starts its contents, for a full-width row, and a margin of `auto`
335
337
  sends the last to the end. `variant="link"` sits in a sentence. An open ghost, bare, secondary
336
- or floating trigger holds an open look by bits-ui's `aria-expanded`, and `pressed` makes a
338
+ or floating trigger holds an open look by the trigger's `aria-expanded`, and `pressed` makes a
337
339
  toggle button (`aria-pressed`) in that look: style neither.
338
340
  - A main action with a menu of how to do it (Merge, Sign in) is a `SplitButton`; don't join two
339
341
  Buttons by hand, or retheme its tokens to restyle a half. Its props are in the
@@ -348,8 +350,8 @@ and `Kbd` inline, `Link` inside text, `Button href` for a link that looks like a
348
350
  - `Popover.Content` takes `padding="none"`, `layout="column"` and a `width`;
349
351
  `HoverCard.Content` takes `layout="column"` and `padding`; `Tooltip.Content` takes
350
352
  `layout="column"` for a title over a line that says more.
351
- - `Select` takes `optionIcon` for an icon with props, and `prefix` for muted words before the
352
- choice on its trigger ("Text size"). An option's `detail` (`detailMono` for code) is muted at
353
+ - `Select` takes `optionIcon`, `prefix` (muted words before the choice: "Text size") and
354
+ `bind:open` (shut with no options). An option's `detail` (`detailMono` for code) is muted at
353
355
  the end of its row, off the trigger. Groups get a hairline between them.
354
356
  - `EmptyState`'s title is a heading (`level`, 2 by default). `Heading` takes a `weight`.
355
357
 
@@ -469,8 +471,8 @@ Parts of a thread that are easy to redraw by hand, and shouldn't be:
469
471
 
470
472
  ## Common mistakes
471
473
 
472
- - **HIGH: `Tooltip.Root` without a `Tooltip.Provider`.** bits-ui reads the provider from
473
- context and throws when there isn't one.
474
+ - **HIGH: bits-ui's popup props** (`onCloseAutoFocus`, `onInteractOutside`, `forceMount`…). Use
475
+ `initialFocus`/`finalFocus`, `dismissible`/`onDismissAttempt` and `keepMounted` (`references/components.md`).
474
476
  - **HIGH: nesting a Button inside a Trigger without `child`.** `<Dialog.Trigger><Button/></Dialog.Trigger>`
475
477
  renders a button inside a button: invalid HTML, with two focus stops. Use the `child` snippet.
476
478
  - **HIGH: an icon-only Button without `aria-label`.** `iconOnly` makes it square, but it has
@@ -484,12 +486,10 @@ Parts of a thread that are easy to redraw by hand, and shouldn't be:
484
486
  - **MEDIUM: a SettingsRow's `<label for>` on a group.** A `SegmentedControl` or a set of radios
485
487
  has no one element for the label to name. Set `labelFor={false}` and pass `labelId` as
486
488
  `aria-labelledby`.
487
- - **MEDIUM: wrapping a Checkbox, Switch or SegmentedControl in `Field`.** They don't read Field's
488
- context, so the label names nothing. Use children or `aria-label`, as above.
489
+ - **MEDIUM: wrapping a SegmentedControl in `Field`.** It doesn't read Field's context, so the
490
+ label names nothing. Use `aria-label`, as above.
489
491
  - **MEDIUM: a flex `<div>` with margins between children.** Use Stack or Grid. Their gaps follow
490
492
  the spacing scale and change by breakpoint without media queries.
491
- - **MEDIUM: styling inside a `<Theme>` and expecting popups to follow.** They render at the end
492
- of the body. See the `theming` skill.
493
493
 
494
494
  ## Completion
495
495
 
@@ -84,7 +84,7 @@ Markdown's table styles: Markdown's tables and this one share their look.
84
84
  | `ToggleGroup.Root`, `.Item` | Toggles that belong together: one pressed, or any number | `toggle-group` |
85
85
  | `SettingsGroup` | A titled group of settings: a heading, an action, the rows on one card | `settings-group` |
86
86
  | `SettingsRow` | One setting: what it is, beside its control (`leading`, `dimmed`, `mono`) | `settings-row` |
87
- | `Tabs` | Views that share one place (`items: TabItem[]`) | `tabs` |
87
+ | `Tabs` | Views that share one place (`tabs: TabItem[]`, `label`, `bind:value`; `activation="manual"` for a slow panel) | `tabs` |
88
88
  | `SearchButton` | Looks like a search field and opens search (`label`, `shortcut`): for a window's bar | `search-button` |
89
89
  | `TabStrip` | Tabs for what is open in a pane: closable, addable, scrolling (`tabs`, `bind:value`, `onclose`, `onadd`); `menu`, `onmove`, `onrename`, `onkeep`, `trailing`, `variant`. The panels are yours | `tab-strip` |
90
90
 
@@ -151,7 +151,14 @@ short line between the halves (give it a fill of its own with `sx`); `shape="pil
151
151
  outer ends; `mainSx` and `menuSx` style each half after its own styles; `menuWidth` and
152
152
  `menuMinWidth` size the menu, as `Menu.Content`'s `width` and `minWidth` do.
153
153
 
154
- ## Overlays (bits-ui; use `child` snippets on triggers)
154
+ ## Overlays (ui-sdk, in the top layer; use `child` snippets on triggers)
155
+
156
+ Popups open in place, in the browser's top layer, stacked in the order they open. Focus and
157
+ dismissal: `initialFocus` and `finalFocus` on the Content (a selector, an element, a function
158
+ returning one, or `'none'`), `dismissible` and `onDismissAttempt` on the Root, `keepMounted` to keep
159
+ a closed one in the page. Change callbacks get `(value, details)`: `details.reason` says why and
160
+ `details.cancel()` refuses it. A popup's room is `--available-height`, `--available-width` and
161
+ `--anchor-width`.
155
162
 
156
163
  | Component | Use it for | Docs slug |
157
164
  | --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
@@ -163,7 +170,7 @@ outer ends; `mainSx` and `menuSx` style each half after its own styles; `menuWid
163
170
  | `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` |
164
171
  | `ContextMenu.Root`, `.Trigger`, `.Content`, filled with `Menu` items | The same, from a right-click | `menu` |
165
172
  | `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`, `sx`; `Input` an `end` snippet; items a snippet `detail`, `wrapDetail`, `badge` and a `hint`; `Empty` a `status` (`loading`, `error`) | `command` |
166
- | `Tooltip.Provider`, `.Root`, `.Trigger`, `.Content` (`shortcut`, `layout`) | A control's name and its keys. Needs the Provider | `tooltip` |
173
+ | `Tooltip.Provider`, `.Root`, `.Trigger`, `.Content` (`shortcut`, `layout`) | A control's name and its keys. A Provider sets `delay` for those inside it | `tooltip` |
167
174
  | `Collapsible.Root`, `.Trigger`, `.Content` | A region the person can fold away | `collapsible` |
168
175
 
169
176
  ### Palettes
@@ -175,7 +182,7 @@ highlighted item is removed, the highlight goes back to the first. `Command.Inpu
175
182
  snippet after the field; `Command.Item` a `badge` after the label and `wrapDetail` for a path
176
183
  whose end matters; `Command.Empty` a `status` of `loading` (a spinner) or `error` (the danger
177
184
  colour); `Command.Dialog` an `sx` for its place and width. `Command.Footer` is read out: pass
178
- `aria-hidden="true"` only for hints alone. Command.Empty is not announced; say loading and
185
+ `aria-hidden="true"` only for hints alone. Command.Empty is announced (`role="status"`). Escape clears the search before it reaches `onescape`; the highlighted item carries `data-highlighted`. Say loading and
179
186
  errors with an `Announcer` too.
180
187
 
181
188
  ## Feedback and status
@@ -289,6 +296,25 @@ page is laid out once per show or hide. What is under `AppShell.Header` glides o
289
296
  for 200ms; the header, the panel and its edge take their places at once. Don't animate the
290
297
  sidebar's width yourself, and don't put a `translate` of your own on `AppShell.Main`'s children.
291
298
 
299
+ ### Resize handles
300
+
301
+ A `ResizeHandle` of your own (`bind:value`, `min`, `max`, `defaultValue`, `edge`,
302
+ `orientation`, `target`, `property`) writes the size onto `target` as `property` while it is
303
+ dragged, and takes it off again when the drag ends, once `value` has the size. Draw the target
304
+ from both, the property first and the value as its fallback:
305
+
306
+ ```svelte
307
+ <div bind:this={side} style:width="var(--narvi-size, {width}px)">…</div>
308
+ <ResizeHandle bind:value={width} edge="end" target={side} label="Resize the sidebar" />
309
+ ```
310
+
311
+ `--narvi-size`, the default, is registered as not inherited, so a move restyles the target
312
+ alone. A `property` of your own needs the same, or every move restyles all that is in the
313
+ target: `@property --pane-size { syntax: '*'; inherits: false; }`, with no initial value so the
314
+ fallback applies once it's let go. Don't read the property from inside the target; it isn't
315
+ inherited. `onDragStart()` and `onDragEnd(value)` bracket a drag, say to keep an iframe from
316
+ taking the pointer. A handle removed mid-drag ends it with the size from before.
317
+
292
318
  ## AI chat
293
319
 
294
320
  | Component | Use it for | Docs slug |
@@ -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.4.1'
15
+ library_version: '0.5.1'
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.4.1'
14
+ library_version: '0.5.1'
15
15
  sources:
16
16
  - src/lib/vite.ts
17
17
  - src/lib/base.css
@@ -85,8 +85,8 @@ Narvi is below 1.0, so a minor release can change an API. Pin the version you bu
85
85
  @import '@diegopluna/narvi/base.css';
86
86
 
87
87
  :root {
88
- /* Narvi's interface text inherits the page's face. Set it on the root, not on a wrapper,
89
- so menus and dialogs, which are placed at the end of the body, take it too. */
88
+ /* Narvi's interface text inherits the page's face. Set it on the root, so every part
89
+ takes it, menus and dialogs among them. */
90
90
  font-family:
91
91
  ui-sans-serif,
92
92
  system-ui,
@@ -129,7 +129,7 @@ Narvi lists both naming styles, so neither needs a theme override.
129
129
 
130
130
  Narvi's types work with `exactOptionalPropertyTypes`. Every optional prop takes `undefined`, so
131
131
  `<Notice detail={maybe}>` and `<Tooltip.Content side={maybe}>` type-check as they are, with no
132
- need to spread a prop only when it is set. That holds for the parts Narvi takes from bits-ui too.
132
+ need to spread a prop only when it is set. That holds for the parts Narvi takes from ui-sdk too.
133
133
 
134
134
  ## With Tailwind CSS 4
135
135
 
@@ -179,8 +179,6 @@ properties: `p-0` on a Card removes its padding, not a part of it.
179
179
  a stylesheet. One set from script (`document.documentElement.style.colorScheme = 'dark'`)
180
180
  darkens the components and leaves the page light, in production only. Leave the target to the
181
181
  plugin, or switch schemes with a rule such as `:root[data-theme='dark'] { color-scheme: dark }`.
182
- - **MEDIUM: putting the font on a layout `<div>`.** Popups are placed at the end of `<body>`,
183
- outside that div, and fall back to the system font. Set `font-family` on `:root`.
184
182
  - **MEDIUM: `scrollbar-width` or `scrollbar-color` on an element.** In Chromium 121 and later
185
183
  (Electron too) either one turns off `::-webkit-scrollbar` for that element, and it shows the
186
184
  system's scrollbar instead of Narvi's. Leave both off; `scrollbar-width: none` is fine where a
@@ -195,8 +193,6 @@ properties: `p-0` on a Card removes its padding, not a part of it.
195
193
  - `pnpm build`: the built CSS contains Narvi's layer. In a SvelteKit app, run
196
194
  `grep -rl "@layer narvi" .svelte-kit/output/client` (in a plain Vite app,
197
195
  `grep -rl "@layer narvi" dist`) and confirm it lists a file. If it doesn't, check step 3.
198
- - pnpm may warn of an unmet peer, `@sveltejs/kit`, wanted by `runed` (a dependency of bits-ui) in
199
- a SvelteKit 3 app. It can be ignored.
200
196
  - With Tailwind, `<Button class="hidden">` disappears.
201
197
 
202
198
  Next: to restyle components or write your own StyleX, load the `styling` skill. For dark mode and
@@ -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.4.1'
15
+ library_version: '0.5.1'
16
16
  requires:
17
17
  - setup
18
18
  sources:
@@ -12,7 +12,7 @@ metadata:
12
12
  menus and dialogs, and resolve token colours for drawing code that cannot read CSS variables.
13
13
  type: core
14
14
  library: '@diegopluna/narvi'
15
- library_version: '0.4.1'
15
+ library_version: '0.5.1'
16
16
  requires:
17
17
  - setup
18
18
  sources:
@@ -131,7 +131,8 @@ The class is added once the page hydrates. With server rendering or prerendering
131
131
  paint shows the default accent for a moment. There's no verified way yet to put the class into the
132
132
  server-rendered `<html>`. In a client-only app (`ssr = false`, as in Electron), there is no flash.
133
133
 
134
- For a section that has no popups, `<Theme theme={ember}>…</Theme>` is enough. It also takes an
134
+ For one section, `<Theme theme={ember}>…</Theme>` is enough: popups opened inside it render in
135
+ place and take it too. It also takes an
135
136
  array of themes. The same `createTheme` works for `space`, `radius`, `font` and `motion`;
136
137
  overriding `font.display` changes the heading serif.
137
138
 
@@ -282,11 +283,6 @@ scheme changes (`matchMedia('(prefers-color-scheme: dark)')`, or your toggle).
282
283
 
283
284
  ## Common mistakes
284
285
 
285
- - **HIGH: popups inside a `<Theme>` lose it.** Menus, popovers, selects, tooltips, dialogs and
286
- sheets render at the end of `<body>`, outside the Theme's element, so they take the root's
287
- scheme and tokens. This was checked in Chromium against 0.1.0: a Popover opened inside
288
- `<Theme theme={…} scheme="dark">` painted the default accent in the `normal` scheme, while text
289
- in normal flow took the theme. For an app-wide theme or scheme, set it on `<html>` as shown above.
290
286
  - **HIGH: hex values in a theme.** A theme value without `light-dark()` loses the other scheme.
291
287
  - **MEDIUM: overriding `accent` alone.** Focus rings and soft fills use `focusRing`, `accentSoft`
292
288
  and `focusHalo`, so override the whole set or the accent looks patched.