@diegopluna/narvi 0.1.0 → 0.2.0

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 (259) hide show
  1. package/README.md +102 -41
  2. package/dist/base.css +2 -2
  3. package/dist/color.d.ts +1 -1
  4. package/dist/color.js +1 -1
  5. package/dist/components/activity/ActivityContent.svelte +3 -15
  6. package/dist/components/activity/ActivityStep.svelte +12 -12
  7. package/dist/components/activity/ActivityThought.svelte +4 -4
  8. package/dist/components/activity/ActivityTrigger.svelte +3 -3
  9. package/dist/components/app-shell/AppShellBar.svelte +89 -0
  10. package/dist/components/app-shell/AppShellBar.svelte.d.ts +20 -0
  11. package/dist/components/app-shell/AppShellHeader.svelte +17 -16
  12. package/dist/components/app-shell/AppShellHeader.svelte.d.ts +2 -2
  13. package/dist/components/app-shell/AppShellMain.svelte +4 -20
  14. package/dist/components/app-shell/AppShellPanel.svelte +21 -19
  15. package/dist/components/app-shell/AppShellPanes.svelte +58 -0
  16. package/dist/components/app-shell/AppShellPanes.svelte.d.ts +11 -0
  17. package/dist/components/app-shell/AppShellRail.svelte +85 -0
  18. package/dist/components/app-shell/AppShellRail.svelte.d.ts +11 -0
  19. package/dist/components/app-shell/AppShellRoot.svelte +50 -24
  20. package/dist/components/app-shell/AppShellRoot.svelte.d.ts +8 -6
  21. package/dist/components/app-shell/AppShellSheet.svelte +95 -0
  22. package/dist/components/app-shell/AppShellSheet.svelte.d.ts +17 -0
  23. package/dist/components/app-shell/AppShellSidebar.svelte +37 -61
  24. package/dist/components/app-shell/AppShellSidebar.svelte.d.ts +1 -5
  25. package/dist/components/app-shell/AppShellToggle.svelte +62 -23
  26. package/dist/components/app-shell/AppShellToggle.svelte.d.ts +2 -0
  27. package/dist/components/app-shell/context.d.ts +6 -0
  28. package/dist/components/app-shell/index.d.ts +9 -1
  29. package/dist/components/app-shell/index.js +5 -1
  30. package/dist/components/approval/Approval.svelte +91 -19
  31. package/dist/components/approval/Approval.svelte.d.ts +7 -0
  32. package/dist/components/avatar/AvatarFallback.svelte +1 -2
  33. package/dist/components/avatar/AvatarRoot.svelte +2 -2
  34. package/dist/components/badge/Badge.svelte +5 -5
  35. package/dist/components/button/Button.svelte +219 -40
  36. package/dist/components/button/Button.svelte.d.ts +38 -2
  37. package/dist/components/card/Card.svelte +15 -26
  38. package/dist/components/change-stats/ChangeStats.svelte +1 -2
  39. package/dist/components/changes-summary/ChangesSummary.svelte +14 -15
  40. package/dist/components/checkbox/Checkbox.svelte +18 -15
  41. package/dist/components/checkbox/Checkbox.svelte.d.ts +5 -0
  42. package/dist/components/code/Code.svelte +1 -2
  43. package/dist/components/collapsible/CollapsibleTrigger.svelte +2 -2
  44. package/dist/components/command/CommandItem.svelte +1 -1
  45. package/dist/components/command/styles.d.ts +3 -2
  46. package/dist/components/command/styles.js +13 -10
  47. package/dist/components/composer/ComposerAttachButton.svelte +1 -1
  48. package/dist/components/composer/ComposerAttachment.svelte +9 -12
  49. package/dist/components/composer/ComposerModelPicker.svelte +18 -20
  50. package/dist/components/composer/ComposerRoot.svelte +8 -7
  51. package/dist/components/composer/ComposerSubmit.svelte +8 -15
  52. package/dist/components/composer/ComposerTextarea.svelte +1 -1
  53. package/dist/components/composer/ComposerToggle.svelte +9 -11
  54. package/dist/components/composer/ComposerTray.svelte +78 -0
  55. package/dist/components/composer/ComposerTray.svelte.d.ts +15 -0
  56. package/dist/components/composer/index.d.ts +3 -1
  57. package/dist/components/composer/index.js +3 -2
  58. package/dist/components/conversation/ConversationContent.svelte +3 -2
  59. package/dist/components/conversation/ConversationEmpty.svelte +1 -1
  60. package/dist/components/conversation/ConversationScrollButton.svelte +3 -3
  61. package/dist/components/dialog/ConfirmDialog.svelte +1 -1
  62. package/dist/components/dialog/styles.d.ts +2 -3
  63. package/dist/components/dialog/styles.js +5 -6
  64. package/dist/components/divider/Divider.svelte +3 -3
  65. package/dist/components/empty-state/EmptyState.svelte +4 -5
  66. package/dist/components/field/Field.svelte +4 -4
  67. package/dist/components/frame/Frame.svelte +6 -7
  68. package/dist/components/frame/Frame.svelte.d.ts +1 -1
  69. package/dist/components/heading/Heading.svelte +2 -2
  70. package/dist/components/kbd/Kbd.svelte +12 -7
  71. package/dist/components/link/Link.svelte +7 -3
  72. package/dist/components/link/Link.svelte.d.ts +4 -1
  73. package/dist/components/markdown/Markdown.svelte +714 -0
  74. package/dist/components/markdown/Markdown.svelte.d.ts +80 -0
  75. package/dist/components/markdown/MarkdownBlock.svelte +231 -0
  76. package/dist/components/markdown/MarkdownBlock.svelte.d.ts +11 -0
  77. package/dist/components/markdown/MarkdownBlocks.svelte +115 -0
  78. package/dist/components/markdown/MarkdownBlocks.svelte.d.ts +15 -0
  79. package/dist/components/markdown/MarkdownCode.svelte +583 -0
  80. package/dist/components/markdown/MarkdownCode.svelte.d.ts +23 -0
  81. package/dist/components/markdown/MarkdownDiagram.svelte +310 -0
  82. package/dist/components/markdown/MarkdownDiagram.svelte.d.ts +6 -0
  83. package/dist/components/markdown/MarkdownFile.svelte +134 -0
  84. package/dist/components/markdown/MarkdownFile.svelte.d.ts +19 -0
  85. package/dist/components/markdown/MarkdownFootnotes.svelte +61 -0
  86. package/dist/components/markdown/MarkdownFootnotes.svelte.d.ts +8 -0
  87. package/dist/components/markdown/MarkdownFresh.svelte +69 -0
  88. package/dist/components/markdown/MarkdownFresh.svelte.d.ts +6 -0
  89. package/dist/components/markdown/MarkdownHtml.svelte +72 -0
  90. package/dist/components/markdown/MarkdownHtml.svelte.d.ts +7 -0
  91. package/dist/components/markdown/MarkdownImage.svelte +150 -0
  92. package/dist/components/markdown/MarkdownImage.svelte.d.ts +8 -0
  93. package/dist/components/markdown/MarkdownInlines.svelte +225 -0
  94. package/dist/components/markdown/MarkdownInlines.svelte.d.ts +7 -0
  95. package/dist/components/markdown/MarkdownLink.svelte +120 -0
  96. package/dist/components/markdown/MarkdownLink.svelte.d.ts +25 -0
  97. package/dist/components/markdown/MarkdownMath.svelte +138 -0
  98. package/dist/components/markdown/MarkdownMath.svelte.d.ts +7 -0
  99. package/dist/components/markdown/MarkdownTable.svelte +265 -0
  100. package/dist/components/markdown/MarkdownTable.svelte.d.ts +17 -0
  101. package/dist/components/markdown/caret.d.ts +14 -0
  102. package/dist/components/markdown/caret.js +67 -0
  103. package/dist/components/markdown/context.d.ts +93 -0
  104. package/dist/components/markdown/context.js +128 -0
  105. package/dist/components/markdown/copy.d.ts +13 -0
  106. package/dist/components/markdown/copy.js +74 -0
  107. package/dist/components/markdown/hidden.d.ts +12 -0
  108. package/dist/components/markdown/hidden.js +31 -0
  109. package/dist/components/markdown/kept.d.ts +32 -0
  110. package/dist/components/markdown/kept.js +71 -0
  111. package/dist/components/markdown/labels.d.ts +46 -0
  112. package/dist/components/markdown/labels.js +35 -0
  113. package/dist/components/markdown/save.d.ts +11 -0
  114. package/dist/components/markdown/save.js +58 -0
  115. package/dist/components/markdown/scrollable.d.ts +24 -0
  116. package/dist/components/markdown/scrollable.js +152 -0
  117. package/dist/components/markdown/static.d.ts +37 -0
  118. package/dist/components/markdown/static.js +233 -0
  119. package/dist/components/markdown/styles.d.ts +328 -0
  120. package/dist/components/markdown/styles.js +302 -0
  121. package/dist/components/menu/MenuRadioItem.svelte +3 -3
  122. package/dist/components/menu/index.d.ts +23 -0
  123. package/dist/components/menu/index.js +3 -1
  124. package/dist/components/message/MessageAction.svelte +22 -2
  125. package/dist/components/message/MessageAction.svelte.d.ts +9 -0
  126. package/dist/components/message/MessageContent.svelte +2 -3
  127. package/dist/components/message/MessageCopy.svelte +62 -3
  128. package/dist/components/message/MessageCopy.svelte.d.ts +17 -1
  129. package/dist/components/message/MessageHeader.svelte +3 -3
  130. package/dist/components/message/MessagePending.svelte +1 -1
  131. package/dist/components/message/MessageTime.svelte +1 -1
  132. package/dist/components/notice/Notice.svelte +14 -10
  133. package/dist/components/plan/Plan.svelte +22 -17
  134. package/dist/components/progress/Progress.svelte +31 -33
  135. package/dist/components/questionnaire/Questionnaire.svelte +19 -22
  136. package/dist/components/queued-message/QueuedMessage.svelte +14 -7
  137. package/dist/components/rail/RailItem.svelte +37 -34
  138. package/dist/components/rail/RailItem.svelte.d.ts +3 -1
  139. package/dist/components/rail/RailRoot.svelte +18 -4
  140. package/dist/components/rail/RailRoot.svelte.d.ts +1 -1
  141. package/dist/components/rail/RailSeparator.svelte +17 -0
  142. package/dist/components/rail/RailSeparator.svelte.d.ts +18 -0
  143. package/dist/components/rail/index.d.ts +2 -1
  144. package/dist/components/rail/index.js +2 -1
  145. package/dist/components/reasoning/ReasoningContent.svelte +4 -8
  146. package/dist/components/reasoning/ReasoningTrigger.svelte +2 -2
  147. package/dist/components/resize-handle/ResizeHandle.svelte +2 -3
  148. package/dist/components/segmented/SegmentedControl.svelte +7 -8
  149. package/dist/components/select/Select.svelte +1 -1
  150. package/dist/components/separator/Separator.svelte +1 -1
  151. package/dist/components/settings-row/SettingsRow.svelte +5 -5
  152. package/dist/components/shimmer/Shimmer.svelte +34 -21
  153. package/dist/components/sidebar/SidebarContent.svelte +1 -1
  154. package/dist/components/sidebar/SidebarFolder.svelte +142 -0
  155. package/dist/components/sidebar/SidebarFolder.svelte.d.ts +19 -0
  156. package/dist/components/sidebar/SidebarFooter.svelte +1 -1
  157. package/dist/components/sidebar/SidebarGroup.svelte +36 -32
  158. package/dist/components/sidebar/SidebarGroup.svelte.d.ts +3 -3
  159. package/dist/components/sidebar/SidebarHeader.svelte +12 -6
  160. package/dist/components/sidebar/SidebarHeader.svelte.d.ts +4 -1
  161. package/dist/components/sidebar/SidebarItem.svelte +26 -32
  162. package/dist/components/sidebar/SidebarRoot.svelte +62 -0
  163. package/dist/components/sidebar/SidebarRoot.svelte.d.ts +14 -0
  164. package/dist/components/sidebar/index.d.ts +5 -1
  165. package/dist/components/sidebar/index.js +3 -1
  166. package/dist/components/skeleton/Skeleton.svelte +26 -15
  167. package/dist/components/slider/Slider.svelte +11 -10
  168. package/dist/components/spinner/Spinner.svelte +4 -11
  169. package/dist/components/status-indicator/StatusIndicator.svelte +1 -1
  170. package/dist/components/suggestions/SuggestionsItem.svelte +5 -5
  171. package/dist/components/switch/Switch.svelte +9 -14
  172. package/dist/components/tab-strip/TabStrip.svelte +340 -0
  173. package/dist/components/tab-strip/TabStrip.svelte.d.ts +31 -0
  174. package/dist/components/tabs/Tabs.svelte +13 -9
  175. package/dist/components/tabs/Tabs.svelte.d.ts +4 -0
  176. package/dist/components/text/Text.svelte +31 -23
  177. package/dist/components/text/Text.svelte.d.ts +8 -4
  178. package/dist/components/toast/Toaster.svelte +5 -5
  179. package/dist/components/tool/ToolContent.svelte +3 -8
  180. package/dist/components/tool/ToolSection.svelte +4 -5
  181. package/dist/components/tool/ToolTrigger.svelte +10 -9
  182. package/dist/components/tooltip/TooltipContent.svelte +3 -3
  183. package/dist/components/work-fold/WorkFold.svelte +5 -9
  184. package/dist/index.d.ts +16 -8
  185. package/dist/index.js +17 -10
  186. package/dist/internal/Code.svelte +3 -4
  187. package/dist/internal/Glyph.svelte +16 -0
  188. package/dist/internal/Glyph.svelte.d.ts +6 -0
  189. package/dist/internal/Tile.svelte +17 -37
  190. package/dist/internal/control.d.ts +4 -4
  191. package/dist/internal/control.js +20 -17
  192. package/dist/internal/layer.d.ts +3 -5
  193. package/dist/internal/layer.js +10 -12
  194. package/dist/internal/markers.stylex.d.ts +8 -0
  195. package/dist/internal/markers.stylex.js +4 -0
  196. package/dist/internal/plugin-order.d.ts +8 -0
  197. package/dist/internal/plugin-order.js +16 -0
  198. package/dist/internal/roving.js +5 -2
  199. package/dist/internal/shared.d.ts +8 -1
  200. package/dist/internal/shared.js +21 -5
  201. package/dist/internal/sx.d.ts +1 -1
  202. package/dist/internal/toggle.d.ts +1 -2
  203. package/dist/internal/toggle.js +8 -12
  204. package/dist/internal/visible.d.ts +32 -0
  205. package/dist/internal/visible.js +44 -0
  206. package/dist/markdown/ast.d.ts +209 -0
  207. package/dist/markdown/ast.js +10 -0
  208. package/dist/markdown/blocks.d.ts +177 -0
  209. package/dist/markdown/blocks.js +1489 -0
  210. package/dist/markdown/code-info.d.ts +10 -0
  211. package/dist/markdown/code-info.js +16 -0
  212. package/dist/markdown/common.d.ts +25 -0
  213. package/dist/markdown/common.js +107 -0
  214. package/dist/markdown/diagrams.d.ts +2 -0
  215. package/dist/markdown/diagrams.js +18 -0
  216. package/dist/markdown/file-paths.d.ts +29 -0
  217. package/dist/markdown/file-paths.js +80 -0
  218. package/dist/markdown/files.d.ts +16 -0
  219. package/dist/markdown/files.js +133 -0
  220. package/dist/markdown/highlight.d.ts +30 -0
  221. package/dist/markdown/highlight.js +127 -0
  222. package/dist/markdown/html.d.ts +23 -0
  223. package/dist/markdown/html.js +289 -0
  224. package/dist/markdown/images.d.ts +15 -0
  225. package/dist/markdown/images.js +45 -0
  226. package/dist/markdown/index.d.ts +12 -0
  227. package/dist/markdown/index.js +5 -0
  228. package/dist/markdown/inlines.d.ts +48 -0
  229. package/dist/markdown/inlines.js +1714 -0
  230. package/dist/markdown/math.d.ts +2 -0
  231. package/dist/markdown/math.js +22 -0
  232. package/dist/markdown/parse.d.ts +81 -0
  233. package/dist/markdown/parse.js +204 -0
  234. package/dist/markdown/plugin.d.ts +178 -0
  235. package/dist/markdown/plugin.js +160 -0
  236. package/dist/markdown/sanitize.d.ts +78 -0
  237. package/dist/markdown/sanitize.js +522 -0
  238. package/dist/markdown/share.d.ts +12 -0
  239. package/dist/markdown/share.js +59 -0
  240. package/dist/markdown/table.d.ts +13 -0
  241. package/dist/markdown/table.js +60 -0
  242. package/dist/preset.d.ts +40 -16
  243. package/dist/preset.js +169 -51
  244. package/dist/tokens.stylex.d.ts +55 -37
  245. package/dist/tokens.stylex.js +107 -62
  246. package/dist/typography.d.ts +48 -0
  247. package/dist/typography.js +55 -0
  248. package/dist/vite.d.ts +7 -1
  249. package/dist/vite.js +27 -2
  250. package/package.json +53 -6
  251. package/skills/building-ui/SKILL.md +242 -0
  252. package/skills/building-ui/references/components.md +207 -0
  253. package/skills/markdown/SKILL.md +452 -0
  254. package/skills/markdown/references/plugins.md +103 -0
  255. package/skills/setup/SKILL.md +191 -0
  256. package/skills/styling/SKILL.md +269 -0
  257. package/skills/theming/SKILL.md +184 -0
  258. package/dist/internal/loop.d.ts +0 -35
  259. package/dist/internal/loop.js +0 -72
