@tamagui/web 1.129.19 → 1.130.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.
Files changed (99) hide show
  1. package/dist/cjs/createComponent.cjs +43 -32
  2. package/dist/cjs/createComponent.js +36 -23
  3. package/dist/cjs/createComponent.js.map +1 -1
  4. package/dist/cjs/createComponent.native.js +30 -21
  5. package/dist/cjs/createComponent.native.js.map +2 -2
  6. package/dist/cjs/helpers/getSplitStyles.cjs +3 -2
  7. package/dist/cjs/helpers/getSplitStyles.js +4 -2
  8. package/dist/cjs/helpers/getSplitStyles.js.map +1 -1
  9. package/dist/cjs/helpers/getSplitStyles.native.js +2 -0
  10. package/dist/cjs/helpers/getSplitStyles.native.js.map +2 -2
  11. package/dist/cjs/helpers/mergeProps.cjs +13 -9
  12. package/dist/cjs/helpers/mergeProps.js +17 -9
  13. package/dist/cjs/helpers/mergeProps.js.map +1 -1
  14. package/dist/cjs/helpers/mergeProps.native.js +20 -9
  15. package/dist/cjs/helpers/mergeProps.native.js.map +2 -2
  16. package/dist/cjs/hooks/useComponentState.cjs +1 -1
  17. package/dist/cjs/hooks/useComponentState.js +1 -1
  18. package/dist/cjs/hooks/useComponentState.js.map +1 -1
  19. package/dist/cjs/hooks/useComponentState.native.js +1 -1
  20. package/dist/cjs/hooks/useComponentState.native.js.map +2 -2
  21. package/dist/cjs/hooks/useProps.cjs +2 -2
  22. package/dist/cjs/hooks/useProps.js +7 -2
  23. package/dist/cjs/hooks/useProps.js.map +1 -1
  24. package/dist/cjs/hooks/useProps.native.js +3 -3
  25. package/dist/cjs/hooks/useProps.native.js.map +1 -1
  26. package/dist/cjs/hooks/useThemeState.cjs +2 -1
  27. package/dist/cjs/hooks/useThemeState.js +3 -1
  28. package/dist/cjs/hooks/useThemeState.js.map +1 -1
  29. package/dist/cjs/hooks/useThemeState.native.js +6 -1
  30. package/dist/cjs/hooks/useThemeState.native.js.map +2 -2
  31. package/dist/cjs/views/Theme.cjs +10 -7
  32. package/dist/cjs/views/Theme.js +21 -7
  33. package/dist/cjs/views/Theme.js.map +1 -1
  34. package/dist/cjs/views/Theme.native.js +7 -7
  35. package/dist/cjs/views/Theme.native.js.map +2 -2
  36. package/dist/esm/createComponent.js +36 -23
  37. package/dist/esm/createComponent.js.map +1 -1
  38. package/dist/esm/createComponent.mjs +43 -32
  39. package/dist/esm/createComponent.mjs.map +1 -1
  40. package/dist/esm/createComponent.native.js +42 -32
  41. package/dist/esm/createComponent.native.js.map +1 -1
  42. package/dist/esm/helpers/getSplitStyles.js +4 -2
  43. package/dist/esm/helpers/getSplitStyles.js.map +1 -1
  44. package/dist/esm/helpers/getSplitStyles.mjs +3 -2
  45. package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
  46. package/dist/esm/helpers/getSplitStyles.native.js +1 -0
  47. package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
  48. package/dist/esm/helpers/mergeProps.js +17 -9
  49. package/dist/esm/helpers/mergeProps.js.map +1 -1
  50. package/dist/esm/helpers/mergeProps.mjs +13 -9
  51. package/dist/esm/helpers/mergeProps.mjs.map +1 -1
  52. package/dist/esm/helpers/mergeProps.native.js +18 -9
  53. package/dist/esm/helpers/mergeProps.native.js.map +1 -1
  54. package/dist/esm/hooks/useComponentState.js +1 -1
  55. package/dist/esm/hooks/useComponentState.js.map +1 -1
  56. package/dist/esm/hooks/useComponentState.mjs +1 -1
  57. package/dist/esm/hooks/useComponentState.mjs.map +1 -1
  58. package/dist/esm/hooks/useComponentState.native.js +1 -1
  59. package/dist/esm/hooks/useProps.js +7 -2
  60. package/dist/esm/hooks/useProps.js.map +1 -1
  61. package/dist/esm/hooks/useProps.mjs +2 -2
  62. package/dist/esm/hooks/useProps.mjs.map +1 -1
  63. package/dist/esm/hooks/useProps.native.js +2 -2
  64. package/dist/esm/hooks/useProps.native.js.map +1 -1
  65. package/dist/esm/hooks/useThemeState.js +3 -1
  66. package/dist/esm/hooks/useThemeState.js.map +1 -1
  67. package/dist/esm/hooks/useThemeState.mjs +2 -1
  68. package/dist/esm/hooks/useThemeState.mjs.map +1 -1
  69. package/dist/esm/hooks/useThemeState.native.js +2 -1
  70. package/dist/esm/hooks/useThemeState.native.js.map +1 -1
  71. package/dist/esm/views/Theme.js +21 -7
  72. package/dist/esm/views/Theme.js.map +1 -1
  73. package/dist/esm/views/Theme.mjs +10 -7
  74. package/dist/esm/views/Theme.mjs.map +1 -1
  75. package/dist/esm/views/Theme.native.js +10 -6
  76. package/dist/esm/views/Theme.native.js.map +1 -1
  77. package/package.json +12 -12
  78. package/src/createComponent.tsx +135 -106
  79. package/src/helpers/getSplitStyles.tsx +9 -3
  80. package/src/helpers/mergeProps.ts +53 -4
  81. package/src/hooks/useComponentState.ts +1 -0
  82. package/src/hooks/useProps.tsx +7 -2
  83. package/src/hooks/useThemeState.ts +7 -2
  84. package/src/setupHooks.ts +1 -1
  85. package/src/types.tsx +10 -1
  86. package/src/views/Theme.tsx +40 -21
  87. package/types/createComponent.d.ts.map +1 -1
  88. package/types/helpers/getSplitStyles.d.ts +1 -1
  89. package/types/helpers/getSplitStyles.d.ts.map +1 -1
  90. package/types/helpers/mergeProps.d.ts +19 -0
  91. package/types/helpers/mergeProps.d.ts.map +1 -1
  92. package/types/hooks/useProps.d.ts.map +1 -1
  93. package/types/hooks/useThemeState.d.ts.map +1 -1
  94. package/types/setupHooks.d.ts +1 -1
  95. package/types/setupHooks.d.ts.map +1 -1
  96. package/types/types.d.ts +7 -1
  97. package/types/types.d.ts.map +1 -1
  98. package/types/views/Theme.d.ts +4 -2
  99. package/types/views/Theme.d.ts.map +1 -1
@@ -12,11 +12,14 @@ var empty = {
12
12
  },
13
13
  Theme = /* @__PURE__ */forwardRef(function (props, ref) {
14
14
  if (props.disable) return props.children;
15
- var isRoot = !!props._isRoot,
15
+ var {
16
+ passThrough
17
+ } = props,
18
+ isRoot = !!props._isRoot,
16
19
  [_, themeState] = useThemeWithState(props, isRoot),
17
20
  disableDirectChildTheme = props["disable-child-theme"],
18
21
  finalChildren = disableDirectChildTheme ? Children.map(props.children, function (child) {
19
- return /* @__PURE__ */cloneElement(child, {
22
+ return passThrough ? child : /* @__PURE__ */cloneElement(child, {
20
23
  "data-disable-theme": !0
21
24
  });
22
25
  }) : props.children;
@@ -28,12 +31,13 @@ var empty = {
28
31
  var stateRef = useRef({
29
32
  hasEverThemed: !1
30
33
  });
31
- return getThemedChildren(themeState, finalChildren, props, isRoot, stateRef);
34
+ return getThemedChildren(themeState, finalChildren, props, isRoot, stateRef, passThrough);
32
35
  });
33
36
  Theme.avoidForwardRef = !0;
34
37
  function getThemedChildren(themeState, children, props) {
35
38
  var isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1,
36
39
  stateRef = arguments.length > 4 ? arguments[4] : void 0,
40
+ passThrough = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !1,
37
41
  {
38
42
  shallow,
39
43
  forceClassName
@@ -62,7 +66,7 @@ function getThemedChildren(themeState, children, props) {
62
66
  var parentState = getThemeState(themeState.isNew ? themeState.id : themeState.parentId);
63
67
  if (!parentState) throw new Error("\u203C\uFE0F010");
64
68
  children = Children.toArray(children).map(function (child) {
65
- return /* @__PURE__ */isValidElement(child) ? /* @__PURE__ */cloneElement(child, void 0, /* @__PURE__ */_jsx(Theme, {
69
+ return /* @__PURE__ */isValidElement(child) ? passThrough ? child : /* @__PURE__ */cloneElement(child, void 0, /* @__PURE__ */_jsx(Theme, {
66
70
  name: parentState.name,
67
71
  children: child.props.children
68
72
  })) : child;
@@ -82,10 +86,10 @@ function getThemedChildren(themeState, children, props) {
82
86
  } = getThemeClassNameAndStyle(themeState, props, isRoot);
83
87
  if (children = /* @__PURE__ */_jsx("span", {
84
88
  className: `${className} _dsp_contents is_Theme`,
85
- style,
89
+ style: passThrough ? void 0 : style,
86
90
  children
87
91
  }), state.hasEverThemed === "wrapped") {
88
- var className1 = requiresExtraWrapper ? `${isInverse ? name.startsWith("light") ? "t_light is_inversed" : name.startsWith("dark") ? "t_dark is_inversed" : "" : ""} _dsp_contents` : "_dsp_contents";
92
+ var className1 = !passThrough && requiresExtraWrapper ? `${isInverse ? name.startsWith("light") ? "t_light is_inversed" : name.startsWith("dark") ? "t_dark is_inversed" : "" : ""} _dsp_contents` : "_dsp_contents";
89
93
  children = /* @__PURE__ */_jsx("span", {
90
94
  className: className1,
91
95
  children
@@ -1 +1 @@
1
- {"version":3,"names":["jsx","_jsx","isWeb","React","Children","cloneElement","forwardRef","isValidElement","useRef","getSetting","variableToString","useThemeWithState","getThemeState","hasThemeUpdatingProps","ThemeStateContext","ThemeDebug","empty","className","style","Theme","props","ref","disable","children","isRoot","_isRoot","_","themeState","disableDirectChildTheme","finalChildren","map","child","only","stateRef","hasEverThemed","getThemedChildren","avoidForwardRef","arguments","length","shallow","forceClassName","state","current","shouldRenderChildrenWithTheme","isNew","process","env","NODE_ENV","debug","themeProps","Provider","value","id","isInverse","name","requiresExtraWrapper","parentId","parentState","Error","toArray","console","warn","getThemeClassNameAndStyle","className1","startsWith"],"sources":["../../../src/views/Theme.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,GAAA,IAAAC,IAAA,QAAa;AAEtB,SAAOC,KAAA,QAAS,oBAAwB;AACxC,OAAAC,KAAS,IAAAC,QAAA,EAAAC,YAAkB,EAAAC,UAAA,EAAAC,cAAA,EAAAC,MAAA;AAC3B,SAASC,UAAA,6BAAwB;AACjC,SAASC,gBAAA,qCAAyB;AAClC,SAAAC,iBAAA;AAAA,SACEC,aAAA,EAAAC,qBAAA,EAAAC,iBAAA;AAAA,SACAC,UAAA;AAAA,IACAC,KAAA;IAAAC,SAEK;IAEPC,KAAA,EAAS;EA2DH;EAAAC,KAAA,kBAAAb,UAAA,WAAAc,KAAA,EAAAC,GAAA;IAzDN,IAAMD,KAAA,CAAAE,OAAU,EAId,OAAIF,KAAM,CAAAG,QAAA;IACR,IAAAC,MAAO,KAAMJ,KAAA,CAAAK,OAAA;MAAA,CAAA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AAe,SAAA;MAAAC;IAAA,IAAA4C,yBAAA,CAAAnC,UAAA,EAAAP,KAAA,EAAAI,MAAA;IAEA,IAAAD,QAAO,kBAAAtB,IAAA;MACTgB,SAAA,KAAAA,SAAA;MAEAC,KAAS;MAKHK;IACF,IAAAkB,KAAO,CAAAP,aAAA;MAIT,IAAM6B,UAAA,GACJR,oBAAqB,MAAAF,SAAW,GAAQC,IAAA,CAAAU,UAAA,QAAiB,yBAErD,GAAAV,IAAQ,CAAAU,UAAA,OACV;MACEzC,QAAO,kBAAAtB,IAAA;QAETgB,SAEE,EAAA8C,UAAc;QAQpBxC;MACF;IAEA","ignoreList":[]}
1
+ {"version":3,"names":["jsx","_jsx","isWeb","React","Children","cloneElement","forwardRef","isValidElement","useRef","getSetting","variableToString","useThemeWithState","getThemeState","hasThemeUpdatingProps","ThemeStateContext","ThemeDebug","empty","className","style","Theme","props","ref","disable","children","passThrough","isRoot","_isRoot","_","themeState","disableDirectChildTheme","finalChildren","map","child","only","stateRef","hasEverThemed","getThemedChildren","avoidForwardRef","arguments","length","shallow","forceClassName","state","current","shouldRenderChildrenWithTheme","isNew","process","env","NODE_ENV","debug","themeProps","Provider","value","id","isInverse","name","requiresExtraWrapper","parentId","parentState","Error","toArray","console","warn","getThemeClassNameAndStyle","className1","startsWith","themeColor","theme","color","maxInverses","themeClassName","inverses","replace","schemePrefix"],"sources":["../../../src/views/Theme.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,GAAA,IAAAC,IAAA,QAAa;AAEtB,SAAOC,KAAA,QAAS,oBAAwB;AACxC,OAAAC,KAAS,IAAAC,QAAA,EAAAC,YAAkB,EAAAC,UAAA,EAAAC,cAAA,EAAAC,MAAA;AAC3B,SAASC,UAAA,6BAAwB;AACjC,SAASC,gBAAA,qCAAyB;AAClC,SAAAC,iBAAA;AAAA,SACEC,aAAA,EAAAC,qBAAA,EAAAC,iBAAA;AAAA,SACAC,UAAA;AAAA,IACAC,KAAA;IAAAC,SAEK;IAEP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UAAQ;MAERE,KAAA,EAAOF;IACT,IACA;IAEEG,WAAA,GAAc5D,UAAA,CAAW,qBAAqB,KAAK;IACnD6D,cAAA,GACJ1C,UAAA,CAAW2C,QAAA,IAAYF,WAAA,GACnBzC,UAAA,CAAW2B,IAAA,GACX3B,UAAA,CAAW2B,IAAA,CAAKiB,OAAA,CAAQC,YAAA,EAAc,EAAE;IAExCxD,SAAA,GAAY,GAAGQ,MAAA,GAAS,KAAK,aAAa,MAAM6C,cAAc;EAEpE,OAAO;IACTpD,KAAA;IAEAD","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/web",
3
- "version": "1.129.19",
3
+ "version": "1.130.1",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -27,16 +27,16 @@
27
27
  "reset.css"
28
28
  ],
29
29
  "dependencies": {
30
- "@tamagui/compose-refs": "1.129.19",
31
- "@tamagui/constants": "1.129.19",
32
- "@tamagui/helpers": "1.129.19",
33
- "@tamagui/is-equal-shallow": "1.129.19",
34
- "@tamagui/normalize-css-color": "1.129.19",
35
- "@tamagui/timer": "1.129.19",
36
- "@tamagui/types": "1.129.19",
37
- "@tamagui/use-did-finish-ssr": "1.129.19",
38
- "@tamagui/use-event": "1.129.19",
39
- "@tamagui/use-force-update": "1.129.19"
30
+ "@tamagui/compose-refs": "1.130.1",
31
+ "@tamagui/constants": "1.130.1",
32
+ "@tamagui/helpers": "1.130.1",
33
+ "@tamagui/is-equal-shallow": "1.130.1",
34
+ "@tamagui/normalize-css-color": "1.130.1",
35
+ "@tamagui/timer": "1.130.1",
36
+ "@tamagui/types": "1.130.1",
37
+ "@tamagui/use-did-finish-ssr": "1.130.1",
38
+ "@tamagui/use-event": "1.130.1",
39
+ "@tamagui/use-force-update": "1.130.1"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": "*",
@@ -44,7 +44,7 @@
44
44
  "react-native": "*"
45
45
  },
46
46
  "devDependencies": {
47
- "@tamagui/build": "1.129.19",
47
+ "@tamagui/build": "1.130.1",
48
48
  "@testing-library/react": "^16.1.0",
49
49
  "csstype": "^3.0.10",
50
50
  "react": "*",
@@ -418,7 +418,7 @@ export function createComponent<
418
418
 
419
419
  // create new context with groups, or else sublings will grab the same one
420
420
  const allGroupContexts = useMemo((): AllGroupContexts | null => {
421
- if (!groupName) {
421
+ if (!groupName || props.passThrough) {
422
422
  return groupContextParent
423
423
  }
424
424
 
@@ -632,11 +632,13 @@ export function createComponent<
632
632
  debugProp
633
633
  )
634
634
 
635
+ // splitStyles === null === passThrough
636
+
635
637
  const groupContext = groupName ? allGroupContexts?.[groupName] || null : null
636
638
 
637
639
  // one tiny mutation 🙏 get width/height optimistically from raw values if possible
638
640
  // if set hardcoded it avoids extra renders
639
- if (groupContext) {
641
+ if (splitStyles && groupContext) {
640
642
  const groupState = groupContext?.state
641
643
  if (groupState && groupState.layout === undefined) {
642
644
  if (splitStyles.style?.width || splitStyles.style?.height) {
@@ -650,116 +652,124 @@ export function createComponent<
650
652
 
651
653
  // avoids re-rendering if animation driver supports it
652
654
  // TODO believe we need to set some sort of "pendingState" in case it re-renders
653
- if ((hasAnimationProp || groupName) && animationDriver?.avoidReRenders) {
654
- const styleListener = stateRef.current.useStyleListener
655
- const ogSetStateShallow = setStateShallow
655
+ if (splitStyles) {
656
+ if ((!hasAnimationProp || groupName) && animationDriver?.avoidReRenders) {
657
+ const useStyleListener = stateRef.current.useStyleListener
658
+ const ogSetStateShallow = setStateShallow
656
659
 
657
- stateRef.current.setStateShallow = (nextOrGetNext) => {
658
- const prev = NextState.get(stateRef) || state
659
- const next =
660
- typeof nextOrGetNext === 'function' ? nextOrGetNext(prev) : nextOrGetNext
660
+ stateRef.current.setStateShallow = (nextOrGetNext) => {
661
+ const prev = NextState.get(stateRef) || state
662
+ const next =
663
+ typeof nextOrGetNext === 'function' ? nextOrGetNext(prev) : nextOrGetNext
661
664
 
662
- if (next === prev || isEqualShallow(prev, next)) {
663
- return
664
- }
665
+ if (next === prev || isEqualShallow(prev, next)) {
666
+ return
667
+ }
665
668
 
666
- // one thing we have to handle here and where it gets a bit more complex is group styles
667
- const canAvoidReRender = Object.keys(next).every((key) =>
668
- avoidReRenderKeys.has(key)
669
- )
669
+ // one thing we have to handle here and where it gets a bit more complex is group styles
670
+ const canAvoidReRender = Object.keys(next).every((key) =>
671
+ avoidReRenderKeys.has(key)
672
+ )
670
673
 
671
- if (canAvoidReRender) {
672
- const updatedState = {
673
- ...prev,
674
- ...next,
675
- }
676
- NextState.set(stateRef, updatedState)
677
-
678
- if (
679
- process.env.NODE_ENV === 'development' &&
680
- debugProp &&
681
- debugProp !== 'profile'
682
- ) {
683
- console.groupCollapsed(`[⚡️] avoid setState`, next, { updatedState, props })
684
- console.info(stateRef.current.host)
685
- console.groupEnd()
686
- }
674
+ if (canAvoidReRender) {
675
+ const updatedState = {
676
+ ...prev,
677
+ ...next,
678
+ }
679
+ NextState.set(stateRef, updatedState)
680
+
681
+ if (
682
+ process.env.NODE_ENV === 'development' &&
683
+ debugProp &&
684
+ debugProp !== 'profile'
685
+ ) {
686
+ console.groupCollapsed(`[⚡️] avoid setState`, next, { updatedState, props })
687
+ console.info(stateRef.current.host)
688
+ console.groupEnd()
689
+ }
687
690
 
688
- const {
689
- group,
690
- hasDynGroupChildren,
691
- unmounted,
692
- animation,
693
- ...childrenGroupState
694
- } = updatedState
695
-
696
- // update before getting styles
697
- if (groupContext) {
698
- notifyGroupSubscribers(
699
- groupContext,
700
- stateRef.current.group || null,
701
- childrenGroupState
702
- )
703
- }
691
+ const {
692
+ group,
693
+ hasDynGroupChildren,
694
+ unmounted,
695
+ animation,
696
+ ...childrenGroupState
697
+ } = updatedState
698
+
699
+ // update before getting styles
700
+ if (groupContext) {
701
+ notifyGroupSubscribers(
702
+ groupContext,
703
+ stateRef.current.group || null,
704
+ childrenGroupState
705
+ )
706
+ }
704
707
 
705
- // we just emit and return for group without animation ^
706
- if (!hasAnimationProp || !styleListener) {
707
- return
708
- }
708
+ // we just emit and return for group without animation ^
709
+ if (!hasAnimationProp || !useStyleListener) {
710
+ return
711
+ }
709
712
 
710
- const nextStyles = getSplitStyles(
711
- props,
712
- staticConfig,
713
- theme,
714
- themeName,
715
- updatedState,
716
- styleProps,
717
- null,
718
- componentContext,
719
- allGroupContexts,
720
- elementType,
721
- startedUnhydrated,
722
- debugProp
723
- )
713
+ const nextStyles = getSplitStyles(
714
+ props,
715
+ staticConfig,
716
+ theme,
717
+ themeName,
718
+ updatedState,
719
+ styleProps,
720
+ null,
721
+ componentContext,
722
+ allGroupContexts,
723
+ elementType,
724
+ startedUnhydrated,
725
+ debugProp
726
+ )
724
727
 
725
- styleListener(nextStyles.style as any)
726
- } else {
727
- if (
728
- process.env.NODE_ENV === 'development' &&
729
- debugProp &&
730
- debugProp !== 'profile'
731
- ) {
732
- console.info(`[🐌] re-render`, { canAvoidReRender, next })
728
+ useStyleListener((nextStyles?.style || {}) as any)
729
+ } else {
730
+ if (
731
+ process.env.NODE_ENV === 'development' &&
732
+ debugProp &&
733
+ debugProp !== 'profile'
734
+ ) {
735
+ console.info(`[🐌] re-render`, { canAvoidReRender, next })
736
+ }
737
+ ogSetStateShallow(next)
733
738
  }
734
- ogSetStateShallow(next)
735
739
  }
736
- }
737
740
 
738
- // needs to capture latest props (it's called from memoized `events`)
739
- setStateShallow = (state) => {
740
- stateRef.current.setStateShallow?.(state)
741
+ // needs to capture latest props (it's called from memoized `events`)
742
+ setStateShallow = (state) => {
743
+ stateRef.current.setStateShallow?.(state)
744
+ }
741
745
  }
742
746
  }
743
747
 
744
748
  if (process.env.NODE_ENV === 'development' && time) time`split-styles`
745
749
 
746
750
  // hide strategy will set this opacity = 0 until measured
747
- if (props.group && props.untilMeasured === 'hide' && !stateRef.current.hasMeasured) {
748
- splitStyles.style ||= {}
749
- splitStyles.style.opacity = 0
750
- }
751
+ if (splitStyles) {
752
+ if (
753
+ props.group &&
754
+ props.untilMeasured === 'hide' &&
755
+ !stateRef.current.hasMeasured
756
+ ) {
757
+ splitStyles.style ||= {}
758
+ splitStyles.style.opacity = 0
759
+ }
751
760
 
752
- if (splitStyles.dynamicThemeAccess != null) {
753
- stateRef.current.isListeningToTheme = splitStyles.dynamicThemeAccess
761
+ if (splitStyles.dynamicThemeAccess != null) {
762
+ stateRef.current.isListeningToTheme = splitStyles.dynamicThemeAccess
763
+ }
754
764
  }
755
765
 
756
766
  // only listen for changes if we are using raw theme values or media space, or dynamic media (native)
757
767
  // array = space media breakpoints
758
- const hasRuntimeMediaKeys = splitStyles.hasMedia && splitStyles.hasMedia !== true
768
+ const hasRuntimeMediaKeys = splitStyles?.hasMedia && splitStyles.hasMedia !== true
759
769
  const shouldListenForMedia =
760
770
  didGetVariableValue() ||
761
771
  hasRuntimeMediaKeys ||
762
- (noClass && splitStyles.hasMedia === true)
772
+ (noClass && splitStyles?.hasMedia === true)
763
773
 
764
774
  const mediaListeningKeys = hasRuntimeMediaKeys
765
775
  ? (splitStyles.hasMedia as Set<string>)
@@ -776,7 +786,9 @@ export function createComponent<
776
786
  style: splitStylesStyle,
777
787
  classNames,
778
788
  space,
779
- } = splitStyles
789
+ pseudoGroups,
790
+ mediaGroups,
791
+ } = splitStyles || {}
780
792
 
781
793
  const propsWithAnimation = props as UseAnimationProps
782
794
 
@@ -804,7 +816,7 @@ export function createComponent<
804
816
  onClick,
805
817
  theme: _themeProp,
806
818
  ...nonTamaguiProps
807
- } = viewPropsIn
819
+ } = viewPropsIn || {}
808
820
 
809
821
  // these can ultimately be for DOM, react-native-web views, or animated views
810
822
  // so the type is pretty loose
@@ -880,7 +892,7 @@ export function createComponent<
880
892
 
881
893
  if (process.env.NODE_ENV === 'development' && time) time`destructure`
882
894
 
883
- if (groupContext) {
895
+ if (splitStyles && groupContext) {
884
896
  nonTamaguiProps.onLayout = composeEventHandlers(
885
897
  nonTamaguiProps.onLayout,
886
898
  (e: LayoutEvent) => {
@@ -935,12 +947,6 @@ export function createComponent<
935
947
 
936
948
  if (process.env.NODE_ENV === 'development' && time) time`events-hooks`
937
949
 
938
- // combined multiple effects into one for performance so be careful with logic
939
- // should not be a layout effect because otherwise it wont render the initial state
940
- // for example css driver needs to render once with the first styles, then again with the next
941
- // if its a layout effect it will just skip that first <render >output
942
- const { pseudoGroups, mediaGroups } = splitStyles
943
-
944
950
  const unPress = () => {
945
951
  setStateShallow({ press: false, pressIn: false })
946
952
  }
@@ -956,9 +962,11 @@ export function createComponent<
956
962
  }
957
963
  return styleObject
958
964
  }
959
- const computed = cssStyleDeclarationToObject(
960
- getComputedStyle(stateRef.current.host! as Element)
961
- )
965
+ const computed = stateRef.current.host
966
+ ? cssStyleDeclarationToObject(
967
+ getComputedStyle(stateRef.current.host as Element)
968
+ )
969
+ : {}
962
970
  console.groupCollapsed(`Rendered > (opacity: ${computed.opacity})`)
963
971
  console.warn(stateRef.current.host)
964
972
  console.warn(computed)
@@ -1226,7 +1234,7 @@ export function createComponent<
1226
1234
  if (process.env.NODE_ENV === 'development' && time) time`hooks`
1227
1235
 
1228
1236
  let content =
1229
- !children || asChild
1237
+ !children || asChild || !splitStyles
1230
1238
  ? children
1231
1239
  : spacedChildren({
1232
1240
  separator,
@@ -1270,6 +1278,17 @@ export function createComponent<
1270
1278
 
1271
1279
  if (process.env.NODE_ENV === 'development' && time) time`use-children`
1272
1280
 
1281
+ // passthrough mode - only pass style display contents, nothing else
1282
+ if (!splitStyles) {
1283
+ elementType = 'span'
1284
+ content = propsIn.children
1285
+ viewProps = {
1286
+ style: {
1287
+ display: 'contents',
1288
+ },
1289
+ }
1290
+ }
1291
+
1273
1292
  if (useChildrenResult) {
1274
1293
  content = useChildrenResult
1275
1294
  } else {
@@ -1279,7 +1298,15 @@ export function createComponent<
1279
1298
  // needs to reset the presence state for nested children
1280
1299
  const ResetPresence = config?.animations?.ResetPresence
1281
1300
  const needsReset = Boolean(
1282
- !isHOC && ResetPresence && willBeAnimated && (hasEnterStyle || presenceState)
1301
+ // not when passing down to child
1302
+ !asChild &&
1303
+ // not when passThrough
1304
+ splitStyles &&
1305
+ // not when HOC
1306
+ !isHOC &&
1307
+ ResetPresence &&
1308
+ willBeAnimated &&
1309
+ (hasEnterStyle || presenceState)
1283
1310
  )
1284
1311
  // avoid re-parenting
1285
1312
  const hasEverReset = stateRef.current.hasEverResetPresence
@@ -1312,9 +1339,10 @@ export function createComponent<
1312
1339
 
1313
1340
  if (process.env.NODE_ENV === 'development' && time) time`group-context`
1314
1341
 
1315
- content = disableTheme
1316
- ? content
1317
- : getThemedChildren(themeState, content, themeStateProps, false, stateRef)
1342
+ content =
1343
+ disableTheme || !splitStyles
1344
+ ? content
1345
+ : getThemedChildren(themeState, content, themeStateProps, false, stateRef)
1318
1346
 
1319
1347
  if (process.env.NODE_ENV === 'development' && time) time`themed-children`
1320
1348
 
@@ -1323,7 +1351,7 @@ export function createComponent<
1323
1351
  content = (
1324
1352
  <span
1325
1353
  className="_dsp_contents"
1326
- {...(isHydrated && events && getWebEvents(events))}
1354
+ {...(splitStyles && isHydrated && events && getWebEvents(events))}
1327
1355
  >
1328
1356
  {content}
1329
1357
  </span>
@@ -1357,6 +1385,7 @@ export function createComponent<
1357
1385
  if (process.env.TAMAGUI_TARGET === 'web' && startedUnhydrated) {
1358
1386
  // breaking rules of hooks but startedUnhydrated NEVER changes
1359
1387
  const styleTags = useMemo(() => {
1388
+ if (!splitStyles) return
1360
1389
  return getStyleTags(Object.values(splitStyles.rulesToInsert))
1361
1390
  }, [])
1362
1391
  // this is only to appease react hydration really
@@ -1509,7 +1538,7 @@ export function createComponent<
1509
1538
 
1510
1539
  out = options?.disableTheme ? out : themeable(out, extendedConfig, true)
1511
1540
 
1512
- if (process.env.TAMAGUI_MEMOIZE_STYLEABLE) {
1541
+ if (extendedConfig.memo || process.env.TAMAGUI_MEMOIZE_STYLEABLE) {
1513
1542
  out = React.memo(out)
1514
1543
  }
1515
1544
 
@@ -97,7 +97,7 @@ type StyleSplitter = (
97
97
  elementType?: string,
98
98
  startedUnhydrated?: boolean,
99
99
  debug?: DebugProp
100
- ) => GetStyleResult
100
+ ) => null | GetStyleResult
101
101
 
102
102
  export const PROP_SPLIT = '-'
103
103
 
@@ -147,6 +147,10 @@ export const getSplitStyles: StyleSplitter = (
147
147
  conf = conf || getConfig()
148
148
  const animationDriver = componentContext?.animationDriver || conf.animations
149
149
 
150
+ if (props.passThrough) {
151
+ return null
152
+ }
153
+
150
154
  // a bit icky, we need no normalize but not fully
151
155
  if (
152
156
  isWeb &&
@@ -1524,8 +1528,10 @@ export const useSplitStyles: StyleSplitter = (a, b, c, d, e, f, g, h, i, j, k, l
1524
1528
 
1525
1529
  if (process.env.TAMAGUI_TARGET !== 'native') {
1526
1530
  useInsertEffectCompat(() => {
1527
- insertStyleRules(res.rulesToInsert)
1528
- }, [res.rulesToInsert])
1531
+ if (res) {
1532
+ insertStyleRules(res.rulesToInsert)
1533
+ }
1534
+ }, [res?.rulesToInsert])
1529
1535
  }
1530
1536
 
1531
1537
  return res
@@ -10,6 +10,25 @@
10
10
  * Handles a couple special tamagui cases
11
11
  * - classNames can be extracted out separately
12
12
  * - shorthands can be expanded before merging
13
+ * - pseudo props and variants maintain runtime order for proper priority
14
+ *
15
+ * Example of variant/pseudo prop ordering importance:
16
+ * const StyledButton = styled(Button, {
17
+ * pressStyle: { bg: '$blue10' },
18
+ * variants: {
19
+ * variant: {
20
+ * default: { pressStyle: { bg: 'red', scale: 1.05 } }
21
+ * }
22
+ * }
23
+ * })
24
+ *
25
+ * case 1: variant first, then pressStyle
26
+ * <StyledButton variant='default' pressStyle={{ bg: 'orange' }} />
27
+ * output: {variant: 'default', pressStyle: {bg: 'orange'}}
28
+ *
29
+ * case 2: pressStyle first, then variant
30
+ * <StyledButton pressStyle={{ bg: 'orange' }} variant='default' />
31
+ * output: {pressStyle: {bg: 'orange'}, variant: 'default'}
13
32
  */
14
33
 
15
34
  import { mediaKeys } from '../hooks/useMedia'
@@ -27,6 +46,35 @@ export const mergeProps = (a: Object, b?: Object, inverseShorthands?: AnyRecord)
27
46
  mergeProp(out, b, undefined, key, inverseShorthands)
28
47
  }
29
48
  }
49
+
50
+ // Targeted reordering: only reorder pseudo props and variants that need runtime order
51
+ if (b && Object.keys(b).length > 0) {
52
+ // Check if we have any pseudo props or variants that need reordering
53
+ const hasPropsNeedingReorder = Object.keys(b).some(
54
+ (key) => (key in pseudoDescriptors || key === 'variant') && key in a && key in out
55
+ )
56
+
57
+ if (hasPropsNeedingReorder) {
58
+ const reordered: AnyRecord = {}
59
+
60
+ // First: Add pseudo props and variants that need specific ordering from runtime props (b)
61
+ for (const key in b) {
62
+ if ((key in pseudoDescriptors || key === 'variant') && key in out) {
63
+ reordered[key] = out[key]
64
+ }
65
+ }
66
+
67
+ // Second: Add all other props in their original order
68
+ for (const key in out) {
69
+ if (!(key in reordered)) {
70
+ reordered[key] = out[key]
71
+ }
72
+ }
73
+
74
+ return reordered
75
+ }
76
+ }
77
+
30
78
  return out
31
79
  }
32
80
 
@@ -40,10 +88,7 @@ function mergeProp(
40
88
  const longhand = inverseShorthands?.[key] || null
41
89
  const val = a[key]
42
90
 
43
- if (b && (key in b || (longhand && longhand in b))) {
44
- return
45
- }
46
-
91
+ // This ensures styled definition and runtime props are always merged
47
92
  if (key in pseudoDescriptors || mediaKeys.has(key)) {
48
93
  out[key] = {
49
94
  ...out[key],
@@ -52,5 +97,9 @@ function mergeProp(
52
97
  return
53
98
  }
54
99
 
100
+ if (b && (key in b || (longhand && longhand in b))) {
101
+ return
102
+ }
103
+
55
104
  out[longhand || key] = val
56
105
  }
@@ -237,6 +237,7 @@ function hasAnimatedStyleValue(style: Object) {
237
237
  const isDisabled = (props: any) => {
238
238
  return (
239
239
  props.disabled ||
240
+ props.passThrough ||
240
241
  props.accessibilityState?.disabled ||
241
242
  props['aria-disabled'] ||
242
243
  props.accessibilityDisabled ||
@@ -122,7 +122,7 @@ export function usePropsAndStyle<A extends PropsLikeObject>(
122
122
  groupContext
123
123
  )
124
124
 
125
- const { mediaGroups, pseudoGroups } = splitStyles
125
+ const { mediaGroups, pseudoGroups } = splitStyles || {}
126
126
 
127
127
  useIsomorphicLayoutEffect(() => {
128
128
  if (disabled) {
@@ -149,5 +149,10 @@ export function usePropsAndStyle<A extends PropsLikeObject>(
149
149
  mediaGroups ? Object.keys([...mediaGroups]).join('') : 0,
150
150
  ])
151
151
 
152
- return [splitStyles.viewProps, splitStyles.style || {}, theme, mediaState] as any
152
+ return [
153
+ splitStyles?.viewProps || {},
154
+ splitStyles?.style || {},
155
+ theme,
156
+ mediaState,
157
+ ] as any
153
158
  }