@diegopluna/narvi 0.3.2 → 0.3.3
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.
- package/dist/components/activity/ActivityIcon.svelte +54 -0
- package/dist/components/activity/ActivityIcon.svelte.d.ts +24 -0
- package/dist/components/activity/ActivityStep.svelte +47 -13
- package/dist/components/activity/ActivityStep.svelte.d.ts +13 -4
- package/dist/components/activity/ActivityThought.svelte +24 -5
- package/dist/components/activity/ActivityThought.svelte.d.ts +12 -2
- package/dist/components/activity/index.d.ts +3 -1
- package/dist/components/activity/index.js +2 -1
- package/dist/components/app-shell/AppShellHeader.svelte +18 -4
- package/dist/components/app-shell/AppShellHeader.svelte.d.ts +5 -0
- package/dist/components/approval/Approval.svelte +14 -1
- package/dist/components/approval/Approval.svelte.d.ts +5 -0
- package/dist/components/badge/Badge.svelte +3 -1
- package/dist/components/badge/Badge.svelte.d.ts +1 -1
- package/dist/components/button/Button.svelte +17 -6
- package/dist/components/composer/ComposerModelPicker.svelte +80 -13
- package/dist/components/composer/ComposerModelPicker.svelte.d.ts +23 -6
- package/dist/components/composer/ComposerRoot.svelte +51 -12
- package/dist/components/composer/ComposerRoot.svelte.d.ts +16 -0
- package/dist/components/composer/ComposerSubmit.svelte +19 -5
- package/dist/components/composer/ComposerSubmit.svelte.d.ts +3 -1
- package/dist/components/composer/ComposerToggle.svelte +18 -4
- package/dist/components/composer/ComposerToggle.svelte.d.ts +2 -0
- package/dist/components/composer/ComposerTray.svelte +17 -3
- package/dist/components/composer/ComposerTray.svelte.d.ts +5 -0
- package/dist/components/composer/context.d.ts +4 -1
- package/dist/components/dialog/DialogContent.svelte +22 -12
- package/dist/components/dialog/DialogContent.svelte.d.ts +10 -0
- package/dist/components/divider/Divider.svelte +56 -14
- package/dist/components/divider/Divider.svelte.d.ts +13 -3
- package/dist/components/empty-state/EmptyState.svelte +12 -2
- package/dist/components/empty-state/EmptyState.svelte.d.ts +6 -0
- package/dist/components/heading/Heading.svelte +15 -0
- package/dist/components/heading/Heading.svelte.d.ts +6 -0
- package/dist/components/hover-card/HoverCardContent.svelte +18 -2
- package/dist/components/hover-card/HoverCardContent.svelte.d.ts +8 -0
- package/dist/components/input/Input.svelte +13 -3
- package/dist/components/input/Input.svelte.d.ts +10 -2
- package/dist/components/markdown/Markdown.svelte +22 -2
- package/dist/components/markdown/MarkdownDiagram.svelte +33 -2
- package/dist/components/markdown/MarkdownFile.svelte +56 -10
- package/dist/components/markdown/MarkdownMath.svelte +6 -0
- package/dist/components/markdown/MarkdownTable.svelte +3 -4
- package/dist/components/markdown/context.d.ts +6 -0
- package/dist/components/markdown/labels.d.ts +7 -0
- package/dist/components/markdown/labels.js +2 -0
- package/dist/components/menu/MenuCheckboxItem.svelte +44 -7
- package/dist/components/menu/MenuCheckboxItem.svelte.d.ts +12 -2
- package/dist/components/menu/MenuContent.svelte +10 -2
- package/dist/components/menu/MenuContent.svelte.d.ts +10 -0
- package/dist/components/menu/MenuItem.svelte +17 -2
- package/dist/components/menu/MenuItem.svelte.d.ts +8 -0
- package/dist/components/menu/MenuSubContent.svelte +10 -2
- package/dist/components/menu/MenuSubContent.svelte.d.ts +10 -0
- package/dist/components/menu/MenuSubTrigger.svelte +19 -2
- package/dist/components/menu/MenuSubTrigger.svelte.d.ts +6 -0
- package/dist/components/message/MessageBubble.svelte +40 -0
- package/dist/components/message/MessageBubble.svelte.d.ts +12 -0
- package/dist/components/message/MessageContent.svelte +23 -14
- package/dist/components/message/MessageContent.svelte.d.ts +6 -0
- package/dist/components/message/MessageCopy.svelte +27 -15
- package/dist/components/message/MessageCopy.svelte.d.ts +9 -2
- package/dist/components/message/MessageRoot.svelte +20 -3
- package/dist/components/message/MessageRoot.svelte.d.ts +6 -0
- package/dist/components/message/context.d.ts +2 -0
- package/dist/components/message/index.d.ts +4 -1
- package/dist/components/message/index.js +3 -2
- package/dist/components/message/styles.d.ts +30 -0
- package/dist/components/message/styles.js +24 -0
- package/dist/components/notice/Notice.svelte +3 -3
- package/dist/components/popover/PopoverContent.svelte +27 -3
- package/dist/components/popover/PopoverContent.svelte.d.ts +18 -0
- package/dist/components/questionnaire/Questionnaire.svelte +103 -19
- package/dist/components/questionnaire/Questionnaire.svelte.d.ts +13 -1
- package/dist/components/queued-message/QueuedMessage.svelte +44 -6
- package/dist/components/queued-message/QueuedMessage.svelte.d.ts +12 -1
- package/dist/components/select/Select.svelte +18 -2
- package/dist/components/select/Select.svelte.d.ts +7 -0
- package/dist/components/toast/Toaster.svelte +1 -1
- package/dist/components/toggle/Toggle.svelte +12 -2
- package/dist/components/toggle/Toggle.svelte.d.ts +11 -1
- package/dist/components/toggle-group/ToggleGroupItem.svelte +10 -1
- package/dist/components/toggle-group/ToggleGroupRoot.svelte +7 -1
- package/dist/components/toggle-group/ToggleGroupRoot.svelte.d.ts +3 -1
- package/dist/components/toggle-group/context.d.ts +2 -1
- package/dist/components/tooltip/TooltipContent.svelte +13 -1
- package/dist/components/tooltip/TooltipContent.svelte.d.ts +10 -0
- package/dist/components/work-fold/WorkFold.svelte +13 -4
- package/dist/components/work-fold/WorkFold.svelte.d.ts +2 -1
- package/dist/focus-ring.d.ts +29 -0
- package/dist/focus-ring.js +42 -0
- package/dist/index.d.ts +6 -5
- package/dist/index.js +7 -2
- package/dist/internal/Collapse.svelte +15 -2
- package/dist/internal/Glyph.svelte +28 -0
- package/dist/internal/Glyph.svelte.d.ts +5 -0
- package/dist/internal/Tile.svelte +3 -2
- package/dist/internal/layer.d.ts +23 -0
- package/dist/internal/layer.js +19 -0
- package/dist/internal/toggle.d.ts +8 -1
- package/dist/internal/toggle.js +20 -2
- package/dist/markdown/file-paths.d.ts +7 -0
- package/dist/markdown/file-paths.js +29 -0
- package/dist/markdown/files.d.ts +22 -2
- package/dist/markdown/files.js +45 -14
- package/dist/tokens.stylex.d.ts +3 -0
- package/dist/tokens.stylex.js +5 -1
- package/package.json +1 -1
- package/skills/building-ui/SKILL.md +55 -3
- package/skills/building-ui/references/components.md +33 -33
- package/skills/markdown/SKILL.md +22 -6
- package/skills/setup/SKILL.md +1 -1
- package/skills/styling/SKILL.md +10 -3
- package/skills/theming/SKILL.md +11 -4
package/dist/markdown/files.js
CHANGED
|
@@ -9,10 +9,15 @@
|
|
|
9
9
|
* are all read, as is `[the config](src/config.ts#L10)`.
|
|
10
10
|
*/
|
|
11
11
|
import MarkdownFile, { chipFile, fileHtml } from '../components/markdown/MarkdownFile.svelte';
|
|
12
|
-
import { displayName, formatPosition, looksLikePath, namesPath, reExtension, splitPosition } from './file-paths.js';
|
|
12
|
+
import { displayName, fileKind, formatPosition, looksLikePath, namesPath, reExtension, splitPosition } from './file-paths.js';
|
|
13
13
|
import { mapInlines, withProps } from './plugin.js';
|
|
14
14
|
import { inlineText } from './table.js';
|
|
15
|
-
export { formatPosition, looksLikePath, splitPosition };
|
|
15
|
+
export { fileKind, formatPosition, looksLikePath, splitPosition };
|
|
16
|
+
// What may go in a style attribute: no quote, backslash or line ending to break out of it
|
|
17
|
+
const reIconUrl = /^[^"\\\r\n]{1,20000}$/;
|
|
18
|
+
const reIconColor = /^[\w\s#%(),./-]{1,200}$/;
|
|
19
|
+
/** The words of a single-word link that name a file anyway: `README`, `Makefile`. */
|
|
20
|
+
const reNamedFile = /^(?:README|LICEN[CS]E|CHANGELOG|CHANGES|CONTRIBUTING|AUTHORS|NOTICE|COPYING|CODEOWNERS|TODO|VERSION|SECURITY|[A-Z][a-z]*file)$/;
|
|
16
21
|
function decode(url) {
|
|
17
22
|
try {
|
|
18
23
|
return decodeURIComponent(url);
|
|
@@ -23,7 +28,22 @@ function decode(url) {
|
|
|
23
28
|
}
|
|
24
29
|
/** The first-party file plugin. */
|
|
25
30
|
export function files(options = {}) {
|
|
26
|
-
const { resolve, open } = options;
|
|
31
|
+
const { resolve, open, icon } = options;
|
|
32
|
+
/** The app's icon for a chip, if it gives one that can be written safely. */
|
|
33
|
+
const iconOf = (target) => {
|
|
34
|
+
let given;
|
|
35
|
+
try {
|
|
36
|
+
given = icon?.(target);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// An icon that throws leaves the chip with Narvi's own
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
if (!given || !reIconUrl.test(given.url))
|
|
43
|
+
return undefined;
|
|
44
|
+
const color = given.color && reIconColor.test(given.color) ? given.color : undefined;
|
|
45
|
+
return color ? { url: given.url, color } : { url: given.url };
|
|
46
|
+
};
|
|
27
47
|
/**
|
|
28
48
|
* The file some text names, or null. `certain` is for a `file:` address, which names a
|
|
29
49
|
* file whatever it looks like, spaces and all.
|
|
@@ -69,21 +89,32 @@ export function files(options = {}) {
|
|
|
69
89
|
.replace(/[\p{Cc}\p{Cf}]/gu, '')
|
|
70
90
|
.trim();
|
|
71
91
|
const tokens = words.split(/\s+/).map((token) => token.replace(/[.,;:!?)\]]+$/, ''));
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
92
|
+
// What could be a file's name: a path, a name with an extension, a dotfile, one with an
|
|
93
|
+
// underscore (`id_rsa`), or a name files go by without an extension (`README`). A plain
|
|
94
|
+
// word, such as "here" or "this", is none of these, alone or among others.
|
|
95
|
+
const readsAsFile = (token) => /[\\/_]/.test(token) ||
|
|
96
|
+
token.startsWith('.') ||
|
|
97
|
+
reExtension.test(splitPosition(token).path) ||
|
|
98
|
+
reNamedFile.test(token);
|
|
99
|
+
const honest = tokens.length > 0 &&
|
|
100
|
+
tokens[0] !== '' &&
|
|
101
|
+
tokens.every((token) => !readsAsFile(token) || namesPath(splitPosition(token).path, file.path));
|
|
76
102
|
if (honest)
|
|
77
103
|
return children;
|
|
78
104
|
return [{ type: 'text', value: displayName(file.path) + formatPosition(file) }];
|
|
79
105
|
};
|
|
80
|
-
const chip = (file, source, children, link = false) =>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
106
|
+
const chip = (file, source, children, link = false) => {
|
|
107
|
+
// A folder is named with a slash at its end, as written or as the app resolves it
|
|
108
|
+
const kind = fileKind(/[\\/]$/.test(source.replace(/#.*$/, '')) ? `${file.path}/` : file.path);
|
|
109
|
+
const own = iconOf({ ...file, kind });
|
|
110
|
+
return {
|
|
111
|
+
type: 'custom',
|
|
112
|
+
name: 'file',
|
|
113
|
+
// `link` marks a chip whose label is the words of a link, not a path
|
|
114
|
+
data: { ...file, source, kind, ...(link ? { link } : {}), ...(own ? { icon: own } : {}) },
|
|
115
|
+
children
|
|
116
|
+
};
|
|
117
|
+
};
|
|
87
118
|
return {
|
|
88
119
|
name: 'files',
|
|
89
120
|
transform: (block) => mapInlines(block, (node, { inLink }) => {
|
package/dist/tokens.stylex.d.ts
CHANGED
|
@@ -43,12 +43,15 @@ export declare const colors: stylex.VarGroup<Readonly<{
|
|
|
43
43
|
success: string;
|
|
44
44
|
warning: string;
|
|
45
45
|
danger: string;
|
|
46
|
+
info: string;
|
|
46
47
|
successSoft: string;
|
|
47
48
|
warningSoft: string;
|
|
48
49
|
dangerSoft: string;
|
|
50
|
+
infoSoft: string;
|
|
49
51
|
successText: string;
|
|
50
52
|
warningText: string;
|
|
51
53
|
dangerText: string;
|
|
54
|
+
infoText: string;
|
|
52
55
|
codeKey: string;
|
|
53
56
|
codeString: string;
|
|
54
57
|
codeNumber: string;
|
package/dist/tokens.stylex.js
CHANGED
|
@@ -64,19 +64,23 @@ export const colors = stylex.defineVars({
|
|
|
64
64
|
primary: 'light-dark(#1c1e21, #eceff4)',
|
|
65
65
|
onPrimary: 'light-dark(#fafafa, #0b0d11)',
|
|
66
66
|
// Status: definite colours, each holding 4.5:1 as small text on a hovered row of the
|
|
67
|
-
// page, on every stone a preset offers
|
|
67
|
+
// page, on every stone a preset offers. `info` is for what is only to be known, such as a
|
|
68
|
+
// note or a comment: a blue of its own, which stays blue whatever accent a preset picks.
|
|
68
69
|
success: 'light-dark(#007835, #37d16c)',
|
|
69
70
|
warning: 'light-dark(#8b6001, #f5af20)',
|
|
70
71
|
danger: 'light-dark(#c92228, #ff7a70)',
|
|
72
|
+
info: 'light-dark(#0164cf, #72acfe)',
|
|
71
73
|
// Behind a status: a wash of its colour, stronger at night so it still reads
|
|
72
74
|
successSoft: 'light-dark(rgb(0 120 53 / 0.12), rgb(55 209 108 / 0.16))',
|
|
73
75
|
warningSoft: 'light-dark(rgb(139 96 1 / 0.12), rgb(245 175 32 / 0.16))',
|
|
74
76
|
dangerSoft: 'light-dark(rgb(201 34 40 / 0.12), rgb(255 122 112 / 0.16))',
|
|
77
|
+
infoSoft: 'light-dark(rgb(1 100 207 / 0.12), rgb(114 172 254 / 0.16))',
|
|
75
78
|
// Small text in a status colour: mixed toward the text colour, so a 12px label
|
|
76
79
|
// on its soft wash still holds 4.5:1
|
|
77
80
|
successText: 'light-dark(#195c2e, #a0dcac)',
|
|
78
81
|
warningText: 'light-dark(#674600, #f2ca8d)',
|
|
79
82
|
dangerText: 'light-dark(#7a342f, #ffb9b1)',
|
|
83
|
+
infoText: 'light-dark(#1a4f8c, #a9c8f8)',
|
|
80
84
|
// Code: keys in slate blue, strings in green, numbers in copper, literals in magenta, and
|
|
81
85
|
// punctuation in a grey that stands back. Each holds 4.5:1 on `fillSunken` in both
|
|
82
86
|
// schemes, punctuation too: a brace is text.
|
package/package.json
CHANGED
|
@@ -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.
|
|
15
|
+
library_version: '0.3.3'
|
|
16
16
|
requires:
|
|
17
17
|
- setup
|
|
18
18
|
sources:
|
|
@@ -117,6 +117,8 @@ The same `child` pattern applies to `Menu.Trigger`, `Popover.Trigger`, `Tooltip.
|
|
|
117
117
|
`HoverCard.Trigger`, `Sheet.Trigger` and `Collapsible.Trigger`.
|
|
118
118
|
|
|
119
119
|
`Dialog.Content` takes `size`: `sm` 24rem, `md` 32 (the default), `lg` 36, `xl` 44 and `2xl` 56.
|
|
120
|
+
`as="form"` makes the dialog the form itself: give it `onsubmit`, and a footer button with
|
|
121
|
+
`type="submit"`; Enter in a field submits it.
|
|
120
122
|
A `Sheet.Content` along an edge takes the same names, from 20rem; from `lg` up, a dialog and a
|
|
121
123
|
sheet of one size are as wide. `Dialog.Body` takes a bindable `ref`, the element that scrolls.
|
|
122
124
|
A Select, Menu or Popover opened inside a dialog or a sheet opens over it.
|
|
@@ -157,7 +159,8 @@ wiring for them.
|
|
|
157
159
|
(radios, a start and an end). The help and the error describe the group; its controls take
|
|
158
160
|
no id from it.
|
|
159
161
|
- `Input` takes an `icon` snippet at its start, sized to the field:
|
|
160
|
-
`<Input>{#snippet icon()}<Search />{/snippet}</Input>`. Don't position an icon by hand.
|
|
162
|
+
`<Input>{#snippet icon()}<Search />{/snippet}</Input>`. Don't position an icon by hand. With
|
|
163
|
+
an icon, `sx` styles the element around the field; `inputSx` and `inputClass` style the field.
|
|
161
164
|
- For one choice among a few that each need a line of detail, use `ChoiceCards`
|
|
162
165
|
(`options: { value, label, detail?, icon?, disabled? }[]`, `bind:value`, `aria-label`).
|
|
163
166
|
|
|
@@ -310,7 +313,20 @@ line, `lines={2}` for several). Use `Code` and `Kbd` inline, and
|
|
|
310
313
|
- A `Button` that is loading hides its label under the spinner, which is as large as an icon in
|
|
311
314
|
a button of that size, icon-only ones too; `loadingLabel="Connecting…"`
|
|
312
315
|
says what it is doing beside the spinner instead. `variant="link"` sits in a sentence, at its
|
|
313
|
-
size, with no padding.
|
|
316
|
+
size, with no padding. A ghost, bare, secondary or floating Button that opens a menu or a
|
|
317
|
+
popover holds an open look while it shows, by the `aria-expanded` bits-ui sets: don't style
|
|
318
|
+
the open trigger yourself.
|
|
319
|
+
- `Toggle` and `ToggleGroup.Root` take `tone="neutral"` for a toolbar's icons that show or hide
|
|
320
|
+
something: pressed, they take the fill of what is chosen instead of lighting in the accent.
|
|
321
|
+
- `Menu.Item`, `Menu.SubTrigger` and `Menu.CheckboxItem` take a `description` (a line under the
|
|
322
|
+
label), and `Menu.Item` a `trailing` snippet after its shortcut. A `Menu.CheckboxItem` with an
|
|
323
|
+
`icon` puts its tick at the end, so its icon lines up with the others'. `Menu.Content` takes a
|
|
324
|
+
`width` (`'18rem'`) in place of fitting its items, up to 22rem.
|
|
325
|
+
- `Popover.Content` takes `padding="none"`, `layout="column"` and a `width`;
|
|
326
|
+
`HoverCard.Content` takes `layout="column"` and `padding`; `Tooltip.Content` takes
|
|
327
|
+
`layout="column"` for a title over a line that says more.
|
|
328
|
+
- `Select` takes an `optionIcon` snippet, given each option, for an icon with props of its own.
|
|
329
|
+
- `EmptyState`'s title is a heading (`level`, 2 by default). `Heading` takes a `weight`.
|
|
314
330
|
|
|
315
331
|
### App and chat screens
|
|
316
332
|
|
|
@@ -362,6 +378,42 @@ Parts of the shell that are easy to redraw by hand, and shouldn't be:
|
|
|
362
378
|
- **A Sheet** focuses itself as it opens (`focusOnOpen="sheet"`), so a Rail or a list in it
|
|
363
379
|
shows no focus ring until the keys move in. Pass `focusOnOpen="first"` for a sheet that
|
|
364
380
|
holds a form.
|
|
381
|
+
- `AppShell.Header` draws a line under itself; `divider={false}` leaves it out where the page
|
|
382
|
+
runs on under the header, as a conversation does.
|
|
383
|
+
|
|
384
|
+
Parts of a thread that are easy to redraw by hand, and shouldn't be:
|
|
385
|
+
|
|
386
|
+
- **An editor of your own in the composer** (a rich prompt field): put it where
|
|
387
|
+
`Composer.Textarea` goes and mark it `data-composer-field` (an editable element is found on
|
|
388
|
+
its own). The frame shows its focus edge and sends clicks to it. Set `hasContent` from the
|
|
389
|
+
editor, so `Composer.Submit` knows there is something to send, and `sending` while a message
|
|
390
|
+
is on its way and can't be stopped: Submit spins, says "Sending" (`sendingLabel`), and nothing
|
|
391
|
+
more is sent. `onfiles` receives picked, dropped and pasted files; return `false` to keep them
|
|
392
|
+
on a list of your own instead of the composer's.
|
|
393
|
+
- **Composer.ModelPicker** takes `bind:open`, and `multiple` with `value: string[]` to pick
|
|
394
|
+
several. `Composer.Toggle` works outside a `Composer.Root` too.
|
|
395
|
+
- **Composer.Tray** shows its shelf for a child that holds something and isn't `hidden`; pass
|
|
396
|
+
`waiting` when what is inside hides itself some other way.
|
|
397
|
+
- **A user's message with attachments:** `<Message.Content bubble={false}>` is a column at the
|
|
398
|
+
end of the line; put the attachments in it, then the words in a `Message.Bubble`, then any
|
|
399
|
+
cards. Its actions then sit under it. `textSize="body"` on `Message.Root` (and on
|
|
400
|
+
`QueuedMessage`) sets the words at the interface's 14px instead of 16.
|
|
401
|
+
- **QueuedMessage** takes `attachments` (a snippet over the bubble), draws no bubble without
|
|
402
|
+
words, and `disabled` holds its actions back (`true`, or the ones to hold by name).
|
|
403
|
+
- **A timeline row of your own** starts with `Activity.Icon` (`kind`, `tone`, `spinning`, or
|
|
404
|
+
your own icon as children), as the others' do. `Activity.Thought` takes a snippet, such as
|
|
405
|
+
Markdown, in place of `text`. `Activity.Step` takes `wrap` for a label that runs on, and
|
|
406
|
+
`status="neutral"` for a step that settled without going through or failing ("Skipped",
|
|
407
|
+
`statusLabels.neutral`); it and `WorkFold` pass `data-*` attributes on.
|
|
408
|
+
- **A divider with more than words:** `Divider` takes children (a link, a time) and
|
|
409
|
+
`role="status"` for words read out as they change. A long label wraps between the rules.
|
|
410
|
+
- **Answers on their way:** `Approval` and `Questionnaire` take `busy`, which spins the button
|
|
411
|
+
pressed and holds the rest. A `Question` takes a `description`, and `secret` for an answer
|
|
412
|
+
typed into a hidden field and never shown back. ⌘Enter sends only once every question is
|
|
413
|
+
answered or skipped.
|
|
414
|
+
- **Closed folds** (`WorkFold`, `Collapsible`, `Activity`, `Reasoning`, `Tool`) stop rendering
|
|
415
|
+
their content once shut, so `checkVisibility()`, find-in-page and Playwright see it as hidden.
|
|
416
|
+
Don't add `display: none` of your own.
|
|
365
417
|
|
|
366
418
|
## Conventions
|
|
367
419
|
|
|
@@ -32,13 +32,13 @@ component: import the namespace (`Dialog`) and use `Dialog.Root`. Docs and live
|
|
|
32
32
|
| `Field` | Label, help text and error around one control | `field` |
|
|
33
33
|
| `Input` | One line of text | `input` |
|
|
34
34
|
| `Textarea` | Several lines of text | `textarea` |
|
|
35
|
-
| `Select` | One choice from a short list (`options: { value, label, icon?, group? }[]`, `align`)
|
|
35
|
+
| `Select` | One choice from a short list (`options: { value, label, icon?, group? }[]`, `align`, `optionIcon`) | `select` |
|
|
36
36
|
| `Checkbox` | An option on or off, or several from a list | `checkbox` |
|
|
37
37
|
| `ChoiceCards` | One choice among a few, each a card with a title and a line of detail | `choice-cards` |
|
|
38
38
|
| `Switch` | A setting that takes effect at once | `switch` |
|
|
39
39
|
| `SegmentedControl` | One of a few options, all visible (`options: { value, label, title? }[]`) | `segmented-control` |
|
|
40
40
|
| `Slider` | A value or a range along a track | `slider` |
|
|
41
|
-
| `Toggle` | A button that stays pressed
|
|
41
|
+
| `Toggle` | A button that stays pressed (`tone`: `accent`, or `neutral` for toolbar icons) | `toggle` |
|
|
42
42
|
| `ToggleGroup.Root`, `.Item` | Toggles that belong together: one pressed, or any number | `toggle-group` |
|
|
43
43
|
| `SettingsGroup` | A titled group of settings: a heading, an action, the rows on one card | `settings-group` |
|
|
44
44
|
| `SettingsRow` | One setting: what it is, beside its control | `settings-row` |
|
|
@@ -50,34 +50,34 @@ component: import the namespace (`Dialog`) and use `Dialog.Root`. Docs and live
|
|
|
50
50
|
|
|
51
51
|
| Component | Use it for | Docs slug |
|
|
52
52
|
| --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | ------------- |
|
|
53
|
-
| `Dialog.Root`, `.Trigger`, `.Content` (`size`, `side`), `.Header`, `.Title`, `.Description`, `.Body`, `.Footer`, `.Close`
|
|
53
|
+
| `Dialog.Root`, `.Trigger`, `.Content` (`size`, `side`, `as`), `.Header`, `.Title`, `.Description`, `.Body`, `.Footer`, `.Close` | A focused task over the page | `dialog` |
|
|
54
54
|
| `ConfirmDialog` | A confirmation for an action that matters | `dialog` |
|
|
55
55
|
| `Sheet.Root`, `.Trigger`, `.Content` (`side`, `size`, `focusOnOpen`), `.Header`, `.Title`, `.Description`, `.Body`, `.Footer`, `.Close` | A panel that slides in from an edge | `sheet` |
|
|
56
|
-
| `Popover.Root`, `.Trigger`, `.Content`, `.Close`
|
|
57
|
-
| `HoverCard.Root`, `.Trigger`, `.Content`
|
|
56
|
+
| `Popover.Root`, `.Trigger`, `.Content` (`padding`, `layout`, `width`), `.Close` | Content anchored to the control that opened it | `popover` |
|
|
57
|
+
| `HoverCard.Root`, `.Trigger`, `.Content` (`layout`, `padding`) | A preview while the pointer rests on a link or chip | `hover-card` |
|
|
58
58
|
| `Menu.Root`, `.Trigger`, `.Content`, `.Item`, `.CheckboxItem`, `.RadioGroup`, `.RadioItem`, `.Group`, `.Label`, `.Separator`, `.Sub` | Actions and choices from a button | `menu` |
|
|
59
59
|
| `ContextMenu.Root`, `.Trigger`, `.Content`, filled with `Menu` items | The same, from a right-click | `menu` |
|
|
60
60
|
| `Command.Dialog`, `.Root`, `.Input`, `.List`, `.Group`, `.Item`, `.Empty`, `.Separator`, `.Footer` | A search field over everything the app can do (⌘K) | `command` |
|
|
61
|
-
| `Tooltip.Provider`, `.Root`, `.Trigger`, `.Content` (`shortcut`)
|
|
61
|
+
| `Tooltip.Provider`, `.Root`, `.Trigger`, `.Content` (`shortcut`, `layout`) | A control's name and its keys. Needs the Provider | `tooltip` |
|
|
62
62
|
| `Collapsible.Root`, `.Trigger`, `.Content` | A region the person can fold away | `collapsible` |
|
|
63
63
|
|
|
64
64
|
## Feedback and status
|
|
65
65
|
|
|
66
|
-
| Component | Use it for
|
|
67
|
-
| ------------------------------------ |
|
|
68
|
-
| `Toaster`, `toast()` | Short notes about something that happened; one Toaster at the root
|
|
69
|
-
| `Notice` | A note in place: what is happening or went wrong, and what to do
|
|
70
|
-
| `EmptyState` | An empty place: what it is for and how to fill it (`title`, `description`, `media`, `actions`) | `empty-state` |
|
|
71
|
-
| `Badge` | A status, category or count (`tone`)
|
|
72
|
-
| `StatusIndicator` | Where a run, thread or machine stands, by shape and colour
|
|
73
|
-
| `StatusDot` | A small dot of status colour (`tone`, `shape`), beside a name or on a mark
|
|
74
|
-
| `Progress` | How far along a task is
|
|
75
|
-
| `Spinner` | Something in progress
|
|
76
|
-
| `Skeleton` | A stand-in for content on its way
|
|
77
|
-
| `Shimmer` | Text that says work is under way
|
|
78
|
-
| `RollingText` | A phrase that rolls to its next value ("Reading…", "Running…")
|
|
79
|
-
| `Announcer` | Says a short message to screen readers without showing anything
|
|
80
|
-
| `Avatar.Root`, `.Image`, `.Fallback` | A person: a picture, or initials
|
|
66
|
+
| Component | Use it for | Docs slug |
|
|
67
|
+
| ------------------------------------ | ------------------------------------------------------------------------------------------------------- | ------------------ |
|
|
68
|
+
| `Toaster`, `toast()` | Short notes about something that happened; one Toaster at the root | `toast` |
|
|
69
|
+
| `Notice` | A note in place: what is happening or went wrong, and what to do | `notice` |
|
|
70
|
+
| `EmptyState` | An empty place: what it is for and how to fill it (`title`, `level`, `description`, `media`, `actions`) | `empty-state` |
|
|
71
|
+
| `Badge` | A status, category or count (`tone`, `info` among them) | `badge` |
|
|
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` |
|
|
74
|
+
| `Progress` | How far along a task is | `progress` |
|
|
75
|
+
| `Spinner` | Something in progress | `spinner` |
|
|
76
|
+
| `Skeleton` | A stand-in for content on its way | `skeleton` |
|
|
77
|
+
| `Shimmer` | Text that says work is under way | `shimmer` |
|
|
78
|
+
| `RollingText` | A phrase that rolls to its next value ("Reading…", "Running…") | none |
|
|
79
|
+
| `Announcer` | Says a short message to screen readers without showing anything | `announcer` |
|
|
80
|
+
| `Avatar.Root`, `.Image`, `.Fallback` | A person: a picture, or initials | `avatar` |
|
|
81
81
|
|
|
82
82
|
## App shell
|
|
83
83
|
|
|
@@ -151,14 +151,14 @@ first. Don't use a rail without a bar in a window that has traffic lights: they
|
|
|
151
151
|
|
|
152
152
|
## AI chat
|
|
153
153
|
|
|
154
|
-
| Component
|
|
155
|
-
|
|
|
156
|
-
| `Conversation.Root`, `.Content`, `.ScrollButton`, `.Empty`
|
|
157
|
-
| `Message.Root` (`from`, `streaming`), `.Header`, `.Pending`, `.Content`, `.Actions`, `.Action`, `.Copy`
|
|
158
|
-
| `Reasoning.Root` (`streaming`), `.Trigger`, `.Content`
|
|
159
|
-
| `Tool.Root` (`name`, `state`), `.Trigger`, `.Content`, `.Input`, `.Output`
|
|
160
|
-
| `Composer.Tray` (`pending` snippet), `.Root` (`bind:value`, `status`, `onsubmit`, `onstop`), `.Textarea`, `.Toolbar`, `.Attachments`, `.AttachButton`, `.Toggle`, `.ModelPicker`, `.Submit` | Where the person writes to the model | `composer` |
|
|
161
|
-
| `Suggestions.Root`, `.Item`
|
|
154
|
+
| Component | Use it for | Docs slug |
|
|
155
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------ | -------------- |
|
|
156
|
+
| `Conversation.Root`, `.Content`, `.ScrollButton`, `.Empty` | The scrolling log; keeps the newest in view while it streams | `conversation` |
|
|
157
|
+
| `Message.Root` (`from`, `streaming`, `textSize`), `.Header`, `.Pending`, `.Content` (`bubble`), `.Bubble`, `.Actions`, `.Action`, `.Copy`, `.Time` | One turn, from the person or the model | `message` |
|
|
158
|
+
| `Reasoning.Root` (`streaming`), `.Trigger`, `.Content` | The model's thinking, folded once done | `reasoning` |
|
|
159
|
+
| `Tool.Root` (`name`, `state`), `.Trigger`, `.Content`, `.Input`, `.Output` | A tool call: what it asked, how it went, what came back | `tool` |
|
|
160
|
+
| `Composer.Tray` (`pending` snippet, `waiting`), `.Root` (`bind:value`, `status`, `sending`, `hasContent`, `onsubmit`, `onstop`, `onfiles`), `.Textarea`, `.Toolbar`, `.Attachments`, `.AttachButton`, `.Toggle`, `.ModelPicker`, `.Submit` | Where the person writes to the model | `composer` |
|
|
161
|
+
| `Suggestions.Root`, `.Item` | Prompts to start from | `suggestions` |
|
|
162
162
|
|
|
163
163
|
```svelte
|
|
164
164
|
<Conversation.Root>
|
|
@@ -193,14 +193,14 @@ Docs slug: `agent-timeline`.
|
|
|
193
193
|
|
|
194
194
|
| Component | Use it for |
|
|
195
195
|
| ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
196
|
-
| `Activity.Root`, `.Trigger`, `.Content`, `.Step`, `.Thought`
|
|
196
|
+
| `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 |
|
|
197
197
|
| `WorkFold` | Folds a finished turn's work behind "Worked for 2m 5s" |
|
|
198
198
|
| `Plan` (`steps: { label, status }[]`) | What the agent means to do, ticked off as it goes |
|
|
199
199
|
| `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 |
|
|
200
|
-
| `Questionnaire` | Questions one at a time, with keys 1–9 to pick and ⌘Enter to send
|
|
201
|
-
| `QueuedMessage` | A message sent while the agent was still working, waiting its turn
|
|
200
|
+
| `Questionnaire` | Questions one at a time, with keys 1–9 to pick and ⌘Enter to send once all are answered; `secret` answers; `busy` |
|
|
201
|
+
| `QueuedMessage` | A message sent while the agent was still working, waiting its turn (`attachments`, `disabled`) |
|
|
202
202
|
| `ChangesSummary` (`ChangedFile[]`), `ChangeStats` (`additions`, `deletions`) | What a turn changed, and +12 −3 counts |
|
|
203
|
-
| `Divider` (`label`)
|
|
203
|
+
| `Divider` (`label`, or children; `role`) | A labelled break in a timeline: a new day, "Context compacted" |
|
|
204
204
|
|
|
205
205
|
## Utilities
|
|
206
206
|
|
package/skills/markdown/SKILL.md
CHANGED
|
@@ -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.
|
|
15
|
+
library_version: '0.3.3'
|
|
16
16
|
requires:
|
|
17
17
|
- setup
|
|
18
18
|
sources:
|
|
@@ -168,7 +168,13 @@ needs the component's state. Never write a new array in the markup:
|
|
|
168
168
|
dollar sign is always text.
|
|
169
169
|
- **`diagrams()`** draws a fenced `mermaid` block as a diagram, with Pele, in Narvi's colours.
|
|
170
170
|
It draws once the fence closes, offers the code and a full-size view that pans and zooms,
|
|
171
|
-
and says why when a diagram can't be drawn.
|
|
171
|
+
and says why when a diagram can't be drawn. The picture is an image named by its source's
|
|
172
|
+
`accTitle`, or by the words in it ("Diagram: Lexer, Parser", `labels.diagramPicture`). A
|
|
173
|
+
failure is read out through the reply's one status region, which every copy button shares:
|
|
174
|
+
a reply holds one `role="status"`, not one per code block, table and diagram.
|
|
175
|
+
- A formula's TeX is not on the page twice: KaTeX's hidden annotation is left out of its
|
|
176
|
+
MathML, so the page's find and a test's `getByText` see only what shows. A copy still takes
|
|
177
|
+
the TeX (from `data-markdown-copy`).
|
|
172
178
|
|
|
173
179
|
Two more are for replies from coding agents:
|
|
174
180
|
|
|
@@ -183,7 +189,9 @@ export const plugins = [
|
|
|
183
189
|
files({
|
|
184
190
|
// Says which paths are real files, and returns them as the app wants them
|
|
185
191
|
resolve: (path) => tree.find(path),
|
|
186
|
-
open: (file) => editor.open(file.path, file.line)
|
|
192
|
+
open: (file) => editor.open(file.path, file.line),
|
|
193
|
+
// Optional: the app's own icons; null keeps Narvi's icon for the kind
|
|
194
|
+
icon: (file) => (file.kind === 'code' ? { url: '/icons/code.svg', color: '#3178c6' } : null)
|
|
187
195
|
}),
|
|
188
196
|
// No image loads unasked unless `allow` says so
|
|
189
197
|
images({ allow: (url) => url.startsWith('https://cdn.example.com/') })
|
|
@@ -193,9 +201,10 @@ export const plugins = [
|
|
|
193
201
|
- **`files()`** turns inline code that names a file into a chip: `src/app.ts`,
|
|
194
202
|
`src/app.ts:42`, `src/app.ts:42:7`, `src/app.ts:42-50` and `src/app.ts#L42-L50`. A Markdown
|
|
195
203
|
link whose address is a file path, with or without a `#L10` fragment, becomes a chip too.
|
|
196
|
-
It keeps the link's words when they're
|
|
197
|
-
words that name another file,
|
|
198
|
-
|
|
204
|
+
It keeps the link's words when they're plain words ("here", "the config") or name that file;
|
|
205
|
+
words that could name another file (a path, a name with an extension, a dotfile, one with an
|
|
206
|
+
underscore such as `id_rsa`, or `README`, `LICENSE`, `Makefile`) are replaced by the real
|
|
207
|
+
name, so a chip can't claim to be a file it isn't. A chip made from code shows the file's name and the place in it (`app.ts:42`),
|
|
199
208
|
and has the whole path as its title. A path that leaves the project (`../x`, `~/x`) is shown
|
|
200
209
|
whole. Network shares, paths that start with `-`, and paths with invisible characters never
|
|
201
210
|
become chips. With `open` it's a button that calls
|
|
@@ -205,6 +214,13 @@ export const plugins = [
|
|
|
205
214
|
what it returns becomes `file.path`.
|
|
206
215
|
Without `resolve`, only text that looks like a path becomes a chip: "and/or", `v1.2.3` and
|
|
207
216
|
`github.com/owner/repo` don't.
|
|
217
|
+
Each chip has an icon for its kind (`fileKind`): a folder (a path written or resolved with a
|
|
218
|
+
slash at its end, `src/lib/`), code, an image, text, data, or any other file. `icon(file)`,
|
|
219
|
+
given the file and its `kind`, returns the app's own: `{ url, color? }`, an SVG drawn as a
|
|
220
|
+
mask in `color` (any CSS colour, `light-dark()` too). Don't draw the `file` node with a
|
|
221
|
+
component of your own for its icon: a finished reply is then built from parts instead of
|
|
222
|
+
written as markup, which is slower to show. A plugin that does take the node over can keep
|
|
223
|
+
the fast path by giving `static.file` too.
|
|
208
224
|
- **`images()`** holds an image the app hasn't allowed: it shows as a button that names the
|
|
209
225
|
image's host, and loads when pressed. By default no image loads unasked, not even one from
|
|
210
226
|
the app's own site, since that's a request with the person's cookies. To let the app's own
|
package/skills/setup/SKILL.md
CHANGED
package/skills/styling/SKILL.md
CHANGED
|
@@ -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.
|
|
15
|
+
library_version: '0.3.3'
|
|
16
16
|
requires:
|
|
17
17
|
- setup
|
|
18
18
|
sources:
|
|
@@ -73,8 +73,10 @@ package root) breaks them.
|
|
|
73
73
|
surface it rests on, and no heavier), `borderControlHover`. Shade: `shadow` (the
|
|
74
74
|
one drop, under what floats over the page) and `scrim` (behind a dialog). Text: `text`,
|
|
75
75
|
`textMuted`, `textSubtle`. The accent, which marks state: `accent`, `accentVivid`, `onAccent`,
|
|
76
|
-
`accentSoft`, `focusRing`, `focusHalo`. Status: `success`, `warning`, `danger`,
|
|
77
|
-
|
|
76
|
+
`accentSoft`, `focusRing`, `focusHalo`. Status: `success`, `warning`, `danger`, `info` (what
|
|
77
|
+
is only to be known, such as a note or a review comment: a blue of its own that stays blue
|
|
78
|
+
whatever accent a preset picks), and their `…Soft` (fills) and `…Text` (text on a soft fill)
|
|
79
|
+
variants. Don't use `accent` for an info note, and don't use `info` for focus or selection. Syntax: `codeKey`, `codeString`,
|
|
78
80
|
`codeNumber`, `codeLiteral`, `codePunct`. The primary button: `primary`, `onPrimary`. The
|
|
79
81
|
thumb of a switch or slider: `thumb`.
|
|
80
82
|
- `space`: a 4px scale from `x1` (4px) to `x16` (64px), with `x1_5` (6px) between an icon and
|
|
@@ -92,6 +94,11 @@ package root) breaks them.
|
|
|
92
94
|
`stylex.attrs(typography.caption, styles.count)`.
|
|
93
95
|
- `visuallyHidden` (from the package root) hides an element from sight and keeps it for
|
|
94
96
|
assistive technology: `stylex.attrs(visuallyHidden)`. Don't write your own.
|
|
97
|
+
- `focusRing` (from the package root) is focus as Narvi's parts show it. `focusRing.ring` goes on
|
|
98
|
+
a control of your own: a 2px ring in the accent, 2px out, from the keyboard, and an edge in
|
|
99
|
+
forced colours. `focusRing.frame` goes on a box around a field of your own, such as an editor:
|
|
100
|
+
its hairline takes the ring and halo while the field inside is typed into, as a text field's
|
|
101
|
+
does. Don't redraw either with `:focus-visible` styles of your own.
|
|
95
102
|
- `play.whileVisible`: the `animationPlayState` for an animation that never ends. Attach
|
|
96
103
|
`whileVisible` (from the package root) to its element and it runs only while it can be seen.
|
|
97
104
|
Step such an animation (`steps(30)` over two seconds) so it costs a few frames a second.
|
package/skills/theming/SKILL.md
CHANGED
|
@@ -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.
|
|
14
|
+
library_version: '0.3.3'
|
|
15
15
|
requires:
|
|
16
16
|
- setup
|
|
17
17
|
sources:
|
|
@@ -153,6 +153,7 @@ const accent = 'var(--app-accent, light-dark(#0164cf, #72acfe))';
|
|
|
153
153
|
const success = 'var(--app-success, light-dark(#007835, #37d16c))';
|
|
154
154
|
const warning = 'var(--app-warning, light-dark(#8b6001, #f5af20))';
|
|
155
155
|
const danger = 'var(--app-danger, light-dark(#c92228, #ff7a70))';
|
|
156
|
+
const info = 'var(--app-info, light-dark(#0164cf, #72acfe))';
|
|
156
157
|
|
|
157
158
|
export const runtimeTheme = stylex.createTheme(colors, {
|
|
158
159
|
bg,
|
|
@@ -184,12 +185,15 @@ export const runtimeTheme = stylex.createTheme(colors, {
|
|
|
184
185
|
success,
|
|
185
186
|
warning,
|
|
186
187
|
danger,
|
|
188
|
+
info,
|
|
187
189
|
successSoft: `color-mix(in oklab, ${success} 14%, transparent)`,
|
|
188
190
|
warningSoft: `color-mix(in oklab, ${warning} 14%, transparent)`,
|
|
189
191
|
dangerSoft: `color-mix(in oklab, ${danger} 14%, transparent)`,
|
|
192
|
+
infoSoft: `color-mix(in oklab, ${info} 14%, transparent)`,
|
|
190
193
|
successText: `color-mix(in oklab, ${success} 70%, ${text})`,
|
|
191
194
|
warningText: `color-mix(in oklab, ${warning} 70%, ${text})`,
|
|
192
|
-
dangerText: `color-mix(in oklab, ${danger} 70%, ${text})
|
|
195
|
+
dangerText: `color-mix(in oklab, ${danger} 70%, ${text})`,
|
|
196
|
+
infoText: `color-mix(in oklab, ${info} 70%, ${text})`
|
|
193
197
|
});
|
|
194
198
|
```
|
|
195
199
|
|
|
@@ -255,8 +259,11 @@ scheme changes (`matchMedia('(prefers-color-scheme: dark)')`, or your toggle).
|
|
|
255
259
|
`bgWindow` is `bg` a shade deeper. Change the neutrals and these keep
|
|
256
260
|
the old tint unless they are overridden as well. A preset from narvi.dpeter.dev/create does it.
|
|
257
261
|
- **MEDIUM: using the accent for decoration.** `accent` means "state": focus, selection, progress,
|
|
258
|
-
something live. Status uses `success`, `warning` and `
|
|
259
|
-
`accent` makes the state colour stop meaning anything.
|
|
262
|
+
something live. Status uses `success`, `warning`, `danger` and `info`. Painting headings or
|
|
263
|
+
icons in `accent` makes the state colour stop meaning anything.
|
|
264
|
+
- **MEDIUM: a theme that sets the statuses but not `info`.** `info`, `infoSoft` and `infoText`
|
|
265
|
+
are tokens too: leave them out and an info Notice, toast or Badge keeps Narvi's
|
|
266
|
+
blue beside your own statuses.
|
|
260
267
|
- **MEDIUM: overriding `bg` or `text` without the root.** `base.css` paints `:root` with copies
|
|
261
268
|
of those two. Set the root's `background-color` and `color` to match your override.
|
|
262
269
|
- **HIGH: a variable without a fallback.** `accent: 'var(--app-accent)'` makes the token invalid
|