@astryxdesign/cli 0.6.6 → 0.6.7
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/CHANGELOG.md +129 -0
- package/README.md +84 -82
- package/api/build/_adapter.d.mts +20 -0
- package/api/build/_adapter.mjs +24 -0
- package/api/build/build.doc.mjs +1 -1
- package/api/build/build.test.mjs +1 -1
- package/api/build/build.type.d.mts +12 -0
- package/api/build/build.type.mjs +3 -0
- package/api/build/help/help.mjs +1 -1
- package/api/build/kit/kit.mjs +13 -1
- package/api/component/_adapter.d.mts +19 -0
- package/api/component/_adapter.mjs +33 -0
- package/api/component/component-replacement.test.mjs +615 -0
- package/api/component/component.doc.mjs +5 -2
- package/api/component/component.mjs +49 -15
- package/api/component/component.test.mjs +32 -0
- package/api/component/component.type.d.mts +33 -3
- package/api/component/component.type.mjs +10 -3
- package/api/component/detail/blocks/blocks.d.mts +2 -1
- package/api/component/detail/blocks/blocks.mjs +5 -2
- package/api/component/detail/detail.mjs +5 -1
- package/api/component/detail/props/props.d.mts +2 -1
- package/api/component/detail/props/props.mjs +3 -2
- package/api/component/detail/showcase/showcase.d.mts +3 -1
- package/api/component/detail/showcase/showcase.mjs +3 -1
- package/api/component/detail/source/source.d.mts +3 -2
- package/api/component/detail/source/source.mjs +7 -3
- package/api/component/list/list.mjs +128 -10
- package/api/docs/_adapter.d.mts +11 -0
- package/api/docs/_adapter.mjs +73 -1
- package/api/docs/compiled-topics.test.mjs +1 -1
- package/api/docs/detail/detail.mjs +19 -3
- package/api/docs/detail/section/section.d.mts +44 -0
- package/api/docs/detail/section/section.mjs +171 -14
- package/api/docs/detail/section/section.test.mjs +4 -4
- package/api/docs/docOverlays.test.mjs +38 -23
- package/api/docs/docs.depth.test.mjs +2 -0
- package/api/docs/docs.doc.mjs +3 -3
- package/api/docs/docs.mjs +13 -16
- package/api/docs/docs.test.mjs +9 -10
- package/api/docs/docs.type.d.mts +43 -3
- package/api/docs/docs.type.mjs +23 -3
- package/api/docs/index/index.mjs +11 -2
- package/api/docs/index/index.test.mjs +7 -2
- package/api/docs/integration-tree.test.mjs +26 -26
- package/api/docs/integrationDocs.test.mjs +8 -7
- package/api/docs/namespace-section.test.mjs +260 -0
- package/api/docs/node/node.mjs +3 -0
- package/api/docs/token-tables.test.mjs +93 -0
- package/api/doctor/_adapter.d.mts +50 -0
- package/api/doctor/_adapter.mjs +190 -0
- package/api/doctor/doctor.d.mts +6 -10
- package/api/doctor/doctor.doc.mjs +1 -3
- package/api/doctor/doctor.mjs +144 -150
- package/api/doctor/doctor.test.mjs +104 -0
- package/api/doctor/theme-checks.d.mts +24 -0
- package/api/doctor/theme-checks.mjs +1231 -0
- package/api/doctor/theme-checks.test.mjs +667 -0
- package/api/gap-report/gap-report.doc.mjs +2 -1
- package/api/gap-report/gap-report.mjs +15 -1
- package/api/hook/_adapter.d.mts +1 -0
- package/api/hook/_adapter.mjs +3 -0
- package/api/hook/detail/detail.mjs +2 -2
- package/api/hook/detail/params/params.mjs +2 -2
- package/api/hook/hook.type.d.mts +12 -0
- package/api/hook/hook.type.mjs +3 -0
- package/api/hook/list/list.mjs +8 -8
- package/api/index.d.mts +1 -1
- package/api/index.mjs +4 -0
- package/api/init/run/run.d.mts +3 -5
- package/api/init/run/run.mjs +11 -11
- package/api/integration/__fixtures__/released-0.6.5-ocean.d.mts +14 -0
- package/api/integration/__fixtures__/released-0.6.5-ocean.mjs +15 -0
- package/api/integration/add-helpers.d.mts +26 -5
- package/api/integration/add-helpers.mjs +50 -5
- package/api/integration/add-theme.mjs +16 -2
- package/api/integration/add-theme.test.mjs +66 -15
- package/api/integration/authoring-checks.mjs +21 -1
- package/api/integration/integrationComponentConflicts.doc.mjs +6 -3
- package/api/integration/pack-check.component-replaces.test.mjs +126 -0
- package/api/integration/pack-check.d.mts +10 -0
- package/api/integration/pack-check.lifecycle-output.test.mjs +21 -2
- package/api/integration/pack-check.mjs +483 -1
- package/api/integration/pack-check.test.mjs +568 -8
- package/api/integration/validate-integration.mjs +20 -4
- package/api/integration/validate-integration.test.mjs +73 -0
- package/api/layout/check/check.d.mts +1 -0
- package/api/layout/check/check.mjs +1 -0
- package/api/layout/expand/expand.d.mts +1 -0
- package/api/layout/expand/expand.mjs +1 -0
- package/api/layout/grammar/grammar.d.mts +1 -0
- package/api/layout/grammar/grammar.mjs +1 -0
- package/api/layout/layoutCheck.doc.mjs +1 -1
- package/api/layout/layoutExpand.doc.mjs +1 -1
- package/api/layout/layoutGrammar.doc.mjs +1 -1
- package/api/search/search.d.mts +47 -3
- package/api/search/search.doc.mjs +1 -1
- package/api/search/search.domain-priority.test.mjs +261 -0
- package/api/search/search.mjs +247 -43
- package/api/search/search.test.mjs +5 -1
- package/api/search/search.type.d.mts +3 -3
- package/api/search/search.type.mjs +2 -2
- package/api/swizzle/_adapter.d.mts +10 -0
- package/api/swizzle/_adapter.mjs +23 -0
- package/api/swizzle/copy/copy.d.mts +5 -6
- package/api/swizzle/copy/copy.mjs +29 -10
- package/api/swizzle/list/list.mjs +2 -2
- package/api/swizzle/swizzle.doc.mjs +5 -2
- package/api/swizzle/swizzle.test.mjs +55 -5
- package/api/swizzle/swizzle.type.d.mts +8 -0
- package/api/swizzle/swizzle.type.mjs +2 -0
- package/api/template/copy/copy.mjs +14 -1
- package/api/template/show/show.mjs +2 -0
- package/api/template/skeleton/skeleton.mjs +2 -1
- package/api/template/template.d.mts +1 -1
- package/api/template/template.doc.mjs +1 -1
- package/api/template/template.mjs +1 -0
- package/api/template/template.type.d.mts +15 -0
- package/api/template/template.type.mjs +6 -0
- package/api/theme/_adapter.d.mts +106 -6
- package/api/theme/_adapter.mjs +687 -18
- package/api/theme/add/add.binary.test.mjs +76 -3
- package/api/theme/add/add.d.mts +5 -9
- package/api/theme/add/add.mjs +87 -64
- package/api/theme/add/add.rollback.test.mjs +9 -9
- package/api/theme/add/add.staging.test.mjs +9 -9
- package/api/theme/add/add.test.mjs +461 -55
- package/api/theme/add/add.types.test.mjs +151 -0
- package/api/theme/build/build.d.mts +96 -2
- package/api/theme/build/build.family.test.mjs +13 -4
- package/api/theme/build/build.mjs +286 -118
- package/api/theme/build/build.test.mjs +30 -0
- package/api/theme/build/font-warning.d.mts +11 -0
- package/api/theme/build/font-warning.mjs +28 -3
- package/api/theme/eject/eject.binary.test.mjs +90 -0
- package/api/theme/eject/eject.d.mts +17 -0
- package/api/theme/eject/eject.mjs +65 -0
- package/api/theme/eject/eject.rollback.test.mjs +158 -0
- package/api/theme/eject/eject.staging.test.mjs +83 -0
- package/api/theme/eject/eject.test.mjs +160 -0
- package/api/theme/integration-themes.test.mjs +30 -6
- package/api/theme/list/list.d.mts +10 -0
- package/api/theme/list/list.mjs +75 -7
- package/api/theme/list/list.test.mjs +155 -4
- package/api/theme/remove/remove.d.mts +12 -0
- package/api/theme/remove/remove.mjs +15 -0
- package/api/theme/remove/remove.test.mjs +94 -0
- package/api/theme/template/template.mjs +3 -4
- package/api/theme/theme.d.mts +5 -2
- package/api/theme/theme.mjs +13 -8
- package/api/theme/theme.type.d.mts +106 -2
- package/api/theme/theme.type.mjs +54 -5
- package/api/theme/themeAdd.doc.d.mts +1 -3
- package/api/theme/themeAdd.doc.mjs +35 -22
- package/api/theme/themeBuild.doc.mjs +1 -1
- package/api/theme/themeEject.doc.d.mts +8 -0
- package/api/theme/themeEject.doc.mjs +89 -0
- package/api/theme/themeListAvailable.doc.mjs +4 -4
- package/api/theme/themeListCopySources.doc.d.mts +8 -0
- package/api/theme/themeListCopySources.doc.mjs +60 -0
- package/api/theme/themeRemove.doc.d.mts +6 -0
- package/api/theme/themeRemove.doc.mjs +50 -0
- package/api/theme/themeTemplate.doc.mjs +4 -3
- package/api/theme/themeUse.doc.d.mts +6 -0
- package/api/theme/themeUse.doc.mjs +47 -0
- package/api/theme/use/use.d.mts +12 -0
- package/api/theme/use/use.mjs +15 -0
- package/api/theme/use/use.test.mjs +98 -0
- package/api/upgrade/_adapter.d.mts +1 -0
- package/api/upgrade/_adapter.mjs +3 -0
- package/api/upgrade/list/list.mjs +9 -3
- package/api/upgrade/upgrade.type.d.mts +4 -0
- package/api/upgrade/upgrade.type.mjs +1 -0
- package/assets/codemods/__tests__/registry.test.mjs +1 -0
- package/assets/codemods/integration-discovery.mjs +1 -1
- package/assets/codemods/integration-discovery.test.mjs +64 -0
- package/assets/codemods/registry.mjs +1 -0
- package/assets/codemods/transforms/v0.6.7/__tests__/migrate-copied-themes-to-descriptors.test.mjs +129 -0
- package/assets/codemods/transforms/v0.6.7/index.mjs +23 -0
- package/assets/codemods/transforms/v0.6.7/migrate-copied-themes-to-descriptors.mjs +54 -0
- package/assets/docs/author-a-theme.doc.mjs +166 -0
- package/assets/docs/getting-started.doc.mjs +61 -17
- package/assets/docs/principles.doc.dense.mjs +4 -4
- package/assets/docs/principles.doc.mjs +6 -6
- package/assets/docs/principles.doc.zh.mjs +4 -4
- package/assets/docs/styling-overview.doc.mjs +211 -0
- package/assets/docs/theme.doc.dense.mjs +10 -198
- package/assets/docs/theme.doc.mjs +13 -771
- package/assets/docs/theme.doc.zh.mjs +31 -12
- package/assets/docs/tree/add-a-theme.doc.mjs +2 -2
- package/assets/docs/tree/checks.doc.mjs +5 -4
- package/assets/docs/tree/component-migration.doc.mjs +107 -0
- package/assets/docs/tree/css-and-stylex.doc.mjs +150 -0
- package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
- package/assets/docs/tree/document-the-theme.doc.mjs +4 -4
- package/assets/docs/tree/font-setup.doc.mjs +122 -0
- package/assets/docs/tree/fonts-and-assets.doc.mjs +25 -20
- package/assets/docs/tree/headers-and-footers.doc.mjs +67 -0
- package/assets/docs/tree/i18n-library-integration.doc.mjs +167 -0
- package/assets/docs/tree/i18n-quick-start.doc.mjs +101 -0
- package/assets/docs/{internationalization.doc.mjs → tree/i18n-rtl-and-testing.doc.mjs} +17 -223
- package/assets/docs/tree/internationalization.doc.mjs +29 -0
- package/assets/docs/tree/layout-spacing.doc.mjs +168 -0
- package/assets/docs/tree/layout.doc.mjs +55 -0
- package/assets/docs/{migration.doc.mjs → tree/migration-setup.doc.mjs} +24 -129
- package/assets/docs/tree/migration-verification.doc.mjs +67 -0
- package/assets/docs/tree/migration.doc.mjs +28 -0
- package/assets/docs/tree/non-css-processing.doc.mjs +112 -0
- package/assets/docs/tree/other-libraries.doc.mjs +218 -0
- package/assets/docs/tree/replace-a-core-component.doc.mjs +21 -4
- package/assets/docs/tree/responsive.doc.mjs +98 -0
- package/assets/docs/tree/scaffold.doc.mjs +140 -0
- package/assets/docs/tree/side-panels.doc.mjs +81 -0
- package/assets/docs/tree/structure.doc.mjs +140 -0
- package/assets/docs/tree/styling-advanced.doc.mjs +159 -0
- package/assets/docs/tree/styling-basics.doc.mjs +181 -0
- package/assets/docs/tree/styling-libraries.doc.mjs +30 -0
- package/assets/docs/tree/styling.doc.mjs +29 -0
- package/assets/docs/tree/tailwind.doc.mjs +65 -0
- package/assets/docs/tree/themes.doc.mjs +2 -2
- package/assets/docs/tree/tokens-and-setup.doc.mjs +128 -0
- package/assets/docs/tree/tokens-border.doc.mjs +46 -0
- package/assets/docs/tree/tokens-color.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-color.doc.mjs +438 -0
- package/assets/docs/tree/tokens-color.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-data.doc.mjs +323 -0
- package/assets/docs/tree/tokens-duration.doc.mjs +78 -0
- package/assets/docs/tree/tokens-ease.doc.mjs +46 -0
- package/assets/docs/tree/tokens-focus.doc.mjs +57 -0
- package/assets/docs/tree/tokens-font-weight.doc.mjs +58 -0
- package/assets/docs/tree/tokens-radius.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-radius.doc.mjs +70 -0
- package/assets/docs/tree/tokens-radius.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-shadow.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-shadow.doc.mjs +74 -0
- package/assets/docs/tree/tokens-shadow.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-size.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-size.doc.mjs +54 -0
- package/assets/docs/tree/tokens-size.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-spacing.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-spacing.doc.mjs +102 -0
- package/assets/docs/tree/tokens-spacing.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-syntax.doc.mjs +98 -0
- package/assets/docs/tree/tokens-text-size.doc.mjs +90 -0
- package/assets/docs/tree/tokens-type-scale.doc.mjs +210 -0
- package/assets/docs/tree/tokens-typography.doc.mjs +54 -0
- package/assets/docs/tree/tokens-usage.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-usage.doc.mjs +36 -0
- package/assets/docs/tree/tokens-usage.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens.doc.mjs +28 -0
- package/assets/docs/tree/troubleshooting.doc.mjs +4 -0
- package/assets/docs/tree/type-scale.doc.mjs +147 -0
- package/assets/docs/tree/typography-best-practices.doc.mjs +55 -0
- package/assets/docs/tree/typography.doc.mjs +29 -0
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +22 -5
- package/assets/docs/tree/versioning.doc.mjs +4 -1
- package/assets/docs/use-a-theme.doc.mjs +212 -0
- package/assets/templates/pages/incident-console/page.tsx +1 -1
- package/assets/templates/pages/table-collapsible/page.tsx +1474 -0
- package/assets/templates/pages/table-collapsible/template.doc.mjs +12 -0
- package/assets/templates/pages/table-comparison/page.tsx +1449 -0
- package/assets/templates/pages/table-comparison/template.doc.mjs +12 -0
- package/assets/theme.template.ts +4 -3
- package/authoring/doctypes/command/command.doc.mjs +5 -0
- package/authoring/doctypes/command/type.ts +2 -0
- package/authoring/doctypes/component/component.doc.mjs +1 -1
- package/authoring/doctypes/component/type.ts +8 -4
- package/authoring/doctypes/template/type.ts +1 -0
- package/authoring/integration/integration.doc.mjs +1 -1
- package/clients/cli/commands/blog.mjs +3 -3
- package/clients/cli/commands/build-theme.adaptations.test.mjs +1 -1
- package/clients/cli/commands/build-theme.ascii-output.test.mjs +11 -1
- package/clients/cli/commands/build-theme.batch-report.test.mjs +335 -0
- package/clients/cli/commands/build-theme.font-warning.test.mjs +36 -7
- package/clients/cli/commands/build-theme.import-path.test.mjs +3 -3
- package/clients/cli/commands/build-theme.mjs +338 -45
- package/clients/cli/commands/build-theme.watch.test.mjs +33 -0
- package/clients/cli/commands/build.mjs +8 -6
- package/clients/cli/commands/build.text-fields.test.mjs +1 -1
- package/clients/cli/commands/component/index.mjs +91 -12
- package/clients/cli/commands/component-replacement.text.test.mjs +316 -0
- package/clients/cli/commands/component.doc.mjs +9 -2
- package/clients/cli/commands/docs.doc.mjs +2 -1
- package/clients/cli/commands/docs.mjs +63 -23
- package/clients/cli/commands/docs.test.mjs +17 -15
- package/clients/cli/commands/doctor-integration-components.doc.mjs +15 -4
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/doctor.test.mjs +59 -52
- package/clients/cli/commands/gap-report.doc.mjs +2 -2
- package/clients/cli/commands/hook/index.mjs +7 -2
- package/clients/cli/commands/import-hint-correctness.test.mjs +28 -5
- package/clients/cli/commands/init.next-steps.test.mjs +18 -23
- package/clients/cli/commands/integration-real-world.test.mjs +61 -12
- package/clients/cli/commands/layout-check.doc.mjs +2 -0
- package/clients/cli/commands/layout-expand.doc.mjs +2 -0
- package/clients/cli/commands/layout-grammar.doc.mjs +2 -0
- package/clients/cli/commands/layout.deprecation-lifecycle.test.mjs +140 -0
- package/clients/cli/commands/layout.doc.mjs +2 -0
- package/clients/cli/commands/layout.mjs +40 -4
- package/clients/cli/commands/no-prompt-wording.test.mjs +4 -4
- package/clients/cli/commands/search.test.mjs +10 -4
- package/clients/cli/commands/swizzle.doc.mjs +12 -3
- package/clients/cli/commands/swizzle.mjs +2 -1
- package/clients/cli/commands/swizzle.routing.test.mjs +2 -1
- package/clients/cli/commands/template.mjs +56 -5
- package/clients/cli/commands/text-json-parity.test.mjs +40 -0
- package/clients/cli/commands/theme-add-lifecycle.test.mjs +135 -0
- package/clients/cli/commands/theme-add.doc.mjs +19 -19
- package/clients/cli/commands/theme-build.doc.mjs +3 -1
- package/clients/cli/commands/theme-eject.doc.mjs +47 -0
- package/clients/cli/commands/theme-list.behavior.test.mjs +5 -2
- package/clients/cli/commands/theme-list.doc.mjs +2 -2
- package/clients/cli/commands/theme-palette-generate.doc.mjs +1 -2
- package/clients/cli/commands/theme-remove.doc.mjs +22 -0
- package/clients/cli/commands/theme-template.doc.mjs +4 -3
- package/clients/cli/commands/theme-use.doc.mjs +22 -0
- package/clients/cli/commands/theme.doc.mjs +21 -16
- package/clients/cli/commands/upgrade.config-ordering.test.mjs +2 -1
- package/clients/cli/commands/upgrade.mjs +1 -1
- package/clients/cli/index.mjs +5 -2
- package/clients/cli/lib/component-format.mjs +29 -2
- package/clients/cli/lib/component-format.test.mjs +1 -1
- package/clients/cli/lib/define-command.mjs +4 -0
- package/clients/cli/lib/resolve-theme.mjs +80 -78
- package/clients/cli/lib/resolve-theme.test.mjs +523 -27
- package/foundation/agent-docs/agent-docs.mjs +48 -30
- package/foundation/agent-docs/agent-docs.test.mjs +47 -34
- package/foundation/agent-docs/app-theme-workflow.test.mjs +13 -0
- package/foundation/config/project.d.mts +20 -5
- package/foundation/config/project.mjs +43 -6
- package/foundation/config/project.test.mjs +1 -1
- package/foundation/config/theme-private-vars.d.mts +12 -0
- package/foundation/config/theme-private-vars.mjs +107 -0
- package/foundation/config/theme-private-vars.test.mjs +55 -0
- package/foundation/config/theme-state.d.mts +145 -0
- package/foundation/config/theme-state.mjs +417 -0
- package/foundation/config/theme-state.test.mjs +182 -0
- package/foundation/discovery/component-discovery.d.mts +5 -2
- package/foundation/discovery/component-discovery.mjs +12 -6
- package/foundation/discovery/component-replacement.d.mts +91 -0
- package/foundation/discovery/component-replacement.mjs +417 -0
- package/foundation/discovery/component-replacement.test.mjs +480 -0
- package/foundation/discovery/docs-discovery.test.mjs +1 -1
- package/foundation/discovery/docs-output-budget.d.mts +6 -2
- package/foundation/discovery/docs-output-budget.mjs +2 -1
- package/foundation/discovery/docs-section-key.d.mts +4 -2
- package/foundation/discovery/docs-section-key.mjs +1 -1
- package/foundation/discovery/module-exports.d.mts +10 -0
- package/foundation/discovery/module-exports.mjs +146 -0
- package/foundation/discovery/package-exports.d.mts +29 -0
- package/foundation/discovery/package-exports.mjs +200 -0
- package/foundation/discovery/template-needs.d.mts +31 -0
- package/foundation/discovery/template-needs.mjs +156 -0
- package/foundation/discovery/template-needs.test.mjs +203 -0
- package/foundation/discovery/theme-discovery.d.mts +72 -5
- package/foundation/discovery/theme-discovery.mjs +134 -18
- package/foundation/discovery/theme-discovery.test.mjs +9 -3
- package/foundation/discovery/theme-imports.d.mts +15 -0
- package/foundation/discovery/theme-imports.mjs +217 -0
- package/foundation/discovery/theme-imports.test.mjs +173 -0
- package/foundation/doc-compiler/bundle.mjs +52 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +15 -5
- package/foundation/doc-compiler/inputs.mjs +2 -1
- package/foundation/doc-compiler/lenses.d.mts +4 -2
- package/foundation/doc-compiler/lenses.mjs +1 -1
- package/foundation/doc-compiler/split-topic-keywords.test.mjs +73 -0
- package/foundation/doc-compiler/tree.d.mts +10 -0
- package/foundation/doc-compiler/tree.mjs +22 -0
- package/foundation/doc-compiler/tree.test.mjs +3 -2
- package/foundation/env/package-manager.d.mts +31 -8
- package/foundation/env/package-manager.mjs +120 -13
- package/foundation/env/package-manager.test.mjs +174 -1
- package/foundation/fs/module-loader.d.mts +9 -0
- package/foundation/fs/module-loader.mjs +71 -2
- package/foundation/integrations/cli-requirement.d.mts +22 -0
- package/foundation/integrations/cli-requirement.mjs +31 -0
- package/foundation/integrations/cli-requirement.test.mjs +70 -0
- package/foundation/integrations/contribution-inventory.mjs +3 -3
- package/foundation/integrations/validate-contributions.d.mts +16 -0
- package/foundation/integrations/validate-contributions.mjs +56 -8
- package/foundation/response/base.d.ts +9 -3
- package/foundation/response/json.d.mts +7 -4
- package/foundation/response/json.mjs +10 -6
- package/foundation/response/response-types.doc.mjs +41 -26
- package/foundation/response/response.doc.mjs +18 -4
- package/foundation/text/copyright-header.mjs +1 -1
- package/foundation/text/copyright-header.test.mjs +1 -1
- package/package.json +1 -1
- package/assets/docs/layout.doc.dense.mjs +0 -388
- package/assets/docs/layout.doc.mjs +0 -550
- package/assets/docs/styling-libraries.doc.mjs +0 -469
- package/assets/docs/styling.doc.mjs +0 -412
- package/assets/docs/tokens.doc.dense.mjs +0 -15
- package/assets/docs/tokens.doc.mjs +0 -1491
- package/assets/docs/tokens.doc.zh.mjs +0 -15
- package/assets/docs/typography.doc.mjs +0 -286
|
@@ -6,693 +6,50 @@ export const docs = {
|
|
|
6
6
|
name: 'theme',
|
|
7
7
|
title: 'Theme System',
|
|
8
8
|
category: 'guide',
|
|
9
|
-
keywords: ['
|
|
9
|
+
keywords: ['theme', 'dark mode', 'defineTheme', 'provider'],
|
|
10
10
|
description:
|
|
11
|
-
'How to use and
|
|
11
|
+
'How to use and create themes: see Use a theme for applying themes, and Author a theme for creating and customizing them.',
|
|
12
12
|
|
|
13
13
|
sections: [
|
|
14
14
|
{
|
|
15
15
|
id: 'quick-start',
|
|
16
16
|
title: 'Wrap your app in a theme',
|
|
17
|
-
category: 'guide',
|
|
18
|
-
content: [
|
|
19
|
-
{
|
|
20
|
-
type: 'code',
|
|
21
|
-
lang: 'bash',
|
|
22
|
-
label: 'Install a theme package',
|
|
23
|
-
code: 'npm install @astryxdesign/theme-neutral',
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
type: 'code',
|
|
27
|
-
lang: 'tsx',
|
|
28
|
-
label: 'Basic theme setup (runtime injection)',
|
|
29
|
-
code: `import {Theme} from '@astryxdesign/core';
|
|
30
|
-
import {neutralTheme} from '@astryxdesign/theme-neutral';
|
|
31
|
-
|
|
32
|
-
function App() {
|
|
33
|
-
return (
|
|
34
|
-
<Theme theme={neutralTheme}>
|
|
35
|
-
<YourApp />
|
|
36
|
-
</Theme>
|
|
37
|
-
);
|
|
38
|
-
}`,
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
type: 'code',
|
|
42
|
-
lang: 'tsx',
|
|
43
|
-
label: 'Optimized setup (pre-built CSS)',
|
|
44
|
-
code: `import {Theme} from '@astryxdesign/core';
|
|
45
|
-
import {neutralTheme} from '@astryxdesign/theme-neutral/built';
|
|
46
|
-
import '@astryxdesign/theme-neutral/theme.css';
|
|
47
|
-
|
|
48
|
-
function App() {
|
|
49
|
-
return (
|
|
50
|
-
<Theme theme={neutralTheme}>
|
|
51
|
-
<YourApp />
|
|
52
|
-
</Theme>
|
|
53
|
-
);
|
|
54
|
-
}`,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
type: 'prose',
|
|
58
|
-
text: 'Each theme ships as its own npm package. Install the one you want, then wrap your app in `<Theme>`. The same pattern works for every theme; just swap the package and import name.',
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
type: 'prose',
|
|
62
|
-
text: 'The default import uses runtime style injection, which works everywhere with no build step. The `/built` import skips injection and relies on the pre-compiled CSS file for better performance and SSR support.',
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
title: 'Available Themes',
|
|
68
|
-
category: 'guide',
|
|
69
|
-
content: [
|
|
70
|
-
{
|
|
71
|
-
type: 'prose',
|
|
72
|
-
text: 'Install the theme package you want with `npm install @astryxdesign/theme-{name}`, then import its theme object as shown below.',
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
type: 'table',
|
|
76
|
-
headers: ['Theme', 'Import', 'Description'],
|
|
77
|
-
rows: [
|
|
78
|
-
[
|
|
79
|
-
'Neutral',
|
|
80
|
-
"import {neutralTheme} from '@astryxdesign/theme-neutral'",
|
|
81
|
-
'Muted, minimal aesthetic with Figtree typography. A good starting point.',
|
|
82
|
-
],
|
|
83
|
-
[
|
|
84
|
-
'Butter',
|
|
85
|
-
"import {butterTheme} from '@astryxdesign/theme-butter'",
|
|
86
|
-
'Golden, buttery surfaces with blue accents; Sarina + Outfit type.',
|
|
87
|
-
],
|
|
88
|
-
[
|
|
89
|
-
'Chocolate',
|
|
90
|
-
"import {chocolateTheme} from '@astryxdesign/theme-chocolate'",
|
|
91
|
-
'Warm brown tones and cozy beige; Fraunces + Albert Sans type.',
|
|
92
|
-
],
|
|
93
|
-
[
|
|
94
|
-
'Gothic',
|
|
95
|
-
"import {gothicTheme} from '@astryxdesign/theme-gothic'",
|
|
96
|
-
'Dark-only atmospheric theme; deep blue-gray surfaces, distressed display type.',
|
|
97
|
-
],
|
|
98
|
-
[
|
|
99
|
-
'Matcha',
|
|
100
|
-
"import {matchaTheme} from '@astryxdesign/theme-matcha'",
|
|
101
|
-
'Earthy greens; DM Sans + Playwrite US Trad type.',
|
|
102
|
-
],
|
|
103
|
-
[
|
|
104
|
-
'Stone',
|
|
105
|
-
"import {stoneTheme} from '@astryxdesign/theme-stone'",
|
|
106
|
-
'Warm stone and slate tones; Montserrat + Figtree type.',
|
|
107
|
-
],
|
|
108
|
-
[
|
|
109
|
-
'Y2K',
|
|
110
|
-
"import {y2kTheme} from '@astryxdesign/theme-y2k'",
|
|
111
|
-
'Playful Y2K pop; periwinkle body, holographic accents, Poppins + `Crimson Text`.',
|
|
112
|
-
],
|
|
113
|
-
],
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
type: 'prose',
|
|
117
|
-
text: 'All theme packages export from two subpaths:\n- `@astryxdesign/theme-{name}`: source theme (runtime injection)\n- `@astryxdesign/theme-{name}/built`: pre-built theme (pair with `theme.css`)',
|
|
118
|
-
},
|
|
119
|
-
],
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
title: 'Theme Props',
|
|
123
|
-
category: 'guide',
|
|
124
|
-
content: [
|
|
125
|
-
{
|
|
126
|
-
type: 'prose',
|
|
127
|
-
text: "`<Theme>` takes `theme` (required), `mode` (`'system'` by default, or `'light'`/`'dark'`), and `children`. For every prop, run `astryx component Theme`.",
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
id: 'integration-themes',
|
|
133
|
-
title: 'Using a Theme from an Integration',
|
|
134
|
-
category: 'guide',
|
|
135
|
-
content: [
|
|
136
|
-
{
|
|
137
|
-
type: 'prose',
|
|
138
|
-
text: 'Install the integration as a direct dependency and Astryx discovers its source themes and guide topics without an `astryx.config` file. Install Core too because the copied source imports `defineTheme` from `@astryxdesign/core/theme`.',
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
type: 'code',
|
|
142
|
-
lang: 'bash',
|
|
143
|
-
label: 'Install, inspect, copy, and build',
|
|
144
|
-
code: 'npm install @astryxdesign/core @acme/brand-integration\nastryx theme list --package @acme/brand-integration\nastryx docs brand-theme\nastryx theme add ocean --package @acme/brand-integration\nastryx theme build src/themes/ocean/oceanTheme.ts',
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
type: 'prose',
|
|
148
|
-
text: 'The copy is editable project source, not a reference back into node_modules. The complete theme directory comes with it, including its typed `.doc.mjs`, nested token and palette modules, and receipts. A second add refuses to overwrite those files unless you pass `--overwrite`.',
|
|
149
|
-
},
|
|
150
|
-
],
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
id: 'creating-a-custom-theme',
|
|
154
|
-
title: 'Custom themes',
|
|
155
|
-
category: 'guide',
|
|
156
|
-
content: [
|
|
157
|
-
{
|
|
158
|
-
type: 'prose',
|
|
159
|
-
text: 'Start from a bundled theme or one contributed by an installed integration, or write one from scratch with defineTheme. `theme list` names each owner; when packages share a slug, pass `--package`. Only override tokens that differ from defaults; omitted tokens use the design system defaults.',
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
type: 'code',
|
|
163
|
-
lang: 'bash',
|
|
164
|
-
label: 'Browse, then copy a theme in as editable source',
|
|
165
|
-
code: 'astryx theme list\nastryx theme add stone\nastryx theme add ocean --package @acme/themes',
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
type: 'prose',
|
|
169
|
-
text: 'For an annotated map of the whole surface (every defineTheme field, the token families, and the component override syntax, each with the CLI command that prints its reference), run `astryx theme template`. It writes `theme.template.ts` into your project to read and copy from (`astryx init --features theme` writes it as part of project setup).',
|
|
170
|
-
},
|
|
171
|
-
],
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
title: 'defineTheme',
|
|
175
|
-
category: 'guide',
|
|
176
17
|
content: [
|
|
177
18
|
{
|
|
178
19
|
type: 'prose',
|
|
179
|
-
text: '
|
|
20
|
+
text: 'Install a theme, import it with the CLI, and wire the generated module once. For the full guide — available themes, integration themes, dark mode, nested themes, and production builds — see {@link generic:use-a-theme}.',
|
|
180
21
|
},
|
|
181
22
|
{
|
|
182
23
|
type: 'code',
|
|
183
24
|
lang: 'tsx',
|
|
184
|
-
label: '
|
|
185
|
-
code:
|
|
186
|
-
|
|
187
|
-
const myTheme = defineTheme({
|
|
188
|
-
name: 'my-theme',
|
|
189
|
-
// accent: single hex, or [light, dark] tuple to seed each scheme separately
|
|
190
|
-
color: { accent: ['#7B61FF', '#9B85FF'], neutralStyle: 'cool' },
|
|
191
|
-
typography: {
|
|
192
|
-
scale: { base: 14, ratio: 1.2 },
|
|
193
|
-
body: { family: 'Inter', fallbacks: '-apple-system, sans-serif' },
|
|
194
|
-
},
|
|
195
|
-
radius: { base: 4, multiplier: 1 },
|
|
196
|
-
motion: { fast: 175, medium: 410, ratio: 0.75 },
|
|
197
|
-
tokens: {
|
|
198
|
-
// Explicit overrides take precedence over scale-generated values
|
|
199
|
-
'--color-background-body': ['#FFFFFF', '#0A0A0A'],
|
|
200
|
-
},
|
|
201
|
-
});`,
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
type: 'table',
|
|
205
|
-
headers: ['Config', 'Generates', 'Parameters'],
|
|
206
|
-
rows: [
|
|
207
|
-
[
|
|
208
|
-
'color',
|
|
209
|
-
'--color-accent, --color-background-*, --color-text-*, --color-border, etc.',
|
|
210
|
-
'accent? (hex or [light, dark] tuple; omit for neutral-only), neutralStyle? (warm|cool|neutral), contrast? (standard|high)',
|
|
211
|
-
],
|
|
212
|
-
[
|
|
213
|
-
'typography.scale',
|
|
214
|
-
'--text-heading-*-size/weight/leading, --text-body-size/weight/leading',
|
|
215
|
-
'base (px), ratio',
|
|
216
|
-
],
|
|
217
|
-
[
|
|
218
|
-
'typography.body/heading/code',
|
|
219
|
-
'--font-family-body, --font-family-heading, --font-family-code',
|
|
220
|
-
'family, fallbacks?, url?, weight?',
|
|
221
|
-
],
|
|
222
|
-
[
|
|
223
|
-
'radius',
|
|
224
|
-
'--radius-inner, --radius-element, --radius-container, --radius-page, --radius-chat',
|
|
225
|
-
'base (px), multiplier (0–2)',
|
|
226
|
-
],
|
|
227
|
-
[
|
|
228
|
-
'motion',
|
|
229
|
-
'--duration-fast-min/fast/fast-max, --duration-medium-min/medium/medium-max',
|
|
230
|
-
'fast (ms), medium (ms), ratio, easing?',
|
|
231
|
-
],
|
|
232
|
-
],
|
|
233
|
-
},
|
|
234
|
-
],
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
title: 'Extending a Theme',
|
|
238
|
-
category: 'guide',
|
|
239
|
-
content: [
|
|
240
|
-
{
|
|
241
|
-
type: 'prose',
|
|
242
|
-
text: '`extends` lets you derive a new theme from an existing one, inheriting its tokens, component overrides, icons, and fonts. Only specify what you want to change; everything else carries over from the base theme.',
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
type: 'code',
|
|
246
|
-
lang: 'tsx',
|
|
247
|
-
label: 'Extending the neutral theme',
|
|
248
|
-
code: `import {defineTheme} from '@astryxdesign/core/theme';
|
|
249
|
-
import {neutralTheme} from '@astryxdesign/theme-neutral';
|
|
250
|
-
import {myIcons} from './icons';
|
|
251
|
-
|
|
252
|
-
const brandTheme = defineTheme({
|
|
253
|
-
name: 'brand',
|
|
254
|
-
extends: neutralTheme,
|
|
255
|
-
icons: myIcons,
|
|
256
|
-
tokens: {
|
|
257
|
-
'--color-accent': ['#7B61FF', '#9B85FF'],
|
|
258
|
-
},
|
|
259
|
-
});`,
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
type: 'table',
|
|
263
|
-
headers: ['Field', 'Merge behavior'],
|
|
264
|
-
rows: [
|
|
265
|
-
[
|
|
266
|
-
'tokens',
|
|
267
|
-
'Base tokens are copied first, then child tokens override on top.',
|
|
268
|
-
],
|
|
269
|
-
[
|
|
270
|
-
'components',
|
|
271
|
-
'Deep-merged: child component rules override matching keys from the base.',
|
|
272
|
-
],
|
|
273
|
-
[
|
|
274
|
-
'icons',
|
|
275
|
-
'Shallow-merged: child icons override matching names from the base.',
|
|
276
|
-
],
|
|
277
|
-
[
|
|
278
|
-
'indicators',
|
|
279
|
-
'Shallow-merged: child indicators override matching names from the base.',
|
|
280
|
-
],
|
|
281
|
-
[
|
|
282
|
-
'onDark, onLight',
|
|
283
|
-
"Deep-merged per surface: the base's resolved surface first, then the child's overrides.",
|
|
284
|
-
],
|
|
285
|
-
[
|
|
286
|
-
'typography, motion, radius, color',
|
|
287
|
-
'Child config replaces base entirely (these are scale inputs, not additive).',
|
|
288
|
-
],
|
|
289
|
-
[
|
|
290
|
-
'adaptations',
|
|
291
|
-
'Width-breakpoint overrides merge by fixed name. Inherited ordered rules keep their relative order; child rules append and re-resolve against the child root axes.',
|
|
292
|
-
],
|
|
293
|
-
],
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
type: 'prose',
|
|
297
|
-
text: "Inheritance is resolved when the theme is defined, so an extended theme is flat: `astryx theme build` emits one self-contained stylesheet holding everything the child inherited, and the base theme's CSS does not need to be loaded next to it. A base that is not a theme (most often an import that missed) is a build error rather than a theme that silently inherits nothing.",
|
|
298
|
-
},
|
|
299
|
-
],
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
title: 'Theme Adaptations',
|
|
303
|
-
category: 'guide',
|
|
304
|
-
content: [
|
|
305
|
-
{
|
|
306
|
-
type: 'prose',
|
|
307
|
-
text: 'Use `adaptations` for opt-in token, theme-local token, and component changes under viewport width, primary-pointer precision, contrast preference, or motion preference. Conditions in one `when` are ANDed. Rules are ordinary ordered objects, and later matching writes win.',
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
type: 'code',
|
|
311
|
-
lang: 'tsx',
|
|
312
|
-
label: 'Width and pointer adaptations',
|
|
313
|
-
code: `const acmeTheme = defineTheme({
|
|
314
|
-
name: 'acme',
|
|
315
|
-
adaptations: {
|
|
316
|
-
widthBreakpoints: {
|
|
317
|
-
sm: 640,
|
|
318
|
-
md: 768,
|
|
319
|
-
lg: 1024,
|
|
320
|
-
xl: 1280,
|
|
321
|
-
'2xl': 1536,
|
|
322
|
-
},
|
|
323
|
-
rules: [
|
|
324
|
-
{
|
|
325
|
-
when: {width: {below: 'md'}},
|
|
326
|
-
value: {tokens: {'--spacing-4': '12px'}},
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
when: {pointer: 'coarse'},
|
|
330
|
-
value: {
|
|
331
|
-
tokens: {
|
|
332
|
-
'--size-element-sm': '36px',
|
|
333
|
-
'--size-element-md': '40px',
|
|
334
|
-
'--size-element-lg': '44px',
|
|
335
|
-
},
|
|
336
|
-
},
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
when: {
|
|
340
|
-
width: {from: 'lg', below: 'xl'},
|
|
341
|
-
pointer: 'coarse',
|
|
342
|
-
contrast: 'more',
|
|
343
|
-
},
|
|
344
|
-
value: {components: {card: {base: {borderWidth: '2px'}}}},
|
|
345
|
-
},
|
|
346
|
-
],
|
|
347
|
-
},
|
|
348
|
-
});`,
|
|
349
|
-
},
|
|
350
|
-
{
|
|
351
|
-
type: 'table',
|
|
352
|
-
headers: ['Condition', 'Values'],
|
|
353
|
-
rows: [
|
|
354
|
-
['width.from / width.below', 'sm | md | lg | xl | 2xl'],
|
|
355
|
-
['pointer', 'coarse | fine'],
|
|
356
|
-
['contrast', 'more | less | no-preference'],
|
|
357
|
-
['motion', 'reduce | no-preference'],
|
|
358
|
-
],
|
|
359
|
-
},
|
|
360
|
-
{
|
|
361
|
-
type: 'prose',
|
|
362
|
-
text: '`widthBreakpoints` are fixed named start points. Defaults are 640 / 768 / 1024 / 1280 / 1536 CSS pixels. `from` includes its point; `below` excludes it. Breakpoint configuration alone emits no CSS. For how matching rules combine and what a rule may write, see Adaptation order and validation.',
|
|
363
|
-
},
|
|
364
|
-
],
|
|
365
|
-
},
|
|
366
|
-
{
|
|
367
|
-
id: 'adaptation-rules',
|
|
368
|
-
title: 'Adaptation order and validation',
|
|
369
|
-
category: 'guide',
|
|
370
|
-
content: [
|
|
371
|
-
{
|
|
372
|
-
type: 'prose',
|
|
373
|
-
text: 'Precedence follows rule order. Root theme values apply first, then every matching rule in declaration order. A later rule may deliberately restore a root value. `onDark` and `onLight` media-surface overrides apply after adaptations and win on the same leaf.',
|
|
374
|
-
},
|
|
375
|
-
{
|
|
376
|
-
type: 'prose',
|
|
377
|
-
text: "`extends` preserves the base rule order and appends child rules. Inherited conditions use the child's effective breakpoint map, and partial generative axes complete from the child root metadata. An empty child rule is a no-op, not a removal operator.",
|
|
378
|
-
},
|
|
379
|
-
{
|
|
380
|
-
type: 'prose',
|
|
381
|
-
text: 'A rule may replace a theme-local token only when the exact name is already enrolled by root `localTokens` or an enrolled base. Component writes in a rule are validated exactly like root `components` — same targets, axes, and value domains. The one addition is that a rule may not be the only place a custom value is enrolled: a value that is valid only because a theme enrolls it generates unconditional type augmentation, so declare it on the root theme first and let rules restyle it. Built-in values need no root declaration. When rules can match together, their ordered portable and local token writes are validated as one effective graph; any reachable cycle fails before CSS is emitted.',
|
|
382
|
-
},
|
|
383
|
-
{
|
|
384
|
-
type: 'prose',
|
|
385
|
-
text: 'Adaptations compile to CSS media queries with no resize listener or styling rerender. Runtime and `astryx theme build` use the same compiler, but only a built theme is present at first paint in an SSR app.',
|
|
25
|
+
label: 'Wire the generated module once',
|
|
26
|
+
code: "import {Theme} from '@astryxdesign/core';\nimport {themes, defaultThemeSlug} from './astryx-themes';\n\nfunction App() {\n return (\n <Theme theme={themes[defaultThemeSlug]}>\n <YourApp />\n </Theme>\n );\n}",
|
|
386
27
|
},
|
|
387
28
|
],
|
|
388
29
|
},
|
|
389
30
|
{
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
content: [
|
|
393
|
-
{
|
|
394
|
-
type: 'prose',
|
|
395
|
-
text: 'The `components` field in defineTheme uses semantic component keys and style keys, not raw CSS selectors. Use `base` for all instances, `variant:value` or `stateName` for specific props/states, and let the theme pipeline choose the underlying selector. For raw external CSS escape hatches, prefer the data-attribute selector surface documented in {@link generic:styling}.',
|
|
396
|
-
},
|
|
397
|
-
{
|
|
398
|
-
type: 'code',
|
|
399
|
-
lang: 'tsx',
|
|
400
|
-
label: 'Component overrides with standard CSS',
|
|
401
|
-
code: `components: {
|
|
402
|
-
// Standard CSS properties are expanded automatically.
|
|
403
|
-
// borderRadius also sets the internal radius var for concentric math.
|
|
404
|
-
// padding on container components (card, section, dialog, bottom-sheet) expands to layout tokens.
|
|
405
|
-
card: {
|
|
406
|
-
base: { borderRadius: '20px', padding: '24px' },
|
|
407
|
-
},
|
|
408
|
-
button: {
|
|
409
|
-
base: {
|
|
410
|
-
borderRadius: '9999px',
|
|
411
|
-
textTransform: 'uppercase',
|
|
412
|
-
// Some components have public CSS vars for properties that don't map
|
|
413
|
-
// to standard CSS. Set these directly. Take the name from
|
|
414
|
-
// \`astryx component <Name>\` — a var the component does not define
|
|
415
|
-
// compiles to CSS that never applies.
|
|
416
|
-
'--button-focus-offset': '3px',
|
|
417
|
-
},
|
|
418
|
-
'variant:ghost': { borderWidth: '2px', borderStyle: 'solid' },
|
|
419
|
-
},
|
|
420
|
-
}`,
|
|
421
|
-
},
|
|
422
|
-
{
|
|
423
|
-
type: 'prose',
|
|
424
|
-
text: "Run `astryx theme targets` for every themeable key in the system (`astryx theme targets <Name>` to scope it, `--json` to lint a theme against it), and `astryx component <Name>` for one component's theming targets, public CSS variables, and which standard CSS properties are supported.",
|
|
425
|
-
},
|
|
426
|
-
{
|
|
427
|
-
type: 'list',
|
|
428
|
-
style: 'do',
|
|
429
|
-
items: [
|
|
430
|
-
'Write standard CSS properties (borderRadius, padding); the pipeline expands them into internal vars.',
|
|
431
|
-
'Set public CSS vars directly when no standard property equivalent exists.',
|
|
432
|
-
],
|
|
433
|
-
},
|
|
434
|
-
{
|
|
435
|
-
type: 'list',
|
|
436
|
-
style: 'dont',
|
|
437
|
-
items: [
|
|
438
|
-
'Set private CSS vars (prefixed --_) directly. Use standard CSS properties instead. `astryx theme build` will error.',
|
|
439
|
-
],
|
|
440
|
-
},
|
|
441
|
-
],
|
|
442
|
-
},
|
|
443
|
-
{
|
|
444
|
-
title: 'Custom Variants',
|
|
445
|
-
category: 'guide',
|
|
446
|
-
content: [
|
|
447
|
-
{
|
|
448
|
-
type: 'prose',
|
|
449
|
-
text: "Themes can add new prop values to any component. Any `prop:value` key where the value isn't a built-in gets treated as a new variant. Use `astryx theme build` to generate TypeScript augmentations for type safety.",
|
|
450
|
-
},
|
|
451
|
-
{
|
|
452
|
-
type: 'code',
|
|
453
|
-
lang: 'tsx',
|
|
454
|
-
label: 'Adding custom variants',
|
|
455
|
-
code: `components: {
|
|
456
|
-
button: {
|
|
457
|
-
// Override an existing variant
|
|
458
|
-
'variant:secondary': { backgroundColor: 'rgba(0,0,0,0.06)' },
|
|
459
|
-
// Add a new variant — generates type augmentation on build
|
|
460
|
-
'variant:primary-muted': {
|
|
461
|
-
backgroundColor: 'light-dark(#F2F4F6, #28292C)',
|
|
462
|
-
color: 'var(--color-text-primary)',
|
|
463
|
-
},
|
|
464
|
-
},
|
|
465
|
-
banner: {
|
|
466
|
-
// Any extensible prop axis works — not just variant
|
|
467
|
-
'status:neutral': {
|
|
468
|
-
backgroundColor: 'var(--color-background-muted)',
|
|
469
|
-
color: 'var(--color-text-secondary)',
|
|
470
|
-
},
|
|
471
|
-
},
|
|
472
|
-
}`,
|
|
473
|
-
},
|
|
474
|
-
{
|
|
475
|
-
type: 'prose',
|
|
476
|
-
text: 'After building, the new values are type-safe in JSX:',
|
|
477
|
-
},
|
|
478
|
-
{
|
|
479
|
-
type: 'code',
|
|
480
|
-
lang: 'tsx',
|
|
481
|
-
label: 'Using custom variants',
|
|
482
|
-
code: `// TypeScript knows about 'primary-muted' after astryx theme build
|
|
483
|
-
<Button variant="primary-muted" label="Save draft" />
|
|
484
|
-
<Banner status="neutral" title="Note" />`,
|
|
485
|
-
},
|
|
486
|
-
{
|
|
487
|
-
type: 'prose',
|
|
488
|
-
text: "Custom variants only work when the theme that defines them is active. The component's variant map is extended via module augmentation, with no changes to the component source needed.",
|
|
489
|
-
},
|
|
490
|
-
],
|
|
491
|
-
},
|
|
492
|
-
{
|
|
493
|
-
id: 'building-themes-for-production',
|
|
494
|
-
title: 'Build a theme',
|
|
495
|
-
category: 'guide',
|
|
496
|
-
content: [
|
|
497
|
-
{
|
|
498
|
-
type: 'prose',
|
|
499
|
-
text: '`astryx theme build` compiles a defineTheme file into production-ready artifacts. Recommended for SSR apps (Next.js, Remix) where styles must be present on first paint.',
|
|
500
|
-
},
|
|
501
|
-
{
|
|
502
|
-
type: 'code',
|
|
503
|
-
lang: 'bash',
|
|
504
|
-
label: 'Build a theme',
|
|
505
|
-
code: 'astryx theme build ./src/themes/ocean.ts',
|
|
506
|
-
},
|
|
507
|
-
{
|
|
508
|
-
type: 'prose',
|
|
509
|
-
text: 'This generates the following files alongside the source:',
|
|
510
|
-
},
|
|
511
|
-
{
|
|
512
|
-
type: 'table',
|
|
513
|
-
headers: ['File', 'Description'],
|
|
514
|
-
rows: [
|
|
515
|
-
[
|
|
516
|
-
'ocean.css',
|
|
517
|
-
'Pre-compiled CSS with token overrides, component overrides, and prose element styles in @scope rules',
|
|
518
|
-
],
|
|
519
|
-
[
|
|
520
|
-
'ocean.js',
|
|
521
|
-
'ES module exporting the theme object with `__built: true` and pre-resolved token values. Also imports and re-exports an icon registry when the build detects its named import in the source theme (see Built themes with an icon registry).',
|
|
522
|
-
],
|
|
523
|
-
[
|
|
524
|
-
'ocean.d.ts',
|
|
525
|
-
'TypeScript declarations for the theme and icon registry exports',
|
|
526
|
-
],
|
|
527
|
-
[
|
|
528
|
-
'ocean.variants.d.ts',
|
|
529
|
-
"(Optional) Module augmentations for custom component prop values found in the theme's component overrides",
|
|
530
|
-
],
|
|
531
|
-
],
|
|
532
|
-
},
|
|
533
|
-
{
|
|
534
|
-
type: 'prose',
|
|
535
|
-
text: 'The `__built: true` flag tells Theme to skip runtime `<style>` injection; the CSS file handles it.',
|
|
536
|
-
},
|
|
537
|
-
{
|
|
538
|
-
type: 'prose',
|
|
539
|
-
text: 'After upgrading Astryx across a selector-contract change, rerun `astryx theme build <theme-file>` for every custom prebuilt theme. Deploy the regenerated `.css`, `.js`, `.d.ts`, and optional `.variants.d.ts` together. The runtime intentionally trusts `__built: true` and will not repair stale CSS from an older build.',
|
|
540
|
-
},
|
|
541
|
-
{
|
|
542
|
-
type: 'code',
|
|
543
|
-
lang: 'tsx',
|
|
544
|
-
label: 'Using a custom built theme',
|
|
545
|
-
code: `import {oceanTheme} from './themes/ocean';
|
|
546
|
-
import './themes/ocean.css';
|
|
547
|
-
|
|
548
|
-
<Theme theme={oceanTheme}>
|
|
549
|
-
<App />
|
|
550
|
-
</Theme>`,
|
|
551
|
-
},
|
|
552
|
-
{
|
|
553
|
-
type: 'prose',
|
|
554
|
-
text: "The build also warns when the theme names font families it does not load (webfonts like Fraunces) and prints the `<link>`/`@font-face` to add. The built CSS only sets font-family, so loading the font files stays the app's job. See {@link generic:typography} for the full recipe.",
|
|
555
|
-
},
|
|
556
|
-
],
|
|
557
|
-
},
|
|
558
|
-
{
|
|
559
|
-
id: 'icon-registry',
|
|
560
|
-
title: 'Built themes with an icon registry',
|
|
561
|
-
category: 'guide',
|
|
562
|
-
content: [
|
|
563
|
-
{
|
|
564
|
-
type: 'prose',
|
|
565
|
-
text: "The current `theme build` implementation emits an icon import when it detects a named import used by the theme’s `icons:` field, such as `import {oceanIcons} from './icons'` with `icons: oceanIcons`. It does not compile that registry module. Inline registries, including local constants, are currently omitted from the generated theme even though `defineTheme` accepts them at runtime. Move the registry to a separate module and use a named import for this build flow. For a registry that uses React and lucide-react, the following example compiles it alongside the generated theme:",
|
|
566
|
-
},
|
|
567
|
-
{
|
|
568
|
-
type: 'code',
|
|
569
|
-
lang: 'bash',
|
|
570
|
-
label: 'Compiling the icon registry sidecar',
|
|
571
|
-
code: `# Emit the built theme; point its icon import at the file the next step produces
|
|
572
|
-
astryx theme build ./src/themes/ocean.ts -o dist/theme.css --icons-specifier ./icons.mjs
|
|
573
|
-
|
|
574
|
-
# Compile the icon registry to a real ES module next to the generated JS
|
|
575
|
-
esbuild src/themes/icons.tsx --bundle --format=esm --outfile=dist/icons.mjs \\
|
|
576
|
-
--external:react --external:lucide-react --jsx=automatic`,
|
|
577
|
-
},
|
|
578
|
-
{
|
|
579
|
-
type: 'prose',
|
|
580
|
-
text: 'In the example above, the generated theme imports `./icons.mjs` from `dist`. If the second command is skipped, `theme build` can still succeed, but loading or bundling the generated module fails because `dist/icons.mjs` is missing. `--icons-specifier` changes the emitted import; it does not create or verify the target file. Match the specifier to a module that resolves from the generated JS file. Keep `react` and the icon library external so the registry does not bundle its own copies of those dependencies.',
|
|
581
|
-
},
|
|
582
|
-
{
|
|
583
|
-
type: 'prose',
|
|
584
|
-
text: 'Without `--icons-specifier`, the detected source import specifier is emitted unchanged. In the default no-`--out` flow, a bundler can resolve an extensionless `./icons` to the neighboring `icons.tsx` source. Node ESM does not perform that lookup and reports `ERR_MODULE_NOT_FOUND`. Moving the output with `--out` also changes where relative imports resolve; the generated module cannot find the original source merely because a bundler is used.',
|
|
585
|
-
},
|
|
586
|
-
],
|
|
587
|
-
},
|
|
588
|
-
{
|
|
589
|
-
title: 'Building a Theme Family',
|
|
590
|
-
category: 'guide',
|
|
31
|
+
id: 'creating-a-custom-theme',
|
|
32
|
+
title: 'Create a custom theme',
|
|
591
33
|
content: [
|
|
592
34
|
{
|
|
593
35
|
type: 'prose',
|
|
594
|
-
text: 'Use
|
|
36
|
+
text: 'Use `defineTheme` with token overrides, scale configs, and component style overrides. For the full guide — palette generation, extending themes, adaptations, custom variants, and production builds — see {@link generic:author-a-theme}.',
|
|
595
37
|
},
|
|
596
38
|
{
|
|
597
39
|
type: 'code',
|
|
598
40
|
lang: 'bash',
|
|
599
|
-
label: '
|
|
600
|
-
code:
|
|
601
|
-
./src/themes/ocean.mjs \\
|
|
602
|
-
./src/themes/ocean-calm.mjs \\
|
|
603
|
-
./src/themes/ocean-calm-deep.mjs \\
|
|
604
|
-
--family-key ocean-family`,
|
|
605
|
-
},
|
|
606
|
-
{
|
|
607
|
-
type: 'code',
|
|
608
|
-
lang: 'html',
|
|
609
|
-
label: 'Load native CSS and ESM independently',
|
|
610
|
-
code: `<link rel="stylesheet" href="./src/themes/ocean-family.css" />
|
|
611
|
-
<script type="module">
|
|
612
|
-
import {oceanCalmTheme} from './src/themes/ocean-family.js';
|
|
613
|
-
</script>`,
|
|
614
|
-
},
|
|
615
|
-
{
|
|
616
|
-
type: 'prose',
|
|
617
|
-
text: 'The family stylesheet eagerly downloads every selected member so first paint is complete. Switching members changes only the theme identity; it does not add, remove, or reorder stylesheets. A bundler such as Vite consumes the same CSS and ESM files.',
|
|
618
|
-
},
|
|
619
|
-
{
|
|
620
|
-
type: 'prose',
|
|
621
|
-
text: 'The family key is only the filename stem (`ocean-family.css`, `.js`, and `.d.ts`) and must differ from every selected member name. Use the ordinary standalone build when an app needs only one complete theme. Add `--check` to compare the exact keyed trio without writing.',
|
|
622
|
-
},
|
|
623
|
-
],
|
|
624
|
-
},
|
|
625
|
-
{
|
|
626
|
-
title: 'Runtime vs Built Themes',
|
|
627
|
-
category: 'guide',
|
|
628
|
-
content: [
|
|
629
|
-
{
|
|
630
|
-
type: 'prose',
|
|
631
|
-
text: 'Themes work in two modes:',
|
|
632
|
-
},
|
|
633
|
-
{
|
|
634
|
-
type: 'table',
|
|
635
|
-
headers: ['', 'Runtime (source)', 'Built'],
|
|
636
|
-
rows: [
|
|
637
|
-
[
|
|
638
|
-
'Import (published theme)',
|
|
639
|
-
'@astryxdesign/theme-{name}',
|
|
640
|
-
'@astryxdesign/theme-{name}/built + theme.css',
|
|
641
|
-
],
|
|
642
|
-
[
|
|
643
|
-
'Import (custom theme)',
|
|
644
|
-
'defineTheme() directly',
|
|
645
|
-
'Built .js + .css from `astryx theme build`',
|
|
646
|
-
],
|
|
647
|
-
[
|
|
648
|
-
'How it works',
|
|
649
|
-
'useInsertionEffect injects <style> at hydration',
|
|
650
|
-
'Pre-compiled .css file loaded with the page',
|
|
651
|
-
],
|
|
652
|
-
[
|
|
653
|
-
'Component overrides',
|
|
654
|
-
'Injected client-only',
|
|
655
|
-
'In static CSS: present during SSR',
|
|
656
|
-
],
|
|
657
|
-
[
|
|
658
|
-
'SSR safe',
|
|
659
|
-
'Tokens yes, component overrides flash on hydration',
|
|
660
|
-
'Fully SSR safe: no flash',
|
|
661
|
-
],
|
|
662
|
-
[
|
|
663
|
-
'Best for',
|
|
664
|
-
'Dev, prototyping, client-only SPAs',
|
|
665
|
-
'Production, SSR apps (Next.js, Remix)',
|
|
666
|
-
],
|
|
667
|
-
],
|
|
668
|
-
},
|
|
669
|
-
{
|
|
670
|
-
type: 'list',
|
|
671
|
-
style: 'do',
|
|
672
|
-
items: [
|
|
673
|
-
'Use the /built subpath + theme.css for production SSR apps.',
|
|
674
|
-
'Use runtime themes during development for fast iteration.',
|
|
675
|
-
'Run `astryx theme build` for custom themes to get the built artifacts.',
|
|
676
|
-
],
|
|
677
|
-
},
|
|
678
|
-
{
|
|
679
|
-
type: 'list',
|
|
680
|
-
style: 'dont',
|
|
681
|
-
items: [
|
|
682
|
-
'Use runtime themes in production SSR apps; component overrides will flash on hydration.',
|
|
683
|
-
"Import /built without the CSS file; component overrides won't apply.",
|
|
684
|
-
],
|
|
41
|
+
label: 'Quick start',
|
|
42
|
+
code: 'astryx theme add stone --import # use an existing theme\nastryx theme eject stone # fork its source to customize\nastryx theme build src/themes/stone/stoneTheme.ts',
|
|
685
43
|
},
|
|
686
44
|
],
|
|
687
45
|
},
|
|
688
46
|
{
|
|
689
47
|
id: 'light-dark-mode',
|
|
690
48
|
title: 'Dark mode',
|
|
691
|
-
category: 'guide',
|
|
692
49
|
content: [
|
|
693
50
|
{
|
|
694
51
|
type: 'prose',
|
|
695
|
-
text: "Use [light, dark] tuples in token values for automatic mode switching. Use mode='system' (default) on Theme to follow OS preference.",
|
|
52
|
+
text: "Use [light, dark] tuples in token values for automatic mode switching. Use mode='system' (default) on Theme to follow OS preference. Full guide: {@link generic:use-a-theme}.",
|
|
696
53
|
},
|
|
697
54
|
{
|
|
698
55
|
type: 'code',
|
|
@@ -700,129 +57,14 @@ esbuild src/themes/icons.tsx --bundle --format=esm --outfile=dist/icons.mjs \\
|
|
|
700
57
|
label: 'Light/dark tuple',
|
|
701
58
|
code: "'--color-accent': ['#0064E0', '#2694FE'],\n// ^light ^dark",
|
|
702
59
|
},
|
|
703
|
-
{
|
|
704
|
-
type: 'code',
|
|
705
|
-
lang: 'tsx',
|
|
706
|
-
label: 'Toggle with a button',
|
|
707
|
-
code: `const [mode, setMode] = useState<'light' | 'dark'>('light');
|
|
708
|
-
|
|
709
|
-
<Theme theme={myTheme} mode={mode}>
|
|
710
|
-
<Button
|
|
711
|
-
label={mode === 'light' ? 'Switch to Dark' : 'Switch to Light'}
|
|
712
|
-
onClick={() => setMode(m => (m === 'light' ? 'dark' : 'light'))}
|
|
713
|
-
/>
|
|
714
|
-
</Theme>;`,
|
|
715
|
-
},
|
|
716
60
|
],
|
|
717
61
|
},
|
|
718
62
|
{
|
|
719
|
-
|
|
720
|
-
title: 'Nested themes',
|
|
721
|
-
category: 'guide',
|
|
63
|
+
title: 'Integration themes',
|
|
722
64
|
content: [
|
|
723
65
|
{
|
|
724
66
|
type: 'prose',
|
|
725
|
-
text: '
|
|
726
|
-
},
|
|
727
|
-
{
|
|
728
|
-
type: 'code',
|
|
729
|
-
lang: 'tsx',
|
|
730
|
-
label: 'Dark sidebar with light content',
|
|
731
|
-
code: `<Theme theme={lightTheme} mode="light">
|
|
732
|
-
<Layout
|
|
733
|
-
header={<LayoutHeader>...</LayoutHeader>}
|
|
734
|
-
start={
|
|
735
|
-
<Theme theme={darkTheme} mode="dark">
|
|
736
|
-
<LayoutPanel>{/* Dark sidebar */}</LayoutPanel>
|
|
737
|
-
</Theme>
|
|
738
|
-
}
|
|
739
|
-
content={<LayoutContent>{/* Light content */}</LayoutContent>}
|
|
740
|
-
/>
|
|
741
|
-
</Theme>`,
|
|
742
|
-
},
|
|
743
|
-
],
|
|
744
|
-
},
|
|
745
|
-
{
|
|
746
|
-
title: 'Token Utilities',
|
|
747
|
-
category: 'guide',
|
|
748
|
-
content: [
|
|
749
|
-
{
|
|
750
|
-
type: 'prose',
|
|
751
|
-
text: 'Use `tokenVar()` when a non-StyleX styling library wants a CSS variable reference, and `resolveThemeTokens()` when JavaScript needs token values for a specific theme and mode without React context. Themes are also registered by name when created with `defineTheme()`; call `registerTheme(theme)` for prebuilt or object-literal themes that need name-based SSR lookup.',
|
|
752
|
-
},
|
|
753
|
-
{
|
|
754
|
-
type: 'code',
|
|
755
|
-
lang: 'ts',
|
|
756
|
-
label: 'CSS var references for styling-library configs',
|
|
757
|
-
code: `import {tokenVar, tokenVars} from '@astryxdesign/core/theme/tokens';
|
|
758
|
-
|
|
759
|
-
const pandaOrEmotionTheme = {
|
|
760
|
-
colors: {
|
|
761
|
-
text: tokenVar('--color-text-primary'),
|
|
762
|
-
surface: tokenVars['--color-background-surface'],
|
|
763
|
-
},
|
|
764
|
-
spacing: {
|
|
765
|
-
4: tokenVars['--spacing-4'],
|
|
766
|
-
},
|
|
767
|
-
};`,
|
|
768
|
-
},
|
|
769
|
-
{
|
|
770
|
-
type: 'code',
|
|
771
|
-
lang: 'ts',
|
|
772
|
-
label: 'Resolve token values without a hook',
|
|
773
|
-
code: `import {resolveThemeTokens} from '@astryxdesign/core/theme/tokens';
|
|
774
|
-
import {neutralTheme} from '@astryxdesign/theme-neutral';
|
|
775
|
-
|
|
776
|
-
const lightTokens = resolveThemeTokens(neutralTheme, {mode: 'light'});
|
|
777
|
-
const chartTheme = {
|
|
778
|
-
textColor: lightTokens['--color-text-primary'],
|
|
779
|
-
seriesColor: lightTokens['--color-data-categorical-blue'],
|
|
780
|
-
};`,
|
|
781
|
-
},
|
|
782
|
-
{
|
|
783
|
-
type: 'prose',
|
|
784
|
-
text: 'The `@astryxdesign/core/theme/tokens` subpath is server-safe and does not require React. The main `@astryxdesign/core/theme` barrel also re-exports these helpers for client code that already imports theme APIs.',
|
|
785
|
-
},
|
|
786
|
-
],
|
|
787
|
-
},
|
|
788
|
-
{
|
|
789
|
-
title: 'useTheme Hook',
|
|
790
|
-
category: 'guide',
|
|
791
|
-
content: [
|
|
792
|
-
{
|
|
793
|
-
type: 'prose',
|
|
794
|
-
text: '`useTheme()` uses the same token resolution as `resolveThemeTokens()`, but reads the nearest Theme and effective color mode from React context and media query state. Use it inside client components for SVG, canvas, charts, maps, and third-party configuration objects that need token values in JavaScript instead of `var(...)` references.',
|
|
795
|
-
},
|
|
796
|
-
{
|
|
797
|
-
type: 'code',
|
|
798
|
-
lang: 'tsx',
|
|
799
|
-
label: 'Access resolved token values in React',
|
|
800
|
-
code: `import {useMemo} from 'react';
|
|
801
|
-
import {useTheme} from '@astryxdesign/core/theme';
|
|
802
|
-
|
|
803
|
-
function ChartConfig() {
|
|
804
|
-
const {mode, tokens} = useTheme();
|
|
805
|
-
|
|
806
|
-
const options = useMemo(
|
|
807
|
-
() => ({
|
|
808
|
-
mode,
|
|
809
|
-
textColor: tokens['--color-text-primary'],
|
|
810
|
-
gridColor: tokens['--color-border'],
|
|
811
|
-
seriesColor: tokens['--color-data-categorical-blue'],
|
|
812
|
-
}),
|
|
813
|
-
[mode, tokens],
|
|
814
|
-
);
|
|
815
|
-
|
|
816
|
-
return <Chart options={options} />;
|
|
817
|
-
}`,
|
|
818
|
-
},
|
|
819
|
-
{
|
|
820
|
-
type: 'prose',
|
|
821
|
-
text: 'Prefer CSS variables, StyleX token imports, xstyle, or className for ordinary styling. To change the theme or mode, manage state at the app level and pass it to `<Theme>`.',
|
|
822
|
-
},
|
|
823
|
-
{
|
|
824
|
-
type: 'prose',
|
|
825
|
-
text: 'See {@link generic:styling-libraries} for styling-library interop and {@link generic:tokens} for the full token reference.',
|
|
67
|
+
text: 'Install an integration and Astryx discovers its themes automatically. Import one with `astryx theme add <name> --import --package <integration>`. Use `theme eject` only for an independent source fork. For the full walkthrough, see {@link generic:use-a-theme}.',
|
|
826
68
|
},
|
|
827
69
|
],
|
|
828
70
|
},
|