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.1.4 to 1.1.5

2

cmsload.js

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

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

@@ -5,0 +5,0 @@ "main": "cmsload.js",

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