@diegopluna/narvi 0.3.11 → 0.3.12

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 (86) hide show
  1. package/dist/components/activity/ActivityContent.svelte +7 -3
  2. package/dist/components/activity/ActivityStep.svelte +9 -6
  3. package/dist/components/activity/ActivityTrigger.svelte +5 -2
  4. package/dist/components/app-shell/AppShellBar.svelte +9 -4
  5. package/dist/components/app-shell/AppShellHeader.svelte +9 -5
  6. package/dist/components/approval/Approval.svelte +7 -4
  7. package/dist/components/button/Button.svelte +50 -26
  8. package/dist/components/card/Card.svelte +5 -2
  9. package/dist/components/changes-summary/ChangesSummary.svelte +11 -8
  10. package/dist/components/choice-cards/ChoiceCards.svelte +5 -2
  11. package/dist/components/collapsible/CollapsibleTrigger.svelte +5 -2
  12. package/dist/components/color-field/ColorField.svelte +9 -6
  13. package/dist/components/command/styles.d.ts +8 -8
  14. package/dist/components/command/styles.js +11 -9
  15. package/dist/components/composer/ComposerAttachment.svelte +7 -3
  16. package/dist/components/composer/ComposerAttachments.svelte +5 -1
  17. package/dist/components/composer/ComposerModelPicker.svelte +37 -34
  18. package/dist/components/composer/ComposerRoot.svelte +9 -5
  19. package/dist/components/composer/ComposerTextarea.svelte +9 -5
  20. package/dist/components/composer/ComposerToggle.svelte +7 -4
  21. package/dist/components/composer/ComposerToolbar.svelte +5 -1
  22. package/dist/components/composer/ComposerTray.svelte +10 -7
  23. package/dist/components/conversation/ConversationScrollButton.svelte +10 -7
  24. package/dist/components/dialog/ConfirmDialog.svelte +5 -2
  25. package/dist/components/dialog/styles.d.ts +3 -3
  26. package/dist/components/dialog/styles.js +6 -4
  27. package/dist/components/frame/Frame.svelte +8 -5
  28. package/dist/components/hover-card/HoverCardContent.svelte +5 -1
  29. package/dist/components/input/Input.svelte +12 -8
  30. package/dist/components/message/MessageActions.svelte +8 -4
  31. package/dist/components/message/MessageContent.svelte +6 -2
  32. package/dist/components/message/MessagePending.svelte +5 -2
  33. package/dist/components/message/MessageRoot.svelte +10 -4
  34. package/dist/components/message/MessageTime.svelte +5 -2
  35. package/dist/components/message/styles.d.ts +2 -2
  36. package/dist/components/message/styles.js +5 -3
  37. package/dist/components/notice/Notice.svelte +13 -4
  38. package/dist/components/plan/Plan.svelte +13 -10
  39. package/dist/components/popover/PopoverContent.svelte +8 -1
  40. package/dist/components/questionnaire/Questionnaire.svelte +12 -9
  41. package/dist/components/queued-message/QueuedMessage.svelte +14 -7
  42. package/dist/components/rail/RailItem.svelte +16 -7
  43. package/dist/components/rail/RailRoot.svelte +9 -4
  44. package/dist/components/rail/RailSeparator.svelte +5 -2
  45. package/dist/components/reasoning/ReasoningContent.svelte +6 -3
  46. package/dist/components/reasoning/ReasoningTrigger.svelte +5 -2
  47. package/dist/components/search-button/SearchButton.svelte +6 -3
  48. package/dist/components/segmented/SegmentedControl.svelte +6 -3
  49. package/dist/components/settings-group/SettingsGroup.svelte +5 -2
  50. package/dist/components/sidebar/SidebarContent.svelte +8 -4
  51. package/dist/components/sidebar/SidebarFolder.svelte +8 -5
  52. package/dist/components/sidebar/SidebarFooter.svelte +5 -2
  53. package/dist/components/sidebar/SidebarGroup.svelte +11 -8
  54. package/dist/components/sidebar/SidebarHeader.svelte +9 -4
  55. package/dist/components/sidebar/SidebarItem.svelte +14 -9
  56. package/dist/components/split-button/SplitButton.svelte +5 -2
  57. package/dist/components/suggestions/SuggestionsItem.svelte +6 -3
  58. package/dist/components/suggestions/SuggestionsRoot.svelte +5 -1
  59. package/dist/components/tab-strip/TabStrip.svelte +21 -16
  60. package/dist/components/tabs/Tabs.svelte +7 -4
  61. package/dist/components/textarea/Textarea.svelte +6 -2
  62. package/dist/components/theme/Theme.svelte +28 -2
  63. package/dist/components/toast/Toaster.svelte +14 -5
  64. package/dist/components/toggle-group/ToggleGroupRoot.svelte +5 -1
  65. package/dist/components/tool/ToolContent.svelte +8 -4
  66. package/dist/components/tool/ToolSection.svelte +7 -4
  67. package/dist/components/tool/ToolTrigger.svelte +5 -2
  68. package/dist/components/tooltip/TooltipContent.svelte +7 -4
  69. package/dist/components/work-fold/WorkFold.svelte +9 -6
  70. package/dist/internal/Code.svelte +6 -3
  71. package/dist/internal/control.d.ts +6 -6
  72. package/dist/internal/control.js +9 -7
  73. package/dist/internal/layer.d.ts +10 -10
  74. package/dist/internal/layer.js +14 -12
  75. package/dist/internal/toggle.d.ts +8 -8
  76. package/dist/internal/toggle.js +22 -10
  77. package/dist/preset.d.ts +12 -3
  78. package/dist/preset.js +18 -4
  79. package/dist/tokens.stylex.d.ts +13 -3
  80. package/dist/tokens.stylex.js +25 -14
  81. package/package.json +1 -1
  82. package/skills/building-ui/SKILL.md +1 -1
  83. package/skills/markdown/SKILL.md +1 -1
  84. package/skills/setup/SKILL.md +1 -1
  85. package/skills/styling/SKILL.md +5 -2
  86. package/skills/theming/SKILL.md +44 -3
