@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.
- package/dist/components/app-shell/AppShellHeader.svelte +15 -2
- package/dist/components/app-shell/AppShellStrip.svelte +41 -0
- package/dist/components/app-shell/AppShellStrip.svelte.d.ts +10 -0
- package/dist/components/app-shell/index.d.ts +3 -1
- package/dist/components/app-shell/index.js +2 -1
- package/dist/components/approval/Approval.svelte +147 -13
- package/dist/components/approval/Approval.svelte.d.ts +22 -0
- package/dist/components/avatar/AvatarFallback.svelte +2 -1
- package/dist/components/avatar/AvatarRoot.svelte +9 -6
- package/dist/components/composer/ComposerModelPicker.svelte +15 -1
- package/dist/components/composer/ComposerTray.svelte +150 -10
- package/dist/components/composer/ComposerTray.svelte.d.ts +15 -3
- package/dist/components/heading/Heading.svelte +2 -1
- package/dist/components/markdown/MarkdownHtml.svelte +7 -3
- package/dist/components/markdown/MarkdownTable.svelte +19 -5
- package/dist/components/markdown/styles.d.ts +0 -17
- package/dist/components/markdown/styles.js +4 -20
- package/dist/components/plan/Plan.svelte +146 -28
- package/dist/components/plan/Plan.svelte.d.ts +17 -2
- package/dist/components/queued-message/QueuedMessage.svelte +185 -49
- package/dist/components/queued-message/QueuedMessage.svelte.d.ts +26 -4
- package/dist/components/rail/RailItem.svelte +20 -6
- package/dist/components/sidebar/SidebarItem.svelte +8 -3
- package/dist/components/tab-strip/TabStrip.svelte +140 -17
- package/dist/components/tab-strip/TabStrip.svelte.d.ts +23 -1
- package/dist/components/table/TableBody.svelte +27 -0
- package/dist/components/table/TableBody.svelte.d.ts +10 -0
- package/dist/components/table/TableCell.svelte +54 -0
- package/dist/components/table/TableCell.svelte.d.ts +17 -0
- package/dist/components/table/TableFoot.svelte +39 -0
- package/dist/components/table/TableFoot.svelte.d.ts +10 -0
- package/dist/components/table/TableHead.svelte +33 -0
- package/dist/components/table/TableHead.svelte.d.ts +10 -0
- package/dist/components/table/TableHeaderCell.svelte +61 -0
- package/dist/components/table/TableHeaderCell.svelte.d.ts +17 -0
- package/dist/components/table/TableRoot.svelte +144 -0
- package/dist/components/table/TableRoot.svelte.d.ts +22 -0
- package/dist/components/table/TableRow.svelte +59 -0
- package/dist/components/table/TableRow.svelte.d.ts +12 -0
- package/dist/components/table/context.d.ts +14 -0
- package/dist/components/table/context.js +15 -0
- package/dist/components/table/index.d.ts +16 -0
- package/dist/components/table/index.js +8 -0
- package/dist/components/table/styles.d.ts +56 -0
- package/dist/components/table/styles.js +44 -0
- package/dist/components/text/Text.svelte +19 -4
- package/dist/components/text/Text.svelte.d.ts +4 -2
- package/dist/components/work-fold/WorkFold.svelte +26 -1
- package/dist/components/work-fold/WorkFold.svelte.d.ts +5 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +7 -1
- package/dist/internal/markers.stylex.d.ts +4 -0
- package/dist/internal/markers.stylex.js +2 -0
- package/dist/internal/table.d.ts +29 -0
- package/dist/internal/table.js +34 -0
- package/dist/tokens.stylex.d.ts +2 -0
- package/dist/tokens.stylex.js +9 -3
- package/dist/typography.d.ts +45 -1
- package/dist/typography.js +47 -2
- package/package.json +1 -1
- package/skills/building-ui/SKILL.md +23 -23
- package/skills/building-ui/references/components.md +204 -42
- package/skills/markdown/SKILL.md +1 -1
- package/skills/setup/SKILL.md +1 -1
- package/skills/styling/SKILL.md +23 -5
- package/skills/theming/SKILL.md +1 -1
|
@@ -6,13 +6,28 @@ export type PlanStep = {
|
|
|
6
6
|
};
|
|
7
7
|
export type PlanProps = {
|
|
8
8
|
steps: PlanStep[];
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Over the steps, and what the plan is called. `null` leaves it out where a card of your
|
|
11
|
+
* own already says it is a plan; the plan is still called "Plan", or its `aria-label`.
|
|
12
|
+
*/
|
|
13
|
+
title?: string | null | undefined;
|
|
14
|
+
/** What the plan is called when no title is shown. */
|
|
15
|
+
'aria-label'?: string | undefined;
|
|
10
16
|
/** How the progress is said: "2 of 4". */
|
|
11
17
|
progressLabel?: ((done: number, total: number) => string) | undefined;
|
|
12
18
|
skippedLabel?: string | undefined;
|
|
19
|
+
/** Leaves out its edge and padding, for a plan put in a card of your own. */
|
|
20
|
+
bare?: boolean | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* One row, for the composer's tray: the step under way and how far along the plan is,
|
|
23
|
+
* which opens to every step.
|
|
24
|
+
*/
|
|
25
|
+
fold?: boolean | undefined;
|
|
26
|
+
/** Whether a folded plan shows its steps. Bindable. */
|
|
27
|
+
open?: boolean | undefined;
|
|
13
28
|
sx?: Sx | undefined;
|
|
14
29
|
class?: string | undefined;
|
|
15
30
|
};
|
|
16
|
-
declare const Plan: import("svelte").Component<PlanProps, {}, "">;
|
|
31
|
+
declare const Plan: import("svelte").Component<PlanProps, {}, "open">;
|
|
17
32
|
type Plan = ReturnType<typeof Plan>;
|
|
18
33
|
export default Plan;
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
A message the person sent while the agent was still at work. It waits at
|
|
3
3
|
the foot of the conversation, quieter than a sent message, saying what will
|
|
4
4
|
happen to it, with ways to change that.
|
|
5
|
+
|
|
6
|
+
`compact` makes it one line, for the composer's tray: a grip to drag it
|
|
7
|
+
into place, its words cut to the line, where it stands, and its actions.
|
|
8
|
+
(From Eregion's TrayQueuedRow, c1b599eb.)
|
|
5
9
|
-->
|
|
6
10
|
<script lang="ts" module>
|
|
7
11
|
import * as stylex from '@stylexjs/stylex';
|
|
8
12
|
import type { Snippet } from 'svelte';
|
|
9
13
|
import Glyph, { type GlyphName } from '../../internal/Glyph.svelte';
|
|
10
14
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
11
|
-
import { colors, density, font, radius } from '../../tokens.stylex.js';
|
|
15
|
+
import { colors, density, font, radius, space } from '../../tokens.stylex.js';
|
|
12
16
|
import Button from '../button/Button.svelte';
|
|
13
17
|
import { text, type MessageTextSize } from '../message/styles.js';
|
|
14
18
|
import * as Tooltip from '../tooltip/index.js';
|
|
@@ -18,8 +22,24 @@
|
|
|
18
22
|
|
|
19
23
|
export type QueuedMessageProps = {
|
|
20
24
|
status?: QueuedMessageStatus | undefined;
|
|
21
|
-
/**
|
|
25
|
+
/** What the status says in place of its own word: one short label, "After setup". */
|
|
22
26
|
statusText?: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* What the status means, in full: "Sends once the worktree's setup script succeeds".
|
|
29
|
+
* Shown in a tooltip on the status, and given as the status's description, so its text is
|
|
30
|
+
* the word alone. Each status has its own.
|
|
31
|
+
*/
|
|
32
|
+
detail?: string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* One line, for the composer's tray: its words cut to the line beside where it stands
|
|
35
|
+
* and its actions, where a bubble with its status under it takes two.
|
|
36
|
+
*/
|
|
37
|
+
compact?: boolean | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* At the start of the compact row: a grip to drag it into the queue's order, such as a
|
|
40
|
+
* Button with your drag-and-drop library's attachment on it.
|
|
41
|
+
*/
|
|
42
|
+
handle?: Snippet | undefined;
|
|
23
43
|
onedit?: (() => void) | undefined;
|
|
24
44
|
/** Takes the message back into the composer. */
|
|
25
45
|
ontakeback?: (() => void) | undefined;
|
|
@@ -33,27 +53,34 @@
|
|
|
33
53
|
* them, or the ones to hold back by name.
|
|
34
54
|
*/
|
|
35
55
|
disabled?: boolean | QueuedMessageAction[] | undefined;
|
|
36
|
-
/** The size its words are read at, as a Message's `textSize`. */
|
|
56
|
+
/** The size its words are read at, as a Message's `textSize`. The compact row's are 14px. */
|
|
37
57
|
textSize?: MessageTextSize | undefined;
|
|
38
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* What goes with it: its images and files, over the bubble. In the compact row they sit
|
|
60
|
+
* after the words, so keep them small, such as a paperclip and a count.
|
|
61
|
+
*/
|
|
39
62
|
attachments?: Snippet | undefined;
|
|
40
63
|
sx?: Sx | undefined;
|
|
41
64
|
class?: string | undefined;
|
|
42
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* The message's words. With none, only its attachments show, with no bubble. The compact
|
|
67
|
+
* row cuts them to one line, so give it words, not blocks.
|
|
68
|
+
*/
|
|
43
69
|
children?: Snippet | undefined;
|
|
44
70
|
};
|
|
45
71
|
|
|
46
72
|
export type QueuedMessageAction = 'edit' | 'takeBack' | 'steer' | 'send';
|
|
47
73
|
|
|
48
|
-
// One short label each. What
|
|
74
|
+
// One short label each. What it means is said on hover, not strung on with a dot.
|
|
49
75
|
const STATUS: Record<QueuedMessageStatus, string> = {
|
|
50
76
|
queued: 'Queued',
|
|
51
77
|
editing: 'Editing',
|
|
52
78
|
unsent: 'Not sent'
|
|
53
79
|
};
|
|
54
|
-
const DETAIL:
|
|
80
|
+
const DETAIL: Record<QueuedMessageStatus, string> = {
|
|
55
81
|
queued: 'Sends when this turn ends',
|
|
56
|
-
editing: 'Still queued; sends when this turn ends'
|
|
82
|
+
editing: 'Still queued; sends when this turn ends',
|
|
83
|
+
unsent: 'Waits for you to send it'
|
|
57
84
|
};
|
|
58
85
|
|
|
59
86
|
/** A length at the window's density (`density` in the tokens). */
|
|
@@ -103,7 +130,43 @@
|
|
|
103
130
|
color: colors.textSubtle,
|
|
104
131
|
fontSize: font.sizeCaption
|
|
105
132
|
},
|
|
106
|
-
unsent: { color: colors.danger }
|
|
133
|
+
unsent: { color: colors.danger },
|
|
134
|
+
// One line, as tall as its buttons reach, so a list of them scrolls only past what fits
|
|
135
|
+
row: {
|
|
136
|
+
display: 'flex',
|
|
137
|
+
flexDirection: 'row',
|
|
138
|
+
alignItems: 'center',
|
|
139
|
+
gap: space.x2,
|
|
140
|
+
minWidth: 0,
|
|
141
|
+
height: d('2rem'),
|
|
142
|
+
paddingInline: space.x1,
|
|
143
|
+
borderRadius: radius.control,
|
|
144
|
+
color: colors.textMuted,
|
|
145
|
+
fontSize: font.sizeBody,
|
|
146
|
+
lineHeight: font.leadingSnug
|
|
147
|
+
},
|
|
148
|
+
// Marked while the composer edits it
|
|
149
|
+
editing: { backgroundColor: colors.fillSelected },
|
|
150
|
+
handle: { display: { default: 'flex', ':empty': 'none' }, flexShrink: 0 },
|
|
151
|
+
words: {
|
|
152
|
+
flexGrow: 1,
|
|
153
|
+
minWidth: 0,
|
|
154
|
+
overflow: 'hidden',
|
|
155
|
+
color: colors.text,
|
|
156
|
+
textOverflow: 'ellipsis',
|
|
157
|
+
whiteSpace: 'nowrap'
|
|
158
|
+
},
|
|
159
|
+
rowAttachments: {
|
|
160
|
+
display: { default: 'flex', ':empty': 'none' },
|
|
161
|
+
flexShrink: 0,
|
|
162
|
+
alignItems: 'center',
|
|
163
|
+
gap: space.x1,
|
|
164
|
+
color: colors.textSubtle,
|
|
165
|
+
fontSize: font.sizeCaption,
|
|
166
|
+
fontVariantNumeric: 'tabular-nums'
|
|
167
|
+
},
|
|
168
|
+
rowStatus: { flexShrink: 0, paddingInlineEnd: 0, whiteSpace: 'nowrap' },
|
|
169
|
+
actions: { display: 'flex', flexShrink: 0, alignItems: 'center' }
|
|
107
170
|
});
|
|
108
171
|
</script>
|
|
109
172
|
|
|
@@ -111,6 +174,9 @@
|
|
|
111
174
|
let {
|
|
112
175
|
status = 'queued',
|
|
113
176
|
statusText,
|
|
177
|
+
detail,
|
|
178
|
+
compact = false,
|
|
179
|
+
handle,
|
|
114
180
|
onedit,
|
|
115
181
|
ontakeback,
|
|
116
182
|
onsteer,
|
|
@@ -137,50 +203,120 @@
|
|
|
137
203
|
] as const
|
|
138
204
|
).filter(([, handler]) => handler)
|
|
139
205
|
);
|
|
206
|
+
|
|
207
|
+
const word = $derived(statusText ?? STATUS[status]);
|
|
208
|
+
// A word of the app's own has no meaning of Narvi's to explain it
|
|
209
|
+
const meaning = $derived(detail ?? (statusText ? undefined : DETAIL[status]));
|
|
210
|
+
const uid = $props.id();
|
|
211
|
+
const meaningId = `${uid}-meaning`;
|
|
140
212
|
</script>
|
|
141
213
|
|
|
142
|
-
|
|
143
|
-
{#if
|
|
144
|
-
<
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
214
|
+
{#snippet statusLine(row: boolean)}
|
|
215
|
+
{#if meaning}
|
|
216
|
+
<Tooltip.Root>
|
|
217
|
+
<Tooltip.Trigger>
|
|
218
|
+
{#snippet child({ props })}
|
|
219
|
+
<span
|
|
220
|
+
{...props}
|
|
221
|
+
data-slot="queued-message-status"
|
|
222
|
+
aria-describedby={meaningId}
|
|
223
|
+
{...stylex.attrs(
|
|
224
|
+
styles.status,
|
|
225
|
+
row && styles.rowStatus,
|
|
226
|
+
status === 'unsent' && styles.unsent
|
|
227
|
+
)}>{word}</span
|
|
228
|
+
>
|
|
229
|
+
{/snippet}
|
|
230
|
+
</Tooltip.Trigger>
|
|
231
|
+
<Tooltip.Content>{meaning}</Tooltip.Content>
|
|
232
|
+
</Tooltip.Root>
|
|
233
|
+
<!-- Always there to describe the status, which the tooltip does only while open. Words
|
|
234
|
+
hidden inside it would be a box of their own, read as "After setup , Sends once…",
|
|
235
|
+
and would keep the word from being found on its own -->
|
|
236
|
+
<span id={meaningId} hidden>{meaning}</span>
|
|
237
|
+
{:else}
|
|
157
238
|
<span
|
|
158
|
-
|
|
159
|
-
{...stylex.attrs(
|
|
160
|
-
|
|
239
|
+
data-slot="queued-message-status"
|
|
240
|
+
{...stylex.attrs(
|
|
241
|
+
styles.status,
|
|
242
|
+
row && styles.rowStatus,
|
|
243
|
+
status === 'unsent' && styles.unsent
|
|
244
|
+
)}>{word}</span
|
|
161
245
|
>
|
|
246
|
+
{/if}
|
|
247
|
+
{/snippet}
|
|
248
|
+
|
|
249
|
+
{#snippet buttons(size: 'xs' | 'sm')}
|
|
250
|
+
{#each actions as [key, handler, icon, fallback] (key)}
|
|
251
|
+
{@const label = labels?.[key] ?? fallback}
|
|
252
|
+
<Tooltip.Root>
|
|
253
|
+
<Tooltip.Trigger>
|
|
254
|
+
{#snippet child({ props })}
|
|
255
|
+
<Button
|
|
256
|
+
{...props}
|
|
257
|
+
variant="ghost"
|
|
258
|
+
{size}
|
|
259
|
+
iconOnly
|
|
260
|
+
aria-label={label}
|
|
261
|
+
disabled={held(key)}
|
|
262
|
+
onclick={() => handler?.()}
|
|
263
|
+
>
|
|
264
|
+
<Glyph name={icon as GlyphName} />
|
|
265
|
+
</Button>
|
|
266
|
+
{/snippet}
|
|
267
|
+
</Tooltip.Trigger>
|
|
268
|
+
<Tooltip.Content>{label}</Tooltip.Content>
|
|
269
|
+
</Tooltip.Root>
|
|
270
|
+
{/each}
|
|
271
|
+
{/snippet}
|
|
272
|
+
|
|
273
|
+
{#if compact}
|
|
274
|
+
<div
|
|
275
|
+
data-slot="queued-message"
|
|
276
|
+
data-status={status}
|
|
277
|
+
data-compact=""
|
|
278
|
+
{...attrs([styles.row, status === 'editing' && styles.editing, sx], className)}
|
|
279
|
+
>
|
|
162
280
|
<TooltipScope>
|
|
163
|
-
{#
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
</Tooltip.Trigger>
|
|
181
|
-
<Tooltip.Content>{label}</Tooltip.Content>
|
|
182
|
-
</Tooltip.Root>
|
|
183
|
-
{/each}
|
|
281
|
+
{#if handle}
|
|
282
|
+
<span data-slot="queued-message-handle" {...stylex.attrs(styles.handle)}>
|
|
283
|
+
{@render handle()}
|
|
284
|
+
</span>
|
|
285
|
+
{/if}
|
|
286
|
+
<span data-slot="queued-message-words" {...stylex.attrs(styles.words)}>
|
|
287
|
+
{@render children?.()}
|
|
288
|
+
</span>
|
|
289
|
+
{#if attachments}
|
|
290
|
+
<span data-slot="queued-message-attachments" {...stylex.attrs(styles.rowAttachments)}>
|
|
291
|
+
{@render attachments()}
|
|
292
|
+
</span>
|
|
293
|
+
{/if}
|
|
294
|
+
{@render statusLine(true)}
|
|
295
|
+
{#if actions.length}
|
|
296
|
+
<span {...stylex.attrs(styles.actions)}>{@render buttons('xs')}</span>
|
|
297
|
+
{/if}
|
|
184
298
|
</TooltipScope>
|
|
185
299
|
</div>
|
|
186
|
-
|
|
300
|
+
{:else}
|
|
301
|
+
<div data-slot="queued-message" data-status={status} {...attrs([styles.root, sx], className)}>
|
|
302
|
+
{#if attachments}
|
|
303
|
+
<div data-slot="queued-message-attachments" {...stylex.attrs(styles.attachments)}>
|
|
304
|
+
{@render attachments()}
|
|
305
|
+
</div>
|
|
306
|
+
{/if}
|
|
307
|
+
{#if children}
|
|
308
|
+
<div
|
|
309
|
+
data-slot="queued-message-bubble"
|
|
310
|
+
{...stylex.attrs(styles.bubble, text[textSize], status !== 'unsent' && styles.waiting)}
|
|
311
|
+
>
|
|
312
|
+
{@render children()}
|
|
313
|
+
</div>
|
|
314
|
+
{/if}
|
|
315
|
+
<div {...stylex.attrs(styles.foot)}>
|
|
316
|
+
<TooltipScope>
|
|
317
|
+
{@render statusLine(false)}
|
|
318
|
+
{@render buttons('sm')}
|
|
319
|
+
</TooltipScope>
|
|
320
|
+
</div>
|
|
321
|
+
</div>
|
|
322
|
+
{/if}
|
|
@@ -4,8 +4,24 @@ import { type MessageTextSize } from '../message/styles.js';
|
|
|
4
4
|
export type QueuedMessageStatus = 'queued' | 'editing' | 'unsent';
|
|
5
5
|
export type QueuedMessageProps = {
|
|
6
6
|
status?: QueuedMessageStatus | undefined;
|
|
7
|
-
/**
|
|
7
|
+
/** What the status says in place of its own word: one short label, "After setup". */
|
|
8
8
|
statusText?: string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* What the status means, in full: "Sends once the worktree's setup script succeeds".
|
|
11
|
+
* Shown in a tooltip on the status, and given as the status's description, so its text is
|
|
12
|
+
* the word alone. Each status has its own.
|
|
13
|
+
*/
|
|
14
|
+
detail?: string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* One line, for the composer's tray: its words cut to the line beside where it stands
|
|
17
|
+
* and its actions, where a bubble with its status under it takes two.
|
|
18
|
+
*/
|
|
19
|
+
compact?: boolean | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* At the start of the compact row: a grip to drag it into the queue's order, such as a
|
|
22
|
+
* Button with your drag-and-drop library's attachment on it.
|
|
23
|
+
*/
|
|
24
|
+
handle?: Snippet | undefined;
|
|
9
25
|
onedit?: (() => void) | undefined;
|
|
10
26
|
/** Takes the message back into the composer. */
|
|
11
27
|
ontakeback?: (() => void) | undefined;
|
|
@@ -19,13 +35,19 @@ export type QueuedMessageProps = {
|
|
|
19
35
|
* them, or the ones to hold back by name.
|
|
20
36
|
*/
|
|
21
37
|
disabled?: boolean | QueuedMessageAction[] | undefined;
|
|
22
|
-
/** The size its words are read at, as a Message's `textSize`. */
|
|
38
|
+
/** The size its words are read at, as a Message's `textSize`. The compact row's are 14px. */
|
|
23
39
|
textSize?: MessageTextSize | undefined;
|
|
24
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* What goes with it: its images and files, over the bubble. In the compact row they sit
|
|
42
|
+
* after the words, so keep them small, such as a paperclip and a count.
|
|
43
|
+
*/
|
|
25
44
|
attachments?: Snippet | undefined;
|
|
26
45
|
sx?: Sx | undefined;
|
|
27
46
|
class?: string | undefined;
|
|
28
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* The message's words. With none, only its attachments show, with no bubble. The compact
|
|
49
|
+
* row cuts them to one line, so give it words, not blocks.
|
|
50
|
+
*/
|
|
29
51
|
children?: Snippet | undefined;
|
|
30
52
|
};
|
|
31
53
|
export type QueuedMessageAction = 'edit' | 'takeBack' | 'steer' | 'send';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import { visuallyHidden } from '../../visually-hidden.js';
|
|
3
2
|
import * as stylex from '@stylexjs/stylex';
|
|
4
3
|
import type { Snippet } from 'svelte';
|
|
5
4
|
import { shared } from '../../internal/shared.js';
|
|
@@ -123,6 +122,15 @@
|
|
|
123
122
|
|
|
124
123
|
const count = $derived(typeof badge === 'number' && badge > 0 ? badge : undefined);
|
|
125
124
|
const dot = $derived(badge === true);
|
|
125
|
+
// Named in full, not by words hidden inside it: a hidden word is a box of its own, and a box
|
|
126
|
+
// is read with a space each side, as "Eregion , 2 new"
|
|
127
|
+
const name = $derived(
|
|
128
|
+
count !== undefined
|
|
129
|
+
? `${label}, ${count} new`
|
|
130
|
+
: dot
|
|
131
|
+
? `${label}, ${badgeTone === 'success' ? 'online' : 'new'}`
|
|
132
|
+
: label
|
|
133
|
+
);
|
|
126
134
|
</script>
|
|
127
135
|
|
|
128
136
|
{#snippet face()}
|
|
@@ -133,13 +141,11 @@
|
|
|
133
141
|
{...stylex.attrs(styles.badge, badgeTone === 'success' && styles.badgeSuccess)}
|
|
134
142
|
>{count > 99 ? '99+' : count}</span
|
|
135
143
|
>
|
|
136
|
-
<span {...stylex.attrs(visuallyHidden)}>, {count} new</span>
|
|
137
144
|
{:else if dot}
|
|
138
145
|
<span
|
|
139
146
|
aria-hidden="true"
|
|
140
147
|
{...stylex.attrs(styles.badge, styles.dot, badgeTone === 'success' && styles.badgeSuccess)}
|
|
141
148
|
></span>
|
|
142
|
-
<span {...stylex.attrs(visuallyHidden)}>{badgeTone === 'success' ? ', online' : ', new'}</span>
|
|
143
149
|
{/if}
|
|
144
150
|
{/snippet}
|
|
145
151
|
|
|
@@ -151,13 +157,21 @@
|
|
|
151
157
|
className
|
|
152
158
|
)}
|
|
153
159
|
{#if href !== undefined}
|
|
154
|
-
<a
|
|
155
|
-
|
|
160
|
+
<a
|
|
161
|
+
{...props}
|
|
162
|
+
{href}
|
|
163
|
+
aria-label={name}
|
|
164
|
+
data-rail-item
|
|
165
|
+
aria-current={current ? 'page' : undefined}
|
|
166
|
+
{...own}
|
|
167
|
+
>
|
|
168
|
+
{@render face()}
|
|
156
169
|
</a>
|
|
157
170
|
{:else}
|
|
158
171
|
<button
|
|
159
172
|
{...props}
|
|
160
173
|
type="button"
|
|
174
|
+
aria-label={name}
|
|
161
175
|
data-rail-item
|
|
162
176
|
aria-current={current ? 'page' : undefined}
|
|
163
177
|
{...own}
|
|
@@ -166,7 +180,7 @@
|
|
|
166
180
|
onclick?.(event);
|
|
167
181
|
}}
|
|
168
182
|
>
|
|
169
|
-
|
|
183
|
+
{@render face()}
|
|
170
184
|
</button>
|
|
171
185
|
{/if}
|
|
172
186
|
{/snippet}
|
|
@@ -280,6 +280,10 @@
|
|
|
280
280
|
transitionTimingFunction: 'ease'
|
|
281
281
|
}
|
|
282
282
|
});
|
|
283
|
+
|
|
284
|
+
// The space after a picked row's hidden word, as an expression: Svelte trims a bare space at
|
|
285
|
+
// the end of a block
|
|
286
|
+
const SPACE = ' ';
|
|
283
287
|
</script>
|
|
284
288
|
|
|
285
289
|
<script lang="ts">
|
|
@@ -343,10 +347,11 @@
|
|
|
343
347
|
|
|
344
348
|
{#snippet inside()}
|
|
345
349
|
{#if leading}<span {...stylex.attrs(styles.lead)}>{@render leading()}</span>{/if}
|
|
350
|
+
<!-- The space after the hidden word is text of its own, so every reading of the name has it:
|
|
351
|
+
some pad a hidden box with spaces, some don't. On screen it starts the line, and goes -->
|
|
346
352
|
<span {...stylex.attrs(styles.title)}
|
|
347
|
-
>{#if picked && !option}<span {...stylex.attrs(visuallyHidden)}
|
|
348
|
-
|
|
349
|
-
</span>{/if}{@render children?.()}</span
|
|
353
|
+
>{#if picked && !option}<span {...stylex.attrs(visuallyHidden)}>{pickedLabel},</span
|
|
354
|
+
>{SPACE}{/if}{@render children?.()}</span
|
|
350
355
|
>
|
|
351
356
|
{#if trailing}
|
|
352
357
|
<span {...stylex.attrs(styles.trail, actions && styles.trailHides)}>{@render trailing()}</span>
|