@tamagui/core 1.0.1-beta.214 → 1.0.1-beta.215
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 +71 -152
- package/dist/cjs/createComponent.js.map +3 -3
- 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 +72 -152
- package/dist/esm/createComponent.js.map +3 -3
- 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 +85 -200
- 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,6 +46,7 @@ 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");
|
|
50
51
|
var import_useShallowSetState = require("./helpers/useShallowSetState");
|
|
51
52
|
var import_useElementLayout = require("./hooks/useElementLayout");
|
|
@@ -112,11 +113,6 @@ function createComponent(configIn, ParentComponent) {
|
|
|
112
113
|
const { Component, isText, isZStack } = staticConfig;
|
|
113
114
|
const componentName = props.componentName || staticConfig.componentName;
|
|
114
115
|
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
116
|
const hasEnterStyle = !!props.enterStyle;
|
|
121
117
|
const needsMount = Boolean((import_constants.isWeb ? import_constants.isClient : true) && (hasEnterStyle || props.animation));
|
|
122
118
|
const states = (0, import_useServerHooks.useServerState)(
|
|
@@ -125,42 +121,47 @@ function createComponent(configIn, ParentComponent) {
|
|
|
125
121
|
const state = propsIn.forceStyle ? { ...states[0], [propsIn.forceStyle]: true } : states[0];
|
|
126
122
|
const setState = states[1];
|
|
127
123
|
const setStateShallow = (0, import_useShallowSetState.useShallowSetState)(setState, debugProp, componentName);
|
|
128
|
-
const
|
|
124
|
+
const useAnimations = (_a = tamaguiConfig.animations) == null ? void 0 : _a.useAnimations;
|
|
125
|
+
const hasEverAnimated = (0, import_react.useRef)(false);
|
|
126
|
+
const isAnimated = (() => {
|
|
127
|
+
const next = !!(useAnimations && props.animation);
|
|
128
|
+
if (next && !hasEverAnimated.current) {
|
|
129
|
+
hasEverAnimated.current = true;
|
|
130
|
+
}
|
|
131
|
+
return next || hasEverAnimated.current;
|
|
132
|
+
})();
|
|
133
|
+
const isReactNative = Boolean(
|
|
134
|
+
staticConfig.isReactNative || isAnimated && tamaguiConfig.animations.isReactNative
|
|
135
|
+
);
|
|
136
|
+
if (process.env.NODE_ENV === "development") {
|
|
137
|
+
if (props["debug"]) {
|
|
138
|
+
const name = `${componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]"}`;
|
|
139
|
+
const type = isReactNative ? "(rnw)" : "";
|
|
140
|
+
const dataIs = propsIn["data-is"] || "";
|
|
141
|
+
const banner = `${name}${dataIs ? ` ${dataIs}` : ""} ${type}`;
|
|
142
|
+
console.group(`%c ${banner}`, "background: yellow;");
|
|
143
|
+
console.log(`state`, state);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const forceUpdate = (0, import_use_force_update.useForceUpdate)();
|
|
147
|
+
const theme = (0, import_useTheme.useTheme)(props.theme, componentName, props, forceUpdate);
|
|
148
|
+
const shouldSetMounted = needsMount && state.unmounted;
|
|
129
149
|
const setMounted = shouldSetMounted ? () => {
|
|
130
150
|
setTimeout(
|
|
131
151
|
() => {
|
|
132
152
|
setStateShallow({
|
|
133
|
-
|
|
153
|
+
unmounted: false
|
|
134
154
|
});
|
|
135
155
|
},
|
|
136
156
|
import_constants.isWeb ? 10 : 0
|
|
137
157
|
);
|
|
138
158
|
} : void 0;
|
|
139
|
-
const shouldAvoidClasses = !!(props.animation && avoidClassesWhileAnimating) || !staticConfig.acceptsClassName;
|
|
159
|
+
const shouldAvoidClasses = !import_constants.isWeb || !!(props.animation && avoidClassesWhileAnimating) || !staticConfig.acceptsClassName;
|
|
140
160
|
const shouldForcePseudo = !!propsIn.forceStyle;
|
|
141
161
|
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
|
-
};
|
|
162
|
+
const noClassNames = shouldAvoidClasses || shouldForcePseudo;
|
|
153
163
|
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
|
-
})();
|
|
164
|
+
const isDisabled = props.disabled ?? ((_b = props.accessibilityState) == null ? void 0 : _b.disabled);
|
|
164
165
|
const isTaggable = !Component || typeof Component === "string";
|
|
165
166
|
const element = import_constants.isWeb ? isTaggable ? props.tag || defaultTag || Component : Component : Component;
|
|
166
167
|
const BaseTextComponent = BaseText || element || "span";
|
|
@@ -168,6 +169,13 @@ function createComponent(configIn, ParentComponent) {
|
|
|
168
169
|
let elementType = isText ? (isAnimated ? AnimatedText : null) || BaseTextComponent : (isAnimated ? AnimatedView : null) || BaseViewComponent;
|
|
169
170
|
elementType = Component || elementType;
|
|
170
171
|
const isStringElement = typeof elementType === "string";
|
|
172
|
+
const splitStyleState = {
|
|
173
|
+
...state,
|
|
174
|
+
noClassNames,
|
|
175
|
+
dynamicStylesInline: noClassNames,
|
|
176
|
+
hasTextAncestor,
|
|
177
|
+
resolveVariablesAs: "value"
|
|
178
|
+
};
|
|
171
179
|
const splitStyles = (0, import_getSplitStyles.useSplitStyles)(
|
|
172
180
|
props,
|
|
173
181
|
staticConfig,
|
|
@@ -179,24 +187,17 @@ function createComponent(configIn, ParentComponent) {
|
|
|
179
187
|
debugProp
|
|
180
188
|
);
|
|
181
189
|
const hostRef = (0, import_useServerHooks.useServerRef)(null);
|
|
182
|
-
const isReactNative = Boolean(
|
|
183
|
-
staticConfig.isReactNative || isAnimated && tamaguiConfig.animations.isReactNative
|
|
184
|
-
);
|
|
185
190
|
const isAnimatedReactNativeWeb = isAnimated && avoidClassesWhileAnimating;
|
|
186
191
|
if (process.env.NODE_ENV === "development") {
|
|
187
192
|
if (!process.env.TAMAGUI_TARGET) {
|
|
188
193
|
console.error(`No process.env.TAMAGUI_TARGET set, please set it to "native" or "web".`);
|
|
189
194
|
}
|
|
190
195
|
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));
|
|
196
|
+
console.groupCollapsed("props");
|
|
197
|
+
console.log("props in", propsIn, "mapped to", props, "in order", Object.keys(props));
|
|
197
198
|
console.log("splitStyles", splitStyles);
|
|
198
199
|
console.log("className", Object.values(splitStyles.classNames));
|
|
199
|
-
if (
|
|
200
|
+
if (import_constants.isClient) {
|
|
200
201
|
console.log("ref", hostRef, "(click to view)");
|
|
201
202
|
}
|
|
202
203
|
console.groupEnd();
|
|
@@ -213,7 +214,6 @@ function createComponent(configIn, ParentComponent) {
|
|
|
213
214
|
classNames,
|
|
214
215
|
mediaKeys
|
|
215
216
|
} = splitStyles;
|
|
216
|
-
const animationFeatureStylesIn = props.animation ? { ...defaultNativeStyle, ...splitStylesStyle } : null;
|
|
217
217
|
const propsWithAnimation = props;
|
|
218
218
|
let animationStyles;
|
|
219
219
|
if (!import_constants.isRSC && isAnimated && useAnimations) {
|
|
@@ -225,7 +225,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
225
225
|
staticConfig,
|
|
226
226
|
getStyle({ isExiting, isEntering, exitVariant, enterVariant } = {}) {
|
|
227
227
|
var _a2, _b2, _c2, _d2;
|
|
228
|
-
const
|
|
228
|
+
const animationStyle = { ...defaultNativeStyle, ...splitStylesStyle };
|
|
229
229
|
const enterStyle = isEntering ? enterVariant && ((_a2 = staticConfig.variants) == null ? void 0 : _a2[enterVariant]["true"]) ? (0, import_getSplitStyles.getSubStyle)(
|
|
230
230
|
"",
|
|
231
231
|
(_b2 = staticConfig.variants) == null ? void 0 : _b2[enterVariant]["true"],
|
|
@@ -234,7 +234,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
234
234
|
props,
|
|
235
235
|
state,
|
|
236
236
|
tamaguiConfig
|
|
237
|
-
)
|
|
237
|
+
) : null : null;
|
|
238
238
|
const exitStyle = isExiting ? exitVariant && ((_c2 = staticConfig.variants) == null ? void 0 : _c2[exitVariant]["true"]) ? (0, import_getSplitStyles.getSubStyle)(
|
|
239
239
|
"",
|
|
240
240
|
(_d2 = staticConfig.variants) == null ? void 0 : _d2[exitVariant]["true"],
|
|
@@ -243,24 +243,14 @@ function createComponent(configIn, ParentComponent) {
|
|
|
243
243
|
props,
|
|
244
244
|
state,
|
|
245
245
|
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
|
-
}
|
|
246
|
+
) : pseudos.exitStyle : null;
|
|
247
|
+
if (isEntering && enterStyle) {
|
|
248
|
+
merge(animationStyle, enterStyle);
|
|
249
|
+
}
|
|
250
|
+
if (isExiting && exitStyle) {
|
|
251
|
+
merge(animationStyle, exitStyle);
|
|
262
252
|
}
|
|
263
|
-
return
|
|
253
|
+
return animationStyle;
|
|
264
254
|
}
|
|
265
255
|
});
|
|
266
256
|
if (animations) {
|
|
@@ -432,13 +422,6 @@ function createComponent(configIn, ParentComponent) {
|
|
|
432
422
|
};
|
|
433
423
|
} else {
|
|
434
424
|
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
425
|
if (shouldForcePseudo) {
|
|
443
426
|
const next = {};
|
|
444
427
|
for (const style of styles) {
|
|
@@ -512,9 +495,11 @@ function createComponent(configIn, ParentComponent) {
|
|
|
512
495
|
viewProps.style = styles;
|
|
513
496
|
}
|
|
514
497
|
const initialPseudos = initialSplitStyles == null ? void 0 : initialSplitStyles.pseudos;
|
|
515
|
-
const
|
|
498
|
+
const runtimePressStyle = noClassNames && ((pseudos == null ? void 0 : pseudos.pressStyle) || (initialPseudos == null ? void 0 : initialPseudos.pressStyle));
|
|
499
|
+
const attachPress = !!(runtimePressStyle || onPress || onPressOut || onPressIn || onClick);
|
|
516
500
|
const isHoverable = import_constants.isWeb;
|
|
517
|
-
const
|
|
501
|
+
const runtimeHoverStyle = noClassNames && ((pseudos == null ? void 0 : pseudos.hoverStyle) || initialPseudos.hoverStyle);
|
|
502
|
+
const attachHover = isHoverable && !!(runtimeHoverStyle || onHoverIn || onHoverOut || onMouseEnter || onMouseLeave);
|
|
518
503
|
const handlesPressEvents = !import_constants.isWeb && !asChild;
|
|
519
504
|
const shouldAttach = asChild ? false : Boolean(
|
|
520
505
|
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 +510,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
525
510
|
onPressOut == null ? void 0 : onPressOut(e);
|
|
526
511
|
onMouseUp == null ? void 0 : onMouseUp(e);
|
|
527
512
|
} : void 0,
|
|
528
|
-
...
|
|
513
|
+
...attachHover && {
|
|
529
514
|
onMouseEnter: attachHover ? (e) => {
|
|
530
515
|
const next = {};
|
|
531
516
|
if (attachHover) {
|
|
@@ -620,7 +605,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
620
605
|
};
|
|
621
606
|
}
|
|
622
607
|
if (process.env.TAMAGUI_TARGET === "native") {
|
|
623
|
-
const attachFocus = !!(pseudos
|
|
608
|
+
const attachFocus = !!(pseudos.focusStyle || initialPseudos && initialPseudos.focusStyle);
|
|
624
609
|
if (attachFocus) {
|
|
625
610
|
viewProps.onFocus = (0, import_Slot.mergeEvent)(viewProps.onFocus, () => {
|
|
626
611
|
setStateShallow({ focus: true });
|
|
@@ -629,11 +614,8 @@ function createComponent(configIn, ParentComponent) {
|
|
|
629
614
|
setStateShallow({ focus: false });
|
|
630
615
|
});
|
|
631
616
|
}
|
|
632
|
-
const pressability = (0, import_Pressability.usePressability)(events);
|
|
617
|
+
const pressability = (0, import_Pressability.usePressability)(events ? { ...events, hitSlop } : {});
|
|
633
618
|
if (attachPress && events) {
|
|
634
|
-
if (hitSlop) {
|
|
635
|
-
viewProps.hitSlop = hitSlop;
|
|
636
|
-
}
|
|
637
619
|
for (const key in pressability) {
|
|
638
620
|
const og = props[key];
|
|
639
621
|
const val = pressability[key];
|
|
@@ -688,12 +670,12 @@ function createComponent(configIn, ParentComponent) {
|
|
|
688
670
|
press: false,
|
|
689
671
|
pressIn: false,
|
|
690
672
|
focus: false,
|
|
691
|
-
|
|
673
|
+
unmounted: true,
|
|
692
674
|
mediaState: getMediaStateObject((0, import_useMedia.getInitialMediaState)())
|
|
693
675
|
};
|
|
694
676
|
defaultComponentStateMounted = {
|
|
695
677
|
...defaultComponentState,
|
|
696
|
-
|
|
678
|
+
unmounted: false
|
|
697
679
|
};
|
|
698
680
|
}
|
|
699
681
|
if (tamaguiConfig.animations) {
|
|
@@ -733,22 +715,21 @@ function createComponent(configIn, ParentComponent) {
|
|
|
733
715
|
staticConfig,
|
|
734
716
|
initialTheme,
|
|
735
717
|
{
|
|
736
|
-
|
|
718
|
+
unmounted: false,
|
|
737
719
|
hover: false,
|
|
738
720
|
press: false,
|
|
739
721
|
pressIn: false,
|
|
740
722
|
focus: false,
|
|
741
723
|
resolveVariablesAs: "both",
|
|
742
|
-
noClassNames
|
|
743
|
-
keepVariantsAsProps: true
|
|
724
|
+
noClassNames
|
|
744
725
|
},
|
|
745
726
|
void 0,
|
|
746
727
|
void 0,
|
|
747
728
|
debug
|
|
748
729
|
);
|
|
749
|
-
const [
|
|
730
|
+
const [defaults, defaultsClassnames] = (0, import_mergeProps.mergeProps)(
|
|
750
731
|
component.defaultProps,
|
|
751
|
-
initialSplitStyles.viewProps,
|
|
732
|
+
{ ...initialSplitStyles.pseudos, ...initialSplitStyles.viewProps },
|
|
752
733
|
true
|
|
753
734
|
);
|
|
754
735
|
initialSplitStyles.classNames = {
|
|
@@ -764,14 +745,14 @@ function createComponent(configIn, ParentComponent) {
|
|
|
764
745
|
if (import_helpers.validPseudoKeys[key])
|
|
765
746
|
continue;
|
|
766
747
|
if (typeof val === "string" && val[0] === "$" || !validStyles2[key]) {
|
|
767
|
-
|
|
748
|
+
defaults[key] = val;
|
|
768
749
|
} else {
|
|
769
750
|
defaultNativeStyle[key] = val;
|
|
770
751
|
}
|
|
771
752
|
}
|
|
772
753
|
}
|
|
773
|
-
if (Object.keys(
|
|
774
|
-
tamaguiDefaultProps =
|
|
754
|
+
if (Object.keys(defaults).length) {
|
|
755
|
+
tamaguiDefaultProps = defaults;
|
|
775
756
|
}
|
|
776
757
|
if (process.env.NODE_ENV === "development" && debug) {
|
|
777
758
|
if (process.env.IS_STATIC !== "is_static") {
|
|
@@ -780,7 +761,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
780
761
|
initialSplitStyles,
|
|
781
762
|
tamaguiDefaultProps,
|
|
782
763
|
defaultNativeStyle,
|
|
783
|
-
defaults
|
|
764
|
+
defaults,
|
|
784
765
|
defaultPropsIn,
|
|
785
766
|
defaultPropsKeyOrder: Object.keys(staticConfig.defaultProps),
|
|
786
767
|
defaultPropsInKeyOrder: Object.keys(defaultPropsIn).map((k) => [k, defaultPropsIn[k]]),
|
|
@@ -953,15 +934,6 @@ function isUnspaced(child) {
|
|
|
953
934
|
var _a, _b;
|
|
954
935
|
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
936
|
}
|
|
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
937
|
const DefaultProps = /* @__PURE__ */ new Map();
|
|
966
938
|
function mergeConfigDefaultProps(name, props, configDefaults, parentNames, conf) {
|
|
967
939
|
const len = parentNames.length;
|
|
@@ -990,66 +962,13 @@ function mergeConfigDefaultProps(name, props, configDefaults, parentNames, conf)
|
|
|
990
962
|
}
|
|
991
963
|
return props;
|
|
992
964
|
}
|
|
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
965
|
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];
|
|
966
|
+
for (const key in next) {
|
|
967
|
+
const val = next[key];
|
|
968
|
+
if (key in import_helpers.stylePropsTransform) {
|
|
969
|
+
(0, import_mergeTransform.mergeTransform)(base, key, val, true);
|
|
1051
970
|
} else {
|
|
1052
|
-
base
|
|
971
|
+
base[key] = val;
|
|
1053
972
|
}
|
|
1054
973
|
}
|
|
1055
974
|
}
|