@diegopluna/narvi 0.3.1 → 0.3.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 (40) hide show
  1. package/dist/components/app-shell/AppShellMain.svelte +5 -1
  2. package/dist/components/badge/Badge.svelte +16 -1
  3. package/dist/components/badge/Badge.svelte.d.ts +3 -0
  4. package/dist/components/button/Button.svelte +46 -7
  5. package/dist/components/hover-card/HoverCardContent.svelte +1 -1
  6. package/dist/components/menu/ContextMenuTrigger.svelte +14 -2
  7. package/dist/components/menu/ContextMenuTrigger.svelte.d.ts +10 -0
  8. package/dist/components/menu/MenuCheckboxItem.svelte +8 -2
  9. package/dist/components/menu/MenuCheckboxItem.svelte.d.ts +6 -0
  10. package/dist/components/menu/MenuGroup.svelte +16 -0
  11. package/dist/components/menu/MenuGroup.svelte.d.ts +6 -0
  12. package/dist/components/menu/MenuLabel.svelte +22 -8
  13. package/dist/components/menu/MenuRadioGroup.svelte +16 -0
  14. package/dist/components/menu/MenuRadioGroup.svelte.d.ts +6 -0
  15. package/dist/components/menu/group.d.ts +2 -0
  16. package/dist/components/menu/group.js +9 -0
  17. package/dist/components/menu/index.d.ts +4 -2
  18. package/dist/components/menu/index.js +2 -2
  19. package/dist/components/sidebar/SidebarContent.svelte +59 -13
  20. package/dist/components/sidebar/SidebarContent.svelte.d.ts +6 -0
  21. package/dist/components/sidebar/SidebarFolder.svelte +29 -2
  22. package/dist/components/sidebar/SidebarGroup.svelte +50 -7
  23. package/dist/components/sidebar/SidebarGroup.svelte.d.ts +10 -1
  24. package/dist/components/sidebar/SidebarItem.svelte +136 -21
  25. package/dist/components/sidebar/SidebarItem.svelte.d.ts +22 -2
  26. package/dist/components/sidebar/SidebarSwitcher.svelte +18 -2
  27. package/dist/components/sidebar/SidebarSwitcher.svelte.d.ts +2 -0
  28. package/dist/components/sidebar/fold.d.ts +12 -0
  29. package/dist/components/sidebar/fold.js +8 -0
  30. package/dist/components/status-indicator/StatusDot.svelte +90 -0
  31. package/dist/components/status-indicator/StatusDot.svelte.d.ts +18 -0
  32. package/dist/index.d.ts +3 -1
  33. package/dist/index.js +1 -0
  34. package/package.json +1 -1
  35. package/skills/building-ui/SKILL.md +33 -6
  36. package/skills/building-ui/references/components.md +7 -6
  37. package/skills/markdown/SKILL.md +1 -1
  38. package/skills/setup/SKILL.md +1 -1
  39. package/skills/styling/SKILL.md +1 -1
  40. package/skills/theming/SKILL.md +1 -1
package/dist/index.js CHANGED
@@ -94,6 +94,7 @@ export { default as Stack } from './components/stack/Stack.svelte';
94
94
  // Compound: <Suggestions.Root>, <Suggestions.Item>
95
95
  export * as Suggestions from './components/suggestions/index.js';
96
96
  export { default as StatusIndicator } from './components/status-indicator/StatusIndicator.svelte';
97
+ export { default as StatusDot } from './components/status-indicator/StatusDot.svelte';
97
98
  export { default as Switch } from './components/switch/Switch.svelte';
98
99
  export { default as TabStrip } from './components/tab-strip/TabStrip.svelte';
99
100
  export { default as Tabs } from './components/tabs/Tabs.svelte';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopluna/narvi",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "packageManager": "pnpm@12.18.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -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.1'
15
+ library_version: '0.3.2'
16
16
  requires:
17
17
  - setup
18
18
  sources:
@@ -123,7 +123,11 @@ A Select, Menu or Popover opened inside a dialog or a sheet opens over it.
123
123
 
124
124
  A menu that picks one of several uses `Menu.RadioGroup` and `Menu.RadioItem`. Picking an item
125
125
  closes the menu, as a select does (`closeOnSelect={false}` keeps it open), and an item takes
126
- an `icon` snippet and a `shortcut`, as `Menu.Item` does.
126
+ an `icon` snippet and a `shortcut`, as `Menu.Item` does. `Menu.CheckboxItem` takes the same and
127
+ closes the menu too; pass `closeOnSelect={false}` for a menu of settings set several at a time.
128
+ A `Menu.Label` names the `Menu.Group` or `Menu.RadioGroup` it is in; on its own it is a heading
129
+ only to the eye, with no group needed. On a `ContextMenu.Trigger`, `menuKey={false}` leaves
130
+ Shift+F10 and the Menu key to a list whose own keys already open the menu.
127
131
 
