@tamagui/core 1.0.1-beta.214 → 1.0.1-beta.216
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/constants/isDevTools.js +9 -1
- package/dist/cjs/constants/isDevTools.js.map +2 -2
- package/dist/cjs/createComponent.js +82 -156
- package/dist/cjs/createComponent.js.map +3 -3
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +74 -47
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.js +5 -1
- package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
- package/dist/cjs/helpers/normalizeValueWithProperty.js +9 -5
- package/dist/cjs/helpers/normalizeValueWithProperty.js.map +2 -2
- package/dist/cjs/helpers/pseudoDescriptors.js +10 -0
- package/dist/cjs/helpers/pseudoDescriptors.js.map +2 -2
- package/dist/cjs/helpers/useShallowSetState.js +1 -1
- package/dist/cjs/helpers/useShallowSetState.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/views/TamaguiProvider.js +2 -5
- package/dist/cjs/views/TamaguiProvider.js.map +3 -3
- package/dist/esm/constants/isDevTools.js +9 -1
- package/dist/esm/constants/isDevTools.js.map +2 -2
- package/dist/esm/createComponent.js +83 -156
- package/dist/esm/createComponent.js.map +3 -3
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +75 -48
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getStylesAtomic.js +5 -1
- package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
- package/dist/esm/helpers/normalizeValueWithProperty.js +9 -5
- package/dist/esm/helpers/normalizeValueWithProperty.js.map +2 -2
- package/dist/esm/helpers/pseudoDescriptors.js +10 -0
- package/dist/esm/helpers/pseudoDescriptors.js.map +2 -2
- package/dist/esm/helpers/useShallowSetState.js +1 -1
- package/dist/esm/helpers/useShallowSetState.js.map +2 -2
- package/dist/esm/views/TamaguiProvider.js +2 -5
- package/dist/esm/views/TamaguiProvider.js.map +3 -3
- package/package.json +12 -12
- package/src/constants/isDevTools.ts +10 -4
- package/src/createComponent.tsx +101 -208
- package/src/helpers/createPropMapper.ts +1 -0
- package/src/helpers/getSplitStyles.tsx +91 -57
- package/src/helpers/getStylesAtomic.ts +7 -2
- package/src/helpers/normalizeValueWithProperty.ts +11 -5
- package/src/helpers/pseudoDescriptors.ts +24 -3
- package/src/helpers/useShallowSetState.tsx +1 -1
- package/src/types.tsx +1 -1
- package/src/views/TamaguiProvider.tsx +5 -6
- package/types/helpers/getSplitStyles.d.ts +1 -1
- package/types/helpers/pseudoDescriptors.d.ts +8 -14
- package/types/types.d.ts +1 -1
|
@@ -21,7 +21,15 @@ __export(isDevTools_exports, {
|
|
|
21
21
|
isDevTools: () => isDevTools
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(isDevTools_exports);
|
|
24
|
-
const isDevTools =
|
|
24
|
+
const isDevTools = (() => {
|
|
25
|
+
if (process.env.NODE_ENV === "development") {
|
|
26
|
+
try {
|
|
27
|
+
return new Function("try {return this===window;}catch(e){ return false;}")();
|
|
28
|
+
} catch {
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
})();
|
|
25
33
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
34
|
0 && (module.exports = {
|
|
27
35
|
isDevTools
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/constants/isDevTools.ts"],
|
|
4
|
-
"sourcesContent": ["// for verbose logging outside node/cli\n\nexport const isDevTools
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,
|
|
4
|
+
"sourcesContent": ["// for verbose logging outside node/cli\n\nexport const isDevTools = (() => {\n if (process.env.NODE_ENV === 'development') {\n try {\n return new Function('try {return this===window;}catch(e){ return false;}')()\n } catch {\n //\n }\n }\n return false\n})()\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,cAAc,MAAM;AAC/B,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI;AACF,aAAO,IAAI,SAAS,qDAAqD,EAAE;AAAA,IAC7E,QAAE;AAAA,IAEF;AAAA,EACF;AACA,SAAO;AACT,GAAG;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -46,7 +46,9 @@ var import_extendStaticConfig = require("./helpers/extendStaticConfig");
|
|
|
46
46
|
var import_getSplitStyles = require("./helpers/getSplitStyles");
|
|
47
47
|
var import_insertStyleRule = require("./helpers/insertStyleRule");
|
|
48
48
|
var import_mergeProps = require("./helpers/mergeProps");
|
|
49
|
+
var import_mergeTransform = require("./helpers/mergeTransform");
|
|
49
50
|
var import_proxyThemeVariables = require("./helpers/proxyThemeVariables");
|
|
51
|
+
var import_pseudoDescriptors = require("./helpers/pseudoDescriptors");
|
|
50
52
|
var import_useShallowSetState = require("./helpers/useShallowSetState");
|
|
51
53
|
var import_useElementLayout = require("./hooks/useElementLayout");
|
|
52
54
|
var import_useMedia = require("./hooks/useMedia");
|
|
@@ -112,11 +114,6 @@ function createComponent(configIn, ParentComponent) {
|
|
|
112
114
|
const { Component, isText, isZStack } = staticConfig;
|
|
113
115
|
const componentName = props.componentName || staticConfig.componentName;
|
|
114
116
|
const componentClassName = props.asChild ? "" : props.componentName ? `is_${props.componentName}` : defaultComponentClassName;
|
|
115
|
-
if (debugProp) {
|
|
116
|
-
console.log(`render ${componentName}`);
|
|
117
|
-
}
|
|
118
|
-
const forceUpdate = (0, import_use_force_update.useForceUpdate)();
|
|
119
|
-
const theme = (0, import_useTheme.useTheme)(props.theme, componentName, props, forceUpdate);
|
|
120
117
|
const hasEnterStyle = !!props.enterStyle;
|
|
121
118
|
const needsMount = Boolean((import_constants.isWeb ? import_constants.isClient : true) && (hasEnterStyle || props.animation));
|
|
122
119
|
const states = (0, import_useServerHooks.useServerState)(
|
|
@@ -125,42 +122,47 @@ function createComponent(configIn, ParentComponent) {
|
|
|
125
122
|
const state = propsIn.forceStyle ? { ...states[0], [propsIn.forceStyle]: true } : states[0];
|
|
126
123
|
const setState = states[1];
|
|
127
124
|
const setStateShallow = (0, import_useShallowSetState.useShallowSetState)(setState, debugProp, componentName);
|
|
128
|
-
const
|
|
125
|
+
const useAnimations = (_a = tamaguiConfig.animations) == null ? void 0 : _a.useAnimations;
|
|
126
|
+
const hasEverAnimated = (0, import_react.useRef)(false);
|
|
127
|
+
const isAnimated = (() => {
|
|
128
|
+
const next = !!(useAnimations && props.animation);
|
|
129
|
+
if (next && !hasEverAnimated.current) {
|
|
130
|
+
hasEverAnimated.current = true;
|
|
131
|
+
}
|
|
132
|
+
return next || hasEverAnimated.current;
|
|
133
|
+
})();
|
|
134
|
+
const isReactNative = Boolean(
|
|
135
|
+
staticConfig.isReactNative || isAnimated && tamaguiConfig.animations.isReactNative
|
|
136
|
+
);
|
|
137
|
+
if (process.env.NODE_ENV === "development") {
|
|
138
|
+
if (props["debug"]) {
|
|
139
|
+
const name = `${componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]"}`;
|
|
140
|
+
const type = isReactNative ? "(rnw)" : "";
|
|
141
|
+
const dataIs = propsIn["data-is"] || "";
|
|
142
|
+
const banner = `${name}${dataIs ? ` ${dataIs}` : ""} ${type}`;
|
|
143
|
+
console.group(`%c ${banner}`, "background: yellow;");
|
|
144
|
+
console.log(`state`, state);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const forceUpdate = (0, import_use_force_update.useForceUpdate)();
|
|
148
|
+
const theme = (0, import_useTheme.useTheme)(props.theme, componentName, props, forceUpdate);
|
|
149
|
+
const shouldSetMounted = needsMount && state.unmounted;
|
|
129
150
|
const setMounted = shouldSetMounted ? () => {
|
|
130
151
|
setTimeout(
|
|
131
152
|
() => {
|
|
132
153
|
setStateShallow({
|
|
133
|
-
|
|
154
|
+
unmounted: false
|
|
134
155
|
});
|
|
135
156
|
},
|
|
136
157
|
import_constants.isWeb ? 10 : 0
|
|
137
158
|
);
|
|
138
159
|
} : void 0;
|
|
139
|
-
const shouldAvoidClasses = !!(props.animation && avoidClassesWhileAnimating) || !staticConfig.acceptsClassName;
|
|
160
|
+
const shouldAvoidClasses = !import_constants.isWeb || !!(props.animation && avoidClassesWhileAnimating) || !staticConfig.acceptsClassName;
|
|
140
161
|
const shouldForcePseudo = !!propsIn.forceStyle;
|
|
141
162
|
const hasTextAncestor = !!(import_constants.isWeb && isText ? (0, import_react.useContext)(import_TextAncestorContext.TextAncestorContext) : false);
|
|
142
|
-
const
|
|
143
|
-
...state,
|
|
144
|
-
hasTextAncestor,
|
|
145
|
-
dynamicStylesInline: true
|
|
146
|
-
} : {
|
|
147
|
-
...state,
|
|
148
|
-
noClassNames: true,
|
|
149
|
-
dynamicStylesInline: true,
|
|
150
|
-
hasTextAncestor,
|
|
151
|
-
resolveVariablesAs: "value"
|
|
152
|
-
};
|
|
163
|
+
const noClassNames = shouldAvoidClasses || shouldForcePseudo;
|
|
153
164
|
const languageContext = import_constants.isRSC ? null : (0, import_react.useContext)(import_FontLanguageContext.FontLanguageContext);
|
|
154
|
-
const isDisabled = props.disabled ?? ((
|
|
155
|
-
const useAnimations = (_b = tamaguiConfig.animations) == null ? void 0 : _b.useAnimations;
|
|
156
|
-
const hasEverAnimated = (0, import_react.useRef)(false);
|
|
157
|
-
const isAnimated = (() => {
|
|
158
|
-
const next = !!(useAnimations && props.animation);
|
|
159
|
-
if (next && !hasEverAnimated.current) {
|
|
160
|
-
hasEverAnimated.current = true;
|
|
161
|
-
}
|
|
162
|
-
return next || hasEverAnimated.current;
|
|
163
|
-
})();
|
|
165
|
+
const isDisabled = props.disabled ?? ((_b = props.accessibilityState) == null ? void 0 : _b.disabled);
|
|
164
166
|
const isTaggable = !Component || typeof Component === "string";
|
|
165
167
|
const element = import_constants.isWeb ? isTaggable ? props.tag || defaultTag || Component : Component : Component;
|
|
166
168
|
const BaseTextComponent = BaseText || element || "span";
|
|
@@ -168,6 +170,13 @@ function createComponent(configIn, ParentComponent) {
|
|
|
168
170
|
let elementType = isText ? (isAnimated ? AnimatedText : null) || BaseTextComponent : (isAnimated ? AnimatedView : null) || BaseViewComponent;
|
|
169
171
|
elementType = Component || elementType;
|
|
170
172
|
const isStringElement = typeof elementType === "string";
|
|
173
|
+
const splitStyleState = {
|
|
174
|
+
...state,
|
|
175
|
+
noClassNames,
|
|
176
|
+
dynamicStylesInline: noClassNames,
|
|
177
|
+
hasTextAncestor,
|
|
178
|
+
resolveVariablesAs: "value"
|
|
179
|
+
};
|
|
171
180
|
const splitStyles = (0, import_getSplitStyles.useSplitStyles)(
|
|
172
181
|
props,
|
|
173
182
|
staticConfig,
|
|
@@ -179,24 +188,17 @@ function createComponent(configIn, ParentComponent) {
|
|
|
179
188
|
debugProp
|
|
180
189
|
);
|
|
181
190
|
const hostRef = (0, import_useServerHooks.useServerRef)(null);
|
|
182
|
-
const isReactNative = Boolean(
|
|
183
|
-
staticConfig.isReactNative || isAnimated && tamaguiConfig.animations.isReactNative
|
|
184
|
-
);
|
|
185
191
|
const isAnimatedReactNativeWeb = isAnimated && avoidClassesWhileAnimating;
|
|
186
192
|
if (process.env.NODE_ENV === "development") {
|
|
187
193
|
if (!process.env.TAMAGUI_TARGET) {
|
|
188
194
|
console.error(`No process.env.TAMAGUI_TARGET set, please set it to "native" or "web".`);
|
|
189
195
|
}
|
|
190
196
|
if (debugProp) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
const banner = `${name} ${propsIn["data-is"] || ""} ${type}`;
|
|
194
|
-
console.group(`%c \u{1F41B} ${banner}`, "background: yellow;");
|
|
195
|
-
console.groupCollapsed("initial props/state");
|
|
196
|
-
console.log("propsIn", propsIn, "turned into", props, "order", Object.keys(props));
|
|
197
|
+
console.groupCollapsed("props");
|
|
198
|
+
console.log("props in", propsIn, "mapped to", props, "in order", Object.keys(props));
|
|
197
199
|
console.log("splitStyles", splitStyles);
|
|
198
200
|
console.log("className", Object.values(splitStyles.classNames));
|
|
199
|
-
if (
|
|
201
|
+
if (import_constants.isClient) {
|
|
200
202
|
console.log("ref", hostRef, "(click to view)");
|
|
201
203
|
}
|
|
202
204
|
console.groupEnd();
|
|
@@ -213,7 +215,6 @@ function createComponent(configIn, ParentComponent) {
|
|
|
213
215
|
classNames,
|
|
214
216
|
mediaKeys
|
|
215
217
|
} = splitStyles;
|
|
216
|
-
const animationFeatureStylesIn = props.animation ? { ...defaultNativeStyle, ...splitStylesStyle } : null;
|
|
217
218
|
const propsWithAnimation = props;
|
|
218
219
|
let animationStyles;
|
|
219
220
|
if (!import_constants.isRSC && isAnimated && useAnimations) {
|
|
@@ -225,7 +226,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
225
226
|
staticConfig,
|
|
226
227
|
getStyle({ isExiting, isEntering, exitVariant, enterVariant } = {}) {
|
|
227
228
|
var _a2, _b2, _c2, _d2;
|
|
228
|
-
const
|
|
229
|
+
const animationStyle = { ...defaultNativeStyle, ...splitStylesStyle };
|
|
229
230
|
const enterStyle = isEntering ? enterVariant && ((_a2 = staticConfig.variants) == null ? void 0 : _a2[enterVariant]["true"]) ? (0, import_getSplitStyles.getSubStyle)(
|
|
230
231
|
"",
|
|
231
232
|
(_b2 = staticConfig.variants) == null ? void 0 : _b2[enterVariant]["true"],
|
|
@@ -234,7 +235,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
234
235
|
props,
|
|
235
236
|
state,
|
|
236
237
|
tamaguiConfig
|
|
237
|
-
)
|
|
238
|
+
) : null : null;
|
|
238
239
|
const exitStyle = isExiting ? exitVariant && ((_c2 = staticConfig.variants) == null ? void 0 : _c2[exitVariant]["true"]) ? (0, import_getSplitStyles.getSubStyle)(
|
|
239
240
|
"",
|
|
240
241
|
(_d2 = staticConfig.variants) == null ? void 0 : _d2[exitVariant]["true"],
|
|
@@ -243,24 +244,14 @@ function createComponent(configIn, ParentComponent) {
|
|
|
243
244
|
props,
|
|
244
245
|
state,
|
|
245
246
|
tamaguiConfig
|
|
246
|
-
)
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
);
|
|
253
|
-
enterStyle && isEntering && merge(style, enterStyle);
|
|
254
|
-
state.hover && pseudos.hoverStyle && merge(style, pseudos.hoverStyle);
|
|
255
|
-
state.focus && pseudos.focusStyle && merge(style, pseudos.focusStyle);
|
|
256
|
-
state.press && pseudos.pressStyle && merge(style, pseudos.pressStyle);
|
|
257
|
-
exitStyle && isExiting && merge(style, exitStyle);
|
|
258
|
-
if (process.env.NODE_ENV === "development") {
|
|
259
|
-
if (debugProp === "verbose") {
|
|
260
|
-
console.log("animation style", style);
|
|
261
|
-
}
|
|
247
|
+
) : pseudos.exitStyle : null;
|
|
248
|
+
if (isEntering && enterStyle) {
|
|
249
|
+
merge(animationStyle, enterStyle);
|
|
250
|
+
}
|
|
251
|
+
if (isExiting && exitStyle) {
|
|
252
|
+
merge(animationStyle, exitStyle);
|
|
262
253
|
}
|
|
263
|
-
return
|
|
254
|
+
return animationStyle;
|
|
264
255
|
}
|
|
265
256
|
});
|
|
266
257
|
if (animations) {
|
|
@@ -432,13 +423,6 @@ function createComponent(configIn, ParentComponent) {
|
|
|
432
423
|
};
|
|
433
424
|
} else {
|
|
434
425
|
styles = [import_constants.isWeb ? null : defaultNativeStyle, animationStyles ?? splitStylesStyle, medias];
|
|
435
|
-
if (!animationStyles && initialSplitStyles) {
|
|
436
|
-
const initPseudos = initialSplitStyles.pseudos;
|
|
437
|
-
!state.mounted && addPseudoToStyles(styles, initPseudos, pseudos, "enterStyle");
|
|
438
|
-
state.hover && addPseudoToStyles(styles, initPseudos, pseudos, "hoverStyle", shouldForcePseudo);
|
|
439
|
-
state.focus && addPseudoToStyles(styles, initPseudos, pseudos, "focusStyle", shouldForcePseudo);
|
|
440
|
-
state.press && addPseudoToStyles(styles, initPseudos, pseudos, "pressStyle", shouldForcePseudo);
|
|
441
|
-
}
|
|
442
426
|
if (shouldForcePseudo) {
|
|
443
427
|
const next = {};
|
|
444
428
|
for (const style of styles) {
|
|
@@ -512,9 +496,11 @@ function createComponent(configIn, ParentComponent) {
|
|
|
512
496
|
viewProps.style = styles;
|
|
513
497
|
}
|
|
514
498
|
const initialPseudos = initialSplitStyles == null ? void 0 : initialSplitStyles.pseudos;
|
|
515
|
-
const
|
|
499
|
+
const runtimePressStyle = noClassNames && ((pseudos == null ? void 0 : pseudos.pressStyle) || (initialPseudos == null ? void 0 : initialPseudos.pressStyle));
|
|
500
|
+
const attachPress = !!(runtimePressStyle || onPress || onPressOut || onPressIn || onClick);
|
|
516
501
|
const isHoverable = import_constants.isWeb;
|
|
517
|
-
const
|
|
502
|
+
const runtimeHoverStyle = noClassNames && ((pseudos == null ? void 0 : pseudos.hoverStyle) || initialPseudos.hoverStyle);
|
|
503
|
+
const attachHover = isHoverable && !!(runtimeHoverStyle || onHoverIn || onHoverOut || onMouseEnter || onMouseLeave);
|
|
518
504
|
const handlesPressEvents = !import_constants.isWeb && !asChild;
|
|
519
505
|
const shouldAttach = asChild ? false : Boolean(
|
|
520
506
|
attachPress || attachHover || "pressStyle" in props || "onPress" in props || "onPressIn" in props || "onPressOut" in props || import_constants.isWeb && ("hoverStyle" in props || "onHoverIn" in props || "onHoverOut" in props || "onMouseEnter" in props || "onMouseLeave" in props)
|
|
@@ -525,7 +511,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
525
511
|
onPressOut == null ? void 0 : onPressOut(e);
|
|
526
512
|
onMouseUp == null ? void 0 : onMouseUp(e);
|
|
527
513
|
} : void 0,
|
|
528
|
-
...
|
|
514
|
+
...attachHover && {
|
|
529
515
|
onMouseEnter: attachHover ? (e) => {
|
|
530
516
|
const next = {};
|
|
531
517
|
if (attachHover) {
|
|
@@ -620,7 +606,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
620
606
|
};
|
|
621
607
|
}
|
|
622
608
|
if (process.env.TAMAGUI_TARGET === "native") {
|
|
623
|
-
const attachFocus = !!(pseudos
|
|
609
|
+
const attachFocus = !!(pseudos.focusStyle || initialPseudos && initialPseudos.focusStyle);
|
|
624
610
|
if (attachFocus) {
|
|
625
611
|
viewProps.onFocus = (0, import_Slot.mergeEvent)(viewProps.onFocus, () => {
|
|
626
612
|
setStateShallow({ focus: true });
|
|
@@ -629,11 +615,8 @@ function createComponent(configIn, ParentComponent) {
|
|
|
629
615
|
setStateShallow({ focus: false });
|
|
630
616
|
});
|
|
631
617
|
}
|
|
632
|
-
const pressability = (0, import_Pressability.usePressability)(events);
|
|
618
|
+
const pressability = (0, import_Pressability.usePressability)(events ? { ...events, hitSlop } : {});
|
|
633
619
|
if (attachPress && events) {
|
|
634
|
-
if (hitSlop) {
|
|
635
|
-
viewProps.hitSlop = hitSlop;
|
|
636
|
-
}
|
|
637
620
|
for (const key in pressability) {
|
|
638
621
|
const og = props[key];
|
|
639
622
|
const val = pressability[key];
|
|
@@ -688,12 +671,12 @@ function createComponent(configIn, ParentComponent) {
|
|
|
688
671
|
press: false,
|
|
689
672
|
pressIn: false,
|
|
690
673
|
focus: false,
|
|
691
|
-
|
|
674
|
+
unmounted: true,
|
|
692
675
|
mediaState: getMediaStateObject((0, import_useMedia.getInitialMediaState)())
|
|
693
676
|
};
|
|
694
677
|
defaultComponentStateMounted = {
|
|
695
678
|
...defaultComponentState,
|
|
696
|
-
|
|
679
|
+
unmounted: false
|
|
697
680
|
};
|
|
698
681
|
}
|
|
699
682
|
if (tamaguiConfig.animations) {
|
|
@@ -733,22 +716,21 @@ function createComponent(configIn, ParentComponent) {
|
|
|
733
716
|
staticConfig,
|
|
734
717
|
initialTheme,
|
|
735
718
|
{
|
|
736
|
-
|
|
719
|
+
unmounted: false,
|
|
737
720
|
hover: false,
|
|
738
721
|
press: false,
|
|
739
722
|
pressIn: false,
|
|
740
723
|
focus: false,
|
|
741
724
|
resolveVariablesAs: "both",
|
|
742
|
-
noClassNames
|
|
743
|
-
keepVariantsAsProps: true
|
|
725
|
+
noClassNames
|
|
744
726
|
},
|
|
745
727
|
void 0,
|
|
746
728
|
void 0,
|
|
747
729
|
debug
|
|
748
730
|
);
|
|
749
|
-
const [
|
|
731
|
+
const [defaults, defaultsClassnames] = (0, import_mergeProps.mergeProps)(
|
|
750
732
|
component.defaultProps,
|
|
751
|
-
initialSplitStyles.viewProps,
|
|
733
|
+
import_constants.isWeb ? { ...initialSplitStyles.pseudos, ...initialSplitStyles.viewProps } : initialSplitStyles.viewProps,
|
|
752
734
|
true
|
|
753
735
|
);
|
|
754
736
|
initialSplitStyles.classNames = {
|
|
@@ -764,14 +746,22 @@ function createComponent(configIn, ParentComponent) {
|
|
|
764
746
|
if (import_helpers.validPseudoKeys[key])
|
|
765
747
|
continue;
|
|
766
748
|
if (typeof val === "string" && val[0] === "$" || !validStyles2[key]) {
|
|
767
|
-
|
|
749
|
+
defaults[key] = val;
|
|
768
750
|
} else {
|
|
769
751
|
defaultNativeStyle[key] = val;
|
|
770
752
|
}
|
|
771
753
|
}
|
|
772
754
|
}
|
|
773
|
-
if (Object.keys(
|
|
774
|
-
tamaguiDefaultProps =
|
|
755
|
+
if (Object.keys(defaults).length) {
|
|
756
|
+
tamaguiDefaultProps = defaults;
|
|
757
|
+
if (!import_constants.isWeb) {
|
|
758
|
+
Object.keys(import_pseudoDescriptors.pseudoDescriptors).forEach((k) => {
|
|
759
|
+
if (ourProps[k]) {
|
|
760
|
+
initialSplitStyles.pseudos[k] = null;
|
|
761
|
+
tamaguiDefaultProps[k] = ourProps[k];
|
|
762
|
+
}
|
|
763
|
+
});
|
|
764
|
+
}
|
|
775
765
|
}
|
|
776
766
|
if (process.env.NODE_ENV === "development" && debug) {
|
|
777
767
|
if (process.env.IS_STATIC !== "is_static") {
|
|
@@ -780,7 +770,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
780
770
|
initialSplitStyles,
|
|
781
771
|
tamaguiDefaultProps,
|
|
782
772
|
defaultNativeStyle,
|
|
783
|
-
defaults
|
|
773
|
+
defaults,
|
|
784
774
|
defaultPropsIn,
|
|
785
775
|
defaultPropsKeyOrder: Object.keys(staticConfig.defaultProps),
|
|
786
776
|
defaultPropsInKeyOrder: Object.keys(defaultPropsIn).map((k) => [k, defaultPropsIn[k]]),
|
|
@@ -894,12 +884,10 @@ function spacedChildren({
|
|
|
894
884
|
}, index)
|
|
895
885
|
);
|
|
896
886
|
}
|
|
897
|
-
if (isUnspaced(child) && index === 0)
|
|
887
|
+
if (isUnspaced(child) && index === 0)
|
|
898
888
|
continue;
|
|
899
|
-
|
|
900
|
-
if (isZStack) {
|
|
889
|
+
if (isZStack)
|
|
901
890
|
continue;
|
|
902
|
-
}
|
|
903
891
|
const next = childrenList[index + 1];
|
|
904
892
|
if (next && !isUnspaced(next)) {
|
|
905
893
|
if (separator) {
|
|
@@ -953,15 +941,6 @@ function isUnspaced(child) {
|
|
|
953
941
|
var _a, _b;
|
|
954
942
|
return ((_a = child == null ? void 0 : child["type"]) == null ? void 0 : _a["isVisuallyHidden"]) || ((_b = child == null ? void 0 : child["type"]) == null ? void 0 : _b["isUnspaced"]);
|
|
955
943
|
}
|
|
956
|
-
function addPseudoToStyles(styles, initialPseudos, pseudos, name, force = false) {
|
|
957
|
-
const pseudoStyle = pseudos[name];
|
|
958
|
-
const shouldNestObject = import_constants.isWeb && name !== "enterStyle" && name !== "exitStyle";
|
|
959
|
-
const defaultPseudoStyle = initialPseudos[name];
|
|
960
|
-
const style = defaultPseudoStyle ? { ...defaultPseudoStyle, ...pseudoStyle } : pseudoStyle;
|
|
961
|
-
if (style) {
|
|
962
|
-
styles.push(shouldNestObject && !force ? { [name]: style } : style);
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
944
|
const DefaultProps = /* @__PURE__ */ new Map();
|
|
966
945
|
function mergeConfigDefaultProps(name, props, configDefaults, parentNames, conf) {
|
|
967
946
|
const len = parentNames.length;
|
|
@@ -990,66 +969,13 @@ function mergeConfigDefaultProps(name, props, configDefaults, parentNames, conf)
|
|
|
990
969
|
}
|
|
991
970
|
return props;
|
|
992
971
|
}
|
|
993
|
-
const defaults = {
|
|
994
|
-
left: 0,
|
|
995
|
-
right: 0,
|
|
996
|
-
top: 0,
|
|
997
|
-
bottom: 0,
|
|
998
|
-
opacity: 1,
|
|
999
|
-
translateX: 0,
|
|
1000
|
-
translateY: 0,
|
|
1001
|
-
skew: 0,
|
|
1002
|
-
skewX: 0,
|
|
1003
|
-
skewY: 0,
|
|
1004
|
-
scale: 1,
|
|
1005
|
-
rotate: "0deg",
|
|
1006
|
-
rotateY: "0deg",
|
|
1007
|
-
rotateX: "0deg"
|
|
1008
|
-
};
|
|
1009
|
-
function ensureBaseHasDefaults(base, ...pseudos) {
|
|
1010
|
-
for (const pseudo of pseudos) {
|
|
1011
|
-
if (!pseudo)
|
|
1012
|
-
continue;
|
|
1013
|
-
for (const key in pseudo) {
|
|
1014
|
-
const val = pseudo[key];
|
|
1015
|
-
if (key === "transform") {
|
|
1016
|
-
if (typeof val === "string") {
|
|
1017
|
-
continue;
|
|
1018
|
-
}
|
|
1019
|
-
for (const t of val) {
|
|
1020
|
-
const tkey = Object.keys(t)[0];
|
|
1021
|
-
const defaultVal = defaults[tkey];
|
|
1022
|
-
const tDefaultVal = { [tkey]: defaultVal };
|
|
1023
|
-
if (!base.transform) {
|
|
1024
|
-
base.transform = [tDefaultVal];
|
|
1025
|
-
} else {
|
|
1026
|
-
if (!base.transform.find((x) => x[tkey])) {
|
|
1027
|
-
base.transform.push(tDefaultVal);
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
} else {
|
|
1032
|
-
if (!(key in base)) {
|
|
1033
|
-
base[key] = defaults[key];
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
972
|
function merge(base, next) {
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
const { transform, ...rest } = next;
|
|
1045
|
-
Object.assign(base, rest);
|
|
1046
|
-
for (const t of transform) {
|
|
1047
|
-
const key = Object.keys(t)[0];
|
|
1048
|
-
const existing = base.transform.find((x) => key in x);
|
|
1049
|
-
if (existing) {
|
|
1050
|
-
existing[key] = t[key];
|
|
973
|
+
for (const key in next) {
|
|
974
|
+
const val = next[key];
|
|
975
|
+
if (key in import_helpers.stylePropsTransform) {
|
|
976
|
+
(0, import_mergeTransform.mergeTransform)(base, key, val, true);
|
|
1051
977
|
} else {
|
|
1052
|
-
base
|
|
978
|
+
base[key] = val;
|
|
1053
979
|
}
|
|
1054
980
|
}
|
|
1055
981
|
}
|