UNPKG

repoweaver

Version:

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

1 lines 9.41 kB
{"ast":null,"code":"'use client';\n\nimport invariant from 'fbjs/lib/invariant';\nimport canUseDOM from \"../../modules/canUseDom\";\nvar dimensions = {\n window: {\n fontScale: 1,\n height: 0,\n scale: 1,\n width: 0\n },\n screen: {\n fontScale: 1,\n height: 0,\n scale: 1,\n width: 0\n }\n};\nvar listeners = {};\nvar shouldInit = canUseDOM;\nfunction update() {\n if (!canUseDOM) {\n return;\n }\n var win = window;\n var height;\n var width;\n if (win.visualViewport) {\n var visualViewport = win.visualViewport;\n height = Math.round(visualViewport.height * visualViewport.scale);\n width = Math.round(visualViewport.width * visualViewport.scale);\n } else {\n var docEl = win.document.documentElement;\n height = docEl.clientHeight;\n width = docEl.clientWidth;\n }\n dimensions.window = {\n fontScale: 1,\n height,\n scale: win.devicePixelRatio || 1,\n width\n };\n dimensions.screen = {\n fontScale: 1,\n height: win.screen.height,\n scale: win.devicePixelRatio || 1,\n width: win.screen.width\n };\n}\nfunction handleResize() {\n update();\n if (Array.isArray(listeners['change'])) {\n listeners['change'].forEach(handler => handler(dimensions));\n }\n}\nexport default class Dimensions {\n static get(dimension) {\n if (shouldInit) {\n shouldInit = false;\n update();\n }\n invariant(dimensions[dimension], \"No dimension set for key \" + dimension);\n return dimensions[dimension];\n }\n static set(initialDimensions) {\n if (initialDimensions) {\n if (canUseDOM) {\n invariant(false, 'Dimensions cannot be set in the browser');\n } else {\n if (initialDimensions.screen != null) {\n dimensions.screen = initialDimensions.screen;\n }\n if (initialDimensions.window != null) {\n dimensions.window = initialDimensions.window;\n }\n }\n }\n }\n static addEventListener(type, handler) {\n listeners[type] = listeners[type] || [];\n listeners[type].push(handler);\n return {\n remove: () => {\n this.removeEventListener(type, handler);\n }\n };\n }\n static removeEventListener(type, handler) {\n if (Array.isArray(listeners[type])) {\n listeners[type] = listeners[type].filter(_handler => _handler !== handler);\n }\n }\n}\nif (canUseDOM) {\n if (window.visualViewport) {\n window.visualViewport.addEventListener('resize', handleResize, false);\n } else {\n window.addEventListener('resize', handleResize, false);\n }\n}","map":{"version":3,"names":["invariant","canUseDOM","dimensions","window","fontScale","height","scale","width","screen","listeners","shouldInit","update","win","visualViewport","Math","round","docEl","document","documentElement","clientHeight","clientWidth","devicePixelRatio","handleResize","Array","isArray","forEach","handler","Dimensions","get","dimension","set","initialDimensions","addEventListener","type","push","remove","removeEventListener","filter","_handler"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-web/dist/exports/Dimensions/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\n'use client';\n\nimport invariant from 'fbjs/lib/invariant';\nimport canUseDOM from '../../modules/canUseDom';\nvar dimensions = {\n window: {\n fontScale: 1,\n height: 0,\n scale: 1,\n width: 0\n },\n screen: {\n fontScale: 1,\n height: 0,\n scale: 1,\n width: 0\n }\n};\nvar listeners = {};\nvar shouldInit = canUseDOM;\nfunction update() {\n if (!canUseDOM) {\n return;\n }\n var win = window;\n var height;\n var width;\n\n /**\n * iOS does not update viewport dimensions on keyboard open/close.\n * window.visualViewport(https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport)\n * is used instead of document.documentElement.clientHeight (which remains as a fallback)\n */\n if (win.visualViewport) {\n var visualViewport = win.visualViewport;\n /**\n * We are multiplying by scale because height and width from visual viewport\n * also react to pinch zoom, and become smaller when zoomed. But it is not desired\n * behaviour, since originally documentElement client height and width were used,\n * and they do not react to pinch zoom.\n */\n height = Math.round(visualViewport.height * visualViewport.scale);\n width = Math.round(visualViewport.width * visualViewport.scale);\n } else {\n var docEl = win.document.documentElement;\n height = docEl.clientHeight;\n width = docEl.clientWidth;\n }\n dimensions.window = {\n fontScale: 1,\n height,\n scale: win.devicePixelRatio || 1,\n width\n };\n dimensions.screen = {\n fontScale: 1,\n height: win.screen.height,\n scale: win.devicePixelRatio || 1,\n width: win.screen.width\n };\n}\nfunction handleResize() {\n update();\n if (Array.isArray(listeners['change'])) {\n listeners['change'].forEach(handler => handler(dimensions));\n }\n}\nexport default class Dimensions {\n static get(dimension) {\n if (shouldInit) {\n shouldInit = false;\n update();\n }\n invariant(dimensions[dimension], \"No dimension set for key \" + dimension);\n return dimensions[dimension];\n }\n static set(initialDimensions) {\n if (initialDimensions) {\n if (canUseDOM) {\n invariant(false, 'Dimensions cannot be set in the browser');\n } else {\n if (initialDimensions.screen != null) {\n dimensions.screen = initialDimensions.screen;\n }\n if (initialDimensions.window != null) {\n dimensions.window = initialDimensions.window;\n }\n }\n }\n }\n static addEventListener(type, handler) {\n listeners[type] = listeners[type] || [];\n listeners[type].push(handler);\n return {\n remove: () => {\n this.removeEventListener(type, handler);\n }\n };\n }\n static removeEventListener(type, handler) {\n if (Array.isArray(listeners[type])) {\n listeners[type] = listeners[type].filter(_handler => _handler !== handler);\n }\n }\n}\nif (canUseDOM) {\n if (window.visualViewport) {\n window.visualViewport.addEventListener('resize', handleResize, false);\n } else {\n window.addEventListener('resize', handleResize, false);\n }\n}"],"mappings":"AAUA,YAAY;;AAEZ,OAAOA,SAAS,MAAM,oBAAoB;AAC1C,OAAOC,SAAS;AAChB,IAAIC,UAAU,GAAG;EACfC,MAAM,EAAE;IACNC,SAAS,EAAE,CAAC;IACZC,MAAM,EAAE,CAAC;IACTC,KAAK,EAAE,CAAC;IACRC,KAAK,EAAE;EACT,CAAC;EACDC,MAAM,EAAE;IACNJ,SAAS,EAAE,CAAC;IACZC,MAAM,EAAE,CAAC;IACTC,KAAK,EAAE,CAAC;IACRC,KAAK,EAAE;EACT;AACF,CAAC;AACD,IAAIE,SAAS,GAAG,CAAC,CAAC;AAClB,IAAIC,UAAU,GAAGT,SAAS;AAC1B,SAASU,MAAMA,CAAA,EAAG;EAChB,IAAI,CAACV,SAAS,EAAE;IACd;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