@astryxdesign/cli 0.1.3-canary.6d57c8d → 0.1.3-canary.70cd22e

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,200 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('../../core/src/docs-types').ReferenceDoc} */
4
+
5
+ export const docs = {
6
+ name: 'browser-support',
7
+ title: 'Browser Support',
8
+ category: 'guide',
9
+ description:
10
+ 'What browsers Astryx targets, which modern platform features it depends on, and how to support older browsers for your own audience.',
11
+
12
+ sections: [
13
+ {
14
+ title: 'Overview',
15
+ content: [
16
+ {
17
+ type: 'prose',
18
+ text: 'Astryx is built on modern web platform features — the Popover API, CSS anchor positioning, and CSS `light-dark()`. These let components stay small, accessible, and dependency-free, but they also set a floor on which browsers render everything correctly.',
19
+ },
20
+ {
21
+ type: 'prose',
22
+ text: 'A design system does not own its traffic — the products built on it do. Their audiences range from evergreen-Chrome-only internal tools to public sites with meaningful older-Safari share. So Astryx does not declare a single hard browser floor the way an app would. Instead it defines tiers that describe what works at each level, and hands the final decision to you. Pick the tier that matches your audience.',
23
+ },
24
+ ],
25
+ },
26
+ {
27
+ title: 'Support Tiers',
28
+ content: [
29
+ {
30
+ type: 'prose',
31
+ text: 'Astryx officially supports Tier 1 and Tier 2. Tier 3 is best-effort: components will not crash, but positioning and theming may degrade.',
32
+ },
33
+ {
34
+ type: 'table',
35
+ headers: ['Tier', 'Baseline', 'Representative versions', 'What your users experience'],
36
+ rows: [
37
+ [
38
+ 'Tier 1 — Full fidelity',
39
+ 'Current Baseline (2026)',
40
+ 'Chrome 125+, Edge 125+, Safari 26+, Firefox 147+',
41
+ 'Everything works, including CSS anchor positioning. This is the reference target.',
42
+ ],
43
+ [
44
+ 'Tier 2 — Functional',
45
+ 'Baseline − 2 years (2024)',
46
+ 'Chrome 114+, Edge 114+, Safari 17+, Firefox 125+',
47
+ 'Components open, dismiss, and are fully usable. Only anchor positioning is missing, so layered surfaces (tooltips, menus, popovers) may not be positioned next to their trigger.',
48
+ ],
49
+ [
50
+ 'Tier 3 — Below Tier 2',
51
+ 'Older than Baseline − 2',
52
+ 'Anything older',
53
+ 'Best-effort. The only guarantee is "does not crash." `light-dark()` is unavailable, so theme colors may fall back to defaults.',
54
+ ],
55
+ ],
56
+ },
57
+ ],
58
+ },
59
+ {
60
+ title: 'Which Features Set the Floor',
61
+ content: [
62
+ {
63
+ type: 'prose',
64
+ text: 'Only three modern features carry a browser requirement. Everything else Astryx uses (`:has()`, `color-mix()`, container queries, the `<dialog>` element) has been widely available since 2023 or earlier and needs no special handling.',
65
+ },
66
+ {
67
+ type: 'table',
68
+ headers: ['Feature', 'Role in Astryx', 'Widely available'],
69
+ rows: [
70
+ [
71
+ 'CSS Anchor Positioning',
72
+ 'Positions layered surfaces relative to their trigger (tooltips, menus, popovers, dropdowns).',
73
+ 'Baseline 2026 — the tightest requirement.',
74
+ ],
75
+ [
76
+ 'Popover API',
77
+ 'Opens, stacks, and light-dismisses layered surfaces via the top layer.',
78
+ 'Baseline 2025.',
79
+ ],
80
+ [
81
+ 'CSS light-dark()',
82
+ 'Compiles every theme color tuple into a single value that responds to color scheme. Underpins the whole theming system.',
83
+ 'Widely available since mid-2024.',
84
+ ],
85
+ ],
86
+ },
87
+ {
88
+ type: 'prose',
89
+ text: 'The gap that matters is between Tier 1 and Tier 2: the Popover API and `light-dark()` reached wide availability well before anchor positioning. So in Tier 2 browsers, layered surfaces open and dismiss correctly — they just are not positioned. This is the one feature most consumers will need to reason about.',
90
+ },
91
+ ],
92
+ },
93
+ {
94
+ title: 'Which Components Are Affected',
95
+ content: [
96
+ {
97
+ type: 'prose',
98
+ text: 'The browser requirement is concentrated in the layered-surface components — anything that renders content in an overlay positioned against a trigger:',
99
+ },
100
+ {
101
+ type: 'list',
102
+ style: 'unordered',
103
+ items: [
104
+ 'Tooltip',
105
+ 'HoverCard',
106
+ 'Popover',
107
+ 'ContextMenu',
108
+ 'Selector and MultiSelector (dropdown surfaces)',
109
+ 'Tokenizer (suggestion menu)',
110
+ 'Carousel (anchored controls)',
111
+ ],
112
+ },
113
+ {
114
+ type: 'prose',
115
+ text: 'If your product does not use any of these, it has no anchor-positioning requirement at all — it needs only `light-dark()` (Tier 2 and up) for correct theme colors. Layout, typography, forms, buttons, cards, tables, and navigation all work down to Tier 2 with no special handling.',
116
+ },
117
+ ],
118
+ },
119
+ {
120
+ title: 'What Astryx Guarantees',
121
+ content: [
122
+ {
123
+ type: 'list',
124
+ style: 'do',
125
+ items: [
126
+ 'Components never throw on missing platform APIs. Where a browser lacks the Popover API, layers fall back to plain visibility instead of crashing.',
127
+ 'Tier 1 and Tier 2 are officially supported and tested.',
128
+ 'Non-layered components render correctly down to Tier 2.',
129
+ ],
130
+ },
131
+ {
132
+ type: 'list',
133
+ style: 'dont',
134
+ items: [
135
+ 'Astryx does not guarantee correct layer positioning below Tier 1 (anchor positioning). Closing that gap for a Tier 2 audience is a consumer choice — see below.',
136
+ 'Astryx does not ship a `light-dark()` fallback, so theme colors are not guaranteed below Tier 2.',
137
+ ],
138
+ },
139
+ ],
140
+ },
141
+ {
142
+ title: 'Supporting Older Browsers',
143
+ content: [
144
+ {
145
+ type: 'prose',
146
+ text: 'If your audience includes Tier 2 browsers and you need correct layer positioning, you have three options, cheapest first. All of them are decisions you make for your audience — Astryx does not impose one.',
147
+ },
148
+ {
149
+ type: 'list',
150
+ style: 'ordered',
151
+ items: [
152
+ 'Polyfill anchor positioning. Load a CSS anchor positioning polyfill conditionally behind an `@supports` check so it costs nothing on Tier 1. This is the lowest-effort way to get correct positioning; note that polyfills may not cover every position-fallback feature.',
153
+ 'Provide a JS positioning fallback. Detect missing support with `CSS.supports("anchor-name", "--x")` and position layers with a measurement-based library (e.g. a floating-element positioner) when it returns false. More code, full control.',
154
+ 'Accept degraded positioning. Document for your users that on Tier 2 browsers, layered surfaces open correctly but may not sit next to their trigger. Cheapest, and often fine for internal tools on evergreen browsers.',
155
+ ],
156
+ },
157
+ {
158
+ type: 'prose',
159
+ text: 'Feature-detect at runtime rather than sniffing user agents:',
160
+ },
161
+ {
162
+ type: 'code',
163
+ lang: 'js',
164
+ label: 'Feature detection',
165
+ code: `// Popover API (Tier 2 and up)
166
+ const hasPopover = typeof HTMLElement !== 'undefined'
167
+ && typeof HTMLElement.prototype.showPopover === 'function';
168
+
169
+ // CSS anchor positioning (Tier 1)
170
+ const hasAnchorPositioning = CSS.supports('anchor-name', '--x');
171
+
172
+ // CSS light-dark() (Tier 2 and up)
173
+ const hasLightDark = CSS.supports('color', 'light-dark(#000, #fff)');`,
174
+ },
175
+ ],
176
+ },
177
+ {
178
+ title: 'How These Tiers Move Over Time',
179
+ content: [
180
+ {
181
+ type: 'prose',
182
+ text: 'The tiers are rolling, not frozen to specific versions. They track the Web Baseline year:',
183
+ },
184
+ {
185
+ type: 'list',
186
+ style: 'unordered',
187
+ items: [
188
+ 'Tier 1 tracks the current Baseline year.',
189
+ 'Tier 2 tracks Baseline minus two years.',
190
+ 'Tier 3 is everything older, and remains best-effort.',
191
+ ],
192
+ },
193
+ {
194
+ type: 'prose',
195
+ text: 'This is not an arbitrary window: Baseline − 2 is close to where anchor positioning stops being available while the Popover API and `light-dark()` still are — so the tier boundary tracks a real capability edge, not a guessed date. The version floors above are reviewed and advanced roughly once a year as new Baseline years land. Always feature-detect rather than hardcoding version numbers, so your app adapts automatically as the platform moves.',
196
+ },
197
+ ],
198
+ },
199
+ ],
200
+ };
@@ -92,7 +92,7 @@ export const docs = {
92
92
  content: [
93
93
  {
94
94
  type: 'prose',
95
- text: 'Card is a widget container, not a list-item wrapper. The fastest way to make an app look like a generic AI prototype is to wrap every record in a Card with a Badge. Dense data anything the user scans, filters, or selects belongs in rows: Table for columnar data, List/Item for single-line records, edge-to-edge with dividers and 32–40px row height.',
95
+ text: 'Card is a widget container, not a list-item wrapper. The fastest way to make an app look like a generic AI prototype is to wrap every record in a Card with a Badge. Dense data (anything the user scans, filters, or selects) belongs in rows: Table for columnar data, List/Item for single-line records, edge-to-edge with dividers and 32–40px row height.',
96
96
  },
97
97
  {
98
98
  type: 'list',
@@ -111,7 +111,7 @@ export const docs = {
111
111
  'Wrapping each list item in a Card (card soup)',
112
112
  'Stacking full-width Cards as a substitute for page structure',
113
113
  'Nesting Cards inside Cards',
114
- 'Using Badge as decoration reserve it for counts and enumerated states; use StatusDot or Token for status and metadata',
114
+ 'Using Badge as decoration: reserve it for counts and enumerated states; use StatusDot or Token for status and metadata',
115
115
  ],
116
116
  },
117
117
  ],
@@ -124,14 +124,14 @@ function App() {
124
124
  type: 'table',
125
125
  headers: ['Prop', 'Type', 'Default', 'Description'],
126
126
  rows: [
127
- ['theme', 'DefinedTheme', '', 'Theme object (required)'],
127
+ ['theme', 'DefinedTheme', '-', 'Theme object (required)'],
128
128
  [
129
129
  'mode',
130
130
  "'system' | 'light' | 'dark'",
131
131
  "'system'",
132
132
  'Color mode. system follows OS preference.',
133
133
  ],
134
- ['children', 'ReactNode', '', 'App content'],
134
+ ['children', 'ReactNode', '-', 'App content'],
135
135
  ],
136
136
  },
137
137
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.1.3-canary.6d57c8d",
3
+ "version": "0.1.3-canary.70cd22e",
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",
@@ -75,9 +75,9 @@
75
75
  "zod": "^4.4.3"
76
76
  },
