@tamagui/core 1.0.0-beta.189 → 1.0.0-beta.207

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 (113) hide show
  1. package/dist/cjs/constants/pseudos.js +37 -0
  2. package/dist/cjs/constants/pseudos.js.map +7 -0
  3. package/dist/cjs/createComponent.js +45 -45
  4. package/dist/cjs/createComponent.js.map +2 -2
  5. package/dist/cjs/createShallowUpdate.js +1 -0
  6. package/dist/cjs/createShallowUpdate.js.map +7 -0
  7. package/dist/cjs/defaultComponentState.js +0 -30
  8. package/dist/cjs/defaultComponentState.js.map +3 -3
  9. package/dist/cjs/devtools.js +32 -0
  10. package/dist/cjs/devtools.js.map +7 -0
  11. package/dist/cjs/helpers/RNComponents.js +34 -0
  12. package/dist/cjs/helpers/RNComponents.js.map +7 -0
  13. package/dist/cjs/helpers/createMediaStyle.js +2 -0
  14. package/dist/cjs/helpers/createMediaStyle.js.map +2 -2
  15. package/dist/cjs/helpers/createPropMapper.js.map +1 -1
  16. package/dist/cjs/helpers/createShallowUpdate.js +51 -0
  17. package/dist/cjs/helpers/createShallowUpdate.js.map +7 -0
  18. package/dist/cjs/helpers/createTamaguiProvider.js +1 -5
  19. package/dist/cjs/helpers/createTamaguiProvider.js.map +2 -2
  20. package/dist/cjs/helpers/getSplitStyles.js +7 -7
  21. package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
  22. package/dist/cjs/helpers/insertStyleRule.js +6 -5
  23. package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
  24. package/dist/cjs/hooks/useFeatures.js +11 -6
  25. package/dist/cjs/hooks/useFeatures.js.map +2 -2
  26. package/dist/cjs/styled.js +2 -12
  27. package/dist/cjs/styled.js.map +2 -2
  28. package/dist/cjs/tamagui-base.css +8 -0
  29. package/dist/cjs/tamagui-base.css.map +7 -0
  30. package/dist/cjs/types-rnw.js.map +1 -1
  31. package/dist/cjs/types.js.map +1 -1
  32. package/dist/cjs/views/Stack.js.map +2 -2
  33. package/dist/cjs/views/Text.js.map +2 -2
  34. package/dist/cjs/views/Theme.js +4 -1
  35. package/dist/cjs/views/Theme.js.map +2 -2
  36. package/dist/esm/constants/pseudos.js +18 -0
  37. package/dist/esm/constants/pseudos.js.map +7 -0
  38. package/dist/esm/createComponent.js +43 -43
  39. package/dist/esm/createComponent.js.map +2 -2
  40. package/dist/esm/createShallowUpdate.js +1 -0
  41. package/dist/esm/createShallowUpdate.js.map +7 -0
  42. package/dist/esm/defaultComponentState.js +0 -11
  43. package/dist/esm/defaultComponentState.js.map +3 -3
  44. package/dist/esm/devtools.js +14 -0
  45. package/dist/esm/devtools.js.map +7 -0
  46. package/dist/esm/helpers/RNComponents.js +12 -0
  47. package/dist/esm/helpers/RNComponents.js.map +7 -0
  48. package/dist/esm/helpers/createMediaStyle.js +2 -0
  49. package/dist/esm/helpers/createMediaStyle.js.map +2 -2
  50. package/dist/esm/helpers/createPropMapper.js.map +1 -1
  51. package/dist/esm/helpers/createShallowUpdate.js +19 -0
  52. package/dist/esm/helpers/createShallowUpdate.js.map +7 -0
  53. package/dist/esm/helpers/createTamaguiProvider.js +1 -4
  54. package/dist/esm/helpers/createTamaguiProvider.js.map +2 -2
  55. package/dist/esm/helpers/getSplitStyles.js +7 -7
  56. package/dist/esm/helpers/getSplitStyles.js.map +2 -2
  57. package/dist/esm/helpers/insertStyleRule.js +6 -5
  58. package/dist/esm/helpers/insertStyleRule.js.map +2 -2
  59. package/dist/esm/hooks/useFeatures.js +17 -11
  60. package/dist/esm/hooks/useFeatures.js.map +2 -2
  61. package/dist/esm/styled.js +1 -8
  62. package/dist/esm/styled.js.map +2 -2
  63. package/dist/esm/tamagui-base.css +8 -0
  64. package/dist/esm/tamagui-base.css.map +7 -0
  65. package/dist/esm/views/Stack.js.map +2 -2
  66. package/dist/esm/views/Text.js.map +2 -2
  67. package/dist/esm/views/Theme.js +4 -1
  68. package/dist/esm/views/Theme.js.map +2 -2
  69. package/dist/jsx/constants/pseudos.js +17 -0
  70. package/dist/jsx/createComponent.js +39 -40
  71. package/dist/jsx/createShallowUpdate.js +0 -0
  72. package/dist/jsx/defaultComponentState.js +0 -11
  73. package/dist/jsx/devtools.js +13 -0
  74. package/dist/jsx/helpers/RNComponents.js +11 -0
  75. package/dist/jsx/helpers/createMediaStyle.js +2 -0
  76. package/dist/jsx/helpers/createShallowUpdate.js +18 -0
  77. package/dist/jsx/helpers/createTamaguiProvider.js +1 -2
  78. package/dist/jsx/helpers/getSplitStyles.js +7 -7
  79. package/dist/jsx/helpers/insertStyleRule.js +6 -5
  80. package/dist/jsx/hooks/useFeatures.js +17 -11
  81. package/dist/jsx/styled.js +1 -8
  82. package/dist/jsx/tamagui-base.css +7 -0
  83. package/dist/jsx/views/Theme.js +4 -1
  84. package/package.json +6 -6
  85. package/types/createComponent.d.ts +5 -6
  86. package/types/createComponent.d.ts.map +1 -1
  87. package/types/defaultComponentState.d.ts +0 -12
  88. package/types/defaultComponentState.d.ts.map +1 -1
  89. package/types/helpers/RNComponents.d.ts +2 -0
  90. package/types/helpers/RNComponents.d.ts.map +1 -0
  91. package/types/helpers/createMediaStyle.d.ts.map +1 -1
  92. package/types/helpers/createPropMapper.d.ts +1 -1
  93. package/types/helpers/createPropMapper.d.ts.map +1 -1
  94. package/types/helpers/createShallowUpdate.d.ts +4 -0
  95. package/types/helpers/createShallowUpdate.d.ts.map +1 -0
  96. package/types/helpers/createTamaguiProvider.d.ts +1 -1
  97. package/types/helpers/createTamaguiProvider.d.ts.map +1 -1
  98. package/types/helpers/getSplitStyles.d.ts +2 -3
  99. package/types/helpers/getSplitStyles.d.ts.map +1 -1
  100. package/types/helpers/insertStyleRule.d.ts.map +1 -1
  101. package/types/hooks/useFeatures.d.ts +3 -4
  102. package/types/hooks/useFeatures.d.ts.map +1 -1
  103. package/types/styled.d.ts +3 -7
  104. package/types/styled.d.ts.map +1 -1
  105. package/types/types-rnw.d.ts +0 -5
  106. package/types/types-rnw.d.ts.map +1 -1
  107. package/types/types.d.ts +61 -62
  108. package/types/types.d.ts.map +1 -1
  109. package/types/views/Stack.d.ts +2 -2
  110. package/types/views/Stack.d.ts.map +1 -1
  111. package/types/views/Text.d.ts +2 -2
  112. package/types/views/Text.d.ts.map +1 -1
  113. package/types/views/Theme.d.ts.map +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/insertStyleRule.tsx"],
