@astryxdesign/cli 0.7.14-canary.gfb823d9 → 0.7.14

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.
Files changed (135) hide show
  1. package/CHANGELOG.md +197 -0
  2. package/api/component/_adapter.d.mts +15 -0
  3. package/api/component/_adapter.mjs +76 -0
  4. package/api/component/component.mjs +8 -1
  5. package/api/search/_named-keywords.d.mts +31 -0
  6. package/api/search/_named-keywords.mjs +177 -0
  7. package/api/search/search-index.mjs +8 -1
  8. package/api/search/search.d.mts +6 -1
  9. package/api/search/search.mjs +49 -8
  10. package/api/theme/_adapter.d.mts +33 -0
  11. package/api/theme/_adapter.mjs +352 -16
  12. package/api/theme/build/build.mjs +261 -10
  13. package/api/theme/eject/eject.mjs +13 -1
  14. package/api/theme/list/list.mjs +11 -2
  15. package/api/theme/palette/generate/color.d.mts +2 -0
  16. package/api/theme/palette/generate/color.mjs +1 -1
  17. package/api/theme/template/template.mjs +139 -6
  18. package/api/theme/theme.type.d.mts +15 -1
  19. package/api/theme/theme.type.mjs +9 -3
  20. package/api/theme/themeAdd.doc.mjs +1 -1
  21. package/api/theme/themeBuild.doc.mjs +10 -2
  22. package/api/theme/themeEject.doc.mjs +2 -2
  23. package/api/theme/themeListAvailable.doc.mjs +1 -1
  24. package/api/theme/themeRemove.doc.mjs +1 -1
  25. package/api/theme/themeTemplate.doc.mjs +8 -0
  26. package/api/theme/themeUse.doc.mjs +1 -1
  27. package/api/theme-edit/_adapter.d.mts +36 -2
  28. package/api/theme-edit/_adapter.mjs +340 -12
  29. package/api/theme-edit/_check.d.mts +28 -25
  30. package/api/theme-edit/_check.mjs +876 -308
  31. package/api/theme-edit/_color.d.mts +53 -4
  32. package/api/theme-edit/_color.mjs +406 -79
  33. package/api/theme-edit/_compiler.d.mts +14 -6
  34. package/api/theme-edit/_compiler.mjs +89 -59
  35. package/api/theme-edit/_context.d.mts +28 -8
  36. package/api/theme-edit/_context.mjs +142 -19
  37. package/api/theme-edit/_edit.d.mts +3 -1
  38. package/api/theme-edit/_edit.mjs +746 -76
  39. package/api/theme-edit/_how-commands.d.mts +91 -0
  40. package/api/theme-edit/_how-commands.mjs +269 -0
  41. package/api/theme-edit/_how-question.d.mts +57 -0
  42. package/api/theme-edit/_how-question.mjs +2574 -0
  43. package/api/theme-edit/_how.d.mts +27 -8
  44. package/api/theme-edit/_how.mjs +776 -175
  45. package/api/theme-edit/_overview.d.mts +9 -0
  46. package/api/theme-edit/_overview.mjs +296 -0
  47. package/api/theme-edit/_palette.d.mts +155 -15
  48. package/api/theme-edit/_palette.mjs +1446 -262
  49. package/api/theme-edit/_parts.mjs +61 -5
  50. package/api/theme-edit/_png.d.mts +18 -6
  51. package/api/theme-edit/_png.mjs +135 -25
  52. package/api/theme-edit/_preview-app.d.mts +32 -11
  53. package/api/theme-edit/_preview-app.mjs +1976 -285
  54. package/api/theme-edit/_preview.d.mts +39 -8
  55. package/api/theme-edit/_preview.mjs +367 -41
  56. package/api/theme-edit/_settings.d.mts +147 -11
  57. package/api/theme-edit/_settings.mjs +908 -99
  58. package/api/theme-edit/_tables.d.mts +4 -16
  59. package/api/theme-edit/_tables.mjs +51 -117
  60. package/api/theme-edit/theme-edit.type.d.mts +102 -66
  61. package/api/theme-edit/theme-edit.type.mjs +58 -40
  62. package/api/theme-edit/themeEditHow.doc.mjs +17 -6
  63. package/api/theme-edit/themeEditNew.doc.mjs +21 -5
  64. package/api/theme-edit/themeEditPreviewAdd.doc.mjs +18 -5
  65. package/api/theme-edit/themeEditPreviewApp.doc.mjs +12 -9
  66. package/api/theme-edit/themeEditPreviewList.doc.mjs +11 -2
  67. package/api/theme-edit/themeEditPreviewRemove.doc.mjs +29 -3
  68. package/api/theme-edit/themeEditSet.doc.mjs +14 -8
  69. package/api/theme-edit/themeEditShow.doc.mjs +10 -5
  70. package/api/theme-edit/themeEditUndo.doc.mjs +9 -4
  71. package/assets/discover/official-packages.json +4 -0
  72. package/assets/docs/tree/icon-sets.doc.mjs +3 -3
  73. package/assets/docs.generated.json +1 -0
  74. package/assets/icons/definitions/bookmarkAdd.doc.mjs +9 -0
  75. package/assets/icons/definitions/documentSearch.doc.mjs +9 -0
  76. package/assets/icons/definitions/keyboard.doc.mjs +9 -0
  77. package/assets/icons/definitions/paintBrush.doc.mjs +9 -0
  78. package/assets/icons/definitions/wallet.doc.mjs +9 -0
  79. package/assets/preview-app/gitignore +3 -0
  80. package/assets/templates/blocks/components/ButtonGroup/ButtonGroupShowcase.doc.mjs +1 -1
  81. package/assets/templates/blocks/components/Lightbox/LightboxGallery.tsx +1 -1
  82. package/assets/templates/components.generated.json +1 -0
  83. package/assets/templates/pages/gallery-hero/page.tsx +8 -2
  84. package/assets/templates/pages/settings-dialog/template.doc.mjs +3 -3
  85. package/assets/templates/pages/side-gallery/page.tsx +1 -1
  86. package/assets/templates/pages/table-filter/template.doc.mjs +2 -2
  87. package/assets/templates/pages/theme-showcase/template.doc.mjs +1 -1
  88. package/clients/cli/bin/astryx.mjs +37 -5
  89. package/clients/cli/commands/experimental/theme.mjs +422 -57
  90. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +22 -9
  91. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +103 -4
  92. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +13 -8
  93. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +5 -5
  94. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +5 -5
  95. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  96. package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +3 -2
  97. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +2 -8
  98. package/clients/cli/commands/experimental-theme-preview-list.doc.mjs +2 -2
  99. package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +2 -2
  100. package/clients/cli/commands/experimental-theme-targets.doc.mjs +1 -1
  101. package/clients/cli/commands/experimental-theme.doc.mjs +3 -4
  102. package/clients/cli/commands/theme-build.doc.mjs +1 -1
  103. package/clients/cli/commands/theme-eject.doc.mjs +3 -3
  104. package/clients/cli/commands/theme-remove.doc.mjs +2 -2
  105. package/clients/cli/commands/theme-template.doc.mjs +11 -4
  106. package/clients/cli/commands/theme.mjs +145 -46
  107. package/clients/cli/commands.generated.json +1 -0
  108. package/clients/cli/index.mjs +96 -5
  109. package/clients/cli/lib/json-shim.mjs +29 -1
  110. package/foundation/config/project.d.mts +16 -2
  111. package/foundation/config/project.mjs +40 -6
  112. package/foundation/config/theme-state.d.mts +9 -0
  113. package/foundation/config/theme-state.mjs +20 -1
  114. package/foundation/discovery/template-adapter.d.mts +12 -1
  115. package/foundation/discovery/template-adapter.mjs +29 -4
  116. package/foundation/discovery/template-icons.d.mts +13 -0
  117. package/foundation/discovery/template-icons.mjs +76 -0
  118. package/foundation/discovery/template-needs.d.mts +7 -0
  119. package/foundation/discovery/template-needs.mjs +117 -8
  120. package/foundation/discovery/template-source-tree.d.mts +5 -1
  121. package/foundation/discovery/template-source-tree.mjs +6 -4
  122. package/foundation/discovery/theme-discovery.d.mts +14 -3
  123. package/foundation/discovery/theme-discovery.mjs +45 -12
  124. package/foundation/doc-compiler/import.mjs +68 -3
  125. package/foundation/doc-compiler/stored-docs.d.mts +27 -0
  126. package/foundation/doc-compiler/stored-docs.mjs +65 -0
  127. package/foundation/fs/fs-error.d.mts +17 -0
  128. package/foundation/fs/fs-error.mjs +34 -0
  129. package/foundation/response/error-codes.d.mts +3 -1
  130. package/foundation/response/error-codes.doc.mjs +13 -1
  131. package/foundation/response/error-codes.mjs +11 -1
  132. package/foundation/response/response-types.doc.mjs +6 -6
  133. package/package.json +6 -7
  134. package/clients/cli/commands/experimental-theme-palette-generate.doc.mjs +0 -73
  135. package/clients/cli/commands/experimental-theme-palette.doc.mjs +0 -37
