@tamagui/core 3.0.0-beta.748.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) {
@@ -15813,7 +15823,7 @@ var resolveTokensAndVariants = function(key, value, styleProps, styleState, pare
15813
15823
  var [_$key, val1, originalVal, conditionSource] = _step.value;
15814
15824
  if (val1 == null) continue;
15815
15825
  if (conditionSource !== void 0) {
15816
- var appended = appendFlatClause(res[_$key], conditionSource, val1);
15826
+ var appended = appendFlatClause(styleState, res[_$key], conditionSource, val1);
15817
15827
  if (appended === void 0) continue;
15818
15828
  res[_$key] = appended;
15819
15829
  continue;
@@ -16050,12 +16060,130 @@ function compoundMatcherMatches(expected, actual) {
16050
16060
  });
16051
16061
  return Object.is(expected, actual);
16052
16062
  }
16053
- 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 = [""];
16054
16147
  for (var key in compoundVariant) {
16055
16148
  if (key === "style") continue;
16056
- 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;
16057
16185
  }
16058
- return true;
16186
+ return chains;
16059
16187
  }
16060
16188
  var styledDefaultsCache = /* @__PURE__ */ new WeakMap();
16061
16189
  function getStyledDefaults(staticConfig) {
@@ -16068,6 +16196,9 @@ function getStyledDefaults(staticConfig) {
16068
16196
  }
16069
16197
  return entries;
16070
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
+ };
16071
16202
  function contributeDisplacedStyledDefaults(styledDefaults, processedProps, shorthands, contribute) {
16072
16203
  if (!styledDefaults) return;
16073
16204
  for (var index = 0; index < styledDefaults.length; index++) {
@@ -16075,10 +16206,10 @@ function contributeDisplacedStyledDefaults(styledDefaults, processedProps, short
16075
16206
  var styledValue = styledDefaults[index][1];
16076
16207
  var propValue = processedProps[key];
16077
16208
  if (!(key in stylePropsAll) && !(key in shorthands)) continue;
16078
- 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);
16079
16210
  }
16080
16211
  }
16081
- function forEachPropInForwardOrder(processedProps, staticConfig, shorthands, contribute) {
16212
+ function forEachPropInForwardOrder(processedProps, staticConfig, shorthands, contribute, isChain) {
16082
16213
  var processedBaseStyle = staticConfig.baseStyle;
16083
16214
  var compoundVariants = staticConfig.compoundVariants;
16084
16215
  var styledDefaults = getStyledDefaults(staticConfig);
@@ -16098,7 +16229,8 @@ function forEachPropInForwardOrder(processedProps, staticConfig, shorthands, con
16098
16229
  try {
16099
16230
  for (var _iterator = compoundVariants[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
16100
16231
  var compoundVariant = _step.value;
16101
- if (!compoundVariantMatches(compoundVariant, processedProps)) continue;
16232
+ var chains = compoundVariantMatchChains(compoundVariant, processedProps, isChain);
16233
+ if (!chains) continue;
16102
16234
  var { style } = compoundVariant;
16103
16235
  if (!isPlainObject(style)) continue;
16104
16236
  var anchor = -1;
@@ -16110,7 +16242,36 @@ function forEachPropInForwardOrder(processedProps, staticConfig, shorthands, con
16110
16242
  }
16111
16243
  }
16112
16244
  var entries = compoundsByAnchor.get(anchor) || [];
16113
- 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
+ }
16114
16275
  compoundsByAnchor.set(anchor, entries);
16115
16276
  }
16116
16277
  } catch (err) {
@@ -16334,7 +16495,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
16334
16495
  if (conditionSource !== void 0) {
16335
16496
  if (isHostStyleKey || isContextProgramKey) contributeVariantClauseValue(styleState, key8, val2, conditionSource, mergeStyle, originalVal, !isHostStyleKey);
16336
16497
  else if (isHOC) {
16337
- var appended = appendFlatClause(viewProps[key8], conditionSource, val2);
16498
+ var appended = appendFlatClause(styleState, viewProps[key8], conditionSource, val2);
16338
16499
  if (appended !== void 0) viewProps[key8] = appended;
16339
16500
  }
16340
16501
  return;
@@ -16359,7 +16520,9 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
16359
16520
  }
16360
16521
  });
16361
16522
  };