4
- "sourcesContent": ["// this needs to check if its inserted already? 99% of the time it is\n// this should avoid re-inserts, but need to test the perf trade-offs\n// i tested with the site itself and the initial insert was trivial\n\nconst allSelectors = {}\nconst insertedSelectors = {}\nexport const insertedTransforms = {}\n\nexport const getAllSelectors = () => allSelectors\nexport const getInsertedRules = () => Object.values(insertedSelectors)\nexport const getAllTransforms = () => insertedTransforms\n\n// keep transforms in map for merging later\nfunction addTransform(identifier: string, rule: string) {\n const s = rule.indexOf('transform:')\n if (s === -1) {\n console.error(`not a transform ${identifier} ${rule}`)\n return\n }\n const startI = s + 'transform:'.length\n const endI = rule.indexOf(';')\n const value = rule.slice(startI, endI)\n insertedTransforms[identifier] = value\n}\n\n// gets existing ones (client side)\n// takes ~0.1ms for a fairly large page\n// used now for three things:\n// 1. debugging at dev time\n// 2. avoid duplicate insert styles at runtime\n// 3. used now for merging transforms atomically\nlet hasInsertedSinceUpdate = true\nexport function updateInserted() {\n if (typeof document === 'undefined') {\n return\n }\n if (!hasInsertedSinceUpdate) {\n console.warn('hasnt inserted since')\n return\n }\n const sheets = document.styleSheets\n if (!sheets) return\n for (let i = 0; i < sheets.length; i++) {\n const rules = sheets[i].cssRules\n const firstRule = rules[0]\n if (!firstRule) continue\n const firstSelector = firstRule['selectorText']\n if (!firstSelector) continue\n if (firstSelector === ':root' || firstSelector.startsWith('._')) {\n for (const rule of rules as any) {\n if (!rule.selectorText) continue\n const identifier = rule.selectorText.slice(1)\n allSelectors[identifier] = true\n if (identifier.startsWith('_transform')) {\n addTransform(identifier, rule.cssText)\n }\n }\n }\n }\n hasInsertedSinceUpdate = false\n}\n\nupdateInserted()\n\nconst newRulesStyleTag =\n typeof document !== 'undefined'\n ? document.head.appendChild(document.createElement('style'))\n : null\n\nexport function insertStyleRule(identifier: string, rule: string) {\n if (allSelectors[identifier]) {\n return\n }\n hasInsertedSinceUpdate = true\n insertedSelectors[identifier] = rule\n allSelectors[identifier] = process.env.NODE_ENV === 'development' ? rule : true\n if (identifier.startsWith('_transform')) {\n addTransform(identifier, rule)\n }\n if (!newRulesStyleTag) {\n return\n }\n const sheet = newRulesStyleTag.sheet!\n sheet.insertRule(rule, sheet.cssRules.length)\n return identifier\n}\n"],
5
- "mappings": ";;AAIA,MAAM,eAAe,CAAC;AACtB,MAAM,oBAAoB,CAAC;AACpB,MAAM,qBAAqB,CAAC;AAE5B,MAAM,kBAAkB,6BAAM,cAAN;AACxB,MAAM,mBAAmB,6BAAM,OAAO,OAAO,iBAAiB,GAArC;AACzB,MAAM,mBAAmB,6BAAM,oBAAN;AAGhC,sBAAsB,YAAoB,MAAc;AACtD,QAAM,IAAI,KAAK,QAAQ,YAAY;AACnC,MAAI,MAAM,IAAI;AACZ,YAAQ,MAAM,mBAAmB,cAAc,MAAM;AACrD;AAAA,EACF;AACA,QAAM,SAAS,IAAI,aAAa;AAChC,QAAM,OAAO,KAAK,QAAQ,GAAG;AAC7B,QAAM,QAAQ,KAAK,MAAM,QAAQ,IAAI;AACrC,qBAAmB,cAAc;AACnC;AAVS;AAkBT,IAAI,yBAAyB;AACtB,0BAA0B;AAC/B,MAAI,OAAO,aAAa,aAAa;AACnC;AAAA,EACF;AACA,MAAI,CAAC,wBAAwB;AAC3B,YAAQ,KAAK,sBAAsB;AACnC;AAAA,EACF;AACA,QAAM,SAAS,SAAS;AACxB,MAAI,CAAC;AAAQ;AACb,WAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;AACtC,UAAM,QAAQ,OAAO,GAAG;AACxB,UAAM,YAAY,MAAM;AACxB,QAAI,CAAC;AAAW;AAChB,UAAM,gBAAgB,UAAU;AAChC,QAAI,CAAC;AAAe;AACpB,QAAI,kBAAkB,WAAW,cAAc,WAAW,IAAI,GAAG;AAC/D,iBAAW,QAAQ,OAAc;AAC/B,YAAI,CAAC,KAAK;AAAc;AACxB,cAAM,aAAa,KAAK,aAAa,MAAM,CAAC;AAC5C,qBAAa,cAAc;AAC3B,YAAI,WAAW,WAAW,YAAY,GAAG;AACvC,uBAAa,YAAY,KAAK,OAAO;AAAA,QACvC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,2BAAyB;AAC3B;AA5BgB;AA8BhB,eAAe;AAEf,MAAM,mBACJ,OAAO,aAAa,cAChB,SAAS,KAAK,YAAY,SAAS,cAAc,OAAO,CAAC,IACzD;AAEC,yBAAyB,YAAoB,MAAc;AAChE,MAAI,aAAa,aAAa;AAC5B;AAAA,EACF;AACA,2BAAyB;AACzB,oBAAkB,cAAc;AAChC,eAAa,cAAc,QAAQ,IAAI,aAAa,gBAAgB,OAAO;AAC3E,MAAI,WAAW,WAAW,YAAY,GAAG;AACvC,iBAAa,YAAY,IAAI;AAAA,EAC/B;AACA,MAAI,CAAC,kBAAkB;AACrB;AAAA,EACF;AACA,QAAM,QAAQ,iBAAiB;AAC/B,QAAM,WAAW,MAAM,MAAM,SAAS,MAAM;AAC5C,SAAO;AACT;AAhBgB;",
4
+ "sourcesContent": ["// this needs to check if its inserted already? 99% of the time it is\n// this should avoid re-inserts, but need to test the perf trade-offs\n// i tested with the site itself and the initial insert was trivial\n\nconst allSelectors = {}\nconst insertedSelectors = {}\nexport const insertedTransforms = {}\n\nexport const getAllSelectors = () => allSelectors\nexport const getInsertedRules = () => Object.values(insertedSelectors)\nexport const getAllTransforms = () => insertedTransforms\n\n// keep transforms in map for merging later\nfunction addTransform(identifier: string, rule: string) {\n const s = rule.indexOf('transform:')\n if (s === -1) {\n console.error(`not a transform ${identifier} ${rule}`)\n return\n }\n const startI = s + 'transform:'.length\n const endI = rule.indexOf(';')\n const value = rule.slice(startI, endI)\n insertedTransforms[identifier] = value\n}\n\n// gets existing ones (client side)\n// takes ~0.1ms for a fairly large page\n// used now for three things:\n// 1. debugging at dev time\n// 2. avoid duplicate insert styles at runtime\n// 3. used now for merging transforms atomically\nlet hasInsertedSinceUpdate = true\nexport function updateInserted() {\n if (typeof document === 'undefined') {\n return\n }\n if (!hasInsertedSinceUpdate) {\n console.warn('hasnt inserted since')\n return\n }\n const sheets = document.styleSheets\n if (!sheets) return\n for (let i = 0; i < sheets.length; i++) {\n const rules = sheets[i].cssRules\n const firstRule = rules[0]\n if (!(firstRule instanceof CSSStyleRule)) continue\n const firstSelector = firstRule.selectorText\n if (!firstSelector) continue\n if (firstSelector === ':root' || firstSelector.startsWith('._')) {\n for (let i = 0; i < rules.length; i++) {\n const rule = rules.item(i)\n if (!(rule instanceof CSSStyleRule)) continue\n const identifier = rule.selectorText.slice(1)\n allSelectors[identifier] = process.env.NODE_ENV === 'development' ? rule.cssText : true\n if (identifier.startsWith('_transform')) {\n addTransform(identifier, rule.cssText)\n }\n }\n }\n }\n hasInsertedSinceUpdate = false\n}\n\nupdateInserted()\n\nconst newRulesStyleTag =\n typeof document !== 'undefined'\n ? document.head.appendChild(document.createElement('style'))\n : null\n\nexport function insertStyleRule(identifier: string, rule: string) {\n if (allSelectors[identifier]) {\n return\n }\n hasInsertedSinceUpdate = true\n insertedSelectors[identifier] = rule\n allSelectors[identifier] = process.env.NODE_ENV === 'development' ? rule : true\n if (identifier.startsWith('_transform')) {\n addTransform(identifier, rule)\n }\n if (!newRulesStyleTag) {\n return\n }\n const sheet = newRulesStyleTag.sheet!\n sheet.insertRule(rule, sheet.cssRules.length)\n return identifier\n}\n"],
5
+ "mappings": ";;AAIA,MAAM,eAAe,CAAC;AACtB,MAAM,oBAAoB,CAAC;AACpB,MAAM,qBAAqB,CAAC;AAE5B,MAAM,kBAAkB,6BAAM,cAAN;AACxB,MAAM,mBAAmB,6BAAM,OAAO,OAAO,iBAAiB,GAArC;AACzB,MAAM,mBAAmB,6BAAM,oBAAN;AAGhC,sBAAsB,YAAoB,MAAc;AACtD,QAAM,IAAI,KAAK,QAAQ,YAAY;AACnC,MAAI,MAAM,IAAI;AACZ,YAAQ,MAAM,mBAAmB,cAAc,MAAM;AACrD;AAAA,EACF;AACA,QAAM,SAAS,IAAI,aAAa;AAChC,QAAM,OAAO,KAAK,QAAQ,GAAG;AAC7B,QAAM,QAAQ,KAAK,MAAM,QAAQ,IAAI;AACrC,qBAAmB,cAAc;AACnC;AAVS;AAkBT,IAAI,yBAAyB;AACtB,0BAA0B;AAC/B,MAAI,OAAO,aAAa,aAAa;AACnC;AAAA,EACF;AACA,MAAI,CAAC,wBAAwB;AAC3B,YAAQ,KAAK,sBAAsB;AACnC;AAAA,EACF;AACA,QAAM,SAAS,SAAS;AACxB,MAAI,CAAC;AAAQ;AACb,WAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;AACtC,UAAM,QAAQ,OAAO,GAAG;AACxB,UAAM,YAAY,MAAM;AACxB,QAAI,CAAE,sBAAqB;AAAe;AAC1C,UAAM,gBAAgB,UAAU;AAChC,QAAI,CAAC;AAAe;AACpB,QAAI,kBAAkB,WAAW,cAAc,WAAW,IAAI,GAAG;AAC/D,eAAS,KAAI,GAAG,KAAI,MAAM,QAAQ,MAAK;AACrC,cAAM,OAAO,MAAM,KAAK,EAAC;AACzB,YAAI,CAAE,iBAAgB;AAAe;AACrC,cAAM,aAAa,KAAK,aAAa,MAAM,CAAC;AAC5C,qBAAa,cAAc,QAAQ,IAAI,aAAa,gBAAgB,KAAK,UAAU;AACnF,YAAI,WAAW,WAAW,YAAY,GAAG;AACvC,uBAAa,YAAY,KAAK,OAAO;AAAA,QACvC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,2BAAyB;AAC3B;AA7BgB;AA+BhB,eAAe;AAEf,MAAM,mBACJ,OAAO,aAAa,cAChB,SAAS,KAAK,YAAY,SAAS,cAAc,OAAO,CAAC,IACzD;AAEC,yBAAyB,YAAoB,MAAc;AAChE,MAAI,aAAa,aAAa;AAC5B;AAAA,EACF;AACA,2BAAyB;AACzB,oBAAkB,cAAc;AAChC,eAAa,cAAc,QAAQ,IAAI,aAAa,gBAAgB,OAAO;AAC3E,MAAI,WAAW,WAAW,YAAY,GAAG;AACvC,iBAAa,YAAY,IAAI;AAAA,EAC/B;AACA,MAAI,CAAC,kBAAkB;AACrB;AAAA,EACF;AACA,QAAM,QAAQ,iBAAiB;AAC/B,QAAM,WAAW,MAAM,MAAM,SAAS,MAAM;AAC5C,SAAO;AACT;AAhBgB;",
6
6
  "names": []
7
7
  }
@@ -45,22 +45,28 @@ function loadAnimationFeature() {
45
45
  console.error("no useAnimations hook provided");
46
46
  return null;
47
47
  }
48
- const animatedStyleIn = {
49
- ...style,
50
- ...state.hover && pseudos.hoverStyle,
51
- ...state.focus && pseudos.focusStyle,
52
- ...state.press && pseudos.pressStyle
53
- };
54
- const res = useAnimations(props, {
55
- isMounted: state.mounted,
56
- style: animatedStyleIn,
57
- exitStyle: pseudos == null ? void 0 : pseudos.exitStyle
48
+ const propsWithAnimation = props;
49
+ const styleKey = JSON.stringify(style);
50
+ const res = useAnimations(propsWithAnimation, {
51
+ styleKey,
52
+ style: style || {},
53
+ state,
54
+ pseudos,
55
+ mergedStyles(props2) {
56
+ return {
57
+ ...style,
58
+ ...state.hover && pseudos.hoverStyle,
59
+ ...state.focus && pseudos.focusStyle,
60
+ ...state.press && pseudos.pressStyle,
61
+ ...(props2 == null ? void 0 : props2.isExiting) && pseudos.exitStyle
62
+ };
63
+ }
58
64
  });
59
65
  useIsomorphicLayoutEffect(() => {
60
66
  setStateShallow({
61
67
  animation: res
62
68
  });
63
- }, [JSON.stringify(style)]);
69
+ }, [styleKey]);
64
70
  return null;