@@ -0,0 +1,23 @@
1
+ import { DropdownMenu } from 'bits-ui';
2
+ import CheckboxItem from './MenuCheckboxItem.svelte';
3
+ import Content from './MenuContent.svelte';
4
+ import Item from './MenuItem.svelte';
5
+ import Label from './MenuLabel.svelte';
6
+ import RadioItem from './MenuRadioItem.svelte';
7
+ import Separator from './MenuSeparator.svelte';
8
+ import SubContent from './MenuSubContent.svelte';
9
+ import SubTrigger from './MenuSubTrigger.svelte';
10
+ declare const Root: typeof DropdownMenu.Root;
11
+ declare const Trigger: typeof DropdownMenu.Trigger;
12
+ declare const Group: typeof DropdownMenu.Group;
13
+ declare const RadioGroup: typeof DropdownMenu.RadioGroup;
14
+ declare const Sub: typeof DropdownMenu.Sub;
15
+ export { Root, Trigger, Content, Item, CheckboxItem, RadioGroup, RadioItem, Group, Label, Separator, Sub, SubTrigger, SubContent };
16
+ export type { MenuCheckboxItemProps } from './MenuCheckboxItem.svelte';
17
+ export type { MenuContentProps } from './MenuContent.svelte';
18
+ export type { MenuItemProps } from './MenuItem.svelte';
19
+ export type { MenuLabelProps } from './MenuLabel.svelte';
20
+ export type { MenuRadioItemProps } from './MenuRadioItem.svelte';
21
+ export type { MenuSeparatorProps } from './MenuSeparator.svelte';
22
+ export type { MenuSubContentProps } from './MenuSubContent.svelte';
23
+ export type { MenuSubTriggerProps } from './MenuSubTrigger.svelte';
@@ -7,7 +7,9 @@ import RadioItem from './MenuRadioItem.svelte';
7
7
  import Separator from './MenuSeparator.svelte';