@@ -0,0 +1,9 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /** @type {Array<{title: string, tree: Tree}>} */
5
+ export const OVERVIEW_SECTIONS: Array<{
6
+ title: string;
7
+ tree: Tree;
8
+ }>;
9
+ export type Tree = import("./_catalog.mjs").Tree;
@@ -0,0 +1,296 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file The preview's Overview page: a compact page of what themes most
5
+ * often break, so a bad contrast, a clipped label or an unreadable small
6
+ * size shows at once. Long and short text, every text level on every
7
+ * surface, every button variant and size with disabled and loading, inputs
8
+ * in their states, selected navigation, badges and status per status, a
9
+ * striped table with a truncating cell, an open popover, and the smallest
10
+ * and biggest sizes.
11
+ *
12
+ * @input Nothing: fixed element trees with Core names.
13
+ * @output OVERVIEW_SECTIONS, each a title and an element tree.
14
+ * @position api/theme-edit — imported by _preview.mjs
15
+ */
16
+
17
+ /** @typedef {import('./_catalog.mjs').Tree} Tree */
18
+
19
+ /** @param {string} name @param {Record<string, unknown>} [props] @param {...unknown} children @returns {Tree} */
20
+ const h = (name, props = {}, ...children) => ({
21
+ __element: name,
22
+ props,
23
+ ...(children.length ? {children} : {}),
24
+ });
25
+
26
+ const noop = {__code: '() => {}'};
27
+ const STATUSES = ['info', 'success', 'warning', 'error'];
28
+ const LONG =
29
+ 'A long heading that has to wrap onto a second line on most screens, so line height and wrapping show';
30
+
31
+ /** One surface with every text level on it. @param {Record<string, unknown>} props @param {string} name */
32
+ const surface = (props, name) =>
33
+ h(
34
+ 'Card',
35
+ {...props, minHeight: 120},
36
+ h(
37
+ 'VStack',
38
+ {gap: 1},
39
+ h('Text', {type: 'label'}, name),
40
+ h('Text', {type: 'body'}, 'Body text reads on this surface.'),
41
+ h('Text', {type: 'supporting'}, 'Supporting text, the smallest level.'),
42
+ h('Link', {href: '#'}, 'A link'),
43
+ ),
44
+ );
45
+
46
+ const ROWS = [
47
+ {
48
+ id: 1,
49
+ task: 'Review the quarterly roadmap with every team lead before the planning offsite next week',
50
+ owner: 'Alex',
51
+ status: 'In progress',
52
+ },
53
+ {id: 2, task: 'Ship onboarding', owner: 'Sam', status: 'Done'},
54
+ {id: 3, task: 'Fix login timeout', owner: 'Riley', status: 'Blocked'},
55
+ {id: 4, task: 'Audit color contrast', owner: 'Jordan', status: 'Planned'},
56
+ ];
57
+
58
+ /** @type {Array<{title: string, tree: Tree}>} */
59
+ export const OVERVIEW_SECTIONS = [
60
+ {
61
+ title: 'Open layers',
62
+ // First on the page, so the layers open below their anchors on load,
63
+ // into space kept free for them: each anchor's cell keeps room for its
64
+ // layer, so nothing sits under one, side by side or stacked.
65
+ tree: h(
66
+ 'Card',
67
+ {variant: 'transparent'},
68
+ h(
69
+ 'Grid',
70
+ {columns: {minWidth: 280, repeat: 'fit'}, gap: 4},
71
+ h(
72
+ 'Card',
73
+ {variant: 'transparent', minHeight: 150},
74
+ h(
75
+ 'Popover',
76
+ {
77
+ isOpen: true,
78
+ label: 'Menu',
79
+ placement: 'below',
80
+ content: h(
81
+ 'VStack',
82
+ {gap: 1},
83
+ h('Text', {type: 'label'}, 'A popover shown open'),
84
+ h('Button', {label: 'Rename', variant: 'ghost', size: 'sm'}),
85
+ h('Button', {label: 'Delete', variant: 'ghost', size: 'sm'}),
86
+ ),
87
+ },
88
+ h('Button', {label: 'Anchor', variant: 'secondary'}),
89
+ ),
90
+ ),
91
+ h(
92
+ 'Card',
93
+ {variant: 'transparent', minHeight: 150},
94
+ h(
95
+ 'Tooltip',
96
+ {isOpen: true, placement: 'below', content: 'A tooltip shown open'},
97
+ h('Button', {label: 'Tooltip anchor', variant: 'secondary'}),
98
+ ),
99
+ ),
100
+ ),
101
+ ),
102
+ },
103
+ {
104
+ title: 'Type',
105
+ tree: h(
106
+ 'VStack',
107
+ {gap: 2},
108
+ h('Heading', {level: 1, type: 'display-1'}, 'Display'),
109
+ h('Heading', {level: 1}, LONG),
110
+ h('Heading', {level: 2}, 'Heading 2'),
111
+ h('Heading', {level: 3}, 'Heading 3'),
112
+ h('Text', {type: 'large'}, 'Large text for introductions.'),
113
+ h(
114
+ 'Text',
115
+ {type: 'body'},
116
+ 'Body text: the quick brown fox jumps over the lazy dog. Numbers 0123456789.',
117
+ ),
118
+ h('Text', {type: 'label'}, 'Label text'),
119
+ h('Text', {type: 'supporting'}, 'Supporting text, the smallest size'),
120
+ h('Text', {type: 'code'}, 'const code = true;'),
121
+ ),
122
+ },
123
+ {
124
+ title: 'Surfaces',
125
+ tree: h(
126
+ 'Grid',
127
+ {columns: {minWidth: 200, repeat: 'fit'}, gap: 3},
128
+ surface({}, 'Card'),
129
+ surface({variant: 'muted'}, 'Muted card'),
130
+ surface({variant: 'blue'}, 'Colored card'),
131
+ surface({variant: 'transparent'}, 'Page surface'),
132
+ ),
133
+ },
134
+ {
135
+ title: 'Buttons',
136
+ tree: h(
137
+ 'VStack',
138
+ {gap: 2},
139
+ ...['sm', 'md', 'lg'].map(size =>
140
+ h(
141
+ 'HStack',
142
+ {gap: 2, align: 'center', wrap: 'wrap'},
143
+ ...['primary', 'secondary', 'ghost', 'destructive'].map(variant =>
144
+ h('Button', {label: `${variant} ${size}`, variant, size}),
145
+ ),
146
+ ),
147
+ ),
148
+ h(
149
+ 'HStack',
150
+ {gap: 2, align: 'center', wrap: 'wrap'},
151
+ h('Button', {label: 'Disabled', variant: 'primary', isDisabled: true}),
152
+ h('Button', {
153
+ label: 'Disabled',
154
+ variant: 'secondary',
155
+ isDisabled: true,
156
+ }),
157
+ h('Button', {label: 'Loading', variant: 'primary', isLoading: true}),
158
+ h('Button', {
159
+ label: 'A very long button label that must truncate',
160
+ variant: 'secondary',
161
+ width: 180,
162
+ }),
163
+ ),
164
+ ),
165
+ },
166
+ {
167
+ title: 'Inputs',
168
+ tree: h(
169
+ 'Grid',
170
+ {columns: {minWidth: 220, repeat: 'fit'}, gap: 3},
171
+ h('TextInput', {label: 'Default', value: 'Jordan Lee'}),
172
+ h('TextInput', {
173
+ label: 'Placeholder',
174
+ value: '',
175
+ placeholder: 'Type to search',
176
+ }),
177
+ h('TextInput', {
178
+ label: 'Error',
179
+ value: 'not-an-email',
180
+ status: {type: 'error', message: 'Enter a valid email address'},
181
+ }),
182
+ h('TextInput', {label: 'Disabled', value: 'Read only', isDisabled: true}),
183
+ h('Selector', {
184
+ label: 'Selector',
185
+ value: 'week',
186
+ options: [
187
+ {value: 'day', label: 'Day'},
188
+ {value: 'week', label: 'Week'},
189
+ {value: 'month', label: 'Month'},
190
+ ],
191
+ onChange: noop,
192
+ }),
193
+ h(
194
+ 'VStack',
195
+ {gap: 2},
196
+ h('CheckboxInput', {label: 'Checked', value: true, onChange: noop}),
197
+ h('CheckboxInput', {label: 'Unchecked', value: false, onChange: noop}),
198
+ h('Switch', {label: 'On', value: true, onChange: noop}),
199
+ h('Switch', {label: 'Off', value: false, onChange: noop}),
200
+ ),
201
+ h(
202
+ 'RadioList',
203
+ {label: 'Radio', value: 'a', onChange: noop},
204
+ h('RadioListItem', {value: 'a', label: 'Selected'}),
205
+ h('RadioListItem', {value: 'b', label: 'Other'}),
206
+ h('RadioListItem', {value: 'c', label: 'Disabled', isDisabled: true}),
207
+ ),
208
+ ),
209
+ },
210
+ {
211
+ title: 'Navigation',
212
+ tree: h(
213
+ 'VStack',
214
+ {gap: 3},
215
+ h(
216
+ 'TopNav',
217
+ {label: 'Top', heading: 'App'},
218
+ h('TopNavItem', {label: 'Selected', href: '#', isSelected: true}),
219
+ h('TopNavItem', {label: 'Other', href: '#'}),
220
+ h('TopNavItem', {label: 'Another', href: '#'}),
221
+ ),
222
+ h(
223
+ 'TabList',
224
+ {value: 'a'},
225
+ h('Tab', {value: 'a', label: 'Selected tab'}),
226
+ h('Tab', {value: 'b', label: 'Other tab'}),
227
+ h('Tab', {value: 'c', label: 'Third tab'}),
228
+ ),
229
+ h(
230
+ 'SegmentedControl',
231
+ {label: 'Range', value: 'b', onChange: noop},
232
+ h('SegmentedControlItem', {value: 'a', label: 'Day'}),
233
+ h('SegmentedControlItem', {value: 'b', label: 'Week'}),
234
+ h('SegmentedControlItem', {value: 'c', label: 'Month'}),
235
+ ),
236
+ h(
237
+ 'SideNav',
238
+ {label: 'Side'},
239
+ h('SideNavItem', {label: 'Selected item', href: '#', isSelected: true}),
240
+ h('SideNavItem', {label: 'Other item', href: '#'}),
241
+ ),
242
+ ),
243
+ },
244
+ {
245
+ title: 'Status',
246
+ tree: h(
247
+ 'VStack',
248
+ {gap: 3},
249
+ h(
250
+ 'HStack',
251
+ {gap: 2, align: 'center', wrap: 'wrap'},
252
+ h('Badge', {variant: 'neutral', label: 'Neutral'}),
253
+ ...STATUSES.map(s =>
254
+ h('Badge', {variant: s, label: s[0].toUpperCase() + s.slice(1)}),
255
+ ),
256
+ ),
257
+ h(
258
+ 'HStack',
259
+ {gap: 3, align: 'center', wrap: 'wrap'},
260
+ ...['success', 'warning', 'error', 'accent', 'neutral'].map(v =>
261
+ h('StatusDot', {variant: v, label: v}),
262
+ ),
263
+ ),
264
+ ...STATUSES.map(s =>
265
+ h('Banner', {
266
+ status: s,
267
+ title: `A ${s} banner`,
268
+ description: 'Its text must read on its tinted fill.',
269
+ collapsible: false,
270
+ }),
271
+ ),
272
+ h(
273
+ 'HStack',
274
+ {gap: 3, align: 'center'},
275
+ ...['accent', 'success', 'warning', 'error'].map(v =>
276
+ h('ProgressBar', {label: v, variant: v, value: 60, width: 120}),
277
+ ),
278
+ h('Spinner', {size: 'md'}),
279
+ ),
280
+ ),
281
+ },
282
+ {
283
+ title: 'Table',
284
+ tree: h('Table', {
285
+ data: ROWS,
286
+ idKey: 'id',
287
+ dividers: 'rows',
288
+ textOverflow: 'truncate',
289
+ columns: [
290
+ {key: 'task', header: 'Task (truncates)'},
291
+ {key: 'owner', header: 'Owner'},
292
+ {key: 'status', header: 'Status'},
293
+ ],
294
+ }),
295
+ },
296
+ ];
@@ -1,39 +1,123 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
+ /**
5
+ * Write a file whole: a temp file beside it, renamed into place, so a link
6
+ * there is replaced, never written through, and a stopped write leaves the
7
+ * old file. The temp file goes whatever happens.
8
+ * @param {string} file
9
+ * @param {string | Buffer} text
10
+ */
11
+ export function writeWhole(file: string, text: string | Buffer): void;
12
+ /**
13
+ * A temp file beside `file` for a whole write, named so only the editor
14
+ * makes such names: `.<name>.astryx-<pid>-<random>.tmp`. The write that
15
+ * makes one removes it.
16
+ * @param {string} file
17
+ */
18
+ export function tempFor(file: string): string;
4
19
  /** @param {string} slug */