16362
- forEachPropInForwardOrder(processedProps, staticConfig, shorthands, contributeProp);
16523
+ forEachPropInForwardOrder(processedProps, staticConfig, shorthands, contributeProp, function(chain) {
16524
+ return !!resolveClauseChain(styleState, chain, 0, chain.length);
16525
+ });
16363
16526
  var conditionalStates = styleState.flatStateKeys || null;
16364
16527
  var usesSafeArea = !!styleState.flatUsesSafeArea;
16365
16528
  if ((_styleState_flatMediaKeys = styleState.flatMediaKeys) === null || _styleState_flatMediaKeys === void 0 ? void 0 : _styleState_flatMediaKeys.size) {
@@ -16983,7 +17146,7 @@ var lifecycleHandler = {
16983
17146
  return true;
16984
17147
  }
16985
17148
  };
16986
- function hasFlatModifier(props, config, modifiers, ctx) {
17149
+ function hasFlatModifier(props, config, modifiers, ctx, variants) {
16987
17150
  var _ctx;
16988
17151
  var scan = (_ctx = ctx).flatScan || (_ctx.flatScan = [
16989
17152
  "",
@@ -16996,7 +17159,7 @@ function hasFlatModifier(props, config, modifiers, ctx) {
16996
17159
  var isString = typeof value === "string";
16997
17160
  if (isString ? value.indexOf(":") === -1 : !value || (typeof value === "undefined" ? "undefined" : _type_of$5(value)) !== "object") continue;
16998
17161
  var property = config.shorthands[key] || key;
16999
- if (!(property in stylePropsAll) && property !== "transition") continue;
17162
+ if (!(property in stylePropsAll) && property !== "transition" && !(variants && key in variants)) continue;
17000
17163
  if (!isString) {
17001
17164
  if (property === "transition") continue;
17002
17165
  for (var chain in value) {
@@ -17038,7 +17201,7 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
17038
17201
  var outputStyle = (_animationDriver_outputStyle = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.outputStyle) !== null && _animationDriver_outputStyle !== void 0 ? _animationDriver_outputStyle : "css";
17039
17202
  var curStateRef = stateRef.current;
17040
17203
  if (!needsHydration && hasAnimationProp) curStateRef.hasAnimated = true;
17041
- 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));
17042
17205
  var willBeAnimatedClient = (function() {
17043
17206
  return Boolean(!!((hasAnimationProp || platformPseudo) && !isHOC && useAnimations) || curStateRef.hasAnimated);
17044
17207
  })();
@@ -17049,7 +17212,7 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
17049
17212
  var presenceState = presence === null || presence === void 0 ? void 0 : presence[2];
17050
17213
  var isExiting = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === false;
17051
17214
  var isEntering = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === true && presenceState.initial !== false;
17052
- var hasEnterStyle = hasFlatModifier(props, config, enterModifier, curStateRef);
17215
+ var hasEnterStyle = hasFlatModifier(props, config, enterModifier, curStateRef, staticConfig.variants);
17053
17216
  var hasAnimationThatNeedsHydrate = hasAnimationProp && !isHydrated && ((animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isReactNative) || inputStyle !== "css");
17054
17217
  var initialState = !isHOC && (hasEnterStyle || isEntering || hasAnimationThatNeedsHydrate || disableClassName) ? hasEnterStyle || isEntering ? defaultComponentStateShouldEnter : defaultComponentState : defaultComponentStateMounted;
17055
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) {
@@ -6034,7 +6044,7 @@ var resolveTokensAndVariants = function(key, value, styleProps, styleState, pare
6034
6044
  var [_$key, val1, originalVal, conditionSource] = _step.value;
6035
6045
  if (val1 == null) continue;
6036
6046
  if (conditionSource !== void 0) {
6037
- var appended = appendFlatClause(res[_$key], conditionSource, val1);
6047
+ var appended = appendFlatClause(styleState, res[_$key], conditionSource, val1);
6038
6048
  if (appended === void 0) continue;
6039
6049
  res[_$key] = appended;
6040
6050
  continue;
@@ -6271,12 +6281,130 @@ function compoundMatcherMatches(expected, actual) {
6271
6281
  });
6272
6282
  return Object.is(expected, actual);
6273
6283
  }
6274
- 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 = [""];
6275
6368
  for (var key in compoundVariant) {
6276
6369
  if (key === "style") continue;
6277
- 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;
6278
6406
  }
6279
- return true;
6407
+ return chains;
6280
6408
  }
6281
6409
  var styledDefaultsCache = /* @__PURE__ */ new WeakMap();
6282
6410
  function getStyledDefaults(staticConfig) {
@@ -6289,6 +6417,9 @@ function getStyledDefaults(staticConfig) {
6289
6417
  }
6290
6418
  return entries;
6291
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
+ };
6292
6423
  function contributeDisplacedStyledDefaults(styledDefaults, processedProps, shorthands, contribute) {
6293
6424
  if (!styledDefaults) return;
6294
6425
  for (var index = 0; index < styledDefaults.length; index++) {
@@ -6296,10 +6427,10 @@ function contributeDisplacedStyledDefaults(styledDefaults, processedProps, short
6296
6427
  var styledValue = styledDefaults[index][1];
6297
6428
  var propValue = processedProps[key];
6298
6429
  if (!(key in stylePropsAll) && !(key in shorthands)) continue;
6299
- 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);
6300
6431
  }
6301
6432
  }
6302
- function forEachPropInForwardOrder(processedProps, staticConfig, shorthands, contribute) {
6433
+ function forEachPropInForwardOrder(processedProps, staticConfig, shorthands, contribute, isChain) {
6303
6434
  var processedBaseStyle = staticConfig.baseStyle;
6304
6435
  var compoundVariants = staticConfig.compoundVariants;
6305
6436
  var styledDefaults = getStyledDefaults(staticConfig);
@@ -6319,7 +6450,8 @@ function forEachPropInForwardOrder(processedProps, staticConfig, shorthands, con
6319
6450
  try {
6320
6451
  for (var _iterator = compoundVariants[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
6321
6452
  var compoundVariant = _step.value;
6322
- if (!compoundVariantMatches(compoundVariant, processedProps)) continue;
6453
+ var chains = compoundVariantMatchChains(compoundVariant, processedProps, isChain);
6454
+ if (!chains) continue;
6323
6455
  var { style } = compoundVariant;
6324
6456
  if (!isPlainObject(style)) continue;
6325
6457
  var anchor = -1;
@@ -6331,7 +6463,36 @@ function forEachPropInForwardOrder(processedProps, staticConfig, shorthands, con
6331
6463
  }
6332
6464
  }
6333
6465
  var entries = compoundsByAnchor.get(anchor) || [];
6334
- 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
+ }
6335
6496
  compoundsByAnchor.set(anchor, entries);
6336
6497
  }
6337
6498
  } catch (err) {
@@ -6556,7 +6717,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
6556
6717
  if (conditionSource !== void 0) {
6557
6718
  if (isHostStyleKey || isContextProgramKey) contributeVariantClauseValue(styleState, key8, val2, conditionSource, mergeStyle, originalVal, !isHostStyleKey);
6558
6719
  else if (isHOC) {
6559
- var appended = appendFlatClause(viewProps[key8], conditionSource, val2);
6720
+ var appended = appendFlatClause(styleState, viewProps[key8], conditionSource, val2);
6560
6721
  if (appended !== void 0) viewProps[key8] = appended;
6561
6722
  }
6562
6723
  return;
@@ -6581,7 +6742,9 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
6581
6742
  }
6582
6743
  });
6583
6744
  };
6584
- forEachPropInForwardOrder(processedProps, staticConfig, shorthands, contributeProp);
6745
+ forEachPropInForwardOrder(processedProps, staticConfig, shorthands, contributeProp, function(chain) {
6746
+ return !!resolveClauseChain(styleState, chain, 0, chain.length);
6747
+ });
6585
6748
  var conditionalStates = styleState.flatStateKeys || null;
6586
6749
  var usesSafeArea = !!styleState.flatUsesSafeArea;
6587
6750
  if ((_styleState_flatMediaKeys = styleState.flatMediaKeys) === null || _styleState_flatMediaKeys === void 0 ? void 0 : _styleState_flatMediaKeys.size) {
@@ -7205,7 +7368,7 @@ var lifecycleHandler = {
7205
7368
  return true;
7206
7369
  }
7207
7370
  };
7208
- function hasFlatModifier(props, config, modifiers, ctx) {
7371
+ function hasFlatModifier(props, config, modifiers, ctx, variants) {
7209
7372
  var _ctx;
7210
7373
  var scan = (_ctx = ctx).flatScan || (_ctx.flatScan = [
7211
7374
  "",
@@ -7218,7 +7381,7 @@ function hasFlatModifier(props, config, modifiers, ctx) {
7218
7381
  var isString = typeof value === "string";
7219
7382
  if (isString ? value.indexOf(":") === -1 : !value || (typeof value === "undefined" ? "undefined" : _type_of$6(value)) !== "object") continue;
7220
7383
  var property = config.shorthands[key] || key;
7221
- if (!(property in stylePropsAll) && property !== "transition") continue;
7384
+ if (!(property in stylePropsAll) && property !== "transition" && !(variants && key in variants)) continue;
7222
7385
  if (!isString) {
7223
7386
  if (property === "transition") continue;
7224
7387
  for (var chain in value) {
@@ -7260,7 +7423,7 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
7260
7423
  var outputStyle = (_animationDriver_outputStyle = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.outputStyle) !== null && _animationDriver_outputStyle !== void 0 ? _animationDriver_outputStyle : "css";
7261
7424
  var curStateRef = stateRef.current;
7262
7425
  if (!needsHydration && hasAnimationProp) curStateRef.hasAnimated = true;
7263
- 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));
7264
7427
  var willBeAnimatedClient = (function() {
7265
7428
  return Boolean(!!((hasAnimationProp || platformPseudo) && !isHOC && useAnimations) || curStateRef.hasAnimated);
7266
7429
  })();
@@ -7271,7 +7434,7 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
7271
7434
  var presenceState = presence === null || presence === void 0 ? void 0 : presence[2];
7272
7435
  var isExiting = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === false;
7273
7436
  var isEntering = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === true && presenceState.initial !== false;
7274
- var hasEnterStyle = hasFlatModifier(props, config, enterModifier, curStateRef);
7437
+ var hasEnterStyle = hasFlatModifier(props, config, enterModifier, curStateRef, staticConfig.variants);
7275
7438
  var hasAnimationThatNeedsHydrate = hasAnimationProp && !isHydrated && ((animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isReactNative) || inputStyle !== "css");
7276
7439
  var initialState = !isHOC && (hasEnterStyle || isEntering || hasAnimationThatNeedsHydrate || disableClassName) ? hasEnterStyle || isEntering ? defaultComponentStateShouldEnter : defaultComponentState : defaultComponentStateMounted;
7277
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.748.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.748.1",
131
- "@tamagui/constants": "3.0.0-beta.748.1",
132
- "@tamagui/helpers": "3.0.0-beta.748.1",
133
- "@tamagui/react-native-media-driver": "3.0.0-beta.748.1",
134
- "@tamagui/react-native-use-pressable": "3.0.0-beta.748.1",
135
- "@tamagui/size": "3.0.0-beta.748.1",
136
- "@tamagui/use-element-layout": "3.0.0-beta.748.1",
137
- "@tamagui/use-event": "3.0.0-beta.748.1",
138
- "@tamagui/web": "3.0.0-beta.748.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.748.1",
142
- "@tamagui/native-bundle": "3.0.0-beta.748.1",
143
- "@tamagui/react-native-web-lite": "3.0.0-beta.748.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",