@diegopluna/narvi 0.3.2 → 0.3.4

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 (133) 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 +14 -2
  12. package/dist/components/app-shell/AppShellPanel.svelte +77 -12
  13. package/dist/components/app-shell/AppShellPanel.svelte.d.ts +11 -1
  14. package/dist/components/app-shell/AppShellSheet.svelte +11 -1
  15. package/dist/components/app-shell/context.d.ts +8 -0
  16. package/dist/components/app-shell/context.js +7 -0
  17. package/dist/components/approval/Approval.svelte +14 -1
  18. package/dist/components/approval/Approval.svelte.d.ts +5 -0
  19. package/dist/components/avatar/AvatarRoot.svelte +20 -7
  20. package/dist/components/avatar/AvatarRoot.svelte.d.ts +10 -3
  21. package/dist/components/badge/Badge.svelte +3 -1
  22. package/dist/components/badge/Badge.svelte.d.ts +1 -1
  23. package/dist/components/button/Button.svelte +28 -6
  24. package/dist/components/button/Button.svelte.d.ts +7 -0
  25. package/dist/components/composer/ComposerModelPicker.svelte +80 -13
  26. package/dist/components/composer/ComposerModelPicker.svelte.d.ts +23 -6
  27. package/dist/components/composer/ComposerRoot.svelte +51 -12
  28. package/dist/components/composer/ComposerRoot.svelte.d.ts +16 -0
  29. package/dist/components/composer/ComposerSubmit.svelte +19 -5
  30. package/dist/components/composer/ComposerSubmit.svelte.d.ts +3 -1
  31. package/dist/components/composer/ComposerToggle.svelte +18 -4
  32. package/dist/components/composer/ComposerToggle.svelte.d.ts +2 -0
  33. package/dist/components/composer/ComposerTray.svelte +17 -3
  34. package/dist/components/composer/ComposerTray.svelte.d.ts +5 -0
  35. package/dist/components/composer/context.d.ts +4 -1
  36. package/dist/components/dialog/DialogContent.svelte +22 -12
  37. package/dist/components/dialog/DialogContent.svelte.d.ts +10 -0
  38. package/dist/components/divider/Divider.svelte +56 -14
  39. package/dist/components/divider/Divider.svelte.d.ts +13 -3
  40. package/dist/components/empty-state/EmptyState.svelte +12 -2
  41. package/dist/components/empty-state/EmptyState.svelte.d.ts +6 -0
  42. package/dist/components/heading/Heading.svelte +15 -0
  43. package/dist/components/heading/Heading.svelte.d.ts +6 -0
  44. package/dist/components/hover-card/HoverCardContent.svelte +18 -2
  45. package/dist/components/hover-card/HoverCardContent.svelte.d.ts +8 -0
  46. package/dist/components/input/Input.svelte +13 -3
  47. package/dist/components/input/Input.svelte.d.ts +10 -2
  48. package/dist/components/markdown/Markdown.svelte +22 -2
  49. package/dist/components/markdown/MarkdownDiagram.svelte +33 -2
  50. package/dist/components/markdown/MarkdownFile.svelte +56 -10
  51. package/dist/components/markdown/MarkdownMath.svelte +6 -0
  52. package/dist/components/markdown/MarkdownTable.svelte +3 -4
  53. package/dist/components/markdown/context.d.ts +6 -0
  54. package/dist/components/markdown/labels.d.ts +7 -0
  55. package/dist/components/markdown/labels.js +2 -0
  56. package/dist/components/menu/MenuCheckboxItem.svelte +44 -7
  57. package/dist/components/menu/MenuCheckboxItem.svelte.d.ts +12 -2
  58. package/dist/components/menu/MenuContent.svelte +10 -2
  59. package/dist/components/menu/MenuContent.svelte.d.ts +10 -0
  60. package/dist/components/menu/MenuItem.svelte +17 -2
  61. package/dist/components/menu/MenuItem.svelte.d.ts +8 -0
  62. package/dist/components/menu/MenuSubContent.svelte +10 -2
  63. package/dist/components/menu/MenuSubContent.svelte.d.ts +10 -0
  64. package/dist/components/menu/MenuSubTrigger.svelte +19 -2
  65. package/dist/components/menu/MenuSubTrigger.svelte.d.ts +6 -0
  66. package/dist/components/message/MessageBubble.svelte +40 -0
  67. package/dist/components/message/MessageBubble.svelte.d.ts +12 -0
  68. package/dist/components/message/MessageContent.svelte +23 -14
  69. package/dist/components/message/MessageContent.svelte.d.ts +6 -0
  70. package/dist/components/message/MessageCopy.svelte +27 -15
  71. package/dist/components/message/MessageCopy.svelte.d.ts +9 -2
  72. package/dist/components/message/MessageRoot.svelte +20 -3
  73. package/dist/components/message/MessageRoot.svelte.d.ts +6 -0
  74. package/dist/components/message/context.d.ts +2 -0
  75. package/dist/components/message/index.d.ts +4 -1
  76. package/dist/components/message/index.js +3 -2
  77. package/dist/components/message/styles.d.ts +30 -0
  78. package/dist/components/message/styles.js +24 -0
  79. package/dist/components/notice/Notice.svelte +3 -3
  80. package/dist/components/popover/PopoverContent.svelte +27 -3
  81. package/dist/components/popover/PopoverContent.svelte.d.ts +18 -0
  82. package/dist/components/questionnaire/Questionnaire.svelte +103 -19
  83. package/dist/components/questionnaire/Questionnaire.svelte.d.ts +13 -1
  84. package/dist/components/queued-message/QueuedMessage.svelte +44 -6
  85. package/dist/components/queued-message/QueuedMessage.svelte.d.ts +12 -1
  86. package/dist/components/segmented/SegmentedControl.svelte +12 -1
  87. package/dist/components/segmented/SegmentedControl.svelte.d.ts +3 -1
  88. package/dist/components/select/Select.svelte +43 -6
  89. package/dist/components/select/Select.svelte.d.ts +14 -0
  90. package/dist/components/settings-row/SettingsRow.svelte +87 -37
  91. package/dist/components/settings-row/SettingsRow.svelte.d.ts +13 -0
  92. package/dist/components/split-button/SplitButton.svelte +137 -0
  93. package/dist/components/split-button/SplitButton.svelte.d.ts +29 -0
  94. package/dist/components/tab-strip/TabStrip.svelte +337 -93
  95. package/dist/components/tab-strip/TabStrip.svelte.d.ts +36 -1
  96. package/dist/components/tab-strip/drag.svelte.d.ts +31 -0
  97. package/dist/components/tab-strip/drag.svelte.js +148 -0
  98. package/dist/components/toast/Toaster.svelte +1 -1
  99. package/dist/components/toggle/Toggle.svelte +12 -2
  100. package/dist/components/toggle/Toggle.svelte.d.ts +11 -1
  101. package/dist/components/toggle-group/ToggleGroupItem.svelte +10 -1
  102. package/dist/components/toggle-group/ToggleGroupRoot.svelte +7 -1
  103. package/dist/components/toggle-group/ToggleGroupRoot.svelte.d.ts +3 -1
  104. package/dist/components/toggle-group/context.d.ts +2 -1
  105. package/dist/components/tooltip/TooltipContent.svelte +13 -1
  106. package/dist/components/tooltip/TooltipContent.svelte.d.ts +10 -0
  107. package/dist/components/work-fold/WorkFold.svelte +13 -4
  108. package/dist/components/work-fold/WorkFold.svelte.d.ts +2 -1
  109. package/dist/focus-ring.d.ts +29 -0
  110. package/dist/focus-ring.js +42 -0
  111. package/dist/index.d.ts +8 -5
  112. package/dist/index.js +8 -2
  113. package/dist/internal/Collapse.svelte +15 -2
  114. package/dist/internal/Glyph.svelte +28 -0
  115. package/dist/internal/Glyph.svelte.d.ts +5 -0
  116. package/dist/internal/Tile.svelte +3 -2
  117. package/dist/internal/layer.d.ts +23 -0
  118. package/dist/internal/layer.js +19 -0
  119. package/dist/internal/toggle.d.ts +8 -1
  120. package/dist/internal/toggle.js +20 -2
  121. package/dist/markdown/file-paths.d.ts +7 -0
  122. package/dist/markdown/file-paths.js +29 -0
  123. package/dist/markdown/files.d.ts +22 -2
  124. package/dist/markdown/files.js +45 -14
  125. package/dist/tokens.stylex.d.ts +3 -0
  126. package/dist/tokens.stylex.js +5 -1
  127. package/package.json +1 -1
  128. package/skills/building-ui/SKILL.md +77 -5
  129. package/skills/building-ui/references/components.md +51 -50
  130. package/skills/markdown/SKILL.md +22 -6
  131. package/skills/setup/SKILL.md +1 -1
  132. package/skills/styling/SKILL.md +10 -3
  133. 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
  };
