@diegopluna/narvi 0.5.7 → 0.5.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/dialog/ConfirmDialog.svelte +17 -5
- package/dist/components/dialog/DialogDescription.svelte +15 -1
- package/dist/components/dialog/DialogRoot.svelte +3 -0
- package/dist/components/dialog/DialogTitle.svelte +13 -1
- package/dist/components/dialog/styles.d.ts +3 -0
- package/dist/components/dialog/styles.js +2 -0
- package/dist/components/toast/Toaster.svelte +32 -22
- package/dist/components/toast/toasts.svelte.d.ts +14 -1
- package/dist/components/toast/toasts.svelte.js +7 -5
- package/dist/internal/closing.svelte.d.ts +16 -0
- package/dist/internal/closing.svelte.js +76 -0
- package/package.json +24 -24
- package/skills/building-ui/SKILL.md +3 -3
- package/skills/building-ui/references/components.md +15 -15
- package/skills/markdown/SKILL.md +1 -1
- package/skills/setup/SKILL.md +2 -2
- package/skills/styling/SKILL.md +1 -1
- package/skills/theming/SKILL.md +1 -1
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
import Button from '../button/Button.svelte';
|
|
24
24
|
import Notice from '../notice/Notice.svelte';
|
|
25
25
|
import { nestDialog, popupContainer } from '../../internal/popup.js';
|
|
26
|
+
import { unbindLater } from '../../internal/closing.svelte.js';
|
|
26
27
|
import { dialog } from './styles.js';
|
|
27
28
|
|
|
28
29
|
export type ConfirmDialogProps = {
|
|
@@ -154,6 +155,15 @@
|
|
|
154
155
|
$effect(() => {
|
|
155
156
|
if (open) error = undefined;
|
|
156
157
|
});
|
|
158
|
+
|
|
159
|
+
// What it said as it closed, until it has gone: an answer that clears what the dialog is
|
|
160
|
+
// about would otherwise blank its title and take its description away as it fades
|
|
161
|
+
type Words = Pick<ConfirmDialogProps, 'title' | 'description' | 'warning'>;
|
|
162
|
+
let kept = $state.raw<Words>();
|
|
163
|
+
$effect.pre(() => {
|
|
164
|
+
if (open) kept = { title, description, warning };
|
|
165
|
+
});
|
|
166
|
+
const words = $derived<Words>(open || !kept ? { title, description, warning } : kept);
|
|
157
167
|
</script>
|
|
158
168
|
|
|
159
169
|
<!-- While the action runs, nothing but the action closes it: not Escape, not Cancel -->
|
|
@@ -172,13 +182,15 @@
|
|
|
172
182
|
<AlertDialogBackdrop {...stylex.attrs(dialog.overlay, nested && dialog.nested)} />
|
|
173
183
|
<AlertDialogContent {...stylex.attrs(dialog.content, styles.content)}>
|
|
174
184
|
<div {...stylex.attrs(dialog.header, styles.header)}>
|
|
175
|
-
<AlertDialogTitle {...stylex.attrs(dialog.title)}>{title}</AlertDialogTitle>
|
|
176
|
-
{#if description || warning}
|
|
185
|
+
<AlertDialogTitle {...stylex.attrs(dialog.title)}>{words.title}</AlertDialogTitle>
|
|
186
|
+
{#if words.description || words.warning}
|
|
177
187
|
<AlertDialogDescription {...stylex.attrs(styles.describe)}>
|
|
178
188
|
{#snippet render({ props })}
|
|
179
|
-
<div {...props}>
|
|
180
|
-
{#if
|
|
181
|
-
|
|
189
|
+
<div {...unbindLater(props)}>
|
|
190
|
+
{#if words.description}
|
|
191
|
+
<p {...stylex.attrs(dialog.description)}>{words.description}</p>
|
|
192
|
+
{/if}
|
|
193
|
+
{#if words.warning}<Notice tone="warning">{words.warning}</Notice>{/if}
|
|
182
194
|
</div>
|
|
183
195
|
{/snippet}
|
|
184
196
|
</AlertDialogDescription>
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
3
|
import { DialogDescription as UiDialogDescription } from '@ui-sdk/svelte/dialog';
|
|
4
4
|
import type { Snippet } from 'svelte';
|
|
5
|
+
import * as stylex from '@stylexjs/stylex';
|
|
6
|
+
import { keepWhileClosing, place, unbindLater } from '../../internal/closing.svelte.js';
|
|
5
7
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
6
8
|
import { dialog } from './styles.js';
|
|
7
9
|
|
|
@@ -15,9 +17,21 @@
|
|
|
15
17
|
|
|
16
18
|
<script lang="ts">
|
|
17
19
|
let { sx, class: className, children, ...rest }: DialogDescriptionProps = $props();
|
|
20
|
+
|
|
21
|
+
let element = $state<HTMLElement>();
|
|
22
|
+
// What it said as the dialog closed, until the dialog has gone
|
|
23
|
+
const kept = keepWhileClosing(() => element);
|
|
18
24
|
</script>
|
|
19
25
|
|
|
20
26
|
<!-- A div, as bits-ui's was, so a description can hold more than a line of text -->
|
|
21
27
|
<UiDialogDescription {...rest} {...attrs([dialog.description, sx], className)}>
|
|
22
|
-
{#snippet render({ props })}
|
|
28
|
+
{#snippet render({ props })}
|
|
29
|
+
<div bind:this={element} {...unbindLater(props)}>
|
|
30
|
+
{#if kept()}
|
|
31
|
+
<span {...stylex.attrs(dialog.kept)} {@attach place(kept()!)}></span>
|
|
32
|
+
{:else}
|
|
33
|
+
{@render children?.()}
|
|
34
|
+
{/if}
|
|
35
|
+
</div>
|
|
36
|
+
{/snippet}
|
|
23
37
|
</UiDialogDescription>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
3
|
import { Dialog } from '@ui-sdk/svelte/dialog';
|
|
4
|
+
import { provideDialogOpen } from '../../internal/closing.svelte.js';
|
|
4
5
|
import { usePopupContainer } from '../../internal/popup.js';
|
|
5
6
|
|
|
6
7
|
// No `presentation`: ui-sdk's own sheet moves itself, where Narvi's content is placed and
|
|
@@ -19,6 +20,8 @@
|
|
|
19
20
|
|
|
20
21
|
// The root's container is the backdrop's as well as the content's
|
|
21
22
|
const target = usePopupContainer(() => container);
|
|
23
|
+
// Its title and description keep their text while it closes
|
|
24
|
+
provideDialogOpen(() => open);
|
|
22
25
|
</script>
|
|
23
26
|
|
|
24
27
|
<!--
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
3
|
import { DialogTitle as UiDialogTitle } from '@ui-sdk/svelte/dialog';
|
|
4
4
|
import type { Snippet } from 'svelte';
|
|
5
|
+
import * as stylex from '@stylexjs/stylex';
|
|
6
|
+
import { keepWhileClosing, place, unbindLater } from '../../internal/closing.svelte.js';
|
|
5
7
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
6
8
|
import { dialog } from './styles.js';
|
|
7
9
|
|
|
@@ -17,11 +19,21 @@
|
|
|
17
19
|
|
|
18
20
|
<script lang="ts">
|
|
19
21
|
let { level = 2, sx, class: className, children, ...rest }: DialogTitleProps = $props();
|
|
22
|
+
|
|
23
|
+
let element = $state<HTMLElement>();
|
|
24
|
+
// What it said as the dialog closed, until the dialog has gone
|
|
25
|
+
const kept = keepWhileClosing(() => element);
|
|
20
26
|
</script>
|
|
21
27
|
|
|
22
28
|
<!-- Names the dialog for assistive technology -->
|
|
23
29
|
<UiDialogTitle {...rest} {...attrs([dialog.title, sx], className)}>
|
|
24
30
|
{#snippet render({ props })}
|
|
25
|
-
<svelte:element this={`h${level}`} {
|
|
31
|
+
<svelte:element this={`h${level}`} bind:this={element} {...unbindLater(props)}>
|
|
32
|
+
{#if kept()}
|
|
33
|
+
<span {...stylex.attrs(dialog.kept)} {@attach place(kept()!)}></span>
|
|
34
|
+
{:else}
|
|
35
|
+
{@render children?.()}
|
|
36
|
+
{/if}
|
|
37
|
+
</svelte:element>
|
|
26
38
|
{/snippet}
|
|
27
39
|
</UiDialogTitle>
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as stylex from '@stylexjs/stylex';
|
|
2
2
|
export declare const dialog: Readonly<{
|
|
3
|
+
readonly kept: Readonly<{
|
|
4
|
+
readonly display: stylex.StyleXClassNameFor<"display", "contents">;
|
|
5
|
+
}>;
|
|
3
6
|
readonly overlay: Readonly<{
|
|
4
7
|
readonly position: stylex.StyleXClassNameFor<"position", "fixed">;
|
|
5
8
|
readonly inset: stylex.StyleXClassNameFor<"inset", 0>;
|
|
@@ -8,6 +8,8 @@ const STARTING = ':is([data-starting-style])';
|
|
|
8
8
|
/** A length at the window's density (`density` in the tokens). */
|
|
9
9
|
const d = (rem) => `calc(${rem} * ${density.factor})`;
|
|
10
10
|
export const dialog = stylex.create({
|
|
11
|
+
// What a title or a description keeps while its dialog closes, laid out as its children were
|
|
12
|
+
kept: { display: 'contents' },
|
|
11
13
|
overlay: {
|
|
12
14
|
// ui-sdk opens the backdrop and the dialog in the top layer, the backdrop just below it, so
|
|
13
15
|
// the order of opening stacks them: a menu or a select opened from a dialog is over it
|
|
@@ -119,6 +119,9 @@
|
|
|
119
119
|
transitionTimingFunction: motion.easeOut
|
|
120
120
|
},
|
|
121
121
|
icon: { display: 'grid', placeItems: 'center', width: '1rem', height: '1.25rem' },
|
|
122
|
+
// An app's own icon grows as wide as it is, at least the glyph's room. It keeps the title's
|
|
123
|
+
// line height, so one taller than the line stays centred on it, spilling into the padding.
|
|
124
|
+
own: { width: 'auto', minWidth: '1rem' },
|
|
122
125
|
dot: {
|
|
123
126
|
width: '0.375rem',
|
|
124
127
|
height: '0.375rem',
|
|
@@ -290,28 +293,35 @@
|
|
|
290
293
|
if (region && typeof region.showPopover === 'function') raise(region);
|
|
291
294
|
}}
|
|
292
295
|
>
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
data.
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
(
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
296
|
+
{#if data.icon}
|
|
297
|
+
<!-- The title says what it shows; the announcer reads only the title and description -->
|
|
298
|
+
<span aria-hidden="true" {...stylex.attrs(styles.icon, styles.own)}>
|
|
299
|
+
{@render data.icon()}
|
|
300
|
+
</span>
|
|
301
|
+
{:else}
|
|
302
|
+
<span
|
|
303
|
+
{...stylex.attrs(
|
|
304
|
+
styles.icon,
|
|
305
|
+
data.tone === 'info' && styles.info,
|
|
306
|
+
data.tone === 'success' && styles.success,
|
|
307
|
+
data.tone === 'warning' && styles.warning,
|
|
308
|
+
data.tone === 'error' && styles.error,
|
|
309
|
+
(data.tone === 'default' || data.tone === 'loading') && styles.muted
|
|
310
|
+
)}
|
|
311
|
+
>
|
|
312
|
+
{#if data.tone === 'loading'}
|
|
313
|
+
<Spinner size={14} label={null} />
|
|
314
|
+
{:else if data.tone === 'success'}
|
|
315
|
+
<Glyph name="check" stroke={1.75} />
|
|
316
|
+
{:else if data.tone === 'error' || data.tone === 'warning'}
|
|
317
|
+
<Glyph name="alert" />
|
|
318
|
+
{:else if data.tone === 'info'}
|
|
319
|
+
<Glyph name="info" />
|
|
320
|
+
{:else}
|
|
321
|
+
<span {...stylex.attrs(styles.dot)}></span>
|
|
322
|
+
{/if}
|
|
323
|
+
</span>
|
|
324
|
+
{/if}
|
|
315
325
|
<div {...stylex.attrs(styles.text)}>
|
|
316
326
|
<ToastTitle {...stylex.attrs(styles.title)} />
|
|
317
327
|
<ToastDescription {...stylex.attrs(styles.description)} />
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toasts: short notes about something that happened away from where the person
|
|
3
|
+
* is looking. Call `toast()` from anywhere; one <Toaster /> shows them.
|
|
4
|
+
*/
|
|
5
|
+
import type { Snippet } from 'svelte';
|
|
1
6
|
export type ToastTone = 'default' | 'info' | 'success' | 'warning' | 'error' | 'loading';
|
|
2
7
|
/** A toast's id: the one `toast()` returns, or one of your own given as `id`. */
|
|
3
8
|
export type ToastId = string | number;
|
|
@@ -14,6 +19,13 @@ export type ToastOptions = {
|
|
|
14
19
|
id?: ToastId | undefined;
|
|
15
20
|
description?: string | undefined;
|
|
16
21
|
tone?: ToastTone | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Your own icon, drawn in place of the tone's: the avatars of the agents a note is about. It
|
|
24
|
+
* takes the room it needs, centred on the title's first line, and none of the tone's colour.
|
|
25
|
+
* It is not announced, so say in the title what it shows. In `toast.update`, `null` takes it
|
|
26
|
+
* away.
|
|
27
|
+
*/
|
|
28
|
+
icon?: Snippet | null | undefined;
|
|
17
29
|
/** A button in the toast, such as Undo or Retry. */
|
|
18
30
|
action?: ToastAction | undefined;
|
|
19
31
|
/** Milliseconds before it goes. `null` keeps it until dismissed. */
|
|
@@ -26,10 +38,11 @@ export type ToastOptions = {
|
|
|
26
38
|
/** Called when it goes by itself, as its time runs out. */
|
|
27
39
|
onAutoClose?: ((id: ToastId) => void) | undefined;
|
|
28
40
|
};
|
|
29
|
-
/** What the Toaster reads from a toast's `data`: its own id, its tone and its action. */
|
|
41
|
+
/** What the Toaster reads from a toast's `data`: its own id, its tone, its icon and its action. */
|
|
30
42
|
export type ToastData = {
|
|
31
43
|
id: ToastId;
|
|
32
44
|
tone: ToastTone;
|
|
45
|
+
icon?: Snippet | null | undefined;
|
|
33
46
|
action?: ToastAction | undefined;
|
|
34
47
|
};
|
|
35
48
|
/**
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Toasts: short notes about something that happened away from where the person
|
|
3
|
-
* is looking. Call `toast()` from anywhere; one <Toaster /> shows them.
|
|
4
|
-
*/
|
|
5
1
|
import { createToaster } from '@ui-sdk/svelte/toast';
|
|
6
2
|
const DURATION = 5000;
|
|
7
3
|
let next = 1;
|
|
@@ -42,7 +38,12 @@ function put(entry) {
|
|
|
42
38
|
description: entry.description,
|
|
43
39
|
type: entry.tone,
|
|
44
40
|
duration: entry.duration ?? Infinity,
|
|
45
|
-
data: {
|
|
41
|
+
data: {
|
|
42
|
+
id: entry.id,
|
|
43
|
+
tone: entry.tone,
|
|
44
|
+
icon: entry.icon,
|
|
45
|
+
action: entry.action
|
|
46
|
+
},
|
|
46
47
|
onDismiss: (details) => ended(at, details)
|
|
47
48
|
});
|
|
48
49
|
}
|
|
@@ -54,6 +55,7 @@ function show(title, options = {}) {
|
|
|
54
55
|
title,
|
|
55
56
|
tone,
|
|
56
57
|
description: options.description,
|
|
58
|
+
icon: options.icon,
|
|
57
59
|
action: options.action,
|
|
58
60
|
duration: durationFor(tone, options.duration),
|
|
59
61
|
onDismiss: options.onDismiss,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Tells the titles and descriptions inside a dialog whether it is open. Call it in its root. */
|
|
2
|
+
export declare function provideDialogOpen(open: () => boolean): void;
|
|
3
|
+
/**
|
|
4
|
+
* The nodes a title or a description keeps while its dialog closes, or undefined while it shows
|
|
5
|
+
* its children. Call it in the part's script, before its markup, so it reads the element before
|
|
6
|
+
* the children change: `element` is the part's own element.
|
|
7
|
+
*/
|
|
8
|
+
export declare function keepWhileClosing(element: () => Element | undefined): () => Node[] | undefined;
|
|
9
|
+
/** Puts the kept nodes in an element. */
|
|
10
|
+
export declare const place: (nodes: Node[]) => (element: Element) => void;
|
|
11
|
+
/**
|
|
12
|
+
* A ui-sdk part's props, with its binding let go of after Svelte's teardown when its element has
|
|
13
|
+
* left the page. Spread them on the part's element. An element that stays, binding again, lets
|
|
14
|
+
* go at once, before it binds.
|
|
15
|
+
*/
|
|
16
|
+
export declare function unbindLater<T extends object>(props: T): T;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a dialog's title and description do as the dialog closes.
|
|
3
|
+
*
|
|
4
|
+
* A confirm dialog's answer often clears what the dialog is about: `open={target !== null}`,
|
|
5
|
+
* a title that names the target, a description shown only while there is one. The same update
|
|
6
|
+
* then closes the dialog, blanks its title and takes its description away.
|
|
7
|
+
*
|
|
8
|
+
* - The text is kept. Once the dialog's `open` turns false, its title and description show what
|
|
9
|
+
* they showed until the dialog has gone, so it does not read "Revoke ?" as it fades. Opened
|
|
10
|
+
* again, they follow their content again.
|
|
11
|
+
* - A part that leaves the page lets ui-sdk go of it after Svelte's teardown. ui-sdk clears
|
|
12
|
+
* a title's or a description's flag as the part unbinds, at once, and that re-applies the
|
|
13
|
+
* dialog's props. Inside a teardown Svelte reads state as it was before the update, so the
|
|
14
|
+
* props still said open, and the dialog was written open again: blank, its backdrop taking
|
|
15
|
+
* every click on the page. Unbound a microtask later, ui-sdk reads the props as they are.
|
|
16
|
+
* ui-sdk 0.1.0-beta.8 fixed it at its root (a part's unbind reads the options last delivered),
|
|
17
|
+
* so this can go once Narvi moves past beta.7.
|
|
18
|
+
*/
|
|
19
|
+
import { getContext, setContext, untrack } from 'svelte';
|
|
20
|
+
const OPEN = Symbol('narvi.dialog-open');
|
|
21
|
+
/** Tells the titles and descriptions inside a dialog whether it is open. Call it in its root. */
|
|
22
|
+
export function provideDialogOpen(open) {
|
|
23
|
+
setContext(OPEN, open);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The nodes a title or a description keeps while its dialog closes, or undefined while it shows
|
|
27
|
+
* its children. Call it in the part's script, before its markup, so it reads the element before
|
|
28
|
+
* the children change: `element` is the part's own element.
|
|
29
|
+
*/
|
|
30
|
+
export function keepWhileClosing(element) {
|
|
31
|
+
const open = getContext(OPEN);
|
|
32
|
+
let kept = $state.raw();
|
|
33
|
+
if (!open)
|
|
34
|
+
return () => undefined;
|
|
35
|
+
// Only a close is kept: content kept mounted while closed has nothing to keep at first
|
|
36
|
+
let was = untrack(open);
|
|
37
|
+
$effect.pre(() => {
|
|
38
|
+
const now = open();
|
|
39
|
+
if (was && !now) {
|
|
40
|
+
const shown = untrack(element);
|
|
41
|
+
kept = shown ? Array.from(shown.childNodes, (node) => node.cloneNode(true)) : undefined;
|
|
42
|
+
}
|
|
43
|
+
else if (now)
|
|
44
|
+
kept = undefined;
|
|
45
|
+
was = now;
|
|
46
|
+
});
|
|
47
|
+
return () => kept;
|
|
48
|
+
}
|
|
49
|
+
/** Puts the kept nodes in an element. */
|
|
50
|
+
export const place = (nodes) => (element) => element.replaceChildren(...nodes);
|
|
51
|
+
const later = new WeakMap();
|
|
52
|
+
/**
|
|
53
|
+
* A ui-sdk part's props, with its binding let go of after Svelte's teardown when its element has
|
|
54
|
+
* left the page. Spread them on the part's element. An element that stays, binding again, lets
|
|
55
|
+
* go at once, before it binds.
|
|
56
|
+
*/
|
|
57
|
+
export function unbindLater(props) {
|
|
58
|
+
const result = { ...props };
|
|
59
|
+
for (const key of Object.getOwnPropertySymbols(props)) {
|
|
60
|
+
const attach = props[key];
|
|
61
|
+
if (typeof attach !== 'function')
|
|
62
|
+
continue;
|
|
63
|
+
let deferred = later.get(attach);
|
|
64
|
+
if (!deferred) {
|
|
65
|
+
deferred = (element) => {
|
|
66
|
+
const release = attach(element);
|
|
67
|
+
if (typeof release !== 'function')
|
|
68
|
+
return release;
|
|
69
|
+
return () => (element.isConnected ? release() : queueMicrotask(() => release()));
|
|
70
|
+
};
|
|
71
|
+
later.set(attach, deferred);
|
|
72
|
+
}
|
|
73
|
+
result[key] = deferred;
|
|
74
|
+
}
|
|
75
|
+
return result;
|
|
76
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diegopluna/narvi",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"packageManager": "pnpm@12.18.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -136,28 +136,28 @@
|
|
|
136
136
|
"@lezer/lr": "^1.4.12",
|
|
137
137
|
"@replit/codemirror-lang-svelte": "^6.0.0",
|
|
138
138
|
"@sveltejs/adapter-static": "^4.0.1",
|
|
139
|
-
"@sveltejs/kit": "^3.
|
|
139
|
+
"@sveltejs/kit": "^3.4.0",
|
|
140
140
|
"@sveltejs/package": "^2.5.8",
|
|
141
|
-
"@sveltejs/vite-plugin-svelte": "^7.
|
|
141
|
+
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
142
142
|
"@tanstack/intent": "0.5.6",
|
|
143
143
|
"@types/markdown-it": "14.2.0",
|
|
144
|
-
"@types/node": "^24",
|
|
144
|
+
"@types/node": "^24.19.2",
|
|
145
145
|
"@types/react": "19.2.14",
|
|
146
146
|
"@types/react-dom": "19.2.3",
|
|
147
|
-
"@vitest/browser-playwright": "^4.1.
|
|
148
|
-
"axe-core": "^4.14.
|
|
149
|
-
"eslint": "^10.
|
|
147
|
+
"@vitest/browser-playwright": "^4.1.12",
|
|
148
|
+
"axe-core": "^4.14.1",
|
|
149
|
+
"eslint": "^10.15.0",
|
|
150
150
|
"eslint-config-prettier": "^10.1.8",
|
|
151
|
-
"eslint-plugin-svelte": "^3.
|
|
152
|
-
"globals": "^17.
|
|
151
|
+
"eslint-plugin-svelte": "^3.24.1",
|
|
152
|
+
"globals": "^17.14.0",
|
|
153
153
|
"markdown-it": "15.0.3",
|
|
154
154
|
"marked": "18.1.2",
|
|
155
155
|
"micromark": "4.0.3",
|
|
156
156
|
"micromark-extension-gfm": "3.0.0",
|
|
157
|
-
"playwright": "^1.
|
|
158
|
-
"prettier": "^3.
|
|
159
|
-
"prettier-plugin-svelte": "
|
|
160
|
-
"publint": "^0.3.
|
|
157
|
+
"playwright": "^1.65.1",
|
|
158
|
+
"prettier": "^3.10.1",
|
|
159
|
+
"prettier-plugin-svelte": "4.1.1",
|
|
160
|
+
"publint": "^0.3.25",
|
|
161
161
|
"react": "19.2.9",
|
|
162
162
|
"react-dom": "19.2.9",
|
|
163
163
|
"rehype-stringify": "10.0.1",
|
|
@@ -166,30 +166,30 @@
|
|
|
166
166
|
"remark-rehype": "11.1.2",
|
|
167
167
|
"shiki": "^4.6.0",
|
|
168
168
|
"streamdown": "2.7.1",
|
|
169
|
-
"svelte": "^5.
|
|
170
|
-
"svelte-check": "^4.
|
|
169
|
+
"svelte": "^5.58.0",
|
|
170
|
+
"svelte-check": "^4.7.8",
|
|
171
171
|
"svelte-exmarkdown": "5.0.2",
|
|
172
172
|
"svelte-streamdown": "5.0.0",
|
|
173
173
|
"typescript": "^6.0.3",
|
|
174
|
-
"typescript-eslint": "^8.
|
|
174
|
+
"typescript-eslint": "^8.73.0",
|
|
175
175
|
"unified": "11.0.5",
|
|
176
|
-
"vite": "^8.3.
|
|
177
|
-
"vitest": "^4.1.
|
|
178
|
-
"vitest-browser-svelte": "^2.
|
|
179
|
-
"wrangler": "^4.
|
|
176
|
+
"vite": "^8.3.8",
|
|
177
|
+
"vitest": "^4.1.12",
|
|
178
|
+
"vitest-browser-svelte": "^2.2.1",
|
|
179
|
+
"wrangler": "^4.165.0"
|
|
180
180
|
},
|
|
181
181
|
"peerDependencies": {
|
|
182
182
|
"svelte": "^5.20.0",
|
|
183
183
|
"vite": ">=6"
|
|
184
184
|
},
|
|
185
185
|
"dependencies": {
|
|
186
|
-
"@pierre/highlights": "0.5.
|
|
187
|
-
"@stylexjs/stylex": "0.19.
|
|
188
|
-
"@stylexjs/unplugin": "0.19.
|
|
186
|
+
"@pierre/highlights": "0.5.1",
|
|
187
|
+
"@stylexjs/stylex": "0.19.2",
|
|
188
|
+
"@stylexjs/unplugin": "0.19.2",
|
|
189
189
|
"@ui-sdk/core": "0.1.0-beta.7",
|
|
190
190
|
"@ui-sdk/svelte": "0.1.0-beta.7",
|
|
191
191
|
"decode-named-character-reference": "1.3.0",
|
|
192
|
-
"dompurify": "3.4.
|
|
192
|
+
"dompurify": "3.4.18",
|
|
193
193
|
"esm-env": "^1.2.2",
|
|
194
194
|
"katex": "0.19.1",
|
|
195
195
|
"lightningcss": "^1.33.0",
|
|
@@ -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.5.
|
|
15
|
+
library_version: '0.5.8'
|
|
16
16
|
requires:
|
|
17
17
|
- setup
|
|
18
18
|
sources:
|
|
@@ -153,7 +153,7 @@ For a yes/no confirmation, use `ConfirmDialog`. It takes a `title` that asks the
|
|
|
153
153
|
`confirmLabel` that names the action. If `onconfirm` returns a promise, the dialog waits for it
|
|
154
154
|
and shows the error when it rejects. Say what will be lost with `warning` (a string), not a
|
|
155
155
|
`Notice` of your own in its children: the warning is read with the description as it opens.
|
|
156
|
-
Children that render nothing (an `{#if}` that is false) leave no empty body.
|
|
156
|
+
Children that render nothing (an `{#if}` that is false) leave no empty body. Its title and description, and a `Dialog`'s, keep their text while it closes, so the answer may clear what `open` and the text read (`open={target !== null}`).
|
|
157
157
|
|
|
158
158
|
### Forms
|
|
159
159
|
|
|
@@ -312,7 +312,7 @@ and `Kbd` inline, `Link` inside text, `Button href` for a link that looks like a
|
|
|
312
312
|
});
|
|
313
313
|
```
|
|
314
314
|
|
|
315
|
-
- Errors and work under way stay until dismissed, and every toast has a Dismiss button.
|
|
315
|
+
- Errors and work under way stay until dismissed, and every toast has a Dismiss button. An `icon` (a `Snippet`) is drawn in place of the tone's glyph, such as a stack of avatars, as wide as it is. It is not announced, so the title says what it shows. `toast.update` keeps it unless given one; `icon: null` takes it away.
|
|
316
316
|
- `Tooltip.Root` needs a `Tooltip.Provider` near the root, whose delay and hand-off Narvi's own
|
|
317
317
|
tooltips (Button, Rail, Tabs) take too. An icon button needs an `aria-label` as well.
|
|
318
318
|
- Use `Notice` for a note in place (`tone`: neutral, info, success, warning, danger; `raised`
|
|
@@ -216,21 +216,21 @@ errors with an `Announcer` too.
|
|
|
216
216
|
|
|
217
217
|
## Feedback and status
|
|
218
218
|
|
|
219
|
-
| Component | Use it for
|
|
220
|
-
| ------------------------------------ |
|
|
221
|
-
| `Toaster`, `toast()` | Short notes about something that happened; one Toaster at the root. Toasts stay over the page and a modal dialog; a menu or popover opened later is over them, a new toast over everything | `toast` |
|
|
222
|
-
| `Notice` | A note in place: what is happening or went wrong, and what to do
|
|
223
|
-
| `EmptyState` | An empty place: what it is for and how to fill it (`title`, `level`, `description`, `media`, `actions`)
|
|
224
|
-
| `Badge` | A status, category or count (`tone`, `info` among them; `color` for a label's own dot)
|
|
225
|
-
| `StatusIndicator` | Where a run, thread or machine stands, by shape and colour
|
|
226
|
-
| `StatusDot` | A small dot of status colour (`tone`, `shape`), beside a name or on a mark
|
|
227
|
-
| `Progress` | How far along a task is
|
|
228
|
-
| `Spinner` | Something in progress
|
|
229
|
-
| `Skeleton` | A stand-in for content on its way
|
|
230
|
-
| `Shimmer` | Text that says work is under way (`tone` `neutral` by default, or `accent` for the one live thing)
|
|
231
|
-
| `RollingText` | A phrase that rolls to its next value ("Reading…", "Running…")
|
|
232
|
-
| `Announcer` | Says a short message to screen readers without showing anything
|
|
233
|
-
| `Avatar.Root`, `.Image`, `.Fallback` | A person: a picture, or initials (`size` `xs` is 20px; `label={null}` beside a written name)
|
|
219
|
+
| Component | Use it for | Docs slug |
|
|
220
|
+
| ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
|
|
221
|
+
| `Toaster`, `toast()` | Short notes about something that happened; one Toaster at the root. Toasts stay over the page and a modal dialog; a menu or popover opened later is over them, a new toast over everything. `icon` (a snippet) draws an app's own, such as avatars, in place of the tone's glyph | `toast` |
|
|
222
|
+
| `Notice` | A note in place: what is happening or went wrong, and what to do | `notice` |
|
|
223
|
+
| `EmptyState` | An empty place: what it is for and how to fill it (`title`, `level`, `description`, `media`, `actions`) | `empty-state` |
|
|
224
|
+
| `Badge` | A status, category or count (`tone`, `info` among them; `color` for a label's own dot) | `badge` |
|
|
225
|
+
| `StatusIndicator` | Where a run, thread or machine stands, by shape and colour | `status-indicator` |
|
|
226
|
+
| `StatusDot` | A small dot of status colour (`tone`, `shape`), beside a name or on a mark | `status-indicator` |
|
|
227
|
+
| `Progress` | How far along a task is | `progress` |
|
|
228
|
+
| `Spinner` | Something in progress | `spinner` |
|
|
229
|
+
| `Skeleton` | A stand-in for content on its way | `skeleton` |
|
|
230
|
+
| `Shimmer` | Text that says work is under way (`tone` `neutral` by default, or `accent` for the one live thing) | `shimmer` |
|
|
231
|
+
| `RollingText` | A phrase that rolls to its next value ("Reading…", "Running…") | none |
|
|
232
|
+
| `Announcer` | Says a short message to screen readers without showing anything | `announcer` |
|
|
233
|
+
| `Avatar.Root`, `.Image`, `.Fallback` | A person: a picture, or initials (`size` `xs` is 20px; `label={null}` beside a written name) | `avatar` |
|
|
234
234
|
|
|
235
235
|
## App shell
|
|
236
236
|
|
package/skills/markdown/SKILL.md
CHANGED
package/skills/setup/SKILL.md
CHANGED
|
@@ -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.5.
|
|
14
|
+
library_version: '0.5.8'
|
|
15
15
|
sources:
|
|
16
16
|
- src/lib/vite.ts
|
|
17
17
|
- src/lib/base.css
|
|
@@ -36,7 +36,7 @@ Narvi is below 1.0, so a minor release can change an API. Pin the version you bu
|
|
|
36
36
|
1. Install the package, with StyleX for your own styles:
|
|
37
37
|
|
|
38
38
|
```sh
|
|
39
|
-
pnpm add @diegopluna/narvi @stylexjs/stylex@0.19.
|
|
39
|
+
pnpm add @diegopluna/narvi @stylexjs/stylex@0.19.2
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
`@stylexjs/stylex` is only needed to import it in your own files. Keep it at the version Narvi
|
package/skills/styling/SKILL.md
CHANGED
package/skills/theming/SKILL.md
CHANGED