@tamagui/core 2.0.0-1768427228811 → 2.0.0-1768530912818

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.cjs CHANGED
@@ -8438,9 +8438,179 @@ var getTokens = function() {
8438
8438
  };
8439
8439
  function setupDev(conf2) {
8440
8440
  }
8441
- var cache$4 = /* @__PURE__ */ new Map(), cacheSize = 0, simpleHash = function(strIn) {
8441
+ var matchMediaImpl = matchMediaFallback, matchMedia$1 = function() {
8442
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
8443
+ return matchMediaImpl(...args);
8444
+ };
8445
+ function matchMediaFallback(query2) {
8446
+ return !process.env.IS_STATIC && false, {
8447
+ match: function(a, b2) {
8448
+ return false;
8449
+ },
8450
+ addListener: function() {
8451
+ },
8452
+ removeListener: function() {
8453
+ },
8454
+ matches: false
8455
+ };
8456
+ }
8457
+ function setupMatchMedia(_2) {
8458
+ matchMediaImpl = _2, globalThis.matchMedia = _2;
8459
+ }
8460
+ exports.mediaState = // development only safeguard
8461
+ {};
8462
+ var mediaQueryConfig = {}, getMedia = function() {
8463
+ return exports.mediaState;
8464
+ }, mediaKeys = /* @__PURE__ */ new Set(), mediaKeyRegex = /\$(platform|theme|group)-/, getMediaKey = function(key) {
8465
+ if (key[0] !== "$") return false;
8466
+ if (mediaKeys.has(key)) return true;
8467
+ var match = key.match(mediaKeyRegex);
8468
+ return match ? match[1] : false;
8469
+ }, initState, mediaKeysOrdered, getMediaKeyImportance = function(key) {
8470
+ return mediaKeysOrdered.indexOf(key) + 100;
8471
+ }, dispose = /* @__PURE__ */ new Set(), mediaVersion = 0, configureMedia = function(config) {
8472
+ var {
8473
+ media
8474
+ } = config, mediaQueryDefaultActive = getSetting("mediaQueryDefaultActive");
8475
+ if (media) {
8476
+ mediaVersion++;
8477
+ for (var key in media) exports.mediaState[key] = (mediaQueryDefaultActive == null ? void 0 : mediaQueryDefaultActive[key]) || false, mediaKeys.add(`$${key}`);
8478
+ Object.assign(mediaQueryConfig, media), initState = __spreadValues({}, exports.mediaState), mediaKeysOrdered = Object.keys(media), setupMediaListeners();
8479
+ }
8480
+ };
8481
+ function unlisten() {
8482
+ dispose.forEach(function(cb) {
8483
+ return cb();
8484
+ }), dispose.clear();
8485
+ }
8486
+ var setupVersion = -1;
8487
+ function setupMediaListeners() {
8488
+ var _loop2 = function(key2) {
8489
+ var str = mediaObjectToString(mediaQueryConfig[key2]), getMatch = function() {
8490
+ return matchMedia$1(str);
8491
+ }, match = getMatch();
8492
+ if (!match) throw new Error("⚠️ No match");
8493
+ match.addListener(update2), dispose.add(function() {
8494
+ match.removeListener(update2);
8495
+ });
8496
+ function update2() {
8497
+ var next = !!getMatch().matches;
8498
+ next !== exports.mediaState[key2] && (exports.mediaState = __spreadProps(__spreadValues({}, exports.mediaState), {
8499
+ [key2]: next
8500
+ }), updateMediaListeners());
8501
+ }
8502
+ update2();
8503
+ };
8504
+ if (!process.env.IS_STATIC && setupVersion !== mediaVersion) {
8505
+ setupVersion = mediaVersion, unlisten();
8506
+ for (var key in mediaQueryConfig) _loop2(key);
8507
+ }
8508
+ }
8509
+ var listeners = /* @__PURE__ */ new Set();
8510
+ function updateMediaListeners() {
8511
+ listeners.forEach(function(cb) {
8512
+ return cb(exports.mediaState);
8513
+ });
8514
+ }
8515
+ var States = /* @__PURE__ */ new WeakMap();
8516
+ function setMediaShouldUpdate(ref, enabled, keys) {
8517
+ var cur = States.get(ref);
8518
+ (!cur || cur.enabled !== enabled || keys) && States.set(ref, __spreadProps(__spreadValues({}, cur), {
8519
+ enabled,
8520
+ keys
8521
+ }));
8522
+ }
8523
+ function subscribe(subscriber) {
8524
+ return listeners.add(subscriber), function() {
8525
+ listeners.delete(subscriber);
8526
+ };
8527
+ }
8528
+ function useMedia(componentContext, debug) {
8529
+ var componentState = componentContext ? States.get(componentContext) : null, internalRef = React.useRef(null);
8530
+ internalRef.current || (internalRef.current = {
8531
+ keys: /* @__PURE__ */ new Set(),
8532
+ lastState: exports.mediaState
8533
+ }), internalRef.current.pendingState && (internalRef.current.lastState = internalRef.current.pendingState, internalRef.current.pendingState = void 0);
8534
+ var {
8535
+ keys
8536
+ } = internalRef.current;
8537
+ keys.size && keys.clear();
8538
+ var state = React.useSyncExternalStore(subscribe, function() {
8539
+ var curKeys2 = (componentState == null ? void 0 : componentState.keys) || keys, {
8540
+ lastState,
8541
+ pendingState
8542
+ } = internalRef.current;
8543
+ if (!curKeys2.size) return lastState;
8544
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
8545
+ try {
8546
+ for (var _iterator = curKeys2[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
8547
+ var key = _step.value;
8548
+ if (exports.mediaState[key] !== (pendingState || lastState)[key]) return false, (componentContext == null ? void 0 : componentContext.mediaEmit) ? (componentContext.mediaEmit(exports.mediaState), internalRef.current.pendingState = exports.mediaState, lastState) : (internalRef.current.lastState = exports.mediaState, exports.mediaState);
8549
+ }
8550
+ } catch (err) {
8551
+ _didIteratorError = true, _iteratorError = err;
8552
+ } finally {
8553
+ try {
8554
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
8555
+ } finally {
8556
+ if (_didIteratorError) throw _iteratorError;
8557
+ }
8558
+ }
8559
+ return lastState;
8560
+ }, getServerSnapshot);
8561
+ return new Proxy(state, {
8562
+ get(_2, key) {
8563
+ return !disableMediaTouch && typeof key == "string" && keys.add(key), Reflect.get(state, key);
8564
+ }
8565
+ });
8566
+ }
8567
+ var getServerSnapshot = function() {
8568
+ return initState;
8569
+ }, disableMediaTouch = false;
8570
+ function _disableMediaTouch(val) {
8571
+ disableMediaTouch = val;
8572
+ }
8573
+ function getMediaState(mediaGroups, layout) {
8574
+ disableMediaTouch = true;
8575
+ var res;
8576
+ try {
8577
+ res = Object.fromEntries([...mediaGroups].map(function(mediaKey) {
8578
+ return [mediaKey, mediaKeyMatch(mediaKey, layout)];
8579
+ }));
8580
+ } finally {
8581
+ disableMediaTouch = false;
8582
+ }
8583
+ return res;
8584
+ }
8585
+ var getMediaImportanceIfMoreImportant = function(mediaKey, key, styleState, isSizeMedia) {
8586
+ var importance = isSizeMedia ? getMediaKeyImportance(mediaKey) : defaultMediaImportance, usedKeys = styleState.usedKeys;
8587
+ return !usedKeys[key] || importance > usedKeys[key] ? importance : null;
8588
+ };
8589
+ function camelToHyphen(str) {
8590
+ return str.replace(/[A-Z]/g, function(m) {
8591
+ return `-${m.toLowerCase()}`;
8592
+ }).toLowerCase();
8593
+ }
8594
+ var cache$4 = /* @__PURE__ */ new WeakMap();
8595
+ function mediaObjectToString(query2, key) {
8596
+ if (typeof query2 == "string") return query2;
8597
+ if (cache$4.has(query2)) return cache$4.get(query2);
8598
+ var res = Object.entries(query2).map(function(param) {
8599
+ var [feature, value] = param;
8600
+ return feature = camelToHyphen(feature), typeof value == "string" ? `(${feature}: ${value})` : (typeof value == "number" && /[height|width]$/.test(feature) && (value = `${value}px`), `(${feature}: ${value})`);
8601
+ }).join(" and ");
8602
+ return cache$4.set(query2, res), res;
8603
+ }
8604
+ function mediaKeyMatch(key, dimensions2) {
8605
+ var mediaQueries = mediaQueryConfig[key], result = Object.keys(mediaQueries).every(function(query2) {
8606
+ var expectedVal = +mediaQueries[query2], isMax = query2.startsWith("max"), isWidth = query2.endsWith("Width"), givenVal = dimensions2[isWidth ? "width" : "height"];
8607
+ return isMax ? givenVal < expectedVal : givenVal > expectedVal;
8608
+ });
8609
+ return result;
8610
+ }
8611
+ var cache$3 = /* @__PURE__ */ new Map(), cacheSize = 0, simpleHash = function(strIn) {
8442
8612
  var hashMin = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 10;
8443
- if (cache$4.has(strIn)) return cache$4.get(strIn);
8613
+ if (cache$3.has(strIn)) return cache$3.get(strIn);
8444
8614
  var str = strIn;
8445
8615
  str[0] === "v" && str.startsWith("var(") && (str = str.slice(6, str.length - 1));
8446
8616
  for (var hash = 0, valids = "", added = 0, len = str.length, i = 0; i < len; i++) {
@@ -8458,7 +8628,7 @@ var cache$4 = /* @__PURE__ */ new Map(), cacheSize = 0, simpleHash = function(st
8458
8628
  hash = hashChar(hash, str[i]);
8459
8629
  }
8460
8630
  var res = valids + (hash ? Math.abs(hash) : "");
8461
- return cacheSize > 1e4 && (cache$4.clear(), cacheSize = 0), cache$4.set(strIn, res), cacheSize++, res;
8631
+ return cacheSize > 1e4 && (cache$3.clear(), cacheSize = 0), cache$3.set(strIn, res), cacheSize++, res;
8462
8632
  }, hashChar = function(hash, c) {
8463
8633
  return Math.imul(31, hash) + c.charCodeAt(0) | 0;
8464
8634
  };
@@ -8917,6 +9087,26 @@ function px(value) {
8917
9087
  function getOppositeScheme(scheme) {
8918
9088
  return scheme === "dark" ? "light" : "dark";
8919
9089
  }
9090
+ var colorStyleKeys = {
9091
+ backgroundColor: true,
9092
+ borderColor: true,
9093
+ borderTopColor: true,
9094
+ borderRightColor: true,
9095
+ borderBottomColor: true,
9096
+ borderLeftColor: true,
9097
+ borderBlockColor: true,
9098
+ borderBlockEndColor: true,
9099
+ borderBlockStartColor: true,
9100
+ color: true,
9101
+ shadowColor: true,
9102
+ textDecorationColor: true,
9103
+ textShadowColor: true,
9104
+ tintColor: true,
9105
+ outlineColor: true
9106
+ };
9107
+ function isColorStyleKey(key) {
9108
+ return colorStyleKeys[key] === true;
9109
+ }
8920
9110
  function getDynamicVal(param) {
8921
9111
  var {
8922
9112
  scheme,
@@ -9166,11 +9356,11 @@ function doesRootSchemeMatchSystem() {
9166
9356
  var _getRootThemeState;
9167
9357
  return ((_getRootThemeState = getRootThemeState()) === null || _getRootThemeState === void 0 ? void 0 : _getRootThemeState.scheme) === Appearance.getColorScheme();
9168
9358
  }
9169
- var cache$3 = /* @__PURE__ */ new Map(), curKeys, curProps, curState, emptyObject = {};
9359
+ var cache$2 = /* @__PURE__ */ new Map(), curKeys, curProps, curState, emptyObject = {};
9170
9360
  function getThemeProxied(_props, _state, _keys) {
9171
9361
  if (!(_state == null ? void 0 : _state.theme)) return emptyObject;
9172
- if (curKeys = _keys, curProps = _props, curState = _state, cache$3.has(curState.theme)) {
9173
- var proxied = cache$3.get(curState.theme);
9362
+ if (curKeys = _keys, curProps = _props, curState = _state, cache$2.has(curState.theme)) {
9363
+ var proxied = cache$2.get(curState.theme);
9174
9364
  return proxied;
9175
9365
  }
9176
9366
  var config = getConfig();
@@ -9202,7 +9392,7 @@ function getThemeProxied(_props, _state, _keys) {
9202
9392
  });
9203
9393
  return [[key, proxied2], [`$${key}`, proxied2]];
9204
9394
  }));
9205
- return cache$3.set(_state.theme, proxied1), proxied1;
9395
+ return cache$2.set(_state.theme, proxied1), proxied1;
9206
9396
  }
9207
9397
  var EMPTY = {}, useTheme = function() {
9208
9398
  var [theme] = useThemeWithState(EMPTY), res = theme;
@@ -9218,10 +9408,14 @@ var _withStableStyle = function(Component, styleProvider) {
9218
9408
  _expressions = []
9219
9409
  } = _a, rest = __objRest(_a, [
9220
9410
  "_expressions"
9221
- ]), theme = useTheme();
9411
+ ]), theme = useTheme(), hasMediaKeys = _expressions.some(function(expr) {
9412
+ return typeof expr == "string";
9413
+ }), media = hasMediaKeys ? useMedia() : null, resolvedExpressions = media ? _expressions.map(function(expr) {
9414
+ return typeof expr == "string" ? media[expr] : expr;
9415
+ }) : _expressions;
9222
9416
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, __spreadValues({
9223
9417
  ref,
9224
- style: styleProvider(theme, _expressions)
9418
+ style: styleProvider(theme, resolvedExpressions)
9225
9419
  }, rest));
9226
9420
  });