@@ -3,6 +3,7 @@
3
3
  import type { Snippet } from 'svelte';
4
4
  import type { HTMLAttributes } from 'svelte/elements';
5
5
  import { attrs, type Sx } from '../../internal/sx.js';
6
+ import { getAppShellSheetContext } from './context.js';
6
7
 
7
8
  export type AppShellMainProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
8
9
  sx?: Sx | undefined;
@@ -21,17 +22,28 @@
21
22
  minHeight: 0,
22
23
  // Focused from a skip link, it is the page that is reached, not a control
23
24
  outlineStyle: 'none'
24
- }
25
+ },
26
+ // Under a maximized panel: out of sight and out of reach, but still laid out, so its
27
+ // scroll and what is typed in it are as they were when the panel is restored
28
+ covered: { visibility: 'hidden' }
25
29
  });
26
30
  </script>
27
31
 
28
32
  <script lang="ts">
29
33
  let { sx, class: className, children, ...rest }: AppShellMainProps = $props();
34
+
35
+ const sheet = getAppShellSheetContext();
36
+ const covered = $derived(sheet?.covered ?? false);
30
37
  </script>
31
38
 
32
39
  <!-- Not focusable by default: with `tabindex="-1"` a click on plain text in the page would move
33
40
  focus to the whole of it, away from a panel that keeps its own, such as a find bar. Pass a
