@astryxdesign/cli 0.7.13-canary.9993f4c → 0.7.13-canary.9b5fdf5
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.
- package/api/component/__fixtures__/resolutions/modules.txt +1 -1
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider04Calendar.doc.mjs +21 -0
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider04Calendar.tsx +46 -0
- package/assets/templates/blocks/components/Text/useTruncationHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Text/useTruncationHookUsage.tsx +112 -0
- package/foundation/discovery/theming-targets.d.mts +6 -0
- package/foundation/discovery/theming-targets.mjs +33 -0
- package/package.json +6 -6
|
@@ -303,5 +303,5 @@ useTableSortableState useTableSortableState Table/plugins/sortable/useTableSorta
|
|
|
303
303
|
useToastGesture useToastGesture Toast/Toast.doc.mjs Toast/useToastGesture.ts
|
|
304
304
|
useTouchTrigger useTouchTrigger Layer/Layer.doc.mjs Layer/useTouchTrigger.ts
|
|
305
305
|
useTriggerMenu useTriggerMenu Chat/Chat.doc.mjs Chat/useTriggerMenu.tsx
|
|
306
|
-
useTruncation useTruncation Text/
|
|
306
|
+
useTruncation useTruncation Text/useTruncation.doc.mjs Text/useTruncation.ts
|
|
307
307
|
utils utils Calendar/Calendar.doc.mjs Calendar/utils.ts
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
|
|
4
|
+
export const doc = {
|
|
5
|
+
type: 'block',
|
|
6
|
+
exampleFor: 'InternationalizationProvider',
|
|
7
|
+
name: 'InternationalizationProvider — Calendar',
|
|
8
|
+
displayName: 'Internationalization Provider — Calendar',
|
|
9
|
+
description:
|
|
10
|
+
'Set the `calendar` prop and the `Calendar` and `DateInput` inside the provider show that calendar system. The value stays a Gregorian ISO date. Japanese and Buddhist dates work in every browser; calendars such as Persian or Hebrew also need `Temporal` or a polyfill.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 16 / 9,
|
|
13
|
+
componentsUsed: [
|
|
14
|
+
'InternationalizationProvider',
|
|
15
|
+
'Calendar',
|
|
16
|
+
'DateInput',
|
|
17
|
+
'SegmentedControl',
|
|
18
|
+
'Layout',
|
|
19
|
+
'Text',
|
|
20
|
+
],
|
|
21
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {useState} from 'react';
|
|
6
|
+
import {InternationalizationProvider} from '@astryxdesign/core/i18n';
|
|
7
|
+
import {Calendar, type ISODateString} from '@astryxdesign/core/Calendar';
|
|
8
|
+
import {DateInput} from '@astryxdesign/core/DateInput';
|
|
9
|
+
import {VStack} from '@astryxdesign/core/Layout';
|
|
10
|
+
import {
|
|
11
|
+
SegmentedControl,
|
|
12
|
+
SegmentedControlItem,
|
|
13
|
+
} from '@astryxdesign/core/SegmentedControl';
|
|
14
|
+
import {Text} from '@astryxdesign/core/Text';
|
|
15
|
+
|
|
16
|
+
type CalendarSystem = 'gregory' | 'japanese' | 'buddhist';
|
|
17
|
+
|
|
18
|
+
export default function InternationalizationProviderCalendar() {
|
|
19
|
+
const [calendar, setCalendar] = useState<CalendarSystem>('japanese');
|
|
20
|
+
const [value, setValue] = useState<ISODateString | undefined>('2026-10-30');
|
|
21
|
+
return (
|
|
22
|
+
<InternationalizationProvider locale="en" calendar={calendar}>
|
|
23
|
+
<VStack gap={4} hAlign="center">
|
|
24
|
+
<SegmentedControl
|
|
25
|
+
label="Calendar"
|
|
26
|
+
value={calendar}
|
|
27
|
+
onChange={next => setCalendar(next as CalendarSystem)}
|
|
28
|
+
size="sm">
|
|
29
|
+
<SegmentedControlItem value="gregory" label="Gregorian" />
|
|
30
|
+
<SegmentedControlItem value="japanese" label="Japanese" />
|
|
31
|
+
<SegmentedControlItem value="buddhist" label="Buddhist" />
|
|
32
|
+
</SegmentedControl>
|
|
33
|
+
<DateInput
|
|
34
|
+
label="Start date"
|
|
35
|
+
value={value}
|
|
36
|
+
onChange={setValue}
|
|
37
|
+
controlStyle={{width: 300}}
|
|
38
|
+
/>
|
|
39
|
+
<Calendar value={value ?? null} onChange={next => setValue(next)} />
|
|
40
|
+
<Text type="supporting" color="secondary">
|
|
41
|
+
{value ? `Value: ${value}` : 'No date'}
|
|
42
|
+
</Text>
|
|
43
|
+
</VStack>
|
|
44
|
+
</InternationalizationProvider>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
|
|
4
|
+
export const doc = {
|
|
5
|
+
type: 'block',
|
|
6
|
+
exampleFor: 'useTruncation',
|
|
7
|
+
name: 'useTruncation — Tooltip on Cut-Off Text',
|
|
8
|
+
displayName: 'useTruncation — Tooltip on Cut-Off Text',
|
|
9
|
+
description:
|
|
10
|
+
'A narrow table column shows the full path in a Tooltip only where useTruncation reports the text is cut off; the short path shows none. One cell clamped to two lines shows the multi-line case.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 4 / 3,
|
|
13
|
+
componentsUsed: ['Table', 'Tooltip'],
|
|
14
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {useTruncation} from '@astryxdesign/core/Text';
|
|
6
|
+
import {Tooltip} from '@astryxdesign/core/Tooltip';
|
|
7
|
+
import {
|
|
8
|
+
Table,
|
|
9
|
+
TableBody,
|
|
10
|
+
TableCell,
|
|
11
|
+
TableHeader,
|
|
12
|
+
TableHeaderCell,
|
|
13
|
+
TableRow,
|
|
14
|
+
} from '@astryxdesign/core/Table';
|
|
15
|
+
|
|
16
|
+
interface FileAsset {
|
|
17
|
+
name: string;
|
|
18
|
+
path: string;
|
|
19
|
+
mode: 'single' | 'clamped' | 'short';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const FILES: FileAsset[] = [
|
|
23
|
+
{
|
|
24
|
+
name: 'build',
|
|
25
|
+
path: 'artifacts/release/build-20261103-120344/index.html',
|
|
26
|
+
mode: 'single',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'bundle',
|
|
30
|
+
path: 'reports/coverage/packages/core/src/components/Calendar/index.html',
|
|
31
|
+
mode: 'clamped',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'readme',
|
|
35
|
+
path: 'README.md',
|
|
36
|
+
mode: 'short',
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
function TruncatedCell({children}: {children: string}) {
|
|
41
|
+
const truncation = useTruncation({maxLines: 1});
|
|
42
|
+
return (
|
|
43
|
+
<Tooltip
|
|
44
|
+
content={truncation.fullText}
|
|
45
|
+
placement="above"
|
|
46
|
+
isEnabled={truncation.isTruncated}>
|
|
47
|
+
<span
|
|
48
|
+
ref={truncation.ref}
|
|
49
|
+
tabIndex={truncation.isTruncated ? 0 : undefined}
|
|
50
|
+
style={{
|
|
51
|
+
display: 'block',
|
|
52
|
+
maxWidth: 120,
|
|
53
|
+
overflow: 'hidden',
|
|
54
|
+
textOverflow: 'ellipsis',
|
|
55
|
+
whiteSpace: 'nowrap',
|
|
56
|
+
}}>
|
|
57
|
+
{children}
|
|
58
|
+
</span>
|
|
59
|
+
</Tooltip>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function ClampedCell({children}: {children: string}) {
|
|
64
|
+
const truncation = useTruncation({maxLines: 2});
|
|
65
|
+
return (
|
|
66
|
+
<Tooltip
|
|
67
|
+
content={truncation.fullText}
|
|
68
|
+
placement="above"
|
|
69
|
+
isEnabled={truncation.isTruncated}>
|
|
70
|
+
<span
|
|
71
|
+
ref={truncation.ref}
|
|
72
|
+
tabIndex={truncation.isTruncated ? 0 : undefined}
|
|
73
|
+
style={{
|
|
74
|
+
display: '-webkit-box',
|
|
75
|
+
WebkitLineClamp: 2,
|
|
76
|
+
WebkitBoxOrient: 'vertical',
|
|
77
|
+
overflow: 'hidden',
|
|
78
|
+
maxWidth: 120,
|
|
79
|
+
wordBreak: 'break-all',
|
|
80
|
+
}}>
|
|
81
|
+
{children}
|
|
82
|
+
</span>
|
|
83
|
+
</Tooltip>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export default function UseTruncationHookUsage() {
|
|
88
|
+
return (
|
|
89
|
+
<Table>
|
|
90
|
+
<TableHeader>
|
|
91
|
+
<TableRow>
|
|
92
|
+
<TableHeaderCell>Asset</TableHeaderCell>
|
|
93
|
+
<TableHeaderCell>Path</TableHeaderCell>
|
|
94
|
+
</TableRow>
|
|
95
|
+
</TableHeader>
|
|
96
|
+
<TableBody>
|
|
97
|
+
{FILES.map(file => (
|
|
98
|
+
<TableRow key={file.name}>
|
|
99
|
+
<TableCell>{file.name}</TableCell>
|
|
100
|
+
<TableCell>
|
|
101
|
+
{file.mode === 'clamped' ? (
|
|
102
|
+
<ClampedCell>{file.path}</ClampedCell>
|
|
103
|
+
) : (
|
|
104
|
+
<TruncatedCell>{file.path}</TruncatedCell>
|
|
105
|
+
)}
|
|
106
|
+
</TableCell>
|
|
107
|
+
</TableRow>
|
|
108
|
+
))}
|
|
109
|
+
</TableBody>
|
|
110
|
+
</Table>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
* Unreadable docs are skipped rather than fatal — a single malformed doc must
|
|
12
12
|
* not take out theme validation or the listing.
|
|
13
13
|
*
|
|
14
|
+
* The scan walks every folder under `src` and reads every component doc. A
|
|
15
|
+
* process scans each Core once. It reuses that scan while every folder and
|
|
16
|
+
* doc it read is unchanged, as the docs and search catalogs do. A `src`
|
|
17
|
+
* reached through a symlink, as a project's node_modules reaches Core, shares
|
|
18
|
+
* the scan of its real path. Each call gets its own copy of the rows.
|
|
19
|
+
*
|
|
14
20
|
* @param {string} coreSrc - absolute path to `<core>/src`
|
|
15
21
|
* @returns {Promise<ThemingTarget[]>}
|
|
16
22
|
*/
|
|
@@ -12,10 +12,13 @@
|
|
|
12
12
|
* <Name>` prints; nothing here is a second registry, so the list a
|
|
13
13
|
* theme author can enumerate and the set the compiler accepts cannot
|
|
14
14
|
* drift from the components or from each other.
|
|
15
|
+
* A process reuses its target scan of a Core while the folders and
|
|
16
|
+
* docs it read are unchanged.
|
|
15
17
|
*/
|
|
16
18
|
|
|
17
19
|
import * as fs from 'node:fs';
|
|
18
20
|
import * as path from 'node:path';
|
|
21
|
+
import {reusedWhileUnchanged} from '../fs/read-record.mjs';
|
|
19
22
|
import {loadComponentDoc} from './component-loader.mjs';
|
|
20
23
|
|
|
21
24
|
const SKIP_DIRS = new Set(['node_modules', '__tests__']);
|
|
@@ -53,12 +56,42 @@ function targetKey(className) {
|
|
|
53
56
|
* Unreadable docs are skipped rather than fatal — a single malformed doc must
|
|
54
57
|
* not take out theme validation or the listing.
|
|
55
58
|
*
|
|
59
|
+
* The scan walks every folder under `src` and reads every component doc. A
|
|
60
|
+
* process scans each Core once. It reuses that scan while every folder and
|
|
61
|
+
* doc it read is unchanged, as the docs and search catalogs do. A `src`
|
|
62
|
+
* reached through a symlink, as a project's node_modules reaches Core, shares
|
|
63
|
+
* the scan of its real path. Each call gets its own copy of the rows.
|
|
64
|
+
*
|
|
56
65
|
* @param {string} coreSrc - absolute path to `<core>/src`
|
|
57
66
|
* @returns {Promise<ThemingTarget[]>}
|
|
58
67
|
*/
|
|
59
68
|
export async function collectThemingTargets(coreSrc) {
|
|
60
69
|
if (!coreSrc || !fs.existsSync(coreSrc)) return [];
|
|
70
|
+
const real = fs.realpathSync(coreSrc);
|
|
71
|
+
let scan = targetScans.get(real);
|
|
72
|
+
if (scan == null) {
|
|
73
|
+
scan = reusedWhileUnchanged(() => scanThemingTargets(real));
|
|
74
|
+
targetScans.set(real, scan);
|
|
75
|
+
}
|
|
76
|
+
return (await scan()).map(target => ({
|
|
77
|
+
...target,
|
|
78
|
+
props: [...target.props],
|
|
79
|
+
states: [...target.states],
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
61
82
|
|
|
83
|
+
/**
|
|
84
|
+
* The target scan of each Core `src`, by its real path.
|
|
85
|
+
* @type {Map<string, () => Promise<ThemingTarget[]>>}
|
|
86
|
+
*/
|
|
87
|
+
const targetScans = new Map();
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Every theming target under `coreSrc`, read from its component docs.
|
|
91
|
+
* @param {string} coreSrc - real path to `<core>/src`
|
|
92
|
+
* @returns {Promise<ThemingTarget[]>}
|
|
93
|
+
*/
|
|
94
|
+
async function scanThemingTargets(coreSrc) {
|
|
62
95
|
/** @type {Array<ThemingTarget & {parent: string|null}>} */
|
|
63
96
|
const targets = [];
|
|
64
97
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.7.13-canary.
|
|
3
|
+
"version": "0.7.13-canary.9b5fdf5",
|
|
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",
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"zod": "^4.6.7"
|
|
126
126
|
},
|
|
127
127
|
"peerDependencies": {
|
|
128
|
-
"@astryxdesign/core": "0.7.13-canary.
|
|
128
|
+
"@astryxdesign/core": "0.7.13-canary.9b5fdf5"
|
|
129
129
|
},
|
|
130
130
|
"peerDependenciesMeta": {
|
|
131
131
|
"@astryxdesign/core": {
|
|
@@ -133,10 +133,10 @@
|
|
|
133
133
|
}
|
|
134
134
|
},
|
|
135
135
|
"devDependencies": {
|
|
136
|
-
"@astryxdesign/charts": "0.7.13-canary.
|
|
137
|
-
"@astryxdesign/core": "0.7.13-canary.
|
|
138
|
-
"@astryxdesign/lab": "0.7.13-canary.
|
|
139
|
-
"@astryxdesign/theme-neutral": "0.7.13-canary.
|
|
136
|
+
"@astryxdesign/charts": "0.7.13-canary.9b5fdf5",
|
|
137
|
+
"@astryxdesign/core": "0.7.13-canary.9b5fdf5",
|
|
138
|
+
"@astryxdesign/lab": "0.7.13-canary.9b5fdf5",
|
|
139
|
+
"@astryxdesign/theme-neutral": "0.7.13-canary.9b5fdf5",
|
|
140
140
|
"@heroicons/react": "^2.2.0",
|
|
141
141
|
"@stylexjs/stylex": "^0.19.1",
|
|
142
142
|
"@types/babel__core": "^7.20.5",
|