@astryxdesign/cli 0.7.16 → 0.7.17-canary.g49a475f
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 +76 -86
- package/api/build/_adapter.d.mts +12 -0
- package/api/build/_adapter.mjs +51 -34
- package/api/build/blocks/blocks.d.mts +7 -5
- package/api/build/blocks/blocks.mjs +113 -26
- package/api/build/build.doc.mjs +4 -3
- package/api/build/build.type.d.mts +2 -2
- package/api/build/build.type.mjs +3 -3
- package/api/build/kit/kind.d.mts +2 -1
- package/api/build/kit/kind.mjs +199 -10
- package/api/build/kit/kit.mjs +6 -4
- package/api/build/kit/rank.d.mts +4 -2
- package/api/build/kit/rank.mjs +125 -24
- package/api/build/kit/start.d.mts +5 -4
- package/api/build/kit/start.mjs +12 -8
- package/api/build/kit/weights.d.mts +39 -3
- package/api/build/kit/weights.json +1 -1
- package/api/build/kit/weights.mjs +340 -43
- 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 +48 -0
- package/api/build/kit/words.mjs +90 -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 -6
- package/api/discover/_adapter.d.mts +1 -1
- package/api/discover/search/search.mjs +3 -2
- package/api/docs/_adapter.d.mts +26 -2
- package/api/docs/_adapter.mjs +219 -6
- 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 +83 -10
- package/api/doctor/built-checks.mjs +40 -14
- 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/icon/_records.mjs +2 -1
- package/api/index.d.mts +2 -0
- package/api/index.mjs +2 -0
- package/api/integration/_adapter.d.mts +44 -0
- package/api/integration/_adapter.mjs +77 -1
- package/api/integration/authoring-checks.mjs +6 -6
- package/api/integration/example-scope.d.mts +14 -0
- package/api/integration/example-scope.mjs +44 -0
- package/api/integration/example-scope.type.d.mts +29 -0
- package/api/integration/example-scope.type.mjs +25 -0
- package/api/integration/integrationExampleScope.doc.d.mts +11 -0
- package/api/integration/integrationExampleScope.doc.mjs +59 -0
- package/api/integration/validate-integration.mjs +19 -1
- package/api/integration/validate-integration.type.d.mts +9 -0
- package/api/integration/validate-integration.type.mjs +1 -1
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/render/_adapter.mjs +591 -195
- package/api/render/render.doc.mjs +11 -3
- package/api/render/render.type.d.mts +52 -0
- package/api/render/render.type.mjs +31 -1
- package/api/search/ORDERING.md +1 -1
- package/api/search/_adapter.d.mts +9 -0
- package/api/search/_adapter.mjs +85 -0
- package/api/search/_candidate-score.mjs +51 -32
- package/api/search/_fit-order.mjs +3 -3
- package/api/search/_gather-components.d.mts +3 -2
- package/api/search/_gather-components.mjs +12 -3
- package/api/search/_lexical.d.mts +5 -0
- package/api/search/_lexical.mjs +8 -2
- package/api/search/_result.d.mts +11 -9
- package/api/search/_result.mjs +4 -4
- package/api/search/_score.d.mts +6 -1
- package/api/search/_score.mjs +15 -3
- package/api/search/search-index.mjs +7 -1
- package/api/search/search.d.mts +1 -1
- package/api/theme/_adapter.mjs +12 -1
- package/api/theme/build/build.d.mts +75 -0
- package/api/theme/build/build.mjs +243 -58
- package/api/theme/build/font-warning.d.mts +7 -0
- package/api/theme/build/font-warning.mjs +17 -0
- package/api/theme/theme.type.d.mts +10 -0
- package/api/theme/theme.type.mjs +7 -1
- package/api/theme-edit/_adapter.d.mts +63 -2
- package/api/theme-edit/_adapter.mjs +771 -57
- package/api/theme-edit/_check.d.mts +40 -22
- package/api/theme-edit/_check.mjs +2029 -336
- package/api/theme-edit/_color.d.mts +10 -0
- package/api/theme-edit/_color.mjs +49 -1
- package/api/theme-edit/_compiler.mjs +9 -0
- package/api/theme-edit/_context.d.mts +3 -3
- package/api/theme-edit/_context.mjs +111 -48
- package/api/theme-edit/_css.d.mts +14 -0
- package/api/theme-edit/_css.mjs +46 -1
- package/api/theme-edit/_edit.d.mts +18 -4
- package/api/theme-edit/_edit.mjs +1685 -155
- package/api/theme-edit/_how-commands.d.mts +65 -0
- package/api/theme-edit/_how-commands.mjs +633 -1
- package/api/theme-edit/_how-question.d.mts +84 -0
- package/api/theme-edit/_how-question.mjs +5124 -281
- package/api/theme-edit/_how.mjs +140 -29
- package/api/theme-edit/_marks.d.mts +31 -5
- package/api/theme-edit/_marks.mjs +57 -5
- package/api/theme-edit/_name-rule.d.mts +11 -0
- package/api/theme-edit/_name-rule.mjs +12 -0
- package/api/theme-edit/_normal.d.mts +257 -0
- package/api/theme-edit/_normal.mjs +1252 -0
- package/api/theme-edit/_palette.mjs +10 -4
- package/api/theme-edit/_parts.d.mts +10 -1
- package/api/theme-edit/_parts.mjs +179 -3
- package/api/theme-edit/_preview-app.d.mts +7 -1
- package/api/theme-edit/_preview-app.mjs +515 -148
- package/api/theme-edit/_preview.d.mts +100 -14
- package/api/theme-edit/_preview.mjs +549 -137
- package/api/theme-edit/_settings.d.mts +347 -30
- package/api/theme-edit/_settings.mjs +2971 -327
- package/api/theme-edit/_tables.d.mts +6 -0
- package/api/theme-edit/_tables.mjs +44 -1
- package/api/theme-edit/_vet.d.mts +18 -0
- package/api/theme-edit/_vet.mjs +32 -0
- 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/themeEditHow.doc.mjs +1 -1
- package/api/theme-edit/themeEditNew.doc.d.mts +0 -1
- package/api/theme-edit/themeEditNew.doc.mjs +7 -4
- package/api/theme-edit/themeEditPreviewApp.doc.mjs +3 -3
- package/api/theme-edit/themeEditPreviewRemove.doc.mjs +2 -2
- package/api/upgrade/run/run.mjs +4 -3
- package/assets/codemods/integration-discovery.mjs +2 -1
- package/assets/codemods/run-codemod.mjs +87 -7
- 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/component-list.generated.json +1 -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/checks.doc.mjs +1 -1
- package/assets/docs/tree/cli-command.doc.mjs +2 -3
- package/assets/docs/tree/render-pages.doc.mjs +44 -3
- package/assets/docs/tree/single-component.doc.mjs +4 -0
- 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/search-catalog.generated.json +2 -0
- 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/Hooks/useContainerRevealHookUsage.tsx +2 -2
- 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 +5 -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 +2 -8
- 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/kanban-board/template.doc.mjs +1 -9
- 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 -9
- package/assets/templates/pages/work-item-detail/template.doc.mjs +1 -0
- package/assets/theme.template.ts +6 -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/component/categories.d.mts +37 -0
- package/authoring/doctypes/component/categories.mjs +54 -0
- package/authoring/doctypes/template/template.doc.mjs +1 -1
- package/authoring/doctypes/template/type.ts +9 -0
- package/authoring/example/example.doc.d.mts +12 -0
- package/authoring/example/example.doc.mjs +69 -0
- package/authoring/example/preview.d.mts +92 -0
- package/authoring/example/preview.mjs +994 -0
- package/authoring/example/type.ts +102 -0
- package/authoring/index.d.mts +1 -0
- package/authoring/index.d.ts +12 -0
- package/authoring/index.mjs +3 -1
- 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 +22 -3
- package/clients/cli/commands/docs.doc.mjs +7 -1
- package/clients/cli/commands/docs.mjs +3 -1
- package/clients/cli/commands/doctor.mjs +32 -14
- package/clients/cli/commands/experimental/render.mjs +42 -1
- package/clients/cli/commands/experimental/theme.mjs +163 -28
- 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-how.doc.mjs +87 -1
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +10 -3
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
- 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/experimental-theme-preview-remove.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-preview.doc.mjs +2 -1
- package/clients/cli/commands/experimental-theme.doc.mjs +5 -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 +209 -8
- package/clients/cli/commands/upgrade.mjs +42 -7
- package/clients/cli/index.mjs +1 -1
- package/clients/cli/lib/cli-error.mjs +2 -1
- package/clients/cli/lib/component-format.mjs +205 -98
- package/clients/cli/lib/hook-format.mjs +9 -19
- package/clients/cli/lib/json-shim.mjs +77 -21
- package/clients/cli/lib/manifest.mjs +3 -2
- 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/authoring-self-docs.mjs +1 -0
- package/foundation/discovery/component-discovery.d.mts +11 -0
- package/foundation/discovery/component-discovery.mjs +56 -8
- package/foundation/discovery/component-replacement.mjs +130 -1
- package/foundation/discovery/copied-passages.mjs +2 -1
- package/foundation/discovery/doc-types.mjs +4 -3
- 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 +22 -8
- package/foundation/discovery/icon-definition-discovery.mjs +2 -1
- package/foundation/discovery/icon-set-checks.mjs +2 -1
- package/foundation/discovery/icon-set-discovery.mjs +2 -1
- package/foundation/discovery/integration-doc-files.mjs +2 -1
- package/foundation/discovery/package-exports.d.mts +10 -0
- package/foundation/discovery/package-exports.mjs +56 -3
- package/foundation/discovery/prop-drift.mjs +9 -9
- package/foundation/discovery/runner-allowlist.d.mts +1 -0
- package/foundation/discovery/runner-allowlist.mjs +2 -0
- package/foundation/discovery/stored-component-list.d.mts +43 -0
- package/foundation/discovery/stored-component-list.mjs +90 -0
- package/foundation/discovery/stored-search-catalog.d.mts +115 -0
- package/foundation/discovery/stored-search-catalog.mjs +297 -0
- package/foundation/discovery/stored-self-audit.d.mts +26 -10
- package/foundation/discovery/stored-self-audit.mjs +38 -18
- package/foundation/discovery/template-adapter.d.mts +52 -0
- package/foundation/discovery/template-adapter.mjs +176 -12
- package/foundation/discovery/template-icons.mjs +2 -1
- package/foundation/discovery/theme-discovery.mjs +3 -2
- package/foundation/discovery/theme-imports.d.mts +14 -0
- package/foundation/discovery/theme-imports.mjs +43 -1
- package/foundation/discovery/theming-targets.mjs +3 -2
- package/foundation/doc-compiler/import.mjs +7 -1
- package/foundation/doc-compiler/inputs.mjs +3 -2
- 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/env/semver.mjs +3 -1
- package/foundation/fonts/font-stylesheet.d.mts +31 -0
- package/foundation/fonts/font-stylesheet.mjs +115 -0
- package/foundation/fs/cache-eviction.d.mts +21 -0
- package/foundation/fs/cache-eviction.mjs +73 -0
- package/foundation/fs/file-protection.mjs +4 -3
- package/foundation/fs/gather-cache.d.mts +25 -4
- package/foundation/fs/gather-cache.mjs +164 -55
- 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/listing-cache.d.mts +7 -0
- package/foundation/fs/listing-cache.mjs +10 -0
- package/foundation/fs/module-loader.d.mts +24 -2
- package/foundation/fs/module-loader.mjs +94 -21
- package/foundation/fs/paths.d.mts +18 -0
- package/foundation/fs/paths.mjs +15 -2
- package/foundation/identity/provider-identity.d.mts +6 -0
- package/foundation/identity/provider-identity.mjs +10 -1
- package/foundation/integrations/contribution-inventory.mjs +4 -3
- package/foundation/integrations/example-code.d.mts +63 -0
- package/foundation/integrations/example-code.mjs +416 -0
- package/foundation/integrations/public-imports.d.mts +9 -0
- package/foundation/integrations/public-imports.mjs +3 -2
- package/foundation/integrations/validate-contributions.mjs +17 -45
- package/foundation/render/embedded-files.d.mts +6 -0
- package/foundation/render/embedded-files.mjs +25 -5
- package/foundation/render/embedded-imports.d.mts +39 -7
- package/foundation/render/embedded-imports.mjs +66 -27
- 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 +121 -13
- package/foundation/render/picture-chrome.d.mts +4 -0
- package/foundation/render/picture-chrome.mjs +185 -0
- package/foundation/render/picture-playwright.d.mts +4 -0
- package/foundation/render/picture-playwright.mjs +34 -0
- package/foundation/render/rebuild.mjs +2 -1
- package/foundation/render/render-page.d.mts +35 -3
- package/foundation/render/render-page.mjs +316 -42
- package/foundation/render/source-block.d.mts +85 -6
- package/foundation/render/source-block.mjs +211 -20
- package/foundation/render/ts-paths.d.mts +69 -6
- package/foundation/render/ts-paths.mjs +326 -40
- package/foundation/response/error-codes.d.mts +3 -1
- package/foundation/response/error-codes.d.ts +1 -0
- package/foundation/response/error-codes.doc.mjs +12 -1
- package/foundation/response/error-codes.mjs +11 -1
- package/foundation/response/response-types.doc.mjs +2 -2
- package/foundation/text/compare-text.d.mts +14 -0
- package/foundation/text/compare-text.mjs +68 -0
- package/foundation/text/string-utils.d.mts +3 -2
- package/foundation/text/string-utils.mjs +18 -4
- package/foundation/text/suggest-order.d.mts +9 -0
- package/foundation/text/suggest-order.mjs +15 -1
- package/foundation/xle/expand.mjs +2 -1
- package/host/index.mjs +8 -6
- package/package.json +7 -6
|
@@ -11,7 +11,7 @@ export const doc = {
|
|
|
11
11
|
stability: 'experimental',
|
|
12
12
|
summary: 'Remove one page from the theme preview, or the whole preview',
|
|
13
13
|
description:
|
|
14
|
-
'Removes one page and its nav item, and rewrites the route. With no page, or for the last page, it removes the whole preview: only the files the preview wrote (theme-preview.json lists them) are deleted, and the folder only when nothing else is in it. A path in theme-preview.json that leads outside the route folder is
|
|
14
|
+
'Removes one page and its nav item, and rewrites the route. With no page, or for the last page, it removes the whole preview: only the files the preview wrote (theme-preview.json lists them) are deleted, and the folder only when nothing else is in it. A path in theme-preview.json that leads outside the route folder is dropped from the record and named in a note; nothing outside the folder is deleted. Only files the preview wrote are deleted: a page file it did not write, or one changed by hand since it wrote it (by the hash theme-preview.json records), is kept and named in `kept`, with a note; files already gone are named in `missing`, and the route and Colors page written again in `rewritten`. Every check runs before the first delete: the theme the route wears is loaded first, so a theme that does not load is refused with nothing deleted, and the refusal names the whole-preview remove, which needs no theme. A theme that is gone is replaced by the theme of the app itself, with a note. A page id matches in any case. A damaged theme-preview.json (not JSON, the wrong shape, a duplicate page, a folder or an absolute path in its files) is refused with `ERR_THEME_INVALID`, naming the file. With no folder given and no preview in the default place, a preview recorded for a theme is used. It takes one page; more arguments are refused. A whole remove stops, deleting nothing, when page.tsx was changed by hand: it imports the pages. A page whose file is gone leaves the nav, with a note. Refusals never suggest deleting files. Preview commands in one project run one after another. A remove deletes only the route file, the record and the page files of recorded pages (in _pages/, or pages/ for an older release), and only when a recorded hash shows they are as the preview wrote them: any other file the record names, and any file with no recorded hash, is kept and named, so a copied or edited record never deletes a project file. A route that stays keeps the pages it imports. Experimental: it may change or be removed in a patch release.',
|
|
15
15
|
fn: 'themeEditPreviewRemove',
|
|
16
16
|
args: [
|
|
17
17
|
{
|
|
@@ -52,7 +52,7 @@ export const doc = {
|
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
code: 1,
|
|
55
|
-
when: 'there is no preview, it has no such page, theme-preview.json is damaged
|
|
55
|
+
when: 'there is no preview, it has no such page, theme-preview.json is damaged, the theme the route wears does not load (ERR_THEME_INVALID, ERR_UNKNOWN_THEME, ERR_THEME_LOAD), another preview command did not finish within 30 seconds (ERR_THEME_BUSY), the route file was changed by hand, a write failed, more than one page, or outside a project',
|
|
56
56
|
},
|
|
57
57
|
],
|
|
58
58
|
related: ['experimental theme preview'],
|
|
@@ -12,7 +12,8 @@ export const doc = {
|
|
|
12
12
|
displayName: 'astryx experimental theme preview',
|
|
13
13
|
namespace: 'cli/commands',
|
|
14
14
|
stability: 'experimental',
|
|
15
|
-
summary:
|
|
15
|
+
summary:
|
|
16
|
+
'A page in your app that shows the theme on real pages, or a starter app (preview app) when there is none',
|
|
16
17
|
description:
|
|
17
18
|
"One route in the app, a normal page that keeps the app's layout, global CSS and providers: an app shell with a side nav item per preview page and a top bar with the theme name and, when it wears a theme made by `editor`, a light, dark and system switch. `add` adds pages (the default pages, the best template pages for a description, or one template) and writes the route the first time; `list` lists them; `remove` removes one, or the whole preview. With no app, `app <dir>` makes a starter app with the preview in it. Pictures of a theme are on `experimental theme editor show`. Experimental: it may change or be removed in a patch release.",
|
|
18
19
|
subcommands: ['add', 'app', 'list', 'remove'],
|
|
@@ -15,7 +15,7 @@ export const doc = {
|
|
|
15
15
|
summary:
|
|
16
16
|
'Make and change a theme one checked change at a time, preview it in the app, and the experimental copies of the theme commands',
|
|
17
17
|
description:
|
|
18
|
-
"Themes, experimental. `editor` makes and changes a theme one checked change at a time: every change is checked against what the installed Core's components really read, and a change that cannot take effect is refused. `preview` writes a page into the app that shows the theme on real pages. The group also carries experimental copies of the `astryx theme` commands (compile, the copy of theme build; list, add, remove, use, eject, template, targets), with the same functions and output. Colors come from `editor set` (accent, neutral, success, warning, danger, info, vibrancy), which generates them, so the group has no command of its own for that. Experimental: it may change or be removed in a patch release.",
|
|
18
|
+
"Themes, experimental. `editor` makes and changes a theme one checked change at a time: every change is checked against what the installed Core's components really read, and a change that cannot take effect is refused. `preview` writes a page into the app that shows the theme on real pages; with no app yet, `preview app <dir>` makes a starter app that shows it. The group also carries experimental copies of the `astryx theme` commands (compile, the copy of theme build; list, add, remove, use, eject, template, targets), with the same functions and output. Colors come from `editor set` (accent, neutral, success, warning, danger, info, vibrancy), which generates them, so the group has no command of its own for that. Experimental: it may change or be removed in a patch release.",
|
|
19
19
|
subcommands: [
|
|
20
20
|
'editor',
|
|
21
21
|
'preview',
|
|
@@ -33,6 +33,10 @@ export const doc = {
|
|
|
33
33
|
label: 'Start a theme',
|
|
34
34
|
cli: 'astryx experimental theme editor new brand --like neutral',
|
|
35
35
|
},
|
|
36
|
+
{
|
|
37
|
+
label: 'No app yet: a starter app that shows the theme',
|
|
38
|
+
cli: 'astryx experimental theme preview app theme-app',
|
|
39
|
+
},
|
|
36
40
|
{
|
|
37
41
|
label: 'Round everything',
|
|
38
42
|
cli: 'astryx experimental theme editor set brand corners pill',
|
|
@@ -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,
|
|
@@ -18,6 +18,7 @@ import {template as templateApi} from '../../../api/template/template.mjs';
|
|
|
18
18
|
import {Project} from '../../../foundation/config/project.mjs';
|
|
19
19
|
import {warnOnIntegrationIssues} from '../../../foundation/integrations/integration-warnings.mjs';
|
|
20
20
|
import {getCliInvocation} from '../../../foundation/env/package-manager.mjs';
|
|
21
|
+
import {firstSentence} from '../../../foundation/text/string-utils.mjs';
|
|
21
22
|
import {defineCommand} from '../lib/define-command.mjs';
|
|
22
23
|
import {NO_RESULT_SET, resultSet} from '../../../foundation/debug/index.mjs';
|
|
23
24
|
import {doc as templateCommand} from './template.doc.mjs';
|
|
@@ -236,12 +237,13 @@ export function registerTemplate(program) {
|
|
|
236
237
|
|
|
237
238
|
// Project each entry to its JSON-mirroring fields; the WIP marker is
|
|
238
239
|
// folded into `name` (as before) and the package is shown only when it
|
|
239
|
-
// isn't the built-in core package.
|
|
240
|
+
// isn't the built-in core package. The text keeps a description's
|
|
241
|
+
// first sentence; --json keeps it whole.
|
|
240
242
|
/** @param {import('../../../api/template/template.type.mjs').TemplateListEntry} t */
|
|
241
243
|
const toRow = t => ({
|
|
242
244
|
id: t.id,
|
|
243
245
|
name: t.isReady ? t.name : `${t.name} (WIP)`,
|
|
244
|
-
description: t.description,
|
|
246
|
+
description: firstSentence(t.description ?? ''),
|
|
245
247
|
package:
|
|
246
248
|
t.package && t.package !== '@astryxdesign/core'
|
|
247
249
|
? t.package
|
|
@@ -23,7 +23,11 @@ export const doc = {
|
|
|
23
23
|
'With --check it writes nothing and reports source drift. --icons-specifier keeps ' +
|
|
24
24
|
'its existing generated-module behavior. It prints one line per built theme and ' +
|
|
25
25
|
'one line naming fonts the themes do not load; --detail full adds the install ' +
|
|
26
|
-
'example and the font recipe, once for a batch.'
|
|
26
|
+
'example and the font recipe, once for a batch. A source that also exports ' +
|
|
27
|
+
"`colorModes` (`['light']` or `['dark']`) for a theme with one color mode gets " +
|
|
28
|
+
'the same export in its built module, which `theme add` reads to wire the theme ' +
|
|
29
|
+
'in that mode; any other value is ignored without a warning, and a --family ' +
|
|
30
|
+
'build never writes the export.',
|
|
27
31
|
fn: 'themeBuild',
|
|
28
32
|
args: [{name: 'files', param: 'file', required: true, variadic: true}],
|
|
29
33
|
options: [
|
|
@@ -14,7 +14,7 @@ export const doc = {
|
|
|
14
14
|
summary:
|
|
15
15
|
'Add, switch, build, and author themes (to make or change one, use experimental theme editor)',
|
|
16
16
|
description:
|
|
17
|
-
'To make or change a theme (colors, fonts, corners, spacing, a look from a picture), use the experimental theme editor: `astryx experimental theme editor new <name> --like neutral`, then `editor set` and `editor how`; it writes and checks the theme, and `astryx theme add <name>` wires it. Look at every change with `astryx experimental theme editor show <name> --png` (pictures
|
|
17
|
+
'To make or change a theme (colors, fonts, corners, spacing, a look from a picture), use the experimental theme editor: `astryx experimental theme editor new <name> --like neutral`, then `editor set` and `editor how`; it writes and checks the theme, and `astryx theme add <name>` wires it. Look at every change with `astryx experimental theme editor show <name> --png` (takes pictures of real components): a theme change is not done until you have looked. The theme command group. Add built themes to an app, choose its default, remove them, list available and added themes, or eject source to make a local fork. The authoring commands build themes, generate palettes, write the annotated template, and list component theme targets.',
|
|
18
18
|
subcommands: [
|
|
19
19
|
'build',
|
|
20
20
|
'list',
|
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
|
|
32
32
|
import * as fs from 'node:fs';
|
|
33
33
|
import * as path from 'node:path';
|
|
34
|
+
import {
|
|
35
|
+
fontKey,
|
|
36
|
+
stylesheetFontFamilies,
|
|
37
|
+
} from '../../../foundation/fonts/font-stylesheet.mjs';
|
|
34
38
|
import {fileURLToPath} from 'node:url';
|
|
35
39
|
import {spawn} from 'node:child_process';
|
|
36
40
|
import {
|
|
@@ -85,6 +89,7 @@ import {
|
|
|
85
89
|
themeSourceFiles,
|
|
86
90
|
themeSourceGuesses,
|
|
87
91
|
buildSuggestion,
|
|
92
|
+
generatedSourceCommand,
|
|
88
93
|
writeDeferredBuildOutputs,
|
|
89
94
|
} from '../../../api/theme/build/build.mjs';
|
|
90
95
|
import {defineCommand} from '../lib/define-command.mjs';
|
|
@@ -119,13 +124,42 @@ import {doc as themePaletteGenerateFn} from '../../../api/theme/themePaletteGene
|
|
|
119
124
|
* @property {string} build - The build subcommand's name: `build` or `compile`.
|
|
120
125
|
* @property {(err: import('../../../api/error.mjs').AstryxError, cwd: string) => import('../../../api/error.mjs').AstryxError | null} [explain] - A clearer refusal for this group, or null.
|
|
121
126
|
* @property {(files: string[], options: {cwd: string, check?: boolean, family?: boolean, iconsSpecifier?: string, out?: string}) => Promise<import('../../../api/error.mjs').AstryxError | null>} [preflight] - A refusal before a build starts, or null.
|
|
122
|
-
* @property {(
|
|
127
|
+
* @property {(err: import('../../../api/error.mjs').AstryxError, cwd: string) => Promise<import('../../../api/error.mjs').AstryxError>} [follow] - The refusal with its first suggested build checked and repaired as the build would check it.
|
|
128
|
+
* @property {(files: string[], options: {cwd: string, check?: boolean, out?: string}) => Promise<() => Promise<void>>} [hold] - Locks held while a build or check runs; resolves to their release.
|
|
129
|
+
* @property {(file: string, cwd: string, opts: {check: boolean, upToDate?: boolean, out?: string}) => Record<string, unknown> | null | Promise<Record<string, unknown> | null>} [extraData] - Fields a group adds to a build's result data (the editor's `appCopyStale`); in a check, `upToDate: false` fails it.
|
|
130
|
+
* @property {(file: string, cwd: string) => (['light'] | ['dark'] | null)} [colorModes] - The one color mode a theme file has that the file itself cannot say, for the build to write into the built module.
|
|
131
|
+
* @property {(file: string, cwd: string) => ((family: string) => boolean) | null | Promise<((family: string) => boolean) | null>} [loadedFonts] - Font families the app loads for a theme file that the file itself cannot say, so the build does not name them as unloaded.
|
|
123
132
|
* @property {(file: string, cwd: string) => {name: string, reason: string} | null} [missingSource] - For a source file that is not there, this group's way to write it again, or null.
|
|
124
133
|
* @property {(options: {targetPath?: string, overwrite?: boolean, cwd?: string}) => import('../../../api/theme/theme.type.mjs').ThemeTemplateResponse} [template] - This group's template write, in place of `themeTemplate`.
|
|
125
134
|
*/
|
|
126
135
|
|
|
127
136
|
/** @type {ThemeCommandWords} */
|
|
128
|
-
const THEME_WORDS = {
|
|
137
|
+
const THEME_WORDS = {
|
|
138
|
+
group: 'theme',
|
|
139
|
+
build: 'build',
|
|
140
|
+
loadedFonts: fontsLoadedBeside,
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The font families a local theme's font stylesheet loads: the
|
|
145
|
+
* `<slug>.fonts.css` beside its source, where the theme's folder is named
|
|
146
|
+
* for its slug (the one font stylesheet `theme add` imports for it), read
|
|
147
|
+
* with its imports (an @fontsource package by its name, a stylesheet by its
|
|
148
|
+
* @font-face rules or the `family=` it requests). A build of that source
|
|
149
|
+
* does not name those families as unloaded. Another stylesheet in the
|
|
150
|
+
* folder loads nothing for the app, so it counts for nothing. Null when the
|
|
151
|
+
* theme has no font stylesheet.
|
|
152
|
+
* @param {string} file the theme source, as given
|
|
153
|
+
* @param {string} cwd
|
|
154
|
+
* @returns {((family: string) => boolean) | null}
|
|
155
|
+
*/
|
|
156
|
+
function fontsLoadedBeside(file, cwd) {
|
|
157
|
+
const dir = path.dirname(path.resolve(cwd, file));
|
|
158
|
+
const sheet = path.join(dir, `${path.basename(dir)}.fonts.css`);
|
|
159
|
+
if (!fs.existsSync(sheet)) return null;
|
|
160
|
+
const loaded = stylesheetFontFamilies(sheet);
|
|
161
|
+
return loaded.size ? family => loaded.has(fontKey(family)) : null;
|
|
162
|
+
}
|
|
129
163
|
|
|
130
164
|
/**
|
|
131
165
|
* Text as the group that ran the command words it: under `experimental
|
|
@@ -200,6 +234,9 @@ function themeError(err, words = THEME_WORDS, fallback = []) {
|
|
|
200
234
|
/** @param {string} text */
|
|
201
235
|
const local = text => inGroupWords(text, words);
|
|
202
236
|
const given = err.suggestions || [];
|
|
237
|
+
// Suggested commands stay bare (`astryx …`): the JSON envelope carries
|
|
238
|
+
// them so, and the text output starts them the way this project runs the
|
|
239
|
+
// CLI.
|
|
203
240
|
return cliError(local(err.message), {
|
|
204
241
|
suggestions: (given.length > 0 ? given : fallback).map(x => ({
|
|
205
242
|
...x,
|
|
@@ -629,6 +666,7 @@ function printThemeApp(result) {
|
|
|
629
666
|
'stylesheet',
|
|
630
667
|
'fontStylesheet',
|
|
631
668
|
'source',
|
|
669
|
+
'mode',
|
|
632
670
|
],
|
|
633
671
|
layout: 'stacked',
|
|
634
672
|
}),
|
|
@@ -641,6 +679,7 @@ function printThemeApp(result) {
|
|
|
641
679
|
slug: change.slug,
|
|
642
680
|
changed: change.changed,
|
|
643
681
|
firstAdd: change.firstAdd,
|
|
682
|
+
...(change.wireModes ? {wireModes: true} : {}),
|
|
644
683
|
},
|
|
645
684
|
],
|
|
646
685
|
{
|
|
@@ -651,20 +690,40 @@ function printThemeApp(result) {
|
|
|
651
690
|
'slug',
|
|
652
691
|
'changed',
|
|
653
692
|
'firstAdd',
|
|
693
|
+
'wireModes',
|
|
654
694
|
],
|
|
655
695
|
layout: 'stacked',
|
|
656
696
|
},
|
|
657
697
|
),
|
|
658
698
|
);
|
|
659
699
|
for (const note of result.data.notes ?? []) emit(text(`[note] ${note}`));
|
|
660
|
-
if (!change.firstAdd) return;
|
|
661
700
|
const stem = path.basename(modulePath, path.extname(modulePath));
|
|
701
|
+
if (!change.firstAdd) {
|
|
702
|
+
// The module now lists one-mode themes' modes: the app's wiring, made
|
|
703
|
+
// without them, passes the selected theme's mode from now on.
|
|
704
|
+
if (change.wireModes)
|
|
705
|
+
emit(
|
|
706
|
+
text(
|
|
707
|
+
"The theme module now exports themeModes. Pass the selected theme's mode to Theme in the app root:",
|
|
708
|
+
),
|
|
709
|
+
code(
|
|
710
|
+
"import {Theme} from '@astryxdesign/core/theme';\n" +
|
|
711
|
+
`import {themes, defaultThemeSlug, themeModes} from './${stem}';\n\n` +
|
|
712
|
+
"<Theme theme={themes[defaultThemeSlug]} mode={themeModes[defaultThemeSlug] ?? 'system'}>\n <App />\n</Theme>",
|
|
713
|
+
),
|
|
714
|
+
);
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
// With a theme of one color mode added, the generated module lists each
|
|
718
|
+
// such theme's mode in `themeModes`, and the wiring passes the selected
|
|
719
|
+
// theme's (none for a two-mode theme, which follows the system).
|
|
720
|
+
const modes = result.data.themes.some(t => t.mode);
|
|
662
721
|
emit(
|
|
663
722
|
text('Wire the generated module once in the app root:'),
|
|
664
723
|
code(
|
|
665
724
|
"import {Theme} from '@astryxdesign/core/theme';\n" +
|
|
666
|
-
`import {themes, defaultThemeSlug} from './${stem}';\n\n` +
|
|
667
|
-
|
|
725
|
+
`import {themes, defaultThemeSlug${modes ? ', themeModes' : ''}} from './${stem}';\n\n` +
|
|
726
|
+
`<Theme theme={themes[defaultThemeSlug]}${modes ? " mode={themeModes[defaultThemeSlug] ?? 'system'}" : ''}>\n <App />\n</Theme>`,
|
|
668
727
|
),
|
|
669
728
|
);
|
|
670
729
|
}
|
|
@@ -996,6 +1055,28 @@ function registerThemeCommands(theme, program, docs, words) {
|
|
|
996
1055
|
const rewrite = looksGlobby
|
|
997
1056
|
? null
|
|
998
1057
|
: (words.missingSource?.(entry.file, process.cwd()) ?? null);
|
|
1058
|
+
// A file another command generates, gone from a folder whose other
|
|
1059
|
+
// files carry that command's mark: that command writes it again; a
|
|
1060
|
+
// blank theme template is no way back.
|
|
1061
|
+
const by =
|
|
1062
|
+
rewrite || looksGlobby
|
|
1063
|
+
? null
|
|
1064
|
+
: generatedSourceCommand(entry.filePath);
|
|
1065
|
+
if (by)
|
|
1066
|
+
return cliError(
|
|
1067
|
+
`File not found: ${entry.filePath}. It is a generated file: the files beside it are written by ${by}, so rebuild it with the command that made it.`,
|
|
1068
|
+
{
|
|
1069
|
+
code: ERROR_CODES.ERR_FILE_NOT_FOUND,
|
|
1070
|
+
suggestions: /^astryx(\s|$)/.test(by)
|
|
1071
|
+
? [
|
|
1072
|
+
{
|
|
1073
|
+
name: `${getCliInvocation(process.cwd())} ${by.replace(/^astryx\s*/, '')}`.trim(),
|
|
1074
|
+
reason: 'the command that writes these files',
|
|
1075
|
+
},
|
|
1076
|
+
]
|
|
1077
|
+
: [],
|
|
1078
|
+
},
|
|
1079
|
+
);
|
|
999
1080
|
return cliError(`File not found: ${entry.filePath}`, {
|
|
1000
1081
|
code: ERROR_CODES.ERR_FILE_NOT_FOUND,
|
|
1001
1082
|
suggestions: rewrite
|
|
@@ -1111,6 +1192,21 @@ function registerThemeCommands(theme, program, docs, words) {
|
|
|
1111
1192
|
// Its key is required exactly with --family, and options that describe one
|
|
1112
1193
|
// standalone output or a long-running loop remain intentionally separate.
|
|
1113
1194
|
if (Boolean(options.family) !== Boolean(options.familyKey)) {
|
|
1195
|
+
// The suggestion below builds each theme on its own; a group that
|
|
1196
|
+
// refuses that build too (an editor theme run from a subfolder)
|
|
1197
|
+
// answers with its own refusal, whose suggestion runs.
|
|
1198
|
+
const own = await words.preflight?.(files, {
|
|
1199
|
+
cwd: process.cwd(),
|
|
1200
|
+
check: options.check,
|
|
1201
|
+
family: false,
|
|
1202
|
+
iconsSpecifier: options.iconsSpecifier,
|
|
1203
|
+
out: files.length === 1 ? options.out : undefined,
|
|
1204
|
+
});
|
|
1205
|
+
if (own)
|
|
1206
|
+
return themeError(
|
|
1207
|
+
(await words.follow?.(own, process.cwd())) ?? own,
|
|
1208
|
+
words,
|
|
1209
|
+
);
|
|
1114
1210
|
return cliError(
|
|
1115
1211
|
options.family
|
|
1116
1212
|
? '--family requires --family-key <key>'
|
|
@@ -1229,7 +1325,12 @@ function registerThemeCommands(theme, program, docs, words) {
|
|
|
1229
1325
|
iconsSpecifier: options.iconsSpecifier,
|
|
1230
1326
|
out: options.out,
|
|
1231
1327
|
});
|
|
1232
|
-
if (refused)
|
|
1328
|
+
if (refused)
|
|
1329
|
+
return themeError(
|
|
1330
|
+
(await words.follow?.(refused, process.cwd())) ?? refused,
|
|
1331
|
+
words,
|
|
1332
|
+
buildFallback,
|
|
1333
|
+
);
|
|
1233
1334
|
|
|
1234
1335
|
if (options.family) {
|
|
1235
1336
|
try {
|
|
@@ -1308,6 +1409,48 @@ function registerThemeCommands(theme, program, docs, words) {
|
|
|
1308
1409
|
const writes = [];
|
|
1309
1410
|
const log = logger.log;
|
|
1310
1411
|
const warn = logger.warn;
|
|
1412
|
+
// A group may know fonts the app loads that the theme file cannot
|
|
1413
|
+
// say (the editor's app copy stylesheet): those are not named as
|
|
1414
|
+
// unloaded, in the notices, the trailer or the full help.
|
|
1415
|
+
const loads =
|
|
1416
|
+
(await words.loadedFonts?.(entry.file, process.cwd())) ?? null;
|
|
1417
|
+
/** @param {string} msg */
|
|
1418
|
+
const namesOnlyLoaded = msg => {
|
|
1419
|
+
// The families the notice names: on its first line, after the
|
|
1420
|
+
// theme's own name.
|
|
1421
|
+
const line =
|
|
1422
|
+
msg
|
|
1423
|
+
.split('\n')
|
|
1424
|
+
.find(l => /not load/.test(l))
|
|
1425
|
+
?.replace(/^.*?(names fonts it does not load:|Font )/, '') ?? '';
|
|
1426
|
+
const fonts = [...line.matchAll(/"([^"]+)"/g)].map(m => m[1]);
|
|
1427
|
+
return (
|
|
1428
|
+
Boolean(loads) && fonts.length > 0 && fonts.every(f => loads?.(f))
|
|
1429
|
+
);
|
|
1430
|
+
};
|
|
1431
|
+
// A check whose result a group may still fail holds its lines
|
|
1432
|
+
// until the group has looked.
|
|
1433
|
+
/** @type {Array<string | undefined> | null} */
|
|
1434
|
+
let held = null;
|
|
1435
|
+
if (options.check && words.extraData && !deferred) {
|
|
1436
|
+
held = [];
|
|
1437
|
+
logger.log = (/** @type {string | undefined} */ message) => {
|
|
1438
|
+
held?.push(message);
|
|
1439
|
+
};
|
|
1440
|
+
}
|
|
1441
|
+
if (loads && !deferred && !held) {
|
|
1442
|
+
logger.log = (/** @type {string | undefined} */ message) => {
|
|
1443
|
+
if (
|
|
1444
|
+
typeof message === 'string' &&
|
|
1445
|
+
/names fonts it does not load|named by this theme but not loaded/.test(
|
|
1446
|
+
message,
|
|
1447
|
+
) &&
|
|
1448
|
+
namesOnlyLoaded(message)
|
|
1449
|
+
)
|
|
1450
|
+
return;
|
|
1451
|
+
log.call(logger, message);
|
|
1452
|
+
};
|
|
1453
|
+
}
|
|
1311
1454
|
if (deferred) {
|
|
1312
1455
|
logger.log = (/** @type {string | undefined} */ message) => {
|
|
1313
1456
|
lines.push(() => log.call(logger, message));
|
|
@@ -1327,6 +1470,7 @@ function registerThemeCommands(theme, program, docs, words) {
|
|
|
1327
1470
|
claimedOutputs,
|
|
1328
1471
|
deferredWrites: deferred ? writes : undefined,
|
|
1329
1472
|
commandWords: words,
|
|
1473
|
+
colorModes: words.colorModes?.(entry.file, process.cwd()) ?? null,
|
|
1330
1474
|
};
|
|
1331
1475
|
let result;
|
|
1332
1476
|
if (report) {
|
|
@@ -1338,6 +1482,19 @@ function registerThemeCommands(theme, program, docs, words) {
|
|
|
1338
1482
|
handOff,
|
|
1339
1483
|
);
|
|
1340
1484
|
result = built.receipt;
|
|
1485
|
+
if (loads && built.trailer) {
|
|
1486
|
+
const named = (/** @type {string} */ msg) =>
|
|
1487
|
+
built.trailer?.unloadedFonts.some(
|
|
1488
|
+
(/** @type {string} */ f) =>
|
|
1489
|
+
loads(f) && msg.includes(`"${f}"`),
|
|
1490
|
+
) ?? false;
|
|
1491
|
+
built.trailer.fontNotices = built.trailer.fontNotices.filter(
|
|
1492
|
+
(/** @type {string} */ m) => !named(m),
|
|
1493
|
+
);
|
|
1494
|
+
built.trailer.unloadedFonts = built.trailer.unloadedFonts.filter(
|
|
1495
|
+
(/** @type {string} */ f) => !loads(f),
|
|
1496
|
+
);
|
|
1497
|
+
}
|
|
1341
1498
|
if (built.trailer) trailers.push(built.trailer);
|
|
1342
1499
|
if (compact && result?.type === 'theme.build') {
|
|
1343
1500
|
const {outputs, sizeKB, tokenCount, componentCount} = result.data;
|
|
@@ -1360,6 +1517,37 @@ function registerThemeCommands(theme, program, docs, words) {
|
|
|
1360
1517
|
}
|
|
1361
1518
|
logger.log = log;
|
|
1362
1519
|
logger.warn = warn;
|
|
1520
|
+
const data = /** @type {any} */ (result)?.data;
|
|
1521
|
+
if (loads && data && Array.isArray(data.notices))
|
|
1522
|
+
data.notices = data.notices.filter(
|
|
1523
|
+
(/** @type {string} */ m) =>
|
|
1524
|
+
!(
|
|
1525
|
+
/named by this theme but not loaded/.test(m) &&
|
|
1526
|
+
namesOnlyLoaded(m)
|
|
1527
|
+
),
|
|
1528
|
+
);
|
|
1529
|
+
// A group may add to a build's result (the editor's app copy:
|
|
1530
|
+
// what keeps it behind, and in a check whether it is current).
|
|
1531
|
+
const extra = await words.extraData?.(entry.file, process.cwd(), {
|
|
1532
|
+
check: Boolean(options.check),
|
|
1533
|
+
upToDate: /** @type {any} */ (result)?.data?.upToDate,
|
|
1534
|
+
out: options.out,
|
|
1535
|
+
});
|
|
1536
|
+
if (extra && result?.data) Object.assign(result.data, extra);
|
|
1537
|
+
// A check the group failed says so where the check said ok.
|
|
1538
|
+
if (held) {
|
|
1539
|
+
logger.log = log;
|
|
1540
|
+
for (const line of held)
|
|
1541
|
+
log.call(
|
|
1542
|
+
logger,
|
|
1543
|
+
extra?.upToDate === false &&
|
|
1544
|
+
typeof line === 'string' &&
|
|
1545
|
+
/^\s*\[ok\]/.test(line)
|
|
1546
|
+
? `[fail] ${String(extra.appCopyStale ?? 'not up to date')}`
|
|
1547
|
+
: line,
|
|
1548
|
+
);
|
|
1549
|
+
held = null;
|
|
1550
|
+
}
|
|
1363
1551
|
results.push({file: entry.file, receipt: result ?? null});
|
|
1364
1552
|
if (deferred) built.push({writes, lines});
|
|
1365
1553
|
if (
|
|
@@ -1373,6 +1561,8 @@ function registerThemeCommands(theme, program, docs, words) {
|
|
|
1373
1561
|
} catch (e) {
|
|
1374
1562
|
logger.log = log;
|
|
1375
1563
|
logger.warn = warn;
|
|
1564
|
+
for (const line of held ?? []) log.call(logger, line);
|
|
1565
|
+
held = null;
|
|
1376
1566
|
const err =
|
|
1377
1567
|
/** @type {import('../../../api/error.mjs').AstryxError} */ (e);
|
|
1378
1568
|
// Stop at the first failure, as a shell loop under `set -e` does.
|
|
@@ -1401,7 +1591,13 @@ function registerThemeCommands(theme, program, docs, words) {
|
|
|
1401
1591
|
if (report && compact) printCompactTrailer(trailers);
|
|
1402
1592
|
else if (report) printBatchTrailer(trailers);
|
|
1403
1593
|
if (entries.length > 1) err.message = `${entry.file}: ${err.message}`;
|
|
1404
|
-
return themeError(
|
|
1594
|
+
return themeError(
|
|
1595
|
+
entries.length === 1
|
|
1596
|
+
? ((await words.follow?.(err, process.cwd())) ?? err)
|
|
1597
|
+
: err,
|
|
1598
|
+
words,
|
|
1599
|
+
buildFallback,
|
|
1600
|
+
);
|
|
1405
1601
|
}
|
|
1406
1602
|
}
|
|
1407
1603
|
if (deferred) {
|
|
@@ -1461,7 +1657,12 @@ function registerThemeCommands(theme, program, docs, words) {
|
|
|
1461
1657
|
// Under --watch each rebuild runs on its own and takes the locks
|
|
1462
1658
|
// itself; holding them for the whole watch would block every one.
|
|
1463
1659
|
if (cmd.opts().watch) return;
|
|
1464
|
-
|
|
1660
|
+
const o = cmd.opts();
|
|
1661
|
+
release = await words.hold?.(cmd.args, {
|
|
1662
|
+
cwd: process.cwd(),
|
|
1663
|
+
check: Boolean(o.check),
|
|
1664
|
+
out: o.out,
|
|
1665
|
+
});
|
|
1465
1666
|
});
|
|
1466
1667
|
buildCli.hook('postAction', async () => {
|
|
1467
1668
|
await release?.();
|
|
@@ -22,6 +22,44 @@ import {doc as upgradeCommand} from './upgrade.doc.mjs';
|
|
|
22
22
|
import {doc as upgradeFn} from '../../../api/upgrade/upgrade.doc.mjs';
|
|
23
23
|
import {NO_RESULT_SET, resultSet} from '../../../foundation/debug/index.mjs';
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* The codemod list as text: a heading that says how many codemods there are
|
|
27
|
+
* and names their package when they share one, then each version with one
|
|
28
|
+
* line per codemod, its name and title, and `(optional)` on a codemod that
|
|
29
|
+
* runs only on request. When codemods come from more than one package, every
|
|
30
|
+
* line names its package.
|
|
31
|
+
* @param {import('../../../api/upgrade/upgrade.type.mjs').UpgradeListResponse['data']} codemods
|
|
32
|
+
* @returns {import('../formatters/index.mjs').Block[]}
|
|
33
|
+
*/
|
|
34
|
+
function codemodListBlocks(codemods) {
|
|
35
|
+
const packages = new Set(codemods.map(c => c.package));
|
|
36
|
+
const shared = packages.size === 1 ? [...packages][0] : null;
|
|
37
|
+
/** @type {Map<string, typeof codemods>} */
|
|
38
|
+
const byVersion = new Map();
|
|
39
|
+
for (const c of codemods) {
|
|
40
|
+
byVersion.set(c.version, [...(byVersion.get(c.version) ?? []), c]);
|
|
41
|
+
}
|
|
42
|
+
const count = `${codemods.length} codemod${codemods.length === 1 ? '' : 's'}`;
|
|
43
|
+
return [
|
|
44
|
+
section(
|
|
45
|
+
'Available codemods',
|
|
46
|
+
`${count}${shared ? ` from ${shared}` : ''}, oldest first`,
|
|
47
|
+
),
|
|
48
|
+
...[...byVersion].flatMap(([version, group]) => [
|
|
49
|
+
section(version),
|
|
50
|
+
records(
|
|
51
|
+
group.map(c => ({
|
|
52
|
+
name: c.name,
|
|
53
|
+
title: c.title,
|
|
54
|
+
optional: c.optional ? '(optional)' : undefined,
|
|
55
|
+
package: shared ? undefined : c.package,
|
|
56
|
+
})),
|
|
57
|
+
{fields: ['name', 'title', 'optional', 'package'], layout: 'inline'},
|
|
58
|
+
),
|
|
59
|
+
]),
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
|
|
25
63
|
/**
|
|
26
64
|
* @param {import('commander').Command} program
|
|
27
65
|
*/
|
|
@@ -79,13 +117,10 @@ export function registerUpgrade(program) {
|
|
|
79
117
|
if (json) jsonOut(result);
|
|
80
118
|
else if (result.type === 'upgrade.list') {
|
|
81
119
|
// Render the list from the result, not the API logger, so the text
|
|
82
|
-
// carries the same fields the JSON does
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
fields: ['name', 'package', 'title', 'version', 'optional'],
|
|
87
|
-
}),
|
|
88
|
-
);
|
|
120
|
+
// carries the same fields the JSON does. One line per codemod under
|
|
121
|
+
// its version: the list gains a line per codemod each release, not a
|
|
122
|
+
// five-line record.
|
|
123
|
+
emit(...codemodListBlocks(result.data));
|
|
89
124
|
}
|
|
90
125
|
|
|
91
126
|
const registrySummary =
|
package/clients/cli/index.mjs
CHANGED
|
@@ -595,7 +595,7 @@ export async function createProgram({argv} = {}) {
|
|
|
595
595
|
|
|
596
596
|
program
|
|
597
597
|
.name('astryx')
|
|
598
|
-
.description('Design system CLI — components, themes, and tooling\n\nMaking or changing a theme? Use the experimental theme editor: astryx experimental theme editor new <name> --like neutral, then editor set / editor how "<what you want>"; after each change look at it with astryx experimental theme editor show <name> --png (
|
|
598
|
+
.description('Design system CLI — components, themes, and tooling\n\nMaking or changing a theme? Use the experimental theme editor: astryx experimental theme editor new <name> --like neutral, then editor set / editor how "<what you want>"; after each change look at it with astryx experimental theme editor show <name> --png (takes pictures of real components): a theme change is not done until you have looked. No app yet: astryx experimental theme preview app <dir>.')
|
|
599
599
|
.version(pkg.version)
|
|
600
600
|
// These four change only the reads named in their text; every other
|
|
601
601
|
// command ignores them.
|
|
@@ -66,6 +66,7 @@ import {
|
|
|
66
66
|
import {levenshteinDistance} from '../../../foundation/text/levenshtein.mjs';
|
|
67
67
|
import {doc as experimentalEditorDoc} from '../commands/experimental-theme-editor.doc.mjs';
|
|
68
68
|
import {doc as experimentalPreviewDoc} from '../commands/experimental-theme-preview.doc.mjs';
|
|
69
|
+
import {compareText} from '../../../foundation/text/compare-text.mjs';
|
|
69
70
|
|
|
70
71
|
/**
|
|
71
72
|
* Suggestion object — matches the shape used by API errors and the JSON
|
|
@@ -230,7 +231,7 @@ export function unknownSubcommandSuggestions(
|
|
|
230
231
|
const ranked = [...names].sort(
|
|
231
232
|
(a, b) =>
|
|
232
233
|
levenshteinDistance(typed, a) - levenshteinDistance(typed, b) ||
|
|
233
|
-
a
|
|
234
|
+
compareText(a, b),
|
|
234
235
|
);
|
|
235
236
|
return [
|
|
236
237
|
...elsewhere,
|