5
20
  export function paletteFiles(slug: string): {
6
21
  config: string;
7
22
  palette: string;
8
23
  receipt: string;
24
+ refs: string;
9
25
  importPath: string;
26
+ refsImportPath: string;
10
27
  };
11
28
  /**
12
- * The seed a color dial value grows from, or null for a value with no fixed
13
- * color (a variable, a keyword, `color-mix()`).
29
+ * The seed a color dial value grows from, or null for a value with no fixed,
30
+ * opaque color (a variable, a keyword, `color-mix()`, a translucent color).
14
31
  * @param {string} value
15
32
  */
16
33
  export function seedOf(value: string): string | null;
17
34
  /**
18
- * The palette config a theme's settings ask for: the existing config, with
19
- * each color dial's family written in place and families the dials no longer
20
- * set removed. Families and fields the editor does not own are kept. Null
21
- * when the config would hold no family.
35
+ * How well citation text (`--color-text-secondary`) reads on the accent
36
+ * tint (`--color-accent-muted`) in the official neutral theme, per mode:
37
+ * both tokens' stops come from its theme source and their colors from its
38
+ * selected palette stops, read from the installed package. Without the
39
+ * package, the same official stops of a plain gray ramp from the
40
+ * generator. Null when neither can be read.
41
+ * @param {Mode} m
42
+ * @returns {number | null}
43
+ */
44
+ export function officialCitation(m: Mode): number | null;
45
+ /**
46
+ * The palette config a theme's settings ask for (see {@link planPalette}),
47
+ * or null when it would hold no family.
22
48
  * @param {string} cwd
23
49
  * @param {string} slug
24
- * @param {import('./_settings.mjs').ThemeData} data
50
+ * @param {{mode?: string, settings: Setting[]}} data
51
+ * @param {{light: Record<string, string>, dark: Record<string, string>}} [base]
25
52
  * @returns {any}
26
53
  */
