@astryxdesign/cli 0.7.0-canary.61639ee → 0.7.0-canary.6ecd417

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.
@@ -0,0 +1,178 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ import {describe, expect, it} from 'vitest';
4
+ import transform from '../preserve-bottom-sheet-content-padding.mjs';
5
+
6
+ async function applyTransform(source) {
7
+ const jscodeshift = (await import('jscodeshift')).default;
8
+ const j = jscodeshift.withParser('tsx');
9
+ const api = {jscodeshift: j, stats: () => {}, report: () => {}};
10
+ return transform({source, path: 'test.tsx'}, api) ?? source;
11
+ }
12
+
13
+ describe('preserve-bottom-sheet-content-padding', () => {
14
+ it('adds padding={0} to a sheet with self-padded content', async () => {
15
+ const output =
16
+ await applyTransform(`import {BottomSheet, VStack} from '@astryxdesign/core';
17
+ const a = (
18
+ <BottomSheet isOpen={isOpen} onOpenChange={setIsOpen} label="Filters">
19
+ <VStack gap={4} padding={4}>x</VStack>
20
+ </BottomSheet>
21
+ );`);
22
+
23
+ expect(output).toContain(
24
+ '<BottomSheet isOpen={isOpen} onOpenChange={setIsOpen} label="Filters" padding={0}>',
25
+ );
26
+ });
27
+
28
+ it('leaves a sheet whose only child is a core Section unchanged', async () => {
29
+ const source = `import {BottomSheet, Section, VStack} from '@astryxdesign/core';
30
+ const a = (
31
+ <BottomSheet isOpen onOpenChange={() => {}} label="Filters">
32
+ {/* filters */}
33
+ <Section padding={4}>
34
+ <VStack gap={4}>x</VStack>
35
+ </Section>
36
+ </BottomSheet>
37
+ );`;
38
+ expect(await applyTransform(source)).toBe(source);
39
+ });
40
+
41
+ it('leaves a sheet whose only child is a core Layout unchanged', async () => {
42
+ const source = `import {BottomSheet, Layout, LayoutContent} from '@astryxdesign/core';
43
+ const a = (
44
+ <BottomSheet isOpen onOpenChange={() => {}} label="Message">
45
+ <Layout content={<LayoutContent>x</LayoutContent>} />
46
+ </BottomSheet>
47
+ );`;
48
+ expect(await applyTransform(source)).toBe(source);
49
+ });
50
+
51
+ it('flags every nested Layout with a TODO, with or without its own padding', async () => {
52
+ const output =
53
+ await applyTransform(`import {BottomSheet, Layout, VStack} from '@astryxdesign/core';
54
+ function A() {
55
+ return (
56
+ <BottomSheet sheetId="a" label="A">
57
+ <VStack>
58
+ <Layout content={x} />
59
+ </VStack>
60
+ </BottomSheet>
61
+ );
62
+ }
63
+ function B() {
64
+ return (
65
+ <BottomSheet sheetId="b" label="B">
66
+ <VStack>
67
+ <Layout padding={4} content={x} />
68
+ </VStack>
69
+ </BottomSheet>
70
+ );
71
+ }`);
72
+
73
+ expect(output).toContain('<BottomSheet sheetId="a" label="A" padding={0}>');
74
+ expect(output).toContain('<BottomSheet sheetId="b" label="B" padding={0}>');
75
+ expect(output.match(/TODO\(astryx upgrade\)/g)).toHaveLength(2);
76
+ expect(output.indexOf('TODO(astryx upgrade)')).toBeLessThan(
77
+ output.indexOf('sheetId="a"'),
78
+ );
79
+ expect(output.indexOf('TODO(astryx upgrade)')).toBeGreaterThan(
80
+ output.indexOf('function A'),
81
+ );
82
+ expect(output.lastIndexOf('TODO(astryx upgrade)')).toBeGreaterThan(
83
+ output.indexOf('function B'),
84
+ );
85
+ });
86
+
87
+ it('does not flag a Layout from another package or a shadowed Layout binding', async () => {
88
+ const output =
89
+ await applyTransform(`import {BottomSheet} from '@astryxdesign/core';
90
+ import {Layout} from './my-layout';
91
+ export function A() {
92
+ return <BottomSheet isOpen><Layout content={<p>b</p>} /></BottomSheet>;
93
+ }
94
+ `);
95
+ expect(output).toContain('padding={0}');
96
+ expect(output).not.toContain('TODO');
97
+ });
98
+
99
+ it('leaves a BottomSheet that a parameter or local binding shadows alone', async () => {
100
+ const source = `import {BottomSheet} from '@astryxdesign/core';
101
+ export function Host({BottomSheet: Sheet}) {
102
+ return <Sheet isOpen><p>own inset</p></Sheet>;
103
+ }
104
+ export function Local() {
105
+ const BottomSheet = (props) => <div {...props} />;
106
+ return <BottomSheet isOpen><p>own inset</p></BottomSheet>;
107
+ }
108
+ `;
109
+ expect(await applyTransform(source)).toBe(source);
110
+ });
111
+
112
+ it('is idempotent: a second run changes nothing', async () => {
113
+ const once =
114
+ await applyTransform(`import {BottomSheet, Layout, VStack} from '@astryxdesign/core';
115
+ export function A() {
116
+ return <BottomSheet isOpen><VStack><p>a</p></VStack></BottomSheet>;
117
+ }
118
+ export function B() {
119
+ return <BottomSheet isOpen><VStack><Layout content={<p>b</p>} /></VStack></BottomSheet>;
120
+ }
121
+ `);
122
+ expect(await applyTransform(once)).toBe(once);
123
+ });
124
+
125
+ it('pads a sheet when the Section has a sibling or is not from core', async () => {
126
+ const output =
127
+ await applyTransform(`import {BottomSheet} from '@astryxdesign/core';
128
+ import {Section} from './local';
129
+ import {Section as CoreSection} from '@astryxdesign/core';
130
+ const a = <BottomSheet sheetId="a" label="A"><Section>x</Section></BottomSheet>;
131
+ const b = (
132
+ <BottomSheet sheetId="b" label="B">
133
+ <CoreSection>x</CoreSection>
134
+ <p>after</p>
135
+ </BottomSheet>
136
+ );`);
137
+
138
+ expect(output).toContain('<BottomSheet sheetId="a" label="A" padding={0}>');
139
+ expect(output).toContain('<BottomSheet sheetId="b" label="B" padding={0}>');
140
+ });
141
+
142
+ it('leaves a sheet that already sets padding unchanged', async () => {
143
+ const source = `import {BottomSheet} from '@astryxdesign/core';
144
+ const a = <BottomSheet sheetId="a" label="A" padding={2}>x</BottomSheet>;
145
+ const b = <BottomSheet sheetId="b" label="B" padding={value}>x</BottomSheet>;`;
146
+ expect(await applyTransform(source)).toBe(source);
147
+ });
148
+
149
+ it('follows aliases, subpath default imports, and namespace imports', async () => {
150
+ const output =
151
+ await applyTransform(`import {BottomSheet as Sheet} from '@astryxdesign/core';
152
+ import Panel from '@astryxdesign/core/BottomSheet';
153
+ import * as Core from '@astryxdesign/core';
154
+ const a = <Sheet sheetId="a" label="A">x</Sheet>;
155
+ const b = <Panel sheetId="b" label="B">x</Panel>;
156
+ const c = <Core.BottomSheet sheetId="c" label="C">x</Core.BottomSheet>;`);
157
+
158
+ expect(output).toContain('<Sheet sheetId="a" label="A" padding={0}>');
159
+ expect(output).toContain('<Panel sheetId="b" label="B" padding={0}>');
160
+ expect(output).toContain(
161
+ '<Core.BottomSheet sheetId="c" label="C" padding={0}>',
162
+ );
163
+ });
164
+
165
+ it('puts padding={0} before a spread so a spread padding still wins', async () => {
166
+ const output =
167
+ await applyTransform(`import {BottomSheet} from '@astryxdesign/core';
168
+ const a = <BottomSheet label="A" {...args} />;`);
169
+
170
+ expect(output).toContain('<BottomSheet label="A" padding={0} {...args} />');
171
+ });
172
+
173
+ it('ignores BottomSheet from other packages', async () => {
174
+ const source = `import {BottomSheet} from './prototype';
175
+ const a = <BottomSheet title="A">x</BottomSheet>;`;
176
+ expect(await applyTransform(source)).toBe(source);
177
+ });
178
+ });
@@ -13,6 +13,9 @@ import migrateDeprecatedThemeSurface, {
13
13
  import migrateFieldInputStyling, {
14
14
  meta as migrateFieldInputStylingMeta,
15
15
  } from './migrate-field-input-styling.mjs';
16
+ import preserveBottomSheetContentPadding, {
17
+ meta as preserveBottomSheetContentPaddingMeta,
18
+ } from './preserve-bottom-sheet-content-padding.mjs';
16
19
  import validateDataTokenOwnership, {
17
20
  meta as validateDataTokenOwnershipMeta,
18
21
  } from './validate-data-token-ownership.mjs';
@@ -33,4 +36,9 @@ export default [
33
36
  transform: migrateFieldInputStyling,
34
37
  meta: migrateFieldInputStylingMeta,
35
38
  },
39
+ {
40
+ name: 'preserve-bottom-sheet-content-padding',
41
+ transform: preserveBottomSheetContentPadding,
42
+ meta: preserveBottomSheetContentPaddingMeta,
43
+ },
36
44
  ];