8
8
  import SubContent from './MenuSubContent.svelte';
9
9
  import SubTrigger from './MenuSubTrigger.svelte';
10
- // Behaviour only, with nothing to style: bits-ui's own parts
10
+ // Behaviour only, with nothing to style: bits-ui's own parts. The annotations are needed:
11
+ // without them TypeScript cannot name Root's inferred type (TS2883), and svelte-package
12
+ // silently leaves this module's declarations out of the package.
11
13
  const Root = DropdownMenu.Root;
12
14
  const Trigger = DropdownMenu.Trigger;
13
15
  const Group = DropdownMenu.Group;
@@ -4,7 +4,7 @@
4
4
  import type { Sx } from '../../internal/sx.js';
5
5
  import { colors } from '../../tokens.stylex.js';
6
6
  import { media } from '../../media.stylex.js';
7
- import Button, { type ButtonProps } from '../button/Button.svelte';
7
+ import Button, { buttonHtml, type ButtonProps } from '../button/Button.svelte';
8
8
 
9
9
  export type MessageActionProps = Omit<
10
10
  ButtonProps,
@@ -30,9 +30,29 @@
30
30
  },
31
31
  pressed: {
32
32
  color: colors.text,
33
- backgroundColor: colors.hover
33
+ backgroundColor: colors.fillSelected
34
34
  }
