@tamagui/core 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 +6 -6
package/dist/native.js
CHANGED
|
@@ -3020,20 +3020,12 @@ var require_useDidHydrateOnce_native = __commonJS({
|
|
|
3020
3020
|
}
|
|
3021
3021
|
});
|
|
3022
3022
|
module2.exports = __toCommonJS2(useDidHydrateOnce_exports);
|
|
3023
|
-
var import_react3 = require("react")
|
|
3023
|
+
var import_react3 = require("react");
|
|
3024
3024
|
function useDidHydrateOnceRoot() {
|
|
3025
|
-
(0, import_react3.useEffect)(function() {
|
|
3026
|
-
var tm = setInterval(function() {
|
|
3027
|
-
Date.now() - last > 32 && (didHydrateOnce = !0, clearInterval(tm));
|
|
3028
|
-
}, 16);
|
|
3029
|
-
return function() {
|
|
3030
|
-
clearInterval(tm);
|
|
3031
|
-
};
|
|
3032
|
-
}, []);
|
|
3033
3025
|
}
|
|
3034
3026
|
var last = Date.now();
|
|
3035
3027
|
function useDidHydrateOnce() {
|
|
3036
|
-
return
|
|
3028
|
+
return !0;
|
|
3037
3029
|
}
|
|
3038
3030
|
}
|
|
3039
3031
|
});
|
|
@@ -3262,7 +3254,7 @@ var require_useMedia_native = __commonJS({
|
|
|
3262
3254
|
}), update();
|
|
3263
3255
|
};
|
|
3264
3256
|
if (!(import_constants.isWeb && import_constants.isServer) && setupVersion !== mediaVersion) {
|
|
3265
|
-
setupVersion = mediaVersion, unlisten();
|
|
3257
|
+
setupVersion = mediaVersion, process.env.NODE_ENV === "development" && unlisten();
|
|
3266
3258
|
for (var key in mediaQueryConfig2) _loop(key);
|
|
3267
3259
|
}
|
|
3268
3260
|
}
|
|
@@ -3274,46 +3266,41 @@ var require_useMedia_native = __commonJS({
|
|
|
3274
3266
|
});
|
|
3275
3267
|
}));
|
|
3276
3268
|
}
|
|
3277
|
-
var
|
|
3269
|
+
var States = /* @__PURE__ */ new WeakMap();
|
|
3278
3270
|
function setMediaShouldUpdate(ref, props) {
|
|
3279
|
-
return
|
|
3280
|
-
}
|
|
3281
|
-
function subscribe(subscriber) {
|
|
3282
|
-
return listeners.add(subscriber), function() {
|
|
3283
|
-
return listeners.delete(subscriber);
|
|
3284
|
-
};
|
|
3271
|
+
return States.set(ref, _object_spread2({}, States.get(ref), props));
|
|
3285
3272
|
}
|
|
3286
|
-
function
|
|
3287
|
-
var
|
|
3273
|
+
function getSnapshot(param) {
|
|
3274
|
+
var touched = param.touched, prev = param.prev, enabled = param.enabled, keys = param.keys, isDisabled = enabled === !1;
|
|
3275
|
+
if (isDisabled) return prev;
|
|
3276
|
+
var testKeys = keys || touched ? _to_consumable_array(keys || []).concat(_to_consumable_array(touched || [])) : null, hasntUpdated = !testKeys || (testKeys == null ? void 0 : testKeys.every(function(key) {
|
|
3277
|
+
return mediaState2[key] === prev[key];
|
|
3278
|
+
}));
|
|
3279
|
+
return hasntUpdated ? prev : mediaState2;
|
|
3280
|
+
}
|
|
3281
|
+
function useMedia2(uidIn, componentContext) {
|
|
3282
|
+
var uid = uidIn ?? (0, import_react3.useRef)(), hasHydrated = (0, import_useDidHydrateOnce.useDidHydrateOnce)(), isHydrated = !import_constants.isWeb || (0, import_useDisableSSR.getDisableSSR)(componentContext) || hasHydrated, initialState = isHydrated ? mediaState2 : initState, componentState = States.get(uid);
|
|
3283
|
+
componentState || (componentState = {
|
|
3284
|
+
prev: initialState
|
|
3285
|
+
}, States.set(uid, componentState)), componentState.touched = void 0;
|
|
3286
|
+
var _useState = _sliced_to_array((0, import_react3.useState)(initialState), 2), state = _useState[0], setState = _useState[1];
|
|
3288
3287
|
return (0, import_constants.useIsomorphicLayoutEffect)(function() {
|
|
3289
3288
|
var update = function() {
|
|
3290
3289
|
setState(function(prev) {
|
|
3291
|
-
var next = getSnapshot();
|
|
3292
|
-
return next !== prev ? next : prev;
|
|
3290
|
+
var componentState2 = States.get(uid), next = getSnapshot(componentState2);
|
|
3291
|
+
return next !== prev ? (componentState2.prev = next, next) : prev;
|
|
3293
3292
|
});
|
|
3294
3293
|
};
|
|
3295
|
-
return
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
var _internal_current = internal.current, touched = _internal_current.touched, prev = _internal_current.prev, componentState = uid ? shouldUpdate.get(uid) : void 0;
|
|
3302
|
-
if (componentState && componentState.enabled === !1) return prev;
|
|
3303
|
-
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_array(touched) : null, hasntUpdated = !testKeys || (testKeys == null ? void 0 : testKeys.every(function(key) {
|
|
3304
|
-
return mediaState2[key] === prev[key];
|
|
3305
|
-
}));
|
|
3306
|
-
return hasntUpdated ? prev : (internal.current.prev = mediaState2, mediaState2);
|
|
3307
|
-
}, function() {
|
|
3308
|
-
return initialState;
|
|
3309
|
-
});
|
|
3310
|
-
return new Proxy(state, {
|
|
3294
|
+
return Promise.resolve().then(update), listeners.add(update), function() {
|
|
3295
|
+
listeners.delete(update);
|
|
3296
|
+
};
|
|
3297
|
+
}, [
|
|
3298
|
+
uid
|
|
3299
|
+
]), new Proxy(state, {
|
|
3311
3300
|
get: function(_, key) {
|
|
3312
3301
|
if (typeof key == "string") {
|
|
3313
|
-
var
|
|
3314
|
-
(
|
|
3315
|
-
prev: initialState
|
|
3316
|
-
}), (_internal_current = internal.current).touched || (_internal_current.touched = /* @__PURE__ */ new Set()), internal.current.touched.add(key);
|
|
3302
|
+
var _componentState;
|
|
3303
|
+
(_componentState = componentState).touched || (_componentState.touched = /* @__PURE__ */ new Set()), componentState.touched.add(key);
|
|
3317
3304
|
}
|
|
3318
3305
|
return Reflect.get(state, key);
|
|
3319
3306
|
}
|