@diegopluna/narvi 0.3.10 → 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 (107) hide show
  1. package/dist/base.css +38 -0
  2. package/dist/components/activity/ActivityContent.svelte +7 -3
  3. package/dist/components/activity/ActivityStep.svelte +28 -11
  4. package/dist/components/activity/ActivityStep.svelte.d.ts +6 -0
  5. package/dist/components/activity/ActivityTrigger.svelte +5 -2
  6. package/dist/components/app-shell/AppShellBar.svelte +9 -4
  7. package/dist/components/app-shell/AppShellHeader.svelte +9 -5
  8. package/dist/components/approval/Approval.svelte +7 -4
  9. package/dist/components/button/Button.svelte +50 -26
  10. package/dist/components/card/Card.svelte +5 -2
  11. package/dist/components/changes-summary/ChangesSummary.svelte +11 -8
  12. package/dist/components/choice-cards/ChoiceCards.svelte +5 -2
  13. package/dist/components/collapsible/CollapsibleTrigger.svelte +5 -2
  14. package/dist/components/color-field/ColorField.svelte +397 -0
  15. package/dist/components/color-field/ColorField.svelte.d.ts +41 -0
  16. package/dist/components/command/styles.d.ts +8 -9
  17. package/dist/components/command/styles.js +11 -10
  18. package/dist/components/composer/ComposerAttachment.svelte +7 -3
  19. package/dist/components/composer/ComposerAttachments.svelte +5 -1
  20. package/dist/components/composer/ComposerModelPicker.svelte +37 -35
  21. package/dist/components/composer/ComposerRoot.svelte +9 -5
  22. package/dist/components/composer/ComposerTextarea.svelte +9 -6
  23. package/dist/components/composer/ComposerToggle.svelte +7 -4
  24. package/dist/components/composer/ComposerToolbar.svelte +5 -1
  25. package/dist/components/composer/ComposerTray.svelte +10 -7
  26. package/dist/components/conversation/ConversationContent.svelte +0 -2
  27. package/dist/components/conversation/ConversationRoot.svelte +124 -27
  28. package/dist/components/conversation/ConversationScrollButton.svelte +10 -7
  29. package/dist/components/conversation/scrolling.d.ts +18 -4
  30. package/dist/components/conversation/scrolling.js +28 -6
  31. package/dist/components/dialog/ConfirmDialog.svelte +5 -2
  32. package/dist/components/dialog/styles.d.ts +3 -4
  33. package/dist/components/dialog/styles.js +7 -6
  34. package/dist/components/frame/Frame.svelte +8 -5
  35. package/dist/components/hover-card/HoverCardContent.svelte +5 -1
  36. package/dist/components/input/Input.svelte +12 -8
  37. package/dist/components/markdown/MarkdownCode.svelte +0 -1
  38. package/dist/components/markdown/MarkdownDiagram.svelte +1 -2
  39. package/dist/components/markdown/styles.d.ts +0 -2
  40. package/dist/components/markdown/styles.js +0 -2
  41. package/dist/components/message/MessageActions.svelte +8 -4
  42. package/dist/components/message/MessageContent.svelte +6 -2
  43. package/dist/components/message/MessagePending.svelte +5 -2
  44. package/dist/components/message/MessageRoot.svelte +10 -4
  45. package/dist/components/message/MessageTime.svelte +5 -2
  46. package/dist/components/message/styles.d.ts +2 -2
  47. package/dist/components/message/styles.js +5 -3
  48. package/dist/components/notice/Notice.svelte +13 -4
  49. package/dist/components/plan/Plan.svelte +13 -10
  50. package/dist/components/popover/PopoverContent.svelte +8 -1
  51. package/dist/components/questionnaire/Questionnaire.svelte +12 -9
  52. package/dist/components/queued-message/QueuedMessage.svelte +14 -7
  53. package/dist/components/rail/RailItem.svelte +16 -7
  54. package/dist/components/rail/RailRoot.svelte +9 -4
  55. package/dist/components/rail/RailSeparator.svelte +5 -2
  56. package/dist/components/reasoning/ReasoningContent.svelte +6 -3
  57. package/dist/components/reasoning/ReasoningTrigger.svelte +5 -2
  58. package/dist/components/resize-handle/ResizeHandle.svelte +11 -7
  59. package/dist/components/search-button/SearchButton.svelte +6 -3
  60. package/dist/components/segmented/SegmentedControl.svelte +6 -3
  61. package/dist/components/settings-group/SettingsGroup.svelte +5 -2
  62. package/dist/components/sidebar/SidebarContent.svelte +8 -9
  63. package/dist/components/sidebar/SidebarFolder.svelte +8 -5
  64. package/dist/components/sidebar/SidebarFooter.svelte +5 -2
  65. package/dist/components/sidebar/SidebarGroup.svelte +11 -8
  66. package/dist/components/sidebar/SidebarHeader.svelte +9 -4
  67. package/dist/components/sidebar/SidebarItem.svelte +14 -9
  68. package/dist/components/split-button/SplitButton.svelte +5 -2
  69. package/dist/components/suggestions/SuggestionsItem.svelte +6 -3
  70. package/dist/components/suggestions/SuggestionsRoot.svelte +5 -1
  71. package/dist/components/tab-strip/TabStrip.svelte +21 -16
  72. package/dist/components/tabs/Tabs.svelte +7 -4
  73. package/dist/components/textarea/Textarea.svelte +6 -2
  74. package/dist/components/theme/Theme.svelte +32 -3
  75. package/dist/components/toast/Toaster.svelte +14 -5
  76. package/dist/components/toggle-group/ToggleGroupRoot.svelte +5 -1
  77. package/dist/components/tool/ToolContent.svelte +8 -4
  78. package/dist/components/tool/ToolSection.svelte +7 -4
  79. package/dist/components/tool/ToolTrigger.svelte +5 -2
  80. package/dist/components/tooltip/TooltipContent.svelte +7 -4
  81. package/dist/components/work-fold/WorkFold.svelte +9 -6
  82. package/dist/index.d.ts +2 -0
  83. package/dist/index.js +1 -0
  84. package/dist/internal/Code.svelte +6 -4
  85. package/dist/internal/Glyph.svelte +23 -2
  86. package/dist/internal/Glyph.svelte.d.ts +4 -1
  87. package/dist/internal/control.d.ts +6 -6
  88. package/dist/internal/control.js +9 -7
  89. package/dist/internal/hsv.d.ts +18 -0
  90. package/dist/internal/hsv.js +63 -0
  91. package/dist/internal/kinds.d.ts +1 -1
  92. package/dist/internal/kinds.js +3 -3
  93. package/dist/internal/layer.d.ts +10 -11
  94. package/dist/internal/layer.js +14 -13
  95. package/dist/internal/toggle.d.ts +8 -8
  96. package/dist/internal/toggle.js +22 -10
  97. package/dist/preset.d.ts +12 -3
  98. package/dist/preset.js +18 -4
  99. package/dist/tokens.stylex.d.ts +13 -3
  100. package/dist/tokens.stylex.js +25 -14
  101. package/package.json +1 -1
  102. package/skills/building-ui/SKILL.md +1 -1
  103. package/skills/building-ui/references/components.md +24 -0
  104. package/skills/markdown/SKILL.md +1 -1
  105. package/skills/setup/SKILL.md +9 -3
  106. package/skills/styling/SKILL.md +5 -2
  107. package/skills/theming/SKILL.md +48 -4