9227
9421
  };
@@ -9254,176 +9448,6 @@ var defaultComponentState = {
9254
9448
  }), defaultComponentStateShouldEnter = __spreadProps(__spreadValues({}, defaultComponentState), {
9255
9449
  unmounted: "should-enter"
9256
9450
  });
9257
- var matchMediaImpl = matchMediaFallback, matchMedia$1 = function() {
9258
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
9259
- return matchMediaImpl(...args);
9260
- };
9261
- function matchMediaFallback(query2) {
9262
- return !process.env.IS_STATIC && false, {
9263
- match: function(a, b2) {
9264
- return false;
9265
- },
9266
- addListener: function() {
9267
- },
9268
- removeListener: function() {
9269
- },
9270
- matches: false
9271
- };
9272
- }
9273
- function setupMatchMedia(_2) {
9274
- matchMediaImpl = _2, globalThis.matchMedia = _2;
9275
- }
9276
- exports.mediaState = // development only safeguard
9277
- {};
9278
- var mediaQueryConfig = {}, getMedia = function() {
9279
- return exports.mediaState;
9280
- }, mediaKeys = /* @__PURE__ */ new Set(), mediaKeyRegex = /\$(platform|theme|group)-/, getMediaKey = function(key) {
9281
- if (key[0] !== "$") return false;
9282
- if (mediaKeys.has(key)) return true;
9283
- var match = key.match(mediaKeyRegex);
9284
- return match ? match[1] : false;
9285
- }, initState, mediaKeysOrdered, getMediaKeyImportance = function(key) {
9286
- return mediaKeysOrdered.indexOf(key) + 100;
9287
- }, dispose = /* @__PURE__ */ new Set(), mediaVersion = 0, configureMedia = function(config) {
9288
- var {
9289
- media
9290
- } = config, mediaQueryDefaultActive = getSetting("mediaQueryDefaultActive");
9291
- if (media) {
9292
- mediaVersion++;
9293
- for (var key in media) exports.mediaState[key] = (mediaQueryDefaultActive == null ? void 0 : mediaQueryDefaultActive[key]) || false, mediaKeys.add(`$${key}`);
9294
- Object.assign(mediaQueryConfig, media), initState = __spreadValues({}, exports.mediaState), mediaKeysOrdered = Object.keys(media), setupMediaListeners();
9295
- }
9296
- };
9297
- function unlisten() {
9298
- dispose.forEach(function(cb) {
9299
- return cb();
9300
- }), dispose.clear();
9301
- }
9302
- var setupVersion = -1;
9303
- function setupMediaListeners() {
9304
- var _loop2 = function(key2) {
9305
- var str = mediaObjectToString(mediaQueryConfig[key2]), getMatch = function() {
9306
- return matchMedia$1(str);
9307
- }, match = getMatch();
9308
- if (!match) throw new Error("⚠️ No match");
9309
- match.addListener(update2), dispose.add(function() {
9310
- match.removeListener(update2);
9311
- });
9312
- function update2() {
9313
- var next = !!getMatch().matches;
9314
- next !== exports.mediaState[key2] && (exports.mediaState = __spreadProps(__spreadValues({}, exports.mediaState), {
9315
- [key2]: next
9316
- }), updateMediaListeners());
9317
- }
9318
- update2();
9319
- };
9320
- if (!process.env.IS_STATIC && setupVersion !== mediaVersion) {
9321
- setupVersion = mediaVersion, unlisten();
9322
- for (var key in mediaQueryConfig) _loop2(key);
9323
- }
9324
- }
9325
- var listeners = /* @__PURE__ */ new Set();
9326
- function updateMediaListeners() {
9327
- listeners.forEach(function(cb) {
9328
- return cb(exports.mediaState);
9329
- });
9330
- }
9331
- var States = /* @__PURE__ */ new WeakMap();
9332
- function setMediaShouldUpdate(ref, enabled, keys) {
9333
- var cur = States.get(ref);
9334
- (!cur || cur.enabled !== enabled || keys) && States.set(ref, __spreadProps(__spreadValues({}, cur), {
9335
- enabled,
9336
- keys
9337
- }));
9338
- }
9339
- function subscribe(subscriber) {
9340
- return listeners.add(subscriber), function() {
9341
- listeners.delete(subscriber);
9342
- };
9343
- }
9344
- function useMedia(componentContext, debug) {
9345
- var componentState = componentContext ? States.get(componentContext) : null, internalRef = React.useRef(null);
9346
- internalRef.current || (internalRef.current = {
9347
- keys: /* @__PURE__ */ new Set(),
9348
- lastState: exports.mediaState
9349
- }), internalRef.current.pendingState && (internalRef.current.lastState = internalRef.current.pendingState, internalRef.current.pendingState = void 0);
9350
- var {
9351
- keys
9352
- } = internalRef.current;
9353
- keys.size && keys.clear();
9354
- var state = React.useSyncExternalStore(subscribe, function() {
9355
- var curKeys2 = (componentState == null ? void 0 : componentState.keys) || keys, {
9356
- lastState,
9357
- pendingState
9358
- } = internalRef.current;
9359
- if (!curKeys2.size) return lastState;
9360
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
9361
- try {
9362
- for (var _iterator = curKeys2[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
9363
- var key = _step.value;
9364
- if (exports.mediaState[key] !== (pendingState || lastState)[key]) return false, (componentContext == null ? void 0 : componentContext.mediaEmit) ? (componentContext.mediaEmit(exports.mediaState), internalRef.current.pendingState = exports.mediaState, lastState) : (internalRef.current.lastState = exports.mediaState, exports.mediaState);
9365
- }
9366
- } catch (err) {
9367
- _didIteratorError = true, _iteratorError = err;
9368
- } finally {
9369
- try {
9370
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
9371
- } finally {
9372
- if (_didIteratorError) throw _iteratorError;
9373
- }
9374
- }
9375
- return lastState;
9376
- }, getServerSnapshot);
9377
- return new Proxy(state, {
9378
- get(_2, key) {
9379
- return !disableMediaTouch && typeof key == "string" && keys.add(key), Reflect.get(state, key);
9380
- }
9381
- });
9382
- }
9383
- var getServerSnapshot = function() {
9384
- return initState;
9385
- }, disableMediaTouch = false;
9386
- function _disableMediaTouch(val) {
9387
- disableMediaTouch = val;
9388
- }
9389
- function getMediaState(mediaGroups, layout) {
9390
- disableMediaTouch = true;
9391
- var res;
9392
- try {
9393
- res = Object.fromEntries([...mediaGroups].map(function(mediaKey) {
9394
- return [mediaKey, mediaKeyMatch(mediaKey, layout)];
9395
- }));
9396
- } finally {
9397
- disableMediaTouch = false;
9398
- }
9399
- return res;
9400
- }
9401
- var getMediaImportanceIfMoreImportant = function(mediaKey, key, styleState, isSizeMedia) {
9402
- var importance = isSizeMedia ? getMediaKeyImportance(mediaKey) : defaultMediaImportance, usedKeys = styleState.usedKeys;
9403
- return !usedKeys[key] || importance > usedKeys[key] ? importance : null;
9404
- };
9405
- function camelToHyphen(str) {
9406
- return str.replace(/[A-Z]/g, function(m) {
9407
- return `-${m.toLowerCase()}`;
9408
- }).toLowerCase();
9409
- }
9410
- var cache$2 = /* @__PURE__ */ new WeakMap();
9411
- function mediaObjectToString(query2, key) {
9412
- if (typeof query2 == "string") return query2;
9413
- if (cache$2.has(query2)) return cache$2.get(query2);
9414
- var res = Object.entries(query2).map(function(param) {
9415
- var [feature, value] = param;
9416
- return feature = camelToHyphen(feature), typeof value == "string" ? `(${feature}: ${value})` : (typeof value == "number" && /[height|width]$/.test(feature) && (value = `${value}px`), `(${feature}: ${value})`);
9417
- }).join(" and ");
9418
- return cache$2.set(query2, res), res;
9419
- }
9420
- function mediaKeyMatch(key, dimensions2) {
9421
- var mediaQueries = mediaQueryConfig[key], result = Object.keys(mediaQueries).every(function(query2) {
9422
- var expectedVal = +mediaQueries[query2], isMax = query2.startsWith("max"), isWidth = query2.endsWith("Width"), givenVal = dimensions2[isWidth ? "width" : "height"];
9423
- return isMax ? givenVal < expectedVal : givenVal > expectedVal;
9424
- });
9425
- return result;
9426
- }
9427
9451
  function getGroupPropParts(groupProp) {
9428
9452
  var mediaQueries = getMedia(), [_2, name, part3, part4] = groupProp.split("-"), pseudo, media = part3 in mediaQueries ? part3 : void 0;
9429
9453
  return media ? pseudo = part4 : pseudo = part3, {
@@ -10210,12 +10234,16 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
10210
10234
  }
10211
10235
  var mediaStyle1 = getSubStyle(styleState, key4, val2, true), importanceBump = 0;
10212
10236
  if (isThemeMedia) {
10213
- if (dynamicThemeAccess = true, isIos && getSetting("fastSchemeChange")) {
10237
+ if (isIos && getSetting("fastSchemeChange")) {
10214
10238
  var _styleState3;
10215
10239
  (_styleState3 = styleState).style || (_styleState3.style = {});
10216
- var scheme = mediaKeyShort, oppositeScheme = getOppositeScheme(mediaKeyShort), themeOriginalValues = styleOriginalValues.get(mediaStyle1);
10240
+ var scheme = mediaKeyShort, oppositeScheme = getOppositeScheme(mediaKeyShort), themeOriginalValues = styleOriginalValues.get(mediaStyle1), isCurrentScheme = themeName === scheme || themeName.startsWith(scheme);
10217
10241
  for (var subKey1 in mediaStyle1) {
10218
10242
  var _$val1 = extractValueFromDynamic(mediaStyle1[subKey1], scheme), existing = styleState.style[subKey1];
10243
+ if (!isColorStyleKey(subKey1)) {
10244
+ dynamicThemeAccess = true, isCurrentScheme ? mediaStyle1[subKey1] = _$val1 : delete mediaStyle1[subKey1];
10245
+ continue;
10246
+ }
10219
10247
  if (existing == null ? void 0 : existing.dynamic) existing.dynamic[scheme] = _$val1, mediaStyle1[subKey1] = existing;
10220
10248
  else {
10221
10249
  var oppositeVal = extractValueFromDynamic(existing, oppositeScheme);
@@ -10226,7 +10254,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
10226
10254
  }), mergeStyle(styleState, subKey1, mediaStyle1[subKey1], priority, false, themeOriginalValues == null ? void 0 : themeOriginalValues[subKey1]);
10227
10255
  }
10228
10256
  }
10229
- } else if (!(themeName === mediaKeyShort || themeName.startsWith(mediaKeyShort))) return;
10257
+ } else if (dynamicThemeAccess = true, !(themeName === mediaKeyShort || themeName.startsWith(mediaKeyShort))) return;
10230
10258
  } else if (isGroupMedia) {
10231
10259
  var _groupContext_groupName, _componentState_group, groupInfo = getGroupPropParts(mediaKeyShort), groupName = groupInfo.name, groupState = groupContext == null || (_groupContext_groupName = groupContext[groupName]) === null || _groupContext_groupName === void 0 ? void 0 : _groupContext_groupName.state, groupPseudoKey = groupInfo.pseudo, groupMediaKey = groupInfo.media;
10232
10260
  if (!groupState) {
@@ -10285,9 +10313,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
10285
10313
  inlineWhenUnflattened,
10286
10314
  parentStaticConfig,
10287
10315
  acceptsClassName
10288
- } = staticConfig, viewProps = {}, mediaState = styleProps2.mediaState || exports.mediaState, shouldDoClasses = acceptsClassName && isWeb, rulesToInsert = void 0, classNames = {}, pseudos = null;
10289
- props.space;
10290
- var hasMedia = false, dynamicThemeAccess, pseudoGroups, mediaGroups;
10316
+ } = staticConfig, viewProps = {}, mediaState = styleProps2.mediaState || exports.mediaState, shouldDoClasses = acceptsClassName && isWeb, rulesToInsert = void 0, classNames = {}, pseudos = null, hasMedia = false, dynamicThemeAccess, pseudoGroups, mediaGroups;
10291
10317
  props.className || "";
