@astryxdesign/cli 0.7.4 → 0.7.5-canary.07605c2
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/_adapter.mjs +16 -1
- package/api/component/component.test.mjs +31 -0
- package/api/discover/_adapter.d.mts +1 -1
- package/api/docs/_adapter.d.mts +5 -2
- package/api/docs/_adapter.mjs +24 -16
- package/api/docs/docs.test.mjs +18 -0
- package/api/docs/integrationDocs.test.mjs +2 -2
- package/api/experimental.d.mts +5 -0
- package/api/experimental.mjs +15 -0
- package/api/hook/list/list.d.mts +1 -1
- package/api/icon/_adapter.d.mts +3 -2
- package/api/icon/_adapter.mjs +16 -3
- package/api/icon/_authoring.d.mts +5 -1
- package/api/icon/_authoring.mjs +478 -63
- package/api/icon/_options.d.mts +11 -0
- package/api/icon/_options.mjs +39 -4
- package/api/icon/_records.d.mts +19 -0
- package/api/icon/_records.mjs +25 -0
- package/api/icon/add/add.d.mts +3 -3
- package/api/icon/add/add.mjs +227 -14
- package/api/icon/all-or-nothing.test.mjs +283 -0
- package/api/icon/detail/detail.mjs +2 -13
- package/api/icon/error-codes.test.mjs +14 -7
- package/api/icon/icon.d.mts +2 -2
- package/api/icon/icon.doc.mjs +30 -2
- package/api/icon/icon.mjs +57 -8
- package/api/icon/icon.test.mjs +133 -1
- package/api/icon/icon.type.d.mts +126 -1
- package/api/icon/icon.type.mjs +67 -3
- package/api/icon/iconAdd.doc.mjs +22 -6
- package/api/icon/iconMap.doc.mjs +24 -8
- package/api/icon/iconNewDefinition.doc.mjs +2 -2
- package/api/icon/iconNewSet.doc.mjs +30 -2
- package/api/icon/iconUse.doc.mjs +4 -1
- package/api/icon/map/map.d.mts +4 -4
- package/api/icon/map/map.mjs +134 -9
- package/api/icon/new-definition/new-definition.mjs +6 -2
- package/api/icon/new-set/new-set.mjs +2 -2
- package/api/icon/new-set/new-set.test.mjs +60 -10
- package/api/icon/option-pairs.test.mjs +368 -0
- package/api/icon/search/search.d.mts +10 -0
- package/api/icon/search/search.mjs +55 -14
- package/api/icon/use/use.mjs +2 -13
- package/api/integration/add-helpers.d.mts +15 -1
- package/api/integration/add-helpers.mjs +1 -1
- package/api/integration/pack-check.lifecycle-output.test.mjs +24 -1
- package/api/integration/pack-check.mjs +10 -4
- package/api/integration/pack-check.test.mjs +5 -1
- package/api/integration/validate-integration.type.d.mts +3 -2
- package/api/integration/validate-integration.type.mjs +3 -2
- package/api/render/_adapter.d.mts +28 -0
- package/api/render/_adapter.mjs +540 -0
- package/api/render/render.d.mts +15 -0
- package/api/render/render.doc.d.mts +9 -0
- package/api/render/render.doc.mjs +112 -0
- package/api/render/render.mjs +113 -0
- package/api/render/render.test.mjs +1155 -0
- package/api/render/render.type.d.mts +74 -0
- package/api/render/render.type.mjs +64 -0
- package/api/search/_adapter.test.mjs +21 -2
- package/api/search/_result.d.mts +5 -5
- package/api/search/search.d.mts +1 -1
- package/api/template/template.mjs +3 -1
- package/api/template/template.type.d.mts +2 -1
- package/api/template/template.type.mjs +1 -1
- package/api/template/unknown-name.test.mjs +63 -0
- package/assets/codemods/transforms/v0.7.0/__tests__/validate-data-token-ownership.test.mjs +123 -70
- package/assets/codemods/transforms/v0.7.0/validate-data-token-ownership.mjs +19 -77
- package/assets/discover/official-packages.json +4 -0
- package/assets/docs/tree/icon-definitions.doc.mjs +2 -2
- package/assets/docs/tree/icon-set-files.doc.mjs +1 -1
- package/assets/docs/tree/icon-sets.doc.mjs +50 -20
- package/assets/docs/tree/render-pages.doc.mjs +94 -0
- package/assets/icons/definitions/activity.doc.mjs +1 -1
- package/assets/icons/definitions/alignCenter.doc.mjs +9 -0
- package/assets/icons/definitions/alignEnd.doc.mjs +10 -0
- package/assets/icons/definitions/alignStart.doc.mjs +10 -0
- package/assets/icons/definitions/archive.doc.mjs +1 -1
- package/assets/icons/definitions/arrowsUpDown.doc.mjs +1 -1
- package/assets/icons/definitions/attach.doc.mjs +1 -1
- package/assets/icons/definitions/audio.doc.mjs +1 -1
- package/assets/icons/definitions/cart.doc.mjs +1 -1
- package/assets/icons/definitions/checkDouble.doc.mjs +1 -1
- package/assets/icons/definitions/chevronsLeft.doc.mjs +1 -1
- package/assets/icons/definitions/chevronsRight.doc.mjs +1 -1
- package/assets/icons/definitions/close.doc.mjs +1 -1
- package/assets/icons/definitions/collapse.doc.mjs +1 -1
- package/assets/icons/definitions/compose.doc.mjs +1 -1
- package/assets/icons/definitions/conversation.doc.mjs +1 -1
- package/assets/icons/definitions/copy.doc.mjs +1 -1
- package/assets/icons/definitions/cpu.doc.mjs +9 -0
- package/assets/icons/definitions/database.doc.mjs +1 -1
- package/assets/icons/definitions/desktop.doc.mjs +1 -1
- package/assets/icons/definitions/discount.doc.mjs +1 -1
- package/assets/icons/definitions/download.doc.mjs +1 -1
- package/assets/icons/definitions/emoji.doc.mjs +1 -1
- package/assets/icons/definitions/error.doc.mjs +1 -1
- package/assets/icons/definitions/expand.doc.mjs +1 -1
- package/assets/icons/definitions/experiment.doc.mjs +1 -1
- package/assets/icons/definitions/externalLink.doc.mjs +7 -1
- package/assets/icons/definitions/eyeSlash.doc.mjs +1 -1
- package/assets/icons/definitions/flipHorizontal.doc.mjs +9 -0
- package/assets/icons/definitions/flipVertical.doc.mjs +9 -0
- package/assets/icons/definitions/folderAdd.doc.mjs +1 -1
- package/assets/icons/definitions/gitBranch.doc.mjs +9 -0
- package/assets/icons/definitions/gitFork.doc.mjs +9 -0
- package/assets/icons/definitions/info.doc.mjs +1 -1
- package/assets/icons/definitions/location.doc.mjs +1 -1
- package/assets/icons/definitions/mention.doc.mjs +1 -1
- package/assets/icons/definitions/menu.doc.mjs +1 -1
- package/assets/icons/definitions/microphone.doc.mjs +1 -1
- package/assets/icons/definitions/mobile.doc.mjs +1 -1
- package/assets/icons/definitions/money.doc.mjs +1 -1
- package/assets/icons/definitions/moreHorizontal.doc.mjs +1 -1
- package/assets/icons/definitions/notificationActive.doc.mjs +1 -1
- package/assets/icons/definitions/notificationOff.doc.mjs +1 -1
- package/assets/icons/definitions/panelLeft.doc.mjs +10 -0
- package/assets/icons/definitions/panelRight.doc.mjs +10 -0
- package/assets/icons/definitions/raiseHand.doc.mjs +1 -1
- package/assets/icons/definitions/redo.doc.mjs +1 -1
- package/assets/icons/definitions/refresh.doc.mjs +1 -1
- package/assets/icons/definitions/rotate.doc.mjs +9 -0
- package/assets/icons/definitions/scale.doc.mjs +10 -0
- package/assets/icons/definitions/search.doc.mjs +1 -1
- package/assets/icons/definitions/send.doc.mjs +1 -1
- package/assets/icons/definitions/settings.doc.mjs +1 -1
- package/assets/icons/definitions/star.doc.mjs +1 -1
- package/assets/icons/definitions/stop.doc.mjs +1 -1
- package/assets/icons/definitions/success.doc.mjs +1 -1
- package/assets/icons/definitions/textCase.doc.mjs +9 -0
- package/assets/icons/definitions/thumbsDown.doc.mjs +1 -1
- package/assets/icons/definitions/thumbsUp.doc.mjs +1 -1
- package/assets/icons/definitions/trendDown.doc.mjs +7 -1
- package/assets/icons/definitions/trendUp.doc.mjs +1 -1
- package/assets/icons/definitions/undo.doc.mjs +1 -1
- package/assets/icons/definitions/upload.doc.mjs +1 -1
- package/assets/icons/definitions/userAdd.doc.mjs +1 -1
- package/assets/icons/definitions/warning.doc.mjs +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerClear.tsx +15 -14
- package/assets/templates/blocks/components/Tokenizer/TokenizerCreatable.tsx +30 -30
- package/assets/templates/blocks/components/Tokenizer/TokenizerEndContent.tsx +15 -14
- package/assets/templates/blocks/components/Tokenizer/TokenizerIcon.tsx +15 -14
- package/assets/templates/blocks/components/Tokenizer/TokenizerMaxEntries.tsx +17 -16
- package/assets/templates/blocks/components/Tokenizer/TokenizerOverflow.tsx +29 -29
- package/assets/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx +9 -8
- package/assets/templates/blocks/components/Tokenizer/TokenizerStates.tsx +39 -41
- package/assets/templates/pages/canvas-editor/template.doc.mjs +9 -0
- package/assets/templates/pages/form-wizard-inline/template.doc.mjs +6 -1
- package/assets/templates/pages/table-comparison/template.doc.mjs +1 -0
- package/assets/templates/pages/table-tree/template.doc.mjs +3 -0
- package/authoring/debug/parse.d.mts +2 -2
- package/authoring/doctypes/icon-definition/icon-definition.doc.mjs +4 -4
- package/authoring/doctypes/icon-set/icon-set-data.doc.mjs +6 -0
- package/authoring/doctypes/icon-set/parse.d.mts +1 -0
- package/authoring/doctypes/icon-set/parse.mjs +1 -0
- package/authoring/doctypes/icon-set/type.ts +5 -0
- package/authoring/doctypes/template/template.doc.mjs +1 -1
- package/authoring/doctypes/template/type.ts +2 -1
- package/clients/cli/commands/doctor.mjs +16 -17
- package/clients/cli/commands/experimental/icon.mjs +167 -35
- package/clients/cli/commands/experimental/index.mjs +2 -0
- package/clients/cli/commands/experimental/render.mjs +113 -0
- package/clients/cli/commands/experimental-icon-add.doc.mjs +14 -4
- package/clients/cli/commands/experimental-icon-map.doc.mjs +12 -2
- package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +1 -1
- package/clients/cli/commands/experimental-icon-new-set.doc.mjs +28 -1
- package/clients/cli/commands/experimental-icon.doc.mjs +18 -2
- package/clients/cli/commands/experimental-render.doc.mjs +60 -0
- package/clients/cli/commands/experimental.doc.mjs +4 -2
- package/clients/cli/commands/icon-authoring.test.mjs +1823 -13
- package/clients/cli/commands/icon-options-wiring.test.mjs +158 -0
- package/clients/cli/commands/icon.test.mjs +1 -1
- package/clients/cli/commands/template.mjs +4 -1
- package/clients/cli/commands/text-json-parity.test.mjs +46 -0
- package/clients/cli/index.mjs +1 -0
- package/foundation/discovery/component-discovery.d.mts +2 -1
- package/foundation/discovery/component-discovery.export-names.test.mjs +41 -0
- package/foundation/discovery/component-discovery.mjs +13 -7
- package/foundation/discovery/icon-set-checks.d.mts +43 -9
- package/foundation/discovery/icon-set-checks.mjs +296 -21
- package/foundation/discovery/icon-set-checks.test.mjs +125 -12
- package/foundation/discovery/icon-set-writer.d.mts +192 -3
- package/foundation/discovery/icon-set-writer.mjs +608 -34
- package/foundation/discovery/icon-set-writer.test.mjs +26 -0
- package/foundation/discovery/module-exports.mjs +82 -25
- package/foundation/discovery/module-exports.test.mjs +38 -1
- package/foundation/discovery/package-exports.d.mts +13 -0
- package/foundation/discovery/package-exports.mjs +40 -1
- package/foundation/discovery/template-icons.d.mts +6 -0
- package/foundation/discovery/template-icons.mjs +98 -10
- package/foundation/discovery/template-icons.test.mjs +103 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +20 -5
- package/foundation/doc-compiler/import.mjs +81 -8
- package/foundation/doc-compiler/read.d.mts +4 -3
- package/foundation/doc-compiler/read.mjs +15 -10
- package/foundation/doc-compiler/read.test.mjs +59 -1
- package/foundation/doc-compiler/tree.mjs +3 -1
- package/foundation/fs/module-loader.d.mts +3 -2
- package/foundation/fs/module-loader.mjs +3 -2
- package/foundation/fs/publish-file-eperm-mutation.test.mjs +2 -0
- package/foundation/fs/read-record.d.mts +27 -0
- package/foundation/fs/read-record.mjs +83 -15
- package/foundation/fs/read-record.test.mjs +88 -1
- package/foundation/render/assets.d.mts +31 -0
- package/foundation/render/assets.mjs +102 -0
- package/foundation/render/component-map.d.mts +52 -0
- package/foundation/render/component-map.mjs +141 -0
- package/foundation/render/css-cut.d.mts +29 -0
- package/foundation/render/css-cut.mjs +144 -0
- package/foundation/render/embedded-files.d.mts +28 -0
- package/foundation/render/embedded-files.mjs +108 -0
- package/foundation/render/embedded-imports.d.mts +61 -0
- package/foundation/render/embedded-imports.mjs +315 -0
- package/foundation/render/html-reader.d.mts +37 -0
- package/foundation/render/html-reader.mjs +121 -0
- package/foundation/render/page-worker.d.mts +7 -0
- package/foundation/render/page-worker.mjs +519 -0
- package/foundation/render/rebuild.d.mts +19 -0
- package/foundation/render/rebuild.mjs +269 -0
- package/foundation/render/render-page.d.mts +85 -0
- package/foundation/render/render-page.mjs +612 -0
- package/foundation/render/render.test.mjs +117 -0
- package/foundation/render/source-block.d.mts +52 -0
- package/foundation/render/source-block.mjs +106 -0
- package/foundation/response/error-codes.d.mts +10 -1
- package/foundation/response/error-codes.doc.mjs +56 -0
- package/foundation/response/error-codes.mjs +61 -0
- package/foundation/response/response-types.doc.mjs +38 -1
- package/foundation/text/string-utils.mjs +33 -0
- package/foundation/text/string-utils.test.mjs +17 -0
- package/foundation/text/suggest-order.d.mts +17 -3
- package/foundation/text/suggest-order.mjs +58 -13
- package/foundation/text/suggest-order.test.mjs +53 -0
- package/package.json +14 -9
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @file
|
|
4
|
+
* @file Reject stale generated theme CSS that still owns data-token defaults.
|
|
5
5
|
*
|
|
6
|
-
* @input
|
|
7
|
-
* @output No rewritten source;
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* @input Generated theme CSS
|
|
7
|
+
* @output No rewritten source; an upgrade error for a generated theme
|
|
8
|
+
* stylesheet that still declares data-color defaults at `:root`
|
|
9
|
+
* @position Next-release upgrade validation for spec:AST-066 FR19
|
|
10
|
+
*
|
|
11
|
+
* Raw `var(--color-data-*)` uses are not checked: prebuilt
|
|
12
|
+
* `@astryxdesign/core/astryx.css` and the `@astryxdesign/build` PostCSS
|
|
13
|
+
* integration define all 56 defaults, and other source builds read data
|
|
14
|
+
* colors through `dataVars` (spec:AST-066 FR3/FR4).
|
|
11
15
|
*/
|
|
12
16
|
|
|
13
17
|
import * as path from 'node:path';
|
|
@@ -15,87 +19,25 @@ import * as path from 'node:path';
|
|
|
15
19
|
export const meta = {
|
|
16
20
|
title: 'Validate data-token ownership',
|
|
17
21
|
description:
|
|
18
|
-
'Reports
|
|
19
|
-
fileExtensions: ['.
|
|
22
|
+
'Reports generated theme CSS that still emits the canonical data-color defaults at :root, so it can be rebuilt with `astryx theme build`.',
|
|
23
|
+
fileExtensions: ['.css'],
|
|
20
24
|
};
|
|
21
25
|
|
|
22
|
-
// A use without a fallback; `var(--color-data-x, <fallback>)` stays valid.
|
|
23
|
-
const DIRECT_DATA_VAR = /var\(\s*(--color-data-[a-z0-9-]+)\s*\)/u;
|
|
24
|
-
const CSS_COMMENT = /\/\*[\s\S]*?\*\//gu;
|
|
25
26
|
const GENERATED_THEME_HEADER = '@generated by `astryx theme build`';
|
|
26
27
|
const ROOT_DATA_DECLARATION = /:root\s*\{[^}]*--color-data-/su;
|
|
27
28
|
|
|
28
|
-
/** @param {any} node */
|
|
29
|
-
function staticString(node) {
|
|
30
|
-
if (
|
|
31
|
-
(node?.type === 'StringLiteral' || node?.type === 'Literal') &&
|
|
32
|
-
typeof node.value === 'string'
|
|
33
|
-
) {
|
|
34
|
-
return node.value;
|
|
35
|
-
}
|
|
36
|
-
if (node?.type === 'TemplateLiteral') {
|
|
37
|
-
// Each static chunk of the template; a use can sit between expressions.
|
|
38
|
-
return (node.quasis ?? [])
|
|
39
|
-
.map((/** @type {any} */ q) => q?.value?.cooked ?? q?.value?.raw ?? '')
|
|
40
|
-
.join('\u0000');
|
|
41
|
-
}
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
29
|
/**
|
|
46
30
|
* @param {import('../../../../authoring/codemod/type').AstryxCodemodFile} file
|
|
47
|
-
* @param {import('../../../../authoring/codemod/type').CodemodTransformApi} api
|
|
48
31
|
* @returns {undefined}
|
|
49
32
|
*/
|
|
50
|
-
export default function validateDataTokenOwnership(file
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
ROOT_DATA_DECLARATION.test(file.source)
|
|
57
|
-
) {
|
|
58
|
-
throw new Error(
|
|
59
|
-
'This generated theme CSS still emits canonical data defaults at :root. Rebuild it with `astryx theme build`; defaults come from source-compiled dataVars consumers or @astryxdesign/core/astryx.css in prebuilt mode.',
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
const uncommented = file.source.replace(CSS_COMMENT, comment =>
|
|
63
|
-
comment.replace(/[^\n]/gu, ' '),
|
|
64
|
-
);
|
|
65
|
-
const cssMatch = DIRECT_DATA_VAR.exec(uncommented);
|
|
66
|
-
if (cssMatch) {
|
|
67
|
-
const line = uncommented.slice(0, cssMatch.index).split('\n').length;
|
|
68
|
-
throw new Error(
|
|
69
|
-
`Raw var(${cssMatch[1]}) without a fallback at line ${line} needs an availability check: load @astryxdesign/core/astryx.css in prebuilt mode, ensure a source-compiled dataVars consumer retains the group, or add an explicit fallback. CSS-capable code imports dataVars from @astryxdesign/core/theme/dataTokens.stylex.`,
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
return undefined;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const j = api.jscodeshift;
|
|
76
|
-
const root = j(file.source);
|
|
77
|
-
/** @type {{token: string, line: number|null}|null} */
|
|
78
|
-
let found = null;
|
|
79
|
-
const inspect = (/** @type {any} */ node) => {
|
|
80
|
-
if (found) return;
|
|
81
|
-
const value = staticString(node);
|
|
82
|
-
const match =
|
|
83
|
-
typeof value === 'string' ? value.match(DIRECT_DATA_VAR) : null;
|
|
84
|
-
if (match) {
|
|
85
|
-
found = {token: match[1], line: node.loc?.start?.line ?? null};
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
/** @param {any} nodePath */
|
|
90
|
-
const inspectPath = nodePath => inspect(nodePath.node);
|
|
91
|
-
root.find(j.StringLiteral).forEach(inspectPath);
|
|
92
|
-
root.find(j.Literal).forEach(inspectPath);
|
|
93
|
-
root.find(j.TemplateLiteral).forEach(inspectPath);
|
|
94
|
-
|
|
95
|
-
if (found) {
|
|
96
|
-
const {token, line} = found;
|
|
33
|
+
export default function validateDataTokenOwnership(file) {
|
|
34
|
+
if (
|
|
35
|
+
path.extname(file.path) === '.css' &&
|
|
36
|
+
file.source.includes(GENERATED_THEME_HEADER) &&
|
|
37
|
+
ROOT_DATA_DECLARATION.test(file.source)
|
|
38
|
+
) {
|
|
97
39
|
throw new Error(
|
|
98
|
-
|
|
40
|
+
'This generated theme CSS still emits canonical data defaults at :root. Rebuild it with `astryx theme build`; defaults come from @astryxdesign/core/astryx.css in prebuilt mode, and in a source build from the @astryxdesign/build PostCSS integration or dataVars imports.',
|
|
99
41
|
);
|
|
100
42
|
}
|
|
101
43
|
return undefined;
|
|
@@ -18,7 +18,7 @@ export const docs = {
|
|
|
18
18
|
stability: 'experimental',
|
|
19
19
|
title: 'Icon definitions',
|
|
20
20
|
summary:
|
|
21
|
-
'
|
|
21
|
+
'Every icon definition: what an icon stands for, and the shared name icon sets map their icons to.',
|
|
22
22
|
keywords: [
|
|
23
23
|
'icon definition',
|
|
24
24
|
'icon definitions',
|
|
@@ -42,7 +42,7 @@ export const docs = {
|
|
|
42
42
|
blocks: [
|
|
43
43
|
{
|
|
44
44
|
type: 'prose',
|
|
45
|
-
text: "An icon definition is one thing an icon stands for, such as `close` or `delete`. Every icon set registers its icons against definitions in its data file's `map`, and templates are written against definitions, so a project that switches icon sets gets the same definition from the new set. Built-in definitions are the shared names Core renders; every set maps them. A set may add its own definitions; in a project that sets `experimental.iconSet`, they are listed here with the package that ships them. `astryx experimental icon <definition>` finds the icon each installed set draws for it. Icon definitions are experimental: they may change or be removed in a patch release.",
|
|
45
|
+
text: "An icon definition is one thing an icon stands for, such as `close` or `delete`. Every icon set registers its icons against definitions in its data file's `map`, and templates are written against definitions, so a project that switches icon sets gets the same definition from the new set. Built-in definitions, marked [built-in], are the shared names Core renders (the semantic icon names in `astryx docs icons`); every set maps them, and `integration check` fails until it does. The others are optional: map each one your library draws. `map` keys a definition by its camelCase name, shown after the id (`eyeSlash`); `experimental icon map` and `--pairs` take either spelling. A set may add its own definitions; in a project that sets `experimental.iconSet`, they are listed here with the package that ships them. `astryx experimental icon <definition>` finds the icon each installed set draws for it. Icon definitions are experimental: they may change or be removed in a patch release.",
|
|
46
46
|
},
|
|
47
47
|
],
|
|
48
48
|
};
|
|
@@ -28,6 +28,6 @@ export const docs = {
|
|
|
28
28
|
'IconDefinitionDoc',
|
|
29
29
|
],
|
|
30
30
|
description:
|
|
31
|
-
'
|
|
31
|
+
'Every field of the files an icon set is made of: the descriptor, the data file, and an icon definition.',
|
|
32
32
|
sections: await buildExperimentalAuthoringSections(),
|
|
33
33
|
};
|
|
@@ -24,7 +24,7 @@ export const docs = {
|
|
|
24
24
|
'integration icons',
|
|
25
25
|
],
|
|
26
26
|
description:
|
|
27
|
-
'
|
|
27
|
+
'Ship an icon set: register each icon against an icon definition, so apps find icons by meaning and templates use your icons.',
|
|
28
28
|
sections: [
|
|
29
29
|
{
|
|
30
30
|
id: 'experimental',
|
|
@@ -42,7 +42,7 @@ export const docs = {
|
|
|
42
42
|
content: [
|
|
43
43
|
{
|
|
44
44
|
type: 'prose',
|
|
45
|
-
text: 'Astryx keeps a list of icon definitions: one file per meaning, like `close` or `delete` (`astryx docs cli/experimental/icon-definitions`). An icon set registers which of its icons draws each definition, in the `map` of its data file. Templates say which definition each of their icons draws, so a project that uses your set gets your icon for every definition you map. Every set maps the built-in definitions, the names Core renders itself.',
|
|
45
|
+
text: 'Astryx keeps a list of icon definitions: one file per meaning, like `close` or `delete` (`astryx docs cli/experimental/icon-definitions`). An icon set registers which of its icons draws each definition, in the `map` of its data file; one icon may draw several definitions (`file` and `document` can both be your `document` icon). Templates say which definition each of their icons draws, so a project that uses your set gets your icon for every definition you map. Every set maps the built-in definitions, the names Core renders itself.',
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
type: 'prose',
|
|
@@ -61,7 +61,11 @@ export const docs = {
|
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
type: 'prose',
|
|
64
|
-
text: "`outline.doc.mjs` is the descriptor: name, display name
|
|
64
|
+
text: "`outline.doc.mjs` is the descriptor: name, display name and description (`--display-name`, `--description`), and `license`, the SPDX license of the artwork (it starts as your package's own). `outline.icons.json` starts with no icons and an empty `map`; its `module` is your package name. `outline.generated.js` is the set's generated module, with its declaration file `outline.generated.d.ts`: the CLI writes both, and every icon and the theme map are exports of it. Every field is in {@link schema:icon-set-doc} and {@link schema:icon-set-data}.",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: 'prose',
|
|
68
|
+
text: "The set's icons import from your package by name, so your package's entry must re-export the generated module. The command writes only the set's own files: your entry, `exports`, `main`, `types`, `files`, peers, and scripts are yours, and the receipt names each change to make as text to copy. For an entry file in the package (and the declaration file package.json names) that is the line `export * from './icon-sets/outline/outline.generated.js';`, relative to it; for a package with no entry, `index.js` and `index.d.ts` with that line and the package.json `main`, `types`, and `exports` that name them; for a built or CommonJS entry, the line to add to the source it is built from. `integration check` names the same change until you make it, and the receipt also names the peers and the `typecheck` script to add. `integration check --strict` type-checks the set's doc files with your package's TypeScript; the receipt says when it is missing (`npm install -D typescript@6`).",
|
|
65
69
|
},
|
|
66
70
|
],
|
|
67
71
|
},
|
|
@@ -71,7 +75,7 @@ export const docs = {
|
|
|
71
75
|
content: [
|
|
72
76
|
{
|
|
73
77
|
type: 'prose',
|
|
74
|
-
text: 'Pick an icon from the library and ask which definitions fit it. Nothing is written yet:',
|
|
78
|
+
text: 'Pick an icon from the library and ask which definitions fit it. Nothing is written yet. To read every icon a set already has, one line each with its words and the definitions it draws, run `astryx experimental icon --set <set> --all-icons`; `astryx experimental icon <set>/<id>` reads one, or says the id does not exist:',
|
|
75
79
|
},
|
|
76
80
|
{
|
|
77
81
|
type: 'code',
|
|
@@ -98,11 +102,11 @@ export const docs = {
|
|
|
98
102
|
{
|
|
99
103
|
type: 'code',
|
|
100
104
|
lang: 'bash',
|
|
101
|
-
code: "astryx experimental icon add
|
|
105
|
+
code: "astryx experimental icon add Dice5 --from @acme/glyph-library --new-definition random --description 'Pick something at random.' --words dice,shuffle,chance",
|
|
102
106
|
},
|
|
103
107
|
{
|
|
104
108
|
type: 'prose',
|
|
105
|
-
text: '`experimental icon map <definition> <icon>` points a definition at an icon the set already has, and `--remove` drops an entry. `experimental icon new-definition <name> --description ... --words ... --icon <id>` adds your own definition for an icon you already have.',
|
|
109
|
+
text: '`experimental icon map <definition> <icon>` points a definition at an icon the set already has (a definition is named in camelCase, `eyeSlash`, or by the kebab id the definitions list shows, `eye-slash`; an icon by its id, its export name in any case, or another name its library exports it as, such as `trash-2`, never by one word of its id), `experimental icon map --pairs close=x-mark,search=magnifying-glass` writes many entries at once (checked together, all or none; an entry the map already has is replaced, and the receipt shows what it was), and `--remove` drops an entry. `experimental icon new-definition <name> --description ... --words ... --icon <id>` adds your own definition for an icon you already have. `experimental icon --definitions` lists every Astryx definition, built in or not, with its words (`--json` for a script).',
|
|
106
110
|
},
|
|
107
111
|
],
|
|
108
112
|
},
|
|
@@ -117,11 +121,29 @@ export const docs = {
|
|
|
117
121
|
},
|
|
118
122
|
{
|
|
119
123
|
type: 'prose',
|
|
120
|
-
text: "Every component the library exports becomes an icon (an alias of one component is recorded once), named `<Name>Icon`,
|
|
124
|
+
text: "Every component the library exports becomes an icon (an alias of one component is recorded once), named `<Name>Icon`, with an id from its name (`Squares2X2Icon` is `squares-2x2`: a dimension stays one word). `map` is filled only where a definition's name is an icon's id (`delete` → icon `delete`), and the receipt lists those entries under Mapped by name: a library can draw another meaning under the same name (one library's `delete` is a backspace key), so check each. An icon whose id is only one of a definition's words (`trash` for `delete`) may mean something else in this library, so the receipt lists it under Suggestions, with the `experimental icon map <definition> <icon>` command for each, and writes nothing for it: check the meaning, then run the ones that fit. Run it again after a library release to refresh the icons that library supplies; `map` entries whose icon still exists are kept, and the receipt names any icon the library dropped, any icon `--exclude` left out, and the `map` entries each took with it. Icons you added from your own files or another library are left as they are. An icon you already have is known by the library export it re-exports, so it keeps its export name exactly, its `map` entries, variants, and words, even when a newer CLI spells its id differently or your `--exclude` lets a library prefix come off new ids; the receipt lists each changed id under `renamed`. A refresh with `--dry-run` writes nothing and prints the Mapped by name and Suggestions lists again; `--display-name` and `--description` on a refresh rewrite the descriptor. Variants added with `add --variant … --all` are kept too; run that `add` again to pick up icons the release added. `experimental icon --list` shows how many definitions the set maps.",
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
type: 'prose',
|
|
128
|
+
text: "With a package or package subpath, it also records the installed library and version as the data file's `source`, so `integration check` warns when your dependency moves to another version; copies the library's LICENSE (and NOTICE) files into the set directory; and sets the descriptor's `license` to the library's. A set you started without `--from` gets the same the first time a refresh records its source, unless you already changed `license`: a `license` you set is kept (the receipt names the library's), and every later refresh keeps it too. Your package.json `license` is never changed. Edit `license` when the artwork's license differs from the library's package license.",
|
|
121
129
|
},
|
|
122
130
|
{
|
|
123
131
|
type: 'prose',
|
|
124
|
-
text: 'A library
|
|
132
|
+
text: 'A library with a module per style supplies variants. Declare them when you create the set, then add a variant for every icon in one run:',
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
type: 'code',
|
|
136
|
+
lang: 'bash',
|
|
137
|
+
code: `astryx experimental icon new-set heroicons --from @heroicons/react/24/outline --variants outline,solid --default-variant outline --description 'Heroicons, outline and solid.'
|
|
138
|
+
astryx experimental icon add --variant solid --from @heroicons/react/24/solid --all`,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
type: 'prose',
|
|
142
|
+
text: "A library that redraws its artwork for small sizes (Heroicons' 20px mini and 16px micro) ships each of those as its own set in its own package (their export names match the 24px ones), not as variants: a variant's size comes from CSS. `--variants` lists the variants; `--default-variant` names the one each icon's own export draws (the first variant when omitted). `--all` adds the variant for every icon whose id an export of `--from` has (`TrashIcon` in the solid module becomes `TrashSolidIcon`, the solid variant of `trash`), and the receipt lists the icons the module has no export for. Running it again changes nothing.",
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
type: 'prose',
|
|
146
|
+
text: 'A library whose icons are data (objects or SVG strings) has no components to find: create the set, declare an `adapter` in its data file (see library shapes), and run the command again; every data export then becomes an icon through the adapter. When every icon export shares a leading word, such as `feather` in `featherEye` and `featherSun`, ids and export names leave it out: `featherEye` becomes id `eye`, exported as `EyeIcon`. The prefix is read over icon-like exports only: SCREAMING_CASE constants (`README`, `VERSION`), number and boolean exports, and, next to components or icon objects, plain strings are never icons. Components named `…Provider` or `…Context` are never icons either. Leave out any other export that is not an icon with `--exclude meta,version`: the data file keeps the list in `exclude`, so a refresh leaves them out too. When a library exports one icon under several names (`Trash2` and `Trash`), the icon is recorded once and its other names become words, so `experimental icon trash-2` finds it and `experimental icon map delete trash-2` maps it. `experimental icon add` reads the prefix the same way, and reuses the icon an export already has, so its commands need no `--id`.',
|
|
125
147
|
},
|
|
126
148
|
],
|
|
127
149
|
},
|
|
@@ -146,7 +168,7 @@ export const docs = {
|
|
|
146
168
|
},
|
|
147
169
|
{
|
|
148
170
|
type: 'prose',
|
|
149
|
-
text: "`experimental icon add` writes the set's generated module (`generated` in the data file) and its declaration file, which re-exports each component's own types and types each adapted icon as `ComponentType<SVGProps<SVGSVGElement>>`. Add
|
|
171
|
+
text: "`experimental icon add` writes the set's generated module (`generated` in the data file) and its declaration file, which re-exports each component's own types and types each adapted icon as `ComponentType<SVGProps<SVGSVGElement>>`. Add this line to your package's entry and its types; `experimental icon new-set` names the exact line and file in its receipt (see add an icon set):",
|
|
150
172
|
},
|
|
151
173
|
{
|
|
152
174
|
type: 'code',
|
|
@@ -155,7 +177,7 @@ export const docs = {
|
|
|
155
177
|
},
|
|
156
178
|
{
|
|
157
179
|
type: 'prose',
|
|
158
|
-
text:
|
|
180
|
+
text: "An optional render test you can copy. Save it inside your package directory and run it there, since it imports your package by name through its `exports`, and install `react-dom` first (`npm install -D react-dom`). A library may add its own classes beside yours, so it checks the class list. A library that sets `width` and `height` attributes (24, say) still fills its box: CSS sizing, such as the `Icon` component's, overrides SVG size attributes.",
|
|
159
181
|
},
|
|
160
182
|
{
|
|
161
183
|
type: 'code',
|
|
@@ -167,7 +189,7 @@ import * as icons from '@acme/icons';
|
|
|
167
189
|
for (const [name, Icon] of Object.entries(icons)) {
|
|
168
190
|
if (!name.endsWith('Icon')) continue;
|
|
169
191
|
const html = renderToStaticMarkup(createElement(Icon, {className: 'x'}));
|
|
170
|
-
if (
|
|
192
|
+
if (!/class="([^"]* )?x( [^"]*)?"/.test(html)) throw new Error(\`\${name} drops className\`);
|
|
171
193
|
if (!html.includes('currentColor')) throw new Error(\`\${name} has a fixed color\`);
|
|
172
194
|
}`,
|
|
173
195
|
},
|
|
@@ -191,7 +213,7 @@ for (const [name, Icon] of Object.entries(icons)) {
|
|
|
191
213
|
],
|
|
192
214
|
[
|
|
193
215
|
'A subpath per style',
|
|
194
|
-
'`experimental icon add Bin --from @acme/glyph-library/solid --id bin --variant solid`
|
|
216
|
+
'`experimental icon add --variant solid --from @acme/glyph-library/solid --all` for every icon at once, or `experimental icon add Bin --from @acme/glyph-library/solid --id bin --variant solid` for one (the set must declare the variant: `new-set --variants`)',
|
|
195
217
|
],
|
|
196
218
|
[
|
|
197
219
|
'One file per icon, default export',
|
|
@@ -207,7 +229,7 @@ for (const [name, Icon] of Object.entries(icons)) {
|
|
|
207
229
|
],
|
|
208
230
|
[
|
|
209
231
|
'Your own component files',
|
|
210
|
-
|
|
232
|
+
"`experimental icon add Rocket --from ./src/icons/rocket.js --definition rocket`, and `--id rocket --variant solid` for its other looks. The file exports a component named as written (no library prefix is taken off), with a declaration file beside it (`rocket.d.ts`) or written in TypeScript, since the set's types re-export its own; when package.json lists `files` and none covers it, the receipt names the `files` array that publishes its folder.",
|
|
211
233
|
],
|
|
212
234
|
],
|
|
213
235
|
},
|
|
@@ -258,7 +280,7 @@ export const brand = defineTheme({name: 'brand', icons: themeIcons});`,
|
|
|
258
280
|
content: [
|
|
259
281
|
{
|
|
260
282
|
type: 'prose',
|
|
261
|
-
text: "`astryx integration check` reads the set without running your icons. An unmapped built-in definition is an error that names the definition's description and words, so you or your agent can pick the icon
|
|
283
|
+
text: "`astryx integration check` reads the set without running your icons. An unmapped built-in definition is an error that names the definition's description and words and the `experimental icon map <definition> <icon id>` command that fixes it, so you or your agent can pick the icon. It names a search of your set (`experimental icon <word> --set <set>`) only when that search finds icons, and suggests one icon: the first of the suggestions `experimental icon new-set` gives for that definition. It never matches part of a word, and never writes a suggestion. Its icon-set codes:",
|
|
262
284
|
},
|
|
263
285
|
{
|
|
264
286
|
type: 'list',
|
|
@@ -286,7 +308,7 @@ export const brand = defineTheme({name: 'brand', icons: themeIcons});`,
|
|
|
286
308
|
},
|
|
287
309
|
{
|
|
288
310
|
type: 'prose',
|
|
289
|
-
text: 'Errors fail the check. Warnings fail only with `--strict`. A set that maps every built-in definition and every definition it declares passes `--strict`, which integrations run in their build ({@link generic:checks}). The flow, start to finish: `experimental icon new-set` → `integration check` → `experimental icon add` (or `experimental icon map`) for each definition it lists → `integration check` passes.',
|
|
311
|
+
text: 'Errors fail the check. Warnings fail only with `--strict`. A set that maps every built-in definition and every definition it declares passes `--strict`, which integrations run in their build ({@link generic:checks}). The flow, start to finish: `experimental icon new-set` → `npm install -D typescript@6` when the receipt asks → `integration check` → `experimental icon add` (or `experimental icon map`) for each definition it lists → `integration check` passes.',
|
|
290
312
|
},
|
|
291
313
|
],
|
|
292
314
|
},
|
|
@@ -299,8 +321,12 @@ export const brand = defineTheme({name: 'brand', icons: themeIcons});`,
|
|
|
299
321
|
style: 'unordered',
|
|
300
322
|
items: [
|
|
301
323
|
'Run `astryx integration verify` yourself before publishing. Do not put it in `prepublishOnly`: under `npm publish --dry-run` its own `npm pack` becomes a dry run too, and it checks nothing.',
|
|
302
|
-
"Declare `@astryxdesign/cli` as an optional peer (`peerDependenciesMeta`). A required peer an app cannot satisfy makes npm remove the app's CLI without a word. Icon sets are experimental, so no version range promises them
|
|
303
|
-
|
|
324
|
+
"Declare `@astryxdesign/cli` as an optional peer (`peerDependenciesMeta`). A required peer an app cannot satisfy makes npm remove the app's CLI without a word. Icon sets are experimental, so no version range promises them, and the format may change in a patch release. A CLI reads a set only when it knows every key the set's data file uses: a key it does not know withdraws the set, naming the key. `exclude` is read only by a CLI whose data-file reference lists it ({@link schema:icon-set-data}); a set without `exclude` is read by every CLI that has `astryx experimental icon`. A CLI without it reads `experimental` as a manifest key it does not know: `astryx doctor` there warns that your package was published against a newer Astryx CLI, other commands print a one-line nudge to run it, and your icons, icon definitions, and template icon mapping do not appear ({@link generic:versioning}).",
|
|
325
|
+
"Every built-in definition needs an icon, because Core renders it. When your library has no icon with that exact meaning, map the closest one, or add your own artwork as a component file in your package (`experimental icon add <Name> --from ./src/icons/<name>.js --definition <definition>`; a ./ path is named as written). Artwork you draw is yours: note its license beside the library's, for example in a NOTICE file in the set directory.",
|
|
326
|
+
'The generated declaration file imports React types, so declare `@types/react` as an optional peer for TypeScript users.',
|
|
327
|
+
'Keep the wrapped library in `dependencies`: your generated module re-exports its components, so apps get it with your package, and `integration check` compares its range with the version the data file records.',
|
|
328
|
+
"`integration check --strict` type-checks the set's doc files; it does not type-check the generated declaration file against React's types. Run `tsc` with `@types/react` installed to check those.",
|
|
329
|
+
'Your package needs `react` (the theme map and adapter use it) as a peer, as Core does. The `experimental icon new-set` receipt names the peers your package.json does not declare yet, as the JSON to add: `react` (`>=18`), and `@types/react` and `@astryxdesign/cli` (from the release that wrote the set) as optional peers; and the `typecheck` script (`astryx integration check --strict`) when there is none.',
|
|
304
330
|
],
|
|
305
331
|
},
|
|
306
332
|
],
|
|
@@ -329,7 +355,11 @@ astryx experimental icon use outline # make it the project's icon set`,
|
|
|
329
355
|
},
|
|
330
356
|
{
|
|
331
357
|
type: 'prose',
|
|
332
|
-
text: "A template declares, in its descriptor's `icons`, the definition each imported icon draws (`{TrashIcon: 'delete'}`). Once the project sets `experimental.iconSet` in astryx.config (`experimental icon use` writes it), each declared icon becomes the set's icon for that definition. An icon the set does not map keeps its original import, and the copy reports every icon as mapped or kept. Nothing is guessed from names.",
|
|
358
|
+
text: "A template declares, in its descriptor's `icons`, the definition each imported icon draws (`{TrashIcon: 'delete'}`). Once the project sets `experimental.iconSet` in astryx.config (`experimental icon use` writes it), each declared icon becomes the set's icon for that definition. An icon the set does not map keeps its original import, and the copy reports every icon as mapped or kept. Nothing is guessed from names. A mapped icon loses its library's sizing props (`size`, `strokeWidth`, `absoluteStrokeWidth`), since a set's icons take their size from CSS; the report names them as `dropped`. Comments on a rewritten import line are kept.",
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
type: 'prose',
|
|
362
|
+
text: "Each `icons` key is the name the template imports from its module, not a local alias. When a template imports the same name from two modules, such as `TrashIcon` from a library's outline and solid modules, one key covers both: both draw the same definition. Each then becomes the project set's variant of the same name when its module belongs to an installed set that declares the variant (so solid stays solid), else the set's default.",
|
|
333
363
|
},
|
|
334
364
|
],
|
|
335
365
|
},
|
|
@@ -363,11 +393,11 @@ astryx experimental icon use outline # make it the project's icon set`,
|
|
|
363
393
|
],
|
|
364
394
|
[
|
|
365
395
|
'`astryx doctor`',
|
|
366
|
-
'
|
|
396
|
+
'In an app, the `icon-sets` check: fails when `experimental.iconSet` names a set that is not installed or was withdrawn (an invalid set, or one whose module does not resolve), saying why, and warns when two packages ship a set by that name or a set was withdrawn. In your icon-set package, check with `astryx integration check` instead: plain `doctor` diagnoses an app.',
|
|
367
397
|
],
|
|
368
398
|
[
|
|
369
399
|
'JSON types',
|
|
370
|
-
'`icon.search`, `icon.detail`, `icon.list`, `icon.use`, `icon.map`, `icon.add`, `icon.definitionMatches`, `icon.newSet`, and `icon.newDefinition`, from the matching `astryx experimental icon` command.',
|
|
400
|
+
'`icon.search`, `icon.detail`, `icon.list`, `icon.setIcons`, `icon.definitions`, `icon.use`, `icon.map`, `icon.mapMany`, `icon.add`, `icon.addVariants`, `icon.definitionMatches`, `icon.newSet`, and `icon.newDefinition`, from the matching `astryx experimental icon` command.',
|
|
371
401
|
],
|
|
372
402
|
],
|
|
373
403
|
},
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx docs cli/experimental/render-pages`: turn a page into one
|
|
5
|
+
* self-contained HTML file to share or embed, and turn that file back into
|
|
6
|
+
* the page.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
|
|
10
|
+
export const docs = {
|
|
11
|
+
type: 'generic',
|
|
12
|
+
name: 'render-pages',
|
|
13
|
+
placement: {parent: 'namespace:experimental', slot: 'guides', order: 20},
|
|
14
|
+
stability: 'experimental',
|
|
15
|
+
title: 'Pages as one HTML file',
|
|
16
|
+
category: 'guide',
|
|
17
|
+
keywords: [
|
|
18
|
+
'render',
|
|
19
|
+
'static html',
|
|
20
|
+
'single file',
|
|
21
|
+
'artifact',
|
|
22
|
+
'share a page',
|
|
23
|
+
'snapshot',
|
|
24
|
+
'embed',
|
|
25
|
+
'sandboxed iframe',
|
|
26
|
+
'reverse',
|
|
27
|
+
],
|
|
28
|
+
description:
|
|
29
|
+
'Experimental. Render a page to one self-contained HTML file for sharing or embedding, and get the page back from it.',
|
|
30
|
+
sections: [
|
|
31
|
+
{
|
|
32
|
+
id: 'experimental',
|
|
33
|
+
title: 'Experimental',
|
|
34
|
+
content: [
|
|
35
|
+
{
|
|
36
|
+
type: 'prose',
|
|
37
|
+
text: 'This command is experimental, as everything under `astryx docs cli/experimental` is: its options, its output file and its JSON may still change. Nothing else in the CLI changes because it exists.',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: 'make-a-file',
|
|
43
|
+
title: 'Make a file to share',
|
|
44
|
+
content: [
|
|
45
|
+
{
|
|
46
|
+
type: 'prose',
|
|
47
|
+
text: 'Build the page with Astryx components as usual, then render it. The page module needs a default export; it renders on your machine with the React and Astryx packages your project installed.',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
type: 'code',
|
|
51
|
+
lang: 'bash',
|
|
52
|
+
code: 'astryx experimental render src/app/page.tsx --out page.html',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: 'prose',
|
|
56
|
+
text: 'The result is ONE file with nothing beside it: the markup, only the CSS rules the page uses (from Core and from any stylesheet it imports, such as a theme), the page\u2019s own StyleX styles, and local images as data: URIs. It runs no script and loads nothing from the network, so it opens from disk, attaches to a message, and displays inside a sandboxed frame that blocks network and script. Colors follow the viewer\u2019s light or dark setting, and a `data-theme` of `light` or `dark` on the root element picks one. The file also carries the source of the page and of every local module, stylesheet, JSON file and image it imports, so whoever you share it with can read that code; keep secrets out of what the page imports.',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: 'prose',
|
|
60
|
+
text: 'What it cannot keep: anything that needs a browser while running. State, effects, click handlers and data loaded after the first paint are gone, and a chart sized by its container is empty, so give charts a fixed size. Read browser-only values such as window inside an effect, or the render stops with ERR_RENDER_BROWSER_API.',
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'warnings',
|
|
66
|
+
title: 'Read the warnings',
|
|
67
|
+
content: [
|
|
68
|
+
{
|
|
69
|
+
type: 'prose',
|
|
70
|
+
text: 'Each warning names something that may look different from what you meant, and what to change. The most common is a component that ignores its children: `<ListItem>Save</ListItem>` renders an empty row because ListItem takes `label="Save"`. Others flag remote images (a sandboxed viewer cannot load them; save the image next to the page and import it), a `<script>`, `<link>` or `<iframe>` the page itself renders (the file promises to run and load nothing, so remove them), missing images, and output the page printed while rendering.',
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'get-it-back',
|
|
76
|
+
title: 'Get the page back',
|
|
77
|
+
content: [
|
|
78
|
+
{
|
|
79
|
+
type: 'code',
|
|
80
|
+
lang: 'bash',
|
|
81
|
+
code: 'astryx experimental render --reverse page.html --out page.tsx',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: 'prose',
|
|
85
|
+
text: 'Every rendered file carries its source, so this writes the page back byte for byte; edit it and render again. A file whose source block was removed but whose markup came from Astryx components is rebuilt from that markup instead: the components, their recorded props and the text come back, while styling, icons and behavior do not, so treat it as a starting point. HTML that was never an Astryx page is refused with ERR_RENDER_NOT_ASTRYX; describe the page to `astryx build` to start one.',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
type: 'prose',
|
|
89
|
+
text: 'It writes the page, the modules, stylesheets and JSON files the page reaches through its own imports, and the images, fonts and media the render carried (however the page named them, as long as their bytes really are one): each goes where the page\'s relative imports find it from wherever you put the page, and a file the page imports through a path alias (`@/components/Header`) goes where your project\'s `tsconfig.json` or `jsconfig.json` alias points. Every file but the page goes inside the one new folder the restore creates (the topmost folder on the page\'s path that does not exist yet), never into a folder that already exists: a page that imports other files comes back into a new folder (`--out restored/app/page.tsx`), and a file it imports through a path alias comes back only when that alias points inside the new folder. Nor does it write a file that a test, story or benchmark runner would run by its default patterns (Jest, Vitest, Bun, AVA, Playwright, Storybook, Cypress and `node --test`: names such as `*.test.*`, `*.spec.*`, `*_test.*`, `*-test.*`, `*.bench.*`, `*.stories.*`, `*.cy.*`, and anything under `test/`, `tests/` or `__tests__/`), judged from the repository root (every folder above the file up to it), else the topmost folder with a package.json. Restored files are the sender\'s code: read them before you run or import them. Without `--out`, everything comes back into a new folder beside the HTML file, named after it (`page.html` comes back into `page-restored/`). A received file that carries anything else (a file the page never imports, a dotfile, `package.json`, a tool configuration, a path that leaves the folder) is refused with nothing written. An existing file is never replaced unless you pass `--overwrite`, and the refusal names every one; a generated, vendored or ignored file, and any path through a symbolic link, is not written even then. Add `--json` for the result as data: what was written, how big it is, and every warning.',
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('@astryxdesign/cli/authoring').IconDefinitionDoc} */
|
|
4
|
+
export default {
|
|
5
|
+
type: 'icon-definition',
|
|
6
|
+
name: 'alignCenter',
|
|
7
|
+
description: 'Center text or items.',
|
|
8
|
+
words: ['center align', 'centre', 'text align'],
|
|
9
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('@astryxdesign/cli/authoring').IconDefinitionDoc} */
|
|
4
|
+
export default {
|
|
5
|
+
type: 'icon-definition',
|
|
6
|
+
name: 'alignEnd',
|
|
7
|
+
description:
|
|
8
|
+
'Align text or items to the end edge: the right in a left-to-right layout, the left in a right-to-left one.',
|
|
9
|
+
words: ['align end', 'right align', 'justify right', 'text align'],
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('@astryxdesign/cli/authoring').IconDefinitionDoc} */
|
|
4
|
+
export default {
|
|
5
|
+
type: 'icon-definition',
|
|
6
|
+
name: 'alignStart',
|
|
7
|
+
description:
|
|
8
|
+
'Align text or items to the start edge: the left in a left-to-right layout, the right in a right-to-left one.',
|
|
9
|
+
words: ['align start', 'left align', 'justify left', 'text align'],
|
|
10
|
+
};
|