@astryxdesign/cli 0.6.4-canary.f0355e3 → 0.6.4
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 +96 -99
- package/api/build/build.doc.mjs +1 -6
- package/api/build/build.test.mjs +0 -22
- package/api/build/kit/kit.mjs +5 -44
- package/api/component/_adapter.d.mts +0 -25
- package/api/component/_adapter.mjs +5 -59
- package/api/component/component.d.mts +3 -6
- package/api/component/component.doc.mjs +17 -37
- package/api/component/component.mjs +9 -249
- package/api/component/component.type.d.mts +0 -25
- package/api/component/component.type.mjs +0 -44
- package/api/discover/_adapter.d.mts +6 -114
- package/api/discover/_adapter.mjs +17 -372
- package/api/discover/detail/detail.d.mts +6 -18
- package/api/discover/detail/detail.mjs +13 -67
- package/api/discover/detail/detail.test.mjs +0 -85
- package/api/discover/discover.d.mts +9 -3
- package/api/discover/discover.doc.mjs +18 -61
- package/api/discover/discover.mjs +36 -220
- package/api/discover/discover.test.mjs +2 -11
- package/api/discover/discover.type.d.mts +8 -147
- package/api/discover/discover.type.mjs +12 -102
- package/api/discover/list/list.d.mts +6 -20
- package/api/discover/list/list.mjs +12 -45
- package/api/discover/list/list.test.mjs +0 -46
- package/api/discover/search/search.d.mts +16 -18
- package/api/discover/search/search.mjs +56 -102
- package/api/discover/search/search.test.mjs +10 -144
- package/api/docs/_adapter.d.mts +3 -8
- package/api/docs/_adapter.mjs +6 -14
- package/api/docs/docOverlays.test.mjs +1 -27
- package/api/docs/docs.doc.mjs +2 -2
- package/api/docs/docs.test.mjs +243 -0
- package/api/docs/integration-tree.test.mjs +555 -0
- package/api/docs/integrationDocs.test.mjs +314 -0
- package/api/doctor/doctor.d.mts +3 -8
- package/api/doctor/doctor.doc.mjs +8 -17
- package/api/doctor/doctor.mjs +9 -90
- package/api/doctor/doctor.test.mjs +10 -122
- package/api/doctor/doctor.type.d.mts +1 -1
- package/api/doctor/doctor.type.mjs +1 -1
- package/api/gap-report/gap-report.doc.mjs +10 -19
- package/api/hook/hook.doc.mjs +3 -6
- package/api/index.d.mts +2 -1
- package/api/index.mjs +5 -5
- package/api/init/init.doc.mjs +12 -17
- package/api/integration/add-helpers.d.mts +2 -5
- package/api/integration/add-helpers.mjs +9 -36
- package/api/integration/add-theme.mjs +1 -22
- package/api/integration/add-theme.test.mjs +0 -34
- package/api/integration/authoring-checks.mjs +2 -2
- package/api/integration/integrationPackCheck.doc.mjs +3 -3
- package/api/integration/pack-check.mjs +9 -82
- package/api/integration/pack-check.test.mjs +0 -90
- package/api/integration/pack-check.type.mjs +1 -1
- package/api/json/assertResponse.doc.mjs +1 -1
- package/api/json/index.ts +1 -0
- package/api/json/isError.doc.mjs +1 -1
- package/api/layout/_adapter.d.mts +34 -0
- package/api/layout/_adapter.mjs +148 -0
- package/api/layout/check/check.d.mts +16 -0
- package/api/layout/check/check.mjs +40 -0
- package/api/layout/expand/expand.d.mts +22 -0
- package/api/layout/expand/expand.mjs +155 -0
- package/api/layout/expand/expand.path-safety.test.mjs +53 -0
- package/api/layout/grammar/grammar.d.mts +13 -0
- package/api/layout/grammar/grammar.mjs +87 -0
- package/api/layout/layout.d.mts +6 -0
- package/api/layout/layout.mjs +17 -0
- package/api/layout/layout.test.mjs +297 -0
- package/api/layout/layout.type.d.mts +89 -0
- package/api/layout/layout.type.mjs +103 -0
- package/api/layout/layoutCheck.doc.d.mts +11 -0
- package/api/layout/layoutCheck.doc.mjs +85 -0
- package/api/layout/layoutExpand.doc.d.mts +11 -0
- package/api/layout/layoutExpand.doc.mjs +107 -0
- package/api/layout/layoutGrammar.doc.d.mts +11 -0
- package/api/layout/layoutGrammar.doc.mjs +57 -0
- package/api/search/search.d.mts +1 -27
- package/api/search/search.doc.mjs +2 -2
- package/api/search/search.mjs +16 -228
- package/api/search/search.test.mjs +512 -0
- package/api/swizzle/swizzle.doc.mjs +5 -7
- package/api/template/copy/copy.mjs +1 -1
- package/api/template/copy/copy.test.mjs +0 -9
- package/api/template/template-integration.test.mjs +65 -1
- package/api/template/template.doc.mjs +1 -2
- package/api/template/template.mjs +1 -1
- package/api/theme/add/add.mjs +25 -17
- package/api/theme/add/add.staging.test.mjs +23 -40
- package/api/theme/build/build.family.test.mjs +12 -7
- package/api/theme/build/build.mjs +18 -8
- package/api/theme/generateTonalPalette.doc.mjs +2 -1
- package/api/theme/listThemes.doc.mjs +1 -1
- package/api/theme/themeAdd.doc.mjs +10 -9
- package/api/theme/themeBuild.doc.mjs +13 -13
- package/api/theme/themeList.doc.mjs +1 -1
- package/api/theme/themeListAvailable.doc.mjs +1 -2
- package/api/theme/themePaletteGenerate.doc.mjs +8 -15
- package/api/theme/themeTargets.doc.mjs +2 -3
- package/api/theme/themeTemplate.doc.mjs +1 -2
- package/api/upgrade/run/run.mjs +4 -6
- package/api/upgrade/upgrade.doc.mjs +22 -24
- package/api/upgrade/upgrade.type.mjs +2 -2
- package/assets/codemods/__tests__/runner.test.mjs +1 -3
- package/assets/codemods/integration-runner.mjs +3 -3
- package/assets/codemods/runner.mjs +4 -5
- package/assets/docs/README.md +2 -4
- package/assets/docs/browser-support.doc.mjs +11 -11
- package/assets/docs/color.doc.mjs +2 -8
- package/assets/docs/elevation.doc.mjs +4 -6
- package/assets/docs/getting-started.doc.mjs +16 -5
- package/assets/docs/icons.doc.mjs +21 -2
- package/assets/docs/illustrations.doc.mjs +15 -7
- package/assets/docs/internationalization.doc.mjs +5 -7
- package/assets/docs/layout.doc.dense.mjs +82 -130
- package/assets/docs/layout.doc.mjs +77 -133
- package/assets/docs/migration.doc.mjs +21 -19
- package/assets/docs/motion.doc.mjs +3 -16
- package/assets/docs/principles.doc.dense.mjs +5 -5
- package/assets/docs/principles.doc.mjs +0 -8
- package/assets/docs/principles.doc.zh.mjs +6 -6
- package/assets/docs/shape.doc.mjs +3 -8
- package/assets/docs/spacing.doc.mjs +2 -7
- package/assets/docs/styling-libraries.doc.mjs +2 -6
- package/assets/docs/styling.doc.mjs +23 -19
- package/assets/docs/theme.doc.dense.mjs +18 -58
- package/assets/docs/theme.doc.mjs +46 -56
- package/assets/docs/theme.doc.zh.mjs +8 -9
- package/assets/docs/tokens.doc.dense.mjs +2 -2
- package/assets/docs/tokens.doc.mjs +8 -389
- package/assets/docs/tokens.doc.zh.mjs +2 -2
- package/assets/docs/tree/integrations.doc.mjs +451 -25
- package/assets/docs/tree/integrations.test.mjs +62 -0
- package/assets/docs/tree/writing-docs.doc.mjs +286 -0
- package/assets/docs/typography.doc.mjs +4 -24
- package/assets/docs/working-with-ai.doc.mjs +22 -30
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
- package/authoring/config/config.doc.mjs +2 -10
- package/authoring/config/parse.d.mts +0 -2
- package/authoring/config/parse.mjs +0 -19
- package/authoring/config/parse.test.mjs +0 -8
- package/authoring/config/type.ts +2 -13
- package/authoring/doctypes/_schema.d.mts +2 -3
- package/authoring/doctypes/_schema.mjs +0 -6
- package/authoring/doctypes/base/graph-fields.doc.mjs +3 -3
- package/authoring/doctypes/base/type.ts +2 -4
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/command/type.ts +1 -1
- package/authoring/doctypes/component/component.doc.mjs +0 -6
- package/authoring/doctypes/component/type.ts +0 -8
- package/authoring/doctypes/reference/reference.doc.mjs +0 -7
- package/authoring/doctypes/reference/type.ts +0 -5
- package/authoring/doctypes/schema/schema.doc.mjs +2 -2
- package/authoring/doctypes/template/template.doc.mjs +1 -1
- package/authoring/doctypes/template/type.ts +2 -2
- package/authoring/index.d.mts +0 -1
- package/authoring/index.d.ts +0 -10
- package/authoring/index.mjs +0 -1
- package/authoring/integration/integration.doc.mjs +10 -12
- package/clients/cli/command-result-coverage.test.mjs +7 -7
- package/clients/cli/commands/component/index.mjs +55 -152
- package/clients/cli/commands/component-ownership.test.mjs +0 -89
- package/clients/cli/commands/component.doc.mjs +9 -27
- package/clients/cli/commands/debug-result-summary.test.mjs +2 -2
- package/clients/cli/commands/discover.doc.mjs +9 -53
- package/clients/cli/commands/discover.mjs +118 -393
- package/clients/cli/commands/docs.doc.mjs +1 -1
- package/clients/cli/commands/docs.mjs +17 -60
- package/clients/cli/commands/docs.test.mjs +294 -0
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +2 -3
- package/clients/cli/commands/doctor-integration.test.mjs +0 -53
- package/clients/cli/commands/doctor.doc.mjs +1 -3
- package/clients/cli/commands/doctor.mjs +5 -49
- package/clients/cli/commands/gap-report.doc.mjs +9 -10
- package/clients/cli/commands/init.doc.mjs +6 -9
- package/clients/cli/commands/integration-add.doc.mjs +9 -9
- package/clients/cli/commands/integration-authoring.test.mjs +10 -61
- package/clients/cli/commands/integration-pack.doc.mjs +9 -5
- package/clients/cli/commands/integration-real-world.test.mjs +1 -1
- package/clients/cli/commands/integration.doc.mjs +4 -4
- package/clients/cli/commands/integration.mjs +43 -74
- package/clients/cli/commands/layout-check.doc.mjs +65 -0
- package/clients/cli/commands/layout-expand.doc.mjs +83 -0
- package/clients/cli/commands/layout-grammar.doc.mjs +30 -0
- package/clients/cli/commands/layout.doc.mjs +34 -0
- package/clients/cli/commands/layout.error-codes.test.mjs +66 -0
- package/clients/cli/commands/layout.exit-parity.test.mjs +41 -0
- package/clients/cli/commands/layout.mjs +275 -0
- package/clients/cli/commands/layout.path-help.test.mjs +33 -0
- package/clients/cli/commands/layout.stdin-cap.test.mjs +47 -0
- package/clients/cli/commands/layout.text-fields.test.mjs +39 -0
- package/clients/cli/commands/manifest.doc.mjs +1 -1
- package/clients/cli/commands/search.doc.mjs +3 -10
- package/clients/cli/commands/search.mjs +2 -21
- package/clients/cli/commands/search.test.mjs +4 -21
- package/clients/cli/commands/swizzle.doc.mjs +1 -1
- package/clients/cli/commands/template.doc.mjs +1 -1
- package/clients/cli/commands/text-json-parity.test.mjs +16 -5
- package/clients/cli/commands/theme-add.doc.mjs +1 -1
- package/clients/cli/commands/theme-palette-generate.doc.mjs +2 -3
- package/clients/cli/commands/theme-palette.doc.mjs +2 -1
- package/clients/cli/commands/theme-targets.doc.mjs +2 -2
- package/clients/cli/commands/theme.doc.mjs +1 -2
- package/clients/cli/commands/upgrade.doc.mjs +3 -62
- package/clients/cli/index.mjs +10 -28
- package/clients/cli/lib/define-command.mjs +4 -28
- package/clients/cli/lib/define-command.test.mjs +0 -54
- package/clients/cli/lib/exit-codes.test.mjs +9 -18
- package/clients/cli/lib/json-shim.mjs +14 -24
- package/clients/cli/lib/json-shim.test.mjs +20 -6
- package/clients/cli/lib/manifest.mjs +13 -18
- package/clients/cli/lib/manifest.test.mjs +2 -5
- package/foundation/agent-docs/agent-docs.mjs +1 -1
- package/foundation/agent-docs/agent-docs.test.mjs +1159 -0
- package/foundation/discovery/authoring-self-docs.mjs +0 -1
- package/foundation/discovery/authoring-self-docs.test.mjs +2 -6
- package/foundation/discovery/cli-self-docs.mjs +2 -16
- package/foundation/discovery/cli-self-docs.test.mjs +0 -20
- package/foundation/discovery/docs-discovery.mjs +1 -5
- package/foundation/discovery/docs-discovery.test.mjs +0 -21
- package/foundation/discovery/docs-section-key.d.mts +1 -1
- package/foundation/discovery/docs-section-key.mjs +1 -1
- package/foundation/discovery/template-adapter.mjs +1 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +14 -3
- package/foundation/doc-compiler/tree.d.mts +0 -4
- package/foundation/doc-compiler/tree.mjs +1 -6
- package/foundation/doc-compiler/tree.test.mjs +598 -0
- package/foundation/integrations/cli-requirement.d.mts +6 -26
- package/foundation/integrations/cli-requirement.mjs +11 -46
- package/foundation/integrations/cli-requirement.test.mjs +2 -7
- package/foundation/integrations/contribution-inventory.mjs +1 -1
- package/foundation/integrations/integrations.d.mts +1 -14
- package/foundation/integrations/integrations.mjs +1 -41
- package/foundation/integrations/integrations.test.mjs +0 -31
- package/foundation/response/error-codes.doc.mjs +8 -6
- package/foundation/response/error-codes.test.mjs +5 -30
- package/foundation/response/response-types.doc.d.mts +3 -4
- package/foundation/response/response-types.doc.mjs +27 -40
- package/foundation/response/response-types.doc.test.mjs +0 -23
- package/foundation/response/response.doc.mjs +10 -11
- package/foundation/xle/browser.d.mts +3 -3
- package/foundation/xle/browser.mjs +3 -3
- package/foundation/xle/expand.mjs +2 -2
- package/foundation/xle/parse.mjs +1 -1
- package/foundation/xle/print.mjs +2 -2
- package/foundation/xle/splice.mjs +1 -1
- package/package.json +9 -9
- package/api/discover/_adapter.test.mjs +0 -215
- package/api/discover/_catalog-view.d.mts +0 -115
- package/api/discover/_catalog-view.mjs +0 -203
- package/api/discover/_catalog-view.test.mjs +0 -128
- package/api/discover/detail/item/item.d.mts +0 -26
- package/api/discover/detail/item/item.mjs +0 -78
- package/api/discover/detail/item/item.test.mjs +0 -73
- package/api/integration/pack-check.lifecycle-output.test.mjs +0 -107
- package/api/theme/add/add.rollback.test.mjs +0 -158
- package/api/theme/build/build.rollback.test.mjs +0 -148
- package/api/upgrade/run/files-changed.test.mjs +0 -111
- package/assets/codemods/file-count.test.mjs +0 -163
- package/assets/docs/tree/add-a-component.doc.mjs +0 -75
- package/assets/docs/tree/add-a-theme.doc.mjs +0 -85
- package/assets/docs/tree/add-a-topic.doc.mjs +0 -144
- package/assets/docs/tree/agent-guidance.doc.mjs +0 -138
- package/assets/docs/tree/block-template.doc.mjs +0 -130
- package/assets/docs/tree/build-the-template.doc.mjs +0 -28
- package/assets/docs/tree/building-blocks.doc.mjs +0 -46
- package/assets/docs/tree/check-your-docs.doc.mjs +0 -137
- package/assets/docs/tree/checks.doc.mjs +0 -119
- package/assets/docs/tree/codemods.doc.mjs +0 -147
- package/assets/docs/tree/component-family.doc.mjs +0 -113
- package/assets/docs/tree/component-imports.doc.mjs +0 -69
- package/assets/docs/tree/component-lookups.doc.mjs +0 -149
- package/assets/docs/tree/components.doc.mjs +0 -23
- package/assets/docs/tree/configuration.doc.mjs +0 -23
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +0 -182
- package/assets/docs/tree/define-the-theme.doc.mjs +0 -118
- package/assets/docs/tree/describe-the-component.doc.mjs +0 -57
- package/assets/docs/tree/docs.doc.mjs +0 -21
- package/assets/docs/tree/document-the-template.doc.mjs +0 -28
- package/assets/docs/tree/document-the-theme.doc.mjs +0 -68
- package/assets/docs/tree/export-template-assets.doc.mjs +0 -147
- package/assets/docs/tree/extend-or-replace.doc.mjs +0 -103
- package/assets/docs/tree/fonts-and-assets.doc.mjs +0 -106
- package/assets/docs/tree/generate-a-palette.doc.mjs +0 -66
- package/assets/docs/tree/grade-template-with-agent.doc.mjs +0 -105
- package/assets/docs/tree/help.doc.mjs +0 -16
- package/assets/docs/tree/links.doc.mjs +0 -98
- package/assets/docs/tree/package-and-test.doc.mjs +0 -32
- package/assets/docs/tree/page-template.doc.mjs +0 -71
- package/assets/docs/tree/publishing.doc.mjs +0 -111
- package/assets/docs/tree/quick-start.doc.mjs +0 -272
- package/assets/docs/tree/replace-a-core-component.doc.mjs +0 -104
- package/assets/docs/tree/replace-a-core-template.doc.mjs +0 -172
- package/assets/docs/tree/sections-and-placement.doc.mjs +0 -108
- package/assets/docs/tree/see-it-in-an-app.doc.mjs +0 -59
- package/assets/docs/tree/ship.doc.mjs +0 -16
- package/assets/docs/tree/short-and-findable.doc.mjs +0 -108
- package/assets/docs/tree/single-component.doc.mjs +0 -165
- package/assets/docs/tree/start-a-template.doc.mjs +0 -143
- package/assets/docs/tree/subcomponent.doc.mjs +0 -115
- package/assets/docs/tree/template-assets.doc.mjs +0 -64
- package/assets/docs/tree/template-doc-overview.doc.mjs +0 -109
- package/assets/docs/tree/template-fonts.doc.mjs +0 -102
- package/assets/docs/tree/template-grading-rubric.doc.mjs +0 -452
- package/assets/docs/tree/template-icons.doc.mjs +0 -97
- package/assets/docs/tree/template-images-media.doc.mjs +0 -127
- package/assets/docs/tree/template-styles.doc.mjs +0 -93
- package/assets/docs/tree/templates.doc.mjs +0 -34
- package/assets/docs/tree/test-in-an-app.doc.mjs +0 -115
- package/assets/docs/tree/test-template-in-app.doc.mjs +0 -128
- package/assets/docs/tree/themes.doc.mjs +0 -39
- package/assets/docs/tree/troubleshooting.doc.mjs +0 -149
- package/assets/docs/tree/upgrading.doc.mjs +0 -103
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +0 -51
- package/assets/docs/tree/verify-packed-template.doc.mjs +0 -77
- package/assets/docs/tree/versioning.doc.mjs +0 -161
- package/assets/docs/tree/write-good-templates.doc.mjs +0 -64
- package/assets/docs/tree/write-the-template-file.doc.mjs +0 -154
- package/authoring/discover/discover.doc.d.mts +0 -13
- package/authoring/discover/discover.doc.mjs +0 -138
- package/authoring/discover/parse.d.mts +0 -24
- package/authoring/discover/parse.mjs +0 -128
- package/authoring/discover/parse.test.mjs +0 -124
- package/authoring/discover/type.ts +0 -87
- package/clients/cli/commands/component-batch.test.mjs +0 -341
- package/clients/cli/commands/discover.sources.test.mjs +0 -267
- package/clients/cli/commands/integration-verify.doc.mjs +0 -22
- package/clients/cli/lib/parse-error-format.test.mjs +0 -81
- package/foundation/response/batch.type.d.mts +0 -33
- package/foundation/response/batch.type.mjs +0 -34
|
@@ -185,7 +185,6 @@ const styles = stylex.create({
|
|
|
185
185
|
],
|
|
186
186
|
},
|
|
187
187
|
{
|
|
188
|
-
id: 'semantic-token-systems',
|
|
189
188
|
title: 'Panda, Chakra, and Other Semantic Token Systems',
|
|
190
189
|
category: 'guide',
|
|
191
190
|
content: [
|
|
@@ -247,7 +246,7 @@ tokens: {
|
|
|
247
246
|
content: [
|
|
248
247
|
{
|
|
249
248
|
type: 'prose',
|
|
250
|
-
text: '
|
|
249
|
+
text: 'MUI expects palette slots such as primary, background, text, and divider. Map those slots to system variables for ordinary component styling. Use raw values only when MUI or your code needs to parse colors for contrast, alpha, lighten, or darken calculations.',
|
|
251
250
|
},
|
|
252
251
|
{
|
|
253
252
|
type: 'code',
|
|
@@ -294,13 +293,12 @@ tokens: {
|
|
|
294
293
|
],
|
|
295
294
|
},
|
|
296
295
|
{
|
|
297
|
-
id: 'css-in-js',
|
|
298
296
|
title: 'Emotion, styled-components, Theme UI, and Styled System',
|
|
299
297
|
category: 'guide',
|
|
300
298
|
content: [
|
|
301
299
|
{
|
|
302
300
|
type: 'prose',
|
|
303
|
-
text: 'Runtime CSS-in-JS libraries
|
|
301
|
+
text: 'Runtime CSS-in-JS libraries usually accept arbitrary theme objects. Keep those objects semantic, but store system CSS variable references as the values. This keeps generated classes stable while the system updates values through the CSS cascade.',
|
|
304
302
|
},
|
|
305
303
|
{
|
|
306
304
|
type: 'code',
|
|
@@ -329,7 +327,6 @@ tokens: {
|
|
|
329
327
|
],
|
|
330
328
|
},
|
|
331
329
|
{
|
|
332
|
-
id: 'unocss',
|
|
333
330
|
title: 'UnoCSS and Custom Utility Systems',
|
|
334
331
|
category: 'guide',
|
|
335
332
|
content: [
|
|
@@ -425,7 +422,6 @@ function RevenueChart({data}: {data: Array<{x: string; y: number}>}) {
|
|
|
425
422
|
],
|
|
426
423
|
},
|
|
427
424
|
{
|
|
428
|
-
id: 'non-css-best-practices',
|
|
429
425
|
title: 'Non-CSS Processing Best Practices',
|
|
430
426
|
category: 'guide',
|
|
431
427
|
content: [
|
|
@@ -8,7 +8,6 @@ export const docs = {
|
|
|
8
8
|
category: 'guide',
|
|
9
9
|
description:
|
|
10
10
|
'How to customize component appearance: xstyle prop, Tailwind, StyleX, className, rest props, compound component patterns, theming hooks, and styling-library interop.',
|
|
11
|
-
keywords: ['override', 'customize', 'css'],
|
|
12
11
|
|
|
13
12
|
sections: [
|
|
14
13
|
{
|
|
@@ -17,7 +16,7 @@ export const docs = {
|
|
|
17
16
|
content: [
|
|
18
17
|
{
|
|
19
18
|
type: 'prose',
|
|
20
|
-
text: '
|
|
19
|
+
text: 'There are several ways to style things. Here is when to use each:',
|
|
21
20
|
},
|
|
22
21
|
{
|
|
23
22
|
type: 'table',
|
|
@@ -31,7 +30,7 @@ export const docs = {
|
|
|
31
30
|
},
|
|
32
31
|
{
|
|
33
32
|
type: 'prose',
|
|
34
|
-
text: '
|
|
33
|
+
text: 'All approaches resolve to the same design tokens, so theming and dark mode work regardless of which you choose. For external styling libraries, run {@link generic:styling-libraries}; it covers Tailwind, StyleX, Panda, Chakra, MUI, CSS-in-JS, CSS Modules, Sass, and `useTheme()` for non-CSS processing.',
|
|
35
34
|
},
|
|
36
35
|
],
|
|
37
36
|
},
|
|
@@ -41,7 +40,7 @@ export const docs = {
|
|
|
41
40
|
content: [
|
|
42
41
|
{
|
|
43
42
|
type: 'prose',
|
|
44
|
-
text: 'Every component accepts an
|
|
43
|
+
text: 'Every component accepts an xstyle prop for style customization. It accepts StyleX styles created via stylex.create(), not inline objects or class name strings. StyleX styles are compiled at build time for optimal deduplication and dead-code elimination.',
|
|
45
44
|
},
|
|
46
45
|
{
|
|
47
46
|
type: 'code',
|
|
@@ -95,14 +94,24 @@ const overrides = stylex.create({
|
|
|
95
94
|
text: 'The package ships a Tailwind v4 theme bridge that maps all design tokens to Tailwind utility classes. Import it once and use Tailwind classes backed by design tokens: colors, spacing, radius, shadows, and typography all resolve to the active theme.',
|
|
96
95
|
},
|
|
97
96
|
{
|
|
98
|
-
type: '
|
|
99
|
-
|
|
97
|
+
type: 'code',
|
|
98
|
+
lang: 'css',
|
|
99
|
+
label: 'globals.css: import the bridge',
|
|
100
|
+
code: `@layer reset, theme, base, astryx-base, astryx-theme, components, utilities;
|
|
101
|
+
|
|
102
|
+
@import "tailwindcss/theme.css" layer(theme);
|
|
103
|
+
@import "tailwindcss/preflight.css" layer(base);
|
|
104
|
+
@import "@astryxdesign/core/reset.css";
|
|
105
|
+
@import "@astryxdesign/core/astryx.css";
|
|
106
|
+
@import "@astryxdesign/theme-neutral/theme.css";
|
|
107
|
+
@import "@astryxdesign/core/tailwind-theme.css";
|
|
108
|
+
@import "tailwindcss/utilities.css" layer(utilities);`,
|
|
100
109
|
},
|
|
101
110
|
{
|
|
102
111
|
type: 'code',
|
|
103
112
|
lang: 'tsx',
|
|
104
113
|
label: 'Tailwind utilities alongside components',
|
|
105
|
-
code: `<div className="text-primary bg-surface rounded-
|
|
114
|
+
code: `<div className="text-primary bg-surface rounded-container p-4 flex gap-3">
|
|
106
115
|
<Button label="Save" variant="primary" />
|
|
107
116
|
<Button label="Cancel" variant="secondary" />
|
|
108
117
|
</div>`,
|
|
@@ -119,7 +128,7 @@ const overrides = stylex.create({
|
|
|
119
128
|
content: [
|
|
120
129
|
{
|
|
121
130
|
type: 'prose',
|
|
122
|
-
text: 'Every component also accepts standard
|
|
131
|
+
text: 'Every component also accepts standard className and style props. className is appended after the component\'s own classes. style is merged after StyleX inline styles, so consumer values win on conflict.',
|
|
123
132
|
},
|
|
124
133
|
{
|
|
125
134
|
type: 'code',
|
|
@@ -217,10 +226,7 @@ const overrides = stylex.create({
|
|
|
217
226
|
],
|
|
218
227
|
},
|
|
219
228
|
{
|
|
220
|
-
|
|
221
|
-
// preferred-selector-surface-data-attributes` keeps working.
|
|
222
|
-
id: 'preferred-selector-surface-data-attributes',
|
|
223
|
-
title: 'Data attribute selectors',
|
|
229
|
+
title: 'Preferred Selector Surface: Data Attributes',
|
|
224
230
|
category: 'guide',
|
|
225
231
|
content: [
|
|
226
232
|
{
|
|
@@ -262,13 +268,12 @@ const overrides = stylex.create({
|
|
|
262
268
|
],
|
|
263
269
|
},
|
|
264
270
|
{
|
|
265
|
-
id: 'deprecated-classes',
|
|
266
271
|
title: 'Deprecated: Bare Prop and State Classes',
|
|
267
272
|
category: 'guide',
|
|
268
273
|
content: [
|
|
269
274
|
{
|
|
270
275
|
type: 'prose',
|
|
271
|
-
text: 'Astryx
|
|
276
|
+
text: 'Astryx continues to emit deprecated bare prop/state classes such as `.primary`, `.sm`, `.level-2`, and `.checked` through the 0.7.0 removal window. Prefer the explicit reflected data attributes for new CSS, and run `astryx upgrade --apply` before 0.7.0 to parse `.css` files and rewrite selectors qualified by a known Astryx target when the 0.5.4 target/value pair has one or more known meanings. Declarations, comments, JavaScript/TypeScript strings, and unqualified classes are never rewritten. Stable base target classes (`.astryx-button`, `.astryx-card`, etc.) remain unchanged.',
|
|
272
277
|
},
|
|
273
278
|
{
|
|
274
279
|
type: 'code',
|
|
@@ -285,7 +290,7 @@ const overrides = stylex.create({
|
|
|
285
290
|
},
|
|
286
291
|
{
|
|
287
292
|
type: 'prose',
|
|
288
|
-
text: '
|
|
293
|
+
text: 'Each known old value becomes a specificity-preserving `:is(...)` union containing the original class arm plus every v0.5.4 data-attribute arm. Both arms match Astryx output during the deprecation window; the data-attribute arm continues matching after the bare compatibility classes are eligible for removal in 0.7.0. The class arm also preserves consumer-supplied `className` matches. Narrow the union later only when class provenance or prop-axis intent is known. Custom/unknown qualified classes and unqualified classes stay unchanged. Search for unqualified old values such as `.primary` or `.sm` and migrate only confirmed Astryx uses manually. Migrate selectors embedded in JavaScript or TypeScript manually with the same rules.',
|
|
289
294
|
},
|
|
290
295
|
],
|
|
291
296
|
},
|
|
@@ -338,7 +343,6 @@ const styles = stylex.create({
|
|
|
338
343
|
],
|
|
339
344
|
},
|
|
340
345
|
{
|
|
341
|
-
id: 'stylex-setup',
|
|
342
346
|
title: 'StyleX Build Setup (required for swizzled components)',
|
|
343
347
|
category: 'guide',
|
|
344
348
|
content: [
|
|
@@ -358,11 +362,11 @@ const styles = stylex.create({
|
|
|
358
362
|
},
|
|
359
363
|
{
|
|
360
364
|
type: 'prose',
|
|
361
|
-
text: 'Next.js (App Router) is the sharp edge. StyleX\'s canonical compiler is a Babel plugin, but introducing a Babel config in Next.js disables the SWC compiler,
|
|
365
|
+
text: 'Next.js (App Router) is the sharp edge. StyleX\'s canonical compiler is a Babel plugin, but introducing a Babel config in Next.js disables the SWC compiler, which in turn breaks SWC-dependent features like `next/font`. So the "obvious" Babel setup is actively incompatible with a standard Next 15 App Router app.',
|
|
362
366
|
},
|
|
363
367
|
{
|
|
364
368
|
type: 'prose',
|
|
365
|
-
text: 'The
|
|
369
|
+
text: 'The working path on Next.js is an SWC-based StyleX transform (e.g. the community `@stylexswc/nextjs-plugin`) wired into `next.config`, which keeps SWC and `next/font` intact. See the example app `apps/example-nextjs-stylex` in the repo for a complete, working Next.js + StyleX + SWC configuration.',
|
|
366
370
|
},
|
|
367
371
|
{
|
|
368
372
|
type: 'code',
|
|
@@ -385,7 +389,7 @@ export default stylexPlugin({
|
|
|
385
389
|
style: 'unordered',
|
|
386
390
|
items: [
|
|
387
391
|
'Symptom of a missing compiler: swizzled component renders with no styles, but no build or runtime error.',
|
|
388
|
-
'
|
|
392
|
+
'Do NOT add @stylexjs/babel-plugin to a Next.js App Router app; it disables SWC and breaks next/font.',
|
|
389
393
|
'Pure theming (defineTheme + astryx theme build) needs NO StyleX compiler; only swizzled/authored StyleX source does.',
|
|
390
394
|
],
|
|
391
395
|
},
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
/** @type {import('@astryxdesign/cli/authoring').ReferenceTranslationDoc} */
|
|
4
4
|
|
|
5
5
|
export const docsDense = {
|
|
6
|
-
description:
|
|
7
|
-
'Theme provider, custom themes, theme build (prod/SSR), light/dark, component overrides',
|
|
6
|
+
description: 'Theme provider, custom themes, light/dark, component overrides',
|
|
8
7
|
sections: [
|
|
9
8
|
{
|
|
10
|
-
section: '
|
|
11
|
-
title: '
|
|
9
|
+
section: 'Quick Start',
|
|
10
|
+
title: 'Quick Start',
|
|
12
11
|
content: [
|
|
13
12
|
null,
|
|
14
13
|
null,
|
|
@@ -32,18 +31,9 @@ export const docsDense = {
|
|
|
32
31
|
},
|
|
33
32
|
],
|
|
34
33
|
},
|
|
34
|
+
{section: 'Theme Props', title: 'Props', content: [null]},
|
|
35
35
|
{
|
|
36
|
-
section: 'Theme
|
|
37
|
-
title: 'Props',
|
|
38
|
-
content: [
|
|
39
|
-
{
|
|
40
|
-
type: 'prose',
|
|
41
|
-
text: "<Theme> props: theme (required), mode ('system' default, or 'light'/'dark'), children. every prop: astryx component Theme.",
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
section: 'Custom themes',
|
|
36
|
+
section: 'Creating a Custom Theme',
|
|
47
37
|
title: 'Custom Theme',
|
|
48
38
|
content: [
|
|
49
39
|
{
|
|
@@ -75,36 +65,10 @@ export const docsDense = {
|
|
|
75
65
|
content: [
|
|
76
66
|
{
|
|
77
67
|
type: 'prose',
|
|
78
|
-
text: 'adaptations = ordered {when,value} rules over width/pointer/contrast/motion. condition fields AND. rules can write typography/color/radius/motion/tokens/localTokens/components.',
|
|
68
|
+
text: 'adaptations = ordered {when,value} rules over width/pointer/contrast/motion. widthBreakpoints fixed sm|md|lg|xl|2xl defaults 640|768|1024|1280|1536; map alone emits no CSS. width.from inclusive, width.below exclusive; condition fields AND. root first, then matching rules in authored order (later writes win), then onDark/onLight. rules can write typography/color/radius/motion/tokens/localTokens/components; local names belong on root. Component writes validate exactly like root components (same targets/axes/domains); only difference: a rule cannot be the sole enroller of a custom value (type augmentation is unconditional) — declare it on root, then restyle. Built-ins need no root declaration. Co-matching token/localToken writes are validated together; any reachable var() cycle fails. extends inherits breakpoints + ordered rules, appends child rules, re-resolves against child axes. CSS-only; use built themes for SSR first paint.',
|
|
79
69
|
},
|
|
80
70
|
null,
|
|
81
71
|
null,
|
|
82
|
-
{
|
|
83
|
-
type: 'prose',
|
|
84
|
-
text: 'widthBreakpoints fixed sm|md|lg|xl|2xl defaults 640|768|1024|1280|1536; map alone emits no CSS. width.from inclusive, width.below exclusive. order + validation: see Adaptation Rules.',
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
section: 'Adaptation order and validation',
|
|
90
|
-
title: 'Adaptation Rules',
|
|
91
|
-
content: [
|
|
92
|
-
{
|
|
93
|
-
type: 'prose',
|
|
94
|
-
text: 'root first, then matching rules in authored order (later writes win), then onDark/onLight on the same leaf.',
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
type: 'prose',
|
|
98
|
-
text: 'extends inherits breakpoints + ordered rules, appends child rules, re-resolves against child axes. an empty child rule is a no-op, not a removal.',
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
type: 'prose',
|
|
102
|
-
text: 'local names belong on root. Component writes validate exactly like root components (same targets/axes/domains); only difference: a rule cannot be the sole enroller of a custom value (type augmentation is unconditional) — declare it on root, then restyle. Built-ins need no root declaration. Co-matching token/localToken writes are validated together; any reachable var() cycle fails.',
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
type: 'prose',
|
|
106
|
-
text: 'CSS-only (media queries, no resize listener); use built themes for SSR first paint.',
|
|
107
|
-
},
|
|
108
72
|
],
|
|
109
73
|
},
|
|
110
74
|
{
|
|
@@ -113,7 +77,7 @@ export const docsDense = {
|
|
|
113
77
|
content: [
|
|
114
78
|
{
|
|
115
79
|
type: 'prose',
|
|
116
|
-
text: 'components field uses semantic component keys + style keys (base, variant:value, stateName), not raw selectors. for external CSS, prefer data-* selectors
|
|
80
|
+
text: 'components field uses semantic component keys + style keys (base, variant:value, stateName), not raw selectors. for external CSS, prefer data-* selectors from `astryx docs styling`. write standard CSS (borderRadius, padding) — pipeline expands to internal vars. public vars (--button-focus-offset etc) set directly. private vars (--_*) cannot be set — use CSS properties. run `astryx theme targets [Name]` to enumerate every themeable key (--json for lint), `astryx component <Name>` for one component.',
|
|
117
81
|
},
|
|
118
82
|
null,
|
|
119
83
|
null,
|
|
@@ -136,19 +100,16 @@ export const docsDense = {
|
|
|
136
100
|
],
|
|
137
101
|
},
|
|
138
102
|
{
|
|
139
|
-
section: '
|
|
103
|
+
section: 'Building Themes for Production',
|
|
140
104
|
title: 'Build for Production',
|
|
141
105
|
content: [
|
|
142
106
|
{
|
|
143
107
|
type: 'prose',
|
|
144
108
|
text: 'astryx theme build compiles defineTheme to static CSS. outputs .css + .js (__built:true) + .d.ts.',
|
|
145
109
|
},
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
section: 'Built themes with an icon registry',
|
|
150
|
-
title: 'Icon Registry',
|
|
151
|
-
content: [
|
|
110
|
+
null,
|
|
111
|
+
null,
|
|
112
|
+
null,
|
|
152
113
|
{
|
|
153
114
|
type: 'prose',
|
|
154
115
|
text: 'current build detects named imports used by icons:. registry module is not compiled. inline/local registries accepted by defineTheme are omitted from built output; move them to a separate module and import by name.',
|
|
@@ -162,6 +123,9 @@ export const docsDense = {
|
|
|
162
123
|
type: 'prose',
|
|
163
124
|
text: 'without --icons-specifier, source import is copied unchanged. default flow without --out: bundlers can resolve ./icons to neighboring icons.tsx; Node ESM fails with ERR_MODULE_NOT_FOUND. moving output changes relative import resolution.',
|
|
164
125
|
},
|
|
126
|
+
null,
|
|
127
|
+
null,
|
|
128
|
+
null,
|
|
165
129
|
],
|
|
166
130
|
},
|
|
167
131
|
{
|
|
@@ -190,8 +154,8 @@ export const docsDense = {
|
|
|
190
154
|
],
|
|
191
155
|
},
|
|
192
156
|
{
|
|
193
|
-
section: 'Dark
|
|
194
|
-
title: 'Dark
|
|
157
|
+
section: 'Light/Dark Mode',
|
|
158
|
+
title: 'Light/Dark',
|
|
195
159
|
content: [
|
|
196
160
|
{
|
|
197
161
|
type: 'prose',
|
|
@@ -202,7 +166,7 @@ export const docsDense = {
|
|
|
202
166
|
],
|
|
203
167
|
},
|
|
204
168
|
{
|
|
205
|
-
section: '
|
|
169
|
+
section: 'Nesting Themes',
|
|
206
170
|
title: 'Nesting',
|
|
207
171
|
content: [
|
|
208
172
|
{type: 'prose', text: 'wrap sections in separate <Theme> providers'},
|
|
@@ -214,11 +178,7 @@ export const docsDense = {
|
|
|
214
178
|
title: 'useTheme',
|
|
215
179
|
content: [
|
|
216
180
|
null,
|
|
217
|
-
|
|
218
|
-
{
|
|
219
|
-
type: 'prose',
|
|
220
|
-
text: 'read-only. ordinary styling: CSS vars, StyleX tokens, xstyle, className. to change theme/mode, manage state at app level and pass it to <Theme>.',
|
|
221
|
-
},
|
|
181
|
+
{type: 'prose', text: 'read-only. manage state at app level.'},
|
|
222
182
|
],
|
|
223
183
|
},
|
|
224
184
|
],
|
|
@@ -11,8 +11,7 @@ export const docs = {
|
|
|
11
11
|
|
|
12
12
|
sections: [
|
|
13
13
|
{
|
|
14
|
-
|
|
15
|
-
title: 'Wrap your app in a theme',
|
|
14
|
+
title: 'Quick Start',
|
|
16
15
|
category: 'guide',
|
|
17
16
|
content: [
|
|
18
17
|
{
|
|
@@ -97,7 +96,7 @@ function App() {
|
|
|
97
96
|
[
|
|
98
97
|
'Matcha',
|
|
99
98
|
"import {matchaTheme} from '@astryxdesign/theme-matcha'",
|
|
100
|
-
'Earthy
|
|
99
|
+
'Earthy green theme with Figtree typography.',
|
|
101
100
|
],
|
|
102
101
|
[
|
|
103
102
|
'Stone',
|
|
@@ -122,13 +121,22 @@ function App() {
|
|
|
122
121
|
category: 'guide',
|
|
123
122
|
content: [
|
|
124
123
|
{
|
|
125
|
-
type: '
|
|
126
|
-
|
|
124
|
+
type: 'table',
|
|
125
|
+
headers: ['Prop', 'Type', 'Default', 'Description'],
|
|
126
|
+
rows: [
|
|
127
|
+
['theme', 'DefinedTheme', '-', 'Theme object (required)'],
|
|
128
|
+
[
|
|
129
|
+
'mode',
|
|
130
|
+
"'system' | 'light' | 'dark'",
|
|
131
|
+
"'system'",
|
|
132
|
+
'Color mode. system follows OS preference.',
|
|
133
|
+
],
|
|
134
|
+
['children', 'ReactNode', '-', 'App content'],
|
|
135
|
+
],
|
|
127
136
|
},
|
|
128
137
|
],
|
|
129
138
|
},
|
|
130
139
|
{
|
|
131
|
-
id: 'integration-themes',
|
|
132
140
|
title: 'Using a Theme from an Integration',
|
|
133
141
|
category: 'guide',
|
|
134
142
|
content: [
|
|
@@ -149,8 +157,7 @@ function App() {
|
|
|
149
157
|
],
|
|
150
158
|
},
|
|
151
159
|
{
|
|
152
|
-
|
|
153
|
-
title: 'Custom themes',
|
|
160
|
+
title: 'Creating a Custom Theme',
|
|
154
161
|
category: 'guide',
|
|
155
162
|
content: [
|
|
156
163
|
{
|
|
@@ -358,18 +365,11 @@ const brandTheme = defineTheme({
|
|
|
358
365
|
},
|
|
359
366
|
{
|
|
360
367
|
type: 'prose',
|
|
361
|
-
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.
|
|
368
|
+
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.',
|
|
362
369
|
},
|
|
363
|
-
],
|
|
364
|
-
},
|
|
365
|
-
{
|
|
366
|
-
id: 'adaptation-rules',
|
|
367
|
-
title: 'Adaptation order and validation',
|
|
368
|
-
category: 'guide',
|
|
369
|
-
content: [
|
|
370
370
|
{
|
|
371
371
|
type: 'prose',
|
|
372
|
-
text: 'Precedence follows rule order
|
|
372
|
+
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.',
|
|
373
373
|
},
|
|
374
374
|
{
|
|
375
375
|
type: 'prose',
|
|
@@ -464,7 +464,7 @@ const brandTheme = defineTheme({
|
|
|
464
464
|
banner: {
|
|
465
465
|
// Any extensible prop axis works — not just variant
|
|
466
466
|
'status:neutral': {
|
|
467
|
-
backgroundColor: 'var(--color-
|
|
467
|
+
backgroundColor: 'var(--color-muted)',
|
|
468
468
|
color: 'var(--color-text-secondary)',
|
|
469
469
|
},
|
|
470
470
|
},
|
|
@@ -489,8 +489,7 @@ const brandTheme = defineTheme({
|
|
|
489
489
|
],
|
|
490
490
|
},
|
|
491
491
|
{
|
|
492
|
-
|
|
493
|
-
title: 'Build a theme',
|
|
492
|
+
title: 'Building Themes for Production',
|
|
494
493
|
category: 'guide',
|
|
495
494
|
content: [
|
|
496
495
|
{
|
|
@@ -517,7 +516,7 @@ const brandTheme = defineTheme({
|
|
|
517
516
|
],
|
|
518
517
|
[
|
|
519
518
|
'ocean.js',
|
|
520
|
-
'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
|
|
519
|
+
'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 the limitations below).',
|
|
521
520
|
],
|
|
522
521
|
[
|
|
523
522
|
'ocean.d.ts',
|
|
@@ -529,36 +528,6 @@ const brandTheme = defineTheme({
|
|
|
529
528
|
],
|
|
530
529
|
],
|
|
531
530
|
},
|
|
532
|
-
{
|
|
533
|
-
type: 'prose',
|
|
534
|
-
text: 'The `__built: true` flag tells Theme to skip runtime `<style>` injection; the CSS file handles it.',
|
|
535
|
-
},
|
|
536
|
-
{
|
|
537
|
-
type: 'prose',
|
|
538
|
-
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.',
|
|
539
|
-
},
|
|
540
|
-
{
|
|
541
|
-
type: 'code',
|
|
542
|
-
lang: 'tsx',
|
|
543
|
-
label: 'Using a custom built theme',
|
|
544
|
-
code: `import {oceanTheme} from './themes/ocean';
|
|
545
|
-
import './themes/ocean.css';
|
|
546
|
-
|
|
547
|
-
<Theme theme={oceanTheme}>
|
|
548
|
-
<App />
|
|
549
|
-
</Theme>`,
|
|
550
|
-
},
|
|
551
|
-
{
|
|
552
|
-
type: 'prose',
|
|
553
|
-
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.",
|
|
554
|
-
},
|
|
555
|
-
],
|
|
556
|
-
},
|
|
557
|
-
{
|
|
558
|
-
id: 'icon-registry',
|
|
559
|
-
title: 'Built themes with an icon registry',
|
|
560
|
-
category: 'guide',
|
|
561
|
-
content: [
|
|
562
531
|
{
|
|
563
532
|
type: 'prose',
|
|
564
533
|
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:",
|
|
@@ -582,6 +551,29 @@ esbuild src/themes/icons.tsx --bundle --format=esm --outfile=dist/icons.mjs \\
|
|
|
582
551
|
type: 'prose',
|
|
583
552
|
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.',
|
|
584
553
|
},
|
|
554
|
+
{
|
|
555
|
+
type: 'prose',
|
|
556
|
+
text: 'The `__built: true` flag tells Theme to skip runtime `<style>` injection; the CSS file handles it.',
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
type: 'prose',
|
|
560
|
+
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.',
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
type: 'code',
|
|
564
|
+
lang: 'tsx',
|
|
565
|
+
label: 'Using a custom built theme',
|
|
566
|
+
code: `import {oceanTheme} from './themes/ocean';
|
|
567
|
+
import './themes/ocean.css';
|
|
568
|
+
|
|
569
|
+
<Theme theme={oceanTheme}>
|
|
570
|
+
<App />
|
|
571
|
+
</Theme>`,
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
type: 'prose',
|
|
575
|
+
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.",
|
|
576
|
+
},
|
|
585
577
|
],
|
|
586
578
|
},
|
|
587
579
|
{
|
|
@@ -685,8 +677,7 @@ esbuild src/themes/icons.tsx --bundle --format=esm --outfile=dist/icons.mjs \\
|
|
|
685
677
|
],
|
|
686
678
|
},
|
|
687
679
|
{
|
|
688
|
-
|
|
689
|
-
title: 'Dark mode',
|
|
680
|
+
title: 'Light/Dark Mode',
|
|
690
681
|
category: 'guide',
|
|
691
682
|
content: [
|
|
692
683
|
{
|
|
@@ -715,13 +706,12 @@ esbuild src/themes/icons.tsx --bundle --format=esm --outfile=dist/icons.mjs \\
|
|
|
715
706
|
],
|
|
716
707
|
},
|
|
717
708
|
{
|
|
718
|
-
|
|
719
|
-
title: 'Nested themes',
|
|
709
|
+
title: 'Nesting Themes',
|
|
720
710
|
category: 'guide',
|
|
721
711
|
content: [
|
|
722
712
|
{
|
|
723
713
|
type: 'prose',
|
|
724
|
-
text: 'Wrap different sections in separate `<Theme>` providers.',
|
|
714
|
+
text: 'Wrap different sections in separate [`<Theme>`](/components/Theme) providers.',
|
|
725
715
|
},
|
|
726
716
|
{
|
|
727
717
|
type: 'code',
|
|
@@ -3,18 +3,17 @@
|
|
|
3
3
|
/** @type {import('@astryxdesign/cli/authoring').ReferenceTranslationDoc} */
|
|
4
4
|
|
|
5
5
|
export const docsZh = {
|
|
6
|
-
description: 'Theme
|
|
6
|
+
description: 'Theme 提供者、自定义主题、亮/暗模式和组件样式覆盖。',
|
|
7
7
|
sections: [
|
|
8
|
-
{ section: '
|
|
8
|
+
{ section: 'Quick Start', title: '快速开始', content: [null, null, null, null, { type: 'prose', text: '默认导入使用运行时样式注入。/built 导入使用预编译 CSS(需配合 theme.css)。' }] },
|
|
9
9
|
{ section: 'Available Themes', title: '可用主题', content: [null, null, { type: 'prose', text: '已发布主题:neutral(推荐起点)、butter、chocolate、gothic(仅暗色)、matcha、stone、y2k。@astryxdesign/theme-{name} = 源码版(运行时注入)。@astryxdesign/theme-{name}/built = 优化版(配合 theme.css)。' }] },
|
|
10
|
-
{ section: 'Theme Props', title: 'Theme 属性', content: [
|
|
11
|
-
{ section: 'Custom
|
|
10
|
+
{ section: 'Theme Props', title: 'Theme 属性', content: [null] },
|
|
11
|
+
{ section: 'Creating a Custom Theme', title: '创建自定义主题', content: [{ type: 'prose', text: '用 `theme list` + `theme add <slug>` 从内置主题或已安装集成提供的主题开始;重名时传 `--package`。也可以用 defineTheme 从零编写。只覆盖与默认值不同的令牌。' }, null, { type: 'prose', text: '`astryx theme template` 会写入 theme.template.ts:带注释的完整参考,涵盖每个 defineTheme 字段、令牌族和覆盖语法,并标明打印各自参考的 CLI 命令。' }] },
|
|
12
12
|
{ section: 'defineTheme', title: 'defineTheme', content: [{ type: 'prose', text: '支持比例配置(color、typography、radius、motion)+ 显式令牌覆盖 + 组件覆盖。color 通过 HCT 从 accent 派生完整调色板;accent 接受单个十六进制值或 [light, dark] 元组(每个模式使用各自的种子色)。tokens 覆盖按令牌逐个生效;--color-on-accent 始终由 color.accent 计算得出,因此优先使用元组 accent 而不是覆盖 --color-accent。' }, null, null] },
|
|
13
|
-
{ section: '
|
|
14
|
-
{ section: 'Built themes with an icon registry', title: '带图标注册表的构建主题', content: [{ type: 'prose', text: '当前 theme build 仅在检测到 icons: 字段使用的具名导入时,才在生成的模块中导入图标注册表;它不会编译注册表模块。defineTheme 在运行时接受的内联注册表(包括本地常量)目前会在构建产物中被省略。使用此构建流程时,请把注册表移到独立模块并使用具名导入。以下示例适用于使用 React 和 lucide-react 的注册表。' }, null, { type: 'prose', text: '上例中生成的主题从 dist 导入 ./icons.mjs。如果跳过第二条命令,theme build 仍可能成功,但加载或打包生成的模块都会因缺少 dist/icons.mjs 而失败。--icons-specifier 只更改生成的导入,不会创建或验证目标文件。路径应相对于生成的 JS 文件可解析。将 react 和图标库标记为 external,避免在注册表中重复打包这些依赖。' }, { type: 'prose', text: '不传 --icons-specifier 时,会原样保留检测到的源码导入路径。默认不传 --out 时,打包器可以把无扩展名的 ./icons 解析为旁边的 icons.tsx;Node ESM 不执行这种查找,会报 ERR_MODULE_NOT_FOUND。用 --out 移动输出位置也会改变相对导入的解析位置;使用打包器并不意味着它能自动找到原来的源码。' }] },
|
|
13
|
+
{ section: 'Building Themes for Production', title: '生产构建', content: [{ type: 'prose', text: 'astryx theme build 将 defineTheme 编译为静态 CSS。输出 .css + .js(__built:true)+ .d.ts。' }, null, null, null, { type: 'prose', text: '当前 theme build 仅在检测到 icons: 字段使用的具名导入时,才在生成的模块中导入图标注册表;它不会编译注册表模块。defineTheme 在运行时接受的内联注册表(包括本地常量)目前会在构建产物中被省略。使用此构建流程时,请把注册表移到独立模块并使用具名导入。以下示例适用于使用 React 和 lucide-react 的注册表。' }, null, { type: 'prose', text: '上例中生成的主题从 dist 导入 ./icons.mjs。如果跳过第二条命令,theme build 仍可能成功,但加载或打包生成的模块都会因缺少 dist/icons.mjs 而失败。--icons-specifier 只更改生成的导入,不会创建或验证目标文件。路径应相对于生成的 JS 文件可解析。将 react 和图标库标记为 external,避免在注册表中重复打包这些依赖。' }, { type: 'prose', text: '不传 --icons-specifier 时,会原样保留检测到的源码导入路径。默认不传 --out 时,打包器可以把无扩展名的 ./icons 解析为旁边的 icons.tsx;Node ESM 不执行这种查找,会报 ERR_MODULE_NOT_FOUND。用 --out 移动输出位置也会改变相对导入的解析位置;使用打包器并不意味着它能自动找到原来的源码。' }, null, null, null] },
|
|
15
14
|
{ section: 'Runtime vs Built Themes', title: '运行时 vs 构建', content: [{ type: 'prose', text: '运行时:useInsertionEffect 在客户端注入样式。构建:静态 CSS 在首次渲染时就存在。SSR 应用请使用 /built + theme.css。' }, null, null, null] },
|
|
16
|
-
{ section: 'Dark
|
|
17
|
-
{ section: '
|
|
18
|
-
{ section: 'useTheme Hook', title: 'useTheme 钩子', content: [null,
|
|
15
|
+
{ section: 'Light/Dark Mode', title: '亮/暗模式', content: [{ type: 'prose', text: "令牌值使用 [light, dark] 元组实现自动模式切换。Theme 上 mode='system'(默认)跟随系统偏好。" }, null, null] },
|
|
16
|
+
{ section: 'Nesting Themes', title: '嵌套主题', content: [{ type: 'prose', text: '将不同部分包裹在独立的 <Theme> 提供者中。' }, null] },
|
|
17
|
+
{ section: 'useTheme Hook', title: 'useTheme 钩子', content: [null, { type: 'prose', text: '这是只读的。要更改主题/模式,在应用层管理状态并传递给 <Theme>。' }] },
|
|
19
18
|
],
|
|
20
19
|
};
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
/** @type {import('@astryxdesign/cli/authoring').ReferenceTranslationDoc} */
|
|
4
4
|
|
|
5
5
|
export const docsDense = {
|
|
6
|
-
description: '
|
|
6
|
+
description: 'spacing/color/radius/type/shadow token ref',
|
|
7
7
|
sections: [
|
|
8
8
|
{ section: 'Color Tokens', title: 'Color', content: [{ type: 'prose', text: 'semantic colors, support light-dark() auto switching.' }, null, null, null] },
|
|
9
|
-
{ section: 'Spacing Tokens', title: 'Spacing', content: [{ type: 'prose', text: '
|
|
9
|
+
{ section: 'Spacing Tokens', title: 'Spacing', content: [{ type: 'prose', text: 'defined in tokens.stylex.ts. gap props use space0-space12.' }, null] },
|
|
10
10
|
{ section: 'Size Tokens', title: 'Size', content: [{ type: 'prose', text: 'control heights for buttons/inputs/selectors.' }, null] },
|
|
11
11
|
{ section: 'Radius Tokens', title: 'Radius', content: [null] },
|
|
12
12
|
{ section: 'Shadow Tokens', title: 'Elevation', content: [null] },
|