10292
10318
  var mediaStylesSeen = 0, validStyles$1 = staticConfig.validStyles || (staticConfig.isText || staticConfig.isInput ? stylePropsText : validStyles);
10293
10319
  var styleState = {
@@ -590,9 +590,179 @@ var getTokens = function() {
590
590
  };
591
591
  function setupDev(conf2) {
592
592
  }
593
- var cache$4 = /* @__PURE__ */ new Map(), cacheSize = 0, simpleHash = function(strIn) {
593
+ var matchMediaImpl = matchMediaFallback, matchMedia$1 = function() {
594
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
595
+ return matchMediaImpl(...args);
596
+ };
597
+ function matchMediaFallback(query) {
598
+ return !process.env.IS_STATIC && false, {
599
+ match: function(a, b2) {
600
+ return false;
601
+ },
602
+ addListener: function() {
603
+ },
604
+ removeListener: function() {
605
+ },
606
+ matches: false
607
+ };
608
+ }
609
+ function setupMatchMedia(_2) {
610
+ matchMediaImpl = _2, globalThis.matchMedia = _2;
611
+ }
612
+ exports.mediaState = // development only safeguard
613
+ {};
614
+ var mediaQueryConfig = {}, getMedia = function() {
615
+ return exports.mediaState;
616
+ }, mediaKeys = /* @__PURE__ */ new Set(), mediaKeyRegex = /\$(platform|theme|group)-/, getMediaKey = function(key) {
617
+ if (key[0] !== "$") return false;
618
+ if (mediaKeys.has(key)) return true;
619
+ var match = key.match(mediaKeyRegex);
620
+ return match ? match[1] : false;
621
+ }, initState, mediaKeysOrdered, getMediaKeyImportance = function(key) {
622
+ return mediaKeysOrdered.indexOf(key) + 100;
623
+ }, dispose = /* @__PURE__ */ new Set(), mediaVersion = 0, configureMedia = function(config) {
624
+ var {
625
+ media
626
+ } = config, mediaQueryDefaultActive = getSetting("mediaQueryDefaultActive");
627
+ if (media) {
628
+ mediaVersion++;
629
+ for (var key in media) exports.mediaState[key] = (mediaQueryDefaultActive == null ? void 0 : mediaQueryDefaultActive[key]) || false, mediaKeys.add(`$${key}`);
630
+ Object.assign(mediaQueryConfig, media), initState = __spreadValues({}, exports.mediaState), mediaKeysOrdered = Object.keys(media), setupMediaListeners();
631
+ }
632
+ };
633
+ function unlisten() {
634
+ dispose.forEach(function(cb) {
635
+ return cb();
636
+ }), dispose.clear();
637
+ }
638
+ var setupVersion = -1;
639
+ function setupMediaListeners() {
640
+ var _loop2 = function(key2) {
641
+ var str = mediaObjectToString(mediaQueryConfig[key2]), getMatch = function() {
642
+ return matchMedia$1(str);
643
+ }, match = getMatch();
644
+ if (!match) throw new Error("⚠️ No match");
645
+ match.addListener(update), dispose.add(function() {
646
+ match.removeListener(update);
647
+ });
648
+ function update() {
649
+ var next = !!getMatch().matches;
650
+ next !== exports.mediaState[key2] && (exports.mediaState = __spreadProps(__spreadValues({}, exports.mediaState), {
651
+ [key2]: next
652
+ }), updateMediaListeners());
653
+ }
654
+ update();
655
+ };
656
+ if (!process.env.IS_STATIC && setupVersion !== mediaVersion) {
657
+ setupVersion = mediaVersion, unlisten();
658
+ for (var key in mediaQueryConfig) _loop2(key);
659
+ }
660
+ }
661
+ var listeners = /* @__PURE__ */ new Set();
662
+ function updateMediaListeners() {
663
+ listeners.forEach(function(cb) {
664
+ return cb(exports.mediaState);
665
+ });
666
+ }
667
+ var States = /* @__PURE__ */ new WeakMap();
668
+ function setMediaShouldUpdate(ref, enabled, keys) {
669
+ var cur = States.get(ref);
670
+ (!cur || cur.enabled !== enabled || keys) && States.set(ref, __spreadProps(__spreadValues({}, cur), {
671
+ enabled,
672
+ keys
673
+ }));
674
+ }
675
+ function subscribe(subscriber) {
676
+ return listeners.add(subscriber), function() {
677
+ listeners.delete(subscriber);
678
+ };
679
+ }
680
+ function useMedia(componentContext, debug) {
681
+ var componentState = componentContext ? States.get(componentContext) : null, internalRef = React.useRef(null);
682
+ internalRef.current || (internalRef.current = {
683
+ keys: /* @__PURE__ */ new Set(),
684
+ lastState: exports.mediaState
685
+ }), internalRef.current.pendingState && (internalRef.current.lastState = internalRef.current.pendingState, internalRef.current.pendingState = void 0);
686
+ var {
687
+ keys
688
+ } = internalRef.current;
689
+ keys.size && keys.clear();
690
+ var state = React.useSyncExternalStore(subscribe, function() {
691
+ var curKeys2 = (componentState == null ? void 0 : componentState.keys) || keys, {
692
+ lastState,
693
+ pendingState
694
+ } = internalRef.current;
695
+ if (!curKeys2.size) return lastState;
696
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
697
+ try {
698
+ for (var _iterator = curKeys2[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
699
+ var key = _step.value;
700
+ if (exports.mediaState[key] !== (pendingState || lastState)[key]) return false, (componentContext == null ? void 0 : componentContext.mediaEmit) ? (componentContext.mediaEmit(exports.mediaState), internalRef.current.pendingState = exports.mediaState, lastState) : (internalRef.current.lastState = exports.mediaState, exports.mediaState);
701
+ }
702
+ } catch (err) {
703
+ _didIteratorError = true, _iteratorError = err;
704
+ } finally {
705
+ try {
706
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
707
+ } finally {
708
+ if (_didIteratorError) throw _iteratorError;
709
+ }
710
+ }
711
+ return lastState;
712
+ }, getServerSnapshot);
713
+ return new Proxy(state, {
714
+ get(_2, key) {
715
+ return !disableMediaTouch && typeof key == "string" && keys.add(key), Reflect.get(state, key);
716
+ }
717
+ });
718
+ }
719
+ var getServerSnapshot = function() {
720
+ return initState;
721
+ }, disableMediaTouch = false;
722
+ function _disableMediaTouch(val) {
723
+ disableMediaTouch = val;
724
+ }
725
+ function getMediaState(mediaGroups, layout) {
726
+ disableMediaTouch = true;
727
+ var res;
728
+ try {
729
+ res = Object.fromEntries([...mediaGroups].map(function(mediaKey) {
730
+ return [mediaKey, mediaKeyMatch(mediaKey, layout)];
731
+ }));
732
+ } finally {
733
+ disableMediaTouch = false;
734
+ }
735
+ return res;
736
+ }
737
+ var getMediaImportanceIfMoreImportant = function(mediaKey, key, styleState, isSizeMedia) {
738
+ var importance = isSizeMedia ? getMediaKeyImportance(mediaKey) : defaultMediaImportance, usedKeys = styleState.usedKeys;
739
+ return !usedKeys[key] || importance > usedKeys[key] ? importance : null;
740
+ };
741
+ function camelToHyphen(str) {
742
+ return str.replace(/[A-Z]/g, function(m) {
743
+ return `-${m.toLowerCase()}`;
744
+ }).toLowerCase();
745
+ }
746
+ var cache$4 = /* @__PURE__ */ new WeakMap();
747
+ function mediaObjectToString(query, key) {
748
+ if (typeof query == "string") return query;
749
+ if (cache$4.has(query)) return cache$4.get(query);
750
+ var res = Object.entries(query).map(function(param) {
751
+ var [feature, value] = param;
752
+ return feature = camelToHyphen(feature), typeof value == "string" ? `(${feature}: ${value})` : (typeof value == "number" && /[height|width]$/.test(feature) && (value = `${value}px`), `(${feature}: ${value})`);
753
+ }).join(" and ");
754
+ return cache$4.set(query, res), res;
755
+ }
756
+ function mediaKeyMatch(key, dimensions) {
757
+ var mediaQueries = mediaQueryConfig[key], result = Object.keys(mediaQueries).every(function(query) {
758
+ var expectedVal = +mediaQueries[query], isMax = query.startsWith("max"), isWidth = query.endsWith("Width"), givenVal = dimensions[isWidth ? "width" : "height"];
759
+ return isMax ? givenVal < expectedVal : givenVal > expectedVal;
760
+ });
761
+ return result;
762
+ }
763
+ var cache$3 = /* @__PURE__ */ new Map(), cacheSize = 0, simpleHash = function(strIn) {
594
764
  var hashMin = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 10;
595
- if (cache$4.has(strIn)) return cache$4.get(strIn);
765
+ if (cache$3.has(strIn)) return cache$3.get(strIn);
596
766
  var str = strIn;
597
767
  str[0] === "v" && str.startsWith("var(") && (str = str.slice(6, str.length - 1));
598
768
  for (var hash = 0, valids = "", added = 0, len = str.length, i = 0; i < len; i++) {
@@ -610,7 +780,7 @@ var cache$4 = /* @__PURE__ */ new Map(), cacheSize = 0, simpleHash = function(st
610
780
  hash = hashChar(hash, str[i]);
611
781
  }
612
782
  var res = valids + (hash ? Math.abs(hash) : "");
613
- return cacheSize > 1e4 && (cache$4.clear(), cacheSize = 0), cache$4.set(strIn, res), cacheSize++, res;
783
+ return cacheSize > 1e4 && (cache$3.clear(), cacheSize = 0), cache$3.set(strIn, res), cacheSize++, res;
614
784
  }, hashChar = function(hash, c) {
615
785
  return Math.imul(31, hash) + c.charCodeAt(0) | 0;
616
786
  };
@@ -1069,6 +1239,26 @@ function px(value) {
1069
1239
  function getOppositeScheme(scheme) {
1070
1240
  return scheme === "dark" ? "light" : "dark";
1071
1241
  }
1242
+ var colorStyleKeys = {
1243
+ backgroundColor: true,
1244
+ borderColor: true,
1245
+ borderTopColor: true,
1246
+ borderRightColor: true,
1247
+ borderBottomColor: true,
1248
+ borderLeftColor: true,
1249
+ borderBlockColor: true,
1250
+ borderBlockEndColor: true,
1251
+ borderBlockStartColor: true,
1252
+ color: true,
1253
+ shadowColor: true,
1254
+ textDecorationColor: true,
1255
+ textShadowColor: true,
1256
+ tintColor: true,
1257
+ outlineColor: true
1258
+ };
1259
+ function isColorStyleKey(key) {
1260
+ return colorStyleKeys[key] === true;
1261
+ }
1072
1262
  function getDynamicVal(param) {
1073
1263
  var {
1074
1264
  scheme,
@@ -1318,11 +1508,11 @@ function doesRootSchemeMatchSystem() {
1318
1508
  var _getRootThemeState;
1319
1509
  return ((_getRootThemeState = getRootThemeState()) === null || _getRootThemeState === void 0 ? void 0 : _getRootThemeState.scheme) === reactNative.Appearance.getColorScheme();
1320
1510
  }
1321
- var cache$3 = /* @__PURE__ */ new Map(), curKeys, curProps, curState, emptyObject = {};
1511
+ var cache$2 = /* @__PURE__ */ new Map(), curKeys, curProps, curState, emptyObject = {};
1322
1512
  function getThemeProxied(_props, _state, _keys) {
1323
1513
  if (!(_state == null ? void 0 : _state.theme)) return emptyObject;
1324
- if (curKeys = _keys, curProps = _props, curState = _state, cache$3.has(curState.theme)) {
1325
- var proxied = cache$3.get(curState.theme);
1514
+ if (curKeys = _keys, curProps = _props, curState = _state, cache$2.has(curState.theme)) {
1515
+ var proxied = cache$2.get(curState.theme);
1326
1516
  return proxied;
1327
1517
  }
1328
1518
  var config = getConfig();
@@ -1354,7 +1544,7 @@ function getThemeProxied(_props, _state, _keys) {
1354
1544
  });
1355
1545
  return [[key, proxied2], [`$${key}`, proxied2]];
1356
1546
  }));
1357
- return cache$3.set(_state.theme, proxied1), proxied1;
1547
+ return cache$2.set(_state.theme, proxied1), proxied1;
1358
1548
  }
1359
1549
  var EMPTY = {}, useTheme = function() {
1360
1550
  var [theme] = useThemeWithState(EMPTY), res = theme;
@@ -1370,10 +1560,14 @@ var _withStableStyle = function(Component, styleProvider) {
1370
1560
  _expressions = []
1371
1561
  } = _a, rest = __objRest(_a, [
1372
1562
  "_expressions"
1373
- ]), theme = useTheme();
1563
+ ]), theme = useTheme(), hasMediaKeys = _expressions.some(function(expr) {
1564
+ return typeof expr == "string";
1565
+ }), media = hasMediaKeys ? useMedia() : null, resolvedExpressions = media ? _expressions.map(function(expr) {
1566
+ return typeof expr == "string" ? media[expr] : expr;
1567
+ }) : _expressions;
1374
1568
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, __spreadValues({
1375
1569
  ref,
1376
- style: styleProvider(theme, _expressions)
1570
+ style: styleProvider(theme, resolvedExpressions)
1377
1571
  }, rest));
1378
1572
  });