@@ -5,7 +5,7 @@
5
5
  import Glyph from '../../internal/Glyph.svelte';
6
6
  import { shared } from '../../internal/shared.js';
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 Spinner from '../spinner/Spinner.svelte';
11
11
 
@@ -22,14 +22,17 @@
22
22
  class?: string | undefined;
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
  plan: {
27
30
  display: 'flex',
28
31
  flexDirection: 'column',
29
- gap: '0.625rem',
30
- paddingTop: '0.75rem',
31
- paddingBottom: '0.5rem',
32
- paddingInline: '0.5rem',
32
+ gap: d('0.625rem'),
33
+ paddingTop: d('0.75rem'),
34
+ paddingBottom: d('0.5rem'),
35
+ paddingInline: d('0.5rem'),
33
36
  borderRadius: radius.panel,
34
37
  boxShadow: `inset 0 0 0 1px ${colors.border}`
35
38
  },
@@ -37,9 +40,9 @@
37
40
  display: 'flex',
38
41
  alignItems: 'baseline',
39
42
  justifyContent: 'space-between',
40
- gap: '0.75rem',
43
+ gap: d('0.75rem'),
41
44
  margin: 0,
42
- paddingInline: '0.375rem'
45
+ paddingInline: d('0.375rem')
43
46
  },
