@tamagui/core 2.4.5 → 2.5.0

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.
@@ -1,4 +1,4 @@
1
1
  $ tamagui-build
2
- built @tamagui/core in 691 ms
2
+ built @tamagui/core in 1368 ms
3
3
  Running afterBuild script...
4
- afterBuild completed in 226 ms
4
+ afterBuild completed in 217 ms
package/dist/native.cjs CHANGED
@@ -15324,6 +15324,25 @@ var init_sortString_native = __esmMin((() => {
15324
15324
  };
15325
15325
  }));
15326
15326
  //#endregion
15327
+ //#region ../web/dist/esm/helpers/styleProvenance.native.js
15328
+ function setStyleTokenProvenance(style, provenance) {
15329
+ Object.defineProperty(style, provenanceSymbol, {
15330
+ value: provenance,
15331
+ enumerable: false,
15332
+ configurable: true,
15333
+ writable: true
15334
+ });
15335
+ }
15336
+ function getStyleTokenProvenance(style) {
15337
+ if (!style) return void 0;
15338
+ return style[provenanceSymbol];
15339
+ }
15340
+ var STYLE_TOKEN_PROVENANCE_KEY, provenanceSymbol;
15341
+ var init_styleProvenance_native = __esmMin((() => {
15342
+ STYLE_TOKEN_PROVENANCE_KEY = "tamagui.styleTokenProvenance";
15343
+ provenanceSymbol = /* @__PURE__ */ Symbol.for(STYLE_TOKEN_PROVENANCE_KEY);
15344
+ }));
15345
+ //#endregion
15327
15346
  //#region ../web/dist/esm/helpers/transformsToString.native.js
