@tamagui/core 1.144.2 → 1.144.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.cjs CHANGED
@@ -9010,6 +9010,26 @@ function px(value) {
9010
9010
  function getOppositeScheme(scheme) {
9011
9011
  return scheme === "dark" ? "light" : "dark";
9012
9012
  }
9013
+ var colorStyleKeys = {
9014
+ backgroundColor: true,
9015
+ borderColor: true,
9016
+ borderTopColor: true,
9017
+ borderRightColor: true,
9018
+ borderBottomColor: true,
9019
+ borderLeftColor: true,
9020
+ borderBlockColor: true,
9021
+ borderBlockEndColor: true,
9022
+ borderBlockStartColor: true,
9023
+ color: true,
9024
+ shadowColor: true,
9025
+ textDecorationColor: true,
9026
+ textShadowColor: true,
9027
+ tintColor: true,
9028
+ outlineColor: true
9029
+ };
9030
+ function isColorStyleKey(key) {
9031
+ return colorStyleKeys[key] === true;
9032
+ }
9013
9033
  function getDynamicVal(param) {
9014
9034
  var {
9015
9035
  scheme,
@@ -9422,7 +9442,7 @@ var defaultOffset = {
9422
9442
  };
9423
9443
  var normalizeColor = function(color, opacity) {
9424
9444
  if (color) {
9425
- if (color[0] === "$") return color;
9445
+ if (typeof color != "string" || color[0] === "$") return color;
9426
9446
  if (color.startsWith("var(")) {
9427
9447
  if (typeof opacity == "number" && opacity < 1) return `color-mix(in srgb, ${color} ${opacity * 100}%, transparent)`;
9428
9448
  } else {
@@ -9435,8 +9455,10 @@ var normalizeColor = function(color, opacity) {
9435
9455
  return color;
9436
9456
  }
9437
9457
  }, getRgba = function(color) {
9438
- var colorNum = normalizeCSSColor(color);
9439
- if (colorNum != null) return rgba(colorNum);
9458
+ if (typeof color == "string") {
9459
+ var colorNum = normalizeCSSColor(color);
9460
+ if (colorNum != null) return rgba(colorNum);
9461
+ }
9440
9462
  };
9441
9463
  function normalizeShadow(param) {
9442
9464
  var {
@@ -10135,19 +10157,27 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
10135
10157
  }
10136
10158
  var mediaStyle1 = getSubStyle(styleState, key4, val2, true), importanceBump = 0;
10137
10159
  if (isThemeMedia) {
10138
- if (dynamicThemeAccess = true, isIos && getSetting("fastSchemeChange")) {
10160
+ if (isIos && getSetting("fastSchemeChange")) {
10139
10161
  var _styleState3;
10140
10162
  (_styleState3 = styleState).style || (_styleState3.style = {});
10141
- var scheme = mediaKeyShort, oppositeScheme = getOppositeScheme(mediaKeyShort), themeOriginalValues = styleOriginalValues.get(mediaStyle1);
10163
+ var scheme = mediaKeyShort, oppositeScheme = getOppositeScheme(mediaKeyShort), themeOriginalValues = styleOriginalValues.get(mediaStyle1), isCurrentScheme = themeName === scheme || themeName.startsWith(scheme);
10142
10164
  for (var subKey1 in mediaStyle1) {
10143
- var _$val1 = extractValueFromDynamic(mediaStyle1[subKey1], scheme), oppositeVal = extractValueFromDynamic(styleState.style[subKey1], oppositeScheme);
10144
- mediaStyle1[subKey1] = getDynamicVal({
10145
- scheme,
10146
- val: _$val1,
10147
- oppositeVal
10148
- }), mergeStyle(styleState, subKey1, mediaStyle1[subKey1], priority, false, themeOriginalValues == null ? void 0 : themeOriginalValues[subKey1]);
10165
+ var _$val1 = extractValueFromDynamic(mediaStyle1[subKey1], scheme), existing = styleState.style[subKey1];
10166
+ if (!isColorStyleKey(subKey1)) {
10167
+ dynamicThemeAccess = true, isCurrentScheme ? mediaStyle1[subKey1] = _$val1 : delete mediaStyle1[subKey1];
10168
+ continue;
10169
+ }
10170
+ if (existing == null ? void 0 : existing.dynamic) existing.dynamic[scheme] = _$val1, mediaStyle1[subKey1] = existing;
10171
+ else {
10172
+ var oppositeVal = extractValueFromDynamic(existing, oppositeScheme);
10173
+ mediaStyle1[subKey1] = getDynamicVal({
10174
+ scheme,
10175
+ val: _$val1,
10176
+ oppositeVal
10177
+ }), mergeStyle(styleState, subKey1, mediaStyle1[subKey1], priority, false, themeOriginalValues == null ? void 0 : themeOriginalValues[subKey1]);
10178
+ }
10149
10179
  }
10150
- } else if (!(themeName === mediaKeyShort || themeName.startsWith(mediaKeyShort))) return;
10180
+ } else if (dynamicThemeAccess = true, !(themeName === mediaKeyShort || themeName.startsWith(mediaKeyShort))) return;
10151
10181
  } else if (isGroupMedia) {
10152
10182
  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;
10153
10183
  if (!groupState) {
@@ -10212,7 +10242,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
10212
10242
  inlineWhenUnflattened,
10213
10243
  parentStaticConfig,
10214
10244
  acceptsClassName
10215
- } = staticConfig, viewProps = {}, mediaState = styleProps2.mediaState || exports.mediaState, shouldDoClasses = acceptsClassName && isWeb, rulesToInsert = void 0, classNames = {}, pseudos = null, space = props.space, hasMedia = false, dynamicThemeAccess, pseudoGroups, mediaGroups;
10245
+ } = staticConfig, viewProps = {}, mediaState = styleProps2.mediaState || exports.mediaState, shouldDoClasses = acceptsClassName && isWeb, rulesToInsert = void 0, classNames = {}, space = props.space, pseudos = null, hasMedia = false, dynamicThemeAccess, pseudoGroups, mediaGroups;
10216
10246
  props.className || "";
10217
10247
  var mediaStylesSeen = 0, validStyles$1 = staticConfig.validStyles || (staticConfig.isText || staticConfig.isInput ? stylePropsText : validStyles);
10218
10248
  var styleState = {
@@ -1162,6 +1162,26 @@ function px(value) {
1162
1162
  function getOppositeScheme(scheme) {
1163
1163
  return scheme === "dark" ? "light" : "dark";
1164
1164
  }
1165
+ var colorStyleKeys = {
1166
+ backgroundColor: true,
1167
+ borderColor: true,
1168
+ borderTopColor: true,
1169
+ borderRightColor: true,
1170
+ borderBottomColor: true,
1171
+ borderLeftColor: true,
1172
+ borderBlockColor: true,
1173
+ borderBlockEndColor: true,
1174
+ borderBlockStartColor: true,
1175
+ color: true,
1176
+ shadowColor: true,
1177
+ textDecorationColor: true,
1178
+ textShadowColor: true,
1179
+ tintColor: true,
1180
+ outlineColor: true
1181
+ };
1182
+ function isColorStyleKey(key) {
1183
+ return colorStyleKeys[key] === true;
1184
+ }
1165
1185
  function getDynamicVal(param) {
1166
1186
  var {
1167
1187
  scheme,
@@ -2115,7 +2135,7 @@ function rgba(colorInt) {
2115
2135
  }
2116
2136
  var normalizeColor = function(color, opacity) {
2117
2137
  if (color) {
2118
- if (color[0] === "$") return color;
2138
+ if (typeof color != "string" || color[0] === "$") return color;
2119
2139
  if (color.startsWith("var(")) {
2120
2140
  if (typeof opacity == "number" && opacity < 1) return `color-mix(in srgb, ${color} ${opacity * 100}%, transparent)`;
2121
2141
  } else {
@@ -2128,8 +2148,10 @@ var normalizeColor = function(color, opacity) {
2128
2148
  return color;
2129
2149
  }
2130
2150
  }, getRgba = function(color) {
2131
- var colorNum = normalizeCSSColor(color);
2132
- if (colorNum != null) return rgba(colorNum);
2151
+ if (typeof color == "string") {
2152
+ var colorNum = normalizeCSSColor(color);
2153
+ if (colorNum != null) return rgba(colorNum);
2154
+ }
2133
2155
  };
2134
2156
  function normalizeShadow(param) {
2135
2157
  var {
@@ -2830,19 +2852,27 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2830
2852
  }
2831
2853
  var mediaStyle1 = getSubStyle(styleState, key4, val2, true), importanceBump = 0;
2832
2854
  if (isThemeMedia) {
2833
- if (dynamicThemeAccess = true, isIos && getSetting("fastSchemeChange")) {
2855
+ if (isIos && getSetting("fastSchemeChange")) {
2834
2856
  var _styleState3;
2835
2857
  (_styleState3 = styleState).style || (_styleState3.style = {});
2836
- var scheme = mediaKeyShort, oppositeScheme = getOppositeScheme(mediaKeyShort), themeOriginalValues = styleOriginalValues.get(mediaStyle1);
2858
+ var scheme = mediaKeyShort, oppositeScheme = getOppositeScheme(mediaKeyShort), themeOriginalValues = styleOriginalValues.get(mediaStyle1), isCurrentScheme = themeName === scheme || themeName.startsWith(scheme);
2837
2859
  for (var subKey1 in mediaStyle1) {
2838
- var _$val1 = extractValueFromDynamic(mediaStyle1[subKey1], scheme), oppositeVal = extractValueFromDynamic(styleState.style[subKey1], oppositeScheme);
2839
- mediaStyle1[subKey1] = getDynamicVal({
2840
- scheme,
2841
- val: _$val1,
2842
- oppositeVal
2843
- }), mergeStyle(styleState, subKey1, mediaStyle1[subKey1], priority, false, themeOriginalValues == null ? void 0 : themeOriginalValues[subKey1]);
2860
+ var _$val1 = extractValueFromDynamic(mediaStyle1[subKey1], scheme), existing = styleState.style[subKey1];
2861
+ if (!isColorStyleKey(subKey1)) {
2862
+ dynamicThemeAccess = true, isCurrentScheme ? mediaStyle1[subKey1] = _$val1 : delete mediaStyle1[subKey1];
2863
+ continue;
2864
+ }
2865
+ if (existing == null ? void 0 : existing.dynamic) existing.dynamic[scheme] = _$val1, mediaStyle1[subKey1] = existing;
2866
+ else {
2867
+ var oppositeVal = extractValueFromDynamic(existing, oppositeScheme);
2868
+ mediaStyle1[subKey1] = getDynamicVal({
2869
+ scheme,
2870
+ val: _$val1,
2871
+ oppositeVal
2872
+ }), mergeStyle(styleState, subKey1, mediaStyle1[subKey1], priority, false, themeOriginalValues == null ? void 0 : themeOriginalValues[subKey1]);
2873
+ }
2844
2874
  }
2845
- } else if (!(themeName === mediaKeyShort || themeName.startsWith(mediaKeyShort))) return;
2875
+ } else if (dynamicThemeAccess = true, !(themeName === mediaKeyShort || themeName.startsWith(mediaKeyShort))) return;
2846
2876
  } else if (isGroupMedia) {
2847
2877
  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;
2848
2878
  if (!groupState) {
@@ -2907,7 +2937,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2907
2937
  inlineWhenUnflattened,
2908
2938
  parentStaticConfig,
2909
2939
  acceptsClassName
2910
- } = staticConfig, viewProps = {}, mediaState = styleProps.mediaState || exports.mediaState, shouldDoClasses = acceptsClassName && isWeb, rulesToInsert = void 0, classNames = {}, pseudos = null, space = props.space, hasMedia = false, dynamicThemeAccess, pseudoGroups, mediaGroups;
2940
+ } = staticConfig, viewProps = {}, mediaState = styleProps.mediaState || exports.mediaState, shouldDoClasses = acceptsClassName && isWeb, rulesToInsert = void 0, classNames = {}, space = props.space, pseudos = null, hasMedia = false, dynamicThemeAccess, pseudoGroups, mediaGroups;
2911
2941
  props.className || "";
2912
2942
  var mediaStylesSeen = 0, validStyles$1 = staticConfig.validStyles || (staticConfig.isText || staticConfig.isInput ? stylePropsText : validStyles);
2913
2943
  var styleState = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/core",
3
- "version": "1.144.2",
3
+ "version": "1.144.4",
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": "1.144.2",
37
- "@tamagui/react-native-media-driver": "1.144.2",
38
- "@tamagui/react-native-use-pressable": "1.144.2",
39
- "@tamagui/react-native-use-responder-events": "1.144.2",
40
- "@tamagui/use-element-layout": "1.144.2",
41
- "@tamagui/use-event": "1.144.2",
42
- "@tamagui/web": "1.144.2"
36
+ "@tamagui/helpers": "1.144.4",
37
+ "@tamagui/react-native-media-driver": "1.144.4",
38
+ "@tamagui/react-native-use-pressable": "1.144.4",
39
+ "@tamagui/react-native-use-responder-events": "1.144.4",
40
+ "@tamagui/use-element-layout": "1.144.4",
41
+ "@tamagui/use-event": "1.144.4",
42
+ "@tamagui/web": "1.144.4"
43
43
  },
44
44
  "devDependencies": {
45
- "@tamagui/build": "1.144.2",
46
- "@tamagui/native-bundle": "1.144.2",
47
- "@tamagui/react-native-web-lite": "1.144.2",
45
+ "@tamagui/build": "1.144.4",
46
+ "@tamagui/native-bundle": "1.144.4",
47
+ "@tamagui/react-native-web-lite": "1.144.4",
48
48
  "@testing-library/react": "^16.1.0",
49
49
  "csstype": "^3.0.10",
50
50
  "react": "*",