44
47
  title: {
45
48
  color: colors.text,
@@ -50,7 +53,7 @@
50
53
  track: {
51
54
  display: 'flex',
52
55
  gap: '0.1875rem',
53
- paddingInline: '0.375rem'
56
+ paddingInline: d('0.375rem')
54
57
  },
55
58
  segment: {
56
59
  flexGrow: 1,
@@ -75,8 +78,8 @@
75
78
  display: 'flex',
76
79
  alignItems: 'center',
77
80
  gap: '0.625rem',
78
- minHeight: '1.875rem',
79
- paddingInline: '0.375rem',
81
+ minHeight: d('1.875rem'),
82
+ paddingInline: d('0.375rem'),
80
83
  borderRadius: radius.control,
81
84
  color: colors.textMuted,
82
85
  fontSize: font.sizeBody,
@@ -2,6 +2,7 @@
2
2
  import type { Loose } from '../../internal/loose.js';
3
3
  import { Popover } from 'bits-ui';
4
4
  import * as stylex from '@stylexjs/stylex';
5
+ import { density } from '../../tokens.stylex.js';
5
6
  import type { Snippet } from 'svelte';
6
7
  import { layer, widthStyle } from '../../internal/layer.js';
7
8
  import { attrs, type Sx } from '../../internal/sx.js';
@@ -22,9 +23,15 @@
22
23
  }
23
24
  >;
24
25
 
26
+ /** A length at the window's density (`density` in the tokens). */
27
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
28
+
25
29
  const styles = stylex.create({
26
30
  // Room for content of its own, rather than a list of items
27
- padded: { padding: '0.75rem', minWidth: 'max(16rem, var(--bits-floating-anchor-width, 0px))' },
31
+ padded: {
32
+ padding: d('0.75rem'),
33
+ minWidth: 'max(16rem, var(--bits-floating-anchor-width, 0px))'
34
+ },
28
35
  bare: { padding: 0, minWidth: 'max(12rem, var(--bits-floating-anchor-width, 0px))' }
29
36
  });
30
37
  </script>
@@ -11,7 +11,7 @@
11
11
  import { tick, type Snippet } from 'svelte';
12
12
  import { shared } from '../../internal/shared.js';
13
13
  import { attrs, type Sx } from '../../internal/sx.js';
14
- import { colors, font, radius, space } from '../../tokens.stylex.js';
14
+ import { colors, density, font, radius, space } from '../../tokens.stylex.js';
15
15
  import { media } from '../../media.stylex.js';
16
16
  import Button from '../button/Button.svelte';
17
17
  import Input from '../input/Input.svelte';
@@ -97,19 +97,22 @@
97
97
  hidden: 'Hidden'
98
98
  };
99
99
 