65
71
  },
66
72
  propNames: ["animation"]
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hooks/useFeatures.tsx"],
4
- "sourcesContent": ["import React from 'react'\nimport { ViewStyle } from 'react-native'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '../constants/platform'\nimport { ComponentState } from '../defaultComponentState'\nimport { PseudoStyles } from '../static'\nimport { UseAnimationHook } from '../types'\nimport { addMediaQueryListener, mediaState, removeMediaQueryListener } from './useMedia'\n\ntype FeatureDefinition = {\n isEnabled: (props: any) => boolean\n Component: any\n}\n\ntype FeatureUtils = {\n forceUpdate: Function\n state: ComponentState\n setStateShallow: (next: Partial<ComponentState>) => void\n useAnimations?: UseAnimationHook\n pseudos: PseudoStyles\n style: ViewStyle | null | undefined\n}\n\nconst createDefinition = ({\n Component,\n propNames,\n}: {\n Component: (props: { _utils: FeatureUtils; [key: string]: any }) => void\n propNames: string[]\n}): FeatureDefinition => ({\n isEnabled: (props: any) => propNames.some((name) => !!props[name]),\n Component,\n})\n\nlet featureDefinitions: Record<string, FeatureDefinition> | null = null\n\nexport const useFeatures = (props: any, utils?: FeatureUtils) => {\n if (!featureDefinitions) {\n featureDefinitions = loadFeatures()\n }\n const features: JSX.Element[] = []\n for (const name in featureDefinitions) {\n const { isEnabled, Component } = featureDefinitions[name]\n if (isEnabled(props) && Component) {\n features.push(<Component key={name} {...props} _utils={utils} />)\n }\n }\n return features\n}\n\nfunction loadFeatures(): Record<string, FeatureDefinition> {\n return {\n // loads animations and sets state with the results\n animation: loadAnimationFeature(),\n\n // will update the parent whenever media query changes\n // no need on web, media queries are inserted and run in css\n ...(!isWeb && {\n mediaQuery: loadMediaQueryFeature(),\n }),\n }\n}\n\nfunction loadAnimationFeature() {\n return createDefinition({\n Component: ({ _utils, ...props }) => {\n const { state, useAnimations, pseudos, style, setStateShallow } = _utils\n\n if (!useAnimations) {\n console.error('no useAnimations hook provided')\n return null\n }\n\n const animatedStyleIn = {\n ...style,\n ...(state.hover && pseudos.hoverStyle),\n ...(state.focus && pseudos.focusStyle),\n ...(state.press && pseudos.pressStyle),\n }\n\n const res = useAnimations(props as any, {\n isMounted: state.mounted,\n style: animatedStyleIn,\n exitStyle: pseudos?.exitStyle,\n // onDidAnimate, delay\n })\n\n useIsomorphicLayoutEffect(() => {\n setStateShallow({\n animation: res,\n })\n }, [JSON.stringify(style)])\n\n return null\n },\n propNames: ['animation'],\n })\n}\n\nfunction loadMediaQueryFeature() {\n const mediaPropNames = Object.keys(mediaState)\n\n return createDefinition({\n Component: (props: any) => {\n const keys = mediaPropNames.flatMap((x) => (x in props ? x.slice(1) : []))\n\n useIsomorphicLayoutEffect(() => {\n for (const key of keys) {\n addMediaQueryListener(key, props._utils.forceUpdate)\n }\n return () => {\n for (const key of keys) {\n removeMediaQueryListener(key, props._utils.forceUpdate)\n }\n }\n }, [keys.join(',')])\n\n return null\n },\n propNames: mediaPropNames,\n })\n}\n\n// TODO\n// measureLayout: createDefinition({\n// Component: (props) => {\n// console.log('measure', props)\n// return null\n// },\n// propNames: ['onLayout'],\n// }),\n"],
5
- "mappings": ";;AAAA;AAGA;AAIA;AAgBA,MAAM,mBAAmB,wBAAC;AAAA,EACxB;AAAA,EACA;AAAA,MAIwB;AAAA,EACxB,WAAW,CAAC,UAAe,UAAU,KAAK,CAAC,SAAS,CAAC,CAAC,MAAM,KAAK;AAAA,EACjE;AACF,IATyB;AAWzB,IAAI,qBAA+D;AAE5D,MAAM,cAAc,wBAAC,OAAY,UAAyB;AAC/D,MAAI,CAAC,oBAAoB;AACvB,yBAAqB,aAAa;AAAA,EACpC;AACA,QAAM,WAA0B,CAAC;AACjC,aAAW,QAAQ,oBAAoB;AACrC,UAAM,EAAE,WAAW,cAAc,mBAAmB;AACpD,QAAI,UAAU,KAAK,KAAK,WAAW;AACjC,eAAS,KAAK,oCAAC;AAAA,QAAU,KAAK;AAAA,WAAU;AAAA,QAAO,QAAQ;AAAA,OAAO,CAAE;AAAA,IAClE;AAAA,EACF;AACA,SAAO;AACT,GAZ2B;AAc3B,wBAA2D;AACzD,SAAO;AAAA,IAEL,WAAW,qBAAqB;AAAA,OAI5B,CAAC,SAAS;AAAA,MACZ,YAAY,sBAAsB;AAAA,IACpC;AAAA,EACF;AACF;AAXS;AAaT,gCAAgC;AAC9B,SAAO,iBAAiB;AAAA,IACtB,WAAW,CAAC,EAAE,WAAW,YAAY;AACnC,YAAM,EAAE,OAAO,eAAe,SAAS,OAAO,oBAAoB;AAElE,UAAI,CAAC,eAAe;AAClB,gBAAQ,MAAM,gCAAgC;AAC9C,eAAO;AAAA,MACT;AAEA,YAAM,kBAAkB;AAAA,WACnB;AAAA,WACC,MAAM,SAAS,QAAQ;AAAA,WACvB,MAAM,SAAS,QAAQ;AAAA,WACvB,MAAM,SAAS,QAAQ;AAAA,MAC7B;AAEA,YAAM,MAAM,cAAc,OAAc;AAAA,QACtC,WAAW,MAAM;AAAA,QACjB,OAAO;AAAA,QACP,WAAW,mCAAS;AAAA,MAEtB,CAAC;AAED,gCAA0B,MAAM;AAC9B,wBAAgB;AAAA,UACd,WAAW;AAAA,QACb,CAAC;AAAA,MACH,GAAG,CAAC,KAAK,UAAU,KAAK,CAAC,CAAC;AAE1B,aAAO;AAAA,IACT;AAAA,IACA,WAAW,CAAC,WAAW;AAAA,EACzB,CAAC;AACH;AAlCS;AAoCT,iCAAiC;AAC/B,QAAM,iBAAiB,OAAO,KAAK,UAAU;AAE7C,SAAO,iBAAiB;AAAA,IACtB,WAAW,CAAC,UAAe;AACzB,YAAM,OAAO,eAAe,QAAQ,CAAC,MAAO,KAAK,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAE;AAEzE,gCAA0B,MAAM;AAC9B,mBAAW,OAAO,MAAM;AACtB,gCAAsB,KAAK,MAAM,OAAO,WAAW;AAAA,QACrD;AACA,eAAO,MAAM;AACX,qBAAW,OAAO,MAAM;AACtB,qCAAyB,KAAK,MAAM,OAAO,WAAW;AAAA,UACxD;AAAA,QACF;AAAA,MACF,GAAG,CAAC,KAAK,KAAK,GAAG,CAAC,CAAC;AAEnB,aAAO;AAAA,IACT;AAAA,IACA,WAAW;AAAA,EACb,CAAC;AACH;AAtBS;",
4
+ "sourcesContent": ["import React from 'react'\nimport { ViewStyle } from 'react-native'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '../constants/platform'\nimport { PseudoStyles } from '../static'\nimport { TamaguiComponentState, UseAnimationHook, UseAnimationProps } from '../types'\nimport { addMediaQueryListener, mediaState, removeMediaQueryListener } from './useMedia'\n\ntype FeatureDefinition = {\n isEnabled: (props: any) => boolean\n Component: any\n}\n\ntype FeatureUtils = {\n forceUpdate: Function\n state: TamaguiComponentState\n setStateShallow: (next: Partial<TamaguiComponentState>) => void\n useAnimations?: UseAnimationHook\n pseudos: PseudoStyles\n style: ViewStyle | null | undefined\n}\n\nconst createDefinition = ({\n Component,\n propNames,\n}: {\n Component: (props: { _utils: FeatureUtils; [key: string]: any }) => void\n propNames: string[]\n}): FeatureDefinition => ({\n isEnabled: (props: any) => propNames.some((name) => !!props[name]),\n Component,\n})\n\nlet featureDefinitions: Record<string, FeatureDefinition> | null = null\n\nexport const useFeatures = (props: any, utils?: FeatureUtils) => {\n if (!featureDefinitions) {\n featureDefinitions = loadFeatures()\n }\n const features: JSX.Element[] = []\n for (const name in featureDefinitions) {\n const { isEnabled, Component } = featureDefinitions[name]\n if (isEnabled(props) && Component) {\n features.push(<Component key={name} {...props} _utils={utils} />)\n }\n }\n return features\n}\n\nfunction loadFeatures(): Record<string, FeatureDefinition> {\n return {\n // loads animations and sets state with the results\n animation: loadAnimationFeature(),\n\n // will update the parent whenever media query changes\n // no need on web, media queries are inserted and run in css\n ...(!isWeb && {\n mediaQuery: loadMediaQueryFeature(),\n }),\n }\n}\n\nfunction loadAnimationFeature() {\n return createDefinition({\n Component: ({ _utils, ...props }) => {\n const { state, useAnimations, pseudos, style, setStateShallow } = _utils\n\n if (!useAnimations) {\n console.error('no useAnimations hook provided')\n return null\n }\n\n // const animatedStyleIn =\n\n // we always have .animation set\n const propsWithAnimation = props as UseAnimationProps\n const styleKey = JSON.stringify(style)\n\n const res = useAnimations(propsWithAnimation, {\n styleKey,\n style: style || {},\n state,\n pseudos,\n mergedStyles(props) {\n return {\n ...style,\n ...(state.hover && pseudos.hoverStyle),\n ...(state.focus && pseudos.focusStyle),\n ...(state.press && pseudos.pressStyle),\n ...(props?.isExiting && pseudos.exitStyle),\n }\n },\n // onDidAnimate, delay\n })\n\n useIsomorphicLayoutEffect(() => {\n setStateShallow({\n animation: res,\n })\n }, [styleKey])\n\n return null\n },\n propNames: ['animation'],\n })\n}\n\nfunction loadMediaQueryFeature() {\n const mediaPropNames = Object.keys(mediaState)\n\n return createDefinition({\n Component: (props: any) => {\n const keys = mediaPropNames.flatMap((x) => (x in props ? x.slice(1) : []))\n\n useIsomorphicLayoutEffect(() => {\n for (const key of keys) {\n addMediaQueryListener(key, props._utils.forceUpdate)\n }\n return () => {\n for (const key of keys) {\n removeMediaQueryListener(key, props._utils.forceUpdate)\n }\n }\n }, [keys.join(',')])\n\n return null\n },\n propNames: mediaPropNames,\n })\n}\n\n// TODO\n// measureLayout: createDefinition({\n// Component: (props) => {\n// console.log('measure', props)\n// return null\n// },\n// propNames: ['onLayout'],\n// }),\n"],
5
+ "mappings": ";;AAAA;AAGA;AAGA;AAgBA,MAAM,mBAAmB,wBAAC;AAAA,EACxB;AAAA,EACA;AAAA,MAIwB;AAAA,EACxB,WAAW,CAAC,UAAe,UAAU,KAAK,CAAC,SAAS,CAAC,CAAC,MAAM,KAAK;AAAA,EACjE;AACF,IATyB;AAWzB,IAAI,qBAA+D;AAE5D,MAAM,cAAc,wBAAC,OAAY,UAAyB;AAC/D,MAAI,CAAC,oBAAoB;AACvB,yBAAqB,aAAa;AAAA,EACpC;AACA,QAAM,WAA0B,CAAC;AACjC,aAAW,QAAQ,oBAAoB;AACrC,UAAM,EAAE,WAAW,cAAc,mBAAmB;AACpD,QAAI,UAAU,KAAK,KAAK,WAAW;AACjC,eAAS,KAAK,oCAAC;AAAA,QAAU,KAAK;AAAA,WAAU;AAAA,QAAO,QAAQ;AAAA,OAAO,CAAE;AAAA,IAClE;AAAA,EACF;AACA,SAAO;AACT,GAZ2B;AAc3B,wBAA2D;AACzD,SAAO;AAAA,IAEL,WAAW,qBAAqB;AAAA,OAI5B,CAAC,SAAS;AAAA,MACZ,YAAY,sBAAsB;AAAA,IACpC;AAAA,EACF;AACF;AAXS;AAaT,gCAAgC;AAC9B,SAAO,iBAAiB;AAAA,IACtB,WAAW,CAAC,EAAE,WAAW,YAAY;AACnC,YAAM,EAAE,OAAO,eAAe,SAAS,OAAO,oBAAoB;AAElE,UAAI,CAAC,eAAe;AAClB,gBAAQ,MAAM,gCAAgC;AAC9C,eAAO;AAAA,MACT;AAKA,YAAM,qBAAqB;AAC3B,YAAM,WAAW,KAAK,UAAU,KAAK;AAErC,YAAM,MAAM,cAAc,oBAAoB;AAAA,QAC5C;AAAA,QACA,OAAO,SAAS,CAAC;AAAA,QACjB;AAAA,QACA;AAAA,QACA,aAAa,QAAO;AAClB,iBAAO;AAAA,eACF;AAAA,eACC,MAAM,SAAS,QAAQ;AAAA,eACvB,MAAM,SAAS,QAAQ;AAAA,eACvB,MAAM,SAAS,QAAQ;AAAA,eACvB,kCAAO,cAAa,QAAQ;AAAA,UAClC;AAAA,QACF;AAAA,MAEF,CAAC;AAED,gCAA0B,MAAM;AAC9B,wBAAgB;AAAA,UACd,WAAW;AAAA,QACb,CAAC;AAAA,MACH,GAAG,CAAC,QAAQ,CAAC;AAEb,aAAO;AAAA,IACT;AAAA,IACA,WAAW,CAAC,WAAW;AAAA,EACzB,CAAC;AACH;AA3CS;AA6CT,iCAAiC;AAC/B,QAAM,iBAAiB,OAAO,KAAK,UAAU;AAE7C,SAAO,iBAAiB;AAAA,IACtB,WAAW,CAAC,UAAe;AACzB,YAAM,OAAO,eAAe,QAAQ,CAAC,MAAO,KAAK,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAE;AAEzE,gCAA0B,MAAM;AAC9B,mBAAW,OAAO,MAAM;AACtB,gCAAsB,KAAK,MAAM,OAAO,WAAW;AAAA,QACrD;AACA,eAAO,MAAM;AACX,qBAAW,OAAO,MAAM;AACtB,qCAAyB,KAAK,MAAM,OAAO,WAAW;AAAA,UACxD;AAAA,QACF;AAAA,MACF,GAAG,CAAC,KAAK,KAAK,GAAG,CAAC,CAAC;AAEnB,aAAO;AAAA,IACT;AAAA,IACA,WAAW;AAAA,EACb,CAAC;AACH;AAtBS;",
6
6
  "names": []
