@tamagui/core 2.0.0-rc.3 → 2.0.0-rc.5

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
@@ -9862,6 +9862,111 @@ function normalizeStyle$1(style) {
9862
9862
  }
9863
9863
  return fixStyles(res), res;
9864
9864
  }
9865
+ function parseNativeStyle(key, cssString, tokenMap) {
9866
+ switch (key) {
9867
+ case "backgroundImage":
9868
+ return parseBackgroundImage(cssString, tokenMap);
9869
+ case "boxShadow":
9870
+ return parseBoxShadow(cssString, tokenMap);
9871
+ case "textShadow":
9872
+ return parseTextShadow(cssString, tokenMap);
9873
+ default:
9874
+ return;
9875
+ }
9876
+ }
9877
+ function resolveColor(raw, tokenMap) {
9878
+ return tokenMap && tokenMap.has(raw) ? tokenMap.get(raw) : raw;
9879
+ }
9880
+ function parseBackgroundImage(css, tokenMap) {
9881
+ var match = css.match(RegExp("^linear-gradient\\((.+)\\)$", "s"));
9882
+ if (match) {
9883
+ var inner = match[1], parts = splitOutsideParens(inner);
9884
+ if (!(parts.length < 2)) {
9885
+ var direction, startIdx = 0, firstPart = parts[0].trim();
9886
+ (firstPart.startsWith("to ") || /^\d+(\.\d+)?(deg|rad|turn|grad)$/.test(firstPart)) && (direction = firstPart, startIdx = 1);
9887
+ for (var colorStops = [], i = startIdx; i < parts.length; i++) {
9888
+ var stopParts = parts[i].trim().split(/\s+/), colorRaw = stopParts[0], color = resolveColor(colorRaw, tokenMap), positions = stopParts.slice(1), stop = {
9889
+ color
9890
+ };
9891
+ positions.length > 0 && (stop.positions = positions), colorStops.push(stop);
9892
+ }
9893
+ var gradient = {
9894
+ type: "linearGradient",
9895
+ colorStops
9896
+ };
9897
+ return direction && (gradient.direction = direction), [gradient];
9898
+ }
9899
+ }
9900
+ }
9901
+ function parseBoxShadow(css, tokenMap) {
9902
+ var shadowStrings = splitOutsideParens(css), shadows = [], _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
9903
+ try {
9904
+ for (var _iterator = shadowStrings[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
9905
+ var raw = _step.value, s = raw.trim();
9906
+ if (s) {
9907
+ var tokens = s.split(/\s+/);
9908
+ if (tokens.length < 2) return;
9909
+ var startIdx = 0, inset = false;
9910
+ tokens[0] === "inset" && (inset = true, startIdx = 1);
9911
+ for (var numericParts = [], colorParts = [], i = startIdx; i < tokens.length; i++) {
9912
+ var n = parseDimension(tokens[i]);
9913
+ if (n !== void 0) numericParts.push(n);
9914
+ else {
9915
+ colorParts = tokens.slice(i);
9916
+ break;
9917
+ }
9918
+ }
9919
+ if (numericParts.length < 2) return;
9920
+ var shadow = {
9921
+ offsetX: numericParts[0],
9922
+ offsetY: numericParts[1]
9923
+ };
9924
+ if (inset && (shadow.inset = true), numericParts.length >= 3 && (shadow.blurRadius = numericParts[2]), numericParts.length >= 4 && (shadow.spreadDistance = numericParts[3]), colorParts.length > 0) {
9925
+ var colorStr = colorParts.join(" ");
9926
+ shadow.color = resolveColor(colorStr, tokenMap);
9927
+ }
9928
+ shadows.push(shadow);
9929
+ }
9930
+ }
9931
+ } catch (err) {
9932
+ _didIteratorError = true, _iteratorError = err;
9933
+ } finally {
9934
+ try {
9935
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
9936
+ } finally {
9937
+ if (_didIteratorError) throw _iteratorError;
9938
+ }
9939
+ }
9940
+ return shadows.length > 0 ? shadows : void 0;
9941
+ }
9942
+ function parseTextShadow(css, tokenMap) {
9943
+ var tokens = css.trim().split(/\s+/);
9944
+ if (!(tokens.length < 3)) {
9945
+ var offsetX = parseDimension(tokens[0]), offsetY = parseDimension(tokens[1]), blur = parseDimension(tokens[2]);
9946
+ if (!(offsetX === void 0 || offsetY === void 0 || blur === void 0)) {
9947
+ var result = [["textShadowOffset", {
9948
+ width: offsetX,
9949
+ height: offsetY
9950
+ }], ["textShadowRadius", blur]];
9951
+ if (tokens.length >= 4) {
9952
+ var colorStr = tokens.slice(3).join(" ");
9953
+ result.push(["textShadowColor", resolveColor(colorStr, tokenMap)]);
9954
+ }
9955
+ return result;
9956
+ }
9957
+ }
9958
+ }
9959
+ function parseDimension(s) {
9960
+ var cleaned = s.replace(/px$|dp$/, ""), n = Number(cleaned);
9961
+ return Number.isFinite(n) ? n : void 0;
9962
+ }
9963
+ function splitOutsideParens(s) {
9964
+ for (var parts = [], depth = 0, current = "", i = 0; i < s.length; i++) {
9965
+ var ch = s[i];
9966
+ ch === "(" ? depth++ : ch === ")" && depth--, ch === "," && depth === 0 ? (parts.push(current), current = "") : current += ch;
9967
+ }
9968
+ return current && parts.push(current), parts;
9969
+ }
9865
9970
  var remRegex = /(-?[\d.]+)rem/g;
9866
9971
  function resolveRem(value) {
9867
9972
  var _config_settings, config = getConfig(), _config_settings_remBaseFontSize, baseFontSize = (_config_settings_remBaseFontSize = config == null || (_config_settings = config.settings) === null || _config_settings === void 0 ? void 0 : _config_settings.remBaseFontSize) !== null && _config_settings_remBaseFontSize !== void 0 ? _config_settings_remBaseFontSize : 16;
@@ -9964,15 +10069,57 @@ var propMapper = function(key, value, styleState, disabled, map) {
9964
10069
  }
9965
10070
  styleProps2.disableExpandShorthands || key in conf2.shorthands && (key = conf2.shorthands[key]);
9966
10071
  var originalValue = value;
9967
- if (value != null && (typeof value == "string" && value[0] === "$" ? value = getTokenForKey(key, value, styleProps2, styleState) : (key === "boxShadow" || key === "textShadow" || key === "filter" || key === "backgroundImage" || key === "border") && typeof value == "string" && value.includes("$") ? value = value.replace(/(\$[\w.-]+)/g, function(t) {
9968
- var r = getTokenForKey("size", t, styleProps2, styleState);
9969
- return r == null && (r = getTokenForKey("color", t, styleProps2, styleState)), r != null ? String(r) : t;
9970
- }) : isVariable(value) ? value = resolveVariableValue(key, value, styleProps2.resolveValues) : isRemValue(value) && (value = resolveRem(value))), value != null) {
10072
+ if (value != null) if (typeof value == "string" && value[0] === "$") value = getTokenForKey(key, value, styleProps2, styleState);
10073
+ else if ((key === "boxShadow" || key === "textShadow" || key === "filter" || key === "backgroundImage" || key === "border") && typeof value == "string" && value.includes("$")) {
10074
+ if (key === "backgroundImage" || key === "boxShadow" || key === "textShadow") {
10075
+ var tokenMap = /* @__PURE__ */ new Map(), placeholderIdx = 0, withPlaceholders = value.replace(/(\$[\w.-]+)/g, function(t) {
10076
+ var r = getTokenForKey("size", t, styleProps2, styleState);
10077
+ if (r == null && (r = getTokenForKey("color", t, styleProps2, styleState)), r == null) return t;
10078
+ if (typeof r != "string" && typeof r != "number") {
10079
+ var placeholder = `__tk${placeholderIdx++}__`;
10080
+ return tokenMap.set(placeholder, r), placeholder;
10081
+ }
10082
+ return String(r);
10083
+ }), parsed = parseNativeStyle(key, withPlaceholders, tokenMap);
10084
+ parsed ? value = parsed : value = value.replace(/(\$[\w.-]+)/g, function(t) {
10085
+ var r = getTokenForKey("size", t, styleProps2, styleState);
10086
+ return r == null && (r = getTokenForKey("color", t, styleProps2, styleState)), r != null ? String(r) : t;
10087
+ });
10088
+ } else value = value.replace(/(\$[\w.-]+)/g, function(t) {
10089
+ var r = getTokenForKey("size", t, styleProps2, styleState);
10090
+ return r == null && (r = getTokenForKey("color", t, styleProps2, styleState)), r != null ? String(r) : t;
10091
+ });
10092
+ } else isVariable(value) ? value = resolveVariableValue(key, value, styleProps2.resolveValues) : isRemValue(value) && (value = resolveRem(value));
10093
+ if (value != null && typeof value == "string" && (key === "backgroundImage" || key === "boxShadow" || key === "textShadow")) {
10094
+ var parsed1 = parseNativeStyle(key, value);
10095
+ if (parsed1) {
10096
+ if (key === "textShadow" && Array.isArray(parsed1) && Array.isArray(parsed1[0])) {
10097
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
10098
+ try {
10099
+ for (var _iterator = parsed1[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
10100
+ var [nkey, nvalue] = _step.value;
10101
+ map(nkey, nvalue, originalValue);
10102
+ }
10103
+ } catch (err) {
10104
+ _didIteratorError = true, _iteratorError = err;
10105
+ } finally {
10106
+ try {
10107
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
10108
+ } finally {
10109
+ if (_didIteratorError) throw _iteratorError;
10110
+ }
10111
+ }
10112
+ return;
10113
+ }
10114
+ value = parsed1;
10115
+ }
10116
+ }
10117
+ if (value != null) {
9971
10118
  key === "fontFamily" && lastFontFamilyToken && (styleState.fontFamily = lastFontFamilyToken);
9972
10119
  var expanded = styleProps2.noExpand ? null : expandStyle(key, value);
9973
10120
  if (expanded) for (var max = expanded.length, i = 0; i < max; i++) {
9974
- var [nkey, nvalue] = expanded[i];
9975
- map(nkey, nvalue, originalValue);
10121
+ var [nkey1, nvalue1] = expanded[i];
10122
+ map(nkey1, nvalue1, originalValue);
9976
10123
  }
9977
10124
  else map(key, value, originalValue);
9978
10125
  }
@@ -10267,7 +10414,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
10267
10414
  viewProps[key4] = val2;
10268
10415
  return;
10269
10416
  }
10270
- if (val2 != null) {
10417
+ if (false, val2 != null) {
10271
10418
  if (key4 === "pointerEvents") {
10272
10419
  viewProps[key4] = val2;
10273
10420
  return;
@@ -10282,13 +10429,13 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
10282
10429
  }
10283
10430
  var shouldPassThrough2 = styleProps2.noExpand && isPseudo || isHOC && (isMediaOrPseudo || (parentStaticConfig == null || (_parentStaticConfig_variants = parentStaticConfig.variants) === null || _parentStaticConfig_variants === void 0 ? void 0 : _parentStaticConfig_variants[keyInit]));
10284
10431
  if (shouldPassThrough2) {
10285
- passDownProp(viewProps, key4, val2, isMediaOrPseudo);
10432
+ passDownProp(viewProps, key4, val2, isMediaOrPseudo), false;
10286
10433
  return;
10287
10434
  }
10288
10435
  if (isPseudo) {
10289
10436
  if (!val2) return;
10290
10437
  var pseudoStyleObject = getSubStyle(styleState, key4, val2, styleProps2.noClass && process.env.IS_STATIC !== "is_static");
10291
- {
10438
+ if (!shouldDoClasses || process.env.IS_STATIC === "is_static") {
10292
10439
  var _pseudos, _key;
10293
10440
  if (pseudos || (pseudos = {}), (_pseudos = pseudos)[_key = key4] || (_pseudos[_key] = {}), process.env.IS_STATIC === "is_static") {
10294
10441
  Object.assign(pseudos[key4], pseudoStyleObject);
@@ -10297,9 +10444,11 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
10297
10444
  }
10298
10445
  var descriptor = pseudoDescriptors[key4], isEnter = key4 === "enterStyle", isExit = key4 === "exitStyle";
10299
10446
  if (!descriptor) return;
10300
- {
10447
+ var pseudoStyles, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, psuedoStyle, fullKey;
10448
+ if (shouldDoClasses && !isExit) ;
10449
+ if (!shouldDoClasses || isExit || isEnter) {
10301
10450
  var descriptorKey = descriptor.stateKey || descriptor.name, isDisabled2 = componentState[descriptorKey] === false;
10302
- isExit && (isDisabled2 = !styleProps2.isExiting), isEnter && componentState.unmounted === false && (isDisabled2 = true);
10451
+ isExit && (isDisabled2 = !styleProps2.isExiting), isEnter && componentState.unmounted === false && (isDisabled2 = true), false;
10303
10452
  var importance = descriptor.priority, pseudoOriginalValues = styleOriginalValues.get(pseudoStyleObject);
10304
10453
  for (var pkey in pseudoStyleObject) {
10305
10454
  var _$val = pseudoStyleObject[pkey];
@@ -10326,14 +10475,13 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
10326
10475
  if (!val2) return;
10327
10476
  var mediaKeyShort = key4.slice(isMedia == "theme" ? 7 : 1);
10328
10477
  hasMedia || (hasMedia = true);
10329
- val2.space;
10330
- if ((!hasMedia || typeof hasMedia == "boolean") && (hasMedia = /* @__PURE__ */ new Set()), hasMedia.add(mediaKeyShort), isMedia === "platform" && !isActivePlatform(key4)) return;
10478
+ var hasSpace = val2.space;
10479
+ if ((hasSpace || !shouldDoClasses || styleProps2.willBeAnimated) && ((!hasMedia || typeof hasMedia == "boolean") && (hasMedia = /* @__PURE__ */ new Set()), hasMedia.add(mediaKeyShort)), isMedia === "platform" && !isActivePlatform(key4)) return;
10331
10480
  var priority = mediaStylesSeen;
10332
10481
  mediaStylesSeen += 1;
10333
- var shouldDoClassesForThisMedia = isWeb;
10482
+ var shouldDoClassesForThisMedia = shouldDoClasses || isWeb && isMedia === "theme";
10334
10483
  if (shouldDoClassesForThisMedia) {
10335
- getSubStyle(styleState, key4, val2, false);
10336
- var mediaStyles = getCSSStylesAtomic(), _iteratorNormalCompletion12 = true, _didIteratorError12 = false, _iteratorError12 = void 0;
10484
+ var mediaStyle = getSubStyle(styleState, key4, val2, false), mediaStyles = getCSSStylesAtomic(mediaStyle), _iteratorNormalCompletion12 = true, _didIteratorError12 = false, _iteratorError12 = void 0;
10337
10485
  try {
10338
10486
  for (var _iterator12 = mediaStyles[Symbol.iterator](), _step12; !(_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done); _iteratorNormalCompletion12 = true) {
10339
10487
  var style3 = _step12.value, property = style3[StyleObjectProperty], isSubStyle = property[0] === "$";
@@ -10359,7 +10507,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
10359
10507
  var didMerge = mergeMediaByImportance(styleState, mediaKeyShort, key5, val3, mediaState[mediaKeyShort], importanceBump, debug, originalVal2);
10360
10508
  didMerge && key5 === "fontFamily" && (styleState.fontFamily = mediaStyle1.fontFamily);
10361
10509
  };
10362
- var isThemeMedia = isMedia === "theme", isGroupMedia = isMedia === "group", isPlatformMedia = isMedia === "platform";
10510
+ var mergeMediaStyle = mergeMediaStyle2, isThemeMedia = isMedia === "theme", isGroupMedia = isMedia === "group", isPlatformMedia = isMedia === "platform";
10363
10511
  if (!isThemeMedia && !isPlatformMedia && !isGroupMedia) {
10364
10512
  if (!mediaState[mediaKeyShort]) {
10365
10513
  return;
@@ -10391,14 +10539,14 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
10391
10539
  } else if (isGroupMedia) {
10392
10540
  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;
10393
10541
  if (!groupState) {
10394
- pseudoGroups || (pseudoGroups = /* @__PURE__ */ new Set());
10542
+ false, pseudoGroups || (pseudoGroups = /* @__PURE__ */ new Set());
10395
10543
  return;
10396
10544
  }
10397
10545
  var componentGroupState = (_componentState_group = componentState.group) === null || _componentState_group === void 0 ? void 0 : _componentState_group[groupName];
10398
10546
  if (groupMediaKey) {
10399
10547
  mediaGroups || (mediaGroups = /* @__PURE__ */ new Set()), mediaGroups.add(groupMediaKey);
10400
10548
  var mediaState1 = componentGroupState == null ? void 0 : componentGroupState.media, isActive = mediaState1 == null ? void 0 : mediaState1[groupMediaKey];
10401
- if (!mediaState1 && groupState.layout && (isActive = mediaKeyMatch(groupMediaKey, groupState.layout)), !isActive) {
10549
+ if (!mediaState1 && groupState.layout && (isActive = mediaKeyMatch(groupMediaKey, groupState.layout)), false, !isActive) {
10402
10550
  for (var pkey1 in mediaStyle1) applyDefaultStyle(pkey1, styleState);
10403
10551
  return;
10404
10552
  }
@@ -10408,7 +10556,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
10408
10556
  var _this;
10409
10557
  pseudoGroups || (pseudoGroups = /* @__PURE__ */ new Set()), pseudoGroups.add(groupName);
10410
10558
  var componentGroupPseudoState = (_this = componentGroupState || (groupContext == null ? void 0 : groupContext[groupName].state)) === null || _this === void 0 ? void 0 : _this.pseudo, isActive1 = componentGroupPseudoState == null ? void 0 : componentGroupPseudoState[groupPseudoKey], priority1 = pseudoPriorities[groupPseudoKey];
10411
- if (!isActive1) {
10559
+ if (false, !isActive1) {
10412
10560
  for (var pkey2 in mediaStyle1) applyDefaultStyle(pkey2, styleState);
10413
10561
  return;
10414
10562
  }
@@ -10446,7 +10594,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
10446
10594
  inlineWhenUnflattened,
10447
10595
  parentStaticConfig,
10448
10596
  acceptsClassName
10449
- } = staticConfig, viewProps = {}, mediaState = styleProps2.mediaState || exports.mediaState, rulesToInsert = void 0, classNames = {};
10597
+ } = staticConfig, viewProps = {}, mediaState = styleProps2.mediaState || exports.mediaState, shouldDoClasses = acceptsClassName && isWeb, rulesToInsert = void 0, classNames = {};
10450
10598
  props.space;
10451
10599
  var pseudos = null, hasMedia = false, dynamicThemeAccess, pseudoGroups, mediaGroups;
10452
10600
  props.className || "";
@@ -10591,7 +10739,7 @@ var getSubStyle = function(styleState, subKey, styleIn, avoidMergeTransform) {
10591
10739
  var shouldSkip = !staticConfig.isHOC && key1 in skipProps && !styleProps2.noSkip;
10592
10740
  if (shouldSkip) return key = key1, "continue";
10593
10741
  propMapper(key1, val, styleState, false, function(skey, sval, originalVal) {
10594
- originalVal !== void 0 && (originalValues || (originalValues = {}), originalValues[skey] = originalVal), skey in validPseudoKeys && (sval = getSubStyle(styleState, skey, sval, avoidMergeTransform)), !avoidMergeTransform && skey in stylePropsTransform ? mergeTransform(styleOut, skey, sval) : styleOut[skey] = styleProps2.noNormalize ? sval : normalizeValueWithProperty(sval);
10742
+ originalVal !== void 0 && (originalValues || (originalValues = {}), originalValues[skey] = originalVal), skey in validPseudoKeys && (sval = getSubStyle(styleState, skey, sval, avoidMergeTransform)), !avoidMergeTransform && skey in stylePropsTransform ? mergeTransform(styleOut, skey, sval) : styleOut[skey] = styleProps2.noNormalize ? sval : normalizeValueWithProperty(sval, key1);
10595
10743
  }), key = key1;
10596
10744
  }, {
10597
10745
  staticConfig,
@@ -2341,6 +2341,111 @@ function normalizeStyle$1(style) {
2341
2341
  }
2342
2342
  return fixStyles(res), res;
2343
2343
  }
2344
+ function parseNativeStyle(key, cssString, tokenMap) {
2345
+ switch (key) {
2346
+ case "backgroundImage":
2347
+ return parseBackgroundImage(cssString, tokenMap);
2348
+ case "boxShadow":
2349
+ return parseBoxShadow(cssString, tokenMap);
2350
+ case "textShadow":
2351
+ return parseTextShadow(cssString, tokenMap);
2352
+ default:
2353
+ return;
2354
+ }
2355
+ }
2356
+ function resolveColor(raw, tokenMap) {
2357
+ return tokenMap && tokenMap.has(raw) ? tokenMap.get(raw) : raw;
2358
+ }
2359
+ function parseBackgroundImage(css, tokenMap) {
2360
+ var match = css.match(RegExp("^linear-gradient\\((.+)\\)$", "s"));
2361
+ if (match) {
2362
+ var inner = match[1], parts = splitOutsideParens(inner);
2363
+ if (!(parts.length < 2)) {
2364
+ var direction, startIdx = 0, firstPart = parts[0].trim();
2365
+ (firstPart.startsWith("to ") || /^\d+(\.\d+)?(deg|rad|turn|grad)$/.test(firstPart)) && (direction = firstPart, startIdx = 1);
2366
+ for (var colorStops = [], i = startIdx; i < parts.length; i++) {
2367
+ var stopParts = parts[i].trim().split(/\s+/), colorRaw = stopParts[0], color = resolveColor(colorRaw, tokenMap), positions = stopParts.slice(1), stop = {
2368
+ color
2369
+ };
2370
+ positions.length > 0 && (stop.positions = positions), colorStops.push(stop);
2371
+ }
2372
+ var gradient = {
2373
+ type: "linearGradient",
2374
+ colorStops
2375
+ };
2376
+ return direction && (gradient.direction = direction), [gradient];
2377
+ }
2378
+ }
2379
+ }
2380
+ function parseBoxShadow(css, tokenMap) {
2381
+ var shadowStrings = splitOutsideParens(css), shadows = [], _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
2382
+ try {
2383
+ for (var _iterator = shadowStrings[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
2384
+ var raw = _step.value, s = raw.trim();
2385
+ if (s) {
2386
+ var tokens = s.split(/\s+/);
2387
+ if (tokens.length < 2) return;
2388
+ var startIdx = 0, inset = false;
2389
+ tokens[0] === "inset" && (inset = true, startIdx = 1);
2390
+ for (var numericParts = [], colorParts = [], i = startIdx; i < tokens.length; i++) {
2391
+ var n = parseDimension(tokens[i]);
2392
+ if (n !== void 0) numericParts.push(n);
2393
+ else {
2394
+ colorParts = tokens.slice(i);
2395
+ break;
2396
+ }
2397
+ }
2398
+ if (numericParts.length < 2) return;
2399
+ var shadow = {
2400
+ offsetX: numericParts[0],
2401
+ offsetY: numericParts[1]
2402
+ };
2403
+ if (inset && (shadow.inset = true), numericParts.length >= 3 && (shadow.blurRadius = numericParts[2]), numericParts.length >= 4 && (shadow.spreadDistance = numericParts[3]), colorParts.length > 0) {
2404
+ var colorStr = colorParts.join(" ");
2405
+ shadow.color = resolveColor(colorStr, tokenMap);
2406
+ }
2407
+ shadows.push(shadow);
2408
+ }
2409
+ }
2410
+ } catch (err) {
2411
+ _didIteratorError = true, _iteratorError = err;
2412
+ } finally {
2413
+ try {
2414
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
2415
+ } finally {
2416
+ if (_didIteratorError) throw _iteratorError;
2417
+ }
2418
+ }
2419
+ return shadows.length > 0 ? shadows : void 0;
2420
+ }
2421
+ function parseTextShadow(css, tokenMap) {
2422
+ var tokens = css.trim().split(/\s+/);
2423
+ if (!(tokens.length < 3)) {
2424
+ var offsetX = parseDimension(tokens[0]), offsetY = parseDimension(tokens[1]), blur = parseDimension(tokens[2]);
2425
+ if (!(offsetX === void 0 || offsetY === void 0 || blur === void 0)) {
2426
+ var result = [["textShadowOffset", {
2427
+ width: offsetX,
2428
+ height: offsetY
2429
+ }], ["textShadowRadius", blur]];
2430
+ if (tokens.length >= 4) {
2431
+ var colorStr = tokens.slice(3).join(" ");
2432
+ result.push(["textShadowColor", resolveColor(colorStr, tokenMap)]);
2433
+ }
2434
+ return result;
2435
+ }
2436
+ }
2437
+ }
2438
+ function parseDimension(s) {
2439
+ var cleaned = s.replace(/px$|dp$/, ""), n = Number(cleaned);
2440
+ return Number.isFinite(n) ? n : void 0;
2441
+ }
2442
+ function splitOutsideParens(s) {
2443
+ for (var parts = [], depth = 0, current = "", i = 0; i < s.length; i++) {
2444
+ var ch = s[i];
2445
+ ch === "(" ? depth++ : ch === ")" && depth--, ch === "," && depth === 0 ? (parts.push(current), current = "") : current += ch;
2446
+ }
2447
+ return current && parts.push(current), parts;
2448
+ }
2344
2449
  var remRegex = /(-?[\d.]+)rem/g;
2345
2450
  function resolveRem(value) {
2346
2451
  var _config_settings, config = getConfig(), _config_settings_remBaseFontSize, baseFontSize = (_config_settings_remBaseFontSize = config == null || (_config_settings = config.settings) === null || _config_settings === void 0 ? void 0 : _config_settings.remBaseFontSize) !== null && _config_settings_remBaseFontSize !== void 0 ? _config_settings_remBaseFontSize : 16;
@@ -2444,15 +2549,57 @@ var propMapper = function(key, value, styleState, disabled, map) {
2444
2549
  }
2445
2550
  styleProps.disableExpandShorthands || key in conf2.shorthands && (key = conf2.shorthands[key]);
2446
2551
  var originalValue = value;
2447
- if (value != null && (typeof value == "string" && value[0] === "$" ? value = getTokenForKey(key, value, styleProps, styleState) : (key === "boxShadow" || key === "textShadow" || key === "filter" || key === "backgroundImage" || key === "border") && typeof value == "string" && value.includes("$") ? value = value.replace(/(\$[\w.-]+)/g, function(t) {
2448
- var r = getTokenForKey("size", t, styleProps, styleState);
2449
- return r == null && (r = getTokenForKey("color", t, styleProps, styleState)), r != null ? String(r) : t;
2450
- }) : isVariable(value) ? value = resolveVariableValue(key, value, styleProps.resolveValues) : isRemValue(value) && (value = resolveRem(value))), value != null) {
2552
+ if (value != null) if (typeof value == "string" && value[0] === "$") value = getTokenForKey(key, value, styleProps, styleState);
2553
+ else if ((key === "boxShadow" || key === "textShadow" || key === "filter" || key === "backgroundImage" || key === "border") && typeof value == "string" && value.includes("$")) {
2554
+ if (key === "backgroundImage" || key === "boxShadow" || key === "textShadow") {
2555
+ var tokenMap = /* @__PURE__ */ new Map(), placeholderIdx = 0, withPlaceholders = value.replace(/(\$[\w.-]+)/g, function(t) {
2556
+ var r = getTokenForKey("size", t, styleProps, styleState);
2557
+ if (r == null && (r = getTokenForKey("color", t, styleProps, styleState)), r == null) return t;
2558
+ if (typeof r != "string" && typeof r != "number") {
2559
+ var placeholder = `__tk${placeholderIdx++}__`;
2560
+ return tokenMap.set(placeholder, r), placeholder;
2561
+ }
2562
+ return String(r);
2563
+ }), parsed = parseNativeStyle(key, withPlaceholders, tokenMap);
2564
+ parsed ? value = parsed : value = value.replace(/(\$[\w.-]+)/g, function(t) {
2565
+ var r = getTokenForKey("size", t, styleProps, styleState);
2566
+ return r == null && (r = getTokenForKey("color", t, styleProps, styleState)), r != null ? String(r) : t;
2567
+ });
2568
+ } else value = value.replace(/(\$[\w.-]+)/g, function(t) {
2569
+ var r = getTokenForKey("size", t, styleProps, styleState);
2570
+ return r == null && (r = getTokenForKey("color", t, styleProps, styleState)), r != null ? String(r) : t;
2571
+ });
2572
+ } else isVariable(value) ? value = resolveVariableValue(key, value, styleProps.resolveValues) : isRemValue(value) && (value = resolveRem(value));
2573
+ if (value != null && typeof value == "string" && (key === "backgroundImage" || key === "boxShadow" || key === "textShadow")) {
2574
+ var parsed1 = parseNativeStyle(key, value);
2575
+ if (parsed1) {
2576
+ if (key === "textShadow" && Array.isArray(parsed1) && Array.isArray(parsed1[0])) {
2577
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
2578
+ try {
2579
+ for (var _iterator = parsed1[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
2580
+ var [nkey, nvalue] = _step.value;
2581
+ map(nkey, nvalue, originalValue);
2582
+ }
2583
+ } catch (err) {
2584
+ _didIteratorError = true, _iteratorError = err;
2585
+ } finally {
2586
+ try {
2587
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
2588
+ } finally {
2589
+ if (_didIteratorError) throw _iteratorError;
2590
+ }
2591
+ }
2592
+ return;
2593
+ }
2594
+ value = parsed1;
2595
+ }
2596
+ }
2597
+ if (value != null) {
2451
2598
  key === "fontFamily" && lastFontFamilyToken && (styleState.fontFamily = lastFontFamilyToken);
2452
2599
  var expanded = styleProps.noExpand ? null : expandStyle(key, value);
2453
2600
  if (expanded) for (var max = expanded.length, i = 0; i < max; i++) {
2454
- var [nkey, nvalue] = expanded[i];
2455
- map(nkey, nvalue, originalValue);
2601
+ var [nkey1, nvalue1] = expanded[i];
2602
+ map(nkey1, nvalue1, originalValue);
2456
2603
  }
2457
2604
  else map(key, value, originalValue);
2458
2605
  }
@@ -2748,7 +2895,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2748
2895
  viewProps[key4] = val2;
2749
2896
  return;
2750
2897
  }
2751
- if (val2 != null) {
2898
+ if (false, val2 != null) {
2752
2899
  if (key4 === "pointerEvents") {
2753
2900
  viewProps[key4] = val2;
2754
2901
  return;
@@ -2763,13 +2910,13 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2763
2910
  }
2764
2911
  var shouldPassThrough2 = styleProps.noExpand && isPseudo || isHOC && (isMediaOrPseudo || (parentStaticConfig == null || (_parentStaticConfig_variants = parentStaticConfig.variants) === null || _parentStaticConfig_variants === void 0 ? void 0 : _parentStaticConfig_variants[keyInit]));
2765
2912
  if (shouldPassThrough2) {
2766
- passDownProp(viewProps, key4, val2, isMediaOrPseudo);
2913
+ passDownProp(viewProps, key4, val2, isMediaOrPseudo), false;
2767
2914
  return;
2768
2915
  }
2769
2916
  if (isPseudo) {
2770
2917
  if (!val2) return;
2771
2918
  var pseudoStyleObject = getSubStyle(styleState, key4, val2, styleProps.noClass && process.env.IS_STATIC !== "is_static");
2772
- {
2919
+ if (!shouldDoClasses || process.env.IS_STATIC === "is_static") {
2773
2920
  var _pseudos, _key;
2774
2921
  if (pseudos || (pseudos = {}), (_pseudos = pseudos)[_key = key4] || (_pseudos[_key] = {}), process.env.IS_STATIC === "is_static") {
2775
2922
  Object.assign(pseudos[key4], pseudoStyleObject);
@@ -2778,9 +2925,11 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2778
2925
  }
2779
2926
  var descriptor = pseudoDescriptors[key4], isEnter = key4 === "enterStyle", isExit = key4 === "exitStyle";
2780
2927
  if (!descriptor) return;
2781
- {
2928
+ var pseudoStyles, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, psuedoStyle, fullKey;
2929
+ if (shouldDoClasses && !isExit) ;
2930
+ if (!shouldDoClasses || isExit || isEnter) {
2782
2931
  var descriptorKey = descriptor.stateKey || descriptor.name, isDisabled2 = componentState[descriptorKey] === false;
2783
- isExit && (isDisabled2 = !styleProps.isExiting), isEnter && componentState.unmounted === false && (isDisabled2 = true);
2932
+ isExit && (isDisabled2 = !styleProps.isExiting), isEnter && componentState.unmounted === false && (isDisabled2 = true), false;
2784
2933
  var importance = descriptor.priority, pseudoOriginalValues = styleOriginalValues.get(pseudoStyleObject);
2785
2934
  for (var pkey in pseudoStyleObject) {
2786
2935
  var _$val = pseudoStyleObject[pkey];
@@ -2807,14 +2956,13 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2807
2956
  if (!val2) return;
2808
2957
  var mediaKeyShort = key4.slice(isMedia == "theme" ? 7 : 1);
2809
2958
  hasMedia || (hasMedia = true);
2810
- val2.space;
2811
- if ((!hasMedia || typeof hasMedia == "boolean") && (hasMedia = /* @__PURE__ */ new Set()), hasMedia.add(mediaKeyShort), isMedia === "platform" && !isActivePlatform(key4)) return;
2959
+ var hasSpace = val2.space;
2960
+ if ((hasSpace || !shouldDoClasses || styleProps.willBeAnimated) && ((!hasMedia || typeof hasMedia == "boolean") && (hasMedia = /* @__PURE__ */ new Set()), hasMedia.add(mediaKeyShort)), isMedia === "platform" && !isActivePlatform(key4)) return;
2812
2961
  var priority = mediaStylesSeen;
2813
2962
  mediaStylesSeen += 1;
2814
- var shouldDoClassesForThisMedia = isWeb;
2963
+ var shouldDoClassesForThisMedia = shouldDoClasses || isWeb && isMedia === "theme";
2815
2964
  if (shouldDoClassesForThisMedia) {
2816
- getSubStyle(styleState, key4, val2, false);
2817
- var mediaStyles = getCSSStylesAtomic(), _iteratorNormalCompletion12 = true, _didIteratorError12 = false, _iteratorError12 = void 0;
2965
+ var mediaStyle = getSubStyle(styleState, key4, val2, false), mediaStyles = getCSSStylesAtomic(mediaStyle), _iteratorNormalCompletion12 = true, _didIteratorError12 = false, _iteratorError12 = void 0;
2818
2966
  try {
2819
2967
  for (var _iterator12 = mediaStyles[Symbol.iterator](), _step12; !(_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done); _iteratorNormalCompletion12 = true) {
2820
2968
  var style3 = _step12.value, property = style3[StyleObjectProperty], isSubStyle = property[0] === "$";
@@ -2840,7 +2988,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2840
2988
  var didMerge = mergeMediaByImportance(styleState, mediaKeyShort, key5, val3, mediaState[mediaKeyShort], importanceBump, debug, originalVal2);
2841
2989
  didMerge && key5 === "fontFamily" && (styleState.fontFamily = mediaStyle1.fontFamily);
2842
2990
  };
2843
- var isThemeMedia = isMedia === "theme", isGroupMedia = isMedia === "group", isPlatformMedia = isMedia === "platform";
2991
+ var mergeMediaStyle = mergeMediaStyle2, isThemeMedia = isMedia === "theme", isGroupMedia = isMedia === "group", isPlatformMedia = isMedia === "platform";
2844
2992
  if (!isThemeMedia && !isPlatformMedia && !isGroupMedia) {
2845
2993
  if (!mediaState[mediaKeyShort]) {
2846
2994
  return;
@@ -2872,14 +3020,14 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2872
3020
  } else if (isGroupMedia) {
2873
3021
  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;
2874
3022
  if (!groupState) {
2875
- pseudoGroups || (pseudoGroups = /* @__PURE__ */ new Set());
3023
+ false, pseudoGroups || (pseudoGroups = /* @__PURE__ */ new Set());
2876
3024
  return;
2877
3025
  }
2878
3026
  var componentGroupState = (_componentState_group = componentState.group) === null || _componentState_group === void 0 ? void 0 : _componentState_group[groupName];
2879
3027
  if (groupMediaKey) {
2880
3028
  mediaGroups || (mediaGroups = /* @__PURE__ */ new Set()), mediaGroups.add(groupMediaKey);
2881
3029
  var mediaState1 = componentGroupState == null ? void 0 : componentGroupState.media, isActive = mediaState1 == null ? void 0 : mediaState1[groupMediaKey];
2882
- if (!mediaState1 && groupState.layout && (isActive = mediaKeyMatch(groupMediaKey, groupState.layout)), !isActive) {
3030
+ if (!mediaState1 && groupState.layout && (isActive = mediaKeyMatch(groupMediaKey, groupState.layout)), false, !isActive) {
2883
3031
  for (var pkey1 in mediaStyle1) applyDefaultStyle(pkey1, styleState);
2884
3032
  return;
2885
3033
  }
@@ -2889,7 +3037,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2889
3037
  var _this;
2890
3038
  pseudoGroups || (pseudoGroups = /* @__PURE__ */ new Set()), pseudoGroups.add(groupName);
2891
3039
  var componentGroupPseudoState = (_this = componentGroupState || (groupContext == null ? void 0 : groupContext[groupName].state)) === null || _this === void 0 ? void 0 : _this.pseudo, isActive1 = componentGroupPseudoState == null ? void 0 : componentGroupPseudoState[groupPseudoKey], priority1 = pseudoPriorities[groupPseudoKey];
2892
- if (!isActive1) {
3040
+ if (false, !isActive1) {
2893
3041
  for (var pkey2 in mediaStyle1) applyDefaultStyle(pkey2, styleState);
2894
3042
  return;
2895
3043
  }
@@ -2927,7 +3075,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2927
3075
  inlineWhenUnflattened,
2928
3076
  parentStaticConfig,
2929
3077
  acceptsClassName
2930
- } = staticConfig, viewProps = {}, mediaState = styleProps.mediaState || exports.mediaState, rulesToInsert = void 0, classNames = {};
3078
+ } = staticConfig, viewProps = {}, mediaState = styleProps.mediaState || exports.mediaState, shouldDoClasses = acceptsClassName && isWeb, rulesToInsert = void 0, classNames = {};
2931
3079
  props.space;
2932
3080
  var pseudos = null, hasMedia = false, dynamicThemeAccess, pseudoGroups, mediaGroups;
2933
3081
  props.className || "";
@@ -3072,7 +3220,7 @@ var getSubStyle = function(styleState, subKey, styleIn, avoidMergeTransform) {
3072
3220
  var shouldSkip = !staticConfig.isHOC && key1 in skipProps && !styleProps.noSkip;
3073
3221
  if (shouldSkip) return key = key1, "continue";
3074
3222
  propMapper(key1, val, styleState, false, function(skey, sval, originalVal) {
3075
- originalVal !== void 0 && (originalValues || (originalValues = {}), originalValues[skey] = originalVal), skey in validPseudoKeys && (sval = getSubStyle(styleState, skey, sval, avoidMergeTransform)), !avoidMergeTransform && skey in stylePropsTransform ? mergeTransform(styleOut, skey, sval) : styleOut[skey] = styleProps.noNormalize ? sval : normalizeValueWithProperty(sval);
3223
+ originalVal !== void 0 && (originalValues || (originalValues = {}), originalValues[skey] = originalVal), skey in validPseudoKeys && (sval = getSubStyle(styleState, skey, sval, avoidMergeTransform)), !avoidMergeTransform && skey in stylePropsTransform ? mergeTransform(styleOut, skey, sval) : styleOut[skey] = styleProps.noNormalize ? sval : normalizeValueWithProperty(sval, key1);
3076
3224
  }), key = key1;
3077
3225
  }, {
3078
3226
  staticConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/core",
3
- "version": "2.0.0-rc.3",
3
+ "version": "2.0.0-rc.5",
4
4
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -82,17 +82,17 @@
82
82
  "clean:build": "tamagui-build clean:build"
83
83
  },
84
84
  "dependencies": {
85
- "@tamagui/helpers": "2.0.0-rc.3",
86
- "@tamagui/react-native-media-driver": "2.0.0-rc.3",
87
- "@tamagui/react-native-use-pressable": "2.0.0-rc.3",
88
- "@tamagui/use-element-layout": "2.0.0-rc.3",
89
- "@tamagui/use-event": "2.0.0-rc.3",
90
- "@tamagui/web": "2.0.0-rc.3"
85
+ "@tamagui/helpers": "2.0.0-rc.5",
86
+ "@tamagui/react-native-media-driver": "2.0.0-rc.5",
87
+ "@tamagui/react-native-use-pressable": "2.0.0-rc.5",
88
+ "@tamagui/use-element-layout": "2.0.0-rc.5",
89
+ "@tamagui/use-event": "2.0.0-rc.5",
90
+ "@tamagui/web": "2.0.0-rc.5"
91
91
  },
92
92
  "devDependencies": {
93
- "@tamagui/build": "2.0.0-rc.3",
94
- "@tamagui/native-bundle": "2.0.0-rc.3",
95
- "@tamagui/react-native-web-lite": "2.0.0-rc.3",
93
+ "@tamagui/build": "2.0.0-rc.5",
94
+ "@tamagui/native-bundle": "2.0.0-rc.5",
95
+ "@tamagui/react-native-web-lite": "2.0.0-rc.5",
96
96
  "@testing-library/react": "^16.1.0",
97
97
  "csstype": "^3.0.10",
98
98
  "react": ">=19",