@diegopluna/narvi 0.3.12 → 0.4.0

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 (64) hide show
  1. package/dist/components/app-shell/AppShellHeader.svelte +15 -2
  2. package/dist/components/app-shell/AppShellStrip.svelte +41 -0
  3. package/dist/components/app-shell/AppShellStrip.svelte.d.ts +10 -0
  4. package/dist/components/app-shell/index.d.ts +3 -1
  5. package/dist/components/app-shell/index.js +2 -1
  6. package/dist/components/approval/Approval.svelte +147 -13
  7. package/dist/components/approval/Approval.svelte.d.ts +22 -0
  8. package/dist/components/avatar/AvatarFallback.svelte +2 -1
  9. package/dist/components/avatar/AvatarRoot.svelte +9 -6
  10. package/dist/components/composer/ComposerTray.svelte +150 -10
  11. package/dist/components/composer/ComposerTray.svelte.d.ts +15 -3
  12. package/dist/components/heading/Heading.svelte +2 -1
  13. package/dist/components/kbd/Kbd.svelte +2 -0
  14. package/dist/components/markdown/MarkdownHtml.svelte +7 -3
  15. package/dist/components/markdown/MarkdownTable.svelte +19 -5
  16. package/dist/components/markdown/styles.d.ts +0 -17
  17. package/dist/components/markdown/styles.js +4 -20
  18. package/dist/components/plan/Plan.svelte +146 -28
  19. package/dist/components/plan/Plan.svelte.d.ts +17 -2
  20. package/dist/components/queued-message/QueuedMessage.svelte +178 -49
  21. package/dist/components/queued-message/QueuedMessage.svelte.d.ts +25 -4
  22. package/dist/components/tab-strip/TabStrip.svelte +120 -12
  23. package/dist/components/tab-strip/TabStrip.svelte.d.ts +17 -0
  24. package/dist/components/table/TableBody.svelte +27 -0
  25. package/dist/components/table/TableBody.svelte.d.ts +10 -0
  26. package/dist/components/table/TableCell.svelte +54 -0
  27. package/dist/components/table/TableCell.svelte.d.ts +17 -0
  28. package/dist/components/table/TableFoot.svelte +39 -0
  29. package/dist/components/table/TableFoot.svelte.d.ts +10 -0
  30. package/dist/components/table/TableHead.svelte +33 -0
  31. package/dist/components/table/TableHead.svelte.d.ts +10 -0
  32. package/dist/components/table/TableHeaderCell.svelte +61 -0
  33. package/dist/components/table/TableHeaderCell.svelte.d.ts +17 -0
  34. package/dist/components/table/TableRoot.svelte +144 -0
  35. package/dist/components/table/TableRoot.svelte.d.ts +22 -0
  36. package/dist/components/table/TableRow.svelte +59 -0
  37. package/dist/components/table/TableRow.svelte.d.ts +12 -0
  38. package/dist/components/table/context.d.ts +14 -0
  39. package/dist/components/table/context.js +15 -0
  40. package/dist/components/table/index.d.ts +16 -0
  41. package/dist/components/table/index.js +8 -0
  42. package/dist/components/table/styles.d.ts +56 -0
  43. package/dist/components/table/styles.js +44 -0
  44. package/dist/components/text/Text.svelte +19 -4
  45. package/dist/components/text/Text.svelte.d.ts +4 -2
  46. package/dist/components/work-fold/WorkFold.svelte +26 -1
  47. package/dist/components/work-fold/WorkFold.svelte.d.ts +5 -0
  48. package/dist/index.d.ts +4 -1
  49. package/dist/index.js +7 -1
  50. package/dist/internal/markers.stylex.d.ts +4 -0
  51. package/dist/internal/markers.stylex.js +2 -0
  52. package/dist/internal/table.d.ts +29 -0
  53. package/dist/internal/table.js +34 -0
  54. package/dist/tokens.stylex.d.ts +2 -0
  55. package/dist/tokens.stylex.js +9 -3
  56. package/dist/typography.d.ts +40 -1
  57. package/dist/typography.js +42 -2
  58. package/package.json +1 -1
  59. package/skills/building-ui/SKILL.md +22 -22
  60. package/skills/building-ui/references/components.md +196 -42
  61. package/skills/markdown/SKILL.md +1 -1
  62. package/skills/setup/SKILL.md +1 -1
  63. package/skills/styling/SKILL.md +21 -5
  64. package/skills/theming/SKILL.md +1 -1