35
35
  });
36
+
37
+ /** An action as markup, as the component draws it. `label` and `attributes` are escaped already. */
38
+ export function actionHtml(options: {
39
+ label: string;
40
+ attributes?: string;
41
+ sx?: Sx;
42
+ inner: string;
43
+ /** As `buttonHtml` takes it: the button and its icon, with nothing between. */
44
+ bare?: boolean;
45
+ }): string {
46
+ return buttonHtml({
47
+ bare: options.bare,
48
+ variant: 'ghost',
49
+ size: 'sm',
50
+ iconOnly: true,
51
+ sx: [styles.action, options.sx],
52
+ attributes: ` aria-label="${options.label}" data-slot="message-action"${options.attributes ?? ''}`,
53
+ inner: options.inner
54
+ });
55
+ }
36
56
  </script>
37
57
 
38
58
  <script lang="ts">
@@ -11,6 +11,15 @@ export type MessageActionProps = Omit<ButtonProps, 'children' | 'variant' | 'siz
11
11
  /** A 16px icon. */
12
12
  children?: Snippet;
13
13
  };
14
+ /** An action as markup, as the component draws it. `label` and `attributes` are escaped already. */
15
+ export declare function actionHtml(options: {
16
+ label: string;
17
+ attributes?: string;
18
+ sx?: Sx;
19
+ inner: string;
20
+ /** As `buttonHtml` takes it: the button and its icon, with nothing between. */
21
+ bare?: boolean;
22
+ }): string;
14
23
  declare const MessageAction: import("svelte").Component<MessageActionProps, {}, "ref">;
15
24
  type MessageAction = ReturnType<typeof MessageAction>;
16
25
  export default MessageAction;
@@ -22,7 +22,7 @@
22
22
  gap: '0.75rem',
23
23
  minWidth: 0,
24
24
  // A size for reading at length: a step up from interface text
25
- fontSize: font.sizeLg,
25
+ fontSize: font.sizeReading,
26
26
  lineHeight: font.leadingNormal,
27
27
  overflowWrap: 'break-word'
28
28
  },
@@ -32,8 +32,7 @@
32
32
  paddingBlock: '0.5625rem',
33
33
  paddingInline: '0.875rem',
34
34
  borderRadius: radius.frame,
35
- backgroundColor: colors.surfaceRaised,
36
- boxShadow: `inset 0 0 0 1px ${colors.line}, 0 1px 2px ${colors.shade}`,
35
+ backgroundColor: colors.fillMuted,
37
36
  whiteSpace: 'pre-wrap',
38
37
  overflowWrap: 'anywhere'
39
38
  },
@@ -1,10 +1,10 @@
1
1
  <script lang="ts" module>
2
2
  import * as stylex from '@stylexjs/stylex';
3
- import Glyph from '../../internal/Glyph.svelte';
4
- import type { Sx } from '../../internal/sx.js';
3
+ import Glyph, { glyphHtml } from '../../internal/Glyph.svelte';
4
+ import { classes, type Sx } from '../../internal/sx.js';
5
5
  import { colors, motion } from '../../tokens.stylex.js';
6
6
  import { media } from '../../media.stylex.js';
7
- import MessageAction, { type MessageActionProps } from './MessageAction.svelte';
7
+ import MessageAction, { actionHtml, type MessageActionProps } from './MessageAction.svelte';
8
8
 
9
9
  export type MessageCopyProps = Omit<
10
10
  MessageActionProps,
@@ -50,6 +50,65 @@
50
50
  whiteSpace: 'nowrap'
51
51
  }
52
52
  });
53
+
54
+ const arrive = stylex.keyframes({
55
+ from: { opacity: 0, scale: 0.6, filter: 'blur(2px)' },
56
+ to: { opacity: 1, scale: 1, filter: 'blur(0)' }
57
+ });
58
+ const lean = stylex.create({
59
+ // An icon that has just taken another's place: it arrives as the component's does
60
+ arrived: {
61
+ animationName: { default: null, [media.motion]: arrive },
62
+ animationDuration: motion.base,
63
+ animationTimingFunction: motion.easeOut
64
+ },
65
+ check: { color: colors.text }
66
+ });
67
+ const arrivedClass = classes(lean.arrived);
68
+ const arrivedCheckClass = classes(lean.arrived, lean.check);
69
+ const statusClass = classes(styles.status);
70
+
71
+ /**
72
+ * A copy button as markup, with the status that says "Copied" after it: a button and its
73
+ * icon, and nothing else. The tick is not there until something is copied (`showCopied`):
74
+ * a page of code blocks has a copy button for each, and nearly none of them is pressed.
75
+ * `label` and `attributes` are escaped already.
76
+ */
77
+ export function copyHtml(options: { label: string; attributes?: string; sx?: Sx }): string {
78
+ return (
79
+ actionHtml({ ...options, bare: true, inner: glyphHtml('copy') }) +
80
+ `<span role="status" class="${statusClass}"></span>`
81
+ );
82
+ }
83
+
84
+ const putBack = new WeakMap<Element, ReturnType<typeof setTimeout>>();
85
+
86
+ /**
87
+ * Shows a copy button written by `copyHtml` as having copied, and puts it back two seconds
88
+ * later: the icon turns into a tick, and the status after it says so.
89
+ */
90
+ export function showCopied(button: Element, copiedLabel: string): void {
91
+ const set = (copied: boolean) => {
92
+ button.querySelector(':scope > svg')?.remove();
93
+ button.insertAdjacentHTML(
94
+ 'afterbegin',
95
+ copied ? glyphHtml('check', 16, 1.75) : glyphHtml('copy')
96
+ );
97
+ button.firstElementChild?.setAttribute('class', copied ? arrivedCheckClass : arrivedClass);
98
+ if (copied) button.setAttribute('data-copied', 'true');
99
+ else button.removeAttribute('data-copied');
100
+ const status = button.nextElementSibling;
101
+ if (status?.getAttribute('role') === 'status') status.textContent = copied ? copiedLabel : '';
102
+ };
103
+ clearTimeout(putBack.get(button));
104
+ set(true);
105
+ putBack.set(
106
+ button,
107
+ setTimeout(() => {
108
+ if (button.isConnected) set(false);
109
+ }, 2000)
110
+ );
111
+ }
53
112
  </script>
54
113
 
55
114
  <script lang="ts">
@@ -1,4 +1,4 @@
1
- import type { Sx } from '../../internal/sx.js';
1
+ import { type Sx } from '../../internal/sx.js';
2
2
  import { type MessageActionProps } from './MessageAction.svelte';
3
3
  export type MessageCopyProps = Omit<MessageActionProps, 'children' | 'value' | 'label' | 'onclick'> & {
4
4
  onclick?: (event: MouseEvent) => void;
@@ -11,6 +11,22 @@ export type MessageCopyProps = Omit<MessageActionProps, 'children' | 'value' | '
11
11
  oncopy?: (text: string) => void;
12
12
  sx?: Sx;
13
13
  };
14
+ /**
15
+ * A copy button as markup, with the status that says "Copied" after it: a button and its
16
+ * icon, and nothing else. The tick is not there until something is copied (`showCopied`):
17
+ * a page of code blocks has a copy button for each, and nearly none of them is pressed.
18
+ * `label` and `attributes` are escaped already.
19
+ */
20
+ export declare function copyHtml(options: {
21
+ label: string;
22
+ attributes?: string;
23
+ sx?: Sx;
24
+ }): string;
25
+ /**
26
+ * Shows a copy button written by `copyHtml` as having copied, and puts it back two seconds
27
+ * later: the icon turns into a tick, and the status after it says so.
28
+ */
29
+ export declare function showCopied(button: Element, copiedLabel: string): void;
14
30
  declare const MessageCopy: import("svelte").Component<MessageCopyProps, {}, "">;
15
31
  type MessageCopy = ReturnType<typeof MessageCopy>;
16
32
  export default MessageCopy;
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  Who is speaking: a mark, a name, and a word more, such as the model or the
3
3
  time. The default mark is the arch of the doors, which lights up while the
4
- reply is arriving, as ithildin shows only under the moon.
4
+ reply is arriving.
5
5
  -->
6
6
  <script lang="ts" module>
7
7
  import * as stylex from '@stylexjs/stylex';
@@ -37,13 +37,13 @@
37
37
  textOverflow: 'ellipsis',
38
38
  whiteSpace: 'nowrap',
39
39
  color: colors.text,
40
- fontSize: font.sizeSm,
40
+ fontSize: font.sizeMeta,
41
41
  fontWeight: font.weightSemibold
42
42
  },
43
43
  meta: {
44
44
  flexShrink: 0,
45
45
  color: colors.textSubtle,
46
- fontSize: font.sizeXs,
46
+ fontSize: font.sizeCaption,
47
47
  fontVariantNumeric: 'tabular-nums'
48
48
  }
49
49
  });
@@ -24,7 +24,7 @@
24
24
  gap: '0.625rem',
