@tamagui/core 1.0.1-beta.61 → 1.0.1-beta.64

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 (88) hide show
  1. package/dist/cjs/createComponent.js +35 -15
  2. package/dist/cjs/createComponent.js.map +2 -2
  3. package/dist/cjs/helpers/createMediaStyle.js +1 -1
  4. package/dist/cjs/helpers/createMediaStyle.js.map +2 -2
  5. package/dist/cjs/helpers/createPropMapper.js +46 -18
  6. package/dist/cjs/helpers/createPropMapper.js.map +2 -2
  7. package/dist/cjs/helpers/extendStaticConfig.js +2 -1
  8. package/dist/cjs/helpers/extendStaticConfig.js.map +2 -2
  9. package/dist/cjs/helpers/generateAtomicStyles.js +30 -23
  10. package/dist/cjs/helpers/generateAtomicStyles.js.map +2 -2
  11. package/dist/cjs/helpers/getSplitStyles.js +29 -14
  12. package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
  13. package/dist/cjs/helpers/getStylesAtomic.js +7 -21
  14. package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
  15. package/dist/cjs/helpers/insertStyleRule.js +2 -1
  16. package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
  17. package/dist/cjs/helpers/mergeProps.js +40 -0
  18. package/dist/cjs/helpers/mergeProps.js.map +7 -0
  19. package/dist/cjs/helpers/pseudos.js +41 -0
  20. package/dist/cjs/helpers/pseudos.js.map +7 -0
  21. package/dist/cjs/helpers/themeable.js +2 -2
  22. package/dist/cjs/helpers/themeable.js.map +2 -2
  23. package/dist/cjs/index.js +5 -0
  24. package/dist/cjs/index.js.map +2 -2
  25. package/dist/cjs/static.js +2 -0
  26. package/dist/cjs/static.js.map +2 -2
  27. package/dist/cjs/types.js.map +1 -1
  28. package/dist/esm/createComponent.js +36 -18
  29. package/dist/esm/createComponent.js.map +2 -2
  30. package/dist/esm/helpers/createMediaStyle.js +1 -1
  31. package/dist/esm/helpers/createMediaStyle.js.map +2 -2
  32. package/dist/esm/helpers/createPropMapper.js +44 -17
  33. package/dist/esm/helpers/createPropMapper.js.map +2 -2
  34. package/dist/esm/helpers/extendStaticConfig.js +5 -3
  35. package/dist/esm/helpers/extendStaticConfig.js.map +2 -2
  36. package/dist/esm/helpers/generateAtomicStyles.js +30 -23
  37. package/dist/esm/helpers/generateAtomicStyles.js.map +2 -2
  38. package/dist/esm/helpers/getSplitStyles.js +29 -14
  39. package/dist/esm/helpers/getSplitStyles.js.map +2 -2
  40. package/dist/esm/helpers/getStylesAtomic.js +6 -19
  41. package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
  42. package/dist/esm/helpers/insertStyleRule.js +2 -1
  43. package/dist/esm/helpers/insertStyleRule.js.map +2 -2
  44. package/dist/esm/helpers/mergeProps.js +18 -0
  45. package/dist/esm/helpers/mergeProps.js.map +7 -0
  46. package/dist/esm/helpers/pseudos.js +18 -0
  47. package/dist/esm/helpers/pseudos.js.map +7 -0
  48. package/dist/esm/helpers/themeable.js +2 -1
  49. package/dist/esm/helpers/themeable.js.map +2 -2
  50. package/dist/esm/index.js +4 -0
  51. package/dist/esm/index.js.map +2 -2
  52. package/dist/esm/static.js +2 -0
  53. package/dist/esm/static.js.map +2 -2
  54. package/dist/jsx/createComponent.js +32 -13
  55. package/dist/jsx/helpers/createMediaStyle.js +1 -1
  56. package/dist/jsx/helpers/createPropMapper.js +44 -17
  57. package/dist/jsx/helpers/extendStaticConfig.js +5 -3
  58. package/dist/jsx/helpers/generateAtomicStyles.js +30 -23
  59. package/dist/jsx/helpers/getSplitStyles.js +29 -14
  60. package/dist/jsx/helpers/getStylesAtomic.js +6 -19
  61. package/dist/jsx/helpers/insertStyleRule.js +2 -1
  62. package/dist/jsx/helpers/mergeProps.js +17 -0
  63. package/dist/jsx/helpers/pseudos.js +17 -0
  64. package/dist/jsx/helpers/themeable.js +2 -1
  65. package/dist/jsx/index.js +4 -0
  66. package/dist/jsx/static.js +2 -0
  67. package/package.json +5 -5
  68. package/types/createComponent.d.ts.map +1 -1
  69. package/types/helpers/createPropMapper.d.ts +3 -2
  70. package/types/helpers/createPropMapper.d.ts.map +1 -1
  71. package/types/helpers/extendStaticConfig.d.ts.map +1 -1
  72. package/types/helpers/generateAtomicStyles.d.ts.map +1 -1
  73. package/types/helpers/getSplitStyles.d.ts +2 -2
  74. package/types/helpers/getSplitStyles.d.ts.map +1 -1
  75. package/types/helpers/getStylesAtomic.d.ts +0 -14
  76. package/types/helpers/getStylesAtomic.d.ts.map +1 -1
  77. package/types/helpers/insertStyleRule.d.ts.map +1 -1
  78. package/types/helpers/mergeProps.d.ts +2 -0
  79. package/types/helpers/mergeProps.d.ts.map +1 -0
  80. package/types/helpers/pseudos.d.ts +15 -0
  81. package/types/helpers/pseudos.d.ts.map +1 -0
  82. package/types/helpers/themeable.d.ts.map +1 -1
  83. package/types/index.d.ts +3 -0
  84. package/types/index.d.ts.map +1 -1
  85. package/types/static.d.ts +2 -0
  86. package/types/static.d.ts.map +1 -1
  87. package/types/types.d.ts +3 -2
  88. package/types/types.d.ts.map +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/getStylesAtomic.ts"],