7
7
  }
@@ -1,16 +1,9 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import * as ReactNative from "react-native";
4
3
  import { Image, Text, TextInput } from "react-native";
5
4
  import { createComponent } from "./createComponent";
6
5
  import { extendStaticConfig } from "./helpers/extendStaticConfig";
7
- const RNComponents = /* @__PURE__ */ new WeakMap();
8
- for (const key of ["Image", "TextInput", "Text", "View"]) {
9
- const val = ReactNative[key];
10
- if (val && typeof val === "object") {
11
- RNComponents.set(val, true);
12
- }
13
- }
6
+ import { RNComponents } from "./helpers/RNComponents";
14
7
  function styled(Component, options, staticExtractionOptions) {
15
8
  const staticConfigProps = (() => {
16
9
  if (options) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/styled.tsx"],
4
- "sourcesContent": ["import * as ReactNative from 'react-native'\nimport { Image, Text, TextInput } from 'react-native'\n\nimport { createComponent } from './createComponent'\nimport { extendStaticConfig } from './helpers/extendStaticConfig'\nimport {\n GetProps,\n GetVariantProps,\n MediaPropKeys,\n MediaProps,\n PseudoProps,\n PsuedoPropKeys,\n StaticComponent,\n StaticConfig,\n StylableComponent,\n VariantDefinitions,\n} from './types'\n\n// bye bye tree shaking... but only way to properly detect react-native components...\n// also neither rnw nor react support tree shaking atm\nconst RNComponents = new WeakMap()\n// I was looping over all of them, but casuses deprecation warnings and there's only a few\n// we realistically support - lets whitelist rather than blacklist\nfor (const key of ['Image', 'TextInput', 'Text', 'View']) {\n const val = ReactNative[key]\n if (val && typeof val === 'object') {\n RNComponents.set(val, true)\n }\n}\n\nexport function styled<\n ParentComponent extends StylableComponent,\n // = VariantDefinitions<GetProps<ParentComponent>> gives type inference to variants: { true: { ... } }\n // but causes \"Type instantiation is excessively deep and possibly infinite.\"...\n Variants extends VariantDefinitions<any> | symbol =\n | VariantDefinitions<GetProps<ParentComponent>>\n | symbol\n>(\n Component: ParentComponent,\n // this should be Partial<GetProps<ParentComponent>> but causes excessively deep type issues\n options?: GetProps<ParentComponent> & {\n name?: string\n variants?: Variants | undefined\n defaultVariants?: Variants extends Object ? GetVariantProps<Variants> : never\n },\n staticExtractionOptions?: StaticConfig\n) {\n const staticConfigProps = (() => {\n if (options) {\n const { variants, name, defaultVariants, ...defaultProps } = options\n if (defaultVariants) {\n Object.assign(defaultProps, defaultVariants)\n }\n const isReactNativeWeb = RNComponents.has(Component)\n const isTamagui = !isReactNativeWeb && 'staticConfig' in Component\n const Comp = Component as any\n const isImage = !!(defaultProps.isImage || (!isTamagui ? Comp === Image : false))\n const isInput = !!(defaultProps.isInput || (!isTamagui ? Comp === TextInput : false))\n const isText = !!(defaultProps.isText || (!isTamagui ? isInput || Comp === Text : false))\n const conf: StaticConfig = {\n ...staticExtractionOptions,\n ...(!isTamagui && {\n Component: Comp,\n }),\n isTamagui,\n // this type gets messed up by options?: Partial<GetProps<ParentComponent>> above\n // take away the Partial<> and it's fine\n variants,\n defaultProps,\n componentName: name,\n isReactNativeWeb,\n isInput,\n isText,\n isImage,\n }\n return conf\n }\n return {}\n })()\n const config = extendStaticConfig(Component, staticConfigProps)\n const component = createComponent(config!) // error is good here its on init\n\n type ParentProps = GetProps<ParentComponent>\n type VariantProps = Variants extends symbol ? {} : Expand<GetVariantProps<Variants>>\n type VariantKeys = Variants extends symbol ? never : keyof Variants[keyof Variants]\n type ParentPropsWithoutOurVariants = VariantKeys extends never\n ? ParentProps\n : Omit<ParentProps, VariantKeys>\n type StyleProps = VariantProps & ParentPropsWithoutOurVariants\n type Props = Variants extends undefined | symbol\n ? ParentProps\n : Omit<\n ParentProps extends Object ? ParentProps : {},\n (VariantKeys extends never ? ImpossibleKey : VariantKeys) | MediaPropKeys | PsuedoPropKeys\n > &\n VariantProps &\n MediaProps<StyleProps> &\n PseudoProps<StyleProps>\n\n return component as StaticComponent<Props, VariantProps>\n}\n\ntype ImpossibleKey = 1234556123312321\ntype Expand<T> = T extends infer O ? { [K in keyof O]?: O[K] } : never\n"],
5
- "mappings": ";;AAAA;AACA;AAEA;AACA;AAgBA,MAAM,eAAe,oBAAI,QAAQ;AAGjC,WAAW,OAAO,CAAC,SAAS,aAAa,QAAQ,MAAM,GAAG;AACxD,QAAM,MAAM,YAAY;AACxB,MAAI,OAAO,OAAO,QAAQ,UAAU;AAClC,iBAAa,IAAI,KAAK,IAAI;AAAA,EAC5B;AACF;AAEO,gBAQL,WAEA,SAKA,yBACA;AACA,QAAM,oBAAqB,OAAM;AAC/B,QAAI,SAAS;AACX,YAAM,EAAE,UAAU,MAAM,oBAAoB,iBAAiB;AAC7D,UAAI,iBAAiB;AACnB,eAAO,OAAO,cAAc,eAAe;AAAA,MAC7C;AACA,YAAM,mBAAmB,aAAa,IAAI,SAAS;AACnD,YAAM,YAAY,CAAC,oBAAoB,kBAAkB;AACzD,YAAM,OAAO;AACb,YAAM,UAAU,CAAC,CAAE,cAAa,WAAY,EAAC,YAAY,SAAS,QAAQ;AAC1E,YAAM,UAAU,CAAC,CAAE,cAAa,WAAY,EAAC,YAAY,SAAS,YAAY;AAC9E,YAAM,SAAS,CAAC,CAAE,cAAa,UAAW,EAAC,YAAY,WAAW,SAAS,OAAO;AAClF,YAAM,OAAqB;AAAA,WACtB;AAAA,WACC,CAAC,aAAa;AAAA,UAChB,WAAW;AAAA,QACb;AAAA,QACA;AAAA,QAGA;AAAA,QACA;AAAA,QACA,eAAe;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AACA,aAAO;AAAA,IACT;AACA,WAAO,CAAC;AAAA,EACV,GAAG;AACH,QAAM,SAAS,mBAAmB,WAAW,iBAAiB;AAC9D,QAAM,YAAY,gBAAgB,MAAO;AAmBzC,SAAO;AACT;AAtEgB;",
4
+ "sourcesContent": ["import { Image, Text, TextInput } from 'react-native'\n\nimport { createComponent } from './createComponent'\nimport { extendStaticConfig } from './helpers/extendStaticConfig'\nimport { RNComponents } from './helpers/RNComponents'\nimport {\n GetProps,\n GetVariantProps,\n GetVariantValues,\n MediaProps,\n PseudoProps,\n StaticConfig,\n StylableComponent,\n TamaguiComponent,\n VariantDefinitions,\n} from './types'\n\nexport function styled<\n ParentComponent extends StylableComponent,\n // = VariantDefinitions<GetProps<ParentComponent>> gives type inference to variants: { true: { ... } }\n // but causes \"Type instantiation is excessively deep and possibly infinite.\"...\n Variants extends VariantDefinitions<{}> = {}\n>(\n Component: ParentComponent,\n // this should be Partial<GetProps<ParentComponent>> but causes excessively deep type issues\n options?: GetProps<ParentComponent> & {\n name?: string\n variants?: Variants | undefined\n defaultVariants?: Variants extends Object ? GetVariantProps<Variants> : never\n },\n staticExtractionOptions?: StaticConfig\n) {\n const staticConfigProps = (() => {\n if (options) {\n const { variants, name, defaultVariants, ...defaultProps } = options\n if (defaultVariants) {\n Object.assign(defaultProps, defaultVariants)\n }\n const isReactNativeWeb = RNComponents.has(Component)\n const isTamagui = !isReactNativeWeb && 'staticConfig' in Component\n const Comp = Component as any\n const isImage = !!(defaultProps.isImage || (!isTamagui ? Comp === Image : false))\n const isInput = !!(defaultProps.isInput || (!isTamagui ? Comp === TextInput : false))\n const isText = !!(defaultProps.isText || (!isTamagui ? isInput || Comp === Text : false))\n const conf: StaticConfig = {\n ...staticExtractionOptions,\n ...(!isTamagui && {\n Component: Comp,\n }),\n isTamagui,\n // this type gets messed up by options?: Partial<GetProps<ParentComponent>> above\n // take away the Partial<> and it's fine\n variants,\n defaultProps,\n componentName: name,\n isReactNativeWeb,\n isInput,\n isText,\n isImage,\n }\n return conf\n }\n return {}\n })()\n const config = extendStaticConfig(Component, staticConfigProps)\n const component = createComponent(config!) // error is good here its on init\n\n // get parent props without pseudos and medias so we can rebuild both with new variants\n type ParentPropsBase = ParentComponent extends TamaguiComponent<any, any, infer P>\n ? P\n : GetProps<ParentComponent>\n type ParentVariants = ParentComponent extends TamaguiComponent<any, any, any, infer V>\n ? V\n : Object\n\n // sprinkle in our variants\n type OurVariants = Variants extends Object\n ? {\n [Key in keyof Variants]?: GetVariantValues<keyof Variants[Key]>\n }\n : {}\n\n type VariantProps = ParentVariants & OurVariants\n type OurPropsBase = ParentPropsBase & VariantProps\n\n type Props = Variants extends void | symbol\n ? GetProps<ParentComponent>\n : // start with base props\n OurPropsBase &\n // add in media (+ pseudos nested)\n MediaProps<OurPropsBase> &\n // add in pseudos\n PseudoProps<OurPropsBase>\n\n return component as TamaguiComponent<\n Props,\n // TODO infer ref\n any,\n ParentPropsBase,\n ParentVariants & OurVariants\n >\n}\n\n// type Merge<A, B> = Omit<A, keyof B> & B\n// import { Stack } from './views/Stack'\n// export const SizableText = styled(Stack, {\n// name: 'SizableText',\n// backgroundColor: 'red',\n// variants: {\n// size: {\n// '...fontSize': (val, { props }) => {\n// return {\n// backgroundColor: '',\n// }\n// },\n// },\n// },\n// })\n// export const Paragraph = styled(SizableText, {\n// name: 'Paragraph',\n// tag: 'p',\n// // variants: {\n// // another: {\n// // true: {}\n// // }\n// // }\n// })\n// export const Paragraph2 = styled(Paragraph, {\n// name: 'Paragraph',\n// tag: 'p',\n// variants: {\n// another: {\n// true: {\n// color: 'red'\n// },\n// }\n// }\n// })\n// const a = <SizableText size=\"$10\" />\n// const y = <Paragraph2 size=\"$10\" another />\n// export const SizableText2 = styled(SizableText, {\n// })\n// const xx = <SizableText2 abc />\n// export const Paragraph = styled(SizableText, {\n// name: 'Paragraph',\n// })\n// export const Heading = styled(Paragraph, {\n// tag: 'span',\n// margin: 0,\n// })\n// export const H2 = styled(Heading, {\n// name: 'H2',\n// })\n// const x = <H2 color=\"red\" />\n"],
5
+ "mappings": ";;AAAA;AAEA;AACA;AACA;AAaO,gBAML,WAEA,SAKA,yBACA;AACA,QAAM,oBAAqB,OAAM;AAC/B,QAAI,SAAS;AACX,YAAM,EAAE,UAAU,MAAM,oBAAoB,iBAAiB;AAC7D,UAAI,iBAAiB;AACnB,eAAO,OAAO,cAAc,eAAe;AAAA,MAC7C;AACA,YAAM,mBAAmB,aAAa,IAAI,SAAS;AACnD,YAAM,YAAY,CAAC,oBAAoB,kBAAkB;AACzD,YAAM,OAAO;AACb,YAAM,UAAU,CAAC,CAAE,cAAa,WAAY,EAAC,YAAY,SAAS,QAAQ;AAC1E,YAAM,UAAU,CAAC,CAAE,cAAa,WAAY,EAAC,YAAY,SAAS,YAAY;AAC9E,YAAM,SAAS,CAAC,CAAE,cAAa,UAAW,EAAC,YAAY,WAAW,SAAS,OAAO;AAClF,YAAM,OAAqB;AAAA,WACtB;AAAA,WACC,CAAC,aAAa;AAAA,UAChB,WAAW;AAAA,QACb;AAAA,QACA;AAAA,QAGA;AAAA,QACA;AAAA,QACA,eAAe;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AACA,aAAO;AAAA,IACT;AACA,WAAO,CAAC;AAAA,EACV,GAAG;AACH,QAAM,SAAS,mBAAmB,WAAW,iBAAiB;AAC9D,QAAM,YAAY,gBAAgB,MAAO;AA6BzC,SAAO;AAOT;AApFgB;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,8 @@
1
+ .tamagui-absolute-fill {
2
+ position: absolute;
3
+ top: 0;
4
+ left: 0;
5
+ right: 0;
6
+ bottom: 0;
7
+ }
8
+ /*# sourceMappingURL=tamagui-base.css.map */
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/tamagui-base.css"],
4
+ "sourcesContent": [".tamagui-absolute-fill {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n}\n"],
5
+ "mappings": "AAAA;AACE;AACA;AACA;AACA;AACA;AAAA;",
6
+ "names": []
7
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/Stack.tsx"],
4
- "sourcesContent": ["import { View } from 'react-native'\n\nimport { stackDefaultStyles } from '../constants/constants'\nimport { createComponent } from '../createComponent'\nimport { StackProps } from '../types'\n\nexport const Stack = createComponent<StackProps, View>({\n defaultProps: {\n ...stackDefaultStyles,\n flexDirection: 'column',\n },\n})\n\n// test types\n// export const YStack = styled(Stack, {\n// flexDirection: 'column',\n// })\n// // test types\n// const x00 = <Stack missing={0} /> // should err\n// const x0 = <YStack missing={0} /> // should err\n// const x1 = (props: StackProps) => <YStack {...props} />\n// type ys = typeof YStack\n// type ysv = ys extends StaticComponent<any, infer V> ? V : unknown\n"],
5
- "mappings": "AAEA;AACA;AAGO,MAAM,QAAQ,gBAAkC;AAAA,EACrD,cAAc;AAAA,OACT;AAAA,IACH,eAAe;AAAA,EACjB;AACF,CAAC;",
4
+ "sourcesContent": ["import { View } from 'react-native'\n\nimport { stackDefaultStyles } from '../constants/constants'\nimport { createComponent } from '../createComponent'\nimport { StackProps, StackPropsBase } from '../types'\n\nexport const Stack = createComponent<StackProps, View, StackPropsBase>({\n defaultProps: {\n ...stackDefaultStyles,\n flexDirection: 'column',\n },\n})\n\n// test types\n// export const YStack = styled(Stack, {\n// flexDirection: 'column',\n// })\n// // test types\n// const x00 = <Stack missing={0} /> // should err\n// const x0 = <YStack missing={0} /> // should err\n// const x1 = (props: StackProps) => <YStack {...props} />\n// type ys = typeof YStack\n// type ysv = ys extends StaticComponent<any, infer V> ? V : unknown\n"],
5
+ "mappings": "AAEA;AACA;AAGO,MAAM,QAAQ,gBAAkD;AAAA,EACrE,cAAc;AAAA,OACT;AAAA,IACH,eAAe;AAAA,EACjB;AACF,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/Text.tsx"],
4
- "sourcesContent": ["import { stylePropsTextOnly, validStyles } from '@tamagui/helpers'\nimport { Text as TextView } from 'react-native'\n\nimport { isWeb } from '../constants/platform'\nimport { createComponent } from '../createComponent'\nimport { TextProps } from '../types'\n\nconst ellipseStyle = {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}\n\nexport const Text = createComponent<TextProps, TextView>({\n isText: true,\n defaultProps: {\n display: isWeb ? 'inline' : 'flex',\n boxSizing: 'border-box',\n fontFamily: 'System',\n wordWrap: 'break-word',\n },\n variants: {\n numberOfLines: {\n 1: ellipseStyle,\n // TODO imply fn, test 1, could do types `>1` `<2`\n ':number': (lines) => (lines > 1 ? { WebkitLineClamp: 1 } : null),\n },\n\n selectable: {\n true: {\n userSelect: 'text',\n cursor: 'text',\n },\n false: {\n userSelect: 'none',\n },\n },\n\n pressable: {\n true: {\n cursor: 'pointer',\n },\n },\n\n ellipse: {\n true: isWeb\n ? ellipseStyle\n : {\n numberOfLines: 1,\n lineBreakMode: 'clip',\n },\n },\n },\n deoptProps: new Set(isWeb ? [] : ['ellipse']),\n validStyles: {\n ...validStyles,\n ...stylePropsTextOnly,\n ...(isWeb && {\n userSelect: true,\n textOverflow: true,\n whiteSpace: true,\n wordWrap: true,\n selectable: true,\n cursor: true,\n }),\n },\n})\n"],
5
- "mappings": "AAAA;AAGA;AACA;AAGA,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AACd;AAEO,MAAM,OAAO,gBAAqC;AAAA,EACvD,QAAQ;AAAA,EACR,cAAc;AAAA,IACZ,SAAS,QAAQ,WAAW;AAAA,IAC5B,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AAAA,EACA,UAAU;AAAA,IACR,eAAe;AAAA,MACb,GAAG;AAAA,MAEH,WAAW,CAAC,UAAW,QAAQ,IAAI,EAAE,iBAAiB,EAAE,IAAI;AAAA,IAC9D;AAAA,IAEA,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,MACA,OAAO;AAAA,QACL,YAAY;AAAA,MACd;AAAA,IACF;AAAA,IAEA,WAAW;AAAA,MACT,MAAM;AAAA,QACJ,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IAEA,SAAS;AAAA,MACP,MAAM,QACF,eACA;AAAA,QACE,eAAe;AAAA,QACf,eAAe;AAAA,MACjB;AAAA,IACN;AAAA,EACF;AAAA,EACA,YAAY,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;AAAA,EAC5C,aAAa;AAAA,OACR;AAAA,OACA;AAAA,OACC,SAAS;AAAA,MACX,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,QAAQ;AAAA,IACV;AAAA,EACF;AACF,CAAC;",
4
+ "sourcesContent": ["import { stylePropsTextOnly, validStyles } from '@tamagui/helpers'\nimport { Text as TextView } from 'react-native'\n\nimport { isWeb } from '../constants/platform'\nimport { createComponent } from '../createComponent'\nimport { TextProps, TextPropsBase } from '../types'\n\nconst ellipseStyle = {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}\n\nexport const Text = createComponent<TextProps, TextView, TextPropsBase>({\n isText: true,\n defaultProps: {\n display: isWeb ? 'inline' : 'flex',\n boxSizing: 'border-box',\n fontFamily: 'System',\n wordWrap: 'break-word',\n },\n variants: {\n numberOfLines: {\n 1: ellipseStyle,\n // TODO imply fn, test 1, could do types `>1` `<2`\n ':number': (lines) => (lines > 1 ? { WebkitLineClamp: 1 } : null),\n },\n\n selectable: {\n true: {\n userSelect: 'text',\n cursor: 'text',\n },\n false: {\n userSelect: 'none',\n },\n },\n\n pressable: {\n true: {\n cursor: 'pointer',\n },\n },\n\n ellipse: {\n true: isWeb\n ? ellipseStyle\n : {\n numberOfLines: 1,\n lineBreakMode: 'clip',\n },\n },\n },\n deoptProps: new Set(isWeb ? [] : ['ellipse']),\n validStyles: {\n ...validStyles,\n ...stylePropsTextOnly,\n ...(isWeb && {\n userSelect: true,\n textOverflow: true,\n whiteSpace: true,\n wordWrap: true,\n selectable: true,\n cursor: true,\n }),\n },\n})\n"],
5
+ "mappings": "AAAA;AAGA;AACA;AAGA,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AACd;AAEO,MAAM,OAAO,gBAAoD;AAAA,EACtE,QAAQ;AAAA,EACR,cAAc;AAAA,IACZ,SAAS,QAAQ,WAAW;AAAA,IAC5B,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AAAA,EACA,UAAU;AAAA,IACR,eAAe;AAAA,MACb,GAAG;AAAA,MAEH,WAAW,CAAC,UAAW,QAAQ,IAAI,EAAE,iBAAiB,EAAE,IAAI;AAAA,IAC9D;AAAA,IAEA,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,MACA,OAAO;AAAA,QACL,YAAY;AAAA,MACd;AAAA,IACF;AAAA,IAEA,WAAW;AAAA,MACT,MAAM;AAAA,QACJ,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IAEA,SAAS;AAAA,MACP,MAAM,QACF,eACA;AAAA,QACE,eAAe;AAAA,QACf,eAAe;AAAA,MACjB;AAAA,IACN;AAAA,EACF;AAAA,EACA,YAAY,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;AAAA,EAC5C,aAAa;AAAA,OACR;AAAA,OACA;AAAA,OACC,SAAS;AAAA,MACX,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,QAAQ;AAAA,IACV;AAAA,EACF;AACF,CAAC;",
6
6
  "names": []
7
7
  }
@@ -17,7 +17,10 @@ const Theme = memo(/* @__PURE__ */ __name(function Theme2(props) {
17
17
  const contents = useMemo(() => wrapThemeManagerContext(props.children, themeManager), [props.children, themeManager]);
18
18
  if (isWeb) {
19
19
  return /* @__PURE__ */ React.createElement("div", {
20
- className: props.disableThemeClass ? "" : props.className ? `${className || ""} ${props.className || ""}` : className || "",
20
+ className: [
21
+ `tui_Theme`,
22
+ ...!props.disableThemeClass ? [props.className, className].filter(Boolean) : []
23
+ ].join(" "),
21
24
  style: {
22
25
  display: "contents",
23
26
  color: (_b = (_a = themes[name]) == null ? void 0 : _a.color) == null ? void 0 : _b.toString()
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/Theme.tsx"],
4
- "sourcesContent": ["import React, { memo, useMemo } from 'react'\n\nimport { isWeb } from '../constants/platform'\nimport { wrapThemeManagerContext } from '../helpers/wrapThemeManagerContext'\nimport { useChangeThemeEffect } from '../static'\nimport { ThemeName } from '../types'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport type ThemeProps = {\n className?: string\n disableThemeClass?: boolean\n name: Exclude<ThemeName, number> | null\n children?: any\n debug?: boolean\n}\n\nexport const Theme = memo(function Theme(props: ThemeProps) {\n const { name, theme, themeManager, themes, className } = useChangeThemeEffect(\n props.name,\n undefined,\n props\n )\n\n if (!themes || !name || !theme) {\n if (name && !theme && process.env.NODE_ENV === 'development') {\n console.warn(`No theme found by name ${name}`)\n }\n return props.children\n }\n\n // memo here, changing theme without re-rendering all children is a critical optimization\n // may require some effort of end user to memoize but without this memo they'd have no option\n const contents = useMemo(\n () => wrapThemeManagerContext(props.children, themeManager),\n [props.children, themeManager]\n )\n\n if (isWeb) {\n return (\n <div\n className={\n props.disableThemeClass\n ? ''\n : props.className\n ? `${className || ''} ${props.className || ''}`\n : className || ''\n }\n style={{\n display: 'contents',\n // in order to provide currentColor, set color by default\n color: themes[name]?.color?.toString(),\n }}\n >\n {contents}\n </div>\n )\n }\n\n return contents\n})\n"],
5
- "mappings": ";;AAAA;AAEA;AACA;AACA;AAIA,MAAM;AAUC,MAAM,QAAQ,KAAK,uCAAe,OAAmB;AAlB5D;AAmBE,QAAM,EAAE,MAAM,OAAO,cAAc,QAAQ,cAAc,qBACvD,MAAM,MACN,QACA,KACF;AAEA,MAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO;AAC9B,QAAI,QAAQ,CAAC,SAAS,QAAQ,IAAI,aAAa,eAAe;AAC5D,cAAQ,KAAK,0BAA0B,MAAM;AAAA,IAC/C;AACA,WAAO,MAAM;AAAA,EACf;AAIA,QAAM,WAAW,QACf,MAAM,wBAAwB,MAAM,UAAU,YAAY,GAC1D,CAAC,MAAM,UAAU,YAAY,CAC/B;AAEA,MAAI,OAAO;AACT,WACE,oCAAC;AAAA,MACC,WACE,MAAM,oBACF,KACA,MAAM,YACN,GAAG,aAAa,MAAM,MAAM,aAAa,OACzC,aAAa;AAAA,MAEnB,OAAO;AAAA,QACL,SAAS;AAAA,QAET,OAAO,mBAAO,UAAP,mBAAc,UAAd,mBAAqB;AAAA,MAC9B;AAAA,OAEC,QACH;AAAA,EAEJ;AAEA,SAAO;AACT,GA3C0B,QA2CzB;",
4
+ "sourcesContent": ["import React, { memo, useMemo } from 'react'\n\nimport { isWeb } from '../constants/platform'\nimport { wrapThemeManagerContext } from '../helpers/wrapThemeManagerContext'\nimport { useChangeThemeEffect } from '../static'\nimport { ThemeName } from '../types'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport type ThemeProps = {\n className?: string\n disableThemeClass?: boolean\n name: Exclude<ThemeName, number> | null\n children?: any\n debug?: boolean\n}\n\nexport const Theme = memo(function Theme(props: ThemeProps) {\n const { name, theme, themeManager, themes, className } = useChangeThemeEffect(\n props.name,\n undefined,\n props\n )\n\n if (!themes || !name || !theme) {\n if (name && !theme && process.env.NODE_ENV === 'development') {\n console.warn(`No theme found by name ${name}`)\n }\n return props.children\n }\n\n // memo here, changing theme without re-rendering all children is a critical optimization\n // may require some effort of end user to memoize but without this memo they'd have no option\n const contents = useMemo(\n () => wrapThemeManagerContext(props.children, themeManager),\n [props.children, themeManager]\n )\n\n if (isWeb) {\n return (\n <div\n className={[\n `tui_Theme`,\n ...(!props.disableThemeClass ? [props.className, className].filter(Boolean) : []),\n ].join(' ')}\n style={{\n display: 'contents',\n // in order to provide currentColor, set color by default\n color: themes[name]?.color?.toString(),\n }}\n >\n {contents}\n </div>\n )\n }\n\n return contents\n})\n"],
5
+ "mappings": ";;AAAA;AAEA;AACA;AACA;AAIA,MAAM;AAUC,MAAM,QAAQ,KAAK,uCAAe,OAAmB;AAlB5D;AAmBE,QAAM,EAAE,MAAM,OAAO,cAAc,QAAQ,cAAc,qBACvD,MAAM,MACN,QACA,KACF;AAEA,MAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO;AAC9B,QAAI,QAAQ,CAAC,SAAS,QAAQ,IAAI,aAAa,eAAe;AAC5D,cAAQ,KAAK,0BAA0B,MAAM;AAAA,IAC/C;AACA,WAAO,MAAM;AAAA,EACf;AAIA,QAAM,WAAW,QACf,MAAM,wBAAwB,MAAM,UAAU,YAAY,GAC1D,CAAC,MAAM,UAAU,YAAY,CAC/B;AAEA,MAAI,OAAO;AACT,WACE,oCAAC;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,GAAI,CAAC,MAAM,oBAAoB,CAAC,MAAM,WAAW,SAAS,EAAE,OAAO,OAAO,IAAI,CAAC;AAAA,MACjF,EAAE,KAAK,GAAG;AAAA,MACV,OAAO;AAAA,QACL,SAAS;AAAA,QAET,OAAO,mBAAO,UAAP,mBAAc,UAAd,mBAAqB;AAAA,MAC9B;AAAA,OAEC,QACH;AAAA,EAEJ;AAEA,SAAO;AACT,GAxC0B,QAwCzB;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,17 @@
1
+ const pseudos = {
2
+ focusStyle: {
3
+ name: "focus",
4
+ priority: 3
5
+ },
6
+ pressStyle: {
7
+ name: "active",
8
+ priority: 2
9
+ },
10
+ hoverStyle: {
11
+ name: "hover",
12
+ priority: 1
13
+ }
14
+ };
15
+ export {
16
+ pseudos
17
+ };
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
  import { stylePropsView } from "@tamagui/helpers";
4
4
  import { useForceUpdate } from "@tamagui/use-force-update";
5
- import {
5
+ import React, {
6
6
  Children,
7
7
  Fragment,
8
8
  createElement,
@@ -20,16 +20,26 @@ import { stackDefaultStyles } from "./constants/constants";
20
20
  import { isAndroid, isTouchDevice, isWeb } from "./constants/platform";
21
21
  import { rnw } from "./constants/rnw";
22
22
  import { isVariable } from "./createVariable";
23
- import { defaultComponentState } from "./defaultComponentState";
23
+ import { createShallowUpdate } from "./helpers/createShallowUpdate";
24
24
  import { extendStaticConfig, parseStaticConfig } from "./helpers/extendStaticConfig";
25
25
  import {
26
26
  getSplitStyles
27
27
  } from "./helpers/getSplitStyles";
28
+ import { getAllSelectors } from "./helpers/insertStyleRule";
28
29
  import { wrapThemeManagerContext } from "./helpers/wrapThemeManagerContext";
29
30
  import { useFeatures } from "./hooks/useFeatures";
30
31
  import { usePressable } from "./hooks/usePressable";
31
32
  import { getThemeManagerIfChanged, useTheme } from "./hooks/useTheme";
32
33
  import { TextAncestorContext } from "./views/TextAncestorContext";
34
+ React["keep"];
35
+ const defaultComponentState = {
36
+ hover: false,
37
+ press: false,
38
+ pressIn: false,
39
+ focus: false,
40
+ mounted: false,
41
+ animation: null
42
+ };
33
43
  const mouseUps = /* @__PURE__ */ new Set();
34
44
  if (typeof document !== "undefined") {
35
45
  document.addEventListener("mouseup", () => {
@@ -37,19 +47,6 @@ if (typeof document !== "undefined") {
37
47
  mouseUps.clear();
38
48
  });
39
49
  }
40
- function createShallowUpdate(setter) {
41
- return (next) => {
42
- setter((prev) => {
43
- for (const key in next) {
44
- if (prev[key] !== next[key]) {
45
- return { ...prev, ...next };
46
- }
47
- }
48
- return prev;
49
- });
50
- };
51
- }
52
- __name(createShallowUpdate, "createShallowUpdate");
53
50
  function createComponent(configIn) {
54
51
  let staticConfig;
55
52
  if ("parsed" in configIn) {
@@ -63,13 +60,13 @@ function createComponent(configIn) {
63
60
  let tamaguiConfig;
64
61
  let AnimatedText;
65
62
  let AnimatedView;
66
- let avoidClasses = false;
63
+ let avoidClasses = true;
67
64
  let defaultPseudos = {};
68
65
  let defaultNativeStyle;
69
66
  let defaultNativeStyleSheet = null;
70
67
  let defaultsClassName = null;
71
68
  let initialTheme;
72
- let splitStyleResult = null;
69
+ let defaultSplitStyleResult = null;
73
70
  function addPseudoToStyles(styles, name, pseudos) {
74
71
  const pseudoStyle = pseudos[name];
75
72
  if (pseudoStyle) {
@@ -94,12 +91,13 @@ function createComponent(configIn) {
94
91
  const theme = useTheme(props.theme, componentName, props, forceUpdate);
95
92
  const [state, set_] = useState(defaultComponentState);
96
93
  const setStateShallow = createShallowUpdate(set_);
97
- const shouldAvoidClasses = !!(state.animation && avoidClasses);
98
- const splitInfo = getSplitStyles(props, staticConfig, theme, shouldAvoidClasses ? { ...state, noClassNames: true, resolveVariablesAs: "value" } : state, defaultsClassName);
99
- const { viewProps: viewPropsIn, pseudos, medias, style, classNames } = splitInfo;
94
+ const shouldAvoidClasses = !!(props.animation && avoidClasses);
95
+ const splitStyles = getSplitStyles(props, staticConfig, theme, shouldAvoidClasses ? { ...state, noClassNames: true, resolveVariablesAs: "value" } : state, shouldAvoidClasses ? null : defaultsClassName);
96
+ const { viewProps: viewPropsIn, pseudos, medias, style, classNames } = splitStyles;
100
97
  const useAnimations = (_a = tamaguiConfig.animations) == null ? void 0 : _a.useAnimations;
101
98
  const isAnimated = !!(useAnimations && props.animation);
102
- const styleWithPseudos = props.animation ? merge({ ...defaultNativeStyle, ...style }, state.hover && pseudos.hoverStyle, state.press && pseudos.pressStyle, state.focus && pseudos.focusStyle, ...Object.values(medias)) : null;
99
+ const hasEnterStyle = !!props.enterStyle;
100
+ const styleWithPseudos = props.animation ? merge({ ...defaultNativeStyle, ...style }, state.hover && pseudos.hoverStyle, state.press && pseudos.pressStyle, state.focus && pseudos.focusStyle, hasEnterStyle && !state.mounted && pseudos.enterStyle, ...Object.values(medias)) : null;
103
101
  const features = useFeatures(props, {
104
102
  forceUpdate,
105
103
  setStateShallow,
@@ -160,7 +158,6 @@ function createComponent(configIn) {
160
158
  }
161
159
  const hasTextAncestor = isWeb ? useContext(TextAncestorContext) : false;
162
160
  const hostRef = useRef(null);
163
- const hasEnterStyle = !!props.enterStyle;
164
161
  const internal = useRef();
165
162
  if (!internal.current) {
166
163
  internal.current = {
@@ -254,10 +251,11 @@ function createComponent(configIn) {
254
251
  const className = classList.join(" ");
255
252
  if (process.env.NODE_ENV === "development") {
256
253
  if (props["debug"]) {
257
- console.log(" \xBB className", { isStringElement, pseudos, state, defaultsClassName, classNames, propsClassName: props.className, style, classList, className: className.trim().split(" "), themeClassName: theme.className });
254
+ console.log(" \xBB className", { isStringElement, pseudos, state, defaultsClassName, classNames, propsClassName: props.className, style, classList, className: className.trim().split(" "), themeClassName: theme.className, values: Object.fromEntries(Object.entries(classNames).map(([k, v]) => [v, getAllSelectors()[v]])) });
258
255
  }
259
256
  }
260
257
  viewProps.className = className;
258
+ viewProps.style = animationStyles;
261
259
  } else {
262
260
  viewProps.style = styles;
263
261
  }
@@ -377,18 +375,6 @@ function createComponent(configIn) {
377
375
  } : {
378
376
  disabled: true
379
377
  });
380
- if (events) {
381
- if (!isStringElement) {
382
- Object.assign(viewProps, pressProps);
383
- } else {
384
- Object.assign(viewProps, events);
385
- }
386
- if (isWeb && isHoverable) {
387
- childEls = <span style={{
388
- display: "contents"
389
- }} onMouseEnter={events.onMouseEnter} onMouseLeave={events.onMouseLeave}>{children}</span>;
390
- }
391
- }
392
378
  let content;
393
379
  if (isWeb) {
394
380
  if (staticConfig.isReactNativeWeb) {
@@ -405,11 +391,23 @@ function createComponent(configIn) {
405
391
  }
406
392
  }
407
393
  }
394
+ if (events) {
395
+ if (!isStringElement) {
396
+ Object.assign(viewProps, pressProps);
397
+ } else {
398
+ Object.assign(viewProps, events);
399
+ }
400
+ }
408
401
  content = createElement(ViewComponent, viewProps, childEls);
402
+ if (isWeb && events && attachHover) {
403
+ content = <span className="tui_Hoverable" style={{
404
+ display: "contents"
405
+ }} onMouseEnter={events.onMouseEnter} onMouseLeave={events.onMouseLeave}>{content}</span>;
406
+ }
409
407
  if (process.env.NODE_ENV === "development") {
410
408
  if (props["debug"]) {
411
409
  viewProps["debug"] = true;
412
- console.log(" \xBB ", { propsIn: { ...props }, propsOut: { ...viewProps }, animationStyles, isStringElement, classNamesIn: (_c = props.className) == null ? void 0 : _c.split(" "), classNamesOut: (_d = viewProps.className) == null ? void 0 : _d.split(" "), pressProps, events, shouldAttach, ViewComponent, viewProps, state, styles, pseudos, content, childEls, shouldAvoidClasses, animation: props.animation, style, defaultNativeStyle, splitStyleResult, ...typeof window !== "undefined" ? { theme, themeState: theme.__state, themeClassName: theme.className, staticConfig, tamaguiConfig } : null });
410
+ console.log(" \xBB ", { propsIn: { ...props }, propsOut: { ...viewProps }, state, styleWithPseudos, splitStyles, defaultsClassName, animationStyles, isStringElement, classNamesIn: (_c = props.className) == null ? void 0 : _c.split(" "), classNamesOut: (_d = viewProps.className) == null ? void 0 : _d.split(" "), pressProps, events, shouldAttach, ViewComponent, viewProps, styles, pseudos, content, childEls, shouldAvoidClasses, avoidClasses, animation: props.animation, style, defaultNativeStyle, defaultSplitStyleResult, ...typeof window !== "undefined" ? { theme, themeState: theme.__state, themeClassName: theme.className, staticConfig, tamaguiConfig } : null });
413
411
  }
414
412
  }
415
413
  if (features.length) {
@@ -428,11 +426,11 @@ function createComponent(configIn) {
428
426
  AnimatedText = (_c = tamaguiConfig.animations) == null ? void 0 : _c.Text;
429
427
  AnimatedView = (_d = tamaguiConfig == null ? void 0 : tamaguiConfig.animations) == null ? void 0 : _d.View;
430
428
  initialTheme = conf.themes[conf.defaultTheme || Object.keys(conf.themes)[0]];
431
- splitStyleResult = getSplitStyles(staticConfig.defaultProps, staticConfig, initialTheme, {
429
+ defaultSplitStyleResult = getSplitStyles(staticConfig.defaultProps, staticConfig, initialTheme, {
432
430
  mounted: true,
433
- resolveVariablesAs: "variable"
431
+ resolveVariablesAs: "both"
434
432
  });
435
- const { classNames, pseudos, style, viewProps } = splitStyleResult;
433
+ const { classNames, pseudos, style, viewProps } = defaultSplitStyleResult;
436
434
  if (isWeb) {
437
435
  defaultsClassName = classNames;
438
436
  }
@@ -451,7 +449,7 @@ function createComponent(configIn) {
451
449
  ...component.defaultProps
452
450
  };
453
451
  if (process.env.NODE_ENV === "development" && shouldDebug && process.env.IS_STATIC !== "is_static") {
454
- console.log(`\u{1F41B} [${staticConfig.componentName || "Component"}]`, { staticConfig, ...splitStyleResult });
452
+ console.log(`\u{1F41B} [${staticConfig.componentName || "Component"}]`, { staticConfig, ...defaultSplitStyleResult });
455
453
  }
456
454
  });
457
455
  let res = component;
@@ -593,6 +591,7 @@ export {
593
591
  AbsoluteFill,
594
592
  Spacer,
595
593
  createComponent,
594
+ defaultComponentState,
596
595
  mouseUps,
597
596
  spacedChildren
598
597
  };
File without changes
@@ -1,11 +0,0 @@
1
- const defaultComponentState = {
2
- hover: false,
3
- press: false,
4
- pressIn: false,
5
- focus: false,
6
- mounted: false,
7
- animation: null
8
- };
9
- export {
10
- defaultComponentState
11
- };
@@ -0,0 +1,13 @@
1
+ import { onConfiguredOnce } from "./conf";
2
+ import { insertedSelectors } from "./helpers/insertStyleRule";
3
+ onConfiguredOnce((conf) => {
4
+ if (globalThis["Tamagui"]) {
5
+ return;
6
+ }
7
+ globalThis["Tamagui"] = {
8
+ ...conf,
9
+ get insertedCSS() {
10
+ return insertedSelectors;
11
+ }
12
+ };
13
+ });
@@ -0,0 +1,11 @@
1
+ import * as ReactNative from "react-native";
2
+ const RNComponents = /* @__PURE__ */ new WeakMap();
3
+ for (const key of ["Image", "TextInput", "Text", "View"]) {
4
+ const val = ReactNative[key];
5
+ if (val && typeof val === "object") {
6
+ RNComponents.set(val, true);
7
+ }
8
+ }
9
+ export {
10
+ RNComponents
11
+ };
@@ -13,6 +13,8 @@ const createMediaStyle = /* @__PURE__ */ __name(({ identifier, rules }, mediaKey
13
13
  const mediaSelector = mediaObjectToString(mediaQueries[mediaKey]);
14
14
  const mediaQuery = `${screenStr} and ${mediaSelector}`;
15
15
  const styleInner = rules[0].replace(identifier, nextIdentifier);
16
+ if (styleInner.includes("2:r;"))
17
+ debugger;
16
18
  let styleRule = "";
17
19
  if (styleInner.includes("@media")) {
18
20
  styleRule = styleInner.replace("{", ` and ${mediaQuery} {`);
@@ -0,0 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ function createShallowUpdate(setter) {
4
+ return (next) => {
5
+ setter((prev) => {
6
+ for (const key in next) {
7
+ if (prev[key] !== next[key]) {
8
+ return { ...prev, ...next };
9
+ }
10
+ }
11
+ return prev;
12
+ });
13
+ };
14
+ }
15
+ __name(createShallowUpdate, "createShallowUpdate");
16
+ export {
17
+ createShallowUpdate
18
+ };
@@ -10,7 +10,6 @@ function createTamaguiProvider({
10
10
  }) {
11
11
  return /* @__PURE__ */ __name(function TamaguiProvider({
12
12
  injectCSS,
13
- fallback,
14
13
  children,
15
14
  ...themePropsProvider
16
15
  }) {
@@ -26,7 +25,7 @@ function createTamaguiProvider({
26
25
  };
27
26
  }, []);
28
27
  }
29
- return <ButtonInsideButtonContext.Provider value={false}><TextAncestorProvider><ThemeProvider {...themeProps} {...themePropsProvider}><React.Suspense fallback={fallback || null}>{children}</React.Suspense></ThemeProvider></TextAncestorProvider></ButtonInsideButtonContext.Provider>;
28
+ return <ButtonInsideButtonContext.Provider value={false}><TextAncestorProvider><ThemeProvider {...themeProps} {...themePropsProvider}>{children}</ThemeProvider></TextAncestorProvider></ButtonInsideButtonContext.Provider>;
30
29
  }, "TamaguiProvider");
31
30
  }
32
31
  __name(createTamaguiProvider, "createTamaguiProvider");
@@ -34,7 +34,6 @@ function normalizeStyleObject(style) {
34
34
  }
35
35
  __name(normalizeStyleObject, "normalizeStyleObject");
36
36
  const getSplitStyles = /* @__PURE__ */ __name((props, staticConfig, theme, state, defaultClassNames) => {
37
- var _a, _b, _c;
38
37
  const validStyleProps = staticConfig.isText ? stylePropsText : validStyles;
39
38
  const viewProps = {};
40
39
  const style = {};
@@ -79,7 +78,8 @@ const getSplitStyles = /* @__PURE__ */ __name((props, staticConfig, theme, state
79
78
  style[atomicStyle.property] = atomicStyle.value;
80
79
  }
81
80
  }
82
- } else {
81
+ }
82
+ if (state.noClassNames || state.resolveVariablesAs === "value" || state.resolveVariablesAs === "both") {
83
83
  for (const key in cur) {
84
84
  if (key in stylePropsTransform) {
85
85
  mergeTransform(style, key, cur[key]);
@@ -111,6 +111,9 @@ const getSplitStyles = /* @__PURE__ */ __name((props, staticConfig, theme, state
111
111
  let isPseudo = validPseudoKeys[keyInit];
112
112
  const out = isMedia || isPseudo ? true : staticConfig.propMapper(keyInit, valInit, theme, props, staticConfig, state.resolveVariablesAs);
113
113
  const expanded = out === true || !out ? [[keyInit, valInit]] : Object.entries(out);
114
+ if (process.env.NODE_ENV === "development" && props["debug"] === "verbose") {
115
+ console.log("split style", keyInit, expanded);
116
+ }
114
117
  for (const [key, val] of expanded) {
115
118
  if (val === void 0) {
116
119
  continue;
@@ -134,9 +137,6 @@ const getSplitStyles = /* @__PURE__ */ __name((props, staticConfig, theme, state
134
137
  pseudos[key] = getSubStyle(val, staticConfig, theme, props, state.resolveVariablesAs, true);
135
138
  if (isWeb && !state.noClassNames) {
136
139
  const pseudoStyles = getStylesAtomic({ [key]: pseudos[key] });
137
- if ((_b = (_a = pseudoStyles[0]) == null ? void 0 : _a.identifier) == null ? void 0 : _b.includes("undefined")) {
138
- console.warn("undefined bug?", (_c = pseudoStyles[0]) == null ? void 0 : _c.identifier);
139
- }
140
140
  for (const style2 of pseudoStyles) {
141
141
  mergeClassName(`${style2.property}-${key}`, style2.identifier);
142
142
  insertStyleRule(style2.identifier, style2.rules[0]);
@@ -147,10 +147,10 @@ const getSplitStyles = /* @__PURE__ */ __name((props, staticConfig, theme, state
147
147
  if (isMedia) {
148
148
  const mediaKey = key.slice(1);
149
149
  if (!mediaQueryConfig[mediaKey]) {
150
- viewProps[key] = valInit;
150
+ viewProps[key] = val;
151
151
  continue;
152
152
  }
153
- const mediaStyle = getSubStyle(valInit, staticConfig, theme, props, state.resolveVariablesAs, true);
153
+ const mediaStyle = getSubStyle(val, staticConfig, theme, props, state.resolveVariablesAs, true);
154
154
  if (isWeb) {
155
155
  const mediaStyles = getStylesAtomic(mediaStyle);
156
156
  for (const style2 of mediaStyles) {
@@ -33,17 +33,18 @@ function updateInserted() {
33
33
  for (let i = 0; i < sheets.length; i++) {
34
34
  const rules = sheets[i].cssRules;
35
35
  const firstRule = rules[0];
36
- if (!firstRule)
36
+ if (!(firstRule instanceof CSSStyleRule))
37
37
  continue;
38
- const firstSelector = firstRule["selectorText"];
38
+ const firstSelector = firstRule.selectorText;
39
39
  if (!firstSelector)
40
40
  continue;
41
41
  if (firstSelector === ":root" || firstSelector.startsWith("._")) {
42
- for (const rule of rules) {
43
- if (!rule.selectorText)
42
+ for (let i2 = 0; i2 < rules.length; i2++) {
43
+ const rule = rules.item(i2);
44
+ if (!(rule instanceof CSSStyleRule))
44
45
  continue;
45
46
  const identifier = rule.selectorText.slice(1);
46
- allSelectors[identifier] = true;
47
+ allSelectors[identifier] = process.env.NODE_ENV === "development" ? rule.cssText : true;
47
48
  if (identifier.startsWith("_transform")) {
48
49
  addTransform(identifier, rule.cssText);
49
50
  }