@diegopluna/narvi 0.3.0 → 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 (47) hide show
  1. package/README.md +3 -1
  2. package/dist/components/app-shell/AppShellMain.svelte +5 -1
  3. package/dist/components/badge/Badge.svelte +16 -1
  4. package/dist/components/badge/Badge.svelte.d.ts +3 -0
  5. package/dist/components/button/Button.svelte +46 -7
  6. package/dist/components/hover-card/HoverCardContent.svelte +1 -1
  7. package/dist/components/menu/ContextMenuTrigger.svelte +14 -2
  8. package/dist/components/menu/ContextMenuTrigger.svelte.d.ts +10 -0
  9. package/dist/components/menu/MenuCheckboxItem.svelte +8 -2
  10. package/dist/components/menu/MenuCheckboxItem.svelte.d.ts +6 -0
  11. package/dist/components/menu/MenuGroup.svelte +16 -0
  12. package/dist/components/menu/MenuGroup.svelte.d.ts +6 -0
  13. package/dist/components/menu/MenuLabel.svelte +22 -8
  14. package/dist/components/menu/MenuRadioGroup.svelte +16 -0
  15. package/dist/components/menu/MenuRadioGroup.svelte.d.ts +6 -0
  16. package/dist/components/menu/group.d.ts +2 -0
  17. package/dist/components/menu/group.js +9 -0
  18. package/dist/components/menu/index.d.ts +4 -2
  19. package/dist/components/menu/index.js +2 -2
  20. package/dist/components/settings-row/SettingsRow.svelte +13 -2
  21. package/dist/components/settings-row/SettingsRow.svelte.d.ts +7 -1
  22. package/dist/components/sidebar/SidebarContent.svelte +59 -13
  23. package/dist/components/sidebar/SidebarContent.svelte.d.ts +6 -0
  24. package/dist/components/sidebar/SidebarFolder.svelte +44 -12
  25. package/dist/components/sidebar/SidebarGroup.svelte +50 -7
  26. package/dist/components/sidebar/SidebarGroup.svelte.d.ts +10 -1
  27. package/dist/components/sidebar/SidebarItem.svelte +139 -24
  28. package/dist/components/sidebar/SidebarItem.svelte.d.ts +22 -2
  29. package/dist/components/sidebar/SidebarSwitcher.svelte +18 -2
  30. package/dist/components/sidebar/SidebarSwitcher.svelte.d.ts +2 -0
  31. package/dist/components/sidebar/depth.d.ts +8 -6
  32. package/dist/components/sidebar/depth.js +7 -5
  33. package/dist/components/sidebar/fold.d.ts +12 -0
  34. package/dist/components/sidebar/fold.js +8 -0
  35. package/dist/components/status-indicator/StatusDot.svelte +90 -0
  36. package/dist/components/status-indicator/StatusDot.svelte.d.ts +18 -0
  37. package/dist/index.d.ts +3 -1
  38. package/dist/index.js +1 -0
  39. package/dist/vite.d.ts +15 -6
  40. package/dist/vite.js +38 -0
  41. package/package.json +1 -1
  42. package/skills/building-ui/SKILL.md +42 -8
  43. package/skills/building-ui/references/components.md +7 -6
  44. package/skills/markdown/SKILL.md +1 -1
  45. package/skills/setup/SKILL.md +9 -11
  46. package/skills/styling/SKILL.md +1 -1
  47. package/skills/theming/SKILL.md +1 -1
@@ -1,14 +1,16 @@
1
1
  import { getContext, setContext } from 'svelte';
2
2
  const KEY = Symbol('narvi.sidebar.depth');
3
3
  /**
4
- * How many folders a row sits in. A row is set in by its text, not its box: its highlight
5
- * runs the sidebar's width, as its folder's does, and its title starts where the folder's
6
- * name does: 1.5rem a level, a folder's mark (1rem) and the gap after it (0.5rem). The rows
7
- * write that in their own styles, as StyleX reads only its own files' constants.
4
+ * How far a row is set in, in steps of 1.5rem: an icon's slot (1rem) and the gap after it
5
+ * (0.5rem). A row is set in by its text, not its box: its highlight runs the sidebar's width,
6
+ * as its folder's does, and its title starts where the folder's name does. A folder takes a
7
+ * step for its chevron, and another for its mark when it has one. The rows write the step in
8
+ * their own styles, as StyleX reads only its own files' constants.
8
9
  */
