@tamagui/helpers 1.88.12 → 1.89.0-1706308641099
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.
- package/LICENSE +21 -0
- package/dist/esm/clamp.mjs +4 -0
- package/dist/esm/composeEventHandlers.mjs +10 -0
- package/dist/esm/concatClassName.mjs +51 -0
- package/dist/esm/index.mjs +7 -0
- package/dist/esm/types.mjs +0 -0
- package/dist/esm/validStyleProps.mjs +244 -0
- package/dist/esm/withStaticProperties.mjs +21 -0
- package/package.json +4 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Nate Wienert
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
function composeEventHandlers(og, next, {
|
|
2
|
+
checkDefaultPrevented = !0
|
|
3
|
+
} = {}) {
|
|
4
|
+
return !og || !next ? next || og || void 0 : event => {
|
|
5
|
+
if (og?.(event), !event || !(checkDefaultPrevented && "defaultPrevented" in event) ||
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
"defaultPrevented" in event && !event.defaultPrevented) return next?.(event);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export { composeEventHandlers };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
function concatClassName(_cn) {
|
|
2
|
+
const args = arguments,
|
|
3
|
+
usedPrefixes = [];
|
|
4
|
+
let final = "";
|
|
5
|
+
const len = args.length;
|
|
6
|
+
let propObjects = null;
|
|
7
|
+
for (let x = len; x >= 0; x--) {
|
|
8
|
+
const cns = args[x];
|
|
9
|
+
if (!cns) continue;
|
|
10
|
+
if (!Array.isArray(cns) && typeof cns != "string") {
|
|
11
|
+
propObjects = propObjects || [], propObjects.push(cns);
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
const names = Array.isArray(cns) ? cns : cns.split(" "),
|
|
15
|
+
numNames = names.length;
|
|
16
|
+
for (let i = numNames - 1; i >= 0; i--) {
|
|
17
|
+
const name = names[i];
|
|
18
|
+
if (!name || name === " ") continue;
|
|
19
|
+
if (name[0] !== "_") {
|
|
20
|
+
final = name + " " + final;
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
const splitIndex = name.indexOf("-");
|
|
24
|
+
if (splitIndex < 1) {
|
|
25
|
+
final = name + " " + final;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const isMediaQuery = name[splitIndex + 1] === "_",
|
|
29
|
+
styleKey = name.slice(1, name.lastIndexOf("-")),
|
|
30
|
+
mediaKey = isMediaQuery ? name.slice(splitIndex + 2, splitIndex + 7) : null,
|
|
31
|
+
uid = mediaKey ? styleKey + mediaKey : styleKey;
|
|
32
|
+
if (usedPrefixes.indexOf(uid) > -1) continue;
|
|
33
|
+
usedPrefixes.push(uid);
|
|
34
|
+
const propName = styleKey;
|
|
35
|
+
propName && propObjects && propObjects.some(po => {
|
|
36
|
+
if (mediaKey) {
|
|
37
|
+
const propKey = pseudoInvert[mediaKey];
|
|
38
|
+
return po && po[propKey] && propName in po[propKey] && po[propKey] !== null;
|
|
39
|
+
}
|
|
40
|
+
return po && propName in po && po[propName] !== null;
|
|
41
|
+
}) || (final = name + " " + final);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return final;
|
|
45
|
+
}
|
|
46
|
+
const pseudoInvert = {
|
|
47
|
+
hover: "hoverStyle",
|
|
48
|
+
focus: "focusStyle",
|
|
49
|
+
press: "pressStyle"
|
|
50
|
+
};
|
|
51
|
+
export { concatClassName };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "@tamagui/simple-hash";
|
|
2
|
+
export * from "./clamp.mjs";
|
|
3
|
+
export * from "./composeEventHandlers.mjs";
|
|
4
|
+
export * from "./concatClassName.mjs";
|
|
5
|
+
export * from "./types.mjs";
|
|
6
|
+
export * from "./validStyleProps.mjs";
|
|
7
|
+
export * from "./withStaticProperties.mjs";
|
|
File without changes
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { isAndroid } from "@tamagui/constants";
|
|
2
|
+
const placeHolderTextColors = {
|
|
3
|
+
placeholderTextColor: !0
|
|
4
|
+
},
|
|
5
|
+
validStylesOnBaseProps = {
|
|
6
|
+
...placeHolderTextColors
|
|
7
|
+
},
|
|
8
|
+
textColors = {
|
|
9
|
+
color: !0,
|
|
10
|
+
...placeHolderTextColors,
|
|
11
|
+
textDecorationColor: !0,
|
|
12
|
+
textShadowColor: !0
|
|
13
|
+
},
|
|
14
|
+
tokenCategories = {
|
|
15
|
+
radius: {
|
|
16
|
+
borderRadius: !0,
|
|
17
|
+
borderTopLeftRadius: !0,
|
|
18
|
+
borderTopRightRadius: !0,
|
|
19
|
+
borderBottomLeftRadius: !0,
|
|
20
|
+
borderBottomRightRadius: !0,
|
|
21
|
+
// logical
|
|
22
|
+
borderStartStartRadius: !0,
|
|
23
|
+
borderStartEndRadius: !0,
|
|
24
|
+
borderEndStartRadius: !0,
|
|
25
|
+
borderEndEndRadius: !0
|
|
26
|
+
},
|
|
27
|
+
size: {
|
|
28
|
+
width: !0,
|
|
29
|
+
height: !0,
|
|
30
|
+
minWidth: !0,
|
|
31
|
+
minHeight: !0,
|
|
32
|
+
maxWidth: !0,
|
|
33
|
+
maxHeight: !0
|
|
34
|
+
},
|
|
35
|
+
zIndex: {
|
|
36
|
+
zIndex: !0
|
|
37
|
+
},
|
|
38
|
+
color: {
|
|
39
|
+
backgroundColor: !0,
|
|
40
|
+
borderColor: !0,
|
|
41
|
+
borderBlockStartColor: !0,
|
|
42
|
+
borderBlockEndColor: !0,
|
|
43
|
+
borderBlockColor: !0,
|
|
44
|
+
borderBottomColor: !0,
|
|
45
|
+
borderTopColor: !0,
|
|
46
|
+
borderLeftColor: !0,
|
|
47
|
+
borderRightColor: !0,
|
|
48
|
+
borderEndColor: !0,
|
|
49
|
+
borderStartColor: !0,
|
|
50
|
+
shadowColor: !0,
|
|
51
|
+
...textColors,
|
|
52
|
+
outlineColor: !0
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
stylePropsUnitless = {
|
|
56
|
+
WebkitLineClamp: !0,
|
|
57
|
+
animationIterationCount: !0,
|
|
58
|
+
aspectRatio: !0,
|
|
59
|
+
borderImageOutset: !0,
|
|
60
|
+
borderImageSlice: !0,
|
|
61
|
+
borderImageWidth: !0,
|
|
62
|
+
columnCount: !0,
|
|
63
|
+
flex: !0,
|
|
64
|
+
flexGrow: !0,
|
|
65
|
+
flexOrder: !0,
|
|
66
|
+
flexPositive: !0,
|
|
67
|
+
flexShrink: !0,
|
|
68
|
+
flexNegative: !0,
|
|
69
|
+
fontWeight: !0,
|
|
70
|
+
gridRow: !0,
|
|
71
|
+
gridRowEnd: !0,
|
|
72
|
+
gridRowGap: !0,
|
|
73
|
+
gridRowStart: !0,
|
|
74
|
+
gridColumn: !0,
|
|
75
|
+
gridColumnEnd: !0,
|
|
76
|
+
gridColumnGap: !0,
|
|
77
|
+
gridColumnStart: !0,
|
|
78
|
+
lineClamp: !0,
|
|
79
|
+
opacity: !0,
|
|
80
|
+
order: !0,
|
|
81
|
+
orphans: !0,
|
|
82
|
+
tabSize: !0,
|
|
83
|
+
widows: !0,
|
|
84
|
+
zIndex: !0,
|
|
85
|
+
zoom: !0,
|
|
86
|
+
scale: !0,
|
|
87
|
+
scaleX: !0,
|
|
88
|
+
scaleY: !0,
|
|
89
|
+
scaleZ: !0,
|
|
90
|
+
shadowOpacity: !0
|
|
91
|
+
},
|
|
92
|
+
stylePropsTransform = {
|
|
93
|
+
x: !0,
|
|
94
|
+
y: !0,
|
|
95
|
+
scale: !0,
|
|
96
|
+
perspective: !0,
|
|
97
|
+
scaleX: !0,
|
|
98
|
+
scaleY: !0,
|
|
99
|
+
skewX: !0,
|
|
100
|
+
skewY: !0,
|
|
101
|
+
matrix: !0,
|
|
102
|
+
rotate: !0,
|
|
103
|
+
rotateY: !0,
|
|
104
|
+
rotateX: !0,
|
|
105
|
+
rotateZ: !0
|
|
106
|
+
},
|
|
107
|
+
stylePropsView = {
|
|
108
|
+
backfaceVisibility: !0,
|
|
109
|
+
borderBottomEndRadius: !0,
|
|
110
|
+
borderBottomStartRadius: !0,
|
|
111
|
+
borderBottomWidth: !0,
|
|
112
|
+
borderLeftWidth: !0,
|
|
113
|
+
borderRightWidth: !0,
|
|
114
|
+
borderStyle: !0,
|
|
115
|
+
borderTopEndRadius: !0,
|
|
116
|
+
borderTopStartRadius: !0,
|
|
117
|
+
borderTopWidth: !0,
|
|
118
|
+
borderWidth: !0,
|
|
119
|
+
transform: !0,
|
|
120
|
+
transformOrigin: !0,
|
|
121
|
+
alignContent: !0,
|
|
122
|
+
alignItems: !0,
|
|
123
|
+
alignSelf: !0,
|
|
124
|
+
borderEndWidth: !0,
|
|
125
|
+
borderStartWidth: !0,
|
|
126
|
+
bottom: !0,
|
|
127
|
+
display: !0,
|
|
128
|
+
end: !0,
|
|
129
|
+
flexBasis: !0,
|
|
130
|
+
flexDirection: !0,
|
|
131
|
+
flexWrap: !0,
|
|
132
|
+
gap: !0,
|
|
133
|
+
columnGap: !0,
|
|
134
|
+
rowGap: !0,
|
|
135
|
+
justifyContent: !0,
|
|
136
|
+
left: !0,
|
|
137
|
+
margin: !0,
|
|
138
|
+
marginBlockEnd: !0,
|
|
139
|
+
marginBlockStart: !0,
|
|
140
|
+
marginInlineEnd: !0,
|
|
141
|
+
marginInline: !0,
|
|
142
|
+
marginInlineStart: !0,
|
|
143
|
+
marginBottom: !0,
|
|
144
|
+
marginEnd: !0,
|
|
145
|
+
marginHorizontal: !0,
|
|
146
|
+
marginLeft: !0,
|
|
147
|
+
marginRight: !0,
|
|
148
|
+
marginStart: !0,
|
|
149
|
+
marginTop: !0,
|
|
150
|
+
marginVertical: !0,
|
|
151
|
+
overflow: !0,
|
|
152
|
+
padding: !0,
|
|
153
|
+
paddingBottom: !0,
|
|
154
|
+
paddingInline: !0,
|
|
155
|
+
paddingBlock: !0,
|
|
156
|
+
paddingBlockStart: !0,
|
|
157
|
+
paddingInlineEnd: !0,
|
|
158
|
+
paddingInlineStart: !0,
|
|
159
|
+
paddingEnd: !0,
|
|
160
|
+
paddingHorizontal: !0,
|
|
161
|
+
paddingLeft: !0,
|
|
162
|
+
paddingRight: !0,
|
|
163
|
+
paddingStart: !0,
|
|
164
|
+
paddingTop: !0,
|
|
165
|
+
paddingVertical: !0,
|
|
166
|
+
position: !0,
|
|
167
|
+
right: !0,
|
|
168
|
+
start: !0,
|
|
169
|
+
top: !0,
|
|
170
|
+
direction: !0,
|
|
171
|
+
shadowOffset: !0,
|
|
172
|
+
shadowRadius: !0,
|
|
173
|
+
...tokenCategories.color,
|
|
174
|
+
...tokenCategories.radius,
|
|
175
|
+
...tokenCategories.size,
|
|
176
|
+
...tokenCategories.radius,
|
|
177
|
+
...validStylesOnBaseProps,
|
|
178
|
+
...stylePropsTransform,
|
|
179
|
+
...stylePropsUnitless,
|
|
180
|
+
// RN doesn't support specific border styles per-edge
|
|
181
|
+
borderBottomStyle: !0,
|
|
182
|
+
borderTopStyle: !0,
|
|
183
|
+
borderLeftStyle: !0,
|
|
184
|
+
borderRightStyle: !0,
|
|
185
|
+
overflowX: !0,
|
|
186
|
+
overflowY: !0,
|
|
187
|
+
userSelect: !0,
|
|
188
|
+
cursor: !0,
|
|
189
|
+
contain: !0,
|
|
190
|
+
pointerEvents: !0,
|
|
191
|
+
boxSizing: !0,
|
|
192
|
+
boxShadow: !0,
|
|
193
|
+
outlineStyle: !0,
|
|
194
|
+
outlineOffset: !0,
|
|
195
|
+
outlineWidth: !0,
|
|
196
|
+
touchAction: !0,
|
|
197
|
+
...(isAndroid ? {
|
|
198
|
+
elevationAndroid: !0
|
|
199
|
+
} : {})
|
|
200
|
+
},
|
|
201
|
+
stylePropsFont = {
|
|
202
|
+
fontFamily: !0,
|
|
203
|
+
fontSize: !0,
|
|
204
|
+
fontStyle: !0,
|
|
205
|
+
fontWeight: !0,
|
|
206
|
+
letterSpacing: !0,
|
|
207
|
+
lineHeight: !0,
|
|
208
|
+
textTransform: !0
|
|
209
|
+
},
|
|
210
|
+
stylePropsTextOnly = {
|
|
211
|
+
...stylePropsFont,
|
|
212
|
+
textAlign: !0,
|
|
213
|
+
textDecorationLine: !0,
|
|
214
|
+
textDecorationStyle: !0,
|
|
215
|
+
...textColors,
|
|
216
|
+
textShadowOffset: !0,
|
|
217
|
+
textShadowRadius: !0,
|
|
218
|
+
whiteSpace: !0,
|
|
219
|
+
wordWrap: !0,
|
|
220
|
+
textOverflow: !0,
|
|
221
|
+
textDecorationDistance: !0,
|
|
222
|
+
userSelect: !0,
|
|
223
|
+
selectable: !0,
|
|
224
|
+
cursor: !0,
|
|
225
|
+
WebkitLineClamp: !0,
|
|
226
|
+
WebkitBoxOrient: !0
|
|
227
|
+
},
|
|
228
|
+
stylePropsText = {
|
|
229
|
+
...stylePropsView,
|
|
230
|
+
...stylePropsTextOnly
|
|
231
|
+
},
|
|
232
|
+
stylePropsAll = stylePropsText,
|
|
233
|
+
validPseudoKeys = {
|
|
234
|
+
enterStyle: !0,
|
|
235
|
+
exitStyle: !0,
|
|
236
|
+
hoverStyle: !0,
|
|
237
|
+
pressStyle: !0,
|
|
238
|
+
focusStyle: !0
|
|
239
|
+
},
|
|
240
|
+
validStyles = {
|
|
241
|
+
...validPseudoKeys,
|
|
242
|
+
...stylePropsView
|
|
243
|
+
};
|
|
244
|
+
export { stylePropsAll, stylePropsFont, stylePropsText, stylePropsTextOnly, stylePropsTransform, stylePropsUnitless, stylePropsView, tokenCategories, validPseudoKeys, validStyles, validStylesOnBaseProps };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createElement, forwardRef } from "react";
|
|
2
|
+
const Decorated = Symbol(),
|
|
3
|
+
withStaticProperties = (component, staticProps) => {
|
|
4
|
+
const next = (() => {
|
|
5
|
+
if (component[Decorated]) {
|
|
6
|
+
const _ = forwardRef((props, ref) => createElement(component, {
|
|
7
|
+
...props,
|
|
8
|
+
ref
|
|
9
|
+
}));
|
|
10
|
+
for (const key in component) {
|
|
11
|
+
const v = component[key];
|
|
12
|
+
_[key] = v && typeof v == "object" ? {
|
|
13
|
+
...v
|
|
14
|
+
} : v;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return component;
|
|
18
|
+
})();
|
|
19
|
+
return Object.assign(next, staticProps), next[Decorated] = !0, next;
|
|
20
|
+
};
|
|
21
|
+
export { withStaticProperties };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/helpers",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.89.0-1706308641099",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"main": "dist/cjs",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"clean:build": "tamagui-build clean:build"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@tamagui/constants": "1.
|
|
23
|
-
"@tamagui/simple-hash": "1.
|
|
22
|
+
"@tamagui/constants": "1.89.0-1706308641099",
|
|
23
|
+
"@tamagui/simple-hash": "1.89.0-1706308641099"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@tamagui/build": "1.
|
|
26
|
+
"@tamagui/build": "1.89.0-1706308641099"
|
|
27
27
|
},
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|