@diegopluna/narvi 0.3.11 → 0.3.13

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 (88) 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/kbd/Kbd.svelte +2 -0
  31. package/dist/components/message/MessageActions.svelte +8 -4
  32. package/dist/components/message/MessageContent.svelte +6 -2
  33. package/dist/components/message/MessagePending.svelte +5 -2
  34. package/dist/components/message/MessageRoot.svelte +10 -4
  35. package/dist/components/message/MessageTime.svelte +5 -2
  36. package/dist/components/message/styles.d.ts +2 -2
  37. package/dist/components/message/styles.js +5 -3
  38. package/dist/components/notice/Notice.svelte +13 -4
  39. package/dist/components/plan/Plan.svelte +13 -10
  40. package/dist/components/popover/PopoverContent.svelte +8 -1
  41. package/dist/components/questionnaire/Questionnaire.svelte +12 -9
  42. package/dist/components/queued-message/QueuedMessage.svelte +14 -7
  43. package/dist/components/rail/RailItem.svelte +16 -7
  44. package/dist/components/rail/RailRoot.svelte +9 -4
  45. package/dist/components/rail/RailSeparator.svelte +5 -2
  46. package/dist/components/reasoning/ReasoningContent.svelte +6 -3
  47. package/dist/components/reasoning/ReasoningTrigger.svelte +5 -2
  48. package/dist/components/search-button/SearchButton.svelte +6 -3
  49. package/dist/components/segmented/SegmentedControl.svelte +6 -3
  50. package/dist/components/settings-group/SettingsGroup.svelte +5 -2
  51. package/dist/components/sidebar/SidebarContent.svelte +8 -4
  52. package/dist/components/sidebar/SidebarFolder.svelte +8 -5
  53. package/dist/components/sidebar/SidebarFooter.svelte +5 -2
  54. package/dist/components/sidebar/SidebarGroup.svelte +11 -8
  55. package/dist/components/sidebar/SidebarHeader.svelte +9 -4
  56. package/dist/components/sidebar/SidebarItem.svelte +14 -9
  57. package/dist/components/split-button/SplitButton.svelte +5 -2
  58. package/dist/components/suggestions/SuggestionsItem.svelte +6 -3
  59. package/dist/components/suggestions/SuggestionsRoot.svelte +5 -1
  60. package/dist/components/tab-strip/TabStrip.svelte +21 -16
  61. package/dist/components/tabs/Tabs.svelte +7 -4
  62. package/dist/components/textarea/Textarea.svelte +6 -2
  63. package/dist/components/theme/Theme.svelte +28 -2
  64. package/dist/components/toast/Toaster.svelte +14 -5
  65. package/dist/components/toggle-group/ToggleGroupRoot.svelte +5 -1
  66. package/dist/components/tool/ToolContent.svelte +8 -4
  67. package/dist/components/tool/ToolSection.svelte +7 -4
  68. package/dist/components/tool/ToolTrigger.svelte +5 -2
  69. package/dist/components/tooltip/TooltipContent.svelte +7 -4
  70. package/dist/components/work-fold/WorkFold.svelte +9 -6
  71. package/dist/internal/Code.svelte +6 -3
  72. package/dist/internal/control.d.ts +6 -6
  73. package/dist/internal/control.js +9 -7
  74. package/dist/internal/layer.d.ts +10 -10
  75. package/dist/internal/layer.js +14 -12
  76. package/dist/internal/toggle.d.ts +8 -8
  77. package/dist/internal/toggle.js +22 -10
  78. package/dist/preset.d.ts +12 -3
  79. package/dist/preset.js +18 -4
  80. package/dist/tokens.stylex.d.ts +13 -3
  81. package/dist/tokens.stylex.js +25 -14
  82. package/package.json +1 -1
  83. package/skills/building-ui/SKILL.md +1 -1
  84. package/skills/building-ui/references/components.md +1 -1
  85. package/skills/markdown/SKILL.md +1 -1
  86. package/skills/setup/SKILL.md +1 -1
  87. package/skills/styling/SKILL.md +5 -2
  88. package/skills/theming/SKILL.md +44 -3
