UNPKG

repoweaver

Version:

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

1 lines 2.8 kB
{"ast":null,"code":"import Dimensions from \"../Dimensions\";\nexport default class PixelRatio {\n static get() {\n return Dimensions.get('window').scale;\n }\n static getFontScale() {\n return Dimensions.get('window').fontScale || PixelRatio.get();\n }\n static getPixelSizeForLayoutSize(layoutSize) {\n return Math.round(layoutSize * PixelRatio.get());\n }\n static roundToNearestPixel(layoutSize) {\n var ratio = PixelRatio.get();\n return Math.round(layoutSize * ratio) / ratio;\n }\n}","map":{"version":3,"names":["Dimensions","PixelRatio","get","scale","getFontScale","fontScale","getPixelSizeForLayoutSize","layoutSize","Math","round","roundToNearestPixel","ratio"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-web/dist/exports/PixelRatio/index.js"],"sourcesContent":["/**\n * Copyright (c) Nicolas Gallagher.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nimport Dimensions from '../Dimensions';\n\n/**\n * PixelRatio gives access to the device pixel density.\n */\nexport default class PixelRatio {\n /**\n * Returns the device pixel density.\n */\n static get() {\n return Dimensions.get('window').scale;\n }\n\n /**\n * No equivalent for Web\n */\n static getFontScale() {\n return Dimensions.get('window').fontScale || PixelRatio.get();\n }\n\n /**\n * Converts a layout size (dp) to pixel size (px).\n * Guaranteed to return an integer number.\n */\n static getPixelSizeForLayoutSize(layoutSize) {\n return Math.round(layoutSize * PixelRatio.get());\n }\n\n /**\n * Rounds a layout size (dp) to the nearest layout size that corresponds to\n * an integer number of pixels. For example, on a device with a PixelRatio\n * of 3, `PixelRatio.roundToNearestPixel(8.4) = 8.33`, which corresponds to\n * exactly (8.33 * 3) = 25 pixels.\n */\n static roundToNearestPixel(layoutSize) {\n var ratio = PixelRatio.get();\n return Math.round(layoutSize * ratio) / ratio;\n }\n}"],"mappings":"AAUA,OAAOA,UAAU;AAKjB,eAAe,MAAMC,UAAU,CAAC;EAI9B,OAAOC,GAAGA,CAAA,EAAG;IACX,OAAOF,UAAU,CAACE,GAAG,CAAC,QAAQ,CAAC,CAACC,KAAK;EACvC;EAKA,OAAOC,YAAYA,CAAA,EAAG;IACpB,OAAOJ,UAAU,CAACE,GAAG,CAAC,QAAQ,CAAC,CAACG,SAAS,IAAIJ,UAAU,CAACC,GAAG,CAAC,CAAC;EAC/D;EAMA,OAAOI,yBAAyBA,CAACC,UAAU,EAAE;IAC3C,OAAOC,IAAI,CAACC,KAAK,CAACF,UAAU,GAAGN,UAAU,CAACC,GAAG,CAAC,CAAC,CAAC;EAClD;EAQA,OAAOQ,mBAAmBA,CAACH,UAAU,EAAE;IACrC,IAAII,KAAK,GAAGV,UAAU,CAACC,GAAG,CAAC,CAAC;IAC5B,OAAOM,IAAI,CAACC,KAAK,CAACF,UAAU,GAAGI,KAAK,CAAC,GAAGA,KAAK;EAC/C;AACF","ignoreList":[]},"metadata":{"hasCjsExports":false},"sourceType":"module","externalDependencies":[]}