@diegopluna/narvi 0.3.1 → 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.
Files changed (139) hide show
  1. package/dist/components/activity/ActivityIcon.svelte +54 -0
  2. package/dist/components/activity/ActivityIcon.svelte.d.ts +24 -0
  3. package/dist/components/activity/ActivityStep.svelte +47 -13
  4. package/dist/components/activity/ActivityStep.svelte.d.ts +13 -4
  5. package/dist/components/activity/ActivityThought.svelte +24 -5
  6. package/dist/components/activity/ActivityThought.svelte.d.ts +12 -2
  7. package/dist/components/activity/index.d.ts +3 -1
  8. package/dist/components/activity/index.js +2 -1
  9. package/dist/components/app-shell/AppShellHeader.svelte +18 -4
  10. package/dist/components/app-shell/AppShellHeader.svelte.d.ts +5 -0
  11. package/dist/components/app-shell/AppShellMain.svelte +5 -1
  12. package/dist/components/approval/Approval.svelte +14 -1
  13. package/dist/components/approval/Approval.svelte.d.ts +5 -0
  14. package/dist/components/badge/Badge.svelte +19 -2
  15. package/dist/components/badge/Badge.svelte.d.ts +4 -1
  16. package/dist/components/button/Button.svelte +63 -13
  17. package/dist/components/composer/ComposerModelPicker.svelte +80 -13
  18. package/dist/components/composer/ComposerModelPicker.svelte.d.ts +23 -6
  19. package/dist/components/composer/ComposerRoot.svelte +51 -12
  20. package/dist/components/composer/ComposerRoot.svelte.d.ts +16 -0
  21. package/dist/components/composer/ComposerSubmit.svelte +19 -5
  22. package/dist/components/composer/ComposerSubmit.svelte.d.ts +3 -1
  23. package/dist/components/composer/ComposerToggle.svelte +18 -4
  24. package/dist/components/composer/ComposerToggle.svelte.d.ts +2 -0
  25. package/dist/components/composer/ComposerTray.svelte +17 -3
  26. package/dist/components/composer/ComposerTray.svelte.d.ts +5 -0
  27. package/dist/components/composer/context.d.ts +4 -1
  28. package/dist/components/dialog/DialogContent.svelte +22 -12
  29. package/dist/components/dialog/DialogContent.svelte.d.ts +10 -0
  30. package/dist/components/divider/Divider.svelte +56 -14
  31. package/dist/components/divider/Divider.svelte.d.ts +13 -3
  32. package/dist/components/empty-state/EmptyState.svelte +12 -2
  33. package/dist/components/empty-state/EmptyState.svelte.d.ts +6 -0
  34. package/dist/components/heading/Heading.svelte +15 -0
  35. package/dist/components/heading/Heading.svelte.d.ts +6 -0
  36. package/dist/components/hover-card/HoverCardContent.svelte +19 -3
  37. package/dist/components/hover-card/HoverCardContent.svelte.d.ts +8 -0
  38. package/dist/components/input/Input.svelte +13 -3
  39. package/dist/components/input/Input.svelte.d.ts +10 -2
  40. package/dist/components/markdown/Markdown.svelte +22 -2
  41. package/dist/components/markdown/MarkdownDiagram.svelte +33 -2
  42. package/dist/components/markdown/MarkdownFile.svelte +56 -10
  43. package/dist/components/markdown/MarkdownMath.svelte +6 -0
  44. package/dist/components/markdown/MarkdownTable.svelte +3 -4
  45. package/dist/components/markdown/context.d.ts +6 -0
  46. package/dist/components/markdown/labels.d.ts +7 -0
  47. package/dist/components/markdown/labels.js +2 -0
  48. package/dist/components/menu/ContextMenuTrigger.svelte +14 -2
  49. package/dist/components/menu/ContextMenuTrigger.svelte.d.ts +10 -0
  50. package/dist/components/menu/MenuCheckboxItem.svelte +50 -7
  51. package/dist/components/menu/MenuCheckboxItem.svelte.d.ts +16 -0
  52. package/dist/components/menu/MenuContent.svelte +10 -2
  53. package/dist/components/menu/MenuContent.svelte.d.ts +10 -0
  54. package/dist/components/menu/MenuGroup.svelte +16 -0
  55. package/dist/components/menu/MenuGroup.svelte.d.ts +6 -0
  56. package/dist/components/menu/MenuItem.svelte +17 -2
  57. package/dist/components/menu/MenuItem.svelte.d.ts +8 -0
  58. package/dist/components/menu/MenuLabel.svelte +22 -8
  59. package/dist/components/menu/MenuRadioGroup.svelte +16 -0
  60. package/dist/components/menu/MenuRadioGroup.svelte.d.ts +6 -0
  61. package/dist/components/menu/MenuSubContent.svelte +10 -2
  62. package/dist/components/menu/MenuSubContent.svelte.d.ts +10 -0
  63. package/dist/components/menu/MenuSubTrigger.svelte +19 -2
  64. package/dist/components/menu/MenuSubTrigger.svelte.d.ts +6 -0
  65. package/dist/components/menu/group.d.ts +2 -0
  66. package/dist/components/menu/group.js +9 -0
  67. package/dist/components/menu/index.d.ts +4 -2
  68. package/dist/components/menu/index.js +2 -2
  69. package/dist/components/message/MessageBubble.svelte +40 -0
  70. package/dist/components/message/MessageBubble.svelte.d.ts +12 -0
  71. package/dist/components/message/MessageContent.svelte +23 -14
  72. package/dist/components/message/MessageContent.svelte.d.ts +6 -0
  73. package/dist/components/message/MessageCopy.svelte +27 -15
  74. package/dist/components/message/MessageCopy.svelte.d.ts +9 -2
  75. package/dist/components/message/MessageRoot.svelte +20 -3
  76. package/dist/components/message/MessageRoot.svelte.d.ts +6 -0
  77. package/dist/components/message/context.d.ts +2 -0
  78. package/dist/components/message/index.d.ts +4 -1
  79. package/dist/components/message/index.js +3 -2
  80. package/dist/components/message/styles.d.ts +30 -0
  81. package/dist/components/message/styles.js +24 -0
  82. package/dist/components/notice/Notice.svelte +3 -3
  83. package/dist/components/popover/PopoverContent.svelte +27 -3
  84. package/dist/components/popover/PopoverContent.svelte.d.ts +18 -0
  85. package/dist/components/questionnaire/Questionnaire.svelte +103 -19
  86. package/dist/components/questionnaire/Questionnaire.svelte.d.ts +13 -1
  87. package/dist/components/queued-message/QueuedMessage.svelte +44 -6
  88. package/dist/components/queued-message/QueuedMessage.svelte.d.ts +12 -1
  89. package/dist/components/select/Select.svelte +18 -2
  90. package/dist/components/select/Select.svelte.d.ts +7 -0
  91. package/dist/components/sidebar/SidebarContent.svelte +59 -13
  92. package/dist/components/sidebar/SidebarContent.svelte.d.ts +6 -0
  93. package/dist/components/sidebar/SidebarFolder.svelte +29 -2
  94. package/dist/components/sidebar/SidebarGroup.svelte +50 -7
  95. package/dist/components/sidebar/SidebarGroup.svelte.d.ts +10 -1
  96. package/dist/components/sidebar/SidebarItem.svelte +136 -21
  97. package/dist/components/sidebar/SidebarItem.svelte.d.ts +22 -2
  98. package/dist/components/sidebar/SidebarSwitcher.svelte +18 -2
  99. package/dist/components/sidebar/SidebarSwitcher.svelte.d.ts +2 -0
  100. package/dist/components/sidebar/fold.d.ts +12 -0
  101. package/dist/components/sidebar/fold.js +8 -0
  102. package/dist/components/status-indicator/StatusDot.svelte +90 -0
  103. package/dist/components/status-indicator/StatusDot.svelte.d.ts +18 -0
  104. package/dist/components/toast/Toaster.svelte +1 -1
  105. package/dist/components/toggle/Toggle.svelte +12 -2
  106. package/dist/components/toggle/Toggle.svelte.d.ts +11 -1
  107. package/dist/components/toggle-group/ToggleGroupItem.svelte +10 -1
  108. package/dist/components/toggle-group/ToggleGroupRoot.svelte +7 -1
  109. package/dist/components/toggle-group/ToggleGroupRoot.svelte.d.ts +3 -1
  110. package/dist/components/toggle-group/context.d.ts +2 -1
  111. package/dist/components/tooltip/TooltipContent.svelte +13 -1
  112. package/dist/components/tooltip/TooltipContent.svelte.d.ts +10 -0
  113. package/dist/components/work-fold/WorkFold.svelte +13 -4
  114. package/dist/components/work-fold/WorkFold.svelte.d.ts +2 -1
  115. package/dist/focus-ring.d.ts +29 -0
  116. package/dist/focus-ring.js +42 -0
  117. package/dist/index.d.ts +9 -6
  118. package/dist/index.js +8 -2
  119. package/dist/internal/Collapse.svelte +15 -2
  120. package/dist/internal/Glyph.svelte +28 -0
  121. package/dist/internal/Glyph.svelte.d.ts +5 -0
  122. package/dist/internal/Tile.svelte +3 -2
  123. package/dist/internal/layer.d.ts +23 -0
  124. package/dist/internal/layer.js +19 -0
  125. package/dist/internal/toggle.d.ts +8 -1
  126. package/dist/internal/toggle.js +20 -2
  127. package/dist/markdown/file-paths.d.ts +7 -0
  128. package/dist/markdown/file-paths.js +29 -0
  129. package/dist/markdown/files.d.ts +22 -2
  130. package/dist/markdown/files.js +45 -14
  131. package/dist/tokens.stylex.d.ts +3 -0
  132. package/dist/tokens.stylex.js +5 -1
  133. package/package.json +1 -1
  134. package/skills/building-ui/SKILL.md +87 -8
  135. package/skills/building-ui/references/components.md +39 -38
  136. package/skills/markdown/SKILL.md +22 -6
  137. package/skills/setup/SKILL.md +1 -1
  138. package/skills/styling/SKILL.md +10 -3
  139. package/skills/theming/SKILL.md +11 -4
