@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
@@ -3,17 +3,38 @@
3
3
  import type { Snippet } from 'svelte';
4
4
  import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
5
5
  import { shared } from '../../internal/shared.js';
6
- import { attrs, type Sx } from '../../internal/sx.js';
6
+ import { attrs, classes, type Sx } from '../../internal/sx.js';
7
7
  import { colors, font, motion, radius } from '../../tokens.stylex.js';
8
8
  import { media } from '../../media.stylex.js';
9
9
  import Spinner from '../spinner/Spinner.svelte';
10
10
 
11
- export type ButtonVariant = 'primary' | 'secondary' | 'soft' | 'ghost' | 'danger';
12
- export type ButtonSize = 'sm' | 'md' | 'lg';
11
+ /**
12
+ * `primary` is the one solid; `secondary` an edge; `soft` a fill of the accent. `ghost` has
13
+ * a fill only under the pointer, `bare` never has one, and `link` is words that underline.
14
+ * `floating` stands over content. The rest say what pressing them does: `danger` (solid),
15
+ * `danger-outline`, `ghost-danger`, `warning-outline` and `success-outline`.
16
+ */
17
+ export type ButtonVariant =
18
+ | 'primary'
19
+ | 'secondary'
20
+ | 'soft'
21
+ | 'ghost'
22
+ | 'bare'
23
+ | 'link'
24
+ | 'floating'
25
+ | 'danger'
26
+ | 'danger-outline'
27
+ | 'ghost-danger'
28
+ | 'warning-outline'
29
+ | 'success-outline';
30
+ export type ButtonSize = 'micro' | 'xs' | 'sm' | 'md' | 'lg';
31
+ export type ButtonShape = 'default' | 'pill';
13
32
 
14
33
  export type ButtonProps = Omit<HTMLButtonAttributes & HTMLAnchorAttributes, 'children'> & {
15
34
  variant?: ButtonVariant;
16
35
  size?: ButtonSize;
36
+ /** `pill` rounds the ends fully: for a chip, or a button that floats. */
37
+ shape?: ButtonShape;
17
38
  /** Shows a spinner and blocks interaction while keeping the button's width. */
18
39
  loading?: boolean;
19
40
  disabled?: boolean;
@@ -26,8 +47,14 @@
26
47
  children?: Snippet;
27
48
  };
28
49
 