100
+ /** A length at the window's density (`density` in the tokens). */
101
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
102
+
100
103
  const styles = stylex.create({
101
104
  card: {
102
105
  display: 'flex',
103
106
  flexDirection: 'column',
104
107
  gap: space.x3,
105
- padding: '0.875rem',
108
+ padding: d('0.875rem'),
106
109
  borderRadius: radius.panel,
107
110
  backgroundColor: colors.bgRaised,
108
111
  boxShadow: `inset 0 0 0 1px color-mix(in oklab, ${colors.accent} 35%, transparent)`
109
112
  },
110
113
  // No card of its own: what holds it draws one
111
114
  bare: { padding: 0, borderRadius: 0, backgroundColor: 'transparent', boxShadow: 'none' },
112
- head: { display: 'flex', flexDirection: 'column', gap: '0.5rem' },
115
+ head: { display: 'flex', flexDirection: 'column', gap: d('0.5rem') },
113
116
  // The heading at the start, the count at the end, on one line while they fit
114
117
  headRow: {
115
118
  display: 'flex',
@@ -117,7 +120,7 @@
117
120
  alignItems: 'center',
118
121
  justifyContent: 'space-between',
119
122
  columnGap: space.x3,
120
- rowGap: '0.25rem',
123
+ rowGap: d('0.25rem'),
121
124
  minWidth: 0
122
125
  },
123
126
  heading: {
@@ -137,7 +140,7 @@
137
140
  outlineStyle: 'none'
138
141
  },
139
142
  about: {
140
- marginTop: '-0.375rem',
143
+ marginTop: d('-0.375rem'),
141
144
  marginBottom: 0,
142
145
  color: colors.textMuted,
143
146
  fontSize: font.sizeBody,
@@ -147,7 +150,7 @@
147
150
  choices: {
148
151
  display: 'flex',
149
152
  flexDirection: 'column',
150
- gap: '0.25rem',
153
+ gap: d('0.25rem'),
151
154
  margin: 0,
152
155
  padding: 0,
153
156
  borderWidth: 0
@@ -157,8 +160,8 @@
157
160
  gridTemplateColumns: 'auto minmax(0, 1fr) auto',
158
161
  alignItems: 'start',
159
162
  columnGap: '0.625rem',
160
- paddingBlock: '0.5rem',
161
- paddingInline: '0.625rem',
163
+ paddingBlock: d('0.5rem'),
164
+ paddingInline: d('0.625rem'),
162
165
  borderRadius: radius.control,
163
166
  backgroundColor: {
164
167
  default: 'transparent',
@@ -202,7 +205,7 @@
202
205
  error: { margin: 0, color: colors.danger, fontSize: font.sizeMeta },
203
206
  foot: { display: 'flex', alignItems: 'center', gap: space.x2 },
204
207
  spacer: { flexGrow: 1 },
205
- summary: { display: 'flex', flexDirection: 'column', gap: '0.5rem', margin: 0, padding: 0 },
208
+ summary: { display: 'flex', flexDirection: 'column', gap: d('0.5rem'), margin: 0, padding: 0 },
206
209
  q: { color: colors.textMuted, fontSize: font.sizeMeta },
207
210
  a: { margin: 0, fontSize: font.sizeBody }
208
211
  });
@@ -8,7 +8,7 @@
8
8
  import type { Snippet } from 'svelte';
9
9
  import Glyph, { type GlyphName } from '../../internal/Glyph.svelte';
10
10
  import { attrs, type Sx } from '../../internal/sx.js';
11
- import { colors, font, radius } from '../../tokens.stylex.js';
11
+ import { colors, density, font, radius } from '../../tokens.stylex.js';
12
12
  import Button from '../button/Button.svelte';
13
13
  import { text, type MessageTextSize } from '../message/styles.js';
14
14
  import * as Tooltip from '../tooltip/index.js';
@@ -56,19 +56,22 @@
56
56
  editing: 'Still queued; sends when this turn ends'
57
57
  };
58
58
 
59
+ /** A length at the window's density (`density` in the tokens). */
60
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
61
+
59
62
  const styles = stylex.create({
60
63
  root: {
61
64
  display: 'flex',
62
65
  flexDirection: 'column',
63
66
  alignItems: 'flex-end',
64
- gap: '0.25rem',
67
+ gap: d('0.25rem'),
65
68
  minWidth: 0
66
69
  },
67
70
  attachments: {
68
71
  display: { default: 'flex', ':empty': 'none' },
69
72
  flexWrap: 'wrap',
70
73
  justifyContent: 'flex-end',
71
- gap: '0.375rem',
74
+ gap: d('0.375rem'),
72
75
  maxWidth: 'min(85%, 36rem)',
73
76
  // Waiting, as the bubble is
74
77
  opacity: 0.8
@@ -77,8 +80,8 @@
77
80
  // A bubble with no words in it is not drawn
78
81
  display: { default: 'block', ':empty': 'none' },
79
82
  maxWidth: 'min(85%, 36rem)',
80
- paddingBlock: '0.5625rem',
81
- paddingInline: '0.875rem',
83
+ paddingBlock: d('0.5625rem'),
84
+ paddingInline: d('0.875rem'),
82
85
  borderRadius: radius.frame,
83
86
  backgroundColor: 'transparent',
84
87
  boxShadow: `inset 0 0 0 1px ${colors.borderStrong}`,
@@ -94,8 +97,12 @@
94
97
  outlineColor: colors.borderStrong,
95
98
  outlineOffset: '-1px'
96
99
  },
97
- foot: { display: 'flex', alignItems: 'center', gap: '0.125rem' },
98
- status: { paddingInlineEnd: '0.25rem', color: colors.textSubtle, fontSize: font.sizeCaption },
100
+ foot: { display: 'flex', alignItems: 'center', gap: d('0.125rem') },
101
+ status: {
102
+ paddingInlineEnd: d('0.25rem'),
103
+ color: colors.textSubtle,
104
+ fontSize: font.sizeCaption
105
+ },
99
106
  unsent: { color: colors.danger }
100
107
  });
101
108
  </script>
@@ -4,7 +4,7 @@
4
4
  import type { Snippet } from 'svelte';
5
5
  import { shared } from '../../internal/shared.js';
6
6
  import { attrs, 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 * as Tooltip from '../tooltip/index.js';
10
10
 
@@ -27,14 +27,17 @@
27
27
  children?: Snippet | undefined;
28
28
  };
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
  item: {
32
35
  position: 'relative',
33
36
  display: 'grid',
34
37
  placeItems: 'center',
35
38
  flexShrink: 0,
36
- width: '2.125rem',
37
- height: '2.125rem',
39
+ width: d('2.125rem'),
40
+ height: d('2.125rem'),
38
41
  margin: 0,
39
42
  padding: 0,
40
43
  borderWidth: 0,
@@ -54,8 +57,14 @@
54
57
  cursor: 'pointer',
55
58
  textDecoration: 'none',
56
59
  WebkitTapHighlightColor: 'transparent',
57
- // The tile is 34px; its hit area reaches 40px, as far as the gap to the next tile allows
58
- '::after': { content: '""', position: 'absolute', inset: '-3px' },
60
+ // The tile is 34px at the default density. Its hit area reaches 40px across, and down
61
+ // as far as the gap to the next tile allows.
62
+ '::after': {
63
+ content: '""',
64
+ position: 'absolute',
65
+ insetInline: `calc((${d('2.125rem')} - 2.5rem) / 2)`,
66
+ insetBlock: `calc(${d('0.375rem')} / -2)`
67
+ },
59
68
  scale: { default: null, ':active': { default: null, [media.motion]: 0.96 } },
60
69
  transitionProperty: {
61
70
  default: 'background-color, color',
@@ -91,8 +100,8 @@
91
100
  minWidth: '0.5rem',
92
101
  height: '0.5rem',
93
102
  padding: 0,
94
- top: '0.3125rem',
95
- insetInlineEnd: '0.3125rem'
103
+ top: d('0.3125rem'),
104
+ insetInlineEnd: d('0.3125rem')
96
105
  },
97
106
  badgeSuccess: { backgroundColor: colors.success }
98
107
  });
@@ -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 { roving } from '../../internal/roving.js';
@@ -21,21 +22,25 @@
21
22
  children?: Snippet | undefined;
22
23
  };