9
10
  export function getSidebarDepth() {
10
- return getContext(KEY) ?? 0;
11
+ return getContext(KEY) ?? (() => 0);
11
12
  }
13
+ /** For a folder's rows: a getter, as whether the folder has a mark can change. */
12
14
  export function setSidebarDepth(depth) {
13
15
  setContext(KEY, depth);
14
16
  }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Whether the rows under a group or folder are folded away, and a way for the open row to stay
3
+ * in view while they are: a current row holds its group and folders open, and the rest of the
4
+ * rows hide. A folder passes the hold on, so the group above it stays open too.
5
+ */
6
+ export type SidebarFold = {
7
+ folded: () => boolean;
8
+ /** Called by a current row; returns the release. */
9
+ hold: () => () => void;
10
+ };
11
+ export declare function getSidebarFold(): SidebarFold | undefined;
12
+ export declare function setSidebarFold(fold: SidebarFold | undefined): void;
@@ -0,0 +1,8 @@
1
+ import { getContext, setContext } from 'svelte';
2
+ const KEY = Symbol('narvi.sidebar.fold');
3
+ export function getSidebarFold() {
4
+ return getContext(KEY);
5
+ }
6
+ export function setSidebarFold(fold) {
7
+ setContext(KEY, fold);
8
+ }
@@ -0,0 +1,90 @@
1
+ <!--
2
+ A dot of status colour, small enough to sit beside a name or on the corner of a mark: a
3
+ machine that is reachable, a thread with something new, a workspace at work. Its shape can say
4
+ it too, for those who cannot tell the colours apart: a ring while something is on its way, a
5
+ diamond when it failed. For a run's status, with a shape for each, use StatusIndicator.
6
+ -->
7
+ <script lang="ts" module>
8
+ import * as stylex from '@stylexjs/stylex';
9
+ import { attrs, type Sx } from '../../internal/sx.js';
10
+ import { colors, radius } from '../../tokens.stylex.js';
11
+
12
+ export type StatusDotTone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger';
13
+ export type StatusDotShape = 'dot' | 'ring' | 'diamond';
14
+
15
+ export type StatusDotProps = {
16
+ /** `accent` for something live or new; `success`, `warning` and `danger` once settled. */
17
+ tone?: StatusDotTone | undefined;
18
+ /** `ring` for something on its way, `diamond` for a failure; a filled dot otherwise. */
19
+ shape?: StatusDotShape | undefined;
20
+ /** Width and height, in pixels. */
21
+ size?: number | undefined;
22
+ /** Names it for assistive technology. Without one it is hidden, as words beside it say it. */
23
+ label?: string | null | undefined;
24
+ sx?: Sx | undefined;
25
+ class?: string | undefined;
26
+ };
27
+
28
+ const styles = stylex.create({
29
+ root: {
30
+ display: 'inline-block',
31
+ flexShrink: 0,
32
+ boxSizing: 'border-box',
33
+ borderRadius: radius.pill,
34
+ verticalAlign: 'middle',
35
+ forcedColorAdjust: 'none'
36
+ },
37
+ ring: { backgroundColor: 'transparent' },
38
+ // A square on its point, a little smaller, so it weighs what the dot does
39
+ diamond: { borderRadius: '1px', transform: 'scale(0.75) rotate(45deg)' }
40
+ });
41
+
42
+ const fills = stylex.create({
43
+ neutral: { backgroundColor: colors.textSubtle },
44
+ accent: { backgroundColor: colors.accent },
45
+ success: { backgroundColor: colors.success },
46
+ warning: { backgroundColor: colors.warning },
47
+ danger: { backgroundColor: colors.danger }
48
+ });
49
+
50
+ const rings = stylex.create({
51
+ neutral: { boxShadow: `inset 0 0 0 1px ${colors.textSubtle}` },
52
+ accent: { boxShadow: `inset 0 0 0 1px ${colors.accent}` },
53
+ success: { boxShadow: `inset 0 0 0 1px ${colors.success}` },
54
+ warning: { boxShadow: `inset 0 0 0 1px ${colors.warning}` },
55
+ danger: { boxShadow: `inset 0 0 0 1px ${colors.danger}` }
56
+ });
57
+ </script>
58
+
59
+ <script lang="ts">
60
+ let {
61
+ tone = 'neutral',
62
+ shape = 'dot',
63
+ size = 6,
64
+ label,
65
+ sx,
66
+ class: className
67
+ }: StatusDotProps = $props();
68
+ </script>
69
+
70
+ <span
71
+ role={label ? 'img' : undefined}
72
+ aria-label={label || undefined}
73
+ aria-hidden={label ? undefined : true}
74
+ data-slot="status-dot"
75
+ data-tone={tone}
76
+ data-shape={shape}
77
+ {...attrs(
78
+ [
79
+ styles.root,
80
+ fills[tone],
81
+ shape === 'ring' && styles.ring,
82
+ shape === 'ring' && rings[tone],
83
+ shape === 'diamond' && styles.diamond,
84
+ sx
85
+ ],
86
+ className
87
+ )}
88
+ style:width="{size}px"
89
+ style:height="{size}px"
90
+ ></span>
@@ -0,0 +1,18 @@
1
+ import { type Sx } from '../../internal/sx.js';
2
+ export type StatusDotTone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger';
3
+ export type StatusDotShape = 'dot' | 'ring' | 'diamond';
4
+ export type StatusDotProps = {
5
+ /** `accent` for something live or new; `success`, `warning` and `danger` once settled. */
6
+ tone?: StatusDotTone | undefined;
7
+ /** `ring` for something on its way, `diamond` for a failure; a filled dot otherwise. */
8
+ shape?: StatusDotShape | undefined;
9
+ /** Width and height, in pixels. */
10
+ size?: number | undefined;
11
+ /** Names it for assistive technology. Without one it is hidden, as words beside it say it. */
12
+ label?: string | null | undefined;
13
+ sx?: Sx | undefined;
14
+ class?: string | undefined;
15
+ };
16
+ declare const StatusDot: import("svelte").Component<StatusDotProps, {}, "">;
17
+ type StatusDot = ReturnType<typeof StatusDot>;
18
+ export default StatusDot;
package/dist/index.d.ts CHANGED
@@ -65,7 +65,7 @@ export type { KbdProps } from './components/kbd/Kbd.svelte';
65
65
  export { default as Link } from './components/link/Link.svelte';
