@diegopluna/narvi 0.3.13 → 0.4.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 (66) 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/ComposerModelPicker.svelte +15 -1
  11. package/dist/components/composer/ComposerTray.svelte +150 -10
  12. package/dist/components/composer/ComposerTray.svelte.d.ts +15 -3
  13. package/dist/components/heading/Heading.svelte +2 -1
  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 +185 -49
  21. package/dist/components/queued-message/QueuedMessage.svelte.d.ts +26 -4
  22. package/dist/components/rail/RailItem.svelte +20 -6
  23. package/dist/components/sidebar/SidebarItem.svelte +8 -3
  24. package/dist/components/tab-strip/TabStrip.svelte +140 -17
  25. package/dist/components/tab-strip/TabStrip.svelte.d.ts +23 -1
  26. package/dist/components/table/TableBody.svelte +27 -0
  27. package/dist/components/table/TableBody.svelte.d.ts +10 -0
  28. package/dist/components/table/TableCell.svelte +54 -0
  29. package/dist/components/table/TableCell.svelte.d.ts +17 -0
  30. package/dist/components/table/TableFoot.svelte +39 -0
  31. package/dist/components/table/TableFoot.svelte.d.ts +10 -0
  32. package/dist/components/table/TableHead.svelte +33 -0
  33. package/dist/components/table/TableHead.svelte.d.ts +10 -0
  34. package/dist/components/table/TableHeaderCell.svelte +61 -0
  35. package/dist/components/table/TableHeaderCell.svelte.d.ts +17 -0
  36. package/dist/components/table/TableRoot.svelte +144 -0
  37. package/dist/components/table/TableRoot.svelte.d.ts +22 -0
  38. package/dist/components/table/TableRow.svelte +59 -0
  39. package/dist/components/table/TableRow.svelte.d.ts +12 -0
  40. package/dist/components/table/context.d.ts +14 -0
  41. package/dist/components/table/context.js +15 -0
  42. package/dist/components/table/index.d.ts +16 -0
  43. package/dist/components/table/index.js +8 -0
  44. package/dist/components/table/styles.d.ts +56 -0
  45. package/dist/components/table/styles.js +44 -0
  46. package/dist/components/text/Text.svelte +19 -4
  47. package/dist/components/text/Text.svelte.d.ts +4 -2
  48. package/dist/components/work-fold/WorkFold.svelte +26 -1
  49. package/dist/components/work-fold/WorkFold.svelte.d.ts +5 -0
  50. package/dist/index.d.ts +4 -1
  51. package/dist/index.js +7 -1
  52. package/dist/internal/markers.stylex.d.ts +4 -0
  53. package/dist/internal/markers.stylex.js +2 -0
  54. package/dist/internal/table.d.ts +29 -0
  55. package/dist/internal/table.js +34 -0
  56. package/dist/tokens.stylex.d.ts +2 -0
  57. package/dist/tokens.stylex.js +9 -3
  58. package/dist/typography.d.ts +45 -1
  59. package/dist/typography.js +47 -2
  60. package/package.json +1 -1
  61. package/skills/building-ui/SKILL.md +23 -23
  62. package/skills/building-ui/references/components.md +204 -42
  63. package/skills/markdown/SKILL.md +1 -1
  64. package/skills/setup/SKILL.md +1 -1
  65. package/skills/styling/SKILL.md +23 -5
  66. package/skills/theming/SKILL.md +1 -1
