@astryxdesign/cli 0.1.5 → 0.1.6-canary.0121ab3

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 (24) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/docs/integration-authoring.md +105 -0
  3. package/docs/internationalization.doc.mjs +243 -0
  4. package/package.json +9 -9
  5. package/src/api/integration-block-exports.test.mjs +240 -0
  6. package/src/api/template-suffix.test.mjs +246 -0
  7. package/src/api/template.mjs +103 -27
  8. package/templates/blocks/components/Avatar/AvatarGroup.tsx +5 -7
  9. package/templates/blocks/components/Avatar/AvatarShowcase.tsx +4 -6
  10. package/templates/blocks/components/Avatar/AvatarUserCard.tsx +3 -5
  11. package/templates/blocks/components/Avatar/AvatarWithImage.tsx +8 -6
  12. package/templates/blocks/components/Avatar/AvatarWithStatus.tsx +3 -5
  13. package/templates/blocks/components/ChatComposerInput/ChatComposerInputControlledInput.tsx +1 -1
  14. package/templates/blocks/components/ChatComposerInput/ChatComposerInputDisabled.tsx +1 -1
  15. package/templates/blocks/components/ChatComposerInput/ChatComposerInputMentionTrigger.tsx +1 -1
  16. package/templates/blocks/components/ChatComposerInput/ChatComposerInputMultipleTriggers.tsx +1 -1
  17. package/templates/blocks/components/ChatComposerInput/ChatComposerInputShowcase.tsx +1 -1
  18. package/templates/blocks/components/ChatComposerInput/ChatComposerInputSlashCommands.tsx +1 -1
  19. package/templates/blocks/components/Table/TableGroupedRowsTable.doc.mjs +14 -0
  20. package/templates/blocks/components/Table/TableGroupedRowsTable.tsx +66 -0
  21. package/templates/blocks/components/Table/TableRowIndexTable.doc.mjs +14 -0
  22. package/templates/blocks/components/Table/TableRowIndexTable.tsx +47 -0
  23. package/templates/pages/theme-showcase/page.tsx +7 -7
  24. package/templates/themes/neutral/neutralTheme.ts +63 -32
@@ -54,7 +54,7 @@ export default function ChatComposerInputMultipleTriggers() {
54
54
  };
55
55
 
56
56
  return (
57
- <Stack direction="vertical" gap={3} style={{width: '100%', maxWidth: 450}}>
57
+ <Stack direction="vertical" gap={3} style={{width: 450, maxWidth: '100%'}}>
58
58
  <Text type="supporting" color="secondary">
59
59
  Type @ for mentions (blue) or / for commands (yellow)
60
60
  </Text>
@@ -7,7 +7,7 @@ import {Stack} from '@astryxdesign/core/Layout';
7
7
 
8
8
  export default function ChatComposerInputShowcase() {
9
9
  return (
10
- <Stack direction="vertical" style={{width: '100%', maxWidth: 450}}>
10
+ <Stack direction="vertical" style={{width: 450, maxWidth: '100%'}}>
11
11
  <ChatComposer
12
12
  onSubmit={() => {}}
13
13
  input={
@@ -40,7 +40,7 @@ export default function ChatComposerInputSlashCommands() {
40
40
  };
41
41
 
42
42
  return (
43
- <Stack direction="vertical" style={{width: '100%', maxWidth: 450}}>
43
+ <Stack direction="vertical" style={{width: 450, maxWidth: '100%'}}>
44
44
  <ChatComposer
45
45
  onSubmit={() => {}}
46
46
  input={
@@ -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: 'useTableGroupedRows',
7
+ name: 'useTableGroupedRows — Collapsible Groups',
8
+ displayName: 'useTableGroupedRows — Collapsible Groups',
9
+ description:
10
+ 'A table grouped into collapsible sections with useTableGroupedRows. Each group gets a full-width header with a chevron, label, and member count; click to collapse/expand.',
11
+ isReady: true,
12
+ aspectRatio: 16 / 9,
13
+ componentsUsed: ['Table'],
14
+ };
@@ -0,0 +1,66 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {useState, useCallback} from 'react';
6
+ import {
7
+ Table,
8
+ useTableGroupedRows,
9
+ proportional,
10
+ pixel,
11
+ } from '@astryxdesign/core/Table';
12
+ import type {TableColumn} from '@astryxdesign/core/Table';
13
+
14
+ interface Person extends Record<string, unknown> {
15
+ id: string;
16
+ name: string;
17
+ team: string;
18
+ role: string;
19
+ }
20
+
21
+ const people: Person[] = [
22
+ {id: '1', name: 'Ava Chen', team: 'Design Systems', role: 'Staff Eng'},
23
+ {id: '2', name: 'Liam Park', team: 'Design Systems', role: 'Engineer'},
24
+ {id: '3', name: 'Zoe Vega', team: 'Design Systems', role: 'Manager'},
25
+ {id: '4', name: 'Max Ross', team: 'Infra', role: 'Senior Eng'},
26
+ {id: '5', name: 'Mia Cole', team: 'Infra', role: 'Engineer'},
27
+ {id: '6', name: 'Leo Nash', team: 'Growth', role: 'PM'},
28
+ ];
29
+
30
+ const columns: TableColumn<Person>[] = [
31
+ {key: 'name', header: 'Name', width: proportional(2)},
32
+ {key: 'role', header: 'Role', width: pixel(140)},
33
+ ];
34
+
35
+ export default function TableGroupedRowsTable() {
36
+ const [collapsedGroups, setCollapsed] = useState<Set<string>>(new Set());
37
+ const onToggleGroup = useCallback((key: string) => {
38
+ setCollapsed(prev => {
39
+ const next = new Set(prev);
40
+ if (next.has(key)) {
41
+ next.delete(key);
42
+ } else {
43
+ next.add(key);
44
+ }
45
+ return next;
46
+ });
47
+ }, []);
48
+
49
+ const grouped = useTableGroupedRows<Person>({
50
+ data: people,
51
+ groupBy: p => p.team,
52
+ collapsedGroups,
53
+ onToggleGroup,
54
+ getRowKey: p => p.id,
55
+ });
56
+
57
+ return (
58
+ <Table
59
+ data={grouped.data}
60
+ columns={columns}
61
+ idKey={grouped.idKey}
62
+ hasHover
63
+ plugins={{grouped: grouped.plugin}}
64
+ />
65
+ );
66
+ }
@@ -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: 'useTableRowIndex',
7
+ name: 'useTableRowIndex — Numbered Rows',
8
+ displayName: 'useTableRowIndex — Numbered Rows',
9
+ description:
10
+ 'A table with a prepended row-number column via useTableRowIndex. Numbering is monospaced, right-aligned, and follows the rendered data order.',
11
+ isReady: true,
12
+ aspectRatio: 16 / 9,
13
+ componentsUsed: ['Table'],
14
+ };
@@ -0,0 +1,47 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {
6
+ Table,
7
+ useTableRowIndex,
8
+ proportional,
9
+ pixel,
10
+ } from '@astryxdesign/core/Table';
11
+ import type {TableColumn} from '@astryxdesign/core/Table';
12
+
13
+ interface Track extends Record<string, unknown> {
14
+ id: string;
15
+ title: string;
16
+ artist: string;
17
+ plays: number;
18
+ }
19
+
20
+ const tracks: Track[] = [
21
+ {id: 't1', title: 'Nightfall', artist: 'Ava Chen', plays: 1820},
22
+ {id: 't2', title: 'Ember', artist: 'Liam Park', plays: 942},
23
+ {id: 't3', title: 'Tidal', artist: 'Zoe Vega', plays: 3310},
24
+ {id: 't4', title: 'Cinder', artist: 'Max Ross', plays: 604},
25
+ {id: 't5', title: 'Halcyon', artist: 'Mia Cole', plays: 2075},
26
+ ];
27
+
28
+ const columns: TableColumn<Track>[] = [
29
+ {key: 'title', header: 'Title', width: proportional(2)},
30
+ {key: 'artist', header: 'Artist', width: proportional(2)},
31
+ {key: 'plays', header: 'Plays', width: pixel(90), align: 'end'},
32
+ ];
33
+
34
+ export default function TableRowIndexTable() {
35
+ // Pass the rendered data array — numbering follows its order.
36
+ const rowIndex = useTableRowIndex<Track>({data: tracks});
37
+
38
+ return (
39
+ <Table
40
+ data={tracks}
41
+ columns={columns}
42
+ idKey="id"
43
+ hasHover
44
+ plugins={{rowIndex}}
45
+ />
46
+ );
47
+ }
@@ -282,14 +282,14 @@ const DEFAULT_PRODUCTS: ProductSpec[] = [
282
282
 
283
283
  // Neutral product photos, served from the shared astryx asset CDN so the
284
284
  // scaffolded template renders real imagery without needing local public assets.
285
- const NEUTRAL_CDN = 'https://lookaside.facebook.com/assets/astryx';
286
285
  const DEFAULT_IMAGES: Record<string, string> = {
287
- watch: `${NEUTRAL_CDN}/Neutral-Watch.png`,
288
- headphones: `${NEUTRAL_CDN}/Neutral-Headphones.png`,
289
- backpack: `${NEUTRAL_CDN}/Neutral-Backpack.png`,
290
- wallet: `${NEUTRAL_CDN}/Neutral-Wallet.png`,
291
- tumbler: `${NEUTRAL_CDN}/Neutral-Tumbler.png`,
292
- throw_: `${NEUTRAL_CDN}/Neutral-Blanket.png`,
286
+ watch: 'https://lookaside.facebook.com/assets/astryx/Neutral-Watch.png',
287
+ headphones:
288
+ 'https://lookaside.facebook.com/assets/astryx/Neutral-Headphones.png',
289
+ backpack: 'https://lookaside.facebook.com/assets/astryx/Neutral-Backpack.png',
290
+ wallet: 'https://lookaside.facebook.com/assets/astryx/Neutral-Wallet.png',
291
+ tumbler: 'https://lookaside.facebook.com/assets/astryx/Neutral-Tumbler.png',
292
+ throw_: 'https://lookaside.facebook.com/assets/astryx/Neutral-Blanket.png',
293
293
  };
294
294
 
295
295
  export interface ThemeShowcaseProps {
@@ -39,19 +39,19 @@ import {neutralIconRegistry} from './icons';
39
39
  const neutralSyntax = defineSyntaxTheme({
40
40
  name: 'xds-neutral',
41
41
  tokens: {
42
- keyword: ['#700084', '#efa8ff'], // purple T30/T80
43
- string: ['#005600', '#a6d2a2'], // green (sat T30 / pastel T80)
44
- comment: ['#737373', '#a3a3a3'], // neutral
45
- number: ['#6e3500', '#ffb37f'], // orange
46
- function: ['#00458c', '#a0caff'], // blue T30/T80 H=255
47
- type: ['#700084', '#efa8ff'], // purple
48
- variable: ['#171717', '#e5e5e5'], // near-black / near-white
49
- operator: ['#737373', '#a3a3a3'], // neutral
50
- constant: ['#6e3500', '#ffb37f'], // orange
51
- tag: ['#89001a', '#ffaeaa'], // red
52
- attribute: ['#584400', '#eec12f'], // yellow
53
- property: ['#005348', '#83dac9'], // teal
54
- punctuation: ['#a3a3a3', '#525252'],// neutral
42
+ keyword: ['#700084', '#efa8ff'], // purple T30/T80
43
+ string: ['#005600', '#a6d2a2'], // green (sat T30 / pastel T80)
44
+ comment: ['#737373', '#a3a3a3'], // neutral
45
+ number: ['#6e3500', '#ffb37f'], // orange
46
+ function: ['#00458c', '#a0caff'], // blue T30/T80 H=255
47
+ type: ['#700084', '#efa8ff'], // purple
48
+ variable: ['#171717', '#e5e5e5'], // near-black / near-white
49
+ operator: ['#737373', '#a3a3a3'], // neutral
50
+ constant: ['#6e3500', '#ffb37f'], // orange
51
+ tag: ['#89001a', '#ffaeaa'], // red
52
+ attribute: ['#584400', '#eec12f'], // yellow
53
+ property: ['#005348', '#83dac9'], // teal
54
+ punctuation: ['#a3a3a3', '#525252'], // neutral
55
55
  background: ['#fafafa', '#0a0a0a'],
56
56
  },
57
57
  });
@@ -127,39 +127,39 @@ export const neutralTheme = defineTheme({
127
127
  // All values use the OKLCH Neutral tonal palette (chroma=0).
128
128
  // =========================================================================
129
129
  '--color-background-surface': ['#ffffff', '#262626'],
130
- '--color-background-body': ['#f1f1f1', '#1b1b1b'],
131
- '--color-background-card': ['#ffffff', '#1b1b1b'],
130
+ '--color-background-body': ['#f1f1f1', '#1b1b1b'],
131
+ '--color-background-card': ['#ffffff', '#1b1b1b'],
132
132
  '--color-background-popover': ['#ffffff', '#1b1b1b'],
133
- '--color-background-muted': ['#f1f1f1', '#1b1b1b'],
133
+ '--color-background-muted': ['#f1f1f1', '#1b1b1b'],
134
134
 
135
135
  // Accent + neutral surface tints (sit alongside backgrounds)
136
- '--color-accent': ['#262626', '#ebebeb'],
136
+ '--color-accent': ['#262626', '#ebebeb'],
137
137
  '--color-accent-muted': ['#f1f1f1', '#262626'],
138
- '--color-neutral': ['#0000000F', '#FFFFFF1A'],
138
+ '--color-neutral': ['#0000000F', '#FFFFFF1A'],
139
139
 
140
140
  // Overlays (modal scrims, hover/pressed tints)
141
- '--color-overlay': ['#00000080', '#000000CC'],
142
- '--color-overlay-hover': ['#0000000D', '#FFFFFF0D'],
141
+ '--color-overlay': ['#00000080', '#000000CC'],
142
+ '--color-overlay-hover': ['#0000000D', '#FFFFFF0D'],
143
143
  '--color-overlay-pressed': ['#0000001A', '#FFFFFF1A'],
144
144
 
145
145
  // Text
146
- '--color-text-primary': ['#171717', '#fafafa'],
146
+ '--color-text-primary': ['#171717', '#fafafa'],
147
147
  '--color-text-secondary': ['#737373', '#a3a3a3'],
148
- '--color-text-disabled': ['#a3a3a3', '#525252'],
149
- '--color-text-accent': ['#262626', '#ebebeb'],
150
- '--color-on-dark': '#ffffff',
151
- '--color-on-light': '#171717',
148
+ '--color-text-disabled': ['#a3a3a3', '#525252'],
149
+ '--color-text-accent': ['#262626', '#ebebeb'],
150
+ '--color-on-dark': '#ffffff',
151
+ '--color-on-light': '#171717',
152
152
  // Contrast: neutral accent is near-black (L) / near-white (D)
153
- '--color-on-accent': ['#ffffff', '#171717'],
153
+ '--color-on-accent': ['#ffffff', '#171717'],
154
154
  '--color-on-success': ['#ffffff', '#171717'],
155
- '--color-on-error': ['#ffffff', '#171717'],
155
+ '--color-on-error': ['#ffffff', '#171717'],
156
156
  '--color-on-warning': '#171717',
157
157
 
158
158
  // Icon
159
- '--color-icon-accent': ['#262626', '#ebebeb'],
160
- '--color-icon-primary': ['#171717', '#fafafa'],
159
+ '--color-icon-accent': ['#262626', '#ebebeb'],
160
+ '--color-icon-primary': ['#171717', '#fafafa'],
161
161
  '--color-icon-secondary': ['#737373', '#a3a3a3'],
162
- '--color-icon-disabled': ['#a3a3a3', '#525252'],
162
+ '--color-icon-disabled': ['#a3a3a3', '#525252'],
163
163
 
164
164
  // Status / Sentiment — dark mode follows the issue #2150 rubric:
165
165
  //
@@ -372,8 +372,8 @@ export const neutralTheme = defineTheme({
372
372
  // =========================================================================
373
373
  button: {
374
374
  'variant:destructive': {
375
- backgroundColor: 'var(--color-error-muted)', // locked pastel red bg
376
- color: 'var(--color-error)', // locked T30 red — matches banner/input error text
375
+ backgroundColor: 'var(--color-error-muted)', // locked pastel red bg
376
+ color: 'var(--color-error)', // locked T30 red — matches banner/input error text
377
377
  },
378
378
  },
379
379
 
@@ -482,6 +482,37 @@ export const neutralTheme = defineTheme({
482
482
  },
483
483
  },
484
484
 
485
+ // =========================================================================
486
+ // StatusDot — fill uses the SAME vivid stops as the filled semantic Badge
487
+ // (and ProgressBar), so a dot and its badge read as one status language.
488
+ //
489
+ // The default component maps each variant to a raw semantic token
490
+ // (--color-success / --color-error / --color-warning / --color-icon-
491
+ // secondary), which in light mode are the dark T30/T40 stops meant to
492
+ // sit as TEXT on a pastel surface — as a solid dot they read muddy
493
+ // (dark green / maroon / brown). Redirect them to the badge fills.
494
+ //
495
+ // success → badge success bg (green T45 / dark-ramp T60)
496
+ // warning → badge warning bg (yellow T85, same hex both modes)
497
+ // error → badge error bg (red T55 / dark-ramp T60)
498
+ // accent → badge info bg (blue T50 / dark-ramp T60) — the
499
+ // StatusDot "accent" is the info/attention color, so it
500
+ // pairs with the info badge rather than --color-accent
501
+ // (near-black #262626, the darkest offender).
502
+ //
503
+ // `neutral` is intentionally NOT overridden: the neutral badge bg is a
504
+ // near-invisible light gray (--color-background-gray #e5e5e5 / 10% white
505
+ // wash), fine as a large pill but unreadable as an 8px dot. It keeps the
506
+ // component default's visible mid-gray (--color-icon-secondary), which is
507
+ // not among the "too dark" cases.
508
+ // =========================================================================
509
+ statusdot: {
510
+ 'variant:success': {backgroundColor: 'light-dark(#198100, #64af4c)'},
511
+ 'variant:warning': {backgroundColor: '#ffce2f'},
512
+ 'variant:error': {backgroundColor: 'light-dark(#e33f4a, #ff705d)'},
513
+ 'variant:accent': {backgroundColor: 'light-dark(#0074e2, #6d9cfe)'},
514
+ },
515
+
485
516
  // =========================================================================
486
517
  // Banner — sits on a hue-tinted surface with colored text/icon:
487
518
  // Light: pastel T90 bg (pulled from --color-{X}-muted / --color-background-blue)