@tamagui/core 1.0.1-beta.75 → 1.0.1-beta.78

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 (201) hide show
  1. package/dist/cjs/ThemeManager.js +6 -22
  2. package/dist/cjs/ThemeManager.js.map +2 -2
  3. package/dist/cjs/createComponent.js +13 -10
  4. package/dist/cjs/createComponent.js.map +2 -2
  5. package/dist/cjs/createFont.js.map +1 -1
  6. package/dist/cjs/createTamagui.js +2 -2
  7. package/dist/cjs/createTamagui.js.map +2 -2
  8. package/dist/cjs/createVariable.js +9 -1
  9. package/dist/cjs/createVariable.js.map +2 -2
  10. package/dist/cjs/helpers/createPropMapper.js +4 -16
  11. package/dist/cjs/helpers/createPropMapper.js.map +2 -2
  12. package/dist/cjs/helpers/generateAtomicStyles.js +55 -70
  13. package/dist/cjs/helpers/generateAtomicStyles.js.map +2 -2
  14. package/dist/cjs/helpers/getSplitStyles.js +18 -10
  15. package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
  16. package/dist/cjs/helpers/getStylesAtomic.js +4 -2
  17. package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
  18. package/dist/cjs/helpers/insertStyleRule.js +12 -10
  19. package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
  20. package/dist/cjs/helpers/{pseudos.js → pseudoDescriptors.js} +7 -7
  21. package/dist/cjs/helpers/pseudoDescriptors.js.map +7 -0
  22. package/dist/cjs/index.js +1 -1
  23. package/dist/cjs/index.js.map +2 -2
  24. package/dist/cjs/insertFont.js +16 -4
  25. package/dist/cjs/insertFont.js.map +2 -2
  26. package/dist/cjs/static.js +1 -1
  27. package/dist/cjs/static.js.map +2 -2
  28. package/dist/cjs/types.js.map +1 -1
  29. package/dist/esm/ThemeManager.js +6 -22
  30. package/dist/esm/ThemeManager.js.map +2 -2
  31. package/dist/esm/constants/constants.js +23 -8
  32. package/dist/esm/constants/constants.js.map +1 -1
  33. package/dist/esm/createComponent.js +228 -121
  34. package/dist/esm/createComponent.js.map +2 -2
  35. package/dist/esm/createFont.js.map +1 -1
  36. package/dist/esm/createTamagui.js +28 -10
  37. package/dist/esm/createTamagui.js.map +2 -2
  38. package/dist/esm/createVariable.js +9 -1
  39. package/dist/esm/createVariable.js.map +2 -2
  40. package/dist/esm/helpers/createPropMapper.js +4 -5
  41. package/dist/esm/helpers/createPropMapper.js.map +2 -2
  42. package/dist/esm/helpers/createShallowUpdate.js +17 -1
  43. package/dist/esm/helpers/createShallowUpdate.js.map +1 -1
  44. package/dist/esm/helpers/createTamaguiProvider.js +39 -9
  45. package/dist/esm/helpers/createTamaguiProvider.js.map +1 -1
  46. package/dist/esm/helpers/extendStaticConfig.js +28 -27
  47. package/dist/esm/helpers/extendStaticConfig.js.map +1 -1
  48. package/dist/esm/helpers/fixNativeShadow.native.js +2 -3
  49. package/dist/esm/helpers/fixNativeShadow.native.js.map +1 -1
  50. package/dist/esm/helpers/generateAtomicStyles.js +75 -76
  51. package/dist/esm/helpers/generateAtomicStyles.js.map +2 -2
  52. package/dist/esm/helpers/getSize.js +2 -3
  53. package/dist/esm/helpers/getSize.js.map +1 -1
  54. package/dist/esm/helpers/getSplitStyles.js +50 -30
  55. package/dist/esm/helpers/getSplitStyles.js.map +2 -2
  56. package/dist/esm/helpers/getStackSize.js +1 -2
  57. package/dist/esm/helpers/getStackSize.js.map +1 -1
  58. package/dist/esm/helpers/getStylesAtomic.js +38 -7
  59. package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
  60. package/dist/esm/helpers/insertStyleRule.js +12 -10
  61. package/dist/esm/helpers/insertStyleRule.js.map +2 -2
  62. package/dist/esm/helpers/mergeTransform.js +1 -1
  63. package/dist/esm/helpers/mergeTransform.js.map +1 -1
  64. package/dist/{jsx/helpers/pseudos.js → esm/helpers/pseudoDescriptors.js} +3 -2
  65. package/dist/esm/helpers/pseudoDescriptors.js.map +7 -0
  66. package/dist/esm/helpers/themeable.js +33 -2
  67. package/dist/esm/helpers/themeable.js.map +1 -1
  68. package/dist/esm/helpers/validate.js +30 -5
  69. package/dist/esm/helpers/validate.js.map +1 -1
  70. package/dist/esm/hooks/useFeatures.js +40 -8
  71. package/dist/esm/hooks/useFeatures.js.map +1 -1
  72. package/dist/esm/hooks/useId.js +2 -3
  73. package/dist/esm/hooks/useId.js.map +1 -1
  74. package/dist/esm/hooks/useMedia.js +18 -6
  75. package/dist/esm/hooks/useMedia.js.map +1 -1
  76. package/dist/esm/hooks/usePressable.js +16 -1
  77. package/dist/esm/hooks/usePressable.js.map +1 -1
  78. package/dist/esm/hooks/useTheme.js +24 -7
  79. package/dist/esm/hooks/useTheme.js.map +1 -1
  80. package/dist/esm/index.js +1 -1
  81. package/dist/esm/index.js.map +1 -1
  82. package/dist/esm/insertFont.js +16 -4
  83. package/dist/esm/insertFont.js.map +2 -2
  84. package/dist/esm/static.js +1 -1
  85. package/dist/esm/static.js.map +1 -1
  86. package/dist/esm/styled.js +38 -9
  87. package/dist/esm/styled.js.map +1 -1
  88. package/dist/esm/views/Slot.js +40 -11
  89. package/dist/esm/views/Slot.js.map +1 -1
  90. package/dist/esm/views/Stack.js +21 -3
  91. package/dist/esm/views/Stack.js.map +1 -1
  92. package/dist/esm/views/Text.js +24 -12
  93. package/dist/esm/views/Text.js.map +1 -1
  94. package/dist/esm/views/TextAncestorContext.js +2 -2
  95. package/dist/esm/views/TextAncestorContext.js.map +1 -1
  96. package/package.json +7 -7
  97. package/reset.css +4 -0
  98. package/types/ThemeManager.d.ts +1 -1
  99. package/types/ThemeManager.d.ts.map +1 -1
  100. package/types/createComponent.d.ts +2 -4
  101. package/types/createComponent.d.ts.map +1 -1
  102. package/types/createVariable.d.ts.map +1 -1
  103. package/types/helpers/generateAtomicStyles.d.ts +2 -2
  104. package/types/helpers/generateAtomicStyles.d.ts.map +1 -1
  105. package/types/helpers/getSplitStyles.d.ts +1 -1
  106. package/types/helpers/getSplitStyles.d.ts.map +1 -1
  107. package/types/helpers/getStylesAtomic.d.ts +2 -0
  108. package/types/helpers/getStylesAtomic.d.ts.map +1 -1
  109. package/types/helpers/insertStyleRule.d.ts +1 -1
  110. package/types/helpers/insertStyleRule.d.ts.map +1 -1
  111. package/types/helpers/{pseudos.d.ts → pseudoDescriptors.d.ts} +3 -3
  112. package/types/helpers/pseudoDescriptors.d.ts.map +1 -0
  113. package/types/index.d.ts +1 -1
  114. package/types/index.d.ts.map +1 -1
  115. package/types/insertFont.d.ts +1 -1
  116. package/types/insertFont.d.ts.map +1 -1
  117. package/types/static.d.ts +1 -1
  118. package/types/static.d.ts.map +1 -1
  119. package/types/types.d.ts +2 -2
  120. package/types/types.d.ts.map +1 -1
  121. package/dist/cjs/helpers/pseudos.js.map +0 -7
  122. package/dist/esm/helpers/pseudos.js +0 -18
  123. package/dist/esm/helpers/pseudos.js.map +0 -7
  124. package/dist/jsx/Pressability.js +0 -4
  125. package/dist/jsx/Pressability.native.js +0 -4
  126. package/dist/jsx/Tamagui.js +0 -38
  127. package/dist/jsx/ThemeContext.js +0 -5
  128. package/dist/jsx/ThemeManager.js +0 -194
  129. package/dist/jsx/conf.js +0 -38
  130. package/dist/jsx/constants/constants.js +0 -17
  131. package/dist/jsx/constants/platform.js +0 -25
  132. package/dist/jsx/constants/rnw.js +0 -10
  133. package/dist/jsx/contexts/ButtonInsideButtonContext.js +0 -5
  134. package/dist/jsx/createComponent.js +0 -1036
  135. package/dist/jsx/createFont.js +0 -25
  136. package/dist/jsx/createShorthands.js +0 -6
  137. package/dist/jsx/createTamagui.js +0 -245
  138. package/dist/jsx/createTheme.js +0 -6
  139. package/dist/jsx/createTokens.js +0 -11
  140. package/dist/jsx/createVariable.js +0 -64
  141. package/dist/jsx/createVariables.js +0 -31
  142. package/dist/jsx/defaultComponentState.js +0 -0
  143. package/dist/jsx/helpers/RNComponents.js +0 -11
  144. package/dist/jsx/helpers/areEqualSets.js +0 -13
  145. package/dist/jsx/helpers/calc.js +0 -46
  146. package/dist/jsx/helpers/createMediaStyle.js +0 -29
  147. package/dist/jsx/helpers/createPropMapper.js +0 -243
  148. package/dist/jsx/helpers/createShallowUpdate.js +0 -16
  149. package/dist/jsx/helpers/createTamaguiProvider.js +0 -28
  150. package/dist/jsx/helpers/extendStaticConfig.js +0 -62
  151. package/dist/jsx/helpers/fixNativeShadow.js +0 -5
  152. package/dist/jsx/helpers/fixNativeShadow.native.js +0 -28
  153. package/dist/jsx/helpers/generateAtomicStyles.js +0 -410
  154. package/dist/jsx/helpers/getExpandedShorthands.js +0 -15
  155. package/dist/jsx/helpers/getSize.js +0 -19
  156. package/dist/jsx/helpers/getSplitStyles.js +0 -380
  157. package/dist/jsx/helpers/getStackSize.js +0 -15
  158. package/dist/jsx/helpers/getStylesAtomic.js +0 -61
  159. package/dist/jsx/helpers/getStylesAtomic.native.js +0 -6
  160. package/dist/jsx/helpers/getTextSize.js +0 -31
  161. package/dist/jsx/helpers/getVariantExtras.js +0 -22
  162. package/dist/jsx/helpers/insertStyleRule.js +0 -91
  163. package/dist/jsx/helpers/isObj.js +0 -4
  164. package/dist/jsx/helpers/isTamaguiComponent.js +0 -12
  165. package/dist/jsx/helpers/isTamaguiElement.js +0 -8
  166. package/dist/jsx/helpers/matchMedia.js +0 -15
  167. package/dist/jsx/helpers/matchMedia.native.js +0 -6
  168. package/dist/jsx/helpers/mergeProps.js +0 -15
  169. package/dist/jsx/helpers/mergeTransform.js +0 -16
  170. package/dist/jsx/helpers/nativeGestureHandler.native.js +0 -1
  171. package/dist/jsx/helpers/proxyThemeVariables.js +0 -14
  172. package/dist/jsx/helpers/registerCSSVariable.js +0 -14
  173. package/dist/jsx/helpers/themeable.js +0 -22
  174. package/dist/jsx/helpers/validate.js +0 -73
  175. package/dist/jsx/helpers/withStaticProperties.js +0 -7
  176. package/dist/jsx/helpers/wrapThemeManagerContext.js +0 -7
  177. package/dist/jsx/hooks/useConstant.js +0 -11
  178. package/dist/jsx/hooks/useFeatures.js +0 -165
  179. package/dist/jsx/hooks/useId.js +0 -32
  180. package/dist/jsx/hooks/useIsMounted.js +0 -15
  181. package/dist/jsx/hooks/useIsTouchDevice.js +0 -14
  182. package/dist/jsx/hooks/useMedia.js +0 -153
  183. package/dist/jsx/hooks/usePressable.js +0 -11
  184. package/dist/jsx/hooks/usePrevious.js +0 -0
  185. package/dist/jsx/hooks/useTheme.js +0 -164
  186. package/dist/jsx/hooks/useUnmountEffect.js +0 -7
  187. package/dist/jsx/index.js +0 -64
  188. package/dist/jsx/insertFont.js +0 -51
  189. package/dist/jsx/static.js +0 -18
  190. package/dist/jsx/styled.js +0 -49
  191. package/dist/jsx/types-rnw.js +0 -0
  192. package/dist/jsx/types.js +0 -0
  193. package/dist/jsx/views/Slot.js +0 -70
  194. package/dist/jsx/views/Stack.js +0 -12
  195. package/dist/jsx/views/Text.js +0 -57
  196. package/dist/jsx/views/TextAncestorContext.js +0 -13
  197. package/dist/jsx/views/Theme.js +0 -27
  198. package/dist/jsx/views/ThemeInverse.js +0 -24
  199. package/dist/jsx/views/ThemeProvider.js +0 -34
  200. package/dist/jsx/views/ThemeReset.js +0 -32
  201. package/types/helpers/pseudos.d.ts.map +0 -1