34
41
  `tabindex` to make it the target of a skip link. -->
35
- <main data-slot="app-shell-main" {...rest} {...attrs([styles.main, sx], className)}>
42
+ <main
43
+ data-slot="app-shell-main"
44
+ inert={covered || undefined}
45
+ {...rest}
46
+ {...attrs([styles.main, covered && styles.covered, sx], className)}
47
+ >
36
48
  {@render children?.()}
37
49
  </main>
@@ -1,6 +1,10 @@
1
1
  <!--
2
2
  The last column of the sheet, beside the page: what the page is about, such as
3
3
  the files a thread changed. Its start edge drags to resize it.
4
+
5
+ Where its row has no room for it beside the page (the row's width less the
6
+ sidebar's, not the window's), it takes the page's place under the page's
7
+ header. Maximized, it takes the page's place whole, header and all.
4
8
  -->
5
9
  <script lang="ts" module>
6
10
  import * as stylex from '@stylexjs/stylex';
@@ -9,7 +13,7 @@
9
13
  import { attrs, type Sx } from '../../internal/sx.js';
10
14
  import { colors } from '../../tokens.stylex.js';
11
15
  import ResizeHandle from '../resize-handle/ResizeHandle.svelte';
12
- import { useAppShell } from './context.js';
16
+ import { getAppShellSheetContext, useAppShell } from './context.js';
13
17
 
14
18
  export type AppShellPanelProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
15
19
  /** Names the region: "Changes", "Files". */
@@ -18,8 +22,18 @@
18
22
  width?: number | undefined;
19
23
  minWidth?: number | undefined;
20
24
  defaultWidth?: number | undefined;
