PageSourceSearch

https://mastodon.social/packs/react-textarea-autosize.browser.esm-o9pjGy_A.js

js mastodon.social collected 2026-10-09 21:33:40 UTC 3,558 bytes, 2 lines download raw bytes

1import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t}from"./jsx-runtime-D3F0h15I.js";import{p as n,y as r}from"./react-router-D0L-bsDO.js";import{t as i}from"./use-isomorphic-layout-effect.browser.esm-M-Y-iJel.js";var a=e(t()),o=function(e){var t=a.useRef(e);return i(function(){t.current=e}),t},s=function(e,t){if(typeof e==`function`){e(t);return}e.current=t},c=function(e,t){var n=a.useRef();return a.useCallback(function(r){e.current=r,n.current&&s(n.current,null),n.current=t,t&&s(t,r)},[t])},l={"min-height":`0`,"max-height":`none`,height:`0`,visibility:`hidden`,overflow:`hidden`,position:`absolute`,"z-index":`-1000`,top:`0`,right:`0`,display:`block`},u=function(e){Object.keys(l).forEach(function(t){e.style.setProperty(t,l[t],`important`)})},d=null,f=function(e,t){var n=e.scrollHeight;return t.sizingStyle.boxSizing===`border-box`?n+t.borderSize:n-t.paddingSize};function p(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),d||(d=document.createElement(`textarea`),d.setAttribute(`tabindex`,`-1`),d.setAttribute(`aria-hidden`,`true`),u(d)),d.parentNode===null&&document.body.appendChild(d);var i=e.paddingSize,a=e.borderSize,o=e.sizingStyle,s=o.boxSizing;Object.keys(o).forEach(function(e){var t=e;d.style[t]=o[t]}),u(d),d.value=t;var c=f(d,e);d.value=t,c=f(d,e),d.value=`x`;var l=d.scrollHeight-i,p=l*n;s===`border-box`&&(p=p+i+a),c=Math.max(p,c);var m=l*r;return s===`border-box`&&(m=m+i+a),c=Math.min(m,c),[c,l]}var m=function(){},h=function(e,t){return e.reduce(function(e,n){return e[n]=t[n],e},{})},g=[`borderBottomWidth`,`borderLeftWidth`,`borderRightWidth`,`borderTopWidth`,`boxSizing`,`fontFamily`,`fontSize`,`fontStyle`,`fontWeight`,`letterSpacing`,`lineHeight`,`paddingBottom`,`paddingLeft`,`paddingRight`,`paddingTop`,`tabSize`,`textIndent`,`textRendering`,`textTransform`,`width`,`wordBreak`,`wordSpacing`,`scrollbarGutter`],_=!!document.documentElement.currentStyle,v=function(e){var t=window.getComputedStyle(e);if(t===null)return null;var n=h(g,t),r=n.boxSizing;return r===``?null:(_&&r===`border-box`&&(n.width=parseFloat(n.width)+parseFloat(n.borderRightWidth)+parseFloat(n.borderLeftWidth)+parseFloat(n.paddingRight)+parseFloat(n.paddingLeft)+`px`),{sizingStyle:n,paddingSize:parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),borderSize:parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth)})};function y(e,t,n){var r=o(n);a.useLayoutEffect(function(){var n=function(e){return r.current(e)};if(e)return e.addEventListener(t,n),function(){return e.removeEventListener(t,n)}},[])}var b=function(e,t){y(document.body,`reset`,function(n){e.current.form===n.target&&t(n)})},x=function(e){y(window,`resize`,e)},S=function(e){y(document.fonts,`loadingdone`,e)},C=[`cacheMeasurements`,`maxRows`,`minRows`,`onChange`,`onHeightChange`],w=a.forwardRef(function(e,t){var i=e.cacheMeasurements,o=e.maxRows,s=e.minRows,l=e.onChange,u=l===void 0?m:l,d=e.onHeightChange,f=d===void 0?m:d,h=n(e,C),g=h.value!==void 0,_=a.useRef(null),y=c(_,t),w=a.useRef(0),T=a.useRef(),E=function(){var e=_.current,t=i&&T.current?T.current:v(e);if(t){T.current=t;var n=p(t,e.value||e.placeholder||`x`,s,o),r=n[0],a=n[1];w.current!==r&&(w.current=r,e.style.setProperty(`height`,r+`px`,`important`),f(r,{rowHeight:a}))}};return a.useLayoutEffect(E),b(_,function(){if(!g){var e=_.current.value;requestAnimationFrame(function(){var t=_.current;t&&e!==t.value&&E()})}}),x(E),S(E),a.createElement(`textarea`,r({},h,{onChange:function(e){g||E(),u(e)},ref:y}))});export{w as t};
2//# sourceMappingURL=react-textarea-autosize.browser.esm-o9pjGy_A.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.