@@ -0,0 +1,242 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file Codemod: preserve BottomSheet content geometry after it became a container
5
+ *
6
+ * BottomSheet now pads its content box like Dialog (theme `bottom-sheet`
7
+ * padding, else `--spacing-4`). Before, the content box had no padding, so
8
+ * callers supplied their own inset. This codemod keeps every existing sheet's
9
+ * geometry by adding `padding={0}` to imported BottomSheet elements that do not
10
+ * set `padding`.
11
+ *
12
+ * Sheets whose only child is a core `Section` or `Layout` are left alone: both
13
+ * escape the inset their container publishes, so they already render exactly
14
+ * as they did in the unpadded box.
15
+ *
16
+ * `padding={0}` goes before the first spread attribute, so a spread that
17
+ * carries `padding` still wins.
18
+ *
19
+ * `padding={0}` also zeroes the inset a nested `Layout` puts between its
20
+ * regions: a Layout's own `padding` restores only its outer edges, and the
21
+ * inner inset comes from the sheet's container chain. Such a sheet still gets
22
+ * `padding={0}`, plus a TODO comment on its statement (api.report is a stub;
23
+ * comments are the only warning channel).
24
+ */
25
+
26
+ export const meta = {
27
+ title: 'Preserve BottomSheet content padding',
28
+ description:
29
+ 'BottomSheet now pads its content like Dialog. Adds `padding={0}` to ' +
30
+ 'BottomSheet elements that do not set `padding`, keeping their previous ' +
31
+ 'unpadded content box. Sheets whose only child is a Section ' +
32
+ 'or Layout are left unchanged; they render identically. A sheet with a ' +
33
+ 'nested Layout anywhere in its content also gets a TODO comment, because ' +
34
+ "padding={0} removes the inset between that Layout's regions and the " +
35
+ "Layout's own padding restores only its outer edges. Remove " +
36
+ '`padding={0}` and your own inset to adopt the theme padding. An app ' +
37
+ 'whose theme already sets `bottom-sheet` padding on every edge is not ' +
38
+ 'affected by the new default; the transform cannot see the theme, so ' +
39
+ 'remove the added `padding={0}` there to keep the theme inset.',
40
+ };
41
+
42
+ const CORE_IMPORT_RE = /^@(astryxdesign|xds)\/core(?:\/|$)/;
43
+
44
+ const TODO_COMMENT =
45
+ ' TODO(astryx upgrade): BottomSheet now pads its content like Dialog. ' +
46
+ 'padding={0} keeps the unpadded content box, but it also removes the inset ' +
47
+ "between a nested Layout's regions, which the Layout's own padding does " +
48
+ "not restore. Drop padding={0} and the sheet content's own inset, or give " +
49
+ 'the Layout its inset another way. ';
50
+
51
+ /**
52
+ * Local JSX names bound to core components, by imported name.
53
+ * @param {any} root
54
+ * @param {any} j
55
+ * @param {string} component
56
+ * @returns {{direct: Set<string>, namespaces: Set<string>}}
57
+ */
58
+ function findBindings(root, j, component) {
59
+ const direct = new Set();
60
+ const namespaces = new Set();
61
+ root.find(j.ImportDeclaration).forEach((/** @type {any} */ importPath) => {
62
+ const source = importPath.node.source.value;
63
+ if (
64
+ importPath.node.importKind === 'type' ||
65
+ typeof source !== 'string' ||
66
+ !CORE_IMPORT_RE.test(source)
67
+ ) {
68
+ return;
69
+ }
70
+ const subpath = source.split('/').at(-1);
71
+ for (const specifier of importPath.node.specifiers ?? []) {
72
+ if (specifier.importKind === 'type') continue;
73
+ if (specifier.type === 'ImportSpecifier') {
74
+ const imported = specifier.imported?.name ?? specifier.imported?.value;
75
+ if (imported === component) {
76
+ direct.add(specifier.local?.name ?? imported);
77
+ }
78
+ } else if (
79
+ specifier.type === 'ImportDefaultSpecifier' &&
80
+ subpath === component
81
+ ) {
82
+ direct.add(specifier.local.name);
83
+ } else if (specifier.type === 'ImportNamespaceSpecifier') {
84
+ namespaces.add(specifier.local.name);
85
+ }
86
+ }
87
+ });
88
+ return {direct, namespaces};
89
+ }
90
+
91
+ /**
92
+ * @param {any} name JSX element name node
93
+ * @param {{direct: Set<string>, namespaces: Set<string>}} bindings
94
+ * @param {string} component
95
+ */
96
+ function nameMatches(name, bindings, component) {
97
+ if (name?.type === 'JSXIdentifier') {
98
+ return bindings.direct.has(name.name);
99
+ }
100
+ return (
101
+ name?.type === 'JSXMemberExpression' &&
102
+ name.object?.type === 'JSXIdentifier' &&
103
+ bindings.namespaces.has(name.object.name) &&
104
+ name.property?.name === component
105
+ );
106
+ }
107
+
108
+ // A parameter or local declaration with the imported name shadows the module
109
+ // binding (same rule as transform-prop.mjs): only a tag whose root binding
110
+ // resolves to the Program scope is the imported component.
111
+ /** @param {any} elementPath @param {any} name */
112
+ function isModuleBinding(elementPath, name) {
113
+ const localName =
114
+ name?.type === 'JSXIdentifier'
115
+ ? name.name
116
+ : name?.type === 'JSXMemberExpression' &&
117
+ name.object?.type === 'JSXIdentifier'
118
+ ? name.object.name
119
+ : null;
120
+ if (localName == null) return false;
121
+ const scope = elementPath.scope?.lookup(localName);
122
+ return scope?.path?.node?.type === 'Program';
123
+ }
124
+
125
+ /**
126
+ * Children that render something: drops whitespace-only text and empty
127
+ * `{}` / `{/* comment *\/}` containers.
128
+ * @param {any[]} children
129
+ */
130
+ function meaningfulChildren(children) {
131
+ return children.filter((/** @type {any} */ child) => {
132
+ if (child.type === 'JSXText') {
133
+ return child.value.trim() !== '';
134
+ }
135
+ if (child.type === 'JSXExpressionContainer') {
136
+ return child.expression?.type !== 'JSXEmptyExpression';
137
+ }
138
+ return true;
139
+ });
140
+ }
141
+
142
+ /**
143
+ * Attach the TODO to the nearest enclosing statement: a comment on a JSX node
144
+ * inside JSX children would print as text.
145
+ * @param {any} j
146
+ * @param {any} elementPath
147
+ */
148
+ function addTodo(j, elementPath) {
149
+ let path = elementPath;
150
+ while (path && !j.Statement.check(path.node)) {
151
+ path = path.parent;
152
+ }
153
+ if (!path) return;
154
+ const host = path.node;
155
+ host.comments = host.comments ?? [];
156
+ if (host.comments.some((/** @type {any} */ c) => c.value === TODO_COMMENT)) {
157
+ return;
158
+ }
159
+ host.comments.push(j.commentBlock(TODO_COMMENT, true, false));
160
+ }
161
+
162
+ /**
163
+ * @param {import('../../../../authoring/codemod/type').AstryxCodemodFile} file
164
+ * @param {import('../../../../authoring/codemod/type').CodemodTransformApi} api
165
+ * @returns {string | null | undefined}
166
+ */
167
+ export default function transformer(file, api) {
168
+ if (!file.source.includes('BottomSheet')) return undefined;
169
+ const j = api.jscodeshift;
170
+ const root = j(file.source);
171
+ const sheets = findBindings(root, j, 'BottomSheet');
172
+ if (sheets.direct.size === 0 && sheets.namespaces.size === 0) {
173
+ return undefined;
174
+ }
175
+ const sections = findBindings(root, j, 'Section');
176
+ const layouts = findBindings(root, j, 'Layout');
177
+ let hasChanges = false;
178
+
179
+ root.find(j.JSXElement).forEach((/** @type {any} */ elementPath) => {
180
+ const opening = elementPath.node.openingElement;
181
+ if (!nameMatches(opening.name, sheets, 'BottomSheet')) return;
182
+ if (!isModuleBinding(elementPath, opening.name)) return;
183
+
184
+ const attributes = opening.attributes ?? [];
185
+ const setsPadding = attributes.some(
186
+ (/** @type {any} */ attribute) =>
187
+ attribute.type === 'JSXAttribute' && attribute.name?.name === 'padding',
188
+ );
189
+ if (setsPadding) return;
190
+
191
+ const children = meaningfulChildren(elementPath.node.children ?? []);
192
+ const hasChildrenAttribute = attributes.some(
193
+ (/** @type {any} */ attribute) =>
194
+ attribute.type === 'JSXAttribute' &&
195
+ attribute.name?.name === 'children',
196
+ );
197
+ if (
198
+ !hasChildrenAttribute &&
199
+ children.length === 1 &&
200
+ children[0].type === 'JSXElement' &&
201
+ (nameMatches(children[0].openingElement.name, sections, 'Section') ||
202
+ nameMatches(children[0].openingElement.name, layouts, 'Layout')) &&
203
+ isModuleBinding(
204
+ elementPath.get('children', 0),
205
+ children[0].openingElement.name,
206
+ )
207
+ ) {
208
+ return;
209
+ }
210
+
211
+ const padding = j.jsxAttribute(
212
+ j.jsxIdentifier('padding'),
213
+ j.jsxExpressionContainer(j.numericLiteral(0)),
214
+ );
215
+ const firstSpread = attributes.findIndex(
216
+ (/** @type {any} */ attribute) => attribute.type === 'JSXSpreadAttribute',
217
+ );
218
+ if (firstSpread === -1) {
219
+ attributes.push(padding);
220
+ } else {
221
+ attributes.splice(firstSpread, 0, padding);
222
+ }
223
+ opening.attributes = attributes;
224
+ hasChanges = true;
225
+
226
+ // Any nested core Layout loses the inset between its regions, with or
227
+ // without its own padding, so every one gets the TODO.
228
+ const hasNestedLayout =
229
+ j(elementPath)
230
+ .find(j.JSXOpeningElement)
231
+ .filter(
232
+ (/** @type {any} */ openingPath) =>
233
+ nameMatches(openingPath.node.name, layouts, 'Layout') &&
234
+ isModuleBinding(openingPath, openingPath.node.name),
235
+ ).length > 0;
236
+ if (hasNestedLayout) {
237
+ addTodo(j, elementPath);
238
+ }
239
+ });
240
+
241
+ return hasChanges ? root.toSource() : undefined;
242
+ }
@@ -18,7 +18,7 @@ export const docs = {
18
18
  content: [
19
19
  {
20
20
  type: 'prose',
21
- text: 'The design system uses a 4px base-unit spacing scale. Component gap props accept step values that map to these tokens. The scale provides fine-grained control at the small end (2px, 4px, 6px) and consistent rhythm at larger sizes (multiples of 4px).',
21
+ text: 'The design system uses a 4px base-unit spacing scale, written in rem so gaps and padding grow with the reader\'s browser font size the way text does: each step is 0.25rem, which is 4px at the default 16px root. Component gap props accept step values that map to these tokens. The scale provides fine-grained control at the small end (2px, 4px, 6px) and consistent rhythm at larger sizes (multiples of 4px).',
22
22
  },
23
23
  ],
24
24
  },
@@ -28,7 +28,7 @@ export const docs = {
28
28
  content: [
29
29
  {
30
30
  type: 'prose',
31
- text: 'Fifteen spacing tokens, from 0px to 48px.',
31
+ text: 'Fifteen spacing tokens, from 0 to 3rem (0px to 48px at the default 16px root).',
32
32
  },
33
33
  {
34
34
  type: 'token-ref',
@@ -35,63 +35,63 @@ export const docs = {
35
35
  "rows": [
36
36
  [
37
37
  "--spacing-0",
38
- "0px"
38
+ "0rem"
39
39
  ],
40
40
  [
41
41
  "--spacing-0-5",
42
- "2px"
42
+ "0.125rem"
43
43
  ],
44
44
  [
45
45
  "--spacing-1",
46
- "4px"
46
+ "0.25rem"
47
47
  ],
48
48
  [
49
49
  "--spacing-1-5",
50
- "6px"
50
+ "0.375rem"
51
51
  ],
52
52
  [
53
53
  "--spacing-2",
54
- "8px"
54
+ "0.5rem"
55
55
  ],
56
56
  [
57
57
  "--spacing-3",
58
- "12px"
58
+ "0.75rem"
59
59
  ],
60
60
  [
61
61
  "--spacing-4",
62
- "16px"
62
+ "1rem"
63
63
  ],
64
64
  [
65
65
  "--spacing-5",
66
- "20px"
66
+ "1.25rem"
67
67
  ],
68
68
  [
69
69
  "--spacing-6",
70
- "24px"
70
+ "1.5rem"
71
71
  ],
72
72
  [
73
73
  "--spacing-7",
74
- "28px"
74
+ "1.75rem"
75
75
  ],
76
76
  [
77
77
  "--spacing-8",
78
- "32px"
78
+ "2rem"
79
79
  ],
80
80
  [
81
81
  "--spacing-9",
82
- "36px"
82
+ "2.25rem"
83
83
  ],
84
84
  [
85
85
  "--spacing-10",
86
- "40px"
86
+ "2.5rem"
87
87
  ],
88
88
  [
89
89
  "--spacing-11",
90
- "44px"
90
+ "2.75rem"
91
91
  ],
92
92
  [
93
93
  "--spacing-12",
94
- "48px"
94
+ "3rem"
95
95
  ]
96
96
  ]
97
97
  }
@@ -34,7 +34,7 @@ export default function BottomSheetHeights() {
34
34
  onOpenChange={isOpen => !isOpen && setHeight(null)}
35
35
  label={`${height ?? 'Hug'} height`}
36
36
  height={height ?? 'hug'}>
37
- <VStack gap={4} style={{padding: 'var(--spacing-4)'}}>
37
+ <VStack gap={4}>
38
38
  <Heading level={3}>{height ?? 'Hug'} height</Heading>
39
39
  <Divider />
40
40
  <Text type="body">{descriptions[height ?? 'hug']}</Text>
@@ -51,7 +51,7 @@ export default function BottomSheetMobileKeyboard() {
51
51
  event.preventDefault();
52
52
  setIsOpen(false);
53
53
  }}>
54
- <VStack gap={4} style={{padding: 'var(--spacing-4)'}}>
54
+ <VStack gap={4}>
55
55
  <Heading level={3}>Edit profile</Heading>
56
56
  <Divider />
57
57
  <Text type="supporting" color="secondary">
@@ -33,7 +33,7 @@ export default function BottomSheetNoScrim() {
33
33
  label="Place details"
34
34
  height="hug"
35
35
  hasScrim={false}>
36
- <VStack gap={4} style={{padding: 'var(--spacing-4)'}}>
36
+ <VStack gap={4}>
37
37
  <Heading level={3}>Central Park</Heading>
38
38
  <Divider />
39
39
  <Text type="body">
@@ -122,7 +122,7 @@ export default function BottomSheetSnapPoints() {
122
122
  label="Directions to the Ferry Building"
123
123
  height="tall"
124
124
  snapPoints={SNAP_POINTS}>
125
- <VStack gap={4} padding={4}>
125
+ <VStack gap={4}>
126
126
  <VStack gap={1}>
127
127
  <Heading level={3}>Ferry Building</Heading>
128
128
  <HStack gap={2}>
@@ -68,7 +68,7 @@ function AdaptiveDialog({
68
68
  label={title}
69
69
  purpose={purpose}
70
70
  height={bottomSheetHeight}>
71
- <VStack gap={4} style={{padding: 'var(--spacing-4)'}}>
71
+ <VStack gap={4}>
72
72
  <Heading level={3}>{title}</Heading>
73
73
  {children}
74
74
  {footer}
@@ -2084,7 +2084,8 @@ function FilterOverflow({
2084
2084
  isOpen={isOpen}
2085
2085
  onOpenChange={setIsOpen}
2086
2086
  label={label}
2087
- height="hug">
2087
+ height="hug"
2088
+ padding={0}>
2088
2089
  {body}
2089
2090
  </BottomSheet>
2090
2091
  </>
@@ -4087,7 +4088,10 @@ export default function TableFilterTemplate() {
4087
4088
  isOpen={isCompactSurface && isViewOpen}
4088
4089
  onOpenChange={setIsViewOpen}
4089
4090
  label="View options"
4090
- height="tall">
4091
+ height="tall"
4092
+ // The tab strip compensates against a container inset, so the sheet
4093
+ // publishes none and the wrapper below owns the top band.
4094
+ padding={0}>
4091
4095
  {/* The inset is the wrapper's, so the strip's own box starts at the tab
4092
4096
  row and its scroll arrow lands on the tabs rather than above them. */}
4093
4097
  <VStack gap={0} paddingBlockStart={SHEET_TOP_INSET}>
@@ -4313,7 +4317,8 @@ export default function TableFilterTemplate() {
4313
4317
  isOpen={isCompactSurface && activeJob != null}
4314
4318
  onOpenChange={open => !open && setActiveJobId(null)}
4315
4319
  label="Job details"
4316
- height="tall">
4320
+ height="tall"
4321
+ padding={0}>
4317
4322
  {detailBody}
4318
4323
  </BottomSheet>
4319
4324
  );
@@ -1773,7 +1773,9 @@ function ComposeWindow({
1773
1773
  // cheaper answer to the same problem: there is not much to drag out of
1774
1774
  // the way in the first place.
1775
1775
  height="hug"
1776
- hasScrim={false}>
1776
+ hasScrim={false}
1777
+ // The Layout below owns the inset; the sheet adds none of its own.
1778
+ padding={0}>
1777
1779
  {/* The grab handle floats over the top edge, out of flow, about 12px
1778
1780
  down. The Layout's own padding is not quite enough to clear it — the
1779
1781
  heading came up level with the pill, four pixels under it — so the
@@ -65,6 +65,18 @@ export const butterTheme = defineTheme({
65
65
  },
66
66
  },
67
67
 
68
+ // Touch + narrow (Mobile Type, Pin): floor base to the 16px floor and
69
+ // re-derive the ratio so Display 1 keeps its desktop size:
70
+ // ratio' = 1.25 * (14/16)^(1/6) ~= 1.2225. Body 14 -> 16px, display-1 stays 53px.
71
+ adaptations: {
72
+ rules: [
73
+ {
74
+ when: {pointer: 'coarse', width: {below: 'lg'}},
75
+ value: {typography: {scale: {base: 16, ratio: 1.2225}}},
76
+ },
77
+ ],
78
+ },
79
+
68
80
  motion: {fast: 125, medium: 300, slow: 700, ratio: 0.75},
69
81
 
70
82
  syntax: butterSyntax,
@@ -55,6 +55,18 @@ export const chocolateTheme = defineTheme({
55
55
  },
56
56
  },
57
57
 
58
+ // Touch + narrow (Mobile Type, Pin): floor base to the 16px floor and
59
+ // re-derive the ratio so Display 1 keeps its desktop size:
60
+ // ratio' = 1.2 * (14/16)^(1/6) ~= 1.1736. Body 14 -> 16px, display-1 stays 42px.
61
+ adaptations: {
62
+ rules: [
63
+ {
64
+ when: {pointer: 'coarse', width: {below: 'lg'}},
65
+ value: {typography: {scale: {base: 16, ratio: 1.1736}}},
66
+ },
67
+ ],
68
+ },
69
+
58
70
  motion: {fast: 125, medium: 300, slow: 700, ratio: 0.75},
59
71
 
60
72
  syntax: chocolateSyntax,
@@ -180,20 +180,20 @@ export const matchaTheme = defineTheme({
180
180
  // =========================================================================
181
181
  // Spacing
182
182
  // =========================================================================
183
- '--spacing-0-5': '3px',
184
- '--spacing-1': '6px',
185
- '--spacing-1-5': '9px',
186
- '--spacing-2': '12px',
187
- '--spacing-3': '18px',
188
- '--spacing-4': '24px',
189
- '--spacing-5': '30px',
190
- '--spacing-6': '36px',
191
- '--spacing-7': '42px',
192
- '--spacing-8': '48px',
193
- '--spacing-9': '54px',
194
- '--spacing-10': '60px',
195
- '--spacing-11': '66px',
196
- '--spacing-12': '72px',
183
+ '--spacing-0-5': '0.1875rem',
184
+ '--spacing-1': '0.375rem',
185
+ '--spacing-1-5': '0.5625rem',
186
+ '--spacing-2': '0.75rem',
187
+ '--spacing-3': '1.125rem',
188
+ '--spacing-4': '1.5rem',
189
+ '--spacing-5': '1.875rem',
190
+ '--spacing-6': '2.25rem',
191
+ '--spacing-7': '2.625rem',
192
+ '--spacing-8': '3rem',
193
+ '--spacing-9': '3.375rem',
194
+ '--spacing-10': '3.75rem',
195
+ '--spacing-11': '4.125rem',
196
+ '--spacing-12': '4.5rem',
197
197
 
198
198
  // =========================================================================
199
199
  // Radius — soft and rounded
@@ -95,6 +95,18 @@ export const neutralTheme = defineTheme({
95
95
  },
96
96
  },
97
97
 
98
+ // Touch + narrow (Mobile Type, Pin): floor base to the 16px floor and
99
+ // re-derive the ratio so Display 1 keeps its desktop size:
100
+ // ratio' = 1.2 * (14/16)^(1/6) ~= 1.1736. Body 14 -> 16px, display-1 stays 42px.
101
+ adaptations: {
102
+ rules: [
103
+ {
104
+ when: {pointer: 'coarse', width: {below: 'lg'}},
105
+ value: {typography: {scale: {base: 16, ratio: 1.1736}}},
106
+ },
107
+ ],
108
+ },
109
+
98
110
  // Motion: snappier than default to match shadcn/Tailwind conventions.
99
111
  // Produces: fast-min=95ms, fast=125ms, fast-max=165ms,
100
112
  // medium-min=225ms, medium=300ms, medium-max=400ms.
@@ -81,6 +81,18 @@ export const stoneTheme = defineTheme({
81
81
  },
82
82
  },
83
83
 
84
+ // Touch + narrow (Mobile Type, Pin): floor base to the 16px floor and
85
+ // re-derive the ratio so Display 1 keeps its desktop size:
86
+ // ratio' = 1.25 * (14/16)^(1/6) ~= 1.2225. Body 14 -> 16px, display-1 stays 53px.
87
+ adaptations: {
88
+ rules: [
89
+ {
90
+ when: {pointer: 'coarse', width: {below: 'lg'}},
91
+ value: {typography: {scale: {base: 16, ratio: 1.2225}}},
92
+ },
93
+ ],
94
+ },
95
+
84
96
  motion: {fast: 125, medium: 300, slow: 700, ratio: 0.75},
85
97
 
86
98
  syntax: stoneSyntax,
@@ -63,16 +63,16 @@ export const y2kTheme = defineTheme({
63
63
  // =========================================================================
64
64
  // Spacing — comfortable preset (base=6)
65
65
  // =========================================================================
66
- '--spacing-0-5': '3px',
67
- '--spacing-1': '6px',
68
- '--spacing-1-5': '9px',
69
- '--spacing-2': '12px',
70
- '--spacing-3': '18px',
71
- '--spacing-4': '24px',
72
- '--spacing-5': '30px',
73
- '--spacing-6': '36px',
74
- '--spacing-7': '42px',
75
- '--spacing-8': '48px',
66
+ '--spacing-0-5': '0.1875rem',
67
+ '--spacing-1': '0.375rem',
68
+ '--spacing-1-5': '0.5625rem',
69
+ '--spacing-2': '0.75rem',
70
+ '--spacing-3': '1.125rem',
71
+ '--spacing-4': '1.5rem',
72
+ '--spacing-5': '1.875rem',
73
+ '--spacing-6': '2.25rem',
74
+ '--spacing-7': '2.625rem',
75
+ '--spacing-8': '3rem',
76
76
 
77
77
  // Size — comfortable preset
78
78
  '--size-element-sm': '32px',
@@ -373,7 +373,7 @@ export const myTheme = defineTheme({
373
373
  // {
374
374
  // // Narrow at every pointer precision.
375
375
  // when: {width: {below: 'md'}},
376
- // value: {tokens: {'--spacing-4': '12px'}},
376
+ // value: {tokens: {'--spacing-4': '0.75rem'}},
377
377
  // },
378
378
  // {
379
379
  // // Taller controls under a finger or stylus at every width.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.7.0-canary.61639ee",
3
+ "version": "0.7.0-canary.6ecd417",
4
4
  "displayName": "CLI",
5
5
  "description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
6
6
  "author": "Meta Open Source",
@@ -101,10 +101,10 @@
101
101
  "zod": "^4.4.3"
102
102
  },
103
103
  "peerDependencies": {
104
- "@astryxdesign/charts": "0.7.0-canary.61639ee",
105
- "@astryxdesign/core": "0.7.0-canary.61639ee",
106
- "@astryxdesign/lab": "0.7.0-canary.61639ee",
107
- "@astryxdesign/theme-neutral": "0.7.0-canary.61639ee"
104
+ "@astryxdesign/charts": "0.7.0-canary.6ecd417",
105
+ "@astryxdesign/core": "0.7.0-canary.6ecd417",
106
+ "@astryxdesign/lab": "0.7.0-canary.6ecd417",
107
+ "@astryxdesign/theme-neutral": "0.7.0-canary.6ecd417"
108
108
  },
109
109
  "peerDependenciesMeta": {
110
110
  "@astryxdesign/charts": {
@@ -121,10 +121,10 @@
121
121
  }
122
122
  },
123
123
  "devDependencies": {
124
- "@astryxdesign/charts": "0.7.0-canary.61639ee",
125
- "@astryxdesign/core": "0.7.0-canary.61639ee",
126
- "@astryxdesign/lab": "0.7.0-canary.61639ee",
127
- "@astryxdesign/theme-neutral": "0.7.0-canary.61639ee",
124
+ "@astryxdesign/charts": "0.7.0-canary.6ecd417",
125
+ "@astryxdesign/core": "0.7.0-canary.6ecd417",
126
+ "@astryxdesign/lab": "0.7.0-canary.6ecd417",
127
+ "@astryxdesign/theme-neutral": "0.7.0-canary.6ecd417",
128
128
  "@heroicons/react": "^2.2.0",
129
129
  "@stylexjs/stylex": "^0.19.0",
130
130
  "@types/babel__core": "^7.20.5",