4
- "sourcesContent": ["import { StyleObject, stylePropsTransform } from '@tamagui/helpers'\nimport { ViewStyle } from 'react-native'\n\nimport { reversedShorthands } from '../createTamagui'\nimport { isVariable } from '../createVariable'\nimport { RulesData, generateAtomicStyles } from './generateAtomicStyles'\nimport { invertMapTransformKeys, mergeTransform } from './mergeTransform'\n\nexport type ViewStyleWithPseudos = ViewStyle & {\n hoverStyle?: ViewStyle\n pressStyle?: ViewStyle\n focusStyle?: ViewStyle\n}\n\ntype AtomicStyleOptions = {\n splitTransforms?: boolean\n}\n\n// *0 order matches to *1\nexport const pseudos = {\n hoverStyle: {\n name: 'hover',\n priority: 1,\n },\n pressStyle: {\n name: 'active',\n priority: 2,\n },\n focusStyle: {\n name: 'focus',\n priority: 3,\n },\n} as const\n\ntype PseudoDescriptor = typeof pseudos[keyof typeof pseudos]\n\nconst pseudosOrdered = Object.values(pseudos)\n\n// this is how compiler outputs psueodo identifier\n// TODO remove in next refactor\nexport const psuedoCNInverse = {\n hover: 'hoverStyle',\n focus: 'focusStyle',\n press: 'pressStyle',\n}\n\nexport function getStylesAtomic(stylesIn: ViewStyleWithPseudos, options: AtomicStyleOptions = {}) {\n const { hoverStyle, pressStyle, focusStyle, ...base } = stylesIn\n let res: StyleObject[] = []\n\n // *1 order matched to *0\n for (const [index, style] of [hoverStyle, pressStyle, focusStyle, base].entries()) {\n if (!style || !Object.keys(style).length) {\n continue\n }\n const pseudo = pseudosOrdered[index]\n for (const skey in style) {\n const val = style[skey]\n if (isVariable(val)) {\n style[skey] = val.toString()\n }\n if (stylePropsTransform[skey]) {\n delete style[skey]\n mergeTransform(style, skey, val)\n }\n }\n res = [...res, ...getAtomicStyle(style, pseudo, options)]\n }\n\n return res\n}\n\nfunction getAtomicStyle(\n style: ViewStyle,\n pseudo: PseudoDescriptor | undefined,\n options: AtomicStyleOptions\n): StyleObject[] {\n if (style == null || typeof style !== 'object') {\n throw new Error(`Wrong style type: \"${typeof style}\": ${style}`)\n }\n\n // why is this diff from react-native-web!? need to figure out\n for (const key in borderDefaults) {\n if (key in style) {\n style[borderDefaults[key]] = style[borderDefaults[key]] ?? 'solid'\n }\n }\n\n let atomicStyles: { [key: string]: RulesData & { transformProperty?: string } } = {}\n\n if (options.splitTransforms && style.transform) {\n let { transform, ...rest } = style\n Object.assign(atomicStyles, generateAtomicStyles(rest))\n for (const t of transform) {\n const tKey = Object.keys(t)[0]\n const transformProperty = invertMapTransformKeys[tKey] || tKey\n const out = generateAtomicStyles({ transform: [t] })\n const key = Object.keys(out)[0]\n atomicStyles[key] = {\n ...out[key],\n transformProperty,\n }\n }\n } else {\n // TODO we can do this all in one loop likely inside getSplitStyles in existing loop and avoid O(n^3)...\n atomicStyles = generateAtomicStyles(style)\n }\n\n // TODO ... and then also avoid this loop! n^4\n return Object.keys(atomicStyles).map((key) => {\n const val = atomicStyles[key]\n const hash = val.identifier\n // pseudos have a `--` to be easier to find with concatClassNames\n const psuedoPrefix = pseudo ? `0${pseudo.name}-` : ''\n if (!val.property) {\n throw new Error(`no prop`)\n }\n const shortProp = reversedShorthands[val.property] || val.property\n const identifier = `_${shortProp}-${psuedoPrefix}${hash}`\n const className = `.${identifier}`\n const rules = val.rules.map((rule) => {\n if (pseudo) {\n const psuedoPrefixSelect = [...Array(pseudo.priority)].map(() => ':root').join('') + ' '\n let res = rule\n .replace(`.${val.identifier}`, `${psuedoPrefixSelect} ${className}`)\n .replace('{', `:${pseudo.name}{`)\n // important to override inline styles\n .replace(';', ' !important;')\n\n if (pseudo.name === 'hover') {\n // hover styles need to be conditional\n // perhaps this can be generalized but for now lets just shortcut\n // and hardcode for hover styles, if we need to later we can\n // WEIRD SYNTAX, SEE:\n // https://stackoverflow.com/questions/40532204/media-query-for-devices-supporting-hover\n res = `@media not all and (hover: none) { ${res} }`\n }\n return res\n }\n return rule.replace(`.${val.identifier}`, className).replace(importantRegex, '')\n })\n\n const result: StyleObject = {\n property: val.transformProperty || val.property,\n pseudo: pseudo?.name,\n value: val.value || '',\n identifier,\n className,\n rules,\n }\n\n return result\n })\n}\n\nconst importantRegex = /\\!important*/g\n\nconst borderDefaults = {\n borderWidth: 'borderStyle',\n borderBottomWidth: 'borderBottomStyle',\n borderTopWidth: 'borderTopStyle',\n borderLeftWidth: 'borderLeftStyle',\n borderRightWidth: 'borderRightStyle',\n}\n"],
5
- "mappings": ";;AAAA;AAGA;AACA;AACA;AACA;AAaO,MAAM,UAAU;AAAA,EACrB,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AACF;AAIA,MAAM,iBAAiB,OAAO,OAAO,OAAO;AAIrC,MAAM,kBAAk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BAAiB;AAEvB,MAAM,iBAAiB;AAAA,EACrB,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,kBAAkB;AACpB;",
4
+ "sourcesContent": ["import { StyleObject, stylePropsTransform } from '@tamagui/helpers'\nimport { ViewStyle } from 'react-native'\n\nimport { reversedShorthands } from '../createTamagui'\nimport { isVariable } from '../createVariable'\nimport { RulesData, generateAtomicStyles } from './generateAtomicStyles'\nimport { invertMapTransformKeys, mergeTransform } from './mergeTransform'\nimport { pseudos } from './pseudos'\n\nexport type ViewStyleWithPseudos = ViewStyle & {\n hoverStyle?: ViewStyle\n pressStyle?: ViewStyle\n focusStyle?: ViewStyle\n}\n\ntype AtomicStyleOptions = {\n splitTransforms?: boolean\n}\n\ntype PseudoDescriptor = typeof pseudos[keyof typeof pseudos]\n\nconst pseudosOrdered = Object.values(pseudos)\n\n// this is how compiler outputs psueodo identifier\n// TODO remove in next refactor\nexport const psuedoCNInverse = {\n hover: 'hoverStyle',\n focus: 'focusStyle',\n press: 'pressStyle',\n}\n\nexport function getStylesAtomic(stylesIn: ViewStyleWithPseudos, options: AtomicStyleOptions = {}) {\n const { hoverStyle, pressStyle, focusStyle, ...base } = stylesIn\n let res: StyleObject[] = []\n\n // *1 order matched to *0\n for (const [index, style] of [hoverStyle, pressStyle, focusStyle, base].entries()) {\n if (!style || !Object.keys(style).length) {\n continue\n }\n const pseudo = pseudosOrdered[index]\n for (const skey in style) {\n const val = style[skey]\n if (isVariable(val)) {\n style[skey] = val.toString()\n }\n if (stylePropsTransform[skey]) {\n delete style[skey]\n mergeTransform(style, skey, val)\n }\n }\n res = [...res, ...getAtomicStyle(style, pseudo, options)]\n }\n\n return res\n}\n\nfunction getAtomicStyle(\n style: ViewStyle,\n pseudo: PseudoDescriptor | undefined,\n options: AtomicStyleOptions\n): StyleObject[] {\n if (style == null || typeof style !== 'object') {\n throw new Error(`Wrong style type: \"${typeof style}\": ${style}`)\n }\n\n // why is this diff from react-native-web!? need to figure out\n for (const key in borderDefaults) {\n if (key in style) {\n style[borderDefaults[key]] = style[borderDefaults[key]] ?? 'solid'\n }\n }\n\n let atomicStyles: { [key: string]: RulesData & { transformProperty?: string } } = {}\n\n if (options.splitTransforms && style.transform) {\n let { transform, ...rest } = style\n style = rest\n for (const t of transform) {\n const tKey = Object.keys(t)[0]\n const transformProperty = invertMapTransformKeys[tKey] || tKey\n const out = generateAtomicStyles({ transform: [t] })\n const key = Object.keys(out)[0]\n atomicStyles[key] = {\n ...out[key],\n transformProperty,\n }\n }\n }\n\n if (style) {\n Object.assign(atomicStyles, generateAtomicStyles(style))\n }\n\n // TODO ... and then also avoid this loop! n^4\n return Object.keys(atomicStyles).map((key) => {\n const val = atomicStyles[key]\n const hash = val.identifier\n // pseudos have a `--` to be easier to find with concatClassNames\n const psuedoPrefix = pseudo ? `0${pseudo.name}-` : ''\n if (!val.property) {\n throw new Error(`no prop`)\n }\n const shortProp = reversedShorthands[val.property] || val.property\n const identifier = `_${shortProp}-${psuedoPrefix}${hash}`\n const className = `.${identifier}`\n const rules = val.rules.map((rule) => {\n if (pseudo) {\n const psuedoPrefixSelect = [...Array(pseudo.priority)].map(() => ':root').join('') + ' '\n let res = rule\n .replace(`.${val.identifier}`, `${psuedoPrefixSelect} ${className}`)\n .replace('{', `:${pseudo.name}{`)\n // important to override inline styles\n .replace(';', ' !important;')\n\n if (pseudo.name === 'hover') {\n // hover styles need to be conditional\n // perhaps this can be generalized but for now lets just shortcut\n // and hardcode for hover styles, if we need to later we can\n // WEIRD SYNTAX, SEE:\n // https://stackoverflow.com/questions/40532204/media-query-for-devices-supporting-hover\n res = `@media not all and (hover: none) { ${res} }`\n }\n return res\n }\n return rule.replace(`.${val.identifier}`, className).replace(importantRegex, '')\n })\n\n const result: StyleObject = {\n property: val.transformProperty || val.property,\n pseudo: pseudo?.name,\n value: val.value as any,\n identifier,\n className,\n rules,\n }\n\n return result\n })\n}\n\nconst importantRegex = /\\!important*/g\n\nconst borderDefaults = {\n borderWidth: 'borderStyle',\n borderBottomWidth: 'borderBottomStyle',\n borderTopWidth: 'borderTopStyle',\n borderLeftWidth: 'borderLeftStyle',\n borderRightWidth: 'borderRightStyle',\n}\n"],
5
+ "mappings": ";;AAAA;AAGA;AACA;AACA;AACA;AACA;AAcA,MAAM,iBAAiB,OAAO,OAAO,OAAO;AAIrC,MAAM,kBAAkB;AAAA,EAC7B,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACT;AAEO,yBAAyB,UAAgC,UAA8B,CAAC,GAAG;AAChG,QAAM,EAAE,YAAY,YAAY,eAAe,SAAS;AACxD,MAAI,MAAqB,CAAC;AAG1B,aAAW,CAAC,OAAO,UAAU,CAAC,YAAY,YAAY,YAAY,IAAI,EAAE,QAAQ,GAAG;AACjF,QAAI,CAAC,SAAS,CAAC,OAAO,KAAK,KAAK,EAAE,QAAQ;AACxC;AAAA,IACF;AACA,UAAM,SAAS,eAAe;AAC9B,eAAW,QAAQ,OAAO;AACxB,YAAM,MAAM,MAAM;AAClB,UAAI,WAAW,GAAG,GAAG;AACnB,cAAM,QAAQ,IAAI,SAAS;AAAA,MAC7B;AACA,UAAI,oBAAoB,OAAO;AAC7B,eAAO,MAAM;AACb,uBAAe,OAAO,MAAM,GAAG;AAAA,MACjC;AAAA,IACF;AACA,UAAM,CAAC,GAAG,KAAK,GAAG,eAAe,OAAO,QAAQ,OAAO,CAAC;AAAA,EAC1D;AAEA,SAAO;AACT;AAxBgB;AA0BhB,wBACE,OACA,QACA,SACe;AA7DjB;AA8DE,MAAI,SAAS,QAAQ,OAAO,UAAU,UAAU;AAC9C,UAAM,IAAI,MAAM,sBAAsB,OAAO,WAAW,OAAO;AAAA,EACjE;AAGA,aAAW,OAAO,gBAAgB;AAChC,QAAI,OAAO,OAAO;AAChB,YAAM,eAAe,QAAQ,YAAM,eAAe,UAArB,YAA8B;AAAA,IAC7D;AAAA,EACF;AAEA,MAAI,eAA8E,CAAC;AA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,gBAAgB,EAAE;AAAA,IACjF,CAAC;AAED,UAAM,SAAsB;AAAA,MAC1B,UAAU,IAAI,qBAAqB,IAAI;AAAA,MACvC,QAAQ,iCAAQ;AAAA,MAChB,OAAO,IAAI;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAEA,WAAO;AAAA,EACT,CAAC;AACH;AAlFS;AAoFT,MAAM,iBAAiB;AAEvB,MAAM,iBAAiB;AAAA,EACrB,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,kBAAkB;AACpB;",
6
6
  "names": []
7
7
  }
@@ -71,7 +71,8 @@ function updateInsertedCache(identifier, rule) {
71
71
  if (insertedSelectors[identifier])
72
72
  return;
73
73
  insertedSelectors[identifier] = rule;
74
- if (identifier.startsWith("_transform")) {
74
+ const isTransform = identifier.startsWith("_transform");
75
+ if (isTransform) {
75
76
  addTransform(identifier, rule);
76
77
  }
77
78
  }
@@ -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, css: string, rule?: CSSRule) {\n const s = css.indexOf('transform:')\n if (s === -1) {\n if (process.env.NODE_ENV === 'development') {\n console.groupCollapsed(`\u274C Invalid transform, likely used deg/% improperly ${identifier}`)\n console.log('rule:', rule)\n console.trace()\n console.groupEnd()\n } else {\n console.error(`Missing transform`, identifier, css, rule)\n }\n return\n }\n const startI = s + 'transform:'.length\n const endI = css.indexOf(';')\n const value = css.slice(startI, endI)\n insertedTransforms[identifier] = value\n}\n\nconst isClient = typeof document !== 'undefined'\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\n\nexport function updateInserted() {\n if (process.env.NODE_ENV === 'test') return\n if (!isClient) return\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 if (!allSelectors[identifier]) {\n allSelectors[identifier] = process.env.NODE_ENV === 'development' ? rule.cssText : true\n if (identifier.startsWith('_transform')) {\n addTransform(identifier, rule.cssText, rule)\n }\n }\n }\n }\n }\n hasInsertedSinceUpdate = false\n}\n\nupdateInserted()\n\nconst sheet = isClient ? document.head.appendChild(document.createElement('style')).sheet : null\n\nexport function updateInsertedCache(identifier: string, rule: string) {\n if (insertedSelectors[identifier]) return\n insertedSelectors[identifier] = rule\n if (identifier.startsWith('_transform')) {\n addTransform(identifier, rule)\n }\n}\n\nexport function insertStyleRule(identifier: string, rule: string) {\n if (allSelectors[identifier]) return\n hasInsertedSinceUpdate = true\n updateInsertedCache(identifier, rule)\n allSelectors[identifier] = process.env.NODE_ENV === 'development' ? rule : true\n sheet?.insertRule(rule, sheet.cssRules.length)\n}\n"],
5
- "mappings": ";;AAIA,MAAM,eAAe,CAAC;AACtB,MAAM,oBAAoB,CAAC;AACpB,MAAM,qBAAqB,CAAC;AAE5B,MAAM,kBAAkB,6BAAM,cAAN;AACxB,MAAM,mB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AAC7B,uBAAa,cAAc,QAAQ,IAAI,aAAa,gBAAgB,KAAK,UAAU;AACnF,cAAI,WAAW,WAAW,YAAY,GAAG;AACvC,yBAAa,YAAY,KAAK,SAAS,IAAI;AAAA,UAC7C;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,2BAAyB;AAC3B;AA9BgB;AAgChB,eAAe;AAEf,MAAM,QAAQ,WAAW,SAAS,KAAK,YAAY,SAAS,cAAc,OAAO,CAAC,EAAE,QAAQ;AAErF,6BAA6B,YAAoB,MAAc;AACpE,MAAI,kBAAkB;AAAa;AACnC,oBAAkB,cAAc;AAChC,MAAI,WAAW,WAAW,YAAY,GAAG;AACvC,iBAAa,YAAY,IAAI;AAAA,EAC/B;AACF;AANgB;AAQT,yBAAyB,YAAoB,MAAc;AAChE,MAAI,aAAa;AAAa;AAC9B,2BAAyB;AACzB,sBAAoB,YAAY,IAAI;AACpC,eAAa,cAAc,QAAQ,IAAI,aAAa,gBAAgB,OAAO;AAC3E,iCAAO,WAAW,MAAM,MAAM,SAAS;AACzC;AANgB;",
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, css: string, rule?: CSSRule) {\n const s = css.indexOf('transform:')\n if (s === -1) {\n if (process.env.NODE_ENV === 'development') {\n console.groupCollapsed(`\u274C Invalid transform, likely used deg/% improperly ${identifier}`)\n console.log('rule:', rule)\n console.trace()\n console.groupEnd()\n } else {\n console.error(`Missing transform`, identifier, css, rule)\n }\n return\n }\n const startI = s + 'transform:'.length\n const endI = css.indexOf(';')\n const value = css.slice(startI, endI)\n insertedTransforms[identifier] = value\n}\n\nconst isClient = typeof document !== 'undefined'\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\n\nexport function updateInserted() {\n if (process.env.NODE_ENV === 'test') return\n if (!isClient) return\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 if (!allSelectors[identifier]) {\n allSelectors[identifier] = process.env.NODE_ENV === 'development' ? rule.cssText : true\n if (identifier.startsWith('_transform')) {\n addTransform(identifier, rule.cssText, rule)\n }\n }\n }\n }\n }\n hasInsertedSinceUpdate = false\n}\n\nupdateInserted()\n\nconst sheet = isClient ? document.head.appendChild(document.createElement('style')).sheet : null\n\nexport function updateInsertedCache(identifier: string, rule: string) {\n if (insertedSelectors[identifier]) return\n insertedSelectors[identifier] = rule\n const isTransform = identifier.startsWith('_transform')\n if (isTransform) {\n addTransform(identifier, rule)\n }\n}\n\nexport function insertStyleRule(identifier: string, rule: string) {\n if (allSelectors[identifier]) return\n hasInsertedSinceUpdate = true\n updateInsertedCache(identifier, rule)\n allSelectors[identifier] = process.env.NODE_ENV === 'development' ? rule : true\n sheet?.insertRule(rule, sheet.cssRules.length)\n}\n"],
5
+ "mappings": ";;AAIA,MAAM,eAAe,CAAC;AACtB,MAAM,oBAAoB,CAAC;AACpB,MAAM,qBAAqB,CAAC;AAE5B,MAAM,kBAAkB,6BAAM,cAAN;AACxB,MAAM,mBAAmB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B,uBAAa,cAAc,QAAQ,IAAI,aAAa,gBAAgB,KAAK,UAAU;AACnF,cAAI,WAAW,WAAW,YAAY,GAAG;AACvC,yBAAa,YAAY,KAAK,SAAS,IAAI;AAAA,UAC7C;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,2BAAyB;AAC3B;AA9BgB;AAgChB,eAAe;AAEf,MAAM,QAAQ,WAAW,SAAS,KAAK,YAAY,SAAS,cAAc,OAAO,CAAC,EAAE,QAAQ;AAErF,6BAA6B,YAAoB,MAAc;AACpE,MAAI,kBAAkB;AAAa;AACnC,oBAAkB,cAAc;AAChC,QAAM,cAAc,WAAW,WAAW,YAAY;AACtD,MAAI,aAAa;AACf,iBAAa,YAAY,IAAI;AAAA,EAC/B;AACF;AAPgB;AAST,yBAAyB,YAAoB,MAAc;AAChE,MAAI,aAAa;AAAa;AAC9B,2BAAyB;AACzB,sBAAoB,YAAY,IAAI;AACpC,eAAa,cAAc,QAAQ,IAAI,aAAa,gBAAgB,OAAO;AAC3E,iCAAO,WAAW,MAAM,MAAM,SAAS;AACzC;AANgB;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ const mergeProps = /* @__PURE__ */ __name((a, b) => {
4
+ const out = {};
5
+ for (const key in a) {
6
+ if (!(key in b)) {
7
+ out[key] = a[key];
8
+ }
9
+ }
10
+ for (const key in b) {
11
+ out[key] = b[key];
12
+ }
13
+ return out;
14
+ }, "mergeProps");
15
+ export {
16
+ mergeProps
17
+ };
18
+ //# sourceMappingURL=mergeProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/helpers/mergeProps.ts"],
4
+ "sourcesContent": ["/**\n * Preserves prop ordering, so that the order most closely matches the last spread objects\n * Useful for having { ...defaultProps, ...props } that ensure props ordering is always kept\n *\n * Given:\n * mergeProps({ a: 1, b: 2 }, { b: 1, a: 2 })\n * The final key order will be:\n * b, a\n */\n\nexport const mergeProps = (a: Object, b: Object) => {\n const out = {}\n\n for (const key in a) {\n if (!(key in b)) {\n out[key] = a[key]\n }\n }\n\n for (const key in b) {\n out[key] = b[key]\n }\n\n return out\n}\n"],
5
+ "mappings": ";;AAUO,MAAM,aAAa,wBAAC,GAAW,MAAc;AAClD,QAAM,MAAM,CAAC;AAEb,aAAW,OAAO,GAAG;AACnB,QAAI,CAAE,QAAO,IAAI;AACf,UAAI,OAAO,EAAE;AAAA,IACf;AAAA,EACF;AAEA,aAAW,OAAO,GAAG;AACnB,QAAI,OAAO,EAAE;AAAA,EACf;AAEA,SAAO;AACT,GAd0B;",
6
+ "names": []
7
+ }
@@ -0,0 +1,18 @@
1
+ const pseudos = {
2
+ hoverStyle: {
3
+ name: "hover",
4
+ priority: 1
5
+ },
6
+ pressStyle: {
7
+ name: "active",
8
+ priority: 2
9
+ },
10
+ focusStyle: {
11
+ name: "focus",
12
+ priority: 3
13
+ }
14
+ };
15
+ export {
16
+ pseudos
17
+ };
18
+ //# sourceMappingURL=pseudos.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/helpers/pseudos.ts"],
4
+ "sourcesContent": ["// *0 order matches to *1\n\nexport const pseudos = {\n hoverStyle: {\n name: 'hover',\n priority: 1,\n },\n pressStyle: {\n name: 'active',\n priority: 2,\n },\n focusStyle: {\n name: 'focus',\n priority: 3,\n },\n} as const\n"],
5
+ "mappings": "AAEO,MAAM,UAAU;AAAA,EACrB,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AACF;",
6
+ "names": []
7
+ }
@@ -4,7 +4,8 @@ import React, { forwardRef } from "react";
4
4
  import { Theme } from "../views/Theme";
