repoweaver
Version:
A GitHub App that skillfully weaves multiple templates together to create and update repositories with intelligent merge strategies
1 lines • 10.7 kB
JSON
{"ast":null,"code":"import _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nconst _excluded = [\"source\", \"color\", \"size\", \"theme\", \"testID\"];\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nimport * as React from 'react';\nimport I18nManager from \"react-native-web/dist/exports/I18nManager\";\nimport Image from \"react-native-web/dist/exports/Image\";\nimport Platform from \"react-native-web/dist/exports/Platform\";\nimport { accessibilityProps } from \"./MaterialCommunityIcon\";\nimport { Consumer as SettingsConsumer } from \"../core/settings\";\nimport { useInternalTheme } from \"../core/theming\";\nconst isImageSource = source => typeof source === 'object' && source !== null && Object.prototype.hasOwnProperty.call(source, 'uri') && typeof source.uri === 'string' || typeof source === 'number' || Platform.OS === 'web' && typeof source === 'string' && (source.startsWith('data:image') || /\\.(bmp|jpg|jpeg|png|gif|svg)$/.test(source));\nconst getIconId = source => {\n if (typeof source === 'object' && source !== null && Object.prototype.hasOwnProperty.call(source, 'uri') && typeof source.uri === 'string') {\n return source.uri;\n }\n return source;\n};\nexport const isValidIcon = source => typeof source === 'string' || typeof source === 'function' || isImageSource(source);\nexport const isEqualIcon = (a, b) => a === b || getIconId(a) === getIconId(b);\nconst Icon = _ref => {\n let {\n source,\n color,\n size,\n theme: themeOverrides,\n testID\n } = _ref,\n rest = _objectWithoutPropertiesLoose(_ref, _excluded);\n const theme = useInternalTheme(themeOverrides);\n const direction = typeof source === 'object' && source.direction && source.source ? source.direction === 'auto' ? I18nManager.getConstants().isRTL ? 'rtl' : 'ltr' : source.direction : null;\n const s = typeof source === 'object' && source.direction && source.source ? source.source : source;\n const iconColor = color || (theme.isV3 ? theme.colors.onSurface : theme.colors.text);\n if (isImageSource(s)) {\n return React.createElement(Image, _extends({}, rest, {\n testID: testID,\n source: s,\n style: [{\n transform: [{\n scaleX: direction === 'rtl' ? -1 : 1\n }]\n }, {\n width: size,\n height: size,\n tintColor: color,\n resizeMode: `contain`\n }]\n }, accessibilityProps, {\n accessibilityIgnoresInvertColors: true\n }));\n } else if (typeof s === 'string') {\n return React.createElement(SettingsConsumer, null, ({\n icon\n }) => {\n return icon === null || icon === void 0 ? void 0 : icon({\n name: s,\n color: iconColor,\n size,\n direction,\n testID\n });\n });\n } else if (typeof s === 'function') {\n return s({\n color: iconColor,\n size,\n direction,\n testID\n });\n }\n return null;\n};\nexport default Icon;","map":{"version":3,"names":["React","I18nManager","Image","Platform","accessibilityProps","Consumer","SettingsConsumer","useInternalTheme","isImageSource","source","Object","prototype","hasOwnProperty","call","uri","OS","startsWith","test","getIconId","isValidIcon","isEqualIcon","a","b","Icon","_ref","color","size","theme","themeOverrides","testID","rest","_objectWithoutPropertiesLoose","_excluded","direction","getConstants","isRTL","s","iconColor","isV3","colors","onSurface","text","createElement","_extends","style","transform","scaleX","width","height","tintColor","resizeMode","accessibilityIgnoresInvertColors","icon","name"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-paper/src/components/Icon.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n I18nManager,\n Image,\n ImageSourcePropType,\n Platform,\n} from 'react-native';\n\nimport { accessibilityProps } from './MaterialCommunityIcon';\nimport { Consumer as SettingsConsumer } from '../core/settings';\nimport { useInternalTheme } from '../core/theming';\nimport type { ThemeProp } from '../types';\n\ntype IconSourceBase = string | ImageSourcePropType;\n\nexport type IconSource =\n | IconSourceBase\n | Readonly<{ source: IconSourceBase; direction: 'rtl' | 'ltr' | 'auto' }>\n | ((props: IconProps & { color: string }) => React.ReactNode);\n\ntype IconProps = {\n /**\n * Size of icon.\n */\n size: number;\n allowFontScaling?: boolean;\n};\n\nconst isImageSource = (source: any) =>\n // source is an object with uri\n (typeof source === 'object' &&\n source !== null &&\n Object.prototype.hasOwnProperty.call(source, 'uri') &&\n typeof source.uri === 'string') ||\n // source is a module, e.g. - require('image')\n typeof source === 'number' ||\n // image url on web\n (Platform.OS === 'web' &&\n typeof source === 'string' &&\n (source.startsWith('data:image') ||\n /\\.(bmp|jpg|jpeg|png|gif|svg)$/.test(source)));\n\nconst getIconId = (source: any) => {\n if (\n typeof source === 'object' &&\n source !== null &&\n Object.prototype.hasOwnProperty.call(source, 'uri') &&\n typeof source.uri === 'string'\n ) {\n return source.uri;\n }\n\n return source;\n};\n\nexport const isValidIcon = (source: any) =>\n typeof source === 'string' ||\n typeof source === 'function' ||\n isImageSource(source);\n\nexport const isEqualIcon = (a: any, b: any) =>\n a === b || getIconId(a) === getIconId(b);\n\nexport type Props = IconProps & {\n /**\n * Icon to display.\n */\n source: any;\n /**\n * Color of the icon.\n */\n color?: string;\n /**\n * TestID used for testing purposes\n */\n testID?: string;\n /**\n * @optional\n */\n theme?: ThemeProp;\n};\n\n/**\n * An icon component which renders icon from vector library.\n *\n * ## Usage\n * ```js\n * import * as React from 'react';\n * import { Icon, MD3Colors } from 'react-native-paper';\n *\n * const MyComponent = () => (\n * <Icon\n * source=\"camera\"\n * color={MD3Colors.error50}\n * size={20}\n * />\n * );\n *\n * export default MyComponent;\n * ```\n */\n\nconst Icon = ({\n source,\n color,\n size,\n theme: themeOverrides,\n testID,\n ...rest\n}: Props) => {\n const theme = useInternalTheme(themeOverrides);\n const direction =\n typeof source === 'object' && source.direction && source.source\n ? source.direction === 'auto'\n ? I18nManager.getConstants().isRTL\n ? 'rtl'\n : 'ltr'\n : source.direction\n : null;\n\n const s =\n typeof source === 'object' && source.direction && source.source\n ? source.source\n : source;\n const iconColor =\n color || (theme.isV3 ? theme.colors.onSurface : theme.colors.text);\n\n if (isImageSource(s)) {\n return (\n <Image\n {...rest}\n testID={testID}\n source={s}\n style={[\n {\n transform: [{ scaleX: direction === 'rtl' ? -1 : 1 }],\n },\n {\n width: size,\n height: size,\n tintColor: color,\n resizeMode: `contain`,\n },\n ]}\n {...accessibilityProps}\n accessibilityIgnoresInvertColors\n />\n );\n } else if (typeof s === 'string') {\n return (\n <SettingsConsumer>\n {({ icon }) => {\n return icon?.({\n name: s,\n color: iconColor,\n size,\n direction,\n testID,\n });\n }}\n </SettingsConsumer>\n );\n } else if (typeof s === 'function') {\n return s({ color: iconColor, size, direction, testID });\n }\n\n return null;\n};\n\nexport default Icon;\n"],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAAA,OAAAC,WAAA;AAAA,OAAAC,KAAA;AAAA,OAAAC,QAAA;AAQ9B,SAASC,kBAAkB;AAC3B,SAASC,QAAQ,IAAIC,gBAAgB;AACrC,SAASC,gBAAgB;AAkBzB,MAAMC,aAAa,GAAIC,MAAW,IAE/B,OAAOA,MAAM,KAAK,QAAQ,IACzBA,MAAM,KAAK,IAAI,IACfC,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACJ,MAAM,EAAE,KAAK,CAAC,IACnD,OAAOA,MAAM,CAACK,GAAG,KAAK,QAAQ,IAEhC,OAAOL,MAAM,KAAK,QAAQ,IAEzBN,QAAQ,CAACY,EAAE,KAAK,KAAK,IACpB,OAAON,MAAM,KAAK,QAAQ,KACzBA,MAAM,CAACO,UAAU,CAAC,YAAY,CAAC,IAC9B,+BAA+B,CAACC,IAAI,CAACR,MAAM,CAAC,CAAE;AAEpD,MAAMS,SAAS,GAAIT,MAAW,IAAK;EACjC,IACE,OAAOA,MAAM,KAAK,QAAQ,IAC1BA,MAAM,KAAK,IAAI,IACfC,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACJ,MAAM,EAAE,KAAK,CAAC,IACnD,OAAOA,MAAM,CAACK,GAAG,KAAK,QAAQ,EAC9B;IACA,OAAOL,MAAM,CAACK,GAAG;EACnB;EAEA,OAAOL,MAAM;AACf,CAAC;AAED,OA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