50
+ // One key for every hover, so the catalog can show it without a pointer
51
+ const HOVER = ':is(:hover, [data-preview~="hover"])';
52
+
29
53
  const styles = stylex.create({
30
54
  base: {
55
+ // A key hint inside takes the button's own ink, whatever it stands on
56
+ '--narvi-kbd-fill': 'color-mix(in srgb, currentColor 14%, transparent)',
57
+ '--narvi-kbd-ink': 'currentColor',
31
58
  position: 'relative',
32
59
  display: 'inline-flex',
33
60
  alignItems: 'center',
@@ -59,91 +86,171 @@
59
86
  }
60
87
  },
61
88
 
62
- // Sizes. Small and medium extend their hit area to 40px without moving the layout.
89
+ // Sizes. All but the large one extend their hit area to 40px without moving the layout.
90
+ micro: {
91
+ minHeight: '1.25rem',
92
+ paddingInline: '0.375rem',
93
+ gap: '0.25rem',
94
+ borderRadius: radius.chip,
95
+ fontSize: font.sizeCaption,
96
+ '::after': { content: '""', position: 'absolute', insetInline: 0, insetBlock: '-10px' }
97
+ },
98
+ xs: {
99
+ minHeight: '1.5rem',
100
+ paddingInline: '0.5rem',
101
+ gap: '0.3125rem',
102
+ borderRadius: radius.item,
103
+ fontSize: font.sizeMeta,
104
+ '::after': { content: '""', position: 'absolute', insetInline: 0, insetBlock: '-8px' }
105
+ },
63
106
  sm: {
64
107
  minHeight: '1.75rem',
65
108
  paddingInline: '0.625rem',
66
109
  gap: '0.375rem',
67
- borderRadius: radius.sm,
68
- fontSize: font.sizeSm,
110
+ borderRadius: radius.item,
111
+ fontSize: font.sizeMeta,
69
112
  '::after': { content: '""', position: 'absolute', insetInline: 0, insetBlock: '-6px' }
70
113
  },
71
114
  md: {
72
115
  minHeight: '2rem',
73
116
  paddingInline: '0.75rem',
74
117
  gap: '0.4375rem',
75
- borderRadius: radius.md,
76
- fontSize: font.sizeMd,
118
+ borderRadius: radius.control,
119
+ fontSize: font.sizeBody,
77
120
  '::after': { content: '""', position: 'absolute', insetInline: 0, insetBlock: '-4px' }
78
121
  },
79
122
  lg: {
80
123
  minHeight: '2.5rem',
81
124
  paddingInline: '1rem',
82
125
  gap: '0.5rem',
83
- borderRadius: radius.lg,
84
- fontSize: '0.9375rem'
126
+ borderRadius: radius.panel,
127
+ fontSize: font.sizeReading
85
128
  },
129
+ iconMicro: { width: '1.25rem', paddingInline: 0 },
130
+ iconXs: { width: '1.5rem', paddingInline: 0 },
86
131
  iconSm: { width: '1.75rem', paddingInline: 0 },
87
132
  iconMd: { width: '2rem', paddingInline: 0 },
88
133
  iconLg: { width: '2.5rem', paddingInline: 0 },
89
134
 
90
- // Mithril: a small piece of bright metal
135
+ pill: { borderRadius: radius.pill },
136
+
137
+ // Primary: the one solid, flat, in the text's own colour
91
138
  primary: {
92
- color: colors.onMithril,
93
- backgroundImage: `linear-gradient(180deg, ${colors.mithrilTop}, ${colors.mithrilBottom})`,
94
- boxShadow: `inset 0 1px 0 ${colors.mithrilEdge}, inset 0 -1px 0 rgb(0 0 0 / 0.14), 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 22px -10px ${colors.mithrilDrop}`,
95
- filter: { default: null, ':hover': { default: null, [media.hover]: 'brightness(1.06)' } },
96
- // The deeper hover shadow is a layer of its own that fades in. Fading
97
- // opacity is cheap; animating the shadow itself repaints it every frame.
98
- '::before': {
99
- content: '""',
100
- position: 'absolute',
101
- inset: 0,
102
- borderRadius: 'inherit',
103
- boxShadow: `0 12px 22px -10px ${colors.mithrilDrop}`,
104
- opacity: { default: 0, ':hover': { default: null, [media.hover]: 1 } },
105
- pointerEvents: 'none',
106
- transitionProperty: 'opacity',
107
- transitionDuration: motion.base,
108
- transitionTimingFunction: 'ease'
109
- }
139
+ color: colors.onPrimary,
140
+ backgroundColor: colors.primary,
141
+ opacity: { default: null, [HOVER]: { default: null, [media.hover]: 0.88 } }
110
142
  },
111
143
  secondary: {
112
144
  color: colors.text,
113
145
  backgroundColor: {
114
- default: colors.surfaceRaised,
115
- ':hover': { default: null, [media.hover]: colors.hover }
146
+ default: 'transparent',
147
+ [HOVER]: { default: null, [media.hover]: colors.fillHover }
116
148
  },
117
- boxShadow: `inset 0 0 0 1px ${colors.lineStrong}, inset 0 1px 0 ${colors.highlight}, 0 1px 2px ${colors.shade}`
149
+ boxShadow: `inset 0 0 0 1px ${colors.borderStrong}`
118
150
  },
119
151
  soft: {
120
- color: colors.ithil,
152
+ color: colors.accent,
121
153
  backgroundColor: {
122
- default: colors.ithilSoft,
123
- ':hover': { default: null, [media.hover]: colors.focusHalo }
154
+ default: colors.accentSoft,
155
+ [HOVER]: { default: null, [media.hover]: colors.focusHalo }
124
156
  }
125
157
  },
126
158
  ghost: {
127
159
  color: {
128
160
  default: colors.textMuted,
129
- ':hover': { default: null, [media.hover]: colors.text }
161
+ [HOVER]: { default: null, [media.hover]: colors.text }
130
162
  },
131
163
  backgroundColor: {
132
164
  default: 'transparent',
133
- ':hover': { default: null, [media.hover]: colors.hover }
165
+ [HOVER]: { default: null, [media.hover]: colors.fillHover }
166
+ }
167
+ },
168
+ // No surface in any state: for a control on a shape that already frames it
169
+ bare: {
170
+ color: {
171
+ default: colors.textMuted,
172
+ [HOVER]: { default: null, [media.hover]: colors.text }
173
+ },
174
+ backgroundColor: 'transparent'
175
+ },
176
+ // Words that act: underlined under the pointer, as a link is
177
+ link: {
178
+ color: colors.text,
179
+ backgroundColor: 'transparent',
180
+ textDecorationLine: {
181
+ default: 'none',
182
+ [HOVER]: { default: null, [media.hover]: 'underline' }
183
+ },
184
+ textUnderlineOffset: '0.2em'
185
+ },
186
+ // Stands over content, so it is one of the few things with a shadow
187
+ floating: {
188
+ color: {
189
+ default: colors.textMuted,
190
+ [HOVER]: { default: null, [media.hover]: colors.text }
191
+ },
192
+ backgroundColor: colors.bgRaised,
193
+ boxShadow: {
194
+ default: `inset 0 0 0 1px ${colors.border}, 0 6px 16px -6px ${colors.shadow}`,
195
+ [HOVER]: {
196
+ default: null,
197
+ [media.hover]: `inset 0 0 0 1px ${colors.borderStrong}, 0 6px 16px -6px ${colors.shadow}`
198
+ }
134
199
  }
135
200
  },
201
+ // What cannot be undone, as a solid: the one press a dialog is asking for
136
202
  danger: {
203
+ color: colors.bgRaised,
204
+ backgroundColor: colors.danger,
205
+ opacity: { default: null, [HOVER]: { default: null, [media.hover]: 0.88 } }
206
+ },
207
+ dangerOutline: {
137
208
  color: colors.danger,
138
209
  backgroundColor: {
139
210
  default: 'transparent',
140
- ':hover': {
211
+ [HOVER]: {
141
212
  default: null,
142
213
  [media.hover]: `color-mix(in oklab, ${colors.danger} 12%, transparent)`
143
214
  }
144
215
  },
145
216
  boxShadow: `inset 0 0 0 1px color-mix(in oklab, ${colors.danger} 45%, transparent)`
146
217
  },
218
+ // Quiet until the pointer is on it: an icon that deletes
219
+ ghostDanger: {
220
+ color: {
221
+ default: colors.textMuted,
222
+ [HOVER]: { default: null, [media.hover]: colors.danger }
223
+ },
224
+ backgroundColor: {
225
+ default: 'transparent',
226
+ [HOVER]: {
227
+ default: null,
228
+ [media.hover]: `color-mix(in oklab, ${colors.danger} 12%, transparent)`
229
+ }
230
+ }
231
+ },
232
+ warningOutline: {
233
+ color: colors.warning,
234
+ backgroundColor: {
235
+ default: 'transparent',
236
+ [HOVER]: {
237
+ default: null,
238
+ [media.hover]: `color-mix(in oklab, ${colors.warning} 12%, transparent)`
239
+ }
240
+ },
241
+ boxShadow: `inset 0 0 0 1px color-mix(in oklab, ${colors.warning} 45%, transparent)`
242
+ },
243
+ successOutline: {
244
+ color: colors.success,
245
+ backgroundColor: {
246
+ default: 'transparent',
247
+ [HOVER]: {
248
+ default: null,
249
+ [media.hover]: `color-mix(in oklab, ${colors.success} 12%, transparent)`
250
+ }
251
+ },
252
+ boxShadow: `inset 0 0 0 1px color-mix(in oklab, ${colors.success} 45%, transparent)`
253
+ },
147
254
 
148
255
  // States
149
256
  disabled: {
@@ -155,10 +262,13 @@
155
262
  cursor: 'progress',
156
263
  pointerEvents: 'none'
157
264
  },
265
+ // As wide as the button, so in a wide one something inside can be pushed to the end
158
266
  content: {
159
267
  display: 'inline-flex',
160
268
  alignItems: 'center',
161
269
  justifyContent: 'center',
270
+ flexGrow: 1,
271
+ minWidth: 0,
162
272
  gap: 'inherit',
163
273
  transitionProperty: { default: 'opacity', [media.motion]: 'opacity, filter' },
164
274
  transitionDuration: motion.base,
@@ -185,13 +295,81 @@
185
295
  }
186
296
  });
