@yamada-ui/cli 0.8.0 → 0.8.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/README.md CHANGED
@@ -36,7 +36,7 @@ pnpm yamada-cli token <path/to/your/theme.(js|ts)>
36
36
 
37
37
  Wouldn't you like to contribute? That's amazing! We have prepared a [contribution guide](https://github.com/hirotomoyamada/yamada-ui/blob/main/CONTRIBUTING.md) to assist you.
38
38
 
39
- ## Licence
39
+ ## License
40
40
 
41
41
  This package is licensed under the terms of the
42
42
  [MIT license](https://github.com/hirotomoyamada/yamada-ui/blob/main/LICENSE).
@@ -6395,18 +6395,22 @@ var prettier = async (content, options) => {
6395
6395
  };
6396
6396
 
6397
6397
  // src/command/colors/index.ts
6398
- var toneColor = (color, hue) => {
6399
- const coef = 0.75;
6398
+ var toneColor = (color, hue, lCoef, dCoef) => {
6399
+ const coef = hue < 500 ? lCoef : dCoef;
6400
6400
  const amount = (500 - hue) * 1e-3 * coef;
6401
6401
  return (0, import_color2k.toHex)((0, import_color2k.lighten)(color, amount));
6402
6402
  };
6403
6403
  var hues = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
6404
- var actionColors = async (color, { name }) => {
6404
+ var actionColors = async (color, { name, coef }) => {
6405
6405
  const spinner = ora("Generating Hue colors").start();
6406
6406
  try {
6407
6407
  const start = process.hrtime.bigint();
6408
+ const [lCoef, dCoef] = coef?.split(",").map((v) => Number(v.trim())) ?? [
6409
+ 0.94,
6410
+ 0.86
6411
+ ];
6408
6412
  let result = hues.reduce((prev, hue) => {
6409
- prev[hue] = toneColor(color, hue);
6413
+ prev[hue] = toneColor(color, hue, lCoef, dCoef);
6410
6414
  return prev;
6411
6415
  }, {});
6412
6416
  if (name) {
@@ -3650,14 +3650,14 @@ var require_async_iterator = __commonJS({
3650
3650
  };
3651
3651
  }
3652
3652
  function readAndResolve(iter) {
3653
- var resolve2 = iter[kLastResolve];
3654
- if (resolve2 !== null) {
3653
+ var resolve = iter[kLastResolve];
3654
+ if (resolve !== null) {
3655
3655
  var data = iter[kStream].read();
3656
3656
  if (data !== null) {
3657
3657
  iter[kLastPromise] = null;
3658
3658
  iter[kLastResolve] = null;
3659
3659
  iter[kLastReject] = null;
3660
- resolve2(createIterResult(data, false));
3660
+ resolve(createIterResult(data, false));
3661
3661
  }
3662
3662
  }
3663
3663
  }
@@ -3665,13 +3665,13 @@ var require_async_iterator = __commonJS({
3665
3665
  process.nextTick(readAndResolve, iter);
3666
3666
  }
3667
3667
  function wrapForNext(lastPromise, iter) {
3668
- return function(resolve2, reject) {
3668
+ return function(resolve, reject) {
3669
3669
  lastPromise.then(function() {
3670
3670
  if (iter[kEnded]) {
3671
- resolve2(createIterResult(void 0, true));
3671
+ resolve(createIterResult(void 0, true));
3672
3672
  return;
3673
3673
  }
3674
- iter[kHandlePromise](resolve2, reject);
3674
+ iter[kHandlePromise](resolve, reject);
3675
3675
  }, reject);
3676
3676
  };
3677
3677
  }
@@ -3691,12 +3691,12 @@ var require_async_iterator = __commonJS({
3691
3691
  return Promise.resolve(createIterResult(void 0, true));
3692
3692
  }
3693
3693
  if (this[kStream].destroyed) {
3694
- return new Promise(function(resolve2, reject) {
3694
+ return new Promise(function(resolve, reject) {
3695
3695
  process.nextTick(function() {
3696
3696
  if (_this[kError]) {
3697
3697
  reject(_this[kError]);
3698
3698
  } else {
3699
- resolve2(createIterResult(void 0, true));
3699
+ resolve(createIterResult(void 0, true));
3700
3700
  }
3701
3701
  });
3702
3702
  });
@@ -3719,13 +3719,13 @@ var require_async_iterator = __commonJS({
3719
3719
  return this;
3720
3720
  }), _defineProperty(_Object$setPrototypeO, "return", function _return() {
3721
3721
  var _this2 = this;
3722
- return new Promise(function(resolve2, reject) {
3722
+ return new Promise(function(resolve, reject) {
3723
3723
  _this2[kStream].destroy(null, function(err) {
3724
3724
  if (err) {
3725
3725
  reject(err);
3726
3726
  return;
3727
3727
  }
3728
- resolve2(createIterResult(void 0, true));
3728
+ resolve(createIterResult(void 0, true));
3729
3729
  });
3730
3730
  });
3731
3731
  }), _Object$setPrototypeO), AsyncIteratorPrototype);
@@ -3747,15 +3747,15 @@ var require_async_iterator = __commonJS({
3747
3747
  value: stream._readableState.endEmitted,
3748
3748
  writable: true
3749
3749
  }), _defineProperty(_Object$create, kHandlePromise, {
3750
- value: function value(resolve2, reject) {
3750
+ value: function value(resolve, reject) {
3751
3751
  var data = iterator[kStream].read();
3752
3752
  if (data) {
3753
3753
  iterator[kLastPromise] = null;
3754
3754
  iterator[kLastResolve] = null;
3755
3755
  iterator[kLastReject] = null;
3756
- resolve2(createIterResult(data, false));
3756
+ resolve(createIterResult(data, false));
3757
3757
  } else {
3758
- iterator[kLastResolve] = resolve2;
3758
+ iterator[kLastResolve] = resolve;
3759
3759
  iterator[kLastReject] = reject;
3760
3760
  }
3761
3761
  },
@@ -3774,12 +3774,12 @@ var require_async_iterator = __commonJS({
3774
3774
  iterator[kError] = err;
3775
3775
  return;
3776
3776
  }
3777
- var resolve2 = iterator[kLastResolve];
3778
- if (resolve2 !== null) {
3777
+ var resolve = iterator[kLastResolve];
3778
+ if (resolve !== null) {
3779
3779
  iterator[kLastPromise] = null;
3780
3780
  iterator[kLastResolve] = null;
3781
3781
  iterator[kLastReject] = null;
3782
- resolve2(createIterResult(void 0, true));
3782
+ resolve(createIterResult(void 0, true));
3783
3783
  }
3784
3784
  iterator[kEnded] = true;
3785
3785
  });
@@ -3795,7 +3795,7 @@ var require_from = __commonJS({
3795
3795
  "../../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/from.js"(exports, module2) {
3796
3796
  "use strict";
3797
3797
  init_cjs_shims();
3798
- function asyncGeneratorStep(gen, resolve2, reject, _next, _throw, key, arg) {
3798
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
3799
3799
  try {
3800
3800
  var info = gen[key](arg);
3801
3801
  var value = info.value;
@@ -3804,7 +3804,7 @@ var require_from = __commonJS({
3804
3804
  return;
3805
3805
  }
3806
3806
  if (info.done) {
3807
- resolve2(value);
3807
+ resolve(value);
3808
3808
  } else {
3809
3809
  Promise.resolve(value).then(_next, _throw);
3810
3810
  }
@@ -3812,13 +3812,13 @@ var require_from = __commonJS({
3812
3812
  function _asyncToGenerator(fn) {
3813
3813
  return function() {
3814
3814
  var self2 = this, args = arguments;
3815
- return new Promise(function(resolve2, reject) {
3815
+ return new Promise(function(resolve, reject) {
3816
3816
  var gen = fn.apply(self2, args);
3817
3817
  function _next(value) {
3818
- asyncGeneratorStep(gen, resolve2, reject, _next, _throw, "next", value);
3818
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
3819
3819
  }
3820
3820
  function _throw(err) {
3821
- asyncGeneratorStep(gen, resolve2, reject, _next, _throw, "throw", err);
3821
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
3822
3822
  }
3823
3823
  _next(void 0);
3824
3824
  });
@@ -5351,8 +5351,10 @@ __export(tokens_exports, {
5351
5351
  });
5352
5352
  module.exports = __toCommonJS(tokens_exports);
5353
5353
  init_cjs_shims();
5354
- var import_fs2 = require("fs");
5355
- var import_util2 = require("util");
5354
+ var import_promises = require("fs/promises");
5355
+ var import_path2 = __toESM(require("path"));
5356
+ var import_bundle_n_require = require("bundle-n-require");
5357
+ var import_chokidar = __toESM(require("chokidar"));
5356
5358
 
5357
5359
  // ../../node_modules/.pnpm/ora@7.0.1/node_modules/ora/index.js
5358
5360
  init_cjs_shims();
@@ -6379,50 +6381,6 @@ function ora(options) {
6379
6381
  return new Ora(options);
6380
6382
  }
6381
6383
 
6382
- // src/command/tokens/resolve-output-path.ts
6383
- init_cjs_shims();
6384
- var import_fs = __toESM(require("fs"));
6385
- var import_path = __toESM(require("path"));
6386
- var import_util = require("util");
6387
- var exists = (0, import_util.promisify)(import_fs.default.exists);
6388
- var themePath = [
6389
- "node_modules",
6390
- "@yamada-ui",
6391
- "core",
6392
- "dist",
6393
- "generated-theme.types.d.ts"
6394
- ];
6395
- var resolveThemePath = async () => {
6396
- const basePath = import_path.default.join("..", "..", "..");
6397
- const rootPath = process.cwd();
6398
- const paths = [
6399
- import_path.default.resolve(basePath, "..", ...themePath),
6400
- import_path.default.resolve(basePath, "..", "..", ...themePath),
6401
- import_path.default.resolve(rootPath, ...themePath),
6402
- import_path.default.resolve(rootPath, "..", ...themePath),
6403
- import_path.default.resolve(rootPath, "..", "..", ...themePath)
6404
- ];
6405
- const triedPaths = await Promise.all(
6406
- paths.map(async (possiblePath) => {
6407
- const isExist = await exists(possiblePath);
6408
- if (isExist)
6409
- return possiblePath;
6410
- return "";
6411
- })
6412
- );
6413
- return triedPaths.find(Boolean);
6414
- };
6415
- var resolveOutputPath = async (outPath) => {
6416
- if (outPath)
6417
- return import_path.default.resolve(process.cwd(), outPath);
6418
- const themePath2 = await resolveThemePath();
6419
- if (!themePath2)
6420
- throw new Error(
6421
- "Could not find @yamada-ui/core in node_modules. Please provide `--out` parameter."
6422
- );
6423
- return themePath2;
6424
- };
6425
-
6426
6384
  // src/command/tokens/create-theme-typings.ts
6427
6385
  init_cjs_shims();
6428
6386
 
@@ -6626,11 +6584,47 @@ export interface GeneratedTheme extends UITheme { ${print(
6626
6584
  );
6627
6585
  };
6628
6586
 
6587
+ // src/command/tokens/resolve-output-path.ts
6588
+ init_cjs_shims();
6589
+ var import_path = __toESM(require("path"));
6590
+ var import_glob = require("glob");
6591
+ var themePath = [
6592
+ "node_modules",
6593
+ "@yamada-ui",
6594
+ "core",
6595
+ "dist",
6596
+ "generated-theme.types.d.ts"
6597
+ ];
6598
+ var resolveThemePath = async () => {
6599
+ const paths = [
6600
+ import_path.default.join("node_modules", ".pnpm", "@yamada-ui+core@*", ...themePath),
6601
+ import_path.default.join(...themePath)
6602
+ ];
6603
+ const triedPaths = await Promise.all(
6604
+ paths.map(async (possiblePath) => {
6605
+ const paths2 = await (0, import_glob.glob)(possiblePath);
6606
+ if (paths2.length)
6607
+ return paths2[0];
6608
+ return "";
6609
+ })
6610
+ );
6611
+ const resolvedPath = triedPaths.find(Boolean);
6612
+ if (!resolvedPath)
6613
+ return;
6614
+ return import_path.default.resolve(process.cwd(), resolvedPath);
6615
+ };
6616
+ var resolveOutputPath = async (outPath) => {
6617
+ if (outPath)
6618
+ return import_path.default.resolve(process.cwd(), outPath);
6619
+ const themePath2 = await resolveThemePath();
6620
+ if (!themePath2)
6621
+ throw new Error(
6622
+ "Could not find @yamada-ui/core in node_modules. Please provide `--out` parameter."
6623
+ );
6624
+ return themePath2;
6625
+ };
6626
+
6629
6627
  // src/command/tokens/index.ts
6630
- var path2 = __toESM(require("path"));
6631
- var import_bundle_n_require = require("bundle-n-require");
6632
- var import_chokidar = __toESM(require("chokidar"));
6633
- var writeFileAsync = (0, import_util2.promisify)(import_fs2.writeFile);
6634
6628
  var generateThemeTypings = async ({
6635
6629
  theme,
6636
6630
  outFile
@@ -6642,7 +6636,7 @@ var generateThemeTypings = async ({
6642
6636
  const outPath = await resolveOutputPath(outFile);
6643
6637
  spinner.info();
6644
6638
  spinner.text = `Write file "${outPath}"...`;
6645
- await writeFileAsync(outPath, generatedTheme, "utf8");
6639
+ await (0, import_promises.writeFile)(outPath, generatedTheme, "utf8");
6646
6640
  const end = process.hrtime.bigint();
6647
6641
  const duration = (Number(end - start) / 1e9).toFixed(2);
6648
6642
  spinner.succeed(`Done in ${duration}s
@@ -6657,7 +6651,7 @@ var generateThemeTypings = async ({
6657
6651
  };
6658
6652
  var actionTokens = async (themeFile, { out: outFile, watch: watchFile }) => {
6659
6653
  const readFile = async () => {
6660
- const filePath = path2.resolve(themeFile);
6654
+ const filePath = import_path2.default.resolve(themeFile);
6661
6655
  const { mod: theme, dependencies } = await (0, import_bundle_n_require.bundleNRequire)(filePath);
6662
6656
  return { theme, dependencies };
6663
6657
  };
@@ -34,10 +34,8 @@ __export(resolve_output_path_exports, {
34
34
  themePath: () => themePath
35
35
  });
36
36
  module.exports = __toCommonJS(resolve_output_path_exports);
37
- var import_fs = __toESM(require("fs"));
38
37
  var import_path = __toESM(require("path"));
39
- var import_util = require("util");
40
- var exists = (0, import_util.promisify)(import_fs.default.exists);
38
+ var import_glob = require("glob");
41
39
  var themePath = [
42
40
  "node_modules",
43
41
  "@yamada-ui",
@@ -46,24 +44,22 @@ var themePath = [
46
44
  "generated-theme.types.d.ts"
47
45
  ];
48
46
  var resolveThemePath = async () => {
49
- const basePath = import_path.default.join("..", "..", "..");
50
- const rootPath = process.cwd();
51
47
  const paths = [
52
- import_path.default.resolve(basePath, "..", ...themePath),
53
- import_path.default.resolve(basePath, "..", "..", ...themePath),
54
- import_path.default.resolve(rootPath, ...themePath),
55
- import_path.default.resolve(rootPath, "..", ...themePath),
56
- import_path.default.resolve(rootPath, "..", "..", ...themePath)
48
+ import_path.default.join("node_modules", ".pnpm", "@yamada-ui+core@*", ...themePath),
49
+ import_path.default.join(...themePath)
57
50
  ];
58
51
  const triedPaths = await Promise.all(
59
52
  paths.map(async (possiblePath) => {
60
- const isExist = await exists(possiblePath);
61
- if (isExist)
62
- return possiblePath;
53
+ const paths2 = await (0, import_glob.glob)(possiblePath);
54
+ if (paths2.length)
55
+ return paths2[0];
63
56
  return "";
64
57
  })
65
58
  );
66
- return triedPaths.find(Boolean);
59
+ const resolvedPath = triedPaths.find(Boolean);
60
+ if (!resolvedPath)
61
+ return;
62
+ return import_path.default.resolve(process.cwd(), resolvedPath);
67
63
  };
68
64
  var resolveOutputPath = async (outPath) => {
69
65
  if (outPath)