77
77
  "peerDependencies": {
78
- "@astryxdesign/core": "0.1.3-canary.6d57c8d",
79
- "@astryxdesign/lab": "0.1.3-canary.6d57c8d",
80
- "@astryxdesign/theme-neutral": "0.1.3-canary.6d57c8d",
78
+ "@astryxdesign/core": "0.1.3-canary.70cd22e",
79
+ "@astryxdesign/lab": "0.1.3-canary.70cd22e",
80
+ "@astryxdesign/theme-neutral": "0.1.3-canary.70cd22e",
81
81
  "gpt-tokenizer": "^2.0.0"
82
82
  },
83
83
  "peerDependenciesMeta": {
@@ -92,9 +92,9 @@
92
92
  }
93
93
  },
94
94
  "devDependencies": {
95
- "@astryxdesign/core": "0.1.3-canary.6d57c8d",
96
- "@astryxdesign/lab": "0.1.3-canary.6d57c8d",
97
- "@astryxdesign/theme-neutral": "0.1.3-canary.6d57c8d",
95
+ "@astryxdesign/core": "0.1.3-canary.70cd22e",
96
+ "@astryxdesign/lab": "0.1.3-canary.70cd22e",
97
+ "@astryxdesign/theme-neutral": "0.1.3-canary.70cd22e",
98
98
  "gpt-tokenizer": "^2.0.0"
99
99
  },