187
297
 
188
- const iconStyles = { sm: styles.iconSm, md: styles.iconMd, lg: styles.iconLg };
298
+ const iconStyles = {
299
+ micro: styles.iconMicro,
300
+ xs: styles.iconXs,
301
+ sm: styles.iconSm,
302
+ md: styles.iconMd,
303
+ lg: styles.iconLg
304
+ };
305
+ const variantStyles = {
306
+ primary: styles.primary,
307
+ secondary: styles.secondary,
308
+ soft: styles.soft,
309
+ ghost: styles.ghost,
310
+ bare: styles.bare,
311
+ link: styles.link,
312
+ floating: styles.floating,
313
+ danger: styles.danger,
314
+ 'danger-outline': styles.dangerOutline,
315
+ 'ghost-danger': styles.ghostDanger,
316
+ 'warning-outline': styles.warningOutline,
317
+ 'success-outline': styles.successOutline
318
+ };
319
+
320
+ /**
321
+ * A button as markup, as the component draws one that is neither loading nor disabled:
322
+ * for the parts of Markdown that are written as a string. `attributes` are written as
323
+ * given, so they must be escaped already, and `inner` is markup.
324
+ */
325
+ export function buttonHtml(options: {
326
+ variant: NonNullable<ButtonProps['variant']>;
327
+ size: NonNullable<ButtonProps['size']>;
328
+ iconOnly?: boolean;
329
+ shape?: ButtonShape;
330
+ sx?: Sx;
331
+ attributes?: string;
332
+ inner: string;
333
+ /**
334
+ * Without the element the component keeps around a button's contents (which it hides
335
+ * while the button is loading): for a button that holds one icon and is never loading.
336
+ */
337
+ bare?: boolean;
338
+ }): string {
339
+ const { attributes = '', inner, bare = false } = options;
340
+ const name = buttonClass(options);
341
+ return bare
342
+ ? `<button type="button"${attributes} class="${name}">${inner}</button>`
343
+ : `<button type="button"${attributes} class="${name}"><span class="${contentClass}">${inner}</span></button>`;
344
+ }
345
+
346
+ /** The classes of a button that is neither loading nor disabled. */
347
+ export function buttonClass(options: {
348
+ variant: NonNullable<ButtonProps['variant']>;
349
+ size: NonNullable<ButtonProps['size']>;
350
+ iconOnly?: boolean;
351
+ shape?: ButtonShape;
352
+ sx?: Sx;
353
+ }): string {
354
+ const { variant, size, iconOnly = false, shape = 'default', sx } = options;
355
+ return classes(
356
+ styles.base,
357
+ shared.focusable,
358
+ styles[size],
359
+ iconOnly && iconStyles[size],
360
+ (shape === 'pill' || variant === 'floating') && styles.pill,
361
+ variantStyles[variant],
362
+ sx
363
+ );
364
+ }
365
+ const contentClass = classes(styles.content);
189
366
  </script>