@@ -0,0 +1,54 @@
1
+ <!--
2
+ The icon at the start of a row in the agent's timeline, bare, in the colour of where the row
3
+ stands: the accent while it runs, green once it went through, red when it did not. For a row
4
+ of the app's own that sits among Activity's, Tool's and Reasoning's, and lines up with them.
5
+ -->
6
+ <script lang="ts" module>
7
+ import type { Snippet } from 'svelte';
8
+ import { KIND_GLYPHS } from '../../internal/kinds.js';
9
+ import type { Sx } from '../../internal/sx.js';
10
+ import Tile, { type TileTone } from '../../internal/Tile.svelte';
11
+ import Spinner from '../spinner/Spinner.svelte';
12
+ import type { ActivityStepKind } from './ActivityStep.svelte';
13
+
14
+ export type ActivityIconTone = TileTone;
15
+
16
+ export type ActivityIconProps = {
17
+ /** What kind of thing the row is: its icon is the one Activity.Step shows for that kind. */
18
+ kind?: ActivityStepKind | undefined;
19
+ /**
20
+ * Where the row stands: `live` (the accent) while it runs, `success`, `warning` or
21
+ * `danger` once it has settled, `neutral` for a row that is neither.
22
+ */
23
+ tone?: ActivityIconTone | undefined;
24
+ /** A spinner in the icon's place, while the row's work goes on. */
25
+ spinning?: boolean | undefined;
26
+ /** `md` for a row of its own, as a step's group is; `sm` for a step within one. */
27
+ size?: 'sm' | 'md' | undefined;
28
+ sx?: Sx | undefined;
29
+ /** An icon of your own in place of the kind's, such as a Lucide icon. It is sized to fit. */
30
+ children?: Snippet | undefined;
31
+ };
32
+ </script>
33
+
34
+ <script lang="ts">
35
+ let {
36
+ kind = 'tool',
37
+ tone = 'neutral',
38
+ spinning = false,
39
+ size = 'md',
40
+ sx,
41
+ children
42
+ }: ActivityIconProps = $props();
43
+ </script>
44
+
45
+ <Tile
46
+ {size}
47
+ {sx}
48
+ tone={spinning && tone === 'neutral' ? 'live' : tone}
49
+ glyph={spinning || children ? undefined : KIND_GLYPHS[kind]}
50
+ >{#if spinning}<Spinner
51
+ size={size === 'md' ? 13 : 11}
52
+ label={null}
53
+ />{:else}{@render children?.()}{/if}</Tile
54
+ >
@@ -0,0 +1,24 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { Sx } from '../../internal/sx.js';
3
+ import { type TileTone } from '../../internal/Tile.svelte';
4
+ import type { ActivityStepKind } from './ActivityStep.svelte';
5
+ export type ActivityIconTone = TileTone;
6
+ export type ActivityIconProps = {
7
+ /** What kind of thing the row is: its icon is the one Activity.Step shows for that kind. */
8
+ kind?: ActivityStepKind | undefined;
9
+ /**
10
+ * Where the row stands: `live` (the accent) while it runs, `success`, `warning` or
11
+ * `danger` once it has settled, `neutral` for a row that is neither.
12
+ */
13
+ tone?: ActivityIconTone | undefined;
14
+ /** A spinner in the icon's place, while the row's work goes on. */
15
+ spinning?: boolean | undefined;
16
+ /** `md` for a row of its own, as a step's group is; `sm` for a step within one. */
17
+ size?: 'sm' | 'md' | undefined;
18
+ sx?: Sx | undefined;
19
+ /** An icon of your own in place of the kind's, such as a Lucide icon. It is sized to fit. */
20
+ children?: Snippet | undefined;
21
+ };
22
+ declare const ActivityIcon: import("svelte").Component<ActivityIconProps, {}, "">;
23
+ type ActivityIcon = ReturnType<typeof ActivityIcon>;
24
+ export default ActivityIcon;
@@ -1,10 +1,12 @@
1
1
  <!--
2
2
  One thing the agent did: a command, an edit, a read, a search. Its label is
3
- the thing itself, as code; a step that did not go through says so.
3
+ the thing itself, as code; a step that did not go through says so, and one
4
+ that was let be, such as one never checked, says that, without the red.
4
5
  -->
5
6
  <script lang="ts" module>
6
7
  import * as stylex from '@stylexjs/stylex';
7
8
  import type { Snippet } from 'svelte';
9
+ import type { HTMLAttributes } from 'svelte/elements';
8
10
  import { emphasis, KIND_GLYPHS, type ActionKind } from '../../internal/kinds.js';
9
11
  import { attrs, type Sx } from '../../internal/sx.js';
10
12
  import Tile from '../../internal/Tile.svelte';
@@ -12,12 +14,22 @@
12
14
  import Spinner from '../spinner/Spinner.svelte';
13
15
 
14
16
  export type ActivityStepKind = ActionKind;
15
- export type ActivityStepStatus = 'running' | 'done' | 'failed' | 'declined' | 'blocked';
17
+ /**
18
+ * Where a step stands. `failed`, `declined` and `blocked` did not go through, and say so in
19
+ * red; `neutral` settled without going through or failing, such as a step that was skipped
20
+ * or never checked, and says so in grey.
21
+ */
22
+ export type ActivityStepStatus =
23
+ 'running' | 'done' | 'failed' | 'declined' | 'blocked' | 'neutral';
16
24
 
17
- export type ActivityStepProps = {
25
+ type Badged = 'failed' | 'declined' | 'blocked' | 'neutral';
26
+
27
+ export type ActivityStepProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class'> & {
18
28
  kind?: ActivityStepKind | undefined;
19
- /** The command, the path, the query: shown as code. */
29
+ /** The command, the path, the query: shown as code. Cut to one line, unless `wrap`. */
20
30
  label: string;
31
+ /** Lets the label run onto more lines, rather than cutting it off at the end of one. */
32
+ wrap?: boolean | undefined;
21
33
  status?: ActivityStepStatus | undefined;
22
34
  /** Why it went the way it did, such as why it was blocked. */
23
35
  reason?: string | undefined;
@@ -26,14 +38,19 @@
26
38
  /** How much of the output to keep, from the end, in characters. */
27
39
  tail?: number | undefined;
28
40
  /** Words for the statuses that need them. */
29
- statusLabels?: Partial<Record<'failed' | 'declined' | 'blocked', string>> | undefined;
41
+ statusLabels?: Partial<Record<Badged, string>> | undefined;
30
42
  /** Anything else: images, a diff. */
31
43
  children?: Snippet | undefined;
32
44
  sx?: Sx | undefined;
33
45
  class?: string | undefined;
34
46
  };
35
47
 
36
- const LABELS = { failed: 'Failed', declined: 'Declined', blocked: 'Blocked' };
48
+ const LABELS: Record<Badged, string> = {
49
+ failed: 'Failed',
50
+ declined: 'Declined',
51
+ blocked: 'Blocked',
52
+ neutral: 'Skipped'
53
+ };
37
54
 
38
55
  const styles = stylex.create({
39
56
  // The icon sits in a column as wide as the row's own icon above
@@ -62,6 +79,13 @@
62
79
  fontFamily: 'inherit',
63
80
  fontSize: font.sizeCaption
64
81
  },
82
+ // All of it, over as many lines as it takes
83
+ wrapped: {
84
+ overflow: 'visible',
85
+ whiteSpace: 'pre-wrap',
86
+ overflowWrap: 'anywhere'
87
+ },
88
+ lineWrapped: { alignItems: 'flex-start' },
65
89
  // The file of a path, the program of a command: the part to read first
66
90
  main: { color: colors.text },
67
91
  badge: {
@@ -74,6 +98,7 @@
74
98
  fontSize: font.sizeMicro,
75
99
  fontWeight: font.weightMedium
76
100
  },
101
+ badgeNeutral: { backgroundColor: colors.fillMuted, color: colors.textMuted },
77
102
  body: {
78
103
  gridColumn: '2',
79
104
  display: 'flex',
@@ -110,14 +135,17 @@
110
135
  output,
111
136
  tail = 4000,
112
137
  statusLabels,
138
+ wrap = false,
113
139
  children,
114
140
  sx,
115
- class: className
141
+ class: className,
142
+ ...rest
116
143
  }: ActivityStepProps = $props();
117
144
 
118
145
  const shown = $derived(output && output.length > tail ? `…${output.slice(-tail)}` : output);
119
146
  const parts = $derived(emphasis(kind, label));
120
147
  const bad = $derived(status === 'failed' || status === 'declined' || status === 'blocked');
148
+ const badged = $derived(bad || status === 'neutral');
121
149
 
122
150
  // Long output opens at its end, where the result is
123
151
  function toEnd(element: HTMLElement) {
@@ -125,7 +153,12 @@
125
153
  }
126
154
  </script>
127
155
 
128
- <div data-slot="activity-step" data-status={status} {...attrs([styles.step, sx], className)}>
156
+ <div
157
+ data-slot="activity-step"
158
+ data-status={status}
159
+ {...rest}
160
+ {...attrs([styles.step, sx], className)}
161
+ >
129
162
  <span {...stylex.attrs(styles.icon)}>
130
163
  <Tile
131
164
  size="sm"
@@ -134,13 +167,14 @@
134
167
  >{#if status === 'running'}<Spinner size={11} label={null} />{/if}</Tile
135
168
  >
136
169
  </span>
137
- <span {...stylex.attrs(styles.line)}>
138
- <code {...stylex.attrs(styles.label)}
170
+ <span {...stylex.attrs(styles.line, wrap && styles.lineWrapped)}>
171
+ <!-- Cut to a line, the whole of it is still there, under the pointer -->
172
+ <code title={wrap ? undefined : label} {...stylex.attrs(styles.label, wrap && styles.wrapped)}
139
173
  >{parts[0]}<span {...stylex.attrs(styles.main)}>{parts[1]}</span>{parts[2]}</code
140
174
  >
141
- {#if bad}
142
- <span {...stylex.attrs(styles.badge)}
143
- >{statusLabels?.[status as 'failed'] ?? LABELS[status as 'failed']}</span
175
+ {#if badged}
176
+ <span {...stylex.attrs(styles.badge, status === 'neutral' && styles.badgeNeutral)}
177
+ >{statusLabels?.[status as Badged] ?? LABELS[status as Badged]}</span
144
178
  >
145
179
  {/if}
146
180
  </span>
@@ -1,12 +1,21 @@
1
1
  import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
2
3
  import { type ActionKind } from '../../internal/kinds.js';
3
4
  import { type Sx } from '../../internal/sx.js';
4
5
  export type ActivityStepKind = ActionKind;
5
- export type ActivityStepStatus = 'running' | 'done' | 'failed' | 'declined' | 'blocked';
6
- export type ActivityStepProps = {
6
+ /**
7
+ * Where a step stands. `failed`, `declined` and `blocked` did not go through, and say so in
8
+ * red; `neutral` settled without going through or failing, such as a step that was skipped
9
+ * or never checked, and says so in grey.
10
+ */
11
+ export type ActivityStepStatus = 'running' | 'done' | 'failed' | 'declined' | 'blocked' | 'neutral';
12
+ type Badged = 'failed' | 'declined' | 'blocked' | 'neutral';
13
+ export type ActivityStepProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class'> & {
7
14
  kind?: ActivityStepKind | undefined;
8
- /** The command, the path, the query: shown as code. */
15
+ /** The command, the path, the query: shown as code. Cut to one line, unless `wrap`. */
9
16
  label: string;
17
+ /** Lets the label run onto more lines, rather than cutting it off at the end of one. */
18
+ wrap?: boolean | undefined;
10
19
  status?: ActivityStepStatus | undefined;
11
20
  /** Why it went the way it did, such as why it was blocked. */
12
21
  reason?: string | undefined;
@@ -15,7 +24,7 @@ export type ActivityStepProps = {
15
24
  /** How much of the output to keep, from the end, in characters. */
16
25
  tail?: number | undefined;
17
26
  /** Words for the statuses that need them. */
18
- statusLabels?: Partial<Record<'failed' | 'declined' | 'blocked', string>> | undefined;
27
+ statusLabels?: Partial<Record<Badged, string>> | undefined;
19
28
  /** Anything else: images, a diff. */
20
29
  children?: Snippet | undefined;
21
30
  sx?: Sx | undefined;
@@ -1,16 +1,26 @@
1
1
  <!-- The agent's thinking between steps, in line with the steps, set apart in italics. -->
2
2
  <script lang="ts" module>
3
3
  import * as stylex from '@stylexjs/stylex';
4
+ import type { Snippet } from 'svelte';
5
+ import type { HTMLAttributes } from 'svelte/elements';
6
+ import { attrs, type Sx } from '../../internal/sx.js';
4
7
  import Tile from '../../internal/Tile.svelte';
5
8
  import { colors, font } from '../../tokens.stylex.js';
6
9
  import Shimmer from '../shimmer/Shimmer.svelte';
7
10
 
8
- export type ActivityThoughtProps = {
9
- text: string;
11
+ export type ActivityThoughtProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
12
+ /** The thought, as plain text. */
13
+ text?: string | undefined;
10
14
  /** Set while the thought is still arriving. */
11
15
  active?: boolean | undefined;
12
16
  label?: string | undefined;
13
17
  activeLabel?: string | undefined;
18
+ sx?: Sx | undefined;
19
+ /**
20
+ * The thought as anything else, such as rendered Markdown, in place of `text`. It takes
21
+ * the thought's colour, size and italics, as `text` does.
22
+ */
23
+ children?: Snippet | undefined;
14
24
  };
15
25
 
16
26
  const styles = stylex.create({
@@ -29,6 +39,7 @@
29
39
  lineHeight: '1.25rem'
30
40
  },
31
41
  text: {
42
+ minWidth: 0,
32
43
  margin: 0,
33
44
  color: colors.textMuted,
34
45
  fontSize: font.sizeMeta,
@@ -43,11 +54,15 @@
43
54
  text,
44
55
  active = false,
45
56
  label = 'Thought',
46
- activeLabel = 'Thinking'
57
+ activeLabel = 'Thinking',
58
+ sx,
59
+ class: className,
60
+ children,
61
+ ...rest
47
62
  }: ActivityThoughtProps = $props();
48
63
  </script>
49
64
 
50
- <div data-slot="activity-thought" {...stylex.attrs(styles.thought)}>
65
+ <div data-slot="activity-thought" {...rest} {...attrs([styles.thought, sx], className)}>
51
66
  <span {...stylex.attrs(styles.icon)}>
52
67
  <Tile size="sm" glyph="bulb" tone={active ? 'live' : 'neutral'} />
53
68
  </span>
@@ -55,6 +70,10 @@
55
70
  <span {...stylex.attrs(styles.label)}
56
71
  ><Shimmer {active}>{active ? activeLabel : label}</Shimmer></span
57
72
  >
58
- <p {...stylex.attrs(styles.text)}>{text}</p>
73
+ {#if children}
74
+ <div {...stylex.attrs(styles.text)}>{@render children()}</div>
75
+ {:else if text}
76
+ <p {...stylex.attrs(styles.text)}>{text}</p>
77
+ {/if}
59
78
  </div>
60
79
  </div>
@@ -1,9 +1,19 @@
1
- export type ActivityThoughtProps = {
2
- text: string;
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import { type Sx } from '../../internal/sx.js';
4
+ export type ActivityThoughtProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
5
+ /** The thought, as plain text. */
6
+ text?: string | undefined;
3
7
  /** Set while the thought is still arriving. */
4
8
  active?: boolean | undefined;
5
9
  label?: string | undefined;
6
10
  activeLabel?: string | undefined;
11
+ sx?: Sx | undefined;
12
+ /**
13
+ * The thought as anything else, such as rendered Markdown, in place of `text`. It takes
14
+ * the thought's colour, size and italics, as `text` does.
15
+ */
16
+ children?: Snippet | undefined;
7
17
  };
8
18
  declare const ActivityThought: import("svelte").Component<ActivityThoughtProps, {}, "">;
9
19
  type ActivityThought = ReturnType<typeof ActivityThought>;
@@ -1,10 +1,12 @@
1
1
  import Content from './ActivityContent.svelte';
2
+ import Icon from './ActivityIcon.svelte';
2
3
  import Root from './ActivityRoot.svelte';
3
4
  import Step from './ActivityStep.svelte';
4
5
  import Thought from './ActivityThought.svelte';
5
6
  import Trigger from './ActivityTrigger.svelte';
6
- export { Root, Trigger, Content, Step, Thought };
7
+ export { Root, Trigger, Content, Step, Thought, Icon };
7
8
  export type { ActivityContentProps } from './ActivityContent.svelte';
9
+ export type { ActivityIconProps, ActivityIconTone } from './ActivityIcon.svelte';
8
10
  export type { ActivityRootProps } from './ActivityRoot.svelte';
9
11
  export type { ActivityStepKind, ActivityStepProps, ActivityStepStatus } from './ActivityStep.svelte';
10
12
  export type { ActivityThoughtProps } from './ActivityThought.svelte';
@@ -1,6 +1,7 @@
1
1
  import Content from './ActivityContent.svelte';
2
+ import Icon from './ActivityIcon.svelte';
2
3
  import Root from './ActivityRoot.svelte';
3
4
  import Step from './ActivityStep.svelte';
4
5
  import Thought from './ActivityThought.svelte';
5
6
  import Trigger from './ActivityTrigger.svelte';
6
- export { Root, Trigger, Content, Step, Thought };
7
+ export { Root, Trigger, Content, Step, Thought, Icon };
@@ -16,6 +16,11 @@
16
16
  * window's drag region. Turn it on in a shell that has no bar.
17
17
  */
18
18
  drag?: boolean | undefined;
19
+ /**
20
+ * Whether a hairline divides it from what is under it. Leave it out where what follows
21
+ * draws its own edge, or where the page runs on under the header, as a conversation does.
22
+ */
23
+ divider?: boolean | undefined;
19
24
  sx?: Sx | undefined;
20
25
  children?: Snippet | undefined;
21
26
  };
@@ -33,22 +38,31 @@
33
38
  // with no bar, clear of the traffic lights while the sidebar is away.
34
39
  paddingInlineStart: 'max(1rem, calc(var(--narvi-inset-page, 0px) + 0.5rem))',
35
40
  paddingInlineEnd: '0.625rem',
41
+ fontSize: font.sizeBody
42
+ },
43
+ divider: {
36
44
  borderBottomWidth: '1px',
37
45
  borderBottomStyle: 'solid',
38
- borderBottomColor: colors.border,
39
- fontSize: font.sizeBody
46
+ borderBottomColor: colors.border
40
47
  }
41
48
  });
42
49
  </script>
43
50
 
44
51
  <script lang="ts">
45
- let { drag = false, sx, class: className, children, ...rest }: AppShellHeaderProps = $props();
52
+ let {
53
+ drag = false,
54
+ divider = true,
55
+ sx,
56
+ class: className,
57
+ children,
58
+ ...rest
59
+ }: AppShellHeaderProps = $props();
46
60
  </script>
47
61
 
48
62
  <header
49
63
  data-slot="app-shell-header"
50
64
  {...rest}
51
- {...attrs([styles.header, drag && shared.dragRegion, sx], className)}
65
+ {...attrs([styles.header, divider && styles.divider, drag && shared.dragRegion, sx], className)}
52
66
  >
53
67
  {@render children?.()}
54
68
  </header>
@@ -7,6 +7,11 @@ export type AppShellHeaderProps = Omit<HTMLAttributes<HTMLElement>, 'children'>
7
7
  * window's drag region. Turn it on in a shell that has no bar.
8
8
  */
9
9
  drag?: boolean | undefined;
10
+ /**
11
+ * Whether a hairline divides it from what is under it. Leave it out where what follows
12
+ * draws its own edge, or where the page runs on under the header, as a conversation does.
13
+ */
14
+ divider?: boolean | undefined;
10
15
  sx?: Sx | undefined;
11
16
  children?: Snippet | undefined;
12
17
  };
@@ -19,6 +19,7 @@
19
19
  flexGrow: 1,
20
20
  minWidth: 0,
21
21
  minHeight: 0,
22
+ // Focused from a skip link, it is the page that is reached, not a control
22
23
  outlineStyle: 'none'
23
24
  }
24
25
  });
@@ -28,6 +29,9 @@
28
29
  let { sx, class: className, children, ...rest }: AppShellMainProps = $props();
29
30
  </script>
30
31
 
31
- <main tabindex="-1" data-slot="app-shell-main" {...rest} {...attrs([styles.main, sx], className)}>
32
+ <!-- Not focusable by default: with `tabindex="-1"` a click on plain text in the page would move
33
+ focus to the whole of it, away from a panel that keeps its own, such as a find bar. Pass a
34
+ `tabindex` to make it the target of a skip link. -->
35
+ <main data-slot="app-shell-main" {...rest} {...attrs([styles.main, sx], className)}>
32
36
  {@render children?.()}
33
37
  </main>
@@ -63,6 +63,11 @@
63
63
  onchoose: (value: string) => void;
64
64
  /** Once there is one, the card folds into a line that says it. */
65
65
  answer?: ApprovalAnswer | undefined;
66
+ /**
67
+ * Set while the answer is on its way. The button pressed shows a spinner, the others
68
+ * wait, and the shortcuts do nothing, so the choice is not made twice.
69
+ */
70
+ busy?: boolean | undefined;
66
71
  /** What the folded line names after the answer, such as the command. */
67
72
  subject?: string | undefined;
68
73
  /** More detail inside the card. */
@@ -156,6 +161,7 @@
156
161
  choices,
157
162
  onchoose,
158
163
  answer,
164
+ busy = false,
159
165
  subject,
160
166
  children,
161
167
  sx,
@@ -166,10 +172,14 @@
166
172
  let card = $state<HTMLElement | null>(null);
167
173
  let line = $state<HTMLElement | null>(null);
168
174
  let keepFocus = false;
175
+ // The choice last made, which spins while the answer is on its way
176
+ let chosen = $state<string>();
169
177
 
170
178
  function choose(value: string) {
179
+ if (busy) return;
171
180
  // The buttons are about to go; focus follows to what replaces them
172
181
  keepFocus = !!card?.contains(document.activeElement);
182
+ chosen = value;
173
183
  onchoose(value);
174
184
  }
175
185
 
@@ -186,7 +196,7 @@
186
196
  });
187
197
 
188
198
  function onkeydown(event: KeyboardEvent) {
189
- if (answer || event.defaultPrevented || event.repeat || !card) return;
199
+ if (answer || busy || event.defaultPrevented || event.repeat || !card) return;
190
200
  // With several cards waiting, the first one on the page answers
191
201
  if (document.querySelector('[data-slot="approval"][data-shortcuts]') !== card) return;
192
202
  const mod = event.metaKey || event.ctrlKey;
@@ -241,6 +251,7 @@
241
251
  role="group"
242
252
  aria-labelledby="{uid}-title"
243
253
  data-slot="approval"
254
+ aria-busy={busy || undefined}
244
255
  data-shortcuts={choices.some((choice) => choice.shortcut) || undefined}
245
256
  {...attrs([styles.card, sx], className)}
246
257
  >
@@ -272,6 +283,8 @@
272
283
  .replace('enter', 'Enter')
273
284
  .replace('backspace', 'Backspace')
274
285
  : undefined}
286
+ loading={busy && chosen === choice.value}
287
+ disabled={busy && chosen !== choice.value}
275
288
  onclick={() => choose(choice.value)}
276
289
  >
277
290
  {choice.label}
@@ -33,6 +33,11 @@ export type ApprovalProps = {
33
33
  onchoose: (value: string) => void;
34
34
  /** Once there is one, the card folds into a line that says it. */
35
35
  answer?: ApprovalAnswer | undefined;
36
+ /**
37
+ * Set while the answer is on its way. The button pressed shows a spinner, the others
38
+ * wait, and the shortcuts do nothing, so the choice is not made twice.
39
+ */
40
+ busy?: boolean | undefined;
36
41
  /** What the folded line names after the answer, such as the command. */
37
42
  subject?: string | undefined;
38
43
  /** More detail inside the card. */
@@ -5,8 +5,9 @@
5
5
  import { shared } from '../../internal/shared.js';
6
6
  import { attrs, type Sx } from '../../internal/sx.js';
7
7
  import { colors, font, radius } from '../../tokens.stylex.js';
8
+ import '../../internal/icons.css';
8
9
 
9
- export type BadgeTone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger';
10
+ export type BadgeTone = 'neutral' | 'accent' | 'info' | 'success' | 'warning' | 'danger';
10
11
 
11
12
  export type BadgeProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children'> & {
12
13
  /** Colour of the dot. The words stay in the text colour, so they are always readable. */
@@ -16,12 +17,16 @@
16
17
  * text colour, which holds its contrast on a badge's own surface.
17
18
  */
18
19
  plain?: boolean | undefined;
20
+ /** `sm` is as tall as a sidebar row's line, 18px, to sit in a row without growing it. */
21
+ size?: 'sm' | 'md' | undefined;
19
22
  sx?: Sx | undefined;
20
23
  children?: Snippet | undefined;
21
24
  };
22
25
 
23
26
  const styles = stylex.create({
24
27
  base: {
28
+ // An icon put in it, beside the words, is 12px (`internal/icons.css`)
29
+ '--narvi-icon-size': '0.75rem',
25
30
  display: 'inline-flex',
26
31
  alignItems: 'center',
27
32
  gap: '0.375rem',
@@ -47,12 +52,14 @@
47
52
  borderRadius: radius.pill,
48
53
  forcedColorAdjust: 'none'
49
54
  },
55
+ sm: { gap: '0.25rem', minHeight: '1.125rem', paddingInline: '0.375rem' },
50
56
  lit: { color: colors.text }
51
57
  });
52
58
 
53
59
  const dots = stylex.create({
54
60
  neutral: { backgroundColor: colors.textSubtle },
55
61
  accent: { backgroundColor: colors.accent },
62
+ info: { backgroundColor: colors.info },
56
63
  success: { backgroundColor: colors.success },
57
64
  warning: { backgroundColor: colors.warning },
58
65
  danger: { backgroundColor: colors.danger }
@@ -62,6 +69,7 @@
62
69
  const words = stylex.create({
63
70
  neutral: {},
64
71
  accent: { color: colors.accent },
72
+ info: { color: colors.infoText },
65
73
  success: { color: colors.successText },
66
74
  warning: { color: colors.warningText },
67
75
  danger: { color: colors.dangerText }
@@ -72,6 +80,7 @@
72
80
  let {
73
81
  tone = 'neutral',
74
82
  plain = false,
83
+ size = 'md',
75
84
  sx,
76
85
  class: className,
77
86
  children,
@@ -80,9 +89,17 @@
80
89
  </script>
81
90
 
82
91
  <span
92
+ data-icons
83
93
  {...rest}
84
94
  {...attrs(
85
- [styles.base, shared.edged, tone === 'accent' && styles.lit, plain && words[tone], sx],
95
+ [
96
+ styles.base,
97
+ size === 'sm' && styles.sm,
98
+ shared.edged,
99
+ tone === 'accent' && styles.lit,
100
+ plain && words[tone],
101
+ sx
102
+ ],
86
103
  className
87
104
  )}
88
105
  >
@@ -1,7 +1,8 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { HTMLAttributes } from 'svelte/elements';
3
3
  import { type Sx } from '../../internal/sx.js';
4
- export type BadgeTone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger';
4
+ import '../../internal/icons.css';
5
+ export type BadgeTone = 'neutral' | 'accent' | 'info' | 'success' | 'warning' | 'danger';
5
6
  export type BadgeProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children'> & {
6
7
  /** Colour of the dot. The words stay in the text colour, so they are always readable. */
7
8
  tone?: BadgeTone | undefined;
@@ -10,6 +11,8 @@ export type BadgeProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children'> & {
10
11
  * text colour, which holds its contrast on a badge's own surface.
11
12
  */
12
13
  plain?: boolean | undefined;
14
+ /** `sm` is as tall as a sidebar row's line, 18px, to sit in a row without growing it. */
15
+ size?: 'sm' | 'md' | undefined;
13
16
  sx?: Sx | undefined;
14
17
  children?: Snippet | undefined;
15
18
  };