UNPKG

repoweaver

Version:

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

1 lines 5.51 kB
{"ast":null,"code":"import Animated from \"react-native-web/dist/exports/Animated\";\nimport color from 'color';\nimport { MD2DarkTheme } from \"./themes/v2/DarkTheme\";\nexport const isAnimatedValue = it => it instanceof Animated.Value;\nexport default function overlay(elevation, surfaceColor = (_MD2DarkTheme$colors => (_MD2DarkTheme$colors = MD2DarkTheme.colors) === null || _MD2DarkTheme$colors === void 0 ? void 0 : _MD2DarkTheme$colors.surface)()) {\n if (isAnimatedValue(elevation)) {\n const inputRange = [0, 1, 2, 3, 8, 24];\n return elevation.interpolate({\n inputRange,\n outputRange: inputRange.map(elevation => {\n return calculateColor(surfaceColor, elevation);\n })\n });\n }\n return calculateColor(surfaceColor, elevation);\n}\nfunction calculateColor(surfaceColor, elevation = 1) {\n let overlayTransparency;\n if (elevation >= 1 && elevation <= 24) {\n overlayTransparency = elevationOverlayTransparency[elevation];\n } else if (elevation > 24) {\n overlayTransparency = elevationOverlayTransparency[24];\n } else {\n overlayTransparency = elevationOverlayTransparency[1];\n }\n return color(surfaceColor).mix(color('white'), overlayTransparency * 0.01).hex();\n}\nconst elevationOverlayTransparency = {\n 1: 5,\n 2: 7,\n 3: 8,\n 4: 9,\n 5: 10,\n 6: 11,\n 7: 11.5,\n 8: 12,\n 9: 12.5,\n 10: 13,\n 11: 13.5,\n 12: 14,\n 13: 14.25,\n 14: 14.5,\n 15: 14.75,\n 16: 15,\n 17: 15.12,\n 18: 15.24,\n 19: 15.36,\n 20: 15.48,\n 21: 15.6,\n 22: 15.72,\n 23: 15.84,\n 24: 16\n};","map":{"version":3,"names":["color","MD2DarkTheme","isAnimatedValue","it","Animated","Value","overlay","elevation","surfaceColor","_MD2DarkTheme$colors","colors","surface","inputRange","interpolate","outputRange","map","calculateColor","overlayTransparency","elevationOverlayTransparency","mix","hex"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-paper/src/styles/overlay.tsx"],"sourcesContent":["import { Animated } from 'react-native';\n\nimport color from 'color';\n\nimport { MD2DarkTheme } from './themes/v2/DarkTheme';\n\nexport const isAnimatedValue = (\n it: number | string | Animated.AnimatedInterpolation<number | string>\n): it is Animated.Value => it instanceof Animated.Value;\n\nexport default function overlay<T extends Animated.Value | number>(\n elevation: T,\n surfaceColor: string = MD2DarkTheme.colors?.surface\n): T extends number ? string : Animated.AnimatedInterpolation<number | string> {\n if (isAnimatedValue(elevation)) {\n const inputRange = [0, 1, 2, 3, 8, 24];\n\n // @ts-expect-error: TS doesn't seem to refine the type correctly\n return elevation.interpolate({\n inputRange,\n outputRange: inputRange.map((elevation) => {\n return calculateColor(surfaceColor, elevation);\n }),\n });\n }\n\n // @ts-expect-error: TS doesn't seem to refine the type correctly\n return calculateColor(surfaceColor, elevation);\n}\n\nfunction calculateColor(surfaceColor: string, elevation: number = 1) {\n let overlayTransparency: number;\n if (elevation >= 1 && elevation <= 24) {\n overlayTransparency = elevationOverlayTransparency[elevation];\n } else if (elevation > 24) {\n overlayTransparency = elevationOverlayTransparency[24];\n } else {\n overlayTransparency = elevationOverlayTransparency[1];\n }\n return color(surfaceColor)\n .mix(color('white'), overlayTransparency * 0.01)\n .hex();\n}\n\nconst elevationOverlayTransparency: Record<string, number> = {\n 1: 5,\n 2: 7,\n 3: 8,\n 4: 9,\n 5: 10,\n 6: 11,\n 7: 11.5,\n 8: 12,\n 9: 12.5,\n 10: 13,\n 11: 13.5,\n 12: 14,\n 13: 14.25,\n 14: 14.5,\n 15: 14.75,\n 16: 15,\n 17: 15.12,\n 18: 15.24,\n 19: 15.36,\n 20: 15.48,\n 21: 15.6,\n 22: 15.72,\n 23: 15.84,\n 24: 16,\n};\n"],"mappings":";AAEA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,YAAY;AAErB,OAAO,MAAMC,eAAe,GAC1BC,EAAqE,IAC5CA,EAAE,YAAYC,QAAQ,CAACC,KAAK;AAEvD,eA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