@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
@@ -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,
@@ -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,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 { roving } from '../../internal/roving.js';
@@ -19,14 +20,17 @@
19
20
  pinned?: Snippet | undefined;
20
21
  };
21
22
 
23
+ /** A length at the window's density (`density` in the tokens). */
24
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
25
+
22
26
  const styles = stylex.create({
23
27
  content: {
24
28
  flexGrow: 1,
25
29
  minHeight: 0,
26
30
  overflowY: 'auto',
27
31
  overscrollBehavior: 'contain',
28
- paddingInline: '0.5rem',
29
- paddingBottom: '0.75rem',
32
+ paddingInline: d('0.5rem'),
33
+ paddingBottom: d('0.75rem'),
30
34
  // The list fades at an edge with more beyond it
31
35
  maskImage:
32
36
  'linear-gradient(to bottom, transparent, #000 var(--narvi-fade-start, 0px), #000 calc(100% - var(--narvi-fade-end, 0px)), transparent)'
@@ -43,8 +47,8 @@
43
47
  maxHeight: '40%',
44
48
  overflowY: 'auto',
45
49
  overscrollBehavior: 'contain',
46
- paddingInline: '0.5rem',
47
- paddingBottom: '0.5rem'
50
+ paddingInline: d('0.5rem'),
51
+ paddingBottom: d('0.5rem')
48
52
  }
49
53
  });
50
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
@@ -5,7 +5,7 @@
5
5
  import Chevron from '../../internal/Chevron.svelte';
6
6
  import Collapse from '../../internal/Collapse.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 { setSidebarFold } from './fold.js';
11
11
 
@@ -32,18 +32,21 @@
32
32
  children?: Snippet | undefined;
33
33
  };
34
34
 
35
+ /** A length at the window's density (`density` in the tokens). */
36
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
37
+
35
38
  const styles = stylex.create({
36
- group: { display: 'flex', flexDirection: 'column', paddingTop: '0.75rem' },
39
+ group: { display: 'flex', flexDirection: 'column', paddingTop: d('0.75rem') },
37
40
  // Rows with no label over them start closer to what is above
38
- bare: { paddingTop: '0.375rem' },
41
+ bare: { paddingTop: d('0.375rem') },
39
42
  head: {
40
43
  display: 'flex',
41
44
  alignItems: 'center',
42
- gap: '0.25rem',
43
- minHeight: '1.75rem',
45
+ gap: d('0.25rem'),
46
+ minHeight: d('1.75rem'),
44
47
  // The rows' own inset at both ends: the label starts where their titles do, and the
45
48
  // actions end where their trailing column does
46
- paddingInline: '0.5rem'
49
+ paddingInline: d('0.5rem')
47
50
  },
48
51
  label: {
49
52
  display: 'inline-flex',
@@ -82,7 +85,7 @@
82
85
  '--narvi-icon-flush': 1,
83
86
  display: 'flex',
84
87
  alignItems: 'center',
85
- gap: '0.25rem',
88
+ gap: d('0.25rem'),
86
89
  flexShrink: 0
87
90
  },
88
91
  list: {
@@ -91,7 +94,7 @@
91
94
  gap: '1px',
92
95
  margin: 0,
93
96
  padding: 0,
94
- paddingTop: '0.125rem',
97
+ paddingTop: d('0.125rem'),
95
98
  listStyleType: 'none'
96
99
  }
97
100
  });
@@ -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';
@@ -15,18 +16,22 @@
15
16
  children?: Snippet | undefined;
16
17
  };
17
18
 
19
+ /** A length at the window's density (`density` in the tokens). */
20
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
21
+
18
22
  const styles = stylex.create({
19
23
  header: {
20
24
  display: 'flex',
21
25
  alignItems: 'center',
22
- gap: '0.25rem',
26
+ gap: d('0.25rem'),
23
27
  boxSizing: 'border-box',
24
28
  flexShrink: 0,
25
29
  // The same height as AppShell.Header, so the columns' heads sit on one line
26
30
  height: '3rem',
27
- // The usual edge, or clear of the traffic lights in a shell with no bar
28
- paddingInlineStart: 'max(1rem, calc(var(--narvi-inset-sidebar, 0px) + 0.5rem))',
29
- paddingInlineEnd: '0.5rem',
31
+ // The usual edge, which follows the rows' inset, or clear of the traffic lights in a
32
+ // shell with no bar
33
+ paddingInlineStart: `max(${d('1rem')}, calc(var(--narvi-inset-sidebar, 0px) + 0.5rem))`,
34
+ paddingInlineEnd: d('0.5rem'),
30
35
  whiteSpace: 'nowrap'
31
36
  }
32
37
  });
