najwer23morsels 1.2.2 → 1.2.4

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/Masonry.js CHANGED
@@ -1 +1 @@
1
- import{jsx as n}from"react/jsx-runtime";import{useRef as a,useEffect as m,Children as r,useState as o,useMemo as s}from"react";import{u as e}from"./useWindowSize-CAQRbyxi.js";import{s as t,g as l}from"./style-inject.es-CrVRO2OA.js";import{a as i}from"./useResizeObserver-BbBZwKT3.js";var y={n23mMasonry:"Masonry-module_n23mMasonry__PqEPk",n23mMasonryColumn:"Masonry-module_n23mMasonryColumn__Vq3lz",n23mMasonryColumnChild:"Masonry-module_n23mMasonryColumnChild__m9YtO"};t("@layer n23mMasonry{.Masonry-module_n23mMasonry__PqEPk{column-gap:var(--masonry-cg);display:flex;&>*{height:fit-content}}.Masonry-module_n23mMasonryColumn__Vq3lz{width:calc(100%/var(--mc) - ((var(--mc) - 1)/var(--mc))*var(--masonry-cg))}.Masonry-module_n23mMasonryColumnChild__m9YtO{margin-bottom:var(--masonry-rg)}@media (max-width:767.98px){.Masonry-module_n23mMasonryColumn__Vq3lz{--mc:var(--masonry-cm)}}@media (min-width:768px) and (max-width:1199.98px){.Masonry-module_n23mMasonryColumn__Vq3lz{--mc:var(--masonry-ct)}}@media (min-width:1200px) and (max-width:1599.98px){.Masonry-module_n23mMasonryColumn__Vq3lz{--mc:var(--masonry-csd)}}@media (min-width:1600px){.Masonry-module_n23mMasonryColumn__Vq3lz{--mc:var(--masonry-cd)}}}");const d=({arrWithChildren:o,onHeightChange:s,id:e})=>{const t=a(null),{height:l=0}=i({ref:t});return m(()=>{s(l)},[l]),n("div",{ref:t,className:y.n23mMasonryColumn,children:r.map(o,(a,m)=>n("div",{className:y.n23mMasonryColumnChild,children:a},e+m))},e)};d.displayName="MasonryColumn";const c=({children:r,gap:t,col:i,onGridMasonryLoadEnd:c,delay:h=10,className:u,style:M,..._})=>{const[p,g]=o(0),{width:C}=e(),v=a(!0),f=n=>n<767.98?i.mobile:n>=768.98&&n<1199.98?i.tablet:n>=1199.98&&n<1599.98?i.smallDesktop:n>=1599.98?i.desktop:3,[x,w]=o(()=>f(C)),q=n=>Array.from({length:n}).map((n,a)=>({name:`col${a}`,arrWithElm:[],height:0})),[z,j]=o(()=>q(x));m(()=>{const n=setTimeout(()=>{const n=f(C);n!==x&&(g(0),w(n),j(q(n)))},100);return()=>clearTimeout(n)},[C]);const E=s(()=>z.map(({height:n})=>n).join(","),[z]);return m(()=>{const n=v.current?0:h,a=setTimeout(()=>{if(p<r.length){const n=(n=>[...n].sort((n,a)=>n.height-a.height)[0].name)(z);j(z.map(a=>a.name===n?{...a,arrWithElm:[...a.arrWithElm,r[p]]}:a)),g(n=>n+1),p===r.length-1&&c&&c(!0)}},n);return()=>clearTimeout(a)},[E]),m(()=>{v.current=!1},[]),n("div",{className:[y.n23mMasonry,"n23mMasonry",u].filter(Boolean).join(" "),..._,style:{...l({"--masonry-cm":i.mobile,"--masonry-ct":i.tablet,"--masonry-csd":i.smallDesktop,"--masonry-cd":i.desktop,"--masonry-cg":t.col,"--masonry-rg":t.row}),...M},children:z.map(({arrWithElm:a,name:m})=>n(d,{arrWithChildren:a,onHeightChange:n=>((n,a)=>{j(z.map(m=>m.name===a?{...m,height:n}:m))})(n,m),id:m},"masonry-parent"+m))})};c.displayName="Masonry";export{c as Masonry};
1
+ import{jsx as n}from"react/jsx-runtime";import{useRef as a,useEffect as m,Children as r,useState as o,useMemo as s}from"react";import{u as e}from"./useWindowSize-CAQRbyxi.js";import{s as t,g as l}from"./style-inject.es-CrVRO2OA.js";import{a as i}from"./useResizeObserver-BbBZwKT3.js";var y={n23mMasonry:"Masonry-module_n23mMasonry__PqEPk",n23mMasonryColumn:"Masonry-module_n23mMasonryColumn__Vq3lz",n23mMasonryColumnChild:"Masonry-module_n23mMasonryColumnChild__m9YtO"};t("@layer n23mMasonry{.Masonry-module_n23mMasonry__PqEPk{column-gap:var(--masonry-cg);display:flex;&>*{height:fit-content}}.Masonry-module_n23mMasonryColumn__Vq3lz{width:calc(100%/var(--mc) - ((var(--mc) - 1)/var(--mc))*var(--masonry-cg))}.Masonry-module_n23mMasonryColumnChild__m9YtO{margin-bottom:var(--masonry-rg)}@media (max-width:767.98px){.Masonry-module_n23mMasonryColumn__Vq3lz{--mc:var(--masonry-cm)}}@media (min-width:768px) and (max-width:1199.98px){.Masonry-module_n23mMasonryColumn__Vq3lz{--mc:var(--masonry-ct)}}@media (min-width:1200px) and (max-width:1599.98px){.Masonry-module_n23mMasonryColumn__Vq3lz{--mc:var(--masonry-csd)}}@media (min-width:1600px){.Masonry-module_n23mMasonryColumn__Vq3lz{--mc:var(--masonry-cd)}}}");const d=({arrWithChildren:o,onHeightChange:s,id:e})=>{const t=a(null),{height:l=0}=i({ref:t});return m(()=>{s(l)},[l]),n("div",{ref:t,className:y.n23mMasonryColumn,children:r.map(o,(a,m)=>n("div",{className:y.n23mMasonryColumnChild,children:a},e+m))},e)};d.displayName="MasonryColumn";const c=({children:r,gap:t,col:i,onGridMasonryLoadEnd:c,delay:h=10,className:u,style:M,..._})=>{const[p,g]=o(0),{width:C}=e(),v=a(!0),f=n=>n<767.98?i.mobile:n>=768.98&&n<1199.98?i.tablet:n>=1199.98&&n<1599.98?i.smallDesktop:n>=1599.98?i.desktop:3,[x,w]=o(()=>f(C)),q=n=>Array.from({length:n}).map((n,a)=>({name:`col${a}`,arrWithElm:[],height:0})),[z,b]=o(()=>q(x));m(()=>{const n=setTimeout(()=>{const n=f(C);n!==x&&(g(0),w(n),b(q(n)))},100);return()=>clearTimeout(n)},[C]);const j=s(()=>z.map(({height:n})=>n).join(","),[z]);return m(()=>{const n=v.current?0:h,a=setTimeout(()=>{if(p<r.length){const n=(n=>[...n].sort((n,a)=>n.height-a.height)[0].name)(z);b(z.map(a=>a.name===n?{...a,arrWithElm:[...a.arrWithElm,r[p]]}:a)),g(n=>n+1),p===r.length-1&&c&&c(!0)}},n);return()=>clearTimeout(a)},[j]),m(()=>{v.current=!1},[]),n("div",{className:[y.n23mMasonry,"n23mMasonry",u].filter(Boolean).join(" "),..._,style:{...l({"--masonry-cm":i.mobile,"--masonry-ct":i.tablet,"--masonry-csd":i.smallDesktop,"--masonry-cd":i.desktop,"--masonry-cg":t.col,"--masonry-rg":t.row}),...M},children:z.map(({arrWithElm:a,name:m})=>n(d,{arrWithChildren:a,onHeightChange:n=>((n,a)=>{b(z.map(m=>m.name===a?{...m,height:n}:m))})(n,m),id:m},"masonry-parent"+m))})};c.displayName="Masonry";export{c as Masonry};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "najwer23morsels",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./lib/index.mjs",
6
6
  "types": "./lib/index.d.ts",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes