@tamagui/helpers 2.0.0-rc.3 → 2.0.0-rc.30

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 (59) hide show
  1. package/dist/cjs/clamp.native.js.map +1 -1
  2. package/dist/cjs/composeEventHandlers.native.js.map +1 -1
  3. package/dist/cjs/index.js +17 -14
  4. package/dist/cjs/index.native.js +7 -7
  5. package/dist/cjs/index.native.js.map +1 -1
  6. package/dist/cjs/shouldRenderNativePlatform.native.js.map +1 -1
  7. package/dist/cjs/types.native.js.map +1 -1
  8. package/dist/cjs/validStyleProps.cjs +84 -39
  9. package/dist/cjs/validStyleProps.native.js +82 -39
  10. package/dist/cjs/validStyleProps.native.js.map +1 -1
  11. package/dist/cjs/webOnlyStyleProps.cjs +38 -30
  12. package/dist/cjs/webOnlyStyleProps.native.js +38 -30
  13. package/dist/cjs/webOnlyStyleProps.native.js.map +1 -1
  14. package/dist/cjs/withStaticProperties.native.js.map +1 -1
  15. package/dist/esm/index.js +7 -7
  16. package/dist/esm/index.js.map +1 -6
  17. package/dist/esm/validStyleProps.mjs +84 -41
  18. package/dist/esm/validStyleProps.mjs.map +1 -1
  19. package/dist/esm/validStyleProps.native.js +81 -41
  20. package/dist/esm/validStyleProps.native.js.map +1 -1
  21. package/dist/esm/webOnlyStyleProps.mjs +37 -31
  22. package/dist/esm/webOnlyStyleProps.mjs.map +1 -1
  23. package/dist/esm/webOnlyStyleProps.native.js +37 -31
  24. package/dist/esm/webOnlyStyleProps.native.js.map +1 -1
  25. package/package.json +7 -10
  26. package/src/validStyleProps.ts +104 -38
  27. package/src/webOnlyStyleProps.ts +40 -29
  28. package/types/validStyleProps.d.ts +337 -238
  29. package/types/validStyleProps.d.ts.map +1 -1
  30. package/types/webOnlyStyleProps.d.ts +60 -20
  31. package/types/webOnlyStyleProps.d.ts.map +1 -1
  32. package/dist/cjs/clamp.js +0 -23
  33. package/dist/cjs/clamp.js.map +0 -6
  34. package/dist/cjs/composeEventHandlers.js +0 -27
  35. package/dist/cjs/composeEventHandlers.js.map +0 -6
  36. package/dist/cjs/shouldRenderNativePlatform.js +0 -35
  37. package/dist/cjs/shouldRenderNativePlatform.js.map +0 -6
  38. package/dist/cjs/types.js +0 -25
  39. package/dist/cjs/types.js.map +0 -6
  40. package/dist/cjs/validStyleProps.js +0 -283
  41. package/dist/cjs/validStyleProps.js.map +0 -6
  42. package/dist/cjs/webOnlyStyleProps.js +0 -89
  43. package/dist/cjs/webOnlyStyleProps.js.map +0 -6
  44. package/dist/cjs/withStaticProperties.js +0 -21
  45. package/dist/cjs/withStaticProperties.js.map +0 -6
  46. package/dist/esm/clamp.js +0 -7
  47. package/dist/esm/clamp.js.map +0 -6
  48. package/dist/esm/composeEventHandlers.js +0 -11
  49. package/dist/esm/composeEventHandlers.js.map +0 -6
  50. package/dist/esm/shouldRenderNativePlatform.js +0 -19
  51. package/dist/esm/shouldRenderNativePlatform.js.map +0 -6
  52. package/dist/esm/types.js +0 -9
  53. package/dist/esm/types.js.map +0 -6
  54. package/dist/esm/validStyleProps.js +0 -268
  55. package/dist/esm/validStyleProps.js.map +0 -6
  56. package/dist/esm/webOnlyStyleProps.js +0 -73
  57. package/dist/esm/webOnlyStyleProps.js.map +0 -6
  58. package/dist/esm/withStaticProperties.js +0 -5
  59. package/dist/esm/withStaticProperties.js.map +0 -6
@@ -1,8 +1,39 @@
1
1
  import { isAndroid } from '@tamagui/constants'
2
- import { webOnlyStylePropsText, webOnlyStylePropsView } from './webOnlyStyleProps'
2
+ import {
3
+ nonAnimatableWebTextProps,
4
+ nonAnimatableWebViewProps,
5
+ webOnlyStylePropsText,
6
+ webOnlyStylePropsView,
7
+ } from './webOnlyStyleProps'
3
8
 