21
- /** How much room it always leaves the main area, in pixels. */
25
+ /**
26
+ * How much room it always leaves the main area, in pixels. Where the row has less than
27
+ * this and `minWidth` together, the panel takes the page's place under its header.
28
+ */
22
29
  mainMinWidth?: number | undefined;
30
+ /**
31
+ * Fills the row in the page's place, over its header too, with no handle. The page
32
+ * stays as it was underneath, out of sight and out of reach, until it is restored. Give
33
+ * the panel a header of its own: with `AppShell.Toggle when="closed"` in it, the sidebar
34
+ * stays in reach.
35
+ */
36
+ maximized?: boolean | undefined;
23
37
  sx?: Sx | undefined;
24
38
  children?: Snippet | undefined;
25
39
  };
@@ -38,20 +52,27 @@
38
52
  borderInlineStartWidth: '1px',
39
53
  borderInlineStartStyle: 'solid',
40
54
  borderInlineStartColor: colors.border,
41
- // The traffic lights are never over a panel, so a header inside one keeps no room for them
55
+ // The traffic lights are never over a panel beside the page, so a header inside one
56
+ // keeps no room for them
42
57
  '--narvi-inset-page': '0px'
43
58
  },
44
- // On a narrow window the panel takes the place of the page, under its
45
- // header, which stays in reach with the sidebar's toggle
46
- narrow: {
59
+ // In the page's place: from the sidebar's end (none on a narrow window, where the
60
+ // sidebar is a drawer) to the sheet's
61
+ over: {
47
62
  position: 'absolute',
48
- inset: 0,
49
- top: '3rem',
63
+ insetBlockEnd: 0,
64
+ insetInlineStart: 'var(--narvi-panel-start, 0px)',
65
+ insetInlineEnd: 0,
50
66
  zIndex: 5,
51
67
  width: 'auto',
52
68
  borderInlineStartWidth: 0,
53
69
  backgroundColor: colors.bgRaised
54
70
  },
71
+ // Under the page's header, which stays in reach with the sidebar's toggle
72
+ narrow: { insetBlockStart: '3rem' },
73
+ // Over all of the page. Where the page's header kept room for the traffic lights, the
74
+ // panel's own header keeps it now.
75
+ maximized: { insetBlockStart: 0, '--narvi-inset-page': 'inherit' },
55
76
  handle: { position: 'relative', alignSelf: 'stretch' }
56
77
  });
57
78
  </script>
@@ -63,6 +84,7 @@
63
84
  minWidth = 320,
64
85
  defaultWidth = 560,
65
86
  mainMinWidth = 352,
87
+ maximized = false,
66
88
  sx,
67
89
  class: className,
68
90
  children,
@@ -70,21 +92,58 @@
70
92
  }: AppShellPanelProps = $props();
71
93
 
72
94
  const shell = useAppShell('Panel');
95
+ const sheetContext = getAppShellSheetContext();
73
96
  let element = $state<HTMLElement | null>(null);
97
+ // The room the row gives the page and the panel together, and where that room starts
98
+ let row = $state(Infinity);
99
+ let start = $state(0);
100
+
101
+ const sidebarOf = (sheet: Element | null | undefined) =>
102
+ sheet?.querySelector<HTMLElement>(':scope > [data-slot="app-shell-sidebar"]') ?? null;
103
+
104
+ // The row is measured, not the window: a sheet among several panes is narrower than it
105
+ $effect(() => {
106
+ const sheet = element?.parentElement;
107
+ if (!sheet) return;
108
+ const measure = () => {
109
+ const sidebar = sidebarOf(sheet);
110
+ // A drawer is over the page, not beside it
111
+ const beside = shell.narrow ? 0 : (sidebar?.offsetWidth ?? 0);
112
+ row = sheet.clientWidth - beside;
113
+ start = beside;
114
+ };
115
+ measure();
116
+ const observer = new ResizeObserver(measure);
117
+ observer.observe(sheet);
118
+ const sidebar = sidebarOf(sheet);
119
+ if (sidebar) observer.observe(sidebar);
120
+ return () => observer.disconnect();
121
+ });
122
+
123
+ const narrow = $derived(shell.narrow || row < minWidth + Math.max(mainMinWidth, 0));
124
+ const over = $derived(maximized || narrow);
125
+
126
+ // The page steps out of view under a maximized panel
127
+ $effect(() => {
128
+ if (!sheetContext || !maximized) return;
129
+ sheetContext.setCovered(true);
130
+ return () => sheetContext.setCovered(false);
131
+ });
74
132
 
