1 line
8.3 KiB
JSON
1 line
8.3 KiB
JSON
{"ast":null,"code":"/* eslint-disable no-param-reassign */\nimport { removeCSS, updateCSS } from \"./Dom/dynamicCSS\";\nvar cached;\nfunction measureScrollbarSize(ele) {\n var randomId = \"rc-scrollbar-measure-\".concat(Math.random().toString(36).substring(7));\n var measureEle = document.createElement('div');\n measureEle.id = randomId;\n\n // Create Style\n var measureStyle = measureEle.style;\n measureStyle.position = 'absolute';\n measureStyle.left = '0';\n measureStyle.top = '0';\n measureStyle.width = '100px';\n measureStyle.height = '100px';\n measureStyle.overflow = 'scroll';\n\n // Clone Style if needed\n var fallbackWidth;\n var fallbackHeight;\n if (ele) {\n var targetStyle = getComputedStyle(ele);\n measureStyle.scrollbarColor = targetStyle.scrollbarColor;\n measureStyle.scrollbarWidth = targetStyle.scrollbarWidth;\n\n // Set Webkit style\n var webkitScrollbarStyle = getComputedStyle(ele, '::-webkit-scrollbar');\n var width = parseInt(webkitScrollbarStyle.width, 10);\n var height = parseInt(webkitScrollbarStyle.height, 10);\n\n // Try wrap to handle CSP case\n try {\n var widthStyle = width ? \"width: \".concat(webkitScrollbarStyle.width, \";\") : '';\n var heightStyle = height ? \"height: \".concat(webkitScrollbarStyle.height, \";\") : '';\n updateCSS(\"\\n#\".concat(randomId, \"::-webkit-scrollbar {\\n\").concat(widthStyle, \"\\n\").concat(heightStyle, \"\\n}\"), randomId);\n } catch (e) {\n // Can't wrap, just log error\n console.error(e);\n\n // Get from style directly\n fallbackWidth = width;\n fallbackHeight = height;\n }\n }\n document.body.appendChild(measureEle);\n\n // Measure. Get fallback style if provided\n var scrollWidth = ele && fallbackWidth && !isNaN(fallbackWidth) ? fallbackWidth : measureEle.offsetWidth - measureEle.clientWidth;\n var scrollHeight = ele && fallbackHeight && !isNaN(fallbackHeight) ? fallbackHeight : measureEle.offsetHeight - measureEle.clientHeight;\n\n // Clean up\n document.body.removeChild(measureEle);\n removeCSS(randomId);\n return {\n width: scrollWidth,\n height: scrollHeight\n };\n}\nexport default function getScrollBarSize(fresh) {\n if (typeof document === 'undefined') {\n return 0;\n }\n if (fresh || cached === undefined) {\n cached = measureScrollbarSize();\n }\n return cached.width;\n}\nexport function getTargetScrollBarSize(target) {\n if (typeof document === 'undefined' || !target || !(target instanceof Element)) {\n return {\n width: 0,\n height: 0\n };\n }\n return measureScrollbarSize(target);\n}","map":{"version":3,"names":["removeCSS","updateCSS","cached","measureScrollbarSize","ele","randomId","concat","Math","random","toString","substring","measureEle","document","createElement","id","measureStyle","style","position","left","top","width","height","overflow","fallbackWidth","fallbackHeight","targetStyle","getComputedStyle","scrollbarColor","scrollbarWidth","webkitScrollbarStyle","parseInt","widthStyle","heightStyle","e","console","error","body","appendChild","scrollWidth","isNaN","offsetWidth","clientWidth","scrollHeight","offsetHeight","clientHeight","removeChild","getScrollBarSize","fresh","undefined","getTargetScrollBarSize","target","Element"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-util/es/getScrollBarSize.js"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport { removeCSS, updateCSS } from \"./Dom/dynamicCSS\";\nvar cached;\nfunction measureScrollbarSize(ele) {\n var randomId = \"rc-scrollbar-measure-\".concat(Math.random().toString(36).substring(7));\n var measureEle = document.createElement('div');\n measureEle.id = randomId;\n\n // Create Style\n var measureStyle = measureEle.style;\n measureStyle.position = 'absolute';\n measureStyle.left = '0';\n measureStyle.top = '0';\n measureStyle.width = '100px';\n measureStyle.height = '100px';\n measureStyle.overflow = 'scroll';\n\n // Clone Style if needed\n var fallbackWidth;\n var fallbackHeight;\n if (ele) {\n var targetStyle = getComputedStyle(ele);\n measureStyle.scrollbarColor = targetStyle.scrollbarColor;\n measureStyle.scrollbarWidth = targetStyle.scrollbarWidth;\n\n // Set Webkit style\n var webkitScrollbarStyle = getComputedStyle(ele, '::-webkit-scrollbar');\n var width = parseInt(webkitScrollbarStyle.width, 10);\n var height = parseInt(webkitScrollbarStyle.height, 10);\n\n // Try wrap to handle CSP case\n try {\n var widthStyle = width ? \"width: \".concat(webkitScrollbarStyle.width, \";\") : '';\n var heightStyle = height ? \"height: \".concat(webkitScrollbarStyle.height, \";\") : '';\n updateCSS(\"\\n#\".concat(randomId, \"::-webkit-scrollbar {\\n\").concat(widthStyle, \"\\n\").concat(heightStyle, \"\\n}\"), randomId);\n } catch (e) {\n // Can't wrap, just log error\n console.error(e);\n\n // Get from style directly\n fallbackWidth = width;\n fallbackHeight = height;\n }\n }\n document.body.appendChild(measureEle);\n\n // Measure. Get fallback style if provided\n var scrollWidth = ele && fallbackWidth && !isNaN(fallbackWidth) ? fallbackWidth : measureEle.offsetWidth - measureEle.clientWidth;\n var scrollHeight = ele && fallbackHeight && !isNaN(fallbackHeight) ? fallbackHeight : measureEle.offsetHeight - measureEle.clientHeight;\n\n // Clean up\n document.body.removeChild(measureEle);\n removeCSS(randomId);\n return {\n width: scrollWidth,\n height: scrollHeight\n };\n}\nexport default function getScrollBarSize(fresh) {\n if (typeof document === 'undefined') {\n return 0;\n }\n if (fresh || cached === undefined) {\n cached = measureScrollbarSize();\n }\n return cached.width;\n}\nexport function getTargetScrollBarSize(target) {\n if (typeof document === 'undefined' || !target || !(target instanceof Element)) {\n return {\n width: 0,\n height: 0\n };\n }\n return measureScrollbarSize(target);\n}"],"mappings":"AAAA;AACA,SAASA,SAAS,EAAEC,SAAS,QAAQ,kBAAkB;AACvD,IAAIC,MAAM;AACV,SAASC,oBAAoBA,CAACC,GAAG,EAAE;EACjC,IAAIC,QAAQ,GAAG,uBAAuB,CAACC,MAAM,CAACC,IAAI,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,SAAS,CAAC,CAAC,CAAC,CAAC;EACtF,IAAIC,UAAU,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EAC9CF,UAAU,CAACG,EAAE,GAAGT,QAAQ;;EAExB;EACA,IAAIU,YAAY,GAAGJ,UAAU,CAACK,KAAK;EACnCD,YAAY,CAACE,QAA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