@yamada-ui/cli 0.9.0 → 1.0.0
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/tokens/create-theme-typings.js +28 -19
- package/dist/command/tokens/index.js +28 -19
- package/dist/index.js +30 -20
- package/dist/utils/cli.js +2 -1
- package/dist/utils/index.js +2 -1
- package/package.json +2 -1
|
@@ -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,
|
|
@@ -661,19 +661,27 @@ var isHue = (value) => {
|
|
|
661
661
|
};
|
|
662
662
|
var extractColorSchemes = (theme) => {
|
|
663
663
|
const { colors, semantics } = theme;
|
|
664
|
+
const results = {
|
|
665
|
+
colorSchemes: [],
|
|
666
|
+
colorSchemeColors: []
|
|
667
|
+
};
|
|
664
668
|
if (!isObject(colors))
|
|
665
|
-
return
|
|
666
|
-
|
|
669
|
+
return results;
|
|
670
|
+
Object.entries(colors).forEach(([key, value]) => {
|
|
667
671
|
if (!isHue(value))
|
|
668
|
-
return
|
|
669
|
-
|
|
670
|
-
const
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
672
|
+
return;
|
|
673
|
+
results.colorSchemes.push(key);
|
|
674
|
+
const semanticKeys = Object.entries(semantics?.colorSchemes ?? {}).filter(([, relatedKey]) => key === relatedKey).map(([key2]) => key2) ?? [];
|
|
675
|
+
if (!semanticKeys.length)
|
|
676
|
+
return;
|
|
677
|
+
results.colorSchemes.push(...semanticKeys);
|
|
678
|
+
results.colorSchemeColors.push(
|
|
679
|
+
...semanticKeys.map(
|
|
680
|
+
(semanticKey) => Object.keys(value).map((hue) => `${semanticKey}.${hue}`)
|
|
681
|
+
).flat()
|
|
682
|
+
);
|
|
683
|
+
});
|
|
684
|
+
return results;
|
|
677
685
|
};
|
|
678
686
|
var extractThemeSchemes = (theme) => {
|
|
679
687
|
const { themeSchemes } = theme;
|
|
@@ -703,8 +711,8 @@ var extractKeys = (theme, key) => {
|
|
|
703
711
|
return Object.keys(property);
|
|
704
712
|
};
|
|
705
713
|
var createThemeTypings = async (theme) => {
|
|
706
|
-
const
|
|
707
|
-
(
|
|
714
|
+
const tokens = config.reduce(
|
|
715
|
+
(prev, {
|
|
708
716
|
key,
|
|
709
717
|
maxScanDepth,
|
|
710
718
|
omitScanKeys,
|
|
@@ -712,33 +720,34 @@ var createThemeTypings = async (theme) => {
|
|
|
712
720
|
flatMap = (value) => value
|
|
713
721
|
}) => {
|
|
714
722
|
const target = theme[key];
|
|
715
|
-
|
|
723
|
+
prev[key] = [];
|
|
716
724
|
if (isObject(target) || isArray(target)) {
|
|
717
|
-
|
|
725
|
+
prev[key] = extractPaths(target, maxScanDepth, omitScanKeys).filter(filter).flatMap(flatMap);
|
|
718
726
|
}
|
|
719
727
|
if (isObject(theme.semantics)) {
|
|
720
728
|
const semanticKeys = extractKeys(
|
|
721
729
|
omitObject(theme.semantics, ["colorSchemes"]),
|
|
722
730
|
key
|
|
723
731
|
).filter(filter).flatMap(flatMap);
|
|
724
|
-
|
|
732
|
+
prev[key].push(...semanticKeys);
|
|
725
733
|
}
|
|
726
|
-
return
|
|
734
|
+
return prev;
|
|
727
735
|
},
|
|
728
736
|
{}
|
|
729
737
|
);
|
|
730
738
|
const textStyles = extractKeys(theme, "styles.textStyles");
|
|
731
739
|
const layerStyles = extractKeys(theme, "styles.layerStyles");
|
|
732
|
-
const colorSchemes = extractColorSchemes(theme);
|
|
740
|
+
const { colorSchemes, colorSchemeColors } = extractColorSchemes(theme);
|
|
733
741
|
const themeSchemes = extractThemeSchemes(theme);
|
|
734
742
|
const { transitionProperty, transitionDuration, transitionEasing } = extractTransitions(theme);
|
|
735
743
|
const componentTypes = extractComponents(theme);
|
|
744
|
+
tokens.colors = [...tokens.colors, ...colorSchemeColors];
|
|
736
745
|
return prettier(
|
|
737
746
|
`import type { UITheme } from './ui-theme.types'
|
|
738
747
|
|
|
739
748
|
export interface GeneratedTheme extends UITheme { ${print(
|
|
740
749
|
{
|
|
741
|
-
...
|
|
750
|
+
...tokens,
|
|
742
751
|
textStyles,
|
|
743
752
|
layerStyles,
|
|
744
753
|
colorSchemes,
|
package/dist/index.js
CHANGED
|
@@ -17478,7 +17478,7 @@ function updateNotifier(options) {
|
|
|
17478
17478
|
// package.json
|
|
17479
17479
|
var package_default = {
|
|
17480
17480
|
name: "@yamada-ui/cli",
|
|
17481
|
-
version: "0.
|
|
17481
|
+
version: "1.0.0",
|
|
17482
17482
|
description: "Generate theme tokens for autocomplete",
|
|
17483
17483
|
keywords: [
|
|
17484
17484
|
"theme",
|
|
@@ -17501,6 +17501,7 @@ var package_default = {
|
|
|
17501
17501
|
publishConfig: {
|
|
17502
17502
|
access: "public"
|
|
17503
17503
|
},
|
|
17504
|
+
homepage: "https://yamada-ui.com",
|
|
17504
17505
|
repository: {
|
|
17505
17506
|
type: "git",
|
|
17506
17507
|
url: "git+https://github.com/hirotomoyamada/yamada-ui",
|
|
@@ -17720,19 +17721,27 @@ var isHue = (value) => {
|
|
|
17720
17721
|
};
|
|
17721
17722
|
var extractColorSchemes = (theme) => {
|
|
17722
17723
|
const { colors, semantics } = theme;
|
|
17724
|
+
const results = {
|
|
17725
|
+
colorSchemes: [],
|
|
17726
|
+
colorSchemeColors: []
|
|
17727
|
+
};
|
|
17723
17728
|
if (!isObject(colors))
|
|
17724
|
-
return
|
|
17725
|
-
|
|
17729
|
+
return results;
|
|
17730
|
+
Object.entries(colors).forEach(([key, value]) => {
|
|
17726
17731
|
if (!isHue(value))
|
|
17727
|
-
return
|
|
17728
|
-
|
|
17729
|
-
const
|
|
17730
|
-
|
|
17731
|
-
|
|
17732
|
-
|
|
17733
|
-
|
|
17734
|
-
|
|
17735
|
-
|
|
17732
|
+
return;
|
|
17733
|
+
results.colorSchemes.push(key);
|
|
17734
|
+
const semanticKeys = Object.entries(semantics?.colorSchemes ?? {}).filter(([, relatedKey]) => key === relatedKey).map(([key2]) => key2) ?? [];
|
|
17735
|
+
if (!semanticKeys.length)
|
|
17736
|
+
return;
|
|
17737
|
+
results.colorSchemes.push(...semanticKeys);
|
|
17738
|
+
results.colorSchemeColors.push(
|
|
17739
|
+
...semanticKeys.map(
|
|
17740
|
+
(semanticKey) => Object.keys(value).map((hue) => `${semanticKey}.${hue}`)
|
|
17741
|
+
).flat()
|
|
17742
|
+
);
|
|
17743
|
+
});
|
|
17744
|
+
return results;
|
|
17736
17745
|
};
|
|
17737
17746
|
var extractThemeSchemes = (theme) => {
|
|
17738
17747
|
const { themeSchemes } = theme;
|
|
@@ -17762,8 +17771,8 @@ var extractKeys = (theme, key) => {
|
|
|
17762
17771
|
return Object.keys(property);
|
|
17763
17772
|
};
|
|
17764
17773
|
var createThemeTypings = async (theme) => {
|
|
17765
|
-
const
|
|
17766
|
-
(
|
|
17774
|
+
const tokens = config.reduce(
|
|
17775
|
+
(prev, {
|
|
17767
17776
|
key,
|
|
17768
17777
|
maxScanDepth,
|
|
17769
17778
|
omitScanKeys,
|
|
@@ -17771,33 +17780,34 @@ var createThemeTypings = async (theme) => {
|
|
|
17771
17780
|
flatMap = (value) => value
|
|
17772
17781
|
}) => {
|
|
17773
17782
|
const target = theme[key];
|
|
17774
|
-
|
|
17783
|
+
prev[key] = [];
|
|
17775
17784
|
if (isObject(target) || isArray(target)) {
|
|
17776
|
-
|
|
17785
|
+
prev[key] = extractPaths(target, maxScanDepth, omitScanKeys).filter(filter).flatMap(flatMap);
|
|
17777
17786
|
}
|
|
17778
17787
|
if (isObject(theme.semantics)) {
|
|
17779
17788
|
const semanticKeys = extractKeys(
|
|
17780
17789
|
omitObject(theme.semantics, ["colorSchemes"]),
|
|
17781
17790
|
key
|
|
17782
17791
|
).filter(filter).flatMap(flatMap);
|
|
17783
|
-
|
|
17792
|
+
prev[key].push(...semanticKeys);
|
|
17784
17793
|
}
|
|
17785
|
-
return
|
|
17794
|
+
return prev;
|
|
17786
17795
|
},
|
|
17787
17796
|
{}
|
|
17788
17797
|
);
|
|
17789
17798
|
const textStyles = extractKeys(theme, "styles.textStyles");
|
|
17790
17799
|
const layerStyles = extractKeys(theme, "styles.layerStyles");
|
|
17791
|
-
const colorSchemes = extractColorSchemes(theme);
|
|
17800
|
+
const { colorSchemes, colorSchemeColors } = extractColorSchemes(theme);
|
|
17792
17801
|
const themeSchemes = extractThemeSchemes(theme);
|
|
17793
17802
|
const { transitionProperty, transitionDuration, transitionEasing } = extractTransitions(theme);
|
|
17794
17803
|
const componentTypes = extractComponents(theme);
|
|
17804
|
+
tokens.colors = [...tokens.colors, ...colorSchemeColors];
|
|
17795
17805
|
return prettier(
|
|
17796
17806
|
`import type { UITheme } from './ui-theme.types'
|
|
17797
17807
|
|
|
17798
17808
|
export interface GeneratedTheme extends UITheme { ${print(
|
|
17799
17809
|
{
|
|
17800
|
-
...
|
|
17810
|
+
...tokens,
|
|
17801
17811
|
textStyles,
|
|
17802
17812
|
layerStyles,
|
|
17803
17813
|
colorSchemes,
|
package/dist/utils/cli.js
CHANGED
|
@@ -17461,7 +17461,7 @@ function updateNotifier(options) {
|
|
|
17461
17461
|
// package.json
|
|
17462
17462
|
var package_default = {
|
|
17463
17463
|
name: "@yamada-ui/cli",
|
|
17464
|
-
version: "0.
|
|
17464
|
+
version: "1.0.0",
|
|
17465
17465
|
description: "Generate theme tokens for autocomplete",
|
|
17466
17466
|
keywords: [
|
|
17467
17467
|
"theme",
|
|
@@ -17484,6 +17484,7 @@ var package_default = {
|
|
|
17484
17484
|
publishConfig: {
|
|
17485
17485
|
access: "public"
|
|
17486
17486
|
},
|
|
17487
|
+
homepage: "https://yamada-ui.com",
|
|
17487
17488
|
repository: {
|
|
17488
17489
|
type: "git",
|
|
17489
17490
|
url: "git+https://github.com/hirotomoyamada/yamada-ui",
|
package/dist/utils/index.js
CHANGED
|
@@ -17487,7 +17487,7 @@ function updateNotifier(options) {
|
|
|
17487
17487
|
// package.json
|
|
17488
17488
|
var package_default = {
|
|
17489
17489
|
name: "@yamada-ui/cli",
|
|
17490
|
-
version: "0.
|
|
17490
|
+
version: "1.0.0",
|
|
17491
17491
|
description: "Generate theme tokens for autocomplete",
|
|
17492
17492
|
keywords: [
|
|
17493
17493
|
"theme",
|
|
@@ -17510,6 +17510,7 @@ var package_default = {
|
|
|
17510
17510
|
publishConfig: {
|
|
17511
17511
|
access: "public"
|
|
17512
17512
|
},
|
|
17513
|
+
homepage: "https://yamada-ui.com",
|
|
17513
17514
|
repository: {
|
|
17514
17515
|
type: "git",
|
|
17515
17516
|
url: "git+https://github.com/hirotomoyamada/yamada-ui",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yamada-ui/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Generate theme tokens for autocomplete",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"publishConfig": {
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
|
+
"homepage": "https://yamada-ui.com",
|
|
26
27
|
"repository": {
|
|
27
28
|
"type": "git",
|
|
28
29
|
"url": "git+https://github.com/hirotomoyamada/yamada-ui",
|