@nextui-org/theme 0.0.0-dev-v2-20231103223703 → 0.0.0-dev-v2-20231105134808

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.
@@ -37,13 +37,14 @@ import mapKeys from "lodash.mapkeys";
37
37
  import kebabCase from "lodash.kebabcase";
38
38
  import deepMerge from "deepmerge";
39
39
  var DEFAULT_PREFIX = "nextui";
40
+ var parsedColorsCache = {};
40
41
  var resolveConfig = (themes = {}, defaultTheme, prefix) => {
41
42
  const resolved = {
42
43
  variants: [],
43
44
  utilities: {},
44
45
  colors: {}
45
46
  };
46
- forEach(themes, ({ extend, layout, colors }, themeName) => {
47
+ for (const [themeName, { extend, layout, colors }] of Object.entries(themes)) {
47
48
  let cssSelector = `.${themeName},[data-theme="${themeName}"]`;
48
49
  const scheme = themeName === "light" || themeName === "dark" ? themeName : extend;
49
50
  if (themeName === defaultTheme) {
@@ -58,11 +59,13 @@ var resolveConfig = (themes = {}, defaultTheme, prefix) => {
58
59
  name: themeName,
59
60
  definition: [`&.${themeName}`, `&[data-theme='${themeName}']`]
60
61
  });
61
- forEach(flatColors, (colorValue, colorName) => {
62
+ for (const [colorName, colorValue] of Object.entries(flatColors)) {
62
63
  if (!colorValue)
63
64
  return;
64
65
  try {
65
- const [h, s, l, defaultAlphaValue] = Color(colorValue).hsl().round().array();
66
+ const parsedColor = parsedColorsCache[colorValue] || Color(colorValue).hsl().round().array();
67
+ parsedColorsCache[colorValue] = parsedColor;
68
+ const [h, s, l, defaultAlphaValue] = parsedColor;
66
69
  const nextuiColorVariable = `--${prefix}-${colorName}`;
67
70
  const nextuiOpacityVariable = `--${prefix}-${colorName}-opacity`;
68
71
  resolved.utilities[cssSelector][nextuiColorVariable] = `${h} ${s}% ${l}%`;
@@ -81,32 +84,31 @@ var resolveConfig = (themes = {}, defaultTheme, prefix) => {
81
84
  } catch (error) {
82
85
  console.log("error", error == null ? void 0 : error.message);
83
86
  }
84
- });
85
- forEach(flatLayout, (value, key) => {
87
+ }
88
+ for (const [key, value] of Object.entries(flatLayout)) {
86
89
  if (!value)
87
90
  return;
91
+ const layoutVariablePrefix = `--${prefix}-${key}`;
88
92
  if (typeof value === "object") {
89
- forEach(value, (v, k) => {
90
- const layoutVariable = `--${prefix}-${key}-${k}`;
91
- resolved.utilities[cssSelector][layoutVariable] = v;
92
- });
93
- } else if (key === "spacing-unit") {
94
- const layoutVariable = `--${prefix}-${key}`;
95
- resolved.utilities[cssSelector][layoutVariable] = value;
96
- const spacingScale = generateSpacingScale(Number(value));
97
- forEach(spacingScale, (v, k) => {
98
- const layoutVariable2 = `--${prefix}-${key}-${k}`;
99
- resolved.utilities[cssSelector][layoutVariable2] = v;
100
- });
93
+ for (const [nestedKey, nestedValue] of Object.entries(value)) {
94
+ const nestedLayoutVariable = `${layoutVariablePrefix}-${nestedKey}`;
95
+ resolved.utilities[cssSelector][nestedLayoutVariable] = nestedValue;
96
+ }
101
97
  } else {
102
- const layoutVariable = `--${prefix}-${key}`;
103
- if (layoutVariable.includes("opacity") && typeof value === "number") {
104
- value = value.toString().replace(/^0\./, ".");
98
+ if (key === "spacing-unit") {
99
+ resolved.utilities[cssSelector][layoutVariablePrefix] = value;
100
+ const spacingScale = generateSpacingScale(Number(value));
101
+ for (const [scaleKey, scaleValue] of Object.entries(spacingScale)) {
102
+ const spacingVariable = `${layoutVariablePrefix}-${scaleKey}`;
103
+ resolved.utilities[cssSelector][spacingVariable] = scaleValue;
104
+ }
105
+ } else {
106
+ const formattedValue = layoutVariablePrefix.includes("opacity") && typeof value === "number" ? value.toString().replace(/^0\./, ".") : value;
107
+ resolved.utilities[cssSelector][layoutVariablePrefix] = formattedValue;
105
108
  }
106
- resolved.utilities[cssSelector][layoutVariable] = value;
107
109
  }
108
- });
109
- });
110
+ }
111
+ }
110
112
  return resolved;
111
113
  };
112
114
  var corePlugin = (themes = {}, defaultTheme, prefix, addCommonColors) => {
@@ -136,8 +138,8 @@ var corePlugin = (themes = {}, defaultTheme, prefix, addCommonColors) => {
136
138
  ...baseStyles(prefix)
137
139
  }
138
140
  });
139
- addUtilities({ ...resolved.utilities, ...utilities });
140
- resolved.variants.forEach((variant) => {
141
+ addUtilities({ ...resolved == null ? void 0 : resolved.utilities, ...utilities });
142
+ resolved == null ? void 0 : resolved.variants.forEach((variant) => {
141
143
  addVariant(variant.name, variant.definition);
142
144
  });
143
145
  },
@@ -146,7 +148,7 @@ var corePlugin = (themes = {}, defaultTheme, prefix, addCommonColors) => {
146
148
  extend: {
147
149
  colors: {
148
150
  ...addCommonColors ? commonColors : {},
149
- ...resolved.colors
151
+ ...resolved == null ? void 0 : resolved.colors
150
152
  },
151
153
  scale: {
152
154
  "80": "0.8",
@@ -9,7 +9,7 @@ import {
9
9
  // src/components/input.ts
10
10
  var input = tv({
11
11
  slots: {
12
- base: ["group flex flex-col", "data-[has-helper=true]:mb-4"],
12
+ base: ["group flex relative flex-col", "data-[has-helper=true]:mb-4"],
13
13
  label: [
14
14
  "absolute",
15
15
  "z-10",
@@ -157,7 +157,7 @@ var input = tv({
157
157
  inside: {
158
158
  label: "text-tiny cursor-text",
159
159
  inputWrapper: "flex-col items-start justify-center gap-0",
160
- innerWrapper: "items-end"
160
+ innerWrapper: "group-data-[has-label=true]:items-end"
161
161
  }
162
162
  },
163
163
  fullWidth: {
@@ -533,8 +533,7 @@ var select = tv({
533
533
  labelPlacement: "inside",
534
534
  size: ["sm", "md"],
535
535
  class: {
536
- label: "text-small",
537
- input: "pt-4"
536
+ label: "text-small"
538
537
  }
539
538
  },
540
539
  {
@@ -543,7 +542,7 @@ var select = tv({
543
542
  size: "sm",
544
543
  class: {
545
544
  label: ["group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.tiny)/2_-_8px)]"],
546
- innerWrapper: "pt-4"
545
+ innerWrapper: "group-data-[has-label=true]:pt-4"
547
546
  }
548
547
  },
549
548
  {
@@ -554,7 +553,7 @@ var select = tv({
554
553
  label: [
555
554
  "group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.small)/2_-_6px)]"
556
555
  ],
557
- innerWrapper: "pt-4"
556
+ innerWrapper: "group-data-[has-label=true]:pt-4"
558
557
  }
559
558
  },
560
559
  {
@@ -566,7 +565,7 @@ var select = tv({
566
565
  "text-medium",
567
566
  "group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.small)/2_-_8px)]"
568
567
  ],
569
- innerWrapper: "pt-5"
568
+ innerWrapper: "group-data-[has-label=true]:pt-5"
570
569
  }
571
570
  },
572
571
  {
@@ -3736,7 +3736,7 @@ var circularProgress = tv({
3736
3736
  // src/components/input.ts
3737
3737
  var input = tv({
3738
3738
  slots: {
3739
- base: ["group flex flex-col", "data-[has-helper=true]:mb-4"],
3739
+ base: ["group flex relative flex-col", "data-[has-helper=true]:mb-4"],
3740
3740
  label: [
3741
3741
  "absolute",
3742
3742
  "z-10",
@@ -3884,7 +3884,7 @@ var input = tv({
3884
3884
  inside: {
3885
3885
  label: "text-tiny cursor-text",
3886
3886
  inputWrapper: "flex-col items-start justify-center gap-0",
3887
- innerWrapper: "items-end"
3887
+ innerWrapper: "group-data-[has-label=true]:items-end"
3888
3888
  }
3889
3889
  },
3890
3890
  fullWidth: {
@@ -6537,8 +6537,7 @@ var select = tv({
6537
6537
  labelPlacement: "inside",
6538
6538
  size: ["sm", "md"],
6539
6539
  class: {
6540
- label: "text-small",
6541
- input: "pt-4"
6540
+ label: "text-small"
6542
6541
  }
6543
6542
  },
6544
6543
  {
@@ -6547,7 +6546,7 @@ var select = tv({
6547
6546
  size: "sm",
6548
6547
  class: {
6549
6548
  label: ["group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.tiny)/2_-_8px)]"],
6550
- innerWrapper: "pt-4"
6549
+ innerWrapper: "group-data-[has-label=true]:pt-4"
6551
6550
  }
6552
6551
  },
6553
6552
  {
@@ -6558,7 +6557,7 @@ var select = tv({
6558
6557
  label: [
6559
6558
  "group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.small)/2_-_6px)]"
6560
6559
  ],
6561
- innerWrapper: "pt-4"
6560
+ innerWrapper: "group-data-[has-label=true]:pt-4"
6562
6561
  }
6563
6562
  },
6564
6563
  {
@@ -6570,7 +6569,7 @@ var select = tv({
6570
6569
  "text-medium",
6571
6570
  "group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.small)/2_-_8px)]"
6572
6571
  ],
6573
- innerWrapper: "pt-5"
6572
+ innerWrapper: "group-data-[has-label=true]:pt-5"
6574
6573
  }
6575
6574
  },
6576
6575
  {
@@ -44,7 +44,7 @@ import {
44
44
  } from "../chunk-VGHVBXXT.mjs";
45
45
  import {
46
46
  select
47
- } from "../chunk-6RI6HHSE.mjs";
47
+ } from "../chunk-TLWI2J7W.mjs";
48
48
  import {
49
49
  skeleton
50
50
  } from "../chunk-JX6O4KJS.mjs";
@@ -53,7 +53,7 @@ import {
53
53
  } from "../chunk-F36W5Y6O.mjs";
54
54
  import {
55
55
  input
56
- } from "../chunk-KNUJMWVH.mjs";
56
+ } from "../chunk-RNXUUR27.mjs";
57
57
  import {
58
58
  kbd
59
59
  } from "../chunk-J7FVLFSZ.mjs";
@@ -129,7 +129,7 @@ var groupDataFocusVisibleClasses = [
129
129
  // src/components/input.ts
130
130
  var input = tv({
131
131
  slots: {
132
- base: ["group flex flex-col", "data-[has-helper=true]:mb-4"],
132
+ base: ["group flex relative flex-col", "data-[has-helper=true]:mb-4"],
133
133
  label: [
134
134
  "absolute",
135
135
  "z-10",
@@ -277,7 +277,7 @@ var input = tv({
277
277
  inside: {
278
278
  label: "text-tiny cursor-text",
279
279
  inputWrapper: "flex-col items-start justify-center gap-0",
280
- innerWrapper: "items-end"
280
+ innerWrapper: "group-data-[has-label=true]:items-end"
281
281
  }
282
282
  },
283
283
  fullWidth: {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  input
3
- } from "../chunk-KNUJMWVH.mjs";
3
+ } from "../chunk-RNXUUR27.mjs";
4
4
  import "../chunk-CMYR6AOY.mjs";
5
5
  import "../chunk-K7LK7NCE.mjs";
6
6
  import "../chunk-2PIR7DFM.mjs";
@@ -646,8 +646,7 @@ var select = tv({
646
646
  labelPlacement: "inside",
647
647
  size: ["sm", "md"],
648
648
  class: {
649
- label: "text-small",
650
- input: "pt-4"
649
+ label: "text-small"
651
650
  }
652
651
  },
653
652
  {
@@ -656,7 +655,7 @@ var select = tv({
656
655
  size: "sm",
657
656
  class: {
658
657
  label: ["group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.tiny)/2_-_8px)]"],
659
- innerWrapper: "pt-4"
658
+ innerWrapper: "group-data-[has-label=true]:pt-4"
660
659
  }
661
660
  },
662
661
  {
@@ -667,7 +666,7 @@ var select = tv({
667
666
  label: [
668
667
  "group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.small)/2_-_6px)]"
669
668
  ],
670
- innerWrapper: "pt-4"
669
+ innerWrapper: "group-data-[has-label=true]:pt-4"
671
670
  }
672
671
  },
673
672
  {
@@ -679,7 +678,7 @@ var select = tv({
679
678
  "text-medium",
680
679
  "group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.small)/2_-_8px)]"
681
680
  ],
682
- innerWrapper: "pt-5"
681
+ innerWrapper: "group-data-[has-label=true]:pt-5"
683
682
  }
684
683
  },
685
684
  {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  select
3
- } from "../chunk-6RI6HHSE.mjs";
3
+ } from "../chunk-TLWI2J7W.mjs";
4
4
  import "../chunk-CMYR6AOY.mjs";
5
5
  import "../chunk-K7LK7NCE.mjs";
6
6
  import "../chunk-2PIR7DFM.mjs";
package/dist/index.js CHANGED
@@ -3769,7 +3769,7 @@ var circularProgress = tv({
3769
3769
  // src/components/input.ts
3770
3770
  var input = tv({
3771
3771
  slots: {
3772
- base: ["group flex flex-col", "data-[has-helper=true]:mb-4"],
3772
+ base: ["group flex relative flex-col", "data-[has-helper=true]:mb-4"],
3773
3773
  label: [
3774
3774
  "absolute",
3775
3775
  "z-10",
@@ -3917,7 +3917,7 @@ var input = tv({
3917
3917
  inside: {
3918
3918
  label: "text-tiny cursor-text",
3919
3919
  inputWrapper: "flex-col items-start justify-center gap-0",
3920
- innerWrapper: "items-end"
3920
+ innerWrapper: "group-data-[has-label=true]:items-end"
3921
3921
  }
3922
3922
  },
3923
3923
  fullWidth: {
@@ -6570,8 +6570,7 @@ var select = tv({
6570
6570
  labelPlacement: "inside",
6571
6571
  size: ["sm", "md"],
6572
6572
  class: {
6573
- label: "text-small",
6574
- input: "pt-4"
6573
+ label: "text-small"
6575
6574
  }
6576
6575
  },
6577
6576
  {
@@ -6580,7 +6579,7 @@ var select = tv({
6580
6579
  size: "sm",
6581
6580
  class: {
6582
6581
  label: ["group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.tiny)/2_-_8px)]"],
6583
- innerWrapper: "pt-4"
6582
+ innerWrapper: "group-data-[has-label=true]:pt-4"
6584
6583
  }
6585
6584
  },
6586
6585
  {
@@ -6591,7 +6590,7 @@ var select = tv({
6591
6590
  label: [
6592
6591
  "group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.small)/2_-_6px)]"
6593
6592
  ],
6594
- innerWrapper: "pt-4"
6593
+ innerWrapper: "group-data-[has-label=true]:pt-4"
6595
6594
  }
6596
6595
  },
6597
6596
  {
@@ -6603,7 +6602,7 @@ var select = tv({
6603
6602
  "text-medium",
6604
6603
  "group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.small)/2_-_8px)]"
6605
6604
  ],
6606
- innerWrapper: "pt-5"
6605
+ innerWrapper: "group-data-[has-label=true]:pt-5"
6607
6606
  }
6608
6607
  },
6609
6608
  {
@@ -8493,13 +8492,14 @@ var darkLayout = {
8493
8492
 
8494
8493
  // src/plugin.ts
8495
8494
  var DEFAULT_PREFIX = "nextui";
8495
+ var parsedColorsCache = {};
8496
8496
  var resolveConfig = (themes = {}, defaultTheme, prefix) => {
8497
8497
  const resolved = {
8498
8498
  variants: [],
8499
8499
  utilities: {},
8500
8500
  colors: {}
8501
8501
  };
8502
- (0, import_lodash3.default)(themes, ({ extend, layout, colors: colors2 }, themeName) => {
8502
+ for (const [themeName, { extend, layout, colors: colors2 }] of Object.entries(themes)) {
8503
8503
  let cssSelector = `.${themeName},[data-theme="${themeName}"]`;
8504
8504
  const scheme = themeName === "light" || themeName === "dark" ? themeName : extend;
8505
8505
  if (themeName === defaultTheme) {
@@ -8514,11 +8514,13 @@ var resolveConfig = (themes = {}, defaultTheme, prefix) => {
8514
8514
  name: themeName,
8515
8515
  definition: [`&.${themeName}`, `&[data-theme='${themeName}']`]
8516
8516
  });
8517
- (0, import_lodash3.default)(flatColors, (colorValue, colorName) => {
8517
+ for (const [colorName, colorValue] of Object.entries(flatColors)) {
8518
8518
  if (!colorValue)
8519
8519
  return;
8520
8520
  try {
8521
- const [h, s, l, defaultAlphaValue] = (0, import_color.default)(colorValue).hsl().round().array();
8521
+ const parsedColor = parsedColorsCache[colorValue] || (0, import_color.default)(colorValue).hsl().round().array();
8522
+ parsedColorsCache[colorValue] = parsedColor;
8523
+ const [h, s, l, defaultAlphaValue] = parsedColor;
8522
8524
  const nextuiColorVariable = `--${prefix}-${colorName}`;
8523
8525
  const nextuiOpacityVariable = `--${prefix}-${colorName}-opacity`;
8524
8526
  resolved.utilities[cssSelector][nextuiColorVariable] = `${h} ${s}% ${l}%`;
@@ -8537,32 +8539,31 @@ var resolveConfig = (themes = {}, defaultTheme, prefix) => {
8537
8539
  } catch (error) {
8538
8540
  console.log("error", error == null ? void 0 : error.message);
8539
8541
  }
8540
- });
8541
- (0, import_lodash3.default)(flatLayout, (value, key) => {
8542
+ }
8543
+ for (const [key, value] of Object.entries(flatLayout)) {
8542
8544
  if (!value)
8543
8545
  return;
8546
+ const layoutVariablePrefix = `--${prefix}-${key}`;
8544
8547
  if (typeof value === "object") {
8545
- (0, import_lodash3.default)(value, (v, k) => {
8546
- const layoutVariable = `--${prefix}-${key}-${k}`;
8547
- resolved.utilities[cssSelector][layoutVariable] = v;
8548
- });
8549
- } else if (key === "spacing-unit") {
8550
- const layoutVariable = `--${prefix}-${key}`;
8551
- resolved.utilities[cssSelector][layoutVariable] = value;
8552
- const spacingScale = generateSpacingScale(Number(value));
8553
- (0, import_lodash3.default)(spacingScale, (v, k) => {
8554
- const layoutVariable2 = `--${prefix}-${key}-${k}`;
8555
- resolved.utilities[cssSelector][layoutVariable2] = v;
8556
- });
8548
+ for (const [nestedKey, nestedValue] of Object.entries(value)) {
8549
+ const nestedLayoutVariable = `${layoutVariablePrefix}-${nestedKey}`;
8550
+ resolved.utilities[cssSelector][nestedLayoutVariable] = nestedValue;
8551
+ }
8557
8552
  } else {
8558
- const layoutVariable = `--${prefix}-${key}`;
8559
- if (layoutVariable.includes("opacity") && typeof value === "number") {
8560
- value = value.toString().replace(/^0\./, ".");
8553
+ if (key === "spacing-unit") {
8554
+ resolved.utilities[cssSelector][layoutVariablePrefix] = value;
8555
+ const spacingScale = generateSpacingScale(Number(value));
8556
+ for (const [scaleKey, scaleValue] of Object.entries(spacingScale)) {
8557
+ const spacingVariable = `${layoutVariablePrefix}-${scaleKey}`;
8558
+ resolved.utilities[cssSelector][spacingVariable] = scaleValue;
8559
+ }
8560
+ } else {
8561
+ const formattedValue = layoutVariablePrefix.includes("opacity") && typeof value === "number" ? value.toString().replace(/^0\./, ".") : value;
8562
+ resolved.utilities[cssSelector][layoutVariablePrefix] = formattedValue;
8561
8563
  }
8562
- resolved.utilities[cssSelector][layoutVariable] = value;
8563
8564
  }
8564
- });
8565
- });
8565
+ }
8566
+ }
8566
8567
  return resolved;
8567
8568
  };
8568
8569
  var corePlugin = (themes = {}, defaultTheme, prefix, addCommonColors) => {
@@ -8592,8 +8593,8 @@ var corePlugin = (themes = {}, defaultTheme, prefix, addCommonColors) => {
8592
8593
  ...baseStyles(prefix)
8593
8594
  }
8594
8595
  });
8595
- addUtilities({ ...resolved.utilities, ...utilities });
8596
- resolved.variants.forEach((variant) => {
8596
+ addUtilities({ ...resolved == null ? void 0 : resolved.utilities, ...utilities });
8597
+ resolved == null ? void 0 : resolved.variants.forEach((variant) => {
8597
8598
  addVariant(variant.name, variant.definition);
8598
8599
  });
8599
8600
  },
@@ -8602,7 +8603,7 @@ var corePlugin = (themes = {}, defaultTheme, prefix, addCommonColors) => {
8602
8603
  extend: {
8603
8604
  colors: {
8604
8605
  ...addCommonColors ? commonColors : {},
8605
- ...resolved.colors
8606
+ ...resolved == null ? void 0 : resolved.colors
8606
8607
  },
8607
8608
  scale: {
8608
8609
  "80": "0.8",
package/dist/index.mjs CHANGED
@@ -44,7 +44,7 @@ import {
44
44
  } from "./chunk-VGHVBXXT.mjs";
45
45
  import {
46
46
  select
47
- } from "./chunk-6RI6HHSE.mjs";
47
+ } from "./chunk-TLWI2J7W.mjs";
48
48
  import {
49
49
  skeleton
50
50
  } from "./chunk-JX6O4KJS.mjs";
@@ -53,7 +53,7 @@ import {
53
53
  } from "./chunk-F36W5Y6O.mjs";
54
54
  import {
55
55
  input
56
- } from "./chunk-KNUJMWVH.mjs";
56
+ } from "./chunk-RNXUUR27.mjs";
57
57
  import {
58
58
  kbd
59
59
  } from "./chunk-J7FVLFSZ.mjs";
@@ -130,7 +130,7 @@ import {
130
130
  } from "./chunk-WBUVHAJX.mjs";
131
131
  import {
132
132
  nextui
133
- } from "./chunk-6XG3Y4GM.mjs";
133
+ } from "./chunk-5QVKTCUZ.mjs";
134
134
  import "./chunk-S7W5DQP2.mjs";
135
135
  import "./chunk-DI2L75XK.mjs";
136
136
  import "./chunk-4Z22WXZX.mjs";
package/dist/plugin.js CHANGED
@@ -711,13 +711,14 @@ var baseStyles = (prefix) => ({
711
711
 
712
712
  // src/plugin.ts
713
713
  var DEFAULT_PREFIX = "nextui";
714
+ var parsedColorsCache = {};
714
715
  var resolveConfig = (themes = {}, defaultTheme, prefix) => {
715
716
  const resolved = {
716
717
  variants: [],
717
718
  utilities: {},
718
719
  colors: {}
719
720
  };
720
- (0, import_lodash3.default)(themes, ({ extend, layout, colors: colors2 }, themeName) => {
721
+ for (const [themeName, { extend, layout, colors: colors2 }] of Object.entries(themes)) {
721
722
  let cssSelector = `.${themeName},[data-theme="${themeName}"]`;
722
723
  const scheme = themeName === "light" || themeName === "dark" ? themeName : extend;
723
724
  if (themeName === defaultTheme) {
@@ -732,11 +733,13 @@ var resolveConfig = (themes = {}, defaultTheme, prefix) => {
732
733
  name: themeName,
733
734
  definition: [`&.${themeName}`, `&[data-theme='${themeName}']`]
734
735
  });
735
- (0, import_lodash3.default)(flatColors, (colorValue, colorName) => {
736
+ for (const [colorName, colorValue] of Object.entries(flatColors)) {
736
737
  if (!colorValue)
737
738
  return;
738
739
  try {
739
- const [h, s, l, defaultAlphaValue] = (0, import_color.default)(colorValue).hsl().round().array();
740
+ const parsedColor = parsedColorsCache[colorValue] || (0, import_color.default)(colorValue).hsl().round().array();
741
+ parsedColorsCache[colorValue] = parsedColor;
742
+ const [h, s, l, defaultAlphaValue] = parsedColor;
740
743
  const nextuiColorVariable = `--${prefix}-${colorName}`;
741
744
  const nextuiOpacityVariable = `--${prefix}-${colorName}-opacity`;
742
745
  resolved.utilities[cssSelector][nextuiColorVariable] = `${h} ${s}% ${l}%`;
@@ -755,32 +758,31 @@ var resolveConfig = (themes = {}, defaultTheme, prefix) => {
755
758
  } catch (error) {
756
759
  console.log("error", error == null ? void 0 : error.message);
757
760
  }
758
- });
759
- (0, import_lodash3.default)(flatLayout, (value, key) => {
761
+ }
762
+ for (const [key, value] of Object.entries(flatLayout)) {
760
763
  if (!value)
761
764
  return;
765
+ const layoutVariablePrefix = `--${prefix}-${key}`;
762
766
  if (typeof value === "object") {
763
- (0, import_lodash3.default)(value, (v, k) => {
764
- const layoutVariable = `--${prefix}-${key}-${k}`;
765
- resolved.utilities[cssSelector][layoutVariable] = v;
766
- });
767
- } else if (key === "spacing-unit") {
768
- const layoutVariable = `--${prefix}-${key}`;
769
- resolved.utilities[cssSelector][layoutVariable] = value;
770
- const spacingScale = generateSpacingScale(Number(value));
771
- (0, import_lodash3.default)(spacingScale, (v, k) => {
772
- const layoutVariable2 = `--${prefix}-${key}-${k}`;
773
- resolved.utilities[cssSelector][layoutVariable2] = v;
774
- });
767
+ for (const [nestedKey, nestedValue] of Object.entries(value)) {
768
+ const nestedLayoutVariable = `${layoutVariablePrefix}-${nestedKey}`;
769
+ resolved.utilities[cssSelector][nestedLayoutVariable] = nestedValue;
770
+ }
775
771
  } else {
776
- const layoutVariable = `--${prefix}-${key}`;
777
- if (layoutVariable.includes("opacity") && typeof value === "number") {
778
- value = value.toString().replace(/^0\./, ".");
772
+ if (key === "spacing-unit") {
773
+ resolved.utilities[cssSelector][layoutVariablePrefix] = value;
774
+ const spacingScale = generateSpacingScale(Number(value));
775
+ for (const [scaleKey, scaleValue] of Object.entries(spacingScale)) {
776
+ const spacingVariable = `${layoutVariablePrefix}-${scaleKey}`;
777
+ resolved.utilities[cssSelector][spacingVariable] = scaleValue;
778
+ }
779
+ } else {
780
+ const formattedValue = layoutVariablePrefix.includes("opacity") && typeof value === "number" ? value.toString().replace(/^0\./, ".") : value;
781
+ resolved.utilities[cssSelector][layoutVariablePrefix] = formattedValue;
779
782
  }
780
- resolved.utilities[cssSelector][layoutVariable] = value;
781
783
  }
782
- });
783
- });
784
+ }
785
+ }
784
786
  return resolved;
785
787
  };
786
788
  var corePlugin = (themes = {}, defaultTheme, prefix, addCommonColors) => {
@@ -810,8 +812,8 @@ var corePlugin = (themes = {}, defaultTheme, prefix, addCommonColors) => {
810
812
  ...baseStyles(prefix)
811
813
  }
812
814
  });
813
- addUtilities({ ...resolved.utilities, ...utilities });
814
- resolved.variants.forEach((variant) => {
815
+ addUtilities({ ...resolved == null ? void 0 : resolved.utilities, ...utilities });
816
+ resolved == null ? void 0 : resolved.variants.forEach((variant) => {
815
817
  addVariant(variant.name, variant.definition);
816
818
  });
817
819
  },
@@ -820,7 +822,7 @@ var corePlugin = (themes = {}, defaultTheme, prefix, addCommonColors) => {
820
822
  extend: {
821
823
  colors: {
822
824
  ...addCommonColors ? commonColors : {},
823
- ...resolved.colors
825
+ ...resolved == null ? void 0 : resolved.colors
824
826
  },
825
827
  scale: {
826
828
  "80": "0.8",
package/dist/plugin.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  nextui
3
- } from "./chunk-6XG3Y4GM.mjs";
3
+ } from "./chunk-5QVKTCUZ.mjs";
4
4
  import "./chunk-S7W5DQP2.mjs";
5
5
  import "./chunk-DI2L75XK.mjs";
6
6
  import "./chunk-4Z22WXZX.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextui-org/theme",
3
- "version": "0.0.0-dev-v2-20231103223703",
3
+ "version": "0.0.0-dev-v2-20231105134808",
4
4
  "description": "The default theme for NextUI components",
5
5
  "keywords": [
6
6
  "theme",