190
367
 
191
368
  <script lang="ts">
192
369
  let {
193
370
  variant = 'secondary',
194
371
  size = 'md',
372
+ shape = 'default',
195
373
  loading = false,
196
374
  disabled = false,
197
375
  iconOnly = false,
@@ -213,7 +391,8 @@
213
391
  shared.focusable,
214
392
  styles[size],
215
393
  iconOnly && iconStyles[size],
216
- styles[variant],
394
+ (shape === 'pill' || variant === 'floating') && styles.pill,
395
+ variantStyles[variant],
217
396
  disabled && styles.disabled,
218
397
  loading && styles.loading,
219
398
  sx
@@ -1,11 +1,20 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
3
3
  import { type Sx } from '../../internal/sx.js';
4
- export type ButtonVariant = 'primary' | 'secondary' | 'soft' | 'ghost' | 'danger';
5
- export type ButtonSize = 'sm' | 'md' | 'lg';
4
+ /**
5
+ * `primary` is the one solid; `secondary` an edge; `soft` a fill of the accent. `ghost` has
6
+ * a fill only under the pointer, `bare` never has one, and `link` is words that underline.
7
+ * `floating` stands over content. The rest say what pressing them does: `danger` (solid),
8
+ * `danger-outline`, `ghost-danger`, `warning-outline` and `success-outline`.
9
+ */
10
+ export type ButtonVariant = 'primary' | 'secondary' | 'soft' | 'ghost' | 'bare' | 'link' | 'floating' | 'danger' | 'danger-outline' | 'ghost-danger' | 'warning-outline' | 'success-outline';
11
+ export type ButtonSize = 'micro' | 'xs' | 'sm' | 'md' | 'lg';
12
+ export type ButtonShape = 'default' | 'pill';
6
13
  export type ButtonProps = Omit<HTMLButtonAttributes & HTMLAnchorAttributes, 'children'> & {
7
14
  variant?: ButtonVariant;
8
15
  size?: ButtonSize;
16
+ /** `pill` rounds the ends fully: for a chip, or a button that floats. */
17
+ shape?: ButtonShape;
9
18
  /** Shows a spinner and blocks interaction while keeping the button's width. */
10
19
  loading?: boolean;
11
20
  disabled?: boolean;
@@ -17,6 +26,33 @@ export type ButtonProps = Omit<HTMLButtonAttributes & HTMLAnchorAttributes, 'chi
17
26
  ref?: HTMLButtonElement | HTMLAnchorElement | null;
18
27
  children?: Snippet;
19
28
  };
29
+ /**
30
+ * A button as markup, as the component draws one that is neither loading nor disabled:
31
+ * for the parts of Markdown that are written as a string. `attributes` are written as
32
+ * given, so they must be escaped already, and `inner` is markup.
33
+ */
34
+ export declare function buttonHtml(options: {
35
+ variant: NonNullable<ButtonProps['variant']>;
36
+ size: NonNullable<ButtonProps['size']>;
37
+ iconOnly?: boolean;
38
+ shape?: ButtonShape;
39
+ sx?: Sx;
40
+ attributes?: string;
41
+ inner: string;
42
+ /**
43
+ * Without the element the component keeps around a button's contents (which it hides
44
+ * while the button is loading): for a button that holds one icon and is never loading.
45
+ */
46
+ bare?: boolean;
47
+ }): string;
48
+ /** The classes of a button that is neither loading nor disabled. */
49
+ export declare function buttonClass(options: {
50
+ variant: NonNullable<ButtonProps['variant']>;
51
+ size: NonNullable<ButtonProps['size']>;
52
+ iconOnly?: boolean;
53
+ shape?: ButtonShape;
54
+ sx?: Sx;
55
+ }): string;
20
56
  declare const Button: import("svelte").Component<ButtonProps, {}, "ref">;
21
57
  type Button = ReturnType<typeof Button>;
22
58
  export default Button;
@@ -30,21 +30,20 @@
30
30
  base: {
31
31
  boxSizing: 'border-box',
32
32
  minWidth: 0,
33
- borderRadius: radius.xl,
33
+ borderRadius: radius.card,
34
34
  color: colors.text,
35
35
  fontFamily: font.body
36
36
  },
37
+ // Three ways to hold something: a surface a step above the page, a line alone, a fill alone
37
38
  raised: {
38
39
  backgroundColor: colors.bgRaised,
39
- boxShadow: `inset 0 0 0 1px ${colors.line}, 0 1px 2px ${colors.shade}, 0 12px 24px -16px ${colors.shade}`
40
+ boxShadow: `inset 0 0 0 1px ${colors.border}`
40
41
  },
41
42
  outlined: {
42
- backgroundColor: colors.bgRaised,
43
- boxShadow: `inset 0 0 0 1px ${colors.line}`
43
+ boxShadow: `inset 0 0 0 1px ${colors.border}`
44
44
  },
45
45
  filled: {
46
- backgroundColor: colors.well,
47
- boxShadow: `inset 0 0 0 1px ${colors.line}, inset 0 1px 2px ${colors.shade}`
46
+ backgroundColor: colors.fillSunken
48
47
  },
49
48
  none: { padding: 0 },
50
49
  sm: { padding: space.x3 },
@@ -69,41 +68,31 @@
69
68
  [media.motion]: `${motion.easeOut}, ease, ease`
70
69
  }
