@diegopluna/narvi 0.0.2 → 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 (313) hide show
  1. package/README.md +116 -44
  2. package/dist/base.css +96 -0
  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 +5 -6
  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 -17
  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 +41 -65
  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 +99 -23
  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 +227 -51
  36. package/dist/components/button/Button.svelte.d.ts +38 -2
  37. package/dist/components/card/Card.svelte +19 -33
  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 +31 -25
  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/CollapsibleContent.svelte +38 -0
  44. package/dist/components/collapsible/CollapsibleContent.svelte.d.ts +11 -0
  45. package/dist/components/collapsible/CollapsibleRoot.svelte +44 -0
  46. package/dist/components/collapsible/CollapsibleRoot.svelte.d.ts +11 -0
  47. package/dist/components/collapsible/CollapsibleTrigger.svelte +83 -0
  48. package/dist/components/collapsible/CollapsibleTrigger.svelte.d.ts +13 -0
  49. package/dist/components/collapsible/context.d.ts +5 -0
  50. package/dist/components/collapsible/context.js +11 -0
  51. package/dist/components/collapsible/index.d.ts +7 -0
  52. package/dist/components/collapsible/index.js +4 -0
  53. package/dist/components/command/CommandItem.svelte +1 -1
  54. package/dist/components/command/styles.d.ts +3 -2
  55. package/dist/components/command/styles.js +15 -12
  56. package/dist/components/composer/ComposerAttachButton.svelte +1 -1
  57. package/dist/components/composer/ComposerAttachment.svelte +13 -18
  58. package/dist/components/composer/ComposerModelPicker.svelte +24 -28
  59. package/dist/components/composer/ComposerRoot.svelte +15 -13
  60. package/dist/components/composer/ComposerSubmit.svelte +12 -20
  61. package/dist/components/composer/ComposerTextarea.svelte +1 -1
  62. package/dist/components/composer/ComposerToggle.svelte +16 -18
  63. package/dist/components/composer/ComposerTray.svelte +78 -0
  64. package/dist/components/composer/ComposerTray.svelte.d.ts +15 -0
  65. package/dist/components/composer/index.d.ts +3 -1
  66. package/dist/components/composer/index.js +3 -2
  67. package/dist/components/conversation/ConversationContent.svelte +3 -2
  68. package/dist/components/conversation/ConversationEmpty.svelte +1 -1
  69. package/dist/components/conversation/ConversationScrollButton.svelte +9 -11
  70. package/dist/components/dialog/ConfirmDialog.svelte +1 -1
  71. package/dist/components/dialog/DialogContent.svelte +5 -1
  72. package/dist/components/dialog/styles.d.ts +2 -26
  73. package/dist/components/dialog/styles.js +12 -49
  74. package/dist/components/divider/Divider.svelte +3 -3
  75. package/dist/components/empty-state/EmptyState.svelte +4 -5
  76. package/dist/components/field/Field.svelte +4 -4
  77. package/dist/components/frame/Frame.svelte +6 -7
  78. package/dist/components/frame/Frame.svelte.d.ts +1 -1
  79. package/dist/components/grid/Grid.svelte +111 -0
  80. package/dist/components/grid/Grid.svelte.d.ts +27 -0
  81. package/dist/components/heading/Heading.svelte +2 -2
  82. package/dist/components/hover-card/HoverCardContent.svelte +50 -0
  83. package/dist/components/hover-card/HoverCardContent.svelte.d.ts +10 -0
  84. package/dist/components/hover-card/HoverCardRoot.svelte +22 -0
  85. package/dist/components/hover-card/HoverCardRoot.svelte.d.ts +5 -0
  86. package/dist/components/hover-card/index.d.ts +7 -0
  87. package/dist/components/hover-card/index.js +7 -0
  88. package/dist/components/kbd/Kbd.svelte +12 -7
  89. package/dist/components/link/Link.svelte +9 -7
  90. package/dist/components/link/Link.svelte.d.ts +4 -1
  91. package/dist/components/markdown/Markdown.svelte +714 -0
  92. package/dist/components/markdown/Markdown.svelte.d.ts +80 -0
  93. package/dist/components/markdown/MarkdownBlock.svelte +231 -0
  94. package/dist/components/markdown/MarkdownBlock.svelte.d.ts +11 -0
  95. package/dist/components/markdown/MarkdownBlocks.svelte +115 -0
  96. package/dist/components/markdown/MarkdownBlocks.svelte.d.ts +15 -0
  97. package/dist/components/markdown/MarkdownCode.svelte +583 -0
  98. package/dist/components/markdown/MarkdownCode.svelte.d.ts +23 -0
  99. package/dist/components/markdown/MarkdownDiagram.svelte +310 -0
  100. package/dist/components/markdown/MarkdownDiagram.svelte.d.ts +6 -0
  101. package/dist/components/markdown/MarkdownFile.svelte +134 -0
  102. package/dist/components/markdown/MarkdownFile.svelte.d.ts +19 -0
  103. package/dist/components/markdown/MarkdownFootnotes.svelte +61 -0
  104. package/dist/components/markdown/MarkdownFootnotes.svelte.d.ts +8 -0
  105. package/dist/components/markdown/MarkdownFresh.svelte +69 -0
  106. package/dist/components/markdown/MarkdownFresh.svelte.d.ts +6 -0
  107. package/dist/components/markdown/MarkdownHtml.svelte +72 -0
  108. package/dist/components/markdown/MarkdownHtml.svelte.d.ts +7 -0
  109. package/dist/components/markdown/MarkdownImage.svelte +150 -0
  110. package/dist/components/markdown/MarkdownImage.svelte.d.ts +8 -0
  111. package/dist/components/markdown/MarkdownInlines.svelte +225 -0
  112. package/dist/components/markdown/MarkdownInlines.svelte.d.ts +7 -0
  113. package/dist/components/markdown/MarkdownLink.svelte +120 -0
  114. package/dist/components/markdown/MarkdownLink.svelte.d.ts +25 -0
  115. package/dist/components/markdown/MarkdownMath.svelte +138 -0
  116. package/dist/components/markdown/MarkdownMath.svelte.d.ts +7 -0
  117. package/dist/components/markdown/MarkdownTable.svelte +265 -0
  118. package/dist/components/markdown/MarkdownTable.svelte.d.ts +17 -0
  119. package/dist/components/markdown/caret.d.ts +14 -0
  120. package/dist/components/markdown/caret.js +67 -0
  121. package/dist/components/markdown/context.d.ts +93 -0
  122. package/dist/components/markdown/context.js +128 -0
  123. package/dist/components/markdown/copy.d.ts +13 -0
  124. package/dist/components/markdown/copy.js +74 -0
  125. package/dist/components/markdown/hidden.d.ts +12 -0
  126. package/dist/components/markdown/hidden.js +31 -0
  127. package/dist/components/markdown/kept.d.ts +32 -0
  128. package/dist/components/markdown/kept.js +71 -0
  129. package/dist/components/markdown/labels.d.ts +46 -0
  130. package/dist/components/markdown/labels.js +35 -0
  131. package/dist/components/markdown/save.d.ts +11 -0
  132. package/dist/components/markdown/save.js +58 -0
  133. package/dist/components/markdown/scrollable.d.ts +24 -0
  134. package/dist/components/markdown/scrollable.js +152 -0
  135. package/dist/components/markdown/static.d.ts +37 -0
  136. package/dist/components/markdown/static.js +233 -0
  137. package/dist/components/markdown/styles.d.ts +328 -0
  138. package/dist/components/markdown/styles.js +302 -0
  139. package/dist/components/menu/MenuRadioItem.svelte +3 -3
  140. package/dist/components/menu/index.d.ts +23 -0
  141. package/dist/components/menu/index.js +3 -1
  142. package/dist/components/message/MessageAction.svelte +24 -5
  143. package/dist/components/message/MessageAction.svelte.d.ts +9 -0
  144. package/dist/components/message/MessageActions.svelte +2 -3
  145. package/dist/components/message/MessageContent.svelte +2 -3
  146. package/dist/components/message/MessageCopy.svelte +66 -8
  147. package/dist/components/message/MessageCopy.svelte.d.ts +17 -1
  148. package/dist/components/message/MessageHeader.svelte +3 -3
  149. package/dist/components/message/MessagePending.svelte +1 -1
  150. package/dist/components/message/MessageRoot.svelte +3 -4
  151. package/dist/components/message/MessageTime.svelte +3 -4
  152. package/dist/components/notice/Notice.svelte +14 -10
  153. package/dist/components/plan/Plan.svelte +25 -21
  154. package/dist/components/progress/Progress.svelte +34 -38
  155. package/dist/components/questionnaire/Questionnaire.svelte +19 -22
  156. package/dist/components/queued-message/QueuedMessage.svelte +14 -7
  157. package/dist/components/rail/RailItem.svelte +43 -40
  158. package/dist/components/rail/RailItem.svelte.d.ts +3 -1
  159. package/dist/components/rail/RailRoot.svelte +18 -4
  160. package/dist/components/rail/RailRoot.svelte.d.ts +1 -1
  161. package/dist/components/rail/RailSeparator.svelte +17 -0
  162. package/dist/components/rail/RailSeparator.svelte.d.ts +18 -0
  163. package/dist/components/rail/index.d.ts +2 -1
  164. package/dist/components/rail/index.js +2 -1
  165. package/dist/components/reasoning/ReasoningContent.svelte +4 -8
  166. package/dist/components/reasoning/ReasoningTrigger.svelte +4 -5
  167. package/dist/components/resize-handle/ResizeHandle.svelte +4 -7
  168. package/dist/components/reveal/Reveal.svelte +89 -0
  169. package/dist/components/reveal/Reveal.svelte.d.ts +17 -0
  170. package/dist/components/reveal/revealed.d.ts +38 -0
  171. package/dist/components/reveal/revealed.js +79 -0
  172. package/dist/components/segmented/SegmentedControl.svelte +11 -16
  173. package/dist/components/select/Select.svelte +1 -1
  174. package/dist/components/separator/Separator.svelte +1 -1
  175. package/dist/components/settings-row/SettingsRow.svelte +5 -5
  176. package/dist/components/sheet/SheetContent.svelte +63 -0
  177. package/dist/components/sheet/SheetContent.svelte.d.ts +18 -0
  178. package/dist/components/sheet/index.d.ts +12 -0
  179. package/dist/components/sheet/index.js +12 -0
  180. package/dist/components/sheet/styles.d.ts +51 -0
  181. package/dist/components/sheet/styles.js +65 -0
  182. package/dist/components/shimmer/Shimmer.svelte +41 -26
  183. package/dist/components/sidebar/SidebarContent.svelte +1 -1
  184. package/dist/components/sidebar/SidebarFolder.svelte +142 -0
  185. package/dist/components/sidebar/SidebarFolder.svelte.d.ts +19 -0
  186. package/dist/components/sidebar/SidebarFooter.svelte +1 -1
  187. package/dist/components/sidebar/SidebarGroup.svelte +41 -35
  188. package/dist/components/sidebar/SidebarGroup.svelte.d.ts +3 -3
  189. package/dist/components/sidebar/SidebarHeader.svelte +12 -6
  190. package/dist/components/sidebar/SidebarHeader.svelte.d.ts +4 -1
  191. package/dist/components/sidebar/SidebarItem.svelte +34 -38
  192. package/dist/components/sidebar/SidebarRoot.svelte +62 -0
  193. package/dist/components/sidebar/SidebarRoot.svelte.d.ts +14 -0
  194. package/dist/components/sidebar/index.d.ts +5 -1
  195. package/dist/components/sidebar/index.js +3 -1
  196. package/dist/components/skeleton/Skeleton.svelte +26 -15
  197. package/dist/components/slider/Slider.svelte +200 -0
  198. package/dist/components/slider/Slider.svelte.d.ts +55 -0
  199. package/dist/components/spinner/Spinner.svelte +4 -11
  200. package/dist/components/stack/Stack.svelte +37 -44
  201. package/dist/components/stack/Stack.svelte.d.ts +12 -6
  202. package/dist/components/status-indicator/StatusIndicator.svelte +1 -1
  203. package/dist/components/suggestions/SuggestionsItem.svelte +11 -13
  204. package/dist/components/switch/Switch.svelte +16 -25
  205. package/dist/components/tab-strip/TabStrip.svelte +340 -0
  206. package/dist/components/tab-strip/TabStrip.svelte.d.ts +31 -0
  207. package/dist/components/tabs/Tabs.svelte +15 -14
  208. package/dist/components/tabs/Tabs.svelte.d.ts +4 -0
  209. package/dist/components/text/Text.svelte +64 -14
  210. package/dist/components/text/Text.svelte.d.ts +13 -3
  211. package/dist/components/toast/Toaster.svelte +12 -10
  212. package/dist/components/toggle/Toggle.svelte +40 -0
  213. package/dist/components/toggle/Toggle.svelte.d.ts +15 -0
  214. package/dist/components/toggle-group/ToggleGroupItem.svelte +37 -0
  215. package/dist/components/toggle-group/ToggleGroupItem.svelte.d.ts +12 -0
  216. package/dist/components/toggle-group/ToggleGroupRoot.svelte +95 -0
  217. package/dist/components/toggle-group/ToggleGroupRoot.svelte.d.ts +33 -0
  218. package/dist/components/toggle-group/context.d.ts +6 -0
  219. package/dist/components/toggle-group/context.js +11 -0
  220. package/dist/components/toggle-group/index.d.ts +5 -0
  221. package/dist/components/toggle-group/index.js +3 -0
  222. package/dist/components/tool/ToolContent.svelte +3 -8
  223. package/dist/components/tool/ToolSection.svelte +4 -5
  224. package/dist/components/tool/ToolTrigger.svelte +14 -15
  225. package/dist/components/tooltip/TooltipContent.svelte +9 -6
  226. package/dist/components/work-fold/WorkFold.svelte +17 -34
  227. package/dist/components/work-fold/WorkFold.svelte.d.ts +1 -1
  228. package/dist/index.d.ts +38 -10
  229. package/dist/index.js +38 -12
  230. package/dist/internal/Chevron.svelte +2 -3
  231. package/dist/internal/Code.svelte +3 -4
  232. package/dist/internal/Collapse.svelte +6 -5
  233. package/dist/internal/Collapse.svelte.d.ts +2 -1
  234. package/dist/internal/Glyph.svelte +16 -0
  235. package/dist/internal/Glyph.svelte.d.ts +6 -0
  236. package/dist/internal/Tile.svelte +17 -37
  237. package/dist/internal/control.d.ts +4 -4
  238. package/dist/internal/control.js +21 -18
  239. package/dist/internal/layer.d.ts +3 -5
  240. package/dist/internal/layer.js +14 -18
  241. package/dist/internal/layout.d.ts +13 -0
  242. package/dist/internal/layout.js +453 -0
  243. package/dist/internal/markers.stylex.d.ts +8 -0
  244. package/dist/internal/markers.stylex.js +4 -0
  245. package/dist/internal/plugin-order.d.ts +8 -0
  246. package/dist/internal/plugin-order.js +16 -0
  247. package/dist/internal/responsive.d.ts +45 -0
  248. package/dist/internal/responsive.js +42 -0
  249. package/dist/internal/roving.js +5 -2
  250. package/dist/internal/shared.d.ts +8 -1
  251. package/dist/internal/shared.js +21 -5
  252. package/dist/internal/sx.d.ts +31 -4
  253. package/dist/internal/sx.js +17 -0
  254. package/dist/internal/toggle.d.ts +73 -0
  255. package/dist/internal/toggle.js +83 -0
  256. package/dist/internal/visible.d.ts +32 -0
  257. package/dist/internal/visible.js +44 -0
  258. package/dist/markdown/ast.d.ts +209 -0
  259. package/dist/markdown/ast.js +10 -0
  260. package/dist/markdown/blocks.d.ts +177 -0
  261. package/dist/markdown/blocks.js +1489 -0
  262. package/dist/markdown/code-info.d.ts +10 -0
  263. package/dist/markdown/code-info.js +16 -0
  264. package/dist/markdown/common.d.ts +25 -0
  265. package/dist/markdown/common.js +107 -0
  266. package/dist/markdown/diagrams.d.ts +2 -0
  267. package/dist/markdown/diagrams.js +18 -0
  268. package/dist/markdown/file-paths.d.ts +29 -0
  269. package/dist/markdown/file-paths.js +80 -0
  270. package/dist/markdown/files.d.ts +16 -0
  271. package/dist/markdown/files.js +133 -0
  272. package/dist/markdown/highlight.d.ts +30 -0
  273. package/dist/markdown/highlight.js +127 -0
  274. package/dist/markdown/html.d.ts +23 -0
  275. package/dist/markdown/html.js +289 -0
  276. package/dist/markdown/images.d.ts +15 -0
  277. package/dist/markdown/images.js +45 -0
  278. package/dist/markdown/index.d.ts +12 -0
  279. package/dist/markdown/index.js +5 -0
  280. package/dist/markdown/inlines.d.ts +48 -0
  281. package/dist/markdown/inlines.js +1714 -0
  282. package/dist/markdown/math.d.ts +2 -0
  283. package/dist/markdown/math.js +22 -0
  284. package/dist/markdown/parse.d.ts +81 -0
  285. package/dist/markdown/parse.js +204 -0
  286. package/dist/markdown/plugin.d.ts +178 -0
  287. package/dist/markdown/plugin.js +160 -0
  288. package/dist/markdown/sanitize.d.ts +78 -0
  289. package/dist/markdown/sanitize.js +522 -0
  290. package/dist/markdown/share.d.ts +12 -0
  291. package/dist/markdown/share.js +59 -0
  292. package/dist/markdown/table.d.ts +13 -0
  293. package/dist/markdown/table.js +60 -0
  294. package/dist/media.stylex.d.ts +52 -0
  295. package/dist/media.stylex.js +53 -0
  296. package/dist/preset.d.ts +40 -16
  297. package/dist/preset.js +169 -51
  298. package/dist/tokens.stylex.d.ts +70 -37
  299. package/dist/tokens.stylex.js +127 -62
  300. package/dist/typography.d.ts +48 -0
  301. package/dist/typography.js +55 -0
  302. package/dist/vite.d.ts +9 -1
  303. package/dist/vite.js +37 -4
  304. package/package.json +58 -6
  305. package/skills/building-ui/SKILL.md +242 -0
  306. package/skills/building-ui/references/components.md +207 -0
  307. package/skills/markdown/SKILL.md +452 -0
  308. package/skills/markdown/references/plugins.md +103 -0
  309. package/skills/setup/SKILL.md +191 -0
  310. package/skills/styling/SKILL.md +269 -0
  311. package/skills/theming/SKILL.md +184 -0
  312. package/dist/internal/loop.d.ts +0 -35
  313. package/dist/internal/loop.js +0 -72