66
66
  export type { LinkProps } from './components/link/Link.svelte';
67
67
  export * as Menu from './components/menu/index.js';
68
- export type { MenuCheckboxItemProps, MenuContentProps, MenuItemProps, MenuLabelProps, MenuRadioItemProps, MenuSeparatorProps, MenuSubContentProps, MenuSubTriggerProps } from './components/menu/index.js';
68
+ export type { MenuCheckboxItemProps, MenuContentProps, MenuGroupProps, MenuItemProps, MenuLabelProps, MenuRadioGroupProps, MenuRadioItemProps, MenuSeparatorProps, MenuSubContentProps, MenuSubTriggerProps } from './components/menu/index.js';
69
69
  export * as Message from './components/message/index.js';
70
70
  export type { MessageActionProps, MessageActionsProps, MessageContentProps, MessageCopyProps, MessageFrom, MessageHeaderProps, MessagePendingProps, MessageRootProps, MessageTimeProps } from './components/message/index.js';
71
71
  export { default as Markdown } from './components/markdown/Markdown.svelte';
@@ -127,6 +127,8 @@ export type { StackAlign, StackDirection, StackGap, StackJustify, StackProps } f
127
127
  export * as Suggestions from './components/suggestions/index.js';
128
128
  export type { SuggestionsItemProps, SuggestionsRootProps } from './components/suggestions/index.js';
129
129
  export { default as StatusIndicator } from './components/status-indicator/StatusIndicator.svelte';