71
70
  },
72
- // On hover the surface lifts a step and its edge firms up, as a control's does
71
+ // On hover its edge firms up, as a control's does
73
72
  raisedLink: {
74
- backgroundColor: {
75
- default: colors.bgRaised,
76
- ':hover': { default: null, [media.hover]: colors.surfaceRaised }
77
- },
73
+ backgroundColor: colors.bgRaised,
78
74
  boxShadow: {
79
- default: `inset 0 0 0 1px ${colors.line}, 0 1px 2px ${colors.shade}, 0 12px 24px -16px ${colors.shade}`,
75
+ default: `inset 0 0 0 1px ${colors.border}`,
80
76
  ':hover': {
81
77
  default: null,
82
- [media.hover]: `inset 0 0 0 1px ${colors.lineStrong}, 0 1px 2px ${colors.shade}, 0 14px 28px -16px ${colors.shade}`
78
+ [media.hover]: `inset 0 0 0 1px ${colors.borderStrong}`
83
79
  }
84
80
  }
85
81
  },
86
82
  outlinedLink: {
87
83
  backgroundColor: {
88
- default: colors.bgRaised,
89
- ':hover': { default: null, [media.hover]: colors.surfaceRaised }
84
+ default: 'transparent',
85
+ ':hover': { default: null, [media.hover]: colors.fillHover }
90
86
  },
91
87
  boxShadow: {
92
- default: `inset 0 0 0 1px ${colors.line}`,
93
- ':hover': { default: null, [media.hover]: `inset 0 0 0 1px ${colors.lineStrong}` }
88
+ default: `inset 0 0 0 1px ${colors.border}`,
89
+ ':hover': { default: null, [media.hover]: `inset 0 0 0 1px ${colors.borderStrong}` }
94
90
  }
95
91
  },
96
92
  filledLink: {
97
93
  backgroundColor: {
98
- default: colors.well,
99
- ':hover': { default: null, [media.hover]: colors.hover }
100
- },
101
- boxShadow: {
102
- default: `inset 0 0 0 1px ${colors.line}, inset 0 1px 2px ${colors.shade}`,
103
- ':hover': {
104
- default: null,
105
- [media.hover]: `inset 0 0 0 1px ${colors.lineStrong}, inset 0 1px 2px ${colors.shade}`
106
- }
94
+ default: colors.fillSunken,
95
+ ':hover': { default: null, [media.hover]: colors.fillSelected }
107
96
  }
108
97
  }
109
98
  });
@@ -19,8 +19,7 @@
19
19
  stats: {
20
20
  display: 'inline-flex',
21
21
  gap: '0.375rem',
22
- fontFamily: font.mono,
23
- fontSize: font.sizeXs,
22
+ fontSize: font.sizeCaption,
24
23
  fontVariantNumeric: 'tabular-nums',
25
24
  whiteSpace: 'nowrap'
26
25
  },
@@ -3,6 +3,7 @@
3
3
  import * as stylex from '@stylexjs/stylex';
4
4
  import { attrs, type Sx } from '../../internal/sx.js';
5
5
  import { colors, font, radius } from '../../tokens.stylex.js';
6
+ import { media } from '../../media.stylex.js';
6
7
  import Button from '../button/Button.svelte';
7
8
  import ChangeStats from '../change-stats/ChangeStats.svelte';
8
9
 
@@ -31,9 +32,8 @@
31
32
  display: 'flex',
32
33
  flexDirection: 'column',
33
34
  overflow: 'hidden',
34
- borderRadius: radius.lg,
35
- backgroundColor: colors.surface,
36
- boxShadow: `inset 0 0 0 1px ${colors.line}`
35
+ borderRadius: radius.panel,
36
+ boxShadow: `inset 0 0 0 1px ${colors.border}`
37
37
  },
38
38
  head: {
39
39
  display: 'flex',
@@ -44,9 +44,9 @@
44
44
  paddingInlineEnd: '0.375rem',
45
45
  borderBottomWidth: '1px',
46
46
  borderBottomStyle: 'solid',
47
- borderBottomColor: colors.line
47
+ borderBottomColor: colors.border
48
48
  },
49
- title: { flexGrow: 1, margin: 0, fontSize: font.sizeMd, fontWeight: font.weightMedium },
49
+ title: { flexGrow: 1, margin: 0, fontSize: font.sizeBody, fontWeight: font.weightMedium },
50
50
  list: { margin: 0, padding: '0.25rem', listStyleType: 'none' },
51
51
  file: {
52
52
  display: 'flex',
@@ -57,14 +57,13 @@
57
57
  margin: 0,
58
58
  paddingInline: '0.5rem',
59
59
  borderWidth: 0,
60
- borderRadius: radius.md,
60
+ borderRadius: radius.control,
61
61
  backgroundColor: {
62
62
  default: 'transparent',
63
- ':hover': { default: null, '@media (hover: hover)': colors.hover }
63
+ ':hover': { default: null, [media.hover]: colors.fillHover }
64
64
  },
65
65
  color: colors.textMuted,
66
- fontFamily: font.mono,
67
- fontSize: font.sizeXs,
66
+ fontSize: font.sizeCaption,
68
67
  textAlign: 'start',
69
68
  cursor: 'pointer',
70
69
  outlineStyle: 'solid',
@@ -80,14 +79,14 @@
80
79
  flexShrink: 0,
81
80
  width: '1.125rem',
82
81
  height: '1.125rem',
83
- borderRadius: radius.xs,
84
- fontSize: '0.6875rem',
82
+ borderRadius: radius.chip,
83
+ fontSize: font.sizeMicro,
85
84
  fontWeight: font.weightSemibold
86
85
  },
87
- added: { backgroundColor: colors.successSoft, color: colors.successInk },
88
- modified: { backgroundColor: colors.warningSoft, color: colors.warningInk },
89
- renamed: { backgroundColor: colors.warningSoft, color: colors.warningInk },
90
- deleted: { backgroundColor: colors.dangerSoft, color: colors.dangerInk },
86
+ added: { backgroundColor: colors.successSoft, color: colors.successText },
87
+ modified: { backgroundColor: colors.warningSoft, color: colors.warningText },
88
+ renamed: { backgroundColor: colors.warningSoft, color: colors.warningText },
89
+ deleted: { backgroundColor: colors.dangerSoft, color: colors.dangerText },
91
90
  // The file name, the part to read first
92
91
  name: { color: colors.text },
93
92
  // Long paths lose their start, which matters least, not their file name
@@ -2,7 +2,7 @@
2
2
  import * as stylex from '@stylexjs/stylex';
3
3
  import type { Snippet } from 'svelte';
4
4
  import type { HTMLInputAttributes } from 'svelte/elements';
5
- import { attrs, type Sx } from '../../internal/sx.js';
5
+ import { attrs, classes, type Sx } from '../../internal/sx.js';
6
6
  import { colors, font, motion, radius } from '../../tokens.stylex.js';