27
- export function paletteConfig(cwd: string, slug: string, data: import("./_settings.mjs").ThemeData): any;
54
+ export function paletteConfig(cwd: string, slug: string, data: {
55
+ mode?: string;
56
+ settings: Setting[];
57
+ }, base?: {
58
+ light: Record<string, string>;
59
+ dark: Record<string, string>;
60
+ }): any;
28
61
  /**
29
62
  * Write the palette config, palette and receipt the settings ask for, with
30
- * the same generator as `theme palette generate --out`; remove all three
31
- * when no family is left. Files are only rewritten when the config changes.
63
+ * the same generator as `theme palette generate --out`; remove them all
64
+ * when no family is left. The palette is generated again when the config
65
+ * changes, when a file is missing, or when it came from another generator
66
+ * version. A palette edited by hand ({@link paletteEdited}) is never
67
+ * overwritten: a change that would rewrite it is refused with the commands
68
+ * that keep or discard the edit; a change that leaves it alone goes ahead. Gives back what the config writer kept or replaced
69
+ * of a hand edit, for the result notes.
32
70
  * @param {string} cwd
33
71
  * @param {string} slug
34
- * @param {import('./_settings.mjs').ThemeData} data
72
+ * @param {{mode?: string, settings: Setting[], palette?: string}} data
73
+ * `palette`: the hash of the config the editor wrote, kept in the settings
74
+ * @param {{light: Record<string, string>, dark: Record<string, string>}} [base]
75
+ * @returns {string[]}
76
+ */
77
+ export function syncPalette(cwd: string, slug: string, data: {
78
+ mode?: string;
79
+ settings: Setting[];
80
+ palette?: string;
81
+ }, base?: {
82
+ light: Record<string, string>;
83
+ dark: Record<string, string>;
84
+ }): string[];
85
+ /**
86
+ * Whether a theme's palette file was edited by hand: its bytes match no
87
+ * receipt, and, formatting aside, it is not what the generator writes for
88
+ * the request it came from (the receipt's, else the config's). False when
89
+ * there is no palette file.
90
+ * @param {string} cwd
91
+ * @param {string} slug
92
+ */
93
+ export function paletteEdited(cwd: string, slug: string): boolean;
94
+ /**
95
+ * Refuse generated text that still holds a stop placeholder: the CSS would
96
+ * carry it as a value no browser reads.
97
+ * @param {string} file shown in the refusal
98
+ * @param {string} text
99
+ */
100
+ export function assertNoPlaceholder(file: string, text: string): void;
101
+ /**
102
+ * The module of only the stops a generated settings source reads, in the
103
+ * shape `scripts/generate-selected-palette-refs.mjs` gives the official
104
+ * themes, or null when it reads none.
105
+ * @param {string} slug
106
+ * @param {Candidate} candidate
107
+ * @param {string} source
108
+ * @returns {string | null}
35
109
  */
36
- export function syncPalette(cwd: string, slug: string, data: import("./_settings.mjs").ThemeData): void;
110
+ export function paletteRefsSource(slug: string, candidate: Candidate, source: string): string | null;
111
+ /**
112
+ * Write the selected stops module beside the palette for a generated
113
+ * settings source, or remove it when the source reads no stop. A source
114
+ * that still holds a stop placeholder is refused.
115
+ * @param {string} cwd
116
+ * @param {string} slug
117
+ * @param {string} source the generated settings source
118
+ * @param {PaletteMapping | null} pal
119
+ */
120
+ export function syncPaletteRefs(cwd: string, slug: string, source: string, pal: PaletteMapping | null): void;
37
121
  /**
38
122
  * The colors and token mapping of a theme's palette, or null when it sets no
39
123
  * color dial. Reads the config the settings ask for and runs the generator
@@ -56,15 +140,19 @@ export function paletteMapping(cwd: string, slug: string, data: import("./_setti
56
140
  */
57
141
  export function mappingRows(dial: string): string[];
58
142
  /**
59
- * What one color dial did, for the result notes: where its palette lives,
60
- * the stop of its main token in each mode, and every token contrast moved.
143
+ * What one color dial did, for the result notes: what its main token uses
144
+ * in each mode, every token contrast moved, and last the generated files.
145
+ * What the config writer kept or replaced of a hand edit comes from the
146
+ * build ({@link syncPalette}).
61
147
  * @param {PaletteMapping | null} pal
62
148
  * @param {string} dial
63
149
  * @param {string} slug
150
+ * @param {Mode[]} [modes] the modes the theme has
64
151
  * @returns {string[]}
65
152
  */
