@hanzogui/themes 3.0.5 → 4.3.1

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 (236) hide show
  1. package/.turbo/turbo-build.log +2 -0
  2. package/dist/cjs/componentThemeDefinitions.cjs +104 -102
  3. package/dist/cjs/componentThemeDefinitions.native.js +106 -104
  4. package/dist/cjs/componentThemeDefinitions.native.js.map +1 -1
  5. package/dist/cjs/generated-new.cjs +2005 -2001
  6. package/dist/cjs/generated-new.native.js +2014 -2007
  7. package/dist/cjs/generated-new.native.js.map +1 -1
  8. package/dist/cjs/generated-v3.cjs +1083 -1079
  9. package/dist/cjs/generated-v3.native.js +1092 -1085
  10. package/dist/cjs/generated-v3.native.js.map +1 -1
  11. package/dist/cjs/generated-v4-gui.cjs +917 -913
  12. package/dist/cjs/generated-v4-gui.native.js +926 -919
  13. package/dist/cjs/generated-v4-gui.native.js.map +1 -1
  14. package/dist/cjs/generated-v4.cjs +375 -371
  15. package/dist/cjs/generated-v4.native.js +384 -377
  16. package/dist/cjs/generated-v4.native.js.map +1 -1
  17. package/dist/cjs/generated-v5-subtle.cjs +533 -529
  18. package/dist/cjs/generated-v5-subtle.native.js +542 -535
  19. package/dist/cjs/generated-v5-subtle.native.js.map +1 -1
  20. package/dist/cjs/generated-v5.cjs +533 -529
  21. package/dist/cjs/generated-v5.native.js +542 -535
  22. package/dist/cjs/generated-v5.native.js.map +1 -1
  23. package/dist/cjs/helpers.cjs +12 -10
  24. package/dist/cjs/helpers.native.js +12 -10
  25. package/dist/cjs/helpers.native.js.map +1 -1
  26. package/dist/cjs/index.cjs +7 -5
  27. package/dist/cjs/index.native.js +7 -5
  28. package/dist/cjs/index.native.js.map +1 -1
  29. package/dist/cjs/opacify.cjs +62 -37
  30. package/dist/cjs/opacify.native.js +65 -42
  31. package/dist/cjs/opacify.native.js.map +1 -1
  32. package/dist/cjs/palettes.cjs +32 -30
  33. package/dist/cjs/palettes.native.js +47 -45
  34. package/dist/cjs/palettes.native.js.map +1 -1
  35. package/dist/cjs/shadows.cjs +30 -28
  36. package/dist/cjs/shadows.native.js +30 -28
  37. package/dist/cjs/shadows.native.js.map +1 -1
  38. package/dist/cjs/subtleChildrenThemes.cjs +48 -45
  39. package/dist/cjs/subtleChildrenThemes.native.js +54 -52
  40. package/dist/cjs/subtleChildrenThemes.native.js.map +1 -1
  41. package/dist/cjs/templates.cjs +98 -96
  42. package/dist/cjs/templates.native.js +100 -98
  43. package/dist/cjs/templates.native.js.map +1 -1
  44. package/dist/cjs/themes-new.cjs +70 -68
  45. package/dist/cjs/themes-new.native.js +69 -67
  46. package/dist/cjs/themes-new.native.js.map +1 -1
  47. package/dist/cjs/themes-old.cjs +219 -211
  48. package/dist/cjs/themes-old.native.js +236 -234
  49. package/dist/cjs/themes-old.native.js.map +1 -1
  50. package/dist/cjs/themes.cjs +12 -10
  51. package/dist/cjs/themes.native.js +12 -10
  52. package/dist/cjs/themes.native.js.map +1 -1
  53. package/dist/cjs/tokens.cjs +133 -124
  54. package/dist/cjs/tokens.native.js +137 -130
  55. package/dist/cjs/tokens.native.js.map +1 -1
  56. package/dist/cjs/utils.cjs +18 -11
  57. package/dist/cjs/utils.native.js +18 -11
  58. package/dist/cjs/utils.native.js.map +1 -1
  59. package/dist/cjs/v3-themes.cjs +442 -439
  60. package/dist/cjs/v3-themes.native.js +454 -452
  61. package/dist/cjs/v3-themes.native.js.map +1 -1
  62. package/dist/cjs/v3-tokens.cjs +80 -76
  63. package/dist/cjs/v3-tokens.native.js +86 -84
  64. package/dist/cjs/v3-tokens.native.js.map +1 -1
  65. package/dist/cjs/v3.cjs +22 -20
  66. package/dist/cjs/v3.native.js +22 -20
  67. package/dist/cjs/v3.native.js.map +1 -1
  68. package/dist/cjs/v4-default.cjs +143 -141
  69. package/dist/cjs/v4-default.native.js +143 -141
  70. package/dist/cjs/v4-default.native.js.map +1 -1
  71. package/dist/cjs/v4-gui.cjs +213 -209
  72. package/dist/cjs/v4-gui.native.js +216 -214
  73. package/dist/cjs/v4-gui.native.js.map +1 -1
  74. package/dist/cjs/v4-tokens.cjs +80 -76
  75. package/dist/cjs/v4-tokens.native.js +86 -84
  76. package/dist/cjs/v4-tokens.native.js.map +1 -1
  77. package/dist/cjs/v4.cjs +16 -14
  78. package/dist/cjs/v4.native.js +16 -14
  79. package/dist/cjs/v4.native.js.map +1 -1
  80. package/dist/cjs/v5-subtle.cjs +19 -14
  81. package/dist/cjs/v5-subtle.native.js +19 -14
  82. package/dist/cjs/v5-subtle.native.js.map +1 -1
  83. package/dist/cjs/v5-templates.cjs +101 -92
  84. package/dist/cjs/v5-templates.native.js +108 -106
  85. package/dist/cjs/v5-templates.native.js.map +1 -1
  86. package/dist/cjs/v5-themes-subtle.cjs +15 -13
  87. package/dist/cjs/v5-themes-subtle.native.js +18 -16
  88. package/dist/cjs/v5-themes-subtle.native.js.map +1 -1
  89. package/dist/cjs/v5-themes.cjs +203 -188
  90. package/dist/cjs/v5-themes.native.js +233 -208
  91. package/dist/cjs/v5-themes.native.js.map +1 -1
  92. package/dist/cjs/v5-tokens.cjs +80 -76
  93. package/dist/cjs/v5-tokens.native.js +86 -84
  94. package/dist/cjs/v5-tokens.native.js.map +1 -1
  95. package/dist/cjs/v5.cjs +16 -14
  96. package/dist/cjs/v5.native.js +16 -14
  97. package/dist/cjs/v5.native.js.map +1 -1
  98. package/dist/esm/componentThemeDefinitions.mjs +92 -92
  99. package/dist/esm/componentThemeDefinitions.mjs.map +1 -1
  100. package/dist/esm/componentThemeDefinitions.native.js +92 -92
  101. package/dist/esm/componentThemeDefinitions.native.js.map +1 -1
  102. package/dist/esm/generated-new.mjs +1993 -1991
  103. package/dist/esm/generated-new.mjs.map +1 -1
  104. package/dist/esm/generated-new.native.js +2002 -1997
  105. package/dist/esm/generated-new.native.js.map +1 -1
  106. package/dist/esm/generated-v3.mjs +1071 -1069
  107. package/dist/esm/generated-v3.mjs.map +1 -1
  108. package/dist/esm/generated-v3.native.js +1080 -1075
  109. package/dist/esm/generated-v3.native.js.map +1 -1
  110. package/dist/esm/generated-v4-gui.mjs +905 -903
  111. package/dist/esm/generated-v4-gui.mjs.map +1 -1
  112. package/dist/esm/generated-v4-gui.native.js +914 -909
  113. package/dist/esm/generated-v4-gui.native.js.map +1 -1
  114. package/dist/esm/generated-v4.mjs +363 -361
  115. package/dist/esm/generated-v4.mjs.map +1 -1
  116. package/dist/esm/generated-v4.native.js +372 -367
  117. package/dist/esm/generated-v4.native.js.map +1 -1
  118. package/dist/esm/generated-v5-subtle.mjs +521 -519
  119. package/dist/esm/generated-v5-subtle.mjs.map +1 -1
  120. package/dist/esm/generated-v5-subtle.native.js +530 -525
  121. package/dist/esm/generated-v5-subtle.native.js.map +1 -1
  122. package/dist/esm/generated-v5.mjs +521 -519
  123. package/dist/esm/generated-v5.mjs.map +1 -1
  124. package/dist/esm/generated-v5.native.js +530 -525
  125. package/dist/esm/generated-v5.native.js.map +1 -1
  126. package/dist/esm/opacify.mjs +50 -27
  127. package/dist/esm/opacify.mjs.map +1 -1
  128. package/dist/esm/opacify.native.js +53 -32
  129. package/dist/esm/opacify.native.js.map +1 -1
  130. package/dist/esm/palettes.mjs +18 -18
  131. package/dist/esm/palettes.mjs.map +1 -1
  132. package/dist/esm/palettes.native.js +26 -26
  133. package/dist/esm/palettes.native.js.map +1 -1
  134. package/dist/esm/shadows.mjs +18 -18
  135. package/dist/esm/shadows.mjs.map +1 -1
  136. package/dist/esm/shadows.native.js +18 -18
  137. package/dist/esm/shadows.native.js.map +1 -1
  138. package/dist/esm/subtleChildrenThemes.mjs +36 -35
  139. package/dist/esm/subtleChildrenThemes.mjs.map +1 -1
  140. package/dist/esm/subtleChildrenThemes.native.js +40 -40
  141. package/dist/esm/subtleChildrenThemes.native.js.map +1 -1
  142. package/dist/esm/templates.mjs +86 -86
  143. package/dist/esm/templates.mjs.map +1 -1
  144. package/dist/esm/templates.native.js +86 -86
  145. package/dist/esm/templates.native.js.map +1 -1
  146. package/dist/esm/themes-new.mjs +51 -51
  147. package/dist/esm/themes-new.mjs.map +1 -1
  148. package/dist/esm/themes-new.native.js +49 -49
  149. package/dist/esm/themes-new.native.js.map +1 -1
  150. package/dist/esm/themes-old.mjs +205 -199
  151. package/dist/esm/themes-old.mjs.map +1 -1
  152. package/dist/esm/themes-old.native.js +222 -222
  153. package/dist/esm/themes-old.native.js.map +1 -1
  154. package/dist/esm/tokens.mjs +119 -112
  155. package/dist/esm/tokens.mjs.map +1 -1
  156. package/dist/esm/tokens.native.js +122 -117
  157. package/dist/esm/tokens.native.js.map +1 -1
  158. package/dist/esm/utils.mjs +6 -1
  159. package/dist/esm/utils.mjs.map +1 -1
  160. package/dist/esm/utils.native.js +6 -1
  161. package/dist/esm/utils.native.js.map +1 -1
  162. package/dist/esm/v3-themes.mjs +425 -424
  163. package/dist/esm/v3-themes.mjs.map +1 -1
  164. package/dist/esm/v3-themes.native.js +436 -436
  165. package/dist/esm/v3-themes.native.js.map +1 -1
  166. package/dist/esm/v3-tokens.mjs +68 -66
  167. package/dist/esm/v3-tokens.mjs.map +1 -1
  168. package/dist/esm/v3-tokens.native.js +72 -72
  169. package/dist/esm/v3-tokens.native.js.map +1 -1
  170. package/dist/esm/v4-default.mjs +117 -117
  171. package/dist/esm/v4-default.mjs.map +1 -1
  172. package/dist/esm/v4-default.native.js +117 -117
  173. package/dist/esm/v4-default.native.js.map +1 -1
  174. package/dist/esm/v4-gui.mjs +186 -184
  175. package/dist/esm/v4-gui.mjs.map +1 -1
  176. package/dist/esm/v4-gui.native.js +188 -188
  177. package/dist/esm/v4-gui.native.js.map +1 -1
  178. package/dist/esm/v4-tokens.mjs +68 -66
  179. package/dist/esm/v4-tokens.mjs.map +1 -1
  180. package/dist/esm/v4-tokens.native.js +72 -72
  181. package/dist/esm/v4-tokens.native.js.map +1 -1
  182. package/dist/esm/v5-subtle.mjs +2 -1
  183. package/dist/esm/v5-subtle.mjs.map +1 -1
  184. package/dist/esm/v5-subtle.native.js +2 -1
  185. package/dist/esm/v5-subtle.native.js.map +1 -1
  186. package/dist/esm/v5-templates.mjs +89 -82
  187. package/dist/esm/v5-templates.mjs.map +1 -1
  188. package/dist/esm/v5-templates.native.js +94 -94
  189. package/dist/esm/v5-templates.native.js.map +1 -1
  190. package/dist/esm/v5-themes.mjs +186 -173
  191. package/dist/esm/v5-themes.mjs.map +1 -1
  192. package/dist/esm/v5-themes.native.js +216 -193
  193. package/dist/esm/v5-themes.native.js.map +1 -1
  194. package/dist/esm/v5-tokens.mjs +68 -66
  195. package/dist/esm/v5-tokens.mjs.map +1 -1
  196. package/dist/esm/v5-tokens.native.js +72 -72
  197. package/dist/esm/v5-tokens.native.js.map +1 -1
  198. package/package.json +7 -7
  199. package/src/v4-default.ts +3 -3
  200. package/src/v4-gui.ts +3 -3
  201. package/src/v5-subtle.tsx +1 -0
  202. package/types/componentThemeDefinitions.d.ts.map +1 -0
  203. package/types/generated-new.d.ts.map +1 -0
  204. package/types/generated-v3.d.ts.map +1 -0
  205. package/types/generated-v4-gui.d.ts.map +1 -0
  206. package/types/generated-v4.d.ts.map +1 -0
  207. package/types/generated-v5-subtle.d.ts.map +1 -0
  208. package/types/generated-v5.d.ts.map +1 -0
  209. package/types/helpers.d.ts.map +1 -0
  210. package/types/index.d.ts.map +1 -0
  211. package/types/opacify.d.ts.map +1 -0
  212. package/types/palettes.d.ts.map +1 -0
  213. package/types/shadows.d.ts.map +1 -0
  214. package/types/subtleChildrenThemes.d.ts.map +1 -0
  215. package/types/templates.d.ts.map +1 -0
  216. package/types/themes-new.d.ts.map +1 -0
  217. package/types/themes-old.d.ts.map +1 -0
  218. package/types/themes.d.ts.map +1 -0
  219. package/types/tokens.d.ts.map +1 -0
  220. package/types/utils.d.ts.map +1 -0
  221. package/types/v3-themes.d.ts.map +1 -0
  222. package/types/v3-tokens.d.ts.map +1 -0
  223. package/types/v3.d.ts.map +1 -0
  224. package/types/v4-default.d.ts +2 -2
  225. package/types/v4-default.d.ts.map +1 -0
  226. package/types/v4-gui.d.ts +2 -2
  227. package/types/v4-gui.d.ts.map +1 -0
  228. package/types/v4-tokens.d.ts.map +1 -0
  229. package/types/v4.d.ts.map +1 -0
  230. package/types/v5-subtle.d.ts +1 -0
  231. package/types/v5-subtle.d.ts.map +1 -0
  232. package/types/v5-templates.d.ts.map +1 -0
  233. package/types/v5-themes-subtle.d.ts.map +1 -0
  234. package/types/v5-themes.d.ts.map +1 -0
  235. package/types/v5-tokens.d.ts.map +1 -0
  236. package/types/v5.d.ts.map +1 -0
