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/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() {
|
|
@@ -7151,24 +7149,29 @@ var require_createShallowSetState_native = __commonJS({
|
|
|
7151
7149
|
var import_react3 = require("react"), callImmediate = function(cb) {
|
|
7152
7150
|
return cb();
|
|
7153
7151
|
};
|
|
7154
|
-
function createShallowSetState(setter,
|
|
7152
|
+
function createShallowSetState(setter, onlyAllow, transition, debug, callback) {
|
|
7155
7153
|
return (0, import_react3.useCallback)(function(next) {
|
|
7156
7154
|
var wrap = transition ? import_react3.startTransition : callImmediate;
|
|
7157
7155
|
wrap(function() {
|
|
7158
7156
|
setter(function(prev) {
|
|
7159
|
-
var out = mergeIfNotShallowEqual(prev, next,
|
|
7157
|
+
var out = mergeIfNotShallowEqual(prev, next, onlyAllow, debug);
|
|
7160
7158
|
return callback == null || callback(out), out;
|
|
7161
7159
|
});
|
|
7162
7160
|
});
|
|
7163
7161
|
}, [
|
|
7164
7162
|
setter,
|
|
7165
|
-
|
|
7163
|
+
onlyAllow ? onlyAllow.join("") : "",
|
|
7166
7164
|
transition,
|
|
7167
7165
|
debug
|
|
7168
7166
|
]);
|
|
7169
7167
|
}
|
|
7170
|
-
function mergeIfNotShallowEqual(prev, next,
|
|
7171
|
-
if (
|
|
7168
|
+
function mergeIfNotShallowEqual(prev, next, onlyAllow, debug) {
|
|
7169
|
+
if (onlyAllow) {
|
|
7170
|
+
var allowed = {};
|
|
7171
|
+
for (var key in next) onlyAllow.includes(key) && (allowed[key] = next[key]);
|
|
7172
|
+
next = allowed;
|
|
7173
|
+
}
|
|
7174
|
+
if (!prev || !next || isEqualShallow(prev, next)) return prev || next;
|
|
7172
7175
|
if (process.env.NODE_ENV === "development" && debug && (console.info("setStateShallow CHANGE", {
|
|
7173
7176
|
prev,
|
|
7174
7177
|
next
|
|
@@ -7318,16 +7321,34 @@ var require_useThemeState_native = __commonJS({
|
|
|
7318
7321
|
}
|
|
7319
7322
|
});
|
|
7320
7323
|
module2.exports = __toCommonJS2(useThemeState_exports);
|
|
7321
|
-
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(),
|
|
7324
|
+
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();
|
|
7325
|
+
process.env.NODE_ENV === "development" && (globalThis.getTamaguiThemes = function() {
|
|
7326
|
+
function buildTree(id) {
|
|
7327
|
+
var node = states.get(id);
|
|
7328
|
+
if (!node) return null;
|
|
7329
|
+
var children = Array.from(states.values()).filter(function(child) {
|
|
7330
|
+
return (child == null ? void 0 : child.parentId) === id;
|
|
7331
|
+
}).map(function(child) {
|
|
7332
|
+
return buildTree(child.id);
|
|
7333
|
+
}).filter(Boolean);
|
|
7334
|
+
return {
|
|
7335
|
+
...node,
|
|
7336
|
+
children
|
|
7337
|
+
};
|
|
7338
|
+
}
|
|
7339
|
+
rootThemeState && console.info(buildTree(rootThemeState.id));
|
|
7340
|
+
});
|
|
7341
|
+
var shouldForce = !1, forceUpdateThemes2 = function() {
|
|
7322
7342
|
cacheVersion++, shouldForce = !0, allListeners.forEach(function(cb) {
|
|
7323
7343
|
return cb();
|
|
7324
7344
|
});
|
|
7325
7345
|
}, getThemeState = function(id) {
|
|
7326
7346
|
return states.get(id);
|
|
7327
|
-
},
|
|
7347
|
+
}, cacheVersion = 0, themes = null, rootThemeState = null, getRootThemeState = function() {
|
|
7328
7348
|
return rootThemeState;
|
|
7329
7349
|
}, useThemeState = function(props) {
|
|
7330
7350
|
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);
|
|
7351
|
+
if (!parentId && !isRoot) throw new Error("No parent?");
|
|
7331
7352
|
if (disable) return states.get(parentId) || {
|
|
7332
7353
|
id: "",
|
|
7333
7354
|
name: "light",
|
|
@@ -7339,16 +7360,24 @@ var require_useThemeState_native = __commonJS({
|
|
|
7339
7360
|
return (_listenersByParent = listenersByParent)[_parentId = parentId] || (_listenersByParent[_parentId] = /* @__PURE__ */ new Set()), listenersByParent[parentId].add(id), allListeners.set(id, function() {
|
|
7340
7361
|
pendingUpdate.set(id, shouldForce ? "force" : !0), cb();
|
|
7341
7362
|
}), function() {
|
|
7342
|
-
allListeners.delete(id), listenersByParent[parentId].delete(id);
|
|
7363
|
+
allListeners.delete(id), listenersByParent[parentId].delete(id), localStates.delete(id), states.delete(id), pendingUpdate.delete(id);
|
|
7343
7364
|
};
|
|
7344
7365
|
}, [
|
|
7345
7366
|
id,
|
|
7346
7367
|
parentId
|
|
7347
7368
|
]), propsKey = getPropsKey(props), getSnapshot = function() {
|
|
7348
|
-
var _keys_current, _props_needsUpdate,
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7369
|
+
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));
|
|
7370
|
+
return pendingUpdate.delete(id), (!local || rerender) && (local = {
|
|
7371
|
+
...next
|
|
7372
|
+
}, localStates.set(id, local)), process.env.NODE_ENV === "development" && props.debug && props.debug !== "profile" && (console.groupCollapsed(` ${id} \u{1FA84} ${rerender}`, local.name, ">", next.name), console.info({
|
|
7373
|
+
props,
|
|
7374
|
+
propsKey,
|
|
7375
|
+
isRoot,
|
|
7376
|
+
parentId,
|
|
7377
|
+
local,
|
|
7378
|
+
next,
|
|
7379
|
+
needsUpdate
|
|
7380
|
+
}), console.groupEnd()), Object.assign(local, next), local.id = id, states.set(id, next), local;
|
|
7352
7381
|
};
|
|
7353
7382
|
process.env.NODE_ENV === "development" && globalThis.time && globalThis.time`theme-prep-uses`;
|
|
7354
7383
|
var state = (0, import_react3.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
|
|
@@ -7367,31 +7396,39 @@ var require_useThemeState_native = __commonJS({
|
|
|
7367
7396
|
}, [
|
|
7368
7397
|
keys,
|
|
7369
7398
|
propsKey
|
|
7370
|
-
]), state
|
|
7371
|
-
|
|
7372
|
-
isNew: !0
|
|
7373
|
-
} : state;
|
|
7374
|
-
}, getSnapshotFrom = function(lastState, props, propsKey) {
|
|
7399
|
+
]), state;
|
|
7400
|
+
}, getNextState = function(lastState, props, propsKey) {
|
|
7375
7401
|
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);
|
|
7376
7402
|
themes || (themes = (0, import_config.getConfig)().themes);
|
|
7377
|
-
var name = !propsKey &&
|
|
7403
|
+
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)));
|
|
7378
7404
|
if (process.env.NODE_ENV === "development" && debug && debug !== "profile") {
|
|
7379
|
-
var message = ` \xB7 useTheme(${id})
|
|
7405
|
+
var message = ` \xB7 useTheme(${id}) => ${name} needsUpdate ${needsUpdate} shouldRerender ${shouldRerender}`;
|
|
7380
7406
|
console.info(message);
|
|
7381
7407
|
}
|
|
7382
|
-
if (
|
|
7408
|
+
if (isSameAsParent) return [
|
|
7409
|
+
shouldRerender,
|
|
7410
|
+
{
|
|
7411
|
+
...parentState,
|
|
7412
|
+
isNew: !1
|
|
7413
|
+
}
|
|
7414
|
+
];
|
|
7383
7415
|
if (!name) {
|
|
7384
7416
|
var next = lastState ?? parentState;
|
|
7385
7417
|
if (!next) throw new Error("No theme and no parent?");
|
|
7386
|
-
if (
|
|
7418
|
+
if (shouldRerender) {
|
|
7387
7419
|
var updated = {
|
|
7388
7420
|
...parentState || lastState
|
|
7389
7421
|
};
|
|
7390
|
-
return
|
|
7422
|
+
return [
|
|
7423
|
+
!0,
|
|
7424
|
+
updated
|
|
7425
|
+
];
|
|
7391
7426
|
}
|
|
7392
|
-
return
|
|
7427
|
+
return [
|
|
7428
|
+
!1,
|
|
7429
|
+
next
|
|
7430
|
+
];
|
|
7393
7431
|
}
|
|
7394
|
-
if (pendingUpdate2 !== "force" && lastState && lastState.name === name) return lastState;
|
|
7395
7432
|
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 = {
|
|
7396
7433
|
id,
|
|
7397
7434
|
name,
|
|
@@ -7400,16 +7437,26 @@ var require_useThemeState_native = __commonJS({
|
|
|
7400
7437
|
parentId,
|
|
7401
7438
|
parentName: parentState == null ? void 0 : parentState.name,
|
|
7402
7439
|
inverses,
|
|
7403
|
-
isInverse
|
|
7440
|
+
isInverse,
|
|
7441
|
+
isNew: !0
|
|
7404
7442
|
};
|
|
7405
|
-
isRoot && (rootThemeState = nextState)
|
|
7443
|
+
if (isRoot && (rootThemeState = nextState), pendingUpdate2 !== "force" && lastState && lastState.name === name) return [
|
|
7444
|
+
!1,
|
|
7445
|
+
nextState
|
|
7446
|
+
];
|
|
7406
7447
|
var shouldAvoidRerender = pendingUpdate2 !== "force" && lastState && !needsUpdate && nextState.name === lastState.name;
|
|
7407
7448
|
return process.env.NODE_ENV === "development" && debug && debug !== "profile" && (console.groupCollapsed(` \xB7 useTheme(${id}) \u23ED\uFE0F ${name} shouldAvoidRerender: ${shouldAvoidRerender}`), console.info({
|
|
7408
7449
|
lastState,
|
|
7409
7450
|
needsUpdate,
|
|
7410
7451
|
nextState,
|
|
7411
7452
|
pendingUpdate: pendingUpdate2
|
|
7412
|
-
}), console.groupEnd()), shouldAvoidRerender ?
|
|
7453
|
+
}), console.groupEnd()), shouldAvoidRerender ? [
|
|
7454
|
+
!1,
|
|
7455
|
+
nextState
|
|
7456
|
+
] : [
|
|
7457
|
+
!0,
|
|
7458
|
+
nextState
|
|
7459
|
+
];
|
|
7413
7460
|
};
|
|
7414
7461
|
function scheduleUpdate(id) {
|
|
7415
7462
|
for (var queue = [
|
|
@@ -7846,7 +7893,11 @@ var require_Theme_native = __commonJS({
|
|
|
7846
7893
|
Theme2.avoidForwardRef = !0;
|
|
7847
7894
|
function getThemedChildren(themeState, children, props) {
|
|
7848
7895
|
var isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1, stateRef = arguments.length > 4 ? arguments[4] : void 0, { shallow, forceClassName } = props, state = stateRef.current, hasEverThemed = state.hasEverThemed, shouldRenderChildrenWithTheme = hasEverThemed || themeState.isNew || isRoot || (0, import_useThemeState.hasThemeUpdatingProps)(props);
|
|
7849
|
-
if (
|
|
7896
|
+
if (process.env.NODE_ENV === "development" && props.debug && (children = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ThemeDebug.ThemeDebug, {
|
|
7897
|
+
themeState,
|
|
7898
|
+
themeProps: props,
|
|
7899
|
+
children
|
|
7900
|
+
})), !shouldRenderChildrenWithTheme) return children;
|
|
7850
7901
|
children = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_useThemeState.ThemeStateContext.Provider, {
|
|
7851
7902
|
value: themeState.id,
|
|
7852
7903
|
children
|
|
@@ -7864,20 +7915,19 @@ var require_Theme_native = __commonJS({
|
|
|
7864
7915
|
})) : child;
|
|
7865
7916
|
});
|
|
7866
7917
|
}
|
|
7867
|
-
if (process.env.NODE_ENV === "development" && props.debug &&
|
|
7918
|
+
if (process.env.NODE_ENV === "development" && props.debug && console.warn(" getThemedChildren", {
|
|
7868
7919
|
requiresExtraWrapper,
|
|
7869
7920
|
forceClassName,
|
|
7870
7921
|
themeState,
|
|
7871
7922
|
state,
|
|
7872
7923
|
...getThemeClassNameAndStyle(themeState, props, isRoot)
|
|
7873
|
-
}),
|
|
7874
|
-
themeState,
|
|
7875
|
-
themeProps: props,
|
|
7876
|
-
children
|
|
7877
|
-
})), forceClassName === !1) return children;
|
|
7924
|
+
}), forceClassName === !1) return children;
|
|
7878
7925
|
if (import_constants4.isWeb) {
|
|
7879
7926
|
var { className, style } = getThemeClassNameAndStyle(themeState, props, isRoot);
|
|
7880
7927
|
if (children = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", {
|
|
7928
|
+
...process.env.NODE_ENV === "development" && {
|
|
7929
|
+
"data-theme-id": themeState.id
|
|
7930
|
+
},
|
|
7881
7931
|
className: `${className} _dsp_contents is_Theme`,
|
|
7882
7932
|
style,
|
|
7883
7933
|
children
|
|
@@ -8132,7 +8182,9 @@ var require_useComponentState_native = __commonJS({
|
|
|
8132
8182
|
groupContextState[groupName] = next;
|
|
8133
8183
|
};
|
|
8134
8184
|
}
|
|
8135
|
-
var setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState, disabled
|
|
8185
|
+
var setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState, disabled ? [
|
|
8186
|
+
"disabled"
|
|
8187
|
+
] : void 0, !1, props.debug, setStateWrapper);
|
|
8136
8188
|
if (presenceState && isAnimated && isHydrated && staticConfig.variants) {
|
|
8137
8189
|
process.env.NODE_ENV === "development" && props.debug === "verbose" && console.warn(`has presenceState ${JSON.stringify(presenceState)}`);
|
|
8138
8190
|
var { enterVariant, exitVariant, enterExitVariant, custom } = presenceState;
|
|
@@ -10860,7 +10912,7 @@ var require_useProps_native = __commonJS({
|
|
|
10860
10912
|
resolveValues: "auto",
|
|
10861
10913
|
...opts
|
|
10862
10914
|
}, null, componentContext), { mediaGroups, pseudoGroups } = splitStyles;
|
|
10863
|
-
return import_react3.default.
|
|
10915
|
+
return import_react3.default.useLayoutEffect(function() {
|
|
10864
10916
|
if (!disabled) {
|
|
10865
10917
|
if (state.unmounted) {
|
|
10866
10918
|
setStateShallow({
|
|
@@ -15938,7 +15990,7 @@ var require_constants_native3 = __commonJS({
|
|
|
15938
15990
|
}
|
|
15939
15991
|
});
|
|
15940
15992
|
module2.exports = __toCommonJS2(constants_exports);
|
|
15941
|
-
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 =
|
|
15993
|
+
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 = {};
|
|
15942
15994
|
}
|
|
15943
15995
|
});
|
|
15944
15996
|
|