tamagui 1.124.9 → 1.124.11
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/native.js +96 -44
- package/dist/native.js.map +2 -2
- package/dist/test.native.js +60 -36
- package/dist/test.native.js.map +2 -2
- package/package.json +54 -54
package/dist/test.native.js
CHANGED
|
@@ -2010,14 +2010,12 @@ var require_useControllableState_native = __commonJS({
|
|
|
2010
2010
|
var import_use_event = require_index_native8(), React4 = __toESM2(require("react")), import_start_transition = require_index_native9(), emptyCallbackFn = function(_) {
|
|
2011
2011
|
return _();
|
|
2012
2012
|
};
|
|
2013
|
-
function useControllableState(
|
|
2014
|
-
var { prop, defaultProp, onChange, strategy = "prop-wins", preventUpdate, transition } =
|
|
2013
|
+
function useControllableState(param) {
|
|
2014
|
+
var { prop, defaultProp, onChange, strategy = "prop-wins", preventUpdate, transition } = param, [state, setState] = React4.useState(prop ?? defaultProp), previous = React4.useRef(state), propWins = strategy === "prop-wins" && prop !== void 0, value = propWins ? prop : state, onChangeCb = (0, import_use_event.useEvent)(onChange || idFn), transitionFn = transition ? import_start_transition.startTransition : emptyCallbackFn;
|
|
2015
2015
|
React4.useEffect(function() {
|
|
2016
|
-
|
|
2017
|
-
setState(
|
|
2018
|
-
|
|
2019
|
-
});
|
|
2020
|
-
});
|
|
2016
|
+
prop !== void 0 && (previous.current = prop, transitionFn(function() {
|
|
2017
|
+
setState(prop);
|
|
2018
|
+
}));
|
|
2021
2019
|
}, [
|
|
2022
2020
|
prop
|
|
2023
2021
|
]), React4.useEffect(function() {
|
|
@@ -6772,24 +6770,29 @@ var require_createShallowSetState_native = __commonJS({
|
|
|
6772
6770
|
var import_react3 = require("react"), callImmediate = function(cb) {
|
|
6773
6771
|
return cb();
|
|
6774
6772
|
};
|
|
6775
|
-
function createShallowSetState(setter,
|
|
6773
|
+
function createShallowSetState(setter, onlyAllow, transition, debug, callback) {
|
|
6776
6774
|
return (0, import_react3.useCallback)(function(next) {
|
|
6777
6775
|
var wrap = transition ? import_react3.startTransition : callImmediate;
|
|
6778
6776
|
wrap(function() {
|
|
6779
6777
|
setter(function(prev) {
|
|
6780
|
-
var out = mergeIfNotShallowEqual(prev, next,
|
|
6778
|
+
var out = mergeIfNotShallowEqual(prev, next, onlyAllow, debug);
|
|
6781
6779
|
return callback == null || callback(out), out;
|
|
6782
6780
|
});
|
|
6783
6781
|
});
|
|
6784
6782
|
}, [
|
|
6785
6783
|
setter,
|
|
6786
|
-
|
|
6784
|
+
onlyAllow ? onlyAllow.join("") : "",
|
|
6787
6785
|
transition,
|
|
6788
6786
|
debug
|
|
6789
6787
|
]);
|
|
6790
6788
|
}
|
|
6791
|
-
function mergeIfNotShallowEqual(prev, next,
|
|
6792
|
-
|
|
6789
|
+
function mergeIfNotShallowEqual(prev, next, onlyAllow, debug) {
|
|
6790
|
+
if (onlyAllow) {
|
|
6791
|
+
var allowed = {};
|
|
6792
|
+
for (var key in next) onlyAllow.includes(key) && (allowed[key] = next[key]);
|
|
6793
|
+
next = allowed;
|
|
6794
|
+
}
|
|
6795
|
+
return !prev || !next || isEqualShallow(prev, next) ? prev || next : {
|
|
6793
6796
|
...prev,
|
|
6794
6797
|
...next
|
|
6795
6798
|
};
|
|
@@ -6934,16 +6937,17 @@ var require_useThemeState_native = __commonJS({
|
|
|
6934
6937
|
}
|
|
6935
6938
|
});
|
|
6936
6939
|
module2.exports = __toCommonJS2(useThemeState_exports);
|
|
6937
|
-
var import_constants4 = require_index_native6(), import_react3 = require("react"), import_config = require_config_native(), ThemeStateContext = (0, import_react3.createContext)(""), keysToId = /* @__PURE__ */ new WeakMap(), allListeners = /* @__PURE__ */ new Map(), listenersByParent = {}, hasRenderedOnce = /* @__PURE__ */ new WeakMap(), pendingUpdate = /* @__PURE__ */ new Map(), states = /* @__PURE__ */ new Map(), shouldForce = !1, forceUpdateThemes2 = function() {
|
|
6940
|
+
var import_constants4 = require_index_native6(), import_react3 = require("react"), import_config = require_config_native(), ThemeStateContext = (0, import_react3.createContext)(""), keysToId = /* @__PURE__ */ new WeakMap(), allListeners = /* @__PURE__ */ new Map(), listenersByParent = {}, hasRenderedOnce = /* @__PURE__ */ new WeakMap(), pendingUpdate = /* @__PURE__ */ new Map(), states = /* @__PURE__ */ new Map(), localStates = /* @__PURE__ */ new Map(), shouldForce = !1, forceUpdateThemes2 = function() {
|
|
6938
6941
|
cacheVersion++, shouldForce = !0, allListeners.forEach(function(cb) {
|
|
6939
6942
|
return cb();
|
|
6940
6943
|
});
|
|
6941
6944
|
}, getThemeState = function(id) {
|
|
6942
6945
|
return states.get(id);
|
|
6943
|
-
},
|
|
6946
|
+
}, cacheVersion = 0, themes = null, rootThemeState = null, getRootThemeState = function() {
|
|
6944
6947
|
return rootThemeState;
|
|
6945
6948
|
}, useThemeState = function(props) {
|
|
6946
6949
|
var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, keys = arguments.length > 2 ? arguments[2] : void 0, { disable } = props, parentId = (0, import_react3.useContext)(ThemeStateContext);
|
|
6950
|
+
if (!parentId && !isRoot) throw new Error("No parent?");
|
|
6947
6951
|
if (disable) return states.get(parentId) || {
|
|
6948
6952
|
id: "",
|
|
6949
6953
|
name: "light",
|
|
@@ -6955,16 +6959,16 @@ var require_useThemeState_native = __commonJS({
|
|
|
6955
6959
|
return (_listenersByParent = listenersByParent)[_parentId = parentId] || (_listenersByParent[_parentId] = /* @__PURE__ */ new Set()), listenersByParent[parentId].add(id), allListeners.set(id, function() {
|
|
6956
6960
|
pendingUpdate.set(id, shouldForce ? "force" : !0), cb();
|
|
6957
6961
|
}), function() {
|
|
6958
|
-
allListeners.delete(id), listenersByParent[parentId].delete(id);
|
|
6962
|
+
allListeners.delete(id), listenersByParent[parentId].delete(id), localStates.delete(id), states.delete(id), pendingUpdate.delete(id);
|
|
6959
6963
|
};
|
|
6960
6964
|
}, [
|
|
6961
6965
|
id,
|
|
6962
6966
|
parentId
|
|
6963
6967
|
]), propsKey = getPropsKey(props), getSnapshot = function() {
|
|
6964
|
-
var _keys_current, _props_needsUpdate,
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
+
var _keys_current, _props_needsUpdate, local = localStates.get(id), needsUpdate = isRoot || props.name === "light" || props.name === "dark" || props.name === null ? !0 : hasRenderedOnce.get(keys) ? !(keys == null || (_keys_current = keys.current) === null || _keys_current === void 0) && _keys_current.size ? !0 : (_props_needsUpdate = props.needsUpdate) === null || _props_needsUpdate === void 0 ? void 0 : _props_needsUpdate.call(props) : !0, [rerender, next] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, pendingUpdate.get(id));
|
|
6969
|
+
return pendingUpdate.delete(id), (!local || rerender) && (local = {
|
|
6970
|
+
...next
|
|
6971
|
+
}, localStates.set(id, local)), Object.assign(local, next), local.id = id, states.set(id, next), local;
|
|
6968
6972
|
}, state = (0, import_react3.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
|
|
6969
6973
|
return (0, import_constants4.useIsomorphicLayoutEffect)(function() {
|
|
6970
6974
|
if (!hasRenderedOnce.get(keys)) {
|
|
@@ -6979,29 +6983,37 @@ var require_useThemeState_native = __commonJS({
|
|
|
6979
6983
|
}, [
|
|
6980
6984
|
keys,
|
|
6981
6985
|
propsKey
|
|
6982
|
-
]), state
|
|
6983
|
-
|
|
6984
|
-
isNew: !0
|
|
6985
|
-
} : state;
|
|
6986
|
-
}, getSnapshotFrom = function(lastState, props, propsKey) {
|
|
6986
|
+
]), state;
|
|
6987
|
+
}, getNextState = function(lastState, props, propsKey) {
|
|
6987
6988
|
var isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1, id = arguments.length > 4 ? arguments[4] : void 0, parentId = arguments.length > 5 ? arguments[5] : void 0, needsUpdate = arguments.length > 6 ? arguments[6] : void 0, pendingUpdate2 = arguments.length > 7 ? arguments[7] : void 0, { debug } = props, parentState = states.get(parentId);
|
|
6988
6989
|
themes || (themes = (0, import_config.getConfig)().themes);
|
|
6989
|
-
var name = !propsKey &&
|
|
6990
|
+
var name = !propsKey && (!lastState || !(lastState != null && lastState.isNew)) ? null : getNewThemeName(parentState == null ? void 0 : parentState.name, props, pendingUpdate2 === "force" ? !0 : !!needsUpdate), isSameAsParent = parentState && (!name || name === parentState.name), shouldRerender = !!(needsUpdate && (pendingUpdate2 || (lastState == null ? void 0 : lastState.name) !== (parentState == null ? void 0 : parentState.name)));
|
|
6990
6991
|
if (0)
|
|
6991
6992
|
var message;
|
|
6992
|
-
if (
|
|
6993
|
+
if (isSameAsParent) return [
|
|
6994
|
+
shouldRerender,
|
|
6995
|
+
{
|
|
6996
|
+
...parentState,
|
|
6997
|
+
isNew: !1
|
|
6998
|
+
}
|
|
6999
|
+
];
|
|
6993
7000
|
if (!name) {
|
|
6994
7001
|
var next = lastState ?? parentState;
|
|
6995
7002
|
if (!next) throw new Error("No theme and no parent?");
|
|
6996
|
-
if (
|
|
7003
|
+
if (shouldRerender) {
|
|
6997
7004
|
var updated = {
|
|
6998
7005
|
...parentState || lastState
|
|
6999
7006
|
};
|
|
7000
|
-
return
|
|
7007
|
+
return [
|
|
7008
|
+
!0,
|
|
7009
|
+
updated
|
|
7010
|
+
];
|
|
7001
7011
|
}
|
|
7002
|
-
return
|
|
7012
|
+
return [
|
|
7013
|
+
!1,
|
|
7014
|
+
next
|
|
7015
|
+
];
|
|
7003
7016
|
}
|
|
7004
|
-
if (pendingUpdate2 !== "force" && lastState && lastState.name === name) return lastState;
|
|
7005
7017
|
var scheme = getScheme(name), _parentState_inverses, parentInverses = (_parentState_inverses = parentState == null ? void 0 : parentState.inverses) !== null && _parentState_inverses !== void 0 ? _parentState_inverses : 0, isInverse = parentState && scheme !== parentState.scheme, inverses = parentInverses + (isInverse ? 1 : 0), nextState = {
|
|
7006
7018
|
id,
|
|
7007
7019
|
name,
|
|
@@ -7010,11 +7022,21 @@ var require_useThemeState_native = __commonJS({
|
|
|
7010
7022
|
parentId,
|
|
7011
7023
|
parentName: parentState == null ? void 0 : parentState.name,
|
|
7012
7024
|
inverses,
|
|
7013
|
-
isInverse
|
|
7025
|
+
isInverse,
|
|
7026
|
+
isNew: !0
|
|
7014
7027
|
};
|
|
7015
|
-
isRoot && (rootThemeState = nextState)
|
|
7028
|
+
if (isRoot && (rootThemeState = nextState), pendingUpdate2 !== "force" && lastState && lastState.name === name) return [
|
|
7029
|
+
!1,
|
|
7030
|
+
nextState
|
|
7031
|
+
];
|
|
7016
7032
|
var shouldAvoidRerender = pendingUpdate2 !== "force" && lastState && !needsUpdate && nextState.name === lastState.name;
|
|
7017
|
-
return shouldAvoidRerender ?
|
|
7033
|
+
return shouldAvoidRerender ? [
|
|
7034
|
+
!1,
|
|
7035
|
+
nextState
|
|
7036
|
+
] : [
|
|
7037
|
+
!0,
|
|
7038
|
+
nextState
|
|
7039
|
+
];
|
|
7018
7040
|
};
|
|
7019
7041
|
function scheduleUpdate(id) {
|
|
7020
7042
|
for (var queue = [
|
|
@@ -7716,7 +7738,9 @@ var require_useComponentState_native = __commonJS({
|
|
|
7716
7738
|
groupContextState[groupName] = next;
|
|
7717
7739
|
};
|
|
7718
7740
|
}
|
|
7719
|
-
var setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState, disabled
|
|
7741
|
+
var setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState, disabled ? [
|
|
7742
|
+
"disabled"
|
|
7743
|
+
] : void 0, !1, props.debug, setStateWrapper);
|
|
7720
7744
|
if (presenceState && isAnimated && isHydrated && staticConfig.variants) {
|
|
7721
7745
|
var { enterVariant, exitVariant, enterExitVariant, custom } = presenceState;
|
|
7722
7746
|
(0, import_isObj.isObj)(custom) && Object.assign(props, custom);
|
|
@@ -10281,7 +10305,7 @@ var require_useProps_native = __commonJS({
|
|
|
10281
10305
|
resolveValues: "auto",
|
|
10282
10306
|
...opts
|
|
10283
10307
|
}, null, componentContext), { mediaGroups, pseudoGroups } = splitStyles;
|
|
10284
|
-
return import_react3.default.
|
|
10308
|
+
return import_react3.default.useLayoutEffect(function() {
|
|
10285
10309
|
if (!disabled) {
|
|
10286
10310
|
if (state.unmounted) {
|
|
10287
10311
|
setStateShallow({
|
|
@@ -15344,7 +15368,7 @@ var require_constants_native3 = __commonJS({
|
|
|
15344
15368
|
}
|
|
15345
15369
|
});
|
|
15346
15370
|
module2.exports = __toCommonJS2(constants_exports);
|
|
15347
|
-
var import_constants4 = require_index_native6(), _global__IS_FABRIC, IS_FABRIC = typeof global < "u" && !!((_global__IS_FABRIC = global._IS_FABRIC) !== null && _global__IS_FABRIC !== void 0 ? _global__IS_FABRIC : global.nativeFabricUIManager), USE_NATIVE_PORTAL =
|
|
15371
|
+
var import_constants4 = require_index_native6(), _global__IS_FABRIC, IS_FABRIC = typeof global < "u" && !!((_global__IS_FABRIC = global._IS_FABRIC) !== null && _global__IS_FABRIC !== void 0 ? _global__IS_FABRIC : global.nativeFabricUIManager), USE_NATIVE_PORTAL = process.env.TAMAGUI_USE_NATIVE_PORTAL && process.env.TAMAGUI_USE_NATIVE_PORTAL !== "false" ? !0 : !import_constants4.isAndroid && !IS_FABRIC, allPortalHosts = /* @__PURE__ */ new Map(), portalListeners = {};
|
|
15348
15372
|
}
|
|
15349
15373
|
});
|
|
15350
15374
|
|