@astryxdesign/cli 0.7.17-canary.g5a3fd39 → 0.7.17-canary.g5cf5d69
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 +64 -63
- package/api/build/_adapter.d.mts +51 -0
- package/api/build/_adapter.mjs +122 -6
- package/api/build/build.doc.mjs +1 -1
- package/api/build/build.mjs +23 -14
- package/api/build/build.type.d.mts +1 -1
- package/api/build/build.type.mjs +3 -3
- package/api/build/help/help.d.mts +15 -14
- package/api/build/help/help.mjs +62 -3
- package/api/build/kit/answer.mjs +2 -3
- package/api/build/kit/signals.d.mts +10 -0
- package/api/build/kit/signals.mjs +15 -2
- package/api/component/detail/blocks/blocks.mjs +2 -1
- package/api/discover/_adapter.d.mts +57 -6
- package/api/discover/_adapter.mjs +278 -49
- package/api/discover/_catalog-view.d.mts +7 -0
- package/api/discover/_catalog-view.mjs +10 -1
- package/api/discover/detail/detail.d.mts +3 -2
- package/api/discover/detail/detail.mjs +3 -2
- package/api/discover/detail/doc/doc.mjs +1 -1
- package/api/discover/discover.d.mts +24 -0
- package/api/discover/discover.doc.mjs +1 -1
- package/api/discover/discover.mjs +146 -25
- package/api/discover/discover.type.d.mts +6 -4
- package/api/discover/discover.type.mjs +6 -4
- package/api/discover/search/search.d.mts +22 -0
- package/api/discover/search/search.mjs +290 -70
- package/api/docs/_entry-names.mjs +4 -3
- package/api/doctor/_adapter.d.mts +43 -3
- package/api/doctor/_adapter.mjs +142 -18
- package/api/doctor/built-checks.d.mts +30 -3
- package/api/doctor/built-checks.mjs +132 -5
- package/api/doctor/doctor.d.mts +93 -6
- package/api/doctor/doctor.doc.mjs +2 -2
- package/api/doctor/doctor.mjs +524 -33
- package/api/doctor/doctor.type.d.mts +2 -1
- package/api/doctor/doctor.type.mjs +2 -1
- package/api/doctor/theme-checks.d.mts +19 -0
- package/api/doctor/theme-checks.mjs +74 -6
- package/api/hook/hook.type.d.mts +1 -1
- package/api/hook/hook.type.mjs +1 -1
- package/api/hook/list/list.mjs +11 -7
- package/api/icon/_adapter.d.mts +2 -1
- package/api/icon/_adapter.mjs +10 -15
- package/api/icon/_records.d.mts +3 -1
- package/api/icon/_records.mjs +30 -3
- package/api/icon/exportIconIndex.doc.mjs +1 -1
- package/api/icon/icon.doc.mjs +3 -3
- package/api/icon/icon.type.d.mts +32 -1
- package/api/icon/icon.type.mjs +19 -3
- package/api/icon/list/list.mjs +4 -1
- package/api/icon/rankIconIndex.doc.mjs +1 -1
- package/api/icon/search/icon-index.mjs +18 -8
- package/api/icon/search/search.d.mts +26 -3
- package/api/icon/search/search.mjs +155 -9
- package/api/init/_adapter.d.mts +14 -0
- package/api/init/_adapter.mjs +26 -4
- package/api/init/init.d.mts +1 -1
- package/api/init/init.doc.mjs +2 -2
- package/api/init/init.mjs +1 -1
- package/api/init/init.type.d.mts +29 -1
- package/api/init/init.type.mjs +14 -1
- package/api/init/run/run.d.mts +11 -1
- package/api/init/run/run.mjs +84 -5
- package/api/integration/_adapter.d.mts +5 -4
- package/api/integration/_adapter.mjs +7 -5
- package/api/integration/integrationCheck.doc.mjs +1 -1
- package/api/integration/pack-check.mjs +8 -9
- package/api/integration/validate-integration.d.mts +1 -1
- package/api/integration/validate-integration.mjs +26 -24
- package/api/integration/validate-integration.type.d.mts +5 -2
- package/api/integration/validate-integration.type.mjs +5 -2
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/render/_adapter.d.mts +4 -2
- package/api/render/_adapter.mjs +62 -21
- package/api/render/render.doc.mjs +8 -5
- package/api/render/render.mjs +1 -1
- package/api/render/render.type.d.mts +2 -0
- package/api/render/render.type.mjs +2 -0
- package/api/search/ORDERING.md +2 -2
- package/api/search/_candidate-score.d.mts +3 -0
- package/api/search/_candidate-score.mjs +36 -3
- package/api/search/_gather-docs.mjs +29 -2
- package/api/search/_gather-templates.mjs +2 -1
- package/api/search/_main-searcher.mjs +13 -0
- package/api/search/_named-keywords.d.mts +2 -1
- package/api/search/_named-keywords.mjs +48 -6
- package/api/search/_order.d.mts +36 -1
- package/api/search/_order.mjs +141 -3
- package/api/swizzle/list/list.mjs +8 -1
- package/api/swizzle/swizzle.type.d.mts +1 -1
- package/api/swizzle/swizzle.type.mjs +1 -1
- package/api/template/copy/copy.mjs +3 -4
- package/api/template/list/list.mjs +2 -1
- package/api/template/show/show.mjs +2 -1
- package/api/template/skeleton/skeleton.mjs +2 -1
- package/api/template/template.doc.mjs +1 -1
- package/api/template/template.mjs +19 -1
- package/api/template/template.type.d.mts +1 -0
- package/api/template/template.type.mjs +2 -1
- package/api/theme/_adapter.d.mts +1 -0
- package/api/theme/_adapter.mjs +3 -5
- package/api/theme/_app-provider.d.mts +42 -0
- package/api/theme/_app-provider.mjs +61 -27
- package/api/theme/build/build.d.mts +4 -10
- package/api/theme/build/build.mjs +165 -116
- package/api/theme/build/input-fields.d.mts +9 -0
- package/api/theme/build/input-fields.mjs +155 -16
- package/api/theme/build/radius-values.d.mts +18 -0
- package/api/theme/build/radius-values.mjs +76 -0
- package/api/theme/build/typography-values.mjs +7 -23
- package/api/theme/build/written-values.d.mts +18 -0
- package/api/theme/build/written-values.mjs +107 -31
- package/api/theme/eject/eject.mjs +6 -1
- package/api/theme/palette/generate/generator.mjs +24 -0
- package/api/theme/theme.type.d.mts +4 -2
- package/api/theme/theme.type.mjs +3 -2
- package/api/theme/themeBuild.doc.mjs +2 -2
- package/api/theme/themeEject.doc.mjs +1 -1
- package/api/theme-edit/_catalog.d.mts +40 -0
- package/api/theme-edit/_catalog.mjs +100 -22
- package/api/theme-edit/_check.mjs +213 -43
- package/api/theme-edit/_color.d.mts +14 -0
- package/api/theme-edit/_color.mjs +22 -0
- package/api/theme-edit/_compiler.mjs +52 -0
- package/api/theme-edit/_context.d.mts +20 -2
- package/api/theme-edit/_context.mjs +157 -29
- package/api/theme-edit/_edit.mjs +426 -58
- package/api/theme-edit/_how-question.d.mts +14 -0
- package/api/theme-edit/_how-question.mjs +1541 -127
- package/api/theme-edit/_how.mjs +43 -0
- package/api/theme-edit/_missed.mjs +107 -27
- package/api/theme-edit/_normal.d.mts +18 -4
- package/api/theme-edit/_normal.mjs +84 -3
- package/api/theme-edit/_palette.d.mts +9 -0
- package/api/theme-edit/_palette.mjs +158 -33
- package/api/theme-edit/_part-words.mjs +16 -3
- package/api/theme-edit/_parts.d.mts +8 -0
- package/api/theme-edit/_parts.mjs +120 -36
- package/api/theme-edit/_png.d.mts +24 -0
- package/api/theme-edit/_png.mjs +99 -0
- package/api/theme-edit/_preview-app.d.mts +16 -0
- package/api/theme-edit/_preview-app.mjs +52 -18
- package/api/theme-edit/_preview.d.mts +44 -26
- package/api/theme-edit/_preview.mjs +255 -67
- package/api/theme-edit/_project.d.mts +12 -1
- package/api/theme-edit/_project.mjs +16 -1
- package/api/theme-edit/_settings.d.mts +116 -0
- package/api/theme-edit/_settings.mjs +1197 -58
- package/api/theme-edit/_tables.d.mts +16 -0
- package/api/theme-edit/_tables.mjs +34 -4
- package/api/theme-edit/theme-edit.type.d.mts +15 -2
- package/api/theme-edit/theme-edit.type.mjs +8 -6
- package/api/upgrade/_adapter.d.mts +46 -7
- package/api/upgrade/_adapter.mjs +110 -15
- package/api/upgrade/registry/registry.d.mts +6 -3
- package/api/upgrade/registry/registry.mjs +21 -6
- package/api/upgrade/run/run.mjs +23 -11
- package/api/upgrade/upgrade.doc.mjs +4 -3
- package/assets/component-list.generated.json +1 -1
- package/assets/docs/tree/agent-guidance.doc.mjs +3 -2
- package/assets/docs/tree/checks.doc.mjs +2 -2
- package/assets/docs/tree/host-entry.doc.mjs +4 -0
- package/assets/docs/tree/icon-definitions.doc.mjs +3 -3
- package/assets/docs/tree/icon-sets.doc.mjs +6 -6
- package/assets/docs/tree/problems.doc.mjs +3 -3
- package/assets/docs/tree/render-pages.doc.mjs +17 -3
- package/assets/docs/tree/share-a-page.doc.mjs +5 -5
- package/assets/docs/tree/short-and-findable.doc.mjs +3 -3
- package/assets/docs/tree/troubleshooting.doc.mjs +8 -0
- package/assets/docs/tree/updates.doc.mjs +1 -1
- package/assets/docs/tree/versioning.doc.mjs +1 -1
- package/assets/docs/working-with-ai.doc.mjs +40 -5
- package/assets/docs-routes.generated.json +1 -1
- package/assets/docs.generated.json +2 -2
- package/assets/icons/installed-icon-set.doc.mjs +30 -0
- package/assets/search-catalog.generated.json +2 -2
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/Avatar/AvatarInteractive.tsx +6 -1
- package/assets/templates/blocks/components/CodeBlock/CodeBlockTerminal.tsx +1 -1
- package/assets/templates/blocks/components/LinkProvider/LinkProviderCustomLink.tsx +3 -1
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ai-chat/page.tsx +6 -2
- package/assets/templates/pages/ai-chat-landing/page.tsx +1 -1
- package/assets/templates/pages/blank/page.tsx +4 -2
- package/assets/templates/pages/canvas-editor/page.tsx +3 -1
- package/assets/templates/pages/centered-hero/page.tsx +1 -1
- package/assets/templates/pages/checkout-wizard/page.tsx +1 -1
- package/assets/templates/pages/classic-gallery/page.tsx +1 -1
- package/assets/templates/pages/contact-form/page.tsx +2 -2
- package/assets/templates/pages/course-detail/page.tsx +1 -1
- package/assets/templates/pages/dashboard/page.tsx +24 -8
- package/assets/templates/pages/dashboard-alert-rail/page.tsx +4 -2
- package/assets/templates/pages/dashboard-cohort-funnel/page.tsx +7 -3
- package/assets/templates/pages/dashboard-comparison/page.tsx +5 -2
- package/assets/templates/pages/dashboard-composition/page.tsx +10 -4
- package/assets/templates/pages/dashboard-progress/page.tsx +6 -3
- package/assets/templates/pages/dashboard-scorecard/page.tsx +17 -8
- package/assets/templates/pages/detail-page/page.tsx +22 -5
- package/assets/templates/pages/documentation/page.tsx +4 -2
- package/assets/templates/pages/documentation-design/page.tsx +5 -2
- package/assets/templates/pages/documentation-technical/page.tsx +4 -2
- package/assets/templates/pages/editor/page.tsx +28 -9
- package/assets/templates/pages/file-explorer/page.tsx +3 -1
- package/assets/templates/pages/form-two-column/page.tsx +1 -1
- package/assets/templates/pages/form-wizard/page.tsx +1 -1
- package/assets/templates/pages/form-wizard-dialog/page.tsx +3 -1
- package/assets/templates/pages/form-wizard-inline/page.tsx +1 -1
- package/assets/templates/pages/form-wizard-vertical/page.tsx +1 -1
- package/assets/templates/pages/gallery-hero/page.tsx +1 -1
- package/assets/templates/pages/ide/page.tsx +7 -2
- package/assets/templates/pages/kanban-board/page.tsx +10 -4
- package/assets/templates/pages/library/page.tsx +31 -61
- package/assets/templates/pages/login/page.tsx +4 -2
- package/assets/templates/pages/login-card/page.tsx +4 -2
- package/assets/templates/pages/login-split/page.tsx +3 -2
- package/assets/templates/pages/login-sso/page.tsx +4 -4
- package/assets/templates/pages/mixed-gallery/page.tsx +1 -1
- package/assets/templates/pages/payment-form/page.tsx +1 -1
- package/assets/templates/pages/product-detail/page.tsx +16 -4
- package/assets/templates/pages/product-gallery/page.tsx +1 -1
- package/assets/templates/pages/settings/page.tsx +10 -4
- package/assets/templates/pages/settings-dialog/page.tsx +5 -6
- package/assets/templates/pages/settings-sidebar/page.tsx +39 -13
- package/assets/templates/pages/side-gallery/page.tsx +1 -1
- package/assets/templates/pages/table/page.tsx +2 -2
- package/assets/templates/pages/table-filter/page.tsx +21 -6
- package/assets/templates/pages/table-grouped/page.tsx +23 -2
- package/assets/templates/pages/table-inbox/page.tsx +82 -32
- package/assets/templates/pages/theme-showcase/page.tsx +3 -2
- package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +12 -12
- package/assets/templates/themes/butter/butterTheme.ts +197 -4
- package/assets/templates/themes/chocolate/chocolateTheme.ts +72 -8
- package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +3 -3
- package/assets/templates/themes/gothic/gothicTheme.ts +114 -4
- package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +8 -8
- package/assets/templates/themes/matcha/matchaTheme.ts +48 -12
- package/assets/templates/themes/neutral/neutralTheme.ts +29 -0
- package/assets/templates/themes/stone/stonePaletteRefs.generated.ts +2 -2
- package/assets/templates/themes/stone/stoneTheme.ts +69 -0
- package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +9 -9
- package/assets/templates/themes/y2k/y2kTheme.ts +249 -14
- package/authoring/codemod/parse.d.mts +0 -36
- package/authoring/codemod/parse.mjs +62 -41
- package/authoring/config/config.doc.mjs +1 -1
- package/authoring/config/parse.d.mts +0 -47
- package/authoring/config/parse.mjs +128 -103
- package/authoring/config/type.ts +4 -3
- package/authoring/debug/parse.d.mts +2 -2
- package/authoring/discover/parse.d.mts +2 -2
- package/authoring/discover/parse.mjs +52 -38
- package/authoring/discover/type.ts +2 -1
- package/authoring/doctypes/_schema.d.mts +834 -950
- package/authoring/doctypes/_schema.mjs +863 -825
- package/authoring/doctypes/command/parse.mjs +2 -2
- package/authoring/doctypes/component/parse.mjs +2 -2
- package/authoring/doctypes/enum/parse.mjs +2 -2
- package/authoring/doctypes/hook/parse.mjs +2 -2
- package/authoring/doctypes/icon-definition/icon-definition.doc.mjs +1 -1
- package/authoring/doctypes/icon-definition/parse.d.mts +0 -24
- package/authoring/doctypes/icon-definition/parse.mjs +59 -43
- package/authoring/doctypes/icon-set/parse.d.mts +0 -75
- package/authoring/doctypes/icon-set/parse.mjs +239 -210
- package/authoring/doctypes/legacy.mjs +3 -3
- package/authoring/doctypes/namespace/parse.mjs +2 -2
- package/authoring/doctypes/reference/parse.mjs +2 -2
- package/authoring/doctypes/schema/parse.mjs +2 -2
- package/authoring/doctypes/template/parse.d.mts +0 -101
- package/authoring/doctypes/template/parse.mjs +131 -106
- package/authoring/doctypes/theme/parse.d.mts +0 -23
- package/authoring/doctypes/theme/parse.mjs +52 -36
- package/authoring/gap-report/parse.d.mts +1 -1
- package/authoring/integration/integration.doc.mjs +8 -0
- package/authoring/integration/schema.d.mts +14 -3
- package/authoring/integration/schema.mjs +20 -2
- package/authoring/integration/type.ts +14 -0
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/build.mjs +27 -13
- package/clients/cli/commands/component.mjs +14 -3
- package/clients/cli/commands/discover.doc.mjs +2 -2
- package/clients/cli/commands/discover.mjs +20 -3
- package/clients/cli/commands/docs.doc.mjs +11 -9
- package/clients/cli/commands/docs.mjs +50 -21
- package/clients/cli/commands/experimental/icon.mjs +330 -227
- package/clients/cli/commands/experimental/render.mjs +16 -1
- package/clients/cli/commands/experimental/theme.mjs +42 -17
- package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
- package/clients/cli/commands/experimental-icon-map.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-new-set.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-use.doc.mjs +1 -1
- package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
- package/clients/cli/commands/experimental-render.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +1 -1
- 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 +1 -1
- package/clients/cli/commands/init.doc.mjs +36 -24
- package/clients/cli/commands/integration-check.doc.mjs +1 -1
- package/clients/cli/commands/mcp.doc.mjs +53 -0
- package/clients/cli/commands/mcp.mjs +51 -0
- package/clients/cli/commands/search.mjs +46 -9
- package/clients/cli/commands/template.mjs +3 -2
- package/clients/cli/commands/theme-build.doc.mjs +1 -1
- package/clients/cli/commands/theme.mjs +12 -2
- package/clients/cli/commands/upgrade.doc.mjs +3 -2
- package/clients/cli/commands.generated.json +1 -1
- package/clients/cli/formatters/index.mjs +52 -6
- package/clients/cli/index.mjs +23 -17
- package/clients/cli/lib/base-gate.mjs +37 -5
- package/clients/cli/lib/define-command.mjs +82 -4
- package/clients/cli/lib/json-shim.mjs +61 -4
- package/clients/cli/lib/manifest.mjs +9 -1
- package/clients/cli/lib/mcp-server.mjs +286 -0
- package/clients/cli/lib/mcp-tools.mjs +405 -0
- package/clients/cli/lib/other-cli-words.mjs +99 -0
- package/clients/cli/lib/stray-option.mjs +27 -1
- package/clients/cli/lib/unknown-command.mjs +326 -11
- package/clients/cli/manifest.generated.json +1 -1
- package/clients/cli/run.mjs +1 -1
- package/foundation/agent-docs/agent-docs.d.mts +49 -1
- package/foundation/agent-docs/agent-docs.mjs +108 -7
- package/foundation/agent-docs/computer-agent-text.mjs +1 -1
- package/foundation/bases/core.d.mts +1 -1
- package/foundation/bases/core.mjs +3 -3
- package/foundation/bases/resolve.d.mts +4 -8
- package/foundation/bases/resolve.mjs +15 -21
- package/foundation/bases/state.d.mts +15 -9
- package/foundation/bases/state.mjs +33 -6
- package/foundation/config/project.d.mts +5 -4
- package/foundation/config/project.mjs +33 -17
- package/foundation/discovery/component-discovery.mjs +15 -28
- package/foundation/discovery/icon-imports.d.mts +66 -0
- package/foundation/discovery/icon-imports.mjs +225 -0
- package/foundation/discovery/icon-ranking.d.mts +12 -2
- package/foundation/discovery/icon-ranking.mjs +197 -10
- package/foundation/discovery/icon-set-checks.mjs +2 -1
- package/foundation/discovery/icon-set-discovery.d.mts +28 -0
- package/foundation/discovery/icon-set-discovery.mjs +42 -0
- package/foundation/discovery/icon-set-writer.d.mts +2 -11
- package/foundation/discovery/icon-set-writer.mjs +3 -29
- package/foundation/discovery/module-exports.d.mts +1 -1
- package/foundation/discovery/module-exports.mjs +136 -33
- package/foundation/discovery/name-roots.d.mts +5 -0
- package/foundation/discovery/name-roots.mjs +11 -0
- package/foundation/discovery/runner-allowlist.d.mts +1 -0
- package/foundation/discovery/runner-allowlist.mjs +2 -0
- package/foundation/discovery/runner-commands.mjs +1 -0
- package/foundation/discovery/template-adapter.d.mts +1 -1
- package/foundation/discovery/template-destination.d.mts +14 -6
- package/foundation/discovery/template-destination.mjs +42 -8
- package/foundation/discovery/template-icons.d.mts +45 -2
- package/foundation/discovery/template-icons.mjs +26 -54
- package/foundation/discovery/template-needs.d.mts +28 -2
- package/foundation/discovery/template-needs.mjs +92 -11
- package/foundation/discovery/theme-discovery.d.mts +8 -0
- package/foundation/discovery/theme-discovery.mjs +23 -6
- package/foundation/discovery/theme-imports.mjs +2 -4
- package/foundation/doc-compiler/parse-readable.mjs +4 -3
- package/foundation/doc-compiler/stored-docs.d.mts +13 -0
- package/foundation/doc-compiler/stored-docs.mjs +74 -3
- package/foundation/env/cli-command.d.mts +68 -10
- package/foundation/env/cli-command.mjs +116 -22
- package/foundation/env/project-scope.d.mts +9 -0
- package/foundation/env/project-scope.mjs +28 -2
- package/foundation/fs/gather-cache.d.mts +23 -0
- package/foundation/fs/gather-cache.mjs +94 -2
- package/foundation/fs/module-loader.d.mts +3 -1
- package/foundation/fs/module-loader.mjs +85 -5
- package/foundation/fs/read-record.mjs +9 -5
- package/foundation/identity/package-names.d.mts +18 -0
- package/foundation/identity/package-names.mjs +19 -0
- package/foundation/identity/providers.mjs +3 -2
- package/foundation/integrations/icon-features.d.mts +63 -0
- package/foundation/integrations/icon-features.mjs +54 -0
- package/foundation/integrations/integrations.d.mts +13 -1
- package/foundation/integrations/integrations.mjs +47 -6
- package/foundation/integrations/pack-state.d.mts +21 -0
- package/foundation/integrations/pack-state.mjs +42 -19
- package/foundation/integrations/validate-contributions.d.mts +11 -3
- package/foundation/integrations/validate-contributions.mjs +51 -13
- package/foundation/release/cache.d.mts +13 -1
- package/foundation/release/cache.mjs +94 -14
- package/foundation/release/notices.d.mts +15 -0
- package/foundation/release/notices.mjs +111 -7
- package/foundation/release/project.d.mts +3 -4
- package/foundation/release/project.mjs +5 -6
- package/foundation/render/client-bundle.d.mts +126 -0
- package/foundation/render/client-bundle.mjs +565 -0
- package/foundation/render/cut-short.d.mts +7 -1
- package/foundation/render/cut-short.mjs +46 -6
- package/foundation/render/embedded-imports.d.mts +4 -3
- package/foundation/render/embedded-imports.mjs +13 -8
- package/foundation/render/esbuild-dependency.d.mts +14 -0
- package/foundation/render/esbuild-dependency.mjs +41 -0
- package/foundation/render/file-header.mjs +5 -4
- package/foundation/render/page-worker.mjs +562 -86
- package/foundation/render/picture-chrome.mjs +54 -29
- package/foundation/render/picture-playwright.mjs +78 -42
- package/foundation/render/picture-window.d.mts +33 -0
- package/foundation/render/picture-window.mjs +78 -0
- package/foundation/render/render-page.d.mts +55 -4
- package/foundation/render/render-page.mjs +199 -28
- package/foundation/render/restore-folder.d.mts +13 -0
- package/foundation/render/restore-folder.mjs +30 -0
- package/foundation/render/served-packages.d.mts +2 -1
- package/foundation/render/served-packages.mjs +5 -3
- package/foundation/render/ts-paths.d.mts +11 -0
- package/foundation/render/ts-paths.mjs +27 -2
- package/foundation/render/value-uses.d.mts +43 -0
- package/foundation/render/value-uses.mjs +110 -0
- package/foundation/response/error-codes.d.mts +2 -1
- package/foundation/response/error-codes.doc.mjs +7 -1
- package/foundation/response/error-codes.mjs +10 -2
- package/foundation/response/response-types.doc.mjs +12 -12
- package/foundation/runtime/package-root.d.mts +8 -0
- package/foundation/runtime/package-root.mjs +20 -0
- package/foundation/suggest/other-command.d.mts +11 -0
- package/foundation/suggest/other-command.mjs +1 -1
- package/foundation/text/icon-id.d.mts +20 -0
- package/foundation/text/icon-id.mjs +40 -0
- package/foundation/text/icon-set-next.d.mts +25 -0
- package/foundation/text/icon-set-next.mjs +29 -0
- package/foundation/xle/browser.d.mts +2 -2
- package/package.json +7 -6
package/api/build/_adapter.d.mts
CHANGED
|
@@ -141,6 +141,31 @@ export function pageDestination(id: string, cwd: string): string | null;
|
|
|
141
141
|
* @returns {string | null}
|
|
142
142
|
*/
|
|
143
143
|
export function buildCoreContentDir(cwd: string): string | null;
|
|
144
|
+
/**
|
|
145
|
+
* The provider the app passes its theme to instead of `<Theme>`, as
|
|
146
|
+
* `theme add` names it: the one an installed package declares, when it takes
|
|
147
|
+
* a theme object. `line` is its opening tag, built as the `theme add`
|
|
148
|
+
* receipt builds it.
|
|
149
|
+
* @typedef {{export: string, from: string, line: string}} ThemeProvider
|
|
150
|
+
*/
|
|
151
|
+
/**
|
|
152
|
+
* @typedef {({state: 'wired', modulePath: string, hasModes: boolean}
|
|
153
|
+
* | {state: 'installed', slug: string, hasModes: boolean}
|
|
154
|
+
* | {state: 'none', slug: string, package: string})
|
|
155
|
+
* & {provider: ThemeProvider | null}} AppThemeWiring
|
|
156
|
+
*/
|
|
157
|
+
/**
|
|
158
|
+
* How the project at `cwd` wires its theme, read the way `theme add` reads
|
|
159
|
+
* it: `wired` when `theme add` has written the generated module, `installed`
|
|
160
|
+
* when a theme it can add is installed but not added, and otherwise the
|
|
161
|
+
* starter theme. `hasModes` says the module records a theme's one color mode,
|
|
162
|
+
* or will once `theme add` adds the installed theme, read from its built
|
|
163
|
+
* module as `theme add` reads it. `provider` is set when an installed package
|
|
164
|
+
* names the provider that takes the theme.
|
|
165
|
+
* @param {string} cwd
|
|
166
|
+
* @returns {Promise<AppThemeWiring>}
|
|
167
|
+
*/
|
|
168
|
+
export function appThemeWiring(cwd: string): Promise<AppThemeWiring>;
|
|
144
169
|
export { withListingCache } from "../../foundation/fs/listing-cache.mjs";
|
|
145
170
|
/**
|
|
146
171
|
* A page template the kit can recommend starting from.
|
|
@@ -238,3 +263,29 @@ export type BlockTemplate = {
|
|
|
238
263
|
*/
|
|
239
264
|
isReady: boolean;
|
|
240
265
|
};
|
|
266
|
+
/**
|
|
267
|
+
* The provider the app passes its theme to instead of `<Theme>`, as
|
|
268
|
+
* `theme add` names it: the one an installed package declares, when it takes
|
|
269
|
+
* a theme object. `line` is its opening tag, built as the `theme add`
|
|
270
|
+
* receipt builds it.
|
|
271
|
+
*/
|
|
272
|
+
export type ThemeProvider = {
|
|
273
|
+
export: string;
|
|
274
|
+
from: string;
|
|
275
|
+
line: string;
|
|
276
|
+
};
|
|
277
|
+
export type AppThemeWiring = ({
|
|
278
|
+
state: "wired";
|
|
279
|
+
modulePath: string;
|
|
280
|
+
hasModes: boolean;
|
|
281
|
+
} | {
|
|
282
|
+
state: "installed";
|
|
283
|
+
slug: string;
|
|
284
|
+
hasModes: boolean;
|
|
285
|
+
} | {
|
|
286
|
+
state: "none";
|
|
287
|
+
slug: string;
|
|
288
|
+
package: string;
|
|
289
|
+
}) & {
|
|
290
|
+
provider: ThemeProvider | null;
|
|
291
|
+
};
|
package/api/build/_adapter.mjs
CHANGED
|
@@ -7,20 +7,24 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @input Template and component discovery for `cwd` — the CLI's own templates
|
|
9
9
|
* and Core's components, plus any that the project's configured integrations
|
|
10
|
-
* contribute
|
|
10
|
+
* contribute; the project's generated theme module and installed theme
|
|
11
|
+
* packages.
|
|
11
12
|
* @output Ready page templates as `{name, displayName, description, category,
|
|
12
13
|
* keywords, command}`, where `command` is the `astryx template` command that
|
|
13
14
|
* selects exactly that template; blocks as search names them; components as
|
|
14
15
|
* `{name, keywords}`; the kit's matcher weights, the root's classifier
|
|
15
16
|
* weights, and the block picker's weights; `keptBlockCatalog`, which keeps
|
|
16
|
-
* the picker's per-block vectors beside the kept search catalog
|
|
17
|
+
* the picker's per-block vectors beside the kept search catalog; and
|
|
18
|
+
* `appThemeWiring`, how the project wires its theme.
|
|
17
19
|
* @position Beside build.mjs (api/build/). The kit leaf reads templates and
|
|
18
20
|
* components only through here, because a subject's `_adapter.mjs` is its
|
|
19
21
|
* only environment access. This adds no discovery of its own: templates come
|
|
20
|
-
* from the template subject's, components from search's
|
|
22
|
+
* from the template subject's, components from search's, themes from the
|
|
23
|
+
* theme subject's.
|
|
21
24
|
*/
|
|
22
25
|
|
|
23
26
|
import fs from 'node:fs';
|
|
27
|
+
import {renderTokens} from '../../foundation/doc-compiler/links.mjs';
|
|
24
28
|
import path from 'node:path';
|
|
25
29
|
import {fileURLToPath} from 'node:url';
|
|
26
30
|
|
|
@@ -33,6 +37,21 @@ import {extractComponents} from '../../foundation/discovery/template-adapter.mjs
|
|
|
33
37
|
import {templateDestination} from '../../foundation/discovery/template-destination.mjs';
|
|
34
38
|
import {quoteCommandArgument} from '../../foundation/env/package-manager.mjs';
|
|
35
39
|
import {isWordModel} from './kit/word-model.mjs';
|
|
40
|
+
import {
|
|
41
|
+
listAvailableThemeState,
|
|
42
|
+
themeOwnerInstalled,
|
|
43
|
+
} from '../theme/_adapter.mjs';
|
|
44
|
+
import {providerLine, providersOf} from '../theme/_app-provider.mjs';
|
|
45
|
+
import {
|
|
46
|
+
ThemeImportError,
|
|
47
|
+
resolveThemeImports,
|
|
48
|
+
} from '../../foundation/discovery/theme-imports.mjs';
|
|
49
|
+
import {
|
|
50
|
+
ThemeStateError,
|
|
51
|
+
readThemeState,
|
|
52
|
+
} from '../../foundation/config/theme-state.mjs';
|
|
53
|
+
import {STARTER_THEME} from '../../foundation/discovery/theme-discovery.mjs';
|
|
54
|
+
import {AstryxError} from '../error.mjs';
|
|
36
55
|
|
|
37
56
|
/**
|
|
38
57
|
* Runs one build with a single directory listing per path: the kit resolves
|
|
@@ -116,7 +135,7 @@ export async function loadTemplates(cwd) {
|
|
|
116
135
|
displayName: t.displayName || t.name,
|
|
117
136
|
category: t.category || '',
|
|
118
137
|
keywords: t.keywords ?? [],
|
|
119
|
-
description: t.description || '',
|
|
138
|
+
description: renderTokens(t.description || ''),
|
|
120
139
|
}));
|
|
121
140
|
const pages = templates
|
|
122
141
|
.filter(t => t.type === 'page' && t.isReady !== false)
|
|
@@ -125,7 +144,7 @@ export async function loadTemplates(cwd) {
|
|
|
125
144
|
{
|
|
126
145
|
name: t.dirName,
|
|
127
146
|
displayName: t.displayName || t.name,
|
|
128
|
-
description: t.description || '',
|
|
147
|
+
description: renderTokens(t.description || ''),
|
|
129
148
|
package: t.package ?? '@astryxdesign/core',
|
|
130
149
|
category: t.category || '',
|
|
131
150
|
keywords: t.keywords ?? [],
|
|
@@ -145,7 +164,7 @@ export async function loadTemplates(cwd) {
|
|
|
145
164
|
name: t.dirName,
|
|
146
165
|
package: t.package ?? '@astryxdesign/core',
|
|
147
166
|
displayName: t.name,
|
|
148
|
-
description: t.description || '',
|
|
167
|
+
description: renderTokens(t.description || ''),
|
|
149
168
|
command: `astryx template ${t.replaces ?? t.dirName} --type block`,
|
|
150
169
|
isReady: t.isReady !== false,
|
|
151
170
|
}));
|
|
@@ -414,3 +433,100 @@ function withComponents(entry, filePath) {
|
|
|
414
433
|
})
|
|
415
434
|
);
|
|
416
435
|
}
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* The provider the app passes its theme to instead of `<Theme>`, as
|
|
439
|
+
* `theme add` names it: the one an installed package declares, when it takes
|
|
440
|
+
* a theme object. `line` is its opening tag, built as the `theme add`
|
|
441
|
+
* receipt builds it.
|
|
442
|
+
* @typedef {{export: string, from: string, line: string}} ThemeProvider
|
|
443
|
+
*/
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* @typedef {({state: 'wired', modulePath: string, hasModes: boolean}
|
|
447
|
+
* | {state: 'installed', slug: string, hasModes: boolean}
|
|
448
|
+
* | {state: 'none', slug: string, package: string})
|
|
449
|
+
* & {provider: ThemeProvider | null}} AppThemeWiring
|
|
450
|
+
*/
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* How the project at `cwd` wires its theme, read the way `theme add` reads
|
|
454
|
+
* it: `wired` when `theme add` has written the generated module, `installed`
|
|
455
|
+
* when a theme it can add is installed but not added, and otherwise the
|
|
456
|
+
* starter theme. `hasModes` says the module records a theme's one color mode,
|
|
457
|
+
* or will once `theme add` adds the installed theme, read from its built
|
|
458
|
+
* module as `theme add` reads it. `provider` is set when an installed package
|
|
459
|
+
* names the provider that takes the theme.
|
|
460
|
+
* @param {string} cwd
|
|
461
|
+
* @returns {Promise<AppThemeWiring>}
|
|
462
|
+
*/
|
|
463
|
+
export async function appThemeWiring(cwd) {
|
|
464
|
+
/** @type {ThemeProvider | null} */
|
|
465
|
+
let starterProvider = null;
|
|
466
|
+
try {
|
|
467
|
+
const {themes} = await listAvailableThemeState(cwd);
|
|
468
|
+
const {taking} = providersOf(themes);
|
|
469
|
+
/** @param {boolean} oneMode @returns {ThemeProvider | null} */
|
|
470
|
+
const provide = oneMode =>
|
|
471
|
+
taking?.provider.themeProp
|
|
472
|
+
? {
|
|
473
|
+
export: taking.provider.export,
|
|
474
|
+
from: taking.provider.from,
|
|
475
|
+
line: providerLine(taking.provider, oneMode),
|
|
476
|
+
}
|
|
477
|
+
: null;
|
|
478
|
+
starterProvider = provide(false);
|
|
479
|
+
const state = readThemeState(cwd);
|
|
480
|
+
const source = state.module.expectedOriginal;
|
|
481
|
+
if (state.configured && source) {
|
|
482
|
+
const hasModes = /\bexport const themeModes\b/u.test(
|
|
483
|
+
source.toString('utf-8'),
|
|
484
|
+
);
|
|
485
|
+
return {
|
|
486
|
+
state: 'wired',
|
|
487
|
+
modulePath: state.module.path,
|
|
488
|
+
hasModes,
|
|
489
|
+
provider: provide(hasModes),
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
const installed = themes.find(theme =>
|
|
493
|
+
themeOwnerInstalled(theme, state.projectDir),
|
|
494
|
+
);
|
|
495
|
+
if (installed) {
|
|
496
|
+
const hasModes = oneColorModeOf(installed, cwd);
|
|
497
|
+
return {
|
|
498
|
+
state: 'installed',
|
|
499
|
+
slug: installed.slug,
|
|
500
|
+
hasModes,
|
|
501
|
+
provider: provide(hasModes),
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
} catch (error) {
|
|
505
|
+
// Outside a project, or with theme state the theme commands refuse, the
|
|
506
|
+
// playbook names the starter theme; those commands report the problem.
|
|
507
|
+
if (!(error instanceof ThemeStateError || error instanceof AstryxError))
|
|
508
|
+
throw error;
|
|
509
|
+
}
|
|
510
|
+
return {
|
|
511
|
+
state: 'none',
|
|
512
|
+
slug: STARTER_THEME.slug,
|
|
513
|
+
package: STARTER_THEME.package,
|
|
514
|
+
provider: starterProvider,
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Whether `theme add` records one color mode for a theme: its built module
|
|
520
|
+
* exports one. A theme whose built module cannot be resolved has none here;
|
|
521
|
+
* `theme add` reports that problem.
|
|
522
|
+
* @param {import('../../foundation/discovery/theme-discovery.mjs').DiscoveredTheme} theme
|
|
523
|
+
* @param {string} cwd
|
|
524
|
+
*/
|
|
525
|
+
function oneColorModeOf(theme, cwd) {
|
|
526
|
+
try {
|
|
527
|
+
return resolveThemeImports(theme, {cwd}).mode != null;
|
|
528
|
+
} catch (error) {
|
|
529
|
+
if (error instanceof ThemeImportError) return false;
|
|
530
|
+
throw error;
|
|
531
|
+
}
|
|
532
|
+
}
|
package/api/build/build.doc.mjs
CHANGED
|
@@ -40,7 +40,7 @@ export const doc = {
|
|
|
40
40
|
name: 'options.cwd',
|
|
41
41
|
type: 'string',
|
|
42
42
|
description:
|
|
43
|
-
'Directory to resolve @astryxdesign/core and templates from.',
|
|
43
|
+
'Directory to resolve @astryxdesign/core and templates from, and whose theme wiring the playbook names.',
|
|
44
44
|
default: 'process.cwd()',
|
|
45
45
|
},
|
|
46
46
|
{
|
package/api/build/build.mjs
CHANGED
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import {AstryxError} from '../error.mjs';
|
|
18
|
+
import {
|
|
19
|
+
docPackageManager,
|
|
20
|
+
runWithDocPackageManager,
|
|
21
|
+
} from '../../foundation/env/package-manager.mjs';
|
|
18
22
|
import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
|
|
19
23
|
import {buildHelp} from './help/help.mjs';
|
|
20
24
|
import {buildKit} from './kit/kit.mjs';
|
|
@@ -40,7 +44,7 @@ export {buildHelp, buildKit};
|
|
|
40
44
|
*/
|
|
41
45
|
export async function build(query, options = {}) {
|
|
42
46
|
if (!query || !String(query).trim()) {
|
|
43
|
-
return buildHelp();
|
|
47
|
+
return buildHelp({cwd: options.cwd});
|
|
44
48
|
}
|
|
45
49
|
if (
|
|
46
50
|
options.limit != null &&
|
|
@@ -53,19 +57,24 @@ export async function build(query, options = {}) {
|
|
|
53
57
|
);
|
|
54
58
|
}
|
|
55
59
|
// The kit resolves every candidate's source and docs by walking the same
|
|
56
|
-
// tree; read each directory once for this call.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
// tree; read each directory once for this call. Doc `{@pm}` steps render
|
|
61
|
+
// for the project the call names, as search's do.
|
|
62
|
+
return runWithDocPackageManager(
|
|
63
|
+
docPackageManager(options.cwd ?? process.cwd()),
|
|
64
|
+
() =>
|
|
65
|
+
withListingCache(
|
|
66
|
+
async () =>
|
|
67
|
+
/** @type {import('./build.type.mjs').BuildKitResponse} */ (
|
|
68
|
+
await runTree(
|
|
69
|
+
BUILD_TREE,
|
|
70
|
+
{query, options},
|
|
71
|
+
{
|
|
72
|
+
weights: loadTreeWeights(),
|
|
73
|
+
blocks: loadBlockPicker(),
|
|
74
|
+
keepBlocks: keptBlockCatalog,
|
|
75
|
+
},
|
|
76
|
+
)
|
|
77
|
+
),
|
|
69
78
|
),
|
|
70
79
|
);
|
|
71
80
|
}
|
|
@@ -65,7 +65,7 @@ export type BuildStart = {
|
|
|
65
65
|
*/
|
|
66
66
|
package: string;
|
|
67
67
|
/**
|
|
68
|
-
* The scaffold command that selects exactly this template, `astryx template <id> --type page <path>`: `<id>` is the Core id an integration replacement stands in for, else the template's own id, `<path>` is the path `astryx template` names for the template in the project where build ran, from the project's layout and the template's own id (not the Core id a replacement stands in for): in a Next app, `<id>` in its App Router folder (`app/<id>` or `src/app/<id>`, in the route group with the root layout when that folder has none), or the page file `pages/<id>.tsx` or `src/pages/<id>.tsx` with only the Pages Router; else `src/pages/<id
|
|
68
|
+
* The scaffold command that selects exactly this template, `astryx template <id> --type page <path>`: `<id>` is the Core id an integration replacement stands in for, else the template's own id, `<path>` is the path `astryx template` names for the template in the project where build ran, from the project's layout and the template's own id (not the Core id a replacement stands in for): in a Next app, `<id>` in its App Router folder (`app/<id>` or `src/app/<id>`, in the route group with the root layout when that folder has none), or the page file `pages/<id>.tsx` or `src/pages/<id>.tsx` with only the Pages Router; else the page file `src/pages/<id>.tsx`; `<id>-2` and on when that path is taken, or, for a page file, when an import of it already resolves to a module (a folder's index or a file with another extension); quoted for a shell. It is the placeholder `<path>` when that folder has no package.json (`architecture:cli-surface` INV38), and the `astryx` prefix is for the caller to replace with its own invocation.
|
|
69
69
|
*/
|
|
70
70
|
command: string;
|
|
71
71
|
/**
|
package/api/build/build.type.mjs
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
* @property {string} displayName Human-facing template name.
|
|
44
44
|
* @property {string} description What the page is: its layout and the ideas it serves.
|
|
45
45
|
* @property {string} package The npm package that owns this template.
|
|
46
|
-
* @property {string} command The scaffold command that selects exactly this template, `astryx template <id> --type page <path>`: `<id>` is the Core id an integration replacement stands in for, else the template's own id, `<path>` is the path `astryx template` names for the template in the project where build ran, from the project's layout and the template's own id (not the Core id a replacement stands in for): in a Next app, `<id>` in its App Router folder (`app/<id>` or `src/app/<id>`, in the route group with the root layout when that folder has none), or the page file `pages/<id>.tsx` or `src/pages/<id>.tsx` with only the Pages Router; else `src/pages/<id
|
|
46
|
+
* @property {string} command The scaffold command that selects exactly this template, `astryx template <id> --type page <path>`: `<id>` is the Core id an integration replacement stands in for, else the template's own id, `<path>` is the path `astryx template` names for the template in the project where build ran, from the project's layout and the template's own id (not the Core id a replacement stands in for): in a Next app, `<id>` in its App Router folder (`app/<id>` or `src/app/<id>`, in the route group with the root layout when that folder has none), or the page file `pages/<id>.tsx` or `src/pages/<id>.tsx` with only the Pages Router; else the page file `src/pages/<id>.tsx`; `<id>-2` and on when that path is taken, or, for a page file, when an import of it already resolves to a module (a folder's index or a file with another extension); quoted for a shell. It is the placeholder `<path>` when that folder has no package.json (`architecture:cli-surface` INV38), and the `astryx` prefix is for the caller to replace with its own invocation.
|
|
47
47
|
* @property {'direct' | 'closest' | 'fallback'} basis Why this template. The page ranker orders the page templates: it weighs each matched word by how rare it is among page templates, favors the family the idea's head names and the container it names ("in a modal"), and discounts words that only modify another. For a part or an edit, the start is where the ranker's placement rules put it; for a whole page, checked-in word weights decide page or app shell and a page-pick model chooses the page from the ranker's list and its own word tables, so the start can differ from the ranker's first template. `direct` when the start is also search's direct match (`directMatch`); `closest` when it is not; `fallback` when the page starts from the app shell.
|
|
48
48
|
* @property {string} reason One sentence saying the same as `basis`, for a reader.
|
|
49
49
|
* @property {number} [fit] For a start that is a page template (not the app shell): the page-pick model's probability for the start among the ready page templates, 0 to 1. A high value means the pick model clearly prefers this template; a low one means several templates fit about as well. At or above 0.4 the choice is clear: below it, the pick model's start agrees with labeled requests less than half the time. Absent for a template the word tables do not list. Absent for an app-shell start and in a project without word weights.
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
* @property {import('../search/search.type.mjs').SearchResultEntry[]} data.pages Closest page templates by search that build could start from (≤3): a template the catalog holds as not ready is left out. Each entry's `command` carries `--skeleton` when `directMatch` is false, so it previews the layout; `start.command` is the scaffold.
|
|
83
83
|
* @property {import('../search/search.type.mjs').SearchResultEntry[]} data.blocks Drop-in block patterns covering parts of the idea (≤5), best first. A block search returned keeps search's score and reason; any other block carries the block picker's relative score (100 for its best candidate, never below 1) and reason, so the two kinds of score are not comparable.
|
|
84
84
|
* @property {import('../search/search.type.mjs').SearchResultEntry[]} data.domain Idea-specific components/hooks (≤6), excluding frame/foundation.
|
|
85
|
-
* @property {string[]} data.frame Always-on page-shell component names. Every page template already uses them.
|
|
86
|
-
* @property {string[]} data.foundation Always-on layout/typography/action component names. Every page template already uses them.
|
|
85
|
+
* @property {string[]} data.frame Always-on page-shell component names. Every page template already uses them. Empty when the active base is not Core.
|
|
86
|
+
* @property {string[]} data.foundation Always-on layout/typography/action component names. Every page template already uses them. Empty when the active base is not Core.
|
|
87
87
|
* @property {{reason: string, commands: string[]}} [data.hint] Present only when the kit is thin. `reason` says why, `commands` are bare subcommands (e.g. `component --list`) for the caller to render with its own invocation — so a reader is never handed a command that does not resolve in their project.
|
|
88
88
|
*/
|
|
89
89
|
|
|
@@ -2,22 +2,23 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* The workflow starts every page from a template, because a template already
|
|
15
|
-
* has the frame, spacing, and section rhythm that a page composed from
|
|
16
|
-
* components has to rediscover.
|
|
5
|
+
* The rule that wires the app's theme, for one project's theme state.
|
|
6
|
+
* @param {import('../_adapter.mjs').AppThemeWiring} wiring
|
|
7
|
+
* @returns {string}
|
|
8
|
+
*/
|
|
9
|
+
export function themeRule(wiring: import("../_adapter.mjs").AppThemeWiring): string;
|
|
10
|
+
/**
|
|
11
|
+
* The step that adds the app's theme, when the project has none added yet.
|
|
12
|
+
* @param {import('../_adapter.mjs').AppThemeWiring} wiring
|
|
13
|
+
* @returns {import('../build.type.mjs').BuildPlaybookStep | null}
|
|
17
14
|
*/
|
|
15
|
+
export function themeStep(wiring: import("../_adapter.mjs").AppThemeWiring): import("../build.type.mjs").BuildPlaybookStep | null;
|
|
18
16
|
/**
|
|
19
17
|
* The page-building playbook (emitted when `build` runs with no query).
|
|
20
18
|
*
|
|
21
|
-
* @
|
|
19
|
+
* @param {{cwd?: string}} [options] the project whose theme the rules wire
|
|
20
|
+
* @returns {Promise<import('../build.type.mjs').BuildHelpResponse>}
|
|
22
21
|
*/
|
|
23
|
-
export function buildHelp(
|
|
22
|
+
export function buildHelp(options?: {
|
|
23
|
+
cwd?: string;
|
|
24
|
+
}): Promise<import("../build.type.mjs").BuildHelpResponse>;
|
package/api/build/help/help.mjs
CHANGED
|
@@ -13,14 +13,72 @@
|
|
|
13
13
|
* The workflow starts every page from a template, because a template already
|
|
14
14
|
* has the frame, spacing, and section rhythm that a page composed from
|
|
15
15
|
* components has to rediscover.
|
|
16
|
+
*
|
|
17
|
+
* The theme rule names the exact wiring for the project the call names, as
|
|
18
|
+
* `theme add` prints it: the import and the value `<Theme>` takes, or the
|
|
19
|
+
* provider an installed package names to take it. When no theme is added yet,
|
|
20
|
+
* a last step adds one, as a command. A rule that leaves the value open gets
|
|
21
|
+
* guessed as a theme name, and `<Theme>` with a name crashes on hydrate.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import {appThemeWiring} from '../_adapter.mjs';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The rule that wires the app's theme, for one project's theme state.
|
|
28
|
+
* @param {import('../_adapter.mjs').AppThemeWiring} wiring
|
|
29
|
+
* @returns {string}
|
|
30
|
+
*/
|
|
31
|
+
export function themeRule(wiring) {
|
|
32
|
+
const module =
|
|
33
|
+
wiring.state === 'wired'
|
|
34
|
+
? `the generated ${wiring.modulePath}`
|
|
35
|
+
: 'the astryx-themes module the theme step writes';
|
|
36
|
+
const notAName =
|
|
37
|
+
'The theme prop takes that theme object, never a name such as "light".';
|
|
38
|
+
/** The module's names some markup uses: `themeModes` only when it passes a mode. */
|
|
39
|
+
const names = (/** @type {string} */ markup) =>
|
|
40
|
+
markup.includes('themeModes[')
|
|
41
|
+
? 'themes, defaultThemeSlug, themeModes'
|
|
42
|
+
: 'themes, defaultThemeSlug';
|
|
43
|
+
const {provider} = wiring;
|
|
44
|
+
if (provider) {
|
|
45
|
+
return `Pass the theme to the app's ${provider.export}, which wires it: ${provider.line} (import {${provider.export}} from '${provider.from}', and {${names(provider.line)}} from ${module}), and import core reset.css + astryx.css. ${notAName}`;
|
|
46
|
+
}
|
|
47
|
+
const modes = wiring.state !== 'none' && wiring.hasModes;
|
|
48
|
+
const mode = modes ? " mode={themeModes[defaultThemeSlug] ?? 'system'}" : '';
|
|
49
|
+
return `Wrap the app in <Theme theme={themes[defaultThemeSlug]}${mode}> (import {Theme} from '@astryxdesign/core/theme', and {${names(mode)}} from ${module}) and import core reset.css + astryx.css. ${notAName}`;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The step that adds the app's theme, when the project has none added yet.
|
|
54
|
+
* @param {import('../_adapter.mjs').AppThemeWiring} wiring
|
|
55
|
+
* @returns {import('../build.type.mjs').BuildPlaybookStep | null}
|
|
16
56
|
*/
|
|
57
|
+
export function themeStep(wiring) {
|
|
58
|
+
if (wiring.state === 'wired') return null;
|
|
59
|
+
return {
|
|
60
|
+
title:
|
|
61
|
+
wiring.state === 'none'
|
|
62
|
+
? `Install ${wiring.package}, then add it as the app's theme (once)`
|
|
63
|
+
: "Add your installed theme as the app's theme (once)",
|
|
64
|
+
commands: [
|
|
65
|
+
{
|
|
66
|
+
command: `theme add ${wiring.slug}`,
|
|
67
|
+
purpose:
|
|
68
|
+
'write the astryx-themes module the app root takes its theme from',
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
17
73
|
|
|
18
74
|
/**
|
|
19
75
|
* The page-building playbook (emitted when `build` runs with no query).
|
|
20
76
|
*
|
|
21
|
-
* @
|
|
77
|
+
* @param {{cwd?: string}} [options] the project whose theme the rules wire
|
|
78
|
+
* @returns {Promise<import('../build.type.mjs').BuildHelpResponse>}
|
|
22
79
|
*/
|
|
23
|
-
export function buildHelp() {
|
|
80
|
+
export async function buildHelp(options = {}) {
|
|
81
|
+
const wiring = await appThemeWiring(options.cwd ?? process.cwd());
|
|
24
82
|
return {
|
|
25
83
|
type: 'build.help',
|
|
26
84
|
data: {
|
|
@@ -56,6 +114,7 @@ export function buildHelp() {
|
|
|
56
114
|
},
|
|
57
115
|
],
|
|
58
116
|
},
|
|
117
|
+
...[themeStep(wiring)].filter(step => step != null),
|
|
59
118
|
],
|
|
60
119
|
rules: [
|
|
61
120
|
'Start every page from a page template. Never lay out a page from scratch.',
|
|
@@ -63,7 +122,7 @@ export function buildHelp() {
|
|
|
63
122
|
"Keep the template's page frame, gap, and padding values. Replace its data, copy, and sections.",
|
|
64
123
|
'No <div>/raw HTML for layout — use VStack/HStack/Grid/Stack/Card etc.',
|
|
65
124
|
'No style={{}} — use component props, and design tokens for values.',
|
|
66
|
-
|
|
125
|
+
themeRule(wiring),
|
|
67
126
|
],
|
|
68
127
|
related: [
|
|
69
128
|
{
|
package/api/build/kit/answer.mjs
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {firstSentence} from '../../../foundation/text/string-utils.mjs';
|
|
14
|
-
import {FOUNDATION, FRAME} from './signals.mjs';
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* Fewer offerable results than this and the kit says how to look further.
|
|
@@ -99,8 +98,8 @@ export function kitAnswer(
|
|
|
99
98
|
pages: signals.pages,
|
|
100
99
|
blocks: list,
|
|
101
100
|
domain: signals.domain,
|
|
102
|
-
frame:
|
|
103
|
-
foundation:
|
|
101
|
+
frame: signals.frame,
|
|
102
|
+
foundation: signals.foundation,
|
|
104
103
|
hint,
|
|
105
104
|
},
|
|
106
105
|
});
|
|
@@ -55,6 +55,16 @@ export type KitSignals = {
|
|
|
55
55
|
* the names of `blocks`
|
|
56
56
|
*/
|
|
57
57
|
kitBlocks: string[];
|
|
58
|
+
/**
|
|
59
|
+
* the always-on page-shell components; none on a
|
|
60
|
+
* base other than Core
|
|
61
|
+
*/
|
|
62
|
+
frame: string[];
|
|
63
|
+
/**
|
|
64
|
+
* the always-on layout, type, and action
|
|
65
|
+
* components; none on a base other than Core
|
|
66
|
+
*/
|
|
67
|
+
foundation: string[];
|
|
58
68
|
/**
|
|
59
69
|
* every block search returned, in its order
|
|
60
70
|
*/
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
searchedComponents,
|
|
19
19
|
} from '../../search/search.mjs';
|
|
20
20
|
import {coreDirOrThrow} from '../../error.mjs';
|
|
21
|
+
import {runBase} from '../../../foundation/bases/resolve.mjs';
|
|
21
22
|
import {getResultCoverage} from '../../search/coverage.mjs';
|
|
22
23
|
import {CORE_PROVIDER_ID} from '../../../foundation/identity/providers.mjs';
|
|
23
24
|
import {
|
|
@@ -85,7 +86,6 @@ export const FOUNDATION = [
|
|
|
85
86
|
'Divider',
|
|
86
87
|
];
|
|
87
88
|
|
|
88
|
-
const ALWAYS = new Set([...FRAME, ...FOUNDATION]);
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
91
|
* @typedef {import('../../search/search.type.mjs').SearchResultEntry} SearchResultEntry
|
|
@@ -107,6 +107,10 @@ const ALWAYS = new Set([...FRAME, ...FOUNDATION]);
|
|
|
107
107
|
* @property {SearchResultEntry[]} blocks the blocks build names itself
|
|
108
108
|
* @property {SearchResultEntry[]} domain
|
|
109
109
|
* @property {string[]} kitBlocks the names of `blocks`
|
|
110
|
+
* @property {string[]} frame the always-on page-shell components; none on a
|
|
111
|
+
* base other than Core
|
|
112
|
+
* @property {string[]} foundation the always-on layout, type, and action
|
|
113
|
+
* components; none on a base other than Core
|
|
110
114
|
* @property {BlockScore[]} searched every block search returned, in its order
|
|
111
115
|
* @property {Map<string, SearchResultEntry>} searchedEntries search's entry for each of those blocks (the first of a name)
|
|
112
116
|
* @property {Map<string, string>} blockText each of those blocks' display name and description, from the catalog
|
|
@@ -160,6 +164,12 @@ export async function kitSignals(query, options = {}) {
|
|
|
160
164
|
// A kit is built from Core's components, hooks, and templates. An open
|
|
161
165
|
// search without core covers the docs alone, so the kit asks for core here.
|
|
162
166
|
if (type !== 'doc') coreDirOrThrow(buildCoreContentDir, cwd);
|
|
167
|
+
// The always-on names are Core components, so they belong to a run on Core
|
|
168
|
+
// and to no other base.
|
|
169
|
+
const run = runBase(cwd);
|
|
170
|
+
const onCore = !run.ok || run.base.core;
|
|
171
|
+
const frame = onCore ? FRAME : [];
|
|
172
|
+
const foundation = onCore ? FOUNDATION : [];
|
|
163
173
|
// search()'s JSDoc @returns widens results to object[]; the SearchResponse
|
|
164
174
|
// shape is the contract (api/search/search.type.mjs). Cast locally rather than
|
|
165
175
|
// tightening the search @returns (a separate follow-up).
|
|
@@ -235,12 +245,13 @@ export async function kitSignals(query, options = {}) {
|
|
|
235
245
|
const blocks = searchedBlocks
|
|
236
246
|
.filter(r => r.score >= DOMAIN_FLOOR)
|
|
237
247
|
.slice(0, 5);
|
|
248
|
+
const always = new Set([...frame, ...foundation]);
|
|
238
249
|
const domain = results
|
|
239
250
|
.filter(
|
|
240
251
|
r =>
|
|
241
252
|
(r.domain === 'component' || r.domain === 'hook') &&
|
|
242
253
|
r.score >= DOMAIN_FLOOR &&
|
|
243
|
-
!
|
|
254
|
+
!always.has(r.name),
|
|
244
255
|
)
|
|
245
256
|
.slice(0, 6);
|
|
246
257
|
const directMatch =
|
|
@@ -362,6 +373,8 @@ export async function kitSignals(query, options = {}) {
|
|
|
362
373
|
blocks: blocksKept,
|
|
363
374
|
domain: domainKept,
|
|
364
375
|
kitBlocks: blocksKept.map(r => r.name),
|
|
376
|
+
frame,
|
|
377
|
+
foundation,
|
|
365
378
|
searched: searchedBlocks.map(blockScore),
|
|
366
379
|
searchedEntries: new Map(
|
|
367
380
|
[...searchedBlocks].reverse().map(r => [r.name, r]),
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import * as path from 'node:path';
|
|
12
12
|
import {findRelatedBlocks, pkgOf} from '../../../template/template.mjs';
|
|
13
|
+
import {renderTokens} from '../../../../foundation/doc-compiler/links.mjs';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Project a component's related blocks into the `component.detail.blocks`
|
|
@@ -26,7 +27,7 @@ export async function componentDetailBlocks(componentName, cwd, ownerPackage) {
|
|
|
26
27
|
name: b.dirName,
|
|
27
28
|
package: pkgOf(b),
|
|
28
29
|
displayName: b.name,
|
|
29
|
-
description: b.description,
|
|
30
|
+
description: renderTokens(b.description),
|
|
30
31
|
isShowcase: b.isShowcase ?? false,
|
|
31
32
|
category: b.category,
|
|
32
33
|
isReady: b.isReady !== false,
|