@tamagui/core 2.0.0-1768427228811 → 2.0.0-1768586279389

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.
@@ -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
  };
@@ -698,13 +868,14 @@ var webOnlyStylePropsView = {
698
868
  borderLeftStyle: true,
699
869
  borderRightStyle: true,
700
870
  borderTopStyle: true,
701
- boxSizing: true,
871
+ // boxSizing: now supported in RN 0.77+ (New Architecture)
702
872
  caretColor: true,
703
873
  clipPath: true,
704
874
  contain: true,
705
875
  containerType: true,
706
876
  content: true,
707
877
  cursor: true,
878
+ // NOTE: cursor is supported on iOS 17+ for trackpad/stylus
708
879
  float: true,
709
880
  mask: true,
710
881
  maskBorder: true,
@@ -723,13 +894,10 @@ var webOnlyStylePropsView = {
723
894
  maskRepeat: true,
724
895
  maskSize: true,
725
896
  maskType: true,
726
- mixBlendMode: true,
897
+ // mixBlendMode: now supported in RN 0.77+ (New Architecture)
727
898
  objectFit: true,
728
899
  objectPosition: true,
729
- outlineOffset: true,
730
- outlineStyle: true,
731
- outlineWidth: true,
732
- outlineColor: true,
900
+ // outline*: now supported in RN 0.77+ (New Architecture)
733
901
  overflowBlock: true,
734
902
  overflowInline: true,
735
903
  overflowX: true,
@@ -785,7 +953,7 @@ var textColors = {
785
953
  zIndex: {
786
954
  zIndex: true
787
955
  },
788
- color: __spreadValues({
956
+ color: __spreadProps(__spreadValues({
789
957
  backgroundColor: true,
790
958
  borderColor: true,
791
959
  borderBlockStartColor: true,
@@ -801,7 +969,10 @@ var textColors = {
801
969
  borderEndColor: true,
802
970
  borderStartColor: true,
803
971
  shadowColor: true
804
- }, textColors)
972
+ }, textColors), {
973
+ // outlineColor is supported on RN 0.77+ (New Architecture)
974
+ outlineColor: true
975
+ })
805
976
  }, stylePropsUnitless = {
806
977
  WebkitLineClamp: true,
807
978
  animationIterationCount: true,
@@ -854,7 +1025,7 @@ var textColors = {
854
1025
  rotateY: true,
855
1026
  rotateX: true,
856
1027
  rotateZ: true
857
- }, stylePropsView = __spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
1028
+ }, stylePropsView = __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
858
1029
  backfaceVisibility: true,
859
1030
  borderBottomEndRadius: true,
860
1031
  borderBottomStartRadius: true,
@@ -944,12 +1115,13 @@ var textColors = {
944
1115
  elevationAndroid: true
945
1116
  } : {}), {
946
1117
  boxShadow: true,
947
- filter: true
948
- }), !process.env.REACT_NATIVE_PRE_77 && {
1118
+ filter: true,
1119
+ // RN 0.76/0.77+ style props (New Architecture)
949
1120
  boxSizing: true,
950
1121
  mixBlendMode: true,
1122
+ isolation: true,
951
1123
  outlineColor: true,
952
- outlineSpread: true,
1124
+ outlineOffset: true,
953
1125
  outlineStyle: true,
954
1126
  outlineWidth: true
955
1127
  }), stylePropsFont = {
@@ -1069,6 +1241,26 @@ function px(value) {
1069
1241
  function getOppositeScheme(scheme) {
1070
1242
  return scheme === "dark" ? "light" : "dark";
1071
1243
  }
1244
+ var colorStyleKeys = {
1245
+ backgroundColor: true,
1246
+ borderColor: true,
1247
+ borderTopColor: true,
1248
+ borderRightColor: true,
1249
+ borderBottomColor: true,
1250
+ borderLeftColor: true,
1251
+ borderBlockColor: true,
1252
+ borderBlockEndColor: true,
1253
+ borderBlockStartColor: true,
1254
+ color: true,
1255
+ shadowColor: true,
1256
+ textDecorationColor: true,
1257
+ textShadowColor: true,
1258
+ tintColor: true,
1259
+ outlineColor: true
1260
+ };
1261
+ function isColorStyleKey(key) {
1262
+ return colorStyleKeys[key] === true;
1263
+ }
1072
1264
  function getDynamicVal(param) {
1073
1265
  var {
1074
1266
  scheme,
@@ -1318,11 +1510,11 @@ function doesRootSchemeMatchSystem() {
1318
1510
  var _getRootThemeState;
1319
1511
  return ((_getRootThemeState = getRootThemeState()) === null || _getRootThemeState === void 0 ? void 0 : _getRootThemeState.scheme) === reactNative.Appearance.getColorScheme();
1320
1512
  }
1321
- var cache$3 = /* @__PURE__ */ new Map(), curKeys, curProps, curState, emptyObject = {};
1513
+ var cache$2 = /* @__PURE__ */ new Map(), curKeys, curProps, curState, emptyObject = {};
1322
1514
  function getThemeProxied(_props, _state, _keys) {
1323
1515
  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);
1516
+ if (curKeys = _keys, curProps = _props, curState = _state, cache$2.has(curState.theme)) {
1517
+ var proxied = cache$2.get(curState.theme);
1326
1518
  return proxied;
1327
1519
  }
1328
1520
  var config = getConfig();
@@ -1354,7 +1546,7 @@ function getThemeProxied(_props, _state, _keys) {
1354
1546
  });
1355
1547
  return [[key, proxied2], [`$${key}`, proxied2]];
1356
1548
  }));
