tamagui 1.100.2 → 1.100.3
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 +29 -42
- package/dist/native.js.map +2 -2
- package/dist/test.native.js +30 -49
- package/dist/test.native.js.map +2 -2
- package/package.json +54 -54
package/dist/native.js
CHANGED
|
@@ -3102,20 +3102,12 @@ var require_useDidHydrateOnce_native = __commonJS({
|
|
|
3102
3102
|
}
|
|
3103
3103
|
});
|
|
3104
3104
|
module2.exports = __toCommonJS2(useDidHydrateOnce_exports);
|
|
3105
|
-
var import_react4 = require("react")
|
|
3105
|
+
var import_react4 = require("react");
|
|
3106
3106
|
function useDidHydrateOnceRoot() {
|
|
3107
|
-
(0, import_react4.useEffect)(function() {
|
|
3108
|
-
var tm = setInterval(function() {
|
|
3109
|
-
Date.now() - last > 32 && (didHydrateOnce = !0, clearInterval(tm));
|
|
3110
|
-
}, 16);
|
|
3111
|
-
return function() {
|
|
3112
|
-
clearInterval(tm);
|
|
3113
|
-
};
|
|
3114
|
-
}, []);
|
|
3115
3107
|
}
|
|
3116
3108
|
var last = Date.now();
|
|
3117
3109
|
function useDidHydrateOnce() {
|
|
3118
|
-
return
|
|
3110
|
+
return !0;
|
|
3119
3111
|
}
|
|
3120
3112
|
}
|
|
3121
3113
|
});
|
|
@@ -3344,7 +3336,7 @@ var require_useMedia_native = __commonJS({
|
|
|
3344
3336
|
}), update();
|
|
3345
3337
|
};
|
|
3346
3338
|
if (!(import_constants4.isWeb && import_constants4.isServer) && setupVersion !== mediaVersion) {
|
|
3347
|
-
setupVersion = mediaVersion, unlisten();
|
|
3339
|
+
setupVersion = mediaVersion, process.env.NODE_ENV === "development" && unlisten();
|
|
3348
3340
|
for (var key in mediaQueryConfig3) _loop(key);
|
|
3349
3341
|
}
|
|
3350
3342
|
}
|
|
@@ -3356,46 +3348,41 @@ var require_useMedia_native = __commonJS({
|
|
|
3356
3348
|
});
|
|
3357
3349
|
}));
|
|
3358
3350
|
}
|
|
3359
|
-
var
|
|
3351
|
+
var States = /* @__PURE__ */ new WeakMap();
|
|
3360
3352
|
function setMediaShouldUpdate(ref, props) {
|
|
3361
|
-
return
|
|
3362
|
-
}
|
|
3363
|
-
function subscribe(subscriber) {
|
|
3364
|
-
return listeners.add(subscriber), function() {
|
|
3365
|
-
return listeners.delete(subscriber);
|
|
3366
|
-
};
|
|
3353
|
+
return States.set(ref, _object_spread9({}, States.get(ref), props));
|
|
3367
3354
|
}
|
|
3368
|
-
function
|
|
3369
|
-
var
|
|
3355
|
+
function getSnapshot(param) {
|
|
3356
|
+
var touched = param.touched, prev = param.prev, enabled = param.enabled, keys = param.keys, isDisabled = enabled === !1;
|
|
3357
|
+
if (isDisabled) return prev;
|
|
3358
|
+
var testKeys = keys || touched ? _to_consumable_array2(keys || []).concat(_to_consumable_array2(touched || [])) : null, hasntUpdated = !testKeys || (testKeys == null ? void 0 : testKeys.every(function(key) {
|
|
3359
|
+
return mediaState3[key] === prev[key];
|
|
3360
|
+
}));
|
|
3361
|
+
return hasntUpdated ? prev : mediaState3;
|
|
3362
|
+
}
|
|
3363
|
+
function useMedia3(uidIn, componentContext) {
|
|
3364
|
+
var uid = uidIn ?? (0, import_react4.useRef)(), hasHydrated = (0, import_useDidHydrateOnce.useDidHydrateOnce)(), isHydrated = !import_constants4.isWeb || (0, import_useDisableSSR.getDisableSSR)(componentContext) || hasHydrated, initialState = isHydrated ? mediaState3 : initState, componentState = States.get(uid);
|
|
3365
|
+
componentState || (componentState = {
|
|
3366
|
+
prev: initialState
|
|
3367
|
+
}, States.set(uid, componentState)), componentState.touched = void 0;
|
|
3368
|
+
var _useState = _sliced_to_array((0, import_react4.useState)(initialState), 2), state = _useState[0], setState = _useState[1];
|
|
3370
3369
|
return (0, import_constants4.useIsomorphicLayoutEffect)(function() {
|
|
3371
3370
|
var update = function() {
|
|
3372
3371
|
setState(function(prev) {
|
|
3373
|
-
var next = getSnapshot();
|
|
3374
|
-
return next !== prev ? next : prev;
|
|
3372
|
+
var componentState2 = States.get(uid), next = getSnapshot(componentState2);
|
|
3373
|
+
return next !== prev ? (componentState2.prev = next, next) : prev;
|
|
3375
3374
|
});
|
|
3376
3375
|
};
|
|
3377
|
-
return
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
var _internal_current = internal.current, touched = _internal_current.touched, prev = _internal_current.prev, componentState = uid ? shouldUpdate.get(uid) : void 0;
|
|
3384
|
-
if (componentState && componentState.enabled === !1) return prev;
|
|
3385
|
-
var _componentState_keys, testKeys = (_componentState_keys = componentState == null ? void 0 : componentState.keys) !== null && _componentState_keys !== void 0 ? _componentState_keys : (!componentState || componentState.enabled) && touched ? _to_consumable_array2(touched) : null, hasntUpdated = !testKeys || (testKeys == null ? void 0 : testKeys.every(function(key) {
|
|
3386
|
-
return mediaState3[key] === prev[key];
|
|
3387
|
-
}));
|
|
3388
|
-
return hasntUpdated ? prev : (internal.current.prev = mediaState3, mediaState3);
|
|
3389
|
-
}, function() {
|
|
3390
|
-
return initialState;
|
|
3391
|
-
});
|
|
3392
|
-
return new Proxy(state, {
|
|
3376
|
+
return Promise.resolve().then(update), listeners.add(update), function() {
|
|
3377
|
+
listeners.delete(update);
|
|
3378
|
+
};
|
|
3379
|
+
}, [
|
|
3380
|
+
uid
|
|
3381
|
+
]), new Proxy(state, {
|
|
3393
3382
|
get: function(_, key) {
|
|
3394
3383
|
if (typeof key == "string") {
|
|
3395
|
-
var
|
|
3396
|
-
(
|
|
3397
|
-
prev: initialState
|
|
3398
|
-
}), (_internal_current = internal.current).touched || (_internal_current.touched = /* @__PURE__ */ new Set()), internal.current.touched.add(key);
|
|
3384
|
+
var _componentState;
|
|
3385
|
+
(_componentState = componentState).touched || (_componentState.touched = /* @__PURE__ */ new Set()), componentState.touched.add(key);
|
|
3399
3386
|
}
|
|
3400
3387
|
return Reflect.get(state, key);
|
|
3401
3388
|
}
|