@@ -1,5 +1,6 @@
1
1
  <script lang="ts" module>
2
2
  import * as stylex from '@stylexjs/stylex';
3
+ import { density } from '../../tokens.stylex.js';
3
4
  import type { Snippet } from 'svelte';
4
5
  import type { HTMLAttributes } from 'svelte/elements';
5
6
  import Collapse from '../../internal/Collapse.svelte';
@@ -12,13 +13,16 @@
12
13
  children?: Snippet | undefined;
13
14
  };
14
15
 
16
+ /** A length at the window's density (`density` in the tokens). */
17
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
18
+
15
19
  const styles = stylex.create({
16
20
  steps: {
17
21
  display: 'flex',
18
22
  flexDirection: 'column',
19
- gap: '0.5rem',
20
- paddingTop: '0.5rem',
21
- paddingBottom: '0.25rem'
23
+ gap: d('0.5rem'),
24
+ paddingTop: d('0.5rem'),
25
+ paddingBottom: d('0.25rem')
22
26
  }
23
27
  });
24
28
  </script>
@@ -13,7 +13,7 @@
13
13
  import { attrs, type Sx } from '../../internal/sx.js';
14
14
  import { getFoldShown } from '../../internal/fold-shown.js';
15
15
  import Tile from '../../internal/Tile.svelte';
16
- import { colors, font, radius } from '../../tokens.stylex.js';
16
+ import { colors, density, font, radius } from '../../tokens.stylex.js';
17
17
  import Button from '../button/Button.svelte';
18
18
  import Spinner from '../spinner/Spinner.svelte';
19
19
 
@@ -78,13 +78,16 @@
78
78
  neutral: 'Skipped'
79
79
  };
80
80
 
81
+ /** A length at the window's density (`density` in the tokens). */
82
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
83
+
81
84
  const styles = stylex.create({
82
85
  // The icon sits in a column as wide as the row's own icon above
83
86
  step: {
84
87
  display: 'grid',
85
88
  gridTemplateColumns: '1rem minmax(0, 1fr)',
86
89
  columnGap: '0.625rem',
87
- rowGap: '0.375rem',
90
+ rowGap: d('0.375rem'),
88
91
  minWidth: 0
89
92
  },
90
93
  icon: { display: 'grid', placeItems: 'center' },
@@ -93,7 +96,7 @@
93
96
  alignItems: 'center',
94
97
  gap: '0.5rem',
95
98
  minWidth: 0,
96
- minHeight: '1.25rem'
99
+ minHeight: d('1.25rem')
97
100
  },
98
101
  label: {
99
102
  minWidth: 0,
@@ -131,7 +134,7 @@
131
134
  gridColumn: '2',
132
135
  display: 'flex',
133
136
  flexDirection: 'column',
134
- gap: '0.375rem',
137
+ gap: d('0.375rem'),
135
138
  minWidth: 0
136
139
  },
137
140
  reason: { margin: 0, color: colors.textMuted, fontSize: font.sizeMeta },
@@ -140,8 +143,8 @@
140
143
  margin: 0,
141
144
  maxHeight: '10rem',
142
145
  overflow: 'auto',
143
- paddingBlock: '0.5rem',
144
- paddingInline: '0.625rem',
146
+ paddingBlock: d('0.5rem'),
147
+ paddingInline: d('0.625rem'),
145
148
  borderRadius: radius.control,
146
149
  backgroundColor: colors.fillSunken,
147
150
  color: colors.textMuted,
@@ -6,7 +6,7 @@
6
6
  import { KIND_GLYPHS, type ActionKind } from '../../internal/kinds.js';
7
7
  import { attrs, type Sx } from '../../internal/sx.js';
8
8
  import Tile from '../../internal/Tile.svelte';
9
- import { colors, font, motion, radius } from '../../tokens.stylex.js';
9
+ import { colors, density, font, motion, radius } from '../../tokens.stylex.js';
10
10
  import { media } from '../../media.stylex.js';
11
11
  import RollingText from '../rolling-text/RollingText.svelte';
12
12
  import { getActivityContext } from './context.js';
@@ -25,6 +25,9 @@
25
25
  sx?: Sx | undefined;
26
26
  };