25
25
  minHeight: '1.75rem',
26
26
  color: colors.textMuted,
27
- fontSize: font.sizeMd,
27
+ fontSize: font.sizeBody,
28
28
  lineHeight: 1,
29
29
  opacity: { default: 1, '@starting-style': 0 },
30
30
  transitionProperty: 'opacity',
@@ -22,7 +22,7 @@
22
22
  time: {
23
23
  paddingInline: '0.375rem',
24
24
  color: colors.textSubtle,
25
- fontSize: font.sizeXs,
25
+ fontSize: font.sizeCaption,
26
26
  fontVariantNumeric: 'tabular-nums',
27
27
  whiteSpace: 'nowrap',
28
28
  opacity: {
@@ -41,25 +41,29 @@
41
41
  columnGap: '0.625rem',
42
42
  paddingBlock: '0.625rem',
43
43
  paddingInline: '0.75rem',
44
- borderRadius: radius.lg,
45
- fontSize: font.sizeMd,
44
+ borderRadius: radius.panel,
45
+ fontSize: font.sizeBody,
46
46
  lineHeight: font.leadingSnug
47
47
  },
48
48
  neutral: {
49
- backgroundColor: colors.well,
50
- boxShadow: `inset 0 0 0 1px ${colors.line}`,
49
+ backgroundColor: colors.fillSunken,
51
50
  color: colors.text
52
51
  },
53
- info: { backgroundColor: colors.ithilSoft, color: colors.text },
54
- success: { backgroundColor: colors.successSoft, color: colors.successInk },
55
- warning: { backgroundColor: colors.warningSoft, color: colors.warningInk },
56
- danger: { backgroundColor: colors.dangerSoft, color: colors.dangerInk },
52
+ info: { backgroundColor: colors.accentSoft, color: colors.text },
53
+ success: { backgroundColor: colors.successSoft, color: colors.successText },
54
+ warning: { backgroundColor: colors.warningSoft, color: colors.warningText },
55
+ danger: { backgroundColor: colors.dangerSoft, color: colors.dangerText },
57
56
  icon: { display: 'grid', placeItems: 'center', width: '1rem', height: '1lh' },
58
57
  iconNeutral: { color: colors.textMuted },
59
- iconInfo: { color: colors.ithil },
58
+ iconInfo: { color: colors.accent },
60
59
  text: { display: 'flex', flexDirection: 'column', gap: '0.125rem', minWidth: 0 },
61
60
  title: { fontWeight: font.weightMedium },
62
- detail: { opacity: 0.85, fontSize: font.sizeSm, userSelect: 'text', overflowWrap: 'anywhere' },
61
+ detail: {
62
+ opacity: 0.85,
63
+ fontSize: font.sizeMeta,
64
+ userSelect: 'text',
65
+ overflowWrap: 'anywhere'
66
+ },
63
67
  actions: { display: 'flex', alignItems: 'center', gap: '0.25rem', marginBlock: '-0.25rem' }
64
68
  });
65
69
  </script>
@@ -29,9 +29,8 @@
29
29
  paddingTop: '0.75rem',
30
30
  paddingBottom: '0.5rem',
31
31
  paddingInline: '0.5rem',
32
- borderRadius: radius.lg,
33
- backgroundColor: colors.surface,
34
- boxShadow: `inset 0 0 0 1px ${colors.line}, inset 0 1px 0 ${colors.highlight}, 0 1px 2px ${colors.shade}`
32
+ borderRadius: radius.panel,
33
+ boxShadow: `inset 0 0 0 1px ${colors.border}`
35
34
  },
36
35
  head: {
37
36
  display: 'flex',
@@ -43,7 +42,7 @@
43
42
  },
44
43
  title: {
45
44
  color: colors.text,
46
- fontSize: font.sizeSm,
45
+ fontSize: font.sizeMeta,
47
46
  fontWeight: font.weightSemibold
48
47
  },
49
48
  // One segment per step: lit as each is done, half-lit while one is under way
@@ -55,14 +54,14 @@
55
54
  segment: {
56
55
  flexGrow: 1,
57
56
  height: '0.1875rem',
58
- borderRadius: radius.full,
59
- backgroundColor: colors.line,
57
+ borderRadius: radius.pill,
58
+ backgroundColor: colors.border,
60
59
  transitionProperty: 'background-color, box-shadow',
61
60
  transitionDuration: motion.slow,
62
61
  transitionTimingFunction: 'ease'
63
62
  },
64
- segmentDone: { backgroundColor: colors.ithil, boxShadow: `0 0 6px ${colors.glow}` },
65
- segmentActive: { backgroundColor: `color-mix(in oklab, ${colors.ithil} 40%, transparent)` },
63
+ segmentDone: { backgroundColor: colors.accent },
64
+ segmentActive: { backgroundColor: `color-mix(in oklab, ${colors.accent} 40%, transparent)` },
66
65
  steps: {
67
66
  display: 'flex',
68
67
  flexDirection: 'column',
@@ -77,9 +76,9 @@
77
76
  gap: '0.625rem',
78
77
  minHeight: '1.875rem',
79
78
  paddingInline: '0.375rem',
80
- borderRadius: radius.md,
79
+ borderRadius: radius.control,
81
80
  color: colors.textMuted,
82
- fontSize: font.sizeMd,
81
+ fontSize: font.sizeBody,
83
82
  lineHeight: font.leadingSnug,
84
83
  transitionProperty: 'color, background-color',
85
84
  transitionDuration: motion.base,
@@ -87,7 +86,7 @@
87
86
  },
88
87
  // The step under way sits in a band of moonlight
89
88
  active: {
90
- backgroundColor: colors.ithilSoft,
89
+ backgroundColor: colors.accentSoft,
91
90
  color: colors.text,
92
91
  fontWeight: font.weightMedium
93
92
  },
@@ -100,7 +99,7 @@
100
99
  boxSizing: 'border-box',
101
100
  width: '1rem',
102
101
  height: '1rem',
103
- borderRadius: radius.full,
102
+ borderRadius: radius.pill,
104
103
  color: colors.textSubtle,
