1 line
14 KiB
JSON
1 line
14 KiB
JSON
{"ast":null,"code":"// Thanks to https://github.com/andreypopp/react-textarea-autosize/\n\n/**\n * calculateNodeHeight(uiTextNode, useCache = false)\n */\n\nvar HIDDEN_TEXTAREA_STYLE = \"\\n min-height:0 !important;\\n max-height:none !important;\\n height:0 !important;\\n visibility:hidden !important;\\n overflow:hidden !important;\\n position:absolute !important;\\n z-index:-1000 !important;\\n top:0 !important;\\n right:0 !important;\\n pointer-events: none !important;\\n\";\nvar SIZING_STYLE = ['letter-spacing', 'line-height', 'padding-top', 'padding-bottom', 'font-family', 'font-weight', 'font-size', 'font-variant', 'text-rendering', 'text-transform', 'width', 'text-indent', 'padding-left', 'padding-right', 'border-width', 'box-sizing', 'word-break', 'white-space'];\nvar computedStyleCache = {};\nvar hiddenTextarea;\nexport function calculateNodeStyling(node) {\n var useCache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var nodeRef = node.getAttribute('id') || node.getAttribute('data-reactid') || node.getAttribute('name');\n if (useCache && computedStyleCache[nodeRef]) {\n return computedStyleCache[nodeRef];\n }\n var style = window.getComputedStyle(node);\n var boxSizing = style.getPropertyValue('box-sizing') || style.getPropertyValue('-moz-box-sizing') || style.getPropertyValue('-webkit-box-sizing');\n var paddingSize = parseFloat(style.getPropertyValue('padding-bottom')) + parseFloat(style.getPropertyValue('padding-top'));\n var borderSize = parseFloat(style.getPropertyValue('border-bottom-width')) + parseFloat(style.getPropertyValue('border-top-width'));\n var sizingStyle = SIZING_STYLE.map(function (name) {\n return \"\".concat(name, \":\").concat(style.getPropertyValue(name));\n }).join(';');\n var nodeInfo = {\n sizingStyle: sizingStyle,\n paddingSize: paddingSize,\n borderSize: borderSize,\n boxSizing: boxSizing\n };\n if (useCache && nodeRef) {\n computedStyleCache[nodeRef] = nodeInfo;\n }\n return nodeInfo;\n}\nexport default function calculateAutoSizeStyle(uiTextNode) {\n var useCache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var minRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n var maxRows = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n if (!hiddenTextarea) {\n hiddenTextarea = document.createElement('textarea');\n hiddenTextarea.setAttribute('tab-index', '-1');\n hiddenTextarea.setAttribute('aria-hidden', 'true');\n document.body.appendChild(hiddenTextarea);\n }\n\n // Fix wrap=\"off\" issue\n // https://github.com/ant-design/ant-design/issues/6577\n if (uiTextNode.getAttribute('wrap')) {\n hiddenTextarea.setAttribute('wrap', uiTextNode.getAttribute('wrap'));\n } else {\n hiddenTextarea.removeAttribute('wrap');\n }\n\n // Copy all CSS properties that have an impact on the height of the content in\n // the textbox\n var _calculateNodeStyling = calculateNodeStyling(uiTextNode, useCache),\n paddingSize = _calculateNodeStyling.paddingSize,\n borderSize = _calculateNodeStyling.borderSize,\n boxSizing = _calculateNodeStyling.boxSizing,\n sizingStyle = _calculateNodeStyling.sizingStyle;\n\n // Need to have the overflow attribute to hide the scrollbar otherwise\n // text-lines will not calculated properly as the shadow will technically be\n // narrower for content\n hiddenTextarea.setAttribute('style', \"\".concat(sizingStyle, \";\").concat(HIDDEN_TEXTAREA_STYLE));\n hiddenTextarea.value = uiTextNode.value || uiTextNode.placeholder || '';\n var minHeight = undefined;\n var maxHeight = undefined;\n var overflowY;\n var height = hiddenTextarea.scrollHeight;\n if (boxSizing === 'border-box') {\n // border-box: add border, since height = content + padding + border\n height += borderSize;\n } else if (boxSizing === 'content-box') {\n // remove padding, since height = content\n height -= paddingSize;\n }\n if (minRows !== null || maxRows !== null) {\n // measure height of a textarea with a single row\n hiddenTextarea.value = ' ';\n var singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;\n if (minRows !== null) {\n minHeight = singleRowHeight * minRows;\n if (boxSizing === 'border-box') {\n minHeight = minHeight + paddingSize + borderSize;\n }\n height = Math.max(minHeight, height);\n }\n if (maxRows !== null) {\n maxHeight = singleRowHeight * maxRows;\n if (boxSizing === 'border-box') {\n maxHeight = maxHeight + paddingSize + borderSize;\n }\n overflowY = height > maxHeight ? '' : 'hidden';\n height = Math.min(maxHeight, height);\n }\n }\n var style = {\n height: height,\n overflowY: overflowY,\n resize: 'none'\n };\n if (minHeight) {\n style.minHeight = minHeight;\n }\n if (maxHeight) {\n style.maxHeight = maxHeight;\n }\n return style;\n}","map":{"version":3,"names":["HIDDEN_TEXTAREA_STYLE","SIZING_STYLE","computedStyleCache","hiddenTextarea","calculateNodeStyling","node","useCache","arguments","length","undefined","nodeRef","getAttribute","style","window","getComputedStyle","boxSizing","getPropertyValue","paddingSize","parseFloat","borderSize","sizingStyle","map","name","concat","join","nodeInfo","calculateAutoSizeStyle","uiTextNode","minRows","maxRows","document","createElement","setAttribute","body","appendChild","removeAttribute","_calculateNodeStyling","value","placeholder","minHeight","maxHeight","overflowY","height","scrollHeight","singleRowHeight","Math","max","min","resize"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-textarea/es/calculateNodeHeight.js"],"sourcesContent":["// Thanks to https://github.com/andreypopp/react-textarea-autosize/\n\n/**\n * calculateNodeHeight(uiTextNode, useCache = false)\n */\n\nvar HIDDEN_TEXTAREA_STYLE = \"\\n min-height:0 !important;\\n max-height:none !important;\\n height:0 !important;\\n visibility:hidden !important;\\n overflow:hidden !important;\\n position:absolute !important;\\n z-index:-1000 !important;\\n top:0 !important;\\n right:0 !important;\\n pointer-events: none !important;\\n\";\nvar SIZING_STYLE = ['letter-spacing', 'line-height', 'padding-top', 'padding-bottom', 'font-family', 'font-weight', 'font-size', 'font-variant', 'text-rendering', 'text-transform', 'width', 'text-indent', 'padding-left', 'padding-right', 'border-width', 'box-sizing', 'word-break', 'white-space'];\nvar computedStyleCache = {};\nvar hiddenTextarea;\nexport function calculateNodeStyling(node) {\n var useCache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var nodeRef = node.getAttribute('id') || node.getAttribute('data-reactid') || node.getAttribute('name');\n if (useCache && computedStyleCache[nodeRef]) {\n return computedStyleCache[nodeRef];\n }\n var style = window.getComputedStyle(node);\n var boxSizing = style.getPropertyValue('box-sizing') || style.getPropertyValue('-moz-box-sizing') || style.getPropertyValue('-webkit-box-sizing');\n var paddingSize = parseFloat(style.getPropertyValue('padding-bottom')) + parseFloat(style.getPropertyValue('padding-top'));\n var borderSize = parseFloat(style.getPropertyValue('border-bottom-width')) + parseFloat(style.getPropertyValue('border-top-width'));\n var sizingStyle = SIZING_STYLE.map(function (name) {\n return \"\".concat(name, \":\").concat(style.getPropertyValue(name));\n }).join(';');\n var nodeInfo = {\n sizingStyle: sizingStyle,\n paddingSize: paddingSize,\n borderSize: borderSize,\n boxSizing: boxSizing\n };\n if (useCache && nodeRef) {\n computedStyleCache[nodeRef] = nodeInfo;\n }\n return nodeInfo;\n}\nexport default function calculateAutoSizeStyle(uiTextNode) {\n var useCache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var minRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n var maxRows = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n if (!hiddenTextarea) {\n hiddenTextarea = document.createElement('textarea');\n hiddenTextarea.setAttribute('tab-index', '-1');\n hiddenTextarea.setAttribute('aria-hidden', 'true');\n document.body.appendChild(hiddenTextarea);\n }\n\n // Fix wrap=\"off\" issue\n // https://github.com/ant-design/ant-design/issues/6577\n if (uiTextNode.getAttribute('wrap')) {\n hiddenTextarea.setAttribute('wrap', uiTextNode.getAttribute('wrap'));\n } else {\n hiddenTextarea.removeAttribute('wrap');\n }\n\n // Copy all CSS properties that have an impact on the height of the content in\n // the textbox\n var _calculateNodeStyling = calculateNodeStyling(uiTextNode, useCache),\n paddingSize = _calculateNodeStyling.paddingSize,\n borderSize = _calculateNodeStyling.borderSize,\n boxSizing = _calculateNodeStyling.boxSizing,\n sizingStyle = _calculateNodeStyling.sizingStyle;\n\n // Need to have the overflow attribute to hide the scrollbar otherwise\n // text-lines will not calculated properly as the shadow will technically be\n // narrower for content\n hiddenTextarea.setAttribute('style', \"\".concat(sizingStyle, \";\").concat(HIDDEN_TEXTAREA_STYLE));\n hiddenTextarea.value = uiTextNode.value || uiTextNode.placeholder || '';\n var minHeight = undefined;\n var maxHeight = undefined;\n var overflowY;\n var height = hiddenTextarea.scrollHeight;\n if (boxSizing === 'border-box') {\n // border-box: add border, since height = content + padding + border\n height += borderSize;\n } else if (boxSizing === 'content-box') {\n // remove padding, since height = content\n height -= paddingSize;\n }\n if (minRows !== null || maxRows !== null) {\n // measure height of a textarea with a single row\n hiddenTextarea.value = ' ';\n var singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;\n if (minRows !== null) {\n minHeight = singleRowHeight * minRows;\n if (boxSizing === 'border-box') {\n minHeight = minHeight + paddingSize + borderSize;\n }\n height = Math.max(minHeight, height);\n }\n if (maxRows !== null) {\n maxHeight = singleRowHeight * maxRows;\n if (boxSizing === 'border-box') {\n maxHeight = maxHeight + paddingSize + borderSize;\n }\n overflowY = height > maxHeight ? '' : 'hidden';\n height = Math.min(maxHeight, height);\n }\n }\n var style = {\n height: height,\n overflowY: overflowY,\n resize: 'none'\n };\n if (minHeight) {\n style.minHeight = minHeight;\n }\n if (maxHeight) {\n style.maxHeight = maxHeight;\n }\n return style;\n}"],"mappings":"AAAA;;AAEA;AACA;AACA;;AAEA,IAAIA,qBAAqB,GAAG,qSAAqS;AACjU,IAAIC,YAAY,GAAG,CAAC,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,CAAC;AACxS,IAAIC,kBAAkB,GAAG,CAAC,CAAC;AAC3B,IAAIC,cAAc;AAClB,OAAO,SAASC,oBAAoBA,CAACC,IAAI,EAAE;EACzC,IAAIC,QAAQ,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