@astryxdesign/cli 0.6.7-canary.83c521e → 0.6.7-canary.af76e84
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.
|
@@ -171,4 +171,18 @@ describe('the reported defect: docs tokens --dense (#2182)', () => {
|
|
|
171
171
|
expect(titles).not.toContain('Dark mode');
|
|
172
172
|
expect(titles).toContain('深色模式');
|
|
173
173
|
});
|
|
174
|
+
|
|
175
|
+
it('teaches committed palette references in every theme-doc variant', async () => {
|
|
176
|
+
for (const options of [{}, {dense: true}, {zh: true}]) {
|
|
177
|
+
const result = await docs('theme', null, options);
|
|
178
|
+
const rendered = JSON.stringify(result.data.sections);
|
|
179
|
+
expect(rendered).toContain(
|
|
180
|
+
'astryx theme palette generate palette.config.json --out palette.generated.ts',
|
|
181
|
+
);
|
|
182
|
+
expect(rendered).toContain(
|
|
183
|
+
"import {palette} from './palette.generated';",
|
|
184
|
+
);
|
|
185
|
+
expect(rendered).toContain('palette.neutral.light[100]');
|
|
186
|
+
}
|
|
187
|
+
});
|
|
174
188
|
});
|
|
@@ -17,6 +17,8 @@ export const docsDense = {
|
|
|
17
17
|
title: 'Custom themes',
|
|
18
18
|
content: [
|
|
19
19
|
{type: 'prose', text: '`defineTheme` + token overrides + component overrides. {@link generic:author-a-theme} for full guide.'},
|
|
20
|
+
null,
|
|
21
|
+
{type: 'prose', text: "new palette: `astryx theme palette generate palette.config.json --out palette.generated.ts` → review + commit module and receipt → `import {palette} from './palette.generated';` → map semantic tokens to stable stops such as `palette.neutral.light[100]` / `palette.neutral.dark[15]`. regeneration updates mapped roles; generation does not rewrite the theme."},
|
|
20
22
|
],
|
|
21
23
|
},
|
|
22
24
|
{
|
|
@@ -41,6 +41,16 @@ export const docs = {
|
|
|
41
41
|
label: 'Quick start',
|
|
42
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',
|
|
43
43
|
},
|
|
44
|
+
{
|
|
45
|
+
type: 'prose',
|
|
46
|
+
text: 'For a new coordinated color system, run `astryx theme palette generate palette.config.json --out palette.generated.ts`. Review and commit the generated palette module and receipt, import its `palette` export, then reference stable stops from semantic tokens. Regenerating an accepted palette updates every mapped token that keeps those references; generation does not rewrite the theme.',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
type: 'code',
|
|
50
|
+
lang: 'tsx',
|
|
51
|
+
label: 'Map semantic tokens to generated palette stops',
|
|
52
|
+
code: "import {defineTheme} from '@astryxdesign/core/theme';\nimport {palette} from './palette.generated';\n\nconst myTheme = defineTheme({\n name: 'my-theme',\n tokens: {\n '--color-background-surface': [\n palette.neutral.light[100],\n palette.neutral.dark[15],\n ],\n },\n});",
|
|
53
|
+
},
|
|
44
54
|
],
|
|
45
55
|
},
|
|
46
56
|
{
|
|
@@ -21,7 +21,7 @@ export const docsZh = {
|
|
|
21
21
|
content: [
|
|
22
22
|
{
|
|
23
23
|
type: 'prose',
|
|
24
|
-
text: '使用 `defineTheme`
|
|
24
|
+
text: '使用 `defineTheme` 进行令牌覆盖、比例配置和组件样式覆盖。新建完整调色板时,请运行 `astryx theme palette generate palette.config.json --out palette.generated.ts`,审核并提交生成的模块和收据,再使用 `import {palette} from \'./palette.generated\';` 导入调色板,让语义令牌引用稳定的色阶,例如 `palette.neutral.light[100]` 和 `palette.neutral.dark[15]`。重新生成已接受的调色板时,所有保留这些引用的映射令牌会一并更新;生成操作不会自动修改主题。完整指南请参阅 {@link generic:author-a-theme}。',
|
|
25
25
|
},
|
|
26
26
|
],
|
|
27
27
|
},
|
package/assets/theme.template.ts
CHANGED
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
*/
|
|
82
82
|
|
|
83
83
|
import {defineTheme} from '@astryxdesign/core/theme';
|
|
84
|
+
// import {palette} from './palette.generated';
|
|
84
85
|
// import {dracula} from '@astryxdesign/core/theme/syntax';
|
|
85
86
|
// import {neutralTheme} from '@astryxdesign/theme-neutral';
|
|
86
87
|
|
|
@@ -99,15 +100,25 @@ export const myTheme = defineTheme({
|
|
|
99
100
|
// extends: neutralTheme,
|
|
100
101
|
|
|
101
102
|
// ───────────────────────────────────────────────────────────────────────
|
|
102
|
-
// Scale configs —
|
|
103
|
-
//
|
|
104
|
-
//
|
|
103
|
+
// Scale configs — concise inputs for typography, radius, and motion.
|
|
104
|
+
// The color scale remains supported for existing themes, but it is not the
|
|
105
|
+
// recommended starting point for a new palette; see its note below.
|
|
105
106
|
// ───────────────────────────────────────────────────────────────────────
|
|
106
107
|
|
|
107
108
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
109
|
+
* Supported compatibility path for existing themes. This expands one accent
|
|
110
|
+
* seed into the neutral ramp, surfaces, text, icons, borders, muted fills,
|
|
111
|
+
* hover and pressed overlays — light and dark both. It is not an accent-only
|
|
112
|
+
* edit.
|
|
113
|
+
*
|
|
114
|
+
* For a new complete palette, run:
|
|
115
|
+
*
|
|
116
|
+
* astryx theme palette generate palette.config.json --out palette.generated.ts
|
|
117
|
+
*
|
|
118
|
+
* Review the generated candidate, then commit the palette module and receipt.
|
|
119
|
+
* Uncomment the `palette` import above and reference its stops from semantic
|
|
120
|
+
* tokens below. Regenerating an accepted palette then updates every mapped
|
|
121
|
+
* token that keeps those references. Generation does not rewrite the theme.
|
|
111
122
|
*
|
|
112
123
|
* accent seed hex, or a [light, dark] pair to seed each scheme's
|
|
113
124
|
* palette from its own colour; omit to keep the default
|
|
@@ -134,7 +145,7 @@ export const myTheme = defineTheme({
|
|
|
134
145
|
* `astryx docs tokens/tokens-color` for every colour token and its light/dark
|
|
135
146
|
* default.
|
|
136
147
|
*/
|
|
137
|
-
color: {accent: '#0064E0', neutralStyle: 'cool', contrast: 'standard'},
|
|
148
|
+
// color: {accent: '#0064E0', neutralStyle: 'cool', contrast: 'standard'},
|
|
138
149
|
|
|
139
150
|
/**
|
|
140
151
|
* Type scale and the three font roles.
|
|
@@ -213,12 +224,17 @@ export const myTheme = defineTheme({
|
|
|
213
224
|
// --color-syntax-* code highlighting · --color-data-* charts
|
|
214
225
|
// ───────────────────────────────────────────────────────────────────────
|
|
215
226
|
tokens: {
|
|
227
|
+
// Keep generated roles connected to the accepted palette. Uncomment the
|
|
228
|
+
// import above, then map each reviewed semantic role this way.
|
|
229
|
+
// '--color-background-surface': [
|
|
230
|
+
// palette.neutral.light[100],
|
|
231
|
+
// palette.neutral.dark[15],
|
|
232
|
+
// ],
|
|
216
233
|
'--color-accent': ['#0064E0', '#2694FE'],
|
|
217
234
|
// Changing an accent means owning its on-colour: this is the label that
|
|
218
235
|
// sits on top of the fill above, in each mode.
|
|
219
236
|
'--color-on-accent': ['#FFFFFF', '#FFFFFF'],
|
|
220
237
|
'--color-background-body': ['#F1F4F7', '#111112'],
|
|
221
|
-
'--color-background-surface': ['#FFFFFF', '#1F1F22'],
|
|
222
238
|
'--focus-outline-color': 'var(--color-accent)',
|
|
223
239
|
'--shadow-low': '0 1px 2px light-dark(#0000001A, #00000066)',
|
|
224
240
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.6.7-canary.
|
|
3
|
+
"version": "0.6.7-canary.af76e84",
|
|
4
4
|
"displayName": "CLI",
|
|
5
5
|
"description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -101,10 +101,10 @@
|
|
|
101
101
|
"zod": "^4.4.3"
|
|
102
102
|
},
|
|
103
103
|
"peerDependencies": {
|
|
104
|
-
"@astryxdesign/charts": "0.6.7-canary.
|
|
105
|
-
"@astryxdesign/core": "0.6.7-canary.
|
|
106
|
-
"@astryxdesign/lab": "0.6.7-canary.
|
|
107
|
-
"@astryxdesign/theme-neutral": "0.6.7-canary.
|
|
104
|
+
"@astryxdesign/charts": "0.6.7-canary.af76e84",
|
|
105
|
+
"@astryxdesign/core": "0.6.7-canary.af76e84",
|
|
106
|
+
"@astryxdesign/lab": "0.6.7-canary.af76e84",
|
|
107
|
+
"@astryxdesign/theme-neutral": "0.6.7-canary.af76e84"
|
|
108
108
|
},
|
|
109
109
|
"peerDependenciesMeta": {
|
|
110
110
|
"@astryxdesign/charts": {
|
|
@@ -121,10 +121,10 @@
|
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
123
|
"devDependencies": {
|
|
124
|
-
"@astryxdesign/charts": "0.6.7-canary.
|
|
125
|
-
"@astryxdesign/core": "0.6.7-canary.
|
|
126
|
-
"@astryxdesign/lab": "0.6.7-canary.
|
|
127
|
-
"@astryxdesign/theme-neutral": "0.6.7-canary.
|
|
124
|
+
"@astryxdesign/charts": "0.6.7-canary.af76e84",
|
|
125
|
+
"@astryxdesign/core": "0.6.7-canary.af76e84",
|
|
126
|
+
"@astryxdesign/lab": "0.6.7-canary.af76e84",
|
|
127
|
+
"@astryxdesign/theme-neutral": "0.6.7-canary.af76e84",
|
|
128
128
|
"@heroicons/react": "^2.2.0",
|
|
129
129
|
"@stylexjs/stylex": "^0.19.0",
|
|
130
130
|
"@types/babel__core": "^7.20.5",
|