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