128
132
  For a yes/no confirmation, use `ConfirmDialog`. It takes a `title` that asks the question and a
129
133
  `confirmLabel` that names the action. If `onconfirm` returns a promise, the dialog waits for it
@@ -289,17 +293,22 @@ line, `lines={2}` for several). Use `Code` and `Kbd` inline, and
289
293
  over a busy background, such as an image behind the composer),
290
294
  `EmptyState` for an empty place, `Skeleton`, `Spinner` or `Progress` while loading, and
291
295
  `StatusIndicator` (`status`: idle, working, waiting, done, failed, stopped, connecting) for where
292
- a run stands.
296
+ a run stands. Where there is no room for its shapes, beside a name or on a mark's corner, use
297
+ `StatusDot` (`tone`; `shape`: dot, ring for on its way, diamond for failed; `size`, 6px; `label`).
298
+ Don't draw a dot as a span of your own.
293
299
 
294
300
  ### Lists, badges and folds
295
301
 
296
302
  - Rows on one card with a line between each: `List.Root` (a `ul`, or `as="div"`) holding
297
303
  `List.Item`s, or rows of your own. Don't redraw the card and its lines.
298
304
  - `Badge` shows its tone as a dot; `plain` hides the dot and colours the words in the tone.
305
+ `size="sm"` is 18px, a sidebar row's line, so it sits in a row without growing it. An icon in
306
+ it is sized to 12px.
299
307
  - `Collapsible.Trigger` takes `chevron="start"` to put the chevron before its label, as in a tree.
300
308
  - `Tabs` and `SegmentedControl` options take an `icon` (a component, sized to fit) and a
301
309
  `title` that names a short label in full, as a tooltip and the item's description.
302
- - A `Button` that is loading hides its label under the spinner; `loadingLabel="Connecting…"`
310
+ - A `Button` that is loading hides its label under the spinner, which is as large as an icon in
311
+ a button of that size, icon-only ones too; `loadingLabel="Connecting…"`
303
312
  says what it is doing beside the spinner instead. `variant="link"` sits in a sentence, at its
304
313
  size, with no padding.
305
314
 
@@ -322,14 +331,32 @@ Parts of the shell that are easy to redraw by hand, and shouldn't be:
322
331
  - **A workspace switcher:** `Sidebar.Switcher` is a row with the workspace's mark (`leading`),
323
332
  its name and a selector glyph. Put it in a `Menu.Trigger`'s `child` and spread the props:
324
333
  `{#snippet child({ props })}<Sidebar.Switcher {...props}>…</Sidebar.Switcher>{/snippet}`.
334
+ An `aside` snippet sits just after the name, such as a `StatusDot`.
325
335
  - **Rows in folders** are set in by their text, not their box. A folder's chevron comes first,
326
336
  on the edge of the rows' icons; give its mark as `leading` and it follows the chevron. Its
327
337
  rows line up on their own, their titles under the folder's name, with a mark or without.
328
338
  Don't pad rows or folders yourself.
329
339
  - **The open row** (`current`) is a flat fill; its title keeps its weight. Don't bold it
330
340
  yourself: a heavier title is wider, so it cuts off at a different point as the person moves.
331
- - **A listbox of results** from Sidebar rows: `<Sidebar.Item as="div" role="option" aria-selected>`
332
- inside your `role="listbox"`, so no list item stands between the box and its options.
341
+ - **A listbox of results** from Sidebar rows: `<Sidebar.Item as="div" role="option" picked={…}>`
342
+ inside your `role="listbox"`, so no list item stands between the box and its options; with
343
+ `role="option"`, `picked` says so with `aria-selected`.
344
+ - **Rows the person picks** to act on together (⌘- and Shift-click, which the app handles):
345
+ `picked` gives the accent's soft fill, `data-picked`, and "Selected," before the title
346
+ (`pickedLabel`). A row that can't be used now takes `disabled`: dimmed, `aria-disabled`, still
347
+ in the arrows' path. Don't give a row a background in `sx` for either. A background in `sx` is
348
+ the row's resting fill, such as a drop target's; hover, open and picked show over it.
349
+ - **A row's menu and its preview:** a `ContextMenu.Trigger`'s props go on the element around the
350
+ row, with `itemProps={props}` (attachments too), and a `HoverCard.Trigger`'s on the row itself.
351
+ Don't wrap the row in an `li` of your own. The row stays lit while its context menu is open,
352
+ and its `actions` stay up while a menu opened from them is showing.
353
+ - **A group's list** takes the group's `label`, or its `aria-label`, as its name. Folded, a
354
+ `collapsible` group keeps the open row in view under its folder (`keepCurrent`, on by
355
+ default). Its `actions` end on the rows' trailing column, an icon button by its icon.
356
+ - **Shelves at the foot of the list:** `Sidebar.Content`'s `pinned` snippet holds groups below
357
+ what scrolls, in the same tab stop and arrow-key order. Don't add a second `Sidebar.Content`.
358
+ - **A mark with a badge** in a row's `meta` may overhang it; the line clips only far past its end.
359
+ - `AppShell.Main` is not focusable, so a press on text in the page leaves focus where it was.
333
360
  - **TabStrip** tabs narrow to an ellipsis before the strip scrolls. With a `leading` icon, a
