@tamagui/core 3.0.0-beta.1598.1 → 3.0.0-beta.1648.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
@@ -12660,6 +12660,27 @@ function extractValueFromDynamic(val, scheme) {
12660
12660
  //#region ../web/dist/esm/helpers/themeUpdateState.native.js
12661
12661
  var themeUpdateStateKey = "_tmgInlineLayer";
12662
12662
  //#endregion
12663
+ //#region ../web/dist/esm/helpers/themes.native.js
12664
+ var schemeKey = /* @__PURE__ */ Symbol.for("tamagui.theme.scheme");
12665
+ function getAuthoredThemeScheme(theme) {
12666
+ var scheme = theme[schemeKey];
12667
+ return scheme === "light" || scheme === "dark" ? scheme : void 0;
12668
+ }
12669
+ function copyAuthoredThemeScheme(target, source) {
12670
+ var scheme = getAuthoredThemeScheme(source);
12671
+ if (scheme) Object.defineProperty(target, schemeKey, { value: scheme });
12672
+ return target;
12673
+ }
12674
+ function ensureThemeVariable(theme, key) {
12675
+ var val = theme[key];
12676
+ var variable = isVariable(val);
12677
+ if (!variable || val.name !== key) theme[key] = createVariable({
12678
+ key: variable ? val.name : key,
12679
+ name: key,
12680
+ val: variable ? val.val : val
12681
+ });
12682
+ }
12683
+ //#endregion
12663
12684
  //#region ../web/dist/esm/hooks/useThemeState.native.js
12664
12685
  var ThemeStateContext = (0, react.createContext)("");
12665
12686
  var allListeners = /* @__PURE__ */ new Map();
@@ -12716,6 +12737,7 @@ var incReducer = function(c) {
12716
12737
  var useThemeState = function(props) {
12717
12738
  "use no memo";
12718
12739
  var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false, keys = arguments.length > 2 ? arguments[2] : void 0, schemeKeys = arguments.length > 3 ? arguments[3] : void 0, cascadeOnChange = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false, optimizeForFirstRender = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : false;
12740
+ var _props__themeUpdate;
12719
12741
  var _ref;
12720
12742
  var { disable } = props;
12721
12743
  var parentId = (0, react.useContext)(ThemeStateContext);
@@ -12726,16 +12748,10 @@ var useThemeState = function(props) {
12726
12748
  theme: getConfig().themes.light
12727
12749
  };
12728
12750
  var id = (0, react.useId)();
12729
- var propsKey = getPropsKey(props);
12751
+ var propsKey = `${props.name || ""}${props.forceClassName || ""}${((_props__themeUpdate = props._themeUpdate) === null || _props__themeUpdate === void 0 ? void 0 : _props__themeUpdate.key) || ""}`;
12730
12752
  if (cascadeOnChange) registerThemeProviderChain(id, parentId, props);
12731
12753
  var r = (_ref = (0, react.useRef)(null)).current || (_ref.current = {
12732
12754
  id,
12733
- parentId,
12734
- props,
12735
- propsKey,
12736
- isRoot,
12737
- keys,
12738
- schemeKeys,
12739
12755
  optimizeForFirstRender,
12740
12756
  renderVersion: 0
12741
12757
  });
@@ -12756,7 +12772,10 @@ var useThemeState = function(props) {
12756
12772
  r.state = r.lastSnap;
12757
12773
  }
12758
12774
  if (cascadeOnChange && !themeProviderParents.has(r.id)) registerThemeProviderChain(r.id, r.parentId, r.props);
12759
- if (r.unsubscribe && r.subscribedTo !== r.parentId) cleanupThemeSubscription(r);
12775
+ if (r.unsubscribe && r.subscribedTo !== r.parentId) {
12776
+ var _r_unsubscribe;
12777
+ (_r_unsubscribe = r.unsubscribe) === null || _r_unsubscribe === void 0 || _r_unsubscribe.call(r);
12778
+ }
12760
12779
  if (shouldSubscribeToTheme(r, cascadeOnChange)) {
12761
12780
  if (!r.unsubscribe) {
12762
12781
  var _listenersByParent, _pid;
@@ -12789,7 +12808,10 @@ var useThemeState = function(props) {
12789
12808
  r.subscribedTo = void 0;
12790
12809
  };
12791
12810
  }
12792
- } else if (r.unsubscribe) cleanupThemeSubscription(r);
12811
+ } else if (r.unsubscribe) {
12812
+ var _r_unsubscribe1;
12813
+ (_r_unsubscribe1 = r.unsubscribe) === null || _r_unsubscribe1 === void 0 || _r_unsubscribe1.call(r);
12814
+ }
12793
12815
  return function() {
12794
12816
  if (r.renderVersion === renderVersion) cleanupThemeState(r);
12795
12817
  };
@@ -12813,12 +12835,8 @@ var shouldSubscribeToTheme = function(r, cascadeOnChange) {
12813
12835
  var _r_keys_current, _r_props_needsUpdate, _r_props;
12814
12836
  return Boolean(r.optimizeForFirstRender || r.isRoot || cascadeOnChange || hasThemeUpdatingProps(r.props) || ((_r_keys_current = r.keys.current) === null || _r_keys_current === void 0 ? void 0 : _r_keys_current.size) || ((_r_props_needsUpdate = (_r_props = r.props).needsUpdate) === null || _r_props_needsUpdate === void 0 ? void 0 : _r_props_needsUpdate.call(_r_props)));
12815
12837
  };
12816
- function cleanupThemeSubscription(r) {
12817
- var _r_unsubscribe;
12818
- (_r_unsubscribe = r.unsubscribe) === null || _r_unsubscribe === void 0 || _r_unsubscribe.call(r);
12819
- }
12820
12838
  function cleanupThemeState(r) {
12821
- if (r.unsubscribe) cleanupThemeSubscription(r);
12839
+ if (r.unsubscribe) r.unsubscribe();
12822
12840
  else {
12823
12841
  r.state = void 0;
12824
12842
  states.delete(r.id);
@@ -12829,15 +12847,15 @@ function cleanupThemeState(r) {
12829
12847
  }
12830
12848
  var getSnapshotImpl = function(r) {
12831
12849
  var _keys_current, _schemeKeys_current, _keys_current1, _props_needsUpdate;
12832
- var { id, parentId, props, propsKey, isRoot, keys, schemeKeys, optimizeForFirstRender } = r;
12850
+ var { id, parentId, props, propsKey, isRoot, keys, optimizeForFirstRender } = r;
12851
+ var schemeKeys = r.schemeKeys;
12833
12852
  var local = r.state;
12834
12853
  var parentState = states.get(parentId);
12835
12854
  if (local && !PendingUpdate.has(id)) {
12836
12855
  if (parentState && local._parentName === parentState.name && local._parentSchemeAuthored === parentState.schemeAuthored && local._propsKey === propsKey) return local;
12837
12856
  }
12838
12857
  var isSchemeOnlyChange = !optimizeForFirstRender && supportsDynamicColorIOS && getSetting("fastSchemeChange") && local && parentState && local.scheme !== parentState.scheme && getThemeBaseName(local.name) === getThemeBaseName(parentState.name);
12839
- var allKeysSchemeOptimized = !optimizeForFirstRender && Boolean(((_keys_current = keys.current) === null || _keys_current === void 0 ? void 0 : _keys_current.size) && (schemeKeys === null || schemeKeys === void 0 ? void 0 : (_schemeKeys_current = schemeKeys.current) === null || _schemeKeys_current === void 0 ? void 0 : _schemeKeys_current.size) === keys.current.size);
12840
- var canSkipForSchemeChange = Boolean(isSchemeOnlyChange && allKeysSchemeOptimized);
12858
+ var canSkipForSchemeChange = Boolean(isSchemeOnlyChange && ((_keys_current = keys.current) === null || _keys_current === void 0 ? void 0 : _keys_current.size) && (schemeKeys === null || schemeKeys === void 0 ? void 0 : (_schemeKeys_current = schemeKeys.current) === null || _schemeKeys_current === void 0 ? void 0 : _schemeKeys_current.size) === keys.current.size);
12841
12859
  var needsUpdate = props.passThrough ? false : optimizeForFirstRender ? true : isRoot || props.forceClassName || props.name === "light" || props.name === "dark" || props.name === null ? true : !HasRenderedOnce.get(keys) ? true : canSkipForSchemeChange ? false : (keys === null || keys === void 0 ? void 0 : (_keys_current1 = keys.current) === null || _keys_current1 === void 0 ? void 0 : _keys_current1.size) ? true : (_props_needsUpdate = props.needsUpdate) === null || _props_needsUpdate === void 0 ? void 0 : _props_needsUpdate.call(props);
12842
12860
  var [rerender, nextRaw] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));
12843
12861
  var next = nextRaw;
@@ -12890,7 +12908,7 @@ var getNextState = function(lastState, props, propsKey) {
12890
12908
  if (shouldRerender) return [true, _objectSpread2({}, parentState || lastState || next)];
12891
12909
  return [false, next];
12892
12910
  }
12893
- var scheme = getThemeScheme(resolvedName);
12911
+ var scheme = getAuthoredThemeScheme(themes[resolvedName]) || getThemeScheme(resolvedName);
12894
12912
  var _parentState_inverses;
12895
12913
  var parentInverses = (_parentState_inverses = parentState === null || parentState === void 0 ? void 0 : parentState.inverses) !== null && _parentState_inverses !== void 0 ? _parentState_inverses : 0;
12896
12914
  var isInverse = Boolean(parentState && scheme !== parentState.scheme);
@@ -12977,10 +12995,6 @@ function resolveThemeName(parentName, name, themes2) {
12977
12995
  if (!forceUpdate && found === parentName && found !== "light" && found !== "dark") return null;
12978
12996
  return found;
12979
12997
  }
12980
- var getPropsKey = function(param) {
12981
- var { name, forceClassName, _themeUpdate } = param;
12982
- return `${name || ""}${forceClassName || ""}${(_themeUpdate === null || _themeUpdate === void 0 ? void 0 : _themeUpdate.key) || ""}`;
12983
- };
12984
12998
  var hasThemeUpdatingProps = function(props) {
12985
12999
  return "name" in props || "forceClassName" in props || "_themeUpdate" in props;
12986
13000
  };
@@ -15063,7 +15077,6 @@ function contributeProp(pass, keyOg, valOg) {
15063
15077
  var shouldCheckSkipProps = !noSkip;
15064
15078
  var asChildExceptStyleLike = Boolean(flags & passAsChildStyleFlag);
15065
15079
  var isTextOrInput = isText || isInput;
15066
- var hocParentVariants = isHOC ? parentVariants : void 0;
15067
15080
  var keyInit = keyOg;
15068
15081
  var valInit = valOg;
15069
15082
  if (keyInit === "children") {
@@ -15264,9 +15277,8 @@ function contributeProp(pass, keyOg, valOg) {
15264
15277
  var isVariant = !isValidStyleKeyInit && variants && keyInit in variants;
15265
15278
  var isStyleProp = isValidStyleKeyInit || isVariant && !noExpand;
15266
15279
  if (isStyleProp && asChildExceptStyleLike) return;
15267
- var shouldPassProp = !isStyleProp && isHOC || hocParentVariants && keyInit in hocParentVariants || (inlineProps === null || inlineProps === void 0 ? void 0 : inlineProps.has(keyInit));
15268
- var parentVariant = parentVariants === null || parentVariants === void 0 ? void 0 : parentVariants[keyInit];
15269
- var isHOCShouldPassThrough = Boolean(isHOC && (parentVariant || keyInit in skipProps));
15280
+ var shouldPassProp = !isStyleProp && isHOC || parentVariants && keyInit in parentVariants || (inlineProps === null || inlineProps === void 0 ? void 0 : inlineProps.has(keyInit));
15281
+ var isHOCShouldPassThrough = isHOC && keyInit in skipProps;
15270
15282
  if (shouldPassProp || isHOCShouldPassThrough) {
15271
15283
  if (keyInit in viewProps) delete viewProps[keyInit];
15272
15284
  viewProps[keyInit] = valInit;
@@ -15322,7 +15334,7 @@ function contributeProp(pass, keyOg, valOg) {
15322
15334
  viewProps[keyInit] = valInit;
15323
15335
  }
15324
15336
  var getSplitStyles = function(props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, componentContext, groupContext, elementType, startedUnhydrated, debug, animationDriver, styleStaticConfig) {
15325
- var _styleState_flatMediaKeys, _styleState_flatGroupKeys, _styleState_flatGroupMedia, _styleState_flatGroupKeys1, _styleState_flatGroupMedia1, _styleState_style;
15337
+ var _staticConfig_Component_staticConfig, _staticConfig_Component, _styleState_flatMediaKeys, _styleState_flatGroupKeys, _styleState_flatGroupMedia, _styleState_flatGroupKeys1, _styleState_flatGroupMedia1, _styleState_style;
15326
15338
  var conf = getConfig();
15327
15339
  styleStaticConfig || (styleStaticConfig = getStyleStaticConfig(staticConfig, conf));
15328
15340
  var driver = animationDriver || (componentContext === null || componentContext === void 0 ? void 0 : componentContext.animationDriver) || conf.animations;
@@ -15381,7 +15393,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
15381
15393
  var frontendContainer;
15382
15394
  var frontendContainerType;
15383
15395
  var processedProps = props;
15384
- var parentVariants = parentStaticConfig ? getStyleStaticConfig(parentStaticConfig, conf).variants : void 0;
15396
+ var parentVariants = isHOC ? (_staticConfig_Component = staticConfig.Component) === null || _staticConfig_Component === void 0 ? void 0 : (_staticConfig_Component_staticConfig = _staticConfig_Component.staticConfig) === null || _staticConfig_Component_staticConfig === void 0 ? void 0 : _staticConfig_Component_staticConfig.variants : void 0;
15385
15397
  var defaultProps = asChild ? styleStaticConfig.defaultProps : void 0;
15386
15398
  var asChildExceptStyleLike = asChild === "except-style" || asChild === "except-style-web";
15387
15399
  var containerValue;
@@ -15403,7 +15415,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
15403
15415
  styledContextKeys,
15404
15416
  (noSkip ? passNoSkipFlag : 0) | (disableExpandShorthands ? passDisableShorthandsFlag : 0) | (noExpand ? passNoExpandFlag : 0) | (noMergeStyle ? passNoMergeFlag : 0) | (isHOC ? passHocFlag : 0) | (isText ? passTextFlag : 0) | (isInput ? passInputFlag : 0) | (asChildExceptStyleLike ? passAsChildStyleFlag : 0),
15405
15417
  debug,
15406
- parentStaticConfig,
15418
+ void 0,
15407
15419
  defaultProps,
15408
15420
  driverAnimations,
15409
15421
  driverOutputStyle,
@@ -16300,7 +16312,7 @@ function emitValue(state, property, raw, cursor, originalValue, contextOnly) {
16300
16312
  }
16301
16313
  if (typeof raw === "string" && property === "background") {
16302
16314
  var parts = splitComponents(raw);
16303
- if (parts.length === 1 && !startsValueFunction(parts[0])) {
16315
+ if (parts.length === 1 && (!startsValueFunction(parts[0]) || classifyBorderComponents(parts[0]).color)) {
16304
16316
  emitResolved(state, "backgroundColor", parts[0], cursor, originalValue, contextOnly);
16305
16317
  return;
16306
16318
  }
@@ -18495,23 +18507,7 @@ function proxyThemeToParents(themeName, theme) {
18495
18507
  }
18496
18508
  }
18497
18509
  Object.assign(out, theme);
18498
- return out;
18499
- }
18500
- //#endregion
18501
- //#region ../web/dist/esm/helpers/themes.native.js
18502
- function ensureThemeVariable(theme, key) {
18503
- var val = theme[key];
18504
- var value = isVariable(val) ? val.val : val;
18505
- if (!isVariable(val)) theme[key] = createVariable({
18506
- key,
18507
- name: key,
18508
- val: value
18509
- });
18510
- else if (val.name !== key) theme[key] = createVariable({
18511
- key: val.name,
18512
- name: key,
18513
- val: value
18514
- });
18510
+ return copyAuthoredThemeScheme(out, theme);
18515
18511
  }
18516
18512
  //#endregion
18517
18513
  //#region ../web/dist/esm/helpers/variableValue.native.js
@@ -18768,7 +18764,7 @@ function createTamagui$2(configIn) {
18768
18764
  var themeConfig = (function() {
18769
18765
  var cssRuleSets = buildCSSRuleSets(createTokenCSS(tokens, shouldTokenCategoryHaveUnits), createFontCSS(fontsParsed, registerFontVariables), defaultFontToken);
18770
18766
  var themesIn = configIn.themes;
18771
- var dedupedThemes = foundThemes !== null && foundThemes !== void 0 ? foundThemes : getThemesDeduped(themesIn, tokens.color, configIn.variables, { tokensParsed });
18767
+ var dedupedThemes = foundThemes !== null && foundThemes !== void 0 ? foundThemes : getThemesDeduped(themesIn, tokensParsed, configIn.variables);
18772
18768
  return {
18773
18769
  themes: proxyThemesToParents(dedupedThemes, Object.keys(themesIn)),
18774
18770
  cssRuleSets,
@@ -18828,7 +18824,7 @@ function createTamagui$2(configIn) {
18828
18824
  initializeTamaguiConfig(config);
18829
18825
  return config;
18830
18826
  }
18831
- function getThemesDeduped(themes, colorTokens, variables, variablesCtx) {
18827
+ function getThemesDeduped(themes, tokensParsed, variables) {
18832
18828
  var dedupedThemes = [];
18833
18829
  var existing = /* @__PURE__ */ new Map();
18834
18830
  var sortedThemeNames = Object.keys(themes).sort(function(a, b) {
@@ -18840,14 +18836,17 @@ function getThemesDeduped(themes, colorTokens, variables, variablesCtx) {
18840
18836
  for (var _iterator = sortedThemeNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
18841
18837
  var themeName = _step.value;
18842
18838
  var rawTheme = themes[themeName];
18843
- var key = JSON.stringify(rawTheme);
18844
- if (existing.has(key)) {
18845
- existing.get(key).names.push(themeName);
18839
+ var scheme = getAuthoredThemeScheme(rawTheme);
18840
+ var key = JSON.stringify(rawTheme) + scheme;
18841
+ var e = existing.get(key);
18842
+ if (e) {
18843
+ e.names.push(themeName);
18846
18844
  continue;
18847
18845
  }
18848
- var theme = _objectSpread2(_objectSpread2({}, colorTokens), rawTheme);
18846
+ var theme = _objectSpread2(_objectSpread2({}, tokensParsed.color), rawTheme);
18849
18847
  for (var key1 in theme) ensureThemeVariable(theme, key1);
18850
- if (variables && variablesCtx && !themeName.includes("_")) mergeConfigVariablesIntoTheme(theme, themeName, variables, variablesCtx.tokensParsed);
18848
+ copyAuthoredThemeScheme(theme, rawTheme);
18849
+ if (variables && !themeName.includes("_")) mergeConfigVariablesIntoTheme(theme, themeName, variables, tokensParsed);
18851
18850
  var deduped = {
18852
18851
  names: [themeName],
18853
18852
  theme
@@ -2907,6 +2907,27 @@ function extractValueFromDynamic(val, scheme) {
2907
2907
  //#region ../web/dist/esm/helpers/themeUpdateState.native.js
2908
2908
  var themeUpdateStateKey = "_tmgInlineLayer";
2909
2909
  //#endregion
2910
+ //#region ../web/dist/esm/helpers/themes.native.js
2911
+ var schemeKey = /* @__PURE__ */ Symbol.for("tamagui.theme.scheme");
2912
+ function getAuthoredThemeScheme(theme) {
2913
+ var scheme = theme[schemeKey];
2914
+ return scheme === "light" || scheme === "dark" ? scheme : void 0;
2915
+ }
2916
+ function copyAuthoredThemeScheme(target, source) {
2917
+ var scheme = getAuthoredThemeScheme(source);
2918
+ if (scheme) Object.defineProperty(target, schemeKey, { value: scheme });
2919
+ return target;
2920
+ }
2921
+ function ensureThemeVariable(theme, key) {
2922
+ var val = theme[key];
2923
+ var variable = isVariable(val);
2924
+ if (!variable || val.name !== key) theme[key] = createVariable({
2925
+ key: variable ? val.name : key,
2926
+ name: key,
2927
+ val: variable ? val.val : val
2928
+ });
2929
+ }
2930
+ //#endregion
2910
2931
  //#region ../web/dist/esm/hooks/useThemeState.native.js
2911
2932
  var ThemeStateContext = (0, react.createContext)("");
2912
2933
  var allListeners = /* @__PURE__ */ new Map();
@@ -2963,6 +2984,7 @@ var incReducer = function(c) {
2963
2984
  var useThemeState = function(props) {
2964
2985
  "use no memo";
2965
2986
  var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false, keys = arguments.length > 2 ? arguments[2] : void 0, schemeKeys = arguments.length > 3 ? arguments[3] : void 0, cascadeOnChange = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false, optimizeForFirstRender = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : false;
2987
+ var _props__themeUpdate;
2966
2988
  var _ref;
2967
2989
  var { disable } = props;
2968
2990
  var parentId = (0, react.useContext)(ThemeStateContext);
@@ -2975,16 +2997,10 @@ Looked for theme${props.name ? ` "${props.name}"` : ""}, but no parent theme con
2975
2997
  theme: getConfig().themes.light
2976
2998
  };
2977
2999
  var id = (0, react.useId)();
2978
- var propsKey = getPropsKey(props);
3000
+ var propsKey = `${props.name || ""}${props.forceClassName || ""}${((_props__themeUpdate = props._themeUpdate) === null || _props__themeUpdate === void 0 ? void 0 : _props__themeUpdate.key) || ""}`;
2979
3001
  if (cascadeOnChange) registerThemeProviderChain(id, parentId, props);
2980
3002
  var r = (_ref = (0, react.useRef)(null)).current || (_ref.current = {
2981
3003
  id,
2982
- parentId,
2983
- props,
2984
- propsKey,
2985
- isRoot,
2986
- keys,
2987
- schemeKeys,
2988
3004
  optimizeForFirstRender,
2989
3005
  renderVersion: 0
2990
3006
  });
@@ -3005,7 +3021,10 @@ Looked for theme${props.name ? ` "${props.name}"` : ""}, but no parent theme con
3005
3021
  r.state = r.lastSnap;
3006
3022
  }
3007
3023
  if (cascadeOnChange && !themeProviderParents.has(r.id)) registerThemeProviderChain(r.id, r.parentId, r.props);
3008
- if (r.unsubscribe && r.subscribedTo !== r.parentId) cleanupThemeSubscription(r);
3024
+ if (r.unsubscribe && r.subscribedTo !== r.parentId) {
3025
+ var _r_unsubscribe;
3026
+ (_r_unsubscribe = r.unsubscribe) === null || _r_unsubscribe === void 0 || _r_unsubscribe.call(r);
3027
+ }
3009
3028
  if (shouldSubscribeToTheme(r, cascadeOnChange)) {
3010
3029
  if (!r.unsubscribe) {
3011
3030
  var _listenersByParent, _pid;
@@ -3038,7 +3057,10 @@ Looked for theme${props.name ? ` "${props.name}"` : ""}, but no parent theme con
3038
3057
  r.subscribedTo = void 0;
3039
3058
  };
3040
3059
  }
3041
- } else if (r.unsubscribe) cleanupThemeSubscription(r);
3060
+ } else if (r.unsubscribe) {
3061
+ var _r_unsubscribe1;
3062
+ (_r_unsubscribe1 = r.unsubscribe) === null || _r_unsubscribe1 === void 0 || _r_unsubscribe1.call(r);
3063
+ }
3042
3064
  return function() {
3043
3065
  if (r.renderVersion === renderVersion) cleanupThemeState(r);
3044
3066
  };
@@ -3062,12 +3084,8 @@ var shouldSubscribeToTheme = function(r, cascadeOnChange) {
3062
3084
  var _r_keys_current, _r_props_needsUpdate, _r_props;
3063
3085
  return Boolean(r.optimizeForFirstRender || r.isRoot || cascadeOnChange || hasThemeUpdatingProps(r.props) || ((_r_keys_current = r.keys.current) === null || _r_keys_current === void 0 ? void 0 : _r_keys_current.size) || ((_r_props_needsUpdate = (_r_props = r.props).needsUpdate) === null || _r_props_needsUpdate === void 0 ? void 0 : _r_props_needsUpdate.call(_r_props)));
3064
3086
  };
3065
- function cleanupThemeSubscription(r) {
3066
- var _r_unsubscribe;
3067
- (_r_unsubscribe = r.unsubscribe) === null || _r_unsubscribe === void 0 || _r_unsubscribe.call(r);
3068
- }
3069
3087
  function cleanupThemeState(r) {
3070
- if (r.unsubscribe) cleanupThemeSubscription(r);
3088
+ if (r.unsubscribe) r.unsubscribe();
3071
3089
  else {
3072
3090
  r.state = void 0;
3073
3091
  states.delete(r.id);
@@ -3078,15 +3096,15 @@ function cleanupThemeState(r) {
3078
3096
  }
3079
3097
  var getSnapshotImpl = function(r) {
3080
3098
  var _keys_current, _schemeKeys_current, _keys_current1, _props_needsUpdate;
3081
- var { id, parentId, props, propsKey, isRoot, keys, schemeKeys, optimizeForFirstRender } = r;
3099
+ var { id, parentId, props, propsKey, isRoot, keys, optimizeForFirstRender } = r;
3100
+ var schemeKeys = r.schemeKeys;
3082
3101
  var local = r.state;
3083
3102
  var parentState = states.get(parentId);
3084
3103
  if (local && !PendingUpdate.has(id)) {
3085
3104
  if (parentState && local._parentName === parentState.name && local._parentSchemeAuthored === parentState.schemeAuthored && local._propsKey === propsKey) return local;
3086
3105
  }
3087
3106
  var isSchemeOnlyChange = !optimizeForFirstRender && supportsDynamicColorIOS && getSetting("fastSchemeChange") && local && parentState && local.scheme !== parentState.scheme && getThemeBaseName(local.name) === getThemeBaseName(parentState.name);
3088
- var allKeysSchemeOptimized = !optimizeForFirstRender && Boolean(((_keys_current = keys.current) === null || _keys_current === void 0 ? void 0 : _keys_current.size) && (schemeKeys === null || schemeKeys === void 0 ? void 0 : (_schemeKeys_current = schemeKeys.current) === null || _schemeKeys_current === void 0 ? void 0 : _schemeKeys_current.size) === keys.current.size);
3089
- var canSkipForSchemeChange = Boolean(isSchemeOnlyChange && allKeysSchemeOptimized);
3107
+ var canSkipForSchemeChange = Boolean(isSchemeOnlyChange && ((_keys_current = keys.current) === null || _keys_current === void 0 ? void 0 : _keys_current.size) && (schemeKeys === null || schemeKeys === void 0 ? void 0 : (_schemeKeys_current = schemeKeys.current) === null || _schemeKeys_current === void 0 ? void 0 : _schemeKeys_current.size) === keys.current.size);
3090
3108
  var needsUpdate = props.passThrough ? false : optimizeForFirstRender ? true : isRoot || props.forceClassName || props.name === "light" || props.name === "dark" || props.name === null ? true : !HasRenderedOnce.get(keys) ? true : canSkipForSchemeChange ? false : (keys === null || keys === void 0 ? void 0 : (_keys_current1 = keys.current) === null || _keys_current1 === void 0 ? void 0 : _keys_current1.size) ? true : (_props_needsUpdate = props.needsUpdate) === null || _props_needsUpdate === void 0 ? void 0 : _props_needsUpdate.call(props);
3091
3109
  var [rerender, nextRaw] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));
3092
3110
  var next = nextRaw;
@@ -3139,7 +3157,7 @@ var getNextState = function(lastState, props, propsKey) {
3139
3157
  if (shouldRerender) return [true, _objectSpread2({}, parentState || lastState || next)];
3140
3158
  return [false, next];
3141
3159
  }
3142
- var scheme = getThemeScheme(resolvedName);
3160
+ var scheme = getAuthoredThemeScheme(themes[resolvedName]) || getThemeScheme(resolvedName);
3143
3161
  var _parentState_inverses;
3144
3162
  var parentInverses = (_parentState_inverses = parentState === null || parentState === void 0 ? void 0 : parentState.inverses) !== null && _parentState_inverses !== void 0 ? _parentState_inverses : 0;
3145
3163
  var isInverse = Boolean(parentState && scheme !== parentState.scheme);
@@ -3226,10 +3244,6 @@ function resolveThemeName(parentName, name, themes2) {
3226
3244
  if (!forceUpdate && found === parentName && found !== "light" && found !== "dark") return null;
3227
3245
  return found;
3228
3246
  }
3229
- var getPropsKey = function(param) {
3230
- var { name, forceClassName, _themeUpdate } = param;
3231
- return `${name || ""}${forceClassName || ""}${(_themeUpdate === null || _themeUpdate === void 0 ? void 0 : _themeUpdate.key) || ""}`;
3232
- };
3233
3247
  var hasThemeUpdatingProps = function(props) {
3234
3248
  return "name" in props || "forceClassName" in props || "_themeUpdate" in props;
3235
3249
  };
@@ -5767,7 +5781,6 @@ function contributeProp(pass, keyOg, valOg) {
5767
5781
  var shouldCheckSkipProps = !noSkip;
5768
5782
  var asChildExceptStyleLike = Boolean(flags & passAsChildStyleFlag);
5769
5783
  var isTextOrInput = isText || isInput;
5770
- var hocParentVariants = isHOC ? parentVariants : void 0;
5771
5784
  var keyInit = keyOg;
5772
5785
  var valInit = valOg;
5773
5786
  if (keyInit === "children") {
@@ -5989,9 +6002,8 @@ function contributeProp(pass, keyOg, valOg) {
5989
6002
  var isVariant = !isValidStyleKeyInit && variants && keyInit in variants;
5990
6003
  var isStyleProp = isValidStyleKeyInit || isVariant && !noExpand;
5991
6004
  if (isStyleProp && asChildExceptStyleLike) return;
5992
- var shouldPassProp = !isStyleProp && isHOC || hocParentVariants && keyInit in hocParentVariants || (inlineProps === null || inlineProps === void 0 ? void 0 : inlineProps.has(keyInit));
5993
- var parentVariant = parentVariants === null || parentVariants === void 0 ? void 0 : parentVariants[keyInit];
5994
- var isHOCShouldPassThrough = Boolean(isHOC && (parentVariant || keyInit in skipProps));
6005
+ var shouldPassProp = !isStyleProp && isHOC || parentVariants && keyInit in parentVariants || (inlineProps === null || inlineProps === void 0 ? void 0 : inlineProps.has(keyInit));
6006
+ var isHOCShouldPassThrough = isHOC && keyInit in skipProps;
5995
6007
  var shouldPassThrough = shouldPassProp || isHOCShouldPassThrough;
5996
6008
  if (globalThis.process.env.NODE_ENV === "development" && debug === "verbose") {
5997
6009
  console.groupCollapsed(` \u{1F511} ${keyOg}${keyInit !== keyOg ? ` (shorthand for ${keyInit})` : ""} ${shouldPassThrough ? "(pass)" : ""}`);
@@ -6079,7 +6091,7 @@ function contributeProp(pass, keyOg, valOg) {
6079
6091
  }
6080
6092
  }
6081
6093
  var getSplitStyles = function(props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, componentContext, groupContext, elementType, startedUnhydrated, debug, animationDriver, styleStaticConfig) {
6082
- var _styleState_flatMediaKeys, _styleState_flatGroupKeys, _styleState_flatGroupMedia, _styleState_flatGroupKeys1, _styleState_flatGroupMedia1, _styleState_style;
6094
+ var _staticConfig_Component_staticConfig, _staticConfig_Component, _styleState_flatMediaKeys, _styleState_flatGroupKeys, _styleState_flatGroupMedia, _styleState_flatGroupKeys1, _styleState_flatGroupMedia1, _styleState_style;
6083
6095
  var conf = getConfig();
6084
6096
  styleStaticConfig || (styleStaticConfig = getStyleStaticConfig(staticConfig, conf));
6085
6097
  var driver = animationDriver || (componentContext === null || componentContext === void 0 ? void 0 : componentContext.animationDriver) || conf.animations;
@@ -6155,7 +6167,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
6155
6167
  var frontendContainer;
6156
6168
  var frontendContainerType;
6157
6169
  var processedProps = props;
6158
- var parentVariants = parentStaticConfig ? getStyleStaticConfig(parentStaticConfig, conf).variants : void 0;
6170
+ var parentVariants = isHOC ? (_staticConfig_Component = staticConfig.Component) === null || _staticConfig_Component === void 0 ? void 0 : (_staticConfig_Component_staticConfig = _staticConfig_Component.staticConfig) === null || _staticConfig_Component_staticConfig === void 0 ? void 0 : _staticConfig_Component_staticConfig.variants : void 0;
6159
6171
  var defaultProps = asChild ? styleStaticConfig.defaultProps : void 0;
6160
6172
  var asChildExceptStyleLike = asChild === "except-style" || asChild === "except-style-web";
6161
6173
  var containerValue;
@@ -6177,7 +6189,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
6177
6189
  styledContextKeys,
6178
6190
  (noSkip ? passNoSkipFlag : 0) | (disableExpandShorthands ? passDisableShorthandsFlag : 0) | (noExpand ? passNoExpandFlag : 0) | (noMergeStyle ? passNoMergeFlag : 0) | (isHOC ? passHocFlag : 0) | (isText ? passTextFlag : 0) | (isInput ? passInputFlag : 0) | (asChildExceptStyleLike ? passAsChildStyleFlag : 0),
6179
6191
  debug,
6180
- parentStaticConfig,
6192
+ globalThis.process.env.NODE_ENV === "development" ? parentStaticConfig : void 0,
6181
6193
  defaultProps,
6182
6194
  driverAnimations,
6183
6195
  driverOutputStyle,
@@ -7193,7 +7205,7 @@ function emitValue(state, property, raw, cursor, originalValue, contextOnly) {
7193
7205
  }
7194
7206
  if (typeof raw === "string" && property === "background") {
7195
7207
  var parts = splitComponents(raw);
7196
- if (parts.length === 1 && !startsValueFunction(parts[0])) {
7208
+ if (parts.length === 1 && (!startsValueFunction(parts[0]) || classifyBorderComponents(parts[0]).color)) {
7197
7209
  emitResolved(state, "backgroundColor", parts[0], cursor, originalValue, contextOnly);
7198
7210
  return;
7199
7211
  }
@@ -9622,23 +9634,7 @@ function proxyThemeToParents(themeName, theme) {
9622
9634
  }
9623
9635
  }
9624
9636
  Object.assign(out, theme);
9625
- return out;
9626
- }
9627
- //#endregion
9628
- //#region ../web/dist/esm/helpers/themes.native.js
9629
- function ensureThemeVariable(theme, key) {
9630
- var val = theme[key];
9631
- var value = isVariable(val) ? val.val : val;
9632
- if (!isVariable(val)) theme[key] = createVariable({
9633
- key,
9634
- name: key,
9635
- val: value
9636
- });
9637
- else if (val.name !== key) theme[key] = createVariable({
9638
- key: val.name,
9639
- name: key,
9640
- val: value
9641
- });
9637
+ return copyAuthoredThemeScheme(out, theme);
9642
9638
  }
9643
9639
  //#endregion
9644
9640
  //#region ../web/dist/esm/helpers/variableValue.native.js
@@ -9994,7 +9990,7 @@ function createTamagui$2(configIn) {
9994
9990
  var themeConfig = (function() {
9995
9991
  var cssRuleSets = buildCSSRuleSets(createTokenCSS(tokens, shouldTokenCategoryHaveUnits), createFontCSS(fontsParsed, registerFontVariables), defaultFontToken);
9996
9992
  var themesIn = configIn.themes;
9997
- var dedupedThemes = foundThemes !== null && foundThemes !== void 0 ? foundThemes : getThemesDeduped(themesIn, tokens.color, configIn.variables, { tokensParsed });
9993
+ var dedupedThemes = foundThemes !== null && foundThemes !== void 0 ? foundThemes : getThemesDeduped(themesIn, tokensParsed, configIn.variables);
9998
9994
  return {
9999
9995
  themes: proxyThemesToParents(dedupedThemes, Object.keys(themesIn)),
10000
9996
  cssRuleSets,
@@ -10057,7 +10053,7 @@ function createTamagui$2(configIn) {
10057
10053
  if (!globalThis["Tamagui"]) globalThis["Tamagui"] = Tamagui;
10058
10054
  return config;
10059
10055
  }
10060
- function getThemesDeduped(themes, colorTokens, variables, variablesCtx) {
10056
+ function getThemesDeduped(themes, tokensParsed, variables) {
10061
10057
  var dedupedThemes = [];
10062
10058
  var existing = /* @__PURE__ */ new Map();
10063
10059
  var sortedThemeNames = Object.keys(themes).sort(function(a, b) {
@@ -10069,14 +10065,17 @@ function getThemesDeduped(themes, colorTokens, variables, variablesCtx) {
10069
10065
  for (var _iterator = sortedThemeNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
10070
10066
  var themeName = _step.value;
10071
10067
  var rawTheme = themes[themeName];
10072
- var key = JSON.stringify(rawTheme);
10073
- if (existing.has(key)) {
10074
- existing.get(key).names.push(themeName);
10068
+ var scheme = getAuthoredThemeScheme(rawTheme);
10069
+ var key = JSON.stringify(rawTheme) + scheme;
10070
+ var e = existing.get(key);
10071
+ if (e) {
10072
+ e.names.push(themeName);
10075
10073
  continue;
10076
10074
  }
10077
- var theme = _objectSpread2(_objectSpread2({}, colorTokens), rawTheme);
10075
+ var theme = _objectSpread2(_objectSpread2({}, tokensParsed.color), rawTheme);
10078
10076
  for (var key1 in theme) ensureThemeVariable(theme, key1);
10079
- if (variables && variablesCtx && !themeName.includes("_")) mergeConfigVariablesIntoTheme(theme, themeName, variables, variablesCtx.tokensParsed);
10077
+ copyAuthoredThemeScheme(theme, rawTheme);
10078
+ if (variables && !themeName.includes("_")) mergeConfigVariablesIntoTheme(theme, themeName, variables, tokensParsed);
10080
10079
  var deduped = {
10081
10080
  names: [themeName],
10082
10081
  theme
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/core",
3
- "version": "3.0.0-beta.1598.1",
3
+ "version": "3.0.0-beta.1648.1",
4
4
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -137,19 +137,19 @@
137
137
  "clean:build": "tamagui-build clean:build"
138
138
  },
139
139
  "dependencies": {
140
- "@tamagui/compose-refs": "3.0.0-beta.1598.1",
141
- "@tamagui/constants": "3.0.0-beta.1598.1",
142
- "@tamagui/helpers": "3.0.0-beta.1598.1",
143
- "@tamagui/react-native-media-driver": "3.0.0-beta.1598.1",
144
- "@tamagui/react-native-use-pressable": "3.0.0-beta.1598.1",
145
- "@tamagui/use-element-layout": "3.0.0-beta.1598.1",
146
- "@tamagui/use-event": "3.0.0-beta.1598.1",
147
- "@tamagui/web": "3.0.0-beta.1598.1"
140
+ "@tamagui/compose-refs": "3.0.0-beta.1648.1",
141
+ "@tamagui/constants": "3.0.0-beta.1648.1",
142
+ "@tamagui/helpers": "3.0.0-beta.1648.1",
143
+ "@tamagui/react-native-media-driver": "3.0.0-beta.1648.1",
144
+ "@tamagui/react-native-use-pressable": "3.0.0-beta.1648.1",
145
+ "@tamagui/use-element-layout": "3.0.0-beta.1648.1",
146
+ "@tamagui/use-event": "3.0.0-beta.1648.1",
147
+ "@tamagui/web": "3.0.0-beta.1648.1"
148
148
  },
149
149
  "devDependencies": {
150
- "@tamagui/build": "3.0.0-beta.1598.1",
151
- "@tamagui/native-bundle": "3.0.0-beta.1598.1",
152
- "@tamagui/react-native-web-lite": "3.0.0-beta.1598.1",
150
+ "@tamagui/build": "3.0.0-beta.1648.1",
151
+ "@tamagui/native-bundle": "3.0.0-beta.1648.1",
152
+ "@tamagui/react-native-web-lite": "3.0.0-beta.1648.1",
153
153
  "@testing-library/react": "^16.1.0",
154
154
  "csstype": "^3.0.10",
155
155
  "react": "19.2.3",
@@ -160,5 +160,5 @@
160
160
  "peerDependencies": {
161
161
  "react": ">=19"
162
162
  },
163
- "releaseSourceCommit": "cb51d68712077103855934d1cd4055921caa9b35"
163
+ "releaseSourceCommit": "302078aa9222bfff888df41f1679e1179a20b18a"
164
164
  }