@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.
@@ -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: "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
- return Object.entries(colors).reduce((array, [key, value]) => {
17729
+ return results;
17730
+ Object.entries(colors).forEach(([key, value]) => {
17726
17731
  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
- }, []);
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 unions = config.reduce(
17766
- (obj, {
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
- obj[key] = [];
17783
+ prev[key] = [];
17775
17784
  if (isObject(target) || isArray(target)) {
17776
- obj[key] = extractPaths(target, maxScanDepth, omitScanKeys).filter(filter).flatMap(flatMap);
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
- obj[key].push(...semanticKeys);
17792
+ prev[key].push(...semanticKeys);
17784
17793
  }
17785
- return obj;
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
- ...unions,
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.9.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",
@@ -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: "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.9.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",