@@ -17,7 +17,7 @@
17
17
  import type { HTMLAnchorAttributes, HTMLAttributes } from 'svelte/elements';
18
18
  import { sidebarItemMarker } from '../../internal/markers.stylex.js';
19
19
  import { attrs, type Sx } from '../../internal/sx.js';
20
- import { colors, font, motion, radius } from '../../tokens.stylex.js';
20
+ import { colors, density, font, motion, radius } from '../../tokens.stylex.js';
21
21
  import { media } from '../../media.stylex.js';
22
22
  import { visuallyHidden } from '../../visually-hidden.js';
23
23
  import { getSidebarDepth } from './depth.js';
@@ -80,16 +80,19 @@
80
80
  const LIT =
81
81
  ':is([data-state="open"], :has([data-slot="sidebar-item-actions"] [aria-expanded="true"]))';
82
82
 
83
+ /** A length at the window's density (`density` in the tokens). */
84
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
85
+
83
86
  const styles = stylex.create({
84
87
  item: {
85
88
  position: 'relative',
86
89
  listStyleType: 'none',
87
90
  contentVisibility: 'auto',
88
- // Two lines: 50px
89
- containIntrinsicSize: 'auto 3.125rem'
91
+ // Two lines: 50px, of which 12px is padding
92
+ containIntrinsicSize: `auto calc(2.375rem + ${d('0.75rem')})`
90
93
  },
91
94
  // One line: 30px
92
- itemOneLine: { containIntrinsicSize: 'auto 1.875rem' },
95
+ itemOneLine: { containIntrinsicSize: `auto calc(1.125rem + ${d('0.75rem')})` },
93
96
  // Its group or folder is folded, and this is not the open row
94
97
  foldedAway: { display: 'none' },
95
98
  row: {
@@ -105,17 +108,19 @@
105
108
  rowGap: '0.125rem',
106
109
  width: '100%',
107
110
  margin: 0,
108
- paddingBlock: '0.375rem',
109
- paddingInline: '0.5rem',
110
- // In a folder, the title starts where the folder's name does
111
- paddingInlineStart: 'calc(0.5rem + var(--narvi-sidebar-depth, 0) * 1.5rem)',
111
+ paddingBlock: d('0.375rem'),
112
+ paddingInline: d('0.5rem'),
113
+ // In a folder, the title starts where the folder's name does. The step is an icon and
114
+ // its gap, which keep their size.
115
+ paddingInlineStart: `calc(${d('0.5rem')} + var(--narvi-sidebar-depth, 0) * 1.5rem)`,
112
116
  borderWidth: 0,
113
117
  borderRadius: radius.control,
114
118
  backgroundColor: 'transparent',
115
119
  color: colors.text,
116
120
  fontFamily: 'inherit',
117
121
  fontSize: font.sizeMeta,
118
- // A whole number of pixels, so every row is 30px and none sits between pixels
122
+ // A whole number of pixels, so at the default density every row is 30px and none
123
+ // sits between pixels
119
124
  lineHeight: '1.125rem',
120
125
  textAlign: 'start',
121
126
  textDecoration: 'none',
@@ -12,7 +12,7 @@
12
12
  import Glyph from '../../internal/Glyph.svelte';
13
13
  import { attrs, type Sx } from '../../internal/sx.js';
14
14
  import Button, { type ButtonProps, type ButtonShape } from '../button/Button.svelte';
15
- import { colors, space } from '../../tokens.stylex.js';
15
+ import { colors, density, space } from '../../tokens.stylex.js';
16
16
  import * as Menu from '../menu/index.js';
17
17
 
18
18
  export type SplitButtonProps = Omit<
@@ -66,6 +66,9 @@
66
66
  children?: Snippet | undefined;
67
67
  };
68
68
 
69
+ /** A length at the window's density (`density` in the tokens). */
70
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
71
+
69
72
  const styles = stylex.create({
70
73
  group: {
71
74
  display: 'inline-flex',
@@ -104,7 +107,7 @@
104
107
  }
105
108
  },
106
109
  // The chevron's button is a little narrower than a square: it is the lesser half
107
- moreWidth: { paddingInline: '0.375rem' }
110
+ moreWidth: { paddingInline: d('0.375rem') }
108
111
  });
109
112
  </script>
110
113
 
@@ -4,7 +4,7 @@
4
4
  import type { HTMLButtonAttributes } 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 } 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 { getSuggestionsContext } from './context.js';
10
10
 
@@ -27,15 +27,18 @@
27
27
  to: { opacity: 1 }
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
  display: 'inline-flex',