1379
1573
  };
@@ -1406,176 +1600,6 @@ var defaultComponentState = {
1406
1600
  }), defaultComponentStateShouldEnter = __spreadProps(__spreadValues({}, defaultComponentState), {
1407
1601
  unmounted: "should-enter"
1408
1602
  });
1409
- var matchMediaImpl = matchMediaFallback, matchMedia$1 = function() {
1410
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
1411
- return matchMediaImpl(...args);
1412
- };
1413
- function matchMediaFallback(query) {
1414
- return !process.env.IS_STATIC && false, {
1415
- match: function(a, b2) {
1416
- return false;
1417
- },
1418
- addListener: function() {
1419
- },
1420
- removeListener: function() {
1421
- },
1422
- matches: false
1423
- };
1424
- }
1425
- function setupMatchMedia(_2) {
1426
- matchMediaImpl = _2, globalThis.matchMedia = _2;
1427
- }
1428
- exports.mediaState = // development only safeguard
1429
- {};
1430
- var mediaQueryConfig = {}, getMedia = function() {
1431
- return exports.mediaState;
1432
- }, mediaKeys = /* @__PURE__ */ new Set(), mediaKeyRegex = /\$(platform|theme|group)-/, getMediaKey = function(key) {
1433
- if (key[0] !== "$") return false;
1434
- if (mediaKeys.has(key)) return true;
1435
- var match = key.match(mediaKeyRegex);
1436
- return match ? match[1] : false;
1437
- }, initState, mediaKeysOrdered, getMediaKeyImportance = function(key) {
1438
- return mediaKeysOrdered.indexOf(key) + 100;
1439
- }, dispose = /* @__PURE__ */ new Set(), mediaVersion = 0, configureMedia = function(config) {
1440
- var {
1441
- media
1442
- } = config, mediaQueryDefaultActive = getSetting("mediaQueryDefaultActive");
1443
- if (media) {
1444
- mediaVersion++;
1445
- for (var key in media) exports.mediaState[key] = (mediaQueryDefaultActive == null ? void 0 : mediaQueryDefaultActive[key]) || false, mediaKeys.add(`$${key}`);
1446
- Object.assign(mediaQueryConfig, media), initState = __spreadValues({}, exports.mediaState), mediaKeysOrdered = Object.keys(media), setupMediaListeners();
1447
- }
1448
- };
1449
- function unlisten() {
1450
- dispose.forEach(function(cb) {
1451
- return cb();
1452
- }), dispose.clear();
1453
- }
1454
- var setupVersion = -1;
1455
- function setupMediaListeners() {
1456
- var _loop2 = function(key2) {
1457
- var str = mediaObjectToString(mediaQueryConfig[key2]), getMatch = function() {
1458
- return matchMedia$1(str);
1459
- }, match = getMatch();
1460
- if (!match) throw new Error("⚠️ No match");
1461
- match.addListener(update), dispose.add(function() {
1462
- match.removeListener(update);
1463
- });
1464
- function update() {
1465
- var next = !!getMatch().matches;
1466
- next !== exports.mediaState[key2] && (exports.mediaState = __spreadProps(__spreadValues({}, exports.mediaState), {
1467
- [key2]: next
1468
- }), updateMediaListeners());
1469
- }
1470
- update();
1471
- };
1472
- if (!process.env.IS_STATIC && setupVersion !== mediaVersion) {
1473
- setupVersion = mediaVersion, unlisten();
1474
- for (var key in mediaQueryConfig) _loop2(key);
1475
- }
1476
- }
1477
- var listeners = /* @__PURE__ */ new Set();
1478
- function updateMediaListeners() {
1479
- listeners.forEach(function(cb) {
1480
- return cb(exports.mediaState);
1481
- });
1482
- }
1483
- var States = /* @__PURE__ */ new WeakMap();
1484
- function setMediaShouldUpdate(ref, enabled, keys) {
1485
- var cur = States.get(ref);
1486
- (!cur || cur.enabled !== enabled || keys) && States.set(ref, __spreadProps(__spreadValues({}, cur), {
1487
- enabled,
1488
- keys
1489
- }));
1490
- }
1491
- function subscribe(subscriber) {
1492
- return listeners.add(subscriber), function() {
1493
- listeners.delete(subscriber);
1494
- };
1495
- }
1496
- function useMedia(componentContext, debug) {
1497
- var componentState = componentContext ? States.get(componentContext) : null, internalRef = React.useRef(null);
1498
- internalRef.current || (internalRef.current = {
1499
- keys: /* @__PURE__ */ new Set(),
1500
- lastState: exports.mediaState
1501
- }), internalRef.current.pendingState && (internalRef.current.lastState = internalRef.current.pendingState, internalRef.current.pendingState = void 0);
1502
- var {
1503
- keys
1504
- } = internalRef.current;
1505
- keys.size && keys.clear();
1506
- var state = React.useSyncExternalStore(subscribe, function() {
1507
- var curKeys2 = (componentState == null ? void 0 : componentState.keys) || keys, {
1508
- lastState,
1509
- pendingState
1510
- } = internalRef.current;
1511
- if (!curKeys2.size) return lastState;
1512
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
1513
- try {
1514
- for (var _iterator = curKeys2[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
1515
- var key = _step.value;
1516
- if (exports.mediaState[key] !== (pendingState || lastState)[key]) return false, (componentContext == null ? void 0 : componentContext.mediaEmit) ? (componentContext.mediaEmit(exports.mediaState), internalRef.current.pendingState = exports.mediaState, lastState) : (internalRef.current.lastState = exports.mediaState, exports.mediaState);
1517
- }
1518
- } catch (err) {
1519
- _didIteratorError = true, _iteratorError = err;
1520
- } finally {
1521
- try {
1522
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
1523
- } finally {
1524
- if (_didIteratorError) throw _iteratorError;
1525
- }
1526
- }
1527
- return lastState;
1528
- }, getServerSnapshot);
1529
- return new Proxy(state, {
1530
- get(_2, key) {
1531
- return !disableMediaTouch && typeof key == "string" && keys.add(key), Reflect.get(state, key);
1532
- }
1533
- });
1534
- }
1535
- var getServerSnapshot = function() {
1536
- return initState;
1537
- }, disableMediaTouch = false;
1538
- function _disableMediaTouch(val) {
1539
- disableMediaTouch = val;
1540
- }
1541
- function getMediaState(mediaGroups, layout) {
1542
- disableMediaTouch = true;
1543
- var res;
1544
- try {
1545
- res = Object.fromEntries([...mediaGroups].map(function(mediaKey) {
1546
- return [mediaKey, mediaKeyMatch(mediaKey, layout)];
1547
- }));
1548
- } finally {
1549
- disableMediaTouch = false;
1550
- }
1551
- return res;
1552
- }
1553
- var getMediaImportanceIfMoreImportant = function(mediaKey, key, styleState, isSizeMedia) {
1554
- var importance = isSizeMedia ? getMediaKeyImportance(mediaKey) : defaultMediaImportance, usedKeys = styleState.usedKeys;
1555
- return !usedKeys[key] || importance > usedKeys[key] ? importance : null;
1556
- };
1557
- function camelToHyphen(str) {
1558
- return str.replace(/[A-Z]/g, function(m) {
1559
- return `-${m.toLowerCase()}`;
1560
- }).toLowerCase();
1561
- }
1562
- var cache$2 = /* @__PURE__ */ new WeakMap();
1563
- function mediaObjectToString(query, key) {
1564
- if (typeof query == "string") return query;
1565
- if (cache$2.has(query)) return cache$2.get(query);
1566
- var res = Object.entries(query).map(function(param) {
1567
- var [feature, value] = param;
1568
- return feature = camelToHyphen(feature), typeof value == "string" ? `(${feature}: ${value})` : (typeof value == "number" && /[height|width]$/.test(feature) && (value = `${value}px`), `(${feature}: ${value})`);
1569
- }).join(" and ");
1570
- return cache$2.set(query, res), res;
1571
- }
1572
- function mediaKeyMatch(key, dimensions) {
1573
- var mediaQueries = mediaQueryConfig[key], result = Object.keys(mediaQueries).every(function(query) {
1574
- var expectedVal = +mediaQueries[query], isMax = query.startsWith("max"), isWidth = query.endsWith("Width"), givenVal = dimensions[isWidth ? "width" : "height"];
1575
- return isMax ? givenVal < expectedVal : givenVal > expectedVal;
1576
- });
1577
- return result;
1578
- }
1579
1603
  function getGroupPropParts(groupProp) {
1580
1604
  var mediaQueries = getMedia(), [_2, name, part3, part4] = groupProp.split("-"), pseudo, media = part3 in mediaQueries ? part3 : void 0;
1581
1605
  return media ? pseudo = part4 : pseudo = part3, {
@@ -2905,12 +2929,16 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2905
2929
  }
2906
2930
  var mediaStyle1 = getSubStyle(styleState, key4, val2, true), importanceBump = 0;
2907
2931
  if (isThemeMedia) {
2908
- if (dynamicThemeAccess = true, isIos && getSetting("fastSchemeChange")) {
2932
+ if (isIos && getSetting("fastSchemeChange")) {
2909
2933
  var _styleState3;
2910
2934
  (_styleState3 = styleState).style || (_styleState3.style = {});
2911
- var scheme = mediaKeyShort, oppositeScheme = getOppositeScheme(mediaKeyShort), themeOriginalValues = styleOriginalValues.get(mediaStyle1);
2935
+ var scheme = mediaKeyShort, oppositeScheme = getOppositeScheme(mediaKeyShort), themeOriginalValues = styleOriginalValues.get(mediaStyle1), isCurrentScheme = themeName === scheme || themeName.startsWith(scheme);
2912
2936
  for (var subKey1 in mediaStyle1) {
2913
2937
  var _$val1 = extractValueFromDynamic(mediaStyle1[subKey1], scheme), existing = styleState.style[subKey1];
2938
+ if (!isColorStyleKey(subKey1)) {
2939
+ dynamicThemeAccess = true, isCurrentScheme ? mediaStyle1[subKey1] = _$val1 : delete mediaStyle1[subKey1];
2940
+ continue;
2941
+ }
2914
2942
  if (existing == null ? void 0 : existing.dynamic) existing.dynamic[scheme] = _$val1, mediaStyle1[subKey1] = existing;
2915
2943
  else {
2916
2944
  var oppositeVal = extractValueFromDynamic(existing, oppositeScheme);
@@ -2921,7 +2949,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2921
2949
  }), mergeStyle(styleState, subKey1, mediaStyle1[subKey1], priority, false, themeOriginalValues == null ? void 0 : themeOriginalValues[subKey1]);
2922
2950
  }
2923
2951
  }
2924
- } else if (!(themeName === mediaKeyShort || themeName.startsWith(mediaKeyShort))) return;
2952
+ } else if (dynamicThemeAccess = true, !(themeName === mediaKeyShort || themeName.startsWith(mediaKeyShort))) return;
2925
2953
  } else if (isGroupMedia) {
2926
2954
  var _groupContext_groupName, _componentState_group, groupInfo = getGroupPropParts(mediaKeyShort), groupName = groupInfo.name, groupState = groupContext == null || (_groupContext_groupName = groupContext[groupName]) === null || _groupContext_groupName === void 0 ? void 0 : _groupContext_groupName.state, groupPseudoKey = groupInfo.pseudo, groupMediaKey = groupInfo.media;
2927
2955
  if (!groupState) {
@@ -2980,9 +3008,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2980
3008
  inlineWhenUnflattened,
2981
3009
  parentStaticConfig,
2982
3010
  acceptsClassName
2983
- } = staticConfig, viewProps = {}, mediaState = styleProps.mediaState || exports.mediaState, shouldDoClasses = acceptsClassName && isWeb, rulesToInsert = void 0, classNames = {}, pseudos = null;
2984
- props.space;
2985
- var hasMedia = false, dynamicThemeAccess, pseudoGroups, mediaGroups;
3011
+ } = staticConfig, viewProps = {}, mediaState = styleProps.mediaState || exports.mediaState, shouldDoClasses = acceptsClassName && isWeb, rulesToInsert = void 0, classNames = {}, pseudos = null, hasMedia = false, dynamicThemeAccess, pseudoGroups, mediaGroups;
2986
3012
  props.className || "";
