@yamada-ui/cli 1.1.1-dev-20240814141847 → 1.1.1-dev-20240814145914

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.
@@ -557,6 +557,7 @@ init_cjs_shims();
557
557
 
558
558
  // src/utils/assertion.ts
559
559
  init_cjs_shims();
560
+ var isString = (value) => Object.prototype.toString.call(value) === "[object String]";
560
561
  var isObject = (obj) => obj !== null && (typeof obj === "object" || typeof obj === "function") && !isArray(obj);
561
562
  var isArray = (value) => Array.isArray(value);
562
563
 
@@ -674,14 +675,20 @@ var extractColorSchemes = (theme) => {
674
675
  Object.entries(colors).forEach(([key, value]) => {
675
676
  if (!isTone(value)) return;
676
677
  results.colorSchemes.push(key);
677
- const semanticKeys = Object.entries(semantics?.colorSchemes ?? {}).filter(([, relatedKey]) => key === relatedKey).map(([key2]) => key2) ?? [];
678
- if (!semanticKeys.length) return;
679
- results.colorSchemes.push(...semanticKeys);
680
- results.colorSchemeColors.push(
681
- ...semanticKeys.map(
682
- (semanticKey) => Object.keys(value).map((hue) => `${semanticKey}.${hue}`)
683
- ).flat()
684
- );
678
+ });
679
+ if (!isObject(semantics?.colorSchemes)) return results;
680
+ Object.entries(semantics.colorSchemes).forEach(([key, value]) => {
681
+ if (isTone(value)) {
682
+ results.colorSchemes.push(key);
683
+ results.colorSchemeColors.push(...tones.map((tone) => `${key}.${tone}`));
684
+ } else {
685
+ const hasColorScheme = isArray(value) ? value.every(
686
+ (key2) => isString(key2) && Object.keys(colors).includes(key2)
687
+ ) : Object.keys(colors).some((key2) => key2 === value);
688
+ if (!hasColorScheme) return;
689
+ results.colorSchemes.push(key);
690
+ results.colorSchemeColors.push(...tones.map((tone) => `${key}.${tone}`));
691
+ }
685
692
  });
686
693
  return results;
687
694
  };
@@ -55,6 +55,7 @@ init_cjs_shims();
55
55
 
56
56
  // src/utils/assertion.ts
57
57
  init_cjs_shims();
58
+ var isString = (value) => Object.prototype.toString.call(value) === "[object String]";
58
59
  var isObject = (obj) => obj !== null && (typeof obj === "object" || typeof obj === "function") && !isArray(obj);
59
60
  var isArray = (value) => Array.isArray(value);
60
61
 
@@ -172,14 +173,20 @@ var extractColorSchemes = (theme) => {
172
173
  Object.entries(colors).forEach(([key, value]) => {
173
174
  if (!isTone(value)) return;
174
175
  results.colorSchemes.push(key);
175
- const semanticKeys = Object.entries(semantics?.colorSchemes ?? {}).filter(([, relatedKey]) => key === relatedKey).map(([key2]) => key2) ?? [];
176
- if (!semanticKeys.length) return;
177
- results.colorSchemes.push(...semanticKeys);
178
- results.colorSchemeColors.push(
179
- ...semanticKeys.map(
180
- (semanticKey) => Object.keys(value).map((hue) => `${semanticKey}.${hue}`)
181
- ).flat()
182
- );
176
+ });
177
+ if (!isObject(semantics?.colorSchemes)) return results;
178
+ Object.entries(semantics.colorSchemes).forEach(([key, value]) => {
179
+ if (isTone(value)) {
180
+ results.colorSchemes.push(key);
181
+ results.colorSchemeColors.push(...tones.map((tone) => `${key}.${tone}`));
182
+ } else {
183
+ const hasColorScheme = isArray(value) ? value.every(
184
+ (key2) => isString(key2) && Object.keys(colors).includes(key2)
185
+ ) : Object.keys(colors).some((key2) => key2 === value);
186
+ if (!hasColorScheme) return;
187
+ results.colorSchemes.push(key);
188
+ results.colorSchemeColors.push(...tones.map((tone) => `${key}.${tone}`));
189
+ }
183
190
  });
184
191
  return results;
185
192
  };
@@ -553,6 +553,7 @@ init_cjs_shims();
553
553
 
554
554
  // src/utils/assertion.ts
555
555
  init_cjs_shims();
556
+ var isString = (value) => Object.prototype.toString.call(value) === "[object String]";
556
557
  var isObject = (obj) => obj !== null && (typeof obj === "object" || typeof obj === "function") && !isArray(obj);
557
558
  var isArray = (value) => Array.isArray(value);
558
559
 
@@ -670,14 +671,20 @@ var extractColorSchemes = (theme) => {
670
671
  Object.entries(colors).forEach(([key, value]) => {
671
672
  if (!isTone(value)) return;
672
673
  results.colorSchemes.push(key);
673
- const semanticKeys = Object.entries(semantics?.colorSchemes ?? {}).filter(([, relatedKey]) => key === relatedKey).map(([key2]) => key2) ?? [];
674
- if (!semanticKeys.length) return;
675
- results.colorSchemes.push(...semanticKeys);
676
- results.colorSchemeColors.push(
677
- ...semanticKeys.map(
678
- (semanticKey) => Object.keys(value).map((hue) => `${semanticKey}.${hue}`)
679
- ).flat()
680
- );
674
+ });
675
+ if (!isObject(semantics?.colorSchemes)) return results;
676
+ Object.entries(semantics.colorSchemes).forEach(([key, value]) => {
677
+ if (isTone(value)) {
678
+ results.colorSchemes.push(key);
679
+ results.colorSchemeColors.push(...tones.map((tone) => `${key}.${tone}`));
680
+ } else {
681
+ const hasColorScheme = isArray(value) ? value.every(
682
+ (key2) => isString(key2) && Object.keys(colors).includes(key2)
683
+ ) : Object.keys(colors).some((key2) => key2 === value);
684
+ if (!hasColorScheme) return;
685
+ results.colorSchemes.push(key);
686
+ results.colorSchemeColors.push(...tones.map((tone) => `${key}.${tone}`));
687
+ }
681
688
  });
682
689
  return results;
683
690
  };