100
100
  "scripts": {
@@ -7,9 +7,20 @@
7
7
  import {discoverComponents, findComponentReadme, resolveImportPath} from './component-discovery.mjs';
8
8
  import {loadDocs} from './component-loader.mjs';
9
9
 
10
- /** Derive the theme component key from a theming target (strips 'xds-' prefix). */
10
+ /**
11
+ * Derive the `defineTheme` component-override key from a theming target.
12
+ *
13
+ * Override keys are the component's stable class name with the `astryx-`
14
+ * namespace prefix stripped — `generateThemeRules` re-adds the prefix when it
15
+ * builds the `.astryx-*` selector. So `astryx-base-table` → key `base-table`
16
+ * (→ `.astryx-base-table`), and `astryx-button` → key `button`.
17
+ *
18
+ * Keep the `astryx-` literal in sync with packages/core/src/naming.ts
19
+ * (NAMESPACE / classPrefix), the same way build-theme.mjs mirrors it.
20
+ * <!-- SYNC: packages/core/src/naming.ts (namespace prefix source of truth) -->
21
+ */
11
22
  function targetKey(target) {
12
- return target.className.replace(/^xds-/, '');
23
+ return target.className.replace(/^astryx-/, '');
13
24
  }
14
25
 
15
26
  function dataAttrForName(name) {
@@ -51,3 +51,45 @@ describe('formatFull sub-component rendering', () => {
51
51
  expect(out).not.toContain('astryx component XDSButtonGroup');
52
52
  });
53
53
  });
54
+
55
+ describe('formatFull theming override keys', () => {
56
+ // Regression guard: the `defineTheme` component-override key is the stable
57
+ // class name with the `astryx-` prefix stripped — `generateThemeRules`
58
+ // re-adds the prefix to build the `.astryx-*` selector. targetKey() used to
59
+ // strip a dead `xds-` prefix (from before the astryx rename), so the printed
60
+ // example advertised `astryx-*` keys. Those double-prefix to
61
+ // `.astryx-astryx-*` at runtime and silently match nothing. See issue #3458.
62
+ it('prints override keys without the astryx- prefix (single-word component)', () => {
63
+ const docs = {
64
+ name: 'Button',
65
+ description: 'A button.',
66
+ theming: {targets: [{className: 'astryx-button', visualProps: ['variant']}]},
67
+ };
68
+ const out = formatFull(docs);
69
+
70
+ expect(out).toContain("'button': {");
71
+ // The full DOM class must not appear as an override key.
72
+ expect(out).not.toContain("'astryx-button': {");
73
+ });
74
+
75
+ it('prints override keys without the astryx- prefix (compound Table classes)', () => {
76
+ const docs = {
77
+ name: 'Table',
78
+ description: 'A table.',
79
+ theming: {
80
+ targets: [
81
+ {className: 'astryx-base-table'},
82
+ {className: 'astryx-table-cell'},
83
+ ],
84
+ },
85
+ };
86
+ const out = formatFull(docs);
87
+
88
+ // Correct keys: class name minus the astryx- prefix.
89
+ expect(out).toContain("'base-table': {");
90
+ expect(out).toContain("'table-cell': {");
91
+ // The verbatim DOM class names must not be advertised as override keys.
92
+ expect(out).not.toContain("'astryx-base-table': {");
93
+ expect(out).not.toContain("'astryx-table-cell': {");
94
+ });
95
+ });
@@ -7,7 +7,7 @@ export const doc = {
7
7
  name: 'MetadataListItem — Basic',
8
8
  displayName: 'MetadataListItem — Basic',
9
9
  description:
10
- 'Labeled keyvalue rows inside a MetadataList. Values accept any content, from plain text to components like Badge.',
10
+ 'Labeled key-value rows inside a MetadataList. Values accept any content, from plain text to components like Badge.',
11
11
  isReady: true,
12
12
  aspectRatio: 16 / 9,
13
13
  componentsUsed: ['MetadataList', 'MetadataListItem', 'Badge'],
@@ -0,0 +1,14 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ exampleFor: 'useTableRowExpansion',
7
+ name: 'useTableRowExpansion — Tree Table',
8
+ displayName: 'useTableRowExpansion — Tree Table',
9
+ description:
10
+ 'A tree table using useTableRowExpansion with inherited columns. Child rows use the same columns as parents, indented by depth. Click the chevron or right-click to expand/collapse.',
11
+ isReady: true,
12
+ aspectRatio: 16 / 9,
13
+ componentsUsed: ['Table'],
14
+ };
@@ -0,0 +1,99 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {useState} from 'react';
6
+ import {
7
+ Table,
8
+ useTableRowExpansion,
9
+ useTableRowExpansionState,
10
+ proportional,
11
+ pixel,
12
+ } from '@astryxdesign/core/Table';
13
+
14
+ interface FileNode extends Record<string, unknown> {
15
+ id: string;
16
+ name: string;
17
+ type: 'folder' | 'file';
18
+ size: string;
19
+ children?: FileNode[];
20
+ }
21
+
22
+ const fileTree: FileNode[] = [
23
+ {
24
+ id: 'src',
25
+ name: 'src',
26
+ type: 'folder',
27
+ size: '—',
28
+ children: [
29
+ {
30
+ id: 'src/components',
31
+ name: 'components',
32
+ type: 'folder',
33
+ size: '—',
34
+ children: [
35
+ {
36
+ id: 'src/components/Button.tsx',
37
+ name: 'Button.tsx',
38
+ type: 'file',
39
+ size: '4.2 KB',
40
+ children: [],
41
+ },
42
+ {
43
+ id: 'src/components/Table.tsx',
44
+ name: 'Table.tsx',
45
+ type: 'file',
46
+ size: '12.8 KB',
47
+ children: [],
48
+ },
49
+ ],
50
+ },
51
+ {
52
+ id: 'src/index.ts',
53
+ name: 'index.ts',
54
+ type: 'file',
55
+ size: '0.4 KB',
56
+ children: [],
57
+ },
58
+ ],
59
+ },
60
+ {
61
+ id: 'package.json',
62
+ name: 'package.json',
63
+ type: 'file',
64
+ size: '1.8 KB',
65
+ children: [],
66
+ },
67
+ ];
68
+
69
+ const columns = [
70
+ {key: 'name', header: 'Name', width: proportional(2)},
71
+ {key: 'type', header: 'Type', width: pixel(80)},
72
+ {key: 'size', header: 'Size', width: pixel(90)},
73
+ ];
74
+
75
+ export default function TableRowExpansionTable() {
76
+ const [expandedKeys, setExpandedKeys] = useState<Set<string>>(
77
+ new Set(['src']),
78
+ );
79
+
80
+ const {data, expansionConfig} = useTableRowExpansionState<FileNode>({
81
+ baseData: fileTree,
82
+ getChildren: item => item.children ?? [],
83
+ getRowKey: item => item.id,
84
+ expandedKeys,
85
+ setExpandedKeys,
86
+ });
87
+
88
+ const expansion = useTableRowExpansion(expansionConfig);
89
+
90
+ return (
91
+ <Table
92
+ data={data}
93
+ columns={columns}
94
+ idKey="id"
95
+ hasHover
96
+ plugins={{expansion}}
97
+ />
98
+ );
99
+ }
@@ -7,7 +7,7 @@ export const doc = {
7
7
  name: 'ToggleButtonGroup — Vertical',
8
8
  displayName: 'ToggleButtonGroup — Vertical',
9
9
  description:
10
- 'A vertically stacked ToggleButtonGroup using the vertical orientation, shown with both single-select and multi-select behavior ideal for sidebar-style option lists and vertical toolbars.',
10
+ 'A vertically stacked ToggleButtonGroup using the vertical orientation, shown with both single-select and multi-select behavior, ideal for sidebar-style option lists and vertical toolbars.',
11
11
  isReady: true,
12
12
  aspectRatio: 3 / 4,
13
13
  componentsUsed: ['ToggleButton', 'ToggleButtonGroup', 'Layout', 'Text'],
@@ -94,13 +94,13 @@ export const stoneTheme = defineTheme({
94
94
  // Core semantic — all neutrals H=291
95
95
  // Stone 900 T=16 C=1.4, Stone 500 T=55 C=4, Stone 300 T=86 C=1.6, Stone 100 T=96 C=1
96
96
  '--color-accent': ['#25252a', '#f3f3f5'], // light: Stone Neutral T15
97
- '--color-accent-muted': ['#25252a14', '#f3f3f5'], // light: Stone Neutral T15 · 8%
97
+ '--color-accent-muted': ['#25252a14', '#f3f3f520'], // light: Stone Neutral T15 · 8% / dark: T96 · 12.5%
98
98
  '--color-neutral': ['#25252a0f', '#f3f3f51a'], // light: Stone Neutral T15 · 6% / dark: T96 · 10%
99
99
  '--color-background-surface': ['#ffffff', '#1b1b1f'], // dark: Stone Neutral T10
100
100
  '--color-background-body': ['#f3f3f5', '#111015'], // dark: Stone Neutral T5
101
101
  '--color-overlay': ['#25252a80', '#28282a'], // light: Stone Neutral T15 · 50%
102
- '--color-overlay-hover': ['#25252a0d', '#f3f3f5'], // light: Stone Neutral T15 · 5%
103
- '--color-overlay-pressed': ['#25252a1a', '#f3f3f5'], // light: Stone Neutral T15 · 10%
102
+ '--color-overlay-hover': ['#25252a0d', '#f3f3f50d'], // light: Stone Neutral T15 · 5% / dark: T96 · 5%
103
+ '--color-overlay-pressed': ['#25252a1a', '#f3f3f51a'], // light: Stone Neutral T15 · 10% / dark: T96 · 10%
104
104
  '--color-background-muted': ['#e2e2e8', '#3b3b3f'], // light: Stone Neutral T90
105
105
 
106
106
  // Text — H=291