23
24
 
25
+ /** A length at the window's density (`density` in the tokens). */
26
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
27
+
24
28
  const styles = stylex.create({
25
29
  rail: {
26
30
  display: 'flex',
27
31
  flexDirection: 'column',
28
32
  alignItems: 'center',
29
- gap: '0.375rem',
33
+ gap: d('0.375rem'),
30
34
  boxSizing: 'border-box',
31
35
  flexShrink: 0,
32
36
  // As wide as an app shell's rail, in one or out of one, and as tall as its place
33
37
  width: 'var(--narvi-rail-width, 3.25rem)',
34
38
  height: '100%',
35
39
  minHeight: 0,
36
- // The first tile is centred on the line of the sheet's 3rem heads
37
- paddingTop: '0.4375rem',
38
- paddingBottom: '0.625rem',
40
+ // The first tile is centred on the line of the sheet's 3rem heads, which keep their
41
+ // height
42
+ paddingTop: `calc(1.5rem - ${d('2.125rem')} / 2)`,
43
+ paddingBottom: d('0.625rem'),
39
44
  overflowY: 'auto',
40
45
  scrollbarWidth: 'none'
41
46
  }
@@ -1,14 +1,17 @@
1
1
  <!-- A short hairline between two kinds of thing in a rail: workspaces, then tools. -->
2
2
  <script lang="ts" module>
3
3
  import * as stylex from '@stylexjs/stylex';
4
- import { colors } from '../../tokens.stylex.js';
4
+ import { colors, density } from '../../tokens.stylex.js';
5
+
6
+ /** A length at the window's density (`density` in the tokens). */
7
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
5
8
 
6
9
  const styles = stylex.create({
7
10
  separator: {
8
11
  flexShrink: 0,
9
12
  width: '0.875rem',
10
13
  height: '1px',
11
- marginBlock: '0.25rem',
14
+ marginBlock: d('0.25rem'),
12
15
  backgroundColor: colors.borderStrong
13
16
  }
14
17
  });
@@ -4,7 +4,7 @@
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, font } from '../../tokens.stylex.js';
7
+ import { colors, density, font } from '../../tokens.stylex.js';
8
8
  import { getReasoningContext } from './context.js';
9
9
 
10
10
  export type ReasoningContentProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
@@ -14,6 +14,9 @@
14
14
  children?: Snippet | undefined;
15
15
  };