4
9
  // generally organizing this so we don't duplicate things so its a bit weird
5
10
 
11
+ // longhands of CSS shorthands - used for specificity boosting on web
12
+ // so that e.g. borderWidth always beats border in the cascade
13
+ export const cssShorthandLonghands = {
14
+ // border longhands
15
+ borderWidth: true,
16
+ borderStyle: true,
17
+ borderColor: true,
18
+ borderTopWidth: true,
19
+ borderTopStyle: true,
20
+ borderTopColor: true,
21
+ borderRightWidth: true,
22
+ borderRightStyle: true,
23
+ borderRightColor: true,
24
+ borderBottomWidth: true,
25
+ borderBottomStyle: true,
26
+ borderBottomColor: true,
27
+ borderLeftWidth: true,
28
+ borderLeftStyle: true,
29
+ borderLeftColor: true,
30
+ // outline longhands
31
+ outlineWidth: true,
32
+ outlineStyle: true,
33
+ outlineColor: true,
34
+ outlineOffset: true,
35
+ }
36
+
6
37
  const textColors = {
7
38
  color: true,
8
39
  textDecorationColor: true,
@@ -68,8 +99,75 @@ export const tokenCategories = {
68
99
  },
69
100
  }
70
101
 
71
- export const stylePropsUnitless = {
102
+ // discrete (non-animatable) view style properties - keyword-based, no interpolation
103
+ // defined above stylePropsView so it can be spread in without duplication
104
+ const nonAnimatableViewProps = {
105
+ alignContent: true,
106
+ alignItems: true,
107
+ alignSelf: true,
108
+ backfaceVisibility: true,
109
+ borderCurve: true,
110
+ borderStyle: true,
111
+ borderBlockStyle: true,
112
+ borderBlockEndStyle: true,
113
+ borderBlockStartStyle: true,
114
+ borderInlineStyle: true,
115
+ borderInlineEndStyle: true,
116
+ borderInlineStartStyle: true,
117
+ boxSizing: true,
118
+ cursor: true,
119
+ direction: true,
120
+ display: true,
121
+ flexDirection: true,
122
+ flexWrap: true,
123
+ isolation: true,
124
+ justifyContent: true,
125
+ mixBlendMode: true,
126
+ outlineStyle: true,
127
+ overflow: true,
128
+ position: true,
129
+ }
130
+
131
+ // discrete (non-animatable) font properties
132
+ const nonAnimatableFontProps = {
133
+ fontFamily: true,
134
+ fontStyle: true,
135
+ fontVariant: true,
136
+ textTransform: true,
137
+ }
138
+
139
+ // discrete (non-animatable) text-only properties
140
+ const nonAnimatableTextOnlyProps = {
141
+ textAlign: true,
142
+ textDecorationLine: true,
143
+ textDecorationStyle: true,
144
+ userSelect: true,
145
+ }
146
+
147
+ // discrete (non-animatable) unitless properties
148
+ const nonAnimatableUnitlessProps = {
72
149
  WebkitLineClamp: true,
150
+ lineClamp: true,
151
+ gridTemplateColumns: true,
152
+ gridTemplateAreas: true,
153
+ }
154
+
155
+ // all non-animatable style props combined, used by getSplitStyles to keep
156
+ // these as atomic CSS classNames even for components with animation drivers
157
+ export const nonAnimatableStyleProps = {
158
+ ...nonAnimatableViewProps,
159
+ ...nonAnimatableFontProps,
160
+ ...nonAnimatableTextOnlyProps,
161
+ ...nonAnimatableUnitlessProps,
162
+ // web-only discrete properties (defined in webOnlyStyleProps.ts)
163
+ ...(process.env.TAMAGUI_TARGET === 'web' && {
164
+ ...nonAnimatableWebViewProps,
165
+ ...nonAnimatableWebTextProps,
166
+ }),
167
+ }
168
+
169
+ export const stylePropsUnitless = {
170
+ ...nonAnimatableUnitlessProps,
73
171
  animationIterationCount: true,
74
172
  aspectRatio: true,
75
173
  borderImageOutset: true,
@@ -91,9 +189,6 @@ export const stylePropsUnitless = {
91
189
  gridColumnEnd: true,
92
190
  gridColumnGap: true,
93
191
  gridColumnStart: true,
94
- gridTemplateColumns: true,
95
- gridTemplateAreas: true,
96
- lineClamp: true,
97
192
  opacity: true,
98
193
  order: true,
99
194
  orphans: true,
@@ -125,9 +220,7 @@ export const stylePropsTransform = {
125
220
  }
126
221
 
127
222
  export const stylePropsView = {
128
- backfaceVisibility: true,
129
- borderCurve: true,
130
- cursor: true,
223
+ ...nonAnimatableViewProps,
131
224
  borderBottomEndRadius: true,
132
225
  borderBottomStartRadius: true,
133
226
  borderBottomWidth: true,
@@ -139,34 +232,20 @@ export const stylePropsView = {
139
232
  borderInlineWidth: true,
140
233
  borderInlineEndWidth: true,
141
234
  borderInlineStartWidth: true,
142
- borderStyle: true,
143
- borderBlockStyle: true,
144
- borderBlockEndStyle: true,
145
- borderBlockStartStyle: true,
146
- borderInlineStyle: true,
147
- borderInlineEndStyle: true,
148
- borderInlineStartStyle: true,
149
235
  borderTopEndRadius: true,
150
236
  borderTopStartRadius: true,
151
237
  borderTopWidth: true,
152
238
  borderWidth: true,
153
239
  transform: true,
154
240
  transformOrigin: true,
155
- alignContent: true,
156
- alignItems: true,
157
- alignSelf: true,
158
241
  borderEndWidth: true,
159
242
  borderStartWidth: true,
160
243
  bottom: true,
161
- display: true,
162
244
  end: true,
163
245
  flexBasis: true,
164
- flexDirection: true,
165
- flexWrap: true,
166
246
  gap: true,
167
247
  columnGap: true,
168
248
  rowGap: true,
169
- justifyContent: true,
170
249
  left: true,
171
250
  margin: true,
172
251
  marginBlock: true,
@@ -183,7 +262,6 @@ export const stylePropsView = {
183
262
  marginStart: true,
184
263
  marginTop: true,
185
264
  marginVertical: true,
186
- overflow: true,
187
265
  padding: true,
188
266
  paddingBottom: true,
189
267
  paddingInline: true,
@@ -198,7 +276,6 @@ export const stylePropsView = {
198
276
  paddingStart: true,
199
277
  paddingTop: true,
200
278
  paddingVertical: true,
201
- position: true,
202
279
  right: true,
203
280
  start: true,
204
281
  top: true,
@@ -209,13 +286,11 @@ export const stylePropsView = {
209
286
  insetInline: true,
210
287
  insetInlineEnd: true,
211
288
  insetInlineStart: true,
212
- direction: true,
213
289
  shadowOffset: true,
214
290
  shadowRadius: true,
215
291
  ...tokenCategories.color,
216
292
  ...tokenCategories.radius,
217
293
  ...tokenCategories.size,
218
- ...tokenCategories.radius,
219
294
  ...stylePropsTransform,
220
295
  ...stylePropsUnitless,
221
296
  ...(isAndroid ? { elevationAndroid: true } : {}),
@@ -228,12 +303,9 @@ export const stylePropsView = {
228
303
  // the actual RN 0.76+ prop name (backgroundImage expands to this on native)
229
304
  experimental_backgroundImage: true,
230
305
  // RN 0.76/0.77+ style props (New Architecture)
231
- boxSizing: true,
232
- mixBlendMode: true,
233
- isolation: true,
306
+ outline: true,
234
307
  outlineColor: true,
235
308
  outlineOffset: true,
236
- outlineStyle: true,
237
309
  outlineWidth: true,
238
310
 
239
311
  // web-only for convenience - tree-shaken on native
@@ -241,26 +313,20 @@ export const stylePropsView = {
241
313
  }
242
314
 
243
315
  const stylePropsFont = {
244
- fontFamily: true,
316
+ ...nonAnimatableFontProps,
245
317
  fontSize: true,
246
- fontStyle: true,
247
318
  fontWeight: true,
248
- fontVariant: true,
249
319
  letterSpacing: true,
250
320
  lineHeight: true,
251
- textTransform: true,
252
321
  }
253
322
 
254
323
  export const stylePropsTextOnly = {
255
324
  ...stylePropsFont,
256
- textAlign: true,
257
- textDecorationLine: true,
258
- textDecorationStyle: true,
325
+ ...nonAnimatableTextOnlyProps,
259
326
  ...textColors,
260
327
  textShadow: true,
261
328
  textShadowOffset: true,
262
329
  textShadowRadius: true,
263
- userSelect: true,
264
330
  verticalAlign: true,
265
331
 
266
332
  // web-only text props - tree-shaken on native
@@ -2,53 +2,31 @@
2
2
  // NOTE: backgroundColor is NOT web-only - it works on React Native too!
3
3
  // NOTE: RN 0.76+ added: boxShadow, filter (cross-platform, with some Android 12+ only filters)
4
4
  // NOTE: RN 0.77+ added: boxSizing, mixBlendMode, isolation, outline* props
5
- export const webOnlyStylePropsView = {
6
- transition: true,
7
- textWrap: true,
8
- backdropFilter: true,
9
- WebkitBackdropFilter: true,
10
- background: true,
11
- borderTop: true,
12
- borderRight: true,
13
- borderBottom: true,
14
- borderLeft: true,
5
+
6
+ // web-only discrete (non-animatable) view props
7
+ export const nonAnimatableWebViewProps = {
15
8
  backgroundAttachment: true,
16
9
  backgroundBlendMode: true,
17
10
  backgroundClip: true,
18
11
  backgroundOrigin: true,
19
- backgroundPosition: true,
20
12
  backgroundRepeat: true,
21
- backgroundSize: true,
22
13
  borderBottomStyle: true,
23
- borderImage: true,
24
14
  borderLeftStyle: true,
25
15
  borderRightStyle: true,
26
16
  borderTopStyle: true,
27
- caretColor: true,
28
- clipPath: true,
29
17
  contain: true,
30
18
  containerType: true,
31
19
  content: true,
32
20
  float: true,
33
- mask: true,
34
- maskBorder: true,
35
21
  maskBorderMode: true,
36
- maskBorderOutset: true,
37
22
  maskBorderRepeat: true,
38
- maskBorderSlice: true,
39
- maskBorderSource: true,
40
- maskBorderWidth: true,
41
23
  maskClip: true,
42
24
  maskComposite: true,
43
- maskImage: true,
44
25
  maskMode: true,
45
26
  maskOrigin: true,
46
- maskPosition: true,
47
27
  maskRepeat: true,
48
- maskSize: true,
49
28
  maskType: true,
50
29
  objectFit: true,
51
- objectPosition: true,
52
30
  overflowBlock: true,
53
31
  overflowInline: true,
54
32
  overflowX: true,
@@ -56,19 +34,52 @@ export const webOnlyStylePropsView = {
56
34
  // NOTE: pointerEvents is NOT web-only - it's a core React Native View prop (not a style)
57
35
  pointerEvents: true,
58
36
  scrollbarWidth: true,
59
- textEmphasis: true,
37
+ textWrap: true,
60
38
  touchAction: true,
61
39
  transformStyle: true,
62
- userSelect: true,
63
40
  willChange: true,
64
41
  }
65
42
 
66
- export const webOnlyStylePropsText = {
43
+ // web-only discrete (non-animatable) text props
44
+ export const nonAnimatableWebTextProps = {
67
45
  whiteSpace: true,
68
46
  wordWrap: true,
69
47
  textOverflow: true,
48
+ WebkitBoxOrient: true,
49
+ }
50
+
51
+ export const webOnlyStylePropsView = {
52
+ ...nonAnimatableWebViewProps,
53
+ transition: true,
54
+ backdropFilter: true,
55
+ WebkitBackdropFilter: true,
56
+ background: true,
57
+ borderTop: true,
58
+ borderRight: true,
59
+ borderBottom: true,
60
+ borderLeft: true,
61
+ backgroundPosition: true,
62
+ backgroundSize: true,
63
+ borderImage: true,
64
+ caretColor: true,
65
+ clipPath: true,
66
+ mask: true,
67
+ maskBorder: true,
68
+ maskBorderOutset: true,
69
+ maskBorderSlice: true,
70
+ maskBorderSource: true,
71
+ maskBorderWidth: true,
72
+ maskImage: true,
73
+ maskPosition: true,
74
+ maskSize: true,
75
+ objectPosition: true,
76
+ textEmphasis: true,
77
+ userSelect: true,
78
+ }
79
+
80
+ export const webOnlyStylePropsText = {
81
+ ...nonAnimatableWebTextProps,
70
82
  textDecorationDistance: true,
71
83
  // cursor: now cross-platform - in stylePropsView
72
84
  WebkitLineClamp: true,
73
- WebkitBoxOrient: true,
74
85
  }