@astryxdesign/cli 0.6.4-canary.06c8fa3 → 0.6.4-canary.0e1fbdb
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 +49 -40
- package/api/build/build.doc.mjs +6 -1
- package/api/build/build.test.mjs +22 -0
- package/api/build/kit/kit.mjs +44 -5
- package/api/component/component.doc.mjs +14 -7
- package/api/docs/_adapter.d.mts +8 -3
- package/api/docs/_adapter.mjs +14 -6
- package/api/docs/docOverlays.test.mjs +27 -1
- package/api/docs/docs.doc.mjs +2 -2
- package/api/doctor/doctor.doc.mjs +17 -8
- 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 +19 -10
- package/api/hook/hook.doc.mjs +6 -3
- package/api/index.d.mts +2 -0
- package/api/index.mjs +3 -1
- package/api/init/init.doc.mjs +17 -12
- package/api/integration/add-theme.mjs +22 -1
- package/api/integration/add-theme.test.mjs +34 -0
- package/api/integration/authoring-checks.mjs +2 -2
- package/api/integration/integrationPackCheck.doc.mjs +3 -3
- package/api/integration/pack-check.lifecycle-output.test.mjs +2 -0
- package/api/integration/pack-check.mjs +54 -6
- package/api/integration/pack-check.test.mjs +90 -0
- 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 +27 -1
- package/api/search/search.doc.mjs +2 -2
- package/api/search/search.mjs +228 -16
- package/api/swizzle/swizzle.doc.mjs +7 -5
- package/api/template/copy/copy.mjs +1 -1
- package/api/template/copy/copy.test.mjs +9 -0
- package/api/template/template-integration.test.mjs +65 -1
- package/api/template/template.doc.mjs +2 -1
- package/api/template/template.mjs +1 -1
- package/api/theme/generateTonalPalette.doc.mjs +1 -2
- package/api/theme/listThemes.doc.mjs +1 -1
- package/api/theme/themeAdd.doc.mjs +9 -10
- package/api/theme/themeBuild.doc.mjs +13 -13
- package/api/theme/themeList.doc.mjs +1 -1
- package/api/theme/themeListAvailable.doc.mjs +2 -1
- package/api/theme/themePaletteGenerate.doc.mjs +15 -8
- package/api/theme/themeTargets.doc.mjs +3 -2
- package/api/theme/themeTemplate.doc.mjs +2 -1
- package/api/upgrade/run/run.mjs +1 -1
- package/api/upgrade/upgrade.doc.mjs +24 -22
- package/assets/docs/README.md +4 -2
- package/assets/docs/browser-support.doc.mjs +11 -11
- package/assets/docs/color.doc.mjs +8 -2
- package/assets/docs/elevation.doc.mjs +6 -4
- package/assets/docs/getting-started.doc.mjs +5 -16
- package/assets/docs/icons.doc.mjs +2 -21
- package/assets/docs/illustrations.doc.mjs +7 -15
- package/assets/docs/layout.doc.dense.mjs +130 -82
- package/assets/docs/layout.doc.mjs +133 -77
- package/assets/docs/migration.doc.mjs +19 -21
- package/assets/docs/motion.doc.mjs +16 -3
- package/assets/docs/principles.doc.dense.mjs +5 -5
- package/assets/docs/principles.doc.mjs +8 -0
- package/assets/docs/principles.doc.zh.mjs +6 -6
- package/assets/docs/shape.doc.mjs +8 -3
- package/assets/docs/spacing.doc.mjs +7 -2
- package/assets/docs/styling-libraries.doc.mjs +6 -2
- package/assets/docs/styling.doc.mjs +19 -23
- package/assets/docs/theme.doc.dense.mjs +58 -18
- package/assets/docs/theme.doc.mjs +56 -46
- package/assets/docs/theme.doc.zh.mjs +9 -8
- package/assets/docs/tokens.doc.dense.mjs +2 -2
- package/assets/docs/tokens.doc.mjs +389 -8
- package/assets/docs/tokens.doc.zh.mjs +2 -2
- package/assets/docs/tree/add-a-component.doc.mjs +75 -0
- package/assets/docs/tree/add-a-theme.doc.mjs +85 -0
- package/assets/docs/tree/add-a-topic.doc.mjs +144 -0
- package/assets/docs/tree/agent-guidance.doc.mjs +138 -0
- package/assets/docs/tree/block-template.doc.mjs +130 -0
- package/assets/docs/tree/build-the-template.doc.mjs +28 -0
- package/assets/docs/tree/building-blocks.doc.mjs +46 -0
- package/assets/docs/tree/check-your-docs.doc.mjs +137 -0
- package/assets/docs/tree/checks.doc.mjs +119 -0
- package/assets/docs/tree/codemods.doc.mjs +147 -0
- package/assets/docs/tree/component-family.doc.mjs +113 -0
- package/assets/docs/tree/component-imports.doc.mjs +69 -0
- package/assets/docs/tree/components.doc.mjs +23 -0
- package/assets/docs/tree/configuration.doc.mjs +23 -0
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +182 -0
- package/assets/docs/tree/define-the-theme.doc.mjs +118 -0
- package/assets/docs/tree/describe-the-component.doc.mjs +57 -0
- package/assets/docs/tree/docs.doc.mjs +21 -0
- package/assets/docs/tree/document-the-template.doc.mjs +28 -0
- package/assets/docs/tree/document-the-theme.doc.mjs +68 -0
- package/assets/docs/tree/export-template-assets.doc.mjs +147 -0
- package/assets/docs/tree/extend-or-replace.doc.mjs +103 -0
- package/assets/docs/tree/fonts-and-assets.doc.mjs +106 -0
- package/assets/docs/tree/generate-a-palette.doc.mjs +66 -0
- package/assets/docs/tree/grade-template-with-agent.doc.mjs +105 -0
- package/assets/docs/tree/help.doc.mjs +16 -0
- package/assets/docs/tree/integrations.doc.mjs +25 -470
- package/assets/docs/tree/links.doc.mjs +98 -0
- package/assets/docs/tree/package-and-test.doc.mjs +32 -0
- package/assets/docs/tree/page-template.doc.mjs +71 -0
- package/assets/docs/tree/publishing.doc.mjs +111 -0
- package/assets/docs/tree/quick-start.doc.mjs +272 -0
- package/assets/docs/tree/replace-a-core-component.doc.mjs +104 -0
- package/assets/docs/tree/replace-a-core-template.doc.mjs +172 -0
- package/assets/docs/tree/sections-and-placement.doc.mjs +108 -0
- package/assets/docs/tree/see-it-in-an-app.doc.mjs +59 -0
- package/assets/docs/tree/ship.doc.mjs +16 -0
- package/assets/docs/tree/short-and-findable.doc.mjs +108 -0
- package/assets/docs/tree/single-component.doc.mjs +165 -0
- package/assets/docs/tree/start-a-template.doc.mjs +143 -0
- package/assets/docs/tree/subcomponent.doc.mjs +115 -0
- package/assets/docs/tree/template-assets.doc.mjs +64 -0
- package/assets/docs/tree/template-doc-overview.doc.mjs +109 -0
- package/assets/docs/tree/template-fonts.doc.mjs +102 -0
- package/assets/docs/tree/template-grading-rubric.doc.mjs +452 -0
- package/assets/docs/tree/template-icons.doc.mjs +97 -0
- package/assets/docs/tree/template-images-media.doc.mjs +127 -0
- package/assets/docs/tree/template-styles.doc.mjs +93 -0
- package/assets/docs/tree/templates.doc.mjs +34 -0
- package/assets/docs/tree/test-in-an-app.doc.mjs +115 -0
- package/assets/docs/tree/test-template-in-app.doc.mjs +128 -0
- package/assets/docs/tree/themes.doc.mjs +39 -0
- package/assets/docs/tree/troubleshooting.doc.mjs +149 -0
- package/assets/docs/tree/upgrading.doc.mjs +103 -0
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +51 -0
- package/assets/docs/tree/verify-packed-template.doc.mjs +77 -0
- package/assets/docs/tree/versioning.doc.mjs +161 -0
- package/assets/docs/tree/write-good-templates.doc.mjs +64 -0
- package/assets/docs/tree/write-the-template-file.doc.mjs +154 -0
- package/assets/docs/typography.doc.mjs +24 -4
- package/assets/docs/working-with-ai.doc.mjs +30 -22
- package/authoring/config/config.doc.mjs +2 -2
- package/authoring/config/type.ts +2 -2
- package/authoring/doctypes/_schema.d.mts +3 -2
- package/authoring/doctypes/_schema.mjs +6 -0
- package/authoring/doctypes/base/graph-fields.doc.mjs +3 -3
- package/authoring/doctypes/base/type.ts +4 -2
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/command/type.ts +1 -1
- package/authoring/doctypes/component/component.doc.mjs +6 -0
- package/authoring/doctypes/component/type.ts +8 -0
- package/authoring/doctypes/reference/reference.doc.mjs +7 -0
- package/authoring/doctypes/reference/type.ts +5 -0
- 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/integration/integration.doc.mjs +12 -10
- package/clients/cli/command-result-coverage.test.mjs +7 -7
- package/clients/cli/commands/component.doc.mjs +4 -3
- package/clients/cli/commands/debug-result-summary.test.mjs +2 -2
- package/clients/cli/commands/docs.doc.mjs +1 -1
- package/clients/cli/commands/docs.mjs +60 -17
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +3 -2
- package/clients/cli/commands/doctor-integration.test.mjs +53 -0
- package/clients/cli/commands/doctor.doc.mjs +3 -1
- package/clients/cli/commands/doctor.mjs +49 -5
- package/clients/cli/commands/gap-report.doc.mjs +10 -9
- package/clients/cli/commands/init.doc.mjs +9 -6
- package/clients/cli/commands/integration-add.doc.mjs +9 -9
- package/clients/cli/commands/integration-authoring.test.mjs +61 -10
- package/clients/cli/commands/integration-pack.doc.mjs +5 -9
- package/clients/cli/commands/integration-real-world.test.mjs +1 -1
- package/clients/cli/commands/integration-verify.doc.mjs +22 -0
- package/clients/cli/commands/integration.doc.mjs +4 -4
- package/clients/cli/commands/integration.mjs +74 -43
- 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 +10 -3
- package/clients/cli/commands/search.mjs +21 -2
- package/clients/cli/commands/search.test.mjs +21 -4
- 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 +24 -1
- package/clients/cli/commands/theme-add.doc.mjs +1 -1
- package/clients/cli/commands/theme-palette-generate.doc.mjs +3 -2
- package/clients/cli/commands/theme-palette.doc.mjs +1 -2
- package/clients/cli/commands/theme-targets.doc.mjs +2 -2
- package/clients/cli/commands/theme.doc.mjs +2 -1
- package/clients/cli/commands/upgrade.doc.mjs +62 -3
- package/clients/cli/index.mjs +32 -6
- package/clients/cli/lib/define-command.mjs +28 -4
- package/clients/cli/lib/define-command.test.mjs +54 -0
- package/clients/cli/lib/exit-codes.test.mjs +25 -2
- package/clients/cli/lib/json-shim.test.mjs +20 -6
- package/clients/cli/lib/manifest.mjs +23 -5
- package/foundation/agent-docs/agent-docs.mjs +1 -1
- package/foundation/discovery/authoring-self-docs.test.mjs +6 -2
- package/foundation/discovery/cli-self-docs.mjs +16 -2
- package/foundation/discovery/cli-self-docs.test.mjs +20 -0
- package/foundation/discovery/docs-discovery.mjs +5 -1
- package/foundation/discovery/docs-discovery.test.mjs +21 -0
- 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 +15 -2
- package/foundation/doc-compiler/inputs.test.mjs +0 -1
- package/foundation/doc-compiler/tree.d.mts +4 -0
- package/foundation/doc-compiler/tree.mjs +6 -1
- package/foundation/integrations/cli-requirement.d.mts +26 -6
- package/foundation/integrations/cli-requirement.mjs +46 -11
- package/foundation/integrations/cli-requirement.test.mjs +7 -2
- package/foundation/integrations/contribution-inventory.mjs +1 -1
- package/foundation/response/error-codes.doc.mjs +6 -8
- package/foundation/response/error-codes.test.mjs +30 -5
- package/foundation/response/response-types.doc.d.mts +4 -3
- package/foundation/response/response-types.doc.mjs +42 -6
- package/foundation/response/response.doc.mjs +11 -10
- 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/docs/docs.test.mjs +0 -245
- package/api/docs/integration-tree.test.mjs +0 -555
- package/api/docs/integrationDocs.test.mjs +0 -314
- package/api/search/search.test.mjs +0 -530
- package/assets/docs/tree/integrations.test.mjs +0 -62
- package/assets/docs/tree/writing-docs.doc.mjs +0 -286
- package/clients/cli/commands/docs.test.mjs +0 -323
- package/foundation/agent-docs/agent-docs.test.mjs +0 -1159
- package/foundation/doc-compiler/tree.test.mjs +0 -606
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx docs cli/integrations/building-blocks/themes/define-the-theme`:
|
|
5
|
+
* map the palette to tokens, keep light-dark() to colors, and avoid Core internals.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
|
|
9
|
+
export const docs = {
|
|
10
|
+
type: 'generic',
|
|
11
|
+
name: 'define-the-theme',
|
|
12
|
+
placement: {parent: 'namespace:themes', slot: 'guides', order: 30},
|
|
13
|
+
title: 'Define the theme',
|
|
14
|
+
category: 'guide',
|
|
15
|
+
description:
|
|
16
|
+
'Point theme tokens at the palette, keep light-dark() to colors, and avoid Core internals.',
|
|
17
|
+
sections: [
|
|
18
|
+
{
|
|
19
|
+
id: 'map-the-palette-to-tokens',
|
|
20
|
+
title: 'Map the palette to tokens',
|
|
21
|
+
content: [
|
|
22
|
+
{
|
|
23
|
+
type: 'prose',
|
|
24
|
+
text: 'A theme token is a named slot that Astryx components read for a value — `--color-accent` for the accent color, and so on. Components never read your palette directly; they read tokens. Defining a theme means pointing each token at a palette shade, so the components wear your colors.',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'prose',
|
|
28
|
+
text: 'Import the palette in `oceanTheme.ts` and point your tokens at its stops. Each token takes a `[light, dark]` pair — the shade to use in light mode and the one in dark mode.',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'code',
|
|
32
|
+
lang: 'ts',
|
|
33
|
+
code: `// themes/ocean/oceanTheme.ts
|
|
34
|
+
import {defineTheme} from '@astryxdesign/core/theme';
|
|
35
|
+
import {palette} from './tokens/ocean.palette';
|
|
36
|
+
|
|
37
|
+
const {light, dark} = palette.ocean;
|
|
38
|
+
|
|
39
|
+
export const oceanTheme = defineTheme({
|
|
40
|
+
name: 'ocean',
|
|
41
|
+
tokens: {
|
|
42
|
+
'--color-accent': [light['45'], dark['70']],
|
|
43
|
+
},
|
|
44
|
+
});`,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: 'prose',
|
|
48
|
+
text: 'Local imports must stay inside the theme folder. One that leaves it, such as `../../shared/colors`, fails with `invalid_theme`, and the theme disappears from `theme list`. `npx astryx theme template` writes a file that explains every `defineTheme` field. For the full token set, scope selectors, and component theming, read {@link generic:theme}.',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: 'build-on-another-theme',
|
|
54
|
+
title: 'Build on another theme',
|
|
55
|
+
content: [
|
|
56
|
+
{
|
|
57
|
+
type: 'prose',
|
|
58
|
+
text: 'To base a theme on an existing one, `extends` it: import the base theme and override only the tokens you change. The derived theme keeps a live link to the base and inherits its later changes — unlike `--from`, which forks a copy ({@link generic:add-a-theme}).',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: 'code',
|
|
62
|
+
lang: 'ts',
|
|
63
|
+
code: `import {defineTheme} from '@astryxdesign/core/theme';
|
|
64
|
+
import {oceanTheme} from './oceanTheme';
|
|
65
|
+
|
|
66
|
+
export const oceanContrastTheme = defineTheme({
|
|
67
|
+
name: 'ocean-contrast',
|
|
68
|
+
extends: oceanTheme,
|
|
69
|
+
tokens: {
|
|
70
|
+
'--color-accent': ['#0051a3', '#4aa3ff'],
|
|
71
|
+
},
|
|
72
|
+
});`,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: 'keep-light-dark-to-colors',
|
|
78
|
+
title: 'Keep light-dark() to colors',
|
|
79
|
+
content: [
|
|
80
|
+
{
|
|
81
|
+
type: 'prose',
|
|
82
|
+
text: 'Each `[light, dark]` pair compiles to a `light-dark()` value, which switches only colors. Give it colors. For a value that is not a plain color — a gradient — put `light-dark()` on each color stop, not around the whole value: a browser without `light-dark()` drops the declaration, and the stop form is the one that degrades safely.',
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: 'avoid-core-internals',
|
|
88
|
+
title: 'Do not set Core private variables',
|
|
89
|
+
content: [
|
|
90
|
+
{
|
|
91
|
+
type: 'prose',
|
|
92
|
+
text: 'Core private variables start with `--_`, such as `--_field-radius`. They are internals and can change in any Core release, so `theme build` reports each one it finds as an `[error]`. Set the standard CSS property instead — `borderRadius`, `padding` — and let the build emit the internal variable where Core needs it.',
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 'declare-the-peers',
|
|
98
|
+
title: 'Declare the peer dependencies',
|
|
99
|
+
content: [
|
|
100
|
+
{
|
|
101
|
+
type: 'prose',
|
|
102
|
+
text: 'The theme imports `@astryxdesign/core/theme`, so declare Core as a peer dependency, with the range of Core versions you test the theme against — a range, not an exact version, so a Core patch release does not force a republish. `integration add theme` already declared the optional `@astryxdesign/cli` peer that reads themes:',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
type: 'code',
|
|
106
|
+
lang: 'json',
|
|
107
|
+
code: `"peerDependencies": {
|
|
108
|
+
"@astryxdesign/core": "^0.7.0",
|
|
109
|
+
"@astryxdesign/cli": ">=0.7.0"
|
|
110
|
+
},
|
|
111
|
+
"peerDependenciesMeta": {
|
|
112
|
+
"@astryxdesign/cli": {"optional": true}
|
|
113
|
+
}`,
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx docs cli/integrations/components/describe-the-component`:
|
|
5
|
+
* choose and maintain the ComponentDoc shape that matches a component's public
|
|
6
|
+
* source.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */
|
|
10
|
+
export const docs = {
|
|
11
|
+
type: 'namespace',
|
|
12
|
+
name: 'describe-the-component',
|
|
13
|
+
placement: {parent: 'namespace:components', slot: 'guides', order: 20},
|
|
14
|
+
title: 'Describe the component',
|
|
15
|
+
summary:
|
|
16
|
+
'Write and maintain the default component doc, then adapt it when one family owns several exports or a member needs its own file.',
|
|
17
|
+
keywords: [
|
|
18
|
+
'component doc',
|
|
19
|
+
'component documentation',
|
|
20
|
+
'component family',
|
|
21
|
+
'subcomponent',
|
|
22
|
+
],
|
|
23
|
+
slots: {
|
|
24
|
+
guides: {
|
|
25
|
+
title: 'Describe the component',
|
|
26
|
+
accepts: {kinds: ['generic']},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
blocks: [
|
|
30
|
+
{
|
|
31
|
+
type: 'prose',
|
|
32
|
+
text: 'A component\'s `.doc.mjs` is part of the integration\'s public contract, not optional commentary. Astryx uses it for CLI output and search, and people and agents read it to decide whether the component fits and how to use it.',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: 'list',
|
|
36
|
+
style: 'unordered',
|
|
37
|
+
items: [
|
|
38
|
+
'Change the source and its `.doc.mjs` together.',
|
|
39
|
+
'Update the doc whenever the public name, import, behavior, props, defaults, examples, or accessibility requirements change.',
|
|
40
|
+
'`integration verify` checks the doc shape and packed import, but it cannot prove the prose still matches the component.',
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: 'prose',
|
|
45
|
+
text: 'Every component doc has one stable identity and enough usage guidance for a reader to choose it correctly. Pick the shape below that matches your module.',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: 'prose',
|
|
49
|
+
text: 'After every source or doc change, read the component back. This output is what people and agents receive.',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: 'code',
|
|
53
|
+
lang: 'bash',
|
|
54
|
+
code: 'npx astryx component AcmeCarousel',
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx docs cli/integrations/docs`: the guides to writing docs for an
|
|
5
|
+
* integration package, which join the same docs tree as the CLI's own
|
|
6
|
+
* (spec:AST-046, spec:AST-047).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */
|
|
10
|
+
export const docs = {
|
|
11
|
+
type: 'namespace',
|
|
12
|
+
name: 'docs',
|
|
13
|
+
placement: {parent: 'namespace:building-blocks', slot: 'guides', order: 40},
|
|
14
|
+
title: 'Docs',
|
|
15
|
+
summary:
|
|
16
|
+
'Write docs that ship with your package and that people and agents find by search or one level at a time.',
|
|
17
|
+
keywords: ['writing docs', 'doc topic', 'docs section', 'placement', 'links'],
|
|
18
|
+
slots: {
|
|
19
|
+
guides: {title: 'Guides', accepts: {kinds: ['generic']}},
|
|
20
|
+
},
|
|
21
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx docs cli/integrations/templates/document-the-template`:
|
|
5
|
+
* document page and block templates for discovery and correct reuse.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */
|
|
9
|
+
export const docs = {
|
|
10
|
+
type: 'namespace',
|
|
11
|
+
name: 'document-the-template',
|
|
12
|
+
placement: {parent: 'namespace:templates', slot: 'build', order: 20},
|
|
13
|
+
title: 'Document the template',
|
|
14
|
+
summary:
|
|
15
|
+
'Write the doc that helps people and agents find, choose, and trust your template: its name, description, readiness, preview, and any Core replacement.',
|
|
16
|
+
keywords: [
|
|
17
|
+
'template doc',
|
|
18
|
+
'template documentation',
|
|
19
|
+
'page template',
|
|
20
|
+
'block template',
|
|
21
|
+
],
|
|
22
|
+
slots: {
|
|
23
|
+
guides: {
|
|
24
|
+
title: 'Guides',
|
|
25
|
+
accepts: {kinds: ['generic']},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx docs cli/integrations/building-blocks/themes/document-the-theme`:
|
|
5
|
+
* document a theme by extending the core theme topic, not in agent guidance.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
|
|
9
|
+
export const docs = {
|
|
10
|
+
type: 'generic',
|
|
11
|
+
name: 'document-the-theme',
|
|
12
|
+
placement: {parent: 'namespace:themes', slot: 'guides', order: 50},
|
|
13
|
+
title: 'Document the theme',
|
|
14
|
+
category: 'guide',
|
|
15
|
+
description:
|
|
16
|
+
'Document a theme by extending the core theme topic, so an app reads it in `astryx docs theme`.',
|
|
17
|
+
sections: [
|
|
18
|
+
{
|
|
19
|
+
id: 'extend-the-theme-topic',
|
|
20
|
+
title: 'Extend the core theme topic',
|
|
21
|
+
content: [
|
|
22
|
+
{
|
|
23
|
+
type: 'prose',
|
|
24
|
+
text: 'Give your theme a doc topic that extends the core `theme` topic, so an app that lists your package sees your theme at the end of `astryx docs theme`. Add it with `extends: \'theme\'` ({@link generic:extend-or-replace}).',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'code',
|
|
28
|
+
lang: 'javascript',
|
|
29
|
+
code: `// docs/ocean-theme.doc.mjs
|
|
30
|
+
/** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
|
|
31
|
+
export default {
|
|
32
|
+
type: 'generic',
|
|
33
|
+
name: 'ocean-theme',
|
|
34
|
+
extends: 'theme',
|
|
35
|
+
title: 'Ocean theme',
|
|
36
|
+
description: 'Use the Ocean theme from @acme/astryx-widgets.',
|
|
37
|
+
sections: [
|
|
38
|
+
{
|
|
39
|
+
id: 'use-the-ocean-theme',
|
|
40
|
+
title: 'Use the Ocean theme',
|
|
41
|
+
content: [
|
|
42
|
+
{
|
|
43
|
+
type: 'prose',
|
|
44
|
+
text: "Add \`@acme/astryx-widgets\` to the app's dependencies and apply the Ocean theme with \`<Theme theme={oceanTheme}>\`.",
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
};`,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: 'prose',
|
|
53
|
+
text: 'Keep the section short: how to add the package, apply the theme ({@link generic:use-a-theme-in-an-app}), and — if the theme uses a custom font — which fonts the app must load ({@link generic:fonts-and-assets}). Extend `theme` rather than a topic another package replaces, or an app that lists that package first drops your section.',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 'not-agent-guidance',
|
|
59
|
+
title: 'Not agent guidance',
|
|
60
|
+
content: [
|
|
61
|
+
{
|
|
62
|
+
type: 'prose',
|
|
63
|
+
text: 'Do not put theme usage in `agentDocs`. Agent lines land in every app\'s agent file and are for guidance needed every session; a theme\'s install-and-use steps belong in a doc topic that people and agents read on demand. See {@link generic:agent-guidance}.',
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx docs cli/integrations/templates/build-the-template/package-and-test/export-template-assets`:
|
|
5
|
+
* expose and include everything a copied template imports, and declare the
|
|
6
|
+
* packages it needs.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
|
|
10
|
+
export const docs = {
|
|
11
|
+
type: 'generic',
|
|
12
|
+
name: 'export-template-assets',
|
|
13
|
+
placement: {
|
|
14
|
+
parent: 'namespace:package-and-test',
|
|
15
|
+
slot: 'guides',
|
|
16
|
+
order: 10,
|
|
17
|
+
},
|
|
18
|
+
title: 'Export the template and assets',
|
|
19
|
+
category: 'guide',
|
|
20
|
+
description:
|
|
21
|
+
'Make sure the published package contains and exposes everything the copied template imports.',
|
|
22
|
+
sections: [
|
|
23
|
+
{
|
|
24
|
+
id: 'keep-the-generated-template-export',
|
|
25
|
+
title: 'Keep the generated template export',
|
|
26
|
+
content: [
|
|
27
|
+
{
|
|
28
|
+
type: 'prose',
|
|
29
|
+
text: '`integration verify` resolves each template through a public package path without a file extension, such as `./templates/acme-dashboard`, and fails when that path is missing.',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: 'code',
|
|
33
|
+
lang: 'json',
|
|
34
|
+
label: 'package.json',
|
|
35
|
+
code: `{
|
|
36
|
+
"exports": {
|
|
37
|
+
"./templates/acme-dashboard": "./templates/acme-dashboard.tsx"
|
|
38
|
+
}
|
|
39
|
+
}`,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
type: 'list',
|
|
43
|
+
style: 'unordered',
|
|
44
|
+
items: [
|
|
45
|
+
'`integration add` writes this entry when `package.json` has an `exports` map ({@link generic:start-a-template}). Without a map it writes nothing, because creating one would make existing deep imports private. Add the map yourself, then the entry.',
|
|
46
|
+
'Keep the public path without `.tsx`. Only the target file ends in `.tsx`.',
|
|
47
|
+
'Do not point the entry at a barrel file that loses the template default export.',
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: 'export-package-owned-support-files',
|
|
54
|
+
title: 'Export package-owned support files',
|
|
55
|
+
content: [
|
|
56
|
+
{
|
|
57
|
+
type: 'prose',
|
|
58
|
+
text: 'Add a public path for every package-owned component, helper, icon, or stylesheet that the copied source imports. Keep implementation-only files private.',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: 'code',
|
|
62
|
+
lang: 'json',
|
|
63
|
+
label: 'Relevant package.json entries',
|
|
64
|
+
code: `{
|
|
65
|
+
"exports": {
|
|
66
|
+
"./templates/acme-dashboard": "./templates/acme-dashboard.tsx",
|
|
67
|
+
"./components/AcmeStatusCard": "./components/AcmeStatusCard.tsx",
|
|
68
|
+
"./icons/AcmePulseIcon": "./icons/AcmePulseIcon.tsx",
|
|
69
|
+
"./styles/acme-dashboard.css": "./styles/acme-dashboard.css"
|
|
70
|
+
}
|
|
71
|
+
}`,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: 'prose',
|
|
75
|
+
text: 'If a block is also loaded directly as a live `.tsx` preview, add a pattern that keeps the extension, such as `"./templates/*.tsx": "./templates/*.tsx"`. Keep the generated entry too; `integration verify` resolves the template through it.',
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'include-every-file',
|
|
81
|
+
title: 'Include every file',
|
|
82
|
+
content: [
|
|
83
|
+
{
|
|
84
|
+
type: 'prose',
|
|
85
|
+
text: 'An export can point to a file that npm leaves out. When `package.json#files` exists, list the integration manifest, the templates directory, and every directory the copied file depends on.',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
type: 'code',
|
|
89
|
+
lang: 'json',
|
|
90
|
+
label: 'package.json',
|
|
91
|
+
code: `{
|
|
92
|
+
"files": [
|
|
93
|
+
"astryx.integration.mjs",
|
|
94
|
+
"templates",
|
|
95
|
+
"components",
|
|
96
|
+
"icons",
|
|
97
|
+
"styles",
|
|
98
|
+
"assets/fonts"
|
|
99
|
+
],
|
|
100
|
+
"sideEffects": ["**/*.css"]
|
|
101
|
+
}`,
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: 'list',
|
|
105
|
+
style: 'unordered',
|
|
106
|
+
items: [
|
|
107
|
+
'`integration add` appends the manifest and templates directory when a `files` list already exists. Add the other directories yourself.',
|
|
108
|
+
'If `package.json` sets `sideEffects`, include CSS in it, as above, so bundlers keep side-effect stylesheet imports.',
|
|
109
|
+
'Run `npm pack --dry-run` and read the real file list instead of reasoning from the workspace.',
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
id: 'declare-what-the-copied-file-imports',
|
|
116
|
+
title: 'Declare what the copied file imports',
|
|
117
|
+
content: [
|
|
118
|
+
{
|
|
119
|
+
type: 'prose',
|
|
120
|
+
text: 'A copied file imports from the app, so the app must install every package it imports. Declare the Astryx peers as described in {@link generic:versioning}. For other packages:',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
type: 'table',
|
|
124
|
+
headers: ['Field', 'Use it for'],
|
|
125
|
+
rows: [
|
|
126
|
+
[
|
|
127
|
+
'`peerDependencies`',
|
|
128
|
+
'Libraries the copied source imports, such as an icon library. List them in `devDependencies` too, so the package itself builds.',
|
|
129
|
+
],
|
|
130
|
+
[
|
|
131
|
+
'`dependencies`',
|
|
132
|
+
'Runtime packages used only by package-owned modules, which should travel with the integration',
|
|
133
|
+
],
|
|
134
|
+
[
|
|
135
|
+
'`devDependencies`',
|
|
136
|
+
'Everything needed to build and test the integration itself',
|
|
137
|
+
],
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
type: 'prose',
|
|
142
|
+
text: 'Use only ranges you test. A package that resolves only because a workspace hoisted it is not declared.',
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx docs cli/integrations/docs/extend-or-replace`: take over an
|
|
5
|
+
* existing topic with `replaces`, merge sections into one with `extends`, and
|
|
6
|
+
* check overlaps with Core topics.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
|
|
10
|
+
export const docs = {
|
|
11
|
+
type: 'generic',
|
|
12
|
+
name: 'extend-or-replace',
|
|
13
|
+
placement: {parent: 'namespace:docs', slot: 'guides', order: 40},
|
|
14
|
+
title: 'Extend or replace a topic',
|
|
15
|
+
category: 'guide',
|
|
16
|
+
description: 'Take over a topic, or merge sections into it.',
|
|
17
|
+
sections: [
|
|
18
|
+
{
|
|
19
|
+
id: 'replace-a-topic',
|
|
20
|
+
title: 'Replace a topic',
|
|
21
|
+
content: [
|
|
22
|
+
{
|
|
23
|
+
type: 'prose',
|
|
24
|
+
text: "Set `replaces` to take over an existing topic, such as Core's `getting-started`. Readers who open the old name get your topic.",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'code',
|
|
28
|
+
lang: 'bash',
|
|
29
|
+
code: 'npx astryx integration add doc acme-getting-started --replaces getting-started\n# The old name now opens your topic\nnpx astryx docs getting-started',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: 'code',
|
|
33
|
+
lang: 'javascript',
|
|
34
|
+
label: 'docs/acme-getting-started.doc.mjs',
|
|
35
|
+
code: "export default {\n type: 'generic',\n name: 'acme-getting-started',\n replaces: 'getting-started',\n title: 'Acme getting started',\n description: 'Install Acme widgets and render your first carousel.',\n sections: [/* ... */],\n};",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: 'prose',
|
|
39
|
+
text: 'The docs list shows your topic in place of the old one. Because your topic has its own `name`, the old name keeps resolving to it, so links and agents that learned the old name still land on your topic.',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 'extend-a-topic',
|
|
45
|
+
title: 'Extend a topic',
|
|
46
|
+
content: [
|
|
47
|
+
{
|
|
48
|
+
type: 'prose',
|
|
49
|
+
text: 'Set `extends` to merge sections into an existing topic instead of owning it. A section with the same key replaces the base section, and a new section is added at the end.',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: 'code',
|
|
53
|
+
lang: 'bash',
|
|
54
|
+
code: 'npx astryx integration add doc acme-theming --extends theme\nnpx astryx docs theme --index',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: 'code',
|
|
58
|
+
lang: 'javascript',
|
|
59
|
+
label: 'docs/acme-theming.doc.mjs',
|
|
60
|
+
code: "export default {\n type: 'generic',\n name: 'acme-theming',\n extends: 'theme',\n title: 'Acme theming',\n description: 'Theme an app that uses Acme widgets.',\n sections: [\n {id: 'quick-start', title: 'Quick Start', content: [/* replaces the base section */]},\n {id: 'use-the-ocean-theme', title: 'Use the ocean theme', content: [/* added at the end */]},\n ],\n};",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: 'list',
|
|
64
|
+
style: 'unordered',
|
|
65
|
+
items: [
|
|
66
|
+
"A section's key is its `id`, or a key made from its title. Read the base topic's keys with `--index`.",
|
|
67
|
+
"The topic keeps the base's title and description, and readers open it by the base's name.",
|
|
68
|
+
'Replace the `Overview` placeholder that `integration add` writes, or it is added to the base topic.',
|
|
69
|
+
"Extend a topic to correct or add to it. A copy made with `replaces` stops getting the owner's fixes.",
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'check-overlaps-with-core-topics',
|
|
76
|
+
title: 'Check overlaps with Core topics',
|
|
77
|
+
content: [
|
|
78
|
+
{
|
|
79
|
+
type: 'prose',
|
|
80
|
+
text: "A topic sets `replaces` or `extends`, never both, and a placed guide sets neither. A topic that uses a Core topic's name with neither is an accidental conflict: apps keep reading the Core topic.",
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
type: 'code',
|
|
84
|
+
lang: 'bash',
|
|
85
|
+
code: 'npx astryx doctor integration docs',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
type: 'code',
|
|
89
|
+
lang: 'text',
|
|
90
|
+
code: 'severity: [info]\ntopic: acme-getting-started\nrelationship: replaces\ncoreTopic: getting-started\nmessage: Intentional override: "acme-getting-started" replaces the Core topic "getting-started".\n\nseverity: [fail]\ntopic: tokens\nrelationship: accidental\ncoreTopic: tokens\nmessage: Accidental conflict: "tokens" is already a Core topic. Rename it, declare replaces: \'tokens\' to take it over, or declare extends: \'tokens\' to merge sections.',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
type: 'list',
|
|
94
|
+
style: 'unordered',
|
|
95
|
+
items: [
|
|
96
|
+
'An intentional overlap prints as `[info]`. An accidental one fails with exit code 1.',
|
|
97
|
+
'A topic that sets both fails as `invalid_doc`, and so does a placed guide that sets either one.',
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx docs cli/integrations/building-blocks/themes/fonts-and-assets`:
|
|
5
|
+
* name a theme's fonts, and have the app load them (Astryx never loads a font).
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
|
|
9
|
+
export const docs = {
|
|
10
|
+
type: 'generic',
|
|
11
|
+
name: 'fonts-and-assets',
|
|
12
|
+
placement: {parent: 'namespace:themes', slot: 'guides', order: 35},
|
|
13
|
+
title: 'Fonts',
|
|
14
|
+
category: 'guide',
|
|
15
|
+
description:
|
|
16
|
+
'Name your theme\'s fonts in its tokens, then have the app load them — Astryx never loads a font file.',
|
|
17
|
+
sections: [
|
|
18
|
+
{
|
|
19
|
+
id: 'name-the-font',
|
|
20
|
+
title: 'Name the font',
|
|
21
|
+
content: [
|
|
22
|
+
{
|
|
23
|
+
type: 'prose',
|
|
24
|
+
text: 'A theme names its typefaces in `typography`: `body`, `heading`, and `code`, each with a `family` and `fallbacks`. These set the `--font-family-*` tokens every component reads. Always give real `fallbacks` so text stays readable before the font loads, or if it never does. `heading` inherits `family` and `fallbacks` from `body` when you omit them.',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'code',
|
|
28
|
+
lang: 'ts',
|
|
29
|
+
code: `// themes/ocean/oceanTheme.ts
|
|
30
|
+
export const oceanTheme = defineTheme({
|
|
31
|
+
name: 'ocean',
|
|
32
|
+
typography: {
|
|
33
|
+
body: {family: 'Acme Sans', fallbacks: 'system-ui, sans-serif'},
|
|
34
|
+
code: {family: 'Acme Mono', fallbacks: 'ui-monospace, monospace'},
|
|
35
|
+
},
|
|
36
|
+
// ...your tokens
|
|
37
|
+
});`,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: 'prose',
|
|
41
|
+
text: 'The full type scale and font roles are in {@link generic:theme}.',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 'load-the-font-in-the-app',
|
|
47
|
+
title: 'Load the font in the app',
|
|
48
|
+
content: [
|
|
49
|
+
{
|
|
50
|
+
type: 'prose',
|
|
51
|
+
text: 'Naming a family does not load it — Astryx never downloads a font file. The app that uses your theme loads the font itself, so your job is to tell your users which families and weights to load, in your theme\'s docs ({@link generic:document-the-theme}). An app loads a font one of two ways:',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: 'list',
|
|
55
|
+
style: 'unordered',
|
|
56
|
+
items: [
|
|
57
|
+
'Link a hosted stylesheet in the app\'s `<head>` — for example a Google Fonts `<link>` covering every weight the UI uses.',
|
|
58
|
+
'Self-host: serve the font files and add an `@font-face` for each weight and style to the app\'s global CSS.',
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: 'code',
|
|
63
|
+
lang: 'css',
|
|
64
|
+
code: `/* In the app's global CSS, when self-hosting */
|
|
65
|
+
@font-face {
|
|
66
|
+
font-family: 'Acme Sans';
|
|
67
|
+
src: url('/fonts/acme-sans.woff2') format('woff2');
|
|
68
|
+
font-weight: 100 900;
|
|
69
|
+
font-style: normal;
|
|
70
|
+
font-display: swap;
|
|
71
|
+
unicode-range: U+0000-00FF, U+0131, U+0152-0153;
|
|
72
|
+
}`,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: 'list',
|
|
76
|
+
style: 'unordered',
|
|
77
|
+
items: [
|
|
78
|
+
'Load every weight and style the theme uses. Do not let the browser synthesize bold or italic — include the italic face, with the same `unicode-range`s as the roman.',
|
|
79
|
+
'Set a `unicode-range` per face so the browser downloads only the subsets it needs.',
|
|
80
|
+
'Use `font-display: swap` unless a measured need justifies another value.',
|
|
81
|
+
'Serve WOFF2; add another format only when a target browser needs it.',
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: 'verify-in-an-app',
|
|
88
|
+
title: 'Verify in an app',
|
|
89
|
+
content: [
|
|
90
|
+
{
|
|
91
|
+
type: 'prose',
|
|
92
|
+
text: 'Before publishing, install the package in a clean app, apply the theme, load the fonts, and open it in a browser. The source and the applied result are not the same thing until you look.',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
type: 'list',
|
|
96
|
+
style: 'unordered',
|
|
97
|
+
items: [
|
|
98
|
+
'Text renders in the named families at every weight and style — the italic face resolves, not a synthesized slant.',
|
|
99
|
+
'Every font request succeeds; nothing silently falls back to a system font.',
|
|
100
|
+
'Color pairs still meet contrast in both light and dark mode.',
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
};
|