@tamagui/core 2.2.0 → 2.3.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/.turbo/turbo-build.log +2 -2
- package/dist/native.cjs +66 -17
- package/dist/test.native.cjs +62 -17
- package/package.json +10 -10
package/.turbo/turbo-build.log
CHANGED
package/dist/native.cjs
CHANGED
|
@@ -1011,7 +1011,7 @@ var init_index_native$11 = __esmMin((() => {
|
|
|
1011
1011
|
avoidUpdates = true;
|
|
1012
1012
|
queuedUpdates = /* @__PURE__ */ new Map();
|
|
1013
1013
|
if (ENABLE) {
|
|
1014
|
-
let
|
|
1014
|
+
let ensureRectFetchObserver2 = function() {
|
|
1015
1015
|
if (rectFetchObserver) return rectFetchObserver;
|
|
1016
1016
|
rectFetchObserver = new IntersectionObserver(function(entries) {
|
|
1017
1017
|
lastCallbackDelay = Math.round(performance.now() - rectFetchStartTime);
|
|
@@ -1108,7 +1108,7 @@ var init_index_native$11 = __esmMin((() => {
|
|
|
1108
1108
|
}
|
|
1109
1109
|
}
|
|
1110
1110
|
if (visibleNodes.length > 0) {
|
|
1111
|
-
var io =
|
|
1111
|
+
var io = ensureRectFetchObserver2();
|
|
1112
1112
|
rectFetchStartTime = performance.now();
|
|
1113
1113
|
for (var i = 0; i < visibleNodes.length; i++) io.observe(visibleNodes[i]);
|
|
1114
1114
|
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
@@ -11794,9 +11794,22 @@ var init_constants_native$1 = __esmMin((() => {
|
|
|
11794
11794
|
}[Platform.OS] : void 0) || "native";
|
|
11795
11795
|
}));
|
|
11796
11796
|
//#endregion
|
|
11797
|
+
//#region ../constants/dist/esm/platformDriver.native.js
|
|
11798
|
+
function setupPlatformDriver(driver) {
|
|
11799
|
+
platformDriver = driver;
|
|
11800
|
+
}
|
|
11801
|
+
function getPlatformDriver() {
|
|
11802
|
+
return platformDriver;
|
|
11803
|
+
}
|
|
11804
|
+
var platformDriver;
|
|
11805
|
+
var init_platformDriver_native = __esmMin((() => {
|
|
11806
|
+
platformDriver = null;
|
|
11807
|
+
}));
|
|
11808
|
+
//#endregion
|
|
11797
11809
|
//#region ../constants/dist/esm/index.native.js
|
|
11798
11810
|
var init_index_native$7 = __esmMin((() => {
|
|
11799
11811
|
init_constants_native$1();
|
|
11812
|
+
init_platformDriver_native();
|
|
11800
11813
|
}));
|
|
11801
11814
|
//#endregion
|
|
11802
11815
|
//#region ../web/dist/esm/constants/constants.native.js
|
|
@@ -11891,6 +11904,7 @@ var init_config_native = __esmMin((() => {
|
|
|
11891
11904
|
};
|
|
11892
11905
|
updateConfig = function(key, value) {
|
|
11893
11906
|
var config = getConfigFromGlobalOrLocal();
|
|
11907
|
+
if (!config || !Object.prototype.hasOwnProperty.call(config, key)) return;
|
|
11894
11908
|
Object.assign(config[key], value);
|
|
11895
11909
|
};
|
|
11896
11910
|
getFont = function(name) {
|
|
@@ -13666,10 +13680,17 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
13666
13680
|
ref.current.pressOutTimer = null;
|
|
13667
13681
|
ref.current.longPressTimer = null;
|
|
13668
13682
|
}
|
|
13669
|
-
viewProps.onStartShouldSetResponder
|
|
13670
|
-
|
|
13683
|
+
var userStartShouldSet = viewProps.onStartShouldSetResponder;
|
|
13684
|
+
var userGrant = viewProps.onResponderGrant;
|
|
13685
|
+
var userRelease = viewProps.onResponderRelease;
|
|
13686
|
+
var userTerminate = viewProps.onResponderTerminate;
|
|
13687
|
+
var userTerminationRequest = viewProps.onResponderTerminationRequest;
|
|
13688
|
+
var userMove = viewProps.onResponderMove;
|
|
13689
|
+
viewProps.onStartShouldSetResponder = function(e) {
|
|
13690
|
+
return Boolean(userStartShouldSet === null || userStartShouldSet === void 0 ? void 0 : userStartShouldSet(e)) || !events.disabled;
|
|
13671
13691
|
};
|
|
13672
13692
|
viewProps.onResponderGrant = function(e) {
|
|
13693
|
+
userGrant === null || userGrant === void 0 || userGrant(e);
|
|
13673
13694
|
cleanup();
|
|
13674
13695
|
ref.current.state = "pressing";
|
|
13675
13696
|
if (delayPressIn > 0) ref.current.pressInTimer = setTimeout(function() {
|
|
@@ -13685,6 +13706,7 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
13685
13706
|
}, delayLongPress + delayPressIn);
|
|
13686
13707
|
};
|
|
13687
13708
|
viewProps.onResponderRelease = function(e) {
|
|
13709
|
+
userRelease === null || userRelease === void 0 || userRelease(e);
|
|
13688
13710
|
var wasLongPressed = ref.current.state === "longPressed";
|
|
13689
13711
|
cleanup();
|
|
13690
13712
|
if (ref.current.state === "pressing") activate(e);
|
|
@@ -13696,15 +13718,18 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
13696
13718
|
ref.current.state = "idle";
|
|
13697
13719
|
};
|
|
13698
13720
|
viewProps.onResponderTerminate = function(e) {
|
|
13721
|
+
userTerminate === null || userTerminate === void 0 || userTerminate(e);
|
|
13699
13722
|
cleanup();
|
|
13700
13723
|
if (ref.current.state === "active" || ref.current.state === "longPressed") deactivate(e);
|
|
13701
13724
|
ref.current.state = "idle";
|
|
13702
13725
|
};
|
|
13703
|
-
viewProps.onResponderTerminationRequest = function() {
|
|
13726
|
+
viewProps.onResponderTerminationRequest = function(e) {
|
|
13727
|
+
if (userTerminationRequest) return userTerminationRequest(e);
|
|
13704
13728
|
return events.cancelable !== false;
|
|
13705
13729
|
};
|
|
13706
13730
|
viewProps.onResponderMove = function(e) {
|
|
13707
13731
|
var _events_onPressMove;
|
|
13732
|
+
userMove === null || userMove === void 0 || userMove(e);
|
|
13708
13733
|
(_events_onPressMove = events.onPressMove) === null || _events_onPressMove === void 0 || _events_onPressMove.call(events, e);
|
|
13709
13734
|
};
|
|
13710
13735
|
}
|
|
@@ -14162,11 +14187,11 @@ var init_expandStyle_native = __esmMin((() => {
|
|
|
14162
14187
|
init_parseBorderShorthand_native();
|
|
14163
14188
|
init_parseOutlineShorthand_native();
|
|
14164
14189
|
init_objectSpread2();
|
|
14165
|
-
_loop = function(
|
|
14190
|
+
_loop = function(parent2) {
|
|
14166
14191
|
var _exec;
|
|
14167
14192
|
var _exec_index;
|
|
14168
|
-
var prefix =
|
|
14169
|
-
EXPANSIONS[
|
|
14193
|
+
var prefix = parent2.slice(0, (_exec_index = (_exec = /[A-Z]/.exec(parent2)) === null || _exec === void 0 ? void 0 : _exec.index) !== null && _exec_index !== void 0 ? _exec_index : parent2.length);
|
|
14194
|
+
EXPANSIONS[parent2] = EXPANSIONS[parent2].map(function(k) {
|
|
14170
14195
|
return `${prefix}${k}`;
|
|
14171
14196
|
});
|
|
14172
14197
|
};
|
|
@@ -16230,7 +16255,7 @@ var init_useComponentState_native = __esmMin((() => {
|
|
|
16230
16255
|
init_objectSpread2();
|
|
16231
16256
|
useComponentState = function(props, animationDriver, staticConfig, config) {
|
|
16232
16257
|
"use no memo";
|
|
16233
|
-
var _animationDriver_usePresence;
|
|
16258
|
+
var _getPlatformDriver, _animationDriver_usePresence;
|
|
16234
16259
|
var isHydrated = useDidFinishSSR();
|
|
16235
16260
|
var needsHydration = !useIsClientOnly();
|
|
16236
16261
|
var useAnimations = (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isStub) ? void 0 : animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.useAnimations;
|
|
@@ -16244,8 +16269,9 @@ var init_useComponentState_native = __esmMin((() => {
|
|
|
16244
16269
|
var outputStyle = (_animationDriver_outputStyle = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.outputStyle) !== null && _animationDriver_outputStyle !== void 0 ? _animationDriver_outputStyle : "css";
|
|
16245
16270
|
var curStateRef = stateRef.current;
|
|
16246
16271
|
if (!needsHydration && hasAnimationProp) curStateRef.hasAnimated = true;
|
|
16272
|
+
var platformPseudo = Boolean(!isHOC && useAnimations && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && ((_getPlatformDriver = getPlatformDriver()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo) && ("hoverStyle" in props || "pressStyle" in props || "focusStyle" in props));
|
|
16247
16273
|
var willBeAnimatedClient = function() {
|
|
16248
|
-
return Boolean(!!(hasAnimationProp && !isHOC && useAnimations) || curStateRef.hasAnimated);
|
|
16274
|
+
return Boolean(!!((hasAnimationProp || platformPseudo) && !isHOC && useAnimations) || curStateRef.hasAnimated);
|
|
16249
16275
|
}();
|
|
16250
16276
|
var willBeAnimated = willBeAnimatedClient;
|
|
16251
16277
|
if (willBeAnimated && !curStateRef.hasAnimated) curStateRef.hasAnimated = true;
|
|
@@ -16302,7 +16328,8 @@ var init_useComponentState_native = __esmMin((() => {
|
|
|
16302
16328
|
inputStyle,
|
|
16303
16329
|
outputStyle,
|
|
16304
16330
|
willBeAnimated,
|
|
16305
|
-
willBeAnimatedClient
|
|
16331
|
+
willBeAnimatedClient,
|
|
16332
|
+
platformPseudo
|
|
16306
16333
|
};
|
|
16307
16334
|
};
|
|
16308
16335
|
isDisabled = function(props) {
|
|
@@ -16410,13 +16437,30 @@ function createComponent(staticConfig) {
|
|
|
16410
16437
|
}();
|
|
16411
16438
|
var useAnimations = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.useAnimations;
|
|
16412
16439
|
var componentState = useComponentState(props, (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isStub) ? null : animationDriver, staticConfig, config);
|
|
16413
|
-
var { disabled, groupName, hasAnimationProp, hasEnterStyle, isAnimated, isExiting, isHydrated, presence, presenceState, setState, noClass, state, stateRef, inputStyle, outputStyle, willBeAnimated, willBeAnimatedClient, startedUnhydrated } = componentState;
|
|
16440
|
+
var { disabled, groupName, hasAnimationProp, hasEnterStyle, isAnimated, isExiting, isHydrated, presence, presenceState, setState, noClass, state, stateRef, inputStyle, outputStyle, willBeAnimated, willBeAnimatedClient, platformPseudo, startedUnhydrated } = componentState;
|
|
16414
16441
|
if (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) useIsomorphicLayoutEffect(function() {
|
|
16442
|
+
var emitted = stateRef.current.prevPseudoState;
|
|
16443
|
+
if (emitted && (emitted.hover || emitted.press || emitted.focus)) {
|
|
16444
|
+
var _stateRef_current_updateStyleListener, _stateRef_current;
|
|
16445
|
+
(_stateRef_current_updateStyleListener = (_stateRef_current = stateRef.current).updateStyleListener) === null || _stateRef_current_updateStyleListener === void 0 || _stateRef_current_updateStyleListener.call(_stateRef_current);
|
|
16446
|
+
}
|
|
16415
16447
|
var pendingState = stateRef.current.nextState;
|
|
16416
16448
|
if (!pendingState) return;
|
|
16417
16449
|
stateRef.current.nextState = void 0;
|
|
16418
16450
|
if (!isEqualShallow(state, pendingState)) componentState.setStateShallow(pendingState);
|
|
16419
16451
|
});
|
|
16452
|
+
useIsomorphicLayoutEffect(function() {
|
|
16453
|
+
var _getPlatformDriver;
|
|
16454
|
+
if (!platformPseudo || props.disabled) return;
|
|
16455
|
+
var pseudoDriver = (_getPlatformDriver = getPlatformDriver()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo;
|
|
16456
|
+
var host = stateRef.current.host;
|
|
16457
|
+
if (!pseudoDriver || !host) return;
|
|
16458
|
+
return pseudoDriver.subscribe(host, function(param) {
|
|
16459
|
+
var { hovered } = param;
|
|
16460
|
+
var _stateRef_current_setStateShallow, _stateRef_current;
|
|
16461
|
+
(_stateRef_current_setStateShallow = (_stateRef_current = stateRef.current).setStateShallow) === null || _stateRef_current_setStateShallow === void 0 || _stateRef_current_setStateShallow.call(_stateRef_current, { hover: hovered });
|
|
16462
|
+
});
|
|
16463
|
+
}, [platformPseudo, props.disabled]);
|
|
16420
16464
|
var allGroupContexts = (0, react.useMemo)(function() {
|
|
16421
16465
|
var _stateRef_current_group_listeners, _stateRef_current_group;
|
|
16422
16466
|
if (!groupName || props.passThrough) return groupContextParent;
|
|
@@ -16512,7 +16556,7 @@ function createComponent(staticConfig) {
|
|
|
16512
16556
|
}
|
|
16513
16557
|
}
|
|
16514
16558
|
var hasEnterExitTransition = props.transition && _type_of$1(props.transition) === "object" && !Array.isArray(props.transition) && ("enter" in props.transition || "exit" in props.transition);
|
|
16515
|
-
if (!isPassthrough && (hasAnimationProp || groupName) && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && !hasEnterExitTransition) {
|
|
16559
|
+
if (!isPassthrough && (hasAnimationProp || groupName || platformPseudo) && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && !hasEnterExitTransition) {
|
|
16516
16560
|
let updateGroupListeners2 = function() {
|
|
16517
16561
|
var updatedState = stateRef.current.nextState;
|
|
16518
16562
|
if (groupContext) {
|
|
@@ -16531,9 +16575,11 @@ function createComponent(staticConfig) {
|
|
|
16531
16575
|
var updatedState = stateRef.current.nextState || state;
|
|
16532
16576
|
var mediaState2 = stateRef.current.nextMedia;
|
|
16533
16577
|
var nextStyles = getSplitStyles(props, staticConfig, theme, themeName, updatedState, mediaState2 ? _objectSpread2(_objectSpread2({}, styleProps), {}, { mediaState: mediaState2 }) : styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp, animationDriver);
|
|
16534
|
-
var
|
|
16578
|
+
var _props_transition2;
|
|
16579
|
+
var effectiveTransition2 = resolveEffectivePseudoTransition(stateRef.current.prevPseudoState, updatedState, nextStyles === null || nextStyles === void 0 ? void 0 : nextStyles.pseudoTransitions, (_props_transition2 = props.transition) !== null && _props_transition2 !== void 0 ? _props_transition2 : platformPseudo ? "0ms" : void 0);
|
|
16535
16580
|
stateRef.current.prevPseudoState = extractPseudoState(updatedState);
|
|
16536
|
-
|
|
16581
|
+
var hasActivePseudo = Boolean(updatedState.hover || updatedState.press || updatedState.pressIn || updatedState.focus || updatedState.focusWithin);
|
|
16582
|
+
useStyleListener((nextStyles === null || nextStyles === void 0 ? void 0 : nextStyles.style) || {}, effectiveTransition2, hasActivePseudo);
|
|
16537
16583
|
};
|
|
16538
16584
|
componentContext.mediaEmitListeners = componentContext.mediaEmitListeners || /* @__PURE__ */ new Set();
|
|
16539
16585
|
if (!stateRef.current.mediaEmitCleanup) {
|
|
@@ -16611,7 +16657,8 @@ function createComponent(staticConfig) {
|
|
|
16611
16657
|
var useStyleEmitter = (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) ? function(listener) {
|
|
16612
16658
|
stateRef.current.useStyleListener = listener;
|
|
16613
16659
|
} : void 0;
|
|
16614
|
-
var
|
|
16660
|
+
var _props_transition;
|
|
16661
|
+
var effectiveTransition = resolveEffectivePseudoTransition(stateRef.current.prevPseudoState, state, splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.pseudoTransitions, (_props_transition = props.transition) !== null && _props_transition !== void 0 ? _props_transition : platformPseudo ? "0ms" : void 0);
|
|
16615
16662
|
if (splitStyles) splitStyles.effectiveTransition = effectiveTransition;
|
|
16616
16663
|
stateRef.current.prevPseudoState = extractPseudoState(state);
|
|
16617
16664
|
var animations = useAnimations({
|
|
@@ -16718,7 +16765,7 @@ function createComponent(staticConfig) {
|
|
|
16718
16765
|
var hasDynamicGroupChildren = Boolean(groupName && state.hasDynGroupChildren);
|
|
16719
16766
|
var attachPress = Boolean(hasDynamicGroupChildren || runtimePressStyle || onPress || onPressOut || onPressIn || onMouseDown || onMouseUp || onLongPress || onClick || (pseudos === null || pseudos === void 0 ? void 0 : pseudos.focusVisibleStyle));
|
|
16720
16767
|
var runtimeHoverStyle = !disabled && noClass && (pseudos === null || pseudos === void 0 ? void 0 : pseudos.hoverStyle);
|
|
16721
|
-
var needsHoverState = Boolean(hasDynamicGroupChildren || runtimeHoverStyle);
|
|
16768
|
+
var needsHoverState = Boolean(hasDynamicGroupChildren || runtimeHoverStyle && !platformPseudo);
|
|
16722
16769
|
var attachHover = isNativeDesktop && !!(hasDynamicGroupChildren || needsHoverState || onMouseEnter || onMouseLeave);
|
|
16723
16770
|
var shouldAttach = !disabled && !props.asChild && Boolean(attachFocus || attachPress || attachHover || runtimePressStyle || runtimeHoverStyle || runtimeFocusStyle);
|
|
16724
16771
|
var needsPressState = Boolean(hasDynamicGroupChildren || runtimePressStyle);
|
|
@@ -18851,6 +18898,7 @@ exports.getExpandedShorthands = getExpandedShorthands;
|
|
|
18851
18898
|
exports.getFontFamilyFromNameOrVariable = getFontFamilyFromNameOrVariable;
|
|
18852
18899
|
exports.getFontsForLanguage = getFontsForLanguage;
|
|
18853
18900
|
exports.getMedia = getMedia;
|
|
18901
|
+
exports.getPlatformDriver = getPlatformDriver;
|
|
18854
18902
|
exports.getReactNativeConfig = getReactNativeConfig;
|
|
18855
18903
|
exports.getRgba = getRgba;
|
|
18856
18904
|
exports.getSetting = getSetting;
|
|
@@ -18937,6 +18985,7 @@ exports.setRef = setRef;
|
|
|
18937
18985
|
exports.setupDev = setupDev;
|
|
18938
18986
|
exports.setupHooks = setupHooks;
|
|
18939
18987
|
exports.setupMatchMedia = setupMatchMedia;
|
|
18988
|
+
exports.setupPlatformDriver = setupPlatformDriver;
|
|
18940
18989
|
exports.shouldRenderNativePlatform = shouldRenderNativePlatform;
|
|
18941
18990
|
exports.simpleHash = simpleHash;
|
|
18942
18991
|
exports.styleOriginalValues = styleOriginalValues;
|
package/dist/test.native.cjs
CHANGED
|
@@ -346,6 +346,15 @@ var currentPlatform = ((react_native.Platform === null || react_native.Platform
|
|
|
346
346
|
windows: "windows"
|
|
347
347
|
}[react_native.Platform.OS] : void 0) || "native";
|
|
348
348
|
//#endregion
|
|
349
|
+
//#region ../constants/dist/esm/platformDriver.native.js
|
|
350
|
+
var platformDriver = null;
|
|
351
|
+
function setupPlatformDriver(driver) {
|
|
352
|
+
platformDriver = driver;
|
|
353
|
+
}
|
|
354
|
+
function getPlatformDriver() {
|
|
355
|
+
return platformDriver;
|
|
356
|
+
}
|
|
357
|
+
//#endregion
|
|
349
358
|
//#region ../web/dist/esm/constants/constants.native.js
|
|
350
359
|
var THEME_NAME_SEPARATOR = "_";
|
|
351
360
|
var THEME_CLASSNAME_PREFIX = "t_";
|
|
@@ -423,6 +432,7 @@ var getThemes = function() {
|
|
|
423
432
|
};
|
|
424
433
|
var updateConfig = function(key, value) {
|
|
425
434
|
var config = getConfigFromGlobalOrLocal();
|
|
435
|
+
if (!config || !Object.prototype.hasOwnProperty.call(config, key)) return;
|
|
426
436
|
Object.assign(config[key], value);
|
|
427
437
|
};
|
|
428
438
|
var getFont = function(name) {
|
|
@@ -2083,10 +2093,17 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
2083
2093
|
ref.current.pressOutTimer = null;
|
|
2084
2094
|
ref.current.longPressTimer = null;
|
|
2085
2095
|
}
|
|
2086
|
-
viewProps.onStartShouldSetResponder
|
|
2087
|
-
|
|
2096
|
+
var userStartShouldSet = viewProps.onStartShouldSetResponder;
|
|
2097
|
+
var userGrant = viewProps.onResponderGrant;
|
|
2098
|
+
var userRelease = viewProps.onResponderRelease;
|
|
2099
|
+
var userTerminate = viewProps.onResponderTerminate;
|
|
2100
|
+
var userTerminationRequest = viewProps.onResponderTerminationRequest;
|
|
2101
|
+
var userMove = viewProps.onResponderMove;
|
|
2102
|
+
viewProps.onStartShouldSetResponder = function(e) {
|
|
2103
|
+
return Boolean(userStartShouldSet === null || userStartShouldSet === void 0 ? void 0 : userStartShouldSet(e)) || !events.disabled;
|
|
2088
2104
|
};
|
|
2089
2105
|
viewProps.onResponderGrant = function(e) {
|
|
2106
|
+
userGrant === null || userGrant === void 0 || userGrant(e);
|
|
2090
2107
|
cleanup();
|
|
2091
2108
|
ref.current.state = "pressing";
|
|
2092
2109
|
if (delayPressIn > 0) ref.current.pressInTimer = setTimeout(function() {
|
|
@@ -2102,6 +2119,7 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
2102
2119
|
}, delayLongPress + delayPressIn);
|
|
2103
2120
|
};
|
|
2104
2121
|
viewProps.onResponderRelease = function(e) {
|
|
2122
|
+
userRelease === null || userRelease === void 0 || userRelease(e);
|
|
2105
2123
|
var wasLongPressed = ref.current.state === "longPressed";
|
|
2106
2124
|
cleanup();
|
|
2107
2125
|
if (ref.current.state === "pressing") activate(e);
|
|
@@ -2113,15 +2131,18 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
2113
2131
|
ref.current.state = "idle";
|
|
2114
2132
|
};
|
|
2115
2133
|
viewProps.onResponderTerminate = function(e) {
|
|
2134
|
+
userTerminate === null || userTerminate === void 0 || userTerminate(e);
|
|
2116
2135
|
cleanup();
|
|
2117
2136
|
if (ref.current.state === "active" || ref.current.state === "longPressed") deactivate(e);
|
|
2118
2137
|
ref.current.state = "idle";
|
|
2119
2138
|
};
|
|
2120
|
-
viewProps.onResponderTerminationRequest = function() {
|
|
2139
|
+
viewProps.onResponderTerminationRequest = function(e) {
|
|
2140
|
+
if (userTerminationRequest) return userTerminationRequest(e);
|
|
2121
2141
|
return events.cancelable !== false;
|
|
2122
2142
|
};
|
|
2123
2143
|
viewProps.onResponderMove = function(e) {
|
|
2124
2144
|
var _events_onPressMove;
|
|
2145
|
+
userMove === null || userMove === void 0 || userMove(e);
|
|
2125
2146
|
(_events_onPressMove = events.onPressMove) === null || _events_onPressMove === void 0 || _events_onPressMove.call(events, e);
|
|
2126
2147
|
};
|
|
2127
2148
|
}
|
|
@@ -2761,11 +2782,11 @@ function parseOutlineShorthand(value) {
|
|
|
2761
2782
|
}
|
|
2762
2783
|
//#endregion
|
|
2763
2784
|
//#region ../web/dist/esm/helpers/expandStyle.native.js
|
|
2764
|
-
var _loop = function(
|
|
2785
|
+
var _loop = function(parent2) {
|
|
2765
2786
|
var _exec;
|
|
2766
2787
|
var _exec_index;
|
|
2767
|
-
var prefix =
|
|
2768
|
-
EXPANSIONS[
|
|
2788
|
+
var prefix = parent2.slice(0, (_exec_index = (_exec = /[A-Z]/.exec(parent2)) === null || _exec === void 0 ? void 0 : _exec.index) !== null && _exec_index !== void 0 ? _exec_index : parent2.length);
|
|
2789
|
+
EXPANSIONS[parent2] = EXPANSIONS[parent2].map(function(k) {
|
|
2769
2790
|
return `${prefix}${k}`;
|
|
2770
2791
|
});
|
|
2771
2792
|
};
|
|
@@ -4701,7 +4722,7 @@ function _type_of$2(obj) {
|
|
|
4701
4722
|
}
|
|
4702
4723
|
var useComponentState = function(props, animationDriver, staticConfig, config) {
|
|
4703
4724
|
"use no memo";
|
|
4704
|
-
var _animationDriver_usePresence;
|
|
4725
|
+
var _getPlatformDriver, _animationDriver_usePresence;
|
|
4705
4726
|
var isHydrated = useDidFinishSSR();
|
|
4706
4727
|
var needsHydration = !useIsClientOnly();
|
|
4707
4728
|
var useAnimations = (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isStub) ? void 0 : animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.useAnimations;
|
|
@@ -4715,8 +4736,9 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
|
|
|
4715
4736
|
var outputStyle = (_animationDriver_outputStyle = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.outputStyle) !== null && _animationDriver_outputStyle !== void 0 ? _animationDriver_outputStyle : "css";
|
|
4716
4737
|
var curStateRef = stateRef.current;
|
|
4717
4738
|
if (!needsHydration && hasAnimationProp) curStateRef.hasAnimated = true;
|
|
4739
|
+
var platformPseudo = Boolean(!isHOC && useAnimations && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && ((_getPlatformDriver = getPlatformDriver()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo) && ("hoverStyle" in props || "pressStyle" in props || "focusStyle" in props));
|
|
4718
4740
|
var willBeAnimatedClient = function() {
|
|
4719
|
-
return Boolean(!!(hasAnimationProp && !isHOC && useAnimations) || curStateRef.hasAnimated);
|
|
4741
|
+
return Boolean(!!((hasAnimationProp || platformPseudo) && !isHOC && useAnimations) || curStateRef.hasAnimated);
|
|
4720
4742
|
}();
|
|
4721
4743
|
var willBeAnimated = willBeAnimatedClient;
|
|
4722
4744
|
if (willBeAnimated && !curStateRef.hasAnimated) curStateRef.hasAnimated = true;
|
|
@@ -4773,7 +4795,8 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
|
|
|
4773
4795
|
inputStyle,
|
|
4774
4796
|
outputStyle,
|
|
4775
4797
|
willBeAnimated,
|
|
4776
|
-
willBeAnimatedClient
|
|
4798
|
+
willBeAnimatedClient,
|
|
4799
|
+
platformPseudo
|
|
4777
4800
|
};
|
|
4778
4801
|
};
|
|
4779
4802
|
function hasAnimatedStyleValue(style) {
|
|
@@ -4924,13 +4947,30 @@ function createComponent(staticConfig) {
|
|
|
4924
4947
|
}();
|
|
4925
4948
|
var useAnimations = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.useAnimations;
|
|
4926
4949
|
var componentState = useComponentState(props, (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isStub) ? null : animationDriver, staticConfig, config);
|
|
4927
|
-
var { disabled, groupName, hasAnimationProp, hasEnterStyle, isAnimated, isExiting, isHydrated, presence, presenceState, setState, noClass, state, stateRef, inputStyle, outputStyle, willBeAnimated, willBeAnimatedClient, startedUnhydrated } = componentState;
|
|
4950
|
+
var { disabled, groupName, hasAnimationProp, hasEnterStyle, isAnimated, isExiting, isHydrated, presence, presenceState, setState, noClass, state, stateRef, inputStyle, outputStyle, willBeAnimated, willBeAnimatedClient, platformPseudo, startedUnhydrated } = componentState;
|
|
4928
4951
|
if (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) useIsomorphicLayoutEffect(function() {
|
|
4952
|
+
var emitted = stateRef.current.prevPseudoState;
|
|
4953
|
+
if (emitted && (emitted.hover || emitted.press || emitted.focus)) {
|
|
4954
|
+
var _stateRef_current_updateStyleListener, _stateRef_current;
|
|
4955
|
+
(_stateRef_current_updateStyleListener = (_stateRef_current = stateRef.current).updateStyleListener) === null || _stateRef_current_updateStyleListener === void 0 || _stateRef_current_updateStyleListener.call(_stateRef_current);
|
|
4956
|
+
}
|
|
4929
4957
|
var pendingState = stateRef.current.nextState;
|
|
4930
4958
|
if (!pendingState) return;
|
|
4931
4959
|
stateRef.current.nextState = void 0;
|
|
4932
4960
|
if (!isEqualShallow(state, pendingState)) componentState.setStateShallow(pendingState);
|
|
4933
4961
|
});
|
|
4962
|
+
useIsomorphicLayoutEffect(function() {
|
|
4963
|
+
var _getPlatformDriver;
|
|
4964
|
+
if (!platformPseudo || props.disabled) return;
|
|
4965
|
+
var pseudoDriver = (_getPlatformDriver = getPlatformDriver()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo;
|
|
4966
|
+
var host = stateRef.current.host;
|
|
4967
|
+
if (!pseudoDriver || !host) return;
|
|
4968
|
+
return pseudoDriver.subscribe(host, function(param) {
|
|
4969
|
+
var { hovered } = param;
|
|
4970
|
+
var _stateRef_current_setStateShallow, _stateRef_current;
|
|
4971
|
+
(_stateRef_current_setStateShallow = (_stateRef_current = stateRef.current).setStateShallow) === null || _stateRef_current_setStateShallow === void 0 || _stateRef_current_setStateShallow.call(_stateRef_current, { hover: hovered });
|
|
4972
|
+
});
|
|
4973
|
+
}, [platformPseudo, props.disabled]);
|
|
4934
4974
|
var allGroupContexts = (0, react.useMemo)(function() {
|
|
4935
4975
|
var _stateRef_current_group_listeners, _stateRef_current_group;
|
|
4936
4976
|
if (!groupName || props.passThrough) return groupContextParent;
|
|
@@ -5026,7 +5066,7 @@ function createComponent(staticConfig) {
|
|
|
5026
5066
|
}
|
|
5027
5067
|
}
|
|
5028
5068
|
var hasEnterExitTransition = props.transition && _type_of$1(props.transition) === "object" && !Array.isArray(props.transition) && ("enter" in props.transition || "exit" in props.transition);
|
|
5029
|
-
if (!isPassthrough && (hasAnimationProp || groupName) && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && !hasEnterExitTransition) {
|
|
5069
|
+
if (!isPassthrough && (hasAnimationProp || groupName || platformPseudo) && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && !hasEnterExitTransition) {
|
|
5030
5070
|
let updateGroupListeners2 = function() {
|
|
5031
5071
|
var updatedState = stateRef.current.nextState;
|
|
5032
5072
|
if (groupContext) {
|
|
@@ -5045,9 +5085,11 @@ function createComponent(staticConfig) {
|
|
|
5045
5085
|
var updatedState = stateRef.current.nextState || state;
|
|
5046
5086
|
var mediaState2 = stateRef.current.nextMedia;
|
|
5047
5087
|
var nextStyles = getSplitStyles(props, staticConfig, theme, themeName, updatedState, mediaState2 ? _objectSpread2(_objectSpread2({}, styleProps), {}, { mediaState: mediaState2 }) : styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp, animationDriver);
|
|
5048
|
-
var
|
|
5088
|
+
var _props_transition2;
|
|
5089
|
+
var effectiveTransition2 = resolveEffectivePseudoTransition(stateRef.current.prevPseudoState, updatedState, nextStyles === null || nextStyles === void 0 ? void 0 : nextStyles.pseudoTransitions, (_props_transition2 = props.transition) !== null && _props_transition2 !== void 0 ? _props_transition2 : platformPseudo ? "0ms" : void 0);
|
|
5049
5090
|
stateRef.current.prevPseudoState = extractPseudoState(updatedState);
|
|
5050
|
-
|
|
5091
|
+
var hasActivePseudo = Boolean(updatedState.hover || updatedState.press || updatedState.pressIn || updatedState.focus || updatedState.focusWithin);
|
|
5092
|
+
useStyleListener((nextStyles === null || nextStyles === void 0 ? void 0 : nextStyles.style) || {}, effectiveTransition2, hasActivePseudo);
|
|
5051
5093
|
};
|
|
5052
5094
|
componentContext.mediaEmitListeners = componentContext.mediaEmitListeners || /* @__PURE__ */ new Set();
|
|
5053
5095
|
if (!stateRef.current.mediaEmitCleanup) {
|
|
@@ -5125,7 +5167,8 @@ function createComponent(staticConfig) {
|
|
|
5125
5167
|
var useStyleEmitter = (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) ? function(listener) {
|
|
5126
5168
|
stateRef.current.useStyleListener = listener;
|
|
5127
5169
|
} : void 0;
|
|
5128
|
-
var
|
|
5170
|
+
var _props_transition;
|
|
5171
|
+
var effectiveTransition = resolveEffectivePseudoTransition(stateRef.current.prevPseudoState, state, splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.pseudoTransitions, (_props_transition = props.transition) !== null && _props_transition !== void 0 ? _props_transition : platformPseudo ? "0ms" : void 0);
|
|
5129
5172
|
if (splitStyles) splitStyles.effectiveTransition = effectiveTransition;
|
|
5130
5173
|
stateRef.current.prevPseudoState = extractPseudoState(state);
|
|
5131
5174
|
var animations = useAnimations({
|
|
@@ -5232,7 +5275,7 @@ function createComponent(staticConfig) {
|
|
|
5232
5275
|
var hasDynamicGroupChildren = Boolean(groupName && state.hasDynGroupChildren);
|
|
5233
5276
|
var attachPress = Boolean(hasDynamicGroupChildren || runtimePressStyle || onPress || onPressOut || onPressIn || onMouseDown || onMouseUp || onLongPress || onClick || (pseudos === null || pseudos === void 0 ? void 0 : pseudos.focusVisibleStyle));
|
|
5234
5277
|
var runtimeHoverStyle = !disabled && noClass && (pseudos === null || pseudos === void 0 ? void 0 : pseudos.hoverStyle);
|
|
5235
|
-
var needsHoverState = Boolean(hasDynamicGroupChildren || runtimeHoverStyle);
|
|
5278
|
+
var needsHoverState = Boolean(hasDynamicGroupChildren || runtimeHoverStyle && !platformPseudo);
|
|
5236
5279
|
var attachHover = isNativeDesktop && !!(hasDynamicGroupChildren || needsHoverState || onMouseEnter || onMouseLeave);
|
|
5237
5280
|
var shouldAttach = !disabled && !props.asChild && Boolean(attachFocus || attachPress || attachHover || runtimePressStyle || runtimeHoverStyle || runtimeFocusStyle);
|
|
5238
5281
|
var needsPressState = Boolean(hasDynamicGroupChildren || runtimePressStyle);
|
|
@@ -6882,7 +6925,7 @@ function rectsEqual(a, b) {
|
|
|
6882
6925
|
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
6883
6926
|
}
|
|
6884
6927
|
if (ENABLE) {
|
|
6885
|
-
let
|
|
6928
|
+
let ensureRectFetchObserver2 = function() {
|
|
6886
6929
|
if (rectFetchObserver) return rectFetchObserver;
|
|
6887
6930
|
rectFetchObserver = new IntersectionObserver(function(entries) {
|
|
6888
6931
|
lastCallbackDelay = Math.round(performance.now() - rectFetchStartTime);
|
|
@@ -6979,7 +7022,7 @@ if (ENABLE) {
|
|
|
6979
7022
|
}
|
|
6980
7023
|
}
|
|
6981
7024
|
if (visibleNodes.length > 0) {
|
|
6982
|
-
var io =
|
|
7025
|
+
var io = ensureRectFetchObserver2();
|
|
6983
7026
|
rectFetchStartTime = performance.now();
|
|
6984
7027
|
for (var i = 0; i < visibleNodes.length; i++) io.observe(visibleNodes[i]);
|
|
6985
7028
|
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
@@ -7193,6 +7236,7 @@ exports.getExpandedShorthands = getExpandedShorthands;
|
|
|
7193
7236
|
exports.getFontFamilyFromNameOrVariable = getFontFamilyFromNameOrVariable;
|
|
7194
7237
|
exports.getFontsForLanguage = getFontsForLanguage;
|
|
7195
7238
|
exports.getMedia = getMedia;
|
|
7239
|
+
exports.getPlatformDriver = getPlatformDriver;
|
|
7196
7240
|
exports.getReactNativeConfig = getReactNativeConfig;
|
|
7197
7241
|
exports.getRgba = getRgba;
|
|
7198
7242
|
exports.getSetting = getSetting;
|
|
@@ -7279,6 +7323,7 @@ exports.setRef = setRef;
|
|
|
7279
7323
|
exports.setupDev = setupDev;
|
|
7280
7324
|
exports.setupHooks = setupHooks;
|
|
7281
7325
|
exports.setupMatchMedia = setupMatchMedia;
|
|
7326
|
+
exports.setupPlatformDriver = setupPlatformDriver;
|
|
7282
7327
|
exports.shouldRenderNativePlatform = shouldRenderNativePlatform;
|
|
7283
7328
|
exports.simpleHash = simpleHash;
|
|
7284
7329
|
exports.styleOriginalValues = styleOriginalValues;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -79,17 +79,17 @@
|
|
|
79
79
|
"clean:build": "tamagui-build clean:build"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@tamagui/helpers": "2.
|
|
83
|
-
"@tamagui/react-native-media-driver": "2.
|
|
84
|
-
"@tamagui/react-native-use-pressable": "2.
|
|
85
|
-
"@tamagui/use-element-layout": "2.
|
|
86
|
-
"@tamagui/use-event": "2.
|
|
87
|
-
"@tamagui/web": "2.
|
|
82
|
+
"@tamagui/helpers": "2.3.1",
|
|
83
|
+
"@tamagui/react-native-media-driver": "2.3.1",
|
|
84
|
+
"@tamagui/react-native-use-pressable": "2.3.1",
|
|
85
|
+
"@tamagui/use-element-layout": "2.3.1",
|
|
86
|
+
"@tamagui/use-event": "2.3.1",
|
|
87
|
+
"@tamagui/web": "2.3.1"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
|
-
"@tamagui/build": "2.
|
|
91
|
-
"@tamagui/native-bundle": "2.
|
|
92
|
-
"@tamagui/react-native-web-lite": "2.
|
|
90
|
+
"@tamagui/build": "2.3.1",
|
|
91
|
+
"@tamagui/native-bundle": "2.3.1",
|
|
92
|
+
"@tamagui/react-native-web-lite": "2.3.1",
|
|
93
93
|
"@testing-library/react": "^16.1.0",
|
|
94
94
|
"csstype": "^3.0.10",
|
|
95
95
|
"react": ">=19",
|