1357
- return cache$3.set(_state.theme, proxied1), proxied1;
1549
+ return cache$2.set(_state.theme, proxied1), proxied1;
1358
1550
  }
1359
1551
  var EMPTY = {}, useTheme = function() {
1360
1552
  var [theme] = useThemeWithState(EMPTY), res = theme;
@@ -1370,10 +1562,14 @@ var _withStableStyle = function(Component, styleProvider) {
1370
1562
  _expressions = []
1371
1563
  } = _a, rest = __objRest(_a, [
1372
1564
  "_expressions"
1373
- ]), theme = useTheme();
1565
+ ]), theme = useTheme(), hasMediaKeys = _expressions.some(function(expr) {
1566
+ return typeof expr == "string";
1567
+ }), media = hasMediaKeys ? useMedia() : null, resolvedExpressions = media ? _expressions.map(function(expr) {
1568
+ return typeof expr == "string" ? media[expr] : expr;
1569
+ }) : _expressions;
1374
1570
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, __spreadValues({
1375
1571
  ref,
1376
- style: styleProvider(theme, _expressions)
1572
+ style: styleProvider(theme, resolvedExpressions)
1377
1573
  }, rest));
1378
1574
  });
1379
1575
  };
@@ -1406,176 +1602,6 @@ var defaultComponentState = {
1406
1602
  }), defaultComponentStateShouldEnter = __spreadProps(__spreadValues({}, defaultComponentState), {
1407
1603
  unmounted: "should-enter"
1408
1604
  });
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
1605
  function getGroupPropParts(groupProp) {
1580
1606
  var mediaQueries = getMedia(), [_2, name, part3, part4] = groupProp.split("-"), pseudo, media = part3 in mediaQueries ? part3 : void 0;
1581
1607
  return media ? pseudo = part4 : pseudo = part3, {
@@ -1827,14 +1853,14 @@ function requireNormalizeColor() {
1827
1853
  return (int % 360 + 360) % 360 / 360;
1828
1854
  }
1829
1855
  function parse1(str) {
1830
- const num = parseFloat(str);
1831
- if (num < 0) {
1856
+ const num2 = parseFloat(str);
1857
+ if (num2 < 0) {
1832
1858
  return 0;
1833
1859
  }
1834
- if (num > 1) {
1860
+ if (num2 > 1) {
1835
1861
  return 255;
1836
1862
  }
1837
- return Math.round(num * 255);
1863
+ return Math.round(num2 * 255);
1838
1864
  }
1839
1865
  function parsePercentage(str) {
1840
1866
  const int = parseFloat(str);
@@ -2328,9 +2354,58 @@ var _loop = function(parent) {
2328
2354
  EXPANSIONS[parent] = EXPANSIONS[parent].map(function(k) {
2329
2355
  return `${prefix}${k}`;
2330
2356
  });
2357
+ }, num = function(v) {
2358
+ return Number.parseFloat(v) || 0;
2359
+ }, parseBoxShadowStr = function(s2) {
2360
+ return s2.split(/,(?![^(]*\))/).map(function(sh) {
2361
+ var p = sh.trim().split(/\s+/), i = p[0] === "inset" ? 1 : 0, o = {
2362
+ offsetX: num(p[i++]),
2363
+ offsetY: num(p[i++])
2364
+ };
2365
+ return p[0] === "inset" && (o.inset = true), p[i] && /^-?[\d.]/.test(p[i]) && (o.blurRadius = num(p[i++])), p[i] && /^-?[\d.]/.test(p[i]) && (o.spreadDistance = num(p[i++])), p[i] && (o.color = p.slice(i).join(" ")), o;
2366
+ });
2367
+ }, simpleFilters = /* @__PURE__ */ new Set(["brightness", "opacity", "contrast", "grayscale", "invert", "saturate", "sepia", "blur"]), parseFilterStr = function(s2) {
2368
+ var r = [], _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
2369
+ try {
2370
+ for (var _iterator = s2.matchAll(/(\w+)\(([^)]+)\)/g)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
2371
+ var [, fn, val] = _step.value, n = +val || 0;
2372
+ if (simpleFilters.has(fn)) r.push({
2373
+ [fn]: n
2374
+ });
2375
+ else if (fn === "hueRotate" || fn === "hue-rotate") r.push({
2376
+ hueRotate: val
2377
+ });
2378
+ else if (fn === "dropShadow" || fn === "drop-shadow") {
2379
+ var p = val.trim().split(/\s+/), ds = {
2380
+ offsetX: num(p[0]),
2381
+ offsetY: num(p[1])
2382
+ };
2383
+ p[2] && /^-?[\d.]/.test(p[2]) ? (ds.blurRadius = num(p[2]), p[3] && (ds.color = p.slice(3).join(" "))) : p[2] && (ds.color = p.slice(2).join(" ")), r.push({
2384
+ dropShadow: ds
2385
+ });
2386
+ }
2387
+ }
2388
+ } catch (err) {
2389
+ _didIteratorError = true, _iteratorError = err;
2390
+ } finally {
2391
+ try {
2392
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
2393
+ } finally {
2394
+ if (_didIteratorError) throw _iteratorError;
2395
+ }
2396
+ }
2397
+ return r;
2331
2398
  };
2332
2399
  function expandStyle(key, value) {
2333
2400
  if (isAndroid && key === "elevationAndroid") return [["elevation", value]];
2401
+ if (key === "boxShadow") {
2402
+ if (typeof value == "string") return [["boxShadow", parseBoxShadowStr(value)]];
2403
+ if (value && !Array.isArray(value)) return [["boxShadow", [value]]];
2404
+ }
2405
+ if (key === "filter") {
2406
+ if (typeof value == "string") return [["filter", parseFilterStr(value)]];
2407
+ if (value && !Array.isArray(value)) return [["filter", [value]]];
2408
+ }
2334
2409
  if (key in EXPANSIONS) return EXPANSIONS[key].map(function(key2) {
2335
2410
  return [key2, value];
2336
2411
  });
@@ -2339,18 +2414,17 @@ function expandStyle(key, value) {
2339
2414
  });
2340
2415
  if (key in webToNativeDynamicExpansion) return webToNativeDynamicExpansion[key](value);
2341
2416
  }
2342
- var all = ["Top", "Right", "Bottom", "Left"], horiz = ["Right", "Left"], vert = ["Top", "Bottom"], xy = ["X", "Y"], EXPANSIONS = __spreadValues({
2417
+ var all = ["Top", "Right", "Bottom", "Left"], horiz = ["Right", "Left"], vert = ["Top", "Bottom"], EXPANSIONS = {
2343
2418
  borderColor: ["TopColor", "RightColor", "BottomColor", "LeftColor"],
2344
2419
  borderRadius: ["TopLeftRadius", "TopRightRadius", "BottomRightRadius", "BottomLeftRadius"],
2345
2420
  borderWidth: ["TopWidth", "RightWidth", "BottomWidth", "LeftWidth"],
2346
2421
  margin: all,
2347
2422
  marginHorizontal: horiz,
2348
2423
  marginVertical: vert,
2349
- overscrollBehavior: xy,
2350
2424
  padding: all,
2351
2425
  paddingHorizontal: horiz,
2352
2426
  paddingVertical: vert
2353
- }, isWeb);
2427
+ };
2354
2428
  for (var parent in EXPANSIONS) _loop(parent);
2355
2429
  var cache$1 = /* @__PURE__ */ new WeakMap(), getVariantExtras = function(styleState) {
2356
2430
  if (cache$1.has(styleState)) return cache$1.get(styleState);
@@ -2491,14 +2565,47 @@ function _type_of$3(obj) {
2491
2565
  "@swc/helpers - typeof";
2492
2566
  return obj && typeof Symbol < "u" && obj.constructor === Symbol ? "symbol" : typeof obj;
2493
2567
  }
2494
- var shorthandStringProps = {
2495
- boxShadow: 1,
2496
- border: 1,
2497
- borderTop: 1,
2498
- borderRight: 1,
2499
- borderBottom: 1,
2500
- borderLeft: 1,
2501
- background: 1
2568
+ var resolveTok = function(v, cat, sp, ss) {
2569
+ if (typeof v == "string" && v[0] === "$") {
2570
+ var r = getTokenForKey(cat, v, sp, ss);
2571
+ return cat === "size" ? r != null && +r || 0 : r != null ? String(r) : v;
2572
+ }
2573
+ return cat === "size" ? typeof v == "number" ? v : +v || 0 : v;
2574
+ }, boxShadowObjResolve = function(v, sp, ss) {
2575
+ return (Array.isArray(v) ? v : [v]).map(function(o) {
2576
+ return __spreadValues(__spreadValues(__spreadValues(__spreadProps(__spreadValues({}, o.inset && {
2577
+ inset: true
2578
+ }), {
2579
+ offsetX: resolveTok(o.offsetX, "size", sp, ss),
2580
+ offsetY: resolveTok(o.offsetY, "size", sp, ss)
2581
+ }), o.blurRadius != null && {
2582
+ blurRadius: resolveTok(o.blurRadius, "size", sp, ss)
2583
+ }), o.spreadDistance != null && {
2584
+ spreadDistance: resolveTok(o.spreadDistance, "size", sp, ss)
2585
+ }), o.color != null && {
2586
+ color: resolveTok(o.color, "color", sp, ss)
2587
+ });
2588
+ });
2589
+ }, filterObjResolve = function(v, sp, ss) {
2590
+ return (Array.isArray(v) ? v : [v]).map(function(o) {
2591
+ if ("blur" in o) return {
2592
+ blur: resolveTok(o.blur, "size", sp, ss)
2593
+ };
2594
+ if ("dropShadow" in o) {
2595
+ var ds = o.dropShadow;
2596
+ return {
2597
+ dropShadow: __spreadValues(__spreadValues({
2598
+ offsetX: resolveTok(ds.offsetX, "size", sp, ss),
2599
+ offsetY: resolveTok(ds.offsetY, "size", sp, ss)
2600
+ }, ds.blurRadius != null && {
2601
+ blurRadius: resolveTok(ds.blurRadius, "size", sp, ss)
2602
+ }), ds.color != null && {
2603
+ color: resolveTok(ds.color, "color", sp, ss)
2604
+ })
2605
+ };
2606
+ }
2607
+ return o;
2608
+ });
2502
2609
  }, propMapper = function(key, value, styleState, disabled, map) {
2503
2610
  if (disabled) return map(key, value);
2504
2611
  if (lastFontFamilyToken = null, !(!isAndroid && key === "elevationAndroid")) {
@@ -2527,13 +2634,13 @@ var shorthandStringProps = {
2527
2634
  }
2528
2635
  styleProps.disableExpandShorthands || key in conf2.shorthands && (key = conf2.shorthands[key]);
2529
2636
  var originalValue = value;
2530
- if (value != null && (value[0] === "$" ? value = getTokenForKey(key, value, styleProps, styleState) : (
2531
- /* Handle CSS shorthand strings with embedded $variables (e.g., boxShadow="0 0 10px $red") */
2532
- key in shorthandStringProps && typeof value == "string" && value.includes("$") ? value = value.replace(/\$[\w.-]+/g, function(token) {
2533
- var resolved = getTokenForKey("color", token, styleProps, styleState);
2534
- return resolved != null ? String(resolved) : token;
2535
- }) : isVariable(value) ? value = resolveVariableValue(key, value, styleProps.resolveValues) : isRemValue(value) && (value = resolveRem(value))
2536
- )), value != null) {
2637
+ if (value != null && (key === "boxShadow" && (typeof value > "u" ? "undefined" : _type_of$3(value)) === "object" ? value = boxShadowObjResolve(value, styleProps, styleState) : key === "filter" && (typeof value > "u" ? "undefined" : _type_of$3(value)) === "object" ? value = filterObjResolve(value, styleProps, styleState) : typeof value == "string" && value[0] === "$" ? value = getTokenForKey(key, value, styleProps, styleState) : key === "boxShadow" && typeof value == "string" && value.includes("$") ? value = value.replace(/(\$[\w.-]+)/g, function(t2) {
2638
+ var cat = /^\$-?\d/.test(t2) ? "size" : "color", r = getTokenForKey(cat, t2, styleProps, styleState);
2639
+ return r != null ? String(r) : t2;
2640
+ }) : key === "filter" && typeof value == "string" && value.includes("$") ? value = value.replace(/(\$[\w.-]+)/g, function(t2) {
2641
+ var cat = /^\$-?\d/.test(t2) ? "size" : "color", r = getTokenForKey(cat, t2, styleProps, styleState);
2642
+ return r != null ? String(r) : t2;
2643
+ }) : isVariable(value) ? value = resolveVariableValue(key, value, styleProps.resolveValues) : isRemValue(value) && (value = resolveRem(value))), value != null) {
2537
2644
  key === "fontFamily" && lastFontFamilyToken && (styleState.fontFamily = lastFontFamilyToken);
2538
2645
  var expanded = styleProps.noExpand ? null : expandStyle(key, value);
2539
2646
  if (expanded) for (var max = expanded.length, i = 0; i < max; i++) {
@@ -2905,12 +3012,16 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2905
3012
  }
2906
3013
  var mediaStyle1 = getSubStyle(styleState, key4, val2, true), importanceBump = 0;
2907
3014
  if (isThemeMedia) {
2908
- if (dynamicThemeAccess = true, isIos && getSetting("fastSchemeChange")) {
3015
+ if (isIos && getSetting("fastSchemeChange")) {
2909
3016
  var _styleState3;
2910
3017
  (_styleState3 = styleState).style || (_styleState3.style = {});
2911
- var scheme = mediaKeyShort, oppositeScheme = getOppositeScheme(mediaKeyShort), themeOriginalValues = styleOriginalValues.get(mediaStyle1);
3018
+ var scheme = mediaKeyShort, oppositeScheme = getOppositeScheme(mediaKeyShort), themeOriginalValues = styleOriginalValues.get(mediaStyle1), isCurrentScheme = themeName === scheme || themeName.startsWith(scheme);
2912
3019
  for (var subKey1 in mediaStyle1) {
2913
3020
  var _$val1 = extractValueFromDynamic(mediaStyle1[subKey1], scheme), existing = styleState.style[subKey1];
3021
+ if (!isColorStyleKey(subKey1)) {
3022
+ dynamicThemeAccess = true, isCurrentScheme ? mediaStyle1[subKey1] = _$val1 : delete mediaStyle1[subKey1];
3023
+ continue;
3024
+ }
2914
3025
  if (existing == null ? void 0 : existing.dynamic) existing.dynamic[scheme] = _$val1, mediaStyle1[subKey1] = existing;
2915
3026
  else {
2916
3027
  var oppositeVal = extractValueFromDynamic(existing, oppositeScheme);
@@ -2921,7 +3032,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2921
3032
  }), mergeStyle(styleState, subKey1, mediaStyle1[subKey1], priority, false, themeOriginalValues == null ? void 0 : themeOriginalValues[subKey1]);
2922
3033
  }
2923
3034
  }
2924
- } else if (!(themeName === mediaKeyShort || themeName.startsWith(mediaKeyShort))) return;
3035
+ } else if (dynamicThemeAccess = true, !(themeName === mediaKeyShort || themeName.startsWith(mediaKeyShort))) return;
2925
3036
  } else if (isGroupMedia) {
2926
3037
  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
3038
  if (!groupState) {
@@ -2980,9 +3091,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2980
3091
  inlineWhenUnflattened,
2981
3092
  parentStaticConfig,
2982
3093
  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;
3094
+ } = staticConfig, viewProps = {}, mediaState = styleProps.mediaState || exports.mediaState, shouldDoClasses = acceptsClassName && isWeb, rulesToInsert = void 0, classNames = {}, pseudos = null, hasMedia = false, dynamicThemeAccess, pseudoGroups, mediaGroups;
2986
3095
  props.className || "";
2987
3096
  var mediaStylesSeen = 0, validStyles$1 = staticConfig.validStyles || (staticConfig.isText || staticConfig.isInput ? stylePropsText : validStyles);
2988
3097
  var styleState = {