16
16
 
17
+ /** A length at the window's density (`density` in the tokens). */
18
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
19
+
17
20
  const styles = stylex.create({
18
21
  // The thoughts are set in under the bulb, in line with the label above, and are
19
22
  // quieter than the answer
@@ -21,8 +24,8 @@
21
24
  display: 'flex',
22
25
  flexDirection: 'column',
23
26
  gap: '0.5rem',
24
- marginTop: '0.375rem',
25
- marginBottom: '0.25rem',
27
+ marginTop: d('0.375rem'),
28
+ marginBottom: d('0.25rem'),
26
29
  paddingInlineStart: '1.625rem',
27
30
  color: colors.textMuted,
28
31
  fontSize: font.sizeBody,
@@ -5,7 +5,7 @@
5
5
  import Chevron from '../../internal/Chevron.svelte';
6
6
  import { attrs, type Sx } from '../../internal/sx.js';
7
7
  import Tile from '../../internal/Tile.svelte';
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 Shimmer from '../shimmer/Shimmer.svelte';
11
11
  import { getReasoningContext } from './context.js';
@@ -20,13 +20,16 @@
20
20
  children?: Snippet<[{ streaming: boolean; duration: number | undefined }]> | undefined;
21
21
  };
22
22
 
23
+ /** A length at the window's density (`density` in the tokens). */
24
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
25
+
23
26
  const styles = stylex.create({
24
27
  trigger: {
25
28
  display: 'inline-flex',
26
29
  alignItems: 'center',
27
30
  alignSelf: 'flex-start',
28
31
  gap: '0.625rem',
29
- minHeight: '1.75rem',
32
+ minHeight: d('1.75rem'),
30
33
  margin: 0,
31
34
  padding: 0,
32
35
  borderWidth: 0,
@@ -39,7 +39,9 @@
39
39
  };
40
40
 
41
41
  const styles = stylex.create({
42
- // An 8px target with a 1px line in the middle, lit when it is reached
42
+ // A 4px target over the first 4px of what follows it, never over the end of what comes
43
+ // before, where that area's scrollbar is (T3 Code's #35043, on either edge). Its line lies
44
+ // on the border between them, lit when it is reached.
43
45
  handle: {
44
46
  position: 'relative',
45
47
  flexShrink: 0,
@@ -50,6 +52,8 @@
50
52
  '::after': {
51
53
  content: '""',
52
54
  position: 'absolute',
55
+ // The line reaches 1px over the border: drawn there, not taking the pointer there
56
+ pointerEvents: 'none',
53
57
  backgroundColor: {
54
58
  default: 'transparent',
55
59
  ':hover': { default: null, [media.hover]: colors.accent },
@@ -63,16 +67,16 @@
63
67
  }
64
68
  },
65
69
  vertical: {
66
- width: '0.5rem',
67
- marginInline: '-0.25rem',
70
+ width: '0.25rem',
71
+ marginInlineEnd: '-0.25rem',
68
72
  cursor: 'col-resize',
69
- '::after': { insetBlock: 0, insetInlineStart: 'calc(50% - 1px)', width: '2px' }
73
+ '::after': { insetBlock: 0, insetInlineStart: '-1px', width: '2px' }
70
74
  },
71
75
  horizontal: {
72
- height: '0.5rem',
73
- marginBlock: '-0.25rem',
76
+ height: '0.25rem',
77
+ marginBlockEnd: '-0.25rem',
74
78
  cursor: 'row-resize',
75
- '::after': { insetInline: 0, top: 'calc(50% - 1px)', height: '2px' }
79
+ '::after': { insetInline: 0, top: '-1px', height: '2px' }
76
80
  },
77
81
  dragging: {
78
82
  '::after': { backgroundColor: colors.accent, transitionDelay: '0ms' }
@@ -9,7 +9,7 @@
9
9
  import Glyph from '../../internal/Glyph.svelte';
10
10
  import { shared } from '../../internal/shared.js';
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 Kbd from '../kbd/Kbd.svelte';
15
15
 
@@ -22,6 +22,9 @@
22
22
  sx?: Sx | undefined;
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
  button: {
27
30
  display: 'flex',
@@ -50,8 +53,8 @@
50
53
  transitionDuration: motion.fast,
51
54
  transitionTimingFunction: 'ease'
52
55
  },
53
- sm: { height: '1.75rem', fontSize: font.sizeMeta },
54
- md: { height: '2rem', fontSize: font.sizeBody },
56
+ sm: { height: d('1.75rem'), fontSize: font.sizeMeta },
57
+ md: { height: d('2rem'), fontSize: font.sizeBody },
55
58
  icon: { display: 'grid', flexShrink: 0, color: colors.textSubtle },
56
59
  label: {
57
60
  flexGrow: 1,
@@ -4,7 +4,7 @@
4
4
  import * as stylex from '@stylexjs/stylex';
5
5
  import type { HTMLAttributes } from 'svelte/elements';
6
6
  import { attrs, 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 '../../internal/icons.css';
10
10
  import { groupTrigger } from '../../internal/tooltip-trigger.js';
@@ -40,6 +40,9 @@
40
40
  sx?: Sx | undefined;
41
41
  };
42
42
 
43
+ /** A length at the window's density (`density` in the tokens). */
44
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
45
+
43
46
  const styles = stylex.create({
44
47
  root: {
45
48
  WebkitAppRegion: 'no-drag',
@@ -110,8 +113,8 @@
110
113
  alignItems: 'center',
111
114
  justifyContent: 'center',
112
115
  gap: '0.375rem',
113
- minHeight: '1.75rem',
114
- paddingInline: '0.75rem',
116
+ minHeight: d('1.75rem'),
117
+ paddingInline: d('0.75rem'),
115
118
  borderRadius: radius.item,
116
119
  color: {
117
120
  default: colors.textMuted,
@@ -8,7 +8,7 @@
8
8
  import type { Snippet } from 'svelte';
9
9
  import type { HTMLAttributes } from 'svelte/elements';
10
10
  import { attrs, type Sx } from '../../internal/sx.js';
11
- import { colors, motion, radius, space } from '../../tokens.stylex.js';
11
+ import { colors, density, motion, radius, space } from '../../tokens.stylex.js';
12
12
  import { media } from '../../media.stylex.js';
13
13
  import { typography } from '../../typography.js';
14
14
  import ListRoot from '../list/ListRoot.svelte';
@@ -28,6 +28,9 @@
28
28
  children?: Snippet | undefined;
29
29
  };
30
30
 
31
+ /** A length at the window's density (`density` in the tokens). */
32
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
33
+
31
34
  const styles = stylex.create({
32
35
  root: {
33
36
  display: 'flex',
@@ -42,7 +45,7 @@
42
45
  display: 'flex',
43
46
  alignItems: 'center',
44
47
  gap: space.x2,
45
- minHeight: '1.75rem',
48
+ minHeight: d('1.75rem'),
46
49
  paddingInline: space.x4,
47
50
  borderRadius: radius.control,
48
51
  transitionProperty: { default: null, [media.motion]: 'background-color' },
@@ -1,10 +1,10 @@
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 { roving } from '../../internal/roving.js';
6
7
  import { attrs, type Sx } from '../../internal/sx.js';
7
- import { colors } from '../../tokens.stylex.js';
8
8
 
9
9
  export type SidebarContentProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
10
10
  /** Names the list for assistive technology: "Threads". */
@@ -20,16 +20,17 @@
20
20
  pinned?: Snippet | undefined;
21
21
  };
22
22
 
23
+ /** A length at the window's density (`density` in the tokens). */
24
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
25
+
23
26
  const styles = stylex.create({
24
27
  content: {
25
28
  flexGrow: 1,
26
29
  minHeight: 0,
27
30
  overflowY: 'auto',
28
31
  overscrollBehavior: 'contain',
29
- paddingInline: '0.5rem',
30
- paddingBottom: '0.75rem',
31
- scrollbarWidth: 'thin',
32
- scrollbarColor: `${colors.borderStrong} transparent`,
32
+ paddingInline: d('0.5rem'),
33
+ paddingBottom: d('0.75rem'),
33
34
  // The list fades at an edge with more beyond it
34
35
  maskImage:
35
36
  'linear-gradient(to bottom, transparent, #000 var(--narvi-fade-start, 0px), #000 calc(100% - var(--narvi-fade-end, 0px)), transparent)'
@@ -46,10 +47,8 @@
46
47
  maxHeight: '40%',
47
48
  overflowY: 'auto',
48
49
  overscrollBehavior: 'contain',
49
- paddingInline: '0.5rem',
50
- paddingBottom: '0.5rem',
51
- scrollbarWidth: 'thin',
52
- scrollbarColor: `${colors.borderStrong} transparent`
50
+ paddingInline: d('0.5rem'),
51
+ paddingBottom: d('0.5rem')
53
52
  }
54
53
  });
55
54
  </script>
@@ -12,7 +12,7 @@
12
12
  import Chevron from '../../internal/Chevron.svelte';
13
13
  import Collapse from '../../internal/Collapse.svelte';
14
14
  import { attrs, type Sx } from '../../internal/sx.js';
15
- import { colors, font, motion, radius } from '../../tokens.stylex.js';
15
+ import { colors, density, font, motion, radius } from '../../tokens.stylex.js';
16
16
  import { media } from '../../media.stylex.js';
17
17
  import { getSidebarDepth, setSidebarDepth } from './depth.js';
18
18
  import { getSidebarFold, setSidebarFold } from './fold.js';
@@ -31,6 +31,9 @@
31
31
  children?: Snippet | undefined;
32
32
  };
33
33
 
34
+ /** A length at the window's density (`density` in the tokens). */
35
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
36
+
34
37
  const styles = stylex.create({
35
38
  folder: { position: 'relative', listStyleType: 'none' },
36
39
  // Its group is folded, and the open row is not in it
@@ -42,11 +45,11 @@
42
45
  gap: '0.5rem',
43
46
  width: '100%',
44
47
  margin: 0,
45
- paddingBlock: '0.375rem',
48
+ paddingBlock: d('0.375rem'),
46
49
  // The same as Sidebar.Item, so a folder's chevron and a row's icon share one edge. A
47
50
  // folder in a folder is set in as a row is.
48
- paddingInline: '0.5rem',
49
- paddingInlineStart: 'calc(0.5rem + var(--narvi-sidebar-depth, 0) * 1.5rem)',
51
+ paddingInline: d('0.5rem'),
52
+ paddingInlineStart: `calc(${d('0.5rem')} + var(--narvi-sidebar-depth, 0) * 1.5rem)`,
50
53
  borderWidth: 0,
51
54
  borderRadius: radius.control,
52
55
  backgroundColor: {
@@ -101,7 +104,7 @@
101
104
  margin: 0,
102
105
  padding: 0,
103
106
  paddingTop: '1px',
104
- paddingBottom: '0.25rem',
107
+ paddingBottom: d('0.25rem'),
105
108
  listStyleType: 'none'
106
109
  }
107
110
  });
@@ -3,20 +3,23 @@
3
3
  import type { Snippet } from 'svelte';
4
4
  import type { HTMLAttributes } from 'svelte/elements';
5
5
  import { attrs, type Sx } from '../../internal/sx.js';
6
- import { colors } from '../../tokens.stylex.js';
6
+ import { colors, density } from '../../tokens.stylex.js';
7
7
 
8
8
  export type SidebarFooterProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
9
9
  sx?: Sx | undefined;
10
10
  children?: Snippet | undefined;
11
11
  };
12
12
 
13
+ /** A length at the window's density (`density` in the tokens). */
14
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
15
+
13
16
  const styles = stylex.create({
14
17
  footer: {
15
18
  display: 'flex',
16
19
  alignItems: 'center',
17
20
  gap: '0.625rem',
18
21
  flexShrink: 0,
19
- padding: '0.75rem',
22
+ padding: d('0.75rem'),
20
23
  borderTopWidth: '1px',
21
24
  borderTopStyle: 'solid',
22
25
  borderTopColor: colors.border