@tamagui/helpers-tamagui 1.0.1-beta.78 → 1.0.1-beta.79

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.
package/dist/jsx/index.js CHANGED
@@ -2,3 +2,4 @@ export * from "./useCurrentColor";
2
2
  export * from "./useGetThemedIcon";
3
3
  export * from "./wrapStringChildrenInText";
4
4
  export * from "./types";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "sourcesContent": ["export * from './useCurrentColor'\nexport * from './useGetThemedIcon'\nexport * from './wrapStringChildrenInText'\nexport * from './types'\n"],
5
+ "mappings": "AAAA;AACA;AACA;AACA;",
6
+ "names": []
7
+ }
package/dist/jsx/types.js CHANGED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -14,3 +14,4 @@ const useCurrentColor = (colorProp) => {
14
14
  export {
15
15
  useCurrentColor
16
16
  };
17
+ //# sourceMappingURL=useCurrentColor.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/useCurrentColor.tsx"],
4
+ "sourcesContent": ["import { ColorTokens, ThemeValueFallback, useTheme } from '@tamagui/core'\nimport { TextStyle } from 'react-native'\n\nexport const useCurrentColor = (colorProp: ColorProp) => {\n const theme = useTheme()\n // get color from prop or theme\n let color: any\n // @ts-expect-error\n if (theme && colorProp && colorProp in theme) {\n // @ts-expect-error\n color = theme[colorProp]\n } else if (colorProp) {\n color = colorProp\n } else {\n color = theme?.color\n }\n return color?.toString() || ('' as string)\n}\n\nexport type ColorProp = ThemeValueFallback | ColorTokens | TextStyle['color'] | undefined\n"],
5
+ "mappings": "AAAA;AAGO,MAAM,kBAAkB,CAAC,cAAyB;AACvD,QAAM,QAAQ,SAAS;AAEvB,MAAI;AAEJ,MAAI,SAAS,aAAa,aAAa,OAAO;AAE5C,YAAQ,MAAM;AAAA,EAChB,WAAW,WAAW;AACpB,YAAQ;AAAA,EACV,OAAO;AACL,YAAQ,+BAAO;AAAA,EACjB;AACA,SAAO,gCAAO,eAAe;AAC/B;",
6
+ "names": []
7
+ }
@@ -18,3 +18,4 @@ const useGetThemedIcon = (props) => {
18
18
  export {
19
19
  useGetThemedIcon
20
20
  };
21
+ //# sourceMappingURL=useGetThemedIcon.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/useGetThemedIcon.tsx"],
4
+ "sourcesContent": ["import React, { isValidElement } from 'react'\n\nimport { ColorProp, useCurrentColor } from './useCurrentColor'\n\nexport const useGetThemedIcon = (props: { color: ColorProp; size: number }) => {\n const color = useCurrentColor(props.color)\n return (el: any) => {\n if (isValidElement(el)) {\n return el\n }\n if (el) {\n return React.createElement(el, {\n ...props,\n color,\n })\n }\n return el\n }\n}\n"],
5
+ "mappings": "AAAA;AAEA;AAEO,MAAM,mBAAmB,CAAC,UAA8C;AAC7E,QAAM,QAAQ,gBAAgB,MAAM,KAAK;AACzC,SAAO,CAAC,OAAY;AAClB,QAAI,eAAe,EAAE,GAAG;AACtB,aAAO;AAAA,IACT;AACA,QAAI,IAAI;AACN,aAAO,MAAM,cAAc,IAAI;AAAA,QAC7B,GAAG;AAAA,QACH;AAAA,MACF,CAAC;AAAA,IACH;AACA,WAAO;AAAA,EACT;AACF;",
6
+ "names": []
7
+ }
@@ -58,3 +58,4 @@ function wrapStringChildrenInText(TextComponent, {
58
58
  export {
59
59
  wrapStringChildrenInText
60
60
  };
61
+ //# sourceMappingURL=wrapStringChildrenInText.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/wrapStringChildrenInText.tsx"],
4
+ "sourcesContent": ["import { SizeTokens } from '@tamagui/core'\nimport React from 'react'\n\nimport { TextParentStyles } from './types'\n\ntype Props = TextParentStyles & {\n children?: React.ReactNode\n size?: SizeTokens\n}\n\nexport function wrapStringChildrenInText(\n TextComponent: any,\n {\n children,\n textProps,\n size,\n noTextWrap,\n color,\n fontFamily,\n fontSize,\n fontWeight,\n letterSpacing,\n textAlign,\n }: Props\n) {\n if (noTextWrap || !children) {\n return children\n }\n\n // in the case of using variables, like so:\n // <ListItem>Hello, {name}</ListItem>\n // it gives us props.children as ['Hello, ', 'name']\n // but we don't want to wrap multiple SizableText around each part\n // so we group them\n let allChildren = React.Children.toArray(children)\n let nextChildren: any[] = []\n let lastIsString = false\n const directTextProps: any = {}\n // to avoid setting undefined\n if (color) directTextProps.color = color\n if (fontFamily) directTextProps.fontFamily = fontFamily\n if (fontSize) directTextProps.fontSize = fontSize\n if (fontWeight) directTextProps.fontWeight = fontWeight\n if (letterSpacing) directTextProps.letterSpacing = letterSpacing\n if (textAlign) directTextProps.textAlign = textAlign\n\n function concatStringChildren() {\n if (!lastIsString) return\n const index = nextChildren.length - 1\n const childrenStrings = nextChildren[index]\n nextChildren[index] = (\n <TextComponent key={index} {...directTextProps} size={size} {...textProps}>\n {childrenStrings}\n </TextComponent>\n )\n }\n\n for (const child of allChildren) {\n const last = nextChildren[nextChildren.length - 1]\n const isString = typeof child === 'string'\n if (isString) {\n if (lastIsString) {\n last.push(child)\n } else {\n nextChildren.push([child])\n }\n } else {\n concatStringChildren()\n nextChildren.push(child)\n }\n lastIsString = isString\n }\n concatStringChildren()\n\n return nextChildren\n}\n"],
5
+ "mappings": "AACA;AASO,kCACL,eACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,GAEF;AACA,MAAI,cAAc,CAAC,UAAU;AAC3B,WAAO;AAAA,EACT;AAOA,MAAI,cAAc,MAAM,SAAS,QAAQ,QAAQ;AACjD,MAAI,eAAsB,CAAC;AAC3B,MAAI,eAAe;AACnB,QAAM,kBAAuB,CAAC;AAE9B,MAAI;AAAO,oBAAgB,QAAQ;AACnC,MAAI;AAAY,oBAAgB,aAAa;AAC7C,MAAI;AAAU,oBAAgB,WAAW;AACzC,MAAI;AAAY,oBAAgB,aAAa;AAC7C,MAAI;AAAe,oBAAgB,gBAAgB;AACnD,MAAI;AAAW,oBAAgB,YAAY;AAE3C,kCAAgC;AAC9B,QAAI,CAAC;AAAc;AACnB,UAAM,QAAQ,aAAa,SAAS;AACpC,UAAM,kBAAkB,aAAa;AACrC,iBAAa,SACX,CAAC,cAAc,KAAK,WAAW,iBAAiB,MAAM,UAAU,YAC7D,gBACH,EAFC;AAAA,EAIL;AAEA,aAAW,SAAS,aAAa;AAC/B,UAAM,OAAO,aAAa,aAAa,SAAS;AAChD,UAAM,WAAW,OAAO,UAAU;AAClC,QAAI,UAAU;AACZ,UAAI,cAAc;AAChB,aAAK,KAAK,KAAK;AAAA,MACjB,OAAO;AACL,qBAAa,KAAK,CAAC,KAAK,CAAC;AAAA,MAC3B;AAAA,IACF,OAAO;AACL,2BAAqB;AACrB,mBAAa,KAAK,KAAK;AAAA,IACzB;AACA,mBAAe;AAAA,EACjB;AACA,uBAAqB;AAErB,SAAO;AACT;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/helpers-tamagui",
3
- "version": "1.0.1-beta.78",
3
+ "version": "1.0.1-beta.79",
4
4
  "source": "src/index.ts",
5
5
  "types": "./types/index.d.ts",
6
6
  "main": "dist/cjs",
@@ -18,10 +18,10 @@
18
18
  "clean:build": "tamagui-build clean:build"
19
19
  },
20
20
  "dependencies": {
21
- "@tamagui/text": "^1.0.1-beta.78"
21
+ "@tamagui/text": "^1.0.1-beta.79"
22
22
  },
23
23
  "devDependencies": {
24
- "@tamagui/build": "^1.0.1-beta.78",
24
+ "@tamagui/build": "^1.0.1-beta.79",
25
25
  "react": "*",
26
26
  "react-native": "*"
27
27
  },