75
133
  // It never takes so much that the main area falls below its minimum
76
134
  const largest = () => {
77
135
  // On the server there is no window to measure: no limit yet
78
136
  if (typeof window === 'undefined') return Infinity;
79
137
  const sheet = element?.parentElement;
80
- const sidebar = sheet?.querySelector<HTMLElement>(':scope > [data-slot="app-shell-sidebar"]');
81
138
  return (
82
- (sheet?.clientWidth ?? innerWidth) - (sidebar?.offsetWidth ?? 0) - Math.max(mainMinWidth, 0)
139
+ (sheet?.clientWidth ?? innerWidth) -
140
+ (sidebarOf(sheet)?.offsetWidth ?? 0) -
141
+ Math.max(mainMinWidth, 0)
83
142
  );
84
143
  };
85
144
  </script>
86
145
 
87
- {#if !shell.narrow}
146
+ {#if !over}
88
147
  <ResizeHandle
89
148
  bind:value={width}
90
149
  min={minWidth}
@@ -101,9 +160,15 @@
101
160
  bind:this={element}
102
161
  aria-label={label}
103
162
  data-slot="app-shell-panel"
163
+ data-maximized={maximized || undefined}
164
+ data-narrow={(narrow && !maximized) || undefined}
104
165
  style:--narvi-panel-width="{width}px"
166
+ style:--narvi-panel-start="{start}px"
105
167
  {...rest}
106
- {...attrs([styles.panel, shell.narrow && styles.narrow, sx], className)}
168
+ {...attrs(
169
+ [styles.panel, over && styles.over, maximized ? styles.maximized : narrow && styles.narrow, sx],
170
+ className
171
+ )}
107
172
  >
108
173
  {@render children?.()}
109
174
  </aside>
@@ -8,8 +8,18 @@ export type AppShellPanelProps = Omit<HTMLAttributes<HTMLElement>, 'children'> &
8
8
  width?: number | undefined;
9
9
  minWidth?: number | undefined;
10
10
  defaultWidth?: number | undefined;
11
- /** How much room it always leaves the main area, in pixels. */
11
+ /**
12
+ * How much room it always leaves the main area, in pixels. Where the row has less than
13
+ * this and `minWidth` together, the panel takes the page's place under its header.
14
+ */
12
15
  mainMinWidth?: number | undefined;
16
+ /**
17
+ * Fills the row in the page's place, over its header too, with no handle. The page
18
+ * stays as it was underneath, out of sight and out of reach, until it is restored. Give
19
+ * the panel a header of its own: with `AppShell.Toggle when="closed"` in it, the sidebar
20
+ * stays in reach.
21
+ */
22
+ maximized?: boolean | undefined;
13
23
  sx?: Sx | undefined;
14
24
  children?: Snippet | undefined;
15
25
  };
@@ -12,7 +12,7 @@
12
12
  import { shared } from '../../internal/shared.js';
13
13
  import { attrs, type Sx } from '../../internal/sx.js';
14
14
  import { colors, radius } from '../../tokens.stylex.js';
15
- import { useAppShell } from './context.js';
15
+ import { setAppShellSheetContext, useAppShell } from './context.js';
16
16
 
17
17
  export type AppShellSheetProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
18
18
  /**
@@ -73,6 +73,16 @@
73
73
  }: AppShellSheetProps = $props();
74
74
 
75
75
  const shell = useAppShell('Sheet');
76
+
77
+ let covered = $state(false);
78
+ setAppShellSheetContext({
79
+ get covered() {
80
+ return covered;
81
+ },
82
+ setCovered(next) {
83
+ covered = next;
84
+ }
85
+ });
76
86
  </script>
77
87
 
78
88
  <div