@tamagui/themes 1.116.0 → 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,479 @@
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 v2_themes_exports = {};
16
+ __export(v2_themes_exports, {
17
+ maskOptions: () => maskOptions,
18
+ masks: () => import_masks2.masks,
19
+ palettes: () => palettes,
20
+ templates: () => templates,
21
+ themes: () => themes,
22
+ tokens: () => tokens
23
+ });
24
+ module.exports = __toCommonJS(v2_themes_exports);
25
+ var import_theme_builder = require("@tamagui/theme-builder"), import_colors = require("@tamagui/colors"), import_web = require("@tamagui/web"), import_masks = require("./masks"), import_masks2 = require("./masks");
26
+ const colorTokens = {
27
+ light: {
28
+ blue: import_colors.blue,
29
+ gray: import_colors.gray,
30
+ green: import_colors.green,
31
+ orange: import_colors.orange,
32
+ pink: import_colors.pink,
33
+ purple: import_colors.purple,
34
+ red: import_colors.red,
35
+ yellow: import_colors.yellow
36
+ },
37
+ dark: {
38
+ blue: import_colors.blueDark,
39
+ gray: import_colors.grayDark,
40
+ green: import_colors.greenDark,
41
+ orange: import_colors.orangeDark,
42
+ pink: import_colors.pinkDark,
43
+ purple: import_colors.purpleDark,
44
+ red: import_colors.redDark,
45
+ yellow: import_colors.yellowDark
46
+ }
47
+ }, palettes = (() => {
48
+ const lightTransparent = "rgba(255,255,255,0)", darkTransparent = "rgba(10,10,10,0)", transparent = (hsl, opacity = 0) => hsl.replace("%)", `%, ${opacity})`).replace("hsl(", "hsla("), getColorPalette = (colors, color2 = colors[0]) => {
49
+ const colorPalette = Object.values(colors), [head, tail] = [
50
+ colorPalette.slice(0, 6),
51
+ colorPalette.slice(colorPalette.length - 5)
52
+ ];
53
+ return [
54
+ transparent(colorPalette[0]),
55
+ ...head,
56
+ ...tail,
57
+ color2,
58
+ transparent(colorPalette[colorPalette.length - 1])
59
+ ];
60
+ }, lightColor = "hsl(0, 0%, 9.0%)", lightPalette = [
61
+ lightTransparent,
62
+ "#fff",
63
+ "#f8f8f8",
64
+ "hsl(0, 0%, 96.3%)",
65
+ "hsl(0, 0%, 94.1%)",
66
+ "hsl(0, 0%, 92.0%)",
67
+ "hsl(0, 0%, 90.0%)",
68
+ "hsl(0, 0%, 88.5%)",
69
+ "hsl(0, 0%, 81.0%)",
70
+ "hsl(0, 0%, 56.1%)",
71
+ "hsl(0, 0%, 50.3%)",
72
+ "hsl(0, 0%, 42.5%)",
73
+ lightColor,
74
+ darkTransparent
75
+ ], darkColor = "#fff", darkPalette = [
76
+ darkTransparent,
77
+ "#050505",
78
+ "#151515",
79
+ "#191919",
80
+ "#232323",
81
+ "#282828",
82
+ "#323232",
83
+ "#424242",
84
+ "#494949",
85
+ "#545454",
86
+ "#626262",
87
+ "#a5a5a5",
88
+ darkColor,
89
+ lightTransparent
90
+ ], lightPalettes = objectFromEntries(
91
+ objectKeys(colorTokens.light).map(
92
+ (key) => [`light_${key}`, getColorPalette(colorTokens.light[key], lightColor)]
93
+ )
94
+ ), darkPalettes = objectFromEntries(
95
+ objectKeys(colorTokens.dark).map(
96
+ (key) => [`dark_${key}`, getColorPalette(colorTokens.dark[key], darkColor)]
97
+ )
98
+ ), colorPalettes = {
99
+ ...lightPalettes,
100
+ ...darkPalettes
101
+ };
102
+ return {
103
+ light: lightPalette,
104
+ dark: darkPalette,
105
+ ...colorPalettes
106
+ };
107
+ })(), templateColorsSpecific = {
108
+ color1: 1,
109
+ color2: 2,
110
+ color3: 3,
111
+ color4: 4,
112
+ color5: 5,
113
+ color6: 6,
114
+ color7: 7,
115
+ color8: 8,
116
+ color9: 9,
117
+ color10: 10,
118
+ color11: 11,
119
+ color12: 12
120
+ }, templates = (() => {
121
+ const template = {
122
+ ...templateColorsSpecific,
123
+ // the background, color, etc keys here work like generics - they make it so you
124
+ // can publish components for others to use without mandating a specific color scale
125
+ // the @tamagui/button Button component looks for `$background`, so you set the
126
+ // dark_red_Button theme to have a stronger background than the dark_red theme.
127
+ background: 2,
128
+ backgroundHover: 3,
129
+ backgroundPress: 4,
130
+ backgroundFocus: 5,
131
+ backgroundStrong: 1,
132
+ backgroundTransparent: 0,
133
+ color: -1,
134
+ colorHover: -2,
135
+ colorPress: -1,
136
+ colorFocus: -2,
137
+ colorTransparent: -0,
138
+ borderColor: 5,
139
+ borderColorHover: 6,
140
+ borderColorFocus: 4,
141
+ borderColorPress: 5,
142
+ placeholderColor: -4,
143
+ // in the future this should be partially transparent
144
+ outlineColor: 5
145
+ };
146
+ return {
147
+ base: template,
148
+ colorLight: {
149
+ ...template,
150
+ // light color themes are a bit less sensitive
151
+ borderColor: 4,
152
+ borderColorHover: 5,
153
+ borderColorFocus: 4,
154
+ borderColorPress: 4
155
+ }
156
+ };
157
+ })(), maskOptions = (() => {
158
+ const shadows2 = {
159
+ shadowColor: 0,
160
+ shadowColorHover: 0,
161
+ shadowColorPress: 0,
162
+ shadowColorFocus: 0
163
+ }, colors = {
164
+ ...shadows2,
165
+ color: 0,
166
+ colorHover: 0,
167
+ colorFocus: 0,
168
+ colorPress: 0
169
+ }, baseMaskOptions = {
170
+ override: shadows2,
171
+ skip: shadows2,
172
+ // avoids the transparent ends
173
+ max: palettes.light.length - 2,
174
+ min: 1
175
+ }, skipShadowsAndSpecificColors = {
176
+ ...shadows2,
177
+ ...templateColorsSpecific
178
+ };
179
+ return {
180
+ component: {
181
+ ...baseMaskOptions,
182
+ override: colors,
183
+ skip: skipShadowsAndSpecificColors
184
+ },
185
+ alt: {
186
+ ...baseMaskOptions
187
+ },
188
+ button: {
189
+ ...baseMaskOptions,
190
+ override: {
191
+ ...colors,
192
+ borderColor: "transparent",
193
+ borderColorHover: "transparent"
194
+ },
195
+ skip: skipShadowsAndSpecificColors
196
+ }
197
+ };
198
+ })(), lightShadowColor = "rgba(0,0,0,0.04)", lightShadowColorStrong = "rgba(0,0,0,0.085)", darkShadowColor = "rgba(0,0,0,0.2)", darkShadowColorStrong = "rgba(0,0,0,0.3)", size = {
199
+ $0: 0,
200
+ "$0.25": 2,
201
+ "$0.5": 4,
202
+ "$0.75": 8,
203
+ $1: 20,
204
+ "$1.5": 24,
205
+ $2: 28,
206
+ "$2.5": 32,
207
+ $3: 36,
208
+ "$3.5": 40,
209
+ $4: 44,
210
+ $true: 44,
211
+ "$4.5": 48,
212
+ $5: 52,
213
+ $6: 64,
214
+ $7: 74,
215
+ $8: 84,
216
+ $9: 94,
217
+ $10: 104,
218
+ $11: 124,
219
+ $12: 144,
220
+ $13: 164,
221
+ $14: 184,
222
+ $15: 204,
223
+ $16: 224,
224
+ $17: 224,
225
+ $18: 244,
226
+ $19: 264,
227
+ $20: 284
228
+ }, spaces = Object.entries(size).map(([k, v]) => [k, sizeToSpace(v)]), spacesNegative = spaces.slice(1).map(([k, v]) => [`-${k.slice(1)}`, -v]), space = {
229
+ ...Object.fromEntries(spaces),
230
+ ...Object.fromEntries(spacesNegative)
231
+ }, zIndex = {
232
+ 0: 0,
233
+ 1: 100,
234
+ 2: 200,
235
+ 3: 300,
236
+ 4: 400,
237
+ 5: 500
238
+ }, darkColors = {
239
+ ...colorTokens.dark.blue,
240
+ ...colorTokens.dark.gray,
241
+ ...colorTokens.dark.green,
242
+ ...colorTokens.dark.orange,
243
+ ...colorTokens.dark.pink,
244
+ ...colorTokens.dark.purple,
245
+ ...colorTokens.dark.red,
246
+ ...colorTokens.dark.yellow
247
+ }, lightColors = {
248
+ ...colorTokens.light.blue,
249
+ ...colorTokens.light.gray,
250
+ ...colorTokens.light.green,
251
+ ...colorTokens.light.orange,
252
+ ...colorTokens.light.pink,
253
+ ...colorTokens.light.purple,
254
+ ...colorTokens.light.red,
255
+ ...colorTokens.light.yellow
256
+ }, color = {
257
+ ...postfixObjKeys(lightColors, "Light"),
258
+ ...postfixObjKeys(darkColors, "Dark")
259
+ }, radius = {
260
+ 0: 0,
261
+ 1: 3,
262
+ 2: 5,
263
+ 3: 7,
264
+ 4: 9,
265
+ true: 9,
266
+ 5: 10,
267
+ 6: 16,
268
+ 7: 19,
269
+ 8: 22,
270
+ 9: 26,
271
+ 10: 34,
272
+ 11: 42,
273
+ 12: 50
274
+ }, tokens = (0, import_web.createTokens)({
275
+ color,
276
+ radius,
277
+ zIndex,
278
+ space,
279
+ size
280
+ }), shadows = {
281
+ light: {
282
+ shadowColor: lightShadowColorStrong,
283
+ shadowColorHover: lightShadowColorStrong,
284
+ shadowColorPress: lightShadowColor,
285
+ shadowColorFocus: lightShadowColor
286
+ },
287
+ dark: {
288
+ shadowColor: darkShadowColorStrong,
289
+ shadowColorHover: darkShadowColorStrong,
290
+ shadowColorPress: darkShadowColor,
291
+ shadowColorFocus: darkShadowColor
292
+ }
293
+ }, colorThemeDefinition = (colorName) => [
294
+ {
295
+ parent: "light",
296
+ palette: colorName,
297
+ template: "colorLight"
298
+ },
299
+ {
300
+ parent: "dark",
301
+ palette: colorName,
302
+ template: "base"
303
+ }
304
+ ], nonInherited = {
305
+ light: {
306
+ ...lightColors,
307
+ ...shadows.light
308
+ },
309
+ dark: {
310
+ ...darkColors,
311
+ ...shadows.dark
312
+ }
313
+ }, overlayThemeDefinitions = [
314
+ {
315
+ parent: "light",
316
+ theme: {
317
+ background: "rgba(0,0,0,0.5)"
318
+ }
319
+ },
320
+ {
321
+ parent: "dark",
322
+ theme: {
323
+ background: "rgba(0,0,0,0.9)"
324
+ }
325
+ }
326
+ ], themeBuilder = (0, import_theme_builder.createThemeBuilder)().addPalettes(palettes).addTemplates(templates).addMasks(import_masks.masks).addThemes({
327
+ light: {
328
+ template: "base",
329
+ palette: "light",
330
+ nonInheritedValues: nonInherited.light
331
+ },
332
+ dark: {
333
+ template: "base",
334
+ palette: "dark",
335
+ nonInheritedValues: nonInherited.dark
336
+ }
337
+ }).addChildThemes({
338
+ orange: colorThemeDefinition("orange"),
339
+ yellow: colorThemeDefinition("yellow"),
340
+ green: colorThemeDefinition("green"),
341
+ blue: colorThemeDefinition("blue"),
342
+ purple: colorThemeDefinition("purple"),
343
+ pink: colorThemeDefinition("pink"),
344
+ red: colorThemeDefinition("red"),
345
+ gray: colorThemeDefinition("gray")
346
+ }).addChildThemes({
347
+ alt1: {
348
+ mask: "soften",
349
+ ...maskOptions.alt
350
+ },
351
+ alt2: {
352
+ mask: "soften2Border1",
353
+ ...maskOptions.alt
354
+ },
355
+ active: {
356
+ mask: "soften3FlatBorder",
357
+ skip: {
358
+ color: 1
359
+ }
360
+ }
361
+ }).addComponentThemes(
362
+ {
363
+ ListItem: [
364
+ {
365
+ parent: "light",
366
+ avoidNestingWithin: ["active"],
367
+ mask: "identity",
368
+ ...maskOptions.component
369
+ },
370
+ {
371
+ parent: "dark",
372
+ avoidNestingWithin: ["active"],
373
+ mask: "identity",
374
+ ...maskOptions.component
375
+ }
376
+ ],
377
+ Card: {
378
+ mask: "soften",
379
+ avoidNestingWithin: ["active"],
380
+ ...maskOptions.component
381
+ },
382
+ Button: {
383
+ mask: "soften2Border1",
384
+ ...maskOptions.component
385
+ },
386
+ Checkbox: {
387
+ mask: "softenBorder2",
388
+ ...maskOptions.component
389
+ },
390
+ Switch: {
391
+ mask: "soften2Border1",
392
+ ...maskOptions.component
393
+ },
394
+ SwitchThumb: {
395
+ mask: "inverseStrengthen2",
396
+ avoidNestingWithin: ["active"],
397
+ ...maskOptions.component
398
+ },
399
+ TooltipContent: {
400
+ mask: "soften2Border1",
401
+ avoidNestingWithin: ["active"],
402
+ ...maskOptions.component
403
+ },
404
+ DrawerFrame: {
405
+ mask: "soften",
406
+ avoidNestingWithin: ["active"],
407
+ ...maskOptions.component
408
+ },
409
+ Progress: {
410
+ mask: "soften",
411
+ avoidNestingWithin: ["active"],
412
+ ...maskOptions.component
413
+ },
414
+ RadioGroupItem: {
415
+ mask: "softenBorder2",
416
+ avoidNestingWithin: ["active"],
417
+ ...maskOptions.component
418
+ },
419
+ TooltipArrow: {
420
+ mask: "soften",
421
+ avoidNestingWithin: ["active"],
422
+ ...maskOptions.component
423
+ },
424
+ SliderTrackActive: {
425
+ mask: "inverseSoften",
426
+ ...maskOptions.component
427
+ },
428
+ SliderTrack: {
429
+ mask: "soften2Border1",
430
+ avoidNestingWithin: ["active"],
431
+ ...maskOptions.component
432
+ },
433
+ SliderThumb: {
434
+ mask: "inverse",
435
+ avoidNestingWithin: ["active"],
436
+ ...maskOptions.component
437
+ },
438
+ Tooltip: {
439
+ mask: "inverse",
440
+ avoidNestingWithin: ["active"],
441
+ ...maskOptions.component
442
+ },
443
+ ProgressIndicator: {
444
+ mask: "inverse",
445
+ avoidNestingWithin: ["active"],
446
+ ...maskOptions.component
447
+ },
448
+ SheetOverlay: overlayThemeDefinitions,
449
+ DialogOverlay: overlayThemeDefinitions,
450
+ ModalOverlay: overlayThemeDefinitions,
451
+ Input: {
452
+ mask: "softenBorder2",
453
+ ...maskOptions.component
454
+ },
455
+ TextArea: {
456
+ mask: "softenBorder2",
457
+ ...maskOptions.component
458
+ }
459
+ },
460
+ {
461
+ // to save bundle size but make alt themes not work on components
462
+ // avoidNestingWithin: ['alt1', 'alt2'],
463
+ }
464
+ ), themesIn = themeBuilder.build(), themes = themesIn;
465
+ function postfixObjKeys(obj, postfix) {
466
+ return Object.fromEntries(
467
+ Object.entries(obj).map(([k, v]) => [`${k}${postfix}`, v])
468
+ );
469
+ }
470
+ function sizeToSpace(v) {
471
+ 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);
472
+ }
473
+ function objectFromEntries(arr) {
474
+ return Object.fromEntries(arr);
475
+ }
476
+ function objectKeys(obj) {
477
+ return Object.keys(obj);
478
+ }
479
+ //# sourceMappingURL=v2-themes.js.map
package/dist/cjs/v2.js ADDED
@@ -0,0 +1,47 @@
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 v2_exports = {};
24
+ __export(v2_exports, {
25
+ blue: () => import_colors.blue,
26
+ blueDark: () => import_colors.blueDark,
27
+ gray: () => import_colors8.gray,
28
+ grayDark: () => import_colors8.grayDark,
29
+ green: () => import_colors2.green,
30
+ greenDark: () => import_colors2.greenDark,
31
+ orange: () => import_colors4.orange,
32
+ orangeDark: () => import_colors4.orangeDark,
33
+ pink: () => import_colors6.pink,
34
+ pinkDark: () => import_colors6.pinkDark,
35
+ purple: () => import_colors7.purple,
36
+ purpleDark: () => import_colors7.purpleDark,
37
+ red: () => import_colors3.red,
38
+ redDark: () => import_colors3.redDark,
39
+ themes: () => themes,
40
+ tokens: () => import_tokens.tokens,
41
+ yellow: () => import_colors5.yellow,
42
+ yellowDark: () => import_colors5.yellowDark
43
+ });
44
+ module.exports = __toCommonJS(v2_exports);
45
+ var generatedThemes = __toESM(require("./generated-v2")), import_tokens = require("./tokens"), import_colors = require("@tamagui/colors"), import_colors2 = require("@tamagui/colors"), import_colors3 = require("@tamagui/colors"), import_colors4 = require("@tamagui/colors"), import_colors5 = require("@tamagui/colors"), import_colors6 = require("@tamagui/colors"), import_colors7 = require("@tamagui/colors"), import_colors8 = require("@tamagui/colors");
46
+ const themes = generatedThemes;
47
+ //# sourceMappingURL=v2.js.map