130
+ export { default as StatusDot } from './components/status-indicator/StatusDot.svelte';
131
+ export type { StatusDotProps, StatusDotShape, StatusDotTone } from './components/status-indicator/StatusDot.svelte';
130
132
  export type { Status, StatusIndicatorProps } from './components/status-indicator/StatusIndicator.svelte';
131
133
  export { default as Switch } from './components/switch/Switch.svelte';
132
134
  export type { SwitchProps } from './components/switch/Switch.svelte';
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/dist/vite.d.ts CHANGED
@@ -12,12 +12,8 @@ export type NarviOptions = StylexOptions & {
12
12
  * For apps that use Tailwind CSS 4. Places Narvi's layer after Tailwind's
13
13
  * `base` (so Preflight does not undo Narvi) and before its `components` and
14
14
  * `utilities` (so a class such as `hidden sm:inline-flex` overrides a
15
- * component). Also add this line to the top of your stylesheet, before
16
- * `@import "tailwindcss"`:
17
- *
18
- * ```css
19
- * @layer theme, base, narvi, components, utilities;
20
- * ```
15
+ * component). Every stylesheet that names one of these layers starts with the
16
+ * order (`TAILWIND_ORDER`), so it holds whichever the browser reads first.
21
17
  */
22
18
  tailwind?: boolean | undefined;
23
19
  };
@@ -30,6 +26,19 @@ export declare const CSS_TARGET: string[];
30
26
  export declare const NARVI_LAYER = "narvi";
31
27
  /** The layer inside it that holds `@diegopluna/narvi/base.css`, below every component. */
32
28
  export declare const BASE_LAYER = "narvi.base";
29
+ /**
30
+ * The order of Narvi's layer among Tailwind's, as the first rule of a stylesheet. With
31
+ * `narvi({ tailwind: true })` the plugin writes it at the top of each one that names a layer.
32
+ */
33
+ export declare const TAILWIND_ORDER = "@layer theme, base, narvi.base, components, utilities;";
34
+ /**
35
+ * Puts Tailwind's layer order, with Narvi's in it, at the top of a stylesheet that names one of
36
+ * those layers. The browser orders layers as it first meets their names, and the first stylesheet
37
+ * on the page need not be the app's: a component's own stylesheet, such as the one that sizes
38
+ * icons, can load first. Naming `narvi` there before Tailwind's layers put Narvi below `base`,
39
+ * where Preflight's reset undid it. Returns `undefined` when the stylesheet is left as it is.
40
+ */
41
+ export declare function orderLayers(code: string, id: string): string | undefined;
33
42
  /**
34
43
  * Vite plugin that compiles Narvi's styles (and any StyleX you write yourself).
35
44
  *
package/dist/vite.js CHANGED
@@ -11,6 +11,31 @@ export const CSS_TARGET = ['chrome123', 'edge123', 'firefox120', 'safari17.5'];
11
11
  export const NARVI_LAYER = 'narvi';
12
12
  /** The layer inside it that holds `@diegopluna/narvi/base.css`, below every component. */
13
13
  export const BASE_LAYER = `${NARVI_LAYER}.base`;