27
27
 
28
+ /** A length at the window's density (`density` in the tokens). */
29
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
30
+
28
31
  const styles = stylex.create({
29
32
  trigger: {
30
33
  display: 'flex',
@@ -32,7 +35,7 @@
32
35
  alignSelf: 'flex-start',
33
36
  gap: '0.625rem',
34
37
  maxWidth: '100%',
35
- minHeight: '1.75rem',
38
+ minHeight: d('1.75rem'),
36
39
  margin: 0,
37
40
  padding: 0,
38
41
  borderWidth: 0,
@@ -7,6 +7,7 @@
7
7
  -->
8
8
  <script lang="ts" module>
9
9
  import * as stylex from '@stylexjs/stylex';
10
+ import { density } from '../../tokens.stylex.js';
10
11
  import type { Snippet } from 'svelte';
11
12
  import type { HTMLAttributes } from 'svelte/elements';
12
13
  import { shared } from '../../internal/shared.js';
@@ -28,6 +29,9 @@
28
29
  children?: Snippet | undefined;
29
30
  };
30
31
 
32
+ /** A length at the window's density (`density` in the tokens). */
33
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
34
+
31
35
  const styles = stylex.create({
32
36
  // Three columns, the outer two equal, so the middle one is centred on the window
33
37
  bar: {
@@ -35,25 +39,26 @@
35
39
  display: 'grid',
36
40
  gridTemplateColumns: 'minmax(0, 1fr) auto minmax(0, 1fr)',
37
41
  alignItems: 'center',
38
- columnGap: '0.5rem',
42
+ columnGap: d('0.5rem'),
39
43
  minWidth: 0,
40
44
  height: '2.75rem',
41
45
  // Back over the shell's gutter, to the window's edges
42
46
  marginTop: '-0.375rem',
43
47
  marginInline: '-0.375rem',
44
48
  paddingInlineEnd: '0.75rem',
45
- // Clear of the traffic lights. With none, a 28px control here is centred over the rail's tiles.
49
+ // Clear of the traffic lights. With none, a 28px control here is centred over the rail's
50
+ // tiles at the default density. The bar's height and this room are kept at any density.
46
51
  paddingInlineStart: 'calc(0.75rem + var(--narvi-window-inset, 0px))'
47
52
  },
48
53
  // Spelled out side by side: a longhand outranks the `margin` shorthand
49
54
  narrow: { marginTop: 0, marginInline: 0 },
50
- start: { display: 'flex', alignItems: 'center', gap: '0.125rem', minWidth: 0 },
55
+ start: { display: 'flex', alignItems: 'center', gap: d('0.125rem'), minWidth: 0 },
51
56
  center: { display: 'flex', justifyContent: 'center', minWidth: 0 },
52
57
  end: {
53
58
  display: 'flex',
54
59
  alignItems: 'center',
55
60
  justifyContent: 'flex-end',
56
- gap: '0.25rem',
61
+ gap: d('0.25rem'),
57
62
  minWidth: 0
58
63
  }
59
64
  });
@@ -8,7 +8,7 @@
8
8
  import type { HTMLAttributes } from 'svelte/elements';
9
9
  import { shared } from '../../internal/shared.js';
10
10
  import { attrs, type Sx } from '../../internal/sx.js';
11
- import { colors, font } from '../../tokens.stylex.js';
11
+ import { colors, density, font } from '../../tokens.stylex.js';
12
12
 
13
13
  export type AppShellHeaderProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
14
14
  /**
@@ -25,19 +25,23 @@
25
25
  children?: Snippet | undefined;
26
26
  };
27
27
 
28
+ /** A length at the window's density (`density` in the tokens). */
29
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
30
+
28
31
  const styles = stylex.create({
29
32
  header: {
30
33
  boxSizing: 'border-box',
31
34
  display: 'flex',
32
35
  alignItems: 'center',
33
- gap: '0.5rem',
36
+ gap: d('0.5rem'),
34
37
  flexShrink: 0,
35
38
  minWidth: 0,
36
39
  height: '3rem',
37
40
  // The same edge as Sidebar.Header, and as a Conversation's column under it. In a shell
38
- // with no bar, clear of the traffic lights while the sidebar is away.
39
- paddingInlineStart: 'max(1rem, calc(var(--narvi-inset-page, 0px) + 0.5rem))',
40
- paddingInlineEnd: '0.625rem',
41
+ // with no bar, clear of the traffic lights while the sidebar is away. Its height and that
42
+ // room are kept at any density.
43
+ paddingInlineStart: `max(${d('1rem')}, calc(var(--narvi-inset-page, 0px) + 0.5rem))`,
44
+ paddingInlineEnd: d('0.625rem'),
41
45
  fontSize: font.sizeBody
42
46
  },
43
47
  divider: {
@@ -9,7 +9,7 @@
9
9
  import { onMount, tick, type Snippet } from 'svelte';
10
10
  import Glyph from '../../internal/Glyph.svelte';
11
11
  import { attrs, type Sx } from '../../internal/sx.js';
12
- import { colors, font, motion, radius, space } from '../../tokens.stylex.js';
12
+ import { colors, density, font, motion, radius, space } from '../../tokens.stylex.js';
13
13
  import { media } from '../../media.stylex.js';
14
14
  import Button from '../button/Button.svelte';
15
15
  import Kbd from '../kbd/Kbd.svelte';
@@ -76,12 +76,15 @@
76
76
  class?: string | undefined;
77
77
  };
78
78
 
79
+ /** A length at the window's density (`density` in the tokens). */
80
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
81
+
79
82
  const styles = stylex.create({
80
83
  card: {
81
84
  display: 'flex',
82
85
  flexDirection: 'column',
83
86
  gap: space.x3,
84
- padding: '0.875rem',
87
+ padding: d('0.875rem'),
85
88
  borderRadius: radius.panel,
86
89
  backgroundColor: `color-mix(in oklab, ${colors.warning} 7%, ${colors.bgRaised})`,
87
90
  opacity: { default: 1, '@starting-style': 0 },
@@ -102,8 +105,8 @@
102
105
  },
103
106
  command: {
104
107
  margin: 0,
105
- paddingBlock: '0.5rem',
106
- paddingInline: '0.625rem',
108
+ paddingBlock: d('0.5rem'),
109
+ paddingInline: d('0.625rem'),
107
110
  overflowX: 'auto',
108
111
  borderRadius: radius.control,
109
112
  backgroundColor: colors.fillSunken,
@@ -4,7 +4,7 @@
4
4
  import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
5
5
  import { shared } from '../../internal/shared.js';
6
6
  import { attrs, classes, type Sx } from '../../internal/sx.js';
7
- import { colors, font, motion, radius } from '../../tokens.stylex.js';
7
+ import { colors, density, 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
  import * as Tooltip from '../tooltip/index.js';
@@ -90,6 +90,9 @@
90
90
  const OPEN =
91
91
  ':is([aria-haspopup]:not([aria-haspopup="false"])[aria-expanded="true"], [aria-pressed="true"])';
92
92
 
93
+ /** A length at the window's density (`density` in the tokens). */
94
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
95
+
93
96
  const styles = stylex.create({
94
97
  base: {
95
98
  // A key hint inside takes the button's own ink, whatever it stands on
@@ -126,48 +129,69 @@
126
129
  }
127
130
  },
128
131
 
129
- // Sizes. All but the large one extend their hit area to 40px without moving the layout.
132
+ // Sizes. All but the large one extend their hit area to 40px without moving the layout,
133
+ // at any density.
130
134
  // Each sets the size of an icon put inside it (`internal/icons.css`): 12, 14, 14, 16, 18px.
131
135
  micro: {
132
136
  '--narvi-icon-size': '0.75rem',
133
- minHeight: '1.25rem',
134
- paddingInline: '0.375rem',
137
+ minHeight: d('1.25rem'),
138
+ paddingInline: d('0.375rem'),
135
139
  gap: '0.25rem',
136
140
  borderRadius: radius.chip,
137
141
  fontSize: font.sizeCaption,
138
- '::after': { content: '""', position: 'absolute', insetInline: 0, insetBlock: '-10px' }
142
+ '::after': {
143
+ content: '""',
144
+ position: 'absolute',
145
+ insetInline: 0,
146
+ insetBlock: `calc((${d('1.25rem')} - 2.5rem) / 2)`
147
+ }
139
148
  },
140
149
  xs: {
141
150
  '--narvi-icon-size': '0.875rem',
142
- minHeight: '1.5rem',
143
- paddingInline: '0.5rem',
151
+ minHeight: d('1.5rem'),
152
+ paddingInline: d('0.5rem'),
144
153
  gap: '0.3125rem',
145
154
  borderRadius: radius.item,
146
155
  fontSize: font.sizeMeta,
147
- '::after': { content: '""', position: 'absolute', insetInline: 0, insetBlock: '-8px' }
156
+ '::after': {
157
+ content: '""',
158
+ position: 'absolute',
159
+ insetInline: 0,
160
+ insetBlock: `calc((${d('1.5rem')} - 2.5rem) / 2)`
161
+ }
148
162
  },
149
163
  sm: {
150
164
  '--narvi-icon-size': '0.875rem',
151
- minHeight: '1.75rem',
152
- paddingInline: '0.625rem',
165
+ minHeight: d('1.75rem'),
166
+ paddingInline: d('0.625rem'),
153
167
  gap: '0.375rem',
154
168
  borderRadius: radius.item,
155
169
  fontSize: font.sizeMeta,
156
- '::after': { content: '""', position: 'absolute', insetInline: 0, insetBlock: '-6px' }
170
+ '::after': {
171
+ content: '""',
172
+ position: 'absolute',
173
+ insetInline: 0,
174
+ insetBlock: `calc((${d('1.75rem')} - 2.5rem) / 2)`
175
+ }
157
176
  },
158
177
  md: {
159
178
  '--narvi-icon-size': '1rem',
160
- minHeight: '2rem',
161
- paddingInline: '0.75rem',
179
+ minHeight: d('2rem'),
180
+ paddingInline: d('0.75rem'),
162
181
  gap: '0.4375rem',
163
182
  borderRadius: radius.control,
164
183
  fontSize: font.sizeBody,
165
- '::after': { content: '""', position: 'absolute', insetInline: 0, insetBlock: '-4px' }
184
+ '::after': {
185
+ content: '""',
186
+ position: 'absolute',
187
+ insetInline: 0,
188
+ insetBlock: `calc((${d('2rem')} - 2.5rem) / 2)`
189
+ }
166
190
  },
167
191
  lg: {
168
192
  '--narvi-icon-size': '1.125rem',
169
- minHeight: '2.5rem',
170
- paddingInline: '1rem',
193
+ minHeight: d('2.5rem'),
194
+ paddingInline: d('1rem'),
171
195
  gap: '0.5rem',
172
196
  borderRadius: radius.panel,
173
197
  fontSize: font.sizeReading
@@ -176,43 +200,43 @@
176
200
  // `--narvi-icon-flush: 1`, as a sidebar group's actions do), the button reaches out by the
177
201
  // room around its icon, so the icon, not the box, ends on the line.
178
202
  iconMicro: {
179
- width: '1.25rem',
203
+ width: d('1.25rem'),
180
204
  paddingInline: 0,
181
205
  marginInlineEnd: {
182
206
  default: null,
183
- ':last-child': 'calc(var(--narvi-icon-flush, 0) * (0.75rem - 1.25rem) / 2)'
207
+ ':last-child': `calc(var(--narvi-icon-flush, 0) * (0.75rem - ${d('1.25rem')}) / 2)`
184
208
  }
185
209
  },
186
210
  iconXs: {
187
- width: '1.5rem',
211
+ width: d('1.5rem'),
188
212
  paddingInline: 0,
189
213
  marginInlineEnd: {
190
214
  default: null,
191
- ':last-child': 'calc(var(--narvi-icon-flush, 0) * (0.875rem - 1.5rem) / 2)'
215
+ ':last-child': `calc(var(--narvi-icon-flush, 0) * (0.875rem - ${d('1.5rem')}) / 2)`
192
216
  }
193
217
  },
194
218
  iconSm: {
195
- width: '1.75rem',
219
+ width: d('1.75rem'),
196
220
  paddingInline: 0,
197
221
  marginInlineEnd: {
198
222
  default: null,
199
- ':last-child': 'calc(var(--narvi-icon-flush, 0) * (0.875rem - 1.75rem) / 2)'
223
+ ':last-child': `calc(var(--narvi-icon-flush, 0) * (0.875rem - ${d('1.75rem')}) / 2)`
200
224
  }
201
225
  },
202
226
  iconMd: {
203
- width: '2rem',
227
+ width: d('2rem'),
204
228
  paddingInline: 0,
205
229
  marginInlineEnd: {
206
230
  default: null,
207
- ':last-child': 'calc(var(--narvi-icon-flush, 0) * (1rem - 2rem) / 2)'
231
+ ':last-child': `calc(var(--narvi-icon-flush, 0) * (1rem - ${d('2rem')}) / 2)`
208
232
  }
209
233
  },
210
234
  iconLg: {
211
- width: '2.5rem',
235
+ width: d('2.5rem'),
212
236
  paddingInline: 0,
213
237
  marginInlineEnd: {
214
238
  default: null,
215
- ':last-child': 'calc(var(--narvi-icon-flush, 0) * (1.125rem - 2.5rem) / 2)'
239
+ ':last-child': `calc(var(--narvi-icon-flush, 0) * (1.125rem - ${d('2.5rem')}) / 2)`
216
240
  }
217
241
  },
218
242
 
@@ -4,7 +4,7 @@
4
4
  import type { HTMLAnchorAttributes, HTMLAttributes } from 'svelte/elements';
5
5
  import { shared } from '../../internal/shared.js';
6
6
  import { attrs, type Sx } from '../../internal/sx.js';
7
- import { colors, font, motion, radius, space } from '../../tokens.stylex.js';
7
+ import { colors, density, font, motion, radius, space } from '../../tokens.stylex.js';
8
8
  import { media } from '../../media.stylex.js';
9
9
 
10
10
  export type CardVariant = 'raised' | 'outlined' | 'filled';
@@ -26,6 +26,9 @@
26
26
  children?: Snippet | undefined;
27
27
  };
28
28
 
29
+ /** A length at the window's density (`density` in the tokens). */
30
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
31
+
29
32
  const styles = stylex.create({
30
33
  base: {
31
34
  boxSizing: 'border-box',
@@ -47,7 +50,7 @@
47
50
  },
48
51
  none: { padding: 0 },
49
52
  sm: { padding: space.x3 },
50
- md: { padding: '1.125rem' },
53
+ md: { padding: d('1.125rem') },
51
54
  lg: { padding: space.x6 },
52
55
 
53
56
  // A card that is a link: a block, in the card's own colours, that answers the pointer
@@ -2,7 +2,7 @@
2
2
  <script lang="ts" module>
3
3
  import * as stylex from '@stylexjs/stylex';
4
4
  import { attrs, type Sx } from '../../internal/sx.js';
5
- import { colors, font, radius } from '../../tokens.stylex.js';
5
+ import { colors, density, font, radius } from '../../tokens.stylex.js';
6
6
  import { media } from '../../media.stylex.js';
7
7
  import Button from '../button/Button.svelte';
8
8
  import ChangeStats from '../change-stats/ChangeStats.svelte';
@@ -27,6 +27,9 @@
27
27
 
28
28
  const STATUS = { added: 'A', modified: 'M', deleted: 'D', renamed: 'R' } as const;
29
29
 
30
+ /** A length at the window's density (`density` in the tokens). */
31
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
32
+
30
33
  const styles = stylex.create({
31
34
  card: {
32
35
  display: 'flex',
@@ -38,24 +41,24 @@
38
41
  head: {
39
42
  display: 'flex',
40
43
  alignItems: 'center',
41
- gap: '0.75rem',
42
- minHeight: '2.5rem',
43
- paddingInlineStart: '0.75rem',
44
- paddingInlineEnd: '0.375rem',
44
+ gap: d('0.75rem'),
45
+ minHeight: d('2.5rem'),
46
+ paddingInlineStart: d('0.75rem'),
47
+ paddingInlineEnd: d('0.375rem'),
45
48
  borderBottomWidth: '1px',
46
49
  borderBottomStyle: 'solid',
47
50
  borderBottomColor: colors.border
48
51
  },
49
52
  title: { flexGrow: 1, margin: 0, fontSize: font.sizeBody, fontWeight: font.weightMedium },
50
- list: { margin: 0, padding: '0.25rem', listStyleType: 'none' },
53
+ list: { margin: 0, padding: d('0.25rem'), listStyleType: 'none' },
51
54
  file: {
52
55
  display: 'flex',
53
56
  alignItems: 'center',
54
57
  gap: '0.5rem',
55
58
  width: '100%',
56
- minHeight: '1.875rem',
59
+ minHeight: d('1.875rem'),
57
60
  margin: 0,
58
- paddingInline: '0.5rem',
61
+ paddingInline: d('0.5rem'),
59
62
  borderWidth: 0,
60
63
  borderRadius: radius.control,
61
64
  backgroundColor: {
@@ -9,7 +9,7 @@
9
9
  import type { HTMLAttributes } from 'svelte/elements';
10
10
  import '../../internal/icons.css';
11
11
  import { attrs, type Sx } from '../../internal/sx.js';
12
- import { colors, motion, radius, space } from '../../tokens.stylex.js';
12
+ import { colors, density, motion, radius, space } from '../../tokens.stylex.js';
13
13
  import { media } from '../../media.stylex.js';
14
14
  import { typography } from '../../typography.js';
15
15
  import { visuallyHidden } from '../../visually-hidden.js';
@@ -42,6 +42,9 @@
42
42
  const FOCUSED = ':has(:focus-visible)';
43
43
  const OFF = ':has(:disabled)';
44
44
 
45
+ /** A length at the window's density (`density` in the tokens). */
46
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
47
+
45
48
  const styles = stylex.create({
46
49
  root: {
47
50
  display: 'grid',
@@ -56,7 +59,7 @@
56
59
  gap: space.x3,
57
60
  minWidth: 0,
58
61
  paddingBlock: space.x3,
59
- paddingInline: '0.875rem',
62
+ paddingInline: d('0.875rem'),
60
63
  borderRadius: radius.panel,
61
64
  backgroundColor: colors.bgRaised,
62
65
  // The edge says which is chosen: the accent, twice as thick
@@ -5,7 +5,7 @@
5
5
  import type { Snippet } from 'svelte';
6
6
  import Chevron from '../../internal/Chevron.svelte';
7
7
  import { attrs, type Sx } from '../../internal/sx.js';
8
- import { colors, font, motion, radius } from '../../tokens.stylex.js';
8
+ import { colors, density, font, motion, radius } from '../../tokens.stylex.js';
9
9
  import { media } from '../../media.stylex.js';
10
10
  import { getCollapsibleContext } from './context.js';
11
11
 
@@ -22,6 +22,9 @@
22
22
  }
23
23
  >;
24
24
 
25
+ /** A length at the window's density (`density` in the tokens). */
26
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
27
+
25
28
  const styles = stylex.create({
26
29
  // A quiet line of text that names what folds, like Reasoning's and WorkFold's
27
30
  trigger: {
@@ -30,7 +33,7 @@
30
33
  alignSelf: 'flex-start',
31
34
  gap: '0.25rem',
32
35
  maxWidth: '100%',
33
- minHeight: '1.75rem',
36
+ minHeight: d('1.75rem'),
34
37
  margin: 0,
35
38
  padding: 0,
36
39
  borderWidth: 0,
@@ -14,7 +14,7 @@
14
14
  import { hexToHsv, hsvToHex, parseHex, toHex, type Hsv } from '../../internal/hsv.js';
15
15
  import { shared } from '../../internal/shared.js';
16
16
  import { attrs, type Sx } from '../../internal/sx.js';
17
- import { colors, radius } from '../../tokens.stylex.js';
17
+ import { colors, density, radius } from '../../tokens.stylex.js';
18
18
  import { media } from '../../media.stylex.js';
19
19
  import Button from '../button/Button.svelte';
20
20
  import { getFieldContext } from '../field/context.js';
@@ -69,8 +69,11 @@
69
69
  const clamp = (value: number, max = 1) => Math.min(Math.max(value, 0), max);
70
70
  const percent = (value: number) => Math.round(value * 100);
71
71
 
72
+ /** A length at the window's density (`density` in the tokens). */
73
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
74
+
72
75
  const styles = stylex.create({
73
- field: { display: 'flex', alignItems: 'center', gap: '0.5rem', minWidth: 0 },
76
+ field: { display: 'flex', alignItems: 'center', gap: d('0.5rem'), minWidth: 0 },
74
77
  // A control's square, its edge the 3:1 boundary every control has, over the colour itself
75
78
  swatch: {
76
79
  flexShrink: 0,
@@ -85,9 +88,9 @@
85
88
  // Forced colours drop the fill; the colour is still in the hex beside it
86
89
  forcedColorAdjust: 'none'
87
90
  },
88
- sm: { width: '28px', height: '28px', borderRadius: radius.item },
89
- md: { width: '34px', height: '34px' },
90
- lg: { width: '40px', height: '40px', borderRadius: radius.panel },
91
+ sm: { width: d('1.75rem'), height: d('1.75rem'), borderRadius: radius.item },
92
+ md: { width: d('2.125rem'), height: d('2.125rem') },
93
+ lg: { width: d('2.5rem'), height: d('2.5rem'), borderRadius: radius.panel },
91
94
  hex: { width: '7.5rem', fontVariantNumeric: 'tabular-nums' },
92
95
  // The area: saturation across, brightness up
93
96
  area: {
@@ -103,7 +106,7 @@
103
106
  height: '100%',
104
107
  borderRadius: 'inherit'
105
108
  },
106
- row: { display: 'flex', alignItems: 'center', gap: '0.5rem' },
109
+ row: { display: 'flex', alignItems: 'center', gap: d('0.5rem') },
107
110
  hue: {
108
111
  position: 'relative',
109
112
  flexGrow: 1,
@@ -22,7 +22,7 @@ export declare const command: Readonly<{
22
22
  readonly input: Readonly<{
23
23
  readonly flexGrow: stylex.StyleXClassNameFor<"flexGrow", 1>;
24
24
  readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
25
- readonly height: stylex.StyleXClassNameFor<"height", "3rem">;
25
+ readonly height: stylex.StyleXClassNameFor<"height", string>;
26
26
  readonly margin: stylex.StyleXClassNameFor<"margin", 0>;
27
27
  readonly padding: stylex.StyleXClassNameFor<"padding", 0>;
28
28
  readonly borderWidth: stylex.StyleXClassNameFor<"borderWidth", 0>;
@@ -40,15 +40,15 @@ export declare const command: Readonly<{
40
40
  readonly maxHeight: stylex.StyleXClassNameFor<"maxHeight", "min(24rem, 60dvh)">;
41
41
  readonly overflowY: stylex.StyleXClassNameFor<"overflowY", "auto">;
42
42
  readonly overscrollBehavior: stylex.StyleXClassNameFor<"overscrollBehavior", "contain">;
43
- readonly padding: stylex.StyleXClassNameFor<"padding", "0.375rem">;
44
- readonly scrollPaddingBlock: stylex.StyleXClassNameFor<"scrollPaddingBlock", "0.375rem">;
43
+ readonly padding: stylex.StyleXClassNameFor<"padding", string>;
44
+ readonly scrollPaddingBlock: stylex.StyleXClassNameFor<"scrollPaddingBlock", string>;
45
45
  }>;
46
46
  readonly item: Readonly<{
47
47
  readonly display: stylex.StyleXClassNameFor<"display", "flex">;
48
48
  readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
49
49
  readonly gap: stylex.StyleXClassNameFor<"gap", "0.625rem">;
50
- readonly minHeight: stylex.StyleXClassNameFor<"minHeight", "2.375rem">;
51
- readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", "0.625rem">;
50
+ readonly minHeight: stylex.StyleXClassNameFor<"minHeight", string>;
51
+ readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
52
52
  readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
53
53
  readonly color: stylex.StyleXClassNameFor<"color", string>;
54
54
  readonly cursor: stylex.StyleXClassNameFor<"cursor", "default">;
@@ -69,7 +69,7 @@ export declare const command: Readonly<{
69
69
  readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
70
70
  readonly gap: stylex.StyleXClassNameFor<"gap", "0.125rem">;
71
71
  readonly flexShrink: stylex.StyleXClassNameFor<"flexShrink", 0>;
72
- readonly marginInlineEnd: stylex.StyleXClassNameFor<"marginInlineEnd", "-0.5rem">;
72
+ readonly marginInlineEnd: stylex.StyleXClassNameFor<"marginInlineEnd", string>;
73
73
  }>;
74
74
  readonly badge: Readonly<{
75
75
  readonly '--narvi-icon-size': stylex.StyleXClassNameFor<"--narvi-icon-size", "0.875rem">;
@@ -85,7 +85,7 @@ export declare const command: Readonly<{
85
85
  readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
86
86
  readonly gap: stylex.StyleXClassNameFor<"gap", string>;
87
87
  readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
88
- readonly paddingBlock: stylex.StyleXClassNameFor<"paddingBlock", "0.375rem">;
88
+ readonly paddingBlock: stylex.StyleXClassNameFor<"paddingBlock", string>;
89
89
  }>;
90
90
  readonly wrapLabel: Readonly<{
91
91
  readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
@@ -124,7 +124,7 @@ export declare const command: Readonly<{
124
124
  readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
125
125
  readonly gap: stylex.StyleXClassNameFor<"gap", string>;
126
126
  readonly flexShrink: stylex.StyleXClassNameFor<"flexShrink", 0>;
127
- readonly minHeight: stylex.StyleXClassNameFor<"minHeight", "2.5rem">;
127
+ readonly minHeight: stylex.StyleXClassNameFor<"minHeight", string>;
128
128
  readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
129
129
  readonly borderTopWidth: stylex.StyleXClassNameFor<"borderTopWidth", "1px">;
130
130
  readonly borderTopStyle: stylex.StyleXClassNameFor<"borderTopStyle", "solid">;