@diegopluna/narvi 0.3.6 → 0.3.8
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/ActivityStep.svelte +86 -6
- package/dist/components/activity/ActivityStep.svelte.d.ts +17 -2
- package/dist/components/activity/index.d.ts +1 -1
- package/dist/components/app-shell/AppShellMain.svelte +62 -2
- package/dist/components/app-shell/AppShellMain.svelte.d.ts +1 -1
- package/dist/components/app-shell/AppShellPanel.svelte +37 -11
- package/dist/components/app-shell/AppShellPanel.svelte.d.ts +13 -0
- package/dist/components/app-shell/AppShellSidebar.svelte +30 -10
- package/dist/components/command/CommandDialog.svelte +9 -2
- package/dist/components/command/CommandDialog.svelte.d.ts +4 -0
- package/dist/components/command/CommandEmpty.svelte +38 -4
- package/dist/components/command/CommandEmpty.svelte.d.ts +18 -2
- package/dist/components/command/CommandFooter.svelte +5 -7
- package/dist/components/command/CommandFooter.svelte.d.ts +4 -1
- package/dist/components/command/CommandInput.svelte +13 -1
- package/dist/components/command/CommandInput.svelte.d.ts +11 -0
- package/dist/components/command/CommandItem.svelte +32 -6
- package/dist/components/command/CommandItem.svelte.d.ts +20 -0
- package/dist/components/command/CommandRoot.svelte +68 -9
- package/dist/components/command/CommandRoot.svelte.d.ts +13 -3
- package/dist/components/command/styles.d.ts +50 -8
- package/dist/components/command/styles.js +50 -8
- package/dist/components/markdown/Markdown.svelte +14 -4
- package/dist/components/menu/MenuContent.svelte +7 -1
- package/dist/components/menu/MenuContent.svelte.d.ts +10 -0
- package/dist/components/sidebar/SidebarFolder.svelte +2 -1
- package/dist/components/sidebar/SidebarGroup.svelte +2 -1
- package/dist/components/sidebar/SidebarItem.svelte +34 -4
- package/dist/components/split-button/SplitButton.svelte +54 -15
- package/dist/components/split-button/SplitButton.svelte.d.ts +21 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -2
- package/dist/internal/Collapse.svelte +16 -1
- package/dist/internal/Collapse.svelte.d.ts +2 -0
- package/dist/internal/fold-shown.d.ts +3 -0
- package/dist/internal/fold-shown.js +14 -0
- package/dist/internal/layer.d.ts +6 -3
- package/dist/internal/layer.js +13 -6
- package/dist/internal/visible.d.ts +24 -1
- package/dist/internal/visible.js +25 -1
- package/package.json +1 -1
- package/skills/building-ui/SKILL.md +15 -15
- package/skills/building-ui/references/components.md +79 -15
- package/skills/markdown/SKILL.md +1 -1
- package/skills/setup/SKILL.md +1 -1
- package/skills/styling/SKILL.md +7 -1
- package/skills/theming/SKILL.md +1 -1
|
@@ -38,7 +38,7 @@ component: import the namespace (`Dialog`) and use `Dialog.Root`. Docs and live
|
|
|
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? }[]`, `onchange`) | `segmented-control` |
|
|
40
40
|
| `Slider` | A value or a range along a track | `slider` |
|
|
41
|
-
| `SplitButton` | A main action joined to a menu of how to do it (`menu`, `menuLabel`, `label`, `variant`)
|
|
41
|
+
| `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` |
|
|
42
42
|
| `Toggle` | A button that stays pressed (`tone`: `accent`, or `neutral` for toolbar icons) | `toggle` |
|
|
43
43
|
| `ToggleGroup.Root`, `.Item` | Toggles that belong together: one pressed, or any number | `toggle-group` |
|
|
44
44
|
| `SettingsGroup` | A titled group of settings: a heading, an action, the rows on one card | `settings-group` |
|
|
@@ -47,20 +47,51 @@ component: import the namespace (`Dialog`) and use `Dialog.Root`. Docs and live
|
|
|
47
47
|
| `SearchButton` | Looks like a search field and opens search (`label`, `shortcut`): for a window's bar | `search-button` |
|
|
48
48
|
| `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` |
|
|
49
49
|
|
|
50
|
+
### Tab strips
|
|
51
|
+
|
|
52
|
+
A side panel's tabs are a `TabStrip`: `menu` (a snippet of Menu parts, given the tab:
|
|
53
|
+
right-click, the menu key, a long press), `onmove(id, index)` (drag, or Alt+Shift+arrow),
|
|
54
|
+
`onrename(id, label)` with `bind:renaming` (double-click, F2, or a menu's Rename), `trailing`
|
|
55
|
+
for a tab's own buttons, `beside` for the tab shown in a split, and per tab `tabId`, `panelId`,
|
|
56
|
+
`title`, `renamable`. Arrows open the tab they reach (`activation="manual"` only moves focus);
|
|
57
|
+
`onchange(id)`; a name cleared comes as `''`; `addMenu` (Menu parts) makes the add button open
|
|
58
|
+
a menu.
|
|
59
|
+
|
|
60
|
+
### Split buttons
|
|
61
|
+
|
|
62
|
+
`SplitButton` takes a `menu` snippet, `menuLabel` for the chevron and `label` for the group.
|
|
63
|
+
Both halves are disabled together; `mainDisabled` disables the main one alone, so the menu stays
|
|
64
|
+
in reach. Without `menu` it stands alone. `variant="ghost"` is the quiet one for a bar, with a
|
|
65
|
+
short line between the halves (give it a fill of its own with `sx`); `shape="pill"` rounds its
|
|
66
|
+
outer ends; `mainSx` and `menuSx` style each half after its own styles; `menuWidth` and
|
|
67
|
+
`menuMinWidth` size the menu, as `Menu.Content`'s `width` and `minWidth` do.
|
|
68
|
+
|
|
50
69
|
## Overlays (bits-ui; use `child` snippets on triggers)
|
|
51
70
|
|
|
52
|
-
| Component | Use it for
|
|
53
|
-
| --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
54
|
-
| `Dialog.Root`, `.Trigger`, `.Content` (`size`, `side`, `as`), `.Header`, `.Title`, `.Description`, `.Body`, `.Footer`, `.Close` | A focused task over the page
|
|
55
|
-
| `ConfirmDialog` | A confirmation for an action that matters
|
|
56
|
-
| `Sheet.Root`, `.Trigger`, `.Content` (`side`, `size`, `focusOnOpen`), `.Header`, `.Title`, `.Description`, `.Body`, `.Footer`, `.Close` | A panel that slides in from an edge
|
|
57
|
-
| `Popover.Root`, `.Trigger`, `.Content` (`padding`, `layout`, `width`), `.Close` | Content anchored to the control that opened it
|
|
58
|
-
| `HoverCard.Root`, `.Trigger`, `.Content` (`layout`, `padding`) | A preview while the pointer rests on a link or chip
|
|
59
|
-
| `Menu.Root`, `.Trigger`, `.Content`, `.Item`, `.CheckboxItem`, `.RadioGroup`, `.RadioItem`, `.Group`, `.Label`, `.Separator`, `.Sub` | Actions and choices from a button; items take `description` (text or a snippet) and `trailing`
|
|
60
|
-
| `ContextMenu.Root`, `.Trigger`, `.Content`, filled with `Menu` items | The same, from a right-click
|
|
61
|
-
| `Command.Dialog`, `.Root`, `.Input`, `.List`, `.Group`, `.Item`, `.Empty`, `.Separator`, `.Footer` | A search field over everything the app can do (⌘K); drive it from outside with `Input` `bind:value`, `Root` `shouldFilter={false}` and `bind:value` (the highlighted item), and `Dialog` `onescape`, `restoreFocus`; items
|
|
62
|
-
| `Tooltip.Provider`, `.Root`, `.Trigger`, `.Content` (`shortcut`, `layout`) | A control's name and its keys. Needs the Provider
|
|
63
|
-
| `Collapsible.Root`, `.Trigger`, `.Content` | A region the person can fold away
|
|
71
|
+
| Component | Use it for | Docs slug |
|
|
72
|
+
| --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
|
|
73
|
+
| `Dialog.Root`, `.Trigger`, `.Content` (`size`, `side`, `as`), `.Header`, `.Title`, `.Description`, `.Body`, `.Footer`, `.Close` | A focused task over the page | `dialog` |
|
|
74
|
+
| `ConfirmDialog` | A confirmation for an action that matters | `dialog` |
|
|
75
|
+
| `Sheet.Root`, `.Trigger`, `.Content` (`side`, `size`, `focusOnOpen`), `.Header`, `.Title`, `.Description`, `.Body`, `.Footer`, `.Close` | A panel that slides in from an edge | `sheet` |
|
|
76
|
+
| `Popover.Root`, `.Trigger`, `.Content` (`padding`, `layout`, `width`), `.Close` | Content anchored to the control that opened it | `popover` |
|
|
77
|
+
| `HoverCard.Root`, `.Trigger`, `.Content` (`layout`, `padding`) | A preview while the pointer rests on a link or chip | `hover-card` |
|
|
78
|
+
| `Menu.Root`, `.Trigger`, `.Content`, `.Item`, `.CheckboxItem`, `.RadioGroup`, `.RadioItem`, `.Group`, `.Label`, `.Separator`, `.Sub` | Actions and choices from a button; items take `description` (text or a snippet) and `trailing` | `menu` |
|
|
79
|
+
| `ContextMenu.Root`, `.Trigger`, `.Content`, filled with `Menu` items | The same, from a right-click | `menu` |
|
|
80
|
+
| `Command.Dialog`, `.Root`, `.Input`, `.List`, `.Group`, `.Item`, `.Empty`, `.Separator`, `.Footer` | A search field over everything the app can do (⌘K); drive it from outside with `Input` `bind:value`, `Root` `shouldFilter={false}` and `bind:value` (the highlighted item), and `Dialog` `onescape`, `restoreFocus`, `sx`; `Input` an `end` snippet; items a snippet `detail`, `wrapDetail`, `badge` and a `hint`; `Empty` a `status` (`loading`, `error`) | `command` |
|
|
81
|
+
| `Tooltip.Provider`, `.Root`, `.Trigger`, `.Content` (`shortcut`, `layout`) | A control's name and its keys. Needs the Provider | `tooltip` |
|
|
82
|
+
| `Collapsible.Root`, `.Trigger`, `.Content` | A region the person can fold away | `collapsible` |
|
|
83
|
+
|
|
84
|
+
### Palettes
|
|
85
|
+
|
|
86
|
+
`Command.Root` passes keys to its list only from the root and its `Command.Input`: a button, a
|
|
87
|
+
field or a form of yours inside it keeps its keys, Enter among them, and the field keeps Home and
|
|
88
|
+
End for its caret. Ctrl+J/K/N/P are left to the app unless `vimBindings` is set. When the
|
|
89
|
+
highlighted item is removed, the highlight goes back to the first. `Command.Input` takes an `end`
|
|
90
|
+
snippet after the field; `Command.Item` a `badge` after the label and `wrapDetail` for a path
|
|
91
|
+
whose end matters; `Command.Empty` a `status` of `loading` (a spinner) or `error` (the danger
|
|
92
|
+
colour); `Command.Dialog` an `sx` for its place and width. `Command.Footer` is read out: pass
|
|
93
|
+
`aria-hidden="true"` only for hints alone. Command.Empty is not announced; say loading and
|
|
94
|
+
errors with an `Announcer` too.
|
|
64
95
|
|
|
65
96
|
## Feedback and status
|
|
66
97
|
|
|
@@ -135,6 +166,12 @@ toggle in the sidebar's head and one with `when="closed"` in the page's header,
|
|
|
135
166
|
while the sidebar is away. `windowInset` then clears the traffic lights in whichever head is
|
|
136
167
|
first. Don't use a rail without a bar in a window that has traffic lights: they are wider than it.
|
|
137
168
|
|
|
169
|
+
A `Sidebar.Item` out of sight is not laid out or painted (`content-visibility: auto`): it keeps
|
|
170
|
+
the size it was last drawn at, or 30px for one line and 50px for two until then. Nothing it draws
|
|
171
|
+
reaches past its box, its actions' focus ring included. Don't add containment of your own through
|
|
172
|
+
`itemProps`, don't turn it off while a row has focus, and don't virtualise a list of rows to save
|
|
173
|
+
their drawing: they are already skipped, and stay in the accessibility tree and the page's find.
|
|
174
|
+
|
|
138
175
|
```svelte
|
|
139
176
|
<AppShell.Root bind:sidebarOpen windowInset="5.25rem">
|
|
140
177
|
<AppShell.Sheet flush>
|
|
@@ -150,6 +187,19 @@ first. Don't use a rail without a bar in a window that has traffic lights: they
|
|
|
150
187
|
</AppShell.Root>
|
|
151
188
|
```
|
|
152
189
|
|
|
190
|
+
### Panels
|
|
191
|
+
|
|
192
|
+
`AppShell.Panel` is raised wherever it stands, so don't give it `bgRaised` of your own. In a
|
|
193
|
+
flex row of yours inside `AppShell.Main`, lying over the row it makes the row's other children
|
|
194
|
+
inert, and with `hideCovered` hides them too (still laid out, so their scroll is kept); they
|
|
195
|
+
come back as they were. `edgeLabel` names its resize edge for assistive technology ("Resize
|
|
196
|
+
panel"), and `edgeTitle` gives the edge a tooltip ("Drag to resize, double-click to reset").
|
|
197
|
+
|
|
198
|
+
The sidebar beside the page gives or takes its room at once and slides on a transform, so the
|
|
199
|
+
page is laid out once per show or hide. What is under `AppShell.Header` glides on `translate`
|
|
200
|
+
for 200ms; the header, the panel and its edge take their places at once. Don't animate the
|
|
201
|
+
sidebar's width yourself, and don't put a `translate` of your own on `AppShell.Main`'s children.
|
|
202
|
+
|
|
153
203
|
## AI chat
|
|
154
204
|
|
|
155
205
|
| Component | Use it for | Docs slug |
|
|
@@ -203,11 +253,25 @@ Docs slug: `agent-timeline`.
|
|
|
203
253
|
| `ChangesSummary` (`ChangedFile[]`), `ChangeStats` (`additions`, `deletions`) | What a turn changed, and +12 −3 counts |
|
|
204
254
|
| `Divider` (`label`, or children; `role`) | A labelled break in a timeline: a new day, "Context compacted" |
|
|
205
255
|
|
|
256
|
+
Folds (`Collapsible`, `Tool`, `Reasoning`, `Activity`, `WorkFold`) build their content the
|
|
257
|
+
first time they open and keep it after. Don't query elements inside one that was never opened,
|
|
258
|
+
and don't wrap its content in an `{#if open}` of your own. `Activity.Step`'s `output` opens at
|
|
259
|
+
its end once its box can be seen, and stays there as more is printed unless the reader scrolls
|
|
260
|
+
up: don't scroll it yourself. It is measured only while its fold is open. Past `tail` (4,000
|
|
261
|
+
characters) only the end shows, under a "Show all output" button of the step's own; bind
|
|
262
|
+
`showAll` to keep that choice where the conversation is drawn again, and set it when a find of
|
|
263
|
+
your own matches the part cut off, which the step marks with `data-output-cut`. Leave out the
|
|
264
|
+
words of `[data-activity-step-toggle]` from what such a find searches. Don't add a button of
|
|
265
|
+
your own for it. `outputLabels` renames it.
|
|
266
|
+
|
|
206
267
|
## Utilities
|
|
207
268
|
|
|
208
269
|
- `sx()`, `classes()` and the `Sx` type: see the `styling` skill.
|
|
209
270
|
- `resolveColor()` and `resolveRgba()`: see the `theming` skill.
|
|
210
271
|
- `whileVisible`: an attachment that runs an animation that never ends only while it can be seen, with `animationPlayState: play.whileVisible` from the tokens. Step the animation itself.
|
|
211
|
-
Shimmer, Skeleton and
|
|
212
|
-
one turn in 600ms, so it stays smooth.
|
|
272
|
+
Shimmer, Skeleton, Progress and Markdown's caret run on it, stepped. Spinner pauses with it
|
|
273
|
+
too, but is not stepped: it is a CSS animation of `rotate`, one turn in 600ms, so it stays smooth.
|
|
274
|
+
- `setPageHidden(hidden)`: tells Narvi the host has hidden the page where the document cannot
|
|
275
|
+
tell, such as a minimized Electron window that keeps running. Every `whileVisible` animation
|
|
276
|
+
pauses until it is called with `false`.
|
|
213
277
|
- `DevStyles`: see the `setup` skill.
|
package/skills/markdown/SKILL.md
CHANGED
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.8'
|
|
16
16
|
requires:
|
|
17
17
|
- setup
|
|
18
18
|
sources:
|
|
@@ -23,6 +23,7 @@ sources:
|
|
|
23
23
|
- src/routes/docs/styling/+page.svelte
|
|
24
24
|
- src/lib/markers.stylex.ts
|
|
25
25
|
- src/lib/visually-hidden.ts
|
|
26
|
+
- src/lib/internal/visible.ts
|
|
26
27
|
- src/lib/typography.ts
|
|
27
28
|
---
|
|
28
29
|
|
|
@@ -102,6 +103,11 @@ package root) breaks them.
|
|
|
102
103
|
- `play.whileVisible`: the `animationPlayState` for an animation that never ends. Attach
|
|
103
104
|
`whileVisible` (from the package root) to its element and it runs only while it can be seen.
|
|
104
105
|
Step such an animation (`steps(30)` over two seconds) so it costs a few frames a second.
|
|
106
|
+
- `setPageHidden(hidden)` (from the package root) is the host's word that the page is out of
|
|
107
|
+
sight where `document.hidden` stays false, as in an Electron window with background
|
|
108
|
+
throttling off, minimized or closed to the tray. Call it with `true` then and `false` when the
|
|
109
|
+
window is back: every `whileVisible` animation pauses meanwhile, Narvi's spinners, shimmers,
|
|
110
|
+
skeletons, progress bars and Markdown's caret among them. Don't pause them by hand.
|
|
105
111
|
- `motion`: `fast` 120ms, `base` 150ms, `slow` 200ms; `easeOut` for feedback, `easeInOut` for
|
|
106
112
|
things that travel. Nothing in an interface takes longer than `motion.slow`.
|
|
107
113
|
- `pageMotion`: a slower scale for pages read as they scroll (`Reveal` uses it). Never use it
|
package/skills/theming/SKILL.md
CHANGED