@@ -0,0 +1,34 @@
1
+ /**
2
+ * What a table of Narvi's looks like, whoever draws it: Markdown's, from a document, and
3
+ * `Table`'s, from data. Each adds only its own room and size: Markdown's in `em`, to take the
4
+ * size of the document, and Table's from the spacing scale.
5
+ */
6
+ import * as stylex from '@stylexjs/stylex';
7
+ import { colors, font } from '../tokens.stylex.js';
8
+ export const tableStyles = stylex.create({
9
+ // As wide as its columns, and never narrower than its frame. Digits line up down a column.
10
+ table: {
11
+ width: 'max-content',
12
+ minWidth: '100%',
13
+ fontVariantNumeric: 'tabular-nums'
14
+ },
15
+ // A hairline over each row. A cell of prose wraps at 24rem; a table of short cells stays as
16
+ // narrow as its content
17
+ cell: {
18
+ textAlign: 'start',
19
+ verticalAlign: 'top',
20
+ maxWidth: '24rem',
21
+ overflowWrap: 'break-word',
22
+ borderBlockStartWidth: { default: '1px', ':first-child': '1px' },
23
+ borderBlockStartStyle: 'solid',
24
+ borderBlockStartColor: colors.border
25
+ },
26
+ // The head is a well: a fill, and no line of its own over it, which is the frame's edge
27
+ headCell: {
28
+ borderBlockStartWidth: 0,
29
+ backgroundColor: colors.fillSunken,
30
+ color: colors.text,
31
+ fontWeight: font.weightMedium,
32
+ whiteSpace: 'nowrap'
33
+ }
34
+ });
@@ -109,7 +109,9 @@ export declare const font: stylex.VarGroup<Readonly<{
109
109
  sizeBody: string;
110
110
  sizeReading: string;
111
111
  sizeTitle: string;
112
+ sizeFigureTile: string;
112
113
  sizeFigure: string;
114
+ sizeFigurePage: string;
113
115
  weightRegular: string;
114
116
  weightMedium: string;
115
117
  weightSemibold: string;
@@ -157,10 +157,16 @@ export const font = stylex.defineVars({
157
157
  sizeBody: '0.875rem',
158
158
  // What is read or typed at length: a reply, the prompt
159
159
  sizeReading: '1rem',
160
- // A title in the text's own face: a dialog's, a section's
160
+ // A title in the text's own face: a dialog's, a section's, a detail page's
161
161
  sizeTitle: '1.0625rem',
162
- // A number that is the point of its place: a total, a usage figure, a count on a card
163
- sizeFigure: '1.75rem',
162
+ // Figures, a number that is the point of its place, in three steps named for where they
163
+ // stand. Each is half again the one before or more, so no two read as the same size.
164
+ // A figure among several: a stat tile, a group's total in a grid
165
+ sizeFigureTile: '1.5rem',
166
+ // The figure a card is about: a usage figure, a count on a card
167
+ sizeFigure: '2.25rem',
168
+ // The one figure a page or a view is about: a period's total
169
+ sizeFigurePage: '3rem',
164
170
  weightRegular: '400',
165
171
  weightMedium: '500',
166
172
  weightSemibold: '600',
@@ -39,11 +39,25 @@ export declare const typography: Readonly<{
39
39
  readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
40
40
  readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1.45>;
41
41
  }>;
42
+ readonly figureTile: Readonly<{
43
+ readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
44
+ readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
45
+ readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1.15>;
46
+ readonly letterSpacing: stylex.StyleXClassNameFor<"letterSpacing", "-0.015em">;
47
+ readonly fontVariantNumeric: stylex.StyleXClassNameFor<"fontVariantNumeric", "tabular-nums">;
48
+ }>;
42
49
  readonly figure: Readonly<{
43
50
  readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
44
51
  readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
45
52
  readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1.1>;
46
- readonly letterSpacing: stylex.StyleXClassNameFor<"letterSpacing", "-0.01em">;
53
+ readonly letterSpacing: stylex.StyleXClassNameFor<"letterSpacing", "-0.02em">;
54
+ readonly fontVariantNumeric: stylex.StyleXClassNameFor<"fontVariantNumeric", "tabular-nums">;
55
+ }>;
56
+ readonly figurePage: Readonly<{
57
+ readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
58
+ readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
59
+ readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1>;
60
+ readonly letterSpacing: stylex.StyleXClassNameFor<"letterSpacing", "-0.025em">;
47
61
  readonly fontVariantNumeric: stylex.StyleXClassNameFor<"fontVariantNumeric", "tabular-nums">;
48
62
  }>;
49
63
  readonly micro: Readonly<{
@@ -53,3 +67,33 @@ export declare const typography: Readonly<{
53
67
  }>;
54
68
  }>;
55
69
  export type TypeRole = keyof typeof typography;
70
+ /**
71
+ * A letter inside a small mark: an avatar's initials, a monogram, the badge on a provider's
72
+ * mark. It is not a role. It is part of the mark, so it is sized from the mark's own box, not
73
+ * from the scale: a quarter of the mark's shorter side, plus 4px so a small mark's letter stays
74
+ * legible. A 16px mark takes 8px, a 20px one 9px, a 28px one 11px, a 56px one 18px.
75
+ *
76
+ * Put `monogram.mark` on the mark, the box that has a width and a height, and
77
+ * `monogram.letter` on the letter inside it (or on a badge inside it, which is then sized from
78
+ * the mark it sits on). Without `monogram.mark` on an ancestor the letter is sized from the
79
+ * window, so never use `letter` alone.
80
+ *
81
+ * `mark` makes the mark a size container, so what is inside it no longer sizes it: a mark with
82
+ * no width and height of its own collapses to nothing, letter and all: give it both. It is
83
+ * `size`, not `inline-size`, because the letter is sized from the shorter side, which may be
84
+ * the height.
85
+ *
86
+ * <span {...stylex.attrs(monogram.mark, styles.mark)}>
87
+ * <span {...stylex.attrs(monogram.letter)}>AL</span>
88
+ * </span>
89
+ */
90
+ export declare const monogram: Readonly<{
91
+ readonly mark: Readonly<{
92
+ readonly containerType: stylex.StyleXClassNameFor<"containerType", "size">;
93
+ }>;
94
+ readonly letter: Readonly<{
95
+ readonly fontSize: stylex.StyleXClassNameFor<"fontSize", "calc(25cqmin + 0.25rem)">;
96
+ readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
97
+ readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1>;
98
+ }>;
99
+ }>;
@@ -46,12 +46,29 @@ export const typography = stylex.create({
46
46
  fontWeight: font.weightRegular,
47
47
  lineHeight: 1.45
48
48
  },
49
- // A number that is the point of its place: a total, a usage figure. Its digits line up.
49
+ // Figures: a number that is the point of its place, its digits lined up. The larger the
50
+ // figure, the tighter it is set. One among several, in a tile or a grid of totals: 24px
51
+ figureTile: {
52
+ fontSize: font.sizeFigureTile,
53
+ fontWeight: font.weightSemibold,
54
+ lineHeight: 1.15,
55
+ letterSpacing: '-0.015em',
56
+ fontVariantNumeric: 'tabular-nums'
57
+ },
58
+ // The figure a card is about: a usage figure, a count: 36px
50
59
  figure: {
51
60
  fontSize: font.sizeFigure,
52
61
  fontWeight: font.weightSemibold,
53
62
  lineHeight: 1.1,
54
- letterSpacing: '-0.01em',
63
+ letterSpacing: '-0.02em',
64
+ fontVariantNumeric: 'tabular-nums'
65
+ },
66
+ // The one figure a page or a view is about: a period's total: 48px
67
+ figurePage: {
68
+ fontSize: font.sizeFigurePage,
69
+ fontWeight: font.weightSemibold,
70
+ lineHeight: 1,
71
+ letterSpacing: '-0.025em',
55
72
  fontVariantNumeric: 'tabular-nums'
56
73
  },
57
74
  // A counter or a status inside tight chrome
@@ -61,3 +78,31 @@ export const typography = stylex.create({
61
78
  lineHeight: 1.3
62
79
  }
63
80
  });
81
+ /**
82
+ * A letter inside a small mark: an avatar's initials, a monogram, the badge on a provider's
83
+ * mark. It is not a role. It is part of the mark, so it is sized from the mark's own box, not
84
+ * from the scale: a quarter of the mark's shorter side, plus 4px so a small mark's letter stays
85
+ * legible. A 16px mark takes 8px, a 20px one 9px, a 28px one 11px, a 56px one 18px.
86
+ *
87
+ * Put `monogram.mark` on the mark, the box that has a width and a height, and
88
+ * `monogram.letter` on the letter inside it (or on a badge inside it, which is then sized from
89
+ * the mark it sits on). Without `monogram.mark` on an ancestor the letter is sized from the
90
+ * window, so never use `letter` alone.
91
+ *
92
+ * `mark` makes the mark a size container, so what is inside it no longer sizes it: a mark with
93
+ * no width and height of its own collapses to nothing, letter and all: give it both. It is
94
+ * `size`, not `inline-size`, because the letter is sized from the shorter side, which may be
95
+ * the height.
96
+ *
97
+ * <span {...stylex.attrs(monogram.mark, styles.mark)}>
98
+ * <span {...stylex.attrs(monogram.letter)}>AL</span>
99
+ * </span>
100
+ */
101
+ export const monogram = stylex.create({
102
+ mark: { containerType: 'size' },
103
+ letter: {
104
+ fontSize: 'calc(25cqmin + 0.25rem)',
105
+ fontWeight: font.weightSemibold,
106
+ lineHeight: 1
107
+ }
108
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopluna/narvi",
3
- "version": "0.3.13",
3
+ "version": "0.4.1",
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.13'
15
+ library_version: '0.4.1'
16
16
  requires:
17
17
  - setup
18
18
  sources:
@@ -30,6 +30,7 @@ sources:
30
30
  - src/lib/components/notice/Notice.svelte
31
31
  - src/lib/components/field/Field.svelte
32
32
  - src/lib/components/list/ListRoot.svelte
33
+ - src/lib/components/table/*
33
34
  - src/lib/components/choice-cards/ChoiceCards.svelte
34
35
  - src/lib/components/dialog/DialogContent.svelte
35
36
  - src/lib/components/tab-strip/TabStrip.svelte
@@ -37,6 +38,10 @@ sources:
37
38
  - src/lib/components/app-shell/*.svelte
38
39
  - src/lib/components/composer/ComposerModelPicker.svelte
39
40
  - src/lib/components/questionnaire/Questionnaire.svelte
41
+ - src/lib/components/approval/Approval.svelte
42
+ - src/lib/components/plan/Plan.svelte
43
+ - src/lib/components/queued-message/QueuedMessage.svelte
44
+ - src/lib/components/composer/ComposerTray.svelte
40
45
  - src/lib/components/button/Button.svelte
41
46
  - src/lib/components/tooltip/TooltipProvider.svelte
42
47
  - src/lib/components/command/*.svelte
@@ -274,13 +279,13 @@ flex or grid style of your own. For anything they can't express, see the `stylin
274
279
  ### Text
275
280
 
276
281
  Use `Heading` (`level` 1–6 for the outline, `size` from `sm` to `4xl` for the look, and
277
- `truncate` for a name that may run long) and `Text` (`variant` is what the text is: `figure`
278
- for a number that is the point of its place, `title`, `reading`, `label`, `body`, `meta`,
279
- `caption`, `micro` or `lead`, each one size, weight and line height; `tone` default, muted,
280
- subtle, accent, danger or success; `weight`; `face="display"` for the serif; `truncate` for one
281
- line, `lines={2}` for several). Use `Code` and `Kbd` inline, and
282
- `Link` for links inside text. `Button href` gives a link that looks like a button, and
283
- `Card href` makes the whole card a link.
282
+ `truncate`; a detail page's title is `size="lg"`, the title role's 17px) and `Text` (`variant`
283
+ is what the text is: a number that is the point of its place is `figureTile` 24px among
284
+ several, `figure` 36px on a card or `figurePage` 48px for a page's one; else `title`,
285
+ `reading`, `label`, `body`, `meta`, `caption`, `micro` or `lead`; `tone` default, muted, subtle,
286
+ accent, danger or success; `weight`; `face="display"`; `truncate`, or `lines={2}`). Use `Code`
287
+ and `Kbd` inline, `Link` inside text, `Button href` for a link that looks like a button, and
288
+ `Card href` for a card that is a link.
284
289
 
285
290
  ### Feedback
286
291
 
@@ -394,8 +399,8 @@ Parts of the shell that are easy to redraw by hand, and shouldn't be:
394
399
  - **A mark with a badge** in a row's `meta` may overhang it; the line clips only far past its end.
395
400
  - `AppShell.Main` is not focusable, so a press on text in the page leaves focus where it was.
396
401
  - **TabStrip** tabs narrow to an ellipsis before the strip scrolls; with a `leading` icon, a
397
- tab's close button takes the icon's place. A side panel's tabs are a TabStrip too, with menus,
398
- dragging, renaming and an add menu: see the [catalogue](references/components.md#tab-strips).
402
+ tab's close button takes the icon's place. Menus, dragging, renaming, preview tabs, middle-click
403
+ close and the header's notch are built in: see the [catalogue](references/components.md#tab-strips).
399
404
  - **AppShell.Panel** goes narrow by its row, not the window; `maximized` lays it over the page,
400
405
  kept inert, so give it an `AppShell.Header` with `AppShell.Toggle when="closed"`. Beside a
401
406
  thread, put it in a flex row of yours (`position: relative`) inside `AppShell.Main`; for
@@ -406,7 +411,7 @@ Parts of the shell that are easy to redraw by hand, and shouldn't be:
406
411
  shows no focus ring until the keys move in. Pass `focusOnOpen="first"` for a sheet that
407
412
  holds a form.
408
413
  - `AppShell.Header` draws a line under itself; `divider={false}` leaves it out where the page
409
- runs on under the header, as a conversation does.
414
+ runs on under the header; an `AppShell.Strip` in it runs its height, for a notch TabStrip.
410
415
 
411
416
  Parts of a thread that are easy to redraw by hand, and shouldn't be:
412
417
 
@@ -420,20 +425,16 @@ Parts of a thread that are easy to redraw by hand, and shouldn't be:
420
425
  - **Composer.ModelPicker** takes `bind:open`, and `multiple` with `value: string[]` to pick
421
426
  several, `providers` (a `provider` on each model) for a rail of agents beside the list,
422
427
  `searchable` for a field that searches them all, and `bind:starred` (values; keep them where
423
- they last) for stars, ⌘D included, and a Starred place in the rail. A model's `older` folds it into one row; `bind:also` adds models beside the chosen one with Shift or ⌘. `Composer.Toggle` works outside a `Composer.Root` too.
424
- - **Composer.Tray** shows its shelf for a child that holds something and isn't `hidden`; pass
425
- `waiting` when what is inside hides itself some other way.
428
+ they last) for stars, ⌘D included, and a Starred place in the rail; a starred option is named "Ithil 2, Starred". A model's `older` folds it into one row; `bind:also` adds models beside the chosen one with Shift or ⌘. `Composer.Toggle` works outside a `Composer.Root` too.
429
+ - **Composer.Tray** opens its shelf only for a child with height (measured), so an empty wrapper
430
+ opens none; `waiting` overrides. Its `queue` scrolls; read [the tray](references/components.md#the-composers-tray).
426
431
  - **A user's message with attachments:** `<Message.Content bubble={false}>` is a column at the
427
432
  end of the line; put the attachments in it, then the words in a `Message.Bubble`, then any
428
433
  cards. Its actions then sit under it. `textSize="body"` on `Message.Root` (and on
429
434
  `QueuedMessage`) sets the words at the interface's 14px instead of 16.
430
435
  - **QueuedMessage** takes `attachments` (a snippet over the bubble), draws no bubble without
431
436
  words, and `disabled` holds its actions back (`true`, or the ones to hold by name).
432
- - **A timeline row of your own** starts with `Activity.Icon` (`kind`, `tone`, `spinning`, or
433
- your own icon as children), as the others' do. `Activity.Thought` takes a snippet, such as
434
- Markdown, in place of `text`. `Activity.Step` takes `wrap` for a label that runs on, and
435
- `status="neutral"` for a step that settled without going through or failing ("Skipped",
436
- `statusLabels.neutral`); it and `WorkFold` pass `data-*` attributes on.
437
+ - **A timeline row of your own** starts with `Activity.Icon`; read the [catalogue](references/components.md#agent-timeline).
437
438
  - **A divider with more than words:** `Divider` takes children (a link, a time) and `role="status"`.
438
439
  - **Answers on their way:** `Approval` and `Questionnaire` take `busy`, which spins the button
439
440
  pressed and holds the rest. A `Question` takes a `description`, and `secret` for an answer
@@ -459,8 +460,8 @@ Parts of a thread that are easy to redraw by hand, and shouldn't be:
459
460
  a class or a style, or set `--narvi-icon-size` on the button.
460
461
  - **One short label.** Don't join details with a dot ("Queued · sends later"). Put the rest in
461
462
  an element of its own, or a tooltip.
462
- - **What waits on the person goes over the composer.** Put an `Approval`, a `Questionnaire` or
463
- `QueuedMessage`s in `Composer.Tray`'s `pending`, not up the conversation.
463
+ - **What waits on the person goes over the composer**, in `Composer.Tray`: the request in
464
+ `pending`, the folded `Plan` and compact `QueuedMessage`s in `queue`. Not up the conversation.
464
465
  - **Labels are sentence case.** Small labels and eyebrows are never uppercase or mono.
465
466
  - **Buttons name their action**: "Rename", "Delete thread", never "OK" or "Submit". A
466
467
  confirmation's cancel button can name the way out: "Keep it".
@@ -477,8 +478,7 @@ Parts of a thread that are easy to redraw by hand, and shouldn't be:
477
478
  - **MEDIUM: a raw `<label>` beside an Input.** It misses Field's description and error wiring.
478
479
  - **HIGH: `Dialog.Content size="lg"` written for 44rem.** Since the sizes gained `lg` 36rem,
479
480
  `xl` 44 and `2xl` 56, the old `lg` is `xl`.
480
- - **MEDIUM: an Input's icon positioned by hand.** Pass it as the Input's `icon` snippet; it is
481
- sized to the field and the text starts after it.
481
+ - **MEDIUM: an Input's icon placed by hand.** Pass it as `icon`; the text starts after it.
482
482
  - **MEDIUM: a toast's `onDismiss` alone for "Undo, or else forget".** A toast that runs out of
483
483
  time calls `onAutoClose`, not `onDismiss`, so the forgetting never happens. Pass both.
484
484
  - **MEDIUM: a SettingsRow's `<label for>` on a group.** A `SegmentedControl` or a set of radios