66
- export function paletteNotes(pal: PaletteMapping | null, dial: string, slug: string): string[];
153
+ export function paletteNotes(pal: PaletteMapping | null, dial: string, slug: string, modes?: Mode[]): string[];
67
154
  /** @typedef {'light' | 'dark'} Mode */
155
+ /** @typedef {import('./_settings.mjs').Setting} Setting */
68
156
  /** @typedef {import('../theme/theme.type.mjs').TonalPaletteCandidate} Candidate */
69
157
  /**
70
158
  * One token pointed at a palette stop in each mode.
@@ -72,6 +160,8 @@ export function paletteNotes(pal: PaletteMapping | null, dial: string, slug: str
72
160
  * @property {number} stop
73
161
  * @property {string} color - The stop's color, with `alpha` appended when set.
74
162
  * @property {string} [alpha] - Two hex digits of opacity.
163
+ * @property {string} [family] - The family the stop is from when it is not the token's own: `neutral` for text on a fill, or `black` / `white`, the palette's own ends.
164
+ * @property {boolean} [exact] - The stop holds the seed's exact color (an exact anchor).
75
165
  */
76
166
  /**
77
167
  * One contrast check behind a stop choice.
@@ -84,6 +174,7 @@ export function paletteNotes(pal: PaletteMapping | null, dial: string, slug: str
84
174
  * @property {number} ratio - The lowest ratio over everything it was measured on.
85
175
  * @property {number} needs
86
176
  * @property {boolean} pass
177
+ * @property {string} [note] - The whole sentence to report, when the check is not a plain stop move.
87
178
  */
