@astryxdesign/cli 0.7.16 → 0.7.17-canary.g9a957aa
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 +12 -23
- package/api/build/_adapter.d.mts +5 -0
- package/api/build/_adapter.mjs +49 -34
- package/api/build/blocks/blocks.d.mts +7 -5
- package/api/build/blocks/blocks.mjs +113 -26
- package/api/build/build.doc.mjs +2 -1
- package/api/build/kit/rank.mjs +47 -9
- package/api/build/kit/weights.d.mts +16 -3
- package/api/build/kit/weights.json +1 -1
- package/api/build/kit/weights.mjs +238 -31
- package/api/build/kit/word-model.d.mts +23 -0
- package/api/build/kit/word-model.mjs +46 -0
- package/api/build/kit/words.d.mts +32 -0
- package/api/build/kit/words.mjs +49 -1
- package/api/component/__fixtures__/resolutions/modules.txt +4 -5
- package/api/component/list/list.d.mts +1 -1
- package/api/component/list/list.mjs +48 -5
- package/api/discover/_adapter.d.mts +1 -1
- package/api/docs/_adapter.d.mts +26 -2
- package/api/docs/_adapter.mjs +217 -5
- package/api/docs/docs.d.mts +3 -0
- package/api/docs/docs.doc.mjs +7 -1
- package/api/docs/docs.mjs +12 -0
- package/api/docs/docs.type.d.mts +5 -0
- package/api/docs/docs.type.mjs +2 -0
- package/api/docs/node/node.mjs +1 -1
- package/api/doctor/_adapter.d.mts +27 -5
- package/api/doctor/_adapter.mjs +77 -6
- package/api/doctor/built-checks.mjs +38 -13
- package/api/doctor/doctor.d.mts +4 -3
- package/api/doctor/doctor.mjs +14 -7
- package/api/doctor/theme-checks.mjs +121 -17
- package/api/render/_adapter.mjs +491 -186
- package/api/render/render.doc.mjs +10 -3
- package/api/render/render.type.d.mts +30 -0
- package/api/render/render.type.mjs +19 -0
- package/api/search/ORDERING.md +1 -1
- package/api/search/_candidate-score.mjs +51 -32
- package/api/search/_fit-order.mjs +3 -3
- package/api/search/_result.d.mts +5 -5
- package/api/search/_score.d.mts +6 -1
- package/api/search/_score.mjs +15 -3
- package/api/search/search.d.mts +1 -1
- package/api/theme/_adapter.mjs +10 -0
- package/api/theme/build/build.d.mts +38 -0
- package/api/theme/build/build.mjs +144 -24
- package/api/theme/theme.type.d.mts +10 -0
- package/api/theme/theme.type.mjs +7 -1
- package/api/theme-edit/_adapter.d.mts +35 -0
- package/api/theme-edit/_adapter.mjs +477 -41
- package/api/theme-edit/_check.d.mts +28 -22
- package/api/theme-edit/_check.mjs +1077 -200
- package/api/theme-edit/_compiler.mjs +9 -0
- package/api/theme-edit/_context.mjs +60 -3
- package/api/theme-edit/_css.mjs +21 -1
- package/api/theme-edit/_edit.d.mts +22 -0
- package/api/theme-edit/_edit.mjs +932 -82
- package/api/theme-edit/_how-commands.d.mts +49 -0
- package/api/theme-edit/_how-commands.mjs +386 -1
- package/api/theme-edit/_how-question.d.mts +56 -0
- package/api/theme-edit/_how-question.mjs +3509 -168
- package/api/theme-edit/_how.mjs +104 -4
- package/api/theme-edit/_marks.d.mts +31 -5
- package/api/theme-edit/_marks.mjs +57 -5
- package/api/theme-edit/_normal.d.mts +137 -0
- package/api/theme-edit/_normal.mjs +612 -0
- package/api/theme-edit/_palette.mjs +10 -4
- package/api/theme-edit/_parts.d.mts +4 -0
- package/api/theme-edit/_parts.mjs +28 -2
- package/api/theme-edit/_preview-app.d.mts +7 -1
- package/api/theme-edit/_preview-app.mjs +191 -15
- package/api/theme-edit/_preview.d.mts +64 -8
- package/api/theme-edit/_preview.mjs +401 -83
- package/api/theme-edit/_settings.d.mts +139 -5
- package/api/theme-edit/_settings.mjs +1659 -112
- package/api/theme-edit/_tables.mjs +17 -1
- package/api/theme-edit/theme-edit.type.d.mts +10 -1
- package/api/theme-edit/theme-edit.type.mjs +4 -1
- package/api/theme-edit/themeEditPreviewApp.doc.mjs +2 -2
- package/assets/codemods/run-codemod.mjs +73 -6
- package/assets/codemods/transforms/next/index.mjs +11 -1
- package/assets/codemods/transforms/next/migrate-item-swipe-actions-to-swipe.mjs +394 -0
- package/assets/docs/author-a-theme.doc.mjs +1 -0
- package/assets/docs/theme.doc.dense.mjs +2 -2
- package/assets/docs/theme.doc.mjs +1 -1
- package/assets/docs/tree/check-your-docs.doc.mjs +1 -1
- package/assets/docs/tree/cli-command.doc.mjs +2 -3
- package/assets/docs/tree/render-pages.doc.mjs +43 -2
- package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
- package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
- package/assets/docs/use-a-theme.doc.mjs +1 -1
- package/assets/docs.generated.json +2 -2
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.tsx +38 -0
- package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.tsx +36 -0
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ai-chat/template.doc.mjs +8 -4
- package/assets/templates/pages/ai-chat-landing/template.doc.mjs +2 -1
- package/assets/templates/pages/blank/template.doc.mjs +1 -1
- package/assets/templates/pages/canvas-editor/template.doc.mjs +4 -2
- package/assets/templates/pages/centered-hero/template.doc.mjs +9 -1
- package/assets/templates/pages/classic-gallery/template.doc.mjs +1 -1
- package/assets/templates/pages/contact-form/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard/template.doc.mjs +3 -2
- package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-composition/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-progress/template.doc.mjs +6 -3
- package/assets/templates/pages/detail-page/template.doc.mjs +10 -3
- package/assets/templates/pages/documentation/template.doc.mjs +4 -1
- package/assets/templates/pages/documentation-design/template.doc.mjs +7 -1
- package/assets/templates/pages/documentation-technical/template.doc.mjs +7 -1
- package/assets/templates/pages/editor/template.doc.mjs +1 -7
- package/assets/templates/pages/file-explorer/template.doc.mjs +1 -1
- package/assets/templates/pages/form-two-column/template.doc.mjs +4 -3
- package/assets/templates/pages/form-wizard/template.doc.mjs +5 -3
- package/assets/templates/pages/gallery-hero/template.doc.mjs +4 -2
- package/assets/templates/pages/ide/page.tsx +24 -2
- package/assets/templates/pages/library/template.doc.mjs +4 -1
- package/assets/templates/pages/login/template.doc.mjs +2 -1
- package/assets/templates/pages/login-card/template.doc.mjs +2 -1
- package/assets/templates/pages/login-split/template.doc.mjs +2 -1
- package/assets/templates/pages/login-sso/template.doc.mjs +4 -2
- package/assets/templates/pages/mixed-gallery/template.doc.mjs +2 -1
- package/assets/templates/pages/product-detail/template.doc.mjs +4 -2
- package/assets/templates/pages/product-gallery/template.doc.mjs +2 -1
- package/assets/templates/pages/settings-dialog/template.doc.mjs +2 -1
- package/assets/templates/pages/settings-sidebar/template.doc.mjs +2 -1
- package/assets/templates/pages/shell-nav/template.doc.mjs +4 -2
- package/assets/templates/pages/shell-side-nav/template.doc.mjs +5 -3
- package/assets/templates/pages/shell-top-nav/template.doc.mjs +2 -1
- package/assets/templates/pages/side-gallery/template.doc.mjs +9 -1
- package/assets/templates/pages/table-filter/template.doc.mjs +9 -8
- package/assets/templates/pages/table-grouped/template.doc.mjs +4 -2
- package/assets/templates/pages/table-page/template.doc.mjs +5 -4
- package/assets/templates/pages/table-tree/template.doc.mjs +6 -3
- package/assets/templates/pages/theme-showcase/template.doc.mjs +2 -1
- package/assets/templates/pages/work-item-detail/template.doc.mjs +1 -0
- package/authoring/debug/parse.d.mts +3 -3
- package/authoring/doctypes/_schema.d.mts +3 -3
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/template/template.doc.mjs +1 -1
- package/authoring/doctypes/template/type.ts +9 -0
- package/clients/cli/bin/astryx.mjs +6 -9
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/component.doc.mjs +1 -1
- package/clients/cli/commands/component.mjs +20 -2
- package/clients/cli/commands/docs.doc.mjs +7 -1
- package/clients/cli/commands/docs.mjs +3 -1
- package/clients/cli/commands/doctor.mjs +22 -14
- package/clients/cli/commands/experimental/render.mjs +32 -1
- package/clients/cli/commands/experimental/theme.mjs +27 -2
- package/clients/cli/commands/experimental-render.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
- package/clients/cli/commands/search.doc.mjs +2 -1
- package/clients/cli/commands/search.mjs +6 -1
- package/clients/cli/commands/template.mjs +4 -2
- package/clients/cli/commands/theme-build.doc.mjs +5 -1
- package/clients/cli/commands/theme.doc.mjs +1 -1
- package/clients/cli/commands/theme.mjs +138 -3
- package/clients/cli/commands/upgrade.mjs +42 -7
- package/clients/cli/index.mjs +1 -1
- package/clients/cli/lib/component-format.mjs +205 -98
- package/clients/cli/lib/hook-format.mjs +9 -19
- package/clients/cli/manifest.generated.json +1 -1
- package/foundation/agent-docs/agent-docs.mjs +1 -1
- package/foundation/config/theme-state.d.mts +13 -1
- package/foundation/config/theme-state.mjs +47 -7
- package/foundation/discovery/component-discovery.d.mts +11 -0
- package/foundation/discovery/component-discovery.mjs +27 -2
- package/foundation/discovery/component-replacement.mjs +130 -1
- package/foundation/discovery/entry-name-files.d.mts +43 -0
- package/foundation/discovery/entry-name-files.mjs +264 -0
- package/foundation/discovery/hook-discovery.d.mts +8 -2
- package/foundation/discovery/hook-discovery.mjs +20 -7
- package/foundation/discovery/runner-allowlist.d.mts +1 -0
- package/foundation/discovery/runner-allowlist.mjs +2 -0
- package/foundation/discovery/template-adapter.d.mts +52 -0
- package/foundation/discovery/template-adapter.mjs +169 -0
- package/foundation/discovery/theme-imports.d.mts +14 -0
- package/foundation/discovery/theme-imports.mjs +43 -1
- package/foundation/doc-compiler/import.mjs +7 -1
- package/foundation/doc-compiler/parse-readable.mjs +4 -1
- package/foundation/doc-compiler/stored-docs.d.mts +22 -0
- package/foundation/doc-compiler/stored-docs.mjs +49 -0
- package/foundation/fs/cache-eviction.d.mts +21 -0
- package/foundation/fs/cache-eviction.mjs +73 -0
- package/foundation/fs/gather-cache.d.mts +25 -4
- package/foundation/fs/gather-cache.mjs +138 -52
- package/foundation/fs/jiti-cache.d.mts +19 -1
- package/foundation/fs/jiti-cache.mjs +130 -6
- package/foundation/fs/kept-tree.d.mts +60 -0
- package/foundation/fs/kept-tree.mjs +154 -0
- package/foundation/fs/module-loader.d.mts +18 -2
- package/foundation/fs/module-loader.mjs +92 -20
- package/foundation/identity/provider-identity.d.mts +6 -0
- package/foundation/identity/provider-identity.mjs +10 -1
- package/foundation/render/file-header.d.mts +66 -0
- package/foundation/render/file-header.mjs +118 -0
- package/foundation/render/host-answer.d.mts +18 -0
- package/foundation/render/host-answer.mjs +46 -0
- package/foundation/render/host-exit.d.mts +1 -0
- package/foundation/render/host-exit.mjs +6 -1
- package/foundation/render/html-reader.d.mts +55 -2
- package/foundation/render/html-reader.mjs +145 -26
- package/foundation/render/markup-edits.d.mts +57 -0
- package/foundation/render/markup-edits.mjs +182 -0
- package/foundation/render/page-host.mjs +29 -12
- package/foundation/render/page-worker.mjs +79 -10
- package/foundation/render/render-page.d.mts +34 -2
- package/foundation/render/render-page.mjs +210 -29
- package/foundation/render/source-block.d.mts +73 -6
- package/foundation/render/source-block.mjs +170 -19
- package/foundation/render/ts-paths.d.mts +4 -1
- package/foundation/render/ts-paths.mjs +7 -3
- package/foundation/response/error-codes.d.mts +2 -1
- package/foundation/response/error-codes.doc.mjs +7 -1
- package/foundation/response/error-codes.mjs +7 -0
- package/foundation/text/string-utils.d.mts +3 -2
- package/foundation/text/string-utils.mjs +16 -3
- package/foundation/text/suggest-order.d.mts +9 -0
- package/foundation/text/suggest-order.mjs +13 -0
- package/package.json +6 -6
|
@@ -44,8 +44,8 @@ declare const eventSchema: z.ZodObject<{
|
|
|
44
44
|
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
45
45
|
options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
46
46
|
optionSources: z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
47
|
-
default: "default";
|
|
48
47
|
cli: "cli";
|
|
48
|
+
default: "default";
|
|
49
49
|
env: "env";
|
|
50
50
|
config: "config";
|
|
51
51
|
implied: "implied";
|
|
@@ -75,16 +75,16 @@ declare const eventSchema: z.ZodObject<{
|
|
|
75
75
|
resultCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
|
76
76
|
emptyResult: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
|
|
77
77
|
resultKind: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
78
|
-
template: "template";
|
|
79
78
|
command: "command";
|
|
79
|
+
none: "none";
|
|
80
80
|
component: "component";
|
|
81
|
+
template: "template";
|
|
81
82
|
doc: "doc";
|
|
82
83
|
theme: "theme";
|
|
83
84
|
hook: "hook";
|
|
84
85
|
integration: "integration";
|
|
85
86
|
migration: "migration";
|
|
86
87
|
mixed: "mixed";
|
|
87
|
-
none: "none";
|
|
88
88
|
}>>>;
|
|
89
89
|
directMatch: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
|
|
90
90
|
stdout: z.ZodString;
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
/** Every authored doc-kind discriminant accepted by parseDoc. */
|
|
5
5
|
export const AuthoredDocKindSchema: z.ZodEnum<{
|
|
6
6
|
function: "function";
|
|
7
|
+
page: "page";
|
|
7
8
|
command: "command";
|
|
8
9
|
component: "component";
|
|
9
10
|
generic: "generic";
|
|
10
|
-
page: "page";
|
|
11
11
|
block: "block";
|
|
12
12
|
schema: "schema";
|
|
13
13
|
enum: "enum";
|
|
@@ -643,10 +643,10 @@ export const NamespaceDocKindSchema: z.ZodObject<{
|
|
|
643
643
|
accepts: z.ZodObject<{
|
|
644
644
|
kinds: z.ZodArray<z.ZodEnum<{
|
|
645
645
|
function: "function";
|
|
646
|
+
page: "page";
|
|
646
647
|
command: "command";
|
|
647
648
|
component: "component";
|
|
648
649
|
generic: "generic";
|
|
649
|
-
page: "page";
|
|
650
650
|
block: "block";
|
|
651
651
|
schema: "schema";
|
|
652
652
|
enum: "enum";
|
|
@@ -664,10 +664,10 @@ export const NamespaceDocKindSchema: z.ZodObject<{
|
|
|
664
664
|
group: z.ZodString;
|
|
665
665
|
kinds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
666
666
|
function: "function";
|
|
667
|
+
page: "page";
|
|
667
668
|
command: "command";
|
|
668
669
|
component: "component";
|
|
669
670
|
generic: "generic";
|
|
670
|
-
page: "page";
|
|
671
671
|
block: "block";
|
|
672
672
|
schema: "schema";
|
|
673
673
|
enum: "enum";
|
|
@@ -241,7 +241,7 @@ export const doc = {
|
|
|
241
241
|
args: [{name: 'query', param: 'query', required: true}],
|
|
242
242
|
options: [
|
|
243
243
|
{flag: '--type <domain>', param: 'options.type', choices: ['component', 'hook', 'doc', 'template', 'theme']},
|
|
244
|
-
{flag: '--verbose', cliOnly: true, description: "Also print each result's score and match reason."},
|
|
244
|
+
{flag: '--verbose', cliOnly: true, description: "Also print each result's score and match reason, and its whole description."},
|
|
245
245
|
],
|
|
246
246
|
examples: [{label: 'Terminal', cli: 'astryx search button --json'}],
|
|
247
247
|
exitCodes: [{code: 1, when: 'The --type value is not a known domain.'}],
|
|
@@ -56,7 +56,7 @@ export const doc = {
|
|
|
56
56
|
name: 'keywords',
|
|
57
57
|
type: 'string[]',
|
|
58
58
|
description:
|
|
59
|
-
"Search keywords for CLI discovery: the ideas, domains, and other names a builder might use for what the template serves (e.g. ['monitoring', 'uptime', 'on-call'] for a service-health dashboard). Lowercase. `astryx search` matches them as it matches the description and `astryx build` ranks page templates on them, so keep them out of `description`. Integration templates need @astryxdesign/cli 0.6.6 or later: earlier CLIs reject the field and drop that template, and CLIs before 0.6.4 also hide the package's doc topics.",
|
|
59
|
+
"Search keywords for CLI discovery: the ideas, domains, and other names a builder might use for what the template serves (e.g. ['monitoring', 'uptime', 'on-call'] for a service-health dashboard). Lowercase. One keyword names one concept: write a list of words as separate keywords (['kpi', 'tiles'], not 'kpi tiles'). Write several words as one keyword only for a term the words do not mean apart, such as 'table of contents' or 'reading pane': when `astryx build` chooses the start and its alternatives, such a keyword counts only when the request names the whole phrase, in order, never through its words alone. Inside a phrase, build skips search's stopwords and one-letter words, so 'sign in' matches as 'sign' and 'on-call' as 'call'. `astryx search` matches them as it matches the description and `astryx build` ranks page templates on them, so keep them out of `description`. Integration templates need @astryxdesign/cli 0.6.6 or later: earlier CLIs reject the field and drop that template, and CLIs before 0.6.4 also hide the package's doc topics.",
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
name: 'replaces',
|
|
@@ -29,6 +29,15 @@ export interface BaseTemplateDoc extends AuthoredDocGraphFields {
|
|
|
29
29
|
/** Search keywords for CLI discovery: the ideas, domains, and other names a
|
|
30
30
|
* builder might use for what this template serves (e.g. `['monitoring',
|
|
31
31
|
* 'uptime', 'on-call']` for a service-health dashboard). Lowercase.
|
|
32
|
+
* One keyword names one concept: write a list of words as separate
|
|
33
|
+
* keywords (`['kpi', 'tiles']`, not `'kpi tiles'`). Write several words as
|
|
34
|
+
* one keyword only for a term the words do not mean apart, such as
|
|
35
|
+
* `'table of contents'` or `'reading pane'`: when `astryx build` chooses
|
|
36
|
+
* the start and its alternatives, such a keyword counts only when the
|
|
37
|
+
* request names the whole phrase, in order, never through its words
|
|
38
|
+
* alone. Inside a phrase, build skips search's
|
|
39
|
+
* stopwords and one-letter words, so `'sign in'` matches as `'sign'` and
|
|
40
|
+
* `'on-call'` as `'call'`.
|
|
32
41
|
* `astryx search` matches them as it matches the description, and
|
|
33
42
|
* `astryx build` ranks page templates on them, so the `description` can
|
|
34
43
|
* stay a description of the layout. Integration templates need
|
|
@@ -33,10 +33,10 @@ import {
|
|
|
33
33
|
|
|
34
34
|
// Node's compile cache keeps the compiled form of the CLI's modules between
|
|
35
35
|
// runs, so a run skips most of their compiling. It lives in a folder of the
|
|
36
|
-
// user's own in the system temp folder (node-compile-cache-<uid>).
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
// folder the user owns that no one else can reach, since a shared folder
|
|
36
|
+
// user's own in the system temp folder (node-compile-cache-<uid>). A machine's
|
|
37
|
+
// first run makes that folder and writes the cache at once, so the next run
|
|
38
|
+
// (most often the same session's next command) reads it. It is used only
|
|
39
|
+
// while it is a real folder the user owns that no one else can reach, since a shared folder
|
|
40
40
|
// could hold planted cache files (foundation/env/private-dir.mjs, the check
|
|
41
41
|
// the kept search catalogs use too). Where the system has no user ids
|
|
42
42
|
// (Windows), ownership cannot be checked, so the cache stays off.
|
|
@@ -46,11 +46,8 @@ try {
|
|
|
46
46
|
const uid = currentUid();
|
|
47
47
|
if (!process.env.NODE_DISABLE_COMPILE_CACHE && uid != null) {
|
|
48
48
|
const cacheDir = join(tmpdir(), `node-compile-cache-${uid}`);
|
|
49
|
-
if (!existsSync(cacheDir)) {
|
|
50
|
-
|
|
51
|
-
} else if (isPrivateDir(cacheDir)) {
|
|
52
|
-
nodeModule.enableCompileCache?.(cacheDir);
|
|
53
|
-
}
|
|
49
|
+
if (!existsSync(cacheDir)) mkdirSync(cacheDir, {mode: 0o700});
|
|
50
|
+
if (isPrivateDir(cacheDir)) nodeModule.enableCompileCache?.(cacheDir);
|
|
54
51
|
}
|
|
55
52
|
} catch {
|
|
56
53
|
// A run without the cache is the same run, only slower.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"84887555feae347521a39a4abfe7cf10ac6e9117ca3f02cd0c47a6f742c63f28"}
|
|
@@ -95,9 +95,16 @@ function summarize(result) {
|
|
|
95
95
|
* @param {string} requestedName
|
|
96
96
|
* @param {'full'|'compact'|'brief'} detail
|
|
97
97
|
* @param {Awaited<ReturnType<typeof resolveTheme>>} themeData
|
|
98
|
+
* @param {string} [scopePackage] - the `--package` the read was scoped to
|
|
98
99
|
* @returns {import('../formatters/index.mjs').Block[]}
|
|
99
100
|
*/
|
|
100
|
-
function componentDetailBlocks(
|
|
101
|
+
function componentDetailBlocks(
|
|
102
|
+
result,
|
|
103
|
+
requestedName,
|
|
104
|
+
detail,
|
|
105
|
+
themeData,
|
|
106
|
+
scopePackage,
|
|
107
|
+
) {
|
|
101
108
|
const requested = (requestedName.split('/').pop() ?? requestedName).replace(
|
|
102
109
|
/^XDS/,
|
|
103
110
|
'',
|
|
@@ -110,6 +117,12 @@ function componentDetailBlocks(result, requestedName, detail, themeData) {
|
|
|
110
117
|
result.data.replaces === requested
|
|
111
118
|
? result.data.name
|
|
112
119
|
: requested;
|
|
120
|
+
// The command that prints this read's props whole names the read's own
|
|
121
|
+
// selector and scope, so it resolves to the same component.
|
|
122
|
+
const scope = scopePackage ? ` --package ${scopePackage}` : '';
|
|
123
|
+
const propsCommand = requestedName
|
|
124
|
+
? `component ${requestedName}${scope} --props`
|
|
125
|
+
: null;
|
|
113
126
|
switch (result.type) {
|
|
114
127
|
case 'component.detail': {
|
|
115
128
|
/** @type {import('../formatters/index.mjs').Block[]} */
|
|
@@ -126,12 +139,15 @@ function componentDetailBlocks(result, requestedName, detail, themeData) {
|
|
|
126
139
|
)
|
|
127
140
|
: detail === 'compact'
|
|
128
141
|
? code(
|
|
129
|
-
formatCompact(result.data, resolvedName, result.data.import
|
|
142
|
+
formatCompact(result.data, resolvedName, result.data.import, {
|
|
143
|
+
propsCommand,
|
|
144
|
+
}),
|
|
130
145
|
)
|
|
131
146
|
: code(
|
|
132
147
|
formatFull(result.data, {
|
|
133
148
|
themeData,
|
|
134
149
|
importHint: result.data.import,
|
|
150
|
+
propsCommand,
|
|
135
151
|
}),
|
|
136
152
|
),
|
|
137
153
|
);
|
|
@@ -425,6 +441,7 @@ export function registerComponent(program) {
|
|
|
425
441
|
row.selector,
|
|
426
442
|
detail,
|
|
427
443
|
themeData,
|
|
444
|
+
options.package,
|
|
428
445
|
),
|
|
429
446
|
);
|
|
430
447
|
continue;
|
|
@@ -472,6 +489,7 @@ export function registerComponent(program) {
|
|
|
472
489
|
name ?? '',
|
|
473
490
|
detail,
|
|
474
491
|
themeData,
|
|
492
|
+
options.package,
|
|
475
493
|
),
|
|
476
494
|
);
|
|
477
495
|
break;
|
|
@@ -32,6 +32,11 @@ export const doc = {
|
|
|
32
32
|
{name: 'section', param: 'section', required: false},
|
|
33
33
|
],
|
|
34
34
|
options: [
|
|
35
|
+
{
|
|
36
|
+
flag: '--list',
|
|
37
|
+
param: 'options.list',
|
|
38
|
+
description: 'List every topic (the same as giving no topic)',
|
|
39
|
+
},
|
|
35
40
|
{
|
|
36
41
|
flag: '--index',
|
|
37
42
|
param: 'options.index',
|
|
@@ -51,6 +56,7 @@ export const doc = {
|
|
|
51
56
|
],
|
|
52
57
|
examples: [
|
|
53
58
|
{label: 'List topics', cli: 'astryx docs'},
|
|
59
|
+
{label: 'The same list, asked for by flag', cli: 'astryx docs --list'},
|
|
54
60
|
{label: "A topic's sections", cli: 'astryx docs theme'},
|
|
55
61
|
{label: 'A whole topic as JSON', cli: 'astryx docs spacing --json'},
|
|
56
62
|
{label: 'One section', cli: 'astryx docs theme quick-start'},
|
|
@@ -72,7 +78,7 @@ export const doc = {
|
|
|
72
78
|
{code: 0, when: 'success'},
|
|
73
79
|
{
|
|
74
80
|
code: 1,
|
|
75
|
-
when: 'unknown topic or route, a section that matches no section or more than one,
|
|
81
|
+
when: 'unknown topic or route, a section that matches no section or more than one, a --depth that is not a number of levels or all, or --list given a topic or section',
|
|
76
82
|
},
|
|
77
83
|
],
|
|
78
84
|
related: ['search', 'component', 'hook', 'template'],
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* Usage:
|
|
18
18
|
* astryx docs List available topics
|
|
19
|
+
* astryx docs --list The same list, asked for by flag
|
|
19
20
|
* astryx docs <topic> List the topic's sections (a topic
|
|
20
21
|
* with one section prints whole)
|
|
21
22
|
* astryx docs <topic> <section> Print one section
|
|
@@ -650,7 +651,7 @@ export function registerDocs(program) {
|
|
|
650
651
|
action: async (
|
|
651
652
|
/** @type {string | undefined} */ topic,
|
|
652
653
|
/** @type {string | undefined} */ sectionName,
|
|
653
|
-
/** @type {{index?: boolean, full?: boolean, depth?: string}} */ options = {},
|
|
654
|
+
/** @type {{list?: boolean, index?: boolean, full?: boolean, depth?: string}} */ options = {},
|
|
654
655
|
) => {
|
|
655
656
|
const run = getCliInvocation();
|
|
656
657
|
const lang = program.opts().lang || null;
|
|
@@ -697,6 +698,7 @@ export function registerDocs(program) {
|
|
|
697
698
|
lang,
|
|
698
699
|
zh,
|
|
699
700
|
dense,
|
|
701
|
+
list: options.list,
|
|
700
702
|
index: listSections,
|
|
701
703
|
...(depth != null ? {depth, detail: childDetail} : {}),
|
|
702
704
|
});
|
|
@@ -22,14 +22,7 @@ import {
|
|
|
22
22
|
validateIntegration,
|
|
23
23
|
} from '../../../api/integration/validate-integration.mjs';
|
|
24
24
|
import {jsonOut} from '../../../foundation/response/json.mjs';
|
|
25
|
-
import {
|
|
26
|
-
emit,
|
|
27
|
-
list,
|
|
28
|
-
section,
|
|
29
|
-
record,
|
|
30
|
-
records,
|
|
31
|
-
text,
|
|
32
|
-
} from '../formatters/index.mjs';
|
|
25
|
+
import {emit, list, section, records, text} from '../formatters/index.mjs';
|
|
33
26
|
import {defineCommand} from '../lib/define-command.mjs';
|
|
34
27
|
import {doc as doctorCommand} from './doctor.doc.mjs';
|
|
35
28
|
import {doc as doctorIntegrationGroup} from './doctor-integration.doc.mjs';
|
|
@@ -58,6 +51,15 @@ const STATUS = {
|
|
|
58
51
|
info: '[info]',
|
|
59
52
|
};
|
|
60
53
|
|
|
54
|
+
/** A doctor check's fields in text order: the status column, then the rest. */
|
|
55
|
+
const CHECK_FIELDS = /** @type {const} */ ([
|
|
56
|
+
'status',
|
|
57
|
+
'id',
|
|
58
|
+
'label',
|
|
59
|
+
'message',
|
|
60
|
+
'fix',
|
|
61
|
+
]);
|
|
62
|
+
|
|
61
63
|
/** @param {string} status */
|
|
62
64
|
function statusToken(status) {
|
|
63
65
|
return STATUS[/** @type {keyof typeof STATUS} */ (status)] ?? status;
|
|
@@ -80,15 +82,21 @@ function printHuman(report) {
|
|
|
80
82
|
? 'No failures — but review the [warn] warnings above when you can.'
|
|
81
83
|
: 'All checks passed. Your Astryx setup looks healthy.';
|
|
82
84
|
|
|
83
|
-
//
|
|
85
|
+
// One check per line, status first so the counted value stays a column.
|
|
86
|
+
// The legend names each field by its JSON key, so text and --json map one
|
|
87
|
+
// to one.
|
|
88
|
+
const summaryFields = /** @type {const} */ (['pass', 'warn', 'fail', 'info']);
|
|
84
89
|
emit(
|
|
85
|
-
section('astryx doctor
|
|
90
|
+
section('astryx doctor', `Each check: ${CHECK_FIELDS.join(', ')}`),
|
|
86
91
|
records(report.checks, {
|
|
87
|
-
fields: [
|
|
88
|
-
|
|
92
|
+
fields: [...CHECK_FIELDS],
|
|
93
|
+
layout: 'inline',
|
|
94
|
+
format: {status: statusToken, fix: fix => `fix: ${fix}`},
|
|
89
95
|
}),
|
|
90
|
-
section(
|
|
91
|
-
|
|
96
|
+
section(
|
|
97
|
+
'summary',
|
|
98
|
+
summaryFields.map(key => `${key}: ${report.summary[key]}`).join(', '),
|
|
99
|
+
),
|
|
92
100
|
text(closing),
|
|
93
101
|
);
|
|
94
102
|
}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import {getCliInvocation} from '../../../../foundation/env/package-manager.mjs';
|
|
17
|
+
import {shellArg} from '../../../../foundation/text/shell-arg.mjs';
|
|
17
18
|
import {jsonOut} from '../../../../foundation/response/json.mjs';
|
|
18
19
|
import {resultSet} from '../../../../foundation/debug/index.mjs';
|
|
19
20
|
import {emit, section, text, record, list} from '../../formatters/index.mjs';
|
|
@@ -76,11 +77,12 @@ export function registerExperimentalRender(group, program) {
|
|
|
76
77
|
...(d.warnings.length > 0
|
|
77
78
|
? [section('Warnings'), list(d.warnings.map(w => w.message))]
|
|
78
79
|
: []),
|
|
79
|
-
text(`Give it back: ${run} experimental render --reverse ${d.output}`),
|
|
80
|
+
text(`Give it back: ${run} experimental render --reverse ${shellArg(d.output)}`),
|
|
80
81
|
);
|
|
81
82
|
return answered;
|
|
82
83
|
}
|
|
83
84
|
const d = result.data;
|
|
85
|
+
const edits = d.edits ?? [];
|
|
84
86
|
emit(
|
|
85
87
|
section(d.mode === 'embedded' ? `Restored ${d.output}` : `Rebuilt ${d.output}`),
|
|
86
88
|
record({
|
|
@@ -98,6 +100,12 @@ export function registerExperimentalRender(group, program) {
|
|
|
98
100
|
...(d.unknown?.length ? {unknown: d.unknown.join(', ')} : {}),
|
|
99
101
|
}
|
|
100
102
|
: {}),
|
|
103
|
+
...(d.format === undefined ? {} : {format: d.format}),
|
|
104
|
+
...(d.renderedBy ? {renderedBy: d.renderedBy} : {}),
|
|
105
|
+
...(d.packages ? {packages: d.packages.join(', ') || 'none'} : {}),
|
|
106
|
+
...(d.title === undefined ? {} : {title: d.title}),
|
|
107
|
+
...(d.edited === undefined ? {} : {edited: d.edited}),
|
|
108
|
+
...(d.stylesEdited === undefined ? {} : {stylesEdited: d.stylesEdited}),
|
|
101
109
|
}),
|
|
102
110
|
...(d.mode === 'rebuilt'
|
|
103
111
|
? [
|
|
@@ -106,6 +114,29 @@ export function registerExperimentalRender(group, program) {
|
|
|
106
114
|
),
|
|
107
115
|
]
|
|
108
116
|
: []),
|
|
117
|
+
...(d.edited
|
|
118
|
+
? [
|
|
119
|
+
section('Changed after the render'),
|
|
120
|
+
...(edits.length > 0
|
|
121
|
+
? edits.map(edit =>
|
|
122
|
+
record({
|
|
123
|
+
was: edit.was ?? '(added after the render)',
|
|
124
|
+
now: edit.now ?? '(removed after the render)',
|
|
125
|
+
...(edit.file ? {file: edit.file, line: edit.line} : {}),
|
|
126
|
+
}),
|
|
127
|
+
)
|
|
128
|
+
: [text(d.stylesEdited ? 'Only the styles changed after the render; the text did not.' : 'The markup changed after the render, but its text did not: only attributes, elements or formatting.')]),
|
|
129
|
+
...(d.moreEdits ? [record({moreEdits: d.moreEdits})] : []),
|
|
130
|
+
text('The restored files are the page as rendered, without these changes: make them in the restored files, then render again.'),
|
|
131
|
+
]
|
|
132
|
+
: []),
|
|
133
|
+
...(d.mode === 'embedded'
|
|
134
|
+
? [
|
|
135
|
+
text(
|
|
136
|
+
`Render it again: ${run} experimental render ${shellArg(d.output)} --out ${shellArg(d.input)}${d.title === undefined ? '' : ` --title ${shellArg(d.title)}`}`,
|
|
137
|
+
),
|
|
138
|
+
]
|
|
139
|
+
: []),
|
|
109
140
|
);
|
|
110
141
|
return answered;
|
|
111
142
|
},
|
|
@@ -49,6 +49,9 @@ import {
|
|
|
49
49
|
dialValueFits,
|
|
50
50
|
newFlagList,
|
|
51
51
|
editorCompileProblem,
|
|
52
|
+
editorBuildExtra,
|
|
53
|
+
editorLoadedFonts,
|
|
54
|
+
editorColorModes,
|
|
52
55
|
editorThemeHold,
|
|
53
56
|
editorThemeRefusal,
|
|
54
57
|
editorMissingSource,
|
|
@@ -484,7 +487,16 @@ function flagValues(name) {
|
|
|
484
487
|
*/
|
|
485
488
|
function changeBlocks(r) {
|
|
486
489
|
const d = r.data;
|
|
487
|
-
|
|
490
|
+
// The status line names the value as saved, with a quote or space mark
|
|
491
|
+
// the text output would fold written as its CSS escape (\201C), so the
|
|
492
|
+
// text and the JSON name the same value.
|
|
493
|
+
const s = {
|
|
494
|
+
...d.setting,
|
|
495
|
+
value: String(d.setting.value).replace(
|
|
496
|
+
/[\u00A0\u00AB\u00BB\u2000-\u200B\u2018-\u201F\u2039\u203A\u202F\u3000\u300C-\u300F]/g,
|
|
497
|
+
c => `\\${c.codePointAt(0)?.toString(16).toUpperCase()} `,
|
|
498
|
+
),
|
|
499
|
+
};
|
|
488
500
|
const status =
|
|
489
501
|
d.was != null
|
|
490
502
|
? `[ok] ${d.theme}: ${s.thing} ${d.was} -> ${s.value}`
|
|
@@ -639,7 +651,14 @@ function strayOption(command, rest) {
|
|
|
639
651
|
},
|
|
640
652
|
);
|
|
641
653
|
}
|
|
642
|
-
|
|
654
|
+
// A value pasted with a token's label (`'--color-accent: #e11d48'`) is
|
|
655
|
+
// a value, read by the label reader, not an option.
|
|
656
|
+
const word = rest.find(
|
|
657
|
+
w =>
|
|
658
|
+
typeof w === 'string' &&
|
|
659
|
+
w.startsWith('--') &&
|
|
660
|
+
!/^--[a-z0-9-]+\s*:\s*\S/i.test(w),
|
|
661
|
+
);
|
|
643
662
|
if (word == null) return null;
|
|
644
663
|
return cliError(
|
|
645
664
|
`unknown option '${word}': only the thing a change names may start with -- (a design token such as --color-accent).`,
|
|
@@ -908,6 +927,9 @@ export function registerExperimentalTheme(group, program) {
|
|
|
908
927
|
// A declaration pasted as one argument (`--color-accent: #e11d48`,
|
|
909
928
|
// or `--color-accent:#e11d48`) is the token and its value; with no
|
|
910
929
|
// value otherwise, the missing-argument error the parser gives.
|
|
930
|
+
// A pasted JSON object of settings goes to the editor whole, which
|
|
931
|
+
// gives one set line per entry.
|
|
932
|
+
if (!value.length && /^\s*\{/.test(thing)) value = [''];
|
|
911
933
|
if (!value.length) {
|
|
912
934
|
// Any thing, a token or a dial, with `:` or `=` (`accent: red`,
|
|
913
935
|
// `--color-accent=#e11d48`).
|
|
@@ -1306,6 +1328,9 @@ export function registerExperimentalTheme(group, program) {
|
|
|
1306
1328
|
missingSource: editorMissingSource,
|
|
1307
1329
|
template: editorThemeTemplate,
|
|
1308
1330
|
hold: editorThemeHold,
|
|
1331
|
+
loadedFonts: editorLoadedFonts,
|
|
1332
|
+
extraData: editorBuildExtra,
|
|
1333
|
+
colorModes: editorColorModes,
|
|
1309
1334
|
},
|
|
1310
1335
|
);
|
|
1311
1336
|
}
|
|
@@ -16,7 +16,7 @@ export const doc = {
|
|
|
16
16
|
summary:
|
|
17
17
|
'Render a page to one self-contained HTML file, or turn one back into a page',
|
|
18
18
|
description:
|
|
19
|
-
"Renders the page's default export with the project's own Astryx components and writes ONE static HTML file that needs nothing beside it: no script runs and nothing loads from the network, so it opens anywhere, including a sandboxed frame with a strict content security policy, and follows the viewer's light or dark scheme. The page's own StyleX compiles, only the Core CSS rules the page uses are inlined, local images become data: URIs, and the page's source is embedded. Warnings name anything that may not look as meant, such as a component that did not render the text it was given (ListItem takes label=, not children). --reverse writes the embedded source back byte for byte; a file with Astryx markup but no embedded source is rebuilt from its components (text and layout only, as a starting point); any other HTML is refused. Experimental: it may change or be removed in a patch release.",
|
|
19
|
+
"Renders the page's default export with the project's own Astryx components and writes ONE static HTML file that needs nothing beside it: no script runs and nothing loads from the network, so it opens anywhere, including a sandboxed frame with a strict content security policy, and follows the viewer's light or dark scheme. The page's own StyleX compiles, only the Core CSS rules the page uses are inlined, local images become data: URIs, and the page's source is embedded. Warnings name anything that may not look as meant, such as a component that did not render the text it was given (ListItem takes label=, not children). The file opens with a plain note for whoever opens it next: the CLI version and render format that made it, the page's path, the files it carries, the packages it rendered with, and the exact commands that give the page back and render it again. --reverse (the way back, or unrender) writes the embedded source back byte for byte and names any text someone changed in the HTML after the render, with the file and line that hold the old text; a file with Astryx markup but no embedded source is rebuilt from its components (text and layout only, as a starting point); any other HTML is refused. Experimental: it may change or be removed in a patch release.",
|
|
20
20
|
fn: 'render',
|
|
21
21
|
args: [{name: 'file', param: 'file', required: false}],
|
|
22
22
|
options: [
|
|
@@ -53,7 +53,7 @@ export const doc = {
|
|
|
53
53
|
{code: 0, when: 'the file was written (warnings included)'},
|
|
54
54
|
{
|
|
55
55
|
code: 1,
|
|
56
|
-
when: 'no file, a wrong extension, a missing file, a page that does not compile, has no default export, imports a package that is not installed, reads a browser API while rendering, throws, crashes Node, or takes over 60 seconds; a file to write outside the current folder; with --reverse, an existing output without --overwrite, a damaged embedded source, or HTML that is not an Astryx page',
|
|
56
|
+
when: 'no file, a wrong extension, a missing file, a page that does not compile, has no default export, imports a package that is not installed, reads a browser API while rendering, throws, crashes Node, or takes over 60 seconds; a file to write outside the current folder; with --reverse, an existing output without --overwrite, a damaged embedded source, a file in a newer render format than this CLI reads, or HTML that is not an Astryx page',
|
|
57
57
|
},
|
|
58
58
|
],
|
|
59
59
|
related: ['template', 'build'],
|
|
@@ -14,7 +14,7 @@ export const doc = {
|
|
|
14
14
|
stability: 'experimental',
|
|
15
15
|
summary: 'Compile standalone themes or one keyed theme family',
|
|
16
16
|
description:
|
|
17
|
-
|
|
17
|
+
"Compiles defineTheme() sources through the same theme pipeline into scoped CSS, standard ESM, and type declarations. Compiling a theme made by experimental theme editor (themes/<theme>/<theme>.theme.ts, or its app copy src/themes/<theme>/<Theme>Theme.ts) takes that theme's lock and also writes its app copy in src/themes/<theme>/ again; --check fails while that copy is behind or gone. Ordinary mode writes one complete set per theme. --family combines one selected extension tree into the three files named by the required --family-key, ready for one CSS load and identity-only switching. With --check it writes nothing and reports source drift. --icons-specifier keeps its existing generated-module behavior. It prints one line per built theme and one line naming fonts the themes do not load; --detail full adds the install example and the font recipe, once for a batch.",
|
|
18
18
|
fn: 'themeBuild',
|
|
19
19
|
args: [
|
|
20
20
|
{
|
|
@@ -39,7 +39,7 @@ export const doc = {
|
|
|
39
39
|
flag: '-o, --out <path>',
|
|
40
40
|
param: 'options.out',
|
|
41
41
|
description:
|
|
42
|
-
|
|
42
|
+
"Output CSS file path, relative or absolute; the .js and .d.ts are written beside it (default: <theme name>.css next to the source). A folder, or a path ending in /, writes <theme name>.css into it. The path should end in .css; another name still builds, with a warning. A build never replaces the theme source (ERR_THEME_INVALID). At a path --out names, it replaces its own earlier outputs, and the output of another theme source with a warning that names both sources; any other existing file fails with ERR_FILE_EXISTS and nothing is written. Into a folder the theme editor made (folder <slug>/ holds <slug>.settings.json), a source outside that folder builds there too, with a warning; to keep the editor folder to its own theme, build beside the source, or pass an --out outside it. A build writes only inside the working directory, the defaults beside the source too (ERR_PATH_TRAVERSAL); --check writes nothing, so it compares outputs anywhere and refuses only a relative path that escapes the working directory. Single theme only: refused with more than one file or with --family (ERR_THEME_INVALID) An --out in an editor theme's app copy folder (src/themes/<theme>/, the folder itself too) is refused (ERR_INVALID_ARGUMENT): the editor writes that folder after every build",
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
flag: '--icons-specifier <specifier>',
|
|
@@ -89,7 +89,7 @@ export const doc = {
|
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
91
|
code: 1,
|
|
92
|
-
when:
|
|
92
|
+
when: "a build or validation error (an error envelope), or --check finds stale or missing outputs (the check result, with upToDate false, the stale files and code ERR_THEME_STALE, is still printed: it is a result, not an error). One exception: an editor theme whose settings changed after its build is refused (ERR_THEME_INVALID, an error envelope) before any file is checked, with `editor show <theme>` to build it again. An editor theme run from a folder other than its app root is refused (ERR_INVALID_ARGUMENT) with the `cd` to the root and the same command; `--family` does not take an editor theme (ERR_INVALID_ARGUMENT); its damaged or unbuildable settings are refused (ERR_THEME_INVALID). An editor theme's compile also writes its app copy in src/themes/<theme>/ from what it just built (its font stylesheet from the fonts the theme loads now), and --check also compares that copy once the theme's outputs are current: a copy that is kept back, missing a file or not the current build fails the check with the same check result (upToDate false, code ERR_THEME_STALE) and appCopyStale naming why. The copy's own files, its source included, are not compile targets (ERR_INVALID_ARGUMENT, naming the theme to compile)",
|
|
93
93
|
},
|
|
94
94
|
],
|
|
95
95
|
related: ['experimental theme add', 'experimental theme list'],
|
|
@@ -32,7 +32,7 @@ export const doc = {
|
|
|
32
32
|
flag: '--png',
|
|
33
33
|
param: 'options.png',
|
|
34
34
|
description:
|
|
35
|
-
'Also take PNG pictures of the previews (light and dark), with no dev server running: it needs a Playwright installed in the project or a Chrome or Chromium found on the machine, and adds a few seconds while the browser starts; without one, the result says how to get it. Each picture carries the editor stamp and is recorded, by name and content, in themes/<theme>/<theme>.pictures.json; a file of yours named like a picture (preview.png, sheet.png) is never written over: no picture is taken, and the result names the file',
|
|
35
|
+
'Also take PNG pictures of the previews (light and dark), with no dev server running: it needs a Playwright installed in the project or a Chrome or Chromium found on the machine, and adds a few seconds while the browser starts; without one, the result says how to get it. Each picture carries the editor stamp and is recorded, by name and content, in themes/<theme>/<theme>.pictures.json; a file of yours named like a picture (preview.png, sheet.png) is never written over: no picture is taken, and the result names the file. Taking pictures changes nothing in the app, except that show first brings the app copy (src/themes/<theme>/) and an in-app preview up to date after a hand edit to <theme>.theme.ts',
|
|
36
36
|
},
|
|
37
37
|
],
|
|
38
38
|
examples: [
|
|
@@ -54,7 +54,7 @@ export const doc = {
|
|
|
54
54
|
flag: '--mode <mode>',
|
|
55
55
|
param: 'options.mode',
|
|
56
56
|
description:
|
|
57
|
-
'light or dark: only that color mode. Colors only; sizes, numbers, fonts and shadows are the same in both modes
|
|
57
|
+
'light or dark: only that color mode. Colors only; sizes, numbers, fonts and shadows are the same in both modes. In a light-only or dark-only theme, it removes a setting saved for one mode (one made before the theme became one-mode)',
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
flag: '--only',
|
|
@@ -15,7 +15,7 @@ export const doc = {
|
|
|
15
15
|
summary:
|
|
16
16
|
'Make and change a theme one checked change at a time (dials, tokens, part styles), with previews',
|
|
17
17
|
description:
|
|
18
|
-
"A type-safe compiler for themes. A theme lives in themes/<theme>/: <theme>.settings.json holds the checked settings and is owned by this command; <theme>.settings.ts is generated from it on every change; <theme>.theme.ts extends it, is written once and is yours to edit; <theme>.css and <theme>.js are built from it; build them again with `astryx experimental theme compile themes/<theme>/<theme>.theme.ts`, which checks the editor's settings first. Every build also writes the theme's app copy, src/themes/<theme>/: a standard local theme (descriptor, source, built module and stylesheets), never edited by hand, so `astryx theme add <theme>` puts the theme into the app and `theme use`, `remove` and `list` take it as they take any local theme.
|
|
18
|
+
"A type-safe compiler for themes. A theme lives in themes/<theme>/: <theme>.settings.json holds the checked settings and is owned by this command; <theme>.settings.ts is generated from it on every change; <theme>.theme.ts extends it, is written once and is yours to edit; <theme>.css and <theme>.js are built from it; build them again with `astryx experimental theme compile themes/<theme>/<theme>.theme.ts`, which checks the editor's settings first. Every build also writes the theme's app copy, src/themes/<theme>/: a standard local theme (descriptor, source, built module and stylesheets), never edited by hand, so `astryx theme add <theme>` puts the theme into the app and `theme use`, `remove` and `list` take it as they take any local theme. Your own files in that folder are left as they are and the copy is written around them; a file, folder or link of yours at one of the copy's names, a link on the way to it, or a folder that cannot be written stops it, and every set, undo, show and compile says so (`appCopyStale`), with `compile --check` failing while the copy is behind or gone. Every change is CHECKED against what the installed Core's components really read (derived from Core itself, version for version, and cached under node_modules/.cache/) and against the token's type; a change that cannot take effect is refused, nothing is written, and the error leads with the command that works. The thing you set is a dial (a big move with named rungs: corners, spacing, font, headings, text-size, base, mode; or a color: accent, neutral, success, warning, danger, info, each generating its light and dark shades from one color for the color tokens, and vibrancy, how saturated they are), a design token by name, or a CSS property on a part. Where it applies: --on <part|group>, --when <prop>:<value>, --state <state>, --mode light|dark, --only. Every accepted change rebuilds and writes preview.html (the sample app page); `show` adds the theme-building page with every component. PNG pictures only with --png. Commands on one theme run one after the other, through a lock in node_modules/.cache/astryx-theme/ of the project; when node_modules cannot be written (a read-only install), changes are refused and `show` still reads the last build. `how` answers everything else: what a part, group, setting or aspect does, how the colors are made, plain-words questions (with exact commands), a picture's colors, and lists of what you can set. Experimental: it may change or be removed in a patch release.",
|
|
19
19
|
subcommands: ['new', 'set', 'undo', 'show', 'how'],
|
|
20
20
|
examples: [
|
|
21
21
|
{
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
summary:
|
|
13
13
|
'Make a new starter app with the theme preview inside, ready to install and run',
|
|
14
14
|
description:
|
|
15
|
-
"Writes a new starter app into <dir> (Next.js app router, Core and the neutral theme, with the Astryx packages pinned to this CLI's release; with --theme, Core and the base theme are pinned to the versions this project has, the ones the copied build was made on, with a note), with the theme preview route and its default pages (the sample app page and every component grouped) in src/app/theme-preview/. With --theme, the theme folder is copied into the app's themes/ and the pages wear it; a base theme or font package it needs is added to package.json. No install runs: it prints the install and dev commands and the page to open. <dir> must be new or empty, inside the
|
|
15
|
+
"Writes a new starter app into <dir> (Next.js app router, Core and the neutral theme, with the Astryx packages pinned to this CLI's release; with --theme, Core and the base theme are pinned to the versions this project has, the ones the copied build was made on, with a note), with the theme preview route and its default pages (the sample app page and every component grouped) in src/app/theme-preview/. With --theme, the theme folder is copied into the app's themes/ and the pages wear it; a base theme or font package it needs is added to package.json. No install runs: it prints the install and dev commands and the page to open. <dir> must be new or empty, inside the project folder (from a subfolder too); a folder that is not empty is refused, with a free folder name to use instead. Every check runs before the first write, so a refusal changes nothing. Later pages go in with `experimental theme preview add`, run in the new app. Every open font the theme names is added to package.json, at the version this project has or a pinned range, and the route imports it; a theme with generated colors gets the Colors page too, and a one-mode theme starts the route in its mode. The app is written into a temp folder beside the folder and moved into place, so a failure leaves nothing behind. A folder holding only .git, .DS_Store or Thumbs.db counts as empty. The folder is refused when it is a file, a dangling link, inside this app's routes folder, themes/, node_modules/ or Next's build folder (.next/, out/ or the distDir next.config names), or written with Windows separators, white space at either end or a name too long. A theme whose build is missing or older than its settings is built first, with a note. The app's home page links to the preview, and its .gitignore leaves out node_modules, next-env.d.ts and *.tsbuildinfo. Inside a project with a tsconfig.json, a note says to exclude the new folder. It takes one folder; more arguments are refused. With a theme, it holds that theme's lock while it builds and copies it, so an `editor set` on the same theme waits for it. A folder given from a subfolder of the project is taken from where it was given. An app is refused in public/ (served as files at the site root) and under a name Windows does not allow; a base theme passed to --theme is named as a package theme, installed or not, with the command that adds it. Experimental: it may change or be removed in a patch release.",
|
|
16
16
|
fn: 'themeEditPreviewApp',
|
|
17
17
|
args: [
|
|
18
18
|
{
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* astryx search dark mode Every word is part of the query
|
|
18
18
|
* astryx search modal --type component Filter to a single domain
|
|
19
19
|
* astryx search forms --limit 5 Cap the result count
|
|
20
|
-
* astryx search button --verbose Also print score / reason
|
|
20
|
+
* astryx search button --verbose Also print score / reason, whole descriptions
|
|
21
21
|
* astryx search button --json Typed JSON envelope
|
|
22
22
|
*/
|
|
23
23
|
|
|
@@ -32,6 +32,7 @@ import {cliError} from '../lib/cli-error.mjs';
|
|
|
32
32
|
import {defineCommand} from '../lib/define-command.mjs';
|
|
33
33
|
import {search as searchApi} from '../../../api/search/search.mjs';
|
|
34
34
|
import {Project} from '../../../foundation/config/project.mjs';
|
|
35
|
+
import {firstSentence} from '../../../foundation/text/string-utils.mjs';
|
|
35
36
|
import {warnOnIntegrationIssues} from '../../../foundation/integrations/integration-warnings.mjs';
|
|
36
37
|
import {doc as searchCommand} from './search.doc.mjs';
|
|
37
38
|
import {doc as searchFn} from '../../../api/search/search.doc.mjs';
|
|
@@ -183,6 +184,10 @@ export function registerSearch(program) {
|
|
|
183
184
|
command: formatCliCommand,
|
|
184
185
|
parent: formatCliCommand,
|
|
185
186
|
deprecated: formatDeprecation,
|
|
187
|
+
// The text view keeps a description's first sentence. A
|
|
188
|
+
// component, hook or doc result's command prints the whole doc;
|
|
189
|
+
// --verbose and --json keep the description whole.
|
|
190
|
+
...(options.verbose ? {} : {description: firstSentence}),
|
|
186
191
|
},
|
|
187
192
|
}),
|
|
188
193
|
...note,
|