@astryxdesign/cli 0.6.5-vanilla-poc.6e25cfc → 0.6.6
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/CHANGELOG.md +84 -0
- package/README.md +1 -34
- package/api/build/_adapter.d.mts +14 -0
- package/api/build/_adapter.mjs +58 -1
- package/api/build/build.test.mjs +74 -1
- package/api/build/kit/kit.mjs +39 -7
- package/api/build/kit/rank.d.mts +8 -0
- package/api/build/kit/rank.mjs +14 -0
- package/api/build/kit/weights.d.mts +82 -0
- package/api/build/kit/weights.json +1 -0
- package/api/build/kit/weights.mjs +305 -0
- package/api/build/kit/weights.test.mjs +190 -0
- package/api/component/_adapter.d.mts +1 -51
- package/api/component/_adapter.mjs +3 -110
- package/api/component/component.d.mts +1 -9
- package/api/component/component.doc.mjs +7 -52
- package/api/component/component.mjs +3 -276
- package/api/component/component.type.d.mts +1 -28
- package/api/component/component.type.mjs +1 -20
- package/api/docs/docs.d.mts +6 -0
- package/api/docs/docs.depth.test.mjs +132 -0
- package/api/docs/docs.doc.mjs +31 -2
- package/api/docs/docs.mjs +44 -1
- package/api/docs/docs.type.d.mts +38 -1
- package/api/docs/docs.type.mjs +18 -1
- package/api/docs/node/node.d.mts +28 -3
- package/api/docs/node/node.mjs +146 -23
- package/api/hook/list/list.d.mts +1 -1
- package/api/index.d.mts +0 -8
- package/api/index.mjs +0 -8
- package/api/integration/add-theme.mjs +93 -3
- package/api/integration/add-theme.test.mjs +100 -0
- package/api/integration/integrationAddTheme.doc.mjs +1 -1
- package/api/search/search.d.mts +8 -1
- package/api/search/search.doc.mjs +3 -3
- package/api/search/search.mjs +58 -73
- package/api/search/search.test.mjs +122 -21
- package/api/search/search.type.d.mts +0 -10
- package/api/search/search.type.mjs +0 -1
- package/api/template/cdn/cdn.test.mjs +2 -50
- package/api/template/template.d.mts +0 -6
- package/api/template/template.doc.mjs +4 -56
- package/api/template/template.mjs +0 -82
- package/api/template/template.type.d.mts +0 -12
- package/api/template/template.type.mjs +0 -7
- package/assets/cdn.template.html +5 -19
- package/assets/docs/tokens.doc.mjs +3 -3
- package/assets/docs/tree/add-a-theme.doc.mjs +4 -0
- package/assets/docs/tree/troubleshooting.doc.mjs +4 -4
- package/clients/cli/commands/component/index.mjs +9 -66
- package/clients/cli/commands/component.doc.mjs +4 -26
- package/clients/cli/commands/docs.depth.test.mjs +219 -0
- package/clients/cli/commands/docs.doc.mjs +15 -2
- package/clients/cli/commands/docs.mjs +222 -5
- package/clients/cli/commands/integration-add.doc.mjs +1 -1
- package/clients/cli/commands/search.doc.mjs +2 -3
- package/clients/cli/commands/search.mjs +11 -8
- package/clients/cli/commands/search.test.mjs +35 -40
- package/clients/cli/commands/template.doc.mjs +3 -31
- package/clients/cli/commands/template.mjs +2 -37
- package/foundation/discovery/theme-discovery.d.mts +6 -0
- package/foundation/discovery/theme-discovery.mjs +9 -0
- package/foundation/response/response-types.doc.mjs +0 -38
- package/package.json +5 -9
- package/api/_vanilla-assets.d.mts +0 -10
- package/api/_vanilla-assets.mjs +0 -59
- package/api/component/html/html.d.mts +0 -12
- package/api/component/html/html.doc.d.mts +0 -5
- package/api/component/html/html.doc.mjs +0 -66
- package/api/component/html/html.mjs +0 -25
- package/api/component/html/html.test.mjs +0 -61
- package/api/component/html/html.type.d.mts +0 -23
- package/api/component/html/html.type.mjs +0 -27
- package/api/component/web-components/web-components.d.mts +0 -12
- package/api/component/web-components/web-components.doc.d.mts +0 -5
- package/api/component/web-components/web-components.doc.mjs +0 -70
- package/api/component/web-components/web-components.mjs +0 -32
- package/api/component/web-components/web-components.test.mjs +0 -50
- package/api/component/web-components/web-components.type.d.mts +0 -23
- package/api/component/web-components/web-components.type.mjs +0 -27
- package/api/template/_adapter.d.mts +0 -38
- package/api/template/_adapter.mjs +0 -90
- package/api/template/html/html.d.mts +0 -17
- package/api/template/html/html.doc.d.mts +0 -5
- package/api/template/html/html.doc.mjs +0 -72
- package/api/template/html/html.mjs +0 -61
- package/api/template/html/html.test.mjs +0 -71
- package/api/template/html/html.type.d.mts +0 -26
- package/api/template/html/html.type.mjs +0 -28
- package/api/template/web-components/web-components.d.mts +0 -13
- package/api/template/web-components/web-components.doc.d.mts +0 -5
- package/api/template/web-components/web-components.doc.mjs +0 -69
- package/api/template/web-components/web-components.mjs +0 -51
- package/api/template/web-components/web-components.test.mjs +0 -73
- package/api/template/web-components/web-components.type.d.mts +0 -26
- package/api/template/web-components/web-components.type.mjs +0 -28
- package/assets/generated/core-component-docs.json +0 -1
- package/assets/vanilla/elements-markup/Avatar.html +0 -27
- package/assets/vanilla/elements-markup/Badge.html +0 -16
- package/assets/vanilla/elements-markup/Banner.html +0 -32
- package/assets/vanilla/elements-markup/Breadcrumbs.html +0 -23
- package/assets/vanilla/elements-markup/Button.html +0 -37
- package/assets/vanilla/elements-markup/Card.html +0 -24
- package/assets/vanilla/elements-markup/CheckboxInput.html +0 -28
- package/assets/vanilla/elements-markup/Collapsible.html +0 -26
- package/assets/vanilla/elements-markup/DateInput.html +0 -28
- package/assets/vanilla/elements-markup/Dialog.html +0 -33
- package/assets/vanilla/elements-markup/Divider.html +0 -20
- package/assets/vanilla/elements-markup/DropdownMenu.html +0 -26
- package/assets/vanilla/elements-markup/EmptyState.html +0 -27
- package/assets/vanilla/elements-markup/Heading.html +0 -18
- package/assets/vanilla/elements-markup/HoverCard.html +0 -39
- package/assets/vanilla/elements-markup/Layout.html +0 -28
- package/assets/vanilla/elements-markup/Lightbox.html +0 -33
- package/assets/vanilla/elements-markup/Link.html +0 -23
- package/assets/vanilla/elements-markup/NumberInput.html +0 -34
- package/assets/vanilla/elements-markup/ProgressBar.html +0 -47
- package/assets/vanilla/elements-markup/RadioList.html +0 -28
- package/assets/vanilla/elements-markup/Selector.html +0 -34
- package/assets/vanilla/elements-markup/SideNav.html +0 -32
- package/assets/vanilla/elements-markup/Skeleton.html +0 -18
- package/assets/vanilla/elements-markup/Slider.html +0 -31
- package/assets/vanilla/elements-markup/Stack.html +0 -33
- package/assets/vanilla/elements-markup/StatusDot.html +0 -19
- package/assets/vanilla/elements-markup/Switch.html +0 -28
- package/assets/vanilla/elements-markup/Tab.html +0 -18
- package/assets/vanilla/elements-markup/TabList.html +0 -31
- package/assets/vanilla/elements-markup/Table.html +0 -31
- package/assets/vanilla/elements-markup/Text.html +0 -24
- package/assets/vanilla/elements-markup/TextArea.html +0 -32
- package/assets/vanilla/elements-markup/TextInput.html +0 -92
- package/assets/vanilla/elements-markup/Theme.html +0 -16
- package/assets/vanilla/elements-markup/TimeInput.html +0 -29
- package/assets/vanilla/elements-markup/Toast.html +0 -22
- package/assets/vanilla/elements-markup/Tooltip.html +0 -30
- package/assets/vanilla/elements-markup/TopNav.html +0 -85
- package/assets/vanilla/elements-markup/Typeahead.html +0 -31
- package/assets/vanilla/elements-templates/dashboard.html +0 -167
- package/assets/vanilla/elements-templates/detail-page.html +0 -145
- package/assets/vanilla/elements-templates/form-two-column.html +0 -135
- package/assets/vanilla/elements-templates/kanban-board.html +0 -141
- package/assets/vanilla/elements-templates/login.html +0 -100
- package/assets/vanilla/elements-templates/product-detail.html +0 -128
- package/assets/vanilla/elements-templates/settings.html +0 -130
- package/assets/vanilla/elements-templates/shell-side-nav.html +0 -160
- package/assets/vanilla/elements-templates/table-filter.html +0 -154
- package/assets/vanilla/markup/Avatar.html +0 -24
- package/assets/vanilla/markup/Badge.html +0 -12
- package/assets/vanilla/markup/Banner.html +0 -49
- package/assets/vanilla/markup/Breadcrumbs.html +0 -38
- package/assets/vanilla/markup/Button.html +0 -37
- package/assets/vanilla/markup/Card.html +0 -16
- package/assets/vanilla/markup/CheckboxInput.html +0 -45
- package/assets/vanilla/markup/Collapsible.html +0 -9
- package/assets/vanilla/markup/DateInput.html +0 -42
- package/assets/vanilla/markup/Dialog.html +0 -45
- package/assets/vanilla/markup/Divider.html +0 -9
- package/assets/vanilla/markup/DropdownMenu.html +0 -30
- package/assets/vanilla/markup/EmptyState.html +0 -41
- package/assets/vanilla/markup/Heading.html +0 -9
- package/assets/vanilla/markup/HoverCard.html +0 -85
- package/assets/vanilla/markup/Layout.html +0 -35
- package/assets/vanilla/markup/Lightbox.html +0 -107
- package/assets/vanilla/markup/Link.html +0 -6
- package/assets/vanilla/markup/NumberInput.html +0 -55
- package/assets/vanilla/markup/ProgressBar.html +0 -101
- package/assets/vanilla/markup/RadioList.html +0 -90
- package/assets/vanilla/markup/Selector.html +0 -92
- package/assets/vanilla/markup/SideNav.html +0 -82
- package/assets/vanilla/markup/Skeleton.html +0 -26
- package/assets/vanilla/markup/Slider.html +0 -65
- package/assets/vanilla/markup/Stack.html +0 -13
- package/assets/vanilla/markup/StatusDot.html +0 -22
- package/assets/vanilla/markup/Switch.html +0 -47
- package/assets/vanilla/markup/TabList.html +0 -56
- package/assets/vanilla/markup/Table.html +0 -75
- package/assets/vanilla/markup/Text.html +0 -9
- package/assets/vanilla/markup/TextArea.html +0 -37
- package/assets/vanilla/markup/TextInput.html +0 -80
- package/assets/vanilla/markup/Theme.html +0 -48
- package/assets/vanilla/markup/TimeInput.html +0 -43
- package/assets/vanilla/markup/Toast.html +0 -42
- package/assets/vanilla/markup/Tooltip.html +0 -18
- package/assets/vanilla/markup/TopNav.html +0 -81
- package/assets/vanilla/markup/Typeahead.html +0 -60
- package/assets/vanilla/templates/dashboard.html +0 -462
- package/assets/vanilla/templates/detail-page.html +0 -536
- package/assets/vanilla/templates/form-two-column.html +0 -438
- package/assets/vanilla/templates/kanban-board.html +0 -443
- package/assets/vanilla/templates/login.html +0 -199
- package/assets/vanilla/templates/product-detail.html +0 -335
- package/assets/vanilla/templates/settings.html +0 -374
- package/assets/vanilla/templates/shell-side-nav.html +0 -440
- package/assets/vanilla/templates/table-filter.html +0 -514
- package/clients/cli/commands/vanilla-html.test.mjs +0 -245
- package/foundation/discovery/bundled-component-docs.d.mts +0 -39
- package/foundation/discovery/bundled-component-docs.mjs +0 -92
|
@@ -29,10 +29,6 @@ import {templateShow} from './show/show.mjs';
|
|
|
29
29
|
import {templateSkeleton} from './skeleton/skeleton.mjs';
|
|
30
30
|
import {templateCopy} from './copy/copy.mjs';
|
|
31
31
|
import {templateCdn} from './cdn/cdn.mjs';
|
|
32
|
-
import {templateHtml} from './html/html.mjs';
|
|
33
|
-
import {templateWebComponents} from './web-components/web-components.mjs';
|
|
34
|
-
|
|
35
|
-
const FRAMEWORKS = ['react', 'html', 'web-components'];
|
|
36
32
|
|
|
37
33
|
// Re-export the shared discovery/IO + cross-command helpers so this module
|
|
38
34
|
// stays the single import surface for the template family (same exports as
|
|
@@ -70,9 +66,6 @@ export {
|
|
|
70
66
|
* @param {boolean} [options.list]
|
|
71
67
|
* @param {boolean} [options.skeleton]
|
|
72
68
|
* @param {boolean | string} [options.cdn] - Write the no-build-step CDN starter page; a string is used as the destination path.
|
|
73
|
-
* @param {boolean} [options.html] - Deprecated alias for framework='html'.
|
|
74
|
-
* @param {'react'|'html'|'web-components'} [options.framework] - Output framework; defaults to react.
|
|
75
|
-
* @param {string} [options.cdnRef] - Git ref used for vanilla jsDelivr URLs; valid only with html or web-components.
|
|
76
69
|
* @param {boolean} [options.show]
|
|
77
70
|
* @param {'page'|'block'} [options.type] - Filter list views / narrow lookups by template kind.
|
|
78
71
|
* @param {string} [options.package] - Narrow lookups to a specific package (id-only matches across packages are ambiguous).
|
|
@@ -85,9 +78,6 @@ export async function template(name, options = {}) {
|
|
|
85
78
|
skeleton = false,
|
|
86
79
|
show = false,
|
|
87
80
|
cdn = false,
|
|
88
|
-
html = false,
|
|
89
|
-
framework,
|
|
90
|
-
cdnRef,
|
|
91
81
|
targetPath,
|
|
92
82
|
overwrite = false,
|
|
93
83
|
type,
|
|
@@ -95,78 +85,6 @@ export async function template(name, options = {}) {
|
|
|
95
85
|
cwd = process.cwd(),
|
|
96
86
|
} = options;
|
|
97
87
|
|
|
98
|
-
if (framework !== undefined && !FRAMEWORKS.includes(framework)) {
|
|
99
|
-
throw new AstryxError(
|
|
100
|
-
`Unknown framework "${String(framework)}". Valid frameworks: ${FRAMEWORKS.join(', ')}`,
|
|
101
|
-
undefined,
|
|
102
|
-
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
if (html && framework !== undefined) {
|
|
106
|
-
throw new AstryxError(
|
|
107
|
-
'--html cannot be combined with --framework; use --framework html instead',
|
|
108
|
-
undefined,
|
|
109
|
-
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
const selectedFramework = html ? 'html' : (framework ?? 'react');
|
|
113
|
-
|
|
114
|
-
if (cdnRef !== undefined && selectedFramework === 'react') {
|
|
115
|
-
throw new AstryxError(
|
|
116
|
-
'--cdn-ref requires --html or --framework html|web-components',
|
|
117
|
-
undefined,
|
|
118
|
-
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (selectedFramework !== 'react') {
|
|
123
|
-
const frameworkFlag = html ? '--html' : `--framework ${selectedFramework}`;
|
|
124
|
-
const incompatible = [
|
|
125
|
-
cdn ? '--cdn' : null,
|
|
126
|
-
skeleton ? '--skeleton' : null,
|
|
127
|
-
targetPath ? '<path>' : null,
|
|
128
|
-
overwrite ? '--overwrite' : null,
|
|
129
|
-
type ? '--type' : null,
|
|
130
|
-
packageFilter ? '--package' : null,
|
|
131
|
-
].filter(Boolean);
|
|
132
|
-
if (incompatible.length > 0) {
|
|
133
|
-
throw new AstryxError(
|
|
134
|
-
`${frameworkFlag} cannot be combined with ${incompatible.join(', ')}`,
|
|
135
|
-
undefined,
|
|
136
|
-
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
if (list && name) {
|
|
140
|
-
throw new AstryxError(
|
|
141
|
-
`--list ${frameworkFlag} cannot be combined with a template id`,
|
|
142
|
-
undefined,
|
|
143
|
-
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
if (list && cdnRef !== undefined) {
|
|
147
|
-
throw new AstryxError(
|
|
148
|
-
`--cdn-ref is only valid with a named ${frameworkFlag} template`,
|
|
149
|
-
undefined,
|
|
150
|
-
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
if (!list && !name) {
|
|
154
|
-
throw new AstryxError(
|
|
155
|
-
`${frameworkFlag} requires a template id or --list`,
|
|
156
|
-
undefined,
|
|
157
|
-
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
const vanillaOptions = {
|
|
161
|
-
cwd,
|
|
162
|
-
list,
|
|
163
|
-
...(cdnRef !== undefined ? {cdnRef} : {}),
|
|
164
|
-
};
|
|
165
|
-
return selectedFramework === 'html'
|
|
166
|
-
? templateHtml(name, vanillaOptions)
|
|
167
|
-
: templateWebComponents(name, vanillaOptions);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
88
|
// The CDN starter ships as an asset rather than as a discovered template, so
|
|
171
89
|
// it answers before discovery — nothing here needs a name resolved.
|
|
172
90
|
if (cdn) {
|
|
@@ -121,18 +121,6 @@ export type TemplateOptions = {
|
|
|
121
121
|
* Write the no-build-step CDN starter page instead of resolving a template. A string is used as the destination path.
|
|
122
122
|
*/
|
|
123
123
|
cdn?: string | boolean | undefined;
|
|
124
|
-
/**
|
|
125
|
-
* Deprecated alias for framework='html'.
|
|
126
|
-
*/
|
|
127
|
-
html?: boolean | undefined;
|
|
128
|
-
/**
|
|
129
|
-
* Output framework; defaults to react.
|
|
130
|
-
*/
|
|
131
|
-
framework?: "react" | "html" | "web-components" | undefined;
|
|
132
|
-
/**
|
|
133
|
-
* Git ref inserted into vanilla jsDelivr URLs; requires html or web-components.
|
|
134
|
-
*/
|
|
135
|
-
cdnRef?: string | undefined;
|
|
136
124
|
/**
|
|
137
125
|
* Filter templates by kind: 'page' or 'block'. Narrows both list and direct lookup.
|
|
138
126
|
*/
|
|
@@ -13,10 +13,6 @@
|
|
|
13
13
|
* astryx --json template <name> --skeleton -> template.skeleton
|
|
14
14
|
* astryx --json template <name> [path] -> template.copy
|
|
15
15
|
* astryx --json template --cdn [path] -> template.cdn
|
|
16
|
-
* astryx --json template --list --framework html -> template.html.list
|
|
17
|
-
* astryx --json template <name> --framework html -> template.html
|
|
18
|
-
* astryx --json template --list --framework web-components -> template.web-components.list
|
|
19
|
-
* astryx --json template <name> --framework web-components -> template.web-components
|
|
20
16
|
* (unknown template) -> CLIError
|
|
21
17
|
*/
|
|
22
18
|
|
|
@@ -100,9 +96,6 @@
|
|
|
100
96
|
* @property {boolean} [skeleton]
|
|
101
97
|
* @property {boolean} [show]
|
|
102
98
|
* @property {boolean | string} [cdn] Write the no-build-step CDN starter page instead of resolving a template. A string is used as the destination path.
|
|
103
|
-
* @property {boolean} [html] Deprecated alias for framework='html'.
|
|
104
|
-
* @property {'react'|'html'|'web-components'} [framework] Output framework; defaults to react.
|
|
105
|
-
* @property {string} [cdnRef] Git ref inserted into vanilla jsDelivr URLs; requires html or web-components.
|
|
106
99
|
* @property {'page' | 'block'} [type] Filter templates by kind: 'page' or 'block'. Narrows both list and direct lookup.
|
|
107
100
|
* @property {string} [package] Narrow to templates from a specific package. Without it, a valid integration replacement is selected for the Core id; @astryxdesign/core explicitly selects the original.
|
|
108
101
|
* @property {string} [targetPath]
|
package/assets/cdn.template.html
CHANGED
|
@@ -47,10 +47,9 @@
|
|
|
47
47
|
react/jsx-runtime is not decoration: the published bundle imports it, and
|
|
48
48
|
leaving it out fails the page with "Failed to resolve module specifier".
|
|
49
49
|
|
|
50
|
-
?external=react,react-dom
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
themed semantic icon exercises that boundary below.
|
|
50
|
+
?external=react,react-dom makes esm.sh reuse the React above instead of
|
|
51
|
+
bundling its own. Two React copies means every hook throws
|
|
52
|
+
"Cannot read properties of null (reading 'useState')".
|
|
54
53
|
|
|
55
54
|
htm is optional — delete it and the `h` binding below if you would rather
|
|
56
55
|
call createElement directly. It costs ~1KB and buys JSX-shaped markup,
|
|
@@ -93,22 +92,13 @@
|
|
|
93
92
|
import * as React from 'react';
|
|
94
93
|
import {createRoot} from 'react-dom/client';
|
|
95
94
|
import htm from 'htm';
|
|
96
|
-
import {
|
|
97
|
-
Theme,
|
|
98
|
-
Card,
|
|
99
|
-
Stack,
|
|
100
|
-
Heading,
|
|
101
|
-
Text,
|
|
102
|
-
Button,
|
|
103
|
-
Icon,
|
|
104
|
-
} from '@astryxdesign/core';
|
|
95
|
+
import {Theme, Card, Stack, Heading, Text, Button} from '@astryxdesign/core';
|
|
105
96
|
import {neutralTheme} from '@astryxdesign/theme-neutral';
|
|
106
97
|
|
|
107
98
|
// Nothing is compiling this file, so there is no JSX. htm gives the same
|
|
108
99
|
// shape from a tagged template; `React.createElement` directly is the
|
|
109
100
|
// dependency-free alternative.
|
|
110
101
|
const h = htm.bind(React.createElement);
|
|
111
|
-
const themedIcon = h`<${Icon} icon="check" />`;
|
|
112
102
|
|
|
113
103
|
// Passing the theme OBJECT is what makes `mode` work: 'system' follows
|
|
114
104
|
// the OS, and light/dark switch at runtime. The `data-astryx-theme`
|
|
@@ -123,11 +113,7 @@
|
|
|
123
113
|
<!-- Button's text comes from \`label\`, which is required — it is
|
|
124
114
|
the accessible name. Children are optional and only change
|
|
125
115
|
the visible text; the accessible name stays \`label\`. -->
|
|
126
|
-
<${Button}
|
|
127
|
-
variant="primary"
|
|
128
|
-
label="Try me"
|
|
129
|
-
icon=${themedIcon}
|
|
130
|
-
/>
|
|
116
|
+
<${Button} variant="primary" label="Try me" />
|
|
131
117
|
</${Stack}>
|
|
132
118
|
</${Card}>
|
|
133
119
|
</${Stack}>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// AUTO-GENERATED — do not edit manually.
|
|
4
4
|
// Source: packages/core/src/theme/tokens.stylex.ts,
|
|
5
|
-
//
|
|
5
|
+
// dataTokens.stylex.ts, and syntax/tokens.ts
|
|
6
6
|
// Run: node scripts/generate-token-docs.mjs
|
|
7
7
|
// Total: 258 tokens across 15 categories.
|
|
8
8
|
|
|
@@ -439,7 +439,7 @@ export const docs = {
|
|
|
439
439
|
"content": [
|
|
440
440
|
{
|
|
441
441
|
"type": "prose",
|
|
442
|
-
"text": "Colors for charts and graphs: one categorical accent per series, a neutral for labels and reference lines, and sequential ramps from 5 (darkest) to 1 (lightest) for ordered scales and heatmaps."
|
|
442
|
+
"text": "Colors for charts and graphs: one categorical accent per series, a neutral for labels and reference lines, and sequential ramps from 5 (darkest) to 1 (lightest) for ordered scales and heatmaps. Import their public StyleX variables from @astryxdesign/core/theme/dataTokens.stylex."
|
|
443
443
|
},
|
|
444
444
|
{
|
|
445
445
|
"type": "table",
|
|
@@ -1479,7 +1479,7 @@ export const docs = {
|
|
|
1479
1479
|
"type": "code",
|
|
1480
1480
|
"lang": "tsx",
|
|
1481
1481
|
"label": "Using token imports",
|
|
1482
|
-
"code": "import * as stylex from '@stylexjs/stylex';\nimport {colorVars, spacingVars, sizeVars, radiusVars} from '@astryxdesign/core/theme/tokens.stylex';\n\nconst styles = stylex.create({\n card: {\n padding: spacingVars['--spacing-4'],\n backgroundColor: colorVars['--color-background-surface'],\n borderRadius: radiusVars['--radius-container'],\n },\n button: {\n height: sizeVars['--size-element-md'],\n },\n});"
|
|
1482
|
+
"code": "import * as stylex from '@stylexjs/stylex';\nimport {colorVars, spacingVars, sizeVars, radiusVars} from '@astryxdesign/core/theme/tokens.stylex';\nimport {dataVars} from '@astryxdesign/core/theme/dataTokens.stylex';\n\nconst styles = stylex.create({\n card: {\n padding: spacingVars['--spacing-4'],\n backgroundColor: colorVars['--color-background-surface'],\n borderRadius: radiusVars['--radius-container'],\n },\n series: {\n color: dataVars['--color-data-categorical-blue'],\n },\n button: {\n height: sizeVars['--size-element-md'],\n },\n});"
|
|
1483
1483
|
},
|
|
1484
1484
|
{
|
|
1485
1485
|
"type": "prose",
|
|
@@ -65,6 +65,10 @@ Declare theme root ./themes in astryx.integration.mjs.
|
|
|
65
65
|
lang: 'bash',
|
|
66
66
|
code: 'npx astryx integration add theme ocean --from neutral',
|
|
67
67
|
},
|
|
68
|
+
{
|
|
69
|
+
type: 'prose',
|
|
70
|
+
text: 'The copy keeps the packages the base theme uses, such as `lucide-react` for its icons: `--from` adds them to your `dependencies`, so an app that installs your package gets them too. Install your dependencies again before you build the theme.',
|
|
71
|
+
},
|
|
68
72
|
{
|
|
69
73
|
type: 'prose',
|
|
70
74
|
text: 'Use `--from` when you want to change a lot. For a small change that should stay linked to a base theme, use `extends` instead ({@link generic:define-the-theme}).',
|
|
@@ -34,12 +34,12 @@ export const docs = {
|
|
|
34
34
|
'Run `npm init -y` and `npm pkg set name=@acme/astryx-widgets` first, in the package folder.',
|
|
35
35
|
],
|
|
36
36
|
[
|
|
37
|
-
'`Error:
|
|
38
|
-
'
|
|
37
|
+
'`Error: Could not find @astryxdesign/core package`',
|
|
38
|
+
'Component commands read Core. Run `npm install -D @astryxdesign/core` in the package.',
|
|
39
39
|
],
|
|
40
40
|
[
|
|
41
41
|
'`core_not_found`: `Could not resolve @astryxdesign/core, so component names could not be checked.`',
|
|
42
|
-
'
|
|
42
|
+
'Same fix. The check exits 1.',
|
|
43
43
|
],
|
|
44
44
|
[
|
|
45
45
|
"`Error: unknown subcommand 'integration verify'`, or `Error: Pass --check to verify the integration tarball.`",
|
|
@@ -78,7 +78,7 @@ export const docs = {
|
|
|
78
78
|
"The `exports` map has no entry for it. Run `npm pkg set 'exports[./components/AcmeCarousel]=./components/AcmeCarousel.tsx'`, or `'exports[./templates/acme-dashboard]=./templates/acme-dashboard.tsx'` for a template.",
|
|
79
79
|
],
|
|
80
80
|
[
|
|
81
|
-
|
|
81
|
+
'`component_import_unresolvable`: `…but a consumer cannot resolve it: Cannot find package \'@acme/old-name\'`',
|
|
82
82
|
"You renamed the package after the add wrote each doc's `import`. Change `import` in every component doc to the new name.",
|
|
83
83
|
],
|
|
84
84
|
[
|
|
@@ -44,10 +44,6 @@ import {doc as componentFn} from '../../../../api/component/component.doc.mjs';
|
|
|
44
44
|
* | import('../../../../api/component/component.type.mjs').ComponentDetailSourceResponse
|
|
45
45
|
* | import('../../../../api/component/component.type.mjs').ComponentDetailShowcaseResponse
|
|
46
46
|
* | import('../../../../api/component/component.type.mjs').ComponentDetailBlocksResponse
|
|
47
|
-
* | import('../../../../api/component/html/html.type.mjs').ComponentHtmlListResponse
|
|
48
|
-
* | import('../../../../api/component/html/html.type.mjs').ComponentHtmlResponse
|
|
49
|
-
* | import('../../../../api/component/web-components/web-components.type.mjs').ComponentWebComponentsListResponse
|
|
50
|
-
* | import('../../../../api/component/web-components/web-components.type.mjs').ComponentWebComponentsResponse
|
|
51
47
|
* )} ComponentResult
|
|
52
48
|
*/
|
|
53
49
|
|
|
@@ -82,12 +78,6 @@ function summarize(result) {
|
|
|
82
78
|
case 'component.detail.source':
|
|
83
79
|
case 'component.detail.showcase':
|
|
84
80
|
return resultSet({count: 1, resultKind: 'component', directMatch: true});
|
|
85
|
-
case 'component.html':
|
|
86
|
-
case 'component.web-components':
|
|
87
|
-
return resultSet({count: 1, resultKind: 'component', directMatch: true});
|
|
88
|
-
case 'component.html.list':
|
|
89
|
-
case 'component.web-components.list':
|
|
90
|
-
return resultSet({count: result.data.length, resultKind: 'component'});
|
|
91
81
|
case 'component.detail.blocks': {
|
|
92
82
|
const {showcase, examples, related} = result.data;
|
|
93
83
|
return resultSet({
|
|
@@ -185,7 +175,7 @@ export function registerComponent(program) {
|
|
|
185
175
|
fn: componentFn,
|
|
186
176
|
action: async (
|
|
187
177
|
/** @type {string[] | undefined} */ names,
|
|
188
|
-
/** @type {{list?: boolean, category?: string, props?: boolean, source?: boolean, showcase?: boolean, blocks?: boolean, package?: string
|
|
178
|
+
/** @type {{list?: boolean, category?: string, props?: boolean, source?: boolean, showcase?: boolean, blocks?: boolean, package?: string}} */ options,
|
|
189
179
|
) => {
|
|
190
180
|
const run = getCliInvocation();
|
|
191
181
|
const name = names?.length === 1 ? names[0] : undefined;
|
|
@@ -228,8 +218,6 @@ export function registerComponent(program) {
|
|
|
228
218
|
source: options.source,
|
|
229
219
|
showcase: options.showcase,
|
|
230
220
|
blocks: options.blocks,
|
|
231
|
-
html: options.html,
|
|
232
|
-
framework: /** @type {'react'|'html'|'web-components'|undefined} */ (options.framework),
|
|
233
221
|
detail,
|
|
234
222
|
lang, zh, dense,
|
|
235
223
|
}));
|
|
@@ -250,39 +238,11 @@ export function registerComponent(program) {
|
|
|
250
238
|
return answered;
|
|
251
239
|
}
|
|
252
240
|
|
|
253
|
-
if (
|
|
254
|
-
result.type === 'component.html.list' ||
|
|
255
|
-
result.type === 'component.web-components.list'
|
|
256
|
-
) {
|
|
257
|
-
const framework =
|
|
258
|
-
result.type === 'component.html.list' ? 'HTML' : 'web-component';
|
|
259
|
-
emit(
|
|
260
|
-
section(`Vanilla ${framework} components`),
|
|
261
|
-
records(result.data, {fields: ['name', 'file']}),
|
|
262
|
-
);
|
|
263
|
-
return answered;
|
|
264
|
-
}
|
|
265
|
-
if (
|
|
266
|
-
result.type === 'component.html' ||
|
|
267
|
-
result.type === 'component.web-components'
|
|
268
|
-
) {
|
|
269
|
-
emit(code(result.data.source));
|
|
270
|
-
return answered;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
241
|
// ── Text output ────────────────────────────────────────────
|
|
274
|
-
//
|
|
275
|
-
//
|
|
276
|
-
const coreDir = findCoreDir(process.cwd());
|
|
277
|
-
const themeData =
|
|
278
|
-
const bundledDocs = result.meta?.componentDocs;
|
|
279
|
-
const sourceNote = bundledDocs
|
|
280
|
-
? [
|
|
281
|
-
text(
|
|
282
|
-
`Component docs: ${bundledDocs.package}@${bundledDocs.version} (bundled with the CLI; no local Core installation found).`,
|
|
283
|
-
),
|
|
284
|
-
]
|
|
285
|
-
: [];
|
|
242
|
+
// The api layer already resolved against core (result exists), so core is
|
|
243
|
+
// present on this path; narrow away the null branch findCoreDir allows.
|
|
244
|
+
const coreDir = /** @type {string} */ (findCoreDir(process.cwd()));
|
|
245
|
+
const themeData = resolveTheme(process.cwd());
|
|
286
246
|
|
|
287
247
|
// Footer shared by the compact + names list views (prose → text()).
|
|
288
248
|
const listFooter = text(
|
|
@@ -299,18 +259,7 @@ export function registerComponent(program) {
|
|
|
299
259
|
if (result.data.detail === 'full') {
|
|
300
260
|
// --detail full — dense per-component docs (signature, props, theming,
|
|
301
261
|
// examples). Verbatim doc block from the shared formatter.
|
|
302
|
-
|
|
303
|
-
? await formatBriefAll(coreDir, {zh, lang, themeData})
|
|
304
|
-
: Object.values(result.data.components)
|
|
305
|
-
.flat()
|
|
306
|
-
.map(doc =>
|
|
307
|
-
formatFull(doc, {
|
|
308
|
-
themeData,
|
|
309
|
-
importHint: doc.import,
|
|
310
|
-
}),
|
|
311
|
-
)
|
|
312
|
-
.join('\n\n');
|
|
313
|
-
emit(...sourceNote, code(rendered));
|
|
262
|
+
emit(code(await formatBriefAll(coreDir, {zh, lang, themeData})));
|
|
314
263
|
break;
|
|
315
264
|
}
|
|
316
265
|
|
|
@@ -329,7 +278,7 @@ export function registerComponent(program) {
|
|
|
329
278
|
out.push(records(items, {fields: ['name', 'import', 'description']}));
|
|
330
279
|
}
|
|
331
280
|
out.push(listFooter);
|
|
332
|
-
emit(...
|
|
281
|
+
emit(...out);
|
|
333
282
|
break;
|
|
334
283
|
}
|
|
335
284
|
|
|
@@ -354,11 +303,7 @@ export function registerComponent(program) {
|
|
|
354
303
|
// Use a precomputed import when the API supplies one (integration
|
|
355
304
|
// components carry it); only fall back to the core resolver for
|
|
356
305
|
// core components.
|
|
357
|
-
const importPath =
|
|
358
|
-
item.import ??
|
|
359
|
-
(coreDir
|
|
360
|
-
? resolveImportPath(coreDir, item.name)
|
|
361
|
-
: `${CORE_PKG}/${item.name}`);
|
|
306
|
+
const importPath = item.import ?? resolveImportPath(coreDir, item.name);
|
|
362
307
|
const qualify =
|
|
363
308
|
item.package !== CORE_PKG || (nameCounts.get(item.name)?.size ?? 0) > 1;
|
|
364
309
|
return qualify ? `${importPath} [${item.package}]` : importPath;
|
|
@@ -370,7 +315,6 @@ export function registerComponent(program) {
|
|
|
370
315
|
const sorted = [...entries].sort((a, b) => a.name.localeCompare(b.name));
|
|
371
316
|
|
|
372
317
|
emit(
|
|
373
|
-
...sourceNote,
|
|
374
318
|
options.category && firstGroup
|
|
375
319
|
? section(firstGroup[0])
|
|
376
320
|
: section(`Components (${sorted.length})`),
|
|
@@ -424,7 +368,7 @@ export function registerComponent(program) {
|
|
|
424
368
|
);
|
|
425
369
|
}
|
|
426
370
|
}
|
|
427
|
-
emit(...
|
|
371
|
+
emit(...out);
|
|
428
372
|
break;
|
|
429
373
|
}
|
|
430
374
|
|
|
@@ -434,7 +378,6 @@ export function registerComponent(program) {
|
|
|
434
378
|
case 'component.detail.showcase':
|
|
435
379
|
case 'component.detail.blocks':
|
|
436
380
|
emit(
|
|
437
|
-
...sourceNote,
|
|
438
381
|
...componentDetailBlocks(
|
|
439
382
|
result,
|
|
440
383
|
name ?? '',
|
|
@@ -17,13 +17,11 @@ export const doc = {
|
|
|
17
17
|
summary: 'List components or print component docs',
|
|
18
18
|
description:
|
|
19
19
|
'Resolves one or several components by exact selector across core and integration ' +
|
|
20
|
-
'packages and prints each authored doc, lists the catalog grouped by category
|
|
21
|
-
'reads vanilla HTML or web-component markup. ' +
|
|
20
|
+
'packages and prints each authored doc, or lists the catalog grouped by category. ' +
|
|
22
21
|
"Use 'Button', 'widgets/Button', '@acme/widgets/Button', or " +
|
|
23
22
|
"'@acme/widgets@1.2.3/Button'. A version applies to the package and must match the " +
|
|
24
|
-
'installed version.
|
|
25
|
-
'
|
|
26
|
-
'resolved component to just its props, source, showcase, or example blocks.',
|
|
23
|
+
'installed version. Boolean flags narrow every resolved component to just its props, ' +
|
|
24
|
+
'source, showcase, or example blocks.',
|
|
27
25
|
fn: 'component',
|
|
28
26
|
args: [
|
|
29
27
|
{
|
|
@@ -73,18 +71,6 @@ export const doc = {
|
|
|
73
71
|
description:
|
|
74
72
|
'Scope lookup to an external package (e.g. @acme/xds-widgets)',
|
|
75
73
|
},
|
|
76
|
-
{
|
|
77
|
-
flag: '--framework <framework>',
|
|
78
|
-
param: 'options.framework',
|
|
79
|
-
description:
|
|
80
|
-
'Output framework: react (default), html, or web-components. HTML and web-components print one vanilla markup file or list their files with --list.',
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
flag: '--html',
|
|
84
|
-
param: 'options.html',
|
|
85
|
-
description:
|
|
86
|
-
'Deprecated alias for --framework html. Print vanilla HTML markup for exactly one <name>, or list packages/vanilla/markup files with --list.',
|
|
87
|
-
},
|
|
88
74
|
],
|
|
89
75
|
examples: [
|
|
90
76
|
{label: 'Browse the catalog', cli: 'astryx component --list'},
|
|
@@ -96,20 +82,12 @@ export const doc = {
|
|
|
96
82
|
label: 'Props table as JSON',
|
|
97
83
|
cli: 'astryx component Button --props --json',
|
|
98
84
|
},
|
|
99
|
-
{
|
|
100
|
-
label: 'Vanilla HTML markup',
|
|
101
|
-
cli: 'astryx component Button --framework html',
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
label: 'Vanilla web-component markup',
|
|
105
|
-
cli: 'astryx component Button --framework web-components',
|
|
106
|
-
},
|
|
107
85
|
],
|
|
108
86
|
exitCodes: [
|
|
109
87
|
{code: 0, when: 'success'},
|
|
110
88
|
{
|
|
111
89
|
code: 1,
|
|
112
|
-
when: 'unknown component, category,
|
|
90
|
+
when: 'unknown component, category, or package; more than 100 selectors; any batch row is unresolved; or @astryxdesign/core cannot be resolved',
|
|
113
91
|
},
|
|
114
92
|
],
|
|
115
93
|
related: ['search', 'hook', 'docs', 'template', 'swizzle'],
|