Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@finsweet/attributes-cmsload

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@finsweet/attributes-cmsload - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2-beta.0

changesets.json

2

cmsload.js

@@ -1,1 +0,1 @@

(()=>{var he=Object.create;var _=Object.defineProperty,Pe=Object.defineProperties,Me=Object.getOwnPropertyDescriptor,ke=Object.getOwnPropertyDescriptors,Be=Object.getOwnPropertyNames,G=Object.getOwnPropertySymbols,De=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable;var z=(e,t,n)=>t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t)=>{for(var n in t||(t={}))X.call(t,n)&&z(e,n,t[n]);if(G)for(var n of G(t))_e.call(t,n)&&z(e,n,t[n]);return e},W=(e,t)=>Pe(e,ke(t)),$e=e=>_(e,"__esModule",{value:!0});var Ne=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ie=(e,t,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Be(t))!X.call(e,o)&&o!=="default"&&_(e,o,{get:()=>t[o],enumerable:!(n=Me(t,o))||n.enumerable});return e},Re=e=>Ie($e(_(e!=null?he(De(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var f=(e,t,n)=>new Promise((o,r)=>{var i=a=>{try{l(n.next(a))}catch(m){r(m)}},s=a=>{try{l(n.throw(a))}catch(m){r(m)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,s);l((n=n.apply(e,t)).next())});var ye=Ne((Tn,Se)=>{Se.exports=Ze;function Ze(e,t,n,o){var r,i,s;return function(){if(s=this,i=Array.prototype.slice.call(arguments),r&&(n||o))return;if(!n)return m(),r=setTimeout(a,t),r;r=setTimeout(m,t),e.apply(s,i);function a(){m(),e.apply(s,i)}function m(){clearTimeout(r),r=null}}}});var C=class{static activateAlerts(){this.alertsActivated=!0}static alert(t,n){if(this.alertsActivated&&window.alert(t),n==="error")throw new Error(t)}};C.alertsActivated=!1;var $="w--current";var v={wrapper:"w-dyn-list",list:"w-dyn-items",item:"w-dyn-item",paginationWrapper:"w-pagination-wrapper",paginationNext:"w-pagination-next",paginationPrevious:"w-pagination-previous",pageCount:"w-page-count",emptyState:"w-dyn-empty"};var J={addToCartForm:"w-commerce-commerceaddtocartform"},Y={trigger:"w-lightbox"};var N=(e,t=!0)=>e.cloneNode(t);var w=(e,t)=>!!e&&t.includes(e);function I(e,t,n,o=!0){let r=n?[n]:[];if(!e)return r;let i=e.split(",").reduce((s,l)=>{let a=l.trim();return(!o||a)&&s.push(a),s},[]);if(t){let s=i.filter(l=>w(l,t));return s.length?s:r}return i}var O=e=>Object.keys(e);var K=e=>e!=null;var Q=new Map([["tiny","(max-width: 479px)"],["small","(max-width: 767px)"],["medium","(max-width: 991px)"],["main","(min-width: 992px)"]]);var{wrapper:We,list:Oe,paginationWrapper:Ke,paginationNext:Fe,paginationPrevious:Ve,emptyState:Ue,pageCount:He}=v;function L(e,t,n=document){let o=typeof e=="string"?n.querySelector(e):e;if(!o)return;let r=o.closest(`.${We}`);if(!r)return;let i=r.querySelector(`.${Oe}`);return t==="wrapper"?r:t==="list"?i:t==="items"?[...(i==null?void 0:i.children)||[]]:t==="empty"?r.querySelector(`.${Ue}`):t==="pageCount"?r.querySelector(`.${He}`):t==="pagination"?r.querySelector(`.${Ke}`):r.querySelector(`.${t==="next"?Fe:Ve}`)}var F=(e,t=document)=>{e=e.filter(i=>i);let n=e.join(", ")||`.${v.wrapper}`;return[...t.querySelectorAll(n)].reduce((i,s)=>{if(!s)return i;let l=L(s,"wrapper");return!l||i.includes(l)||i.push(l),i},[])};var V=()=>{for(let[e,t]of Q)if(window.matchMedia(t).matches)return e;return"main"};var Z="fs-attributes",ee={preventLoad:{key:`${Z}-preventload`},debugMode:{key:`${Z}-debug`}};var te=()=>{window.fsAttributes||(window.fsAttributes={cms:{}})},ne=e=>{let{preventLoad:t,debugMode:n}=ee,o=typeof(e==null?void 0:e.getAttribute(t.key))=="string";return typeof(e==null?void 0:e.getAttribute(n.key))=="string"&&C.activateAlerts(),{preventsLoad:o}},P=e=>t=>`${e}${t?`-${t}`:""}`,oe=e=>(n,o,r)=>{let i=e[n],{key:s,values:l}=i,a;if(!o)return`[${s}]`;let m=l==null?void 0:l[o];if(typeof m=="string"?a=m:a=m(r&&"instanceIndex"in r?r.instanceIndex:void 0),!(r==null?void 0:r.operator))return`[${s}="${a}"]`;switch(r.operator){case"prefixed":return`[${s}^="${a}"]`;case"suffixed":return`[${s}$="${a}"]`;case"contains":return`[${s}*="${a}"]`}};var qe="https://cdn.jsdelivr.net/npm/@finsweet/attributes-animation@1/functions.js",je="https://cdn.jsdelivr.net/npm/@finsweet/attributes-cmscore@1/cmscore.js",M=()=>f(void 0,null,function*(){let{fsAttributes:e}=window;if(e.animationImport)return e.animationImport;try{let t=import(qe);return e.animationImport=t,t}catch(t){C.alert(`${t}`,"error");return}}),R=()=>f(void 0,null,function*(){let{fsAttributes:e}=window;e.cms||(e.cms={});let{cms:t}=e;if(t.coreImport)return t.coreImport;try{let n=import(je);return t.coreImport=n,n.then(o=>{o&&(t.coreVersion||(t.coreVersion=o.version))}),n}catch(n){C.alert(`${n}`,"error");return}});var x="fs-cmsload",k={element:{key:`${x}-element`,values:{list:P("list"),loader:P("loader"),itemsCount:P("items-count"),scrollAnchor:P("scroll-anchor"),pageButton:"page-button",pageDots:"page-dots"}},loading:{key:`${x}-loading`},mode:{key:`${x}-mode`,values:{renderAll:"render-all",pagination:"pagination",infinite:"infinite"}},threshold:{key:`${x}-threshold`},pageSiblings:{key:`${x}-pagesiblings`},pageBoundary:{key:`${x}-pageboundary`},animation:{key:`${x}-animation`},easing:{key:`${x}-easing`},duration:{key:`${x}-duration`},stagger:{key:`${x}-stagger`},resetIx:{key:`${x}-resetix`,values:{true:"true"}}},y=oe(k),re="-20",ie=1,ae=1,se={main:0,medium:1,small:2,tiny:3};var le=.1;var me=(o,r)=>f(void 0,[o,r],function*(e,{durationKey:t,easingKey:n}){let i=yield M();if(!i)return;let{animations:{fade:s},easings:l}=i,{listAnimation:a}=e,m=e.getAttribute(t),p=e.getAttribute(n);if(a&&!m&&!p)return;let u=w(p,l)?p:void 0,d=m?parseFloat(m)/2e3:le;if(!a){e.listAnimation=W(b({},s),{options:{easing:u,duration:d}});return}let{options:g}=a;if(!g){a.options={easing:u,duration:d};return}g.easing||(g.easing=u),m&&(g.duration=d)}),ue=(i,s)=>f(void 0,[i,s],function*(e,{animationKey:t,durationKey:n,easingKey:o,staggerKey:r}){let l=yield M();if(!l)return;let{animations:a,easings:m}=l,p=e.getAttribute(t),u=w(p,O(a))?a[p]:a.fade,d=e.getAttribute(n),g=e.getAttribute(o),c=e.getAttribute(r);e.itemsAnimation=W(b({},u),{options:{easing:w(g,m)?g:void 0,duration:d?parseFloat(d)/1e3:void 0,stagger:c?parseFloat(c):void 0}})});var Ge=new DOMParser,B=(e,t)=>f(void 0,null,function*(){let n=[],{index:o,paginationNext:r}=e;if(!r||typeof o!="number")return;let i=l=>f(void 0,[l],function*({href:s}){var m;let a;try{let u=yield(yield fetch(s)).text(),d=Ge.parseFromString(u,"text/html"),g=F([],d)[o];if(!g)return;if(!e.paginationPrevious){let E=L(g,"previous");E&&e.addPaginationPrevious(E)}let c=L(g,"items");if(yield e.addItems(c),a=(m=L(g,"next"))==null?void 0:m.href,a&&!n.includes(a)&&t==="all"){n.push(a),yield i({href:a});return}yield e.emit("finishload")}catch(p){return}return a});return n.push(r.href),yield i(r)}),D=s=>f(void 0,[s],function*({e,paginationNext:t,listInstance:n,paginationNextTextNode:o,originalNextText:r,loadingText:i}){if(e==null||e.preventDefault(),!document.body.contains(t))return;yield n.displayElement("loader"),o&&i&&(o.textContent=i);let l=yield B(n,"next");return o&&r&&(o.textContent=r||""),l?t.href=l:t.remove(),yield n.displayElement("loader",!1),l});var{loading:{key:Xe},pageSiblings:{key:ze},pageBoundary:{key:Je},threshold:{key:Ye}}=k,T=e=>{let{paginationNext:t,paginationPrevious:n}=e;if(!t)return;n==null||n.remove();let o=t.querySelector(y("loading")),r=o==null?void 0:o.textContent,i=o==null?void 0:o.getAttribute(Xe);return{listInstance:e,paginationNext:t,paginationNextTextNode:o,originalNextText:r,loadingText:i}},ce=e=>{let{paginationWrapper:t,paginationCount:n}=e;if(!t)return;let o=t.querySelector(y("element","pageButton",{operator:"prefixed"})),r=t.querySelector(y("element","pageDots",{operator:"prefixed"}));r?r.remove():(r=document.createElement("div"),r.textContent="...");let i=e.getAttribute(Je),s=e.getAttribute(ze),l=(i?I(i):[]).map(d=>parseInt(d)),a=(s?I(s):[]).map(d=>parseInt(d)),[m,p]=U(l,a),u=[l,a].some(({length:d})=>d>1);return{listInstance:e,paginationWrapper:t,pageButtonTemplate:o,pageDotsTemplate:r,paginationCount:n,pageBoundary:m,pageBoundaryValues:l,pageSiblings:p,pageSiblingsValues:a,hasBreakpoints:u}},U=(e,t)=>{let n=V(),o=se[n],r=[];[e,t].forEach((l,a)=>{for(let m=o;m>=0;m--){let p=l[m];if(typeof p=="number"){r[a]=p;break}}});let[i,s]=r;return i!=null||(i=ae),s!=null||(s=ie),[i,s]},pe=e=>({threshold:parseInt(e.getAttribute(Ye)||re)});var de=e=>f(void 0,null,function*(){let t=T(e);if(!t)return;let{paginationNext:n,paginationNextTextNode:o,loadingText:r}=t,i=s=>(s.preventDefault(),!1);n.addEventListener("click",i),yield e.displayElement("loader"),o&&r&&(o.textContent=r),yield B(e,"all"),n.removeEventListener("click",i),n.remove(),yield e.displayElement("loader",!1)});var fe=Qe;function Qe(e,t,n){var o=null,r=null,i=n&&n.leading,s=n&&n.trailing;i==null&&(i=!0),s==null&&(s=!i),i==!0&&(s=!1);var l=function(){o&&(clearTimeout(o),o=null)},a=function(){var p=r;l(),p&&p()},m=function(){var p=i&&!o,u=this,d=arguments;if(r=function(){return e.apply(u,d)},o||(o=setTimeout(function(){if(o=null,s)return r()},t)),p)return p=!1,r()};return m.cancel=l,m.flush=a,m}var ge=e=>{let t=T(e);if(!t)return;let{threshold:n}=pe(e),o=1-n/100,r=!1,{paginationNext:i}=t,{list:s}=e;i.addEventListener("click",m=>f(void 0,null,function*(){m.preventDefault(),!r&&(r=!0,yield D(b({e:m},t)),r=!1)}));let l=new IntersectionObserver(m=>{for(let{isIntersecting:p}of m)window[p?"addEventListener":"removeEventListener"]("scroll",a)});l.observe(s);let a=fe(()=>f(void 0,null,function*(){if(r)return;let{innerHeight:m}=window,{bottom:p}=s.getBoundingClientRect(),u=o*m;p>0&&p<=u&&(r=!0,(yield D(t))||(window.removeEventListener("scroll",a),l.disconnect()),r=!1)}),100)};var xe=Re(ye());var{paginationNext:et,paginationPrevious:tt}=v,Ee=e=>f(void 0,null,function*(){let t=ce(e);if(!t)return;let{paginationWrapper:n,pageButtonTemplate:o,pageDotsTemplate:r,paginationCount:i,pageBoundary:s,pageBoundaryValues:l,pageSiblings:a,pageSiblingsValues:m,hasBreakpoints:p}=t,u;if(o){let{parentElement:d}=o;d&&(u={parentElement:d,pageButtonTemplate:o,pageDotsTemplate:r,pageBoundary:s,pageSiblings:a,renderedElements:new Map([[o,1]])})}yield e.switchPage(1,!1),Ce(e,u,i,!1),e.on("renderitems",()=>Ce(e,u,i)),n.addEventListener("click",d=>at(d,u,e)),u&&p&&window.addEventListener("resize",(0,xe.default)(()=>{st(u,e,l,m)},100)),yield e.displayElement("loader"),yield B(e,"all"),yield e.displayElement("loader",!1)}),Ce=(e,t,n,o=!0)=>{t&&be(t,e),n&&it(n,e),o&&rt(e)},be=(e,t)=>{let{currentPage:n,totalPages:o}=t;if(!n)return;let{parentElement:r,renderedElements:i,pageBoundary:s,pageSiblings:l}=e,a=[...i],m=l*2+1,u=s*2+m+2,d=n-1<u-m,g=o-n<u-m;for(let c=1;c<=u;c++){let[E,Te]=a[c-1]||[],[q]=a[c-2]||[];if(c>o){E&&(E.remove(),a[c-1]=void 0);continue}let S;o<=u?S=c:d?c>u-s?S=o-(u-c):c===u-s?S=null:S=c:g?c<s+1?S=c:c===s+1?S=null:S=o-(u-c):c<s+1?S=c:c>u-s?S=o-(u-c):c===s+1||c===u-s?S=null:S=n+(c-(s+1)-(1+l));let A;Te!==S&&(E==null||E.remove(),A=nt(e,S),a[c-1]=[A,S],q?r.insertBefore(A,q.nextSibling):r.appendChild(A),A.style.opacity="");let j=A||E;!j||ot(j,S===n)}e.renderedElements=new Map([...a.filter(K)])},nt=({pageButtonTemplate:e,pageDotsTemplate:t},n)=>{let o;return n?(o=N(e),o.classList.remove($),o.textContent=`${n}`):o=N(t),o},ot=(e,t)=>{t?(e.classList.add($),e.setAttribute("aria-current","page")):(e.classList.remove($),e.removeAttribute("aria-current"))},rt=e=>{let{currentPage:t,totalPages:n}=e;e.displayElement("paginationPrevious",t!==1,!1),e.displayElement("paginationNext",t!==n,!1)},it=(e,{currentPage:t,totalPages:n})=>{e.setAttribute("aria-label",`Page ${t} of ${n}`),e.textContent=`${t} / ${n}`},at=(e,t,n)=>{let{target:o}=e;if(!(o instanceof Element))return;let r=o.closest(y("element","pageButton",{operator:"prefixed"})),i=o.closest(`.${et}`),s=o.closest(`.${tt}`);if(!r&&!i&&!s)return;e.preventDefault();let{currentPage:l,totalPages:a}=n;if(!l)return;let m;i&&(m=l+1),s&&(m=l-1),r&&(m=t==null?void 0:t.renderedElements.get(r)),!!m&&m>=1&&m<=a&&n.switchPage(m)},st=(e,t,...n)=>{let{pageBoundary:o,pageSiblings:r,renderedElements:i}=e,[s,l]=U(...n);if(!(o===s&&r===l)){e.pageBoundary=s,e.pageSiblings=l;for(let[a]of i)a.remove();i.clear(),be(e,t)}};var we=e=>{let t=T(e);if(!t)return;let n=!1,{paginationNext:o}=t,r=i=>f(void 0,null,function*(){if(i.preventDefault(),n)return;n=!0,(yield D(b({e:i},t)))||o.removeEventListener("click",r),n=!1});o.addEventListener("click",r)};var{element:{key:lt},mode:{key:mt,values:{renderAll:ut,infinite:ct,pagination:pt}},animation:{key:dt},duration:{key:Le},easing:{key:Ae},stagger:{key:ft},resetIx:{key:gt,values:St}}=k,{Webflow:h}=window,ve=e=>f(void 0,null,function*(){let t=e.getInstanceIndex(lt),{items:n}=e;ue(e,{animationKey:dt,durationKey:Le,easingKey:Ae,staggerKey:ft}),me(e,{durationKey:Le,easingKey:Ae});let o=!!h&&"require"in h&&!!h.require("commerce")&&n.some(({element:a})=>a.querySelector(`.${J.addToCartForm}`));o&&(e.restartCommerce=o);let r=!!h&&"require"in h&&!!h.require("lightbox")&&n.some(({element:a})=>a.querySelector(`.${Y.trigger}`));r&&(e.restartLightbox=r);let i=e.getAttribute(gt)===St.true;i&&(e.restartIx=i);let s=document.querySelector(y("element","loader",{instanceIndex:t}));if(s&&e.addLoader(s),!e.itemsCount){let a=document.querySelector(y("element","itemsCount",{instanceIndex:t}));a&&e.addItemsCount(a)}if(!e.scrollAnchor){let a=document.querySelector(y("element","scrollAnchor",{instanceIndex:t}));a&&(e.scrollAnchor=a)}let l=e.getAttribute(mt);return l===ut?yield de(e):l===ct?ge(e):l===pt?yield Ee(e):we(e),e});var H=()=>f(void 0,null,function*(){let e=yield R();if(!e)return[];let t=e.createCMSListInstances([y("element","list",{operator:"prefixed"})]);return yield Promise.all(t.map(ve)),t});te();var{currentScript:yt}=document,{preventsLoad:xt}=ne(yt);R();M();xt?window.fsAttributes.cmsload={init:H}:(window.Webflow||(window.Webflow=[]),window.Webflow.push(H));})();
(()=>{var Pe=Object.create;var k=Object.defineProperty,he=Object.defineProperties,Me=Object.getOwnPropertyDescriptor,Ne=Object.getOwnPropertyDescriptors,Be=Object.getOwnPropertyNames,j=Object.getOwnPropertySymbols,ke=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty,Ie=Object.prototype.propertyIsEnumerable;var z=(e,t,n)=>t in e?k(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t)=>{for(var n in t||(t={}))X.call(t,n)&&z(e,n,t[n]);if(j)for(var n of j(t))Ie.call(t,n)&&z(e,n,t[n]);return e},R=(e,t)=>he(e,Ne(t)),De=e=>k(e,"__esModule",{value:!0});var $e=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ke=(e,t,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Be(t))!X.call(e,o)&&o!=="default"&&k(e,o,{get:()=>t[o],enumerable:!(n=Me(t,o))||n.enumerable});return e},Re=e=>Ke(De(k(e!=null?Pe(ke(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var f=(e,t,n)=>new Promise((o,r)=>{var i=s=>{try{l(n.next(s))}catch(m){r(m)}},a=s=>{try{l(n.throw(s))}catch(m){r(m)}},l=s=>s.done?o(s.value):Promise.resolve(s.value).then(i,a);l((n=n.apply(e,t)).next())});var ye=$e((Hn,Ee)=>{Ee.exports=yt;function yt(e,t,n,o){var r,i,a;return function(){if(a=this,i=Array.prototype.slice.call(arguments),r&&(n||o))return;if(!n)return m(),r=setTimeout(s,t),r;r=setTimeout(m,t),e.apply(a,i);function s(){m(),e.apply(a,i)}function m(){clearTimeout(r),r=null}}}});var C=class{static activateAlerts(){this.alertsActivated=!0}static alert(t,n){if(this.alertsActivated&&window.alert(t),n==="error")throw new Error(t)}};C.alertsActivated=!1;var I="w--current";var A={wrapper:"w-dyn-list",list:"w-dyn-items",item:"w-dyn-item",paginationWrapper:"w-pagination-wrapper",paginationNext:"w-pagination-next",paginationPrevious:"w-pagination-previous",pageCount:"w-page-count",emptyState:"w-dyn-empty"};var J={addToCartForm:"w-commerce-commerceaddtocartform"},Q={trigger:"w-lightbox"};var D=(e,t=!0)=>e.cloneNode(t);var T=(e,t)=>!!e&&t.includes(e);function $(e,t,n,o=!0){let r=n?[n]:[];if(!e)return r;let i=e.split(",").reduce((a,l)=>{let s=l.trim();return(!o||s)&&a.push(s),a},[]);if(t){let a=i.filter(l=>T(l,t));return a.length?a:r}return i}var O=e=>Object.keys(e);var W=e=>e!=null;var Z=new Map([["tiny","(max-width: 479px)"],["small","(max-width: 767px)"],["medium","(max-width: 991px)"],["main","(min-width: 992px)"]]);var{wrapper:Oe,list:We,paginationWrapper:Ve,paginationNext:Fe,paginationPrevious:Ue,emptyState:Ge,pageCount:He}=A;function L(e,t,n=document){let o=typeof e=="string"?n.querySelector(e):e;if(!o)return;let r=o.closest(`.${Oe}`);if(!r)return;let i=r.querySelector(`.${We}`);return t==="wrapper"?r:t==="list"?i:t==="items"?[...(i==null?void 0:i.children)||[]]:t==="empty"?r.querySelector(`.${Ge}`):t==="pageCount"?r.querySelector(`.${He}`):t==="pagination"?r.querySelector(`.${Ve}`):r.querySelector(`.${t==="next"?Fe:Ue}`)}var V=(e,t=document)=>{e=e.filter(i=>i);let n=e.join(", ")||`.${A.wrapper}`;return[...t.querySelectorAll(n)].reduce((i,a)=>{if(!a)return i;let l=L(a,"wrapper");return!l||i.includes(l)||i.push(l),i},[])};var F=()=>{for(let[e,t]of Z)if(window.matchMedia(t).matches)return e;return"main"};var ee="fs-attributes",te={preventLoad:{key:`${ee}-preventload`},debugMode:{key:`${ee}-debug`}};var ne=()=>{window.fsAttributes||(window.fsAttributes={cms:{}})},oe=e=>{let{preventLoad:t,debugMode:n}=te,o=typeof(e==null?void 0:e.getAttribute(t.key))=="string";return typeof(e==null?void 0:e.getAttribute(n.key))=="string"&&C.activateAlerts(),{preventsLoad:o}},P=e=>t=>`${e}${t?`-${t}`:""}`,re=e=>(n,o,r)=>{let i=e[n],{key:a,values:l}=i,s;if(!o)return`[${a}]`;let m=l==null?void 0:l[o];if(typeof m=="string"?s=m:s=m(r&&"instanceIndex"in r?r.instanceIndex:void 0),!(r==null?void 0:r.operator))return`[${a}="${s}"]`;switch(r.operator){case"prefixed":return`[${a}^="${s}"]`;case"suffixed":return`[${a}$="${s}"]`;case"contains":return`[${a}*="${s}"]`}};var qe="https://cdn.jsdelivr.net/npm/@finsweet/attributes-animation@1/functions.js",Ye="https://cdn.jsdelivr.net/npm/@finsweet/attributes-cmscore@1/cmscore.js",h=()=>f(void 0,null,function*(){let{fsAttributes:e}=window;if(e.animationImport)return e.animationImport;try{let t=import(qe);return e.animationImport=t,t}catch(t){C.alert(`${t}`,"error");return}}),K=()=>f(void 0,null,function*(){let{fsAttributes:e}=window;e.cms||(e.cms={});let{cms:t}=e;if(t.coreImport)return t.coreImport;try{let n=import(Ye);return t.coreImport=n,n.then(o=>{o&&(t.coreVersion||(t.coreVersion=o.version))}),n}catch(n){C.alert(`${n}`,"error");return}});var U="cmsload",y=`fs-${U}`,je="list",Xe="loader",ze="items-count",Je="scroll-anchor",Qe="page-button",Ze="page-dots",et="loading",tt="mode",nt={loadUnder:"load-under",renderAll:"render-all",pagination:"pagination",infinite:"infinite"},ot="threshold",rt="pagesiblings",it="pageboundary",st="animation",at="easing",lt="duration",mt="stagger",ct="resetix",ut={true:"true"},M={element:{key:`${y}-element`,values:{list:P(je),loader:P(Xe),itemsCount:P(ze),scrollAnchor:P(Je),pageButton:Qe,pageDots:Ze}},loading:{key:`${y}-${et}`},mode:{key:`${y}-${tt}`,values:nt},threshold:{key:`${y}-${ot}`},pageSiblings:{key:`${y}-${rt}`},pageBoundary:{key:`${y}-${it}`},animation:{key:`${y}-${st}`},easing:{key:`${y}-${at}`},duration:{key:`${y}-${lt}`},stagger:{key:`${y}-${mt}`},resetIx:{key:`${y}-${ct}`,values:ut}},E=re(M),ie="-20",se=1,ae=1,le={main:0,medium:1,small:2,tiny:3};var me=.1;var ce=(o,r)=>f(void 0,[o,r],function*(e,{durationKey:t,easingKey:n}){let i=yield h();if(!i)return;let{animations:{fade:a},easings:l}=i,{listAnimation:s}=e,m=e.getAttribute(t),p=e.getAttribute(n);if(s&&!m&&!p)return;let c=T(p,l)?p:void 0,d=m?parseFloat(m)/2e3:me;if(!s){e.listAnimation=R(b({},a),{options:{easing:c,duration:d}});return}let{options:g}=s;if(!g){s.options={easing:c,duration:d};return}g.easing||(g.easing=c),m&&(g.duration=d)}),ue=(i,a)=>f(void 0,[i,a],function*(e,{animationKey:t,durationKey:n,easingKey:o,staggerKey:r}){let l=yield h();if(!l)return;let{animations:s,easings:m}=l,p=e.getAttribute(t),c=T(p,O(s))?s[p]:s.fade,d=e.getAttribute(n),g=e.getAttribute(o),u=e.getAttribute(r);e.itemsAnimation=R(b({},c),{options:{easing:T(g,m)?g:void 0,duration:d?parseFloat(d)/1e3:void 0,stagger:u?parseFloat(u):void 0}})});var pt=new DOMParser,N=(e,t)=>f(void 0,null,function*(){let n=[],{index:o,paginationNext:r}=e;if(!r||typeof o!="number")return;let i=l=>f(void 0,[l],function*({href:a}){var m;let s;try{let c=yield(yield fetch(a)).text(),d=pt.parseFromString(c,"text/html"),g=V([],d)[o];if(!g)return;if(!e.paginationPrevious){let x=L(g,"previous");x&&e.addPaginationPrevious(x)}let u=L(g,"items");if(yield e.addItems(u),s=(m=L(g,"next"))==null?void 0:m.href,s&&!n.includes(s)&&t==="all"){n.push(s),yield i({href:s});return}yield e.emit("finishload")}catch(p){return}return s});return n.push(r.href),yield i(r)}),B=a=>f(void 0,[a],function*({e,paginationNext:t,listInstance:n,paginationNextTextNode:o,originalNextText:r,loadingText:i}){if(e==null||e.preventDefault(),!document.body.contains(t))return;yield n.displayElement("loader"),o&&i&&(o.textContent=i);let l=yield N(n,"next");return o&&r&&(o.textContent=r||""),l?t.href=l:t.remove(),yield n.displayElement("loader",!1),l});var{loading:{key:dt},pageSiblings:{key:ft},pageBoundary:{key:gt},threshold:{key:St}}=M,v=e=>{let{paginationNext:t,paginationPrevious:n}=e;if(!t)return;n==null||n.remove();let o=t.querySelector(E("loading")),r=o==null?void 0:o.textContent,i=o==null?void 0:o.getAttribute(dt);return{listInstance:e,paginationNext:t,paginationNextTextNode:o,originalNextText:r,loadingText:i}},pe=e=>{let{paginationWrapper:t,paginationCount:n}=e;if(!t)return;let o=t.querySelector(E("element","pageButton",{operator:"prefixed"})),r=t.querySelector(E("element","pageDots",{operator:"prefixed"}));r?r.remove():(r=document.createElement("div"),r.textContent="...");let i=e.getAttribute(gt),a=e.getAttribute(ft),l=(i?$(i):[]).map(d=>parseInt(d)),s=(a?$(a):[]).map(d=>parseInt(d)),[m,p]=G(l,s),c=[l,s].some(({length:d})=>d>1);return{listInstance:e,paginationWrapper:t,pageButtonTemplate:o,pageDotsTemplate:r,paginationCount:n,pageBoundary:m,pageBoundaryValues:l,pageSiblings:p,pageSiblingsValues:s,hasBreakpoints:c}},G=(e,t)=>{let n=F(),o=le[n],r=[];[e,t].forEach((l,s)=>{for(let m=o;m>=0;m--){let p=l[m];if(typeof p=="number"){r[s]=p;break}}});let[i,a]=r;return i!=null||(i=ae),a!=null||(a=se),[i,a]},de=e=>({threshold:parseInt(e.getAttribute(St)||ie)});var fe=e=>f(void 0,null,function*(){let t=v(e);if(!t)return;let{paginationNext:n,paginationNextTextNode:o,loadingText:r}=t,i=a=>(a.preventDefault(),!1);n.addEventListener("click",i),yield e.displayElement("loader"),o&&r&&(o.textContent=r),yield N(e,"all"),n.removeEventListener("click",i),n.remove(),yield e.displayElement("loader",!1)});var ge=Et;function Et(e,t,n){var o=null,r=null,i=n&&n.leading,a=n&&n.trailing;i==null&&(i=!0),a==null&&(a=!i),i==!0&&(a=!1);var l=function(){o&&(clearTimeout(o),o=null)},s=function(){var p=r;l(),p&&p()},m=function(){var p=i&&!o,c=this,d=arguments;if(r=function(){return e.apply(c,d)},o||(o=setTimeout(function(){if(o=null,a)return r()},t)),p)return p=!1,r()};return m.cancel=l,m.flush=s,m}var Se=e=>{let t=v(e);if(!t)return;let{threshold:n}=de(e),o=1-n/100,r=!1,{paginationNext:i}=t,{list:a}=e;i.addEventListener("click",m=>f(void 0,null,function*(){m.preventDefault(),!r&&(r=!0,yield B(b({e:m},t)),r=!1)}));let l=new IntersectionObserver(m=>{for(let{isIntersecting:p}of m)window[p?"addEventListener":"removeEventListener"]("scroll",s)});l.observe(a);let s=ge(()=>f(void 0,null,function*(){if(r)return;let{innerHeight:m}=window,{bottom:p}=a.getBoundingClientRect(),c=o*m;p>0&&p<=c&&(r=!0,(yield B(t))||(window.removeEventListener("scroll",s),l.disconnect()),r=!1)}),100)};var xe=Re(ye());var{paginationNext:xt,paginationPrevious:Ct}=A,Ce=e=>f(void 0,null,function*(){let t=pe(e);if(!t)return;let{paginationWrapper:n,pageButtonTemplate:o,pageDotsTemplate:r,paginationCount:i,pageBoundary:a,pageBoundaryValues:l,pageSiblings:s,pageSiblingsValues:m,hasBreakpoints:p}=t,c;if(o){let{parentElement:d}=o;d&&(c={parentElement:d,pageButtonTemplate:o,pageDotsTemplate:r,pageBoundary:a,pageSiblings:s,renderedElements:new Map([[o,1]])})}yield e.switchPage(1,!1),be(e,c,i,!1),e.on("renderitems",()=>be(e,c,i)),n.addEventListener("click",d=>At(d,c,e)),c&&p&&window.addEventListener("resize",(0,xe.default)(()=>{vt(c,e,l,m)},100)),yield e.displayElement("loader"),yield N(e,"all"),yield e.displayElement("loader",!1)}),be=(e,t,n,o=!0)=>{t&&Te(t,e),n&&wt(n,e),o&&Lt(e)},Te=(e,t)=>{let{currentPage:n,totalPages:o}=t;if(!n)return;let{parentElement:r,renderedElements:i,pageBoundary:a,pageSiblings:l}=e,s=[...i],m=l*2+1,c=a*2+m+2,d=n-1<c-m,g=o-n<c-m;for(let u=1;u<=c;u++){let[x,_e]=s[u-1]||[],[q]=s[u-2]||[];if(u>o){x&&(x.remove(),s[u-1]=void 0);continue}let S;o<=c?S=u:d?u>c-a?S=o-(c-u):u===c-a?S=null:S=u:g?u<a+1?S=u:u===a+1?S=null:S=o-(c-u):u<a+1?S=u:u>c-a?S=o-(c-u):u===a+1||u===c-a?S=null:S=n+(u-(a+1)-(1+l));let w;_e!==S&&(x==null||x.remove(),w=bt(e,S),s[u-1]=[w,S],q?r.insertBefore(w,q.nextSibling):r.appendChild(w),w.style.opacity="");let Y=w||x;!Y||Tt(Y,S===n)}e.renderedElements=new Map([...s.filter(W)])},bt=({pageButtonTemplate:e,pageDotsTemplate:t},n)=>{let o;return n?(o=D(e),o.classList.remove(I),o.textContent=`${n}`):o=D(t),o},Tt=(e,t)=>{t?(e.classList.add(I),e.setAttribute("aria-current","page")):(e.classList.remove(I),e.removeAttribute("aria-current"))},Lt=e=>{let{currentPage:t,totalPages:n}=e;e.displayElement("paginationPrevious",t!==1,!1),e.displayElement("paginationNext",t!==n,!1)},wt=(e,{currentPage:t,totalPages:n})=>{e.setAttribute("aria-label",`Page ${t} of ${n}`),e.textContent=`${t} / ${n}`},At=(e,t,n)=>{let{target:o}=e;if(!(o instanceof Element))return;let r=o.closest(E("element","pageButton",{operator:"prefixed"})),i=o.closest(`.${xt}`),a=o.closest(`.${Ct}`);if(!r&&!i&&!a)return;e.preventDefault();let{currentPage:l,totalPages:s}=n;if(!l)return;let m;i&&(m=l+1),a&&(m=l-1),r&&(m=t==null?void 0:t.renderedElements.get(r)),!!m&&m>=1&&m<=s&&n.switchPage(m)},vt=(e,t,...n)=>{let{pageBoundary:o,pageSiblings:r,renderedElements:i}=e,[a,l]=G(...n);if(!(o===a&&r===l)){e.pageBoundary=a,e.pageSiblings=l;for(let[s]of i)s.remove();i.clear(),Te(e,t)}};var Le=e=>{let t=v(e);if(!t)return;let n=!1,{paginationNext:o}=t,r=i=>f(void 0,null,function*(){if(i.preventDefault(),n)return;n=!0,(yield B(b({e:i},t)))||o.removeEventListener("click",r),n=!1});o.addEventListener("click",r)};var{element:{key:_t},mode:{key:Pt,values:{renderAll:ht,infinite:Mt,pagination:Nt}},animation:{key:Bt},duration:{key:we},easing:{key:Ae},stagger:{key:kt},resetIx:{key:It,values:Dt}}=M,{Webflow:_}=window,ve=e=>f(void 0,null,function*(){let t=e.getInstanceIndex(_t),{items:n}=e;ue(e,{animationKey:Bt,durationKey:we,easingKey:Ae,staggerKey:kt}),ce(e,{durationKey:we,easingKey:Ae});let o=!!_&&"require"in _&&!!_.require("commerce")&&n.some(({element:s})=>s.querySelector(`.${J.addToCartForm}`));o&&(e.restartCommerce=o);let r=!!_&&"require"in _&&!!_.require("lightbox")&&n.some(({element:s})=>s.querySelector(`.${Q.trigger}`));r&&(e.restartLightbox=r);let i=e.getAttribute(It)===Dt.true;i&&(e.restartIx=i);let a=document.querySelector(E("element","loader",{instanceIndex:t}));if(a&&e.addLoader(a),!e.itemsCount){let s=document.querySelector(E("element","itemsCount",{instanceIndex:t}));s&&e.addItemsCount(s)}if(!e.scrollAnchor){let s=document.querySelector(E("element","scrollAnchor",{instanceIndex:t}));s&&(e.scrollAnchor=s)}let l=e.getAttribute(Pt);return l===ht?yield fe(e):l===Mt?Se(e):l===Nt?yield Ce(e):Le(e),e});var H=()=>f(void 0,null,function*(){let e=yield K();if(!e)return[];let t=e.createCMSListInstances([E("element","list",{operator:"prefixed"})]);return yield Promise.all(t.map(ve)),t});ne();var{currentScript:$t}=document,{preventsLoad:Kt}=oe($t);K();h();Kt?window.fsAttributes[U]={init:H}:(window.Webflow||(window.Webflow=[]),window.Webflow.push(H));})();
{
"name": "@finsweet/attributes-cmsload",
"version": "1.3.1",
"version": "1.3.2-beta.0",
"description": "Load More Webflow CMS items on the page after the page has loaded.",

@@ -9,3 +9,4 @@ "main": "cmsload.js",

"examples.json",
"schema.json"
"schema.json",
"changesets.json"
],

@@ -12,0 +13,0 @@ "type": "module",

@@ -1,1 +0,1 @@

{"elements":{"list":{"description":"Defines the list to load more items.","required":true,"appliedTo":[".w-dyn-list",".w-dyn-items"],"requiresInstance":true,"conditions":[]},"loader":{"description":"Defines an element that will be displayed while the library is loading items in the background.","required":false,"appliedTo":[],"requiresInstance":true,"conditions":[{"type":"exists","element":"list"}]},"items-count":{"description":"Defines an element where to display the total items of the list.","required":false,"appliedTo":[],"requiresInstance":true,"conditions":[{"type":"exists","element":"listt"}]},"scroll-anchor":{"description":"Defines an element where to scroll the view every time a page in `Pagination` mode is switched.","required":false,"appliedTo":[],"requiresInstance":true,"conditions":[{"type":"exists","element":"list"}]},"page-button":{"description":"Defines the template element to generate all page buttons for the `Pagination` mode.","required":false,"appliedTo":[],"requiresInstance":false,"conditions":[{"type":"isChildOf","element":"list"},{"type":"isChildOf","selector":".w-pagination-wrapper"}]},"page-dots":{"description":"Defines the template element to create the page dots separators.","required":false,"appliedTo":[],"requiresInstance":false,"conditions":[{"type":"isChildOf","element":"list"},{"type":"isChildOf","selector":".w-pagination-wrapper"}]}},"settings":{"mode":{"description":"Defines the loading mode.","appliedTo":{"elements":["list"]},"value":{"type":"options","options":[{"value":"load-under","description":"When clicking the Next button more items will be loaded and rendered at the end of the list."},{"value":"infinite","description":"When the bottom of the list reaches a certain threshold more items will be loaded and rendered at the end of the list."},{"value":"pagination","description":"Users can quickly navigate through pages."},{"value":"render-all","description":"All items will be loaded and rendered on the list. Not advised for lists with more than 200 items."}],"default":"load-under"},"conditions":[]},"loading":{"description":"Defines the text to display on the Next button while loading new items.","appliedTo":{},"value":{"type":"string"},"conditions":[{"type":"isChildOf","selector":".w-pagination-next"}]},"threshold":{"description":"Defines when new items will load when the user scrolls","appliedTo":{"elements":["list"]},"value":{"type":"float","default":"-20"},"conditions":[{"type":"settings","element":"list","settings":[{"key":"mode","value":"infinite"}]}]},"pagesiblings":{"description":"Defines the amount of digits to display either side of the current page. It can be a comma-separated string listing the values in a `Desktop, Tablet, Landscape, Portrait` order.","appliedTo":{"elements":["list"]},"value":{"type":"commaSeparatedFloat","default":"1"},"conditions":[]},"pageboundary":{"description":"Defines the amount of digits to display at the start and end of a page buttons list. It can be a comma-separated string listing the values in a `Desktop, Tablet, Landscape, Portrait` order.","appliedTo":{"elements":["list"]},"value":{"type":"commaSeparatedFloat","default":"1"},"conditions":[]},"animation":{"description":"Defines the animation to use when appending elements to the list.","appliedTo":{"elements":["list"]},"value":{"type":"options","options":[{"value":"fade","description":"The items will fade-in."},{"value":"slide-up","description":"The items will slide from the bottom."},{"value":"slide-down","description":"The items will slide from the top."},{"value":"slide-right","description":"The items will slide from the left to the right."},{"value":"slide-left","description":"The items will slide from the right to the left."},{"value":"grow","description":"The items will grow-in."},{"value":"shrink","description":"The items will shrink-in."},{"value":"spin","description":"The items will spin-in."}],"default":"fade"},"conditions":[]},"easing":{"description":"Defines the easing function of the animation.","appliedTo":{"elements":["list"]},"value":{"type":"options","options":[{"value":"linear","description":"The items animation curve will be linear."},{"value":"ease","description":"The items animation curve will be ease."},{"value":"ease-in","description":"The items animation curve will be ease-in."},{"value":"ease-out","description":"The items animation curve will be ease-out."},{"value":"ease-in-out","description":"The items animation curve will be ease-in-out."}],"default":"ease"},"conditions":[]},"duration":{"description":"Defines the duration of the animation in miliseconds.","appliedTo":{"elements":["list"]},"value":{"type":"float","default":"100"},"conditions":[]},"stagger":{"description":"Defines a stagger delay for the items animation in miliseconds.","appliedTo":{"elements":["list"]},"value":{"type":"float"},"conditions":[]},"resetix":{"description":"Defines if Webflow's interactions should be restarted after rendering new items. Use it if your Collection List Items use interactions.","appliedTo":{"elements":["list"]},"value":{"type":"boolean"},"conditions":[]}}}
{"elements":{"list":{"description":"Defines the list to load more items.","required":true,"appliedTo":[".w-dyn-list",".w-dyn-items"],"requiresInstance":true,"conditions":[]},"loader":{"description":"Defines an element that will be displayed while the library is loading items in the background.","required":false,"appliedTo":[],"requiresInstance":true,"conditions":[{"type":"exists","element":"list"}]},"items-count":{"description":"Defines an element where to display the total items of the list.","required":false,"appliedTo":[],"requiresInstance":true,"conditions":[{"type":"exists","element":"list"}]},"scroll-anchor":{"description":"Defines an element where to scroll the view every time a page in `Pagination` mode is switched.","required":false,"appliedTo":[],"requiresInstance":true,"conditions":[{"type":"exists","element":"list"}]},"page-button":{"description":"Defines the template element to generate all page buttons for the `Pagination` mode.","required":false,"appliedTo":[],"requiresInstance":false,"conditions":[{"type":"isChildOf","element":"list"},{"type":"isChildOf","selector":".w-pagination-wrapper"}]},"page-dots":{"description":"Defines the template element to create the page dots separators.","required":false,"appliedTo":[],"requiresInstance":false,"conditions":[{"type":"isChildOf","element":"list"},{"type":"isChildOf","selector":".w-pagination-wrapper"}]}},"settings":{"mode":{"description":"Defines the loading mode.","appliedTo":{"elements":["list"]},"value":{"type":"options","options":[{"value":"load-under","description":"When clicking the Next button more items will be loaded and rendered at the end of the list."},{"value":"infinite","description":"When the bottom of the list reaches a certain threshold more items will be loaded and rendered at the end of the list."},{"value":"pagination","description":"Users can quickly navigate through pages."},{"value":"render-all","description":"All items will be loaded and rendered on the list. Not advised for lists with more than 200 items."}],"default":"load-under"},"conditions":[]},"loading":{"description":"Defines the text to display on the Next button while loading new items.","appliedTo":{},"value":{"type":"string"},"conditions":[{"type":"isChildOf","selector":".w-pagination-next"}]},"threshold":{"description":"Defines when new items will load when the user scrolls","appliedTo":{"elements":["list"]},"value":{"type":"float","default":"-20"},"conditions":[{"type":"settings","element":"list","settings":[{"key":"mode","value":"infinite"}]}]},"pagesiblings":{"description":"Defines the amount of digits to display either side of the current page. It can be a comma-separated string listing the values in a `Desktop, Tablet, Landscape, Portrait` order.","appliedTo":{"elements":["list"]},"value":{"type":"commaSeparatedFloat","default":"1"},"conditions":[]},"pageboundary":{"description":"Defines the amount of digits to display at the start and end of a page buttons list. It can be a comma-separated string listing the values in a `Desktop, Tablet, Landscape, Portrait` order.","appliedTo":{"elements":["list"]},"value":{"type":"commaSeparatedFloat","default":"1"},"conditions":[]},"animation":{"description":"Defines the animation to use when appending elements to the list.","appliedTo":{"elements":["list"]},"value":{"type":"options","options":[{"value":"fade","description":"The items will fade-in."},{"value":"slide-up","description":"The items will slide from the bottom."},{"value":"slide-down","description":"The items will slide from the top."},{"value":"slide-right","description":"The items will slide from the left to the right."},{"value":"slide-left","description":"The items will slide from the right to the left."},{"value":"grow","description":"The items will grow-in."},{"value":"shrink","description":"The items will shrink-in."},{"value":"spin","description":"The items will spin-in."}],"default":"fade"},"conditions":[]},"easing":{"description":"Defines the easing function of the animation.","appliedTo":{"elements":["list"]},"value":{"type":"options","options":[{"value":"linear","description":"The items animation curve will be linear."},{"value":"ease","description":"The items animation curve will be ease."},{"value":"ease-in","description":"The items animation curve will be ease-in."},{"value":"ease-out","description":"The items animation curve will be ease-out."},{"value":"ease-in-out","description":"The items animation curve will be ease-in-out."}],"default":"ease"},"conditions":[]},"duration":{"description":"Defines the duration of the animation in miliseconds.","appliedTo":{"elements":["list"]},"value":{"type":"float","default":"100"},"conditions":[]},"stagger":{"description":"Defines a stagger delay for the items animation in miliseconds.","appliedTo":{"elements":["list"]},"value":{"type":"float"},"conditions":[]},"resetix":{"description":"Defines if Webflow's interactions should be restarted after rendering new items. Use it if your Collection List Items use interactions.","appliedTo":{"elements":["list"]},"value":{"type":"boolean"},"conditions":[]}}}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc