react-wrap-balancer
Advanced tools
Comparing version 0.2.1 to 0.2.2
"use client" | ||
var m=Object.create;var u=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var w=(e,t)=>{for(var r in t)u(e,r,{get:t[r],enumerable:!0})},d=(e,t,r,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of y(t))!E.call(e,n)&&n!==r&&u(e,n,{get:()=>t[n],enumerable:!(c=v(t,n))||c.enumerable});return e};var _=(e,t,r)=>(r=e!=null?m(h(e)):{},d(t||!e||!e.__esModule?u(r,"default",{value:e,enumerable:!0}):r,e)),x=e=>d(u({},"__esModule",{value:!0}),e);var L={};w(L,{default:()=>g});module.exports=x(L);var s=_(require("react")),a="__wrap_balancer",b=typeof window=="undefined",p=b?s.default.useEffect:s.default.useLayoutEffect;if(!b&&process.env.NODE_ENV!=="production"){let e=document.querySelector("[data-next-hide-fouc]");if(e){let t=c=>{for(let n of c)for(let l of n.removedNodes)if(l===e){r.disconnect();let o=document.querySelectorAll("[data-br]");for(let i of o)self[a](0,+i.dataset.brr,i)}},r=new MutationObserver(t);r.observe(document.head,{childList:!0})}}var S=({as:e="span",ratio:t=1,children:r,...c})=>{let n=e,l=s.default.useId(),o=s.default.useRef();return p(()=>{!o.current||self[a](0,t,o.current)},[r,t]),p(()=>{if(!o.current)return;let i=o.current.parentElement;if(!i)return;let f=new ResizeObserver(()=>{!o.current||self[a](0,t,o.current)});return f.observe(i),()=>f.unobserve(i)},[]),s.default.createElement(s.default.Fragment,null,s.default.createElement(n,{...c,"data-br":l,"data-brr":t,ref:o,style:{display:"inline-block",verticalAlign:"top",textDecoration:"inherit"},suppressHydrationWarning:!0},r),s.default.createElement("script",{dangerouslySetInnerHTML:{__html:`self.${a}=((e,v,t)=>{let l,w=t||document.querySelector(\`[data-br="\${e}"]\`),a=w.parentElement,f=e=>w.style.maxWidth=e+"px";w.style.maxWidth="";let o=a.clientWidth,d=a.clientHeight,i=o/2,r=o;if(!o)return;for(;i+1<r;)f(l=~~((i+r)/2)),a.clientHeight==d?r=l:i=l;f(r*v+o*(1-v))});self.${a}("${l}",${t})`}}))},g=S;0&&(module.exports={}); | ||
var h=Object.create;var d=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var R=(t,e)=>{for(var r in e)d(t,r,{get:e[r],enumerable:!0})},b=(t,e,r,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of I(e))!L.call(t,n)&&n!==r&&d(t,n,{get:()=>e[n],enumerable:!(c=v(e,n))||c.enumerable});return t};var g=(t,e,r)=>(r=t!=null?h(S(t)):{},b(e||!t||!t.__esModule?d(r,"default",{value:t,enumerable:!0}):r,t)),w=t=>b(d({},"__esModule",{value:!0}),t);var M={};R(M,{default:()=>A});module.exports=w(M);var i=g(require("react")),a="__wrap_balancer",E=typeof window=="undefined",m=E?i.default.useEffect:i.default.useLayoutEffect,y=(t,e,r)=>{let c,n=r||document.querySelector(`[data-br="${t}"]`),u=n.parentElement,o=_=>n.style.maxWidth=_+"px";n.style.maxWidth="";let s=u.clientWidth,l=u.clientHeight,p=s/2,f=s;if(s){for(;p+1<f;)o(c=~~((p+f)/2)),u.clientHeight==l?f=c:p=c;o(f*e+s*(1-e))}},x=y.toString();if(!E&&process.env.NODE_ENV!=="production"){let t=document.querySelector("[data-next-hide-fouc]");if(t){let e=c=>{for(let n of c)for(let u of n.removedNodes)if(u===t){r.disconnect();let o=document.querySelectorAll("[data-br]");for(let s of o)self[a](0,+s.dataset.brr,s)}},r=new MutationObserver(e);r.observe(document.head,{childList:!0})}}var O=({as:t="span",ratio:e=1,children:r,...c})=>{let n=t,u=i.default.useId(),o=i.default.useRef();return m(()=>{!o.current||(self[a]=y)(0,e,o.current)},[r,e]),m(()=>{if(!o.current)return;let s=o.current.parentElement;if(!s)return;let l=new ResizeObserver(()=>{!o.current||self[a](0,e,o.current)});return l.observe(s),()=>l.unobserve(s)},[]),i.default.createElement(i.default.Fragment,null,i.default.createElement(n,{...c,"data-br":u,"data-brr":e,ref:o,style:{display:"inline-block",verticalAlign:"top",textDecoration:"inherit"},suppressHydrationWarning:!0},r),i.default.createElement("script",{dangerouslySetInnerHTML:{__html:`self.${a}=${x};self.${a}("${u}",${e})`}}))},A=O;0&&(module.exports={}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "react-wrap-balancer", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Better text wrapping.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22087