@tamagui/web 1.4.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/cjs/createComponent.js +4 -5
  2. package/dist/cjs/createComponent.js.map +2 -2
  3. package/dist/cjs/createTamagui.js +7 -6
  4. package/dist/cjs/createTamagui.js.map +3 -3
  5. package/dist/cjs/helpers/expandStyle.js +5 -14
  6. package/dist/cjs/helpers/expandStyle.js.map +2 -2
  7. package/dist/cjs/helpers/expandStyles.js +4 -42
  8. package/dist/cjs/helpers/expandStyles.js.map +2 -2
  9. package/dist/cjs/helpers/getSplitStyles.js +22 -23
  10. package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
  11. package/dist/cjs/helpers/normalizeColor.js +13 -15
  12. package/dist/cjs/helpers/normalizeColor.js.map +2 -2
  13. package/dist/cjs/helpers/normalizeValueWithProperty.js +8 -19
  14. package/dist/cjs/helpers/normalizeValueWithProperty.js.map +2 -2
  15. package/dist/cjs/helpers/themeable.js.map +1 -1
  16. package/dist/cjs/views/Theme.js +2 -2
  17. package/dist/cjs/views/Theme.js.map +2 -2
  18. package/dist/esm/createComponent.js +5 -10
  19. package/dist/esm/createComponent.js.map +2 -2
  20. package/dist/esm/createComponent.mjs +5 -10
  21. package/dist/esm/createComponent.mjs.map +2 -2
  22. package/dist/esm/createTamagui.js +7 -6
  23. package/dist/esm/createTamagui.js.map +3 -3
  24. package/dist/esm/createTamagui.mjs +7 -6
  25. package/dist/esm/createTamagui.mjs.map +3 -3
  26. package/dist/esm/helpers/expandStyle.js +5 -14
  27. package/dist/esm/helpers/expandStyle.js.map +2 -2
  28. package/dist/esm/helpers/expandStyle.mjs +5 -14
  29. package/dist/esm/helpers/expandStyle.mjs.map +2 -2
  30. package/dist/esm/helpers/expandStyles.js +3 -41
  31. package/dist/esm/helpers/expandStyles.js.map +2 -2
  32. package/dist/esm/helpers/expandStyles.mjs +3 -41
  33. package/dist/esm/helpers/expandStyles.mjs.map +2 -2
  34. package/dist/esm/helpers/getSplitStyles.js +20 -21
  35. package/dist/esm/helpers/getSplitStyles.js.map +2 -2
  36. package/dist/esm/helpers/getSplitStyles.mjs +20 -21
  37. package/dist/esm/helpers/getSplitStyles.mjs.map +2 -2
  38. package/dist/esm/helpers/normalizeColor.js +12 -15
  39. package/dist/esm/helpers/normalizeColor.js.map +2 -2
  40. package/dist/esm/helpers/normalizeColor.mjs +12 -15
  41. package/dist/esm/helpers/normalizeColor.mjs.map +2 -2
  42. package/dist/esm/helpers/normalizeValueWithProperty.js +9 -20
  43. package/dist/esm/helpers/normalizeValueWithProperty.js.map +2 -2
  44. package/dist/esm/helpers/normalizeValueWithProperty.mjs +9 -20
  45. package/dist/esm/helpers/normalizeValueWithProperty.mjs.map +2 -2
  46. package/dist/esm/helpers/themeable.js.map +1 -1
  47. package/dist/esm/helpers/themeable.mjs.map +1 -1
  48. package/dist/esm/views/Theme.js +2 -2
  49. package/dist/esm/views/Theme.js.map +2 -2
  50. package/dist/esm/views/Theme.mjs +2 -2
  51. package/dist/esm/views/Theme.mjs.map +2 -2
  52. package/package.json +9 -9
  53. package/src/createComponent.tsx +7 -13
  54. package/src/createTamagui.ts +6 -4
  55. package/src/helpers/expandStyle.ts +5 -18
  56. package/src/helpers/expandStyles.ts +9 -46
  57. package/src/helpers/getSplitStyles.tsx +31 -24
  58. package/src/helpers/normalizeColor.ts +11 -22
  59. package/src/helpers/normalizeShadow.native.ts +30 -0
  60. package/src/helpers/normalizeShadow.ts +20 -0
  61. package/src/helpers/normalizeStylePropKeys.native.ts +12 -0
  62. package/src/helpers/normalizeStylePropKeys.ts +3 -0
  63. package/src/helpers/normalizeValueWithProperty.ts +9 -23
  64. package/src/helpers/themeable.tsx +2 -2
  65. package/src/views/Theme.tsx +2 -3
  66. package/types/createComponent.d.ts.map +1 -1
  67. package/types/createTamagui.d.ts.map +1 -1
  68. package/types/helpers/expandStyle.d.ts.map +1 -1
  69. package/types/helpers/expandStyles.d.ts.map +1 -1
  70. package/types/helpers/getSplitStyles.d.ts +1 -2
  71. package/types/helpers/getSplitStyles.d.ts.map +1 -1
  72. package/types/helpers/normalizeColor.d.ts +5 -0
  73. package/types/helpers/normalizeColor.d.ts.map +1 -1
  74. package/types/helpers/normalizeColor.native.d.ts +16 -0
  75. package/types/helpers/normalizeShadow.d.ts +10 -0
  76. package/types/helpers/normalizeShadow.native.d.ts +10 -0
  77. package/types/helpers/normalizeStylePropKeys.d.ts +2 -0
  78. package/types/helpers/normalizeStylePropKeys.native.d.ts +13 -0
  79. package/types/helpers/normalizeValueWithProperty.d.ts.map +1 -1
  80. package/types/helpers/themeable.d.ts +2 -2
  81. package/types/helpers/themeable.d.ts.map +1 -1
  82. package/types/views/Theme.d.ts.map +1 -1
  83. package/src/helpers/mergeTransform.ts +0 -30
@@ -1,35 +1,32 @@
1
1
  import { isWeb } from "@tamagui/constants";
2
2
  import * as NCC from "@tamagui/normalize-css-color";
3
3
  const rgba = NCC.rgba;