@@ -3,7 +3,7 @@
3
3
  import type { Snippet } from 'svelte';
4
4
  import type { ClassValue, HTMLInputAttributes } from 'svelte/elements';
5
5
  import '../../internal/icons.css';
6
- import { colors } from '../../tokens.stylex.js';
6
+ import { colors, density } from '../../tokens.stylex.js';
7
7
  import { control, type ControlSize } from '../../internal/control.js';
8
8
  import { attrs, type Sx } from '../../internal/sx.js';
9
9
  import { getFieldContext } from '../field/context.js';
@@ -31,6 +31,9 @@
31
31
  ref?: HTMLInputElement | null | 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
  frame: { position: 'relative', display: 'block', width: '100%', minWidth: 0 },
36
39
  // In the field's start padding, where the pointer passes through to the field
@@ -42,13 +45,14 @@
42
45
  color: colors.textSubtle,
43
46
  pointerEvents: 'none'
44
47
  },
45
- iconSm: { '--narvi-icon-size': '0.875rem', insetInlineStart: '8px' },
46
- iconMd: { '--narvi-icon-size': '1rem', insetInlineStart: '10px' },
47
- iconLg: { '--narvi-icon-size': '1rem', insetInlineStart: '12px' },
48
- // The text starts after the icon: its inset, its size and a gap of 6px
49
- besideSm: { paddingInlineStart: '28px' },
50
- besideMd: { paddingInlineStart: '32px' },
51
- besideLg: { paddingInlineStart: '34px' }
48
+ iconSm: { '--narvi-icon-size': '0.875rem', insetInlineStart: d('0.5rem') },
49
+ iconMd: { '--narvi-icon-size': '1rem', insetInlineStart: d('0.625rem') },
50
+ iconLg: { '--narvi-icon-size': '1rem', insetInlineStart: d('0.75rem') },
51
+ // The text starts after the icon: its inset, which follows the density, then its size and a
52
+ // gap of 6px, which keep theirs
53
+ besideSm: { paddingInlineStart: `calc(${d('0.5rem')} + 1.25rem)` },
54
+ besideMd: { paddingInlineStart: `calc(${d('0.625rem')} + 1.375rem)` },
55
+ besideLg: { paddingInlineStart: `calc(${d('0.75rem')} + 1.375rem)` }
52
56
  });
53
57
 
54
58
  const iconStyles = { sm: styles.iconSm, md: styles.iconMd, lg: styles.iconLg };
