@yamada-ui/cli 0.9.0 → 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.
@@ -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
- return Object.entries(colors).reduce((array, [key, value]) => {
161
+ return results;
162
+ Object.entries(colors).forEach(([key, value]) => {
159
163
  if (!isHue(value))
160
- return array;
161
- array.push(key);
162
- const [semanticKey] = Object.entries(semantics?.colorSchemes ?? {}).find(
163
- ([, relatedKey]) => key === relatedKey
164
- ) ?? [];
165
- if (semanticKey)
166
- array.push(semanticKey);
167
- return array;
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 unions = config.reduce(
199
- (obj, {
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
- obj[key] = [];
215
+ prev[key] = [];
208
216
  if (isObject(target) || isArray(target)) {
209
- obj[key] = extractPaths(target, maxScanDepth, omitScanKeys).filter(filter).flatMap(flatMap);
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
- obj[key].push(...semanticKeys);
224
+ prev[key].push(...semanticKeys);
217
225
  }
218
- return obj;
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
- ...unions,
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
- return Object.entries(colors).reduce((array, [key, value]) => {
669
+ return results;
670
+ Object.entries(colors).forEach(([key, value]) => {
667
671
  if (!isHue(value))
668
- return array;
669
- array.push(key);
670
- const [semanticKey] = Object.entries(semantics?.colorSchemes ?? {}).find(
671
- ([, relatedKey]) => key === relatedKey
672
- ) ?? [];
673
- if (semanticKey)
674
- array.push(semanticKey);
675
- return array;
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 unions = config.reduce(
707
- (obj, {
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
- obj[key] = [];
723
+ prev[key] = [];
716
724
  if (isObject(target) || isArray(target)) {
717
- obj[key] = extractPaths(target, maxScanDepth, omitScanKeys).filter(filter).flatMap(flatMap);
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
- obj[key].push(...semanticKeys);
732
+ prev[key].push(...semanticKeys);
725
733
  }
726
- return obj;
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
- ...unions,
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.9.0",
17481
+ version: "0.9.1",
17482
17482
  description: "Generate theme tokens for autocomplete",
17483
17483
  keywords: [
17484
17484
  "theme",
@@ -17720,19 +17720,27 @@ var isHue = (value) => {
17720
17720
  };
17721
17721
  var extractColorSchemes = (theme) => {
17722
17722
  const { colors, semantics } = theme;
17723
+ const results = {
17724
+ colorSchemes: [],
17725
+ colorSchemeColors: []
17726
+ };
17723
17727
  if (!isObject(colors))
17724
- return [];
17725
- return Object.entries(colors).reduce((array, [key, value]) => {
17728
+ return results;
17729
+ Object.entries(colors).forEach(([key, value]) => {
17726
17730
  if (!isHue(value))
17727
- return array;
17728
- array.push(key);
17729
- const [semanticKey] = Object.entries(semantics?.colorSchemes ?? {}).find(
17730
- ([, relatedKey]) => key === relatedKey
17731
- ) ?? [];
17732
- if (semanticKey)
17733
- array.push(semanticKey);
17734
- return array;
17735
- }, []);
17731
+ return;
17732
+ results.colorSchemes.push(key);
17733
+ const semanticKeys = Object.entries(semantics?.colorSchemes ?? {}).filter(([, relatedKey]) => key === relatedKey).map(([key2]) => key2) ?? [];
17734
+ if (!semanticKeys.length)
17735
+ return;
17736
+ results.colorSchemes.push(...semanticKeys);
17737
+ results.colorSchemeColors.push(
17738
+ ...semanticKeys.map(
17739
+ (semanticKey) => Object.keys(value).map((hue) => `${semanticKey}.${hue}`)
17740
+ ).flat()
17741
+ );
17742
+ });
17743
+ return results;
17736
17744
  };
17737
17745
  var extractThemeSchemes = (theme) => {
17738
17746
  const { themeSchemes } = theme;
@@ -17762,8 +17770,8 @@ var extractKeys = (theme, key) => {
17762
17770
  return Object.keys(property);
17763
17771
  };
17764
17772
  var createThemeTypings = async (theme) => {
17765
- const unions = config.reduce(
17766
- (obj, {
17773
+ const tokens = config.reduce(
17774
+ (prev, {
17767
17775
  key,
17768
17776
  maxScanDepth,
17769
17777
  omitScanKeys,
@@ -17771,33 +17779,34 @@ var createThemeTypings = async (theme) => {
17771
17779
  flatMap = (value) => value
17772
17780
  }) => {
17773
17781
  const target = theme[key];
17774
- obj[key] = [];
17782
+ prev[key] = [];
17775
17783
  if (isObject(target) || isArray(target)) {
17776
- obj[key] = extractPaths(target, maxScanDepth, omitScanKeys).filter(filter).flatMap(flatMap);
17784
+ prev[key] = extractPaths(target, maxScanDepth, omitScanKeys).filter(filter).flatMap(flatMap);
17777
17785
  }
17778
17786
  if (isObject(theme.semantics)) {
17779
17787
  const semanticKeys = extractKeys(
17780
17788
  omitObject(theme.semantics, ["colorSchemes"]),
17781
17789
  key
17782
17790
  ).filter(filter).flatMap(flatMap);
17783
- obj[key].push(...semanticKeys);
17791
+ prev[key].push(...semanticKeys);
17784
17792
  }
17785
- return obj;
17793
+ return prev;
17786
17794
  },
17787
17795
  {}
17788
17796
  );
17789
17797
  const textStyles = extractKeys(theme, "styles.textStyles");
17790
17798
  const layerStyles = extractKeys(theme, "styles.layerStyles");
17791
- const colorSchemes = extractColorSchemes(theme);
17799
+ const { colorSchemes, colorSchemeColors } = extractColorSchemes(theme);
17792
17800
  const themeSchemes = extractThemeSchemes(theme);
17793
17801
  const { transitionProperty, transitionDuration, transitionEasing } = extractTransitions(theme);
17794
17802
  const componentTypes = extractComponents(theme);
17803
+ tokens.colors = [...tokens.colors, ...colorSchemeColors];
17795
17804
  return prettier(
17796
17805
  `import type { UITheme } from './ui-theme.types'
17797
17806
 
17798
17807
  export interface GeneratedTheme extends UITheme { ${print(
17799
17808
  {
17800
- ...unions,
17809
+ ...tokens,
17801
17810
  textStyles,
17802
17811
  layerStyles,
17803
17812
  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.9.0",
17464
+ version: "0.9.1",
17465
17465
  description: "Generate theme tokens for autocomplete",
17466
17466
  keywords: [
17467
17467
  "theme",
@@ -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.9.0",
17490
+ version: "0.9.1",
17491
17491
  description: "Generate theme tokens for autocomplete",
17492
17492
  keywords: [
17493
17493
  "theme",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamada-ui/cli",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Generate theme tokens for autocomplete",
5
5
  "keywords": [
6
6
  "theme",