@tamagui/theme-base 1.0.1-beta.19 → 1.0.1-beta.191

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.
@@ -1,8 +1,8 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
6
  var __export = (target, all) => {
7
7
  for (var name in all)
8
8
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -23,7 +23,7 @@ __export(colorUtils_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(colorUtils_exports);
25
25
  var import_core = require("@tamagui/core");
26
- const hexToRGBA = /* @__PURE__ */ __name((hex, alpha = 1) => {
26
+ const hexToRGBA = (hex, alpha = 1) => {
27
27
  if (!isValidHex(hex)) {
28
28
  throw new Error("Invalid HEX");
29
29
  }
@@ -31,8 +31,8 @@ const hexToRGBA = /* @__PURE__ */ __name((hex, alpha = 1) => {
31
31
  const hexArr = getChunksFromString(hex.slice(1), chunkSize);
32
32
  const [r, g, b, a] = (hexArr == null ? void 0 : hexArr.map(convertHexUnitTo256)) ?? [];
33
33
  return `rgba(${r}, ${g}, ${b}, ${getAlphaFloat(a, alpha)})`;
34
- }, "hexToRGBA");
35
- const setColorAlpha = /* @__PURE__ */ __name((colorIn, alpha = 1) => {
34
+ };
35
+ const setColorAlpha = (colorIn, alpha = 1) => {
36
36
  let color = `${(0, import_core.getVariableValue)(colorIn)}`;
37
37
  if (color.startsWith("hsl(")) {
38
38
  return color.replace("hsl", "hsla").replace(")", `, ${alpha})`);
@@ -44,11 +44,11 @@ const setColorAlpha = /* @__PURE__ */ __name((colorIn, alpha = 1) => {
44
44
  return color.replace("rgb", "rgba").replace(")", `, ${alpha})`);
45
45
  }
46
46
  return color;
47
- }, "setColorAlpha");
48
- const isValidHex = /* @__PURE__ */ __name((hex) => /^#([A-Fa-f0-9]{3,4}){1,2}$/.test(hex), "isValidHex");
49
- const getChunksFromString = /* @__PURE__ */ __name((st, chunkSize = 0) => st.match(new RegExp(`.{${chunkSize}}`, "g")), "getChunksFromString");
50
- const convertHexUnitTo256 = /* @__PURE__ */ __name((hexStr) => parseInt(hexStr.repeat(2 / hexStr.length), 16), "convertHexUnitTo256");
51
- const getAlphaFloat = /* @__PURE__ */ __name((a, alpha = 1) => {
47
+ };
48
+ const isValidHex = (hex) => /^#([A-Fa-f0-9]{3,4}){1,2}$/.test(hex);
49
+ const getChunksFromString = (st, chunkSize = 0) => st.match(new RegExp(`.{${chunkSize}}`, "g"));
50
+ const convertHexUnitTo256 = (hexStr) => parseInt(hexStr.repeat(2 / hexStr.length), 16);
51
+ const getAlphaFloat = (a, alpha = 1) => {
52
52
  if (a !== void 0) {
53
53
  return a / 255;
54
54
  }
@@ -56,7 +56,7 @@ const getAlphaFloat = /* @__PURE__ */ __name((a, alpha = 1) => {
56
56
  return 1;
57
57
  }
58
58
  return alpha;
59
- }, "getAlphaFloat");
59
+ };
60
60
  // Annotate the CommonJS export names for ESM import in node:
61
61
  0 && (module.exports = {
62
62
  hexToRGBA,
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/colorUtils.tsx"],
4
4
  "sourcesContent": ["import { Variable, getVariableValue } from '@tamagui/core'\n\nexport const hexToRGBA = (hex: string, alpha = 1) => {\n if (!isValidHex(hex)) {\n throw new Error('Invalid HEX')\n }\n const chunkSize = Math.floor((hex.length - 1) / 3)\n const hexArr = getChunksFromString(hex.slice(1), chunkSize)\n const [r, g, b, a] = hexArr?.map(convertHexUnitTo256) ?? []\n return `rgba(${r}, ${g}, ${b}, ${getAlphaFloat(a, alpha)})`\n}\n\nexport const setColorAlpha = (colorIn: string | Variable, alpha = 1) => {\n let color = `${getVariableValue(colorIn)}`\n if (color.startsWith('hsl(')) {\n return color.replace('hsl', 'hsla').replace(')', `, ${alpha})`)\n }\n if (color.startsWith('#')) {\n return hexToRGBA(color, alpha)\n }\n if (color.startsWith('rgb(')) {\n return color.replace('rgb', 'rgba').replace(')', `, ${alpha})`)\n }\n return color\n}\n\nconst isValidHex = (hex: string) => /^#([A-Fa-f0-9]{3,4}){1,2}$/.test(hex)\n\nconst getChunksFromString = (st: string, chunkSize = 0) =>\n st.match(new RegExp(`.{${chunkSize}}`, 'g'))\n\nconst convertHexUnitTo256 = (hexStr: string) => parseInt(hexStr.repeat(2 / hexStr.length), 16)\n\nconst getAlphaFloat = (a: any, alpha = 1) => {\n if (a !== undefined) {\n return a / 255\n }\n if (typeof alpha != 'number' || alpha < 0 || alpha > 1) {\n return 1\n }\n return alpha\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA2C;AAEpC,MAAM,YAAY,wBAAC,KAAa,QAAQ,MAAM;AACnD,MAAI,CAAC,WAAW,GAAG,GAAG;AACpB,UAAM,IAAI,MAAM,aAAa;AAAA,EAC/B;AACA,QAAM,YAAY,KAAK,MAAO,KAAI,SAAS,KAAK,CAAC;AACjD,QAAM,SAAS,oBAAoB,IAAI,MAAM,CAAC,GAAG,SAAS;AAC1D,QAAM,CAAC,GAAG,GAAG,GAAG,KAAK,kCAAQ,IAAI,yBAAwB,CAAC;AAC1D,SAAO,QAAQ,MAAM,MAAM,MAAM,cAAc,GAAG,KAAK;AACzD,GARyB;AAUlB,MAAM,gBAAgB,wBAAC,SAA4B,QAAQ,MAAM;AACtE,MAAI,QAAQ,GAAG,kCAAiB,OAAO;AACvC,MAAI,MAAM,WAAW,MAAM,GAAG;AAC5B,WAAO,MAAM,QAAQ,OAAO,MAAM,EAAE,QAAQ,KAAK,KAAK,QAAQ;AAAA,EAChE;AACA,MAAI,MAAM,WAAW,GAAG,GAAG;AACzB,WAAO,UAAU,OAAO,KAAK;AAAA,EAC/B;AACA,MAAI,MAAM,WAAW,MAAM,GAAG;AAC5B,WAAO,MAAM,QAAQ,OAAO,MAAM,EAAE,QAAQ,KAAK,KAAK,QAAQ;AAAA,EAChE;AACA,SAAO;AACT,GAZ6B;AAc7B,MAAM,aAAa,wBAAC,QAAgB,6BAA6B,KAAK,GAAG,GAAtD;AAEnB,MAAM,sBAAsB,wBAAC,IAAY,YAAY,MACnD,GAAG,MAAM,IAAI,OAAO,KAAK,cAAc,GAAG,CAAC,GADjB;AAG5B,MAAM,sBAAsB,wBAAC,WAAmB,SAAS,OAAO,OAAO,IAAI,OAAO,MAAM,GAAG,EAAE,GAAjE;AAE5B,MAAM,gBAAgB,wBAAC,GAAQ,QAAQ,MAAM;AAC3C,MAAI,MAAM,QAAW;AACnB,WAAO,IAAI;AAAA,EACb;AACA,MAAI,OAAO,SAAS,YAAY,QAAQ,KAAK,QAAQ,GAAG;AACtD,WAAO;AAAA,EACT;AACA,SAAO;AACT,GARsB;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA2C;AAEpC,MAAM,YAAY,CAAC,KAAa,QAAQ,MAAM;AACnD,MAAI,CAAC,WAAW,GAAG,GAAG;AACpB,UAAM,IAAI,MAAM,aAAa;AAAA,EAC/B;AACA,QAAM,YAAY,KAAK,OAAO,IAAI,SAAS,KAAK,CAAC;AACjD,QAAM,SAAS,oBAAoB,IAAI,MAAM,CAAC,GAAG,SAAS;AAC1D,QAAM,CAAC,GAAG,GAAG,GAAG,CAAC,KAAI,iCAAQ,IAAI,yBAAwB,CAAC;AAC1D,SAAO,QAAQ,MAAM,MAAM,MAAM,cAAc,GAAG,KAAK;AACzD;AAEO,MAAM,gBAAgB,CAAC,SAA4B,QAAQ,MAAM;AACtE,MAAI,QAAQ,OAAG,8BAAiB,OAAO;AACvC,MAAI,MAAM,WAAW,MAAM,GAAG;AAC5B,WAAO,MAAM,QAAQ,OAAO,MAAM,EAAE,QAAQ,KAAK,KAAK,QAAQ;AAAA,EAChE;AACA,MAAI,MAAM,WAAW,GAAG,GAAG;AACzB,WAAO,UAAU,OAAO,KAAK;AAAA,EAC/B;AACA,MAAI,MAAM,WAAW,MAAM,GAAG;AAC5B,WAAO,MAAM,QAAQ,OAAO,MAAM,EAAE,QAAQ,KAAK,KAAK,QAAQ;AAAA,EAChE;AACA,SAAO;AACT;AAEA,MAAM,aAAa,CAAC,QAAgB,6BAA6B,KAAK,GAAG;AAEzE,MAAM,sBAAsB,CAAC,IAAY,YAAY,MACnD,GAAG,MAAM,IAAI,OAAO,KAAK,cAAc,GAAG,CAAC;AAE7C,MAAM,sBAAsB,CAAC,WAAmB,SAAS,OAAO,OAAO,IAAI,OAAO,MAAM,GAAG,EAAE;AAE7F,MAAM,gBAAgB,CAAC,GAAQ,QAAQ,MAAM;AAC3C,MAAI,MAAM,QAAW;AACnB,WAAO,IAAI;AAAA,EACb;AACA,MAAI,OAAO,SAAS,YAAY,QAAQ,KAAK,QAAQ,GAAG;AACtD,WAAO;AAAA,EACT;AACA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
package/dist/cjs/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.tsx"],
4
4
  "sourcesContent": ["export * from './themes'\nexport * from './tokens'\nexport * from '@tamagui/colors'\n"],
5
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,qBAAd;AACA,wBAAc,qBADd;AAEA,wBAAc,4BAFd;",
5
+ "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,qBAAd;AACA,wBAAc,qBADd;AAEA,wBAAc,4BAFd;",
6
6
  "names": []
7
7
  }
@@ -1,27 +1,8 @@
1
- var __create = Object.create;
1
+ "use strict";
2
2
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
- var __getProtoOf = Object.getPrototypeOf;
9
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
25
6
  var __export = (target, all) => {
26
7
  for (var name in all)
27
8
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -34,55 +15,84 @@ var __copyProps = (to, from, except, desc) => {
34
15
  }
35
16
  return to;
36
17
  };
37
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
38
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
39
19
  var themes_exports = {};
40
20
  __export(themes_exports, {
21
+ colorNames: () => colorNames,
41
22
  colorSchemes: () => colorSchemes,
42
- darkGradient: () => darkGradient,
43
- lightGradient: () => lightGradient,
44
23
  themes: () => themes
45
24
  });
46
25
  module.exports = __toCommonJS(themes_exports);
47
- var Colors = __toESM(require("@tamagui/colors"));
48
- var import_colors = require("@tamagui/colors");
49
26
  var import_core = require("@tamagui/core");
50
27
  var import_colorUtils = require("./colorUtils");
51
28
  var import_tokens = require("./tokens");
52
- const alternates = [1, 2, 3, 4];
29
+ const alternates = [1, 2, 3];
30
+ const alts = [1, 2];
53
31
  function createThemesFrom(name, getTheme, props) {
54
32
  const { shift = 0 } = props;
55
33
  const theme = getTheme(0 + shift, props);
56
34
  let themeEntries = [[name, theme]];
57
35
  const altThemes = alternates.map((alt) => [
36
+ `${name}_alt${alt}`,
37
+ getTheme(alt * 1 + shift, props)
38
+ ]);
39
+ const altThemes2 = alternates.map((alt) => [
58
40
  `${name}_alt${alt}`,
59
41
  getTheme(alt + shift, props)
60
42
  ]);
61
43
  const altButtonThemes = alternates.map((_, i) => {
62
- const [bName, bTheme] = [altThemes[i][0], (altThemes[i + 1] || altThemes[i])[1]];
44
+ const [bName, bTheme] = [altThemes2[i][0], (altThemes2[i + 1] || altThemes2[i])[1]];
63
45
  return [`${bName}_Button`, bTheme];
64
46
  });
65
47
  const darkerTheme = getTheme(Math.max(0, shift + (props.isLight ? 1 : -1)), props);
66
- const activeTheme = makeActiveTheme(theme);
48
+ const activeTheme = props.activeTheme || {
49
+ ...theme,
50
+ borderColor: props.backgrounds[7],
51
+ background: props.backgrounds[6],
52
+ backgroundHover: props.backgrounds[6],
53
+ backgroundPress: props.backgrounds[6]
54
+ };
55
+ const inverted = altThemes.map(([_name, theme2]) => {
56
+ return {
57
+ ...theme2,
58
+ background: theme2.color,
59
+ backgroundHover: theme2.colorHover,
60
+ backgroundFocus: theme2.colorFocus,
61
+ backgroundPress: theme2.colorPress,
62
+ color: theme2.background,
63
+ colorHover: theme2.backgroundHover,
64
+ colorFocus: theme2.backgroundFocus,
65
+ colorPress: theme2.backgroundPress
66
+ };
67
+ });
67
68
  themeEntries = [
68
69
  ...themeEntries,
69
- ...altThemes,
70
- ...altButtonThemes,
71
- [`${name}_Button`, altThemes[0][1]],
70
+ ...altThemes.slice(0, alts.length),
71
+ ...altButtonThemes.slice(0, alts.length),
72
+ [`${name}_Button`, altThemes2[1][1]],
73
+ [`${name}_DrawerFrame`, altThemes2[1][1]],
74
+ [`${name}_SliderTrack`, altThemes[0][1]],
75
+ [`${name}_SliderTrackActive`, altThemes[2][1]],
76
+ [`${name}_SliderThumb`, inverted[2]],
77
+ [`${name}_Progress`, altThemes[2][1]],
78
+ [`${name}_ProgressIndicator`, inverted[2]],
79
+ [`${name}_Switch`, altThemes[0][1]],
80
+ [`${name}_SwitchThumb`, inverted[2]],
81
+ [`${name}_TooltipArrow`, altThemes[1][1]],
82
+ [`${name}_TooltipContent`, altThemes[1][1]],
72
83
  [`${name}_darker`, darkerTheme],
73
84
  [`${name}_active`, activeTheme]
74
85
  ];
75
86
  const themes2 = Object.fromEntries(themeEntries);
76
87
  return themes2;
77
88
  }
78
- __name(createThemesFrom, "createThemesFrom");
79
- const createTheme = /* @__PURE__ */ __name((str = 1, {
89
+ const themeCreator = (str = 1, {
80
90
  backgrounds,
81
91
  isLight = true,
82
92
  isBase = false,
83
93
  colors = [...backgrounds].reverse(),
84
94
  borderColors = isLight ? colors : backgrounds,
85
- backgroundStronger,
95
+ backgroundStrong,
86
96
  offsets: offsetsProp
87
97
  }) => {
88
98
  const offsets = {
@@ -90,36 +100,49 @@ const createTheme = /* @__PURE__ */ __name((str = 1, {
90
100
  background: (offsetsProp == null ? void 0 : offsetsProp.background) ?? [0, 0, 0, 0],
91
101
  color: (offsetsProp == null ? void 0 : offsetsProp.color) ?? [0, 0, 0, 0]
92
102
  };
93
- const darkColors = isLight ? colors : backgrounds;
103
+ const darkColors2 = isLight ? colors : backgrounds;
94
104
  const lighterDir = isLight ? -1 : 1;
95
105
  const darkerDir = -lighterDir;
96
106
  const strongerDir = isLight ? darkerDir : lighterDir;
97
- const get = /* @__PURE__ */ __name((arr, index, name = "background") => {
107
+ const softerDir = -strongerDir;
108
+ const get = (arr, index, name = "background") => {
98
109
  return arr[Math.max(0, Math.min(index + (offsets[name][str] || 0), arr.length - 1))];
99
- }, "get");
110
+ };
100
111
  const colorTranslucent = (0, import_colorUtils.setColorAlpha)((0, import_core.getVariableValue)(get(colors, 0 + str, "color")), 0.5);
101
- let theme = {
112
+ const theme = {
102
113
  background: get(backgrounds, str),
103
- backgroundStronger: backgroundStronger || get(backgrounds, str + strongerDir),
104
- backgroundSoft: get(backgrounds, str + 3),
105
- backgroundHover: get(backgrounds, str + strongerDir),
106
- backgroundPress: get(backgrounds, str + darkerDir * 1),
114
+ backgroundStrong: backgroundStrong || get(backgrounds, str + strongerDir * 2),
115
+ backgroundSoft: get(backgrounds, str + softerDir * 2),
116
+ backgroundHover: get(backgrounds, str + lighterDir),
117
+ backgroundPress: get(backgrounds, str + darkerDir),
107
118
  backgroundFocus: get(backgrounds, str + darkerDir * 2),
108
- backgroundTransparent: import_tokens.color.grayA1,
119
+ backgroundTransparent: "hsla(0, 0%, 0%, 0.012)",
109
120
  color: get(colors, 0 + str, "color"),
110
121
  colorHover: get(colors, 1 + str, "color"),
111
122
  colorPress: get(colors, 2 + str, "color"),
112
123
  colorFocus: get(colors, 3 + str, "color"),
113
124
  colorTranslucent,
114
- colorMid: colors[Math.floor(colors.length / 2)],
115
- shadowColor: isLight ? import_tokens.color.grayA2 : import_tokens.color.grayA8,
116
- shadowColorHover: darkColors[!isLight ? 1 : 8],
117
- shadowColorPress: darkColors[!isLight ? 1 : 8],
118
- shadowColorFocus: darkColors[!isLight ? 1 : 8],
125
+ colorMid: (isLight ? colors : backgrounds)[Math.floor(colors.length / 2)],
126
+ shadowColor: isLight ? "hsla(0, 0%, 0%, 0.03)" : "hsla(0, 0%, 0%, 0.2)",
127
+ shadowColorHover: darkColors2[!isLight ? 1 : 8],
128
+ shadowColorPress: darkColors2[!isLight ? 1 : 8],
129
+ shadowColorFocus: darkColors2[!isLight ? 1 : 8],
119
130
  borderColor: null,
120
131
  borderColorHover: null,
121
132
  borderColorPress: null,
122
- borderColorFocus: null
133
+ borderColorFocus: null,
134
+ color1: backgrounds[0],
135
+ color2: backgrounds[1],
136
+ color3: backgrounds[2],
137
+ color4: backgrounds[3],
138
+ color5: backgrounds[4],
139
+ color6: backgrounds[5],
140
+ color7: backgrounds[6],
141
+ color8: backgrounds[7],
142
+ color9: backgrounds[8],
143
+ color10: backgrounds[9],
144
+ color11: backgrounds[10],
145
+ color12: backgrounds[11]
123
146
  };
124
147
  if (isBase) {
125
148
  Object.assign(theme, {
@@ -137,62 +160,52 @@ const createTheme = /* @__PURE__ */ __name((str = 1, {
137
160
  });
138
161
  }
139
162
  return theme;
140
- }, "createTheme");
141
- const colorSchemes = [
142
- { name: "blue", colors: Colors.blue, darkColors: Colors.blueDark },
143
- { name: "gray", colors: Colors.gray, darkColors: Colors.grayDark },
144
- { name: "green", colors: Colors.green, darkColors: Colors.greenDark },
145
- { name: "indigo", colors: Colors.indigo, darkColors: Colors.indigoDark },
146
- { name: "orange", colors: Colors.orange, darkColors: Colors.orangeDark },
147
- { name: "pink", colors: Colors.pink, darkColors: Colors.pinkDark },
148
- { name: "purple", colors: Colors.purple, darkColors: Colors.purpleDark },
149
- { name: "red", colors: Colors.red, darkColors: Colors.redDark },
150
- { name: "violet", colors: Colors.violet, darkColors: Colors.violetDark },
151
- { name: "yellow", colors: Colors.yellow, darkColors: Colors.yellowDark },
152
- { name: "teal", colors: Colors.teal, darkColors: Colors.tealDark },
153
- { name: "lime", colors: Colors.lime, darkColors: Colors.limeDark },
154
- { name: "brown", colors: Colors.brown, darkColors: Colors.brownDark }
155
- ];
156
- const lightGradient = [
157
- "#fff",
158
- "#f4f4f4",
159
- import_tokens.color.gray1,
160
- import_tokens.color.gray2,
161
- import_tokens.color.gray3,
162
- import_tokens.color.gray4,
163
- import_tokens.color.gray5,
164
- import_tokens.color.gray6,
165
- import_tokens.color.gray7,
166
- import_tokens.color.gray8,
167
- import_tokens.color.gray9,
168
- import_tokens.color.gray10,
169
- import_tokens.color.gray11,
170
- import_tokens.color.gray12
171
- ];
172
- const darkGradient = [
173
- "#111111",
174
- "#151515",
175
- "#191919",
176
- "#232323",
177
- "#282828",
178
- "#323232",
179
- "#383838",
180
- "#424242",
181
- "#494949",
182
- "#545454",
183
- "#626262",
184
- "#777777"
185
- ];
186
- const lightThemes = createThemesFrom("light", createTheme, {
187
- backgrounds: lightGradient,
188
- backgroundStronger: "#fcfcfc",
189
- borderColors: lightGradient.slice(2),
190
- isLight: true
163
+ };
164
+ const themeColors = {
165
+ light: [
166
+ "#fff",
167
+ "#f4f4f4",
168
+ "hsl(0, 0%, 99.0%)",
169
+ "hsl(0, 0%, 97.3%)",
170
+ "hsl(0, 0%, 95.1%)",
171
+ "hsl(0, 0%, 93.0%)",
172
+ "hsl(0, 0%, 90.9%)",
173
+ "hsl(0, 0%, 88.7%)",
174
+ "hsl(0, 0%, 85.8%)",
175
+ "hsl(0, 0%, 78.0%)",
176
+ "hsl(0, 0%, 56.1%)",
177
+ "hsl(0, 0%, 52.3%)",
178
+ "hsl(0, 0%, 43.5%)",
179
+ "hsl(0, 0%, 9.0%)"
180
+ ],
181
+ dark: [
182
+ "#111111",
183
+ "#151515",
184
+ "#191919",
185
+ "#232323",
186
+ "#282828",
187
+ "#323232",
188
+ "#383838",
189
+ "#424242",
190
+ "#494949",
191
+ "#545454",
192
+ "#626262",
193
+ "#777777"
194
+ ]
195
+ };
196
+ const lightThemes = createThemesFrom("light", themeCreator, {
197
+ backgrounds: themeColors.light,
198
+ backgroundStrong: import_core.isWeb ? "#fefefe" : "#f2f2f2",
199
+ borderColors: themeColors.light.slice(2),
200
+ isLight: true,
201
+ offsets: {
202
+ background: [2, 2, 2, 2, 2, 2]
203
+ }
191
204
  });
192
- const darkThemes = createThemesFrom("dark", createTheme, {
193
- backgrounds: darkGradient,
194
- colors: lightGradient.slice(2),
195
- backgroundStronger: "#111",
205
+ const darkThemes = createThemesFrom("dark", themeCreator, {
206
+ backgrounds: themeColors.dark,
207
+ colors: themeColors.light.slice(2),
208
+ backgroundStrong: "#070707",
196
209
  isBase: true,
197
210
  isLight: false,
198
211
  shift: 1,
@@ -200,45 +213,78 @@ const darkThemes = createThemesFrom("dark", createTheme, {
200
213
  color: [0, 4, 5, 5, 5, 5]
201
214
  }
202
215
  });
203
- const baseThemes = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, lightThemes), {
204
- light: __spreadValues(__spreadValues({}, import_colors.allLightColors), lightThemes.light),
205
- light_active: makeActiveTheme(lightThemes.light),
216
+ darkThemes.dark_darker.background = "#030303";
217
+ darkThemes.dark_darker.backgroundStrong = "#000";
218
+ const light = (0, import_core.createTheme)({
219
+ ...import_tokens.lightColors,
220
+ ...lightThemes.light
221
+ });
222
+ const dark = (0, import_core.createTheme)({
223
+ ...import_tokens.darkColors,
224
+ ...darkThemes.dark
225
+ });
226
+ const baseThemes = {
227
+ ...lightThemes,
228
+ light,
229
+ light_active: lightThemes.light,
206
230
  light_Card: lightThemes.light,
231
+ light_SliderTrack: lightThemes.light_alt1,
232
+ light_SliderTrackActive: lightThemes.light_alt2,
233
+ light_Switch: lightThemes.light_alt2,
234
+ light_SwitchThumb: lightThemes.light,
207
235
  light_DrawerFrame: lightThemes.light_alt1,
208
- light_Button: lightThemes.light_alt1
209
- }), darkThemes), {
210
- dark: __spreadValues(__spreadValues({}, import_colors.allDarkColors), darkThemes.dark),
211
- dark_active: makeActiveTheme(darkThemes.dark),
212
- dark_Card: darkThemes.dark_alt1,
213
- dark_DrawerFrame: darkThemes.dark_alt2,
236
+ ...darkThemes,
237
+ dark,
238
+ dark_active: darkThemes.dark,
239
+ dark_Card: darkThemes.dark,
240
+ dark_DrawerFrame: darkThemes.dark_alt1,
241
+ dark_SliderTrack: darkThemes.dark_darker,
242
+ dark_SliderTrackActive: darkThemes.dark_alt2,
243
+ dark_Switch: darkThemes.dark_alt2,
244
+ dark_SwitchThumb: darkThemes.dark_darker,
214
245
  dark_Button: darkThemes.dark_alt1
215
- });
216
- function makeActiveTheme(theme) {
217
- const res = __spreadValues({}, theme);
218
- res.backgroundHover = res.background;
219
- res.colorHover = res.color;
220
- res.backgroundPress = res.background;
221
- res.colorPress = res.color;
222
- return res;
246
+ };
247
+ const darkEntries = Object.entries(dark);
248
+ const lightEntries = Object.entries(light);
249
+ function findColors(prefix, dark2 = false) {
250
+ return Object.fromEntries(
251
+ (dark2 ? darkEntries : lightEntries).filter(([k]) => k.startsWith(prefix))
252
+ );
223
253
  }
224
- __name(makeActiveTheme, "makeActiveTheme");
225
- const colorThemeEntries = colorSchemes.flatMap(({ name, colors, darkColors }) => {
254
+ const colorSchemes = [
255
+ { name: "blue", colors: findColors("blue"), darkColors: findColors("blue", true) },
256
+ { name: "gray", colors: findColors("gray"), darkColors: findColors("gray", true) },
257
+ { name: "green", colors: findColors("green"), darkColors: findColors("green", true) },
258
+ { name: "orange", colors: findColors("orange"), darkColors: findColors("orange", true) },
259
+ { name: "pink", colors: findColors("pink"), darkColors: findColors("pink", true) },
260
+ { name: "purple", colors: findColors("purple"), darkColors: findColors("purple", true) },
261
+ { name: "red", colors: findColors("red"), darkColors: findColors("red", true) },
262
+ { name: "yellow", colors: findColors("yellow"), darkColors: findColors("yellow", true) }
263
+ ];
264
+ const colorNames = [
265
+ "blue",
266
+ "green",
267
+ "orange",
268
+ "pink",
269
+ "purple",
270
+ "red",
271
+ "yellow",
272
+ "gray"
273
+ ];
274
+ const colorThemeEntries = colorSchemes.flatMap(({ name, colors, darkColors: darkColors2 }) => {
226
275
  const [altLightThemes, altDarkThemes] = [
227
- { colors: darkColors, backgrounds: colors },
228
- { colors, backgrounds: darkColors }
276
+ { colors: darkColors2, backgrounds: colors },
277
+ { colors, backgrounds: darkColors2 }
229
278
  ].map((props, i) => {
230
279
  const isLight = i === 0;
280
+ const colorsBase = Object.values(props.colors).slice(2);
231
281
  const [backgrounds, colors2] = [
232
282
  Object.values(props.backgrounds),
233
- Object.values(props.colors).slice(isLight ? 2 : 2)
283
+ isLight ? colorsBase : [colorsBase[0], "#ccc", ...colorsBase.slice(1)]
234
284
  ];
235
285
  const scheme = isLight ? "light" : "dark";
236
286
  const shift = isLight ? 0 : 1;
237
- if (!isLight) {
238
- const [_, h, sp, lp] = backgrounds[0].match(/hsl\(([0-9\.]+), ([0-9\.]+)\%, ([0-9\.]+)\%\)/);
239
- backgrounds.unshift(`hsl(${h}, ${sp}%, ${parseFloat(lp) / 2}%)`);
240
- }
241
- const themeWithAlts = createThemesFrom(name, createTheme, {
287
+ const themeWithAlts = createThemesFrom(name, themeCreator, {
242
288
  colors: colors2,
243
289
  backgrounds,
244
290
  borderColors: backgrounds,
@@ -246,34 +292,37 @@ const colorThemeEntries = colorSchemes.flatMap(({ name, colors, darkColors }) =>
246
292
  shift,
247
293
  isBase: false,
248
294
  offsets: {
249
- background: isLight ? [1, 1, 1, 1, 1, 1] : null,
295
+ background: isLight ? [2, 2, 2, 2, 2, 2] : null,
250
296
  borderColor: isLight ? [2, 2, 2, 3, 2] : null,
251
297
  color: isLight ? [0, 0, -1, -2, -3, -3, -4] : [-1, -1, -1, -1, -1, -1]
252
298
  }
253
299
  });
254
300
  return Object.entries(themeWithAlts).map(([k, v]) => [`${scheme}_${k}`, v]);
255
301
  });
256
- const lightButtonTheme = altLightThemes[0];
257
- const darkButtonTheme = altDarkThemes[0];
258
- return [
259
- ...altLightThemes,
260
- [`${lightButtonTheme[0]}_Button`, altLightThemes[2][1]],
261
- [`${lightButtonTheme[0]}_Card`, altLightThemes[2][1]],
262
- [`${lightButtonTheme[0]}_DrawerFrame`, altLightThemes[2][1]],
263
- ...altDarkThemes,
264
- [`${darkButtonTheme[0]}_Button`, altDarkThemes[2][1]],
265
- [`${darkButtonTheme[0]}_Card`, altDarkThemes[2][1]],
266
- [`${darkButtonTheme[0]}_DrawerFrame`, altDarkThemes[2][1]]
267
- ];
302
+ return [...altLightThemes, ...altDarkThemes];
268
303
  });
269
304
  const colorThemes = Object.fromEntries(colorThemeEntries);
270
- const allThemes = __spreadValues(__spreadValues({}, baseThemes), colorThemes);
305
+ baseThemes.dark_active = {
306
+ ...colorThemes.dark_blue_alt2,
307
+ background: import_tokens.darkColors.blue10,
308
+ backgroundHover: import_tokens.darkColors.blue11,
309
+ backgroundPress: import_tokens.darkColors.blue9,
310
+ backgroundFocus: import_tokens.darkColors.blue9,
311
+ color: import_tokens.darkColors.blue12,
312
+ colorHover: import_tokens.darkColors.blue12,
313
+ colorPress: import_tokens.darkColors.blue12,
314
+ colorFocus: import_tokens.darkColors.blue12
315
+ };
316
+ baseThemes.light_active = baseThemes.dark_active;
317
+ const allThemes = {
318
+ ...baseThemes,
319
+ ...colorThemes
320
+ };
271
321
  const themes = allThemes;
272
322
  // Annotate the CommonJS export names for ESM import in node:
273
323
  0 && (module.exports = {
324
+ colorNames,
274
325
  colorSchemes,
275
- darkGradient,
276
- lightGradient,
277
326
  themes
278
327
  });
279
328
  //# sourceMappingURL=themes.js.map