@@ -7,46 +7,86 @@ component: import the namespace (`Dialog`) and use `Dialog.Root`. Docs and live
7
7
 
8
8
  ## Layout and text
9
9
 
10
- | Component | Use it for | Docs slug |
11
- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
12
- | `Stack` | Children in a column or a row, with even gaps, by breakpoint | `stack` |
13
- | `Grid` | Children in columns (a count or a template), by breakpoint | `grid` |
14
- | `Card` | A surface that groups related content; `href` makes the whole card a link | `card` |
15
- | `Frame` | A tray around an inset panel, with an optional title: Narvi's signature container | `frame` |
16
- | `Separator` | A thin line between groups | `separator` |
17
- | `Heading` | A title: `level` for the outline, `size` for the look | `heading` |
18
- | `Text` | Text in a role (`variant`: `title`, `reading`, `label`, `body`, `meta`, `caption`, `micro`, `lead`), in the page's face or the display serif | `text` |
19
- | `Link` | A link inside running text | `link` |
20
- | `List.Root`, `.Item` | Rows on one card, with a line between each | `list` |
21
- | `Code` | A short piece of code inside text | `code` |
22
- | `Markdown` | Markdown, streamed or finished: an AI reply, a README (see the `markdown` skill) | `markdown` |
23
- | `Kbd` | A key cap, for shortcuts. Inside a `Button` it takes the button's ink | `kbd` |
24
- | `Reveal` | Eases part of a scrolled page into place. For marketing pages, not apps | `reveal` |
25
- | `Theme` | Sets the scheme or a custom theme for part of the page (see `theming`) | `theme` |
10
+ | Component | Use it for | Docs slug |
11
+ | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
12
+ | `Stack` | Children in a column or a row, with even gaps, by breakpoint | `stack` |
13
+ | `Grid` | Children in columns (a count or a template), by breakpoint | `grid` |
14
+ | `Card` | A surface that groups related content; `href` makes the whole card a link | `card` |
15
+ | `Frame` | A tray around an inset panel, with an optional title: Narvi's signature container | `frame` |
16
+ | `Separator` | A thin line between groups | `separator` |
17
+ | `Heading` | A title: `level` for the outline, `size` for the look | `heading` |
18
+ | `Text` | Text in a role (`variant`: `title`, `reading`, `label`, `body`, `meta`, `caption`, `micro`, `lead`), in the page's face or the display serif | `text` |
19
+ | `Link` | A link inside running text | `link` |
20
+ | `List.Root`, `.Item` | Rows on one card, with a line between each | `list` |
21
+ | `Table.Root` and parts | Rows of data (a CSV file, usage, totals) in a frame that scrolls both ways, with its head and foot kept in view | `table` |
22
+ | `Code` | A short piece of code inside text | `code` |
23
+ | `Markdown` | Markdown, streamed or finished: an AI reply, a README (see the `markdown` skill) | `markdown` |
24
+ | `Kbd` | A key cap, for shortcuts. Inside a `Button` it takes the button's ink, and in a flex row it keeps its width | `kbd` |
25
+ | `Reveal` | Eases part of a scrolled page into place. For marketing pages, not apps | `reveal` |
26
+ | `Theme` | Sets the scheme or a custom theme for part of the page (see `theming`) | `theme` |
27
+
28
+ ### Tables
29
+
30
+ `Table.Root` (`label` is required) holds `Table.Head`, `Table.Body` and `Table.Foot`, each of
31
+ `Table.Row`s of `Table.HeaderCell`s and `Table.Cell`s. Don't draw a `<table>` of your own or copy
32
+ Markdown's table styles: Markdown's tables and this one share their look.
33
+
34
+ ```svelte
35
+ <Table.Root label="usage.csv" rowNumbers truncate style="height: 18rem">
36
+ <Table.Head>
37
+ <Table.Row>
38
+ <Table.HeaderCell>provider</Table.HeaderCell>
39
+ <Table.HeaderCell numeric>tokens</Table.HeaderCell>
40
+ </Table.Row>
41
+ </Table.Head>
42
+ <Table.Body>
43
+ {#each rows as row, at (at)}
44
+ <Table.Row>
45
+ <Table.Cell title={row.provider}>{row.provider}</Table.Cell>
46
+ <Table.Cell numeric>{row.tokens}</Table.Cell>
47
+ </Table.Row>
48
+ {/each}
49
+ </Table.Body>
50
+ </Table.Root>
51
+ ```
52
+
53
+ - Give the root a height (`style="height: 18rem"`, or `sx` with `flexGrow: 1, minHeight: 0` in a
54
+ flex column) and it scrolls inside its edge, the head kept at the top and the foot at the
55
+ bottom. Wide columns scroll sideways without a wrapper of yours. On a card, pass `raised`.
56
+ - `numeric` on a cell, and on its column's header cell, puts it at the end; digits line up in
57
+ every cell. `align` (`start | center | end`) for anything else.
58
+ - `rowNumbers` on the root numbers the body's rows from one; `number` on a `Table.Row` when the
59
+ rows shown are not the first.
60
+ - A cell wraps at 24rem. `truncate` (on the root, or a cell) keeps it to one line: give the cell
61
+ a `title` with the whole of it.
62
+ - `Table.Foot` is for a row of totals. A summary of the table ("120 rows", "Comma separated")
63
+ goes under the root, each part its own `Text variant="caption"`, not joined with a dot.
64
+ - A `Table.HeaderCell` in the body names its row (`scope="row"` is set for you). Cells are in the
65
+ text's face; put `Code` in a cell when the data is code.
26
66
 
