@tamagui/helpers 1.46.2 → 1.47.0

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.
@@ -1,6 +1,76 @@
1
- // flat transform props
2
1
  import { isAndroid } from '@tamagui/constants'
3
- export const stylePropsTransform = Object.freeze({
2
+
3
+ // used for propMapping to find the right token category
4
+ // just specificy the least costly, all else go to `space` (most keys - we can exclude)
5
+ export const tokenCategories = {
6
+ radius: {
7
+ borderRadius: true,
8
+ borderTopLeftRadius: true,
9
+ borderTopRightRadius: true,
10
+ borderBottomLeftRadius: true,
11
+ borderBottomRightRadius: true,
12
+ },
13
+ size: {
14
+ width: true,
15
+ height: true,
16
+ minWidth: true,
17
+ minHeight: true,
18
+ maxWidth: true,
19
+ maxHeight: true,
20
+ },
21
+ zIndex: {
22
+ zIndex: true,
23
+ },
24
+ color: {
25
+ color: true,
26
+ backgroundColor: true,
27
+ borderColor: true,
28
+ borderBottomColor: true,
29
+ borderTopColor: true,
30
+ borderLeftColor: true,
31
+ borderRightColor: true,
32
+ },
33
+ }
34
+
35
+ export const stylePropsUnitless = {
36
+ WebkitLineClamp: true,
37
+ animationIterationCount: true,
38
+ aspectRatio: true,
39
+ borderImageOutset: true,
40
+ borderImageSlice: true,
41
+ borderImageWidth: true,
42
+ columnCount: true,
43
+ flex: true,
44
+ flexGrow: true,
45
+ flexOrder: true,
46
+ flexPositive: true,
47
+ flexShrink: true,
48
+ flexNegative: true,
49
+ fontWeight: true,
50
+ gridRow: true,
51
+ gridRowEnd: true,
52
+ gridRowGap: true,
53
+ gridRowStart: true,
54
+ gridColumn: true,
55
+ gridColumnEnd: true,
56
+ gridColumnGap: true,
57
+ gridColumnStart: true,
58
+ lineClamp: true,
59
+ opacity: true,
60
+ order: true,
61
+ orphans: true,
62
+ tabSize: true,
63
+ widows: true,
64
+ zIndex: true,
65
+ zoom: true,
66
+ scale: true,
67
+ scaleX: true,
68
+ scaleY: true,
69
+ scaleZ: true,
70
+ shadowOpacity: true,
71
+ }
72
+
73
+ export const stylePropsTransform = {
4
74
  x: true,
5
75
  y: true,
6
76
  scale: true,
@@ -14,58 +84,41 @@ export const stylePropsTransform = Object.freeze({
14
84
  rotateY: true,
15
85
  rotateX: true,
16
86
  rotateZ: true,
17
- })
87
+ }
18
88
 
19
- export const validStylesOnBaseProps = Object.freeze({
89
+ export const validStylesOnBaseProps = {
20
90
  placeholderTextColor: true,
21
- })
91
+ }
22
92
 
23
- export const stylePropsView = Object.freeze({
93
+ export const stylePropsView = {
24
94
  backfaceVisibility: true,
25
- backgroundColor: true,
26
- borderBottomColor: true,
27
95
  borderBottomEndRadius: true,
28
- borderBottomLeftRadius: true,
29
- borderBottomRightRadius: true,
30
96
  borderBottomStartRadius: true,
31
97
  borderBottomWidth: true,
32
- borderColor: true,
33
98
  borderEndColor: true,
34
- borderLeftColor: true,
35
99
  borderLeftWidth: true,
36
- borderRadius: true,
37
- borderRightColor: true,
38
100
  borderRightWidth: true,
39
101
  borderStartColor: true,
40
102
  borderStyle: true,
41
- borderTopColor: true,
42
103
  borderTopEndRadius: true,
43
- borderTopLeftRadius: true,
44
- borderTopRightRadius: true,
45
104
  borderTopStartRadius: true,
46
105
  borderTopWidth: true,
47
106
  borderWidth: true,
48
- opacity: true,
49
107
  transform: true,
50
108
  alignContent: true,
51
109
  alignItems: true,
52
110
  alignSelf: true,
53
- aspectRatio: true,
54
111
  borderEndWidth: true,
55
112
  borderStartWidth: true,
56
113
  bottom: true,
57
114
  display: true,
58
115
  end: true,
59
- flex: true,
60
116
  flexBasis: true,
61
117
  flexDirection: true,
62
- flexGrow: true,
63
- flexShrink: true,
64
118
  flexWrap: true,
65
119
  gap: true,
66
120
  columnGap: true,
67
121
  rowGap: true,
68
- height: true,
69
122
  justifyContent: true,
70
123
  left: true,
71
124
  margin: true,
@@ -77,10 +130,6 @@ export const stylePropsView = Object.freeze({
77
130
  marginStart: true,
78
131
  marginTop: true,
79
132
  marginVertical: true,
80
- maxHeight: true,
81
- maxWidth: true,
82
- minHeight: true,
83
- minWidth: true,
84
133
  overflow: true,
85
134
  padding: true,
86
135
  paddingBottom: true,
@@ -95,15 +144,17 @@ export const stylePropsView = Object.freeze({
95
144
  right: true,
96
145
  start: true,
97
146
  top: true,
98
- width: true,
99
- zIndex: true,
100
147
  direction: true,
101
148
  shadowColor: true,
102
149
  shadowOffset: true,
103
- shadowOpacity: true,
104
150
  shadowRadius: true,
151
+ ...tokenCategories.color,
152
+ ...tokenCategories.radius,
153
+ ...tokenCategories.size,
154
+ ...tokenCategories.radius,
105
155
  ...validStylesOnBaseProps,
106
156
  ...stylePropsTransform,
157
+ ...stylePropsUnitless,
107
158
 
108
159
  // allow a few web only ones
109
160
 
@@ -128,9 +179,9 @@ export const stylePropsView = Object.freeze({
128
179
  outlineWidth: true,
129
180
  }),
130
181
  ...(isAndroid ? { elevationAndroid: true } : {}),
131
- })
182
+ }
132
183
 
133
- export const stylePropsFont = Object.freeze({
184
+ export const stylePropsFont = {
134
185
  fontFamily: true,
135
186
  fontSize: true,
136
187
  fontStyle: true,
@@ -138,9 +189,9 @@ export const stylePropsFont = Object.freeze({
138
189
  letterSpacing: true,
139
190
  lineHeight: true,
140
191
  textTransform: true,
141
- })
192
+ }
142
193
 
143
- export const stylePropsTextOnly = Object.freeze({
194
+ export const stylePropsTextOnly = {
144
195
  color: true,
145
196
  ...stylePropsFont,
146
197
  textAlign: true,
@@ -163,24 +214,24 @@ export const stylePropsTextOnly = Object.freeze({
163
214
  WebkitLineClamp: true,
164
215
  WebkitBoxOrient: true,
165
216
  }),
166
- })
217
+ }
167
218
 
168
- export const stylePropsText = Object.freeze({
219
+ export const stylePropsText = {
169
220
  ...stylePropsView,
170
221
  ...stylePropsTextOnly,
171
- })
222
+ }
172
223
 
173
224
  export const stylePropsAll = stylePropsText
174
225
 
175
- export const validPseudoKeys = Object.freeze({
226
+ export const validPseudoKeys = {
176
227
  enterStyle: true,
177
228
  exitStyle: true,
178
229
  hoverStyle: true,
179
230
  pressStyle: true,
180
231
  focusStyle: true,
181
- })
232
+ }
182
233
 
183
- export const validStyles = Object.freeze({
234
+ export const validStyles = {
184
235
  ...validPseudoKeys,
185
236
  ...stylePropsView,
186
- })
237
+ }