@@ -3,187 +3,191 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
14
  get: () => from[key],
14
15
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
16
  });
16
- return to;
17
- };
17
+ }
18
+ return to;
19
+ };
18
20
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
21
+ value: true
20
22
  }), mod);
21
23
  var themes_old_exports = {};
22
24
  __export(themes_old_exports, {
23
25
  themes: () => themes
24
26
  });
25
27
  module.exports = __toCommonJS(themes_old_exports);
26
- var import_create_theme = require("@hanzogui/create-theme"),
27
- import_tokens = require("./tokens.cjs");
28
- const lightTransparent = "rgba(255,255,255,0)",
29
- darkTransparent = "rgba(10,10,10,0)",
30
- palettes = {
31
- dark: [darkTransparent, "#050505", "#151515", "#191919", "#232323", "#282828", "#323232", "#424242", "#494949", "#545454", "#626262", "#a5a5a5", "#fff", lightTransparent],
32
- light: [lightTransparent, "#fff", "#f9f9f9", "hsl(0, 0%, 97.3%)", "hsl(0, 0%, 95.1%)", "hsl(0, 0%, 94.0%)", "hsl(0, 0%, 92.0%)", "hsl(0, 0%, 89.5%)", "hsl(0, 0%, 81.0%)", "hsl(0, 0%, 56.1%)", "hsl(0, 0%, 50.3%)", "hsl(0, 0%, 42.5%)", "hsl(0, 0%, 9.0%)", darkTransparent]
33
- },
34
- templateColors = {
35
- color1: 1,
36
- color2: 2,
37
- color3: 3,
38
- color4: 4,
39
- color5: 5,
40
- color6: 6,
41
- color7: 7,
42
- color8: 8,
43
- color9: 9,
44
- color10: 10,
45
- color11: 11,
46
- color12: 12
47
- },
48
- templateShadows = {
49
- shadowColor: 1,
50
- shadowColorHover: 1,
51
- shadowColorPress: 2,
52
- shadowColorFocus: 2
53
- },
54
- toSkip = {
55
- ...templateShadows
56
- },
57
- override = Object.fromEntries(Object.entries(toSkip).map(([k]) => [k, 0])),
58
- overrideShadows = Object.fromEntries(Object.entries(templateShadows).map(([k]) => [k, 0])),
59
- overrideWithColors = {
60
- ...override,
61
- color: 0,
62
- colorHover: 0,
63
- colorFocus: 0,
64
- colorPress: 0
65
- },
66
- template = {
67
- ...templateColors,
68
- ...toSkip,
69
- // the background, color, etc keys here work like generics - they make it so you
70
- // can publish components for others to use without mandating a specific color scale
71
- // the @hanzogui/button Button component looks for `$background`, so you set the
72
- // dark_red_Button theme to have a stronger background than the dark_red theme.
73
- background: 2,
74
- backgroundHover: 3,
75
- backgroundPress: 4,
76
- backgroundFocus: 5,
77
- backgroundStrong: 1,
78
- backgroundTransparent: 0,
79
- color: -1,
80
- colorHover: -2,
81
- colorPress: -1,
82
- colorFocus: -2,
83
- colorTransparent: -0,
84
- borderColor: 4,
85
- borderColorHover: 5,
86
- borderColorPress: 3,
87
- borderColorFocus: 4,
88
- placeholderColor: -4
89
- },
90
- lightShadowColor = "rgba(0,0,0,0.02)",
91
- lightShadowColorStrong = "rgba(0,0,0,0.066)",
92
- darkShadowColor = "rgba(0,0,0,0.2)",
93
- darkShadowColorStrong = "rgba(0,0,0,0.3)",
94
- lightShadows = {
95
- shadowColor: lightShadowColorStrong,
96
- shadowColorHover: lightShadowColorStrong,
97
- shadowColorPress: lightShadowColor,
98
- shadowColorFocus: lightShadowColor
99
- },
100
- darkShadows = {
101
- shadowColor: darkShadowColorStrong,
102
- shadowColorHover: darkShadowColorStrong,
103
- shadowColorPress: darkShadowColor,
104
- shadowColorFocus: darkShadowColor
105
- },
106
- lightTemplate = {
107
- ...template,
108
- background: 2,
109
- backgroundHover: 3,
110
- backgroundPress: 4,
111
- // our light color palette is... a bit unique
112
- borderColor: 6,
113
- borderColorHover: 7,
114
- borderColorFocus: 5,
115
- borderColorPress: 6,
116
- ...lightShadows
117
- },
118
- darkTemplate = {
119
- ...template,
120
- ...darkShadows
121
- },
122
- light = (0, import_create_theme.createTheme)(palettes.light, lightTemplate),
123
- dark = (0, import_create_theme.createTheme)(palettes.dark, darkTemplate),
124
- baseThemes = {
125
- light,
126
- dark
127
- },
128
- masks = {
129
- skip: import_create_theme.skipMask,
130
- weaker: (0, import_create_theme.createWeakenMask)(),
131
- stronger: (0, import_create_theme.createStrengthenMask)()
132
- },
133
- maskOptions = {
134
- override,
135
- skip: toSkip,
136
- // avoids the transparent ends
137
- max: palettes.light.length - 2,
138
- min: 1
139
- },
140
- transparent = (hsl, opacity = 0) => hsl.replace("%)", `%, ${opacity})`).replace("hsl(", "hsla("),
141
- [lightColorThemes, darkColorThemes] = [import_tokens.colorTokens.light, import_tokens.colorTokens.dark].map((colorSet, i) => {
142
- const isLight = i === 0,
143
- theme = baseThemes[isLight ? "light" : "dark"];
144
- return Object.fromEntries(Object.keys(colorSet).map(color => {
145
- const colorPalette = Object.values(colorSet[color]),
146
- [head, tail] = [colorPalette.slice(0, 6), colorPalette.slice(colorPalette.length - 5)],
147
- palette = [transparent(colorPalette[0]), ...head, ...tail, theme.color, transparent(colorPalette[colorPalette.length - 1])],
148
- colorTheme = (0, import_create_theme.createTheme)(palette, isLight ? {
149
- ...lightTemplate,
150
- // light color themes are a bit less sensitive
151
- borderColor: 4,
152
- borderColorHover: 5,
153
- borderColorFocus: 4,
154
- borderColorPress: 4
155
- } : darkTemplate);
156
- return [color, colorTheme];
157
- }));
158
- }),
159
- allThemes = (0, import_create_theme.addChildren)(baseThemes, (name, theme) => {
160
- const isLight = name === "light",
161
- inverseTheme = baseThemes[isLight ? "dark" : "light"],
162
- colorThemes = isLight ? lightColorThemes : darkColorThemes,
163
- inverseColorThemes = isLight ? darkColorThemes : lightColorThemes,
164
- allColorThemes = (0, import_create_theme.addChildren)(colorThemes, (colorName, colorTheme) => {
165
- const inverse = inverseColorThemes[colorName];
166
- return {
167
- ...getAltThemes({
168
- theme: colorTheme,
169
- inverse,
170
- isLight
171
- }),
172
- ...getComponentThemes(colorTheme, inverse, isLight)
173
- };
174
- });
28
+ var import_create_theme = require("@hanzogui/create-theme");
29
+ var import_tokens = require("./tokens.cjs");
30
+ const lightTransparent = "rgba(255,255,255,0)";
31
+ const darkTransparent = "rgba(10,10,10,0)";
32
+ const palettes = {
33
+ dark: [darkTransparent, "#050505", "#151515", "#191919", "#232323", "#282828", "#323232", "#424242", "#494949", "#545454", "#626262", "#a5a5a5", "#fff", lightTransparent],
34
+ light: [lightTransparent, "#fff", "#f9f9f9", "hsl(0, 0%, 97.3%)", "hsl(0, 0%, 95.1%)", "hsl(0, 0%, 94.0%)", "hsl(0, 0%, 92.0%)", "hsl(0, 0%, 89.5%)", "hsl(0, 0%, 81.0%)", "hsl(0, 0%, 56.1%)", "hsl(0, 0%, 50.3%)", "hsl(0, 0%, 42.5%)", "hsl(0, 0%, 9.0%)", darkTransparent]
35
+ };
36
+ const templateColors = {
37
+ color1: 1,
38
+ color2: 2,
39
+ color3: 3,
40
+ color4: 4,
41
+ color5: 5,
42
+ color6: 6,
43
+ color7: 7,
44
+ color8: 8,
45
+ color9: 9,
46
+ color10: 10,
47
+ color11: 11,
48
+ color12: 12
49
+ };
50
+ const templateShadows = {
51
+ shadowColor: 1,
52
+ shadowColorHover: 1,
53
+ shadowColorPress: 2,
54
+ shadowColorFocus: 2
55
+ };
56
+ const toSkip = {
57
+ ...templateShadows
58
+ };
59
+ const override = Object.fromEntries(Object.entries(toSkip).map(([k]) => [k, 0]));
60
+ const overrideShadows = Object.fromEntries(Object.entries(templateShadows).map(([k]) => [k, 0]));
61
+ const overrideWithColors = {
62
+ ...override,
63
+ color: 0,
64
+ colorHover: 0,
65
+ colorFocus: 0,
66
+ colorPress: 0
67
+ };
68
+ const template = {
69
+ ...templateColors,
70
+ ...toSkip,
71
+ // the background, color, etc keys here work like generics - they make it so you
72
+ // can publish components for others to use without mandating a specific color scale
73
+ // the @hanzogui/button Button component looks for `$background`, so you set the
74
+ // dark_red_Button theme to have a stronger background than the dark_red theme.
75
+ background: 2,
76
+ backgroundHover: 3,
77
+ backgroundPress: 4,
78
+ backgroundFocus: 5,
79
+ backgroundStrong: 1,
80
+ backgroundTransparent: 0,
81
+ color: -1,
82
+ colorHover: -2,
83
+ colorPress: -1,
84
+ colorFocus: -2,
85
+ colorTransparent: -0,
86
+ borderColor: 4,
87
+ borderColorHover: 5,
88
+ borderColorPress: 3,
89
+ borderColorFocus: 4,
90
+ placeholderColor: -4
91
+ };
92
+ const lightShadowColor = "rgba(0,0,0,0.02)";
93
+ const lightShadowColorStrong = "rgba(0,0,0,0.066)";
94
+ const darkShadowColor = "rgba(0,0,0,0.2)";
95
+ const darkShadowColorStrong = "rgba(0,0,0,0.3)";
96
+ const lightShadows = {
97
+ shadowColor: lightShadowColorStrong,
98
+ shadowColorHover: lightShadowColorStrong,
99
+ shadowColorPress: lightShadowColor,
100
+ shadowColorFocus: lightShadowColor
101
+ };
102
+ const darkShadows = {
103
+ shadowColor: darkShadowColorStrong,
104
+ shadowColorHover: darkShadowColorStrong,
105
+ shadowColorPress: darkShadowColor,
106
+ shadowColorFocus: darkShadowColor
107
+ };
108
+ const lightTemplate = {
109
+ ...template,
110
+ background: 2,
111
+ backgroundHover: 3,
112
+ backgroundPress: 4,
113
+ // our light color palette is... a bit unique
114
+ borderColor: 6,
115
+ borderColorHover: 7,
116
+ borderColorFocus: 5,
117
+ borderColorPress: 6,
118
+ ...lightShadows
119
+ };
120
+ const darkTemplate = {
121
+ ...template,
122
+ ...darkShadows
123
+ };
124
+ const light = (0, import_create_theme.createTheme)(palettes.light, lightTemplate);
125
+ const dark = (0, import_create_theme.createTheme)(palettes.dark, darkTemplate);
126
+ const baseThemes = {
127
+ light,
128
+ dark
129
+ };
130
+ const masks = {
131
+ skip: import_create_theme.skipMask,
132
+ weaker: (0, import_create_theme.createWeakenMask)(),
133
+ stronger: (0, import_create_theme.createStrengthenMask)()
134
+ };
135
+ const maskOptions = {
136
+ override,
137
+ skip: toSkip,
138
+ // avoids the transparent ends
139
+ max: palettes.light.length - 2,
140
+ min: 1
141
+ };
142
+ const transparent = (hsl, opacity = 0) => hsl.replace(`%)`, `%, ${opacity})`).replace(`hsl(`, `hsla(`);
143
+ const [lightColorThemes, darkColorThemes] = [import_tokens.colorTokens.light, import_tokens.colorTokens.dark].map((colorSet, i) => {
144
+ const isLight = i === 0;
145
+ const theme = baseThemes[isLight ? "light" : "dark"];
146
+ return Object.fromEntries(Object.keys(colorSet).map(color => {
147
+ const colorPalette = Object.values(colorSet[color]);
148
+ const [head, tail] = [colorPalette.slice(0, 6), colorPalette.slice(colorPalette.length - 5)];
149
+ const palette = [transparent(colorPalette[0]), ...head, ...tail, theme.color, transparent(colorPalette[colorPalette.length - 1])];
150
+ const colorTheme = (0, import_create_theme.createTheme)(palette, isLight ? {
151
+ ...lightTemplate,
152
+ // light color themes are a bit less sensitive
153
+ borderColor: 4,
154
+ borderColorHover: 5,
155
+ borderColorFocus: 4,
156
+ borderColorPress: 4
157
+ } : darkTemplate);
158
+ return [color, colorTheme];
159
+ }));
160
+ });
161
+ const allThemes = (0, import_create_theme.addChildren)(baseThemes, (name, theme) => {
162
+ const isLight = name === "light";
163
+ const inverseName = isLight ? "dark" : "light";
164
+ const inverseTheme = baseThemes[inverseName];
165
+ const colorThemes = isLight ? lightColorThemes : darkColorThemes;
166
+ const inverseColorThemes = isLight ? darkColorThemes : lightColorThemes;
167
+ const allColorThemes = (0, import_create_theme.addChildren)(colorThemes, (colorName, colorTheme) => {
168
+ const inverse = inverseColorThemes[colorName];
175
169
  return {
176
- ...{
177
- ...getAltThemes({
178
- theme,
179
- inverse: inverseTheme,
180
- isLight
181
- }),
182
- ...getComponentThemes(theme, inverseTheme, isLight)
183
- },
184
- ...allColorThemes
170
+ ...getAltThemes({
171
+ theme: colorTheme,
172
+ inverse,
173
+ isLight
174
+ }),
175
+ ...getComponentThemes(colorTheme, inverse, isLight)
185
176
  };
186
177
  });
178
+ const baseSubThemes = {
179
+ ...getAltThemes({
180
+ theme,
181
+ inverse: inverseTheme,
182
+ isLight
183
+ }),
184
+ ...getComponentThemes(theme, inverseTheme, isLight)
185
+ };
186
+ return {
187
+ ...baseSubThemes,
188
+ ...allColorThemes
189
+ };
190
+ });
187
191
  function getAltThemes({
188
192
  theme,
189
193
  inverse,
@@ -191,62 +195,66 @@ function getAltThemes({
191
195
  activeTheme
192
196
  }) {
193
197
  const maskOptionsAlt = {
194
- ...maskOptions,
195
- override: overrideShadows
196
- },
197
- alt1 = (0, import_create_theme.applyMask)(theme, masks.weaker, maskOptionsAlt),
198
- alt2 = (0, import_create_theme.applyMask)(alt1, masks.weaker, maskOptionsAlt),
199
- active = activeTheme ?? (process.env.ACTIVE_THEME_INVERSE ? inverse : (0, import_create_theme.applyMask)(theme, masks.weaker, {
198
+ ...maskOptions,
199
+ override: overrideShadows
200
+ };
201
+ const alt1 = (0, import_create_theme.applyMask)(theme, masks.weaker, maskOptionsAlt);
202
+ const alt2 = (0, import_create_theme.applyMask)(alt1, masks.weaker, maskOptionsAlt);
203
+ const active = activeTheme ?? (process.env.ACTIVE_THEME_INVERSE ? inverse : (() => {
204
+ return (0, import_create_theme.applyMask)(theme, masks.weaker, {
200
205
  ...maskOptions,
201
206
  strength: 3,
202
207
  skip: {
203
208
  ...maskOptions.skip,
204
209
  color: 1
205
210
  }
206
- }));
211
+ });
212
+ })());
207
213
  return (0, import_create_theme.addChildren)({
208
214
  alt1,
209
215
  alt2,
210
216
  active
211
- }, (_, subTheme) => getComponentThemes(subTheme, subTheme === inverse ? theme : inverse, isLight));
217
+ }, (_, subTheme) => {
218
+ return getComponentThemes(subTheme, subTheme === inverse ? theme : inverse, isLight);
219
+ });
212
220
  }
213
221
  function getComponentThemes(theme, inverse, isLight) {
214
222
  const componentMaskOptions = {
215
- ...maskOptions,
216
- override: overrideWithColors,
217
- skip: {
218
- ...maskOptions.skip,
219
- // skip colors too just for component sub themes
220
- ...templateColors
221
- }
222
- },
223
- weaker1 = (0, import_create_theme.applyMask)(theme, masks.weaker, componentMaskOptions),
224
- base = (0, import_create_theme.applyMask)(weaker1, masks.stronger, componentMaskOptions),
225
- weaker2 = (0, import_create_theme.applyMask)(weaker1, masks.weaker, componentMaskOptions),
226
- stronger1 = (0, import_create_theme.applyMask)(theme, masks.stronger, componentMaskOptions),
227
- inverse1 = (0, import_create_theme.applyMask)(inverse, masks.weaker, componentMaskOptions),
228
- inverse2 = (0, import_create_theme.applyMask)(inverse1, masks.weaker, componentMaskOptions),
229
- strongerBorderLighterBackground = isLight ? {
230
- ...stronger1,
231
- borderColor: weaker1.borderColor,
232
- borderColorHover: weaker1.borderColorHover,
233
- borderColorPress: weaker1.borderColorPress,
234
- borderColorFocus: weaker1.borderColorFocus
235
- } : {
236
- ...(0, import_create_theme.applyMask)(theme, masks.skip, componentMaskOptions),
237
- borderColor: weaker1.borderColor,
238
- borderColorHover: weaker1.borderColorHover,
239
- borderColorPress: weaker1.borderColorPress,
240
- borderColorFocus: weaker1.borderColorFocus
241
- },
242
- overlayTheme = {
243
- background: isLight ? "rgba(0,0,0,0.5)" : "rgba(0,0,0,0.9)"
244
- },
245
- weaker2WithoutBorder = {
246
- ...weaker2,
247
- borderColor: "transparent",
248
- borderColorHover: "transparent"
249
- };
223
+ ...maskOptions,
224
+ override: overrideWithColors,
225
+ skip: {
226
+ ...maskOptions.skip,
227
+ // skip colors too just for component sub themes
228
+ ...templateColors
229
+ }
230
+ };
231
+ const weaker1 = (0, import_create_theme.applyMask)(theme, masks.weaker, componentMaskOptions);
232
+ const base = (0, import_create_theme.applyMask)(weaker1, masks.stronger, componentMaskOptions);
233
+ const weaker2 = (0, import_create_theme.applyMask)(weaker1, masks.weaker, componentMaskOptions);
234
+ const stronger1 = (0, import_create_theme.applyMask)(theme, masks.stronger, componentMaskOptions);
235
+ const inverse1 = (0, import_create_theme.applyMask)(inverse, masks.weaker, componentMaskOptions);
236
+ const inverse2 = (0, import_create_theme.applyMask)(inverse1, masks.weaker, componentMaskOptions);
237
+ const strongerBorderLighterBackground = isLight ? {
238
+ ...stronger1,
239
+ borderColor: weaker1.borderColor,
240
+ borderColorHover: weaker1.borderColorHover,
241
+ borderColorPress: weaker1.borderColorPress,
242
+ borderColorFocus: weaker1.borderColorFocus
243
+ } : {
244
+ ...(0, import_create_theme.applyMask)(theme, masks.skip, componentMaskOptions),
245
+ borderColor: weaker1.borderColor,
246
+ borderColorHover: weaker1.borderColorHover,
247
+ borderColorPress: weaker1.borderColorPress,
248
+ borderColorFocus: weaker1.borderColorFocus
249
+ };
250
+ const overlayTheme = {
251
+ background: isLight ? "rgba(0,0,0,0.5)" : "rgba(0,0,0,0.9)"
252
+ };
253
+ const weaker2WithoutBorder = {
254
+ ...weaker2,
255
+ borderColor: "transparent",
256
+ borderColorHover: "transparent"
257
+ };
250
258
  return {
251
259
  ListItem: isLight ? stronger1 : base,
252
260
  Card: weaker1,