5
5
  import { ThemeInverse } from "../views/ThemeInverse";
6
6
  function themeable(component, opts) {
7
- const withThemeComponent = forwardRef(/* @__PURE__ */ __name(function WithTheme({ themeInverse, theme, ...rest }, ref) {
7
+ const withThemeComponent = forwardRef(/* @__PURE__ */ __name(function WithTheme(props, ref) {
8
+ const { themeInverse, theme, ...rest } = props;
8
9
  const element = React.createElement(component, { ...rest, ref });
9
10
  if (themeInverse) {
10
11
  return /* @__PURE__ */ React.createElement(ThemeInverse, null, element);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/themeable.tsx"],
4
- "sourcesContent": ["import React, { forwardRef } from 'react'\n\nimport { ThemeName } from '../types'\nimport { Theme } from '../views/Theme'\nimport { ThemeInverse } from '../views/ThemeInverse'\n\nexport type ThemeableProps = {\n theme?: ThemeName | string | null\n themeInverse?: boolean\n}\n\nexport function themeable<Component extends (props: any) => any>(\n component: Component,\n opts?: { componentName?: string }\n) {\n const withThemeComponent = forwardRef(function WithTheme(\n { themeInverse, theme, ...rest }: any,\n ref\n ) {\n const element = React.createElement(component, { ...rest, ref } as any)\n if (themeInverse) {\n return <ThemeInverse>{element}</ThemeInverse>\n }\n if (theme || opts) {\n return (\n <Theme componentName={opts?.componentName} name={(theme as any) || null}>\n {element}\n </Theme>\n )\n }\n return element\n })\n\n const withTheme: any = withThemeComponent\n withTheme.displayName = `Themed(${\n (component as any)?.displayName || (component as any)?.name || 'Anonymous'\n })`\n\n return withTheme as Component extends (props: infer P) => infer R\n ? (\n props: Omit<P, 'theme' | 'themeInverse'> & {\n theme?: ThemeName | null\n themeInverse?: boolean\n }\n ) => R\n : unknown\n}\n"],
5
- "mappings": ";;AAAA;AAGA;AACA;AAOO,mBACL,WACA,MACA;AACA,QAAM,qBAAqB,WAAW,0CACpC,EAAE,cAAc,UAAU,QAC1B,KACA;AACA,UAAM,UAAU,MAAM,cAAc,WAAW,EAAE,GAAG,MAAM,IAAI,CAAQ;AACtE,QAAI,cAAc;AAChB,aAAO,oCAAC,oBAAc,OAAQ;AAAA,IAChC;AACA,QAAI,SAAS,MAAM;AACjB,aACE,oCAAC;AAAA,QAAM,eAAe,6BAAM;AAAA,QAAe,MAAO,SAAiB;AAAA,SAChE,OACH;AAAA,IAEJ;AACA,WAAO;AAAA,EACT,GAhBsC,YAgBrC;AAED,QAAM,YAAiB;AACvB,YAAU,cAAc,UACrB,wCAAmB,gBAAgB,wCAAmB,SAAQ;AAGjE,SAAO;AAQT;AAnCgB;",
4
+ "sourcesContent": ["import React, { forwardRef } from 'react'\n\nimport { ThemeName } from '../types'\nimport { Theme } from '../views/Theme'\nimport { ThemeInverse } from '../views/ThemeInverse'\n\nexport type ThemeableProps = {\n theme?: ThemeName | string | null\n themeInverse?: boolean\n}\n\nexport function themeable<Component extends (props: any) => any>(\n component: Component,\n opts?: { componentName?: string }\n) {\n const withThemeComponent = forwardRef(function WithTheme(props: any, ref) {\n const { themeInverse, theme, ...rest } = props\n const element = React.createElement(component, { ...rest, ref } as any)\n if (themeInverse) {\n return <ThemeInverse>{element}</ThemeInverse>\n }\n if (theme || opts) {\n return (\n <Theme componentName={opts?.componentName} name={(theme as any) || null}>\n {element}\n </Theme>\n )\n }\n return element\n })\n\n const withTheme: any = withThemeComponent\n withTheme.displayName = `Themed(${\n (component as any)?.displayName || (component as any)?.name || 'Anonymous'\n })`\n\n return withTheme as Component extends (props: infer P) => infer R\n ? (\n props: Omit<P, 'theme' | 'themeInverse'> & {\n theme?: ThemeName | null\n themeInverse?: boolean\n }\n ) => R\n : unknown\n}\n"],
5
+ "mappings": ";;AAAA;AAGA;AACA;AAOO,mBACL,WACA,MACA;AACA,QAAM,qBAAqB,WAAW,0CAAmB,OAAY,KAAK;AACxE,UAAM,EAAE,cAAc,UAAU,SAAS;AACzC,UAAM,UAAU,MAAM,cAAc,WAAW,EAAE,GAAG,MAAM,IAAI,CAAQ;AACtE,QAAI,cAAc;AAChB,aAAO,oCAAC,oBAAc,OAAQ;AAAA,IAChC;AACA,QAAI,SAAS,MAAM;AACjB,aACE,oCAAC;AAAA,QAAM,eAAe,6BAAM;AAAA,QAAe,MAAO,SAAiB;AAAA,SAChE,OACH;AAAA,IAEJ;AACA,WAAO;AAAA,EACT,GAdsC,YAcrC;AAED,QAAM,YAAiB;AACvB,YAAU,cAAc,UACrB,wCAAmB,gBAAgB,wCAAmB,SAAQ;AAGjE,SAAO;AAQT;AAjCgB;",
6
6
  "names": []
7
7
  }
package/dist/esm/index.js CHANGED
@@ -23,6 +23,9 @@ export * from "./helpers/getExpandedShorthands";
23
23
  export * from "./helpers/getSize";
24
24
  export * from "./helpers/getSplitStyles";
25
25
  export * from "./helpers/getStylesAtomic";
26
+ export * from "./helpers/pseudos";
27
+ export * from "./helpers/mergeProps";
28
+ import { expandStyles } from "./helpers/generateAtomicStyles";
26
29
  export * from "./helpers/getTextSize";
27
30
  export * from "./helpers/isObj";
28
31
  export * from "./helpers/isTamaguiElement";
@@ -52,6 +55,7 @@ export * from "@tamagui/helpers";
52
55
  export {
53
56
  RNWTextProps,
54
57
  RNWViewProps,
58
+ expandStyles,
55
59
  getConfig,
56
60
  getHasConfigured,
57
61
  getThemes,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["export * from './Tamagui'\nexport * from './createComponent'\nexport * from './createShorthands'\nexport * from './createTheme'\nexport * from './createTamagui'\nexport * from './createFont'\nexport * from './createTokens'\nexport * from './createVariable'\nexport * from './createVariables'\nexport * from './insertFont'\nexport * from './styled'\nexport * from './types'\n// for type portability\nexport { RNWTextProps, RNWViewProps } from './types-rnw'\nexport { getHasConfigured, getConfig, getThemes, getTokens, onConfiguredOnce } from './conf'\n\nexport * from './constants/constants'\nexport * from './constants/platform'\nexport * from './constants/rnw'\n\nexport * from './helpers/calc'\nexport * from './helpers/createShallowUpdate'\nexport * from './helpers/getStackSize'\nexport * from './helpers/getVariantExtras'\nexport * from './helpers/getExpandedShorthands'\nexport * from './helpers/getSize'\nexport * from './helpers/getSplitStyles'\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/getTextSize'\nexport * from './helpers/isObj'\nexport * from './helpers/isTamaguiElement'\nexport * from './helpers/isTamaguiComponent'\nexport * from './helpers/matchMedia'\nexport * from './helpers/themeable'\nexport * from './helpers/withStaticProperties'\n\nexport * from './contexts/ButtonInsideButtonContext'\n\nexport * from './hooks/useConstant'\nexport * from './hooks/useId'\nexport * from './hooks/useIsMounted'\nexport * from './hooks/useIsTouchDevice'\nexport * from './hooks/useMedia'\nexport * from './hooks/usePressable'\nexport * from './hooks/useTheme'\nexport * from './hooks/useUnmountEffect'\n\nexport * from './views/Slot'\nexport * from './views/Stack'\nexport * from './views/Text'\nexport * from './views/TextAncestorContext'\nexport * from './views/Theme'\nexport * from './views/ThemeInverse'\nexport * from './views/ThemeProvider'\nexport * from './views/ThemeReset'\n\nexport * from '@tamagui/use-force-update'\nexport * from '@tamagui/helpers'\n"],
5
- "mappings": "AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;",
4
+ "sourcesContent": ["export * from './Tamagui'\nexport * from './createComponent'\nexport * from './createShorthands'\nexport * from './createTheme'\nexport * from './createTamagui'\nexport * from './createFont'\nexport * from './createTokens'\nexport * from './createVariable'\nexport * from './createVariables'\nexport * from './insertFont'\nexport * from './styled'\nexport * from './types'\n// for type portability\nexport { RNWTextProps, RNWViewProps } from './types-rnw'\nexport { getHasConfigured, getConfig, getThemes, getTokens, onConfiguredOnce } from './conf'\n\nexport * from './constants/constants'\nexport * from './constants/platform'\nexport * from './constants/rnw'\n\nexport * from './helpers/calc'\nexport * from './helpers/createShallowUpdate'\nexport * from './helpers/getStackSize'\nexport * from './helpers/getVariantExtras'\nexport * from './helpers/getExpandedShorthands'\nexport * from './helpers/getSize'\nexport * from './helpers/getSplitStyles'\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/pseudos'\nexport * from './helpers/mergeProps'\nexport { expandStyles } from './helpers/generateAtomicStyles'\nexport * from './helpers/getTextSize'\nexport * from './helpers/isObj'\nexport * from './helpers/isTamaguiElement'\nexport * from './helpers/isTamaguiComponent'\nexport * from './helpers/matchMedia'\nexport * from './helpers/themeable'\nexport * from './helpers/withStaticProperties'\n\nexport * from './contexts/ButtonInsideButtonContext'\n\nexport * from './hooks/useConstant'\nexport * from './hooks/useId'\nexport * from './hooks/useIsMounted'\nexport * from './hooks/useIsTouchDevice'\nexport * from './hooks/useMedia'\nexport * from './hooks/usePressable'\nexport * from './hooks/useTheme'\nexport * from './hooks/useUnmountEffect'\n\nexport * from './views/Slot'\nexport * from './views/Stack'\nexport * from './views/Text'\nexport * from './views/TextAncestorContext'\nexport * from './views/Theme'\nexport * from './views/ThemeInverse'\nexport * from './views/ThemeProvider'\nexport * from './views/ThemeReset'\n\nexport * from '@tamagui/use-force-update'\nexport * from '@tamagui/helpers'\n"],
5
+ "mappings": "AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;",
6
6
  "names": []
7
7
  }
@@ -9,6 +9,8 @@ export * from "./hooks/useMedia";
9
9
  export * from "./hooks/useTheme";
10
10
  export * from "./helpers/isObj";
11
11
  export * from "./helpers/getStylesAtomic";
12
+ export * from "./helpers/generateAtomicStyles";
13
+ export * from "./helpers/pseudos";
12
14
  export * from "./helpers/proxyThemeVariables";
13
15
  export * from "./helpers/getSplitStyles";
14
16
  export * from "@tamagui/helpers";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/static.ts"],
4
- "sourcesContent": ["// only stuff that gets extracted or needed by tamagui-static\n\nexport * from './styled'\nexport * from './createComponent'\nexport * from './createFont'\nexport * from './createTokens'\nexport * from './createTamagui'\nexport * from './createVariable'\nexport * from './constants/constants'\n\nexport * from './hooks/useMedia'\nexport * from './hooks/useTheme'\n\nexport * from './helpers/isObj'\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/proxyThemeVariables'\nexport * from './helpers/getSplitStyles'\nexport * from '@tamagui/helpers'\n\nexport * from './constants/rnw'\n\nexport * from './types'\n"],
5
- "mappings": "AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAEA;",
4
+ "sourcesContent": ["// only stuff that gets extracted or needed by tamagui-static\n\nexport * from './styled'\nexport * from './createComponent'\nexport * from './createFont'\nexport * from './createTokens'\nexport * from './createTamagui'\nexport * from './createVariable'\nexport * from './constants/constants'\n\nexport * from './hooks/useMedia'\nexport * from './hooks/useTheme'\n\nexport * from './helpers/isObj'\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/generateAtomicStyles'\nexport * from './helpers/pseudos'\nexport * from './helpers/proxyThemeVariables'\nexport * from './helpers/getSplitStyles'\nexport * from '@tamagui/helpers'\n\nexport * from './constants/rnw'\n\nexport * from './types'\n"],
5
+ "mappings": "AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;",
6
6
  "names": []
7
7
  }
@@ -19,10 +19,12 @@ import { onConfiguredOnce } from "./conf";
19
19
  import { stackDefaultStyles } from "./constants/constants";
20
20
  import { isWeb, useIsomorphicLayoutEffect } from "./constants/platform";
21
21
  import { rnw } from "./constants/rnw";
22
+ import { getReturnVariablesAs } from "./helpers/createPropMapper";
22
23
  import { createShallowUpdate } from "./helpers/createShallowUpdate";
23
24
  import { extendStaticConfig, parseStaticConfig } from "./helpers/extendStaticConfig";
24
25
  import { insertSplitStyles, useSplitStyles } from "./helpers/getSplitStyles";
25
26
  import { getAllSelectors } from "./helpers/insertStyleRule";
27
+ import { mergeProps } from "./helpers/mergeProps";
26
28
  import { proxyThemeVariables } from "./helpers/proxyThemeVariables";
27
29
  import { wrapThemeManagerContext } from "./helpers/wrapThemeManagerContext";
28
30
  import { useFeatures } from "./hooks/useFeatures";
@@ -96,14 +98,23 @@ function createComponent(configIn, ParentComponent) {
96
98
  __name(addPseudoToStyles, "addPseudoToStyles");
97
99
  const component = forwardRef((propsIn, forwardedRef) => {
98
100
  var _a, _b, _c, _d, _e;
99
- const props = tamaguiDefaultProps && !propsIn.asChild ? { ...tamaguiDefaultProps, ...propsIn } : propsIn;
101
+ let props;
102
+ if (tamaguiDefaultProps && !propsIn.asChild) {
103
+ props = mergeProps(tamaguiDefaultProps, propsIn);
104
+ } else {
105
+ props = propsIn;
106
+ }
100
107
  const { Component, isText, isZStack } = staticConfig;
101
108
  const componentName = props.componentName || staticConfig.componentName;
102
109
  const componentClassName = props.asChild ? "" : props.componentName ? `is_${props.componentName}` : defaultComponentClassName;
103
110
  if (process.env.NODE_ENV === "development") {
104
111
  if (props["debug"]) {
105
112
  console.log("\u26A0\uFE0F", componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]", "debug on");
106
- console.log("props in:", { propsIn, props, ordered: Object.keys(props) });
113
+ console.log("props in:", {
114
+ propsIn,
115
+ props,
116
+ ordered: Object.keys(props)
117
+ });
107
118
  if (props["debug"] === "break")
108
119
  debugger;
109
120
  }
@@ -113,7 +124,7 @@ function createComponent(configIn, ParentComponent) {
113
124
  const [state, set_] = useState(defaultComponentState);
114
125
  const setStateShallow = createShallowUpdate(set_);
115
126
  const shouldAvoidClasses = !!(props.animation && avoidClasses);
116
- const splitStyles = useSplitStyles(props, staticConfig, theme, !shouldAvoidClasses ? {
127
+ const splitStyleState = !shouldAvoidClasses ? {
117
128
  ...state,
118
129
  dynamicStylesInline: true
119
130
  } : {
@@ -121,7 +132,8 @@ function createComponent(configIn, ParentComponent) {
121
132
  noClassNames: true,
122
133
  dynamicStylesInline: true,
123
134
  resolveVariablesAs: "value"
124
- }, shouldAvoidClasses || props.asChild ? null : initialSplitStyles.classNames);
135
+ };
136
+ const splitStyles = useSplitStyles(props, staticConfig, theme, splitStyleState, shouldAvoidClasses || props.asChild ? null : initialSplitStyles.classNames, props["debug"]);
125
137
  const { viewProps: viewPropsIn, pseudos, medias, style, classNames } = splitStyles;
126
138
  const useAnimations = (_a = tamaguiConfig.animations) == null ? void 0 : _a.useAnimations;
127
139
  const isAnimated = !!(useAnimations && props.animation);
@@ -559,10 +571,20 @@ function createComponent(configIn, ParentComponent) {
559
571
  }
560
572
  }
561
573
  content = createElement(elementType, viewProps, childEls);
562
- if (isWeb && events && attachHover) {
563
- content = <span className="tui_Hoverable" style={{
564
- display: "contents"
565
- }} onMouseEnter={events.onMouseEnter} onMouseLeave={events.onMouseLeave}>{content}</span>;
574
+ if (isWeb) {
575
+ const isAnimatedRNWView = isAnimated && typeof elementType !== "string";
576
+ const shouldWrapWithComponentTheme = isAnimatedRNWView && getReturnVariablesAs(props, splitStyleState) === "non-color-value";
577
+ const shouldWrapWithHover = events && attachHover;
578
+ if (shouldWrapWithHover || shouldWrapWithComponentTheme) {
579
+ const themeClassName = shouldWrapWithComponentTheme ? `${theme.className}` : "";
580
+ const hoverClassName = shouldWrapWithHover ? "tui_Hoverable" : "";
581
+ content = <span className={`${hoverClassName} ${themeClassName}`} style={{
582
+ display: "contents"
583
+ }} {...shouldWrapWithHover && {
584
+ onMouseEnter: events.onMouseEnter,
585
+ onMouseLeave: events.onMouseLeave
586
+ }}>{content}</span>;
587
+ }
566
588
  }
567
589
  if (process.env.NODE_ENV === "development") {
568
590
  if (props["debug"]) {
@@ -597,11 +619,8 @@ function createComponent(configIn, ParentComponent) {
597
619
  focus: false,
598
620
  resolveVariablesAs: "both",
599
621
  keepVariantsAsProps: true
600
- });
601
- const defaults = {
602
- ...component.defaultProps,
603
- ...initialSplitStyles.viewProps
604
- };
622
+ }, void 0, staticConfig.defaultProps["debug"]);
623
+ const defaults = mergeProps(component.defaultProps, initialSplitStyles.viewProps);
605
624
  defaultNativeStyle = {};
606
625
  const validStyles2 = staticConfig.validStyles || stylePropsView;
607
626
  for (const key in staticConfig.defaultProps) {
@@ -12,7 +12,7 @@ const createMediaStyle = /* @__PURE__ */ __name(({ identifier, rules }, mediaKey
12
12
  const screenStr = negate ? "not all" : "screen";
13
13
  const mediaSelector = mediaObjectToString(mediaQueries[mediaKey]);
14
14
  const mediaQuery = `${screenStr} and ${mediaSelector}`;
15
- const styleInner = rules[0].replace(identifier, nextIdentifier);
15
+ const styleInner = rules.map((rule) => rule.replace(identifier, nextIdentifier)).join(";");
16
16
  let styleRule = "";
17
17
  if (styleInner.includes("@media")) {
18
18
  styleRule = styleInner.replace("{", ` and ${mediaQuery} {`);
@@ -6,17 +6,20 @@ import { isVariable } from "../createVariable";
6
6
  import { expandStyle, expandStyles } from "./generateAtomicStyles";
7
7
  import { getVariantExtras } from "./getVariantExtras";
8
8
  import { isObj } from "./isObj";
9
+ const getReturnVariablesAs = /* @__PURE__ */ __name((props, state) => {
10
+ return !!props.animation || state.resolveVariablesAs === "value" ? isWeb ? "non-color-value" : "value" : "auto";
11
+ }, "getReturnVariablesAs");
9
12
  const createPropMapper = /* @__PURE__ */ __name((staticConfig) => {
10
13
  const variants = staticConfig.variants || {};
11
14
  const defaultProps = staticConfig.defaultProps || {};
12
- const mapper = /* @__PURE__ */ __name((key, value, theme, propsIn, state, avoidDefaultProps = false) => {
15
+ const mapper = /* @__PURE__ */ __name((key, value, theme, propsIn, state, avoidDefaultProps = false, debug) => {
13
16
  const conf = getConfig();
14
17
  if (!conf) {
15
18
  console.trace("no conf! err");
16
19
  return;
17
20
  }
18
21
  const props = state.fallbackProps || propsIn;
19
- const returnVariablesAs = state.resolveVariablesAs === "value" || !!props.animation ? "value" : "auto";
22
+ const returnVariablesAs = getReturnVariablesAs(props, state);
20
23
  const fontFamily = props.fontFamily || defaultProps.fontFamily || "$body";
21
24
  const variantValue = resolveVariants(key, value, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, "", avoidDefaultProps);
22
25
  if (variantValue) {
@@ -29,9 +32,9 @@ const createPropMapper = /* @__PURE__ */ __name((staticConfig) => {
29
32
  }
30
33
  if (value) {
31
34
  if (value[0] === "$") {
32
- value = getToken(key, value, conf, theme, fontFamily, returnVariablesAs);
35
+ value = getToken(key, value, conf, theme, fontFamily, returnVariablesAs, debug);
33
36
  } else if (isVariable(value)) {
34
- value = getVariableValue(value, returnVariablesAs);
37
+ value = getVariableValue(key, value, returnVariablesAs);
35
38
  }
36
39
  }
37
40
  if (shouldReturn) {
@@ -40,7 +43,7 @@ const createPropMapper = /* @__PURE__ */ __name((staticConfig) => {
40
43
  }, "mapper");
41
44
  return mapper;
42
45
  }, "createPropMapper");
43
- const resolveVariants = /* @__PURE__ */ __name((key, value, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, parentVariantKey, avoidDefaultProps = false) => {
46
+ const resolveVariants = /* @__PURE__ */ __name((key, value, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, parentVariantKey, avoidDefaultProps = false, debug) => {
44
47
  var _a;
45
48
  const variant = variants && variants[key];
46
49
  if (variant && value !== void 0) {
@@ -51,7 +54,7 @@ const resolveVariants = /* @__PURE__ */ __name((key, value, props, defaultProps,
51
54
  variantValue = fn(value, getVariantExtras(props, theme, defaultProps, avoidDefaultProps));
52
55
  }
53
56
  if (isObj(variantValue)) {
54
- variantValue = resolveTokensAndVariants(key, variantValue, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, parentVariantKey, avoidDefaultProps);
57
+ variantValue = resolveTokensAndVariants(key, variantValue, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, parentVariantKey, avoidDefaultProps, debug);
55
58
  }
56
59
  return Object.entries(expandStyles(variantValue));
57
60
  } else {
@@ -59,13 +62,14 @@ const resolveVariants = /* @__PURE__ */ __name((key, value, props, defaultProps,
59
62
  if ((_a = staticConfig.validStyles) == null ? void 0 : _a[key]) {
60
63
  return null;
61
64
  }
62
- console.warn(`No variant found: ${staticConfig.componentName || "[UnnamedComponent]"} has variant "${key}", but no matching value "${value}"`);
65
+ const name = staticConfig.componentName || "[UnnamedComponent]";
66
+ console.warn(`No variant found: ${name} has variant "${key}", but no matching value "${value}"`);
63
67
  }
64
68
  return null;
65
69
  }
66
70
  }
67
71
  }, "resolveVariants");
68
- const resolveTokensAndVariants = /* @__PURE__ */ __name((key, value, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, parentVariantKey, avoidDefaultProps) => {
72
+ const resolveTokensAndVariants = /* @__PURE__ */ __name((key, value, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, parentVariantKey, avoidDefaultProps, debug) => {
69
73
  var _a;
70
74
  let res = {};
71
75
  for (const rKey in value) {
@@ -79,15 +83,15 @@ const resolveTokensAndVariants = /* @__PURE__ */ __name((key, value, props, defa
79
83
  } else {
80
84
  res = {
81
85
  ...res,
82
- ...Object.fromEntries(resolveVariants(fKey, val, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, key, avoidDefaultProps))
86
+ ...Object.fromEntries(resolveVariants(fKey, val, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, key, avoidDefaultProps, debug))
83
87
  };
84
88
  }
85
89
  } else if (typeof val === "string") {
86
- const fVal = val[0] === "$" ? getToken(fKey, val, conf, theme, fontFamily, returnVariablesAs) : val;
90
+ const fVal = val[0] === "$" ? getToken(fKey, val, conf, theme, fontFamily, returnVariablesAs, debug) : val;
87
91
  res[fKey] = fVal;
88
92
  } else {
89
93
  if (isObj(val)) {
90
- res[fKey] = resolveTokensAndVariants(fKey, val, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, key, avoidDefaultProps);
94
+ res[fKey] = resolveTokensAndVariants(fKey, val, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, key, avoidDefaultProps, debug);
91
95
  } else {
92
96
  res[fKey] = value[fKey];
93
97
  }
@@ -128,7 +132,7 @@ const fontShorthand = {
128
132
  fontSize: "size",
129
133
  fontWeight: "weight"
130
134
  };
131
- const getToken = /* @__PURE__ */ __name((key, value, { tokensParsed, fontsParsed }, theme, fontFamily = "$body", resolveAs) => {
135
+ const getToken = /* @__PURE__ */ __name((key, value, { tokensParsed, fontsParsed }, theme, fontFamily = "$body", resolveAs, debug) => {
132
136
  var _a, _b, _c;
133
137
  let valOrVar;
134
138
  let hasSet = false;
@@ -167,21 +171,39 @@ const getToken = /* @__PURE__ */ __name((key, value, { tokensParsed, fontsParsed
167
171
  }
168
172
  }
169
173
  if (hasSet) {
170
- return getVariableValue(valOrVar, resolveAs);
174
+ return getVariableValue(key, valOrVar, resolveAs);
171
175
  }
172
176
  if (process.env.NODE_ENV === "development") {
173
177
  if (value && value[0] === "$") {
174
- console.warn(`\u26A0\uFE0F Missing token:`, key, value, fontFamily, theme, fontsParsed);
178
+ console.warn(`\u26A0\uFE0F You've passed the value "${value}" to the style property "${key}", but there's no theme or token with the key "${value}". Using theme "${theme.name}".
179
+
180
+ Set the debug prop to true to see more detailed debug information.`);
181
+ if (debug) {
182
+ if (typeof window !== "undefined") {
183
+ console.log("Looked in:");
184
+ console.log("Theme:", theme);
185
+ console.log("Tokens:", tokensParsed);
186
+ console.log("Fonts:", fontsParsed);
187
+ }
188
+ }
175
189
  return null;
176
190
  }
177
191
  }
178
192
  return value;
179
193
  }, "getToken");
180
- function getVariableValue(valOrVar, resolveAs = "auto") {
194
+ function getVariableValue(key, valOrVar, resolveAs = "auto") {
181
195
  if (isVariable(valOrVar)) {
182
196
  if (resolveAs === "variable") {
183
197
  return valOrVar;
184
198
  }
199
+ if (resolveAs === "non-color-value") {
200
+ if (isWeb) {
201
+ if (key in tokenCategories.color) {
202
+ return valOrVar.variable;
203
+ }
204
+ }
205
+ return valOrVar.val;
206
+ }
185
207
  if (!isWeb || resolveAs === "value") {
186
208
  return valOrVar.val;
187
209
  }
@@ -192,7 +214,11 @@ function getVariableValue(valOrVar, resolveAs = "auto") {
192
214
  __name(getVariableValue, "getVariableValue");
193
215
  const tokenCategories = {
194
216
  radius: {
195
- borderRadius: true
217
+ borderRadius: true,
218
+ borderTopLeftRadius: true,
219
+ borderTopRightRadius: true,
220
+ borderBottomLeftRadius: true,
221
+ borderBottomRightRadius: true
196
222
  },
197
223
  size: {
198
224
  width: true,
@@ -213,5 +239,6 @@ const tokenCategories = {
213
239
  }
214
240
  };
215
241
  export {
216
- createPropMapper
242
+ createPropMapper,
243
+ getReturnVariablesAs
217
244
  };
@@ -2,6 +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 { createPropMapper } from "./createPropMapper";
5
+ import { mergeProps } from "./mergeProps";
5
6
  function extendStaticConfig(config, parent) {
6
7
  var _a;
7
8
  if (!parent || !("staticConfig" in parent)) {
@@ -35,12 +36,13 @@ function extendStaticConfig(config, parent) {
35
36
  ...parent.staticConfig.validStyles,
36
37
  ...config.validStyles
37
38
  } : parent.staticConfig.validStyles || stylePropsView,
38
- defaultProps: {
39
+ defaultProps: mergeProps({
39
40
  ...parent.staticConfig.defaultProps,
40
- ...parent.staticConfig.defaultVariants,
41
+ ...parent.staticConfig.defaultVariants
42
+ }, {
41
43
  ...config.defaultProps,
42
44
  ...config.defaultVariants
43
- }
45
+ })
44
46
  });
45
47
  }
46
48
  __name(extendStaticConfig, "extendStaticConfig");