@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
|
@@ -63,6 +63,7 @@ import * as os from 'node:os';
|
|
|
63
63
|
import * as path from 'node:path';
|
|
64
64
|
import {createRequire, isBuiltin} from 'node:module';
|
|
65
65
|
import {moduleImports} from '../../../foundation/render/embedded-imports.mjs';
|
|
66
|
+
import {projectMapsImport} from '../../../foundation/render/ts-paths.mjs';
|
|
66
67
|
import {STYLESHEET_FILE} from '../../../foundation/fs/stylesheet-file.mjs';
|
|
67
68
|
import {fileURLToPath, pathToFileURL} from 'node:url';
|
|
68
69
|
import {babelParse as parse} from '../../../foundation/runtime/lazy-dependencies.mjs';
|
|
@@ -113,12 +114,14 @@ import {interceptCore} from './core-interception.mjs';
|
|
|
113
114
|
import {irregularFileKind} from '../../../foundation/fs/regular-file.mjs';
|
|
114
115
|
import {keyPathLine, keyValueLine, nullThemeValues} from './null-values.mjs';
|
|
115
116
|
import {typographyInputProblems} from './typography-values.mjs';
|
|
117
|
+
import {radiusInputProblems} from './radius-values.mjs';
|
|
116
118
|
import {sourcePlugins} from './source-syntax.mjs';
|
|
117
119
|
import {
|
|
118
120
|
INPUT_DECLARATION_FILES,
|
|
119
121
|
inputFieldsFrom,
|
|
120
122
|
sourceFieldProblems,
|
|
121
123
|
inputFieldProblems,
|
|
124
|
+
sourceInputField,
|
|
122
125
|
sourceTypography,
|
|
123
126
|
} from './input-fields.mjs';
|
|
124
127
|
import {styleKeyProblems} from './style-keys.mjs';
|
|
@@ -130,6 +133,7 @@ import {
|
|
|
130
133
|
import {levenshteinDistance} from '../../../foundation/text/levenshtein.mjs';
|
|
131
134
|
import {
|
|
132
135
|
installCommandFor,
|
|
136
|
+
installStepFor,
|
|
133
137
|
parsedSpecifiers,
|
|
134
138
|
} from '../../../foundation/discovery/template-needs.mjs';
|
|
135
139
|
import {generateFamilyCSS, resolveThemeFamily} from './family.mjs';
|
|
@@ -605,6 +609,15 @@ function inAstryxRepository(cwd) {
|
|
|
605
609
|
return false;
|
|
606
610
|
}
|
|
607
611
|
|
|
612
|
+
/**
|
|
613
|
+
* The step that installs Core in the project at `cwd`, as message text.
|
|
614
|
+
* @param {string} cwd
|
|
615
|
+
*/
|
|
616
|
+
function coreInstallText(cwd) {
|
|
617
|
+
const {line, note} = installStepFor(['@astryxdesign/core'], cwd);
|
|
618
|
+
return note ? `\`${line}\` (${note})` : `\`${line}\``;
|
|
619
|
+
}
|
|
620
|
+
|
|
608
621
|
/**
|
|
609
622
|
* Why `theme build` has no Core to generate with, and the fix for where it
|
|
610
623
|
* ran: the Astryx repository builds Core, an app installs it, and an installed
|
|
@@ -632,7 +645,7 @@ export function coreUnavailableMessage(cwd, importError) {
|
|
|
632
645
|
}
|
|
633
646
|
return (
|
|
634
647
|
`This project does not have @astryxdesign/core installed: ${why}. Install ` +
|
|
635
|
-
`it:
|
|
648
|
+
`it: ${coreInstallText(cwd)}.${detail}`
|
|
636
649
|
);
|
|
637
650
|
}
|
|
638
651
|
|
|
@@ -690,6 +703,56 @@ function headerRoot(outDir, cwd) {
|
|
|
690
703
|
return findPackageRoot(outDir) ?? path.resolve(cwd);
|
|
691
704
|
}
|
|
692
705
|
|
|
706
|
+
/**
|
|
707
|
+
* Whether a file is an output of some released `theme build`: its header has
|
|
708
|
+
* the build's mark, or, with `legacy`, a mark or shape of the CLI before it
|
|
709
|
+
* was named Astryx: its header's mark, or for its releases that wrote no
|
|
710
|
+
* header, the shape they wrote: a stylesheet in the `xds.theme`,
|
|
711
|
+
* `xds-theme` or `reset` layer scoped to `[data-xds-theme=…]`, a module
|
|
712
|
+
* that says it was built by `xds theme build` (`xds build-theme` at first),
|
|
713
|
+
* declarations of a built theme with their import, or variant declarations
|
|
714
|
+
* that open with `// Generated by xds theme build`.
|
|
715
|
+
* @param {string} file
|
|
716
|
+
* @param {{legacy?: boolean}} [options]
|
|
717
|
+
*/
|
|
718
|
+
function isBuildOutput(file, {legacy = false} = {}) {
|
|
719
|
+
const head = fileHead(file);
|
|
720
|
+
if (head.includes(GENERATED_MARKER)) return true;
|
|
721
|
+
if (!legacy) return false;
|
|
722
|
+
if (head.includes(LEGACY_BUILD_MARKER)) return true;
|
|
723
|
+
const text = head.trimStart();
|
|
724
|
+
if (/\.css$/i.test(file))
|
|
725
|
+
return (
|
|
726
|
+
/^@layer (?:xds\.theme|xds-theme|reset) \{/.test(text) &&
|
|
727
|
+
text.includes('[data-xds-theme=')
|
|
728
|
+
);
|
|
729
|
+
if (/\.d\.ts$/i.test(file)) {
|
|
730
|
+
// A theme's variant declarations (`<theme>.variants.d.ts`) opened with
|
|
731
|
+
// this line in those releases.
|
|
732
|
+
if (text.startsWith('// Generated by xds theme build')) return true;
|
|
733
|
+
const lines = text
|
|
734
|
+
.split('\n')
|
|
735
|
+
.map(line => line.trim())
|
|
736
|
+
.filter(Boolean);
|
|
737
|
+
return (
|
|
738
|
+
lines.includes(
|
|
739
|
+
"import type { XDSDefinedTheme } from '@xds/core/theme';",
|
|
740
|
+
) &&
|
|
741
|
+
lines.every(line =>
|
|
742
|
+
/^(?:import type \{[^}]*\} from '@xds\/core[^']*';|export declare const [A-Za-z_$][\w$]*: [A-Za-z_$][\w$]*;)$/.test(
|
|
743
|
+
line,
|
|
744
|
+
),
|
|
745
|
+
)
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
if (/\.js$/i.test(file))
|
|
749
|
+
return /theme — built by `[^`]*xds (?:theme build|build-theme)`/.test(head);
|
|
750
|
+
return false;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
/** The mark headers of the CLI carried before it was named Astryx. */
|
|
754
|
+
const LEGACY_BUILD_MARKER = '@generated by `xds theme build`';
|
|
755
|
+
|
|
693
756
|
/**
|
|
694
757
|
* Whether a build refuses to replace, at a path `--out` names, the output of
|
|
695
758
|
* another theme source that still exists. False makes it warn and replace.
|
|
@@ -1319,7 +1382,10 @@ function assertThemeSourceFile(filePath, cwd, mode = {}) {
|
|
|
1319
1382
|
* `familyInterception` make the build a family member's plan.
|
|
1320
1383
|
* `colorModes` is the one color mode a calling command knows the theme has
|
|
1321
1384
|
* (the theme editor, from its settings), written into the built module.
|
|
1322
|
-
*
|
|
1385
|
+
* `ownsOutputs` says the caller made the folder the outputs go into and owns
|
|
1386
|
+
* every file there named like one (the theme editor's theme folder), so a
|
|
1387
|
+
* damaged or half-written output is replaced, never refused.
|
|
1388
|
+
* @typedef {{ownsOutputs?: boolean, prepareFamily?: boolean, familyLoader?: any, familyInterception?: any, writeRoot?: string, claimedOutputs?: Map<string, string>, deferredWrites?: Array<Array<{dest: string, content: string}>>, commandWords?: {group: string, build: string}, colorModes?: ['light'] | ['dark'] | null, fontHelp?: FontHelp | null, loadedFonts?: ((family: string) => boolean) | null, install?: string | null}} ThemeBuildHandOff
|
|
1323
1389
|
*/
|
|
1324
1390
|
|
|
1325
1391
|
/**
|
|
@@ -1449,17 +1515,20 @@ export function buildSuggestion(source, mode, cwd, words, shape = {}) {
|
|
|
1449
1515
|
/**
|
|
1450
1516
|
* Refuse a build that would replace a file it does not own. A build never
|
|
1451
1517
|
* writes over its input, two of its own outputs at one path, or an output
|
|
1452
|
-
* another theme in the same run already wrote. With `refuseUnmarked` (
|
|
1453
|
-
*
|
|
1454
|
-
*
|
|
1455
|
-
*
|
|
1518
|
+
* another theme in the same run already wrote. With `refuseUnmarked` (every
|
|
1519
|
+
* build but one whose caller owns the output folder), it also replaces only
|
|
1520
|
+
* outputs of a release of the build (isBuildOutput) and empty files, never
|
|
1521
|
+
* another file such as the user's own stylesheet, `package.json` or app
|
|
1522
|
+
* source.
|
|
1456
1523
|
* @param {Array<{dest: string}>} writes
|
|
1457
1524
|
* @param {string} filePath the theme source
|
|
1458
1525
|
* @param {string} cwd
|
|
1459
|
-
* @param {{claimed?: Map<string, string>, rerun?: (out: string | null) => string, refuseUnmarked?: boolean, warnUnmarked?: boolean, elsewhere?: string, onEditorFolder?: (warning: string) => void, onWarning?: (message: string) => void}} [options]
|
|
1526
|
+
* @param {{claimed?: Map<string, string>, rerun?: (out: string | null) => string, refuseUnmarked?: boolean, warnUnmarked?: boolean, acceptLegacy?: boolean, elsewhere?: string, onEditorFolder?: (warning: string) => void, onWarning?: (message: string) => void}} [options]
|
|
1460
1527
|
* `claimed`: outputs written earlier in this run, by the source that wrote
|
|
1461
1528
|
* them; `rerun`: this build's command with another --out, or without one;
|
|
1462
|
-
* `
|
|
1529
|
+
* `acceptLegacy`: an output of the CLI before it was named Astryx counts
|
|
1530
|
+
* as the build's own (the default paths, where the build always replaced
|
|
1531
|
+
* them); `warnUnmarked` (with `refuseUnmarked`): a header-less file is replaced
|
|
1463
1532
|
* with a warning naming it, as a family build has always replaced one;
|
|
1464
1533
|
* `elsewhere`: the option that moves the outputs; `onEditorFolder`: takes
|
|
1465
1534
|
* the editor-folder warning instead of the logger (a watcher prints it
|
|
@@ -1474,6 +1543,7 @@ function assertOutputsReplaceable(
|
|
|
1474
1543
|
rerun,
|
|
1475
1544
|
refuseUnmarked = false,
|
|
1476
1545
|
warnUnmarked = false,
|
|
1546
|
+
acceptLegacy = false,
|
|
1477
1547
|
elsewhere = '--out',
|
|
1478
1548
|
onEditorFolder,
|
|
1479
1549
|
onWarning,
|
|
@@ -1553,8 +1623,6 @@ function assertOutputsReplaceable(
|
|
|
1553
1623
|
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
1554
1624
|
);
|
|
1555
1625
|
}
|
|
1556
|
-
// Only a path --out names is checked: at the default paths beside the
|
|
1557
|
-
// source, a build replaces what is there, as it always has.
|
|
1558
1626
|
const otherSource = refuseUnmarked
|
|
1559
1627
|
? builtFromOtherSource(write.dest, owner, cwd)
|
|
1560
1628
|
: null;
|
|
@@ -1571,33 +1639,29 @@ function assertOutputsReplaceable(
|
|
|
1571
1639
|
ERROR_CODES.ERR_FILE_EXISTS,
|
|
1572
1640
|
);
|
|
1573
1641
|
}
|
|
1574
|
-
//
|
|
1575
|
-
//
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
) {
|
|
1642
|
+
// A file no release of the build wrote is the user's or another
|
|
1643
|
+
// tool's: only the user can say it may go.
|
|
1644
|
+
// A family build keeps its released rule: a file without the current
|
|
1645
|
+
// mark is replaced with a warning naming it.
|
|
1646
|
+
const ours = isBuildOutput(write.dest, {legacy: acceptLegacy});
|
|
1647
|
+
if (refuseUnmarked && stat.size > 0 && !ours) {
|
|
1581
1648
|
if (warnUnmarked) {
|
|
1582
1649
|
unmarkedReplaced.push(rel(write.dest));
|
|
1583
1650
|
continue;
|
|
1584
1651
|
}
|
|
1585
|
-
//
|
|
1586
|
-
//
|
|
1652
|
+
// A path that takes every output, where nothing is replaced; never
|
|
1653
|
+
// the same paths again.
|
|
1587
1654
|
const free = freeOutPath(writes);
|
|
1588
1655
|
throw new AstryxError(
|
|
1589
|
-
`${rel(write.dest)} is a file this build did not write (it has no build header: your own file
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
: []),
|
|
1599
|
-
beside,
|
|
1600
|
-
],
|
|
1656
|
+
`${rel(write.dest)} is a file this build did not write (it has no build header: your own file or another tool's), so the build does not replace it. Build to another place with ${elsewhere}, or move or rename ${rel(write.dest)} and build again.`,
|
|
1657
|
+
free && rerun
|
|
1658
|
+
? [
|
|
1659
|
+
{
|
|
1660
|
+
name: rerun(rel(free)),
|
|
1661
|
+
reason: 'a path where no output of this build exists yet',
|
|
1662
|
+
},
|
|
1663
|
+
]
|
|
1664
|
+
: [],
|
|
1601
1665
|
ERROR_CODES.ERR_FILE_EXISTS,
|
|
1602
1666
|
);
|
|
1603
1667
|
}
|
|
@@ -1609,7 +1673,7 @@ function assertOutputsReplaceable(
|
|
|
1609
1673
|
onWarning?.(warnedOtherSource);
|
|
1610
1674
|
}
|
|
1611
1675
|
if (unmarkedReplaced.length) {
|
|
1612
|
-
const message = `${unmarkedReplaced.join(', ')} ${unmarkedReplaced.length > 1 ? 'have' : 'has'} no build header (an output
|
|
1676
|
+
const message = `${unmarkedReplaced.join(', ')} ${unmarkedReplaced.length > 1 ? 'have' : 'has'} no build header (an output of an earlier build, or a file of your own or another tool's), and this build of ${rel(filePath)} replaces ${unmarkedReplaced.length > 1 ? 'them' : 'it'}; to keep a file of your own there, build with another ${elsewhere}.`;
|
|
1613
1677
|
logger.warn(`Warning: ${message}`);
|
|
1614
1678
|
onWarning?.(message);
|
|
1615
1679
|
}
|
|
@@ -3101,16 +3165,20 @@ function isPlainObject(value) {
|
|
|
3101
3165
|
|
|
3102
3166
|
/**
|
|
3103
3167
|
* @param {any} value
|
|
3168
|
+
* @param {Set<any>} [seen] the themes already met on the way up its bases
|
|
3104
3169
|
* @returns {boolean}
|
|
3105
3170
|
*/
|
|
3106
|
-
function isThemeObject(value) {
|
|
3171
|
+
function isThemeObject(value, seen = new Set()) {
|
|
3172
|
+
if (seen.has(value)) return false;
|
|
3173
|
+
seen.add(value);
|
|
3107
3174
|
return Boolean(
|
|
3108
3175
|
value &&
|
|
3109
3176
|
typeof value === 'object' &&
|
|
3110
3177
|
typeof value.name === 'string' &&
|
|
3111
3178
|
((value.tokens && typeof value.tokens === 'object') ||
|
|
3112
|
-
// A theme with no tokens of its own over a base it extends
|
|
3113
|
-
|
|
3179
|
+
// A theme with no tokens of its own over a base it extends (a base
|
|
3180
|
+
// that reaches back to it is no theme: `extends` cycles).
|
|
3181
|
+
isThemeObject(value.extends, seen)),
|
|
3114
3182
|
);
|
|
3115
3183
|
}
|
|
3116
3184
|
|
|
@@ -3458,14 +3526,15 @@ function themeLoadSuggestions(error, shown, cwd, mode = {}) {
|
|
|
3458
3526
|
];
|
|
3459
3527
|
const missing = missingThemePackage(error.cause ?? error);
|
|
3460
3528
|
if (missing) {
|
|
3461
|
-
const {installCommand} = installCommandFor(
|
|
3529
|
+
const {installCommand, installGuidance} = installCommandFor(
|
|
3462
3530
|
[missing],
|
|
3463
3531
|
findPackageRoot(cwd) ?? cwd,
|
|
3464
3532
|
);
|
|
3465
|
-
|
|
3533
|
+
const install = installGuidance ?? installCommand;
|
|
3534
|
+
if (install) {
|
|
3466
3535
|
return [
|
|
3467
3536
|
{
|
|
3468
|
-
name:
|
|
3537
|
+
name: install,
|
|
3469
3538
|
reason: `install ${missing}, which the theme imports`,
|
|
3470
3539
|
},
|
|
3471
3540
|
];
|
|
@@ -3522,70 +3591,6 @@ function importerOf(message) {
|
|
|
3522
3591
|
}
|
|
3523
3592
|
}
|
|
3524
3593
|
|
|
3525
|
-
/**
|
|
3526
|
-
* Whether the project that holds `from` maps `specifier` itself: the nearest
|
|
3527
|
-
* tsconfig.json or jsconfig.json names it in `compilerOptions.paths` (`@app/*`
|
|
3528
|
-
* maps `@app/c`), or its `baseUrl` holds the file (`lib/c`). The theme loader
|
|
3529
|
-
* maps neither, so such an import is a path alias, never a package.
|
|
3530
|
-
* @param {string} specifier
|
|
3531
|
-
* @param {string | null} from the importing module
|
|
3532
|
-
* @returns {boolean}
|
|
3533
|
-
*/
|
|
3534
|
-
export function projectMapsImport(specifier, from) {
|
|
3535
|
-
if (!from) return false;
|
|
3536
|
-
for (let dir = path.dirname(from); ; dir = path.dirname(dir)) {
|
|
3537
|
-
for (const name of ['tsconfig.json', 'jsconfig.json']) {
|
|
3538
|
-
const file = path.join(dir, name);
|
|
3539
|
-
/** @type {any} */
|
|
3540
|
-
let config;
|
|
3541
|
-
try {
|
|
3542
|
-
// JSON with comments and trailing commas, as TypeScript reads it.
|
|
3543
|
-
config = JSON.parse(
|
|
3544
|
-
fs
|
|
3545
|
-
.readFileSync(file, 'utf8')
|
|
3546
|
-
.replace(
|
|
3547
|
-
/("(?:[^"\\]|\\.)*")|\/\/[^\n]*|\/\*[\s\S]*?\*\//g,
|
|
3548
|
-
(m, str) => str ?? '',
|
|
3549
|
-
)
|
|
3550
|
-
.replace(/,(\s*[}\]])/g, '$1'),
|
|
3551
|
-
);
|
|
3552
|
-
} catch {
|
|
3553
|
-
continue;
|
|
3554
|
-
}
|
|
3555
|
-
const options = config?.compilerOptions ?? {};
|
|
3556
|
-
const paths = Object.keys(
|
|
3557
|
-
options.paths && typeof options.paths === 'object' ? options.paths : {},
|
|
3558
|
-
);
|
|
3559
|
-
if (
|
|
3560
|
-
paths.some(pattern =>
|
|
3561
|
-
pattern.endsWith('*')
|
|
3562
|
-
? specifier.startsWith(pattern.slice(0, -1))
|
|
3563
|
-
: specifier === pattern,
|
|
3564
|
-
)
|
|
3565
|
-
)
|
|
3566
|
-
return true;
|
|
3567
|
-
if (typeof options.baseUrl === 'string') {
|
|
3568
|
-
const base = path.resolve(dir, options.baseUrl, specifier);
|
|
3569
|
-
if (
|
|
3570
|
-
['', ...THEME_MODULE_EXTENSIONS].some(ext => {
|
|
3571
|
-
try {
|
|
3572
|
-
return fs.statSync(base + ext).isFile();
|
|
3573
|
-
} catch {
|
|
3574
|
-
return false;
|
|
3575
|
-
}
|
|
3576
|
-
}) ||
|
|
3577
|
-
THEME_MODULE_EXTENSIONS.some(ext =>
|
|
3578
|
-
fs.existsSync(path.join(base, `index${ext}`)),
|
|
3579
|
-
)
|
|
3580
|
-
)
|
|
3581
|
-
return true;
|
|
3582
|
-
}
|
|
3583
|
-
return false;
|
|
3584
|
-
}
|
|
3585
|
-
if (path.dirname(dir) === dir) return false;
|
|
3586
|
-
}
|
|
3587
|
-
}
|
|
3588
|
-
|
|
3589
3594
|
/**
|
|
3590
3595
|
* The package an import specifier names, or undefined when it names none:
|
|
3591
3596
|
* a relative or absolute path, a `#` subpath import, or a path alias such
|
|
@@ -4007,17 +4012,32 @@ function isDefinedTheme(theme) {
|
|
|
4007
4012
|
* @param {Set<any>} [seen] the bases already met, for one that extends itself
|
|
4008
4013
|
* @returns {any}
|
|
4009
4014
|
*/
|
|
4010
|
-
function defineThemeInput(theme, seen = new Set()) {
|
|
4015
|
+
function defineThemeInput(theme, seen = new Set([theme])) {
|
|
4016
|
+
// Each value as the build writes it (a BigInt as its digits, a boxed
|
|
4017
|
+
// primitive as itself), so defineTheme reads what is written, as the
|
|
4018
|
+
// value judge does.
|
|
4011
4019
|
const input = Object.fromEntries(
|
|
4012
|
-
Object.entries(theme)
|
|
4020
|
+
Object.entries(theme)
|
|
4021
|
+
.filter(([, value]) => value !== undefined)
|
|
4022
|
+
.map(([key, value]) => [
|
|
4023
|
+
key,
|
|
4024
|
+
key === 'extends' ? value : writtenPrimitives(value),
|
|
4025
|
+
]),
|
|
4013
4026
|
);
|
|
4014
4027
|
const base = input.extends;
|
|
4015
|
-
if (
|
|
4016
|
-
base
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4028
|
+
if (base && typeof base === 'object' && !isDefinedTheme(base)) {
|
|
4029
|
+
// A plain base that reaches back to a theme already on the way (`a`
|
|
4030
|
+
// extends `b`, `b` extends `a`) has no base to build from.
|
|
4031
|
+
if (seen.has(base)) {
|
|
4032
|
+
const names = [...seen, base].map(t =>
|
|
4033
|
+
typeof t?.name === 'string' ? `"${t.name}"` : 'a theme with no name',
|
|
4034
|
+
);
|
|
4035
|
+
throw new AstryxError(
|
|
4036
|
+
`The themes extend each other in a cycle (${names.join(' extends ')}), so none has a base to build from. Give the cycle a theme that extends nothing.`,
|
|
4037
|
+
undefined,
|
|
4038
|
+
ERROR_CODES.ERR_THEME_INVALID,
|
|
4039
|
+
);
|
|
4040
|
+
}
|
|
4021
4041
|
seen.add(base);
|
|
4022
4042
|
input.extends = _defineTheme(defineThemeInput(base, seen));
|
|
4023
4043
|
}
|
|
@@ -5189,11 +5209,18 @@ async function themeBuildInternal(
|
|
|
5189
5209
|
from = {file: path.relative(cwd, base.file) || base.file, line: at};
|
|
5190
5210
|
break;
|
|
5191
5211
|
}
|
|
5212
|
+
// From the theme it extends only when that theme holds this very
|
|
5213
|
+
// value: a resolved base holds every token, so holding the path alone
|
|
5214
|
+
// says nothing.
|
|
5192
5215
|
const inherited =
|
|
5193
5216
|
line == null &&
|
|
5194
5217
|
(from != null ||
|
|
5195
5218
|
(parentTheme != null &&
|
|
5196
|
-
valueAt(parentTheme, item.path) !== undefined
|
|
5219
|
+
valueAt(parentTheme, item.path) !== undefined &&
|
|
5220
|
+
Object.is(
|
|
5221
|
+
valueAt(parentTheme, item.path),
|
|
5222
|
+
valueAt(themeDef, item.path),
|
|
5223
|
+
)));
|
|
5197
5224
|
return inherited && handOff.prepareFamily
|
|
5198
5225
|
? []
|
|
5199
5226
|
: [{...item, line, inherited, elsewhere: line == null, from}];
|
|
@@ -5201,7 +5228,7 @@ async function themeBuildInternal(
|
|
|
5201
5228
|
const nulls = placed(nullThemeValues(themeDef));
|
|
5202
5229
|
/** @param {{path: string[], why: string, line: number | null, inherited?: boolean, elsewhere?: boolean, from?: {file: string, line: number} | null, at?: {file: string, line: number} | null}} n */
|
|
5203
5230
|
const nullLine = n =>
|
|
5204
|
-
`${n.path.join('.')}${n.line != null ? ` (line ${n.line})` : n.at ? ` (in ${n.at.file}, line ${n.at.line})` : n.from ? ` (in ${n.from.file}, line ${n.from.line}, the theme it extends)` : n.inherited ? ' (from the theme it extends)' : n.elsewhere ?
|
|
5231
|
+
`${n.path.join('.')}${n.line != null ? ` (line ${n.line})` : n.at ? ` (in ${n.at.file}, line ${n.at.line})` : n.from ? ` (in ${n.from.file}, line ${n.from.line}, the theme it extends)` : n.inherited ? ' (from the theme it extends)' : n.elsewhere ? ` (not written in this file as it is: computed in it, or from ${parentTheme != null ? '' : 'the theme it extends or '}a module it imports)` : ''}: ${n.why}`;
|
|
5205
5232
|
const unbuildable = nulls.filter(n => n.unbuildable);
|
|
5206
5233
|
if (unbuildable.length > 0) {
|
|
5207
5234
|
const first = unbuildable.find(n => n.line != null);
|
|
@@ -5348,8 +5375,23 @@ async function themeBuildInternal(
|
|
|
5348
5375
|
return {...t, line, inherited: false, elsewhere: line == null, from: null};
|
|
5349
5376
|
});
|
|
5350
5377
|
|
|
5378
|
+
// A radius scale missing a field builds every scaled corner as NaNpx:
|
|
5379
|
+
// warned at its line, as the editor refuses it.
|
|
5380
|
+
const radiusInput =
|
|
5381
|
+
interception?.inputOf(themeDef)?.radius ??
|
|
5382
|
+
// A plain-object theme is its own input.
|
|
5383
|
+
(isDefinedTheme(themeDef) ? undefined : themeDef.radius) ??
|
|
5384
|
+
sourceInputField(themeSource, filePath, 'radius');
|
|
5385
|
+
const badRadius = radiusInputProblems(radiusInput).map(t => {
|
|
5386
|
+
const line =
|
|
5387
|
+
keyPathLine(themeSource, t.path, filePath) ??
|
|
5388
|
+
keyPathLine(themeSource, ['radius'], filePath);
|
|
5389
|
+
return {...t, line, inherited: false, elsewhere: line == null, from: null};
|
|
5390
|
+
});
|
|
5391
|
+
|
|
5351
5392
|
// Validate component overrides
|
|
5352
5393
|
const warnings = await validateComponentOverrides(themeDef);
|
|
5394
|
+
/** @type {string[]} */
|
|
5353
5395
|
const warningMessages = [];
|
|
5354
5396
|
/** Advisories about a correct theme — see the `notices` note on the receipt. */
|
|
5355
5397
|
const noticeMessages = [];
|
|
@@ -5374,8 +5416,11 @@ async function themeBuildInternal(
|
|
|
5374
5416
|
...badKeys.map(nullLine),
|
|
5375
5417
|
...badValueLines.map(nullLine),
|
|
5376
5418
|
...badTypography.map(nullLine),
|
|
5419
|
+
...badRadius.map(nullLine),
|
|
5377
5420
|
...badFields.map(nullLine),
|
|
5378
5421
|
]) {
|
|
5422
|
+
// The source reader and the loaded value can name one field alike.
|
|
5423
|
+
if (warningMessages.includes(w)) continue;
|
|
5379
5424
|
warningMessages.push(w);
|
|
5380
5425
|
logger.warn(` [warn] ${source}${w}`);
|
|
5381
5426
|
}
|
|
@@ -6102,13 +6147,17 @@ async function themeBuildInternal(
|
|
|
6102
6147
|
{iconsSpecifier: options.iconsSpecifier, out: out ?? undefined},
|
|
6103
6148
|
cwd,
|
|
6104
6149
|
);
|
|
6105
|
-
//
|
|
6106
|
-
//
|
|
6107
|
-
//
|
|
6150
|
+
// Beside the source or at a path --out names, only build outputs are
|
|
6151
|
+
// replaced: a file of the user's own of the same name is kept. A caller
|
|
6152
|
+
// that owns the output folder (the theme editor) repairs it instead.
|
|
6108
6153
|
assertOutputsReplaceable(writes, filePath, cwd, {
|
|
6109
6154
|
claimed: handOff.claimedOutputs,
|
|
6110
6155
|
rerun,
|
|
6111
|
-
refuseUnmarked:
|
|
6156
|
+
refuseUnmarked: !handOff.ownsOutputs,
|
|
6157
|
+
// At the default paths the build always replaced what was there, so an
|
|
6158
|
+
// output of the CLI before it was named Astryx is still its own; a path
|
|
6159
|
+
// --out names keeps its released rule (the current mark only).
|
|
6160
|
+
acceptLegacy: !options.out,
|
|
6112
6161
|
onEditorFolder: editorFolderListener ?? undefined,
|
|
6113
6162
|
// The result's warnings carry what text prints.
|
|
6114
6163
|
onWarning: message => warningMessages.push(message),
|
|
@@ -55,6 +55,15 @@ export function inputFieldProblems(input: any, fields: InputFields): Array<{
|
|
|
55
55
|
* @returns {unknown}
|
|
56
56
|
*/
|
|
57
57
|
export function sourceTypography(source: string, file?: string): unknown;
|
|
58
|
+
/**
|
|
59
|
+
* One field of a theme source's input (`typography`, `radius`) as the plain
|
|
60
|
+
* values it writes, read as sourceTypography() reads typography.
|
|
61
|
+
* @param {string} source
|
|
62
|
+
* @param {string} file the source's file name
|
|
63
|
+
* @param {string} field
|
|
64
|
+
* @returns {unknown}
|
|
65
|
+
*/
|
|
66
|
+
export function sourceInputField(source: string, file: string, field: string): unknown;
|
|
58
67
|
/**
|
|
59
68
|
* The fields Core's `defineTheme()` input takes, read from the type
|
|
60
69
|
* declarations of the installed Core, so the editor names a misspelled
|