27
67
  ## Controls and forms
28
68
 
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`, `justify`, `loading`, `iconOnly`, `pressed`, `tooltip` | `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
- | `ColorField` | A colour: a swatch that opens Narvi's picker, beside a hex field (`label`, `bind:value`, `onchange`, `size`, `labels`) | `color-field` |
42
- | `SplitButton` | A main action joined to a menu of how to do it (`menu`, `menuLabel`, `label`, `variant` incl. `ghost`, `shape`, `mainDisabled`, `mainSx`/`menuSx`, `menuMinWidth`) | `split-button` |
43
- | `Toggle` | A button that stays pressed (`tone`: `accent`, or `neutral` for toolbar icons) | `toggle` |
44
- | `ToggleGroup.Root`, `.Item` | Toggles that belong together: one pressed, or any number | `toggle-group` |
45
- | `SettingsGroup` | A titled group of settings: a heading, an action, the rows on one card | `settings-group` |
46
- | `SettingsRow` | One setting: what it is, beside its control (`leading`, `dimmed`, `mono`) | `settings-row` |
47
- | `Tabs` | Views that share one place (`items: TabItem[]`) | `tabs` |
48
- | `SearchButton` | Looks like a search field and opens search (`label`, `shortcut`): for a window's bar | `search-button` |
49
- | `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` |
69
+ | Component | Use it for | Docs slug |
70
+ | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- |
71
+ | `Button` | An action; `href` makes it a link; `variant` (12, from `primary` to `success-outline`), `size` (`micro` to `lg`), `shape`, `justify`, `loading`, `iconOnly`, `pressed`, `tooltip` | `button` |
72
+ | `Field` | Label, help text and error around one control | `field` |
73
+ | `Input` | One line of text | `input` |
74
+ | `Textarea` | Several lines of text | `textarea` |
75
+ | `Select` | One choice from a short list (`options: { value, label, icon?, detail?, detailMono?, group? }[]`, `align`, `optionIcon`) | `select` |
76
+ | `Checkbox` | An option on or off, or several from a list | `checkbox` |
77
+ | `ChoiceCards` | One choice among a few, each a card with a title and a line of detail | `choice-cards` |
78
+ | `Switch` | A setting that takes effect at once | `switch` |
79
+ | `SegmentedControl` | One of a few options, all visible (`options: { value, label, title? }[]`, `onchange`) | `segmented-control` |
80
+ | `Slider` | A value or a range along a track | `slider` |
81
+ | `ColorField` | A colour: a swatch that opens Narvi's picker, beside a hex field (`label`, `bind:value`, `onchange`, `size`, `labels`) | `color-field` |
82
+ | `SplitButton` | A main action joined to a menu of how to do it (`menu`, `menuLabel`, `label`, `variant` incl. `ghost`, `shape`, `mainDisabled`, `mainSx`/`menuSx`, `menuMinWidth`) | `split-button` |
83
+ | `Toggle` | A button that stays pressed (`tone`: `accent`, or `neutral` for toolbar icons) | `toggle` |
84
+ | `ToggleGroup.Root`, `.Item` | Toggles that belong together: one pressed, or any number | `toggle-group` |
85
+ | `SettingsGroup` | A titled group of settings: a heading, an action, the rows on one card | `settings-group` |
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` |
88
+ | `SearchButton` | Looks like a search field and opens search (`label`, `shortcut`): for a window's bar | `search-button` |
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` |
50
90
 