14
+ /**
15
+ * The order of Narvi's layer among Tailwind's, as the first rule of a stylesheet. With
16
+ * `narvi({ tailwind: true })` the plugin writes it at the top of each one that names a layer.
17
+ */
18
+ export const TAILWIND_ORDER = `@layer theme, base, ${BASE_LAYER}, components, utilities;`;
19
+ // A stylesheet Vite compiles, including a Svelte component's (`?svelte&type=style&lang.css`),
20
+ // and not one imported as a URL or as text.
21
+ const CSS_RE = /\.(?:css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
22
+ const NOT_CSS_RE = /[?&](?:raw|url|worker|sharedworker)\b/;
23
+ // A rule or a statement that names Narvi's layer or one of Tailwind's.
24
+ const NAMES_LAYER_RE = /@layer\s+(?:narvi|theme|base|components|utilities)\b/;
25
+ /**
26
+ * Puts Tailwind's layer order, with Narvi's in it, at the top of a stylesheet that names one of
27
+ * those layers. The browser orders layers as it first meets their names, and the first stylesheet
28
+ * on the page need not be the app's: a component's own stylesheet, such as the one that sizes
29
+ * icons, can load first. Naming `narvi` there before Tailwind's layers put Narvi below `base`,
30
+ * where Preflight's reset undid it. Returns `undefined` when the stylesheet is left as it is.
31
+ */
32
+ export function orderLayers(code, id) {
33
+ if (!CSS_RE.test(id) || NOT_CSS_RE.test(id) || !NAMES_LAYER_RE.test(code))
34
+ return undefined;
35
+ // `@charset` must stay first; the order may come before any `@import`
36
+ const charset = /^@charset\s+"[^"]*";\s*/.exec(code)?.[0] ?? '';
37
+ return `${charset}${TAILWIND_ORDER}\n${code.slice(charset.length)}`;
38
+ }
14
39
  /**
15
40
  * Vite plugin that compiles Narvi's styles (and any StyleX you write yourself).
16
41
  *
@@ -55,6 +80,8 @@ export function narvi({ tailwind = false, ...options } = {}) {
55
80
  const configureServer = plugin.configureServer;
56
81
  const config = plugin.config;
57
82
  const configResolved = plugin.configResolved;
83
+ // StyleX's hook is a plain function, not an object with a `handler`
84
+ const transform = plugin.transform;
58
85
  const self = {
59
86
  ...plugin,
60
87
  // Vite lowers the CSS it bundles for its default targets, which are older than
@@ -72,6 +99,17 @@ export function narvi({ tailwind = false, ...options } = {}) {
72
99
  assertAfterSvelte(config.plugins, self);
73
100
  return configResolved?.call(this, config);
74
101
  },
102
+ // StyleX compiles scripts. With Tailwind, a stylesheet that names a layer (one of Narvi's
103
+ // components', the app's, Tailwind's own output) is given the order first. Vite hands it
104
+ // here after compiling it, and before turning it into a module or a bundle.
105
+ transform(code, id, options) {
106
+ if (tailwind) {
107
+ const ordered = orderLayers(code, id);
108
+ if (ordered !== undefined)
109
+ return { code: ordered, map: null };
110
+ }
111
+ return transform?.call(this, code, id, options);
112
+ },
75
113
  // The StyleX plugin defaults to `enforce: 'pre'`, which would hand it raw
76
114
  // `.svelte` source. Dropping `enforce` lets the Svelte compiler go first.
77
115
  enforce: undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopluna/narvi",
3
- "version": "0.3.0",
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.0'
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
@@ -219,6 +223,9 @@ of the heading), which lays them on one card with a line between each, and each
219
223
  - The row's label is a `<label for>` the control. For a group (`SegmentedControl`, radios,
220
224
  several buttons) or a control that labels itself (a `Switch` with children), set
221
225
  `labelFor={false}` and pass `labelId` to the control's `aria-labelledby`.
226
+ - The row makes the control's id. Where the app needs a fixed one (search, a deep link, a
227
+ test), pass `controlId="settings-branch-prefix"`: the label's `for` names it and `children`
228
+ receives it as `id`. Don't keep a row of your own for that.
222
229
  - Attributes such as `id`, `tabindex` and `data-*` go on the row's element (and on the group's
223
230
  `<section>`), so search can scroll to one and focus it. Set `highlighted` for a moment as it
224
231
  lands to light it.
@@ -286,17 +293,22 @@ line, `lines={2}` for several). Use `Code` and `Kbd` inline, and
286
293
  over a busy background, such as an image behind the composer),
287
294
  `EmptyState` for an empty place, `Skeleton`, `Spinner` or `Progress` while loading, and
288
295
  `StatusIndicator` (`status`: idle, working, waiting, done, failed, stopped, connecting) for where
289
- 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.
290
299
 
291
300
  ### Lists, badges and folds
292
301
 
293
302
  - Rows on one card with a line between each: `List.Root` (a `ul`, or `as="div"`) holding
294
303
  `List.Item`s, or rows of your own. Don't redraw the card and its lines.
295
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.
296
307
  - `Collapsible.Trigger` takes `chevron="start"` to put the chevron before its label, as in a tree.
297
308
  - `Tabs` and `SegmentedControl` options take an `icon` (a component, sized to fit) and a
298
309
  `title` that names a short label in full, as a tooltip and the item's description.
299
- - 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…"`
300
312
  says what it is doing beside the spinner instead. `variant="link"` sits in a sentence, at its
301
313
  size, with no padding.
302
314
 
@@ -319,10 +331,32 @@ Parts of the shell that are easy to redraw by hand, and shouldn't be:
319
331
  - **A workspace switcher:** `Sidebar.Switcher` is a row with the workspace's mark (`leading`),
320
332
  its name and a selector glyph. Put it in a `Menu.Trigger`'s `child` and spread the props:
321
333
  `{#snippet child({ props })}<Sidebar.Switcher {...props}>…</Sidebar.Switcher>{/snippet}`.
322
- - **Rows in folders** are set in by their text, not their box: give a folder's mark as its
323
- `leading` and its rows line up on their own. Don't pad rows or folders yourself.
324
- - **A listbox of results** from Sidebar rows: `<Sidebar.Item as="div" role="option" aria-selected>`
325
- inside your `role="listbox"`, so no list item stands between the box and its options.
334
+ An `aside` snippet sits just after the name, such as a `StatusDot`.
335
+ - **Rows in folders** are set in by their text, not their box. A folder's chevron comes first,
336
+ on the edge of the rows' icons; give its mark as `leading` and it follows the chevron. Its
337
+ rows line up on their own, their titles under the folder's name, with a mark or without.
338
+ Don't pad rows or folders yourself.
339
+ - **The open row** (`current`) is a flat fill; its title keeps its weight. Don't bold it
340
+ yourself: a heavier title is wider, so it cuts off at a different point as the person moves.
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.
326
360
  - **TabStrip** tabs narrow to an ellipsis before the strip scrolls. With a `leading` icon, a
327
361
  tab's close button takes the icon's place, so no room is kept at its end.
328
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.0'
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.0'
14
+ library_version: '0.3.2'
15
15
  sources:
16
16
  - src/lib/vite.ts
17
17
  - src/lib/base.css
@@ -132,7 +132,7 @@ need to spread a prop only when it is set. That holds for the parts Narvi takes
132
132
  ## With Tailwind CSS 4
133
133
 
134
134
  Out of the box, Narvi's layer comes after Tailwind's, so a utility such as `hidden` on a Button
135
- changes nothing. Both of these changes are needed:
135
+ changes nothing. Set the plugin's `tailwind` option:
136
136
 
137
137
  ```ts
138
138
  // vite.config.ts
@@ -146,15 +146,13 @@ export default defineConfig({
146
146
  });
147
147
  ```
148
148
 
149
- ```css
150
- /* src/app.css: the order line comes first, before any @import */
151
- @layer theme, base, narvi, components, utilities;
152
- @import 'tailwindcss';
153
- ```
154
-
155
- The browser fixes the layer order from whichever stylesheet it reads first, and in development
156
- that can be either one, so the plugin option and the CSS line are both needed. Narvi still beats
157
- Preflight. Utilities replace whole properties: `p-0` on a Card removes its padding, not a part of it.
149
+ The browser fixes the layer order from whichever stylesheet names the layers first, and that can
150
+ be one of Narvi's components' (the one that sizes icons, from 0.3) rather than the app's. With the
151
+ option, the plugin starts every stylesheet that names Narvi's layer or one of Tailwind's with
152
+ `@layer theme, base, narvi.base, components, utilities;` (exported as `TAILWIND_ORDER`), so the
153
+ order holds whichever loads first: Narvi beats Preflight, and utilities beat Narvi. No line in
154
+ `app.css` is needed; one written for an earlier version does no harm. Utilities replace whole
155
+ properties: `p-0` on a Card removes its padding, not a part of it.
158
156
 
159
157
  ## Common mistakes
160
158
 
@@ -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.0'
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.0'
14
+ library_version: '0.3.2'
15
15
  requires:
16
16
  - setup
17
17
  sources: