@tamagui/core 3.0.0-beta.745.1 → 3.0.0-beta.752.1

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
@@ -14976,7 +14976,9 @@ function flushDirectStyles(state) {
14976
14976
  var styleObject = atomics[property].styleObject;
14977
14977
  var identifier = styleObject[2];
14978
14978
  if (shouldInsertStyleRules(identifier)) {
14979
- updateRules(identifier, styleObject[4]);
14979
+ var rules = styleObject[4].slice();
14980
+ styleObject[4] = rules;
14981
+ updateRules(identifier, rules);
14980
14982
  state.flatRulesToInsert[identifier] = styleObject;
14981
14983
  }
14982
14984
  }
@@ -15548,10 +15550,18 @@ function _type_of$8(obj) {
15548
15550
  "@swc/helpers - typeof";
15549
15551
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
15550
15552
  }
15551
- function appendFlatClause(prev, conditionSource, value) {
15552
- if (prev != null && typeof prev !== "string" && typeof prev !== "number") return;
15553
- if (typeof value !== "string" && typeof value !== "number") return;
15554
- return prev == null ? `${conditionSource}:${value}` : `${prev} ${conditionSource}:${value}`;
15553
+ function appendFlatClause(state, prev, conditionSource, value) {
15554
+ if (typeof value === "string" || typeof value === "number") {
15555
+ if (prev == null) return `${conditionSource}:${value}`;
15556
+ if (typeof prev === "string" || typeof prev === "number") return `${prev} ${conditionSource}:${value}`;
15557
+ }
15558
+ if (prev == null) return { [conditionSource]: value };
15559
+ if (typeof prev === "string" && prev.includes(":")) return;
15560
+ if ((typeof prev === "undefined" ? "undefined" : _type_of$8(prev)) === "object" && !Array.isArray(prev) && !isVariable(prev) && isConditionalStyleObject(state, prev)) return _objectSpread2(_objectSpread2({}, prev), {}, { [conditionSource]: value });
15561
+ return {
15562
+ default: prev,
15563
+ [conditionSource]: value
15564
+ };
15555
15565
  }
15556
15566
  var propMapperHandler = {
15557
15567
  segment(ctx, start, end, isBase, valid, source, chainStart, chainEnd, chainValid) {
@@ -15696,6 +15706,34 @@ var resolveVariants = function(key, value, styleProps, styleState, parentVariant
15696
15706
  return entries || [];
15697
15707
  }
15698
15708
  }
15709
+ if (value && (typeof value === "undefined" ? "undefined" : _type_of$8(value)) === "object" && !Array.isArray(value) && !isVariable(value) && isConditionalStyleObject(styleState, value)) {
15710
+ var entries1;
15711
+ for (var objKey in value) {
15712
+ var payload = value[objKey];
15713
+ if (payload == null) continue;
15714
+ var resolved1 = resolveVariantValue(key, payload, styleProps, styleState, parentVariantKey);
15715
+ if (!resolved1) continue;
15716
+ entries1 || (entries1 = []);
15717
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
15718
+ try {
15719
+ for (var _iterator1 = resolved1[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
15720
+ var entry1 = _step1.value;
15721
+ if (objKey !== "default") entry1[3] = objKey;
15722
+ entries1.push(entry1);
15723
+ }
15724
+ } catch (err) {
15725
+ _didIteratorError1 = true;
15726
+ _iteratorError1 = err;
15727
+ } finally {
15728
+ try {
15729
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();
15730
+ } finally {
15731
+ if (_didIteratorError1) throw _iteratorError1;
15732
+ }
15733
+ }
15734
+ }
15735
+ return entries1 || [];
15736
+ }
15699
15737
  return resolveVariantValue(key, value, styleProps, styleState, parentVariantKey);
15700
15738
  };
15701
15739
  var resolveVariantValue = function(key, value, styleProps, styleState, parentVariantKey) {
@@ -15785,7 +15823,7 @@ var resolveTokensAndVariants = function(key, value, styleProps, styleState, pare
15785
15823
  var [_$key, val1, originalVal, conditionSource] = _step.value;
15786
15824
  if (val1 == null) continue;
15787
15825
  if (conditionSource !== void 0) {
15788
- var appended = appendFlatClause(res[_$key], conditionSource, val1);
15826
+ var appended = appendFlatClause(styleState, res[_$key], conditionSource, val1);
15789
15827
  if (appended === void 0) continue;
15790
15828
  res[_$key] = appended;
15791
15829
  continue;
@@ -16022,12 +16060,130 @@ function compoundMatcherMatches(expected, actual) {
16022
16060
  });
16023
16061
  return Object.is(expected, actual);
16024
16062
  }
16025
- function compoundVariantMatches(compoundVariant, props) {
16063
+ function compoundMatcherMatchesPayload(expected, payload) {
16064
+ if (Array.isArray(expected)) return expected.some(function(value) {
16065
+ return compoundMatcherMatchesPayload(value, payload);
16066
+ });
16067
+ return typeof expected === "string" ? expected === payload : String(expected) === payload;
16068
+ }
16069
+ var compoundScanHandler = {
16070
+ segment(ctx, start, end, isBase, valid, source, chainStart, chainEnd, chainValid) {
16071
+ if (!valid || start >= end) return;
16072
+ if (!compoundMatcherMatchesPayload(ctx[1], source.slice(start, end))) return;
16073
+ if (isBase) {
16074
+ ctx[4] = true;
16075
+ return;
16076
+ }
16077
+ if (!chainValid) return;
16078
+ var chain = source.slice(chainStart, chainEnd);
16079
+ if (ctx[2](chain)) ctx[3].push(chain);
16080
+ },
16081
+ chain() {
16082
+ return true;
16083
+ },
16084
+ error() {}
16085
+ };
16086
+ function matcherChains(expected, actual, isChain) {
16087
+ if (typeof actual === "string" && actual.indexOf(":") !== -1) {
16088
+ var scan = [
16089
+ actual,
16090
+ expected,
16091
+ isChain,
16092
+ [],
16093
+ false
16094
+ ];
16095
+ scanFlatValue(actual, compoundScanHandler, scan);
16096
+ if (scan[4]) return [""];
16097
+ return scan[3].length ? scan[3] : null;
16098
+ }
16099
+ if (actual && (typeof actual === "undefined" ? "undefined" : _type_of$6(actual)) === "object" && !Array.isArray(actual) && !isVariable(actual)) {
16100
+ var conditional = Object.prototype.hasOwnProperty.call(actual, "default");
16101
+ if (!conditional) for (var key in actual) {
16102
+ conditional = key.length > 0 && isChain(key);
16103
+ break;
16104
+ }
16105
+ if (conditional) {
16106
+ var chains = [];
16107
+ for (var key1 in actual) {
16108
+ var payload = actual[key1];
16109
+ if (payload == null || !compoundMatcherMatches(expected, payload)) continue;
16110
+ if (key1 === "default") return [""];
16111
+ if (isChain(key1)) chains.push(key1);
16112
+ }
16113
+ return chains.length ? chains : null;
16114
+ }
16115
+ }
16116
+ return compoundMatcherMatches(expected, actual) ? [""] : null;
16117
+ }
16118
+ function isConditionalObjectValue(value, isChain) {
16119
+ if (Object.prototype.hasOwnProperty.call(value, "default")) return true;
16120
+ for (var key in value) return key.length > 0 && isChain(key);
16121
+ return false;
16122
+ }
16123
+ var joinChains = function(a, b) {
16124
+ if (!a) return b;
16125
+ if (!b) return a;
16126
+ var segments = a.split(":");
16127
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
16128
+ try {
16129
+ for (var _iterator = b.split(":")[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
16130
+ var segment = _step.value;
16131
+ if (!segments.includes(segment)) segments.push(segment);
16132
+ }
16133
+ } catch (err) {
16134
+ _didIteratorError = true;
16135
+ _iteratorError = err;
16136
+ } finally {
16137
+ try {
16138
+ if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
16139
+ } finally {
16140
+ if (_didIteratorError) throw _iteratorError;
16141
+ }
16142
+ }
16143
+ return segments.join(":");
16144
+ };
16145
+ function compoundVariantMatchChains(compoundVariant, props, isChain) {
16146
+ var chains = [""];
16026
16147
  for (var key in compoundVariant) {
16027
16148
  if (key === "style") continue;
16028
- if (!compoundMatcherMatches(compoundVariant[key], props[key])) return false;
16149
+ var keyChains = matcherChains(compoundVariant[key], props[key], isChain);
16150
+ if (!keyChains) return null;
16151
+ var next = [];
16152
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
16153
+ try {
16154
+ for (var _iterator = chains[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
16155
+ var a = _step.value;
16156
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
16157
+ try {
16158
+ for (var _iterator1 = keyChains[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
16159
+ var b = _step1.value;
16160
+ var joined = joinChains(a, b);
16161
+ if (!next.includes(joined)) next.push(joined);
16162
+ }
16163
+ } catch (err) {
16164
+ _didIteratorError1 = true;
16165
+ _iteratorError1 = err;
16166
+ } finally {
16167
+ try {
16168
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();
16169
+ } finally {
16170
+ if (_didIteratorError1) throw _iteratorError1;
16171
+ }
16172
+ }
16173
+ }
16174
+ } catch (err) {
16175
+ _didIteratorError = true;
16176
+ _iteratorError = err;
16177
+ } finally {
16178
+ try {
16179
+ if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
16180
+ } finally {
16181
+ if (_didIteratorError) throw _iteratorError;
16182
+ }
16183
+ }
16184
+ chains = next;
16029
16185
  }
16030
- return true;
16186
+ return chains;
16031
16187
  }
16032
16188
  var styledDefaultsCache = /* @__PURE__ */ new WeakMap();
16033
16189
  function getStyledDefaults(staticConfig) {
@@ -16040,6 +16196,9 @@ function getStyledDefaults(staticConfig) {
16040
16196
  }
16041
16197
  return entries;
16042
16198
  }
16199
+ var maybeStyleProgram = function(value) {
16200
+ return typeof value === "string" ? value.includes(":") : !!value && (typeof value === "undefined" ? "undefined" : _type_of$6(value)) === "object" && !Array.isArray(value) && !isVariable(value);
16201
+ };
16043
16202
  function contributeDisplacedStyledDefaults(styledDefaults, processedProps, shorthands, contribute) {
16044
16203
  if (!styledDefaults) return;
16045
16204
  for (var index = 0; index < styledDefaults.length; index++) {
@@ -16047,10 +16206,10 @@ function contributeDisplacedStyledDefaults(styledDefaults, processedProps, short
16047
16206
  var styledValue = styledDefaults[index][1];
16048
16207
  var propValue = processedProps[key];
16049
16208
  if (!(key in stylePropsAll) && !(key in shorthands)) continue;
16050
- if (propValue !== void 0 && propValue !== styledValue && (typeof styledValue === "string" && styledValue.includes(":") || typeof propValue === "string" && propValue.includes(":"))) contribute(key, styledValue);
16209
+ if (propValue !== void 0 && propValue !== styledValue && (maybeStyleProgram(styledValue) || maybeStyleProgram(propValue))) contribute(key, styledValue);
16051
16210
  }
16052
16211
  }
16053
- function forEachPropInForwardOrder(processedProps, staticConfig, shorthands, contribute) {
16212
+ function forEachPropInForwardOrder(processedProps, staticConfig, shorthands, contribute, isChain) {
16054
16213
  var processedBaseStyle = staticConfig.baseStyle;
16055
16214
  var compoundVariants = staticConfig.compoundVariants;
16056
16215
  var styledDefaults = getStyledDefaults(staticConfig);
@@ -16070,7 +16229,8 @@ function forEachPropInForwardOrder(processedProps, staticConfig, shorthands, con
16070
16229
  try {
16071
16230
  for (var _iterator = compoundVariants[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
16072
16231
  var compoundVariant = _step.value;
16073
- if (!compoundVariantMatches(compoundVariant, processedProps)) continue;
16232
+ var chains = compoundVariantMatchChains(compoundVariant, processedProps, isChain);
16233
+ if (!chains) continue;
16074
16234
  var { style } = compoundVariant;
16075
16235
  if (!isPlainObject(style)) continue;
16076
16236
  var anchor = -1;
@@ -16082,7 +16242,36 @@ function forEachPropInForwardOrder(processedProps, staticConfig, shorthands, con
16082
16242
  }
16083
16243
  }
16084
16244
  var entries = compoundsByAnchor.get(anchor) || [];
16085
- for (var key2 in style) entries.push([key2, style[key2]]);
16245
+ for (var key2 in style) {
16246
+ var value = style[key2];
16247
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
16248
+ try {
16249
+ for (var _iterator1 = chains[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
16250
+ var chain = _step1.value;
16251
+ if (!chain) {
16252
+ entries.push([key2, value]);
16253
+ continue;
16254
+ }
16255
+ if (value && (typeof value === "undefined" ? "undefined" : _type_of$6(value)) === "object" && !Array.isArray(value) && !isVariable(value) && isConditionalObjectValue(value, isChain)) {
16256
+ var composed = {};
16257
+ for (var inner in value) composed[inner === "default" ? chain : `${chain}:${inner}`] = value[inner];
16258
+ entries.push([key2, composed]);
16259
+ continue;
16260
+ }
16261
+ if (typeof value === "string" && value.includes(":")) continue;
16262
+ entries.push([key2, { [chain]: value }]);
16263
+ }
16264
+ } catch (err) {
16265
+ _didIteratorError1 = true;
16266
+ _iteratorError1 = err;
16267
+ } finally {
16268
+ try {
16269
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();
16270
+ } finally {
16271
+ if (_didIteratorError1) throw _iteratorError1;
16272
+ }
16273
+ }
16274
+ }
16086
16275
  compoundsByAnchor.set(anchor, entries);
16087
16276
  }
16088
16277
  } catch (err) {
@@ -16306,7 +16495,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
16306
16495
  if (conditionSource !== void 0) {
16307
16496
  if (isHostStyleKey || isContextProgramKey) contributeVariantClauseValue(styleState, key8, val2, conditionSource, mergeStyle, originalVal, !isHostStyleKey);
16308
16497
  else if (isHOC) {
16309
- var appended = appendFlatClause(viewProps[key8], conditionSource, val2);
16498
+ var appended = appendFlatClause(styleState, viewProps[key8], conditionSource, val2);
16310
16499
  if (appended !== void 0) viewProps[key8] = appended;
16311
16500
  }
16312
16501
  return;
@@ -16331,7 +16520,9 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
16331
16520
  }
16332
16521
  });
16333
16522
  };
16334
- forEachPropInForwardOrder(processedProps, staticConfig, shorthands, contributeProp);
16523
+ forEachPropInForwardOrder(processedProps, staticConfig, shorthands, contributeProp, function(chain) {
16524
+ return !!resolveClauseChain(styleState, chain, 0, chain.length);
16525
+ });
16335
16526
  var conditionalStates = styleState.flatStateKeys || null;
16336
16527
  var usesSafeArea = !!styleState.flatUsesSafeArea;
16337
16528
  if ((_styleState_flatMediaKeys = styleState.flatMediaKeys) === null || _styleState_flatMediaKeys === void 0 ? void 0 : _styleState_flatMediaKeys.size) {
@@ -16955,7 +17146,7 @@ var lifecycleHandler = {
16955
17146
  return true;
16956
17147
  }
16957
17148
  };
16958
- function hasFlatModifier(props, config, modifiers, ctx) {
17149
+ function hasFlatModifier(props, config, modifiers, ctx, variants) {
16959
17150
  var _ctx;
16960
17151
  var scan = (_ctx = ctx).flatScan || (_ctx.flatScan = [
16961
17152
  "",
@@ -16968,7 +17159,7 @@ function hasFlatModifier(props, config, modifiers, ctx) {
16968
17159
  var isString = typeof value === "string";
16969
17160
  if (isString ? value.indexOf(":") === -1 : !value || (typeof value === "undefined" ? "undefined" : _type_of$5(value)) !== "object") continue;
16970
17161
  var property = config.shorthands[key] || key;
16971
- if (!(property in stylePropsAll) && property !== "transition") continue;
17162
+ if (!(property in stylePropsAll) && property !== "transition" && !(variants && key in variants)) continue;
16972
17163
  if (!isString) {
16973
17164
  if (property === "transition") continue;
16974
17165
  for (var chain in value) {
@@ -17010,7 +17201,7 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
17010
17201
  var outputStyle = (_animationDriver_outputStyle = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.outputStyle) !== null && _animationDriver_outputStyle !== void 0 ? _animationDriver_outputStyle : "css";
17011
17202
  var curStateRef = stateRef.current;
17012
17203
  if (!needsHydration && hasAnimationProp) curStateRef.hasAnimated = true;
17013
- var platformPseudo = Boolean(!isHOC && useAnimations && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && ((_getPlatformDriver = getPlatformDriver()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo) && hasFlatModifier(props, config, platformPseudoModifiers, curStateRef));
17204
+ var platformPseudo = Boolean(!isHOC && useAnimations && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && ((_getPlatformDriver = getPlatformDriver()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo) && hasFlatModifier(props, config, platformPseudoModifiers, curStateRef, staticConfig.variants));
17014
17205
  var willBeAnimatedClient = (function() {
17015
17206
  return Boolean(!!((hasAnimationProp || platformPseudo) && !isHOC && useAnimations) || curStateRef.hasAnimated);
17016
17207
  })();
@@ -17021,7 +17212,7 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
17021
17212
  var presenceState = presence === null || presence === void 0 ? void 0 : presence[2];
17022
17213
  var isExiting = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === false;
17023
17214
  var isEntering = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === true && presenceState.initial !== false;
17024
- var hasEnterStyle = hasFlatModifier(props, config, enterModifier, curStateRef);
17215
+ var hasEnterStyle = hasFlatModifier(props, config, enterModifier, curStateRef, staticConfig.variants);
17025
17216
  var hasAnimationThatNeedsHydrate = hasAnimationProp && !isHydrated && ((animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isReactNative) || inputStyle !== "css");
17026
17217
  var initialState = !isHOC && (hasEnterStyle || isEntering || hasAnimationThatNeedsHydrate || disableClassName) ? hasEnterStyle || isEntering ? defaultComponentStateShouldEnter : defaultComponentState : defaultComponentStateMounted;
17027
17218
  var disabled = isDisabled(props);
@@ -5196,7 +5196,9 @@ function flushDirectStyles(state) {
5196
5196
  var styleObject = atomics[property].styleObject;
5197
5197
  var identifier = styleObject[2];
5198
5198
  if (shouldInsertStyleRules(identifier)) {
5199
- updateRules(identifier, styleObject[4]);
5199
+ var rules = styleObject[4].slice();
5200
+ styleObject[4] = rules;
5201
+ updateRules(identifier, rules);
5200
5202
  state.flatRulesToInsert[identifier] = styleObject;
5201
5203
  }
5202
5204
  }
@@ -5769,10 +5771,18 @@ function _type_of$9(obj) {
5769
5771
  "@swc/helpers - typeof";
5770
5772
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
5771
5773
  }
5772
- function appendFlatClause(prev, conditionSource, value) {
5773
- if (prev != null && typeof prev !== "string" && typeof prev !== "number") return;
5774
- if (typeof value !== "string" && typeof value !== "number") return;
5775
- return prev == null ? `${conditionSource}:${value}` : `${prev} ${conditionSource}:${value}`;
5774
+ function appendFlatClause(state, prev, conditionSource, value) {
5775
+ if (typeof value === "string" || typeof value === "number") {
5776
+ if (prev == null) return `${conditionSource}:${value}`;
5777
+ if (typeof prev === "string" || typeof prev === "number") return `${prev} ${conditionSource}:${value}`;
5778
+ }
5779
+ if (prev == null) return { [conditionSource]: value };
5780
+ if (typeof prev === "string" && prev.includes(":")) return;
5781
+ if ((typeof prev === "undefined" ? "undefined" : _type_of$9(prev)) === "object" && !Array.isArray(prev) && !isVariable(prev) && isConditionalStyleObject(state, prev)) return _objectSpread2(_objectSpread2({}, prev), {}, { [conditionSource]: value });
5782
+ return {
5783
+ default: prev,
5784
+ [conditionSource]: value
5785
+ };
5776
5786
  }
5777
5787
  var propMapperHandler = {
5778
5788
  segment(ctx, start, end, isBase, valid, source, chainStart, chainEnd, chainValid) {
@@ -5917,6 +5927,34 @@ var resolveVariants = function(key, value, styleProps, styleState, parentVariant
5917
5927
  return entries || [];
5918
5928
  }
5919
5929
  }
5930
+ if (value && (typeof value === "undefined" ? "undefined" : _type_of$9(value)) === "object" && !Array.isArray(value) && !isVariable(value) && isConditionalStyleObject(styleState, value)) {
5931
+ var entries1;
5932
+ for (var objKey in value) {
5933
+ var payload = value[objKey];
5934
+ if (payload == null) continue;
5935
+ var resolved1 = resolveVariantValue(key, payload, styleProps, styleState, parentVariantKey);
5936
+ if (!resolved1) continue;
5937
+ entries1 || (entries1 = []);
5938
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
5939
+ try {
5940
+ for (var _iterator1 = resolved1[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
5941
+ var entry1 = _step1.value;
5942
+ if (objKey !== "default") entry1[3] = objKey;
5943
+ entries1.push(entry1);
5944
+ }
5945
+ } catch (err) {
5946
+ _didIteratorError1 = true;
5947
+ _iteratorError1 = err;
5948
+ } finally {
5949
+ try {
5950
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();
5951
+ } finally {
5952
+ if (_didIteratorError1) throw _iteratorError1;
5953
+ }
5954
+ }
5955
+ }
5956
+ return entries1 || [];
5957
+ }
5920
5958
  return resolveVariantValue(key, value, styleProps, styleState, parentVariantKey);
5921
5959
  };
5922
5960
  var resolveVariantValue = function(key, value, styleProps, styleState, parentVariantKey) {
@@ -6006,7 +6044,7 @@ var resolveTokensAndVariants = function(key, value, styleProps, styleState, pare
6006
6044
  var [_$key, val1, originalVal, conditionSource] = _step.value;
6007
6045
  if (val1 == null) continue;
6008
6046
  if (conditionSource !== void 0) {
6009
- var appended = appendFlatClause(res[_$key], conditionSource, val1);
6047
+ var appended = appendFlatClause(styleState, res[_$key], conditionSource, val1);
6010
6048
  if (appended === void 0) continue;
6011
6049
  res[_$key] = appended;
6012
6050
  continue;
@@ -6243,12 +6281,130 @@ function compoundMatcherMatches(expected, actual) {
6243
6281
  });
6244
6282
  return Object.is(expected, actual);
6245
6283
  }
6246
- function compoundVariantMatches(compoundVariant, props) {
6284
+ function compoundMatcherMatchesPayload(expected, payload) {
6285
+ if (Array.isArray(expected)) return expected.some(function(value) {
6286
+ return compoundMatcherMatchesPayload(value, payload);
6287
+ });
6288
+ return typeof expected === "string" ? expected === payload : String(expected) === payload;
6289
+ }
6290
+ var compoundScanHandler = {
6291
+ segment(ctx, start, end, isBase, valid, source, chainStart, chainEnd, chainValid) {
6292
+ if (!valid || start >= end) return;
6293
+ if (!compoundMatcherMatchesPayload(ctx[1], source.slice(start, end))) return;
6294
+ if (isBase) {
6295
+ ctx[4] = true;
6296
+ return;
6297
+ }
6298
+ if (!chainValid) return;
6299
+ var chain = source.slice(chainStart, chainEnd);
6300
+ if (ctx[2](chain)) ctx[3].push(chain);
6301
+ },
6302
+ chain() {
6303
+ return true;
6304
+ },
6305
+ error() {}
6306
+ };
6307
+ function matcherChains(expected, actual, isChain) {
6308
+ if (typeof actual === "string" && actual.indexOf(":") !== -1) {
6309
+ var scan = [
6310
+ actual,
6311
+ expected,
6312
+ isChain,
6313
+ [],
6314
+ false
6315
+ ];
6316
+ scanFlatValue(actual, compoundScanHandler, scan);
6317
+ if (scan[4]) return [""];
6318
+ return scan[3].length ? scan[3] : null;
6319
+ }
6320
+ if (actual && (typeof actual === "undefined" ? "undefined" : _type_of$7(actual)) === "object" && !Array.isArray(actual) && !isVariable(actual)) {
6321
+ var conditional = Object.prototype.hasOwnProperty.call(actual, "default");
6322
+ if (!conditional) for (var key in actual) {
6323
+ conditional = key.length > 0 && isChain(key);
6324
+ break;
6325
+ }
6326
+ if (conditional) {
6327
+ var chains = [];
6328
+ for (var key1 in actual) {
6329
+ var payload = actual[key1];
6330
+ if (payload == null || !compoundMatcherMatches(expected, payload)) continue;
6331
+ if (key1 === "default") return [""];
6332
+ if (isChain(key1)) chains.push(key1);
6333
+ }
6334
+ return chains.length ? chains : null;
6335
+ }
6336
+ }
6337
+ return compoundMatcherMatches(expected, actual) ? [""] : null;
6338
+ }
6339
+ function isConditionalObjectValue(value, isChain) {
6340
+ if (Object.prototype.hasOwnProperty.call(value, "default")) return true;
6341
+ for (var key in value) return key.length > 0 && isChain(key);
6342
+ return false;
6343
+ }
6344
+ var joinChains = function(a, b) {
6345
+ if (!a) return b;
6346
+ if (!b) return a;
6347
+ var segments = a.split(":");
6348
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
6349
+ try {
6350
+ for (var _iterator = b.split(":")[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
6351
+ var segment = _step.value;
6352
+ if (!segments.includes(segment)) segments.push(segment);
6353
+ }
6354
+ } catch (err) {
6355
+ _didIteratorError = true;
6356
+ _iteratorError = err;
6357
+ } finally {
6358
+ try {
6359
+ if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
6360
+ } finally {
6361
+ if (_didIteratorError) throw _iteratorError;
6362
+ }
6363
+ }
6364
+ return segments.join(":");
6365
+ };
6366
+ function compoundVariantMatchChains(compoundVariant, props, isChain) {
6367
+ var chains = [""];
6247
6368
  for (var key in compoundVariant) {
6248
6369
  if (key === "style") continue;
6249
- if (!compoundMatcherMatches(compoundVariant[key], props[key])) return false;
6370
+ var keyChains = matcherChains(compoundVariant[key], props[key], isChain);
6371
+ if (!keyChains) return null;
6372
+ var next = [];
6373
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
6374
+ try {
6375
+ for (var _iterator = chains[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
6376
+ var a = _step.value;
6377
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
6378
+ try {
6379
+ for (var _iterator1 = keyChains[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
6380
+ var b = _step1.value;
6381
+ var joined = joinChains(a, b);
6382
+ if (!next.includes(joined)) next.push(joined);
6383
+ }
6384
+ } catch (err) {
6385
+ _didIteratorError1 = true;
6386
+ _iteratorError1 = err;
6387
+ } finally {
6388
+ try {
6389
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();
6390
+ } finally {
6391
+ if (_didIteratorError1) throw _iteratorError1;
6392
+ }
6393
+ }
6394
+ }
6395
+ } catch (err) {
6396
+ _didIteratorError = true;
6397
+ _iteratorError = err;
6398
+ } finally {
6399
+ try {
6400
+ if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
6401
+ } finally {
6402
+ if (_didIteratorError) throw _iteratorError;
6403
+ }
6404
+ }
6405
+ chains = next;
6250
6406
  }
6251
- return true;
6407
+ return chains;
6252
6408
  }
6253
6409
  var styledDefaultsCache = /* @__PURE__ */ new WeakMap();
6254
6410
  function getStyledDefaults(staticConfig) {
@@ -6261,6 +6417,9 @@ function getStyledDefaults(staticConfig) {
6261
6417
  }
6262
6418
  return entries;
6263
6419
  }
6420
+ var maybeStyleProgram = function(value) {
6421
+ return typeof value === "string" ? value.includes(":") : !!value && (typeof value === "undefined" ? "undefined" : _type_of$7(value)) === "object" && !Array.isArray(value) && !isVariable(value);
6422
+ };
6264
6423
  function contributeDisplacedStyledDefaults(styledDefaults, processedProps, shorthands, contribute) {
6265
6424
  if (!styledDefaults) return;
6266
6425
  for (var index = 0; index < styledDefaults.length; index++) {
@@ -6268,10 +6427,10 @@ function contributeDisplacedStyledDefaults(styledDefaults, processedProps, short
6268
6427
  var styledValue = styledDefaults[index][1];
6269
6428
  var propValue = processedProps[key];
6270
6429
  if (!(key in stylePropsAll) && !(key in shorthands)) continue;
6271
- if (propValue !== void 0 && propValue !== styledValue && (typeof styledValue === "string" && styledValue.includes(":") || typeof propValue === "string" && propValue.includes(":"))) contribute(key, styledValue);
6430
+ if (propValue !== void 0 && propValue !== styledValue && (maybeStyleProgram(styledValue) || maybeStyleProgram(propValue))) contribute(key, styledValue);
6272
6431
  }
6273
6432
  }
6274
- function forEachPropInForwardOrder(processedProps, staticConfig, shorthands, contribute) {
6433
+ function forEachPropInForwardOrder(processedProps, staticConfig, shorthands, contribute, isChain) {
6275
6434
  var processedBaseStyle = staticConfig.baseStyle;
6276
6435
  var compoundVariants = staticConfig.compoundVariants;
6277
6436
  var styledDefaults = getStyledDefaults(staticConfig);
@@ -6291,7 +6450,8 @@ function forEachPropInForwardOrder(processedProps, staticConfig, shorthands, con
6291
6450
  try {
6292
6451
  for (var _iterator = compoundVariants[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
6293
6452
  var compoundVariant = _step.value;
6294
- if (!compoundVariantMatches(compoundVariant, processedProps)) continue;
6453
+ var chains = compoundVariantMatchChains(compoundVariant, processedProps, isChain);
6454
+ if (!chains) continue;
6295
6455
  var { style } = compoundVariant;
6296
6456
  if (!isPlainObject(style)) continue;
6297
6457
  var anchor = -1;
@@ -6303,7 +6463,36 @@ function forEachPropInForwardOrder(processedProps, staticConfig, shorthands, con
6303
6463
  }
6304
6464
  }
6305
6465
  var entries = compoundsByAnchor.get(anchor) || [];
6306
- for (var key2 in style) entries.push([key2, style[key2]]);
6466
+ for (var key2 in style) {
6467
+ var value = style[key2];
6468
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
6469
+ try {
6470
+ for (var _iterator1 = chains[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
6471
+ var chain = _step1.value;
6472
+ if (!chain) {
6473
+ entries.push([key2, value]);
6474
+ continue;
6475
+ }
6476
+ if (value && (typeof value === "undefined" ? "undefined" : _type_of$7(value)) === "object" && !Array.isArray(value) && !isVariable(value) && isConditionalObjectValue(value, isChain)) {
6477
+ var composed = {};
6478
+ for (var inner in value) composed[inner === "default" ? chain : `${chain}:${inner}`] = value[inner];
6479
+ entries.push([key2, composed]);
6480
+ continue;
6481
+ }
6482
+ if (typeof value === "string" && value.includes(":")) continue;
6483
+ entries.push([key2, { [chain]: value }]);
6484
+ }
6485
+ } catch (err) {
6486
+ _didIteratorError1 = true;
6487
+ _iteratorError1 = err;
6488
+ } finally {
6489
+ try {
6490
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();
6491
+ } finally {
6492
+ if (_didIteratorError1) throw _iteratorError1;
6493
+ }
6494
+ }
6495
+ }
6307
6496
  compoundsByAnchor.set(anchor, entries);
6308
6497
  }
6309
6498
  } catch (err) {
@@ -6528,7 +6717,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
6528
6717
  if (conditionSource !== void 0) {
6529
6718
  if (isHostStyleKey || isContextProgramKey) contributeVariantClauseValue(styleState, key8, val2, conditionSource, mergeStyle, originalVal, !isHostStyleKey);
6530
6719
  else if (isHOC) {
6531
- var appended = appendFlatClause(viewProps[key8], conditionSource, val2);
6720
+ var appended = appendFlatClause(styleState, viewProps[key8], conditionSource, val2);
6532
6721
  if (appended !== void 0) viewProps[key8] = appended;
6533
6722
  }
6534
6723
  return;
@@ -6553,7 +6742,9 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
6553
6742
  }
6554
6743
  });
6555
6744
  };
6556
- forEachPropInForwardOrder(processedProps, staticConfig, shorthands, contributeProp);
6745
+ forEachPropInForwardOrder(processedProps, staticConfig, shorthands, contributeProp, function(chain) {
6746
+ return !!resolveClauseChain(styleState, chain, 0, chain.length);
6747
+ });
6557
6748
  var conditionalStates = styleState.flatStateKeys || null;
6558
6749
  var usesSafeArea = !!styleState.flatUsesSafeArea;
6559
6750
  if ((_styleState_flatMediaKeys = styleState.flatMediaKeys) === null || _styleState_flatMediaKeys === void 0 ? void 0 : _styleState_flatMediaKeys.size) {
@@ -7177,7 +7368,7 @@ var lifecycleHandler = {
7177
7368
  return true;
7178
7369
  }
7179
7370
  };
7180
- function hasFlatModifier(props, config, modifiers, ctx) {
7371
+ function hasFlatModifier(props, config, modifiers, ctx, variants) {
7181
7372
  var _ctx;
7182
7373
  var scan = (_ctx = ctx).flatScan || (_ctx.flatScan = [
7183
7374
  "",
@@ -7190,7 +7381,7 @@ function hasFlatModifier(props, config, modifiers, ctx) {
7190
7381
  var isString = typeof value === "string";
7191
7382
  if (isString ? value.indexOf(":") === -1 : !value || (typeof value === "undefined" ? "undefined" : _type_of$6(value)) !== "object") continue;
7192
7383
  var property = config.shorthands[key] || key;
7193
- if (!(property in stylePropsAll) && property !== "transition") continue;
7384
+ if (!(property in stylePropsAll) && property !== "transition" && !(variants && key in variants)) continue;
7194
7385
  if (!isString) {
7195
7386
  if (property === "transition") continue;
7196
7387
  for (var chain in value) {
@@ -7232,7 +7423,7 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
7232
7423
  var outputStyle = (_animationDriver_outputStyle = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.outputStyle) !== null && _animationDriver_outputStyle !== void 0 ? _animationDriver_outputStyle : "css";
7233
7424
  var curStateRef = stateRef.current;
7234
7425
  if (!needsHydration && hasAnimationProp) curStateRef.hasAnimated = true;
7235
- var platformPseudo = Boolean(!isHOC && useAnimations && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && ((_getPlatformDriver = getPlatformDriver()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo) && hasFlatModifier(props, config, platformPseudoModifiers, curStateRef));
7426
+ var platformPseudo = Boolean(!isHOC && useAnimations && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && ((_getPlatformDriver = getPlatformDriver()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo) && hasFlatModifier(props, config, platformPseudoModifiers, curStateRef, staticConfig.variants));
7236
7427
  var willBeAnimatedClient = (function() {
7237
7428
  return Boolean(!!((hasAnimationProp || platformPseudo) && !isHOC && useAnimations) || curStateRef.hasAnimated);
7238
7429
  })();
@@ -7243,7 +7434,7 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
7243
7434
  var presenceState = presence === null || presence === void 0 ? void 0 : presence[2];
7244
7435
  var isExiting = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === false;
7245
7436
  var isEntering = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === true && presenceState.initial !== false;
7246
- var hasEnterStyle = hasFlatModifier(props, config, enterModifier, curStateRef);
7437
+ var hasEnterStyle = hasFlatModifier(props, config, enterModifier, curStateRef, staticConfig.variants);
7247
7438
  var hasAnimationThatNeedsHydrate = hasAnimationProp && !isHydrated && ((animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isReactNative) || inputStyle !== "css");
7248
7439
  var initialState = !isHOC && (hasEnterStyle || isEntering || hasAnimationThatNeedsHydrate || disableClassName) ? hasEnterStyle || isEntering ? defaultComponentStateShouldEnter : defaultComponentState : defaultComponentStateMounted;
7249
7440
  var disabled = isDisabled(props);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/core",
3
- "version": "3.0.0-beta.745.1",
3
+ "version": "3.0.0-beta.752.1",
4
4
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -127,20 +127,20 @@
127
127
  "clean:build": "tamagui-build clean:build"
128
128
  },
129
129
  "dependencies": {
130
- "@tamagui/compose-refs": "3.0.0-beta.745.1",
131
- "@tamagui/constants": "3.0.0-beta.745.1",
132
- "@tamagui/helpers": "3.0.0-beta.745.1",
133
- "@tamagui/react-native-media-driver": "3.0.0-beta.745.1",
134
- "@tamagui/react-native-use-pressable": "3.0.0-beta.745.1",
135
- "@tamagui/size": "3.0.0-beta.745.1",
136
- "@tamagui/use-element-layout": "3.0.0-beta.745.1",
137
- "@tamagui/use-event": "3.0.0-beta.745.1",
138
- "@tamagui/web": "3.0.0-beta.745.1"
130
+ "@tamagui/compose-refs": "3.0.0-beta.752.1",
131
+ "@tamagui/constants": "3.0.0-beta.752.1",
132
+ "@tamagui/helpers": "3.0.0-beta.752.1",
133
+ "@tamagui/react-native-media-driver": "3.0.0-beta.752.1",
134
+ "@tamagui/react-native-use-pressable": "3.0.0-beta.752.1",
135
+ "@tamagui/size": "3.0.0-beta.752.1",
136
+ "@tamagui/use-element-layout": "3.0.0-beta.752.1",
137
+ "@tamagui/use-event": "3.0.0-beta.752.1",
138
+ "@tamagui/web": "3.0.0-beta.752.1"
139
139
  },
140
140
  "devDependencies": {
141
- "@tamagui/build": "3.0.0-beta.745.1",
142
- "@tamagui/native-bundle": "3.0.0-beta.745.1",
143
- "@tamagui/react-native-web-lite": "3.0.0-beta.745.1",
141
+ "@tamagui/build": "3.0.0-beta.752.1",
142
+ "@tamagui/native-bundle": "3.0.0-beta.752.1",
143
+ "@tamagui/react-native-web-lite": "3.0.0-beta.752.1",
144
144
  "@testing-library/react": "^16.1.0",
145
145
  "csstype": "^3.0.10",
146
146
  "react": "19.2.3",