package/dist/index.js CHANGED
@@ -4701,7 +4701,7 @@ var require_util = __commonJS({
4701
4701
  const typeList = [].concat(types[key]);
4702
4702
  const isPath = typeList.indexOf(path14) !== -1;
4703
4703
  const isBool = typeList.indexOf(Boolean) !== -1;
4704
- const isString2 = typeList.indexOf(String) !== -1;
4704
+ const isString3 = typeList.indexOf(String) !== -1;
4705
4705
  const isNumber = typeList.indexOf(Number) !== -1;
4706
4706
  field = `${field}`.trim();
4707
4707
  if (/^".*"$/.test(field)) {
@@ -4711,7 +4711,7 @@ var require_util = __commonJS({
4711
4711
  throw new Error(`Failed parsing JSON config key ${key}: ${field}`);
4712
4712
  }
4713
4713
  }
4714
- if (isBool && !isString2 && field === "") {
4714
+ if (isBool && !isString3 && field === "") {
4715
4715
  return true;
4716
4716
  }
4717
4717
  switch (field) {
@@ -6428,6 +6428,7 @@ init_cjs_shims();
6428
6428
 
6429
6429
  // src/utils/assertion.ts
6430
6430
  init_cjs_shims();
6431
+ var isString = (value) => Object.prototype.toString.call(value) === "[object String]";
6431
6432
  var isObject = (obj) => obj !== null && (typeof obj === "object" || typeof obj === "function") && !isArray(obj);
6432
6433
  var isArray = (value) => Array.isArray(value);
6433
6434
 
@@ -6708,7 +6709,7 @@ init_cjs_shims();
6708
6709
  var isException = (value) => {
6709
6710
  return value instanceof Error && "code" in value;
6710
6711
  };
6711
- var isString = (value) => {
6712
+ var isString2 = (value) => {
6712
6713
  return typeof value === "string";
6713
6714
  };
6714
6715
  var isUndefined = (value) => {
@@ -6845,7 +6846,7 @@ var temp_default = Temp;
6845
6846
 
6846
6847
  // ../../node_modules/.pnpm/atomically@2.0.3/node_modules/atomically/dist/index.js
6847
6848
  function writeFileSync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
6848
- if (isString(options))
6849
+ if (isString2(options))
6849
6850
  return writeFileSync(filePath, data, { encoding: options });
6850
6851
  const timeout2 = Date.now() + ((options.timeout ?? DEFAULT_TIMEOUT_SYNC) || -1);
6851
6852
  let tempDisposer = null;
@@ -6881,7 +6882,7 @@ function writeFileSync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
6881
6882
  if (options.tmpCreated) {
6882
6883
  options.tmpCreated(tempPath);
6883
6884
  }
6884
- if (isString(data)) {
6885
+ if (isString2(data)) {
6885
6886
  dist_default.retry.writeSync(timeout2)(fd, data, 0, options.encoding || DEFAULT_ENCODING);
6886
6887
  } else if (!isUndefined(data)) {
6887
6888
  dist_default.retry.writeSync(timeout2)(fd, data, 0, data.length, 0);
@@ -9185,14 +9186,20 @@ var extractColorSchemes = (theme) => {
9185
9186
  Object.entries(colors).forEach(([key, value]) => {
9186
9187
  if (!isTone(value)) return;
9187
9188
  results.colorSchemes.push(key);
9188
- const semanticKeys = Object.entries(semantics?.colorSchemes ?? {}).filter(([, relatedKey]) => key === relatedKey).map(([key2]) => key2) ?? [];
9189
- if (!semanticKeys.length) return;
9190
- results.colorSchemes.push(...semanticKeys);
9191
- results.colorSchemeColors.push(
9192
- ...semanticKeys.map(
9193
- (semanticKey) => Object.keys(value).map((hue) => `${semanticKey}.${hue}`)
9194
- ).flat()
9195
- );
9189
+ });
9190
+ if (!isObject(semantics?.colorSchemes)) return results;
9191
+ Object.entries(semantics.colorSchemes).forEach(([key, value]) => {
9192
+ if (isTone(value)) {
9193
+ results.colorSchemes.push(key);
9194
+ results.colorSchemeColors.push(...tones.map((tone) => `${key}.${tone}`));
9195
+ } else {
9196
+ const hasColorScheme = isArray(value) ? value.every(
9197
+ (key2) => isString(key2) && Object.keys(colors).includes(key2)
9198
+ ) : Object.keys(colors).some((key2) => key2 === value);
9199
+ if (!hasColorScheme) return;
9200
+ results.colorSchemes.push(key);
9201
+ results.colorSchemeColors.push(...tones.map((tone) => `${key}.${tone}`));
9202
+ }
9196
9203
  });
9197
9204
  return results;
9198
9205
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamada-ui/cli",
3
- "version": "1.1.1-dev-20240814141847",
3
+ "version": "1.1.1-dev-20240814145914",
4
4
  "description": "Generate theme tokens for autocomplete",
5
5
  "keywords": [
6
6
  "theme",