334
361
  tab's close button takes the icon's place, so no room is kept at its end.
335
362
  - **A Sheet** focuses itself as it opens (`focusOnOpen="sheet"`), so a Rail or a list in it
@@ -70,6 +70,7 @@ component: import the namespace (`Dialog`) and use `Dialog.Root`. Docs and live
70
70
  | `EmptyState` | An empty place: what it is for and how to fill it (`title`, `description`, `media`, `actions`) | `empty-state` |
71
71
  | `Badge` | A status, category or count (`tone`) | `badge` |
72
72
  | `StatusIndicator` | Where a run, thread or machine stands, by shape and colour | `status-indicator` |
73
+ | `StatusDot` | A small dot of status colour (`tone`, `shape`), beside a name or on a mark | `status-indicator` |
73
74
  | `Progress` | How far along a task is | `progress` |
74
75
  | `Spinner` | Something in progress | `spinner` |
75
76
  | `Skeleton` | A stand-in for content on its way | `skeleton` |
@@ -80,12 +81,12 @@ component: import the namespace (`Dialog`) and use `Dialog.Root`. Docs and live
80
81
 
81
82
  ## App shell
82
83
 
83
- | Component | Use it for | Docs slug |
84
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ----------- |
85
- | `AppShell.Root` (`bind:sidebarOpen`, `windowInset`), `.Bar` (`center`, `end` snippets), `.Rail`, `.Panes`, `.Sheet` (`flush`), `.Sidebar`, `.Main`, `.Header` (`drag`), `.Panel` (`bind:width`), `.Toggle` (`when`) | The window: its bar, a rail, and one sheet for the sidebar, the page and a side panel | `app-shell` |
86
- | `Sidebar.Root` (`label`), `.Header` (`drag`), `.Content` (`label`), `.Group`, `.Folder` (`bind:open`, `leading`, `trailing` snippets), `.Item` (`current`, `as`, `leading`, `trailing`, `meta`, `actions` snippets), `.Switcher` (`leading`), `.Footer` | A column of rows, in groups and folders. `Root` is for one on its own; in an app shell the same parts go in `AppShell.Sidebar` | `sidebar` |
87
- | `Rail.Root` (`label`), `.Item` (`label`, `href`, `current`, `badge`, `badgeTone`, `shortcut`), `.Separator`, `.Spacer` | A narrow strip of places to go: workspaces, settings. On its own beside a page, or in `AppShell.Rail` | `rail` |
88
- | `ResizeHandle` | A draggable edge between two areas | none |
84
+ | Component | Use it for | Docs slug |
85
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ----------- |
86
+ | `AppShell.Root` (`bind:sidebarOpen`, `windowInset`), `.Bar` (`center`, `end` snippets), `.Rail`, `.Panes`, `.Sheet` (`flush`), `.Sidebar`, `.Main`, `.Header` (`drag`), `.Panel` (`bind:width`), `.Toggle` (`when`) | The window: its bar, a rail, and one sheet for the sidebar, the page and a side panel | `app-shell` |
87
+ | `Sidebar.Root` (`label`), `.Header` (`drag`), `.Content` (`label`, `pinned` snippet), `.Group` (`label`, `collapsible`, `keepCurrent`, `actions`), `.Folder` (`bind:open`, `leading`, `trailing` snippets), `.Item` (`current`, `picked`, `disabled`, `as`, `itemProps`, `leading`, `trailing`, `meta`, `actions` snippets), `.Switcher` (`leading`, `aside`), `.Footer` | A column of rows, in groups and folders. `Root` is for one on its own; in an app shell the same parts go in `AppShell.Sidebar` | `sidebar` |
88
+ | `Rail.Root` (`label`), `.Item` (`label`, `href`, `current`, `badge`, `badgeTone`, `shortcut`), `.Separator`, `.Spacer` | A narrow strip of places to go: workspaces, settings. On its own beside a page, or in `AppShell.Rail` | `rail` |
89
+ | `ResizeHandle` | A draggable edge between two areas | none |
89
90
 
90
91
  `AppShell.Bar`, `AppShell.Rail` and `AppShell.Sheet` are direct children of `AppShell.Root`; the
91
92
  sidebar, the page and the panel go inside the sheet. The bar is where macOS's traffic lights sit
@@ -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.1'
15
+ library_version: '0.3.2'
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.1'
14
+ library_version: '0.3.2'
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.1'
15
+ library_version: '0.3.2'
16
16
  requires:
17
17
  - setup
18
18
  sources:
@@ -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.1'
14
+ library_version: '0.3.2'
15
15
  requires:
16
16
  - setup
17
17
  sources: