@diegopluna/narvi 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) 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/approval/Approval.svelte +14 -1
  12. package/dist/components/approval/Approval.svelte.d.ts +5 -0
  13. package/dist/components/badge/Badge.svelte +3 -1
  14. package/dist/components/badge/Badge.svelte.d.ts +1 -1
  15. package/dist/components/button/Button.svelte +17 -6
  16. package/dist/components/composer/ComposerModelPicker.svelte +80 -13
  17. package/dist/components/composer/ComposerModelPicker.svelte.d.ts +23 -6
  18. package/dist/components/composer/ComposerRoot.svelte +51 -12
  19. package/dist/components/composer/ComposerRoot.svelte.d.ts +16 -0
  20. package/dist/components/composer/ComposerSubmit.svelte +19 -5
  21. package/dist/components/composer/ComposerSubmit.svelte.d.ts +3 -1
  22. package/dist/components/composer/ComposerToggle.svelte +18 -4
  23. package/dist/components/composer/ComposerToggle.svelte.d.ts +2 -0
  24. package/dist/components/composer/ComposerTray.svelte +17 -3
  25. package/dist/components/composer/ComposerTray.svelte.d.ts +5 -0
  26. package/dist/components/composer/context.d.ts +4 -1
  27. package/dist/components/dialog/DialogContent.svelte +22 -12
  28. package/dist/components/dialog/DialogContent.svelte.d.ts +10 -0
  29. package/dist/components/divider/Divider.svelte +56 -14
  30. package/dist/components/divider/Divider.svelte.d.ts +13 -3
  31. package/dist/components/empty-state/EmptyState.svelte +12 -2
  32. package/dist/components/empty-state/EmptyState.svelte.d.ts +6 -0
  33. package/dist/components/heading/Heading.svelte +15 -0
  34. package/dist/components/heading/Heading.svelte.d.ts +6 -0
  35. package/dist/components/hover-card/HoverCardContent.svelte +18 -2
  36. package/dist/components/hover-card/HoverCardContent.svelte.d.ts +8 -0
  37. package/dist/components/input/Input.svelte +13 -3
  38. package/dist/components/input/Input.svelte.d.ts +10 -2
  39. package/dist/components/markdown/Markdown.svelte +22 -2
  40. package/dist/components/markdown/MarkdownDiagram.svelte +33 -2
  41. package/dist/components/markdown/MarkdownFile.svelte +56 -10
  42. package/dist/components/markdown/MarkdownMath.svelte +6 -0
  43. package/dist/components/markdown/MarkdownTable.svelte +3 -4
  44. package/dist/components/markdown/context.d.ts +6 -0
  45. package/dist/components/markdown/labels.d.ts +7 -0
  46. package/dist/components/markdown/labels.js +2 -0
  47. package/dist/components/menu/MenuCheckboxItem.svelte +44 -7
  48. package/dist/components/menu/MenuCheckboxItem.svelte.d.ts +12 -2
  49. package/dist/components/menu/MenuContent.svelte +10 -2
  50. package/dist/components/menu/MenuContent.svelte.d.ts +10 -0
  51. package/dist/components/menu/MenuItem.svelte +17 -2
  52. package/dist/components/menu/MenuItem.svelte.d.ts +8 -0
  53. package/dist/components/menu/MenuSubContent.svelte +10 -2
  54. package/dist/components/menu/MenuSubContent.svelte.d.ts +10 -0
  55. package/dist/components/menu/MenuSubTrigger.svelte +19 -2
  56. package/dist/components/menu/MenuSubTrigger.svelte.d.ts +6 -0
  57. package/dist/components/message/MessageBubble.svelte +40 -0
  58. package/dist/components/message/MessageBubble.svelte.d.ts +12 -0
  59. package/dist/components/message/MessageContent.svelte +23 -14
  60. package/dist/components/message/MessageContent.svelte.d.ts +6 -0
  61. package/dist/components/message/MessageCopy.svelte +27 -15
  62. package/dist/components/message/MessageCopy.svelte.d.ts +9 -2
  63. package/dist/components/message/MessageRoot.svelte +20 -3
  64. package/dist/components/message/MessageRoot.svelte.d.ts +6 -0
  65. package/dist/components/message/context.d.ts +2 -0
  66. package/dist/components/message/index.d.ts +4 -1
  67. package/dist/components/message/index.js +3 -2
  68. package/dist/components/message/styles.d.ts +30 -0
  69. package/dist/components/message/styles.js +24 -0
  70. package/dist/components/notice/Notice.svelte +3 -3
  71. package/dist/components/popover/PopoverContent.svelte +27 -3
  72. package/dist/components/popover/PopoverContent.svelte.d.ts +18 -0
  73. package/dist/components/questionnaire/Questionnaire.svelte +103 -19
  74. package/dist/components/questionnaire/Questionnaire.svelte.d.ts +13 -1
  75. package/dist/components/queued-message/QueuedMessage.svelte +44 -6
  76. package/dist/components/queued-message/QueuedMessage.svelte.d.ts +12 -1
  77. package/dist/components/select/Select.svelte +18 -2
  78. package/dist/components/select/Select.svelte.d.ts +7 -0
  79. package/dist/components/toast/Toaster.svelte +1 -1
  80. package/dist/components/toggle/Toggle.svelte +12 -2
  81. package/dist/components/toggle/Toggle.svelte.d.ts +11 -1
  82. package/dist/components/toggle-group/ToggleGroupItem.svelte +10 -1
  83. package/dist/components/toggle-group/ToggleGroupRoot.svelte +7 -1
  84. package/dist/components/toggle-group/ToggleGroupRoot.svelte.d.ts +3 -1
  85. package/dist/components/toggle-group/context.d.ts +2 -1
  86. package/dist/components/tooltip/TooltipContent.svelte +13 -1
  87. package/dist/components/tooltip/TooltipContent.svelte.d.ts +10 -0
  88. package/dist/components/work-fold/WorkFold.svelte +13 -4
  89. package/dist/components/work-fold/WorkFold.svelte.d.ts +2 -1
  90. package/dist/focus-ring.d.ts +29 -0
  91. package/dist/focus-ring.js +42 -0
  92. package/dist/index.d.ts +6 -5
  93. package/dist/index.js +7 -2
  94. package/dist/internal/Collapse.svelte +15 -2
  95. package/dist/internal/Glyph.svelte +28 -0
  96. package/dist/internal/Glyph.svelte.d.ts +5 -0
  97. package/dist/internal/Tile.svelte +3 -2
  98. package/dist/internal/layer.d.ts +23 -0
  99. package/dist/internal/layer.js +19 -0
  100. package/dist/internal/toggle.d.ts +8 -1
  101. package/dist/internal/toggle.js +20 -2
  102. package/dist/markdown/file-paths.d.ts +7 -0
  103. package/dist/markdown/file-paths.js +29 -0
  104. package/dist/markdown/files.d.ts +22 -2
  105. package/dist/markdown/files.js +45 -14
  106. package/dist/tokens.stylex.d.ts +3 -0
  107. package/dist/tokens.stylex.js +5 -1
  108. package/package.json +1 -1
  109. package/skills/building-ui/SKILL.md +55 -3
  110. package/skills/building-ui/references/components.md +33 -33
  111. package/skills/markdown/SKILL.md +22 -6
  112. package/skills/setup/SKILL.md +1 -1
  113. package/skills/styling/SKILL.md +10 -3
  114. 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
  };
@@ -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. */
@@ -7,7 +7,7 @@
7
7
  import { colors, font, radius } from '../../tokens.stylex.js';
8
8
  import '../../internal/icons.css';
9
9
 
10
- export type BadgeTone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger';
10
+ export type BadgeTone = 'neutral' | 'accent' | 'info' | 'success' | 'warning' | 'danger';
11
11
 
12
12
  export type BadgeProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children'> & {
13
13
  /** Colour of the dot. The words stay in the text colour, so they are always readable. */
@@ -59,6 +59,7 @@
59
59
  const dots = stylex.create({
60
60
  neutral: { backgroundColor: colors.textSubtle },
61
61
  accent: { backgroundColor: colors.accent },
62
+ info: { backgroundColor: colors.info },
62
63
  success: { backgroundColor: colors.success },
63
64
  warning: { backgroundColor: colors.warning },
64
65
  danger: { backgroundColor: colors.danger }
@@ -68,6 +69,7 @@
68
69
  const words = stylex.create({
69
70
  neutral: {},
70
71
  accent: { color: colors.accent },
72
+ info: { color: colors.infoText },
71
73
  success: { color: colors.successText },
72
74
  warning: { color: colors.warningText },
73
75
  danger: { color: colors.dangerText }
@@ -2,7 +2,7 @@ import type { Snippet } from 'svelte';
2
2
  import type { HTMLAttributes } from 'svelte/elements';
3
3
  import { type Sx } from '../../internal/sx.js';
4
4
  import '../../internal/icons.css';
5
- export type BadgeTone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger';
5
+ export type BadgeTone = 'neutral' | 'accent' | 'info' | 'success' | 'warning' | 'danger';
6
6
  export type BadgeProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children'> & {
7
7
  /** Colour of the dot. The words stay in the text colour, so they are always readable. */
8
8
  tone?: BadgeTone | undefined;
@@ -55,6 +55,10 @@
55
55
 
56
56
  // One key for every hover, so the catalog can show it without a pointer
57
57
  const HOVER = ':is(:hover, [data-preview~="hover"])';
58
+ // The trigger of a menu, a popover or a select while what it opened is showing. bits-ui
59
+ // marks it with `aria-expanded`, which a disclosure's trigger carries too: only a popup's
60
+ // (`aria-haspopup`) is held in its open look.
61
+ const OPEN = ':is([aria-haspopup]:not([aria-haspopup="false"])[aria-expanded="true"])';
58
62
 
59
63
  const styles = stylex.create({
60
64
  base: {
@@ -194,7 +198,8 @@
194
198
  color: colors.text,
195
199
  backgroundColor: {
196
200
  default: 'transparent',
197
- [HOVER]: { default: null, [media.hover]: colors.fillHover }
201
+ [HOVER]: { default: null, [media.hover]: colors.fillHover },
202
+ [OPEN]: colors.fillSelected
198
203
  },
199
204
  boxShadow: `inset 0 0 0 1px ${colors.borderStrong}`
200
205
  },
@@ -205,21 +210,25 @@
205
210
  [HOVER]: { default: null, [media.hover]: colors.focusHalo }
206
211
  }
207
212
  },
213
+ // Open, it holds the fill of what is chosen while its menu shows, a step past a hover
208
214
  ghost: {
209
215
  color: {
210
216
  default: colors.textMuted,
211
- [HOVER]: { default: null, [media.hover]: colors.text }
217
+ [HOVER]: { default: null, [media.hover]: colors.text },
218
+ [OPEN]: colors.text
212
219
  },
213
220
  backgroundColor: {
214
221
  default: 'transparent',
215
- [HOVER]: { default: null, [media.hover]: colors.fillHover }
222
+ [HOVER]: { default: null, [media.hover]: colors.fillHover },
223
+ [OPEN]: colors.fillSelected
216
224
  }
217
225
  },
218
226
  // No surface in any state: for a control on a shape that already frames it
219
227
  bare: {
220
228
  color: {
221
229
  default: colors.textMuted,
222
- [HOVER]: { default: null, [media.hover]: colors.text }
230
+ [HOVER]: { default: null, [media.hover]: colors.text },
231
+ [OPEN]: colors.text
223
232
  },
224
233
  backgroundColor: 'transparent'
225
234
  },
@@ -243,7 +252,8 @@
243
252
  floating: {
244
253
  color: {
245
254
  default: colors.textMuted,
246
- [HOVER]: { default: null, [media.hover]: colors.text }
255
+ [HOVER]: { default: null, [media.hover]: colors.text },
256
+ [OPEN]: colors.text
247
257
  },
248
258
  backgroundColor: colors.bgRaised,
249
259
  boxShadow: {
@@ -251,7 +261,8 @@
251
261
  [HOVER]: {
252
262
  default: null,
253
263
  [media.hover]: `inset 0 0 0 1px ${colors.borderStrong}, 0 6px 16px -6px ${colors.shadow}`
254
- }
264
+ },
265
+ [OPEN]: `inset 0 0 0 1px ${colors.borderStrong}, 0 6px 16px -6px ${colors.shadow}`
255
266
  }
256
267
  },
257
268
  // What cannot be undone, as a solid: the one press a dialog is asking for