4
- const normalizeColor = (color, opacity) => {
5
- if (color === null || color === void 0) {
4
+ const names = NCC.names;
5
+ const normalizeColor = (color, opacity = 1) => {
6
+ if (!color)
6
7
  return;
7
- }
8
- if (color === "transparent") {
8
+ if (color === "transparent")
9
9
  return `rgba(0,0,0,0)`;
10
- }
11
- if (color[0] === "$" || isWeb && (webColors[color] || color[0] === "_" || color.startsWith("var("))) {
10
+ if (color[0] === "$")
11
+ return color;
12
+ if (isWeb && opacity === 1) {
12
13
  return color;
13
14
  }
14
15
  const colorProcessed = NCC.normalizeCSSColor(color);
15
- if (colorProcessed !== null) {
16
+ if (colorProcessed) {
16
17
  const { r, g, b, a } = rgba(colorProcessed);
17
18
  return `rgba(${r},${g},${b},${(opacity ?? a).toFixed(2)})`;
18
19
  }
19
- if (isWeb) {
20
- return color;
21
- } else {
20
+ if (process.env.TAMAGUI_TARGET === "native") {
22
21
  if (process.env.NODE_ENV === "development") {
23
22
  console.warn(`Unknown color value: ${color}`);
24
23
  }
24
+ return;
25
25
  }
26
- };
27
- const webColors = {
28
- currentColor: true,
29
- currentcolor: true,
30
- inherit: true
26
+ return color;
31
27
  };
32
28
  export {
29
+ names,
33
30
  normalizeColor,
34
31
  rgba
35
32
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/normalizeColor.ts"],
4
- "sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport * as NCC from '@tamagui/normalize-css-color'\n\nexport const rgba = NCC.rgba\n\nexport const normalizeColor = (color?: string | null, opacity?: number) => {\n if (color === null || color === undefined) {\n return\n }\n if (color === 'transparent') {\n return `rgba(0,0,0,0)`\n }\n if (\n color[0] === '$' ||\n (isWeb && (webColors[color] || color[0] === '_' || color.startsWith('var(')))\n ) {\n return color\n }\n const colorProcessed = NCC.normalizeCSSColor(color)\n if (colorProcessed !== null) {\n const { r, g, b, a } = rgba(colorProcessed)\n return `rgba(${r},${g},${b},${(opacity ?? a).toFixed(2)})`\n }\n\n if (isWeb) {\n return color\n } else {\n if (process.env.NODE_ENV === 'development') {\n console.warn(`Unknown color value: ${color}`)\n }\n }\n}\n\nconst webColors = {\n currentColor: true,\n currentcolor: true,\n inherit: true,\n}\n"],
5
- "mappings": "AAAA,SAAS,aAAa;AACtB,YAAY,SAAS;AAEd,MAAM,OAAO,IAAI;AAEjB,MAAM,iBAAiB,CAAC,OAAuB,YAAqB;AACzE,MAAI,UAAU,QAAQ,UAAU,QAAW;AACzC;AAAA,EACF;AACA,MAAI,UAAU,eAAe;AAC3B,WAAO;AAAA,EACT;AACA,MACE,MAAM,CAAC,MAAM,OACZ,UAAU,UAAU,KAAK,KAAK,MAAM,CAAC,MAAM,OAAO,MAAM,WAAW,MAAM,IAC1E;AACA,WAAO;AAAA,EACT;AACA,QAAM,iBAAiB,IAAI,kBAAkB,KAAK;AAClD,MAAI,mBAAmB,MAAM;AAC3B,UAAM,EAAE,GAAG,GAAG,GAAG,EAAE,IAAI,KAAK,cAAc;AAC1C,WAAO,QAAQ,KAAK,KAAK,MAAM,WAAW,GAAG,QAAQ,CAAC;AAAA,EACxD;AAEA,MAAI,OAAO;AACT,WAAO;AAAA,EACT,OAAO;AACL,QAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,cAAQ,KAAK,wBAAwB,OAAO;AAAA,IAC9C;AAAA,EACF;AACF;AAEA,MAAM,YAAY;AAAA,EAChB,cAAc;AAAA,EACd,cAAc;AAAA,EACd,SAAS;AACX;",
4
+ "sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport * as NCC from '@tamagui/normalize-css-color'\n\nexport const rgba = NCC.rgba\nexport const names = NCC.names\n\nexport const normalizeColor = (color?: string | null, opacity = 1) => {\n if (!color) return\n if (color === 'transparent') return `rgba(0,0,0,0)`\n if (color[0] === '$') return color\n if (isWeb && opacity === 1) {\n return color\n }\n const colorProcessed = NCC.normalizeCSSColor(color)\n if (colorProcessed) {\n const { r, g, b, a } = rgba(colorProcessed)\n return `rgba(${r},${g},${b},${(opacity ?? a).toFixed(2)})`\n }\n if (process.env.TAMAGUI_TARGET === 'native') {\n if (process.env.NODE_ENV === 'development') {\n console.warn(`Unknown color value: ${color}`)\n }\n // avoids errors\n return\n }\n return color\n}\n"],
5
+ "mappings": "AAAA,SAAS,aAAa;AACtB,YAAY,SAAS;AAEd,MAAM,OAAO,IAAI;AACjB,MAAM,QAAQ,IAAI;AAElB,MAAM,iBAAiB,CAAC,OAAuB,UAAU,MAAM;AACpE,MAAI,CAAC;AAAO;AACZ,MAAI,UAAU;AAAe,WAAO;AACpC,MAAI,MAAM,CAAC,MAAM;AAAK,WAAO;AAC7B,MAAI,SAAS,YAAY,GAAG;AAC1B,WAAO;AAAA,EACT;AACA,QAAM,iBAAiB,IAAI,kBAAkB,KAAK;AAClD,MAAI,gBAAgB;AAClB,UAAM,EAAE,GAAG,GAAG,GAAG,EAAE,IAAI,KAAK,cAAc;AAC1C,WAAO,QAAQ,KAAK,KAAK,MAAM,WAAW,GAAG,QAAQ,CAAC;AAAA,EACxD;AACA,MAAI,QAAQ,IAAI,mBAAmB,UAAU;AAC3C,QAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,cAAQ,KAAK,wBAAwB,OAAO;AAAA,IAC9C;AAEA;AAAA,EACF;AACA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,35 +1,32 @@
1
1
  import { isWeb } from "@tamagui/constants";
2
2
  import * as NCC from "@tamagui/normalize-css-color";
3
3
  const rgba = NCC.rgba;
4
- const normalizeColor = (color, opacity) => {
5
- if (color === null || color === void 0) {
4
+ const names = NCC.names;
5
+ const normalizeColor = (color, opacity = 1) => {
6
+ if (!color)
6
7
  return;
7
- }
8
- if (color === "transparent") {
8
+ if (color === "transparent")
9
9
  return `rgba(0,0,0,0)`;
10
- }
11
- if (color[0] === "$" || isWeb && (webColors[color] || color[0] === "_" || color.startsWith("var("))) {
10
+ if (color[0] === "$")
11
+ return color;
12
+ if (isWeb && opacity === 1) {
12
13
  return color;
13
14
  }
14
15
  const colorProcessed = NCC.normalizeCSSColor(color);
15
- if (colorProcessed !== null) {
16
+ if (colorProcessed) {
16
17
  const { r, g, b, a } = rgba(colorProcessed);
17
18
  return `rgba(${r},${g},${b},${(opacity ?? a).toFixed(2)})`;
18
19
  }
19
- if (isWeb) {
20
- return color;
21
- } else {
20
+ if (process.env.TAMAGUI_TARGET === "native") {
22
21
  if (process.env.NODE_ENV === "development") {
23
22
  console.warn(`Unknown color value: ${color}`);
24
23
  }
24
+ return;
25
25
  }
26
- };
27
- const webColors = {
28
- currentColor: true,
29
- currentcolor: true,
30
- inherit: true
26
+ return color;
31
27
  };
32
28
  export {
29
+ names,
33
30
  normalizeColor,
34
31
  rgba
35
32
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/normalizeColor.ts"],
4
- "sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport * as NCC from '@tamagui/normalize-css-color'\n\nexport const rgba = NCC.rgba\n\nexport const normalizeColor = (color?: string | null, opacity?: number) => {\n if (color === null || color === undefined) {\n return\n }\n if (color === 'transparent') {\n return `rgba(0,0,0,0)`\n }\n if (\n color[0] === '$' ||\n (isWeb && (webColors[color] || color[0] === '_' || color.startsWith('var(')))\n ) {\n return color\n }\n const colorProcessed = NCC.normalizeCSSColor(color)\n if (colorProcessed !== null) {\n const { r, g, b, a } = rgba(colorProcessed)\n return `rgba(${r},${g},${b},${(opacity ?? a).toFixed(2)})`\n }\n\n if (isWeb) {\n return color\n } else {\n if (process.env.NODE_ENV === 'development') {\n console.warn(`Unknown color value: ${color}`)\n }\n }\n}\n\nconst webColors = {\n currentColor: true,\n currentcolor: true,\n inherit: true,\n}\n"],
5
- "mappings": "AAAA,SAAS,aAAa;AACtB,YAAY,SAAS;AAEd,MAAM,OAAO,IAAI;AAEjB,MAAM,iBAAiB,CAAC,OAAuB,YAAqB;AACzE,MAAI,UAAU,QAAQ,UAAU,QAAW;AACzC;AAAA,EACF;AACA,MAAI,UAAU,eAAe;AAC3B,WAAO;AAAA,EACT;AACA,MACE,MAAM,CAAC,MAAM,OACZ,UAAU,UAAU,KAAK,KAAK,MAAM,CAAC,MAAM,OAAO,MAAM,WAAW,MAAM,IAC1E;AACA,WAAO;AAAA,EACT;AACA,QAAM,iBAAiB,IAAI,kBAAkB,KAAK;AAClD,MAAI,mBAAmB,MAAM;AAC3B,UAAM,EAAE,GAAG,GAAG,GAAG,EAAE,IAAI,KAAK,cAAc;AAC1C,WAAO,QAAQ,KAAK,KAAK,MAAM,WAAW,GAAG,QAAQ,CAAC;AAAA,EACxD;AAEA,MAAI,OAAO;AACT,WAAO;AAAA,EACT,OAAO;AACL,QAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,cAAQ,KAAK,wBAAwB,OAAO;AAAA,IAC9C;AAAA,EACF;AACF;AAEA,MAAM,YAAY;AAAA,EAChB,cAAc;AAAA,EACd,cAAc;AAAA,EACd,SAAS;AACX;",
4
+ "sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport * as NCC from '@tamagui/normalize-css-color'\n\nexport const rgba = NCC.rgba\nexport const names = NCC.names\n\nexport const normalizeColor = (color?: string | null, opacity = 1) => {\n if (!color) return\n if (color === 'transparent') return `rgba(0,0,0,0)`\n if (color[0] === '$') return color\n if (isWeb && opacity === 1) {\n return color\n }\n const colorProcessed = NCC.normalizeCSSColor(color)\n if (colorProcessed) {\n const { r, g, b, a } = rgba(colorProcessed)\n return `rgba(${r},${g},${b},${(opacity ?? a).toFixed(2)})`\n }\n if (process.env.TAMAGUI_TARGET === 'native') {\n if (process.env.NODE_ENV === 'development') {\n console.warn(`Unknown color value: ${color}`)\n }\n // avoids errors\n return\n }\n return color\n}\n"],
5
+ "mappings": "AAAA,SAAS,aAAa;AACtB,YAAY,SAAS;AAEd,MAAM,OAAO,IAAI;AACjB,MAAM,QAAQ,IAAI;AAElB,MAAM,iBAAiB,CAAC,OAAuB,UAAU,MAAM;AACpE,MAAI,CAAC;AAAO;AACZ,MAAI,UAAU;AAAe,WAAO;AACpC,MAAI,MAAM,CAAC,MAAM;AAAK,WAAO;AAC7B,MAAI,SAAS,YAAY,GAAG;AAC1B,WAAO;AAAA,EACT;AACA,QAAM,iBAAiB,IAAI,kBAAkB,KAAK;AAClD,MAAI,gBAAgB;AAClB,UAAM,EAAE,GAAG,GAAG,GAAG,EAAE,IAAI,KAAK,cAAc;AAC1C,WAAO,QAAQ,KAAK,KAAK,MAAM,WAAW,GAAG,QAAQ,CAAC;AAAA,EACxD;AACA,MAAI,QAAQ,IAAI,mBAAmB,UAAU;AAC3C,QAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,cAAQ,KAAK,wBAAwB,OAAO;AAAA,IAC9C;AAEA;AAAA,EACF;AACA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,38 +1,26 @@
1
1
  import { isWeb } from "@tamagui/constants";
2
2
  import { getAllSelectors } from "./insertStyleRule";
3
- import { normalizeColor } from "./normalizeColor";
3
+ import { names, normalizeColor } from "./normalizeColor";
4
+ import { normalizeStylePropKeys } from "./normalizeStylePropKeys";
4
5
  const colorCache = {};
5
6
  function normalizeValueWithProperty(value, property) {
6
- const cached = colorCache[value];
7
- if (cached !== void 0) {
8
- return cached;
7
+ if (value in colorCache) {
8
+ return colorCache[value];
9
9
  }
10
10
  if (property && property in unitlessNumbers) {
11
11
  return value;
12
12
  }
13
13
  let res = value;
14
- if (process.env.TAMAGUI_TARGET === "web" && typeof value === "number" && (property === void 0 || !(property in unitlessNumbers || property in stringNumbers))) {
14
+ if (property && (property in normalizeStylePropKeys || value in names)) {
15
+ res = normalizeColor(value);
16
+ colorCache[value] = res;
17
+ } else if (process.env.TAMAGUI_TARGET === "web" && typeof value === "number" && (property === void 0 || !(property in unitlessNumbers || property in stringNumbers))) {
15
18
  res = `${value}px`;
16
19
  } else if (isWeb && property !== void 0 && property in stringNumbers) {
17
20
  res = `${res}`;
18
- } else if (property && property in colorProps) {
19
- res = normalizeColor(value);
20
- colorCache[value] = res;
21
21
  }
22
22
  return res;
23
23
  }
24
- const colorProps = {
25
- backgroundColor: true,
26
- borderColor: true,
27
- borderTopColor: true,
28
- borderRightColor: true,
29
- borderBottomColor: true,
30
- borderLeftColor: true,
31
- color: true,
32
- shadowColor: true,
33
- textDecorationColor: true,
34
- textShadowColor: true
35
- };
36
24
  const stringNumbers = {
37
25
  zIndex: true
38
26
  };
@@ -46,6 +34,7 @@ const unitlessNumbers = {
46
34
  columnCount: true,
47
35
  flex: true,
48
36
  flexGrow: true,
37
+ flexBasis: true,
49
38
  flexOrder: true,
50
39
  flexPositive: true,
51
40
  flexShrink: true,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/normalizeValueWithProperty.ts"],
4
- "sourcesContent": ["/**\n * Some parts adapted from react-native-web\n * Copyright (c) Nicolas Gallagher licensed under the MIT license.\n */\n\nimport { isWeb } from '@tamagui/constants'\n\nimport { getAllSelectors } from './insertStyleRule'\nimport { normalizeColor } from './normalizeColor'\n\nconst colorCache = {}\n\nexport function normalizeValueWithProperty(value: any, property?: string): any {\n const cached = colorCache[value]\n if (cached !== undefined) {\n return cached\n }\n if (property && property in unitlessNumbers) {\n return value\n }\n let res = value\n if (\n process.env.TAMAGUI_TARGET === 'web' &&\n typeof value === 'number' &&\n (property === undefined ||\n !(property in unitlessNumbers || property in stringNumbers))\n ) {\n res = `${value}px`\n } else if (isWeb && property !== undefined && property in stringNumbers) {\n res = `${res}`\n } else if (property && property in colorProps) {\n res = normalizeColor(value)\n colorCache[value] = res\n }\n return res\n}\n\n// TODO react-native-web-lite\n\nconst colorProps = {\n backgroundColor: true,\n borderColor: true,\n borderTopColor: true,\n borderRightColor: true,\n borderBottomColor: true,\n borderLeftColor: true,\n color: true,\n shadowColor: true,\n textDecorationColor: true,\n textShadowColor: true,\n}\n\nconst stringNumbers = {\n zIndex: true,\n}\n\nconst unitlessNumbers = {\n WebkitLineClamp: true,\n animationIterationCount: true,\n aspectRatio: true,\n borderImageOutset: true,\n borderImageSlice: true,\n borderImageWidth: true,\n columnCount: true,\n flex: true,\n flexGrow: true,\n flexOrder: true,\n flexPositive: true,\n flexShrink: true,\n flexNegative: true,\n fontWeight: true,\n gridRow: true,\n gridRowEnd: true,\n gridRowGap: true,\n gridRowStart: true,\n gridColumn: true,\n gridColumnEnd: true,\n gridColumnGap: true,\n gridColumnStart: true,\n lineClamp: true,\n opacity: true,\n order: true,\n orphans: true,\n tabSize: true,\n widows: true,\n zoom: true,\n scale: true,\n scaleX: true,\n scaleY: true,\n scaleZ: true,\n shadowOpacity: true,\n}\n\n// getting real values for colors for animations (reverse mapped from CSS)\n// this isn't beautiful, but will do relatively fine performance for now\nconst rcache = {}\nexport function reverseMapClassNameToValue(key: string, className: string) {\n const selectors = getAllSelectors()\n const cssRule = selectors[className]\n if (rcache[cssRule]) return rcache[cssRule]\n if (!cssRule) {\n return\n }\n const cssVal = cssRule.replace(/.*:/, '').replace(/;.*/, '').trim()\n let res: any\n if (cssVal.startsWith('var(')) {\n res = cssVal\n } else if (unitlessNumbers[key]) {\n res = +cssVal\n } else if (cssVal.endsWith('px')) {\n res = +cssVal.replace('px', '')\n } else {\n res = cssVal\n }\n rcache[cssRule] = res\n if (process.env.NODE_ENV === 'development') {\n // ensure we are parsing properly\n if (typeof res === 'number' && isNaN(res)) {\n // eslint-disable-next-line no-console\n console.log('Tamagui invalid parsed value, NaN:', {\n res,\n cssVal,\n cssRule,\n key,\n className,\n })\n }\n }\n return res\n}\n"],
5
- "mappings": "AAKA,SAAS,aAAa;AAEtB,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAE/B,MAAM,aAAa,CAAC;AAEb,SAAS,2BAA2B,OAAY,UAAwB;AAC7E,QAAM,SAAS,WAAW,KAAK;AAC/B,MAAI,WAAW,QAAW;AACxB,WAAO;AAAA,EACT;AACA,MAAI,YAAY,YAAY,iBAAiB;AAC3C,WAAO;AAAA,EACT;AACA,MAAI,MAAM;AACV,MACE,QAAQ,IAAI,mBAAmB,SAC/B,OAAO,UAAU,aAChB,aAAa,UACZ,EAAE,YAAY,mBAAmB,YAAY,iBAC/C;AACA,UAAM,GAAG;AAAA,EACX,WAAW,SAAS,aAAa,UAAa,YAAY,eAAe;AACvE,UAAM,GAAG;AAAA,EACX,WAAW,YAAY,YAAY,YAAY;AAC7C,UAAM,eAAe,KAAK;AAC1B,eAAW,KAAK,IAAI;AAAA,EACtB;AACA,SAAO;AACT;AAIA,MAAM,aAAa;AAAA,EACjB,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,OAAO;AAAA,EACP,aAAa;AAAA,EACb,qBAAqB;AAAA,EACrB,iBAAiB;AACnB;AAEA,MAAM,gBAAgB;AAAA,EACpB,QAAQ;AACV;AAEA,MAAM,kBAAkB;AAAA,EACtB,iBA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;AAEzC,cAAQ,IAAI,sCAAsC;AAAA,QAChD;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO;AACT;",
4
+ "sourcesContent": ["/**\n * Some parts adapted from react-native-web\n * Copyright (c) Nicolas Gallagher licensed under the MIT license.\n */\n\nimport { isWeb } from '@tamagui/constants'\n\nimport { getAllSelectors } from './insertStyleRule'\nimport { names, normalizeColor } from './normalizeColor'\nimport { normalizeStylePropKeys } from './normalizeStylePropKeys'\n\nconst colorCache = {}\n\nexport function normalizeValueWithProperty(value: any, property?: string): any {\n if (value in colorCache) {\n return colorCache[value]\n }\n if (property && property in unitlessNumbers) {\n return value\n }\n let res = value\n if (property && (property in normalizeStylePropKeys || value in names)) {\n res = normalizeColor(value)\n colorCache[value] = res\n } else if (\n process.env.TAMAGUI_TARGET === 'web' &&\n typeof value === 'number' &&\n (property === undefined ||\n !(property in unitlessNumbers || property in stringNumbers))\n ) {\n res = `${value}px`\n } else if (isWeb && property !== undefined && property in stringNumbers) {\n res = `${res}`\n }\n return res\n}\n\nconst stringNumbers = {\n zIndex: true,\n}\n\nconst unitlessNumbers = {\n WebkitLineClamp: true,\n animationIterationCount: true,\n aspectRatio: true,\n borderImageOutset: true,\n borderImageSlice: true,\n borderImageWidth: true,\n columnCount: true,\n flex: true,\n flexGrow: true,\n flexBasis: true,\n flexOrder: true,\n flexPositive: true,\n flexShrink: true,\n flexNegative: true,\n fontWeight: true,\n gridRow: true,\n gridRowEnd: true,\n gridRowGap: true,\n gridRowStart: true,\n gridColumn: true,\n gridColumnEnd: true,\n gridColumnGap: true,\n gridColumnStart: true,\n lineClamp: true,\n opacity: true,\n order: true,\n orphans: true,\n tabSize: true,\n widows: true,\n zoom: true,\n scale: true,\n scaleX: true,\n scaleY: true,\n scaleZ: true,\n shadowOpacity: true,\n}\n\n// getting real values for colors for animations (reverse mapped from CSS)\n// this isn't beautiful, but will do relatively fine performance for now\nconst rcache = {}\nexport function reverseMapClassNameToValue(key: string, className: string) {\n const selectors = getAllSelectors()\n const cssRule = selectors[className]\n if (rcache[cssRule]) return rcache[cssRule]\n if (!cssRule) {\n return\n }\n const cssVal = cssRule.replace(/.*:/, '').replace(/;.*/, '').trim()\n let res: any\n if (cssVal.startsWith('var(')) {\n res = cssVal\n } else if (unitlessNumbers[key]) {\n res = +cssVal\n } else if (cssVal.endsWith('px')) {\n res = +cssVal.replace('px', '')\n } else {\n res = cssVal\n }\n rcache[cssRule] = res\n if (process.env.NODE_ENV === 'development') {\n // ensure we are parsing properly\n if (typeof res === 'number' && isNaN(res)) {\n // eslint-disable-next-line no-console\n console.log('Tamagui invalid parsed value, NaN:', {\n res,\n cssVal,\n cssRule,\n key,\n className,\n })\n }\n }\n return res\n}\n"],
5
+ "mappings": "AAKA,SAAS,aAAa;AAEtB,SAAS,uBAAuB;AAChC,SAAS,OAAO,sBAAsB;AACtC,SAAS,8BAA8B;AAEvC,MAAM,aAAa,CAAC;AAEb,SAAS,2BAA2B,OAAY,UAAwB;AAC7E,MAAI,SAAS,YAAY;AACvB,WAAO,WAAW,KAAK;AAAA,EACzB;AACA,MAAI,YAAY,YAAY,iBAAiB;AAC3C,WAAO;AAAA,EACT;AACA,MAAI,MAAM;AACV,MAAI,aAAa,YAAY,0BAA0B,SAAS,QAAQ;AACtE,UAAM,eAAe,KAAK;AAC1B,eAAW,KAAK,IAAI;AAAA,EACtB,WACE,QAAQ,IAAI,mBAAmB,SAC/B,OAAO,UAAU,aAChB,aAAa,UACZ,EAAE,YAAY,mBAAmB,YAAY,iBAC/C;AACA,UAAM,GAAG;AAAA,EACX,WAAW,SAAS,aAAa,UAAa,YAAY,eAAe;AACvE,UAAM,GAAG;AAAA,EACX;AACA,SAAO;AACT;AAEA,MAAM,gBAAgB;AAAA,EACpB,QAAQ;AACV;AAEA,MAAM,kBAAkB;AAAA,EACtB,iBAAiB;AAAA,EACjB,yBAAyB;AAAA,EACzB,aAAa;AAA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AAAA,QAChD;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,38 +1,26 @@
1
1
  import { isWeb } from "@tamagui/constants";
2
2
  import { getAllSelectors } from "./insertStyleRule";
3
- import { normalizeColor } from "./normalizeColor";
3
+ import { names, normalizeColor } from "./normalizeColor";
4
+ import { normalizeStylePropKeys } from "./normalizeStylePropKeys";
4
5
  const colorCache = {};
5
6
  function normalizeValueWithProperty(value, property) {
6
- const cached = colorCache[value];
7
- if (cached !== void 0) {
8
- return cached;
7
+ if (value in colorCache) {
8
+ return colorCache[value];
9
9
  }
10
10
  if (property && property in unitlessNumbers) {
11
11
  return value;
12
12
  }
13
13
  let res = value;
14
- if (process.env.TAMAGUI_TARGET === "web" && typeof value === "number" && (property === void 0 || !(property in unitlessNumbers || property in stringNumbers))) {
14
+ if (property && (property in normalizeStylePropKeys || value in names)) {
15
+ res = normalizeColor(value);
16
+ colorCache[value] = res;
17
+ } else if (process.env.TAMAGUI_TARGET === "web" && typeof value === "number" && (property === void 0 || !(property in unitlessNumbers || property in stringNumbers))) {
15
18
  res = `${value}px`;
16
19
  } else if (isWeb && property !== void 0 && property in stringNumbers) {
17
20
  res = `${res}`;
18
- } else if (property && property in colorProps) {
19
- res = normalizeColor(value);
20
- colorCache[value] = res;
21
21
  }
22
22
  return res;
23
23
  }
24
- const colorProps = {
25
- backgroundColor: true,
26
- borderColor: true,
27
- borderTopColor: true,
28
- borderRightColor: true,
29
- borderBottomColor: true,
30
- borderLeftColor: true,
31
- color: true,
32
- shadowColor: true,
33
- textDecorationColor: true,
34
- textShadowColor: true
35
- };
36
24
  const stringNumbers = {
37
25
  zIndex: true
38
26
  };
@@ -46,6 +34,7 @@ const unitlessNumbers = {
46
34
  columnCount: true,
47
35
  flex: true,
48
36
  flexGrow: true,
37
+ flexBasis: true,
49
38
  flexOrder: true,
50
39
  flexPositive: true,
51
40
  flexShrink: true,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/normalizeValueWithProperty.ts"],
4
- "sourcesContent": ["/**\n * Some parts adapted from react-native-web\n * Copyright (c) Nicolas Gallagher licensed under the MIT license.\n */\n\nimport { isWeb } from '@tamagui/constants'\n\nimport { getAllSelectors } from './insertStyleRule'\nimport { normalizeColor } from './normalizeColor'\n\nconst colorCache = {}\n\nexport function normalizeValueWithProperty(value: any, property?: string): any {\n const cached = colorCache[value]\n if (cached !== undefined) {\n return cached\n }\n if (property && property in unitlessNumbers) {\n return value\n }\n let res = value\n if (\n process.env.TAMAGUI_TARGET === 'web' &&\n typeof value === 'number' &&\n (property === undefined ||\n !(property in unitlessNumbers || property in stringNumbers))\n ) {\n res = `${value}px`\n } else if (isWeb && property !== undefined && property in stringNumbers) {\n res = `${res}`\n } else if (property && property in colorProps) {\n res = normalizeColor(value)\n colorCache[value] = res\n }\n return res\n}\n\n// TODO react-native-web-lite\n\nconst colorProps = {\n backgroundColor: true,\n borderColor: true,\n borderTopColor: true,\n borderRightColor: true,\n borderBottomColor: true,\n borderLeftColor: true,\n color: true,\n shadowColor: true,\n textDecorationColor: true,\n textShadowColor: true,\n}\n\nconst stringNumbers = {\n zIndex: true,\n}\n\nconst unitlessNumbers = {\n WebkitLineClamp: true,\n animationIterationCount: true,\n aspectRatio: true,\n borderImageOutset: true,\n borderImageSlice: true,\n borderImageWidth: true,\n columnCount: true,\n flex: true,\n flexGrow: true,\n flexOrder: true,\n flexPositive: true,\n flexShrink: true,\n flexNegative: true,\n fontWeight: true,\n gridRow: true,\n gridRowEnd: true,\n gridRowGap: true,\n gridRowStart: true,\n gridColumn: true,\n gridColumnEnd: true,\n gridColumnGap: true,\n gridColumnStart: true,\n lineClamp: true,\n opacity: true,\n order: true,\n orphans: true,\n tabSize: true,\n widows: true,\n zoom: true,\n scale: true,\n scaleX: true,\n scaleY: true,\n scaleZ: true,\n shadowOpacity: true,\n}\n\n// getting real values for colors for animations (reverse mapped from CSS)\n// this isn't beautiful, but will do relatively fine performance for now\nconst rcache = {}\nexport function reverseMapClassNameToValue(key: string, className: string) {\n const selectors = getAllSelectors()\n const cssRule = selectors[className]\n if (rcache[cssRule]) return rcache[cssRule]\n if (!cssRule) {\n return\n }\n const cssVal = cssRule.replace(/.*:/, '').replace(/;.*/, '').trim()\n let res: any\n if (cssVal.startsWith('var(')) {\n res = cssVal\n } else if (unitlessNumbers[key]) {\n res = +cssVal\n } else if (cssVal.endsWith('px')) {\n res = +cssVal.replace('px', '')\n } else {\n res = cssVal\n }\n rcache[cssRule] = res\n if (process.env.NODE_ENV === 'development') {\n // ensure we are parsing properly\n if (typeof res === 'number' && isNaN(res)) {\n // eslint-disable-next-line no-console\n console.log('Tamagui invalid parsed value, NaN:', {\n res,\n cssVal,\n cssRule,\n key,\n className,\n })\n }\n }\n return res\n}\n"],
5
- "mappings": "AAKA,SAAS,aAAa;AAEtB,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAE/B,MAAM,aAAa,CAAC;AAEb,SAAS,2BAA2B,OAAY,UAAwB;AAC7E,QAAM,SAAS,WAAW,KAAK;AAC/B,MAAI,WAAW,QAAW;AACxB,WAAO;AAAA,EACT;AACA,MAAI,YAAY,YAAY,iBAAiB;AAC3C,WAAO;AAAA,EACT;AACA,MAAI,MAAM;AACV,MACE,QAAQ,IAAI,mBAAmB,SAC/B,OAAO,UAAU,aAChB,aAAa,UACZ,EAAE,YAAY,mBAAmB,YAAY,iBAC/C;AACA,UAAM,GAAG;AAAA,EACX,WAAW,SAAS,aAAa,UAAa,YAAY,eAAe;AACvE,UAAM,GAAG;AAAA,EACX,WAAW,YAAY,YAAY,YAAY;AAC7C,UAAM,eAAe,KAAK;AAC1B,eAAW,KAAK,IAAI;AAAA,EACtB;AACA,SAAO;AACT;AAIA,MAAM,aAAa;AAAA,EACjB,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,gBAAg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T,WAAW,OAAO,SAAS,IAAI,GAAG;AAChC,UAAM,CAAC,OAAO,QAAQ,MAAM,EAAE;AAAA,EAChC,OAAO;AACL,UAAM;AAAA,EACR;AACA,SAAO,OAAO,IAAI;AAClB,MAAI,QAAQ,IAAI,aAAa,eAAe;AAE1C,QAAI,OAAO,QAAQ,YAAY,MAAM,GAAG,GAAG;AAEzC,cAAQ,IAAI,sCAAsC;AAAA,QAChD;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO;AACT;",
4
+ "sourcesContent": ["/**\n * Some parts adapted from react-native-web\n * Copyright (c) Nicolas Gallagher licensed under the MIT license.\n */\n\nimport { isWeb } from '@tamagui/constants'\n\nimport { getAllSelectors } from './insertStyleRule'\nimport { names, normalizeColor } from './normalizeColor'\nimport { normalizeStylePropKeys } from './normalizeStylePropKeys'\n\nconst colorCache = {}\n\nexport function normalizeValueWithProperty(value: any, property?: string): any {\n if (value in colorCache) {\n return colorCache[value]\n }\n if (property && property in unitlessNumbers) {\n return value\n }\n let res = value\n if (property && (property in normalizeStylePropKeys || value in names)) {\n res = normalizeColor(value)\n colorCache[value] = res\n } else if (\n process.env.TAMAGUI_TARGET === 'web' &&\n typeof value === 'number' &&\n (property === undefined ||\n !(property in unitlessNumbers || property in stringNumbers))\n ) {\n res = `${value}px`\n } else if (isWeb && property !== undefined && property in stringNumbers) {\n res = `${res}`\n }\n return res\n}\n\nconst stringNumbers = {\n zIndex: true,\n}\n\nconst unitlessNumbers = {\n WebkitLineClamp: true,\n animationIterationCount: true,\n aspectRatio: true,\n borderImageOutset: true,\n borderImageSlice: true,\n borderImageWidth: true,\n columnCount: true,\n flex: true,\n flexGrow: true,\n flexBasis: true,\n flexOrder: true,\n flexPositive: true,\n flexShrink: true,\n flexNegative: true,\n fontWeight: true,\n gridRow: true,\n gridRowEnd: true,\n gridRowGap: true,\n gridRowStart: true,\n gridColumn: true,\n gridColumnEnd: true,\n gridColumnGap: true,\n gridColumnStart: true,\n lineClamp: true,\n opacity: true,\n order: true,\n orphans: true,\n tabSize: true,\n widows: true,\n zoom: true,\n scale: true,\n scaleX: true,\n scaleY: true,\n scaleZ: true,\n shadowOpacity: true,\n}\n\n// getting real values for colors for animations (reverse mapped from CSS)\n// this isn't beautiful, but will do relatively fine performance for now\nconst rcache = {}\nexport function reverseMapClassNameToValue(key: string, className: string) {\n const selectors = getAllSelectors()\n const cssRule = selectors[className]\n if (rcache[cssRule]) return rcache[cssRule]\n if (!cssRule) {\n return\n }\n const cssVal = cssRule.replace(/.*:/, '').replace(/;.*/, '').trim()\n let res: any\n if (cssVal.startsWith('var(')) {\n res = cssVal\n } else if (unitlessNumbers[key]) {\n res = +cssVal\n } else if (cssVal.endsWith('px')) {\n res = +cssVal.replace('px', '')\n } else {\n res = cssVal\n }\n rcache[cssRule] = res\n if (process.env.NODE_ENV === 'development') {\n // ensure we are parsing properly\n if (typeof res === 'number' && isNaN(res)) {\n // eslint-disable-next-line no-console\n console.log('Tamagui invalid parsed value, NaN:', {\n res,\n cssVal,\n cssRule,\n key,\n className,\n })\n }\n }\n return res\n}\n"],
5
+ "mappings": "AAKA,SAAS,aAAa;AAEtB,SAAS,uBAAuB;AAChC,SAAS,OAAO,sBAAsB;AACtC,SAAS,8BAA8B;AAEvC,MAAM,aAAa,CAAC;AAEb,SAAS,2BAA2B,OAAY,UAAwB;AAC7E,MAAI,SAAS,YAAY;AACvB,WAAO,WAAW,KAAK;AAAA,EACzB;AACA,MAAI,YAAY,YAAY,iBAAiB;AAC3C,WAAO;AAAA,EACT;AACA,MAAI,MAAM;AACV,MAAI,aAAa,YAAY,0BAA0B,SAAS,QAAQ;AACtE,UAAM,eAAe,KAAK;AAC1B,eAAW,KAAK,IAAI;AAAA,EACtB,WACE,QAAQ,IAAI,mBAAmB,SAC/B,OAAO,UAAU,aAChB,aAAa,UACZ,EAAE,YAAY,mBAAmB,YAAY,iBAC/C;AACA,UAAM,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G;AAChC,UAAM,CAAC,OAAO,QAAQ,MAAM,EAAE;AAAA,EAChC,OAAO;AACL,UAAM;AAAA,EACR;AACA,SAAO,OAAO,IAAI;AAClB,MAAI,QAAQ,IAAI,aAAa,eAAe;AAE1C,QAAI,OAAO,QAAQ,YAAY,MAAM,GAAG,GAAG;AAEzC,cAAQ,IAAI,sCAAsC;AAAA,QAChD;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/themeable.tsx"],
4
- "sourcesContent": ["import React, { forwardRef, useId } from 'react'\n\nimport { ThemeName } from '../types'\nimport { Theme } from '../views/Theme'\n\nexport interface ThemeableProps {\n theme?: ThemeName | null\n themeInverse?: boolean\n themeReset?: boolean\n componentName?: string\n debug?: boolean | 'verbose'\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: ThemeableProps, ref) {\n const { themeInverse, theme, componentName, themeReset, ...rest } = props\n const element = React.createElement(component, { ...rest, ref } as any)\n\n return (\n <Theme\n inverse={themeInverse}\n componentName={componentName || opts?.componentName}\n name={(theme as any) || null}\n data-themeable\n debug={props.debug}\n reset={props.themeReset}\n >\n {element}\n </Theme>\n )\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 ? (props: Omit<P, 'theme' | 'themeInverse'> & ThemeableProps) => R\n : unknown\n}\n"],
4
+ "sourcesContent": ["import React, { forwardRef, useId } from 'react'\n\nimport { DebugProp, ThemeName } from '../types'\nimport { Theme } from '../views/Theme'\n\nexport interface ThemeableProps {\n theme?: ThemeName | null\n themeInverse?: boolean\n themeReset?: boolean\n componentName?: string\n debug?: DebugProp\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: ThemeableProps, ref) {\n const { themeInverse, theme, componentName, themeReset, ...rest } = props\n const element = React.createElement(component, { ...rest, ref } as any)\n\n return (\n <Theme\n inverse={themeInverse}\n componentName={componentName || opts?.componentName}\n name={(theme as any) || null}\n data-themeable\n debug={props.debug}\n reset={props.themeReset}\n >\n {element}\n </Theme>\n )\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 ? (props: Omit<P, 'theme' | 'themeInverse'> & ThemeableProps) => R\n : unknown\n}\n"],
5
5
  "mappings": "AAsBM;AAtBN,OAAO,SAAS,kBAAyB;AAGzC,SAAS,aAAa;AAUf,SAAS,UACd,WACA,MACA;AACA,QAAM,qBAAqB,WAAW,SAAS,UAAU,OAAuB,KAAK;AACnF,UAAM,EAAE,cAAc,OAAO,eAAe,YAAY,GAAG,KAAK,IAAI;AACpE,UAAM,UAAU,MAAM,cAAc,WAAW,EAAE,GAAG,MAAM,IAAI,CAAQ;AAEtE,WACE;AAAA,MAAC;AAAA;AAAA,QACC,SAAS;AAAA,QACT,eAAe,kBAAiB,6BAAM;AAAA,QACtC,MAAO,SAAiB;AAAA,QACxB,kBAAc;AAAA,QACd,OAAO,MAAM;AAAA,QACb,OAAO,MAAM;AAAA,QAEZ;AAAA;AAAA,IACH;AAAA,EAEJ,CAAC;AAED,QAAM,YAAiB;AACvB,YAAU,cAAc,WACrB,uCAAmB,iBAAgB,uCAAmB,SAAQ;AAGjE,SAAO;AAGT;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/themeable.tsx"],
4
- "sourcesContent": ["import React, { forwardRef, useId } from 'react'\n\nimport { ThemeName } from '../types'\nimport { Theme } from '../views/Theme'\n\nexport interface ThemeableProps {\n theme?: ThemeName | null\n themeInverse?: boolean\n themeReset?: boolean\n componentName?: string\n debug?: boolean | 'verbose'\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: ThemeableProps, ref) {\n const { themeInverse, theme, componentName, themeReset, ...rest } = props\n const element = React.createElement(component, { ...rest, ref } as any)\n\n return (\n <Theme\n inverse={themeInverse}\n componentName={componentName || opts?.componentName}\n name={(theme as any) || null}\n data-themeable\n debug={props.debug}\n reset={props.themeReset}\n >\n {element}\n </Theme>\n )\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 ? (props: Omit<P, 'theme' | 'themeInverse'> & ThemeableProps) => R\n : unknown\n}\n"],
4
+ "sourcesContent": ["import React, { forwardRef, useId } from 'react'\n\nimport { DebugProp, ThemeName } from '../types'\nimport { Theme } from '../views/Theme'\n\nexport interface ThemeableProps {\n theme?: ThemeName | null\n themeInverse?: boolean\n themeReset?: boolean\n componentName?: string\n debug?: DebugProp\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: ThemeableProps, ref) {\n const { themeInverse, theme, componentName, themeReset, ...rest } = props\n const element = React.createElement(component, { ...rest, ref } as any)\n\n return (\n <Theme\n inverse={themeInverse}\n componentName={componentName || opts?.componentName}\n name={(theme as any) || null}\n data-themeable\n debug={props.debug}\n reset={props.themeReset}\n >\n {element}\n </Theme>\n )\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 ? (props: Omit<P, 'theme' | 'themeInverse'> & ThemeableProps) => R\n : unknown\n}\n"],
5
5
  "mappings": "AAsBM;AAtBN,OAAO,SAAS,kBAAyB;AAGzC,SAAS,aAAa;AAUf,SAAS,UACd,WACA,MACA;AACA,QAAM,qBAAqB,WAAW,SAAS,UAAU,OAAuB,KAAK;AACnF,UAAM,EAAE,cAAc,OAAO,eAAe,YAAY,GAAG,KAAK,IAAI;AACpE,UAAM,UAAU,MAAM,cAAc,WAAW,EAAE,GAAG,MAAM,IAAI,CAAQ;AAEtE,WACE;AAAA,MAAC;AAAA;AAAA,QACC,SAAS;AAAA,QACT,eAAe,kBAAiB,6BAAM;AAAA,QACtC,MAAO,SAAiB;AAAA,QACxB,kBAAc;AAAA,QACd,OAAO,MAAM;AAAA,QACb,OAAO,MAAM;AAAA,QAEZ;AAAA;AAAA,IACH;AAAA,EAEJ,CAAC;AAED,QAAM,YAAiB;AACvB,YAAU,cAAc,WACrB,uCAAmB,iBAAgB,uCAAmB,SAAQ;AAGjE,SAAO;AAGT;",
6
6
  "names": []
7
7
  }
@@ -38,13 +38,13 @@ function useThemedChildren(themeState, children, options) {
38
38
  }
39
39
  next = /* @__PURE__ */ jsx(ThemeManagerContext.Provider, { value: themeManager, children: next });
40
40
  if (isWeb) {
41
- const enableClassName = forceClassName === true || forceClassName !== false && isNewTheme;
41
+ const enableClassName = forceClassName ?? (forceClassName !== false && isNewTheme);
42
42
  return /* @__PURE__ */ jsx(
43
43
  "span",
44
44
  {
45
45
  className: "_dsp_contents",
46
46
  ...theme && enableClassName && {
47
- className: `${className} ${forceClassName ? "forced1" : ""} _dsp_contents`,
47
+ className: `${className} _dsp_contents`,
48
48
  style: {
49
49
  // in order to provide currentColor, set color by default
50
50
  color: variableToString(theme.color)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/Theme.tsx"],
4
- "sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport { Children, cloneElement } from 'react'\n\nimport { variableToString } from '../createVariable'\nimport { ThemeManagerContext } from '../helpers/ThemeManagerContext'\nimport { useServerRef } from '../hooks/useServerHooks'\nimport { ChangedThemeResponse, useChangeThemeEffect } from '../hooks/useTheme'\nimport { ThemeProps } from '../types'\n\nexport function Theme(props: ThemeProps) {\n // @ts-expect-error only for internal views\n if (props.disable) return props.children\n const isRoot = !!props['_isRoot']\n const themeState = useChangeThemeEffect(props, isRoot)\n const children = props['data-themeable']\n ? Children.map(props.children, (child) =>\n cloneElement(child, { ['data-themeable']: true })\n )\n : props.children\n\n return useThemedChildren(themeState, children, props)\n}\n\nexport function useThemedChildren(\n themeState: ChangedThemeResponse,\n children: any,\n options: { forceClassName?: boolean; shallow?: boolean }\n) {\n const { themeManager, isNewTheme, className, theme } = themeState\n const { shallow, forceClassName } = options\n\n const hasEverThemed = useServerRef(false)\n if (isNewTheme) {\n hasEverThemed.current = true\n }\n\n // once a theme is set it always passes the context to avoid reparenting\n // until then no context to avoid lots of context\n if (!isNewTheme && !hasEverThemed.current && !forceClassName && !shallow) {\n return children\n }\n\n // be sure to memoize shouldReset to avoid reparenting\n let next = children\n\n if (shallow && themeManager) {\n next = Children.map(next, (child) => {\n return cloneElement(\n child,\n undefined,\n <Theme name={themeManager.state.parentName}>{child.props.children}</Theme>\n )\n })\n }\n\n next = (\n <ThemeManagerContext.Provider value={themeManager}>\n {next}\n </ThemeManagerContext.Provider>\n )\n\n if (isWeb) {\n const enableClassName =\n forceClassName === true || (forceClassName !== false && isNewTheme)\n return (\n <span\n className=\"_dsp_contents\"\n {...(theme &&\n enableClassName && {\n className: `${className} ${forceClassName ? 'forced1' : ''} _dsp_contents`,\n style: {\n // in order to provide currentColor, set color by default\n color: variableToString(theme.color),\n },\n })}\n >\n {next}\n </span>\n )\n }\n\n return next\n}\n"],
5
- "mappings": "AAkDQ;AAlDR,SAAS,aAAa;AACtB,SAAS,UAAU,oBAAoB;AAEvC,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,oBAAoB;AAC7B,SAA+B,4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AAA,EAEJ;AAEA,SAAO;AACT;",
4
+ "sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport { Children, cloneElement } from 'react'\n\nimport { variableToString } from '../createVariable'\nimport { ThemeManagerContext } from '../helpers/ThemeManagerContext'\nimport { useServerRef } from '../hooks/useServerHooks'\nimport { ChangedThemeResponse, useChangeThemeEffect } from '../hooks/useTheme'\nimport { ThemeProps } from '../types'\n\nexport function Theme(props: ThemeProps) {\n // @ts-expect-error only for internal views\n if (props.disable) return props.children\n const isRoot = !!props['_isRoot']\n const themeState = useChangeThemeEffect(props, isRoot)\n const children = props['data-themeable']\n ? Children.map(props.children, (child) =>\n cloneElement(child, { ['data-themeable']: true })\n )\n : props.children\n\n return useThemedChildren(themeState, children, props)\n}\n\nexport function useThemedChildren(\n themeState: ChangedThemeResponse,\n children: any,\n options: { forceClassName?: boolean; shallow?: boolean }\n) {\n const { themeManager, isNewTheme, className, theme } = themeState\n const { shallow, forceClassName } = options\n\n const hasEverThemed = useServerRef(false)\n if (isNewTheme) {\n hasEverThemed.current = true\n }\n\n // once a theme is set it always passes the context to avoid reparenting\n // until then no context to avoid lots of context\n if (!isNewTheme && !hasEverThemed.current && !forceClassName && !shallow) {\n return children\n }\n\n // be sure to memoize shouldReset to avoid reparenting\n let next = children\n\n if (shallow && themeManager) {\n next = Children.map(next, (child) => {\n return cloneElement(\n child,\n undefined,\n <Theme name={themeManager.state.parentName}>{child.props.children}</Theme>\n )\n })\n }\n\n next = (\n <ThemeManagerContext.Provider value={themeManager}>\n {next}\n </ThemeManagerContext.Provider>\n )\n\n if (isWeb) {\n const enableClassName = forceClassName ?? (forceClassName !== false && isNewTheme)\n return (\n <span\n className=\"_dsp_contents\"\n {...(theme &&\n enableClassName && {\n className: `${className} _dsp_contents`,\n style: {\n // in order to provide currentColor, set color by default\n color: variableToString(theme.color),\n },\n })}\n >\n {next}\n </span>\n )\n }\n\n return next\n}\n"],
5
+ "mappings": "AAkDQ;AAlDR,SAAS,aAAa;AACt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,iBAAiB,MAAM,KAAK;AAAA,UACrC;AAAA,QACF;AAAA,QAED;AAAA;AAAA,IACH;AAAA,EAEJ;AAEA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -38,13 +38,13 @@ function useThemedChildren(themeState, children, options) {
38
38
  }
39
39
  next = /* @__PURE__ */ jsx(ThemeManagerContext.Provider, { value: themeManager, children: next });
40
40
  if (isWeb) {
41
- const enableClassName = forceClassName === true || forceClassName !== false && isNewTheme;
41
+ const enableClassName = forceClassName ?? (forceClassName !== false && isNewTheme);
42
42
  return /* @__PURE__ */ jsx(
43
43
  "span",
44
44
  {
45
45
  className: "_dsp_contents",
46
46
  ...theme && enableClassName && {
47
- className: `${className} ${forceClassName ? "forced1" : ""} _dsp_contents`,
47
+ className: `${className} _dsp_contents`,
48
48
  style: {
49
49
  // in order to provide currentColor, set color by default
50
50
  color: variableToString(theme.color)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/Theme.tsx"],
4
- "sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport { Children, cloneElement } from 'react'\n\nimport { variableToString } from '../createVariable'\nimport { ThemeManagerContext } from '../helpers/ThemeManagerContext'\nimport { useServerRef } from '../hooks/useServerHooks'\nimport { ChangedThemeResponse, useChangeThemeEffect } from '../hooks/useTheme'\nimport { ThemeProps } from '../types'\n\nexport function Theme(props: ThemeProps) {\n // @ts-expect-error only for internal views\n if (props.disable) return props.children\n const isRoot = !!props['_isRoot']\n const themeState = useChangeThemeEffect(props, isRoot)\n const children = props['data-themeable']\n ? Children.map(props.children, (child) =>\n cloneElement(child, { ['data-themeable']: true })\n )\n : props.children\n\n return useThemedChildren(themeState, children, props)\n}\n\nexport function useThemedChildren(\n themeState: ChangedThemeResponse,\n children: any,\n options: { forceClassName?: boolean; shallow?: boolean }\n) {\n const { themeManager, isNewTheme, className, theme } = themeState\n const { shallow, forceClassName } = options\n\n const hasEverThemed = useServerRef(false)\n if (isNewTheme) {\n hasEverThemed.current = true\n }\n\n // once a theme is set it always passes the context to avoid reparenting\n // until then no context to avoid lots of context\n if (!isNewTheme && !hasEverThemed.current && !forceClassName && !shallow) {\n return children\n }\n\n // be sure to memoize shouldReset to avoid reparenting\n let next = children\n\n if (shallow && themeManager) {\n next = Children.map(next, (child) => {\n return cloneElement(\n child,\n undefined,\n <Theme name={themeManager.state.parentName}>{child.props.children}</Theme>\n )\n })\n }\n\n next = (\n <ThemeManagerContext.Provider value={themeManager}>\n {next}\n </ThemeManagerContext.Provider>\n )\n\n if (isWeb) {\n const enableClassName =\n forceClassName === true || (forceClassName !== false && isNewTheme)\n return (\n <span\n className=\"_dsp_contents\"\n {...(theme &&\n enableClassName && {\n className: `${className} ${forceClassName ? 'forced1' : ''} _dsp_contents`,\n style: {\n // in order to provide currentColor, set color by default\n color: variableToString(theme.color),\n },\n })}\n >\n {next}\n </span>\n )\n }\n\n return next\n}\n"],
5
- "mappings": "AAkDQ;AAlDR,SAAS,aAAa;AACtB,SAAS,UAAU,oBAAoB;AAEvC,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,oBAAoB;AAC7B,SAA+B,4BAA4B;AAGpD,SAAS,MAAM,OAAmB;AAEvC,MAAI,MAAM;AAAS,WAAO,MAAM;AAChC,QAAM,SAAS,CAAC,CAAC,MAAM,SAAS;AAChC,QAAM,aAAa,qBAAqB,OAAO,MAAM;AACrD,QAAM,WAAW,MAAM,gBAAgB,IACnC,SAAS;AAAA,IAAI,MAAM;AAAA,IAAU,CAAC,UAC5B,aAAa,OAAO,EAAE,CAAC,gBAAgB,GAAG,KAAK,CAAC;AAAA,EAClD,IACA,MAAM;AAEV,SAAO,kBAAkB,YAAY,UAAU,KAAK;AACtD;AAEO,SAAS,kBACd,YACA,UACA,SACA;AACA,QAAM,EAAE,cAAc,YAAY,WAAW,MAAM,IAAI;AACvD,QAAM,EAAE,SAAS,eAAe,IAAI;AAEpC,QAAM,gBAAgB,aAAa,KAAK;AACxC,MAAI,YAAY;AACd,kBAAc,UAAU;AAAA,EAC1B;AAIA,MAAI,CAAC,cAAc,CAAC,cAAc,WAAW,CAAC,kBAAkB,CAAC,SAAS;AACxE,WAAO;AAAA,EACT;AAGA,MAAI,OAAO;AAEX,MAAI,WAAW,cAAc;AAC3B,WAAO,SAAS,IAAI,MAAM,CAAC,UAAU;AACnC,aAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA,oBAAC,SAAM,MAAM,aAAa,MAAM,YAAa,gBAAM,MAAM,UAAS;AAAA,MACpE;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SACE,oBAAC,oBAAoB,UAApB,EAA6B,OAAO,cAClC,gBACH;AAGF,MAAI,OAAO;AACT,UAAM,kBACJ,mBAAmB,QAAS,mBAAmB,SAAS;AAC1D,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACT,GAAI,SACH,mBAAmB;AAAA,UACjB,WAAW,GAAG,aAAa,iBAAiB,YAAY;AAAA,UACxD,OAAO;AAAA;AAAA,YAEL,OAAO,iBAAiB,MAAM,KAAK;AAAA,UACrC;AAAA,QACF;AAAA,QAED;AAAA;AAAA,IACH;AAAA,EAEJ;AAEA,SAAO;AACT;",
4
+ "sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport { Children, cloneElement } from 'react'\n\nimport { variableToString } from '../createVariable'\nimport { ThemeManagerContext } from '../helpers/ThemeManagerContext'\nimport { useServerRef } from '../hooks/useServerHooks'\nimport { ChangedThemeResponse, useChangeThemeEffect } from '../hooks/useTheme'\nimport { ThemeProps } from '../types'\n\nexport function Theme(props: ThemeProps) {\n // @ts-expect-error only for internal views\n if (props.disable) return props.children\n const isRoot = !!props['_isRoot']\n const themeState = useChangeThemeEffect(props, isRoot)\n const children = props['data-themeable']\n ? Children.map(props.children, (child) =>\n cloneElement(child, { ['data-themeable']: true })\n )\n : props.children\n\n return useThemedChildren(themeState, children, props)\n}\n\nexport function useThemedChildren(\n themeState: ChangedThemeResponse,\n children: any,\n options: { forceClassName?: boolean; shallow?: boolean }\n) {\n const { themeManager, isNewTheme, className, theme } = themeState\n const { shallow, forceClassName } = options\n\n const hasEverThemed = useServerRef(false)\n if (isNewTheme) {\n hasEverThemed.current = true\n }\n\n // once a theme is set it always passes the context to avoid reparenting\n // until then no context to avoid lots of context\n if (!isNewTheme && !hasEverThemed.current && !forceClassName && !shallow) {\n return children\n }\n\n // be sure to memoize shouldReset to avoid reparenting\n let next = children\n\n if (shallow && themeManager) {\n next = Children.map(next, (child) => {\n return cloneElement(\n child,\n undefined,\n <Theme name={themeManager.state.parentName}>{child.props.children}</Theme>\n )\n })\n }\n\n next = (\n <ThemeManagerContext.Provider value={themeManager}>\n {next}\n </ThemeManagerContext.Provider>\n )\n\n if (isWeb) {\n const enableClassName = forceClassName ?? (forceClassName !== false && isNewTheme)\n return (\n <span\n className=\"_dsp_contents\"\n {...(theme &&\n enableClassName && {\n className: `${className} _dsp_contents`,\n style: {\n // in order to provide currentColor, set color by default\n color: variableToString(theme.color),\n },\n })}\n >\n {next}\n </span>\n )\n }\n\n return next\n}\n"],
5
+ "mappings": "AAkDQ;AAlDR,SAAS,aAAa;AACtB,SAAS,UAAU,oBAAoB;AAEvC,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,oBAAoB;AAC7B,SAA+B,4BAA4B;AAGpD,SAAS,MAAM,OAAmB;AAEvC,MAAI,MAAM;AAAS,WAAO,MAAM;AAChC,QAAM,SAAS,CAAC,CAAC,MAAM,SAAS;AAChC,QAAM,aAAa,qBAAqB,OAAO,MAAM;AACrD,QAAM,WAAW,MAAM,gBAAgB,IACnC,SAAS;AAAA,IAAI,MAAM;AAAA,IAAU,CAAC,UAC5B,aAAa,OAAO,EAAE,CAAC,gBAAgB,GAAG,KAAK,CAAC;AAAA,EAClD,IACA,MAAM;AAEV,SAAO,kBAAkB,YAAY,UAAU,KAAK;AACtD;AAEO,SAAS,kBACd,YACA,UACA,SACA;AACA,QAAM,EAAE,cAAc,YAAY,WAAW,MAAM,IAAI;AACvD,QAAM,EAAE,SAAS,eAAe,IAAI;AAEpC,QAAM,gBAAgB,aAAa,KAAK;AACxC,MAAI,YAAY;AACd,kBAAc,UAAU;AAAA,EAC1B;AAIA,MAAI,CAAC,cAAc,CAAC,cAAc,WAAW,CAAC,kBAAkB,CAAC,SAAS;AACxE,WAAO;AAAA,EACT;AAGA,MAAI,OAAO;AAEX,MAAI,WAAW,cAAc;AAC3B,WAAO,SAAS,IAAI,MAAM,CAAC,UAAU;AACnC,aAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA,oBAAC,SAAM,MAAM,aAAa,MAAM,YAAa,gBAAM,MAAM,UAAS;AAAA,MACpE;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SACE,oBAAC,oBAAoB,UAApB,EAA6B,OAAO,cAClC,gBACH;AAGF,MAAI,OAAO;AACT,UAAM,kBAAkB,mBAAmB,mBAAmB,SAAS;AACvE,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACT,GAAI,SACH,mBAAmB;AAAA,UACjB,WAAW,GAAG;AAAA,UACd,OAAO;AAAA;AAAA,YAEL,OAAO,iBAAiB,MAAM,KAAK;AAAA,UACrC;AAAA,QACF;AAAA,QAED;AAAA;AAAA,IACH;AAAA,EAEJ;AAEA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/web",
3
- "version": "1.4.0",
3
+ "version": "1.5.1",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -27,20 +27,20 @@
27
27
  "reset.css"
28
28
  ],
29
29
  "dependencies": {
30
- "@tamagui/compose-refs": "^1.4.0",
31
- "@tamagui/constants": "^1.4.0",
32
- "@tamagui/helpers": "^1.4.0",
33
- "@tamagui/normalize-css-color": "^1.4.0",
34
- "@tamagui/use-did-finish-ssr": "^1.4.0",
35
- "@tamagui/use-event": "^1.4.0",
36
- "@tamagui/use-force-update": "^1.4.0"
30
+ "@tamagui/compose-refs": "^1.5.1",
31
+ "@tamagui/constants": "^1.5.1",
32
+ "@tamagui/helpers": "^1.5.1",
33
+ "@tamagui/normalize-css-color": "^1.5.1",
34
+ "@tamagui/use-did-finish-ssr": "^1.5.1",
35
+ "@tamagui/use-event": "^1.5.1",
36
+ "@tamagui/use-force-update": "^1.5.1"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "react": "*",
40
40
  "react-dom": "*"
41
41
  },
42
42
  "devDependencies": {
43
- "@tamagui/build": "^1.4.0",
43
+ "@tamagui/build": "^1.5.1",
44
44
  "@testing-library/react": "^13.4.0",
45
45
  "csstype": "^3.0.10",
46
46
  "react": "^18.2.0",
@@ -1,11 +1,6 @@
1
1
  import { useComposedRefs } from '@tamagui/compose-refs'
2
2
  import { isClient, isRSC, isServer, isWeb } from '@tamagui/constants'
3
- import {
4
- composeEventHandlers,
5
- stylePropsView,
6
- validPseudoKeys,
7
- validStyles,
8
- } from '@tamagui/helpers'
3
+ import { stylePropsView, validPseudoKeys, validStyles } from '@tamagui/helpers'
9
4
  import React, {
10
5
  Children,
11
6
  Fragment,
@@ -50,7 +45,7 @@ import {
50
45
  UseAnimationHook,
51
46
  UseAnimationProps,
52
47
  } from './types'
53
- import { Slot, mergeEvent } from './views/Slot'
48
+ import { Slot } from './views/Slot'
54
49
  import { useThemedChildren } from './views/Theme'
55
50
 
56
51
  // let t
@@ -431,12 +426,11 @@ export function createComponent<
431
426
  // so the type is pretty loose
432
427
  let viewProps = nonTamaguiProps
433
428
 
434
- // hook for transforming props
435
- if (process.env.TAMAGUI_TARGET === 'web' && !isReactNative) {
436
- const nextProps = hooks.usePropsTransform?.(elementType, nonTamaguiProps, hostRef)
437
- if (!asChild) {
438
- viewProps = nextProps
439
- }
429
+ // if react-native-web view just pass all props down
430
+ if (process.env.TAMAGUI_TARGET === 'web' && !isReactNative && !asChild) {
431
+ viewProps = hooks.usePropsTransform?.(elementType, nonTamaguiProps, hostRef)
432
+ } else {
433
+ viewProps = nonTamaguiProps
440
434
  }
441
435
 
442
436
  viewProps.ref = useComposedRefs(hostRef as any, forwardedRef)
@@ -125,15 +125,17 @@ export function createTamagui<Conf extends CreateTamaguiProps>(
125
125
  const dedupedThemes: {
126
126
  [key: string]: DedupedTheme
127
127
  } = {}
128
- const existing = new WeakMap<ThemeParsed, DedupedTheme>()
128
+ const existing = new Map<string, DedupedTheme>()
129
129
 
130
130
  // first, de-dupe and parse them
131
131
  for (const themeName in themes) {
132
132
  const rawTheme = themes[themeName] as ThemeParsed
133
+ // dont force referential equality but may need something more consistent than JSON.stringify
134
+ const key = JSON.stringify(rawTheme)
133
135
 
134
136
  // if existing, avoid
135
- if (existing.has(rawTheme)) {
136
- const e = existing.get(rawTheme)!
137
+ if (existing.has(key)) {
138
+ const e = existing.get(key)!
137
139
  themes[themeName] = e.theme
138
140
  e.names.push(themeName)
139
141
  continue
@@ -154,7 +156,7 @@ export function createTamagui<Conf extends CreateTamaguiProps>(
154
156
  theme,
155
157
  }
156
158
 
157
- existing.set(rawTheme, dedupedThemes[themeName])
159
+ existing.set(key, dedupedThemes[themeName])
158
160
  }
159
161
 
160
162
  // then, generate CSS from de-duped
@@ -8,24 +8,11 @@ import { isWeb } from '@tamagui/constants'
8
8
  export function expandStyle(key: string, value: any) {
9
9
  if (process.env.TAMAGUI_TARGET === 'web') {
10
10
  if (key === 'flex') {
11
- // The 'flex' property value in React Native must be a positive integer,
12
- // 0, or -1.
13
- if (value <= -1) {
14
- return [
15
- ['flexGrow', 0],
16
- ['flexShrink', 1],
17
- ['flexBasis', 'auto'],
18
- ]
19
- }
20
- // normalizing to better align with native
21
- // see spec for flex shorthand https://developer.mozilla.org/en-US/docs/Web/CSS/flex
22
- if (value >= 0) {
23
- return [
24
- ['flexGrow', value],
25
- ['flexShrink', 1],
26
- ]
27
- }
28
- return
11
+ return [
12
+ ['flexGrow', value],
13
+ ['flexShrink', 1],
14
+ ['flexBasis', 'auto'],
15
+ ]
29
16
  }
30
17
 
31
18
  // web only