@tamagui/theme-base 1.0.1-beta.21 → 1.0.1-beta.210
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.
- package/dist/cjs/colorUtils.js +10 -10
- package/dist/cjs/colorUtils.js.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/themes.js +36 -251
- package/dist/cjs/themes.js.map +2 -2
- package/dist/cjs/tokens.js +113 -30
- package/dist/cjs/tokens.js.map +2 -2
- package/dist/esm/colorUtils.js +10 -13
- package/dist/esm/colorUtils.js.map +1 -1
- package/dist/esm/index.js +0 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/themes.js +36 -241
- package/dist/esm/themes.js.map +2 -2
- package/dist/esm/tokens.js +122 -18
- package/dist/esm/tokens.js.map +2 -2
- package/package.json +17 -6
- package/src/colorUtils.tsx +42 -0
- package/src/index.tsx +3 -0
- package/src/themes.tsx +39 -0
- package/src/tokens.tsx +172 -0
- package/types/themes.d.ts +5936 -4486
- package/types/tokens.d.ts +867 -197
- package/dist/jsx/colorUtils.js +0 -42
- package/dist/jsx/index.js +0 -3
- package/dist/jsx/themes.js +0 -245
- package/dist/jsx/tokens.js +0 -45
- package/types/colorUtils.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
- package/types/themes.d.ts.map +0 -1
- package/types/tokens.d.ts.map +0 -1
package/dist/cjs/colorUtils.js
CHANGED
|
@@ -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 =
|
|
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
|
-
}
|
|
35
|
-
const setColorAlpha =
|
|
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
|
-
}
|
|
48
|
-
const isValidHex =
|
|
49
|
-
const getChunksFromString =
|
|
50
|
-
const convertHexUnitTo256 =
|
|
51
|
-
const getAlphaFloat =
|
|
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
|
-
}
|
|
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,
|
|
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
package/dist/cjs/index.js.map
CHANGED
|
@@ -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": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,qBAAd;AACA,wBAAc,qBADd;AAEA,wBAAc,4BAFd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/themes.js
CHANGED
|
@@ -1,27 +1,8 @@
|
|
|
1
|
-
|
|
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,247 +15,51 @@ 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, {
|
|
41
|
-
colorSchemes: () => colorSchemes,
|
|
42
|
-
darkGradient: () => darkGradient,
|
|
43
|
-
lightGradient: () => lightGradient,
|
|
44
21
|
themes: () => themes
|
|
45
22
|
});
|
|
46
23
|
module.exports = __toCommonJS(themes_exports);
|
|
47
|
-
var
|
|
48
|
-
var import_colors = require("@tamagui/colors");
|
|
49
|
-
var import_core = require("@tamagui/core");
|
|
50
|
-
var import_colorUtils = require("./colorUtils");
|
|
24
|
+
var import_create_themes = require("@tamagui/create-themes");
|
|
51
25
|
var import_tokens = require("./tokens");
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
offsets: offsetsProp
|
|
87
|
-
}) => {
|
|
88
|
-
const offsets = {
|
|
89
|
-
borderColor: (offsetsProp == null ? void 0 : offsetsProp.borderColor) ?? (offsetsProp == null ? void 0 : offsetsProp.background) ?? [0, 0, 0, 0],
|
|
90
|
-
background: (offsetsProp == null ? void 0 : offsetsProp.background) ?? [0, 0, 0, 0],
|
|
91
|
-
color: (offsetsProp == null ? void 0 : offsetsProp.color) ?? [0, 0, 0, 0]
|
|
92
|
-
};
|
|
93
|
-
const darkColors = isLight ? colors : backgrounds;
|
|
94
|
-
const lighterDir = isLight ? -1 : 1;
|
|
95
|
-
const darkerDir = -lighterDir;
|
|
96
|
-
const strongerDir = isLight ? darkerDir : lighterDir;
|
|
97
|
-
const softerDir = -strongerDir;
|
|
98
|
-
const get = /* @__PURE__ */ __name((arr, index, name = "background") => {
|
|
99
|
-
return arr[Math.max(0, Math.min(index + (offsets[name][str] || 0), arr.length - 1))];
|
|
100
|
-
}, "get");
|
|
101
|
-
const colorTranslucent = (0, import_colorUtils.setColorAlpha)((0, import_core.getVariableValue)(get(colors, 0 + str, "color")), 0.5);
|
|
102
|
-
let theme = {
|
|
103
|
-
background: get(backgrounds, str),
|
|
104
|
-
backgroundStrong: backgroundStrong || get(backgrounds, str + strongerDir * 2),
|
|
105
|
-
backgroundSoft: get(backgrounds, str + softerDir * 2),
|
|
106
|
-
backgroundHover: get(backgrounds, str + lighterDir),
|
|
107
|
-
backgroundPress: get(backgrounds, str + darkerDir),
|
|
108
|
-
backgroundFocus: get(backgrounds, str + darkerDir * 2),
|
|
109
|
-
backgroundTransparent: import_tokens.color.grayA1,
|
|
110
|
-
color: get(colors, 0 + str, "color"),
|
|
111
|
-
colorHover: get(colors, 1 + str, "color"),
|
|
112
|
-
colorPress: get(colors, 2 + str, "color"),
|
|
113
|
-
colorFocus: get(colors, 3 + str, "color"),
|
|
114
|
-
colorTranslucent,
|
|
115
|
-
colorMid: colors[Math.floor(colors.length / 2)],
|
|
116
|
-
shadowColor: isLight ? import_tokens.color.grayA2 : import_tokens.color.grayA8,
|
|
117
|
-
shadowColorHover: darkColors[!isLight ? 1 : 8],
|
|
118
|
-
shadowColorPress: darkColors[!isLight ? 1 : 8],
|
|
119
|
-
shadowColorFocus: darkColors[!isLight ? 1 : 8],
|
|
120
|
-
borderColor: null,
|
|
121
|
-
borderColorHover: null,
|
|
122
|
-
borderColorPress: null,
|
|
123
|
-
borderColorFocus: null
|
|
124
|
-
};
|
|
125
|
-
if (isBase) {
|
|
126
|
-
Object.assign(theme, {
|
|
127
|
-
borderColor: isLight ? get(colors, 8 - str, "borderColor") : get(backgrounds, 2 + str, "borderColor"),
|
|
128
|
-
borderColorHover: isLight ? get(colors, 6 - str, "borderColor") : get(backgrounds, 3 + str, "borderColor"),
|
|
129
|
-
borderColorPress: isLight ? get(colors, 5 - str, "borderColor") : get(backgrounds, 1 + str, "borderColor"),
|
|
130
|
-
borderColorFocus: isLight ? get(colors, 4 - str, "borderColor") : get(backgrounds, 3 + str, "borderColor")
|
|
131
|
-
});
|
|
132
|
-
} else {
|
|
133
|
-
Object.assign(theme, {
|
|
134
|
-
borderColor: get(borderColors, 1 + strongerDir, "borderColor"),
|
|
135
|
-
borderColorHover: get(borderColors, 2 + strongerDir, "borderColor"),
|
|
136
|
-
borderColorPress: get(borderColors, 3 + strongerDir, "borderColor"),
|
|
137
|
-
borderColorFocus: get(borderColors, 4 + strongerDir, "borderColor")
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
return theme;
|
|
141
|
-
}, "createTheme");
|
|
142
|
-
const colorSchemes = [
|
|
143
|
-
{ name: "blue", colors: Colors.blue, darkColors: Colors.blueDark },
|
|
144
|
-
{ name: "gray", colors: Colors.gray, darkColors: Colors.grayDark },
|
|
145
|
-
{ name: "green", colors: Colors.green, darkColors: Colors.greenDark },
|
|
146
|
-
{ name: "indigo", colors: Colors.indigo, darkColors: Colors.indigoDark },
|
|
147
|
-
{ name: "orange", colors: Colors.orange, darkColors: Colors.orangeDark },
|
|
148
|
-
{ name: "pink", colors: Colors.pink, darkColors: Colors.pinkDark },
|
|
149
|
-
{ name: "purple", colors: Colors.purple, darkColors: Colors.purpleDark },
|
|
150
|
-
{ name: "red", colors: Colors.red, darkColors: Colors.redDark },
|
|
151
|
-
{ name: "violet", colors: Colors.violet, darkColors: Colors.violetDark },
|
|
152
|
-
{ name: "yellow", colors: Colors.yellow, darkColors: Colors.yellowDark },
|
|
153
|
-
{ name: "teal", colors: Colors.teal, darkColors: Colors.tealDark },
|
|
154
|
-
{ name: "lime", colors: Colors.lime, darkColors: Colors.limeDark },
|
|
155
|
-
{ name: "brown", colors: Colors.brown, darkColors: Colors.brownDark }
|
|
156
|
-
];
|
|
157
|
-
const lightGradient = [
|
|
158
|
-
"#fff",
|
|
159
|
-
"#f4f4f4",
|
|
160
|
-
import_tokens.color.gray1,
|
|
161
|
-
import_tokens.color.gray2,
|
|
162
|
-
import_tokens.color.gray3,
|
|
163
|
-
import_tokens.color.gray4,
|
|
164
|
-
import_tokens.color.gray5,
|
|
165
|
-
import_tokens.color.gray6,
|
|
166
|
-
import_tokens.color.gray7,
|
|
167
|
-
import_tokens.color.gray8,
|
|
168
|
-
import_tokens.color.gray9,
|
|
169
|
-
import_tokens.color.gray10,
|
|
170
|
-
import_tokens.color.gray11,
|
|
171
|
-
import_tokens.color.gray12
|
|
172
|
-
];
|
|
173
|
-
const darkGradient = [
|
|
174
|
-
"#111111",
|
|
175
|
-
"#151515",
|
|
176
|
-
"#191919",
|
|
177
|
-
"#232323",
|
|
178
|
-
"#282828",
|
|
179
|
-
"#323232",
|
|
180
|
-
"#383838",
|
|
181
|
-
"#424242",
|
|
182
|
-
"#494949",
|
|
183
|
-
"#545454",
|
|
184
|
-
"#626262",
|
|
185
|
-
"#777777"
|
|
186
|
-
];
|
|
187
|
-
const lightThemes = createThemesFrom("light", createTheme, {
|
|
188
|
-
backgrounds: lightGradient,
|
|
189
|
-
backgroundStrong: "#fcfcfc",
|
|
190
|
-
borderColors: lightGradient.slice(2),
|
|
191
|
-
isLight: true
|
|
192
|
-
});
|
|
193
|
-
const darkThemes = createThemesFrom("dark", createTheme, {
|
|
194
|
-
backgrounds: darkGradient,
|
|
195
|
-
colors: lightGradient.slice(2),
|
|
196
|
-
backgroundStrong: "#111",
|
|
197
|
-
isBase: true,
|
|
198
|
-
isLight: false,
|
|
199
|
-
shift: 1,
|
|
200
|
-
offsets: {
|
|
201
|
-
color: [0, 4, 5, 5, 5, 5]
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
const baseThemes = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, lightThemes), {
|
|
205
|
-
light: __spreadValues(__spreadValues({}, import_colors.allLightColors), lightThemes.light),
|
|
206
|
-
light_active: makeActiveTheme(lightThemes.light),
|
|
207
|
-
light_Card: lightThemes.light,
|
|
208
|
-
light_DrawerFrame: lightThemes.light_alt1,
|
|
209
|
-
light_Button: lightThemes.light_alt1
|
|
210
|
-
}), darkThemes), {
|
|
211
|
-
dark: __spreadValues(__spreadValues({}, import_colors.allDarkColors), darkThemes.dark),
|
|
212
|
-
dark_active: makeActiveTheme(darkThemes.dark),
|
|
213
|
-
dark_Card: darkThemes.dark_alt1,
|
|
214
|
-
dark_DrawerFrame: darkThemes.dark_alt2,
|
|
215
|
-
dark_Button: darkThemes.dark_alt1
|
|
216
|
-
});
|
|
217
|
-
function makeActiveTheme(theme) {
|
|
218
|
-
const res = __spreadValues({}, theme);
|
|
219
|
-
res.backgroundHover = res.background;
|
|
220
|
-
res.colorHover = res.color;
|
|
221
|
-
res.backgroundPress = res.background;
|
|
222
|
-
res.colorPress = res.color;
|
|
223
|
-
return res;
|
|
224
|
-
}
|
|
225
|
-
__name(makeActiveTheme, "makeActiveTheme");
|
|
226
|
-
const colorThemeEntries = colorSchemes.flatMap(({ name, colors, darkColors }) => {
|
|
227
|
-
const [altLightThemes, altDarkThemes] = [
|
|
228
|
-
{ colors: darkColors, backgrounds: colors },
|
|
229
|
-
{ colors, backgrounds: darkColors }
|
|
230
|
-
].map((props, i) => {
|
|
231
|
-
const isLight = i === 0;
|
|
232
|
-
const [backgrounds, colors2] = [
|
|
233
|
-
Object.values(props.backgrounds),
|
|
234
|
-
Object.values(props.colors).slice(isLight ? 2 : 2)
|
|
235
|
-
];
|
|
236
|
-
const scheme = isLight ? "light" : "dark";
|
|
237
|
-
const shift = isLight ? 0 : 1;
|
|
238
|
-
if (!isLight) {
|
|
239
|
-
const [_, h, sp, lp] = backgrounds[0].match(/hsl\(([0-9\.]+), ([0-9\.]+)\%, ([0-9\.]+)\%\)/);
|
|
240
|
-
backgrounds.unshift(`hsl(${h}, ${sp}%, ${parseFloat(lp) / 2}%)`);
|
|
241
|
-
}
|
|
242
|
-
const themeWithAlts = createThemesFrom(name, createTheme, {
|
|
243
|
-
colors: colors2,
|
|
244
|
-
backgrounds,
|
|
245
|
-
borderColors: backgrounds,
|
|
246
|
-
isLight,
|
|
247
|
-
shift,
|
|
248
|
-
isBase: false,
|
|
249
|
-
offsets: {
|
|
250
|
-
background: isLight ? [1, 1, 1, 1, 1, 1] : null,
|
|
251
|
-
borderColor: isLight ? [2, 2, 2, 3, 2] : null,
|
|
252
|
-
color: isLight ? [0, 0, -1, -2, -3, -3, -4] : [-1, -1, -1, -1, -1, -1]
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
return Object.entries(themeWithAlts).map(([k, v]) => [`${scheme}_${k}`, v]);
|
|
256
|
-
});
|
|
257
|
-
const lightButtonTheme = altLightThemes[0];
|
|
258
|
-
const darkButtonTheme = altDarkThemes[0];
|
|
259
|
-
return [
|
|
260
|
-
...altLightThemes,
|
|
261
|
-
[`${lightButtonTheme[0]}_Button`, altLightThemes[2][1]],
|
|
262
|
-
[`${lightButtonTheme[0]}_Card`, altLightThemes[2][1]],
|
|
263
|
-
[`${lightButtonTheme[0]}_DrawerFrame`, altLightThemes[2][1]],
|
|
264
|
-
...altDarkThemes,
|
|
265
|
-
[`${darkButtonTheme[0]}_Button`, altDarkThemes[2][1]],
|
|
266
|
-
[`${darkButtonTheme[0]}_Card`, altDarkThemes[2][1]],
|
|
267
|
-
[`${darkButtonTheme[0]}_DrawerFrame`, altDarkThemes[2][1]]
|
|
268
|
-
];
|
|
26
|
+
const themes = (0, import_create_themes.createThemes)({
|
|
27
|
+
activeColor: "blue",
|
|
28
|
+
light: [
|
|
29
|
+
"#fff",
|
|
30
|
+
"#f4f4f4",
|
|
31
|
+
"hsl(0, 0%, 99.0%)",
|
|
32
|
+
"hsl(0, 0%, 97.3%)",
|
|
33
|
+
"hsl(0, 0%, 95.1%)",
|
|
34
|
+
"hsl(0, 0%, 93.0%)",
|
|
35
|
+
"hsl(0, 0%, 90.9%)",
|
|
36
|
+
"hsl(0, 0%, 88.7%)",
|
|
37
|
+
"hsl(0, 0%, 85.8%)",
|
|
38
|
+
"hsl(0, 0%, 78.0%)",
|
|
39
|
+
"hsl(0, 0%, 56.1%)",
|
|
40
|
+
"hsl(0, 0%, 52.3%)",
|
|
41
|
+
"hsl(0, 0%, 43.5%)",
|
|
42
|
+
"hsl(0, 0%, 9.0%)"
|
|
43
|
+
],
|
|
44
|
+
dark: [
|
|
45
|
+
"#111111",
|
|
46
|
+
"#151515",
|
|
47
|
+
"#191919",
|
|
48
|
+
"#232323",
|
|
49
|
+
"#282828",
|
|
50
|
+
"#323232",
|
|
51
|
+
"#383838",
|
|
52
|
+
"#424242",
|
|
53
|
+
"#494949",
|
|
54
|
+
"#545454",
|
|
55
|
+
"#626262",
|
|
56
|
+
"#777777"
|
|
57
|
+
],
|
|
58
|
+
colorsLight: import_tokens.colorTokens.light,
|
|
59
|
+
colorsDark: import_tokens.colorTokens.dark
|
|
269
60
|
});
|
|
270
|
-
const colorThemes = Object.fromEntries(colorThemeEntries);
|
|
271
|
-
const allThemes = __spreadValues(__spreadValues({}, baseThemes), colorThemes);
|
|
272
|
-
const themes = allThemes;
|
|
273
61
|
// Annotate the CommonJS export names for ESM import in node:
|
|
274
62
|
0 && (module.exports = {
|
|
275
|
-
colorSchemes,
|
|
276
|
-
darkGradient,
|
|
277
|
-
lightGradient,
|
|
278
63
|
themes
|
|
279
64
|
});
|
|
280
65
|
//# sourceMappingURL=themes.js.map
|
package/dist/cjs/themes.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/themes.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as Colors from '@tamagui/colors'\nimport { allDarkColors, allLightColors } from '@tamagui/colors'\nimport { Variable, getVariableValue } from '@tamagui/core'\n\nimport { setColorAlpha } from './colorUtils'\nimport { color } from './tokens'\n\n// spaghetti ahead\n\ntype ThemeCreatorProps = {\n shift?: number\n backgrounds: (string | Variable)[]\n backgroundStrong?: string | Variable\n borderColors?: (string | Variable)[]\n colors?: (string | Variable)[]\n offsets?: {\n color?: number[] | null\n background?: number[] | null\n borderColor?: number[] | null\n }\n isLight?: boolean\n isBase?: boolean\n}\n\n// helpers\n\nconst alternates = [1, 2, 3, 4] as const\ntype AltKeys = 1 | 2 | 3 | 4 // one less for dark_darker\ntype AltName<Name extends string, Keys extends string | number> = `${Name}_alt${Keys}`\ntype ThemeCreator<A = any> = (str: number, props: ThemeCreatorProps) => A\n\nfunction createThemesFrom<Name extends string, GetTheme extends ThemeCreator = ThemeCreator>(\n name: Name,\n getTheme: GetTheme,\n props: ThemeCreatorProps\n): {\n [key in `${Name}_alt${AltKeys}` | `${Name}` | `${Name}_darker`]: GetTheme extends ThemeCreator<\n infer Theme\n >\n ? Theme\n : never\n} {\n const { shift = 0 } = props\n const theme = getTheme(0 + shift, props)\n let themeEntries: any[] = [[name, theme]]\n const altThemes: any[] = alternates.map((alt) => [\n `${name}_alt${alt}`,\n getTheme(alt + shift, props),\n ])\n const altButtonThemes: any[] = alternates.map((_, i) => {\n const [bName, bTheme] = [altThemes[i][0], (altThemes[i + 1] || altThemes[i])[1]]\n return [`${bName}_Button` as any, bTheme]\n })\n // add these after alts since we rely on positioning\n const darkerTheme = getTheme(Math.max(0, shift + (props.isLight ? 1 : -1)), props)\n const activeTheme = makeActiveTheme(theme)\n themeEntries = [\n ...themeEntries,\n ...altThemes,\n ...altButtonThemes,\n [`${name}_Button`, altThemes[0][1]],\n [`${name}_darker`, darkerTheme],\n [`${name}_active`, activeTheme],\n ]\n const themes = Object.fromEntries(themeEntries)\n // if (props.isLight) {\n // console.log('themes', themes)\n // }\n return themes as any\n}\n\nconst createTheme = (\n str = 1,\n {\n backgrounds,\n isLight = true,\n isBase = false,\n colors = [...backgrounds].reverse(),\n borderColors = isLight ? colors : backgrounds,\n backgroundStrong,\n offsets: offsetsProp,\n }: ThemeCreatorProps\n) => {\n const offsets = {\n borderColor: offsetsProp?.borderColor ?? offsetsProp?.background ?? [0, 0, 0, 0],\n background: offsetsProp?.background ?? [0, 0, 0, 0],\n color: offsetsProp?.color ?? [0, 0, 0, 0],\n }\n const darkColors = isLight ? colors : backgrounds\n const lighterDir = isLight ? -1 : 1\n const darkerDir = -lighterDir\n const strongerDir = isLight ? darkerDir : lighterDir\n const softerDir = -strongerDir\n const get = (arr: any[], index: number, name = 'background') => {\n return arr[Math.max(0, Math.min(index + (offsets[name][str] || 0), arr.length - 1))]\n }\n\n const colorTranslucent = setColorAlpha(getVariableValue(get(colors, 0 + str, 'color')), 0.5)\n\n let theme = {\n background: get(backgrounds, str),\n backgroundStrong: backgroundStrong || get(backgrounds, str + strongerDir * 2),\n backgroundSoft: get(backgrounds, str + softerDir * 2),\n backgroundHover: get(backgrounds, str + lighterDir),\n backgroundPress: get(backgrounds, str + darkerDir),\n backgroundFocus: get(backgrounds, str + darkerDir * 2),\n backgroundTransparent: color.grayA1,\n color: get(colors, 0 + str, 'color'),\n colorHover: get(colors, 1 + str, 'color'),\n colorPress: get(colors, 2 + str, 'color'),\n colorFocus: get(colors, 3 + str, 'color'),\n colorTranslucent,\n colorMid: colors[Math.floor(colors.length / 2)],\n shadowColor: isLight ? color.grayA2 : color.grayA8,\n shadowColorHover: darkColors[!isLight ? 1 : 8],\n shadowColorPress: darkColors[!isLight ? 1 : 8],\n shadowColorFocus: darkColors[!isLight ? 1 : 8],\n borderColor: null as any as string | Variable,\n borderColorHover: null as any as string | Variable,\n borderColorPress: null as any as string | Variable,\n borderColorFocus: null as any as string | Variable,\n }\n\n if (isBase) {\n Object.assign(theme, {\n borderColor: isLight\n ? get(colors, 8 - str, 'borderColor')\n : get(backgrounds, 2 + str, 'borderColor'),\n borderColorHover: isLight\n ? get(colors, 6 - str, 'borderColor')\n : get(backgrounds, 3 + str, 'borderColor'),\n borderColorPress: isLight\n ? get(colors, 5 - str, 'borderColor')\n : get(backgrounds, 1 + str, 'borderColor'),\n borderColorFocus: isLight\n ? get(colors, 4 - str, 'borderColor')\n : get(backgrounds, 3 + str, 'borderColor'),\n })\n } else {\n Object.assign(theme, {\n borderColor: get(borderColors, 1 + strongerDir, 'borderColor'),\n borderColorHover: get(borderColors, 2 + strongerDir, 'borderColor'),\n borderColorPress: get(borderColors, 3 + strongerDir, 'borderColor'),\n borderColorFocus: get(borderColors, 4 + strongerDir, 'borderColor'),\n })\n }\n\n return theme\n}\n\nexport const colorSchemes = [\n { name: 'blue', colors: Colors.blue, darkColors: Colors.blueDark },\n { name: 'gray', colors: Colors.gray, darkColors: Colors.grayDark },\n { name: 'green', colors: Colors.green, darkColors: Colors.greenDark },\n { name: 'indigo', colors: Colors.indigo, darkColors: Colors.indigoDark },\n { name: 'orange', colors: Colors.orange, darkColors: Colors.orangeDark },\n { name: 'pink', colors: Colors.pink, darkColors: Colors.pinkDark },\n { name: 'purple', colors: Colors.purple, darkColors: Colors.purpleDark },\n { name: 'red', colors: Colors.red, darkColors: Colors.redDark },\n { name: 'violet', colors: Colors.violet, darkColors: Colors.violetDark },\n { name: 'yellow', colors: Colors.yellow, darkColors: Colors.yellowDark },\n { name: 'teal', colors: Colors.teal, darkColors: Colors.tealDark },\n { name: 'lime', colors: Colors.lime, darkColors: Colors.limeDark },\n { name: 'brown', colors: Colors.brown, darkColors: Colors.brownDark },\n] as const\n\nexport type ColorNames = typeof colorSchemes[number]['name']\n\nexport const lightGradient = [\n '#fff',\n '#f4f4f4',\n color.gray1,\n color.gray2,\n color.gray3,\n color.gray4,\n color.gray5,\n color.gray6,\n color.gray7,\n color.gray8,\n color.gray9,\n color.gray10,\n color.gray11,\n color.gray12,\n]\n\nexport const darkGradient = [\n '#111111',\n '#151515',\n '#191919',\n '#232323',\n '#282828',\n '#323232',\n '#383838',\n '#424242',\n '#494949',\n '#545454',\n '#626262',\n '#777777',\n]\n\nconst lightThemes = createThemesFrom('light', createTheme, {\n backgrounds: lightGradient,\n // isBase: true,\n backgroundStrong: '#fcfcfc',\n borderColors: lightGradient.slice(2),\n isLight: true,\n})\n\nconst darkThemes = createThemesFrom('dark', createTheme, {\n backgrounds: darkGradient,\n colors: lightGradient.slice(2),\n backgroundStrong: '#111',\n isBase: true,\n isLight: false,\n shift: 1,\n offsets: {\n color: [0, 4, 5, 5, 5, 5],\n },\n})\n\nconst baseThemes = {\n // light\n ...lightThemes,\n light: {\n ...allLightColors,\n ...lightThemes.light,\n },\n light_active: makeActiveTheme(lightThemes.light),\n light_Card: lightThemes.light,\n light_DrawerFrame: lightThemes.light_alt1,\n light_Button: lightThemes.light_alt1,\n\n // dark\n ...darkThemes,\n dark: {\n ...allDarkColors,\n ...darkThemes.dark,\n },\n dark_active: makeActiveTheme(darkThemes.dark),\n dark_Card: darkThemes.dark_alt1,\n dark_DrawerFrame: darkThemes.dark_alt2,\n dark_Button: darkThemes.dark_alt1,\n}\n\nfunction makeActiveTheme(theme: any) {\n const res = { ...theme }\n res.backgroundHover = res.background\n res.colorHover = res.color\n res.backgroundPress = res.background\n res.colorPress = res.color\n return res\n}\n\ntype ColorThemeNames =\n | ColorNames\n | AltName<`light_${ColorNames}`, AltKeys>\n | AltName<`dark_${ColorNames}`, AltKeys>\n\nconst colorThemeEntries = colorSchemes.flatMap(({ name, colors, darkColors }) => {\n const [altLightThemes, altDarkThemes] = [\n { colors: darkColors, backgrounds: colors },\n { colors, backgrounds: darkColors },\n ].map((props, i) => {\n const isLight = i === 0\n const [backgrounds, colors] = [\n Object.values(props.backgrounds),\n Object.values(props.colors).slice(isLight ? 2 : 2),\n ] as const\n\n const scheme = isLight ? 'light' : 'dark'\n const shift = isLight ? 0 : 1\n\n if (!isLight) {\n const [_, h, sp, lp] = backgrounds[0].match(/hsl\\(([0-9\\.]+), ([0-9\\.]+)\\%, ([0-9\\.]+)\\%\\)/)!\n backgrounds.unshift(`hsl(${h}, ${sp}%, ${parseFloat(lp) / 2}%)`)\n }\n\n const themeWithAlts = createThemesFrom(name, createTheme, {\n colors,\n backgrounds,\n borderColors: backgrounds,\n isLight,\n shift,\n isBase: false,\n offsets: {\n background: isLight ? [1, 1, 1, 1, 1, 1] : null,\n borderColor: isLight ? [2, 2, 2, 3, 2] : null,\n color: isLight ? [0, 0, -1, -2, -3, -3, -4] : [-1, -1, -1, -1, -1, -1],\n },\n })\n\n return Object.entries(themeWithAlts).map(([k, v]) => [`${scheme}_${k}`, v])\n })\n const lightButtonTheme = altLightThemes[0]\n const darkButtonTheme = altDarkThemes[0]\n return [\n ...altLightThemes,\n [`${lightButtonTheme[0]}_Button`, altLightThemes[2][1]],\n [`${lightButtonTheme[0]}_Card`, altLightThemes[2][1]],\n [`${lightButtonTheme[0]}_DrawerFrame`, altLightThemes[2][1]],\n ...altDarkThemes,\n [`${darkButtonTheme[0]}_Button`, altDarkThemes[2][1]],\n [`${darkButtonTheme[0]}_Card`, altDarkThemes[2][1]],\n [`${darkButtonTheme[0]}_DrawerFrame`, altDarkThemes[2][1]],\n ]\n})\n\ntype MyThemeBase = typeof baseThemes['light_alt1']\n\nconst colorThemes: {\n [key in ColorThemeNames]: MyThemeBase\n} = Object.fromEntries(colorThemeEntries) as any\n\nconst allThemes = {\n ...baseThemes,\n ...colorThemes,\n} as const\n\nexport const themes: {\n [key in keyof typeof allThemes]: typeof baseThemes['light']\n} = allThemes as any\n\n// TODO\n// export function createThemes(props: {\n// colors?:\n// | 'amber'\n// | 'blue'\n// | 'bronze'\n// | 'brown'\n// | 'crimson'\n// | 'cyan'\n// | 'gold'\n// | 'grass'\n// | 'gray'\n// | 'green'\n// | 'indigo'\n// | 'lime'\n// | 'mint'\n// | 'olive'\n// | 'orange'\n// | 'pink'\n// | 'plum'\n// | 'purple'\n// | 'mauve'\n// | 'red'\n// | 'sage'\n// | 'sand'\n// | 'sky'\n// | 'slate'\n// | 'teal'\n// | 'tomato'\n// | 'violet'\n// | 'yellow'\n// alternates?: number\n// }) {}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { createThemes } from '@tamagui/create-themes'\n\nimport { colorTokens } from './tokens'\n\nexport const themes = createThemes<keyof typeof colorTokens.light>({\n activeColor: 'blue',\n light: [\n '#fff',\n '#f4f4f4',\n 'hsl(0, 0%, 99.0%)',\n 'hsl(0, 0%, 97.3%)',\n 'hsl(0, 0%, 95.1%)',\n 'hsl(0, 0%, 93.0%)',\n 'hsl(0, 0%, 90.9%)',\n 'hsl(0, 0%, 88.7%)',\n 'hsl(0, 0%, 85.8%)',\n 'hsl(0, 0%, 78.0%)',\n 'hsl(0, 0%, 56.1%)',\n 'hsl(0, 0%, 52.3%)',\n 'hsl(0, 0%, 43.5%)',\n 'hsl(0, 0%, 9.0%)',\n ],\n dark: [\n '#111111',\n '#151515',\n '#191919',\n '#232323',\n '#282828',\n '#323232',\n '#383838',\n '#424242',\n '#494949',\n '#545454',\n '#626262',\n '#777777',\n ],\n colorsLight: colorTokens.light,\n colorsDark: colorTokens.dark,\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAA6B;AAE7B,oBAA4B;AAErB,MAAM,aAAS,mCAA6C;AAAA,EACjE,aAAa;AAAA,EACb,OAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,MAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,aAAa,0BAAY;AAAA,EACzB,YAAY,0BAAY;AAC1B,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/tokens.js
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
20
6
|
var __export = (target, all) => {
|
|
21
7
|
for (var name in all)
|
|
22
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -33,21 +19,58 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
33
19
|
var tokens_exports = {};
|
|
34
20
|
__export(tokens_exports, {
|
|
35
21
|
color: () => color,
|
|
36
|
-
|
|
22
|
+
colorTokens: () => colorTokens,
|
|
23
|
+
darkColors: () => darkColors,
|
|
24
|
+
lightColors: () => lightColors,
|
|
37
25
|
radius: () => radius,
|
|
38
26
|
size: () => size,
|
|
39
|
-
sizeKeys: () => sizeKeys,
|
|
40
27
|
space: () => space,
|
|
28
|
+
tokens: () => tokens,
|
|
41
29
|
zIndex: () => zIndex
|
|
42
30
|
});
|
|
43
31
|
module.exports = __toCommonJS(tokens_exports);
|
|
44
32
|
var import_colors = require("@tamagui/colors");
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
33
|
+
var import_core = require("@tamagui/core");
|
|
34
|
+
const size = {
|
|
35
|
+
0: 0,
|
|
36
|
+
0.25: 2,
|
|
37
|
+
0.5: 4,
|
|
38
|
+
0.75: 8,
|
|
39
|
+
1: 20,
|
|
40
|
+
1.5: 24,
|
|
41
|
+
2: 28,
|
|
42
|
+
2.5: 32,
|
|
43
|
+
3: 36,
|
|
44
|
+
3.5: 40,
|
|
45
|
+
4: 44,
|
|
46
|
+
true: 44,
|
|
47
|
+
4.5: 48,
|
|
48
|
+
5: 52,
|
|
49
|
+
6: 64,
|
|
50
|
+
7: 74,
|
|
51
|
+
8: 84,
|
|
52
|
+
9: 94,
|
|
53
|
+
10: 104,
|
|
54
|
+
11: 124,
|
|
55
|
+
12: 144,
|
|
56
|
+
13: 164,
|
|
57
|
+
14: 184,
|
|
58
|
+
15: 204,
|
|
59
|
+
16: 224,
|
|
60
|
+
17: 224,
|
|
61
|
+
18: 244,
|
|
62
|
+
19: 264,
|
|
63
|
+
20: 284
|
|
64
|
+
};
|
|
65
|
+
const spaces = Object.entries(size).map(([k, v]) => [
|
|
66
|
+
k,
|
|
67
|
+
Math.max(0, v <= 16 ? Math.round(v * 0.333) : Math.floor(v * 0.7 - 12))
|
|
68
|
+
]);
|
|
69
|
+
const spacesNegative = spaces.map(([k, v]) => [`-${k}`, -v]);
|
|
70
|
+
const space = {
|
|
71
|
+
...Object.fromEntries(spaces),
|
|
72
|
+
...Object.fromEntries(spacesNegative)
|
|
73
|
+
};
|
|
51
74
|
const zIndex = {
|
|
52
75
|
0: 0,
|
|
53
76
|
1: 100,
|
|
@@ -56,7 +79,55 @@ const zIndex = {
|
|
|
56
79
|
4: 400,
|
|
57
80
|
5: 500
|
|
58
81
|
};
|
|
59
|
-
const
|
|
82
|
+
const colorTokens = {
|
|
83
|
+
light: {
|
|
84
|
+
blue: import_colors.blue,
|
|
85
|
+
gray: import_colors.gray,
|
|
86
|
+
green: import_colors.green,
|
|
87
|
+
orange: import_colors.orange,
|
|
88
|
+
pink: import_colors.pink,
|
|
89
|
+
purple: import_colors.purple,
|
|
90
|
+
red: import_colors.red,
|
|
91
|
+
yellow: import_colors.yellow
|
|
92
|
+
},
|
|
93
|
+
dark: {
|
|
94
|
+
blue: import_colors.blueDark,
|
|
95
|
+
gray: import_colors.grayDark,
|
|
96
|
+
green: import_colors.greenDark,
|
|
97
|
+
orange: import_colors.orangeDark,
|
|
98
|
+
pink: import_colors.pinkDark,
|
|
99
|
+
purple: import_colors.purpleDark,
|
|
100
|
+
red: import_colors.redDark,
|
|
101
|
+
yellow: import_colors.yellowDark
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const darkColors = {
|
|
105
|
+
...colorTokens.dark.blue,
|
|
106
|
+
...colorTokens.dark.gray,
|
|
107
|
+
...colorTokens.dark.green,
|
|
108
|
+
...colorTokens.dark.orange,
|
|
109
|
+
...colorTokens.dark.pink,
|
|
110
|
+
...colorTokens.dark.purple,
|
|
111
|
+
...colorTokens.dark.red,
|
|
112
|
+
...colorTokens.dark.yellow
|
|
113
|
+
};
|
|
114
|
+
const lightColors = {
|
|
115
|
+
...colorTokens.light.blue,
|
|
116
|
+
...colorTokens.light.gray,
|
|
117
|
+
...colorTokens.light.green,
|
|
118
|
+
...colorTokens.light.orange,
|
|
119
|
+
...colorTokens.light.pink,
|
|
120
|
+
...colorTokens.light.purple,
|
|
121
|
+
...colorTokens.light.red,
|
|
122
|
+
...colorTokens.light.yellow
|
|
123
|
+
};
|
|
124
|
+
const color = {
|
|
125
|
+
...postfixObjKeys(lightColors, "Light"),
|
|
126
|
+
...postfixObjKeys(darkColors, "Dark")
|
|
127
|
+
};
|
|
128
|
+
function postfixObjKeys(obj, postfix) {
|
|
129
|
+
return Object.fromEntries(Object.entries(obj).map(([k, v]) => [`${k}${postfix}`, v]));
|
|
130
|
+
}
|
|
60
131
|
const radius = {
|
|
61
132
|
0: 0,
|
|
62
133
|
1: 3,
|
|
@@ -64,19 +135,31 @@ const radius = {
|
|
|
64
135
|
3: 7,
|
|
65
136
|
4: 9,
|
|
66
137
|
5: 10,
|
|
67
|
-
6:
|
|
68
|
-
7:
|
|
69
|
-
8:
|
|
70
|
-
9:
|
|
138
|
+
6: 16,
|
|
139
|
+
7: 19,
|
|
140
|
+
8: 22,
|
|
141
|
+
9: 26,
|
|
142
|
+
10: 34,
|
|
143
|
+
11: 42,
|
|
144
|
+
12: 50
|
|
71
145
|
};
|
|
146
|
+
const tokens = (0, import_core.createTokens)({
|
|
147
|
+
color,
|
|
148
|
+
radius,
|
|
149
|
+
zIndex,
|
|
150
|
+
space,
|
|
151
|
+
size
|
|
152
|
+
});
|
|
72
153
|
// Annotate the CommonJS export names for ESM import in node:
|
|
73
154
|
0 && (module.exports = {
|
|
74
155
|
color,
|
|
75
|
-
|
|
156
|
+
colorTokens,
|
|
157
|
+
darkColors,
|
|
158
|
+
lightColors,
|
|
76
159
|
radius,
|
|
77
160
|
size,
|
|
78
|
-
sizeKeys,
|
|
79
161
|
space,
|
|
162
|
+
tokens,
|
|
80
163
|
zIndex
|
|
81
164
|
});
|
|
82
165
|
//# sourceMappingURL=tokens.js.map
|