@tamagui/themes 1.116.1 → 1.116.2

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.
Files changed (37) hide show
  1. package/dist/cjs/componentThemeDefinitions.js +123 -0
  2. package/dist/cjs/generated-new.js +1806 -0
  3. package/dist/cjs/generated-v2.js +1788 -0
  4. package/dist/cjs/generated-v3.js +3564 -0
  5. package/dist/cjs/helpers.js +29 -0
  6. package/dist/cjs/index.js +22 -0
  7. package/dist/cjs/masks.js +86 -0
  8. package/dist/cjs/palettes.js +82 -0
  9. package/dist/cjs/shadows.js +34 -0
  10. package/dist/cjs/templates.js +106 -0
  11. package/dist/cjs/themes-new.js +76 -0
  12. package/dist/cjs/themes-old.js +266 -0
  13. package/dist/cjs/themes.js +29 -0
  14. package/dist/cjs/tokens.js +143 -0
  15. package/dist/cjs/v2-themes.js +479 -0
  16. package/dist/cjs/v2.js +47 -0
  17. package/dist/cjs/v3-themes.js +594 -0
  18. package/dist/cjs/v3.js +47 -0
  19. package/package.json +7 -7
  20. /package/dist/cjs/{componentThemeDefinitions.cjs.map → componentThemeDefinitions.js.map} +0 -0
  21. /package/dist/cjs/{generated-new.cjs.map → generated-new.js.map} +0 -0
  22. /package/dist/cjs/{generated-v2.cjs.map → generated-v2.js.map} +0 -0
  23. /package/dist/cjs/{generated-v3.cjs.map → generated-v3.js.map} +0 -0
  24. /package/dist/cjs/{helpers.cjs.map → helpers.js.map} +0 -0
  25. /package/dist/cjs/{index.cjs.map → index.js.map} +0 -0
  26. /package/dist/cjs/{masks.cjs.map → masks.js.map} +0 -0
  27. /package/dist/cjs/{palettes.cjs.map → palettes.js.map} +0 -0
  28. /package/dist/cjs/{shadows.cjs.map → shadows.js.map} +0 -0
  29. /package/dist/cjs/{templates.cjs.map → templates.js.map} +0 -0
  30. /package/dist/cjs/{themes-new.cjs.map → themes-new.js.map} +0 -0
  31. /package/dist/cjs/{themes-old.cjs.map → themes-old.js.map} +0 -0
  32. /package/dist/cjs/{themes.cjs.map → themes.js.map} +0 -0
  33. /package/dist/cjs/{tokens.cjs.map → tokens.js.map} +0 -0
  34. /package/dist/cjs/{v2-themes.cjs.map → v2-themes.js.map} +0 -0
  35. /package/dist/cjs/{v2.cjs.map → v2.js.map} +0 -0
  36. /package/dist/cjs/{v3-themes.cjs.map → v3-themes.js.map} +0 -0
  37. /package/dist/cjs/{v3.cjs.map → v3.js.map} +0 -0