105
104
  opacity: { default: 1, '@starting-style': 0 },
106
105
  scale: { default: null, [media.motion]: { default: 1, '@starting-style': 0.6 } },
@@ -108,11 +107,17 @@
108
107
  transitionDuration: motion.slow,
109
108
  transitionTimingFunction: motion.easeOut
110
109
  },
111
- iconActive: { color: colors.ithil },
110
+ iconActive: { color: colors.accent },
112
111
  // Done: a solid green seal with the tick cut out of it
113
112
  iconDone: { backgroundColor: colors.success, color: colors.bgRaised },
114
- iconSkipped: { boxShadow: `inset 0 0 0 1px ${colors.lineStrong}` },
115
- skipped: { color: colors.textSubtle, fontSize: font.sizeSm, fontWeight: font.weightRegular },
113
+ iconSkipped: { boxShadow: `inset 0 0 0 1px ${colors.borderStrong}` },
114
+ // Set off by room, not a dot
115
+ skipped: {
116
+ marginInlineStart: '0.5rem',
117
+ color: colors.textSubtle,
118
+ fontSize: font.sizeMeta,
119
+ fontWeight: font.weightRegular
120
+ },
116
121
  hidden: {
117
122
  position: 'absolute',
118
123
  width: '1px',
@@ -185,8 +190,8 @@
185
190
  </span>
186
191
  {/key}
187
192
  <span>
188
- {step.label}{#if step.status === 'skipped'}<span {...stylex.attrs(styles.skipped)}>
189
- · {skippedLabel}</span
193
+ {step.label}{#if step.status === 'skipped'}<span {...stylex.attrs(styles.skipped)}
194
+ >{skippedLabel}</span
190
195
  >{:else if step.status === 'done'}<span {...stylex.attrs(styles.hidden)}>
191
196
  (done)</span
192
197
  >{/if}
@@ -1,9 +1,9 @@
1
1
  <script lang="ts" module>
2
2
  import * as stylex from '@stylexjs/stylex';
3
3
  import type { HTMLAttributes } from 'svelte/elements';
4
- import { loop } from '../../internal/loop.js';
5
4
  import { attrs, type Sx } from '../../internal/sx.js';
6
- import { colors, motion, radius } from '../../tokens.stylex.js';
5
+ import { whileVisible } from '../../internal/visible.js';
6
+ import { colors, motion, play, radius } from '../../tokens.stylex.js';
7
7
  import { media } from '../../media.stylex.js';
8
8
 
9
9
  export type ProgressProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
@@ -13,28 +13,18 @@
13
13
  sx?: Sx;
14
14
  };
15
15
 
16
- // The bar of an unknown amount sweeps across on Narvi's shared clock, easing in
17
- // and out. With reduced motion it breathes in place instead.
18
- const ease = (t: number) => (t < 0.5 ? 2 * t * t : 1 - (-2 * t + 2) ** 2 / 2);
19
- const sweep = loop(
20
- (reduced) => (reduced ? 2000 : 1400),
21
- (element, { progress, reduced, rtl }) => {
22
- if (reduced) {
23
- element.style.translate = '';
24
- element.style.opacity = String(
25
- 0.35 + 0.65 * (0.5 - 0.5 * Math.cos(progress * 2 * Math.PI))
26
- );
27
- return;
28
- }
29
- const at = -100 + 350 * ease(progress);
30
- element.style.opacity = '';
31
- element.style.translate = `${rtl ? -at : at}% 0`;
32
- },
33
- (element) => {
34
- element.style.translate = '';
35
- element.style.opacity = '';
36
- }
37
- );
16
+ // The bar of an unknown amount crosses the track, stepped, and only while it can be
17
+ // seen. With less motion asked for it fills the track and breathes in place instead.
18
+ const sweep = stylex.keyframes({ from: { translate: '-100% 0' }, to: { translate: '250% 0' } });
19
+ const sweepRtl = stylex.keyframes({
20
+ from: { translate: '100% 0' },
21
+ to: { translate: '-250% 0' }
22
+ });
23
+ const breathe = stylex.keyframes({
24
+ '0%': { opacity: 1 },
25
+ '50%': { opacity: 0.35 },
26
+ '100%': { opacity: 1 }
27
+ });
38
28
 
39
29
  const styles = stylex.create({
40
30
  track: {
@@ -42,9 +32,8 @@
42
32
  boxSizing: 'border-box',
43
33
  width: '100%',
44
34
  height: '0.25rem',
45
- borderRadius: radius.full,
46
- backgroundColor: colors.well,
47
- boxShadow: `inset 0 0 0 1px ${colors.line}`,
35
+ borderRadius: radius.pill,
36
+ backgroundColor: colors.fillSunken,
48
37
  outlineStyle: 'solid',
49
38
  outlineWidth: '1px',
50
39
  outlineColor: 'transparent'
@@ -55,16 +44,17 @@
55
44
  position: 'absolute',
56
45
  inset: 0,
57
46
  overflow: 'hidden',
58
- borderRadius: radius.full,
59
- filter: `drop-shadow(0 0 4px ${colors.glow})`
47
+ borderRadius: radius.pill
60
48
  },
61
49
  fill: {
62
50
  display: 'block',
63
51
  width: '100%',
64
52
  height: '100%',
65
- borderRadius: radius.full,
53
+ borderRadius: radius.pill,
54
+ backgroundColor: colors.accent,
55
+ // Forced colours drop a background colour, not an image
66
56
  backgroundImage: {
67
- default: `linear-gradient(90deg, ${colors.ithilStrong}, ${colors.ithil})`,
57
+ default: 'none',
68
58
  [media.forcedColors]: 'linear-gradient(Highlight, Highlight)'
69
59
  },
70
60
  forcedColorAdjust: 'none'
@@ -81,7 +71,15 @@
81
71
  transitionTimingFunction: motion.easeOut
82
72
  },
83
73
  unknown: {
84
- width: { default: '100%', [media.motion]: '40%' }
74
+ width: { default: '100%', [media.motion]: '40%' },
75
+ animationName: {
76
+ default: breathe,
77
+ [media.motion]: { default: sweep, ':dir(rtl)': sweepRtl }
78
+ },
79
+ animationDuration: { default: '2s', [media.motion]: '1.4s' },
80
+ animationTimingFunction: { default: 'steps(12)', [media.motion]: 'steps(28)' },
81
+ animationIterationCount: 'infinite',
82
+ animationPlayState: play.whileVisible
85
83
  }
86
84
  });
87
85
  </script>
@@ -105,7 +103,7 @@
105
103
  <span
106
104
  {...stylex.attrs(styles.fill, known ? styles.known : styles.unknown)}
107
105
  style:--narvi-progress={known ? `${percent}%` : undefined}
108
- {@attach !known && sweep}
106
+ {@attach !known && whileVisible}
109
107
  ></span>
110
108
  </span>
111
109
  </div>
@@ -10,6 +10,7 @@
10
10
  import { shared } from '../../internal/shared.js';
11
11
  import { attrs, type Sx } from '../../internal/sx.js';
12
12
  import { colors, font, radius, space } from '../../tokens.stylex.js';
13
+ import { media } from '../../media.stylex.js';
13
14
  import Button from '../button/Button.svelte';
14
15
  import Kbd from '../kbd/Kbd.svelte';
15
16
  import Progress from '../progress/Progress.svelte';
@@ -58,15 +59,15 @@
58
59
  flexDirection: 'column',
59
60
  gap: space.x3,
60
61
  padding: '0.875rem',
61
- borderRadius: radius.lg,
62
+ borderRadius: radius.panel,
62
63
  backgroundColor: colors.bgRaised,
63
- boxShadow: `inset 0 0 0 1px color-mix(in oklab, ${colors.ithil} 35%, transparent), 0 0 0 3px ${colors.ithilSoft}`
64
+ boxShadow: `inset 0 0 0 1px color-mix(in oklab, ${colors.accent} 35%, transparent)`
64
65
  },
65
66
  head: { display: 'flex', flexDirection: 'column', gap: '0.5rem' },
66
- count: { color: colors.ithil },
67
+ count: { color: colors.accent },
67
68
  prompt: {
68
69
  margin: 0,
69
- fontSize: font.sizeLg,
70
+ fontSize: font.sizeReading,
70
71
  fontWeight: font.weightMedium,
71
72
  lineHeight: font.leadingSnug,
72
73
  outlineStyle: 'none'
@@ -86,23 +87,19 @@
86
87
  columnGap: '0.625rem',
87
88
  paddingBlock: '0.5rem',
88
89
  paddingInline: '0.625rem',
89
- borderRadius: radius.md,
90
+ borderRadius: radius.control,
90
91
  backgroundColor: {
91
92
  default: 'transparent',
92
- ':hover': { default: null, '@media (hover: hover)': colors.hover },
93
- ':has(:checked)': colors.ithilSoft
94
- },
95
- boxShadow: {
96
- default: `inset 0 0 0 1px ${colors.line}`,
97
- ':has(:checked)': `inset 0 0 0 1px color-mix(in oklab, ${colors.ithil} 60%, transparent)`
93
+ ':hover': { default: null, [media.hover]: colors.fillHover },
94
+ ':has(:checked)': colors.accentSoft
98
95
  },
99
96
  cursor: 'pointer',
100
- transitionProperty: 'background-color, box-shadow',
97
+ transitionProperty: 'background-color',
101
98
  transitionDuration: '120ms',
102
99
  transitionTimingFunction: 'ease'
103
100
  },
104
101
  // Drawn by hand, so it matches the stone in both schemes: a ring, filled
105
- // with ithildin and a dot of the card's colour once chosen
102
+ // with the accent and a dot of the card's colour once chosen
106
103
  input: {
107
104
  appearance: 'none',
108
105
  boxSizing: 'border-box',
@@ -111,11 +108,11 @@
111
108
  height: '1rem',
112
109
  margin: 0,
113
110
  marginTop: '0.1875rem',
114
- borderRadius: radius.full,
115
- backgroundColor: { default: colors.well, ':checked': colors.ithil },
111
+ borderRadius: radius.pill,
112
+ backgroundColor: { default: 'transparent', ':checked': colors.accent },
116
113
  boxShadow: {
117
- default: `inset 0 0 0 1px ${colors.edge}`,
118
- ':checked': `inset 0 0 0 4px ${colors.ithil}, inset 0 0 0 10px ${colors.bgRaised}`
114
+ default: `inset 0 0 0 1px ${colors.borderControl}`,
115
+ ':checked': `inset 0 0 0 4px ${colors.accent}, inset 0 0 0 10px ${colors.bgRaised}`
119
116
  },
120
117
  cursor: 'pointer',
121
118
  outlineStyle: 'solid',
@@ -127,15 +124,15 @@
127
124
  transitionTimingFunction: 'ease'
128
125
  },
129
126
  // Several may be chosen: the same, squared
130
- box: { borderRadius: radius.xs },
127
+ box: { borderRadius: radius.chip },
131
128
  text: { display: 'flex', flexDirection: 'column', gap: '0.125rem', minWidth: 0 },
132
- description: { color: colors.textMuted, fontSize: font.sizeSm },
133
- error: { margin: 0, color: colors.danger, fontSize: font.sizeSm },
129
+ description: { color: colors.textMuted, fontSize: font.sizeMeta },
130
+ error: { margin: 0, color: colors.danger, fontSize: font.sizeMeta },
134
131
  foot: { display: 'flex', alignItems: 'center', gap: space.x2 },
135
132
  spacer: { flexGrow: 1 },
136
133
  summary: { display: 'flex', flexDirection: 'column', gap: '0.5rem', margin: 0, padding: 0 },
137
- q: { color: colors.textMuted, fontSize: font.sizeSm },
138
- a: { margin: 0, fontSize: font.sizeMd }
134
+ q: { color: colors.textMuted, fontSize: font.sizeMeta },
135
+ a: { margin: 0, fontSize: font.sizeBody }
139
136
  });
140
137
  </script>
141
138