2987
3013
  var mediaStylesSeen = 0, validStyles$1 = staticConfig.validStyles || (staticConfig.isText || staticConfig.isInput ? stylePropsText : validStyles);
2988
3014
  var styleState = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/core",
3
- "version": "2.0.0-1768427228811",
3
+ "version": "2.0.0-1768530912818",
4
4
  "type": "module",
5
5
  "source": "src/index.tsx",
6
6
  "main": "dist/cjs",
@@ -33,18 +33,18 @@
33
33
  "native-test.d.ts"
34
34
  ],
35
35
  "dependencies": {
36
- "@tamagui/helpers": "2.0.0-1768427228811",
37
- "@tamagui/react-native-media-driver": "2.0.0-1768427228811",
38
- "@tamagui/react-native-use-pressable": "2.0.0-1768427228811",
39
- "@tamagui/react-native-use-responder-events": "2.0.0-1768427228811",
40
- "@tamagui/use-element-layout": "2.0.0-1768427228811",
41
- "@tamagui/use-event": "2.0.0-1768427228811",
42
- "@tamagui/web": "2.0.0-1768427228811"
36
+ "@tamagui/helpers": "2.0.0-1768530912818",
37
+ "@tamagui/react-native-media-driver": "2.0.0-1768530912818",
38
+ "@tamagui/react-native-use-pressable": "2.0.0-1768530912818",
39
+ "@tamagui/react-native-use-responder-events": "2.0.0-1768530912818",
40
+ "@tamagui/use-element-layout": "2.0.0-1768530912818",
41
+ "@tamagui/use-event": "2.0.0-1768530912818",
42
+ "@tamagui/web": "2.0.0-1768530912818"
43
43
  },
44
44
  "devDependencies": {
45
- "@tamagui/build": "2.0.0-1768427228811",
46
- "@tamagui/native-bundle": "2.0.0-1768427228811",
47
- "@tamagui/react-native-web-lite": "2.0.0-1768427228811",
45
+ "@tamagui/build": "2.0.0-1768530912818",
46
+ "@tamagui/native-bundle": "2.0.0-1768530912818",
47
+ "@tamagui/react-native-web-lite": "2.0.0-1768530912818",
48
48
  "@testing-library/react": "^16.1.0",
49
49
  "csstype": "^3.0.10",
50
50
  "react": "*",