@yamada-ui/cli 0.8.2 → 0.9.1
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/dist/command/colors/index.js +54 -5887
- package/dist/command/tokens/create-theme-typings.js +28 -19
- package/dist/command/tokens/index.js +73 -5899
- package/dist/index.js +3108 -8611
- package/dist/utils/cli.js +4 -3
- package/dist/utils/index.js +4 -3
- package/package.json +3 -2
|
@@ -153,19 +153,27 @@ var isHue = (value) => {
|
|
|
153
153
|
};
|
|
154
154
|
var extractColorSchemes = (theme) => {
|
|
155
155
|
const { colors, semantics } = theme;
|
|
156
|
+
const results = {
|
|
157
|
+
colorSchemes: [],
|
|
158
|
+
colorSchemeColors: []
|
|
159
|
+
};
|
|
156
160
|
if (!isObject(colors))
|
|
157
|
-
return
|
|
158
|
-
|
|
161
|
+
return results;
|
|
162
|
+
Object.entries(colors).forEach(([key, value]) => {
|
|
159
163
|
if (!isHue(value))
|
|
160
|
-
return
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
164
|
+
return;
|
|
165
|
+
results.colorSchemes.push(key);
|
|
166
|
+
const semanticKeys = Object.entries(semantics?.colorSchemes ?? {}).filter(([, relatedKey]) => key === relatedKey).map(([key2]) => key2) ?? [];
|
|
167
|
+
if (!semanticKeys.length)
|
|
168
|
+
return;
|
|
169
|
+
results.colorSchemes.push(...semanticKeys);
|
|
170
|
+
results.colorSchemeColors.push(
|
|
171
|
+
...semanticKeys.map(
|
|
172
|
+
(semanticKey) => Object.keys(value).map((hue) => `${semanticKey}.${hue}`)
|
|
173
|
+
).flat()
|
|
174
|
+
);
|
|
175
|
+
});
|
|
176
|
+
return results;
|
|
169
177
|
};
|
|
170
178
|
var extractThemeSchemes = (theme) => {
|
|
171
179
|
const { themeSchemes } = theme;
|
|
@@ -195,8 +203,8 @@ var extractKeys = (theme, key) => {
|
|
|
195
203
|
return Object.keys(property);
|
|
196
204
|
};
|
|
197
205
|
var createThemeTypings = async (theme) => {
|
|
198
|
-
const
|
|
199
|
-
(
|
|
206
|
+
const tokens = config.reduce(
|
|
207
|
+
(prev, {
|
|
200
208
|
key,
|
|
201
209
|
maxScanDepth,
|
|
202
210
|
omitScanKeys,
|
|
@@ -204,33 +212,34 @@ var createThemeTypings = async (theme) => {
|
|
|
204
212
|
flatMap = (value) => value
|
|
205
213
|
}) => {
|
|
206
214
|
const target = theme[key];
|
|
207
|
-
|
|
215
|
+
prev[key] = [];
|
|
208
216
|
if (isObject(target) || isArray(target)) {
|
|
209
|
-
|
|
217
|
+
prev[key] = extractPaths(target, maxScanDepth, omitScanKeys).filter(filter).flatMap(flatMap);
|
|
210
218
|
}
|
|
211
219
|
if (isObject(theme.semantics)) {
|
|
212
220
|
const semanticKeys = extractKeys(
|
|
213
221
|
omitObject(theme.semantics, ["colorSchemes"]),
|
|
214
222
|
key
|
|
215
223
|
).filter(filter).flatMap(flatMap);
|
|
216
|
-
|
|
224
|
+
prev[key].push(...semanticKeys);
|
|
217
225
|
}
|
|
218
|
-
return
|
|
226
|
+
return prev;
|
|
219
227
|
},
|
|
220
228
|
{}
|
|
221
229
|
);
|
|
222
230
|
const textStyles = extractKeys(theme, "styles.textStyles");
|
|
223
231
|
const layerStyles = extractKeys(theme, "styles.layerStyles");
|
|
224
|
-
const colorSchemes = extractColorSchemes(theme);
|
|
232
|
+
const { colorSchemes, colorSchemeColors } = extractColorSchemes(theme);
|
|
225
233
|
const themeSchemes = extractThemeSchemes(theme);
|
|
226
234
|
const { transitionProperty, transitionDuration, transitionEasing } = extractTransitions(theme);
|
|
227
235
|
const componentTypes = extractComponents(theme);
|
|
236
|
+
tokens.colors = [...tokens.colors, ...colorSchemeColors];
|
|
228
237
|
return prettier(
|
|
229
238
|
`import type { UITheme } from './ui-theme.types'
|
|
230
239
|
|
|
231
240
|
export interface GeneratedTheme extends UITheme { ${print(
|
|
232
241
|
{
|
|
233
|
-
...
|
|
242
|
+
...tokens,
|
|
234
243
|
textStyles,
|
|
235
244
|
layerStyles,
|
|
236
245
|
colorSchemes,
|