UNPKG

repoweaver

Version:

A GitHub App that skillfully weaves multiple templates together to create and update repositories with intelligent merge strategies

1 lines 11.1 kB
{"ast":null,"code":"import * as React from 'react';\nimport AccessibilityInfo from \"react-native-web/dist/exports/AccessibilityInfo\";\nimport Appearance from \"react-native-web/dist/exports/Appearance\";\nimport SafeAreaProviderCompat from \"./SafeAreaProviderCompat\";\nimport { Provider as SettingsProvider } from \"./settings\";\nimport { defaultThemesByVersion, ThemeProvider } from \"./theming\";\nimport MaterialCommunityIcon from \"../components/MaterialCommunityIcon\";\nimport PortalHost from \"../components/Portal/PortalHost\";\nimport { addEventListener } from \"../utils/addEventListener\";\nconst PaperProvider = props => {\n const isOnlyVersionInTheme = props.theme && Object.keys(props.theme).length === 1 && props.theme.version;\n const colorSchemeName = (!props.theme || isOnlyVersionInTheme) && (Appearance === null || Appearance === void 0 ? void 0 : Appearance.getColorScheme()) || 'light';\n const [reduceMotionEnabled, setReduceMotionEnabled] = React.useState(false);\n const [colorScheme, setColorScheme] = React.useState(colorSchemeName);\n const handleAppearanceChange = preferences => {\n const {\n colorScheme\n } = preferences;\n setColorScheme(colorScheme);\n };\n React.useEffect(() => {\n let subscription;\n if (!props.theme) {\n subscription = addEventListener(AccessibilityInfo, 'reduceMotionChanged', setReduceMotionEnabled);\n }\n return () => {\n if (!props.theme) {\n var _subscription;\n (_subscription = subscription) === null || _subscription === void 0 || _subscription.remove();\n }\n };\n }, [props.theme]);\n React.useEffect(() => {\n let appearanceSubscription;\n if (!props.theme || isOnlyVersionInTheme) {\n appearanceSubscription = Appearance === null || Appearance === void 0 ? void 0 : Appearance.addChangeListener(handleAppearanceChange);\n }\n return () => {\n if (!props.theme || isOnlyVersionInTheme) {\n if (appearanceSubscription) {\n appearanceSubscription.remove();\n } else {\n Appearance === null || Appearance === void 0 || Appearance.removeChangeListener(handleAppearanceChange);\n }\n }\n };\n }, [props.theme, isOnlyVersionInTheme]);\n const theme = React.useMemo(() => {\n var _props$theme, _props$theme2;\n const themeVersion = ((_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : _props$theme.version) || 3;\n const scheme = colorScheme || 'light';\n const defaultThemeBase = defaultThemesByVersion[themeVersion][scheme];\n const extendedThemeBase = Object.assign({}, defaultThemeBase, props.theme, {\n version: themeVersion,\n animation: Object.assign({}, (_props$theme2 = props.theme) === null || _props$theme2 === void 0 ? void 0 : _props$theme2.animation, {\n scale: reduceMotionEnabled ? 0 : 1\n })\n });\n return Object.assign({}, extendedThemeBase, {\n isV3: extendedThemeBase.version === 3\n });\n }, [colorScheme, props.theme, reduceMotionEnabled]);\n const {\n children,\n settings\n } = props;\n const settingsValue = React.useMemo(() => Object.assign({\n icon: MaterialCommunityIcon,\n rippleEffectEnabled: true\n }, settings), [settings]);\n return React.createElement(SafeAreaProviderCompat, null, React.createElement(PortalHost, null, React.createElement(SettingsProvider, {\n value: settingsValue\n }, React.createElement(ThemeProvider, {\n theme: theme\n }, children))));\n};\nexport default PaperProvider;","map":{"version":3,"names":["React","AccessibilityInfo","Appearance","SafeAreaProviderCompat","Provider","SettingsProvider","defaultThemesByVersion","ThemeProvider","MaterialCommunityIcon","PortalHost","addEventListener","PaperProvider","props","isOnlyVersionInTheme","theme","Object","keys","length","version","colorSchemeName","getColorScheme","reduceMotionEnabled","setReduceMotionEnabled","useState","colorScheme","setColorScheme","handleAppearanceChange","preferences","useEffect","subscription","_subscription","remove","appearanceSubscription","addChangeListener","removeChangeListener","useMemo","_props$theme","_props$theme2","themeVersion","scheme","defaultThemeBase","extendedThemeBase","assign","animation","scale","isV3","children","settings","settingsValue","icon","rippleEffectEnabled","createElement","value"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-paper/src/core/PaperProvider.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n AccessibilityInfo,\n Appearance,\n ColorSchemeName,\n NativeEventSubscription,\n} from 'react-native';\n\nimport SafeAreaProviderCompat from './SafeAreaProviderCompat';\nimport { Provider as SettingsProvider, Settings } from './settings';\nimport { defaultThemesByVersion, ThemeProvider } from './theming';\nimport MaterialCommunityIcon from '../components/MaterialCommunityIcon';\nimport PortalHost from '../components/Portal/PortalHost';\nimport type { ThemeProp } from '../types';\nimport { addEventListener } from '../utils/addEventListener';\n\nexport type Props = {\n children: React.ReactNode;\n theme?: ThemeProp;\n settings?: Settings;\n};\n\nconst PaperProvider = (props: Props) => {\n const isOnlyVersionInTheme =\n props.theme && Object.keys(props.theme).length === 1 && props.theme.version;\n\n const colorSchemeName =\n ((!props.theme || isOnlyVersionInTheme) && Appearance?.getColorScheme()) ||\n 'light';\n\n const [reduceMotionEnabled, setReduceMotionEnabled] =\n React.useState<boolean>(false);\n const [colorScheme, setColorScheme] =\n React.useState<ColorSchemeName>(colorSchemeName);\n\n const handleAppearanceChange = (\n preferences: Appearance.AppearancePreferences\n ) => {\n const { colorScheme } = preferences;\n setColorScheme(colorScheme);\n };\n\n React.useEffect(() => {\n let subscription: NativeEventSubscription | undefined;\n\n if (!props.theme) {\n subscription = addEventListener(\n AccessibilityInfo,\n 'reduceMotionChanged',\n setReduceMotionEnabled\n );\n }\n return () => {\n if (!props.theme) {\n subscription?.remove();\n }\n };\n }, [props.theme]);\n\n React.useEffect(() => {\n let appearanceSubscription: NativeEventSubscription | undefined;\n if (!props.theme || isOnlyVersionInTheme) {\n appearanceSubscription = Appearance?.addChangeListener(\n handleAppearanceChange\n ) as NativeEventSubscription | undefined;\n }\n return () => {\n if (!props.theme || isOnlyVersionInTheme) {\n if (appearanceSubscription) {\n appearanceSubscription.remove();\n } else {\n // @ts-expect-error: We keep deprecated listener remove method for backwards compat with old RN versions\n Appearance?.removeChangeListener(handleAppearanceChange);\n }\n }\n };\n }, [props.theme, isOnlyVersionInTheme]);\n\n const theme = React.useMemo(() => {\n const themeVersion = props.theme?.version || 3;\n const scheme = colorScheme || 'light';\n const defaultThemeBase = defaultThemesByVersion[themeVersion][scheme];\n\n const extendedThemeBase = {\n ...defaultThemeBase,\n ...props.theme,\n version: themeVersion,\n animation: {\n ...props.theme?.animation,\n scale: reduceMotionEnabled ? 0 : 1,\n },\n };\n\n return {\n ...extendedThemeBase,\n isV3: extendedThemeBase.version === 3,\n };\n }, [colorScheme, props.theme, reduceMotionEnabled]);\n\n const { children, settings } = props;\n\n const settingsValue = React.useMemo(\n () => ({\n icon: MaterialCommunityIcon,\n rippleEffectEnabled: true,\n ...settings,\n }),\n [settings]\n );\n\n return (\n <SafeAreaProviderCompat>\n <PortalHost>\n <SettingsProvider value={settingsValue}>\n <ThemeProvider theme={theme}>{children}</ThemeProvider>\n </SettingsProvider>\n </PortalHost>\n </SafeAreaProviderCompat>\n );\n};\n\nexport default PaperProvider;\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAAA,OAAAC,iBAAA;AAAA,OAAAC,UAAA;AAQ9B,OAAOC,sBAAsB;AAC7B,SAASC,QAAQ,IAAIC,gBAAgB;AACrC,SAASC,sBAAsB,EAAEC,aAAa;AAC9C,OAAOC,qBAAqB;AAC5B,OAAOC,UAAU;AAEjB,SAASC,gBAAgB;AAQzB,MAAMC,aAAa,GAAIC,KAAY,IAAK;EACtC,MAAMC,oBAAoB,GACxBD,KAAK,CAACE,KAAK,IAAIC,MAAM,CAACC,IAAI,CAACJ,KAAK,CAACE,KAAK,CAAC,CAACG,MAAM,KAAK,CAAC,IAAIL,KAAK,CAACE,KAAK,CAACI,OAAO;EAE7E,MAAMC,eAAe,GAClB,CAAC,CAACP,KAAK,CAACE,KAAK,IAAID,oBAAoB,MAAKX,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEkB,cAAc,CAAC,CAAC,KACvE,OAAO;EAET,MAAM,CAACC,mBAAmB,EAAEC,sBAAsB,CAAC,GACjDtB,KAAK,CAACuB,QAAQ,CAAU,KAAK,CAAC;EAChC,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GACjCzB,KAAK,CAACuB,QAAQ,CAAkBJ,eAAe,CAAC;EAElD,MAAMO,sBAAsB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