package/README.md CHANGED
@@ -1,49 +1,108 @@
1
1
  # Narvi
2
2
 
3
- A component library for Svelte 5, styled with [StyleX](https://stylexjs.com). Styles are compiled
4
- to atomic CSS at build time, so no styling code runs in the browser.
3
+ A component library for Svelte 5, styled with [StyleX](https://stylexjs.com). Beside buttons and
4
+ dialogs it has the parts an app for AI agents is made of: a window's shell, a conversation, a
5
+ composer, and a timeline of what an agent did. Styles are compiled to atomic CSS at build time, so
6
+ no styling code runs in the browser.
5
7
 
6
- This repository holds two things:
8
+ Docs, live examples and every component: **[narvi.dpeter.dev](https://narvi.dpeter.dev)**.
7
9
 
8
- - the library, in `src/lib`, packaged with `svelte-package`
9
- - the docs site, in `src/routes` and `src/docs`, a prerendered SvelteKit app that uses the library
10
+ ## Use it in an app
10
11
 
11
- ## Develop
12
+ Narvi works in a SvelteKit app, or a plain Vite app with the Svelte plugin. It needs Svelte 5.20 or
13
+ later, Vite 6 or later, and browsers with `light-dark()` (Chrome 123, Safari 17.5, Firefox 120).
14
+ It is below 1.0, so pin the version you build against.
12
15
 
13
- ```sh
14
- pnpm install
15
- pnpm dev # docs site with live examples, at http://localhost:5173
16
+ 1. Install it.
17
+
18
+ ```sh
19
+ pnpm add @diegopluna/narvi
20
+ ```
21
+
22
+ 2. Add the plugin after `sveltekit()`, or after `svelte()` in a plain Vite app.
23
+
24
+ ```ts
25
+ // vite.config.ts
26
+ import { sveltekit } from '@sveltejs/kit/vite';
27
+ import { narvi } from '@diegopluna/narvi/vite';
28
+ import { defineConfig } from 'vite';
29
+
30
+ export default defineConfig({
31
+ plugins: [sveltekit(), narvi()]
32
+ });
33
+ ```
34
+
35
+ 3. Start your stylesheet with Narvi's base, and set the page's typeface on the root.
36
+
37
+ ```css
38
+ /* src/app.css */
39
+ @import '@diegopluna/narvi/base.css';
40
+
41
+ :root {
42
+ font-family: ui-sans-serif, system-ui, sans-serif;
43
+ }
44
+ ```
45
+
46
+ 4. Import that stylesheet once, at the root of the app, and mount `DevStyles` beside it: in
47
+ `src/routes/+layout.svelte`, or in `src/App.svelte` in a plain Vite app.
48
+
49
+ ```svelte
50
+ <script lang="ts">
51
+ import '../app.css';
52
+ import { DevStyles } from '@diegopluna/narvi';
53
+
54
+ let { children } = $props();
55
+ </script>
56
+
57
+ <DevStyles />
58
+
59
+ {@render children()}
60
+ ```
61
+
62
+ Then import components by name:
63
+
64
+ ```svelte
65
+ <script lang="ts">
66
+ import { Button } from '@diegopluna/narvi';
67
+ </script>
68
+
69
+ <Button variant="primary">Speak, friend</Button>
16
70
  ```
17
71
 
18
- | Command | What it does |
19
- | ----------------- | ------------------------------------------------------ |
20
- | `pnpm check` | Type-checks the library and the docs |
21
- | `pnpm lint` | Prettier and ESLint |
22
- | `pnpm test` | Component tests, in headless Chromium |
23
- | `pnpm build:lib` | Packages the library into `dist` and lints the package |
24
- | `pnpm build:docs` | Builds the static docs site into `build` |
25
- | `pnpm build` | Both of the above |
72
+ The button should be a flat, rounded solid, not the browser's grey. If it is not, or it is while
73
+ you develop and not once built, [Installation](https://narvi.dpeter.dev/docs/installation) lists
74
+ each cause beside its fix. The same page covers typefaces, styles of your own, Tailwind and themes.
26
75
 
27
- The tests need a browser once: `pnpm exec playwright install chromium-headless-shell`.
76
+ A coding agent can load the same instructions from the package:
77
+ `npx @tanstack/intent load @diegopluna/narvi#setup`.
28
78
 
29
- ## Use it in an app
79
+ ## Work on Narvi
30
80
 
31
- Install `@diegopluna/narvi` from npm, then add the plugin after `sveltekit()`:
81
+ This repository holds the library, in `src/lib`, packaged with `svelte-package`, and the docs site,
82
+ in `src/routes` and `src/docs`, a prerendered SvelteKit app that uses the library.
32
83
 
33
- ```ts
34
- // vite.config.ts
35
- import { sveltekit } from '@sveltejs/kit/vite';
36
- import { narvi } from '@diegopluna/narvi/vite';
37
- import { defineConfig } from 'vite';
84
+ You need Node 24, which is what CI runs, and pnpm at the version in `package.json`
85
+ (`corepack enable` picks it up).
38
86
 
39
- export default defineConfig({
40
- plugins: [sveltekit(), narvi()]
41
- });
87
+ ```sh
88
+ pnpm install
89
+ pnpm exec playwright install chromium-headless-shell # once, for the tests
90
+ pnpm dev # the docs, at http://localhost:5173
42
91
  ```
43
92
 
44
- Mount `<DevStyles />` in the root layout, import a stylesheet that sets
45
- `:root { color-scheme: light dark; }`, and import components from `@diegopluna/narvi`. The docs site covers
46
- this in full under Installation.
93
+ | Command | What it does |
94
+ | -------------------- | ------------------------------------------------------------------------ |
95
+ | `pnpm check` | Type-checks the library and the docs |
96
+ | `pnpm lint` | Prettier, ESLint, and Narvi's own design rules |
97
+ | `pnpm test` | Component tests, in headless Chromium |
98
+ | `pnpm test:browsers` | The Markdown tests in Firefox and WebKit (`playwright install` them too) |
99
+ | `pnpm build:lib` | Packages the library into `dist` and lints the package |
100
+ | `pnpm build:docs` | Builds the static docs site into `build` |
101
+ | `pnpm build` | Both of the above |
102
+
103
+ Before a pull request, run `pnpm check`, `pnpm lint` and `pnpm test`, then `pnpm build` if the
104
+ change touches the package or the docs. CI runs the same steps. `AGENTS.md` holds the rules a
105
+ component and a design decision are held to.
47
106
 
48
107
  ## Release
49
108
 
@@ -55,23 +114,33 @@ publish succeeds, so a failed run can be run again.
55
114
  ## How it is put together
56
115
 
57
116
  - **Tokens** live in `src/lib/tokens.stylex.ts`. Colours hold a light and a dark value in one
58
- `light-dark()` declaration, so the theme follows `color-scheme`. The palette is stone and
59
- moonlight: near-black and warm paper for surfaces, a pale metal ("mithril") for the solid button,
60
- and one silver-blue ("ithildin") that is kept for state: focus, selection and progress.
117
+ `light-dark()` declaration, so the theme follows `color-scheme`. The default palette is a grey
118
+ with a trace of blue, a dark grey by night and white on grey by day, and one blue accent that
119
+ is kept for state: focus, selection and progress. A preset (`src/lib/preset.ts`) swaps both.
120
+ - **Conditions** live in `src/lib/media.stylex.ts`: `media.hover`, `media.motion`, `media.forcedColors`
121
+ and the rest, and the breakpoints `sm` to `xl`, as `defineConsts` constants that any file can import.
122
+ - **The base stylesheet**, `src/lib/base.css`, holds what belongs on the document: `color-scheme`, the
123
+ page's colours and a small reset, in the `narvi.base` layer below every component. Its colours are
124
+ copied from the tokens by `scripts/base-css.js` when the library is built, and a test checks them.
125
+ - **Layout props** on Stack and Grid take a value or values by breakpoint. They compile to static
126
+ classes: one rule reads a custom property per breakpoint (`src/lib/internal/layout.ts`), and each
127
+ value is a class that sets one of them (`src/lib/internal/responsive.ts` explains how).
61
128
  - **Components** live in `src/lib/components/<name>/<Name>.svelte`. Styles are created in the
62
129
  `<script module>` block and applied with the `attrs` helper from `src/lib/internal/sx.ts`, which
63
130
  also merges the consumer's `sx` and `class`. Interface text inherits the page's font; only large
64
131
  headings bring their own, a serif.
65
- - **Edges are shadows.** Hairlines and top highlights are drawn with `box-shadow`, so
132
+ - **Edges are shadows.** Hairlines are drawn with `box-shadow`, so
66
133
  `src/lib/internal/shared.ts` adds a transparent outline that becomes the edge in forced-colours
67
- mode. Control boundaries (`colors.edge`) hold 3:1 against their surface.
134
+ mode. Control boundaries (`colors.borderControl`) hold 3:1 against their surface.
68
135
  - **The Vite plugin** in `src/lib/vite.ts` is a preset over `@stylexjs/unplugin`. It puts every
69
- style in one cascade layer, `narvi`, so unlayered CSS beats it. `narvi({ tailwind: true })`
70
- orders that layer between Tailwind's `base` and its `components` and `utilities`.
136
+ style in one cascade layer, `narvi`, so unlayered CSS beats it, and declares `narvi.base` first
137
+ inside it, so `base.css` stays below the components whichever stylesheet loads first. `narvi({ tailwind: true })`
138
+ orders that layer between Tailwind's `base` and its `components` and `utilities`. It also says so
139
+ when it is listed before the Svelte plugin, and targets browsers that have `light-dark()`, so
140
+ Vite does not rewrite it in the app's own stylesheet.
71
141
 
72
- The look started as a study in `Frame` + `Card`: a tray around an inset panel, whose radius is the
73
- panel's radius plus the gap between them. Hover styles sit behind `@media (hover: hover) and (pointer: fine)` and
74
- movement behind `prefers-reduced-motion: no-preference`.
142
+ Hover styles sit behind `@media (hover: hover) and (pointer: fine)` and movement behind
143
+ `prefers-reduced-motion: no-preference`.
75
144
 
76
145
  ### Adding a component
77
146
 
@@ -84,8 +153,11 @@ movement behind `prefers-reduced-motion: no-preference`.
84
153
  Readers can press Edit to change the example and see it re-render as they type: the
85
154
  compiler and editor (`src/docs/live/`) load only then. Examples that define their own
86
155
  StyleX styles stay read-only, because StyleX compiles at build time.
87
- 4. Add the page to `src/docs/nav.ts`.
156
+ 4. Add the page to `src/docs/nav.ts`, with its sentence, what it exports and where its source is,
157
+ and a test in `src/tests`.
88
158
 
89
159
  Two StyleX rules to keep in mind: values inside `stylex.create` must be known at build time, so a
90
- constant such as a media query has to be defined in the same file, and tokens must be imported
91
- straight from `tokens.stylex.js`.
160
+ media query comes from `media.stylex.js` (or is written in the same file), and tokens and media
161
+ queries must be imported straight from their `.stylex.js` files. Use `media` throughout rather than
162
+ writing a condition out: StyleX ranks a constant condition above a written one, and orders constant
163
+ breakpoints by width only when they are in px.
package/dist/base.css ADDED
@@ -0,0 +1,96 @@
1
+ /*
2
+ * Narvi's base stylesheet: what a StyleX app needs on the document itself, and a small reset.
3
+ *
4
+ * @import '@diegopluna/narvi/base.css';
5
+ *
6
+ * It sits in `narvi.base`, the lowest layer of Narvi's own, so every component beats it, and
7
+ * any CSS of yours outside a layer beats both. The Narvi Vite plugin declares that layer
8
+ * first, so the order holds whichever stylesheet the browser reads first.
9
+ *
10
+ * A colour followed by a comment naming a token is copied from that token when the library
11
+ * is built (`scripts/base-css.js`), so the page and the components never drift apart.
12
+ */
13
+ @layer narvi.base {
14
+ *,
15
+ *::before,
16
+ *::after {
17
+ box-sizing: border-box;
18
+ }
19
+
20
+ :root {
21
+ /* Narvi's colours take their light or dark half from this. */
22
+ color-scheme: light dark;
23
+ /* The page, on the root rather than the body, so overscroll shows it too */
24
+ background-color: light-dark(#f3f4f5, #151618); /* colors.bg */
25
+ color: light-dark(#16181c, #eaedf2); /* colors.text */
26
+ /* Narvi's interface text inherits the page's face: set your own on the root */
27
+ font-family:
28
+ system-ui,
29
+ -apple-system,
30
+ 'Segoe UI',
31
+ Roboto,
32
+ sans-serif;
33
+ -webkit-text-size-adjust: 100%;
34
+ text-size-adjust: 100%;
35
+ -webkit-font-smoothing: antialiased;
36
+ -moz-osx-font-smoothing: grayscale;
37
+ text-rendering: optimizeLegibility;
38
+ }
39
+
40
+ body {
41
+ margin: 0;
42
+ }
43
+
44
+ /* Spacing comes from layout (Stack, Grid, gap), not from the browser's margins */
45
+ h1,
46
+ h2,
47
+ h3,
48
+ h4,
49
+ h5,
50
+ h6,
51
+ p,
52
+ blockquote,
53
+ figure,
54
+ dl,
55
+ dd,
56
+ pre {
57
+ margin: 0;
58
+ }
59
+
60
+ /* A list is laid out as you style it: no markers, no 40px indent */
61
+ ul,
62
+ ol,
63
+ menu {
64
+ margin: 0;
65
+ padding: 0;
66
+ list-style: none;
67
+ }
68
+
69
+ /* Media sit on their own line, and shrink with their container */
70
+ img,
71
+ picture,
72
+ svg,
73
+ video,
74
+ canvas,
75
+ audio,
76
+ iframe,
77
+ embed,
78
+ object {
79
+ display: block;
80
+ }
81
+
82
+ img,
83
+ video {
84
+ max-width: 100%;
85
+ height: auto;
86
+ }
87
+
88
+ /* Form controls take the page's face rather than the system's. Only the face: their size
89
+ and line height are left to the browser, or to the component, as without a reset. */
90
+ button,
91
+ input,
92
+ select,
93
+ textarea {
94
+ font-family: inherit;
95
+ }
96
+ }
package/dist/color.d.ts CHANGED
@@ -23,7 +23,7 @@ export type ResolveColorOptions = {
23
23
  * ```ts
24
24
  * import { colors } from '@diegopluna/narvi/tokens.stylex.js';
25
25
  *
26
- * context.fillStyle = resolveColor(colors.ithil);
26
+ * context.fillStyle = resolveColor(colors.accent);
27
27
  * ```
28
28
  */
29
29
  export declare function resolveColor(color: string, options?: ResolveColorOptions): string;
package/dist/color.js CHANGED
@@ -14,7 +14,7 @@
14
14
  * ```ts
15
15
  * import { colors } from '@diegopluna/narvi/tokens.stylex.js';
16
16
  *
17
- * context.fillStyle = resolveColor(colors.ithil);
17
+ * context.fillStyle = resolveColor(colors.accent);
18
18
  * ```
19
19
  */
20
20
  export function resolveColor(color, options = {}) {
@@ -4,7 +4,6 @@
4
4
  import type { HTMLAttributes } from 'svelte/elements';
5
5
  import Collapse from '../../internal/Collapse.svelte';
6
6
  import type { Sx } from '../../internal/sx.js';
7
- import { colors } from '../../tokens.stylex.js';
8
7
  import { getActivityContext } from './context.js';
9
8
 
10
9
  export type ActivityContentProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
@@ -14,23 +13,12 @@
14
13
  };
15
14
 
16
15
  const styles = stylex.create({
17
- // The steps hang from a rail that runs down through the middle of their tiles
18
16
  steps: {
19
- position: 'relative',
20
17
  display: 'flex',
21
18
  flexDirection: 'column',
22
- gap: '0.625rem',
23
- paddingTop: '0.625rem',
24
- paddingBottom: '0.25rem',
25
- '::before': {
26
- content: '""',
27
- position: 'absolute',
28
- top: 0,
29
- bottom: '0.875rem',
30
- insetInlineStart: 'calc(0.75rem - 0.5px)',
31
- width: '1px',
32
- backgroundImage: `linear-gradient(to bottom, ${colors.lineStrong}, ${colors.line})`
33
- }
19
+ gap: '0.5rem',
20
+ paddingTop: '0.5rem',
21
+ paddingBottom: '0.25rem'
34
22
  }
35
23
  });
36
24
  </script>
@@ -36,10 +36,10 @@
36
36
  const LABELS = { failed: 'Failed', declined: 'Declined', blocked: 'Blocked' };
37
37
 
38
38
  const styles = stylex.create({
39
- // The tile sits on the rail, in a column as wide as the row's own tile above
39
+ // The icon sits in a column as wide as the row's own icon above
40
40
  step: {
41
41
  display: 'grid',
42
- gridTemplateColumns: '1.5rem minmax(0, 1fr)',
42
+ gridTemplateColumns: '1rem minmax(0, 1fr)',
43
43
  columnGap: '0.625rem',
44
44
  rowGap: '0.375rem',
45
45
  minWidth: 0
@@ -58,8 +58,9 @@
58
58
  textOverflow: 'ellipsis',
59
59
  whiteSpace: 'nowrap',
60
60
  color: colors.textSubtle,
61
- fontFamily: font.mono,
62
- fontSize: font.sizeXs
61
+ // A `<code>`, in the text's own face
62
+ fontFamily: 'inherit',
63
+ fontSize: font.sizeCaption
63
64
  },
64
65
  // The file of a path, the program of a command: the part to read first
65
66
  main: { color: colors.text },
@@ -67,10 +68,10 @@
67
68
  flexShrink: 0,
68
69
  paddingBlock: '0.0625rem',
69
70
  paddingInline: '0.375rem',
70
- borderRadius: radius.lg,
71
+ borderRadius: radius.panel,
71
72
  backgroundColor: colors.dangerSoft,
72
- color: colors.dangerInk,
73
- fontSize: '0.6875rem',
73
+ color: colors.dangerText,
74
+ fontSize: font.sizeMicro,
74
75
  fontWeight: font.weightMedium
75
76
  },
76
77
  body: {
@@ -80,19 +81,18 @@
80
81
  gap: '0.375rem',
81
82
  minWidth: 0
82
83
  },
83
- reason: { margin: 0, color: colors.textMuted, fontSize: font.sizeSm },
84
+ reason: { margin: 0, color: colors.textMuted, fontSize: font.sizeMeta },
84
85
  output: {
85
86
  margin: 0,
86
87
  maxHeight: '10rem',
87
88
  overflow: 'auto',
88
89
  paddingBlock: '0.5rem',
89
90
  paddingInline: '0.625rem',
90
- borderRadius: radius.md,
91
- backgroundColor: colors.well,
92
- boxShadow: `inset 0 0 0 1px ${colors.line}`,
91
+ borderRadius: radius.control,
92
+ backgroundColor: colors.fillSunken,
93
93
  color: colors.textMuted,
94
94
  fontFamily: font.mono,
95
- fontSize: font.sizeXs,
95
+ fontSize: font.sizeCaption,
96
96
  lineHeight: font.leadingNormal,
97
97
  whiteSpace: 'pre-wrap',
98
98
  overflowWrap: 'anywhere',
@@ -1,4 +1,4 @@
1
- <!-- The agent's thinking between steps, on the rail with the steps, set apart in italics. -->
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
4
  import Tile from '../../internal/Tile.svelte';
@@ -16,7 +16,7 @@
16
16
  const styles = stylex.create({
17
17
  thought: {
18
18
  display: 'grid',
19
- gridTemplateColumns: '1.5rem minmax(0, 1fr)',
19
+ gridTemplateColumns: '1rem minmax(0, 1fr)',
20
20
  columnGap: '0.625rem',
21
21
  minWidth: 0
22
22
  },
@@ -24,14 +24,14 @@
24
24
  body: { display: 'flex', flexDirection: 'column', gap: '0.125rem', minWidth: 0 },
25
25
  label: {
26
26
  color: colors.textSubtle,
27
- fontSize: font.sizeXs,
27
+ fontSize: font.sizeCaption,
28
28
  fontWeight: font.weightMedium,
29
29
  lineHeight: '1.25rem'
30
30
  },
31
31
  text: {
32
32
  margin: 0,
33
33
  color: colors.textMuted,
34
- fontSize: font.sizeSm,
34
+ fontSize: font.sizeMeta,
35
35
  fontStyle: 'italic',
36
36
  lineHeight: font.leadingNormal
37
37
  }
@@ -7,6 +7,7 @@
7
7
  import { attrs, type Sx } from '../../internal/sx.js';
8
8
  import Tile from '../../internal/Tile.svelte';
9
9
  import { colors, font, motion, radius } from '../../tokens.stylex.js';
10
+ import { media } from '../../media.stylex.js';
10
11
  import RollingText from '../rolling-text/RollingText.svelte';
11
12
  import { getActivityContext } from './context.js';
12
13
 
@@ -24,8 +25,6 @@
24
25
  sx?: Sx;
25
26
  };
26
27
 
27
- const HOVER = '@media (hover: hover) and (pointer: fine)';
28
-
29
28
  const styles = stylex.create({
30
29
  trigger: {
31
30
  display: 'flex',
@@ -37,11 +36,11 @@
37
36
  margin: 0,
38
37
  padding: 0,
39
38
  borderWidth: 0,
40
- borderRadius: radius.xs,
39
+ borderRadius: radius.chip,
41
40
  backgroundColor: 'transparent',
42
- color: { default: colors.textMuted, ':hover': { default: null, [HOVER]: colors.text } },
41
+ color: { default: colors.textMuted, ':hover': { default: null, [media.hover]: colors.text } },
43
42
  fontFamily: 'inherit',
44
- fontSize: font.sizeMd,
43
+ fontSize: font.sizeBody,
45
44
  lineHeight: font.leadingSnug,
46
45
  textAlign: 'start',
47
46
  cursor: 'pointer',
@@ -96,7 +95,7 @@
96
95
  <span {...stylex.attrs(styles.text)}>
97
96
  <RollingText {text} shimmer={activity.active} />
98
97
  {#if activity.failures > 0}
99
- <span {...stylex.attrs(styles.failed)}>· {failedLabel(activity.failures)}</span>
98
+ <span {...stylex.attrs(styles.failed)}>{failedLabel(activity.failures)}</span>
100
99
  {/if}
101
100
  </span>
102
101
  <span {...stylex.attrs(styles.chevron)}><Chevron open={activity.open} size={12} /></span>
@@ -0,0 +1,89 @@
1
+ <!--
2
+ The window's own bar, across its full width, above the rail and the sheet.
3
+
4
+ It is where macOS's traffic lights sit in a window with a hidden title bar, so
5
+ nothing under it has to be as wide as they are: the rail can be as narrow as its
6
+ tiles. Teams, Slack and VS Code clear the lights the same way.
7
+ -->
8
+ <script lang="ts" module>
9
+ import * as stylex from '@stylexjs/stylex';
10
+ import type { Snippet } from 'svelte';
11
+ import type { HTMLAttributes } from 'svelte/elements';
12
+ import { shared } from '../../internal/shared.js';
13
+ import { attrs, type Sx } from '../../internal/sx.js';
14
+ import { useAppShell } from './context.js';
15
+
16
+ export type AppShellBarProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
17
+ /**
18
+ * Whether the bar drags the window, in Electron with a hidden title bar.
19
+ * Narvi's controls opt out on their own, so they still take clicks.
20
+ */
21
+ drag?: boolean;
22
+ /** What sits in the middle of the window, whatever is on either side: a search field. */
23
+ center?: Snippet;
24
+ /** What sits at the end: a panel's toggle, the person's avatar, window buttons. */
25
+ end?: Snippet;
26
+ sx?: Sx;
27
+ /** What sits at the start, after the traffic lights: AppShell.Toggle, back and forward. */
28
+ children?: Snippet;
29
+ };
30
+
31
+ const styles = stylex.create({
32
+ // Three columns, the outer two equal, so the middle one is centred on the window
33
+ bar: {
34
+ gridArea: 'bar',
35
+ display: 'grid',
36
+ gridTemplateColumns: 'minmax(0, 1fr) auto minmax(0, 1fr)',
37
+ alignItems: 'center',
38
+ columnGap: '0.5rem',
39
+ minWidth: 0,
40
+ height: '2.75rem',
41
+ // Back over the shell's gutter, to the window's edges
42
+ marginTop: '-0.375rem',
43
+ marginInline: '-0.375rem',
44
+ paddingInlineEnd: '0.75rem',
45
+ // Clear of the traffic lights. With none, a 28px control here is centred over the rail's tiles.
46
+ paddingInlineStart: 'calc(0.75rem + var(--narvi-window-inset, 0px))'
47
+ },
48
+ // Spelled out side by side: a longhand outranks the `margin` shorthand
49
+ narrow: { marginTop: 0, marginInline: 0 },
50
+ start: { display: 'flex', alignItems: 'center', gap: '0.125rem', minWidth: 0 },
51
+ center: { display: 'flex', justifyContent: 'center', minWidth: 0 },
52
+ end: {
53
+ display: 'flex',
54
+ alignItems: 'center',
55
+ justifyContent: 'flex-end',
56
+ gap: '0.25rem',
57
+ minWidth: 0
58
+ }
59
+ });
60
+ </script>
61
+
62
+ <script lang="ts">
63
+ let {
64
+ drag = true,
65
+ center,
66
+ end,
67
+ sx,
68
+ class: className,
69
+ children,
70
+ ...rest
71
+ }: AppShellBarProps = $props();
72
+
73
+ const shell = useAppShell('Bar');
74
+
75
+ $effect(() => {
76
+ shell.setBar(true);
77
+ return () => shell.setBar(false);
78
+ });
79
+ </script>
80
+
81
+ <header
82
+ data-slot="app-shell-bar"
83
+ {...rest}
84
+ {...attrs([styles.bar, shell.narrow && styles.narrow, drag && shared.dragRegion, sx], className)}
85
+ >
86
+ <div {...stylex.attrs(styles.start)}>{@render children?.()}</div>
87
+ <div {...stylex.attrs(styles.center)}>{@render center?.()}</div>
88
+ <div {...stylex.attrs(styles.end)}>{@render end?.()}</div>
89
+ </header>
@@ -0,0 +1,20 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import { type Sx } from '../../internal/sx.js';
4
+ export type AppShellBarProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
5
+ /**
6
+ * Whether the bar drags the window, in Electron with a hidden title bar.
7
+ * Narvi's controls opt out on their own, so they still take clicks.
8
+ */
9
+ drag?: boolean;
10
+ /** What sits in the middle of the window, whatever is on either side: a search field. */
11
+ center?: Snippet;
12
+ /** What sits at the end: a panel's toggle, the person's avatar, window buttons. */
13
+ end?: Snippet;
14
+ sx?: Sx;
15
+ /** What sits at the start, after the traffic lights: AppShell.Toggle, back and forward. */
16
+ children?: Snippet;
17
+ };
18
+ declare const AppShellBar: import("svelte").Component<AppShellBarProps, {}, "">;
19
+ type AppShellBar = ReturnType<typeof AppShellBar>;
20
+ export default AppShellBar;
@@ -1,48 +1,48 @@
1
+ <!--
2
+ The head of a column of the sheet: the page's title and its actions, or a
3
+ panel's tabs. Every column's head is the same height, so they sit on one line.
4
+ -->
1
5
  <script lang="ts" module>
2
6
  import * as stylex from '@stylexjs/stylex';
3
7
  import type { Snippet } from 'svelte';
4
8
  import type { HTMLAttributes } from 'svelte/elements';
5
9
  import { shared } from '../../internal/shared.js';
6
10
  import { attrs, type Sx } from '../../internal/sx.js';
7
- import { colors, font, motion } from '../../tokens.stylex.js';
11
+ import { colors, font } from '../../tokens.stylex.js';
8
12
 
9
13
  export type AppShellHeaderProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
10
14
  /**
11
- * Whether the bar drags the window, in Electron with a hidden title bar.
12
- * Narvi's controls opt out on their own, so they still take clicks.
15
+ * Whether it drags the window, in Electron. Off by default: AppShell.Bar is the
16
+ * window's drag region. Turn it on in a shell that has no bar.
13
17
  */
14
18
  drag?: boolean;
15
19
  sx?: Sx;
16
20
  children?: Snippet;
17
21
  };
18
22
 
19
- const MOTION = '@media (prefers-reduced-motion: no-preference)';
20
-
21
23
  const styles = stylex.create({
22
24
  header: {
25
+ boxSizing: 'border-box',
23
26
  display: 'flex',
24
27
  alignItems: 'center',
25
28
  gap: '0.5rem',
26
29
  flexShrink: 0,
27
- height: '3.25rem',
28
- paddingInlineEnd: '0.75rem',
29
- // Clear of the traffic lights, for whatever part of them the sidebar
30
- // does not cover now. It moves with the sidebar.
31
- paddingInlineStart:
32
- 'calc(0.75rem + max(0px, var(--narvi-window-inset, 0px) - var(--narvi-sidebar-taken, 0px)))',
30
+ minWidth: 0,
31
+ height: '3rem',
32
+ // The same edge as Sidebar.Header, and as a Conversation's column under it. In a shell
33
+ // with no bar, clear of the traffic lights while the sidebar is away.
34
+ paddingInlineStart: 'max(1rem, calc(var(--narvi-inset-page, 0px) + 0.5rem))',
35
+ paddingInlineEnd: '0.625rem',
33
36
  borderBottomWidth: '1px',
34
37
  borderBottomStyle: 'solid',
35
- borderBottomColor: colors.line,
36
- fontSize: font.sizeMd,
37
- transitionProperty: { default: 'none', [MOTION]: 'padding-inline-start' },
38
- transitionDuration: motion.slow,
39
- transitionTimingFunction: motion.easeInOut
38
+ borderBottomColor: colors.border,
39
+ fontSize: font.sizeBody
40
40
  }
41
41
  });
42
42
  </script>
43
43
 
44
44
  <script lang="ts">
45
- let { drag = true, sx, class: className, children, ...rest }: AppShellHeaderProps = $props();
45
+ let { drag = false, sx, class: className, children, ...rest }: AppShellHeaderProps = $props();
46
46
  </script>
47
47
 
48
48
  <header