@yamada-ui/cli 1.0.5 → 1.0.6-dev-20240724114656
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 +4 -6
- package/dist/command/tokens/create-theme-typings.js +10 -18
- package/dist/command/tokens/index.js +14 -26
- package/dist/command/tokens/resolve-output-path.js +3 -6
- package/dist/index.js +4671 -12981
- package/dist/utils/cli.js +4668 -12964
- package/dist/utils/index.js +4703 -13000
- package/dist/utils/object.js +1 -2
- package/package.json +6 -6
|
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// ../../node_modules/.pnpm/tsup@8.
|
|
33
|
+
// ../../node_modules/.pnpm/tsup@8.2.2_@swc+core@1.7.1_tsx@4.16.2_typescript@5.5.4/node_modules/tsup/assets/cjs_shims.js
|
|
34
34
|
var init_cjs_shims = __esm({
|
|
35
|
-
"../../node_modules/.pnpm/tsup@8.
|
|
35
|
+
"../../node_modules/.pnpm/tsup@8.2.2_@swc+core@1.7.1_tsx@4.16.2_typescript@5.5.4/node_modules/tsup/assets/cjs_shims.js"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
}
|
|
38
38
|
});
|
|
@@ -595,8 +595,7 @@ var actionColors = async (color, { name, out }) => {
|
|
|
595
595
|
s.start(`Computing the color`);
|
|
596
596
|
const contents = generateTones(color);
|
|
597
597
|
let result = contents;
|
|
598
|
-
if (name)
|
|
599
|
-
result = { [name]: result };
|
|
598
|
+
if (name) result = { [name]: result };
|
|
600
599
|
let data = await prettier(JSON.stringify(result), { parser: "json" });
|
|
601
600
|
if (name)
|
|
602
601
|
data = data.replace(/^{/, "").replace(/}\s+$/, "").replace(/\s+}/g, "\n}");
|
|
@@ -610,8 +609,7 @@ var actionColors = async (color, { name, out }) => {
|
|
|
610
609
|
const end = process.hrtime.bigint();
|
|
611
610
|
const duration = (Number(end - start) / 1e9).toFixed(2);
|
|
612
611
|
p.outro(source_default.green(`Done in ${duration}s${!out ? "\n" : ""}`));
|
|
613
|
-
if (out)
|
|
614
|
-
console.log(data.trim(), "\n");
|
|
612
|
+
if (out) console.log(data.trim(), "\n");
|
|
615
613
|
} catch (e) {
|
|
616
614
|
s.stop(`An error occurred`, 500);
|
|
617
615
|
p.cancel(source_default.red(e instanceof Error ? e.message : "Message is missing"));
|
|
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// ../../node_modules/.pnpm/tsup@8.
|
|
33
|
+
// ../../node_modules/.pnpm/tsup@8.2.2_@swc+core@1.7.1_tsx@4.16.2_typescript@5.5.4/node_modules/tsup/assets/cjs_shims.js
|
|
34
34
|
var init_cjs_shims = __esm({
|
|
35
|
-
"../../node_modules/.pnpm/tsup@8.
|
|
35
|
+
"../../node_modules/.pnpm/tsup@8.2.2_@swc+core@1.7.1_tsx@4.16.2_typescript@5.5.4/node_modules/tsup/assets/cjs_shims.js"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
}
|
|
38
38
|
});
|
|
@@ -82,8 +82,7 @@ init_cjs_shims();
|
|
|
82
82
|
var omitObject = (obj, keys) => {
|
|
83
83
|
const result = {};
|
|
84
84
|
Object.keys(obj).forEach((key) => {
|
|
85
|
-
if (keys.includes(key))
|
|
86
|
-
return;
|
|
85
|
+
if (keys.includes(key)) return;
|
|
87
86
|
result[key] = obj[key];
|
|
88
87
|
});
|
|
89
88
|
return result;
|
|
@@ -159,8 +158,7 @@ var extractTransitions = (theme) => {
|
|
|
159
158
|
return { transitionProperty, transitionDuration, transitionEasing };
|
|
160
159
|
};
|
|
161
160
|
var isTone = (value) => {
|
|
162
|
-
if (!isObject(value))
|
|
163
|
-
return false;
|
|
161
|
+
if (!isObject(value)) return false;
|
|
164
162
|
const keys = Object.keys(value);
|
|
165
163
|
return tones.every((key) => keys.includes(key.toString()));
|
|
166
164
|
};
|
|
@@ -170,15 +168,12 @@ var extractColorSchemes = (theme) => {
|
|
|
170
168
|
colorSchemes: [],
|
|
171
169
|
colorSchemeColors: []
|
|
172
170
|
};
|
|
173
|
-
if (!isObject(colors))
|
|
174
|
-
return results;
|
|
171
|
+
if (!isObject(colors)) return results;
|
|
175
172
|
Object.entries(colors).forEach(([key, value]) => {
|
|
176
|
-
if (!isTone(value))
|
|
177
|
-
return;
|
|
173
|
+
if (!isTone(value)) return;
|
|
178
174
|
results.colorSchemes.push(key);
|
|
179
175
|
const semanticKeys = Object.entries(semantics?.colorSchemes ?? {}).filter(([, relatedKey]) => key === relatedKey).map(([key2]) => key2) ?? [];
|
|
180
|
-
if (!semanticKeys.length)
|
|
181
|
-
return;
|
|
176
|
+
if (!semanticKeys.length) return;
|
|
182
177
|
results.colorSchemes.push(...semanticKeys);
|
|
183
178
|
results.colorSchemeColors.push(
|
|
184
179
|
...semanticKeys.map(
|
|
@@ -190,13 +185,11 @@ var extractColorSchemes = (theme) => {
|
|
|
190
185
|
};
|
|
191
186
|
var extractThemeSchemes = (theme) => {
|
|
192
187
|
const { themeSchemes } = theme;
|
|
193
|
-
if (!isObject(themeSchemes))
|
|
194
|
-
return ["base"];
|
|
188
|
+
if (!isObject(themeSchemes)) return ["base"];
|
|
195
189
|
return ["base", ...Object.keys(themeSchemes)];
|
|
196
190
|
};
|
|
197
191
|
var extractPaths = (target, maxDepth = 3, omitKeys = []) => {
|
|
198
|
-
if (!isObject(target) && !isArray(target) || !maxDepth)
|
|
199
|
-
return [];
|
|
192
|
+
if (!isObject(target) && !isArray(target) || !maxDepth) return [];
|
|
200
193
|
return Object.entries(target).reduce((array, [key, value]) => {
|
|
201
194
|
if (isObject(value) && !Object.keys(value).some((key2) => omitKeys.includes(key2))) {
|
|
202
195
|
extractPaths(value, maxDepth - 1, omitKeys).forEach(
|
|
@@ -211,8 +204,7 @@ var extractPaths = (target, maxDepth = 3, omitKeys = []) => {
|
|
|
211
204
|
var extractKeys = (theme, key) => {
|
|
212
205
|
const keys = key.split(".");
|
|
213
206
|
const property = keys.reduce((obj, key2) => obj[key2] ?? {}, theme);
|
|
214
|
-
if (!isObject(property))
|
|
215
|
-
return [];
|
|
207
|
+
if (!isObject(property)) return [];
|
|
216
208
|
return Object.keys(property);
|
|
217
209
|
};
|
|
218
210
|
var createThemeTypings = async (theme) => {
|
|
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// ../../node_modules/.pnpm/tsup@8.
|
|
33
|
+
// ../../node_modules/.pnpm/tsup@8.2.2_@swc+core@1.7.1_tsx@4.16.2_typescript@5.5.4/node_modules/tsup/assets/cjs_shims.js
|
|
34
34
|
var init_cjs_shims = __esm({
|
|
35
|
-
"../../node_modules/.pnpm/tsup@8.
|
|
35
|
+
"../../node_modules/.pnpm/tsup@8.2.2_@swc+core@1.7.1_tsx@4.16.2_typescript@5.5.4/node_modules/tsup/assets/cjs_shims.js"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
}
|
|
38
38
|
});
|
|
@@ -580,8 +580,7 @@ init_cjs_shims();
|
|
|
580
580
|
var omitObject = (obj, keys) => {
|
|
581
581
|
const result = {};
|
|
582
582
|
Object.keys(obj).forEach((key) => {
|
|
583
|
-
if (keys.includes(key))
|
|
584
|
-
return;
|
|
583
|
+
if (keys.includes(key)) return;
|
|
585
584
|
result[key] = obj[key];
|
|
586
585
|
});
|
|
587
586
|
return result;
|
|
@@ -657,8 +656,7 @@ var extractTransitions = (theme) => {
|
|
|
657
656
|
return { transitionProperty, transitionDuration, transitionEasing };
|
|
658
657
|
};
|
|
659
658
|
var isTone = (value) => {
|
|
660
|
-
if (!isObject(value))
|
|
661
|
-
return false;
|
|
659
|
+
if (!isObject(value)) return false;
|
|
662
660
|
const keys = Object.keys(value);
|
|
663
661
|
return tones.every((key) => keys.includes(key.toString()));
|
|
664
662
|
};
|
|
@@ -668,15 +666,12 @@ var extractColorSchemes = (theme) => {
|
|
|
668
666
|
colorSchemes: [],
|
|
669
667
|
colorSchemeColors: []
|
|
670
668
|
};
|
|
671
|
-
if (!isObject(colors))
|
|
672
|
-
return results;
|
|
669
|
+
if (!isObject(colors)) return results;
|
|
673
670
|
Object.entries(colors).forEach(([key, value]) => {
|
|
674
|
-
if (!isTone(value))
|
|
675
|
-
return;
|
|
671
|
+
if (!isTone(value)) return;
|
|
676
672
|
results.colorSchemes.push(key);
|
|
677
673
|
const semanticKeys = Object.entries(semantics?.colorSchemes ?? {}).filter(([, relatedKey]) => key === relatedKey).map(([key2]) => key2) ?? [];
|
|
678
|
-
if (!semanticKeys.length)
|
|
679
|
-
return;
|
|
674
|
+
if (!semanticKeys.length) return;
|
|
680
675
|
results.colorSchemes.push(...semanticKeys);
|
|
681
676
|
results.colorSchemeColors.push(
|
|
682
677
|
...semanticKeys.map(
|
|
@@ -688,13 +683,11 @@ var extractColorSchemes = (theme) => {
|
|
|
688
683
|
};
|
|
689
684
|
var extractThemeSchemes = (theme) => {
|
|
690
685
|
const { themeSchemes } = theme;
|
|
691
|
-
if (!isObject(themeSchemes))
|
|
692
|
-
return ["base"];
|
|
686
|
+
if (!isObject(themeSchemes)) return ["base"];
|
|
693
687
|
return ["base", ...Object.keys(themeSchemes)];
|
|
694
688
|
};
|
|
695
689
|
var extractPaths = (target, maxDepth = 3, omitKeys = []) => {
|
|
696
|
-
if (!isObject(target) && !isArray(target) || !maxDepth)
|
|
697
|
-
return [];
|
|
690
|
+
if (!isObject(target) && !isArray(target) || !maxDepth) return [];
|
|
698
691
|
return Object.entries(target).reduce((array, [key, value]) => {
|
|
699
692
|
if (isObject(value) && !Object.keys(value).some((key2) => omitKeys.includes(key2))) {
|
|
700
693
|
extractPaths(value, maxDepth - 1, omitKeys).forEach(
|
|
@@ -709,8 +702,7 @@ var extractPaths = (target, maxDepth = 3, omitKeys = []) => {
|
|
|
709
702
|
var extractKeys = (theme, key) => {
|
|
710
703
|
const keys = key.split(".");
|
|
711
704
|
const property = keys.reduce((obj, key2) => obj[key2] ?? {}, theme);
|
|
712
|
-
if (!isObject(property))
|
|
713
|
-
return [];
|
|
705
|
+
if (!isObject(property)) return [];
|
|
714
706
|
return Object.keys(property);
|
|
715
707
|
};
|
|
716
708
|
var createThemeTypings = async (theme) => {
|
|
@@ -784,19 +776,16 @@ var resolveThemePath = async () => {
|
|
|
784
776
|
const triedPaths = await Promise.all(
|
|
785
777
|
paths.map(async (possiblePath) => {
|
|
786
778
|
const paths2 = await (0, import_glob.glob)(possiblePath);
|
|
787
|
-
if (paths2.length)
|
|
788
|
-
return paths2[0];
|
|
779
|
+
if (paths2.length) return paths2[0];
|
|
789
780
|
return "";
|
|
790
781
|
})
|
|
791
782
|
);
|
|
792
783
|
const resolvedPath = triedPaths.find(Boolean);
|
|
793
|
-
if (!resolvedPath)
|
|
794
|
-
return;
|
|
784
|
+
if (!resolvedPath) return;
|
|
795
785
|
return import_path2.default.resolve(process.cwd(), resolvedPath);
|
|
796
786
|
};
|
|
797
787
|
var resolveOutputPath = async (outPath) => {
|
|
798
|
-
if (outPath)
|
|
799
|
-
return import_path2.default.resolve(process.cwd(), outPath);
|
|
788
|
+
if (outPath) return import_path2.default.resolve(process.cwd(), outPath);
|
|
800
789
|
const themePath2 = await resolveThemePath();
|
|
801
790
|
if (!themePath2)
|
|
802
791
|
throw new Error(
|
|
@@ -842,8 +831,7 @@ var actionTokens = async (themeFile, { out: outFile, watch: watchFile }) => {
|
|
|
842
831
|
let file = await readFile();
|
|
843
832
|
const buildFile = async () => {
|
|
844
833
|
await generateThemeTypings({ theme: file.theme, outFile });
|
|
845
|
-
if (watchFile)
|
|
846
|
-
console.log("\n", "\u231B\uFE0F Watching for changes...");
|
|
834
|
+
if (watchFile) console.log("\n", "\u231B\uFE0F Watching for changes...");
|
|
847
835
|
};
|
|
848
836
|
if (watchFile) {
|
|
849
837
|
const watchPath = typeof watchFile === "string" ? watchFile : file.dependencies;
|
|
@@ -53,19 +53,16 @@ var resolveThemePath = async () => {
|
|
|
53
53
|
const triedPaths = await Promise.all(
|
|
54
54
|
paths.map(async (possiblePath) => {
|
|
55
55
|
const paths2 = await (0, import_glob.glob)(possiblePath);
|
|
56
|
-
if (paths2.length)
|
|
57
|
-
return paths2[0];
|
|
56
|
+
if (paths2.length) return paths2[0];
|
|
58
57
|
return "";
|
|
59
58
|
})
|
|
60
59
|
);
|
|
61
60
|
const resolvedPath = triedPaths.find(Boolean);
|
|
62
|
-
if (!resolvedPath)
|
|
63
|
-
return;
|
|
61
|
+
if (!resolvedPath) return;
|
|
64
62
|
return import_path.default.resolve(process.cwd(), resolvedPath);
|
|
65
63
|
};
|
|
66
64
|
var resolveOutputPath = async (outPath) => {
|
|
67
|
-
if (outPath)
|
|
68
|
-
return import_path.default.resolve(process.cwd(), outPath);
|
|
65
|
+
if (outPath) return import_path.default.resolve(process.cwd(), outPath);
|
|
69
66
|
const themePath2 = await resolveThemePath();
|
|
70
67
|
if (!themePath2)
|
|
71
68
|
throw new Error(
|