@@ -0,0 +1,266 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var themes_old_exports = {};
16
+ __export(themes_old_exports, {
17
+ themes: () => themes
18
+ });
19
+ module.exports = __toCommonJS(themes_old_exports);
20
+ var import_create_theme = require("@tamagui/create-theme"), import_tokens = require("./tokens");
21
+ const lightTransparent = "rgba(255,255,255,0)", darkTransparent = "rgba(10,10,10,0)", palettes = {
22
+ dark: [
23
+ darkTransparent,
24
+ "#050505",
25
+ "#151515",
26
+ "#191919",
27
+ "#232323",
28
+ "#282828",
29
+ "#323232",
30
+ "#424242",
31
+ "#494949",
32
+ "#545454",
33
+ "#626262",
34
+ "#a5a5a5",
35
+ "#fff",
36
+ lightTransparent
37
+ ],
38
+ light: [
39
+ lightTransparent,
40
+ "#fff",
41
+ "#f9f9f9",
42
+ "hsl(0, 0%, 97.3%)",
43
+ "hsl(0, 0%, 95.1%)",
44
+ "hsl(0, 0%, 94.0%)",
45
+ "hsl(0, 0%, 92.0%)",
46
+ "hsl(0, 0%, 89.5%)",
47
+ "hsl(0, 0%, 81.0%)",
48
+ "hsl(0, 0%, 56.1%)",
49
+ "hsl(0, 0%, 50.3%)",
50
+ "hsl(0, 0%, 42.5%)",
51
+ "hsl(0, 0%, 9.0%)",
52
+ darkTransparent
53
+ ]
54
+ }, templateColors = {
55
+ color1: 1,
56
+ color2: 2,
57
+ color3: 3,
58
+ color4: 4,
59
+ color5: 5,
60
+ color6: 6,
61
+ color7: 7,
62
+ color8: 8,
63
+ color9: 9,
64
+ color10: 10,
65
+ color11: 11,
66
+ color12: 12
67
+ }, templateShadows = {
68
+ shadowColor: 1,
69
+ shadowColorHover: 1,
70
+ shadowColorPress: 2,
71
+ shadowColorFocus: 2
72
+ }, toSkip = {
73
+ ...templateShadows
74
+ }, override = Object.fromEntries(Object.entries(toSkip).map(([k]) => [k, 0])), overrideShadows = Object.fromEntries(
75
+ Object.entries(templateShadows).map(([k]) => [k, 0])
76
+ ), overrideWithColors = {
77
+ ...override,
78
+ color: 0,
79
+ colorHover: 0,
80
+ colorFocus: 0,
81
+ colorPress: 0
82
+ }, template = {
83
+ ...templateColors,
84
+ ...toSkip,
85
+ // the background, color, etc keys here work like generics - they make it so you
86
+ // can publish components for others to use without mandating a specific color scale
87
+ // the @tamagui/button Button component looks for `$background`, so you set the
88
+ // dark_red_Button theme to have a stronger background than the dark_red theme.
89
+ background: 2,
90
+ backgroundHover: 3,
91
+ backgroundPress: 4,
92
+ backgroundFocus: 5,
93
+ backgroundStrong: 1,
94
+ backgroundTransparent: 0,
95
+ color: -1,
96
+ colorHover: -2,
97
+ colorPress: -1,
98
+ colorFocus: -2,
99
+ colorTransparent: -0,
100
+ borderColor: 4,
101
+ borderColorHover: 5,
102
+ borderColorPress: 3,
103
+ borderColorFocus: 4,
104
+ placeholderColor: -4
105
+ }, lightShadowColor = "rgba(0,0,0,0.02)", lightShadowColorStrong = "rgba(0,0,0,0.066)", darkShadowColor = "rgba(0,0,0,0.2)", darkShadowColorStrong = "rgba(0,0,0,0.3)", lightShadows = {
106
+ shadowColor: lightShadowColorStrong,
107
+ shadowColorHover: lightShadowColorStrong,
108
+ shadowColorPress: lightShadowColor,
109
+ shadowColorFocus: lightShadowColor
110
+ }, darkShadows = {
111
+ shadowColor: darkShadowColorStrong,
112
+ shadowColorHover: darkShadowColorStrong,
113
+ shadowColorPress: darkShadowColor,
114
+ shadowColorFocus: darkShadowColor
115
+ }, lightTemplate = {
116
+ ...template,
117
+ background: 2,
118
+ backgroundHover: 3,
119
+ backgroundPress: 4,
120
+ // our light color palette is... a bit unique
121
+ borderColor: 6,
122
+ borderColorHover: 7,
123
+ borderColorFocus: 5,
124
+ borderColorPress: 6,
125
+ ...lightShadows
126
+ }, darkTemplate = { ...template, ...darkShadows }, light = (0, import_create_theme.createTheme)(palettes.light, lightTemplate), dark = (0, import_create_theme.createTheme)(palettes.dark, darkTemplate), baseThemes = {
127
+ light,
128
+ dark
129
+ }, masks = {
130
+ skip: import_create_theme.skipMask,
131
+ weaker: (0, import_create_theme.createWeakenMask)(),
132
+ stronger: (0, import_create_theme.createStrengthenMask)()
133
+ }, maskOptions = {
134
+ override,
135
+ skip: toSkip,
136
+ // avoids the transparent ends
137
+ max: palettes.light.length - 2,
138
+ min: 1
139
+ }, transparent = (hsl, opacity = 0) => hsl.replace("%)", `%, ${opacity})`).replace("hsl(", "hsla("), [lightColorThemes, darkColorThemes] = [import_tokens.colorTokens.light, import_tokens.colorTokens.dark].map(
140
+ (colorSet, i) => {
141
+ const isLight = i === 0, theme = baseThemes[isLight ? "light" : "dark"];
142
+ return Object.fromEntries(
143
+ Object.keys(colorSet).map((color) => {
144
+ const colorPalette = Object.values(colorSet[color]), [head, tail] = [
145
+ colorPalette.slice(0, 6),
146
+ colorPalette.slice(colorPalette.length - 5)
147
+ ], palette = [
148
+ transparent(colorPalette[0]),
149
+ ...head,
150
+ ...tail,
151
+ theme.color,
152
+ transparent(colorPalette[colorPalette.length - 1])
153
+ ], colorTheme = (0, import_create_theme.createTheme)(
154
+ palette,
155
+ isLight ? {
156
+ ...lightTemplate,
157
+ // light color themes are a bit less sensitive
158
+ borderColor: 4,
159
+ borderColorHover: 5,
160
+ borderColorFocus: 4,
161
+ borderColorPress: 4
162
+ } : darkTemplate
163
+ );
164
+ return [color, colorTheme];
165
+ })
166
+ );
167
+ }
168
+ ), allThemes = (0, import_create_theme.addChildren)(baseThemes, (name, theme) => {
169
+ const isLight = name === "light", inverseTheme = baseThemes[isLight ? "dark" : "light"], colorThemes = isLight ? lightColorThemes : darkColorThemes, inverseColorThemes = isLight ? darkColorThemes : lightColorThemes, allColorThemes = (0, import_create_theme.addChildren)(colorThemes, (colorName, colorTheme) => {
170
+ const inverse = inverseColorThemes[colorName];
171
+ return {
172
+ ...getAltThemes({
173
+ theme: colorTheme,
174
+ inverse,
175
+ isLight
176
+ }),
177
+ ...getComponentThemes(colorTheme, inverse, isLight)
178
+ };
179
+ });
180
+ return {
181
+ ...{
182
+ ...getAltThemes({ theme, inverse: inverseTheme, isLight }),
183
+ ...getComponentThemes(theme, inverseTheme, isLight)
184
+ },
185
+ ...allColorThemes
186
+ };
187
+ });
188
+ function getAltThemes({
189
+ theme,
190
+ inverse,
191
+ isLight,
192
+ activeTheme
193
+ }) {
194
+ const maskOptionsAlt = {
195
+ ...maskOptions,
196
+ override: overrideShadows
197
+ }, alt1 = (0, import_create_theme.applyMask)(theme, masks.weaker, maskOptionsAlt), alt2 = (0, import_create_theme.applyMask)(alt1, masks.weaker, maskOptionsAlt), active = activeTheme ?? (process.env.ACTIVE_THEME_INVERSE ? inverse : (0, import_create_theme.applyMask)(theme, masks.weaker, {
198
+ ...maskOptions,
199
+ strength: 3,
200
+ skip: {
201
+ ...maskOptions.skip,
202
+ color: 1
203
+ }
204
+ }));
205
+ return (0, import_create_theme.addChildren)({ alt1, alt2, active }, (_, subTheme) => getComponentThemes(subTheme, subTheme === inverse ? theme : inverse, isLight));
206
+ }
207
+ function getComponentThemes(theme, inverse, isLight) {
208
+ const componentMaskOptions = {
209
+ ...maskOptions,
210
+ override: overrideWithColors,
211
+ skip: {
212
+ ...maskOptions.skip,
213
+ // skip colors too just for component sub themes
214
+ ...templateColors
215
+ }
216
+ }, weaker1 = (0, import_create_theme.applyMask)(theme, masks.weaker, componentMaskOptions), base = (0, import_create_theme.applyMask)(weaker1, masks.stronger, componentMaskOptions), weaker2 = (0, import_create_theme.applyMask)(weaker1, masks.weaker, componentMaskOptions), stronger1 = (0, import_create_theme.applyMask)(theme, masks.stronger, componentMaskOptions), inverse1 = (0, import_create_theme.applyMask)(inverse, masks.weaker, componentMaskOptions), inverse2 = (0, import_create_theme.applyMask)(inverse1, masks.weaker, componentMaskOptions), strongerBorderLighterBackground = isLight ? {
217
+ ...stronger1,
218
+ borderColor: weaker1.borderColor,
219
+ borderColorHover: weaker1.borderColorHover,
220
+ borderColorPress: weaker1.borderColorPress,
221
+ borderColorFocus: weaker1.borderColorFocus
222
+ } : {
223
+ ...(0, import_create_theme.applyMask)(theme, masks.skip, componentMaskOptions),
224
+ borderColor: weaker1.borderColor,
225
+ borderColorHover: weaker1.borderColorHover,
226
+ borderColorPress: weaker1.borderColorPress,
227
+ borderColorFocus: weaker1.borderColorFocus
228
+ }, overlayTheme = {
229
+ background: isLight ? "rgba(0,0,0,0.5)" : "rgba(0,0,0,0.9)"
230
+ }, weaker2WithoutBorder = {
231
+ ...weaker2,
232
+ borderColor: "transparent",
233
+ borderColorHover: "transparent"
234
+ };
235
+ return {
236
+ ListItem: isLight ? stronger1 : base,
237
+ Card: weaker1,
238
+ Button: weaker2WithoutBorder,
239
+ Checkbox: weaker2,
240
+ DrawerFrame: weaker1,
241
+ SliderTrack: stronger1,
242
+ SliderTrackActive: weaker2,
243
+ SliderThumb: inverse1,
244
+ Progress: weaker1,
245
+ ProgressIndicator: inverse,
246
+ Switch: weaker2,
247
+ SwitchThumb: inverse2,
248
+ TooltipArrow: weaker1,
249
+ TooltipContent: weaker2,
250
+ Input: strongerBorderLighterBackground,
251
+ TextArea: strongerBorderLighterBackground,
252
+ Tooltip: inverse1,
253
+ // make overlays always dark
254
+ SheetOverlay: overlayTheme,
255
+ DialogOverlay: overlayTheme,
256
+ ModalOverlay: overlayTheme
257
+ };
258
+ }
259
+ const themes = {
260
+ ...allThemes,
261
+ // bring back the full type, the rest use a subset to avoid clogging up ts,
262
+ // tamagui will be smart and use the top level themes as the type for useTheme() etc
263
+ light: (0, import_create_theme.createTheme)(palettes.light, lightTemplate, { nonInheritedValues: import_tokens.lightColors }),
264
+ dark: (0, import_create_theme.createTheme)(palettes.dark, darkTemplate, { nonInheritedValues: import_tokens.darkColors })
265
+ };
266
+ //# sourceMappingURL=themes-old.js.map
@@ -0,0 +1,29 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
+ // If the importer is in node compatibility mode or this is not an ESM
17
+ // file that has been converted to a CommonJS file using a Babel-
18
+ // compatible transform (i.e. "__esModule" has not been set), then set
19
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
+ mod
22
+ )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
+ var themes_exports = {};
24
+ __export(themes_exports, {
25
+ themes: () => themes
26
+ });
27
+ module.exports = __toCommonJS(themes_exports);
28
+ var themes = __toESM(require("./generated-new"));
29
+ //# sourceMappingURL=themes.js.map
@@ -0,0 +1,143 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var tokens_exports = {};
16
+ __export(tokens_exports, {
17
+ color: () => color,
18
+ colorTokens: () => colorTokens,
19
+ darkColors: () => darkColors,
20
+ lightColors: () => lightColors,
21
+ radius: () => radius,
22
+ size: () => size,
23
+ space: () => space,
24
+ tokens: () => tokens,
25
+ zIndex: () => zIndex
26
+ });
27
+ module.exports = __toCommonJS(tokens_exports);
28
+ var import_colors = require("@tamagui/colors"), import_web = require("@tamagui/web");
29
+ const size = {
30
+ $0: 0,
31
+ "$0.25": 2,
32
+ "$0.5": 4,
33
+ "$0.75": 8,
34
+ $1: 20,
35
+ "$1.5": 24,
36
+ $2: 28,
37
+ "$2.5": 32,
38
+ $3: 36,
39
+ "$3.5": 40,
40
+ $4: 44,
41
+ $true: 44,
42
+ "$4.5": 48,
43
+ $5: 52,
44
+ $6: 64,
45
+ $7: 74,
46
+ $8: 84,
47
+ $9: 94,
48
+ $10: 104,
49
+ $11: 124,
50
+ $12: 144,
51
+ $13: 164,
52
+ $14: 184,
53
+ $15: 204,
54
+ $16: 224,
55
+ $17: 224,
56
+ $18: 244,
57
+ $19: 264,
58
+ $20: 284
59
+ }, spaces = Object.entries(size).map(([k, v]) => [k, sizeToSpace(v)]);
60
+ function sizeToSpace(v) {
61
+ return v === 0 ? 0 : v === 2 ? 0.5 : v === 4 ? 1 : v === 8 ? 1.5 : v <= 16 ? Math.round(v * 0.333) : Math.floor(v * 0.7 - 12);
62
+ }
63
+ const spacesNegative = spaces.slice(1).map(([k, v]) => [`-${k.slice(1)}`, -v]), space = {
64
+ ...Object.fromEntries(spaces),
65
+ ...Object.fromEntries(spacesNegative)
66
+ }, zIndex = {
67
+ 0: 0,
68
+ 1: 100,
69
+ 2: 200,
70
+ 3: 300,
71
+ 4: 400,
72
+ 5: 500
73
+ }, colorTokens = {
74
+ light: {
75
+ blue: import_colors.blue,
76
+ gray: import_colors.gray,
77
+ green: import_colors.green,
78
+ orange: import_colors.orange,
79
+ pink: import_colors.pink,
80
+ purple: import_colors.purple,
81
+ red: import_colors.red,
82
+ yellow: import_colors.yellow
83
+ },
84
+ dark: {
85
+ blue: import_colors.blueDark,
86
+ gray: import_colors.grayDark,
87
+ green: import_colors.greenDark,
88
+ orange: import_colors.orangeDark,
89
+ pink: import_colors.pinkDark,
90
+ purple: import_colors.purpleDark,
91
+ red: import_colors.redDark,
92
+ yellow: import_colors.yellowDark
93
+ }
94
+ }, darkColors = {
95
+ ...colorTokens.dark.blue,
96
+ ...colorTokens.dark.gray,
97
+ ...colorTokens.dark.green,
98
+ ...colorTokens.dark.orange,
99
+ ...colorTokens.dark.pink,
100
+ ...colorTokens.dark.purple,
101
+ ...colorTokens.dark.red,
102
+ ...colorTokens.dark.yellow
103
+ }, lightColors = {
104
+ ...colorTokens.light.blue,
105
+ ...colorTokens.light.gray,
106
+ ...colorTokens.light.green,
107
+ ...colorTokens.light.orange,
108
+ ...colorTokens.light.pink,
109
+ ...colorTokens.light.purple,
110
+ ...colorTokens.light.red,
111
+ ...colorTokens.light.yellow
112
+ }, color = {
113
+ ...postfixObjKeys(lightColors, "Light"),
114
+ ...postfixObjKeys(darkColors, "Dark")
115
+ };
116
+ function postfixObjKeys(obj, postfix) {
117
+ return Object.fromEntries(
118
+ Object.entries(obj).map(([k, v]) => [`${k}${postfix}`, v])
119
+ );
120
+ }
121
+ const radius = {
122
+ 0: 0,
123
+ 1: 3,
124
+ 2: 5,
125
+ 3: 7,
126
+ 4: 9,
127
+ true: 9,
128
+ 5: 10,
129
+ 6: 16,
130
+ 7: 19,
131
+ 8: 22,
132
+ 9: 26,
133
+ 10: 34,
134
+ 11: 42,
135
+ 12: 50
136
+ }, tokens = (0, import_web.createTokens)({
137
+ color,
138
+ radius,
139
+ zIndex,
140
+ space,
141
+ size
142
+ });
143
+ //# sourceMappingURL=tokens.js.map