@@ -1,410 +0,0 @@
1
- import { simpleHash } from "@tamagui/helpers";
2
- import hyphenateStyleName from "hyphenate-style-name";
3
- import normalizeCSSColor from "normalize-css-color";
4
- import { getConfig } from "../conf";
5
- import { isWeb } from "../constants/platform";
6
- import { reversedShorthands } from "../createTamagui";
7
- import { pseudos } from "./pseudos";
8
- const generateAtomicStyles = (style, pseudo) => {
9
- const res = expandStyles(style);
10
- const out = [];
11
- for (const key in res) {
12
- const value = res[key];
13
- if (value != null) {
14
- const valueString = stringifyValueWithProperty(value, key);
15
- const hash = simpleHash(key + valueString + ((pseudo == null ? void 0 : pseudo.name) || ""));
16
- const cachedResult = cache.get(hash, valueString);
17
- if (cachedResult != null) {
18
- out.push(cachedResult);
19
- } else {
20
- const pseudoPrefix = pseudo ? `0${pseudo.name}-` : "";
21
- const shortProp = reversedShorthands[key] || key;
22
- const identifier = `_${shortProp}-${pseudoPrefix}${hash}`;
23
- const rules = createAtomicRules(identifier, key, valueString, pseudo);
24
- const styleObject = {
25
- property: key,
26
- pseudo: pseudo == null ? void 0 : pseudo.name,
27
- value,
28
- identifier,
29
- rules
30
- };
31
- cache.set(hash, valueString, styleObject);
32
- out.push(styleObject);
33
- }
34
- }
35
- }
36
- if (style.borderColor === "transparent") {
37
- debugger;
38
- }
39
- return out;
40
- };
41
- const reducedStyleKeys = {
42
- shadowColor: true,
43
- shadowOffset: true,
44
- shadowOpacity: true,
45
- shadowRadius: true,
46
- textShadowColor: true,
47
- textShadowOffset: true,
48
- textShadowRadius: true
49
- };
50
- let shorthands = null;
51
- function expandStyles(style) {
52
- const res = {};
53
- boxShadowReducer(res, style);
54
- textShadowReducer(res, style);
55
- borderReducer(res, style);
56
- for (let key in style) {
57
- shorthands = shorthands || getConfig().shorthands;
58
- if (shorthands) {
59
- key = shorthands[key] || key;
60
- }
61
- if (reducedStyleKeys[key])
62
- continue;
63
- if (key in pseudos) {
64
- res[key] = expandStyles(style[key]);
65
- } else {
66
- const val = normalizeValueWithProperty(style[key], key);
67
- const out = expandStyle(key, val);
68
- if (out) {
69
- Object.assign(res, Object.fromEntries(out));
70
- } else {
71
- res[key] = val;
72
- }
73
- }
74
- }
75
- return res;
76
- }
77
- function borderReducer(res, cur) {
78
- for (const key in borderDefaults) {
79
- if (key in cur) {
80
- res[borderDefaults[key]] = cur[borderDefaults[key]] || "solid";
81
- }
82
- }
83
- }
84
- const borderDefaults = {
85
- borderWidth: "borderStyle",
86
- borderBottomWidth: "borderBottomStyle",
87
- borderTopWidth: "borderTopStyle",
88
- borderLeftWidth: "borderLeftStyle",
89
- borderRightWidth: "borderRightStyle"
90
- };
91
- function createDeclarationBlock(style, important = false) {
92
- let declarations = "";
93
- for (const key in style) {
94
- const prop = hyphenateStyleName(key);
95
- const value = style[key];
96
- declarations += `${prop}:${value}`;
97
- }
98
- return `{${declarations}${important ? ` !important` : ""};}`;
99
- }
100
- const pseudoSelectorPrefixes = (() => {
101
- const res = {};
102
- for (const key in pseudos) {
103
- const pseudo = pseudos[key];
104
- res[pseudo.name] = [...Array(pseudo.priority)].map(() => ":root").join("") + " ";
105
- }
106
- return res;
107
- })();
108
- function createAtomicRules(identifier, property, value, pseudo) {
109
- const selector = pseudo ? `${pseudoSelectorPrefixes[pseudo.name]} .${identifier}:${pseudo.name}` : `.${identifier}`;
110
- const important = !!pseudo;
111
- let rules = [];
112
- switch (property) {
113
- case "placeholderTextColor": {
114
- const block = createDeclarationBlock({ color: value, opacity: 1 }, important);
115
- rules.push(`${selector}::placeholder${block}`);
116
- break;
117
- }
118
- case "pointerEvents": {
119
- let finalValue = value;
120
- if (value === "auto" || value === "box-only") {
121
- finalValue = "auto!important";
122
- if (value === "box-only") {
123
- const block2 = createDeclarationBlock({ pointerEvents: "none" }, important);
124
- rules.push(`${selector}>*${block2}`);
125
- }
126
- } else if (value === "none" || value === "box-none") {
127
- finalValue = "none!important";
128
- if (value === "box-none") {
129
- const block2 = createDeclarationBlock({ pointerEvents: "auto" }, important);
130
- rules.push(`${selector}>*${block2}`);
131
- }
132
- }
133
- const block = createDeclarationBlock({ pointerEvents: finalValue }, important);
134
- rules.push(`${selector}${block}`);
135
- break;
136
- }
137
- case "scrollbarWidth": {
138
- if (value === "none") {
139
- rules.push(`${selector}::-webkit-scrollbar{display:none}`);
140
- }
141
- const block = createDeclarationBlock({ scrollbarWidth: value }, important);
142
- rules.push(`${selector}${block}`);
143
- break;
144
- }
145
- default: {
146
- const block = createDeclarationBlock({ [property]: value }, important);
147
- rules.push(`${selector}${block}`);
148
- break;
149
- }
150
- }
151
- if ((pseudo == null ? void 0 : pseudo.name) === "hover") {
152
- rules = rules.map((r) => `@media not all and (hover: none) { ${r} }`);
153
- }
154
- return rules;
155
- }
156
- function expandStyle(key, value) {
157
- if (key === "flex") {
158
- if (value <= -1) {
159
- return [
160
- ["flexGrow", 0],
161
- ["flexShrink", 1],
162
- ["flexBasis", "auto"]
163
- ];
164
- }
165
- if (value >= 0) {
166
- return [
167
- ["flexGrow", value],
168
- ["flexShrink", 1]
169
- ];
170
- }
171
- return;
172
- }
173
- switch (key) {
174
- case "elevation":
175
- case "overlayColor":
176
- case "resizeMode":
177
- case "tintColor": {
178
- break;
179
- }
180
- case "aspectRatio": {
181
- return [[key, value.toString()]];
182
- }
183
- case "backgroundClip": {
184
- if (value === "text") {
185
- return [
186
- ["backgroundClip", value],
187
- ["WebkitBackgroundClip", value]
188
- ];
189
- }
190
- break;
191
- }
192
- case "textAlignVertical": {
193
- return [["verticalAlign", value === "center" ? "middle" : value]];
194
- }
195
- case "textDecorationLine": {
196
- return [["textDecorationLine", value]];
197
- }
198
- case "transform": {
199
- if (Array.isArray(value)) {
200
- return [[key, value.map(mapTransform).join(" ")]];
201
- }
202
- break;
203
- }
204
- case "writingDirection": {
205
- return [["direction", value]];
206
- }
207
- }
208
- const longKey = STYLE_SHORT_FORM_EXPANSIONS[key];
209
- if (longKey) {
210
- return longKey.map((key2) => {
211
- return [key2, value];
212
- });
213
- } else {
214
- if (isWeb && Array.isArray(value)) {
215
- return [[key, value.join(",")]];
216
- }
217
- }
218
- }
219
- const cache = {
220
- get(property, value) {
221
- if (cache[property] != null && cache[property].hasOwnProperty(value) && cache[property][value] != null) {
222
- return cache[property][value];
223
- }
224
- },
225
- set(property, value, object) {
226
- if (cache[property] == null) {
227
- cache[property] = {};
228
- }
229
- return cache[property][value] = object;
230
- }
231
- };
232
- function stringifyValueWithProperty(value, property) {
233
- return normalizeValueWithProperty(value, property);
234
- }
235
- const mapTransform = (transform) => {
236
- const type = Object.keys(transform)[0];
237
- const value = transform[type];
238
- if (type === "matrix" || type === "matrix3d") {
239
- return `${type}(${value.join(",")})`;
240
- } else {
241
- const normalizedValue = normalizeValueWithProperty(value, type);
242
- return `${type}(${normalizedValue})`;
243
- }
244
- };
245
- const colorProps = {
246
- backgroundColor: true,
247
- borderColor: true,
248
- borderTopColor: true,
249
- borderRightColor: true,
250
- borderBottomColor: true,
251
- borderLeftColor: true,
252
- color: true,
253
- shadowColor: true,
254
- textDecorationColor: true,
255
- textShadowColor: true
256
- };
257
- function normalizeValueWithProperty(value, property) {
258
- if (process.env.TAMAGUI_TARGET === "web") {
259
- const shouldCoerceToPx = typeof value === "number" && (property === void 0 || property === null || !unitlessNumbers[property]);
260
- if (shouldCoerceToPx) {
261
- return `${value}px`;
262
- }
263
- }
264
- if (property && colorProps[property]) {
265
- return normalizeColor(value);
266
- }
267
- return value;
268
- }
269
- const normalizeColor = (color, opacity = 1) => {
270
- if (color == null || color == void 0) {
271
- return;
272
- }
273
- if (process.env.TAMAGUI_TARGET === "web") {
274
- if (typeof color === "string" && isWebColor(color)) {
275
- return color;
276
- }
277
- }
278
- const colorInt = processColor(color);
279
- if (colorInt != null) {
280
- const r = colorInt >> 16 & 255;
281
- const g = colorInt >> 8 & 255;
282
- const b = colorInt & 255;
283
- const a = (colorInt >> 24 & 255) / 255;
284
- const alpha = (a * opacity).toFixed(2);
285
- return `rgba(${r},${g},${b},${alpha})`;
286
- }
287
- return `${color}`;
288
- };
289
- const webColors = {
290
- currentColor: true,
291
- currentcolor: true,
292
- transparent: true,
293
- inherit: true
294
- };
295
- const isWebColor = (color) => webColors[color] || color.indexOf("var(") === 0;
296
- const processColor = (color) => {
297
- if (color === void 0 || color === null) {
298
- return color;
299
- }
300
- let intColor = normalizeCSSColor(color);
301
- if (intColor === void 0 || intColor === null) {
302
- return void 0;
303
- }
304
- return (+intColor << 24 | +intColor >>> 8) >>> 0;
305
- };
306
- const unitlessNumbers = {
307
- animationIterationCount: true,
308
- aspectRatio: true,
309
- borderImageOutset: true,
310
- borderImageSlice: true,
311
- borderImageWidth: true,
312
- boxFlex: true,
313
- boxFleGroup: true,
314
- boxOrdinalGroup: true,
315
- columnCount: true,
316
- flex: true,
317
- flexGrow: true,
318
- flexOrder: true,
319
- flexPositive: true,
320
- flexShrink: true,
321
- flexNegative: true,
322
- fontWeight: true,
323
- gridRow: true,
324
- gridRowEnd: true,
325
- gridRowGap: true,
326
- gridRowStart: true,
327
- gridColumn: true,
328
- gridColumnEnd: true,
329
- gridColumnGap: true,
330
- gridColumnStart: true,
331
- lineClamp: true,
332
- opacity: true,
333
- order: true,
334
- orphans: true,
335
- tabSize: true,
336
- widows: true,
337
- zIndex: true,
338
- zoom: true,
339
- fillOpacity: true,
340
- floodOpacity: true,
341
- stopOpacity: true,
342
- strokeDasharray: true,
343
- strokeDashoffset: true,
344
- strokeMiterlimit: true,
345
- strokeOpacity: true,
346
- strokeWidth: true,
347
- scale: true,
348
- scaleX: true,
349
- scaleY: true,
350
- scaleZ: true,
351
- shadowOpacity: true
352
- };
353
- const resolveShadowValue = (style) => {
354
- const { shadowColor, shadowOffset, shadowOpacity, shadowRadius } = style;
355
- if (shadowRadius === void 0) {
356
- return;
357
- }
358
- const { height, width } = shadowOffset || defaultOffset;
359
- const offsetX = normalizeValueWithProperty(width);
360
- const offsetY = normalizeValueWithProperty(height);
361
- const blurRadius = normalizeValueWithProperty(shadowRadius || 0);
362
- const color = normalizeColor(String(shadowColor || "black"), shadowOpacity);
363
- return `${offsetX} ${offsetY} ${blurRadius} ${color}`;
364
- };
365
- function boxShadowReducer(resolvedStyle, style) {
366
- const { boxShadow } = style;
367
- const shadow = resolveShadowValue(style);
368
- if (shadow != null) {
369
- resolvedStyle.boxShadow = boxShadow ? `${boxShadow}, ${shadow}` : shadow;
370
- }
371
- }
372
- const defaultOffset = { height: 0, width: 0 };
373
- function textShadowReducer(resolvedStyle, style) {
374
- const { textShadowColor, textShadowOffset, textShadowRadius } = style;
375
- const { height, width } = textShadowOffset || defaultOffset;
376
- const radius = textShadowRadius || 0;
377
- const offsetX = normalizeValueWithProperty(width);
378
- const offsetY = normalizeValueWithProperty(height);
379
- const blurRadius = normalizeValueWithProperty(radius);
380
- const color = normalizeValueWithProperty(textShadowColor, "textShadowColor");
381
- if (color && (height !== 0 || width !== 0 || radius !== 0) && offsetX != null && offsetY != null && blurRadius != null) {
382
- resolvedStyle.textShadow = `${offsetX} ${offsetY} ${blurRadius} ${color}`;
383
- }
384
- }
385
- const STYLE_SHORT_FORM_EXPANSIONS = {
386
- borderColor: ["borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor"],
387
- borderRadius: [
388
- "borderTopLeftRadius",
389
- "borderTopRightRadius",
390
- "borderBottomRightRadius",
391
- "borderBottomLeftRadius"
392
- ],
393
- borderStyle: ["borderTopStyle", "borderRightStyle", "borderBottomStyle", "borderLeftStyle"],
394
- borderWidth: ["borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth"],
395
- margin: ["marginTop", "marginRight", "marginBottom", "marginLeft"],
396
- marginHorizontal: ["marginRight", "marginLeft"],
397
- marginVertical: ["marginTop", "marginBottom"],
398
- overscrollBehavior: ["overscrollBehaviorX", "overscrollBehaviorY"],
399
- padding: ["paddingTop", "paddingRight", "paddingBottom", "paddingLeft"],
400
- paddingHorizontal: ["paddingRight", "paddingLeft"],
401
- paddingVertical: ["paddingTop", "paddingBottom"],
402
- ...isWeb && {
403
- overflow: ["overflowX", "overflowY"]
404
- }
405
- };
406
- export {
407
- expandStyle,
408
- expandStyles,
409
- generateAtomicStyles
410
- };
@@ -1,15 +0,0 @@
1
- import { getConfig } from "../conf";
2
- function getExpandedShorthands(props) {
3
- const shorthands = getConfig().shorthands;
4
- if (!shorthands) {
5
- return props;
6
- }
7
- let res = {};
8
- for (const key in props) {
9
- res[shorthands[key] || key] = props[key];
10
- }
11
- return res;
12
- }
13
- export {
14
- getExpandedShorthands
15
- };
@@ -1,19 +0,0 @@
1
- import { getTokens } from "../conf";
2
- const getSize = (size, shift = 0, bounds = [0]) => {
3
- return stepTokenUpOrDown(getTokens().size, size, shift, bounds);
4
- };
5
- const stepTokenUpOrDown = (tokens, current, shift = 0, bounds = [0]) => {
6
- var _a, _b;
7
- const sizeNames = Object.keys(tokens);
8
- const currentKeyNum = (typeof current === "string" ? current.replace("$", "") : current) || "4";
9
- const nextKeyName = `$${+currentKeyNum + shift}`;
10
- const min = (_a = bounds[0]) != null ? _a : 0;
11
- const max = (_b = bounds[1]) != null ? _b : sizeNames.length - 1;
12
- const index = Math.min(max, Math.max(min, sizeNames.indexOf(nextKeyName)));
13
- const key = sizeNames[index];
14
- return tokens[key] || tokens["$4"];
15
- };
16
- export {
17
- getSize,
18
- stepTokenUpOrDown
19
- };