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

@finsweet/attributes-cmsload

Package Overview
Dependencies
Maintainers
3
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.8.1 to 1.8.2

2

cmsload.js

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

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

@@ -37,7 +37,7 @@ "homepage": "https://www.finsweet.com/attributes",

"dependencies": {
"@finsweet/attributes-cmscore": "1.7.1",
"@finsweet/attributes-cmscore": "1.7.2",
"@finsweet/ts-utils": "^0.33.1",
"@global/constants": "1.0.2",
"@global/factory": "1.1.3",
"@global/import": "1.0.2",
"@global/constants": "1.1.0",
"@global/factory": "1.1.4",
"@global/import": "1.0.3",
"just-debounce": "^1.1.0",

@@ -44,0 +44,0 @@ "just-throttle": "^4.0.1"

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