88
179
  /**
89
180
  * The palette mapping of a theme.
@@ -92,11 +183,36 @@ export function paletteNotes(pal: PaletteMapping | null, dial: string, slug: str
92
183
  * @property {Array<{id: string, dial: string, seed: string, value: string}>} families
93
184
  * @property {Record<string, {family: string, light: StopRef, dark: StopRef}>} tokens
94
185
  * @property {ContrastCheck[]} contrast
186
+ * @property {number} vibrancy - The generator's vibrancy, 0 to 100.
187
+ * @property {Record<string, Partial<Record<Mode, string>>>} exact - Main tokens the theme sets exactly, the value per mode: the dial's fill gives way to them.
188
+ * @property {string[]} notes - What the config writer kept or replaced of a hand edit.
95
189
  */
96
190
  /** The color dials. Each one is a palette family of the same id. */
97
191
  export const PALETTE_DIALS: string[];
192
+ /** The generator's vibrancy when the theme sets none. */
193
+ export const VIBRANCY_DEFAULT: 50;
98
194
  export function paletteToken(dial: string): string;
195
+ export function paletteImport(slug: string): string;
196
+ export function isGraySeed(seed: string | null): boolean;
197
+ /** Every token a color dial can point at a generated shade. */
198
+ export const PALETTE_TOKENS: Set<string>;
199
+ /**
200
+ * What the config writer decided: the config, what it kept or replaced of
201
+ * a hand edit, and for each accent or status color the stop of its exact
202
+ * color and whether dark mode holds it too (why not, when not).
203
+ */
204
+ export type PalettePlan = {
205
+ config: any;
206
+ notes: string[];
207
+ fills: Record<string, {
208
+ stop: number;
209
+ dark: boolean;
210
+ why: string;
211
+ ratio: number;
212
+ }>;
213
+ };
99
214
  export type Mode = "light" | "dark";
