najwer23morsels 0.16.4 → 0.16.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.
package/lib/Footer.js CHANGED
@@ -1 +1 @@
1
- import{jsxs as e,jsx as o}from"react/jsx-runtime";import{G as t}from"./Grid-XlOpwTNv.js";import{T as r}from"./TextBox-dHL75Jj9.js";import{g as i}from"./getCssVariableStyle-CBKDTT0s.js";import{s as a}from"./style-inject.es-BnTDb6vU.js";import"./Loader-D18j8aqL.js";import"react";var n={n23mFooter:"Footer-module_n23mFooter__R0RUZ",footerPush:"Footer-module_footerPush__xKhQr",footerContainer:"Footer-module_footerContainer__JkRev"};a("@layer n23mFooter{html{height:100%}body{min-height:100%;position:relative}.Footer-module_n23mFooter__R0RUZ{.Footer-module_footerPush__xKhQr{padding-bottom:100px}.Footer-module_footerContainer__JkRev{background-image:linear-gradient(180deg,#dcdada,#eee);bottom:0;height:100px;position:absolute;width:100%}}}");const l=({children:a,className:l,style:s,...d})=>e("footer",{className:[n.n23mFooter,"n23mFooter",l].filter(Boolean).join(" "),...d,style:{...i({"--footer":"test"}),...s},children:[o("div",{className:n.footerPush}),o("div",{className:n.footerContainer,children:e(t,{layout:"container",widthMax:"1600px",children:[o(t,{layout:"flex",widthMax:"1400px",padding:"20px 0 0",justifyContent:"center",children:o(r,{mobileSize:22,desktopSize:22,color:"black",tag:"p",children:"© Mariusz Najwer"})}),o(t,{layout:"flex",widthMax:"1400px",padding:"0",justifyContent:"center",children:e(r,{mobileSize:12,desktopSize:12,color:"black",tag:"p",children:["2019 - ",(new Date).getFullYear()]})})]})})]});l.displayName="Footer";export{l as Footer};
1
+ import{jsxs as e,jsx as o}from"react/jsx-runtime";import{G as t}from"./Grid-XlOpwTNv.js";import{T as r}from"./TextBox-dHL75Jj9.js";import{g as i}from"./getCssVariableStyle-CBKDTT0s.js";import{s as n}from"./style-inject.es-BnTDb6vU.js";import"./Loader-D18j8aqL.js";import"react";var a={n23mFooter:"Footer-module_n23mFooter__R0RUZ",n23mFooterPush:"Footer-module_n23mFooterPush__LbDeJ",n23mFooterContainer:"Footer-module_n23mFooterContainer__gMHjx"};n("@layer n23mFooter{html{height:100%}body{min-height:100%;position:relative}.Footer-module_n23mFooter__R0RUZ{.Footer-module_n23mFooterPush__LbDeJ{padding-bottom:100px}.Footer-module_n23mFooterContainer__gMHjx{background-image:linear-gradient(180deg,#dcdada,#eee);bottom:0;height:100px;position:absolute;width:100%}}}");const m=({children:n,className:m,style:l,...s})=>e("footer",{className:[a.n23mFooter,"n23mFooter",m].filter(Boolean).join(" "),...s,style:{...i({"--footer":"test"}),...l},children:[o("div",{className:a.n23mFooterPush}),o("div",{className:a.n23mFooterContainer,children:e(t,{layout:"container",widthMax:"1600px",children:[o(t,{layout:"flex",widthMax:"1400px",padding:"20px 0 0",justifyContent:"center",children:o(r,{mobileSize:22,desktopSize:22,color:"black",tag:"p",children:"© Mariusz Najwer"})}),o(t,{layout:"flex",widthMax:"1400px",padding:"0",justifyContent:"center",children:e(r,{mobileSize:12,desktopSize:12,color:"black",tag:"p",children:["2019 - ",(new Date).getFullYear()]})})]})})]});m.displayName="Footer";export{m as Footer};
package/lib/Hooks.js CHANGED
@@ -1 +1 @@
1
- export{a as useIsMounted,u as useResizeObserver}from"./useResizeObserver-Cey-xNGY.js";export{u as useWindowSize}from"./useWindowSize-CAQRbyxi.js";import"react";
1
+ export{u as useCachedImageCheck}from"./useCachedImageCheck-TeUbYfzH.js";export{a as useIsMounted,u as useResizeObserver}from"./useResizeObserver-Cey-xNGY.js";export{u as useWindowSize}from"./useWindowSize-CAQRbyxi.js";import"react";
package/lib/Picture.js CHANGED
@@ -1 +1 @@
1
- import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useState as i,useRef as o,useEffect as t}from"react";import{u as c}from"./useWindowSize-CAQRbyxi.js";import{T as a}from"./TextBox-dHL75Jj9.js";import{g as n}from"./getCssVariableStyle-CBKDTT0s.js";import{s as l}from"./style-inject.es-BnTDb6vU.js";var u={n23mPictureFigure:"Picture-module_n23mPictureFigure__uStTO",n23mPicture:"Picture-module_n23mPicture__LpndY",border:"Picture-module_border__yjTpQ",loaded:"Picture-module_loaded__fpjpQ",cacheLoaded:"Picture-module_cacheLoaded__IunbX"};l("@layer n23mPicture{.Picture-module_n23mPictureFigure__uStTO{margin:0;padding:0}.Picture-module_n23mPicture__LpndY{box-sizing:border-box;display:block;&.Picture-module_border__yjTpQ{border:2px solid var(--picture-bc);padding:5px}& img{display:grid;height:auto;max-height:var(--picture-mh,unset);opacity:0;width:100%}&.Picture-module_loaded__fpjpQ img{opacity:1;transition:opacity .25s ease-in-out}&.Picture-module_cacheLoaded__IunbX img{opacity:1}}}");const d=(e,r=25)=>{const[c,a]=i(null),n=o(null);return t(()=>{if(!e)return void a(null);const i=new Image;n.current=i;const o=new Promise((r,o)=>{i.onload=()=>r(i),i.onerror=()=>o(new Error("Image load error")),i.src=e});return((e,r,i=null)=>{let o;const t=new Promise((r,t)=>{o=setTimeout(()=>t(i),e)});return Promise.race([r,t]).finally(()=>{clearTimeout(o)})})(r,o,"Image not loaded from cache").then(()=>a(!0)).catch(()=>a(!1)).finally(()=>{n.current=null}),()=>{n.current&&(n.current.onload=null,n.current.onerror=null,n.current=null)}},[e,r]),c},m=({children:o,className:t,style:l,draggable:m=!1,alt:s,src:p,srcDesktop:g,srcMobile:_,ar:h,arMobile:b,arDesktop:P,border:f=!1,borderColor:x="black",loading:y="lazy",srcset:j,sizes:w,maxHeight:S,maxHeightMobile:T,maxHeightDesktop:z,figcaption:L,figcaptionColor:k,...I})=>{const[v,F]=i(!1),{width:Q}=c(),C=g&&Q>=768?g:_&&Q<768?_:p||"",D=d(C,25);return e("figure",{className:u.n23mPictureFigure,children:[e("picture",{className:["n23mPicture",u.n23mPicture,f&&u.border,v&&!D&&u.loaded,D&&u.cacheLoaded,t].filter(Boolean).join(" "),...I,style:{...n({"--picture-bc":x,"--picture-mh":z||T?T&&Q<767.98?T:z||T:S}),...l},children:[g&&r("source",{media:"(min-width: 768px)",srcSet:g}),_&&r("source",{media:"(max-width: 767.98px)",srcSet:_}),r("img",{sizes:w,srcSet:j,width:P||b?b&&Q<767.98?b:P||b:h,height:1,src:C,alt:s,loading:y,onLoad:()=>F(!0),draggable:m})]}),L&&r("figcaption",{children:r(a,{tag:"p",desktopSize:12,mobileSize:12,color:k,margin:"3px 0 3px 0",children:L})})]})};export{m as Picture};
1
+ import{jsxs as e,jsx as i}from"react/jsx-runtime";import{useState as r}from"react";import{u as t}from"./useCachedImageCheck-TeUbYfzH.js";import{u as o}from"./useWindowSize-CAQRbyxi.js";import{T as a}from"./TextBox-dHL75Jj9.js";import{g as c}from"./getCssVariableStyle-CBKDTT0s.js";import{s as d}from"./style-inject.es-BnTDb6vU.js";var m={n23mPictureFigure:"Picture-module_n23mPictureFigure__uStTO",n23mPicture:"Picture-module_n23mPicture__LpndY",border:"Picture-module_border__yjTpQ",loaded:"Picture-module_loaded__fpjpQ",cacheLoaded:"Picture-module_cacheLoaded__IunbX"};d("@layer n23mPicture{.Picture-module_n23mPictureFigure__uStTO{margin:0;padding:0}.Picture-module_n23mPicture__LpndY{box-sizing:border-box;display:block;&.Picture-module_border__yjTpQ{border:2px solid var(--picture-bc);padding:5px}& img{display:grid;height:auto;max-height:var(--picture-mh,unset);opacity:0;width:100%}&.Picture-module_loaded__fpjpQ img{opacity:1;transition:opacity .25s ease-in-out}&.Picture-module_cacheLoaded__IunbX img{opacity:1}}}");const s=({children:d,className:s,style:u,draggable:l=!1,alt:n,src:p,srcDesktop:g,srcMobile:_,ar:h,arMobile:b,arDesktop:P,border:x=!1,borderColor:f="black",loading:y="lazy",srcset:j,sizes:S,maxHeight:k,maxHeightMobile:z,maxHeightDesktop:L,figcaption:w,figcaptionColor:T,...C})=>{const[F,Q]=r(!1),{width:v}=o(),D=g&&v>=768?g:_&&v<768?_:p||"",H=t(D,25);return e("figure",{className:m.n23mPictureFigure,children:[e("picture",{className:["n23mPicture",m.n23mPicture,x&&m.border,F&&!H&&m.loaded,H&&m.cacheLoaded,s].filter(Boolean).join(" "),...C,style:{...c({"--picture-bc":f,"--picture-mh":L||z?z&&v<767.98?z:L||z:k}),...u},children:[g&&i("source",{media:"(min-width: 768px)",srcSet:g}),_&&i("source",{media:"(max-width: 767.98px)",srcSet:_}),i("img",{sizes:S,srcSet:j,width:P||b?b&&v<767.98?b:P||b:h,height:1,src:D,alt:n,loading:y,onLoad:()=>Q(!0),draggable:l})]}),w&&i("figcaption",{children:i(a,{tag:"p",desktopSize:12,mobileSize:12,color:T,margin:"3px 0 3px 0",children:w})})]})};export{s as Picture};
@@ -1,6 +1,5 @@
1
+ import { useCachedImageCheck } from './useCachedImageCheck';
1
2
  import { useIsMounted } from './useIsMounted';
