@astryxdesign/cli 0.7.13 → 0.7.14-canary.d08ce65
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 +10 -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 +96 -0
- package/api/theme-edit/_adapter.mjs +1039 -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 +842 -0
- package/api/theme-edit/_color.d.mts +35 -0
- package/api/theme-edit/_color.mjs +125 -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 +86 -0
- package/api/theme-edit/_preview.mjs +564 -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 +848 -0
- package/api/theme-edit/_tables.d.mts +130 -0
- package/api/theme-edit/_tables.mjs +697 -0
- package/api/theme-edit/theme-edit.d.mts +89 -0
- package/api/theme-edit/theme-edit.mjs +119 -0
- package/api/theme-edit/theme-edit.type.d.mts +270 -0
- package/api/theme-edit/theme-edit.type.mjs +155 -0
- package/api/theme-edit/themeEditExplain.doc.d.mts +6 -0
- package/api/theme-edit/themeEditExplain.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/themeEditPreview.doc.d.mts +6 -0
- package/api/theme-edit/themeEditPreview.doc.mjs +96 -0
- package/api/theme-edit/themeEditReset.doc.d.mts +6 -0
- package/api/theme-edit/themeEditReset.doc.mjs +161 -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 +80 -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/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 +542 -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-eject.doc.mjs +71 -0
- package/clients/cli/commands/experimental-theme-explain.doc.mjs +84 -0
- package/clients/cli/commands/experimental-theme-list.doc.mjs +49 -0
- package/clients/cli/commands/experimental-theme-new.doc.mjs +66 -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.doc.mjs +76 -0
- package/clients/cli/commands/experimental-theme-remove.doc.mjs +55 -0
- package/clients/cli/commands/experimental-theme-reset.doc.mjs +103 -0
- package/clients/cli/commands/experimental-theme-set.doc.mjs +121 -0
- package/clients/cli/commands/experimental-theme-show.doc.mjs +66 -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-undo.doc.mjs +55 -0
- package/clients/cli/commands/experimental-theme-use.doc.mjs +55 -0
- package/clients/cli/commands/experimental-theme.doc.mjs +66 -0
- package/clients/cli/commands/experimental.doc.mjs +10 -3
- package/clients/cli/commands/theme.mjs +101 -34
- package/clients/cli/index.mjs +16 -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 +43 -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,95 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file The icon definitions the bundled templates use (AST-084 FR15), and
|
|
5
|
+
* the ones an icon set leaves unmapped.
|
|
6
|
+
*
|
|
7
|
+
* A bundled page or block template names, in its descriptor's `icons`, the
|
|
8
|
+
* icon definition each icon it imports draws. A copied template renders a
|
|
9
|
+
* placeholder for a definition the project's sets do not map, so an icon-set
|
|
10
|
+
* author needs to know which definitions templates use beyond the built-in
|
|
11
|
+
* ones. Each definition counts the templates that use it, once per template.
|
|
12
|
+
* Only Astryx's own definitions count: a name that is not one is a template
|
|
13
|
+
* error, which other checks report.
|
|
14
|
+
*
|
|
15
|
+
* @input The bundled templates, through template discovery
|
|
16
|
+
* @output Each definition templates use, with its template count, most used
|
|
17
|
+
* first; and the ones a set's `map` leaves out. The one-line summary is in
|
|
18
|
+
* foundation/text/template-meanings-line.mjs
|
|
19
|
+
* @position packages/cli/foundation/discovery — read by the icon authoring
|
|
20
|
+
* receipts, `experimental icon --definitions`, and `integration check`
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import {discoverCoreTemplates} from './template-adapter.mjs';
|
|
24
|
+
import {astryxDefinitionsByName} from './icon-definition-discovery.mjs';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* One icon definition templates use.
|
|
28
|
+
* @typedef {object} TemplateMeaning
|
|
29
|
+
* @property {string} definition the definition's name
|
|
30
|
+
* @property {number} templates how many bundled templates use it
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/** @type {Promise<TemplateMeaning[]> | null} */
|
|
34
|
+
let cached = null;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Count the definitions some templates declare in `icons`, most used first,
|
|
38
|
+
* then by name.
|
|
39
|
+
* @param {Array<{icons?: Record<string, unknown>}>} templates
|
|
40
|
+
* @param {Set<string> | Map<string, unknown>} known the definitions that count
|
|
41
|
+
* @returns {TemplateMeaning[]}
|
|
42
|
+
*/
|
|
43
|
+
export function countTemplateMeanings(templates, known) {
|
|
44
|
+
/** @type {Map<string, number>} */
|
|
45
|
+
const counts = new Map();
|
|
46
|
+
for (const template of templates) {
|
|
47
|
+
const icons = template.icons;
|
|
48
|
+
if (icons == null || typeof icons !== 'object') continue;
|
|
49
|
+
const used = new Set(
|
|
50
|
+
Object.values(icons).filter(
|
|
51
|
+
/** @returns {value is string} */
|
|
52
|
+
value => typeof value === 'string' && known.has(value),
|
|
53
|
+
),
|
|
54
|
+
);
|
|
55
|
+
for (const definition of used) {
|
|
56
|
+
counts.set(definition, (counts.get(definition) ?? 0) + 1);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return [...counts]
|
|
60
|
+
.map(([definition, templates]) => ({definition, templates}))
|
|
61
|
+
.sort(
|
|
62
|
+
(a, b) =>
|
|
63
|
+
b.templates - a.templates ||
|
|
64
|
+
(a.definition < b.definition
|
|
65
|
+
? -1
|
|
66
|
+
: a.definition > b.definition
|
|
67
|
+
? 1
|
|
68
|
+
: 0),
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Every Astryx icon definition the bundled templates use, with how many
|
|
74
|
+
* templates use it, most used first. Read once per process.
|
|
75
|
+
* @returns {Promise<TemplateMeaning[]>}
|
|
76
|
+
*/
|
|
77
|
+
export function templateIconMeanings() {
|
|
78
|
+
cached ??= discoverCoreTemplates().then(templates =>
|
|
79
|
+
countTemplateMeanings(templates, astryxDefinitionsByName()),
|
|
80
|
+
);
|
|
81
|
+
return cached;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The template meanings a set's `map` does not name, most used first.
|
|
86
|
+
* @param {TemplateMeaning[]} meanings
|
|
87
|
+
* @param {Record<string, string> | undefined} map
|
|
88
|
+
* @returns {TemplateMeaning[]}
|
|
89
|
+
*/
|
|
90
|
+
export function unmappedTemplateMeanings(meanings, map) {
|
|
91
|
+
const mapped = map ?? {};
|
|
92
|
+
return meanings.filter(
|
|
93
|
+
each => !Object.prototype.hasOwnProperty.call(mapped, each.definition),
|
|
94
|
+
);
|
|
95
|
+
}
|
|
@@ -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
|
|
|
@@ -110,6 +110,17 @@ export function allErrorCodes(): string[];
|
|
|
110
110
|
* | 'ERR_RENDER_FAILED'
|
|
111
111
|
* | 'ERR_RENDER_NOT_ASTRYX'
|
|
112
112
|
* | 'ERR_RENDER_SOURCE_DAMAGED'
|
|
113
|
+
* | 'ERR_THEME_BAD_VALUE'
|
|
114
|
+
* | 'ERR_THEME_NO_MODE'
|
|
115
|
+
* | 'ERR_THEME_UNKNOWN_PART'
|
|
116
|
+
* | 'ERR_THEME_UNKNOWN_VARIANT'
|
|
117
|
+
* | 'ERR_THEME_UNKNOWN_STATE'
|
|
118
|
+
* | 'ERR_THEME_PRIVATE_TOKEN'
|
|
119
|
+
* | 'ERR_THEME_UNKNOWN_TOKEN'
|
|
120
|
+
* | 'ERR_THEME_NO_EFFECT'
|
|
121
|
+
* | 'ERR_THEME_UNKNOWN_THING'
|
|
122
|
+
* | 'ERR_THEME_NOT_SET'
|
|
123
|
+
* | 'ERR_THEME_NOTHING_TO_UNDO'
|
|
113
124
|
* )} ErrorCode
|
|
114
125
|
*/
|
|
115
126
|
/**
|
|
@@ -120,4 +131,4 @@ export const ERROR_CODES: Readonly<Record<ErrorCode, ErrorCode>>;
|
|
|
120
131
|
/**
|
|
121
132
|
* Stable error-code string union. Append-only.
|
|
122
133
|
*/
|
|
123
|
-
export type ErrorCode = ("ERR_UNKNOWN" | "ERR_UNKNOWN_COMMAND" | "ERR_UNKNOWN_SUBCOMMAND" | "ERR_INVALID_OPTION" | "ERR_INVALID_ARGUMENT" | "ERR_MISSING_ARGUMENT" | "ERR_INVALID_LANG" | "ERR_INVALID_DETAIL" | "ERR_NODE_VERSION" | "ERR_CORE_NOT_FOUND" | "ERR_CORE_INCOMPATIBLE" | "ERR_UNKNOWN_COMPONENT" | "ERR_UNKNOWN_HOOK" | "ERR_UNKNOWN_TOPIC" | "ERR_UNKNOWN_SECTION" | "ERR_UNKNOWN_CATEGORY" | "ERR_UNKNOWN_TEMPLATE" | "ERR_AMBIGUOUS_TEMPLATE" | "ERR_AMBIGUOUS_COMPONENT" | "ERR_AMBIGUOUS_THEME" | "ERR_UNKNOWN_THEME" | "ERR_INTEGRATION_ROOT_CONFLICT" | "ERR_INTEGRATION_EXPORT_CONFLICT" | "ERR_UNKNOWN_PACKAGE" | "ERR_UNKNOWN_AGENT" | "ERR_UNKNOWN_FEATURE" | "ERR_UNKNOWN_CODEMOD" | "ERR_CODEMOD_FAILED" | "ERR_CODEMOD_PROTECTED" | "ERR_CODEMOD_PROTECTION_SOURCE" | "ERR_NOT_FOUND" | "ERR_NO_DOC" | "ERR_NO_SHOWCASE" | "ERR_NO_SOURCE" | "ERR_INVALID_DOC" | "ERR_FILE_NOT_FOUND" | "ERR_FILE_EXISTS" | "ERR_PATH_TRAVERSAL" | "ERR_WRITE_FAILED" | "ERR_THEME_INVALID" | "ERR_THEME_LOAD" | "ERR_PALETTE_GENERATION" | "ERR_VERSION_DETECT" | "ERR_INVALID_VERSION" | "ERR_DEP_MISSING" | "ERR_GH_CLI" | "ERR_UNKNOWN_POST" | "ERR_FETCH_FAILED" | "ERR_LAYOUT_PARSE" | "ERR_LAYOUT_INVALID" | "ERR_UNCLASSIFIED_EXIT" | "ERR_SIGNAL_TERMINATED" | "ERR_VERSIONS_UNAVAILABLE" | "ERR_PROJECT_REQUIRED" | "ERR_RENDER_COMPILE" | "ERR_RENDER_NO_DEFAULT_EXPORT" | "ERR_RENDER_MISSING_DEPENDENCY" | "ERR_RENDER_BROWSER_API" | "ERR_RENDER_ASSET_TOO_LARGE" | "ERR_RENDER_TIMEOUT" | "ERR_RENDER_FAILED" | "ERR_RENDER_NOT_ASTRYX" | "ERR_RENDER_SOURCE_DAMAGED");
|
|
134
|
+
export type ErrorCode = ("ERR_UNKNOWN" | "ERR_UNKNOWN_COMMAND" | "ERR_UNKNOWN_SUBCOMMAND" | "ERR_INVALID_OPTION" | "ERR_INVALID_ARGUMENT" | "ERR_MISSING_ARGUMENT" | "ERR_INVALID_LANG" | "ERR_INVALID_DETAIL" | "ERR_NODE_VERSION" | "ERR_CORE_NOT_FOUND" | "ERR_CORE_INCOMPATIBLE" | "ERR_UNKNOWN_COMPONENT" | "ERR_UNKNOWN_HOOK" | "ERR_UNKNOWN_TOPIC" | "ERR_UNKNOWN_SECTION" | "ERR_UNKNOWN_CATEGORY" | "ERR_UNKNOWN_TEMPLATE" | "ERR_AMBIGUOUS_TEMPLATE" | "ERR_AMBIGUOUS_COMPONENT" | "ERR_AMBIGUOUS_THEME" | "ERR_UNKNOWN_THEME" | "ERR_INTEGRATION_ROOT_CONFLICT" | "ERR_INTEGRATION_EXPORT_CONFLICT" | "ERR_UNKNOWN_PACKAGE" | "ERR_UNKNOWN_AGENT" | "ERR_UNKNOWN_FEATURE" | "ERR_UNKNOWN_CODEMOD" | "ERR_CODEMOD_FAILED" | "ERR_CODEMOD_PROTECTED" | "ERR_CODEMOD_PROTECTION_SOURCE" | "ERR_NOT_FOUND" | "ERR_NO_DOC" | "ERR_NO_SHOWCASE" | "ERR_NO_SOURCE" | "ERR_INVALID_DOC" | "ERR_FILE_NOT_FOUND" | "ERR_FILE_EXISTS" | "ERR_PATH_TRAVERSAL" | "ERR_WRITE_FAILED" | "ERR_THEME_INVALID" | "ERR_THEME_LOAD" | "ERR_PALETTE_GENERATION" | "ERR_VERSION_DETECT" | "ERR_INVALID_VERSION" | "ERR_DEP_MISSING" | "ERR_GH_CLI" | "ERR_UNKNOWN_POST" | "ERR_FETCH_FAILED" | "ERR_LAYOUT_PARSE" | "ERR_LAYOUT_INVALID" | "ERR_UNCLASSIFIED_EXIT" | "ERR_SIGNAL_TERMINATED" | "ERR_VERSIONS_UNAVAILABLE" | "ERR_PROJECT_REQUIRED" | "ERR_RENDER_COMPILE" | "ERR_RENDER_NO_DEFAULT_EXPORT" | "ERR_RENDER_MISSING_DEPENDENCY" | "ERR_RENDER_BROWSER_API" | "ERR_RENDER_ASSET_TOO_LARGE" | "ERR_RENDER_TIMEOUT" | "ERR_RENDER_FAILED" | "ERR_RENDER_NOT_ASTRYX" | "ERR_RENDER_SOURCE_DAMAGED" | "ERR_THEME_BAD_VALUE" | "ERR_THEME_NO_MODE" | "ERR_THEME_UNKNOWN_PART" | "ERR_THEME_UNKNOWN_VARIANT" | "ERR_THEME_UNKNOWN_STATE" | "ERR_THEME_PRIVATE_TOKEN" | "ERR_THEME_UNKNOWN_TOKEN" | "ERR_THEME_NO_EFFECT" | "ERR_THEME_UNKNOWN_THING" | "ERR_THEME_NOT_SET" | "ERR_THEME_NOTHING_TO_UNDO");
|
|
@@ -346,5 +346,71 @@ export const doc = {
|
|
|
346
346
|
description:
|
|
347
347
|
'`render --reverse` refused the received file, and nothing was written: its embedded source was removed (a file a render wrote, with no Astryx components left to rebuild from) or is damaged (not valid, or a file does not match its checksum), lists a path twice, carries a module, stylesheet or JSON file the page does not reach through its own imports, or an image, font or media file whose bytes are not one, or carries a file a render never embeds: a dotfile or dot-folder, anything under node_modules, a package manifest, lockfile or tool configuration, a file a test, story or benchmark runner would run, or any kind but a page module, stylesheet, JSON file or image. Raised only by the experimental render command.',
|
|
348
348
|
},
|
|
349
|
+
{
|
|
350
|
+
value: 'ERR_THEME_BAD_VALUE',
|
|
351
|
+
stability: 'experimental',
|
|
352
|
+
description:
|
|
353
|
+
'A value does not fit what it sets: not a color for a color token, not a size for a size, a step (`more`/`less`) on something that is not a dial, or a word a dial does not take. Nothing was changed. Raised only by the experimental theme command.',
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
value: 'ERR_THEME_NO_MODE',
|
|
357
|
+
stability: 'experimental',
|
|
358
|
+
description:
|
|
359
|
+
'`--mode light|dark` was given for something that cannot differ between light and dark: a size, a number, a font, or a property that is not a plain color, or a theme that has only one mode. Nothing was changed. Raised only by the experimental theme command.',
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
value: 'ERR_THEME_UNKNOWN_PART',
|
|
363
|
+
stability: 'experimental',
|
|
364
|
+
description:
|
|
365
|
+
'`--on` names something that is not a themeable part or a family. Nothing was changed. Raised only by the experimental theme command.',
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
value: 'ERR_THEME_UNKNOWN_VARIANT',
|
|
369
|
+
stability: 'experimental',
|
|
370
|
+
description:
|
|
371
|
+
'`--when` names a prop the part does not have, or a value that prop does not take. Nothing was changed. Raised only by the experimental theme command.',
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
value: 'ERR_THEME_UNKNOWN_STATE',
|
|
375
|
+
stability: 'experimental',
|
|
376
|
+
description:
|
|
377
|
+
'`--state` names a state the part does not have. Nothing was changed. Raised only by the experimental theme command.',
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
value: 'ERR_THEME_PRIVATE_TOKEN',
|
|
381
|
+
stability: 'experimental',
|
|
382
|
+
description:
|
|
383
|
+
'The setting names a variable private to a component (`--_...`), which a theme cannot set. Nothing was changed. Raised only by the experimental theme command.',
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
value: 'ERR_THEME_UNKNOWN_TOKEN',
|
|
387
|
+
stability: 'experimental',
|
|
388
|
+
description:
|
|
389
|
+
'The setting names a design token that does not exist. Nothing was changed. Raised only by the experimental theme command.',
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
value: 'ERR_THEME_NO_EFFECT',
|
|
393
|
+
stability: 'experimental',
|
|
394
|
+
description:
|
|
395
|
+
'The change could not take effect: neither the part nor any part inside it reads the token (or, for the whole theme, no part reads it). The suggestions name the token the part really reads and the property that sets it directly. Nothing was changed. Raised only by the experimental theme command.',
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
value: 'ERR_THEME_UNKNOWN_THING',
|
|
399
|
+
stability: 'experimental',
|
|
400
|
+
description:
|
|
401
|
+
'The thing to change is not a dial, a design token, or a CSS property. Nothing was changed. Raised only by the experimental theme command.',
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
value: 'ERR_THEME_NOT_SET',
|
|
405
|
+
stability: 'experimental',
|
|
406
|
+
description:
|
|
407
|
+
'`reset` names a setting the theme does not have (with those `--on`, `--when`, `--state` and `--mode`). Nothing was changed. Raised only by the experimental theme command.',
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
value: 'ERR_THEME_NOTHING_TO_UNDO',
|
|
411
|
+
stability: 'experimental',
|
|
412
|
+
description:
|
|
413
|
+
'`undo` found no earlier change to step back to. Nothing was changed. Raised only by the experimental theme command.',
|
|
414
|
+
},
|
|
349
415
|
],
|
|
350
416
|
};
|
|
@@ -99,6 +99,17 @@
|
|
|
99
99
|
* | 'ERR_RENDER_FAILED'
|
|
100
100
|
* | 'ERR_RENDER_NOT_ASTRYX'
|
|
101
101
|
* | 'ERR_RENDER_SOURCE_DAMAGED'
|
|
102
|
+
* | 'ERR_THEME_BAD_VALUE'
|
|
103
|
+
* | 'ERR_THEME_NO_MODE'
|
|
104
|
+
* | 'ERR_THEME_UNKNOWN_PART'
|
|
105
|
+
* | 'ERR_THEME_UNKNOWN_VARIANT'
|
|
106
|
+
* | 'ERR_THEME_UNKNOWN_STATE'
|
|
107
|
+
* | 'ERR_THEME_PRIVATE_TOKEN'
|
|
108
|
+
* | 'ERR_THEME_UNKNOWN_TOKEN'
|
|
109
|
+
* | 'ERR_THEME_NO_EFFECT'
|
|
110
|
+
* | 'ERR_THEME_UNKNOWN_THING'
|
|
111
|
+
* | 'ERR_THEME_NOT_SET'
|
|
112
|
+
* | 'ERR_THEME_NOTHING_TO_UNDO'
|
|
102
113
|
* )} ErrorCode
|
|
103
114
|
*/
|
|
104
115
|
|
|
@@ -315,6 +326,50 @@ export const ERROR_CODES = Object.freeze({
|
|
|
315
326
|
* was written.
|
|
316
327
|
*/
|
|
317
328
|
ERR_RENDER_SOURCE_DAMAGED: 'ERR_RENDER_SOURCE_DAMAGED',
|
|
329
|
+
/**
|
|
330
|
+
* A value does not fit what it sets: not a color for a color token, not a size for a size, a step (`more`/`less`) on something that is not a dial, or a word a dial does not take. Nothing was changed. Raised only by `experimental theme`.
|
|
331
|
+
*/
|
|
332
|
+
ERR_THEME_BAD_VALUE: 'ERR_THEME_BAD_VALUE',
|
|
333
|
+
/**
|
|
334
|
+
* `--mode light|dark` was given for something that cannot differ between light and dark: a size, a number, a font, or a property that is not a plain color, or a theme that has only one mode. Nothing was changed. Raised only by `experimental theme`.
|
|
335
|
+
*/
|
|
336
|
+
ERR_THEME_NO_MODE: 'ERR_THEME_NO_MODE',
|
|
337
|
+
/**
|
|
338
|
+
* `--on` names something that is not a themeable part or a family. Nothing was changed. Raised only by `experimental theme`.
|
|
339
|
+
*/
|
|
340
|
+
ERR_THEME_UNKNOWN_PART: 'ERR_THEME_UNKNOWN_PART',
|
|
341
|
+
/**
|
|
342
|
+
* `--when` names a prop the part does not have, or a value that prop does not take. Nothing was changed. Raised only by `experimental theme`.
|
|
343
|
+
*/
|
|
344
|
+
ERR_THEME_UNKNOWN_VARIANT: 'ERR_THEME_UNKNOWN_VARIANT',
|
|
345
|
+
/**
|
|
346
|
+
* `--state` names a state the part does not have. Nothing was changed. Raised only by `experimental theme`.
|
|
347
|
+
*/
|
|
348
|
+
ERR_THEME_UNKNOWN_STATE: 'ERR_THEME_UNKNOWN_STATE',
|
|
349
|
+
/**
|
|
350
|
+
* The setting names a variable private to a component (`--_...`), which a theme cannot set. Nothing was changed. Raised only by `experimental theme`.
|
|
351
|
+
*/
|
|
352
|
+
ERR_THEME_PRIVATE_TOKEN: 'ERR_THEME_PRIVATE_TOKEN',
|
|
353
|
+
/**
|
|
354
|
+
* The setting names a design token that does not exist. Nothing was changed. Raised only by `experimental theme`.
|
|
355
|
+
*/
|
|
356
|
+
ERR_THEME_UNKNOWN_TOKEN: 'ERR_THEME_UNKNOWN_TOKEN',
|
|
357
|
+
/**
|
|
358
|
+
* The change could not take effect: neither the part nor any part inside it reads the token (or, for the whole theme, no part reads it). The suggestions name the token the part really reads and the property that sets it directly. Nothing was changed. Raised only by `experimental theme`.
|
|
359
|
+
*/
|
|
360
|
+
ERR_THEME_NO_EFFECT: 'ERR_THEME_NO_EFFECT',
|
|
361
|
+
/**
|
|
362
|
+
* The thing to change is not a dial, a design token, or a CSS property. Nothing was changed. Raised only by `experimental theme`.
|
|
363
|
+
*/
|
|
364
|
+
ERR_THEME_UNKNOWN_THING: 'ERR_THEME_UNKNOWN_THING',
|
|
365
|
+
/**
|
|
366
|
+
* `reset` names a setting the theme does not have (with those `--on`, `--when`, `--state` and `--mode`). Nothing was changed. Raised only by `experimental theme`.
|
|
367
|
+
*/
|
|
368
|
+
ERR_THEME_NOT_SET: 'ERR_THEME_NOT_SET',
|
|
369
|
+
/**
|
|
370
|
+
* `undo` found no earlier change to step back to. Nothing was changed. Raised only by `experimental theme`.
|
|
371
|
+
*/
|
|
372
|
+
ERR_THEME_NOTHING_TO_UNDO: 'ERR_THEME_NOTHING_TO_UNDO',
|
|
318
373
|
});
|
|
319
374
|
|
|
320
375
|
/**
|
|
@@ -112,6 +112,49 @@ export const doc = {
|
|
|
112
112
|
description:
|
|
113
113
|
"One post's metadata plus the feed URL and the post's full plaintext body.",
|
|
114
114
|
},
|
|
115
|
+
// experimental theme (experimental: may change or be removed in a patch release)
|
|
116
|
+
{
|
|
117
|
+
value: 'themeEdit.new',
|
|
118
|
+
stability: 'experimental',
|
|
119
|
+
description:
|
|
120
|
+
'A theme made by `experimental theme new`: `theme`, `like` (the built-in theme it builds on, or null), the `files` written (settings, source, css, module), contrast `problems`, the `preview` page, and any `pictures` (with `pictureProblem` when none could be taken). Experimental: may change or be removed in a patch release.',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
value: 'themeEdit.set',
|
|
124
|
+
stability: 'experimental',
|
|
125
|
+
description:
|
|
126
|
+
'One checked change written: the `setting`, the one it `replaced`, `was` (for base and mode), the `parts` and `family` it styles, resolved `changedTokens`, part styles written (`styled`), part settings a dial `kept`, newly `lifted` variant keys, `notes`, contrast `problems`, build `warnings`, the `preview` page and any `pictures`. Experimental: may change or be removed in a patch release.',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
value: 'themeEdit.reset',
|
|
130
|
+
stability: 'experimental',
|
|
131
|
+
description:
|
|
132
|
+
"One setting returned to the base theme's value: the same fields as `themeEdit.set`, with `setting` naming the one removed. Experimental: may change or be removed in a patch release.",
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
value: 'themeEdit.show',
|
|
136
|
+
stability: 'experimental',
|
|
137
|
+
description:
|
|
138
|
+
'Every `settings` entry with the `parts` it styles, key `resolved` token values per mode, contrast `problems`, font `notes`, the `preview` and `sheet` pages, the `sheetComponents` count, template pages `skipped`, and any `pictures`. Experimental: may change or be removed in a patch release.',
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
value: 'themeEdit.undo',
|
|
142
|
+
stability: 'experimental',
|
|
143
|
+
description:
|
|
144
|
+
'The last change undone: what was `undone`, the `settings` count now, the `stepsLeft`, the `preview` page and any `pictures`. Experimental: may change or be removed in a patch release.',
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
value: 'themeEdit.preview',
|
|
148
|
+
stability: 'experimental',
|
|
149
|
+
description:
|
|
150
|
+
'The theme-building page: `mode` (`html`, one rendered file, or `page`, page modules written into the app), the `files` written, the `components` count, template pages `skipped`, and any `pictures`. Experimental: may change or be removed in a patch release.',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
value: 'themeEdit.explain',
|
|
154
|
+
stability: 'experimental',
|
|
155
|
+
description:
|
|
156
|
+
'An explain answer; `kind` says which: `part`, `family`, `setting`, `aspect`, `question` (answers with commands), `picture` (main colors or the color at points) or `list` (the items). Experimental: may change or be removed in a patch release.',
|
|
157
|
+
},
|
|
115
158
|
// render (experimental: may change or be removed in a patch release)
|
|
116
159
|
{
|
|
117
160
|
value: 'render.page',
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The one-line summary of the template meanings a set leaves unmapped, with
|
|
6
|
+
* the command that maps one; null when it maps them all.
|
|
7
|
+
* @param {Array<{definition: string, templates: number}>} unmapped most used
|
|
8
|
+
* first
|
|
9
|
+
* @param {string} set the set's name
|
|
10
|
+
* @param {string} [run] how to invoke the CLI (default `astryx`)
|
|
11
|
+
* @returns {string | null}
|
|
12
|
+
*/
|
|
13
|
+
export function templateMeaningsLine(unmapped: Array<{
|
|
14
|
+
definition: string;
|
|
15
|
+
templates: number;
|
|
16
|
+
}>, set: string, run?: string): string | null;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file The one-line summary of the icon definitions the bundled templates
|
|
5
|
+
* use that an icon set leaves unmapped (AST-084 FR13, FR15).
|
|
6
|
+
*
|
|
7
|
+
* @input The unmapped meanings, most used first, and the set's name
|
|
8
|
+
* @output One line, or null when the set maps them all
|
|
9
|
+
* @position packages/cli/foundation/text — read by the icon authoring
|
|
10
|
+
* receipts and the `integration check` icon-set list
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** How many unmapped meanings a one-line summary names before it stops. */
|
|
14
|
+
const SHOWN = 8;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The one-line summary of the template meanings a set leaves unmapped, with
|
|
18
|
+
* the command that maps one; null when it maps them all.
|
|
19
|
+
* @param {Array<{definition: string, templates: number}>} unmapped most used
|
|
20
|
+
* first
|
|
21
|
+
* @param {string} set the set's name
|
|
22
|
+
* @param {string} [run] how to invoke the CLI (default `astryx`)
|
|
23
|
+
* @returns {string | null}
|
|
24
|
+
*/
|
|
25
|
+
export function templateMeaningsLine(unmapped, set, run = 'astryx') {
|
|
26
|
+
if (unmapped.length === 0) return null;
|
|
27
|
+
const named = unmapped
|
|
28
|
+
.slice(0, SHOWN)
|
|
29
|
+
.map(
|
|
30
|
+
(each, index) =>
|
|
31
|
+
`${each.definition} (${each.templates}${index === 0 ? (each.templates === 1 ? ' template' : ' templates') : ''})`,
|
|
32
|
+
)
|
|
33
|
+
.join(', ');
|
|
34
|
+
const more =
|
|
35
|
+
unmapped.length > SHOWN ? `, and ${unmapped.length - SHOWN} more` : '';
|
|
36
|
+
return `Templates use ${unmapped.length} ${unmapped.length === 1 ? 'meaning' : 'meanings'} this set does not map: ${named}${more}. Map one: \`${run} experimental icon map <definition> <icon id> --set ${set}\`.`;
|
|
37
|
+
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export function checkExpression(expression: string, registry: import("./xle-ast").Registry | import("./browser").SerializedRegistry | object, opts?: {
|
|
17
17
|
blocks?: import("./browser").XLEBlock[] | undefined;
|
|
18
|
-
form?: "compact" | "
|
|
18
|
+
form?: "compact" | "outline" | "auto" | undefined;
|
|
19
19
|
loose?: boolean | undefined;
|
|
20
20
|
}): import("./browser").CheckResult;
|
|
21
21
|
/**
|
|
@@ -34,7 +34,7 @@ export function checkExpression(expression: string, registry: import("./xle-ast"
|
|
|
34
34
|
*/
|
|
35
35
|
export function expandExpression(expression: string, registry: import("./xle-ast").Registry | import("./browser").SerializedRegistry | object, opts?: {
|
|
36
36
|
blocks?: import("./browser").XLEBlock[] | undefined;
|
|
37
|
-
form?: "compact" | "
|
|
37
|
+
form?: "compact" | "outline" | "auto" | undefined;
|
|
38
38
|
loose?: boolean | undefined;
|
|
39
39
|
name?: string | undefined;
|
|
40
40
|
blockModules?: Map<string, import("./xle-ast").BlockModule> | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.14-canary.d08ce65",
|
|
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": "
|
|
128
|
+
"@astryxdesign/core": "0.7.14-canary.d08ce65"
|
|
129
129
|
},
|
|
130
130
|
"peerDependenciesMeta": {
|
|
131
131
|
"@astryxdesign/core": {
|
|
@@ -133,10 +133,10 @@
|
|
|
133
133
|
}
|
|
134
134
|
},
|
|
135
135
|
"devDependencies": {
|
|
136
|
-
"@astryxdesign/charts": "
|
|
137
|
-
"@astryxdesign/core": "
|
|
138
|
-
"@astryxdesign/lab": "
|
|
139
|
-
"@astryxdesign/theme-neutral": "
|
|
136
|
+
"@astryxdesign/charts": "0.7.14-canary.d08ce65",
|
|
137
|
+
"@astryxdesign/core": "0.7.14-canary.d08ce65",
|
|
138
|
+
"@astryxdesign/lab": "0.7.14-canary.d08ce65",
|
|
139
|
+
"@astryxdesign/theme-neutral": "0.7.14-canary.d08ce65",
|
|
140
140
|
"@heroicons/react": "^2.2.0",
|
|
141
141
|
"@stylexjs/stylex": "^0.19.1",
|
|
142
142
|
"@types/babel__core": "^7.20.5",
|