215
+ export type Setting = import("./_settings.mjs").Setting;
100
216
  export type Candidate = import("../theme/theme.type.mjs").TonalPaletteCandidate;
101
217
  /**
102
218
  * One token pointed at a palette stop in each mode.
@@ -111,6 +227,14 @@ export type StopRef = {
111
227
  * - Two hex digits of opacity.
112
228
  */
113
229
  alpha?: string | undefined;
230
+ /**
231
+ * - The family the stop is from when it is not the token's own: `neutral` for text on a fill, or `black` / `white`, the palette's own ends.
232
+ */
233
+ family?: string | undefined;
234
+ /**
235
+ * - The stop holds the seed's exact color (an exact anchor).
236
+ */
237
+ exact?: boolean | undefined;
114
238
  };
115
239
  /**
116
240
  * One contrast check behind a stop choice.
@@ -133,6 +257,10 @@ export type ContrastCheck = {
133
257
  ratio: number;
134
258
  needs: number;
135
259
  pass: boolean;
260
+ /**
261
+ * - The whole sentence to report, when the check is not a plain stop move.
262
+ */
263
+ note?: string | undefined;
136
264
  };
137
265
  /**
138
266
  * The palette mapping of a theme.
@@ -151,4 +279,16 @@ export type PaletteMapping = {
151
279
  dark: StopRef;
152
280
  }>;
153
281
  contrast: ContrastCheck[];
282
+ /**
283
+ * - The generator's vibrancy, 0 to 100.
284
+ */
285
+ vibrancy: number;
286
+ /**
287
+ * - Main tokens the theme sets exactly, the value per mode: the dial's fill gives way to them.
288
+ */
289
+ exact: Record<string, Partial<Record<Mode, string>>>;
290
+ /**
291
+ * - What the config writer kept or replaced of a hand edit.
292
+ */
293
+ notes: string[];
154
294
  };