2
3
  import { useResizeObserver } from './useResizeObserver';
3
4
  import { useWindowSize } from './useWindowSize';
4
- export { useWindowSize };
5
- export { useResizeObserver };
6
- export { useIsMounted };
5
+ export { useWindowSize, useCachedImageCheck, useResizeObserver, useIsMounted };
@@ -0,0 +1 @@
1
+ export declare const useCachedImageCheck: (src?: string, timeout?: number) => boolean | null;
@@ -0,0 +1 @@
1
+ import{useState as r,useRef as n,useCallback as e,useEffect as o}from"react";const l=(l,t=25)=>{const[u,c]=r(null),a=n(null),m=e((r,n,e=null)=>{let o;const l=new Promise((n,l)=>{o=setTimeout(()=>l(e),r)});return Promise.race([n,l]).finally(()=>{clearTimeout(o)})},[]);return o(()=>{if(!l)return void c(null);const r=new Image;a.current=r;const n=new Promise((n,e)=>{r.onload=()=>n(r),r.onerror=()=>e(new Error("Image load error")),r.src=l});return m(t,n,"Image not loaded from cache").then(()=>c(!0)).catch(()=>c(!1)).finally(()=>{a.current=null}),()=>{a.current&&(a.current.onload=null,a.current.onerror=null,a.current=null)}},[l,t,m]),u};export{l as u};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "najwer23morsels",
3
- "version": "0.16.4",
3
+ "version": "0.16.6",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./lib/index.mjs",
6
6
  "types": "./lib/index.d.ts",