33
36
  alignItems: 'center',
34
37
  flexShrink: 0,
35
38
  gap: '0.375rem',
36
- minHeight: '2rem',
39
+ minHeight: d('2rem'),
37
40
  margin: 0,
38
- paddingInline: '0.75rem',
41
+ paddingInline: d('0.75rem'),
39
42
  borderWidth: 0,
40
43
  borderRadius: `calc(${radius.card} * 4 / 3)`,
41
44
  backgroundColor: {
@@ -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 { attrs, type Sx } from '../../internal/sx.js';
@@ -23,13 +24,16 @@
23
24
  children?: Snippet | undefined;
24
25
  };
25
26
 
27
+ /** A length at the window's density (`density` in the tokens). */
28
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
29
+
26
30
  const styles = stylex.create({
27
31
  root: {
28
32
  display: 'flex',
29
33
  // Pills keep their own height, however tall the space they are placed in
30
34
  alignItems: 'flex-start',
31
35
  alignContent: 'flex-start',
32
- gap: '0.5rem',
36
+ gap: d('0.5rem'),
33
37
  minWidth: 0
34
38
  },
35
39
  wrap: {
@@ -25,7 +25,7 @@
25
25
  import * as Menu from '../menu/index.js';
26
26
  import { TabDragging, tabOffset } from './drag.svelte.js';
27
27
  import { attrs, type Sx } from '../../internal/sx.js';
28
- import { colors, font, motion, radius } from '../../tokens.stylex.js';
28
+ import { colors, density, font, motion, radius } from '../../tokens.stylex.js';
29
29
  import { media } from '../../media.stylex.js';
30
30
 
31
31
  export type TabStripTab = {
@@ -109,12 +109,15 @@
109
109
  // One key for every hover, so the catalog can show it without a pointer
110
110
  const HOVER = ':is(:hover, [data-preview~="hover"])';
111
111
 
112
+ /** A length at the window's density (`density` in the tokens). */
113
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
114
+
112
115
  const styles = stylex.create({
113
116
  root: {
114
117
  display: 'flex',
115
118
  alignItems: 'center',
116
119
  // The button to add one stands a little apart from the last tab
117
- gap: '0.375rem',
120
+ gap: d('0.375rem'),
118
121
  minWidth: 0,
119
122
  fontFamily: font.body
120
123
  },
@@ -122,7 +125,7 @@
122
125
  list: {
123
126
  display: 'flex',
124
127
  alignItems: 'center',
125
- gap: '0.125rem',
128
+ gap: d('0.125rem'),
126
129
  minWidth: 0,
127
130
  overflowX: 'auto',
128
131
  overscrollBehaviorX: 'contain',
@@ -185,11 +188,11 @@
185
188
  gap: '0.4375rem',
186
189
  flexGrow: 1,
187
190
  minWidth: 0,
188
- height: '1.75rem',
191
+ height: d('1.75rem'),
189
192
  margin: 0,
190
193
  paddingBlock: 0,
191
- paddingInlineStart: '0.625rem',
192
- paddingInlineEnd: '0.625rem',
194
+ paddingInlineStart: d('0.625rem'),
195
+ paddingInlineEnd: d('0.625rem'),
193
196
  borderWidth: 0,
194
197
  borderRadius: 'inherit',
195
198
  backgroundColor: 'transparent',
@@ -206,8 +209,9 @@
206
209
  outlineColor: colors.focusRing,
207
210
  outlineOffset: '0px'
208
211
  },
209
- // A tab that can be closed keeps room at its end for the button
210
- closable: { paddingInlineEnd: '1.625rem' },
212
+ // A tab that can be closed keeps room at its end for the button: its inset, which follows the
213
+ // density, then the button and a gap, which keep their size
214
+ closable: { paddingInlineEnd: `calc(${d('0.25rem')} + 1.375rem)` },
211
215
  // With buttons of its own, the room for the close button is kept after them
212
216
  buttonBeforeTrailing: { paddingInlineEnd: '0.375rem' },
213
217
  trailing: {
@@ -215,9 +219,9 @@
215
219
  alignItems: 'center',
216
220
  gap: '0.125rem',
217
221
  flexShrink: 0,
218
- paddingInlineEnd: '0.25rem'
222
+ paddingInlineEnd: d('0.25rem')
219
223
  },
220
- trailingBeforeEnd: { paddingInlineEnd: '1.5rem' },
224
+ trailingBeforeEnd: { paddingInlineEnd: `calc(${d('0.25rem')} + 1.25rem)` },
221
225
  // The name, typed in place
222
226
  rename: {
223
227
  boxSizing: 'border-box',
@@ -225,8 +229,8 @@
225
229
  width: '8rem',
226
230
  minWidth: 0,
227
231
  height: '1.25rem',
228
- marginInline: '0.25rem',
229
- paddingInline: '0.375rem',
232
+ marginInline: d('0.25rem'),
233
+ paddingInline: d('0.375rem'),
230
234
  borderWidth: 0,
231
235
  borderRadius: radius.item,
232
236
  backgroundColor: colors.bgRaised,
@@ -264,9 +268,10 @@
264
268
  }
265
269
  },
266
270
  leadMark: { gridArea: '1 / 1' },
271
+ // Centred on the leading icon, which starts after the tab's padding
267
272
  start: {
268
273
  position: 'absolute',
269
- insetInlineStart: '0.5rem',
274
+ insetInlineStart: `calc(${d('0.625rem')} - 0.125rem)`,
270
275
  top: '50%',
271
276
  translate: '0 -50%',
272
277
  display: 'grid',
@@ -291,7 +296,7 @@
291
296
  // with focus inside; until then a mark may stand there.
292
297
  end: {
293
298
  position: 'absolute',
294
- insetInlineEnd: '0.25rem',
299
+ insetInlineEnd: d('0.25rem'),
295
300
  top: '50%',
296
301
  translate: '0 -50%',
297
302
  display: 'grid',
@@ -350,8 +355,8 @@
350
355
  display: 'grid',
351
356
  placeItems: 'center',
352
357
  flexShrink: 0,
353
- width: '1.75rem',
354
- height: '1.75rem',
358
+ width: d('1.75rem'),
359
+ height: d('1.75rem'),
355
360
  margin: 0,
356
361
  padding: 0,
357
362
  borderWidth: 0,
@@ -8,7 +8,7 @@
8
8
  import * as Tooltip from '../tooltip/index.js';
9
9
  import TooltipScope from '../../internal/TooltipScope.svelte';
10
10
  import { attrs, type Sx } from '../../internal/sx.js';
11
- import { colors, font, motion, radius } from '../../tokens.stylex.js';
11
+ import { colors, density, font, motion, radius } from '../../tokens.stylex.js';
12
12
  import { media } from '../../media.stylex.js';
13
13
 
14
14
  export type TabItem = {
@@ -37,6 +37,9 @@
37
37
  children?: Snippet<[string]> | undefined;
38
38
  };
39
39
 
40
+ /** A length at the window's density (`density` in the tokens). */
41
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
42
+
40
43
  const styles = stylex.create({
41
44
  root: {
42
45
  minWidth: 0,
@@ -45,7 +48,7 @@
45
48
  list: {
46
49
  WebkitAppRegion: 'no-drag',
47
50
  display: 'flex',
48
- gap: '1.25rem',
51
+ gap: d('1.25rem'),
49
52
  borderBottomWidth: '1px',
50
53
  borderBottomStyle: 'solid',
51
54
  borderBottomColor: colors.border
@@ -57,7 +60,7 @@
57
60
  alignItems: 'center',
58
61
  gap: '0.375rem',
59
62
  flexShrink: 0,
60
- minHeight: '2.125rem',
63
+ minHeight: d('2.125rem'),
61
64
  margin: 0,
62
65
  padding: 0,
63
66
  borderWidth: 0,
@@ -103,7 +106,7 @@
103
106
  fontVariantNumeric: 'tabular-nums'
104
107
  },
105
108
  panel: {
106
- paddingTop: '0.875rem',
109
+ paddingTop: d('0.875rem'),
107
110
  outlineStyle: 'solid',
108
111
  outlineWidth: { default: 0, ':focus-visible': '2px' },
109
112
  outlineColor: colors.focusRing,
@@ -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 { HTMLTextareaAttributes } from 'svelte/elements';
4
5
  import { control } from '../../internal/control.js';
5
6
  import { attrs, type Sx } from '../../internal/sx.js';
@@ -14,11 +15,14 @@
14
15
  ref?: HTMLTextAreaElement | null | undefined;
15
16
  };
16
17
 
18
+ /** A length at the window's density (`density` in the tokens). */
19
+ const d = (rem: string) => `calc(${rem} * ${density.factor})`;
20
+
17
21
  const styles = stylex.create({
18
22
  base: {
19
23
  minHeight: '5rem',
20
- paddingBlock: '0.5rem',
21
- paddingInline: '0.625rem',
24
+ paddingBlock: d('0.5rem'),
25
+ paddingInline: d('0.625rem'),
22
26
  resize: 'vertical'
23
27
  },
24
28
  autosize: {