15328
15347
  function transformsToString(transforms) {
15329
15348
  return transforms.map(function(transform) {
@@ -15398,9 +15417,16 @@ function mergeStyle(styleState, key, val, importance) {
15398
15417
  (_styleState2 = styleState).style || (_styleState2.style = {});
15399
15418
  usedKeys[key] = importance;
15400
15419
  styleState.style[key] = key === "transform" && Array.isArray(out) ? [...out] : out;
15420
+ if (shouldTrackStyleTokenProvenance) recordStyleTokenProvenance(styleState, key, originalVal);
15401
15421
  }
15402
15422
  }
15403
15423
  }
15424
+ function recordStyleTokenProvenance(styleState, key, originalVal) {
15425
+ if (typeof originalVal === "string" && originalVal[0] === "$") {
15426
+ var _styleState;
15427
+ ((_styleState = styleState).tokenProvenance || (_styleState.tokenProvenance = {}))[key] = originalVal;
15428
+ } else if (styleState.tokenProvenance && key in styleState.tokenProvenance) delete styleState.tokenProvenance[key];
15429
+ }
15404
15430
  function passDownProp(viewProps, key, val) {
15405
15431
  if (arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false) {
15406
15432
  var next = _objectSpread2(_objectSpread2({}, viewProps[key]), val);
@@ -15439,7 +15465,7 @@ function applyDefaultStyle(pkey, styleState) {
15439
15465
  var defaultValues = animatableDefaults[pkey];
15440
15466
  if (defaultValues != null && !(pkey in styleState.usedKeys) && (!styleState.style || !(pkey in styleState.style))) mergeStyle(styleState, pkey, defaultValues, 1);
15441
15467
  }
15442
- var conf, PROP_SPLIT, getSplitStyles, getSubStyle, useSplitStyles, defaultColor, animatableDefaults, mergeTransform, mapTransformKeys;
15468
+ var shouldTrackStyleTokenProvenance, conf, PROP_SPLIT, getSplitStyles, getSubStyle, useSplitStyles, defaultColor, animatableDefaults, mergeTransform, mapTransformKeys;
15443
15469
  var init_getSplitStyles_native = __esmMin((() => {
15444
15470
  init_index_native$7();
15445
15471
  init_index_native$5();
@@ -15460,8 +15486,10 @@ var init_getSplitStyles_native = __esmMin((() => {
15460
15486
  init_skipProps_native();
15461
15487
  init_sortString_native();
15462
15488
  init_styleOriginalValues_native();
15489
+ init_styleProvenance_native();
15463
15490
  init_transformsToString_native();
15464
15491
  init_objectSpread2();
15492
+ shouldTrackStyleTokenProvenance = false;
15465
15493
  PROP_SPLIT = "-";
15466
15494
  getSplitStyles = function(props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, componentContext, groupContext, elementType, startedUnhydrated, debug, animationDriver) {
15467
15495
  var _loop = function(keyOg2) {
@@ -15492,9 +15520,13 @@ var init_getSplitStyles_native = __esmMin((() => {
15492
15520
  }
15493
15521
  }
15494
15522
  if (keyInit in skipProps && !noSkip && !isHOC) {
15495
- var _driver_animations;
15496
15523
  if (keyInit === "group");
15497
- if (keyInit === "transition" && typeof valInit === "string" && !(driver === null || driver === void 0 ? void 0 : (_driver_animations = driver.animations) === null || _driver_animations === void 0 ? void 0 : _driver_animations[valInit])) {} else return "continue";
15524
+ if (keyInit === "transition" && typeof valInit === "string") {
15525
+ var _driver_animations;
15526
+ var animationConfig = driver === null || driver === void 0 ? void 0 : (_driver_animations = driver.animations) === null || _driver_animations === void 0 ? void 0 : _driver_animations[valInit];
15527
+ if (animationConfig && (driver === null || driver === void 0 ? void 0 : driver.outputStyle) === "css" && process.env.IS_STATIC === "is_static") valInit = `all ${animationConfig}`;
15528
+ else if (animationConfig) return "continue";
15529
+ } else return "continue";
15498
15530
  }
15499
15531
  var isValidStyleKeyInit = isValidStyleKey(keyInit, validStyles$1, accept);
15500
15532
  if (!isValidStyleKeyInit) {
@@ -15530,51 +15562,51 @@ var init_getSplitStyles_native = __esmMin((() => {
15530
15562
  if (valInit && (keyInit === "fontFamily" || keyInit === shorthands["fontFamily"]) && valInit in conf.fontsParsed) styleState.fontFamily = valInit;
15531
15563
  }
15532
15564
  var disablePropMap = isMediaOrPseudo || !isStyleLikeKey;
15533
- propMapper(keyInit, valInit, styleState, disablePropMap, function(key5, val2, originalVal) {
15565
+ propMapper(keyInit, valInit, styleState, disablePropMap, function(key6, val2, originalVal) {
15534
15566
  var _parentStaticConfig_variants;
15535
- var isStyledContextProp = styledContext && key5 in styledContext;
15567
+ var isStyledContextProp = styledContext && key6 in styledContext;
15536
15568
  if (!isHOC && disablePropMap && !isStyledContextProp && !isMediaOrPseudo) {
15537
- viewProps[key5] = val2;
15569
+ viewProps[key6] = val2;
15538
15570
  return;
15539
15571
  }
15540
15572
  if (val2 == null) return;
15541
- if (key5 === "pointerEvents") {
15542
- viewProps[key5] = val2;
15573
+ if (key6 === "pointerEvents") {
15574
+ viewProps[key6] = val2;
15543
15575
  return;
15544
15576
  }
15545
- if (!isHOC && isValidStyleKey(key5, validStyles$1, accept) || isAndroid && key5 === "elevation") {
15546
- mergeStyle(styleState, key5, val2, 1, false, originalVal);
15577
+ if (!isHOC && isValidStyleKey(key6, validStyles$1, accept) || isAndroid && key6 === "elevation") {
15578
+ mergeStyle(styleState, key6, val2, 1, false, originalVal);
15547
15579
  return;
15548
15580
  }
15549
- isPseudo = key5 in validPseudoKeys;
15550
- isMedia = isPseudo ? false : getMediaKey(key5);
15581
+ isPseudo = key6 in validPseudoKeys;
15582
+ isMedia = isPseudo ? false : getMediaKey(key6);
15551
15583
  isMediaOrPseudo = Boolean(isMedia || isPseudo);
15552
- isVariant = variants && key5 in variants;
15553
- if (isMedia === "group") key5 = normalizeGroupKey(key5, groupContext);
15554
- if (shouldSkipNativeHoverProp(key5, isMedia)) return;
15555
- if ((inlineProps === null || inlineProps === void 0 ? void 0 : inlineProps.has(key5)) || process.env.IS_STATIC === "is_static" && (inlineWhenUnflattened === null || inlineWhenUnflattened === void 0 ? void 0 : inlineWhenUnflattened.has(key5))) {
15584
+ isVariant = variants && key6 in variants;
15585
+ if (isMedia === "group") key6 = normalizeGroupKey(key6, groupContext);
15586
+ if (shouldSkipNativeHoverProp(key6, isMedia)) return;
15587
+ if ((inlineProps === null || inlineProps === void 0 ? void 0 : inlineProps.has(key6)) || process.env.IS_STATIC === "is_static" && (inlineWhenUnflattened === null || inlineWhenUnflattened === void 0 ? void 0 : inlineWhenUnflattened.has(key6))) {
15556
15588
  var _props_key;
15557
- viewProps[key5] = (_props_key = props[key5]) !== null && _props_key !== void 0 ? _props_key : val2;
15589
+ viewProps[key6] = (_props_key = props[key6]) !== null && _props_key !== void 0 ? _props_key : val2;
15558
15590
  }
15559
15591
  if (styleProps.noExpand && isPseudo || isHOC && (isMediaOrPseudo || (parentStaticConfig === null || parentStaticConfig === void 0 ? void 0 : (_parentStaticConfig_variants = parentStaticConfig.variants) === null || _parentStaticConfig_variants === void 0 ? void 0 : _parentStaticConfig_variants[keyInit]))) {
15560
- passDownProp(viewProps, key5, val2, isMediaOrPseudo);
15592
+ passDownProp(viewProps, key6, val2, isMediaOrPseudo);
15561
15593
  return;
15562
15594
  }
15563
15595
  if (isPseudo) {
15564
15596
  if (!val2) return;
15565
- var pseudoStyleObject = getSubStyle(styleState, key5, val2, styleProps.noClass && !(process.env.IS_STATIC === "is_static"));
15597
+ var pseudoStyleObject = getSubStyle(styleState, key6, val2, styleProps.noClass && !(process.env.IS_STATIC === "is_static"));
15566
15598
  if (!shouldDoClasses || process.env.IS_STATIC === "is_static") {
15567
15599
  var _pseudos, _key;
15568
15600
  pseudos || (pseudos = {});
15569
- (_pseudos = pseudos)[_key = key5] || (_pseudos[_key] = {});
15601
+ (_pseudos = pseudos)[_key = key6] || (_pseudos[_key] = {});
15570
15602
  if (process.env.IS_STATIC === "is_static") {
15571
- Object.assign(pseudos[key5], pseudoStyleObject);
15603
+ Object.assign(pseudos[key6], pseudoStyleObject);
15572
15604
  return;
15573
15605
  }
15574
15606
  }
15575
- var descriptor = pseudoDescriptors[key5];
15576
- var isEnter = key5 === "enterStyle";
15577
- var isExit = key5 === "exitStyle";
15607
+ var descriptor = pseudoDescriptors[key6];
15608
+ var isEnter = key6 === "enterStyle";
15609
+ var isExit = key6 === "exitStyle";
15578
15610
  if (!descriptor) return;
15579
15611
  if (shouldDoClasses && !isExit) {
15580
15612
  var pseudoStyles = getStyleAtomic(pseudoStyleObject, descriptor);
@@ -15609,34 +15641,34 @@ var init_getSplitStyles_native = __esmMin((() => {
15609
15641
  if (process.env.IS_STATIC === "is_static") {
15610
15642
  var _pseudos1, _key1;
15611
15643
  pseudos || (pseudos = {});
15612
- (_pseudos1 = pseudos)[_key1 = key5] || (_pseudos1[_key1] = {});
15613
- pseudos[key5][pkey] = _$val;
15644
+ (_pseudos1 = pseudos)[_key1 = key6] || (_pseudos1[_key1] = {});
15645
+ pseudos[key6][pkey] = _$val;
15614
15646
  }
15615
15647
  mergeStyle(styleState, pkey, _$val, importance, false, pseudoOriginalValues === null || pseudoOriginalValues === void 0 ? void 0 : pseudoOriginalValues[pkey]);
15616
15648
  }
15617
15649
  }
15618
15650
  if (!isDisabled) for (var _$key in val2) {
15619
- var k = shorthands[_$key] || _$key;
15620
- styleState.usedKeys[k] = Math.max(importance, styleState.usedKeys[k] || 0);
15651
+ var k2 = shorthands[_$key] || _$key;
15652
+ styleState.usedKeys[k2] = Math.max(importance, styleState.usedKeys[k2] || 0);
15621
15653
  }
15622
15654
  }
15623
15655
  return;
15624
15656
  }
15625
15657
  if (isMedia) {
15626
15658
  if (!val2) return;
15627
- var mediaKeyShort = key5.slice(isMedia == "theme" ? 7 : 1);
15659
+ var mediaKeyShort = key6.slice(isMedia == "theme" ? 7 : 1);
15628
15660
  hasMedia || (hasMedia = true);
15629
15661
  if (val2["space"] || !shouldDoClasses || styleProps.willBeAnimated) {
15630
15662
  if (!hasMedia || typeof hasMedia === "boolean") hasMedia = /* @__PURE__ */ new Set();
15631
15663
  hasMedia.add(mediaKeyShort);
15632
15664
  }
15633
15665
  if (isMedia === "platform") {
15634
- if (!isActivePlatform(key5)) return;
15666
+ if (!isActivePlatform(key6)) return;
15635
15667
  }
15636
15668
  var priority = mediaStylesSeen;
15637
15669
  mediaStylesSeen += 1;
15638
15670
  if (shouldDoClasses) {
15639
- var mediaStyles = getCSSStylesAtomic(getSubStyle(styleState, key5, val2, false));
15671
+ var mediaStyles = getCSSStylesAtomic(getSubStyle(styleState, key6, val2, false));
15640
15672
  var _iteratorNormalCompletion12 = true, _didIteratorError12 = false, _iteratorError12 = void 0;
15641
15673
  try {
15642
15674
  for (var _iterator12 = mediaStyles[Symbol.iterator](), _step12; !(_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done); _iteratorNormalCompletion12 = true) {
@@ -15660,14 +15692,14 @@ var init_getSplitStyles_native = __esmMin((() => {
15660
15692
  }
15661
15693
  }
15662
15694
  } else {
15663
- let mergeMediaStyle2 = function(key6, val3, originalVal2) {
15695
+ let mergeMediaStyle2 = function(key7, val3, originalVal2) {
15664
15696
  var _styleState4;
15665
- if (!isValidStyleKey(key6, validStyles$1, accept)) {
15666
- viewProps[key6] = val3;
15697
+ if (!isValidStyleKey(key7, validStyles$1, accept)) {
15698
+ viewProps[key7] = val3;
15667
15699
  return;
15668
15700
  }
15669
15701
  (_styleState4 = styleState).style || (_styleState4.style = {});
15670
- if (mergeMediaByImportance(styleState, mediaKeyShort, key6, val3, mediaState$1[mediaKeyShort], importanceBump, debug, originalVal2) && key6 === "fontFamily") styleState.fontFamily = mediaStyle1.fontFamily;
15702
+ if (mergeMediaByImportance(styleState, mediaKeyShort, key7, val3, mediaState$1[mediaKeyShort], importanceBump, debug, originalVal2) && key7 === "fontFamily") styleState.fontFamily = mediaStyle1.fontFamily;
15671
15703
  };
15672
15704
  var isThemeMedia = isMedia === "theme";
15673
15705
  var isGroupMedia = isMedia === "group";
@@ -15675,7 +15707,7 @@ var init_getSplitStyles_native = __esmMin((() => {
15675
15707
  if (!isThemeMedia && !isPlatformMedia && !isGroupMedia) {
15676
15708
  if (!mediaState$1[mediaKeyShort]) return;
15677
15709
  }
15678
- var mediaStyle1 = getSubStyle(styleState, key5, val2, true);
15710
+ var mediaStyle1 = getSubStyle(styleState, key6, val2, true);
15679
15711
  var importanceBump = 0;
15680
15712
  if (isThemeMedia) if (supportsDynamicColorIOS && getSetting("fastSchemeChange")) {
15681
15713
  var _styleState3;
@@ -15789,7 +15821,7 @@ var init_getSplitStyles_native = __esmMin((() => {
15789
15821
  }
15790
15822
  if (!isVariant) {
15791
15823
  if (isStyledContextProp) return;
15792
- viewProps[key5] = val2;
15824
+ viewProps[key6] = val2;
15793
15825
  }
15794
15826
  });
15795
15827
  };
@@ -15829,9 +15861,9 @@ var init_getSplitStyles_native = __esmMin((() => {
15829
15861
  };
15830
15862
  if (process.env.IS_STATIC === "is_static") {
15831
15863
  var { fallbackProps } = styleProps;
15832
- if (fallbackProps) styleState.props = new Proxy(props, { get(_, key5, val2) {
15833
- if (!Reflect.has(props, key5)) return Reflect.get(fallbackProps, key5);
15834
- return Reflect.get(props, key5);
15864
+ if (fallbackProps) styleState.props = new Proxy(props, { get(_, key6, val2) {
15865
+ if (!Reflect.has(props, key6)) return Reflect.get(fallbackProps, key6);
15866
+ return Reflect.get(props, key6);
15835
15867
  } });
15836
15868
  }
15837
15869
  var { asChild } = props;
@@ -15870,7 +15902,12 @@ var init_getSplitStyles_native = __esmMin((() => {
15870
15902
  else {
15871
15903
  var _styleState2;
15872
15904
  (_styleState2 = styleState).style || (_styleState2.style = {});
15873
- Object.assign(styleState.style, normalizeStyle$1(style));
15905
+ var normalized = normalizeStyle$1(style);
15906
+ Object.assign(styleState.style, normalized);
15907
+ if (shouldTrackStyleTokenProvenance) {
15908
+ var styleOriginals = styleOriginalValues.get(normalized);
15909
+ for (var k in normalized) recordStyleTokenProvenance(styleState, k, styleOriginals === null || styleOriginals === void 0 ? void 0 : styleOriginals[k]);
15910
+ }
15874
15911
  }
15875
15912
  }
15876
15913
  }
@@ -15894,6 +15931,18 @@ var init_getSplitStyles_native = __esmMin((() => {
15894
15931
  }
15895
15932
  }
15896
15933
  }
15934
+ if (shouldTrackStyleTokenProvenance && styleState.style && styleState.tokenProvenance) {
15935
+ var provenance = {};
15936
+ var hasProvenance = false;
15937
+ for (var key4 in styleState.tokenProvenance) {
15938
+ provenance[key4] = {
15939
+ token: styleState.tokenProvenance[key4],
15940
+ theme: themeName
15941
+ };
15942
+ hasProvenance = true;
15943
+ }
15944
+ if (hasProvenance) setStyleTokenProvenance(styleState.style, provenance);
15945
+ }
15897
15946
  var result = {
15898
15947
  hasMedia,
15899
15948
  fontFamily: styleState.fontFamily,
@@ -16866,7 +16915,7 @@ function createComponent(staticConfig) {
16866
16915
  setMediaShouldUpdate(componentContext, didGetVariableValue() || hasRuntimeMediaKeys || noClass && (splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.hasMedia) === true, hasRuntimeMediaKeys ? splitStyles.hasMedia : null);
16867
16916
  var { viewProps: viewPropsIn, pseudos, style: splitStylesStyle, classNames, pseudoGroups, mediaGroups } = splitStyles || {};
16868
16917
  var propsWithAnimation = props;
16869
- var _ref5 = viewPropsIn || {}, { asChild, children, themeShallow, spaceDirection: _spaceDirection, onPress, onLongPress, onPressIn, onPressOut, onHoverIn, onHoverOut, onMouseUp, onMouseDown, onMouseEnter, onMouseLeave, onFocus, onBlur, separator, passThrough, forceStyle: _forceStyle, onClick, theme: _themeProp } = _ref5, nonTamaguiProps = _objectWithoutProperties(_ref5, _excluded2$1);
16918
+ var _ref5 = viewPropsIn || {}, { asChild, children, themeShallow, spaceDirection: _spaceDirection, onPress, onLongPress, onPressIn, onPressOut, onHoverIn, onHoverOut, onMouseUp, onMouseDown, onMouseEnter, onMouseLeave, onFocus, onBlur, onDidAnimate, separator, passThrough, forceStyle: _forceStyle, onClick, theme: _themeProp } = _ref5, nonTamaguiProps = _objectWithoutProperties(_ref5, _excluded2$1);
16870
16919
  var viewProps = nonTamaguiProps;
16871
16920
  if (props.forceStyle) viewProps.forceStyle = props.forceStyle;
16872
16921
  if (isHOC) {
@@ -16896,7 +16945,8 @@ function createComponent(staticConfig) {
16896
16945
  themeName,
16897
16946
  pseudos: pseudos || null,
16898
16947
  staticConfig,
16899
- stateRef
16948
+ stateRef,
16949
+ onDidAnimate
16900
16950
  });
16901
16951
  if (animations) {
16902
16952
  if (animations.ref) animatedRef = animations.ref;
@@ -17227,6 +17277,7 @@ var init_createComponent_native = __esmMin((() => {
17227
17277
  "onMouseLeave",
17228
17278
  "onFocus",
17229
17279
  "onBlur",
17280
+ "onDidAnimate",
17230
17281
  "separator",
17231
17282
  "passThrough",
17232
17283
  "forceStyle",
@@ -19093,6 +19144,7 @@ exports.LayoutMeasurementController = LayoutMeasurementController;
19093
19144
  exports.MEDIA_SEP = MEDIA_SEP;
19094
19145
  exports.MISSING_THEME_MESSAGE = MISSING_THEME_MESSAGE;
19095
19146
  exports.PROP_SPLIT = PROP_SPLIT;
19147
+ exports.STYLE_TOKEN_PROVENANCE_KEY = STYLE_TOKEN_PROVENANCE_KEY;
19096
19148
  exports.Slot = Slot;
19097
19149
  exports.Slottable = Slottable;
19098
19150
  exports.StyleObjectIdentifier = StyleObjectIdentifier;
@@ -19152,6 +19204,7 @@ exports.getSplitStyles = getSplitStyles;
19152
19204
  exports.getStyleAtomic = getStyleAtomic;
19153
19205
  exports.getStyleCompat = getStyleCompat;
19154
19206
  exports.getStyleTags = getStyleTags;
19207
+ exports.getStyleTokenProvenance = getStyleTokenProvenance;
19155
19208
  exports.getSubStyle = getSubStyle;
19156
19209
  exports.getThemeCSSRules = getThemeCSSRules;
19157
19210
  exports.getThemedChildren = getThemedChildren;
@@ -3873,6 +3873,22 @@ var sortString = function(a, b) {
3873
3873
  return a < b ? -1 : a > b ? 1 : 0;
3874
3874
  };
3875
3875
  //#endregion
3876
+ //#region ../web/dist/esm/helpers/styleProvenance.native.js
3877
+ var STYLE_TOKEN_PROVENANCE_KEY = "tamagui.styleTokenProvenance";
3878
+ var provenanceSymbol = /* @__PURE__ */ Symbol.for(STYLE_TOKEN_PROVENANCE_KEY);
3879
+ function setStyleTokenProvenance(style, provenance) {
3880
+ Object.defineProperty(style, provenanceSymbol, {
3881
+ value: provenance,
3882
+ enumerable: false,
3883
+ configurable: true,
3884
+ writable: true
3885
+ });
3886
+ }
3887
+ function getStyleTokenProvenance(style) {
3888
+ if (!style) return void 0;
3889
+ return style[provenanceSymbol];
3890
+ }
3891
+ //#endregion
3876
3892
  //#region ../web/dist/esm/helpers/transformsToString.native.js
3877
3893
  function transformsToString(transforms) {
3878
3894
  return transforms.map(function(transform) {
@@ -3888,6 +3904,7 @@ function _type_of$3(obj) {
3888
3904
  "@swc/helpers - typeof";
3889
3905
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
3890
3906
  }
3907
+ var shouldTrackStyleTokenProvenance = false;
3891
3908
  var conf;
3892
3909
  var PROP_SPLIT = "-";
3893
3910
  function normalizeGroupKey(key, groupContext) {
@@ -3939,9 +3956,13 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
3939
3956
  }
3940
3957
  }
3941
3958
  if (keyInit in skipProps && !noSkip && !isHOC) {
3942
- var _driver_animations;
3943
3959
  if (keyInit === "group");
3944
- if (keyInit === "transition" && typeof valInit === "string" && !(driver === null || driver === void 0 ? void 0 : (_driver_animations = driver.animations) === null || _driver_animations === void 0 ? void 0 : _driver_animations[valInit])) {} else return "continue";
3960
+ if (keyInit === "transition" && typeof valInit === "string") {
3961
+ var _driver_animations;
3962
+ var animationConfig = driver === null || driver === void 0 ? void 0 : (_driver_animations = driver.animations) === null || _driver_animations === void 0 ? void 0 : _driver_animations[valInit];
3963
+ if (animationConfig && (driver === null || driver === void 0 ? void 0 : driver.outputStyle) === "css" && process.env.IS_STATIC === "is_static") valInit = `all ${animationConfig}`;
3964
+ else if (animationConfig) return "continue";
3965
+ } else return "continue";
3945
3966
  }
3946
3967
  var isValidStyleKeyInit = isValidStyleKey(keyInit, validStyles$1, accept);
3947
3968
  if (!isValidStyleKeyInit) {
@@ -3977,51 +3998,51 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
3977
3998
  if (valInit && (keyInit === "fontFamily" || keyInit === shorthands["fontFamily"]) && valInit in conf.fontsParsed) styleState.fontFamily = valInit;
3978
3999
  }
3979
4000
  var disablePropMap = isMediaOrPseudo || !isStyleLikeKey;
3980
- propMapper(keyInit, valInit, styleState, disablePropMap, function(key5, val2, originalVal) {
4001
+ propMapper(keyInit, valInit, styleState, disablePropMap, function(key6, val2, originalVal) {
3981
4002
  var _parentStaticConfig_variants;
3982
- var isStyledContextProp = styledContext && key5 in styledContext;
4003
+ var isStyledContextProp = styledContext && key6 in styledContext;
3983
4004
  if (!isHOC && disablePropMap && !isStyledContextProp && !isMediaOrPseudo) {
3984
- viewProps[key5] = val2;
4005
+ viewProps[key6] = val2;
3985
4006
  return;
3986
4007
  }
3987
4008
  if (val2 == null) return;
3988
- if (key5 === "pointerEvents") {
3989
- viewProps[key5] = val2;
4009
+ if (key6 === "pointerEvents") {
4010
+ viewProps[key6] = val2;
3990
4011
  return;
3991
4012
  }
3992
- if (!isHOC && isValidStyleKey(key5, validStyles$1, accept) || isAndroid && key5 === "elevation") {
3993
- mergeStyle(styleState, key5, val2, 1, false, originalVal);
4013
+ if (!isHOC && isValidStyleKey(key6, validStyles$1, accept) || isAndroid && key6 === "elevation") {
4014
+ mergeStyle(styleState, key6, val2, 1, false, originalVal);
3994
4015
  return;
3995
4016
  }
3996
- isPseudo = key5 in validPseudoKeys;
3997
- isMedia = isPseudo ? false : getMediaKey(key5);
4017
+ isPseudo = key6 in validPseudoKeys;
4018
+ isMedia = isPseudo ? false : getMediaKey(key6);
3998
4019
  isMediaOrPseudo = Boolean(isMedia || isPseudo);
3999
- isVariant = variants && key5 in variants;
4000
- if (isMedia === "group") key5 = normalizeGroupKey(key5, groupContext);
4001
- if (shouldSkipNativeHoverProp(key5, isMedia)) return;
4002
- if ((inlineProps === null || inlineProps === void 0 ? void 0 : inlineProps.has(key5)) || process.env.IS_STATIC === "is_static" && (inlineWhenUnflattened === null || inlineWhenUnflattened === void 0 ? void 0 : inlineWhenUnflattened.has(key5))) {
4020
+ isVariant = variants && key6 in variants;
4021
+ if (isMedia === "group") key6 = normalizeGroupKey(key6, groupContext);
4022
+ if (shouldSkipNativeHoverProp(key6, isMedia)) return;
4023
+ if ((inlineProps === null || inlineProps === void 0 ? void 0 : inlineProps.has(key6)) || process.env.IS_STATIC === "is_static" && (inlineWhenUnflattened === null || inlineWhenUnflattened === void 0 ? void 0 : inlineWhenUnflattened.has(key6))) {
4003
4024
  var _props_key;
4004
- viewProps[key5] = (_props_key = props[key5]) !== null && _props_key !== void 0 ? _props_key : val2;
4025
+ viewProps[key6] = (_props_key = props[key6]) !== null && _props_key !== void 0 ? _props_key : val2;
4005
4026
  }
4006
4027
  if (styleProps.noExpand && isPseudo || isHOC && (isMediaOrPseudo || (parentStaticConfig === null || parentStaticConfig === void 0 ? void 0 : (_parentStaticConfig_variants = parentStaticConfig.variants) === null || _parentStaticConfig_variants === void 0 ? void 0 : _parentStaticConfig_variants[keyInit]))) {
4007
- passDownProp(viewProps, key5, val2, isMediaOrPseudo);
4028
+ passDownProp(viewProps, key6, val2, isMediaOrPseudo);
4008
4029
  return;
4009
4030
  }
4010
4031
  if (isPseudo) {
4011
4032
  if (!val2) return;
4012
- var pseudoStyleObject = getSubStyle(styleState, key5, val2, styleProps.noClass && !(process.env.IS_STATIC === "is_static"));
4033
+ var pseudoStyleObject = getSubStyle(styleState, key6, val2, styleProps.noClass && !(process.env.IS_STATIC === "is_static"));
4013
4034
  if (!shouldDoClasses || process.env.IS_STATIC === "is_static") {
4014
4035
  var _pseudos, _key;
4015
4036
  pseudos || (pseudos = {});
4016
- (_pseudos = pseudos)[_key = key5] || (_pseudos[_key] = {});
4037
+ (_pseudos = pseudos)[_key = key6] || (_pseudos[_key] = {});
4017
4038
  if (process.env.IS_STATIC === "is_static") {
4018
- Object.assign(pseudos[key5], pseudoStyleObject);
4039
+ Object.assign(pseudos[key6], pseudoStyleObject);
4019
4040
  return;
4020
4041
  }
4021
4042
  }
4022
- var descriptor = pseudoDescriptors[key5];
4023
- var isEnter = key5 === "enterStyle";
4024
- var isExit = key5 === "exitStyle";
4043
+ var descriptor = pseudoDescriptors[key6];
4044
+ var isEnter = key6 === "enterStyle";
4045
+ var isExit = key6 === "exitStyle";
4025
4046
  if (!descriptor) return;
4026
4047
  if (shouldDoClasses && !isExit) {
4027
4048
  var pseudoStyles = getStyleAtomic(pseudoStyleObject, descriptor);
@@ -4056,34 +4077,34 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
4056
4077
  if (process.env.IS_STATIC === "is_static") {
4057
4078
  var _pseudos1, _key1;
4058
4079
  pseudos || (pseudos = {});
4059
- (_pseudos1 = pseudos)[_key1 = key5] || (_pseudos1[_key1] = {});
4060
- pseudos[key5][pkey] = _$val;
4080
+ (_pseudos1 = pseudos)[_key1 = key6] || (_pseudos1[_key1] = {});
4081
+ pseudos[key6][pkey] = _$val;
4061
4082
  }
4062
4083
  mergeStyle(styleState, pkey, _$val, importance, false, pseudoOriginalValues === null || pseudoOriginalValues === void 0 ? void 0 : pseudoOriginalValues[pkey]);
4063
4084
  }
4064
4085
  }
4065
4086
  if (!isDisabled) for (var _$key in val2) {
4066
- var k = shorthands[_$key] || _$key;
4067
- styleState.usedKeys[k] = Math.max(importance, styleState.usedKeys[k] || 0);
4087
+ var k2 = shorthands[_$key] || _$key;
4088
+ styleState.usedKeys[k2] = Math.max(importance, styleState.usedKeys[k2] || 0);
4068
4089
  }
4069
4090
  }
4070
4091
  return;
4071
4092
  }
4072
4093
  if (isMedia) {
4073
4094
  if (!val2) return;
4074
- var mediaKeyShort = key5.slice(isMedia == "theme" ? 7 : 1);
4095
+ var mediaKeyShort = key6.slice(isMedia == "theme" ? 7 : 1);
4075
4096
  hasMedia || (hasMedia = true);
4076
4097
  if (val2["space"] || !shouldDoClasses || styleProps.willBeAnimated) {
4077
4098
  if (!hasMedia || typeof hasMedia === "boolean") hasMedia = /* @__PURE__ */ new Set();
4078
4099
  hasMedia.add(mediaKeyShort);
4079
4100
  }
4080
4101
  if (isMedia === "platform") {
4081
- if (!isActivePlatform(key5)) return;
4102
+ if (!isActivePlatform(key6)) return;
4082
4103
  }
4083
4104
  var priority = mediaStylesSeen;
4084
4105
  mediaStylesSeen += 1;
4085
4106
  if (shouldDoClasses) {
4086
- var mediaStyles = getCSSStylesAtomic(getSubStyle(styleState, key5, val2, false));
4107
+ var mediaStyles = getCSSStylesAtomic(getSubStyle(styleState, key6, val2, false));
4087
4108
  var _iteratorNormalCompletion12 = true, _didIteratorError12 = false, _iteratorError12 = void 0;
4088
4109
  try {
4089
4110
  for (var _iterator12 = mediaStyles[Symbol.iterator](), _step12; !(_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done); _iteratorNormalCompletion12 = true) {
@@ -4107,14 +4128,14 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
4107
4128
  }
4108
4129
  }
4109
4130
  } else {
4110
- let mergeMediaStyle2 = function(key6, val3, originalVal2) {
4131
+ let mergeMediaStyle2 = function(key7, val3, originalVal2) {
4111
4132
  var _styleState4;
4112
- if (!isValidStyleKey(key6, validStyles$1, accept)) {
4113
- viewProps[key6] = val3;
4133
+ if (!isValidStyleKey(key7, validStyles$1, accept)) {
4134
+ viewProps[key7] = val3;
4114
4135
  return;
4115
4136
  }
4116
4137
  (_styleState4 = styleState).style || (_styleState4.style = {});
4117
- if (mergeMediaByImportance(styleState, mediaKeyShort, key6, val3, mediaState$1[mediaKeyShort], importanceBump, debug, originalVal2) && key6 === "fontFamily") styleState.fontFamily = mediaStyle1.fontFamily;
4138
+ if (mergeMediaByImportance(styleState, mediaKeyShort, key7, val3, mediaState$1[mediaKeyShort], importanceBump, debug, originalVal2) && key7 === "fontFamily") styleState.fontFamily = mediaStyle1.fontFamily;
4118
4139
  };
4119
4140
  var isThemeMedia = isMedia === "theme";
4120
4141
  var isGroupMedia = isMedia === "group";
@@ -4122,7 +4143,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
4122
4143
  if (!isThemeMedia && !isPlatformMedia && !isGroupMedia) {
4123
4144
  if (!mediaState$1[mediaKeyShort]) return;
4124
4145
  }
4125
- var mediaStyle1 = getSubStyle(styleState, key5, val2, true);
4146
+ var mediaStyle1 = getSubStyle(styleState, key6, val2, true);
4126
4147
  var importanceBump = 0;
4127
4148
  if (isThemeMedia) if (supportsDynamicColorIOS && getSetting("fastSchemeChange")) {
4128
4149
  var _styleState3;
@@ -4236,7 +4257,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
4236
4257
  }
4237
4258
  if (!isVariant) {
4238
4259
  if (isStyledContextProp) return;
4239
- viewProps[key5] = val2;
4260
+ viewProps[key6] = val2;
4240
4261
  }
4241
4262
  });
4242
4263
  };
@@ -4276,9 +4297,9 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
4276
4297
  };
4277
4298
  if (process.env.IS_STATIC === "is_static") {
4278
4299
  var { fallbackProps } = styleProps;
4279
- if (fallbackProps) styleState.props = new Proxy(props, { get(_, key5, val2) {
4280
- if (!Reflect.has(props, key5)) return Reflect.get(fallbackProps, key5);
4281
- return Reflect.get(props, key5);
4300
+ if (fallbackProps) styleState.props = new Proxy(props, { get(_, key6, val2) {
4301
+ if (!Reflect.has(props, key6)) return Reflect.get(fallbackProps, key6);
4302
+ return Reflect.get(props, key6);
4282
4303
  } });
4283
4304
  }
4284
4305
  var { asChild } = props;
@@ -4317,7 +4338,12 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
4317
4338
  else {
4318
4339
  var _styleState2;
4319
4340
  (_styleState2 = styleState).style || (_styleState2.style = {});
4320
- Object.assign(styleState.style, normalizeStyle$1(style));
4341
+ var normalized = normalizeStyle$1(style);
4342
+ Object.assign(styleState.style, normalized);
4343
+ if (shouldTrackStyleTokenProvenance) {
4344
+ var styleOriginals = styleOriginalValues.get(normalized);
4345
+ for (var k in normalized) recordStyleTokenProvenance(styleState, k, styleOriginals === null || styleOriginals === void 0 ? void 0 : styleOriginals[k]);
4346
+ }
4321
4347
  }
4322
4348
  }
4323
4349
  }
@@ -4341,6 +4367,18 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
4341
4367
  }
4342
4368
  }
4343
4369
  }
4370
+ if (shouldTrackStyleTokenProvenance && styleState.style && styleState.tokenProvenance) {
4371
+ var provenance = {};
4372
+ var hasProvenance = false;
4373
+ for (var key4 in styleState.tokenProvenance) {
4374
+ provenance[key4] = {
4375
+ token: styleState.tokenProvenance[key4],
4376
+ theme: themeName
4377
+ };
4378
+ hasProvenance = true;
4379
+ }
4380
+ if (hasProvenance) setStyleTokenProvenance(styleState.style, provenance);
4381
+ }
4344
4382
  var result = {
4345
4383
  hasMedia,
4346
4384
  fontFamily: styleState.fontFamily,
@@ -4401,9 +4439,16 @@ function mergeStyle(styleState, key, val, importance) {
4401
4439
  (_styleState2 = styleState).style || (_styleState2.style = {});
4402
4440
  usedKeys[key] = importance;
4403
4441
  styleState.style[key] = key === "transform" && Array.isArray(out) ? [...out] : out;
4442
+ if (shouldTrackStyleTokenProvenance) recordStyleTokenProvenance(styleState, key, originalVal);
4404
4443
  }
4405
4444
  }
4406
4445
  }
4446
+ function recordStyleTokenProvenance(styleState, key, originalVal) {
4447
+ if (typeof originalVal === "string" && originalVal[0] === "$") {
4448
+ var _styleState;
4449
+ ((_styleState = styleState).tokenProvenance || (_styleState.tokenProvenance = {}))[key] = originalVal;
4450
+ } else if (styleState.tokenProvenance && key in styleState.tokenProvenance) delete styleState.tokenProvenance[key];
4451
+ }
4407
4452
  var getSubStyle = function(styleState, subKey, styleIn, avoidMergeTransform) {
4408
4453
  var { staticConfig, conf: conf2, styleProps } = styleState;
4409
4454
  var styleOut = {};
@@ -5095,6 +5140,7 @@ var _excluded$2 = [
5095
5140
  "onMouseLeave",
5096
5141
  "onFocus",
5097
5142
  "onBlur",
5143
+ "onDidAnimate",
5098
5144
  "separator",
5099
5145
  "passThrough",
5100
5146
  "forceStyle",
@@ -5384,7 +5430,7 @@ function createComponent(staticConfig) {
5384
5430
  setMediaShouldUpdate(componentContext, didGetVariableValue() || hasRuntimeMediaKeys || noClass && (splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.hasMedia) === true, hasRuntimeMediaKeys ? splitStyles.hasMedia : null);
5385
5431
  var { viewProps: viewPropsIn, pseudos, style: splitStylesStyle, classNames, pseudoGroups, mediaGroups } = splitStyles || {};
5386
5432
  var propsWithAnimation = props;
5387
- var _ref5 = viewPropsIn || {}, { asChild, children, themeShallow, spaceDirection: _spaceDirection, onPress, onLongPress, onPressIn, onPressOut, onHoverIn, onHoverOut, onMouseUp, onMouseDown, onMouseEnter, onMouseLeave, onFocus, onBlur, separator, passThrough, forceStyle: _forceStyle, onClick, theme: _themeProp } = _ref5, nonTamaguiProps = _objectWithoutProperties(_ref5, _excluded2$1);
5433
+ var _ref5 = viewPropsIn || {}, { asChild, children, themeShallow, spaceDirection: _spaceDirection, onPress, onLongPress, onPressIn, onPressOut, onHoverIn, onHoverOut, onMouseUp, onMouseDown, onMouseEnter, onMouseLeave, onFocus, onBlur, onDidAnimate, separator, passThrough, forceStyle: _forceStyle, onClick, theme: _themeProp } = _ref5, nonTamaguiProps = _objectWithoutProperties(_ref5, _excluded2$1);
5388
5434
  var viewProps = nonTamaguiProps;
5389
5435
  if (props.forceStyle) viewProps.forceStyle = props.forceStyle;
5390
5436
  if (isHOC) {
@@ -5414,7 +5460,8 @@ function createComponent(staticConfig) {
5414
5460
  themeName,
5415
5461
  pseudos: pseudos || null,
5416
5462
  staticConfig,
5417
- stateRef
5463
+ stateRef,
5464
+ onDidAnimate
5418
5465
  });
5419
5466
  if (animations) {
5420
5467
  if (animations.ref) animatedRef = animations.ref;
@@ -7437,6 +7484,7 @@ exports.LayoutMeasurementController = LayoutMeasurementController;
7437
7484
  exports.MEDIA_SEP = MEDIA_SEP;
7438
7485
  exports.MISSING_THEME_MESSAGE = MISSING_THEME_MESSAGE;
7439
7486
  exports.PROP_SPLIT = PROP_SPLIT;
7487
+ exports.STYLE_TOKEN_PROVENANCE_KEY = STYLE_TOKEN_PROVENANCE_KEY;
7440
7488
  exports.Slot = Slot;
7441
7489
  exports.Slottable = Slottable;
7442
7490
  exports.StyleObjectIdentifier = StyleObjectIdentifier;
@@ -7496,6 +7544,7 @@ exports.getSplitStyles = getSplitStyles;
7496
7544
  exports.getStyleAtomic = getStyleAtomic;
7497
7545
  exports.getStyleCompat = getStyleCompat;
7498
7546
  exports.getStyleTags = getStyleTags;
7547
+ exports.getStyleTokenProvenance = getStyleTokenProvenance;
7499
7548
  exports.getSubStyle = getSubStyle;
7500
7549
  exports.getThemeCSSRules = getThemeCSSRules;
7501
7550
  exports.getThemedChildren = getThemedChildren;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/core",
3
- "version": "2.4.5",
3
+ "version": "2.5.0",
4
4
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -9,7 +9,7 @@
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "https://github.com/tamagui/tamagui.git",
12
- "directory": "packages/core"
12
+ "directory": "code/core/core"
13
13
  },
14
14
  "source": "src/index.tsx",
15
15
  "type": "module",
@@ -79,17 +79,17 @@
79
79
  "clean:build": "tamagui-build clean:build"
80
80
  },
81
81
  "dependencies": {
82
- "@tamagui/helpers": "2.4.5",
83
- "@tamagui/react-native-media-driver": "2.4.5",
84
- "@tamagui/react-native-use-pressable": "2.4.5",
85
- "@tamagui/use-element-layout": "2.4.5",
86
- "@tamagui/use-event": "2.4.5",
87
- "@tamagui/web": "2.4.5"
82
+ "@tamagui/helpers": "2.5.0",
83
+ "@tamagui/react-native-media-driver": "2.5.0",
84
+ "@tamagui/react-native-use-pressable": "2.5.0",
85
+ "@tamagui/use-element-layout": "2.5.0",
86
+ "@tamagui/use-event": "2.5.0",
87
+ "@tamagui/web": "2.5.0"
88
88
  },
89
89
  "devDependencies": {
90
- "@tamagui/build": "2.4.5",
91
- "@tamagui/native-bundle": "2.4.5",
92
- "@tamagui/react-native-web-lite": "2.4.5",
90
+ "@tamagui/build": "2.5.0",
91
+ "@tamagui/native-bundle": "2.5.0",
92
+ "@tamagui/react-native-web-lite": "2.5.0",
93
93
  "@testing-library/react": "^16.1.0",
94
94
  "csstype": "^3.0.10",
95
95
  "react": ">=19",