lm-web-controls 1.4.4 → 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{__assign as t}from"../../_virtual/_tslib.js";import e,{useState as o,useRef as i,useEffect as n}from"react";function r(r){var l=r.src,a=r.alt,c=r.className,s=void 0===c?"":c,d=r.sizes,f=r.priority,u=void 0!==f&&f,p=r.quality,m=void 0===p?75:p,v=r.placeholder,b=void 0===v?"empty":v,h=r.blurDataURL,g=r.onLoad,y=r.onError,x=r.fill,w=void 0!==x&&x,j=r.style,E=o(!1),z=E[0],k=E[1],C=o(!1),F=C[0],I=C[1],S=o(u),L=S[0],q=S[1],N=i(null),P=i(null);n(function(){if(!u&&!L){var t=new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting&&(q(!0),t.disconnect())})},{rootMargin:"50px 0px",threshold:.1});return P.current&&t.observe(P.current),function(){return t.disconnect()}}},[u,L]);var _={ref:N,alt:a,onLoad:function(){k(!0),null==g||g()},onError:function(){I(!0),null==y||y()},loading:u?"eager":"lazy",sizes:d,style:t({objectFit:"cover",objectPosition:"center"},j)},D=t({position:w?"absolute":"relative",display:"block",overflow:"hidden"},w?{top:0,left:0,bottom:0,right:0}:{}),M=t({position:w?"absolute":"static",top:w?0:void 0,left:w?0:void 0,bottom:w?0:void 0,right:w?0:void 0,boxSizing:"border-box",padding:0,border:"none",margin:"auto",display:"block",width:"100%",height:w?"100%":"auto",maxWidth:"100%",objectFit:"cover",objectPosition:"center",transition:"opacity 0.3s ease",opacity:z?1:0},_.style);return e.createElement("div",{ref:P,className:s,style:D},!z&&!F&&e.createElement("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"#f3f4f6",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",color:"#9ca3af"}},"blur"===b&&h?e.createElement("img",{src:h,alt:"",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",filter:"blur(10px)",transform:"scale(1.1)"}}):null),F&&e.createElement("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"#fef2f2",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",color:"#dc2626"}},"Failed to load image"),L&&e.createElement("img",t({},_,{src:l,srcSet:d?function(){if(d){return[640,750,828,1080,1200,1920,2048].map(function(t){var e=l.includes("?")?"&":"?";return"".concat(l).concat(e,"w=").concat(t,"&q=").concat(m," ").concat(t,"w")}).join(", ")}}():void 0,style:M})))}var l=function(t){if("undefined"!=typeof window){var e=document.createElement("link");e.rel="preload",e.as="image",e.href=t,document.head.appendChild(e)}};export{r as OptimizedImage,l as preloadImage};
2
+ import{__assign as t}from"../../_virtual/_tslib.js";import e,{useState as i,useRef as o,useEffect as n}from"react";function r(r){var l=r.src,a=r.alt,c=r.className,s=void 0===c?"":c,d=r.width,f=r.height,u=r.sizes,h=r.priority,p=void 0!==h&&h;r.quality;var m=r.placeholder,b=void 0===m?"empty":m,v=r.blurDataURL,g=r.onLoad,y=r.onError,x=r.fill,w=void 0!==x&&x,j=r.style,E=i(!1),z=E[0],k=E[1],C=i(!1),F=C[0],I=C[1],S=i(p),L=S[0],H=S[1],N=o(null),P=o(null);n(function(){if(!p){var t=new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting&&(H(!0),t.disconnect())})},{rootMargin:"50px 0px",threshold:.01});return P.current&&t.observe(P.current),function(){return t.disconnect()}}H(!0)},[p]);var W={ref:N,src:l,alt:a,onLoad:function(){k(!0),null==g||g()},onError:function(){I(!0),null==y||y()},loading:p?"eager":"lazy",sizes:u,srcSet:u?function(){if(u){return[640,750,828,1080,1200,1920,2048].map(function(t){return"".concat(l," ").concat(t,"w")}).join(", ")}}():void 0,style:t({objectFit:"cover",objectPosition:"center"},j)},_=t(t({position:w?"absolute":"relative",display:"block",overflow:"hidden"},w?{top:0,left:0,bottom:0,right:0}:{}),d&&f&&!w?{width:d,height:f}:{}),q=t({position:w?"absolute":"static",top:w?0:void 0,left:w?0:void 0,bottom:w?0:void 0,right:w?0:void 0,boxSizing:"border-box",padding:0,border:"none",margin:"auto",display:"block",width:w?"100%":d||"100%",height:w?"100%":f||"auto",minWidth:"100%",maxWidth:"100%",minHeight:"100%",maxHeight:"100%",objectFit:"cover",objectPosition:"center",transition:"opacity 0.3s ease",opacity:z?1:0},W.style);return e.createElement("div",{ref:P,className:s,style:_},!z&&!F&&e.createElement("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"#f3f4f6",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",color:"#9ca3af"}},"blur"===b&&v?e.createElement("img",{src:v,alt:"",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",filter:"blur(10px)",transform:"scale(1.1)"}}):null),F&&e.createElement("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"#fef2f2",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",color:"#dc2626"}},"Failed to load image"),e.createElement("img",t({},W,{style:t(t({},q),{visibility:L?"visible":"hidden"})})))}var l=function(t){if("undefined"!=typeof window){var e=document.createElement("link");e.rel="preload",e.as="image",e.href=t,document.head.appendChild(e)}};export{r as OptimizedImage,l as preloadImage};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lm-web-controls",
3
- "version": "1.4.4",
3
+ "version": "1.4.6",
4
4
  "description": "leadmetrics-lm-web-controls",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",