@@ -16,6 +16,8 @@
16
16
  base: {
17
17
  display: 'inline-grid',
18
18
  placeItems: 'center',
19
+ // A key cap keeps its width in a flex row, so a long label beside it gives way first
20
+ flexShrink: 0,
19
21
  boxSizing: 'border-box',
20
22
  minWidth: '1.25rem',
21
23
  minHeight: '1.25rem',
@@ -4,7 +4,7 @@
4
4
  import type { HTMLAttributes } from 'svelte/elements';
5
5
  import { messageMarker } from '../../internal/markers.stylex.js';
6
6
  import { attrs, type Sx } from '../../internal/sx.js';
7
- import { motion } from '../../tokens.stylex.js';
7
+ import { density, motion } from '../../tokens.stylex.js';
8
8
  import { media } from '../../media.stylex.js';
9
9
  import { getMessageContext } from './context.js';
10
10
 
@@ -22,14 +22,18 @@
22
22
  children?: Snippet | 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
  actions: {
27
30
  display: 'flex',
28
31
  alignItems: 'center',
29
- gap: '2px'
32
+ gap: d('0.125rem')
30
33
  },
31
- // The buttons' icons line up with the edge of the text above them
32
- assistant: { marginInlineStart: '-6px' },
34
+ // The buttons' icons line up with the edge of the text above them. The buttons follow the
35
+ // density and their 14px icons do not, so the room around an icon changes with it.
36
+ assistant: { marginInlineStart: `calc((0.875rem - ${d('1.75rem')}) / 2 + 1px)` },
33
37
  user: { marginInlineEnd: '-2px' },
34
38
  // Revealed on hover. The space stays, so nothing shifts when they appear.
35
39
  hover: {
@@ -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 { shared } from '../../internal/shared.js';
@@ -20,12 +21,15 @@
20
21
  children?: Snippet | undefined;
21
22
  };
22
23
 
24
+ /** A length at the window's density (`density` in the tokens). */
25
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
26
+
23
27
  const styles = stylex.create({
24
28
  content: {
25
29
  boxSizing: 'border-box',
26
30
  display: 'flex',
27
31
  flexDirection: 'column',
28
- gap: '0.75rem',
32
+ gap: d('0.75rem'),
29
33
  minWidth: 0,
30
34
  overflowWrap: 'break-word'
31
35
  },
@@ -33,7 +37,7 @@
33
37
  around: {
34
38
  alignItems: 'flex-end',
35
39
  alignSelf: 'stretch',
36
- gap: '0.5rem'
40
+ gap: d('0.5rem')
37
41
  },
38
42
  assistant: {
39
43
  width: '100%'
@@ -8,7 +8,7 @@
8
8
  import type { HTMLAttributes } from 'svelte/elements';
9
9
  import { attrs, type Sx } from '../../internal/sx.js';
10
10
  import Tile from '../../internal/Tile.svelte';
11
- import { colors, font, motion } from '../../tokens.stylex.js';
11
+ import { colors, density, font, motion } from '../../tokens.stylex.js';
12
12
  import Shimmer from '../shimmer/Shimmer.svelte';
13
13
 
14
14
  export type MessagePendingProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
@@ -17,12 +17,15 @@
17
17
  sx?: Sx | undefined;
18
18
  };
19
19
 
20
+ /** A length at the window's density (`density` in the tokens). */
21
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
22
+
20
23
  const styles = stylex.create({
21
24
  row: {
22
25
  display: 'flex',
23
26
  alignItems: 'center',
24
27
  gap: '0.625rem',
25
- minHeight: '1.75rem',
28
+ minHeight: d('1.75rem'),
26
29
  color: colors.textMuted,
27
30
  fontSize: font.sizeBody,
28
31
  lineHeight: 1,
@@ -4,7 +4,7 @@
4
4
  import type { HTMLAttributes } from 'svelte/elements';
5
5
  import { messageMarker } from '../../internal/markers.stylex.js';
6
6
  import { attrs, 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 { media } from '../../media.stylex.js';
9
9
  import { setMessageContext, type MessageFrom } from './context.js';
10
10
  import type { MessageTextSize } from './styles.js';
@@ -31,11 +31,14 @@
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
  root: {
36
39
  display: 'flex',
37
40
  flexDirection: 'column',
38
- gap: '0.375rem',
41
+ gap: d('0.375rem'),
39
42
  minWidth: 0,
40
43
  color: colors.text,
41
44
  fontFamily: font.body
@@ -50,8 +53,11 @@
50
53
  default: 'column',
51
54
  [media.hover]: { default: 'row-reverse', [HOLDS_MORE]: 'column' }
52
55
  },
53
- gap: { default: '0.375rem', [media.hover]: { default: '0.25rem', [HOLDS_MORE]: '0.375rem' } },
54
- marginBlockStart: { default: '1.5rem', ':first-child': 0 }
56
+ gap: {
57
+ default: d('0.375rem'),
58
+ [media.hover]: { default: d('0.25rem'), [HOLDS_MORE]: d('0.375rem') }
59
+ },
60
+ marginBlockStart: { default: d('1.5rem'), ':first-child': 0 }
55
61
  },
56
62
  assistant: { alignItems: 'stretch' }
57
63
  });
@@ -6,7 +6,7 @@
6
6
  import * as stylex from '@stylexjs/stylex';
7
7
  import { messageMarker } from '../../internal/markers.stylex.js';
8
8
  import { attrs, type Sx } from '../../internal/sx.js';
9
- import { colors, font, motion } from '../../tokens.stylex.js';
9
+ import { colors, density, font, motion } from '../../tokens.stylex.js';
10
10
  import { media } from '../../media.stylex.js';
11
11
 
12
12
  export type MessageTimeProps = {
@@ -18,9 +18,12 @@
18
18
  class?: string | undefined;
19
19
  };
20
20
 
21
+ /** A length at the window's density (`density` in the tokens). */
22
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
23
+
21
24
  const styles = stylex.create({
22
25
  time: {
23
- paddingInline: '0.375rem',
26
+ paddingInline: d('0.375rem'),
24
27
  color: colors.textSubtle,
25
28
  fontSize: font.sizeCaption,
26
29
  fontVariantNumeric: 'tabular-nums',
@@ -20,8 +20,8 @@ export declare const bubble: Readonly<{
20
20
  readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">;
21
21
  readonly maxWidth: stylex.StyleXClassNameFor<"maxWidth", "min(85%, 36rem)">;
22
22
  readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
23
- readonly paddingBlock: stylex.StyleXClassNameFor<"paddingBlock", "0.5625rem">;
24
- readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", "0.875rem">;
23
+ readonly paddingBlock: stylex.StyleXClassNameFor<"paddingBlock", string>;
24
+ readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
25
25
  readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
26
26
  readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
27
27
  readonly whiteSpace: stylex.StyleXClassNameFor<"whiteSpace", "pre-wrap">;
@@ -3,7 +3,9 @@
3
3
  * they are read at, and the person's bubble.
4
4
  */
5
5
  import * as stylex from '@stylexjs/stylex';
6
- import { colors, font, radius } from '../../tokens.stylex.js';
6
+ import { colors, density, font, radius } from '../../tokens.stylex.js';
7
+ /** A length at the window's density (`density` in the tokens). */
8
+ const d = (rem) => `calc(${rem} * ${density.factor})`;
7
9
  export const text = stylex.create({
8
10
  reading: { fontSize: font.sizeReading, lineHeight: font.leadingNormal },
9
11
  body: { fontSize: font.sizeBody, lineHeight: font.leadingNormal }
@@ -14,8 +16,8 @@ export const bubble = stylex.create({
14
16
  boxSizing: 'border-box',
15
17
  maxWidth: 'min(85%, 36rem)',
16
18
  minWidth: 0,
17
- paddingBlock: '0.5625rem',
18
- paddingInline: '0.875rem',
19
+ paddingBlock: d('0.5625rem'),
20
+ paddingInline: d('0.875rem'),
19
21
  borderRadius: radius.frame,
20
22
  backgroundColor: colors.fillMuted,
21
23
  whiteSpace: 'pre-wrap',
@@ -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, radius } from '../../tokens.stylex.js';
12
+ import { colors, density, font, radius } from '../../tokens.stylex.js';
13
13
  import Spinner from '../spinner/Spinner.svelte';
14
14
 
15
15
  export type NoticeTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger';
@@ -39,14 +39,17 @@
39
39
  children?: Snippet | undefined;
40
40
  };
41
41
 
42
+ /** A length at the window's density (`density` in the tokens). */
43
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
44
+
42
45
  const styles = stylex.create({
43
46
  notice: {
44
47
  display: 'grid',
45
48
  gridTemplateColumns: 'auto minmax(0, 1fr) auto',
46
49
  alignItems: 'start',
47
50
  columnGap: '0.625rem',
48
- paddingBlock: '0.625rem',
49
- paddingInline: '0.75rem',
51
+ paddingBlock: d('0.625rem'),
52
+ paddingInline: d('0.75rem'),
50
53
  borderRadius: radius.panel,
51
54
  fontSize: font.sizeBody,
52
55
  lineHeight: font.leadingSnug
@@ -86,7 +89,13 @@
86
89
  userSelect: 'text',
87
90
  overflowWrap: 'anywhere'
88
91
  },
89
- actions: { display: 'flex', alignItems: 'center', gap: '0.25rem', marginBlock: '-0.25rem' }
92
+ // Small buttons take no more room than the first line, about 20px, at any density
93
+ actions: {
94
+ display: 'flex',
95
+ alignItems: 'center',
96
+ gap: d('0.25rem'),
97
+ marginBlock: `calc((1.25rem - ${d('1.75rem')}) / 2)`
98
+ }
90
99
  });
91
100
  </script>
92
101
 
@@ -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,