@tamagui/core 1.92.1 → 1.93.1
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/hooks/useElementLayout.js +39 -18
- package/dist/cjs/hooks/useElementLayout.js.map +1 -1
- package/dist/cjs/hooks/useElementLayout.native.js +177 -25
- package/dist/cjs/hooks/useElementLayout.native.js.map +2 -2
- package/dist/esm/hooks/useElementLayout.js +39 -18
- package/dist/esm/hooks/useElementLayout.js.map +1 -1
- package/dist/esm/hooks/useElementLayout.mjs +32 -11
- package/dist/esm/hooks/useElementLayout.native.js +176 -25
- package/dist/esm/hooks/useElementLayout.native.js.map +2 -2
- package/dist/native.js +192 -131
- package/dist/native.js.map +2 -2
- package/dist/test.native.js +182 -121
- package/dist/test.native.js.map +2 -2
- package/package.json +7 -7
- package/reset.css +1 -0
- package/src/hooks/useElementLayout.tsx +45 -12
- package/types/hooks/useElementLayout.d.ts +2 -1
- package/types/hooks/useElementLayout.d.ts.map +1 -1
package/dist/test.native.js
CHANGED
|
@@ -2321,12 +2321,16 @@ var require_createVariable_native = __commonJS({
|
|
|
2321
2321
|
writable: !0
|
|
2322
2322
|
}) : obj[key] = value, obj;
|
|
2323
2323
|
}
|
|
2324
|
-
var IS_VAR = "isVar"
|
|
2324
|
+
var IS_VAR = "isVar";
|
|
2325
|
+
function constructCSSVariableName(name) {
|
|
2326
|
+
return "var(--".concat(process.env.TAMAGUI_CSS_VARIABLE_PREFIX || "").concat(name, ")");
|
|
2327
|
+
}
|
|
2328
|
+
var createVariable = function(props) {
|
|
2325
2329
|
var skipHash = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
|
|
2326
2330
|
if (!skipHash && isVariable(props))
|
|
2327
2331
|
return props;
|
|
2328
2332
|
var key = props.key, name = props.name, val = props.val, _obj;
|
|
2329
|
-
return _obj = {}, _define_property2(_obj, IS_VAR, !0), _define_property2(_obj, "key", key), _define_property2(_obj, "name", skipHash ? "" : (0, import_helpers.simpleHash)(name, 40)), _define_property2(_obj, "val", val), _define_property2(_obj, "variable", import_constants.isWeb ? skipHash ?
|
|
2333
|
+
return _obj = {}, _define_property2(_obj, IS_VAR, !0), _define_property2(_obj, "key", key), _define_property2(_obj, "name", skipHash ? "" : (0, import_helpers.simpleHash)(name, 40)), _define_property2(_obj, "val", val), _define_property2(_obj, "variable", import_constants.isWeb ? skipHash ? constructCSSVariableName(name) : createCSSVariable(name) : ""), _obj;
|
|
2330
2334
|
};
|
|
2331
2335
|
function variableToString(vrble) {
|
|
2332
2336
|
var getValue = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
|
|
@@ -2357,7 +2361,7 @@ var require_createVariable_native = __commonJS({
|
|
|
2357
2361
|
}
|
|
2358
2362
|
var createCSSVariable = function(nameProp) {
|
|
2359
2363
|
var includeVar = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, name = (0, import_helpers.simpleHash)(nameProp, 60);
|
|
2360
|
-
return includeVar ?
|
|
2364
|
+
return includeVar ? constructCSSVariableName(name) : name;
|
|
2361
2365
|
};
|
|
2362
2366
|
}
|
|
2363
2367
|
});
|
|
@@ -6220,11 +6224,6 @@ var require_expandStyle_native = __commonJS({
|
|
|
6220
6224
|
});
|
|
6221
6225
|
};
|
|
6222
6226
|
function expandStyle(key, value) {
|
|
6223
|
-
if (0)
|
|
6224
|
-
switch (key) {
|
|
6225
|
-
case "textAlignVertical":
|
|
6226
|
-
case "writingDirection":
|
|
6227
|
-
}
|
|
6228
6227
|
if (import_constants.isAndroid && key === "elevationAndroid")
|
|
6229
6228
|
return [
|
|
6230
6229
|
[
|
|
@@ -7292,22 +7291,8 @@ var require_getSplitStyles_native = __commonJS({
|
|
|
7292
7291
|
viewProps["data-".concat(hyphenate(keyInit1))] = valInit[keyInit1];
|
|
7293
7292
|
continue;
|
|
7294
7293
|
}
|
|
7295
|
-
if (0)
|
|
7294
|
+
if (0)
|
|
7296
7295
|
var didUseKeyInit;
|
|
7297
|
-
if (!isReactNative)
|
|
7298
|
-
switch (keyInit) {
|
|
7299
|
-
case "accessibilityRole":
|
|
7300
|
-
case "accessibilityLabelledBy":
|
|
7301
|
-
case "accessibilityFlowTo":
|
|
7302
|
-
case "accessibilityControls":
|
|
7303
|
-
case "accessibilityDescribedBy":
|
|
7304
|
-
case "accessibilityKeyShortcuts":
|
|
7305
|
-
case "accessibilityLiveRegion":
|
|
7306
|
-
case "accessibilityReadOnly":
|
|
7307
|
-
case "accessibilityRequired":
|
|
7308
|
-
default:
|
|
7309
|
-
}
|
|
7310
|
-
}
|
|
7311
7296
|
var isShorthand = keyInit in shorthands, isVariant = !isValidStyleKeyInit && variants && keyInit in variants, isStyleLikeKey = isShorthand || isValidStyleKeyInit || isVariant, isPseudo = keyInit in import_helpers.validPseudoKeys, isMedia = !isStyleLikeKey && !isPseudo && (0, import_useMedia.isMediaKey)(keyInit), isMediaOrPseudo1 = !!(isMedia || isPseudo), isStyleProp = isValidStyleKeyInit || isMediaOrPseudo1 || isVariant && !styleProps.noExpand || isShorthand;
|
|
7312
7297
|
if (!(isStyleProp && (props.asChild === "except-style" || props.asChild === "except-style-web"))) {
|
|
7313
7298
|
var shouldPassProp = !isStyleProp || // is in parent variants
|
|
@@ -8430,11 +8415,20 @@ var require_createComponent_native = __commonJS({
|
|
|
8430
8415
|
createComponent: function() {
|
|
8431
8416
|
return createComponent;
|
|
8432
8417
|
},
|
|
8418
|
+
isDisabled: function() {
|
|
8419
|
+
return isDisabled;
|
|
8420
|
+
},
|
|
8433
8421
|
mouseUps: function() {
|
|
8434
8422
|
return mouseUps;
|
|
8435
8423
|
},
|
|
8436
8424
|
spacedChildren: function() {
|
|
8437
8425
|
return spacedChildren;
|
|
8426
|
+
},
|
|
8427
|
+
subscribeToContextGroup: function() {
|
|
8428
|
+
return subscribeToContextGroup;
|
|
8429
|
+
},
|
|
8430
|
+
useComponentState: function() {
|
|
8431
|
+
return useComponentState;
|
|
8438
8432
|
}
|
|
8439
8433
|
});
|
|
8440
8434
|
module2.exports = __toCommonJS2(createComponent_exports);
|
|
@@ -8559,7 +8553,80 @@ var require_createComponent_native = __commonJS({
|
|
|
8559
8553
|
return x();
|
|
8560
8554
|
}), mouseUps.clear();
|
|
8561
8555
|
}, addEventListener("mouseup", cancelTouches), addEventListener("touchend", cancelTouches), addEventListener("touchcancel", cancelTouches));
|
|
8562
|
-
var cancelTouches,
|
|
8556
|
+
var cancelTouches, useComponentState = function(props, param, staticConfig, config) {
|
|
8557
|
+
var animationDriver = param.animationDriver, groups = param.groups, _animationDriver_usePresence, useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, stateRef = (0, import_react3.useRef)({}), hasAnimationProp = !!("animation" in props || props.style && hasAnimatedStyleValue(props.style)), supportsCSSVars = animationDriver == null ? void 0 : animationDriver.supportsCSSVars, curStateRef = stateRef.current, willBeAnimatedClient = function() {
|
|
8558
|
+
var next = !!(hasAnimationProp && !staticConfig.isHOC && useAnimations);
|
|
8559
|
+
return !!(next || curStateRef.hasAnimated);
|
|
8560
|
+
}(), willBeAnimated = !import_constants.isServer && willBeAnimatedClient;
|
|
8561
|
+
willBeAnimated && !curStateRef.hasAnimated && (curStateRef.hasAnimated = !0);
|
|
8562
|
+
var isHydrated = config != null && config.disableSSR ? !0 : (0, import_use_did_finish_ssr.useDidFinishSSR)(), presence = willBeAnimated && props.animatePresence !== !1 && (animationDriver == null || (_animationDriver_usePresence = animationDriver.usePresence) === null || _animationDriver_usePresence === void 0 ? void 0 : _animationDriver_usePresence.call(animationDriver)) || null, presenceState = presence == null ? void 0 : presence[2], isExiting = (presenceState == null ? void 0 : presenceState.isPresent) === !1, isEntering = (presenceState == null ? void 0 : presenceState.isPresent) === !0 && presenceState.initial !== !1, hasEnterStyle = !!props.enterStyle, hasRNAnimation = hasAnimationProp && (animationDriver == null ? void 0 : animationDriver.isReactNative), isReactNative = staticConfig.isReactNative, isAnimated = willBeAnimated;
|
|
8563
|
+
!isReactNative && hasRNAnimation && !staticConfig.isHOC && !isHydrated && (isAnimated = !1, curStateRef.willHydrate = !0);
|
|
8564
|
+
var hasEnterState = hasEnterStyle || isEntering, needsToMount = !isHydrated || !curStateRef.host, initialState = hasEnterState ? needsToMount ? import_defaultComponentState.defaultComponentStateShouldEnter : import_defaultComponentState.defaultComponentState : import_defaultComponentState.defaultComponentStateMounted, disabled = isDisabled(props);
|
|
8565
|
+
disabled != null && (initialState.disabled = disabled);
|
|
8566
|
+
var states = (0, import_react3.useState)(initialState), state = props.forceStyle ? _object_spread_props(_object_spread2({}, states[0]), _define_property2({}, props.forceStyle, !0)) : states[0], setState = states[1];
|
|
8567
|
+
disabled !== state.disabled && setState(_object_spread_props(_object_spread2({}, state, import_defaultComponentState.defaultComponentState), {
|
|
8568
|
+
// removes any stale press state etc
|
|
8569
|
+
disabled
|
|
8570
|
+
}));
|
|
8571
|
+
var setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState, disabled, props.debug);
|
|
8572
|
+
if (isHydrated && state.unmounted === "should-enter" && (state.unmounted = !0), presenceState && isAnimated && isHydrated && staticConfig.variants) {
|
|
8573
|
+
var enterVariant = presenceState.enterVariant, exitVariant = presenceState.exitVariant, enterExitVariant = presenceState.enterExitVariant, custom = presenceState.custom;
|
|
8574
|
+
(0, import_isObj.isObj)(custom) && Object.assign(props, custom);
|
|
8575
|
+
var exv = exitVariant ?? enterExitVariant, env = enterVariant ?? enterExitVariant;
|
|
8576
|
+
state.unmounted && env && staticConfig.variants[env] ? props[env] = !0 : isExiting && exv && (props[exv] = exitVariant !== enterExitVariant);
|
|
8577
|
+
}
|
|
8578
|
+
var shouldAvoidClasses = !!(!import_constants.isWeb || isAnimated && !supportsCSSVars || !staticConfig.acceptsClassName || // on server for SSR and animation compat added the && isHydrated but perhaps we want
|
|
8579
|
+
// disableClassName="until-hydrated" to be more straightforward
|
|
8580
|
+
// see issue if not, Button sets disableClassName to true <Button animation="" /> with
|
|
8581
|
+
// the react-native driver errors because it tries to animate var(--color) to rbga(..)
|
|
8582
|
+
props.disableClassName && isHydrated), groupName = props.group;
|
|
8583
|
+
if (groupName && !curStateRef.group) {
|
|
8584
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
8585
|
+
curStateRef.group = {
|
|
8586
|
+
listeners,
|
|
8587
|
+
emit: function(name, state2) {
|
|
8588
|
+
listeners.forEach(function(l) {
|
|
8589
|
+
return l(name, state2);
|
|
8590
|
+
});
|
|
8591
|
+
},
|
|
8592
|
+
subscribe: function(cb) {
|
|
8593
|
+
return listeners.add(cb), function() {
|
|
8594
|
+
listeners.delete(cb);
|
|
8595
|
+
};
|
|
8596
|
+
}
|
|
8597
|
+
};
|
|
8598
|
+
}
|
|
8599
|
+
if (groupName) {
|
|
8600
|
+
var groupContextState = groups.state, og = setStateShallow;
|
|
8601
|
+
setStateShallow = function(state2) {
|
|
8602
|
+
og(state2), curStateRef.group.emit(groupName, {
|
|
8603
|
+
pseudo: state2
|
|
8604
|
+
});
|
|
8605
|
+
var next = _object_spread2({}, groupContextState[groupName], state2);
|
|
8606
|
+
groupContextState[groupName] = next;
|
|
8607
|
+
};
|
|
8608
|
+
}
|
|
8609
|
+
return {
|
|
8610
|
+
curStateRef,
|
|
8611
|
+
disabled,
|
|
8612
|
+
groupName,
|
|
8613
|
+
hasAnimationProp,
|
|
8614
|
+
hasEnterStyle,
|
|
8615
|
+
isAnimated,
|
|
8616
|
+
isExiting,
|
|
8617
|
+
isHydrated,
|
|
8618
|
+
presence,
|
|
8619
|
+
presenceState,
|
|
8620
|
+
setState,
|
|
8621
|
+
setStateShallow,
|
|
8622
|
+
shouldAvoidClasses,
|
|
8623
|
+
state,
|
|
8624
|
+
stateRef,
|
|
8625
|
+
supportsCSSVars,
|
|
8626
|
+
willBeAnimated,
|
|
8627
|
+
willBeAnimatedClient
|
|
8628
|
+
};
|
|
8629
|
+
}, BaseText, BaseView, hasSetupBaseViews = !1, lastInteractionWasKeyboard = {
|
|
8563
8630
|
value: !1
|
|
8564
8631
|
};
|
|
8565
8632
|
import_constants.isWeb && globalThis.document && (document.addEventListener("keydown", function() {
|
|
@@ -8577,8 +8644,8 @@ var require_createComponent_native = __commonJS({
|
|
|
8577
8644
|
defaultForComponent && (defaultProps = _object_spread2({}, defaultForComponent, defaultProps));
|
|
8578
8645
|
}
|
|
8579
8646
|
});
|
|
8580
|
-
var Component = staticConfig.Component, isText = staticConfig.isText,
|
|
8581
|
-
var
|
|
8647
|
+
var Component = staticConfig.Component, isText = staticConfig.isText, isZStack = staticConfig.isZStack, isHOC = staticConfig.isHOC, _staticConfig_validStyles = staticConfig.validStyles, _$validStyles = _staticConfig_validStyles === void 0 ? {} : _staticConfig_validStyles, _staticConfig_variants = staticConfig.variants, variants = _staticConfig_variants === void 0 ? {} : _staticConfig_variants, component = /* @__PURE__ */ (0, import_react3.forwardRef)(function(propsIn, forwardedRef) {
|
|
8648
|
+
var _themeState_state, _hooks_usePropsTransform, _hooks_useEvents, _config_animations, internalID = "";
|
|
8582
8649
|
if (!hasSetupBaseViews) {
|
|
8583
8650
|
var _hooks_getBaseViews;
|
|
8584
8651
|
hasSetupBaseViews = !0;
|
|
@@ -8589,7 +8656,7 @@ var require_createComponent_native = __commonJS({
|
|
|
8589
8656
|
var _propsIn_datatestrenders, _current, _;
|
|
8590
8657
|
(_ = (_propsIn_datatestrenders = propsIn["data-test-renders"])[_current = "current"]) !== null && _ !== void 0 || (_propsIn_datatestrenders[_current] = 0), propsIn["data-test-renders"].current += 1;
|
|
8591
8658
|
}
|
|
8592
|
-
var componentContext = (0, import_react3.useContext)(import_ComponentContext.ComponentContext), styledContextProps, overriddenContextProps, contextValue, context = staticConfig.context;
|
|
8659
|
+
var componentContext = (0, import_react3.useContext)(import_ComponentContext.ComponentContext), styledContextProps, overriddenContextProps, contextValue, context = staticConfig.context, isReactNative = staticConfig.isReactNative;
|
|
8593
8660
|
if (context) {
|
|
8594
8661
|
contextValue = (0, import_react3.useContext)(context);
|
|
8595
8662
|
var inverseShorthands = (0, import_config.getConfig)().inverseShorthands;
|
|
@@ -8609,72 +8676,19 @@ var require_createComponent_native = __commonJS({
|
|
|
8609
8676
|
var debugProp = props.debug, componentName2 = props.componentName || staticConfig.componentName;
|
|
8610
8677
|
if (0)
|
|
8611
8678
|
var timer;
|
|
8612
|
-
var
|
|
8613
|
-
|
|
8614
|
-
return !!(next || curState.hasAnimated);
|
|
8615
|
-
}(), willBeAnimated = !import_constants.isServer && willBeAnimatedClient;
|
|
8616
|
-
willBeAnimated && !curState.hasAnimated && (curState.hasAnimated = !0);
|
|
8617
|
-
var isHydrated = config != null && config.disableSSR ? !0 : (0, import_use_did_finish_ssr.useDidFinishSSR)(), presence = willBeAnimated && props.animatePresence !== !1 && (animationsConfig == null || (_animationsConfig_usePresence = animationsConfig.usePresence) === null || _animationsConfig_usePresence === void 0 ? void 0 : _animationsConfig_usePresence.call(animationsConfig)) || null, presenceState = presence == null ? void 0 : presence[2], isExiting = (presenceState == null ? void 0 : presenceState.isPresent) === !1, isEntering = (presenceState == null ? void 0 : presenceState.isPresent) === !0 && presenceState.initial !== !1, hasEnterStyle = !!props.enterStyle, hasRNAnimation = hasAnimationProp && (animationsConfig == null ? void 0 : animationsConfig.isReactNative), isReactNative = staticConfig.isReactNative, isAnimated = willBeAnimated;
|
|
8618
|
-
!isReactNative && hasRNAnimation && !isHOC && !isHydrated && (isAnimated = !1, curState.willHydrate = !0);
|
|
8619
|
-
var hasEnterState = hasEnterStyle || isEntering, needsToMount = !isHydrated || !curState.host, initialState = hasEnterState ? needsToMount ? import_defaultComponentState.defaultComponentStateShouldEnter : import_defaultComponentState.defaultComponentState : import_defaultComponentState.defaultComponentStateMounted, disabled = props.disabled || ((_props_accessibilityState = props.accessibilityState) === null || _props_accessibilityState === void 0 ? void 0 : _props_accessibilityState.disabled) || props["aria-disabled"] || // @ts-expect-error (comes from core)
|
|
8620
|
-
props.accessibilityDisabled || !1;
|
|
8621
|
-
disabled != null && (initialState.disabled = disabled);
|
|
8622
|
-
var states = (0, import_react3.useState)(initialState), state = props.forceStyle ? _object_spread_props(_object_spread2({}, states[0]), _define_property2({}, props.forceStyle, !0)) : states[0], setState = states[1];
|
|
8623
|
-
disabled !== state.disabled && setState(_object_spread_props(_object_spread2({}, state, import_defaultComponentState.defaultComponentState), {
|
|
8624
|
-
// removes any stale press state etc
|
|
8625
|
-
disabled
|
|
8626
|
-
}));
|
|
8627
|
-
var setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState, disabled, debugProp);
|
|
8628
|
-
if (isHydrated && state.unmounted === "should-enter" && (state.unmounted = !0), presenceState && isAnimated && isHydrated && staticConfig.variants) {
|
|
8629
|
-
var enterVariant = presenceState.enterVariant, exitVariant = presenceState.exitVariant, enterExitVariant = presenceState.enterExitVariant, custom = presenceState.custom;
|
|
8630
|
-
(0, import_isObj.isObj)(custom) && Object.assign(props, custom);
|
|
8631
|
-
var exv = exitVariant ?? enterExitVariant, env = enterVariant ?? enterExitVariant;
|
|
8632
|
-
state.unmounted && env && staticConfig.variants[env] ? props[env] = !0 : isExiting && exv && (props[exv] = exitVariant !== enterExitVariant);
|
|
8633
|
-
}
|
|
8634
|
-
var shouldAvoidClasses = !!(!import_constants.isWeb || isAnimated && !supportsCSSVars || !staticConfig.acceptsClassName || // on server for SSR and animation compat added the && isHydrated but perhaps we want
|
|
8635
|
-
// disableClassName="until-hydrated" to be more straightforward
|
|
8636
|
-
// see issue if not, Button sets disableClassName to true <Button animation="" /> with
|
|
8637
|
-
// the react-native driver errors because it tries to animate var(--color) to rbga(..)
|
|
8638
|
-
propsIn.disableClassName && isHydrated), shouldForcePseudo = !!propsIn.forceStyle, noClassNames = shouldAvoidClasses || shouldForcePseudo, groupName = props.group;
|
|
8639
|
-
if (groupName && !curState.group) {
|
|
8640
|
-
var listeners = /* @__PURE__ */ new Set();
|
|
8641
|
-
curState.group = {
|
|
8642
|
-
listeners,
|
|
8643
|
-
emit: function(name2, state2) {
|
|
8644
|
-
listeners.forEach(function(l) {
|
|
8645
|
-
return l(name2, state2);
|
|
8646
|
-
});
|
|
8647
|
-
},
|
|
8648
|
-
subscribe: function(cb) {
|
|
8649
|
-
return listeners.add(cb), function() {
|
|
8650
|
-
listeners.delete(cb);
|
|
8651
|
-
};
|
|
8652
|
-
}
|
|
8653
|
-
};
|
|
8654
|
-
}
|
|
8655
|
-
if (groupName) {
|
|
8656
|
-
var groupContextState = componentContext.groups.state, og = setStateShallow;
|
|
8657
|
-
setStateShallow = function(state2) {
|
|
8658
|
-
og(state2), curState.group.emit(groupName, {
|
|
8659
|
-
pseudo: state2
|
|
8660
|
-
});
|
|
8661
|
-
var next = _object_spread2({}, groupContextState[groupName], state2);
|
|
8662
|
-
groupContextState[groupName] = next;
|
|
8663
|
-
};
|
|
8664
|
-
}
|
|
8665
|
-
var hasTextAncestor = !!(import_constants.isWeb && isText && componentContext.inText), isTaggable = !Component || typeof Component == "string", tagProp = props.tag, element = import_constants.isWeb && isTaggable && tagProp || Component, BaseTextComponent = BaseText || element || "span", BaseViewComponent = BaseView || element || (hasTextAncestor ? "span" : "div"), elementType = isText ? BaseTextComponent : BaseViewComponent;
|
|
8666
|
-
animationsConfig && isAnimated && (elementType = animationsConfig[isText ? "Text" : "View"] || elementType);
|
|
8679
|
+
var animationDriver = componentContext.animationDriver, useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, _useComponentState = useComponentState(props, componentContext, staticConfig, config), curStateRef = _useComponentState.curStateRef, disabled = _useComponentState.disabled, groupName = _useComponentState.groupName, hasAnimationProp = _useComponentState.hasAnimationProp, hasEnterStyle = _useComponentState.hasEnterStyle, isAnimated = _useComponentState.isAnimated, isExiting = _useComponentState.isExiting, isHydrated = _useComponentState.isHydrated, presence = _useComponentState.presence, presenceState = _useComponentState.presenceState, setState = _useComponentState.setState, setStateShallow = _useComponentState.setStateShallow, shouldAvoidClasses = _useComponentState.shouldAvoidClasses, state = _useComponentState.state, stateRef = _useComponentState.stateRef, supportsCSSVars = _useComponentState.supportsCSSVars, willBeAnimated = _useComponentState.willBeAnimated, willBeAnimatedClient = _useComponentState.willBeAnimatedClient, shouldForcePseudo = !!propsIn.forceStyle, noClassNames = shouldAvoidClasses || shouldForcePseudo, hasTextAncestor = !!(import_constants.isWeb && isText && componentContext.inText), isTaggable = !Component || typeof Component == "string", tagProp = props.tag, element = import_constants.isWeb && isTaggable && tagProp || Component, BaseTextComponent = BaseText || element || "span", BaseViewComponent = BaseView || element || (hasTextAncestor ? "span" : "div"), elementType = isText ? BaseTextComponent : BaseViewComponent;
|
|
8680
|
+
animationDriver && isAnimated && (elementType = animationDriver[isText ? "Text" : "View"] || elementType);
|
|
8667
8681
|
var disableThemeProp = !1, disableTheme = disableThemeProp || isHOC;
|
|
8668
|
-
props.themeShallow && (
|
|
8682
|
+
props.themeShallow && (curStateRef.themeShallow = !0);
|
|
8669
8683
|
var themeStateProps = {
|
|
8670
8684
|
name: props.theme,
|
|
8671
8685
|
componentName: componentName2,
|
|
8672
8686
|
disable: disableTheme,
|
|
8673
|
-
shallow:
|
|
8687
|
+
shallow: curStateRef.themeShallow,
|
|
8674
8688
|
inverse: props.themeInverse,
|
|
8675
8689
|
debug: debugProp
|
|
8676
8690
|
};
|
|
8677
|
-
if (typeof
|
|
8691
|
+
if (typeof curStateRef.isListeningToTheme == "boolean" && (themeStateProps.shouldUpdate = function() {
|
|
8678
8692
|
return stateRef.current.isListeningToTheme;
|
|
8679
8693
|
}), themeStateProps.deopt = willBeAnimated, !1) {
|
|
8680
8694
|
var name, type, dataIs, banner;
|
|
@@ -8695,11 +8709,11 @@ var require_createComponent_native = __commonJS({
|
|
|
8695
8709
|
isExiting,
|
|
8696
8710
|
isAnimated
|
|
8697
8711
|
}, splitStyles = (0, import_getSplitStyles.useSplitStyles)(props, staticConfig, theme, (themeState == null || (_themeState_state = themeState.state) === null || _themeState_state === void 0 ? void 0 : _themeState_state.name) || "", state, styleProps, null, componentContext, elementType, debugProp);
|
|
8698
|
-
if (props.group && props.untilMeasured === "hide" && !
|
|
8712
|
+
if (props.group && props.untilMeasured === "hide" && !curStateRef.hasMeasured) {
|
|
8699
8713
|
var _splitStyles;
|
|
8700
8714
|
(_splitStyles = splitStyles).style || (_splitStyles.style = {}), splitStyles.style.opacity = 0;
|
|
8701
8715
|
}
|
|
8702
|
-
|
|
8716
|
+
curStateRef.isListeningToTheme = splitStyles.dynamicThemeAccess;
|
|
8703
8717
|
var isMediaArray = splitStyles.hasMedia && Array.isArray(splitStyles.hasMedia), shouldListenForMedia = (0, import_createVariable.didGetVariableValue)() || isMediaArray || noClassNames && splitStyles.hasMedia === !0, mediaListeningKeys = isMediaArray ? splitStyles.hasMedia : null;
|
|
8704
8718
|
(0, import_useMedia.setMediaShouldUpdate)(stateRef, {
|
|
8705
8719
|
enabled: shouldListenForMedia,
|
|
@@ -8754,53 +8768,39 @@ var require_createComponent_native = __commonJS({
|
|
|
8754
8768
|
}), !stateRef.current.hasMeasured && props.untilMeasured === "hide" && setState(function(prev) {
|
|
8755
8769
|
return _object_spread2({}, prev);
|
|
8756
8770
|
}), stateRef.current.hasMeasured = !0;
|
|
8757
|
-
})), viewProps = ((_hooks_usePropsTransform = import_setupHooks.hooks.usePropsTransform) === null || _hooks_usePropsTransform === void 0 ? void 0 : _hooks_usePropsTransform.call(import_setupHooks.hooks, elementType, nonTamaguiProps, stateRef,
|
|
8771
|
+
})), viewProps = ((_hooks_usePropsTransform = import_setupHooks.hooks.usePropsTransform) === null || _hooks_usePropsTransform === void 0 ? void 0 : _hooks_usePropsTransform.call(import_setupHooks.hooks, elementType, nonTamaguiProps, stateRef, curStateRef.willHydrate)) || nonTamaguiProps, curStateRef.composedRef || (curStateRef.composedRef = (0, import_compose_refs.composeRefs)(function(x) {
|
|
8758
8772
|
return stateRef.current.host = x;
|
|
8759
|
-
}, forwardedRef)), viewProps.ref =
|
|
8773
|
+
}, forwardedRef)), viewProps.ref = curStateRef.composedRef;
|
|
8760
8774
|
var pseudoGroups = splitStyles.pseudoGroups, mediaGroups = splitStyles.mediaGroups;
|
|
8761
|
-
|
|
8775
|
+
curStateRef.unPress || (curStateRef.unPress = function() {
|
|
8762
8776
|
return setStateShallow({
|
|
8763
8777
|
press: !1,
|
|
8764
8778
|
pressIn: !1
|
|
8765
8779
|
});
|
|
8766
8780
|
});
|
|
8767
|
-
var unPress =
|
|
8781
|
+
var unPress = curStateRef.unPress;
|
|
8768
8782
|
(0, import_react3.useEffect)(function() {
|
|
8769
8783
|
if (!disabled) {
|
|
8770
|
-
if (
|
|
8784
|
+
if (state.unmounted) {
|
|
8771
8785
|
setStateShallow({
|
|
8772
8786
|
unmounted: !1
|
|
8773
8787
|
});
|
|
8774
8788
|
return;
|
|
8775
8789
|
}
|
|
8776
|
-
var
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
|
|
8783
|
-
|
|
8784
|
-
var group = _object_spread_props(_object_spread2({}, state.group), _define_property2({}, name2, current));
|
|
8785
|
-
setStateShallow({
|
|
8786
|
-
group
|
|
8787
|
-
});
|
|
8788
|
-
};
|
|
8789
|
-
if (pseudo && pseudoGroups != null && pseudoGroups.has(name2))
|
|
8790
|
-
Object.assign(current.pseudo, pseudo), persist();
|
|
8791
|
-
else if (layout && mediaGroups) {
|
|
8792
|
-
var mediaState22 = getMediaState(mediaGroups, layout), next = (0, import_createShallowSetState.mergeIfNotShallowEqual)(current.media, mediaState22);
|
|
8793
|
-
next !== current.media && (Object.assign(current.media, next), persist());
|
|
8794
|
-
}
|
|
8795
|
-
});
|
|
8796
|
-
}
|
|
8790
|
+
var dispose = subscribeToContextGroup({
|
|
8791
|
+
disabled,
|
|
8792
|
+
componentContext,
|
|
8793
|
+
setStateShallow,
|
|
8794
|
+
state,
|
|
8795
|
+
mediaGroups,
|
|
8796
|
+
pseudoGroups
|
|
8797
|
+
});
|
|
8797
8798
|
return function() {
|
|
8798
|
-
|
|
8799
|
+
dispose == null || dispose(), mouseUps.delete(unPress);
|
|
8799
8800
|
};
|
|
8800
8801
|
}
|
|
8801
8802
|
}, [
|
|
8802
8803
|
disabled,
|
|
8803
|
-
shouldEnter,
|
|
8804
8804
|
pseudoGroups ? Object.keys(_to_consumable_array(pseudoGroups)).join("") : 0,
|
|
8805
8805
|
mediaGroups ? Object.keys(_to_consumable_array(mediaGroups)).join("") : 0
|
|
8806
8806
|
]);
|
|
@@ -8886,7 +8886,7 @@ var require_createComponent_native = __commonJS({
|
|
|
8886
8886
|
ResetPresence && willBeAnimated && (hasEnterStyle || presenceState) && content && typeof content != "string" && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResetPresence, {
|
|
8887
8887
|
children: content
|
|
8888
8888
|
}));
|
|
8889
|
-
var groupState =
|
|
8889
|
+
var groupState = curStateRef.group, subGroupContext = (0, import_react3.useMemo)(function() {
|
|
8890
8890
|
var _splitStyles_style, _splitStyles_style1;
|
|
8891
8891
|
if (!(!groupState || !groupName))
|
|
8892
8892
|
return groupState.listeners.clear(), _object_spread_props(_object_spread2({}, componentContext.groups), {
|
|
@@ -9098,6 +9098,31 @@ var require_createComponent_native = __commonJS({
|
|
|
9098
9098
|
}
|
|
9099
9099
|
var fromPx = function(val) {
|
|
9100
9100
|
return typeof val != "string" ? val : +val.replace("px", "");
|
|
9101
|
+
}, isDisabled = function(props) {
|
|
9102
|
+
var _props_accessibilityState;
|
|
9103
|
+
return props.disabled || ((_props_accessibilityState = props.accessibilityState) === null || _props_accessibilityState === void 0 ? void 0 : _props_accessibilityState.disabled) || props["aria-disabled"] || props.accessibilityDisabled || !1;
|
|
9104
|
+
}, subscribeToContextGroup = function(param) {
|
|
9105
|
+
var _param_disabled = param.disabled, disabled = _param_disabled === void 0 ? !1 : _param_disabled, setStateShallow = param.setStateShallow, pseudoGroups = param.pseudoGroups, mediaGroups = param.mediaGroups, componentContext = param.componentContext, state = param.state;
|
|
9106
|
+
if (pseudoGroups || mediaGroups) {
|
|
9107
|
+
var _componentContext_groups, current = {
|
|
9108
|
+
pseudo: {},
|
|
9109
|
+
media: {}
|
|
9110
|
+
};
|
|
9111
|
+
return (_componentContext_groups = componentContext.groups) === null || _componentContext_groups === void 0 ? void 0 : _componentContext_groups.subscribe(function(name, param2) {
|
|
9112
|
+
var layout = param2.layout, pseudo = param2.pseudo, persist = function() {
|
|
9113
|
+
var group = _object_spread_props(_object_spread2({}, state.group), _define_property2({}, name, current));
|
|
9114
|
+
setStateShallow({
|
|
9115
|
+
group
|
|
9116
|
+
});
|
|
9117
|
+
};
|
|
9118
|
+
if (pseudo && pseudoGroups != null && pseudoGroups.has(name))
|
|
9119
|
+
Object.assign(current.pseudo, pseudo), persist();
|
|
9120
|
+
else if (layout && mediaGroups) {
|
|
9121
|
+
var mediaState2 = getMediaState(mediaGroups, layout), next = (0, import_createShallowSetState.mergeIfNotShallowEqual)(current.media, mediaState2);
|
|
9122
|
+
next !== current.media && (Object.assign(current.media, next), persist());
|
|
9123
|
+
}
|
|
9124
|
+
});
|
|
9125
|
+
}
|
|
9101
9126
|
};
|
|
9102
9127
|
}
|
|
9103
9128
|
});
|
|
@@ -9524,7 +9549,7 @@ var require_registerCSSVariable_native = __commonJS({
|
|
|
9524
9549
|
tokensValueToVariable.set((0, import_createVariable.getVariableValue)(v), v);
|
|
9525
9550
|
}, variableToCSS = function(v) {
|
|
9526
9551
|
var unitless = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
|
|
9527
|
-
return "--".concat((0, import_createVariable.createCSSVariable)(v.name, !1), ":").concat(!unitless && typeof v.val == "number" ? "".concat(v.val, "px") : v.val);
|
|
9552
|
+
return "--".concat(process.env.TAMAGUI_CSS_VARIABLE_PREFIX || "").concat((0, import_createVariable.createCSSVariable)(v.name, !1), ":").concat(!unitless && typeof v.val == "number" ? "".concat(v.val, "px") : v.val);
|
|
9528
9553
|
}, tokensValueToVariable = /* @__PURE__ */ new Map();
|
|
9529
9554
|
}
|
|
9530
9555
|
});
|
|
@@ -11283,7 +11308,7 @@ var require_useProps_native = __commonJS({
|
|
|
11283
11308
|
}
|
|
11284
11309
|
});
|
|
11285
11310
|
module2.exports = __toCommonJS2(useProps_exports);
|
|
11286
|
-
var import_react3 = require("react"), import_ComponentContext = require_ComponentContext_native(),
|
|
11311
|
+
var import_react3 = require("react"), import_config = require_config_native(), import_ComponentContext = require_ComponentContext_native(), import_createComponent = require_createComponent_native(), import_getSplitStyles = require_getSplitStyles_native(), import_Stack = require_Stack_native(), import_useMedia = require_useMedia_native(), import_useTheme = require_useTheme_native();
|
|
11287
11312
|
function _array_like_to_array(arr, len) {
|
|
11288
11313
|
(len == null || len > arr.length) && (len = arr.length);
|
|
11289
11314
|
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
@@ -11294,6 +11319,10 @@ var require_useProps_native = __commonJS({
|
|
|
11294
11319
|
if (Array.isArray(arr))
|
|
11295
11320
|
return arr;
|
|
11296
11321
|
}
|
|
11322
|
+
function _array_without_holes(arr) {
|
|
11323
|
+
if (Array.isArray(arr))
|
|
11324
|
+
return _array_like_to_array(arr);
|
|
11325
|
+
}
|
|
11297
11326
|
function _define_property2(obj, key, value) {
|
|
11298
11327
|
return key in obj ? Object.defineProperty(obj, key, {
|
|
11299
11328
|
value,
|
|
@@ -11302,6 +11331,10 @@ var require_useProps_native = __commonJS({
|
|
|
11302
11331
|
writable: !0
|
|
11303
11332
|
}) : obj[key] = value, obj;
|
|
11304
11333
|
}
|
|
11334
|
+
function _iterable_to_array(iter) {
|
|
11335
|
+
if ((typeof Symbol > "u" ? "undefined" : _type_of(Symbol)) < "u" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
11336
|
+
return Array.from(iter);
|
|
11337
|
+
}
|
|
11305
11338
|
function _iterable_to_array_limit(arr, i) {
|
|
11306
11339
|
var _i = arr == null ? null : (typeof Symbol > "u" ? "undefined" : _type_of(Symbol)) < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
11307
11340
|
if (_i != null) {
|
|
@@ -11325,6 +11358,9 @@ var require_useProps_native = __commonJS({
|
|
|
11325
11358
|
function _non_iterable_rest() {
|
|
11326
11359
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
11327
11360
|
}
|
|
11361
|
+
function _non_iterable_spread() {
|
|
11362
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
11363
|
+
}
|
|
11328
11364
|
function _object_spread2(target) {
|
|
11329
11365
|
for (var i = 1; i < arguments.length; i++) {
|
|
11330
11366
|
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
@@ -11354,6 +11390,9 @@ var require_useProps_native = __commonJS({
|
|
|
11354
11390
|
function _sliced_to_array(arr, i) {
|
|
11355
11391
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
11356
11392
|
}
|
|
11393
|
+
function _to_consumable_array(arr) {
|
|
11394
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
11395
|
+
}
|
|
11357
11396
|
function _unsupported_iterable_to_array(o, minLen) {
|
|
11358
11397
|
if (o) {
|
|
11359
11398
|
if (typeof o == "string")
|
|
@@ -11379,15 +11418,36 @@ var require_useProps_native = __commonJS({
|
|
|
11379
11418
|
function usePropsAndStyle(props, opts) {
|
|
11380
11419
|
var _opts_forComponent, _themeState_state, _opts_forComponent_staticConfig, staticConfig = (_opts_forComponent_staticConfig = opts == null || (_opts_forComponent = opts.forComponent) === null || _opts_forComponent === void 0 ? void 0 : _opts_forComponent.staticConfig) !== null && _opts_forComponent_staticConfig !== void 0 ? _opts_forComponent_staticConfig : import_Stack.Stack.staticConfig, _useThemeWithState = _sliced_to_array((0, import_useTheme.useThemeWithState)({
|
|
11381
11420
|
componentName: staticConfig.componentName
|
|
11382
|
-
}), 2), themeState = _useThemeWithState[0], theme = _useThemeWithState[1], componentContext = (0, import_react3.useContext)(import_ComponentContext.ComponentContext), media = (0, import_useMedia.useMedia)(), splitStyles = (0, import_getSplitStyles.useSplitStyles)(props, staticConfig, theme, ((_themeState_state = themeState.state) === null || _themeState_state === void 0 ? void 0 : _themeState_state.name) || "",
|
|
11421
|
+
}), 2), themeState = _useThemeWithState[0], theme = _useThemeWithState[1], componentContext = (0, import_react3.useContext)(import_ComponentContext.ComponentContext), _useComponentState = (0, import_createComponent.useComponentState)(props, componentContext, staticConfig, (0, import_config.getConfig)()), state = _useComponentState.state, disabled = _useComponentState.disabled, setStateShallow = _useComponentState.setStateShallow, media = (0, import_useMedia.useMedia)(), splitStyles = (0, import_getSplitStyles.useSplitStyles)(props, staticConfig, theme, ((_themeState_state = themeState.state) === null || _themeState_state === void 0 ? void 0 : _themeState_state.name) || "", state, _object_spread2({
|
|
11383
11422
|
isAnimated: !1,
|
|
11384
11423
|
mediaState: media,
|
|
11385
11424
|
noSkip: !0,
|
|
11386
11425
|
noMergeStyle: !0,
|
|
11387
11426
|
noClassNames: !0,
|
|
11388
11427
|
resolveValues: "auto"
|
|
11389
|
-
}, opts), null, componentContext);
|
|
11390
|
-
return
|
|
11428
|
+
}, opts), null, componentContext), mediaGroups = splitStyles.mediaGroups, pseudoGroups = splitStyles.pseudoGroups;
|
|
11429
|
+
return (0, import_react3.useEffect)(function() {
|
|
11430
|
+
if (!disabled) {
|
|
11431
|
+
if (state.unmounted) {
|
|
11432
|
+
setStateShallow({
|
|
11433
|
+
unmounted: !1
|
|
11434
|
+
});
|
|
11435
|
+
return;
|
|
11436
|
+
}
|
|
11437
|
+
return (0, import_createComponent.subscribeToContextGroup)({
|
|
11438
|
+
disabled,
|
|
11439
|
+
componentContext,
|
|
11440
|
+
setStateShallow,
|
|
11441
|
+
state,
|
|
11442
|
+
mediaGroups,
|
|
11443
|
+
pseudoGroups
|
|
11444
|
+
});
|
|
11445
|
+
}
|
|
11446
|
+
}, [
|
|
11447
|
+
disabled,
|
|
11448
|
+
pseudoGroups ? Object.keys(_to_consumable_array(pseudoGroups)).join("") : 0,
|
|
11449
|
+
mediaGroups ? Object.keys(_to_consumable_array(mediaGroups)).join("") : 0
|
|
11450
|
+
]), [
|
|
11391
11451
|
splitStyles.viewProps,
|
|
11392
11452
|
splitStyles.style || {},
|
|
11393
11453
|
theme,
|
|
@@ -12208,6 +12268,7 @@ var require_index_native9 = __commonJS({
|
|
|
12208
12268
|
__reExport2(src_exports2, require_getExpandedShorthands_native(), module2.exports);
|
|
12209
12269
|
__reExport2(src_exports2, require_getSplitStyles_native(), module2.exports);
|
|
12210
12270
|
__reExport2(src_exports2, require_getStylesAtomic_native(), module2.exports);
|
|
12271
|
+
__reExport2(src_exports2, require_createComponent_native(), module2.exports);
|
|
12211
12272
|
__reExport2(src_exports2, require_getThemeCSSRules_native(), module2.exports);
|
|
12212
12273
|
__reExport2(src_exports2, require_getVariantExtras_native(), module2.exports);
|
|
12213
12274
|
__reExport2(src_exports2, require_isTamaguiComponent_native(), module2.exports);
|