51
91
  ### Tab strips
52
92
 
@@ -56,7 +96,38 @@ right-click, the menu key, a long press), `onmove(id, index)` (drag, or Alt+Shif
56
96
  for a tab's own buttons, `beside` for the tab shown in a split, and per tab `tabId`, `panelId`,
57
97
  `title`, `renamable`. Arrows open the tab they reach (`activation="manual"` only moves focus);
58
98
  `onchange(id)`; a name cleared comes as `''`; `addMenu` (Menu parts) makes the add button open
59
- a menu.
99
+ a menu. A middle click anywhere on a tab calls `onclose` (and neither scrolls nor pastes).
100
+
101
+ A preview tab, which the next one opened replaces, is `temporary: true`: in italics and said as
102
+ "preview". A double-click on it calls `onkeep(id)` instead of renaming; set its `temporary` to
103
+ false there, and offer "Keep open" in its `menu` for the keyboard. Don't mark tabs with a
104
+ `MutationObserver`, or listen for `dblclick` or `auxclick` around the strip: the strip does it.
105
+
106
+ Workspace tabs across the page's header take `variant="notch"`: the open tab is the colour of the
107
+ page under the header and runs down into it, with a curve each side and no line or shadow. Put
108
+ the strip in `AppShell.Strip`, which runs the header's full height; the header then becomes a
109
+ band of `colors.bg` with no line under it, and its other parts stay centred. Give the band
110
+ another colour with the header's `sx`, and if the page under it is not `colors.bgRaised`, set
111
+ `--narvi-tab-surface` to its colour (StyleX tokens can't be read from plain CSS, so don't copy
112
+ the colour into global CSS of your own).
113
+
114
+ ```svelte
115
+ <AppShell.Header>
116
+ <AppShell.Toggle when="closed" />
117
+ <AppShell.Strip>
118
+ <TabStrip
119
+ variant="notch"
120
+ label="Open tabs"
121
+ {tabs}
122
+ bind:value
123
+ onclose={closeTab}
124
+ onkeep={keepTab}
125
+ onadd={newTab}
126
+ />
127
+ </AppShell.Strip>
128
+ <Button size="sm" variant="ghost" iconOnly aria-label="Show the panel">…</Button>
129
+ </AppShell.Header>
130
+ ```
60
131
 
61
132
  ### Colour fields
62
133
 
@@ -126,7 +197,7 @@ errors with an `Announcer` too.
126
197
 
127
198
  | Component | Use it for | Docs slug |
128
199
  | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ----------- |
129
- | `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` |
200
+ | `AppShell.Root` (`bind:sidebarOpen`, `windowInset`), `.Bar` (`center`, `end` snippets), `.Rail`, `.Panes`, `.Sheet` (`flush`), `.Sidebar`, `.Main`, `.Header` (`drag`, `divider`), `.Strip`, `.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` |
130
201
  | `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` |
131
202
  | `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` |
132
203
  | `ResizeHandle` | A draggable edge between two areas | none |
@@ -263,11 +334,11 @@ Docs slug: `agent-timeline`.
263
334
  | Component | Use it for |
264
335
  | ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
265
336
  | `Activity.Root`, `.Trigger`, `.Content`, `.Step`, `.Thought`, `.Icon` | A stretch of work: says what the agent is doing, then what it did. `.Icon` starts a row of your own |
266
- | `WorkFold` | Folds a finished turn's work behind "Worked for 2m 5s" |
267
- | `Plan` (`steps: { label, status }[]`) | What the agent means to do, ticked off as it goes |
337
+ | `WorkFold` (`label`, `trailing`) | Folds a finished turn's work behind "Worked for 2m 5s"; `trailing` puts the turn's totals (a `ChangeStats`) on that line, outside the button |
338
+ | `Plan` (`steps: { label, status }[]`) | What the agent means to do, ticked off as it goes; `fold` for the tray, `bare` and `title={null}` in a card |
268
339
  | `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 |
269
340
  | `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` |
270
- | `QueuedMessage` | A message sent while the agent was still working, waiting its turn (`attachments`, `disabled`) |
341
+ | `QueuedMessage` | A message sent while the agent was still working, waiting its turn (`attachments`, `disabled`, `detail`); `compact` with a `handle` for the tray |
271
342
  | `ChangesSummary` (`ChangedFile[]`), `ChangeStats` (`additions`, `deletions`) | What a turn changed, and +12 −3 counts |
272
343
  | `Divider` (`label`, or children; `role`) | A labelled break in a timeline: a new day, "Context compacted" |
273
344
 
@@ -288,6 +359,89 @@ to fit and in the step's colour. Inside an opened row the icon stays quiet: grey
288
359
  with its spinner (the row above is what is lit), and a faint red when it did not go through, its
289
360
  badge saying it in words. Don't recolour it with a wrapper of your own.
290
361
 
362
+ A timeline row of your own starts with `Activity.Icon` (`kind`, `tone`, `spinning`, or your own
363
+ icon as children), as the others' do. `Activity.Thought` takes a snippet, such as Markdown, in
364
+ place of `text`. `Activity.Step` takes `wrap` for a label that runs on, and `status="neutral"` for
365
+ a step that settled without going through or failing ("Skipped", `statusLabels.neutral`); it and
366
+ `WorkFold` pass `data-*` attributes on.
367
+
368
+ ### The composer's tray
369
+
370
+ Read this when putting what waits on the person in `Composer.Tray`. The tray keeps itself short:
371
+ the request nearest the composer, and what waits behind it in a region that scrolls.
372
+
373
+ ```svelte
374
+ <script lang="ts">
375
+ import { Approval, Button, Composer, Plan, QueuedMessage } from '@diegopluna/narvi';
376
+
377
+ let shown = $state(0); // which of the waiting approvals is shown
378
+ </script>
379
+
380
+ <Composer.Tray>
381
+ {#snippet queue()}
382
+ <Plan fold steps={plan} />
383
+ {#each queued as message, index (message.id)}
384
+ <QueuedMessage
385
+ compact
386
+ status={editing === message.id ? 'editing' : 'queued'}
387
+ onedit={() => edit(message)}
388
+ ontakeback={() => takeBack(message)}
389
+ >
390
+ {#snippet handle()}
391
+ <Button variant="ghost" size="xs" iconOnly aria-label="Move queued message, {index + 1}">
392
+ <GripVertical />
393
+ </Button>
394
+ {/snippet}
395
+ {message.text}
396
+ </QueuedMessage>
397
+ {/each}
398
+ {/snippet}
399
+ {#snippet pending()}
400
+ {#if approvals.length}
401
+ {@const ask = approvals[shown]}
402
+ <Approval
403
+ compact
404
+ title="Run this command?"
405
+ command={ask.command}
406
+ index={shown}
407
+ count={approvals.length}
408
+ onindexchange={(index) => (shown = index)}
409
+ choices={ask.choices}
410
+ onchoose={(value) => answer(ask, value)}
411
+ />
412
+ {/if}
413
+ {/snippet}
414
+ <Composer.Root>…</Composer.Root>
415
+ </Composer.Tray>
416
+ ```
417
+
418
+ - **`queue`** holds the folded `Plan` and compact `QueuedMessage`s. It scrolls once taller than
419
+ `queueMaxHeight` (about a folded plan and four rows), with room at its edges for its buttons'
420
+ focus rings and 40px hit areas. Don't wrap it in a scrolling `div` of your own: that cuts them
421
+ off.
422
+ - **The shelf opens only for what has height.** The tray measures `pending` and `queue`: an empty
423
+ wrapper (hidden, or holding only whitespace, comments or empty elements) opens nothing, and a
424
+ queue holding only one takes no room. `waiting` overrides it: `true` holds the shelf open,
425
+ `false` keeps it shut. Held open with nothing to see, it warns in the console while developing
426
+ (`Composer.Tray "<label>": the shelf is open, but what is in it measures 0px tall`): render
427
+ nothing when nothing waits, or drop `waiting`. Before hydration the shelf is shut, so a
428
+ server-rendered page shows what waits once the app is running.
429
+ - **`Approval`**: `compact` takes less room (the command on one line that scrolls sideways).
430
+ With several waiting, show one with `index` (from 0) and `count`; it says "2 of 3", and with
431
+ `onindexchange` it has buttons to the others that wrap round. Clamp `index` when one is
432
+ answered and leaves. Its `mod` shortcuts answer the one shown, and leave the key to a field
433
+ with words typed in it: a textarea, an input, or a contenteditable editor (ProseMirror) whose
434
+ text isn't empty. An editor's placeholder must not be text in the element.
435
+ - **`Plan`**: `fold` is one row with the step under way (or the next, or the last once all are
436
+ done) and "1 of 3", opening to every step; `bind:open`. Outside the tray, `bare` drops its
437
+ edge and padding inside a card of yours, and `title={null}` its title (it is still named
438
+ "Plan", or by `aria-label`).
439
+ - **`QueuedMessage`**: `compact` is one line, cut with an ellipsis, so give it words, not
440
+ blocks. `handle` is a snippet at its start: put your drag-and-drop library's attachment on
441
+ the Button (Narvi's Button passes `{@attach}` on). `status` and `statusText` are one word;
442
+ what it means goes in `detail`, shown in a tooltip and read after the word. Never join them
443
+ with a dot. `attachments` sits after the words in the row: keep it to a count.
444
+
291
445
  ## Utilities
292
446
 
293
447
  - `sx()`, `classes()` and the `Sx` type: see the `styling` skill.
@@ -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.12'
15
+ library_version: '0.4.0'
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.12'
14
+ library_version: '0.4.0'
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.12'
15
+ library_version: '0.4.0'
16
16
  requires:
17
17
  - setup
18
18
  sources:
@@ -91,11 +91,27 @@ package root) breaks them.
91
91
  - `font`: `body` (inherits the page), `display` (the heading serif), `mono`; the weights
92
92
  `weightRegular`, `weightMedium` and `weightSemibold`; the line heights `leadingTight`,
93
93
  `leadingSnug` and `leadingNormal`; and sizes named for what they set: `sizeMicro` (11px),
94
- `sizeCaption` (12), `sizeMeta` (13), `sizeBody` (14), `sizeReading` (16), `sizeTitle` (17)
95
- and `sizeFigure` (28, a number that is the point of its place). Prefer a whole role to a
96
- size: `import { typography } from '@diegopluna/narvi'` gives `figure`, `title`, `reading`,
97
- `label`, `body`, `meta`, `caption` and `micro`, each a size, a weight and a line height, for
94
+ `sizeCaption` (12), `sizeMeta` (13), `sizeBody` (14), `sizeReading` (16), `sizeTitle` (17,
95
+ a dialog's, a section's or a detail page's title), and three figure sizes for a number that
96
+ is the point of its place, named for where it stands: `sizeFigureTile` (24, one among
97
+ several in a tile or a grid of totals), `sizeFigure` (36, the figure a card is about) and
98
+ `sizeFigurePage` (48, the one figure a page or view is about). Prefer a whole role to a
99
+ size: `import { typography } from '@diegopluna/narvi'` gives `figurePage`, `figure`,
100
+ `figureTile`, `title`, `reading`, `label`, `body`, `meta`, `caption` and `micro`, each a
101
+ size, a weight and a line height (the figures with `tabular-nums`), for
98
102
  `stylex.attrs(typography.caption, styles.count)`.
103
+ - There is no step between `title` (17) and `figureTile` (24). A page or detail heading
104
+ that wants 18px takes `title` (or `Heading size="lg"`, which is the same 17px); don't
105
+ write `1.125rem`.
106
+ - Pick a figure by where it stands, not by how big it should look: three figures side by
107
+ side are `figureTile`, even on a page.
108
+ - A letter inside a small mark (an avatar's initials, a monogram, the letter badge on a
109
+ provider's mark) takes no role and no written size. `import { monogram } from
110
+ '@diegopluna/narvi'`: `monogram.mark` on the mark (the box with a width and a height),
111
+ `monogram.letter` on the letter, or on a badge inside the mark. The letter is a quarter of
112
+ the mark's shorter side plus 4px (a 16px mark gives 8px, 24px gives 10px) and follows the
113
+ mark when it is resized. Without `monogram.mark` on an ancestor the letter is sized from the
114
+ window, so never use `monogram.letter` alone. `Avatar` already does this.
99
115
  - `visuallyHidden` (from the package root) hides an element from sight and keeps it for
100
116
  assistive technology: `stylex.attrs(visuallyHidden)`. Don't write your own.
101
117
  - `focusRing` (from the package root) is focus as Narvi's parts show it. `focusRing.ring` goes on
@@ -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.3.12'
15
+ library_version: '0.4.0'
16
16
  requires:
17
17
  - setup
18
18
  sources: