@astryxdesign/cli 0.7.13 → 0.7.14-canary.108f354
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/README.md +18 -18
- package/api/component/__fixtures__/resolutions/modules.txt +1 -1
- package/api/doctor/doctor.mjs +3 -7
- package/api/experimental.d.mts +2 -0
- package/api/experimental.mjs +12 -0
- package/api/icon/_adapter.d.mts +10 -0
- package/api/icon/_adapter.mjs +31 -2
- package/api/icon/_authoring.d.mts +2 -1
- package/api/icon/_authoring.mjs +91 -6
- package/api/icon/_options.mjs +1 -0
- package/api/icon/_records.d.mts +18 -0
- package/api/icon/_records.mjs +26 -0
- package/api/icon/add/add.mjs +7 -1
- package/api/icon/definitions/definitions.d.mts +12 -0
- package/api/icon/definitions/definitions.mjs +83 -0
- package/api/icon/icon.doc.mjs +5 -4
- package/api/icon/icon.mjs +5 -16
- package/api/icon/icon.type.d.mts +29 -2
- package/api/icon/icon.type.mjs +17 -3
- package/api/icon/iconAdd.doc.mjs +1 -1
- package/api/icon/iconMap.doc.mjs +2 -2
- package/api/icon/iconNewSet.doc.mjs +8 -2
- package/api/icon/map/map.mjs +21 -2
- package/api/icon/new-set/new-set.mjs +14 -2
- package/api/icon/search/search.mjs +2 -15
- package/api/icon/use/use.mjs +4 -3
- package/api/integration/validate-integration.mjs +6 -1
- package/api/integration/validate-integration.type.d.mts +12 -0
- package/api/integration/validate-integration.type.mjs +5 -0
- package/api/theme-edit/_adapter.d.mts +116 -0
- package/api/theme-edit/_adapter.mjs +1683 -0
- package/api/theme-edit/_catalog.d.mts +59 -0
- package/api/theme-edit/_catalog.mjs +564 -0
- package/api/theme-edit/_check.d.mts +49 -0
- package/api/theme-edit/_check.mjs +845 -0
- package/api/theme-edit/_color.d.mts +29 -0
- package/api/theme-edit/_color.mjs +300 -0
- package/api/theme-edit/_compiler.d.mts +61 -0
- package/api/theme-edit/_compiler.mjs +522 -0
- package/api/theme-edit/_css-properties.d.mts +10 -0
- package/api/theme-edit/_css-properties.mjs +556 -0
- package/api/theme-edit/_parts.d.mts +111 -0
- package/api/theme-edit/_parts.mjs +409 -0
- package/api/theme-edit/_png.d.mts +40 -0
- package/api/theme-edit/_png.mjs +187 -0
- package/api/theme-edit/_preview.d.mts +121 -0
- package/api/theme-edit/_preview.mjs +720 -0
- package/api/theme-edit/_project.d.mts +83 -0
- package/api/theme-edit/_project.mjs +289 -0
- package/api/theme-edit/_settings.d.mts +222 -0
- package/api/theme-edit/_settings.mjs +861 -0
- package/api/theme-edit/_tables.d.mts +132 -0
- package/api/theme-edit/_tables.mjs +700 -0
- package/api/theme-edit/theme-edit.d.mts +93 -0
- package/api/theme-edit/theme-edit.mjs +145 -0
- package/api/theme-edit/theme-edit.type.d.mts +413 -0
- package/api/theme-edit/theme-edit.type.mjs +233 -0
- package/api/theme-edit/themeEditHow.doc.d.mts +6 -0
- package/api/theme-edit/themeEditHow.doc.mjs +88 -0
- package/api/theme-edit/themeEditNew.doc.d.mts +6 -0
- package/api/theme-edit/themeEditNew.doc.mjs +89 -0
- package/api/theme-edit/themeEditPreviewAdd.doc.d.mts +6 -0
- package/api/theme-edit/themeEditPreviewAdd.doc.mjs +100 -0
- package/api/theme-edit/themeEditPreviewApp.doc.d.mts +6 -0
- package/api/theme-edit/themeEditPreviewApp.doc.mjs +84 -0
- package/api/theme-edit/themeEditPreviewList.doc.d.mts +6 -0
- package/api/theme-edit/themeEditPreviewList.doc.mjs +53 -0
- package/api/theme-edit/themeEditPreviewRemove.doc.d.mts +6 -0
- package/api/theme-edit/themeEditPreviewRemove.doc.mjs +66 -0
- package/api/theme-edit/themeEditSet.doc.d.mts +6 -0
- package/api/theme-edit/themeEditSet.doc.mjs +165 -0
- package/api/theme-edit/themeEditShow.doc.d.mts +6 -0
- package/api/theme-edit/themeEditShow.doc.mjs +86 -0
- package/api/theme-edit/themeEditUndo.doc.d.mts +6 -0
- package/api/theme-edit/themeEditUndo.doc.mjs +124 -0
- package/assets/docs/color.doc.mjs +5 -5
- package/assets/docs/tree/icon-sets.doc.mjs +6 -2
- package/assets/docs/tree/tokens-border.doc.mjs +1 -1
- package/assets/docs/tree/tokens-color.doc.mjs +2 -2
- package/assets/docs/tree/tokens-data.doc.mjs +2 -2
- package/assets/docs/tree/tokens-duration.doc.mjs +1 -1
- package/assets/docs/tree/tokens-ease.doc.mjs +1 -1
- package/assets/docs/tree/tokens-focus.doc.mjs +1 -1
- package/assets/docs/tree/tokens-font-weight.doc.mjs +1 -1
- package/assets/docs/tree/tokens-radius.doc.mjs +1 -1
- package/assets/docs/tree/tokens-shadow.doc.mjs +1 -1
- package/assets/docs/tree/tokens-size.doc.mjs +1 -1
- package/assets/docs/tree/tokens-spacing.doc.mjs +1 -1
- package/assets/docs/tree/tokens-syntax.doc.mjs +1 -1
- package/assets/docs/tree/tokens-text-size.doc.mjs +1 -1
- package/assets/docs/tree/tokens-type-scale.doc.mjs +1 -1
- package/assets/docs/tree/tokens-typography.doc.mjs +1 -1
- package/assets/icons/definitions/bank.doc.mjs +1 -1
- package/assets/icons/definitions/save.doc.mjs +1 -1
- package/assets/preview-app/README.md +6 -0
- package/assets/preview-app/css.d.ts +5 -0
- package/assets/preview-app/gitignore +1 -0
- package/assets/preview-app/next.config.mjs +6 -0
- package/assets/preview-app/package.json +23 -0
- package/assets/preview-app/src/app/globals.css +5 -0
- package/assets/preview-app/src/app/layout.tsx +21 -0
- package/assets/preview-app/src/app/page.tsx +94 -0
- package/assets/preview-app/src/app/providers.tsx +16 -0
- package/assets/preview-app/tsconfig.json +27 -0
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.doc.mjs +2 -1
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.doc.mjs +2 -1
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider03RtlDirection.doc.mjs +2 -1
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider04Calendar.doc.mjs +2 -1
- package/assets/templates/blocks/components/Text/useTruncationHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Text/useTruncationHookUsage.tsx +112 -0
- package/authoring/doctypes/_schema.d.mts +1 -0
- package/authoring/doctypes/_schema.mjs +1 -0
- package/authoring/doctypes/command/command.doc.mjs +7 -0
- package/authoring/doctypes/command/type.ts +3 -0
- package/authoring/doctypes/icon-set/parse.d.mts +7 -0
- package/authoring/doctypes/icon-set/parse.mjs +18 -8
- package/clients/cli/commands/doctor.mjs +33 -3
- package/clients/cli/commands/experimental/icon.mjs +67 -14
- package/clients/cli/commands/experimental/index.mjs +2 -0
- package/clients/cli/commands/experimental/theme.mjs +684 -0
- package/clients/cli/commands/experimental-icon-new-set.doc.mjs +7 -1
- package/clients/cli/commands/experimental-icon.doc.mjs +3 -2
- package/clients/cli/commands/experimental-theme-add.doc.mjs +78 -0
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +97 -0
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +84 -0
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +66 -0
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +121 -0
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +66 -0
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +104 -0
- package/clients/cli/commands/experimental-theme-editor.doc.mjs +49 -0
- package/clients/cli/commands/experimental-theme-eject.doc.mjs +71 -0
- package/clients/cli/commands/experimental-theme-list.doc.mjs +49 -0
- package/clients/cli/commands/experimental-theme-palette-generate.doc.mjs +73 -0
- package/clients/cli/commands/experimental-theme-palette.doc.mjs +37 -0
- package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +86 -0
- package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +66 -0
- package/clients/cli/commands/experimental-theme-preview-list.doc.mjs +48 -0
- package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +59 -0
- package/clients/cli/commands/experimental-theme-preview.doc.mjs +40 -0
- package/clients/cli/commands/experimental-theme-remove.doc.mjs +55 -0
- package/clients/cli/commands/experimental-theme-targets.doc.mjs +61 -0
- package/clients/cli/commands/experimental-theme-template.doc.mjs +61 -0
- package/clients/cli/commands/experimental-theme-use.doc.mjs +55 -0
- package/clients/cli/commands/experimental-theme.doc.mjs +57 -0
- package/clients/cli/commands/experimental.doc.mjs +10 -3
- package/clients/cli/commands/theme.mjs +101 -34
- package/clients/cli/index.mjs +18 -0
- package/clients/cli/lib/define-command.mjs +3 -0
- package/foundation/discovery/icon-set-checks.d.mts +16 -1
- package/foundation/discovery/icon-set-checks.mjs +68 -7
- package/foundation/discovery/icon-set-discovery.d.mts +21 -6
- package/foundation/discovery/icon-set-discovery.mjs +17 -8
- package/foundation/discovery/template-icon-meanings.d.mts +39 -0
- package/foundation/discovery/template-icon-meanings.mjs +95 -0
- package/foundation/discovery/theming-targets.d.mts +6 -0
- package/foundation/discovery/theming-targets.mjs +33 -0
- package/foundation/response/error-codes.d.mts +12 -1
- package/foundation/response/error-codes.doc.mjs +66 -0
- package/foundation/response/error-codes.mjs +55 -0
- package/foundation/response/response-types.doc.mjs +55 -0
- package/foundation/text/template-meanings-line.d.mts +16 -0
- package/foundation/text/template-meanings-line.mjs +37 -0
- package/foundation/xle/browser.d.mts +2 -2
- package/package.json +6 -6
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Theme preview starter app
|
|
2
|
+
|
|
3
|
+
`astryx experimental theme preview add --app <dir>` copies these files into a
|
|
4
|
+
new folder, pins the Astryx packages to the CLI's own release, and writes the
|
|
5
|
+
theme preview route into `src/app/theme-preview/`. They are a copy of the
|
|
6
|
+
repository's `apps/example-nextjs`; a test keeps them the same.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.next
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "astryx-theme-preview",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "next dev",
|
|
8
|
+
"build": "next build",
|
|
9
|
+
"start": "next start"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@astryxdesign/core": "{{astryxVersion}}",
|
|
13
|
+
"@astryxdesign/theme-neutral": "{{astryxVersion}}",
|
|
14
|
+
"next": "^16.3.6",
|
|
15
|
+
"react": "^19.3.1",
|
|
16
|
+
"react-dom": "^19.3.1"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/react": "^19.3.0",
|
|
20
|
+
"@types/react-dom": "^19.3.0",
|
|
21
|
+
"typescript": "^6.0.3"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
import type {Metadata} from 'next';
|
|
4
|
+
import './globals.css';
|
|
5
|
+
import {Providers} from './providers';
|
|
6
|
+
|
|
7
|
+
export const metadata: Metadata = {
|
|
8
|
+
title: 'Astryx Example — Next.js (Dist)',
|
|
9
|
+
description:
|
|
10
|
+
'Reference example for consuming @astryxdesign/core as a pre-built dist package',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default function RootLayout({children}: {children: React.ReactNode}) {
|
|
14
|
+
return (
|
|
15
|
+
<html lang="en">
|
|
16
|
+
<body>
|
|
17
|
+
<Providers>{children}</Providers>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {useState} from 'react';
|
|
6
|
+
import {VStack, HStack} from '@astryxdesign/core/Layout';
|
|
7
|
+
import {Button} from '@astryxdesign/core/Button';
|
|
8
|
+
import {Text, Heading} from '@astryxdesign/core/Text';
|
|
9
|
+
import {TextInput} from '@astryxdesign/core/TextInput';
|
|
10
|
+
import {Badge} from '@astryxdesign/core/Badge';
|
|
11
|
+
import {Divider} from '@astryxdesign/core';
|
|
12
|
+
|
|
13
|
+
export default function Home() {
|
|
14
|
+
const [email, setEmail] = useState('');
|
|
15
|
+
return (
|
|
16
|
+
<main
|
|
17
|
+
style={{
|
|
18
|
+
display: 'flex',
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
justifyContent: 'center',
|
|
21
|
+
minHeight: '100vh',
|
|
22
|
+
padding: '2rem',
|
|
23
|
+
}}>
|
|
24
|
+
<div style={{maxWidth: 640, width: '100%'}}>
|
|
25
|
+
<VStack gap={6}>
|
|
26
|
+
<VStack gap={2}>
|
|
27
|
+
<Heading level={1}>Astryx Example — Next.js (Dist)</Heading>
|
|
28
|
+
<Text type="body" color="secondary">
|
|
29
|
+
This example consumes{' '}
|
|
30
|
+
<Text type="body" weight="bold">
|
|
31
|
+
@astryxdesign/core
|
|
32
|
+
</Text>{' '}
|
|
33
|
+
as a pre-built dist package: no StyleX build plugin needed. Plain
|
|
34
|
+
inline styles handle layout. Astryx handles components, theming,
|
|
35
|
+
and design tokens.
|
|
36
|
+
</Text>
|
|
37
|
+
</VStack>
|
|
38
|
+
|
|
39
|
+
<Divider />
|
|
40
|
+
|
|
41
|
+
{/* Buttons */}
|
|
42
|
+
<VStack gap={3}>
|
|
43
|
+
<Heading level={2}>Buttons</Heading>
|
|
44
|
+
<HStack gap={3} vAlign="center">
|
|
45
|
+
<Button label="Primary" variant="primary" />
|
|
46
|
+
<Button label="Secondary" variant="secondary" />
|
|
47
|
+
<Button label="Ghost" variant="ghost" />
|
|
48
|
+
</HStack>
|
|
49
|
+
</VStack>
|
|
50
|
+
|
|
51
|
+
<Divider />
|
|
52
|
+
|
|
53
|
+
{/* Badges */}
|
|
54
|
+
<VStack gap={3}>
|
|
55
|
+
<Heading level={2}>Badges</Heading>
|
|
56
|
+
<HStack gap={3} vAlign="center">
|
|
57
|
+
<Badge variant="info" label="Info" />
|
|
58
|
+
<Badge variant="success" label="Success" />
|
|
59
|
+
<Badge variant="warning" label="Warning" />
|
|
60
|
+
<Badge variant="error" label="Error" />
|
|
61
|
+
</HStack>
|
|
62
|
+
</VStack>
|
|
63
|
+
|
|
64
|
+
<Divider />
|
|
65
|
+
|
|
66
|
+
{/* Text Input */}
|
|
67
|
+
<VStack gap={3}>
|
|
68
|
+
<Heading level={2}>Text Input</Heading>
|
|
69
|
+
<TextInput
|
|
70
|
+
label="Email address"
|
|
71
|
+
placeholder="you@example.com"
|
|
72
|
+
value={email}
|
|
73
|
+
onChange={setEmail}
|
|
74
|
+
/>
|
|
75
|
+
</VStack>
|
|
76
|
+
|
|
77
|
+
<Divider />
|
|
78
|
+
|
|
79
|
+
{/* Typography */}
|
|
80
|
+
<VStack gap={3}>
|
|
81
|
+
<Heading level={2}>Typography</Heading>
|
|
82
|
+
<Text type="large" weight="bold">
|
|
83
|
+
Large bold text
|
|
84
|
+
</Text>
|
|
85
|
+
<Text type="body">Default body text</Text>
|
|
86
|
+
<Text type="supporting" color="secondary">
|
|
87
|
+
Supporting text in secondary color
|
|
88
|
+
</Text>
|
|
89
|
+
</VStack>
|
|
90
|
+
</VStack>
|
|
91
|
+
</div>
|
|
92
|
+
</main>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import Link from 'next/link';
|
|
6
|
+
import {Theme} from '@astryxdesign/core/theme';
|
|
7
|
+
import {LinkProvider} from '@astryxdesign/core/Link';
|
|
8
|
+
import {neutralTheme} from '@astryxdesign/theme-neutral/built';
|
|
9
|
+
|
|
10
|
+
export function Providers({children}: {children: React.ReactNode}) {
|
|
11
|
+
return (
|
|
12
|
+
<Theme theme={neutralTheme}>
|
|
13
|
+
<LinkProvider component={Link}>{children}</LinkProvider>
|
|
14
|
+
</Theme>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2017",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"module": "esnext",
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"jsx": "react-jsx",
|
|
15
|
+
"incremental": true,
|
|
16
|
+
"plugins": [
|
|
17
|
+
{
|
|
18
|
+
"name": "next"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"paths": {
|
|
22
|
+
"@/*": ["./src/*"]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts"],
|
|
26
|
+
"exclude": ["node_modules"]
|
|
27
|
+
}
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
export const doc = {
|
|
5
5
|
type: 'block',
|
|
6
6
|
exampleFor: 'InternationalizationProvider',
|
|
7
|
-
name: '
|
|
7
|
+
name: 'Load a shipped Astryx locale catalog',
|
|
8
8
|
displayName: 'Internationalization Provider — Shipped Locale',
|
|
9
|
+
registry: {slug: 'shipped-locale'},
|
|
9
10
|
description:
|
|
10
11
|
'Load a locale catalog shipped by Astryx and re-render InternationalizationProvider with a new locale to update Astryx strings live.',
|
|
11
12
|
isReady: true,
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
export const doc = {
|
|
5
5
|
type: 'block',
|
|
6
6
|
exampleFor: 'InternationalizationProvider',
|
|
7
|
-
name: '
|
|
7
|
+
name: 'Override one Astryx string',
|
|
8
8
|
displayName: 'Internationalization Provider — Overrides',
|
|
9
|
+
registry: {slug: 'overrides'},
|
|
9
10
|
description:
|
|
10
11
|
'Override a small number of Astryx strings without providing a full locale catalog.',
|
|
11
12
|
isReady: true,
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
export const doc = {
|
|
5
5
|
type: 'block',
|
|
6
6
|
exampleFor: 'InternationalizationProvider',
|
|
7
|
-
name: '
|
|
7
|
+
name: 'Mirror the layout for right-to-left text',
|
|
8
8
|
displayName: 'Internationalization Provider — RTL Direction',
|
|
9
|
+
registry: {slug: 'rtl-direction'},
|
|
9
10
|
description:
|
|
10
11
|
'Toggle text direction with the `dir` prop and watch Astryx components mirror. Pagination flips its prev/next chevrons under RTL. The `dir` prop is passed to both `InternationalizationProvider` (so Astryx components pick it up) and the `VStack` (so the DOM subtree mirrors); both channels stay in sync with no extra wrapper.',
|
|
11
12
|
isReady: true,
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
export const doc = {
|
|
5
5
|
type: 'block',
|
|
6
6
|
exampleFor: 'InternationalizationProvider',
|
|
7
|
-
name: '
|
|
7
|
+
name: 'Show Calendar and DateInput in another calendar',
|
|
8
8
|
displayName: 'Internationalization Provider — Calendar',
|
|
9
|
+
registry: {slug: 'calendar'},
|
|
9
10
|
description:
|
|
10
11
|
'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
12
|
isReady: true,
|
|
@@ -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
|
+
}
|
|
@@ -514,6 +514,7 @@ export const CommandDocKindSchema: z.ZodObject<{
|
|
|
514
514
|
same: "same";
|
|
515
515
|
refuse: "refuse";
|
|
516
516
|
}>>;
|
|
517
|
+
replaces: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
517
518
|
related: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
518
519
|
notes: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
519
520
|
type: z.ZodLiteral<"prose">;
|
|
@@ -594,6 +594,7 @@ export const CommandDocKindSchema = z
|
|
|
594
594
|
.array(z.object({code: z.number(), when: z.string()}).passthrough())
|
|
595
595
|
.optional(),
|
|
596
596
|
outsideProject: z.enum(['same', 'refuse', 'own']).optional(),
|
|
597
|
+
replaces: z.array(z.string()).optional(),
|
|
597
598
|
related: z.array(z.string()).optional(),
|
|
598
599
|
notes: z.array(ReferenceContentBlockSchema).optional(),
|
|
599
600
|
})
|
|
@@ -209,6 +209,13 @@ export const doc = {
|
|
|
209
209
|
type: 'string',
|
|
210
210
|
description: 'Deprecation notice — a DEP-* id and the replacement.',
|
|
211
211
|
},
|
|
212
|
+
{
|
|
213
|
+
name: 'replaces',
|
|
214
|
+
type: 'string[]',
|
|
215
|
+
stability: 'experimental',
|
|
216
|
+
description:
|
|
217
|
+
'The commands this command is meant to replace, by command path (`theme build`). Help shows them as one line ("Will replace: astryx theme build"), and a later deprecation of those commands reads this list. It marks nothing as deprecated.',
|
|
218
|
+
},
|
|
212
219
|
{
|
|
213
220
|
name: 'related',
|
|
214
221
|
type: 'string[]',
|
|
@@ -97,6 +97,9 @@ export interface CommandDoc extends AuthoredDocGraphFields {
|
|
|
97
97
|
outsideProject?: CommandOutsideProject;
|
|
98
98
|
/** Deprecation notice — a DEP-* id and the replacement. */
|
|
99
99
|
deprecated?: string;
|
|
100
|
+
/** The commands this command is meant to replace, by command path (`theme build`). Help shows them as one line ("Will replace: astryx theme build"), and a later deprecation of those commands reads this list. It marks nothing as deprecated.
|
|
101
|
+
* @experimental May change or be removed in a patch release. */
|
|
102
|
+
replaces?: string[];
|
|
100
103
|
/** Related command names; the CLI links each to its doc. */
|
|
101
104
|
related?: string[];
|
|
102
105
|
/** Freeform prose/notes. */
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
// @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Whether a value is a path the data file accepts for a file in the set's
|
|
6
|
+
* package: `./` first, then plain segments, none of them `.` or `..`.
|
|
7
|
+
* @param {string} value
|
|
8
|
+
* @returns {boolean}
|
|
9
|
+
*/
|
|
10
|
+
export function isPackagePath(value: string): boolean;
|
|
4
11
|
/**
|
|
5
12
|
* Compile-time drift locks: the sealed schemas must infer the public types.
|
|
6
13
|
*
|
|
@@ -43,17 +43,27 @@ const EXPORT_RE = /^[$A-Z_a-z][$\w]*$/u;
|
|
|
43
43
|
// absolute, so no path in the data file can leave the package (FR5).
|
|
44
44
|
// A path inside the set's package, from its root: `./src/icons.js`.
|
|
45
45
|
const PACKAGE_PATH_RE = /^\.\/(?:[A-Za-z0-9._~@-]+\/)*[A-Za-z0-9._~@-]+$/u;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Whether a value is a path the data file accepts for a file in the set's
|
|
49
|
+
* package: `./` first, then plain segments, none of them `.` or `..`.
|
|
50
|
+
* @param {string} value
|
|
51
|
+
* @returns {boolean}
|
|
52
|
+
*/
|
|
53
|
+
export function isPackagePath(value) {
|
|
54
|
+
return (
|
|
55
|
+
PACKAGE_PATH_RE.test(value) &&
|
|
56
|
+
!value
|
|
57
|
+
.split('/')
|
|
58
|
+
.slice(1)
|
|
59
|
+
.some(part => part === '..' || part === '.')
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
46
63
|
const packagePathSchema = z
|
|
47
64
|
.string()
|
|
48
65
|
.regex(PACKAGE_PATH_RE, 'must be a ./ path inside the package')
|
|
49
|
-
.refine(
|
|
50
|
-
value =>
|
|
51
|
-
!value
|
|
52
|
-
.split('/')
|
|
53
|
-
.slice(1)
|
|
54
|
-
.some(part => part === '..' || part === '.'),
|
|
55
|
-
{message: 'must not contain "." or ".." segments'},
|
|
56
|
-
);
|
|
66
|
+
.refine(isPackagePath, {message: 'must not contain "." or ".." segments'});
|
|
57
67
|
const MODULE_RE =
|
|
58
68
|
/^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*(?:\/[A-Za-z0-9._~-]+)*$/u;
|
|
59
69
|
|