@tamagui/core 1.0.1-beta.73 → 1.0.1-beta.76
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/dist/cjs/createComponent.js +25 -20
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createFont.js.map +1 -1
- package/dist/cjs/createTamagui.js +2 -2
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createVariable.js +9 -1
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/helpers/createPropMapper.js +3 -1
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/generateAtomicStyles.js +55 -70
- package/dist/cjs/helpers/generateAtomicStyles.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +15 -10
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.js +4 -2
- package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
- package/dist/cjs/helpers/insertStyleRule.js +12 -10
- package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
- package/dist/cjs/helpers/pseudoDescriptors.js +41 -0
- package/dist/cjs/helpers/pseudoDescriptors.js.map +7 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/insertFont.js +17 -4
- package/dist/cjs/insertFont.js.map +2 -2
- package/dist/cjs/static.js +1 -1
- package/dist/cjs/static.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/ThemeManager.js +6 -22
- package/dist/esm/ThemeManager.js.map +1 -1
- package/dist/esm/constants/constants.js +23 -8
- package/dist/esm/constants/constants.js.map +1 -1
- package/dist/esm/createComponent.js +239 -131
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createFont.js.map +1 -1
- package/dist/esm/createTamagui.js +28 -10
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createVariable.js +9 -1
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/helpers/createPropMapper.js +20 -5
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/createShallowUpdate.js +17 -1
- package/dist/esm/helpers/createShallowUpdate.js.map +1 -1
- package/dist/esm/helpers/createTamaguiProvider.js +39 -9
- package/dist/esm/helpers/createTamaguiProvider.js.map +1 -1
- package/dist/esm/helpers/extendStaticConfig.js +28 -27
- package/dist/esm/helpers/extendStaticConfig.js.map +1 -1
- package/dist/esm/helpers/fixNativeShadow.native.js +2 -3
- package/dist/esm/helpers/fixNativeShadow.native.js.map +1 -1
- package/dist/esm/helpers/generateAtomicStyles.js +75 -76
- package/dist/esm/helpers/generateAtomicStyles.js.map +2 -2
- package/dist/esm/helpers/getSize.js +2 -3
- package/dist/esm/helpers/getSize.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.js +47 -30
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getStackSize.js +1 -2
- package/dist/esm/helpers/getStackSize.js.map +1 -1
- package/dist/esm/helpers/getStylesAtomic.js +38 -7
- package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
- package/dist/esm/helpers/insertStyleRule.js +12 -10
- package/dist/esm/helpers/insertStyleRule.js.map +2 -2
- package/dist/esm/helpers/mergeTransform.js +1 -1
- package/dist/esm/helpers/mergeTransform.js.map +1 -1
- package/dist/esm/helpers/pseudoDescriptors.js +18 -0
- package/dist/esm/helpers/pseudoDescriptors.js.map +7 -0
- package/dist/esm/helpers/themeable.js +33 -2
- package/dist/esm/helpers/themeable.js.map +1 -1
- package/dist/esm/helpers/validate.js +30 -5
- package/dist/esm/helpers/validate.js.map +1 -1
- package/dist/esm/hooks/useFeatures.js +40 -8
- package/dist/esm/hooks/useFeatures.js.map +1 -1
- package/dist/esm/hooks/useId.js +2 -3
- package/dist/esm/hooks/useId.js.map +1 -1
- package/dist/esm/hooks/useMedia.js +18 -6
- package/dist/esm/hooks/useMedia.js.map +1 -1
- package/dist/esm/hooks/usePressable.js +16 -1
- package/dist/esm/hooks/usePressable.js.map +1 -1
- package/dist/esm/hooks/useTheme.js +24 -7
- package/dist/esm/hooks/useTheme.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/insertFont.js +17 -4
- package/dist/esm/insertFont.js.map +2 -2
- package/dist/esm/static.js +1 -1
- package/dist/esm/static.js.map +1 -1
- package/dist/esm/styled.js +38 -9
- package/dist/esm/styled.js.map +1 -1
- package/dist/esm/views/Slot.js +40 -11
- package/dist/esm/views/Slot.js.map +1 -1
- package/dist/esm/views/Stack.js +21 -3
- package/dist/esm/views/Stack.js.map +1 -1
- package/dist/esm/views/Text.js +24 -12
- package/dist/esm/views/Text.js.map +1 -1
- package/dist/esm/views/TextAncestorContext.js +2 -2
- package/dist/esm/views/TextAncestorContext.js.map +1 -1
- package/dist/jsx/createComponent.js +13 -11
- package/dist/jsx/createTamagui.js +2 -2
- package/dist/jsx/insertFont.js +17 -4
- package/package.json +6 -6
- package/reset.css +4 -0
- package/types/createComponent.d.ts +2 -4
- package/types/createComponent.d.ts.map +1 -1
- package/types/createVariable.d.ts.map +1 -1
- package/types/helpers/createTamaguiProvider.d.ts +0 -1
- package/types/helpers/createTamaguiProvider.d.ts.map +1 -1
- package/types/helpers/generateAtomicStyles.d.ts +2 -2
- package/types/helpers/generateAtomicStyles.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts +1 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/getStylesAtomic.d.ts +2 -0
- package/types/helpers/getStylesAtomic.d.ts.map +1 -1
- package/types/helpers/insertStyleRule.d.ts +1 -1
- package/types/helpers/insertStyleRule.d.ts.map +1 -1
- package/types/helpers/pseudoDescriptors.d.ts +16 -0
- package/types/helpers/pseudoDescriptors.d.ts.map +1 -0
- package/types/helpers/pseudos.d.ts +2 -2
- package/types/helpers/pseudos.d.ts.map +1 -1
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/insertFont.d.ts +1 -1
- package/types/insertFont.d.ts.map +1 -1
- package/types/static.d.ts +1 -1
- package/types/static.d.ts.map +1 -1
- package/types/types.d.ts +2 -2
- package/types/types.d.ts.map +1 -1
|
@@ -1,15 +1,30 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
1
17
|
import { isWeb } from "./platform";
|
|
2
18
|
const THEME_NAME_SEPARATOR = "_";
|
|
3
19
|
const THEME_CLASSNAME_PREFIX = `t_`;
|
|
4
|
-
const stackDefaultStyles = {
|
|
20
|
+
const stackDefaultStyles = __spreadValues({
|
|
5
21
|
alignItems: "stretch",
|
|
6
|
-
flexShrink: 0
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
22
|
+
flexShrink: 0
|
|
23
|
+
}, isWeb && {
|
|
24
|
+
display: "flex",
|
|
25
|
+
flexBasis: "auto",
|
|
26
|
+
boxSizing: "border-box"
|
|
27
|
+
});
|
|
13
28
|
export {
|
|
14
29
|
THEME_CLASSNAME_PREFIX,
|
|
15
30
|
THEME_NAME_SEPARATOR,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/constants/constants.ts"],
|
|
4
4
|
"sourcesContent": ["import { isWeb } from './platform'\n\nexport const THEME_NAME_SEPARATOR = '_'\nexport const THEME_CLASSNAME_PREFIX = `t_`\n\nexport const stackDefaultStyles = {\n alignItems: 'stretch',\n flexShrink: 0,\n // more accurately match react-native defaults on web\n ...(isWeb && {\n display: 'flex',\n flexBasis: 'auto',\n boxSizing: 'border-box',\n }),\n}\n"],
|
|
5
|
-
"mappings": "AAAA;AAEO,MAAM,uBAAuB;AAC7B,MAAM,yBAAyB;AAE/B,MAAM,qBAAqB;AAAA,EAChC,YAAY;AAAA,EACZ,YAAY;AAAA,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAEO,MAAM,uBAAuB;AAC7B,MAAM,yBAAyB;AAE/B,MAAM,qBAAqB;AAAA,EAChC,YAAY;AAAA,EACZ,YAAY;AAAA,GAER,SAAS;AAAA,EACX,SAAS;AAAA,EACT,WAAW;AAAA,EACX,WAAW;AACb;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
1
32
|
import { composeEventHandlers, stylePropsView, validStyles } from "@tamagui/helpers";
|
|
2
33
|
import { useForceUpdate } from "@tamagui/use-force-update";
|
|
3
34
|
import React, {
|
|
@@ -82,7 +113,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
82
113
|
let tamaguiDefaultProps;
|
|
83
114
|
let initialSplitStyles;
|
|
84
115
|
const component = forwardRef((propsIn, forwardedRef) => {
|
|
85
|
-
var _a,
|
|
116
|
+
var _a, _d, _e, _f;
|
|
86
117
|
let props;
|
|
87
118
|
if (tamaguiDefaultProps && !propsIn.asChild) {
|
|
88
119
|
props = mergeProps(tamaguiDefaultProps, propsIn);
|
|
@@ -110,32 +141,29 @@ function createComponent(configIn, ParentComponent) {
|
|
|
110
141
|
const setStateShallow = createShallowUpdate(statesUsed[1]);
|
|
111
142
|
let state = statesUsed[0];
|
|
112
143
|
if (propsIn.forceStyle) {
|
|
113
|
-
state = {
|
|
114
|
-
...state,
|
|
144
|
+
state = __spreadProps(__spreadValues({}, state), {
|
|
115
145
|
[propsIn.forceStyle]: true
|
|
116
|
-
};
|
|
146
|
+
});
|
|
117
147
|
}
|
|
118
148
|
const shouldAvoidClasses = !!(props.animation && avoidClasses);
|
|
119
149
|
const shouldForcePseudo = !!propsIn.forceStyle;
|
|
120
150
|
const hasTextAncestor = !!(isWeb ? useContext(TextAncestorContext) : false);
|
|
121
|
-
const splitStyleState = !shouldAvoidClasses && !shouldForcePseudo ? {
|
|
122
|
-
...state,
|
|
151
|
+
const splitStyleState = !shouldAvoidClasses && !shouldForcePseudo ? __spreadProps(__spreadValues({}, state), {
|
|
123
152
|
hasTextAncestor,
|
|
124
153
|
dynamicStylesInline: true
|
|
125
|
-
} : {
|
|
126
|
-
...state,
|
|
154
|
+
}) : __spreadProps(__spreadValues({}, state), {
|
|
127
155
|
noClassNames: true,
|
|
128
156
|
dynamicStylesInline: true,
|
|
129
157
|
hasTextAncestor,
|
|
130
158
|
resolveVariablesAs: "value"
|
|
131
|
-
};
|
|
159
|
+
});
|
|
132
160
|
const splitStyles = useSplitStyles(props, staticConfig, theme, splitStyleState, props.asChild ? null : initialSplitStyles.classNames, props["debug"]);
|
|
133
161
|
const { viewProps: viewPropsIn, pseudos, medias, style, classNames } = splitStyles;
|
|
134
162
|
const useAnimations = (_a = tamaguiConfig.animations) == null ? void 0 : _a.useAnimations;
|
|
135
163
|
const isAnimated = !!(useAnimations && props.animation);
|
|
136
164
|
const hasEnterStyle = !!props.enterStyle;
|
|
137
165
|
const hostRef = useRef(null);
|
|
138
|
-
const animationFeatureStylesIn = props.animation ? {
|
|
166
|
+
const animationFeatureStylesIn = props.animation ? __spreadValues(__spreadValues({}, defaultNativeStyle), style) : null;
|
|
139
167
|
const features = useFeatures(props, {
|
|
140
168
|
forceUpdate,
|
|
141
169
|
setStateShallow,
|
|
@@ -148,7 +176,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
148
176
|
hostRef,
|
|
149
177
|
onDidAnimate: props.onDidAnimate
|
|
150
178
|
});
|
|
151
|
-
const {
|
|
179
|
+
const _b = viewPropsIn, {
|
|
152
180
|
tag,
|
|
153
181
|
hitSlop,
|
|
154
182
|
asChild,
|
|
@@ -161,6 +189,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
161
189
|
space: spaceProp,
|
|
162
190
|
spaceDirection: _spaceDirection,
|
|
163
191
|
disabled: disabledProp,
|
|
192
|
+
onMouseUp,
|
|
164
193
|
onMouseDown,
|
|
165
194
|
onMouseEnter,
|
|
166
195
|
onMouseLeave,
|
|
@@ -169,9 +198,31 @@ function createComponent(configIn, ParentComponent) {
|
|
|
169
198
|
forceStyle: _forceStyle,
|
|
170
199
|
onClick,
|
|
171
200
|
theme: _themeProp,
|
|
172
|
-
defaultVariants
|
|
173
|
-
|
|
174
|
-
|
|
201
|
+
defaultVariants
|
|
202
|
+
} = _b, nonTamaguiProps = __objRest(_b, [
|
|
203
|
+
"tag",
|
|
204
|
+
"hitSlop",
|
|
205
|
+
"asChild",
|
|
206
|
+
"children",
|
|
207
|
+
"onPress",
|
|
208
|
+
"onPressIn",
|
|
209
|
+
"onPressOut",
|
|
210
|
+
"onHoverIn",
|
|
211
|
+
"onHoverOut",
|
|
212
|
+
"space",
|
|
213
|
+
"spaceDirection",
|
|
214
|
+
"disabled",
|
|
215
|
+
"onMouseUp",
|
|
216
|
+
"onMouseDown",
|
|
217
|
+
"onMouseEnter",
|
|
218
|
+
"onMouseLeave",
|
|
219
|
+
"hrefAttrs",
|
|
220
|
+
"separator",
|
|
221
|
+
"forceStyle",
|
|
222
|
+
"onClick",
|
|
223
|
+
"theme",
|
|
224
|
+
"defaultVariants"
|
|
225
|
+
]);
|
|
175
226
|
const isTaggable = !Component || typeof Component === "string";
|
|
176
227
|
const element = isWeb ? isTaggable ? tag || Component : Component : Component;
|
|
177
228
|
const BaseTextComponent = !isWeb ? Text : element || "span";
|
|
@@ -182,7 +233,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
182
233
|
const disabled = props.accessibilityState != null && props.accessibilityState.disabled === true || props.accessibilityDisabled;
|
|
183
234
|
let viewProps;
|
|
184
235
|
if (isWeb && !staticConfig.isReactNativeWeb) {
|
|
185
|
-
const {
|
|
236
|
+
const _c = nonTamaguiProps, {
|
|
186
237
|
onMoveShouldSetResponder,
|
|
187
238
|
onMoveShouldSetResponderCapture,
|
|
188
239
|
onResponderEnd,
|
|
@@ -251,9 +302,78 @@ function createComponent(configIn, ParentComponent) {
|
|
|
251
302
|
accessibilityValue,
|
|
252
303
|
collapsable,
|
|
253
304
|
focusable,
|
|
254
|
-
onLayout
|
|
255
|
-
|
|
256
|
-
|
|
305
|
+
onLayout
|
|
306
|
+
} = _c, webProps = __objRest(_c, [
|
|
307
|
+
"onMoveShouldSetResponder",
|
|
308
|
+
"onMoveShouldSetResponderCapture",
|
|
309
|
+
"onResponderEnd",
|
|
310
|
+
"onResponderGrant",
|
|
311
|
+
"onResponderMove",
|
|
312
|
+
"onResponderReject",
|
|
313
|
+
"onResponderRelease",
|
|
314
|
+
"onResponderStart",
|
|
315
|
+
"onResponderTerminate",
|
|
316
|
+
"onResponderTerminationRequest",
|
|
317
|
+
"onScrollShouldSetResponder",
|
|
318
|
+
"onScrollShouldSetResponderCapture",
|
|
319
|
+
"onSelectionChangeShouldSetResponder",
|
|
320
|
+
"onSelectionChangeShouldSetResponderCapture",
|
|
321
|
+
"onStartShouldSetResponder",
|
|
322
|
+
"onStartShouldSetResponderCapture",
|
|
323
|
+
"nativeID",
|
|
324
|
+
"accessibilityActiveDescendant",
|
|
325
|
+
"accessibilityAtomic",
|
|
326
|
+
"accessibilityAutoComplete",
|
|
327
|
+
"accessibilityBusy",
|
|
328
|
+
"accessibilityChecked",
|
|
329
|
+
"accessibilityColumnCount",
|
|
330
|
+
"accessibilityColumnIndex",
|
|
331
|
+
"accessibilityColumnSpan",
|
|
332
|
+
"accessibilityControls",
|
|
333
|
+
"accessibilityCurrent",
|
|
334
|
+
"accessibilityDescribedBy",
|
|
335
|
+
"accessibilityDetails",
|
|
336
|
+
"accessibilityDisabled",
|
|
337
|
+
"accessibilityErrorMessage",
|
|
338
|
+
"accessibilityExpanded",
|
|
339
|
+
"accessibilityFlowTo",
|
|
340
|
+
"accessibilityHasPopup",
|
|
341
|
+
"accessibilityHidden",
|
|
342
|
+
"accessibilityInvalid",
|
|
343
|
+
"accessibilityKeyShortcuts",
|
|
344
|
+
"accessibilityLabel",
|
|
345
|
+
"accessibilityLabelledBy",
|
|
346
|
+
"accessibilityLevel",
|
|
347
|
+
"accessibilityLiveRegion",
|
|
348
|
+
"accessibilityModal",
|
|
349
|
+
"accessibilityMultiline",
|
|
350
|
+
"accessibilityMultiSelectable",
|
|
351
|
+
"accessibilityOrientation",
|
|
352
|
+
"accessibilityOwns",
|
|
353
|
+
"accessibilityPlaceholder",
|
|
354
|
+
"accessibilityPosInSet",
|
|
355
|
+
"accessibilityPressed",
|
|
356
|
+
"accessibilityReadOnly",
|
|
357
|
+
"accessibilityRequired",
|
|
358
|
+
"accessibilityRole",
|
|
359
|
+
"accessibilityRoleDescription",
|
|
360
|
+
"accessibilityRowCount",
|
|
361
|
+
"accessibilityRowIndex",
|
|
362
|
+
"accessibilityRowSpan",
|
|
363
|
+
"accessibilitySelected",
|
|
364
|
+
"accessibilitySetSize",
|
|
365
|
+
"accessibilitySort",
|
|
366
|
+
"accessibilityValueMax",
|
|
367
|
+
"accessibilityValueMin",
|
|
368
|
+
"accessibilityValueNow",
|
|
369
|
+
"accessibilityValueText",
|
|
370
|
+
"accessible",
|
|
371
|
+
"accessibilityState",
|
|
372
|
+
"accessibilityValue",
|
|
373
|
+
"collapsable",
|
|
374
|
+
"focusable",
|
|
375
|
+
"onLayout"
|
|
376
|
+
]);
|
|
257
377
|
viewProps = webProps;
|
|
258
378
|
assignNativePropsToWeb(elementType, viewProps, nonTamaguiProps);
|
|
259
379
|
if (!asChild) {
|
|
@@ -357,15 +477,11 @@ function createComponent(configIn, ParentComponent) {
|
|
|
357
477
|
let styles;
|
|
358
478
|
const animationStyles = state.animation ? state.animation.style : null;
|
|
359
479
|
if (isStringElement && shouldAvoidClasses && !shouldForcePseudo) {
|
|
360
|
-
styles = {
|
|
361
|
-
...defaultNativeStyle,
|
|
362
|
-
...animationStyles != null ? animationStyles : style,
|
|
363
|
-
...medias
|
|
364
|
-
};
|
|
480
|
+
styles = __spreadValues(__spreadValues(__spreadValues({}, defaultNativeStyle), animationStyles ?? style), medias);
|
|
365
481
|
} else {
|
|
366
482
|
styles = [
|
|
367
483
|
isWeb ? null : defaultNativeStyleSheet ? defaultNativeStyleSheet.base : null,
|
|
368
|
-
animationStyles
|
|
484
|
+
animationStyles ?? style,
|
|
369
485
|
medias
|
|
370
486
|
];
|
|
371
487
|
if (!animationStyles) {
|
|
@@ -396,17 +512,16 @@ function createComponent(configIn, ParentComponent) {
|
|
|
396
512
|
classNames ? Object.values(classNames).join(" ") : ""
|
|
397
513
|
];
|
|
398
514
|
const className = classList.join(" ");
|
|
399
|
-
const style2 = animationStyles
|
|
515
|
+
const style2 = animationStyles ?? splitStyles.style;
|
|
400
516
|
if (process.env.NODE_ENV === "development" && props["debug"]) {
|
|
401
517
|
console.log(" \xBB className", { splitStyles, style: style2, isStringElement, pseudos, state, classNames, propsClassName: props.className, classList, className: className.trim().split(" "), themeClassName: theme.className, values: Object.fromEntries(Object.entries(classNames).map(([k, v]) => [v, getAllSelectors()[v]])) });
|
|
402
518
|
}
|
|
403
519
|
const isAnimatedReactNativeWeb = props.animation && avoidClasses;
|
|
404
520
|
if (staticConfig.isReactNativeWeb || isAnimatedReactNativeWeb) {
|
|
405
|
-
viewProps.dataSet = {
|
|
406
|
-
...viewProps.dataSet,
|
|
521
|
+
viewProps.dataSet = __spreadProps(__spreadValues({}, viewProps.dataSet), {
|
|
407
522
|
className,
|
|
408
523
|
id: props.id
|
|
409
|
-
};
|
|
524
|
+
});
|
|
410
525
|
if (props["data-is"]) {
|
|
411
526
|
viewProps.dataSet.is = props["data-is"];
|
|
412
527
|
}
|
|
@@ -435,43 +550,44 @@ function createComponent(configIn, ParentComponent) {
|
|
|
435
550
|
pressIn: false
|
|
436
551
|
});
|
|
437
552
|
}, []);
|
|
438
|
-
const events = shouldAttach ? {
|
|
553
|
+
const events = shouldAttach ? __spreadValues(__spreadProps(__spreadValues({
|
|
439
554
|
[pressOutKey]: attachPress ? (e) => {
|
|
440
555
|
unPress();
|
|
441
556
|
onPressOut == null ? void 0 : onPressOut(e);
|
|
557
|
+
onMouseUp == null ? void 0 : onMouseUp(e);
|
|
558
|
+
} : void 0
|
|
559
|
+
}, isHoverable && {
|
|
560
|
+
onMouseEnter: attachHover ? (e) => {
|
|
561
|
+
let next = {};
|
|
562
|
+
if (attachHover) {
|
|
563
|
+
next.hover = true;
|
|
564
|
+
}
|
|
565
|
+
if (state.pressIn) {
|
|
566
|
+
next.press = true;
|
|
567
|
+
}
|
|
568
|
+
if (Object.keys(next).length) {
|
|
569
|
+
setStateShallow(next);
|
|
570
|
+
}
|
|
571
|
+
onHoverIn == null ? void 0 : onHoverIn(e);
|
|
572
|
+
onMouseEnter == null ? void 0 : onMouseEnter(e);
|
|
442
573
|
} : void 0,
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
mouseUps.add(unPress);
|
|
461
|
-
if (attachHover) {
|
|
462
|
-
next.hover = false;
|
|
463
|
-
}
|
|
464
|
-
if (state.pressIn) {
|
|
465
|
-
next.press = false;
|
|
466
|
-
next.pressIn = false;
|
|
467
|
-
}
|
|
468
|
-
if (Object.keys(next).length) {
|
|
469
|
-
setStateShallow(next);
|
|
470
|
-
}
|
|
471
|
-
onHoverOut == null ? void 0 : onHoverOut(e);
|
|
472
|
-
onMouseLeave == null ? void 0 : onMouseLeave(e);
|
|
473
|
-
} : void 0
|
|
474
|
-
},
|
|
574
|
+
onMouseLeave: attachHover ? (e) => {
|
|
575
|
+
let next = {};
|
|
576
|
+
mouseUps.add(unPress);
|
|
577
|
+
if (attachHover) {
|
|
578
|
+
next.hover = false;
|
|
579
|
+
}
|
|
580
|
+
if (state.pressIn) {
|
|
581
|
+
next.press = false;
|
|
582
|
+
next.pressIn = false;
|
|
583
|
+
}
|
|
584
|
+
if (Object.keys(next).length) {
|
|
585
|
+
setStateShallow(next);
|
|
586
|
+
}
|
|
587
|
+
onHoverOut == null ? void 0 : onHoverOut(e);
|
|
588
|
+
onMouseLeave == null ? void 0 : onMouseLeave(e);
|
|
589
|
+
} : void 0
|
|
590
|
+
}), {
|
|
475
591
|
[pressInKey]: attachPress ? (e) => {
|
|
476
592
|
setStateShallow({
|
|
477
593
|
press: true,
|
|
@@ -487,18 +603,17 @@ function createComponent(configIn, ParentComponent) {
|
|
|
487
603
|
unPress();
|
|
488
604
|
onClick == null ? void 0 : onClick(e);
|
|
489
605
|
onPress == null ? void 0 : onPress(e);
|
|
490
|
-
} : null
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
} : null;
|
|
606
|
+
} : null
|
|
607
|
+
}), !isWeb && {
|
|
608
|
+
cancelable: !props.rejectResponderTermination,
|
|
609
|
+
disabled: props.disabled !== null ? props.disabled : (_d = props.accessibilityState) == null ? void 0 : _d.disabled,
|
|
610
|
+
hitSlop: props.hitSlop,
|
|
611
|
+
delayLongPress: props.delayLongPress,
|
|
612
|
+
delayPressIn: props.delayPressIn,
|
|
613
|
+
delayPressOut: props.delayPressOut,
|
|
614
|
+
focusable: viewProps.focusable ?? true,
|
|
615
|
+
minPressDuration: 0
|
|
616
|
+
}) : null;
|
|
502
617
|
let space = spaceProp;
|
|
503
618
|
if (features.enabled.mediaQuery) {
|
|
504
619
|
for (const key in mediaState) {
|
|
@@ -519,23 +634,22 @@ function createComponent(configIn, ParentComponent) {
|
|
|
519
634
|
let content;
|
|
520
635
|
if (asChild) {
|
|
521
636
|
elementType = Slot;
|
|
522
|
-
viewProps = {
|
|
523
|
-
...viewProps,
|
|
637
|
+
viewProps = __spreadProps(__spreadValues({}, viewProps), {
|
|
524
638
|
onPress,
|
|
525
639
|
onPressIn,
|
|
526
640
|
onPressOut
|
|
527
|
-
};
|
|
641
|
+
});
|
|
528
642
|
}
|
|
529
643
|
if (isWeb) {
|
|
530
|
-
const [pressableProps] = usePressable(events ? {
|
|
531
|
-
disabled
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
644
|
+
const [pressableProps] = usePressable(events ? __spreadProps(__spreadValues({
|
|
645
|
+
disabled
|
|
646
|
+
}, hitSlop && {
|
|
647
|
+
hitSlop
|
|
648
|
+
}), {
|
|
535
649
|
onPressOut: events[pressOutKey],
|
|
536
650
|
onPressIn: events[pressInKey],
|
|
537
651
|
onPress: events[pressKey]
|
|
538
|
-
} : {
|
|
652
|
+
}) : {
|
|
539
653
|
disabled: true
|
|
540
654
|
});
|
|
541
655
|
if (events) {
|
|
@@ -557,18 +671,18 @@ function createComponent(configIn, ParentComponent) {
|
|
|
557
671
|
});
|
|
558
672
|
}
|
|
559
673
|
}
|
|
560
|
-
const pressability = isWeb ? null : useMemo(() => {
|
|
561
|
-
if (attachPress && events) {
|
|
562
|
-
const pressability2 = new Pressability(events);
|
|
563
|
-
internal.current.unmountEffects = [
|
|
564
|
-
() => {
|
|
565
|
-
pressability2.reset();
|
|
566
|
-
}
|
|
567
|
-
];
|
|
568
|
-
return pressability2;
|
|
569
|
-
}
|
|
570
|
-
}, []);
|
|
571
674
|
if (process.env.TAMAGUI_TARGET === "native") {
|
|
675
|
+
const pressability = useMemo(() => {
|
|
676
|
+
if (attachPress && events) {
|
|
677
|
+
const pressability2 = new Pressability(events);
|
|
678
|
+
internal.current.unmountEffects = [
|
|
679
|
+
() => {
|
|
680
|
+
pressability2.reset();
|
|
681
|
+
}
|
|
682
|
+
];
|
|
683
|
+
return pressability2;
|
|
684
|
+
}
|
|
685
|
+
}, []);
|
|
572
686
|
if (attachPress && events) {
|
|
573
687
|
pressability.configure(events);
|
|
574
688
|
const eventHandlers = pressability.getEventHandlers();
|
|
@@ -590,21 +704,20 @@ function createComponent(configIn, ParentComponent) {
|
|
|
590
704
|
if (shouldWrapWithHover || shouldWrapWithComponentTheme) {
|
|
591
705
|
const themeClassName = shouldWrapWithComponentTheme ? `${theme.className}` : "";
|
|
592
706
|
const hoverClassName = shouldWrapWithHover ? "t_Hoverable" : "";
|
|
593
|
-
content = /* @__PURE__ */ React.createElement("span", {
|
|
707
|
+
content = /* @__PURE__ */ React.createElement("span", __spreadValues({
|
|
594
708
|
className: `${hoverClassName} ${themeClassName}`,
|
|
595
709
|
style: {
|
|
596
710
|
display: "contents"
|
|
597
|
-
},
|
|
598
|
-
...shouldWrapWithHover && {
|
|
599
|
-
onMouseEnter: events.onMouseEnter,
|
|
600
|
-
onMouseLeave: events.onMouseLeave
|
|
601
711
|
}
|
|
602
|
-
},
|
|
712
|
+
}, shouldWrapWithHover && {
|
|
713
|
+
onMouseEnter: events.onMouseEnter,
|
|
714
|
+
onMouseLeave: events.onMouseLeave
|
|
715
|
+
}), content);
|
|
603
716
|
}
|
|
604
717
|
}
|
|
605
718
|
if (process.env.NODE_ENV === "development") {
|
|
606
719
|
if (props["debug"]) {
|
|
607
|
-
console.log("\u2B50\uFE0F", { propsIn: {
|
|
720
|
+
console.log("\u2B50\uFE0F", __spreadValues({ propsIn: __spreadValues({}, props), propsOut: __spreadValues({}, viewProps), elementType, state, splitStyles, animationStyles, isStringElement, classNamesIn: (_e = props.className) == null ? void 0 : _e.split(" "), classNamesOut: (_f = viewProps.className) == null ? void 0 : _f.split(" "), events, shouldAttach, ViewComponent: elementType, viewProps, styles, pseudos, content, childEls, shouldAvoidClasses, avoidClasses, animation: props.animation, style, defaultNativeStyle, initialSplitStyles }, typeof window !== "undefined" ? { theme, themeClassName: theme.className, staticConfig, tamaguiConfig, events, shouldAvoidClasses, shouldForcePseudo } : null));
|
|
608
721
|
}
|
|
609
722
|
}
|
|
610
723
|
if (features.elements.length) {
|
|
@@ -668,12 +781,14 @@ function createComponent(configIn, ParentComponent) {
|
|
|
668
781
|
const defaults = mergeProps(component.defaultProps, initialSplitStyles.viewProps);
|
|
669
782
|
defaultNativeStyle = {};
|
|
670
783
|
const validStyles2 = staticConfig.validStyles || stylePropsView;
|
|
671
|
-
|
|
672
|
-
const
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
784
|
+
if (!isWeb) {
|
|
785
|
+
for (const key in defaults) {
|
|
786
|
+
const val = defaults[key];
|
|
787
|
+
if (typeof val === "string" && val[0] === "$" || !validStyles2[key] || val[0] === "_") {
|
|
788
|
+
defaults[key] = val;
|
|
789
|
+
} else {
|
|
790
|
+
defaultNativeStyle[key] = val;
|
|
791
|
+
}
|
|
677
792
|
}
|
|
678
793
|
}
|
|
679
794
|
defaultNativeStyleSheet = StyleSheet.create({
|
|
@@ -698,21 +813,17 @@ function createComponent(configIn, ParentComponent) {
|
|
|
698
813
|
if (configIn.memo) {
|
|
699
814
|
res = memo(res);
|
|
700
815
|
}
|
|
701
|
-
res.staticConfig = {
|
|
702
|
-
validStyles: staticConfig.validStyles || stylePropsView
|
|
703
|
-
|
|
704
|
-
};
|
|
816
|
+
res.staticConfig = __spreadValues({
|
|
817
|
+
validStyles: staticConfig.validStyles || stylePropsView
|
|
818
|
+
}, staticConfig);
|
|
705
819
|
res.extractable = (Component, conf) => {
|
|
706
|
-
Component.staticConfig = extendStaticConfig({
|
|
707
|
-
Component
|
|
708
|
-
|
|
820
|
+
Component.staticConfig = extendStaticConfig(__spreadProps(__spreadValues({
|
|
821
|
+
Component
|
|
822
|
+
}, conf), {
|
|
709
823
|
neverFlatten: true,
|
|
710
824
|
isExtractable: true,
|
|
711
|
-
defaultProps: {
|
|
712
|
-
|
|
713
|
-
...conf == null ? void 0 : conf.defaultProps
|
|
714
|
-
}
|
|
715
|
-
}, res);
|
|
825
|
+
defaultProps: __spreadValues(__spreadValues({}, Component.defaultProps), conf == null ? void 0 : conf.defaultProps)
|
|
826
|
+
}), res);
|
|
716
827
|
return Component;
|
|
717
828
|
};
|
|
718
829
|
return res;
|
|
@@ -726,16 +837,14 @@ const Spacer = createComponent({
|
|
|
726
837
|
memo: true,
|
|
727
838
|
componentName: "Spacer",
|
|
728
839
|
validStyles,
|
|
729
|
-
defaultProps: {
|
|
730
|
-
...stackDefaultStyles,
|
|
840
|
+
defaultProps: __spreadProps(__spreadValues({}, stackDefaultStyles), {
|
|
731
841
|
size: true
|
|
732
|
-
},
|
|
842
|
+
}),
|
|
733
843
|
variants: {
|
|
734
844
|
size: {
|
|
735
845
|
"...size": (size, { tokens }) => {
|
|
736
|
-
var _a;
|
|
737
846
|
size = size == true ? "$true" : size;
|
|
738
|
-
const sizePx =
|
|
847
|
+
const sizePx = tokens.space[size] ?? size;
|
|
739
848
|
return {
|
|
740
849
|
width: sizePx,
|
|
741
850
|
height: sizePx,
|
|
@@ -761,7 +870,7 @@ const Spacer = createComponent({
|
|
|
761
870
|
}
|
|
762
871
|
},
|
|
763
872
|
defaultVariants: {
|
|
764
|
-
direction: "
|
|
873
|
+
direction: "both"
|
|
765
874
|
}
|
|
766
875
|
});
|
|
767
876
|
function spacedChildren({
|
|
@@ -830,14 +939,13 @@ function spacedChildren({
|
|
|
830
939
|
return final;
|
|
831
940
|
}
|
|
832
941
|
function createSpacer({ key, direction, space, spaceFlex }) {
|
|
833
|
-
return /* @__PURE__ */ React.createElement(Spacer, {
|
|
942
|
+
return /* @__PURE__ */ React.createElement(Spacer, __spreadValues({
|
|
834
943
|
key,
|
|
835
|
-
direction: direction === "both" ? void 0 : direction === "row" || direction === "row-reverse" ? "horizontal" : "vertical",
|
|
836
944
|
size: space,
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
});
|
|
945
|
+
direction
|
|
946
|
+
}, spaceFlex && {
|
|
947
|
+
flex: spaceFlex
|
|
948
|
+
}));
|
|
841
949
|
}
|
|
842
950
|
function isUnspaced(child) {
|
|
843
951
|
var _a, _b;
|
|
@@ -1029,7 +1137,7 @@ function addPseudoToStyles(styles, initialPseudos, pseudos, name, force = false)
|
|
|
1029
1137
|
const pseudoStyle = pseudos[name];
|
|
1030
1138
|
const shouldNestObject = isWeb && name !== "enterStyle" && name !== "exitStyle";
|
|
1031
1139
|
const defaultPseudoStyle = initialPseudos[name];
|
|
1032
|
-
const style = defaultPseudoStyle ? {
|
|
1140
|
+
const style = defaultPseudoStyle ? __spreadValues(__spreadValues({}, defaultPseudoStyle), pseudoStyle) : pseudoStyle;
|
|
1033
1141
|
if (style) {
|
|
1034
1142
|
styles.push(shouldNestObject && !force ? { [name]: style } : style);
|
|
1035
1143
|
}
|