7
7
  import { media } from '../../media.stylex.js';
8
8
 
@@ -30,7 +30,7 @@
30
30
  gap: '0.625rem',
31
31
  color: colors.text,
32
32
  fontFamily: font.body,
33
- fontSize: font.sizeMd,
33
+ fontSize: font.sizeBody,
34
34
  lineHeight: '1.25rem',
35
35
  cursor: 'pointer',
36
36
  WebkitTapHighlightColor: 'transparent'
@@ -42,7 +42,7 @@
42
42
  description: {
43
43
  display: 'block',
44
44
  color: colors.textSubtle,
45
- fontSize: font.sizeXs,
45
+ fontSize: font.sizeCaption,
46
46
  lineHeight: font.leadingSnug
47
47
  },
48
48
  input: {
@@ -58,31 +58,26 @@
58
58
  marginBlock: '2px',
59
59
  borderWidth: '1px',
60
60
  borderStyle: 'solid',
61
- borderRadius: radius.xs,
61
+ borderRadius: radius.chip,
62
62
  borderColor: {
63
- default: colors.edge,
64
- ':hover': { default: null, [media.hover]: colors.edgeHover },
63
+ default: colors.borderControl,
64
+ ':hover': { default: null, [media.hover]: colors.borderControlHover },
65
65
  ':checked': 'transparent',
66
66
  ':indeterminate': 'transparent',
67
67
  [media.forcedColors]: 'ButtonText'
68
68
  },
69
- backgroundColor: { default: colors.well, [media.forcedColors]: 'Canvas' },
69
+ backgroundColor: { default: 'transparent', [media.forcedColors]: 'Canvas' },
70
70
  backgroundOrigin: 'border-box',
71
71
  backgroundImage: {
72
72
  default: 'none',
73
- ':checked': `linear-gradient(180deg, ${colors.ithil}, ${colors.ithilStrong})`,
74
- ':indeterminate': `linear-gradient(180deg, ${colors.ithil}, ${colors.ithilStrong})`,
73
+ ':checked': `linear-gradient(${colors.accent}, ${colors.accent})`,
74
+ ':indeterminate': `linear-gradient(${colors.accent}, ${colors.accent})`,
75
75
  [media.forcedColors]: {
76
76
  default: 'none',
77
77
  ':checked': 'linear-gradient(Highlight, Highlight)',
78
78
  ':indeterminate': 'linear-gradient(Highlight, Highlight)'
79
79
  }
80
80
  },
81
- boxShadow: {
82
- default: `inset 0 1px 2px ${colors.shade}`,
83
- ':checked': `inset 0 1px 0 rgb(255 255 255 / 0.4), 0 0 6px ${colors.glow}`,
84
- ':indeterminate': `inset 0 1px 0 rgb(255 255 255 / 0.4), 0 0 6px ${colors.glow}`
85
- },
86
81
  forcedColorAdjust: 'none',
87
82
  appearance: 'none',
88
83
  cursor: { default: 'pointer', ':disabled': 'not-allowed' },
@@ -98,7 +93,7 @@
98
93
  content: '""',
99
94
  width: '0.625rem',
100
95
  height: '0.625rem',
101
- backgroundColor: { default: colors.onIthil, [media.forcedColors]: 'HighlightText' },
96
+ backgroundColor: { default: colors.onAccent, [media.forcedColors]: 'HighlightText' },
102
97
  maskImage: { default: CHECK, ':indeterminate': DASH },
103
98
  maskSize: 'contain',
104
99
  maskRepeat: 'no-repeat',
@@ -134,6 +129,14 @@
134
129
  }
135
130
  }
136
131
  });
132
+
133
+ /**
134
+ * The class of a checkbox that stands alone, as the component gives it one: for the parts
135
+ * of Markdown that are written as a string.
136
+ */
137
+ export function checkboxClass(sx?: Sx): string {
138
+ return classes(styles.input, styles.standalone, sx);
139
+ }
137
140
  </script>
138
141
 
139
142
  <script lang="ts">