@finsweet/attributes-cmsprevnext
Advanced tools
Comparing version 1.4.8 to 1.5.0
@@ -1,1 +0,1 @@ | ||
(()=>{var D=Object.defineProperty;var F=(e,t,r)=>t in e?D(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var M=(e,t,r)=>(F(e,typeof t!="symbol"?t+"":t,r),r);var U="@finsweet/attributes-cmscore";var f=class{static activateAlerts(){this.alertsActivated=!0}static alert(t,r){if(this.alertsActivated&&window.alert(t),r==="error")throw new Error(t)}};M(f,"alertsActivated",!1);var I=e=>e.replace(/\/+$/,"");var H=`https://cdn.jsdelivr.net/npm/${U}@1/cmscore.js`,b=async()=>{let{fsAttributes:e}=window;e.cms||(e.cms={});let{cms:t}=e;if(t.coreImport)return t.coreImport;try{let r=import(H);return t.coreImport=r,r.then(n=>{n&&(t.coreVersion||(t.coreVersion=n.version))}),r}catch(r){f.alert(`${r}`,"error");return}};var d="fs-attributes";var m="cmsprevnext";var X=`${d}-support`,q="https://cdn.jsdelivr.net/npm/@finsweet/attributes-support@1/support.js",P=async()=>{let{fsAttributes:e,location:t}=window,{host:r,searchParams:n}=new URL(t.href);if(!r.includes("webflow.io")||!n.has(X))return!1;if(e.supportImport)return e.supportImport;try{e.supportImport=new Promise((i,o)=>{let s=document.createElement("script");s.src=q,s.onload=()=>i(!0),s.onerror=o,document.head.append(s)})}catch(i){return!1}return e.supportImport};var w=e=>{let t=(n,i,o)=>{let s=e[n],{key:c,values:a}=s,p;if(!i)return`[${c}]`;let T=a==null?void 0:a[i];typeof T=="string"?p=T:p=T(o&&"instanceIndex"in o?o.instanceIndex:void 0);let u=o&&"caseInsensitive"in o&&o.caseInsensitive?"i":"";if(!(o!=null&&o.operator))return`[${c}="${p}"${u}]`;switch(o.operator){case"prefixed":return`[${c}^="${p}"${u}]`;case"suffixed":return`[${c}$="${p}"${u}]`;case"contains":return`[${c}*="${p}"${u}]`}};function r(n,i){let o=t("element",n,i),s=(i==null?void 0:i.scope)||document;return i!=null&&i.all?s.querySelectorAll(o):s.querySelector(o)}return[t,r]};var A={preventLoad:{key:`${d}-preventload`},debugMode:{key:`${d}-debug`},src:{key:"src",values:{finsweet:"@finsweet/attributes"}},dev:{key:`${d}-dev`}},[R,vt]=w(A);var B=e=>{let{currentScript:t}=document,r={};if(!t)return{attributes:r,preventsLoad:!1};let i={preventsLoad:typeof t.getAttribute(A.preventLoad.key)=="string",attributes:r};for(let o in e){let s=t.getAttribute(e[o]);i.attributes[o]=s}return i};var L=()=>{if(window.fsAttributes&&!Array.isArray(window.fsAttributes))return;let e={cms:{},push(...t){var r,n;for(let[i,o]of t)(n=(r=this[i])==null?void 0:r.loading)==null||n.then(o)}};Y(e),G(e),window.fsAttributes=e,window.FsAttributes=window.fsAttributes,P()},Y=e=>{let t=R("src","finsweet",{operator:"contains"}),r=R("dev"),i=[...document.querySelectorAll(`script${t}, script${r}`)].reduce((o,s)=>{var a;let c=s.getAttribute(A.dev.key)||((a=s.src.match(/[\w-. ]+(?=(\.js)$)/))==null?void 0:a[0]);return c&&!o.includes(c)&&o.push(c),o},[]);for(let o of i){e[o]={};let s=e[o];s.loading=new Promise(c=>{s.resolve=a=>{c(a),delete s.resolve}})}},G=e=>{let t=Array.isArray(window.fsAttributes)?window.fsAttributes:[];e.push(...t)};var N="1.4.8";var Q=`fs-${m}`,z="list",J="previous",Z="previous-empty",tt="next",et="next-empty",rt={element:{key:`${Q}-element`,values:{list:z,previous:J,previousEmpty:Z,next:tt,nextEmpty:et}}},[V,x]=w(rt);var O=()=>{let e=x("previous",{operator:"prefixed"}),t=x("next",{operator:"prefixed"});if(!e&&!t)return;let r=x("previousEmpty",{operator:"prefixed"});r==null||r.remove();let n=x("nextEmpty",{operator:"prefixed"});return n==null||n.remove(),{previousPlaceholder:e,nextPlaceholder:t,previousEmptyElement:r,nextEmptyElement:n}};var h=async()=>{var g,C;let e=await b();if(!e)return[];let t=!1,r=!1,n=e.createCMSListInstances([V("element","list",{operator:"prefixed"})]);if(!n.length)return[];let i=O();if(!i)return[];let{previousPlaceholder:o,nextPlaceholder:s,previousEmptyElement:c,nextEmptyElement:a}=i,{origin:p,pathname:T}=window.location,u=p+T,v=()=>(!o||o&&t)&&(!s||s&&r);for(let E of n){if(v())break;let y=S=>{if(v()){E.off("additems",y),E.wrapper.remove();return}let _=S.findIndex(({href:l})=>l&&I(l)===I(u));if(!(_<0)){if(o){let l=S[_-1];l&&!t?(c==null||c.remove(),o.appendChild(l.element),t=!0):c&&o.appendChild(c)}if(s){let l=S[_+1];l&&!r?(a==null||a.remove(),s.appendChild(l.element),r=!0):a&&s.appendChild(a)}}};E.on("additems",y),y(E.items),E.wrapper.style.display="none"}return(C=(g=window.fsAttributes[m]).resolve)==null||C.call(g,n),n};L();b();var k,K;(k=window.fsAttributes)[K=m]||(k[K]={});var{preventsLoad:ot}=B(),$=window.fsAttributes[m];$.version=N;ot?$.init=h:(window.Webflow||(window.Webflow=[]),window.Webflow.push(h));})(); | ||
"use strict";(()=>{var j=Object.defineProperty;var H=(e,t,r)=>t in e?j(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var M=(e,t,r)=>(H(e,typeof t!="symbol"?t+"":t,r),r);var P="@finsweet/attributes-cmscore";var f=class{static activateAlerts(){this.alertsActivated=!0}static alert(t,r){if(this.alertsActivated&&window.alert(t),r==="error")throw new Error(t)}};M(f,"alertsActivated",!1);var I=e=>e.replace(/\/+$/,"");var q=`https://cdn.jsdelivr.net/npm/${P}@1/cmscore.js`,b=async()=>{let{fsAttributes:e}=window;e.cms||(e.cms={});let{cms:t}=e;if(t.coreImport)return t.coreImport;try{let r=import(q);return t.coreImport=r,r.then(n=>{n&&(t.coreVersion||(t.coreVersion=n.version))}),r}catch(r){f.alert(`${r}`,"error");return}};var T="fs-attributes";var B="cmsattribute";var m="cmsprevnext";var Y=`${T}-support`,G="https://cdn.jsdelivr.net/npm/@finsweet/attributes-support@1/support.js",L=async()=>{let{fsAttributes:e,location:t}=window,{host:r,searchParams:n}=new URL(t.href);if(!r.includes("webflow.io")||!n.has(Y))return!1;if(e.supportImport)return e.supportImport;try{e.supportImport=new Promise((i,o)=>{let s=document.createElement("script");s.src=G,s.onload=()=>i(!0),s.onerror=o,document.head.append(s)})}catch(i){return!1}return e.supportImport};var w=e=>{let t=(n,i,o)=>{let s=e[n],{key:c,values:a}=s,p;if(!i)return`[${c}]`;let d=a==null?void 0:a[i];typeof d=="string"?p=d:p=d(o&&"instanceIndex"in o?o.instanceIndex:void 0);let u=o&&"caseInsensitive"in o&&o.caseInsensitive?"i":"";if(!(o!=null&&o.operator))return`[${c}="${p}"${u}]`;switch(o.operator){case"prefixed":return`[${c}^="${p}"${u}]`;case"suffixed":return`[${c}$="${p}"${u}]`;case"contains":return`[${c}*="${p}"${u}]`}};function r(n,i){let o=t("element",n,i),s=(i==null?void 0:i.scope)||document;return i!=null&&i.all?s.querySelectorAll(o):s.querySelector(o)}return[t,r]};var A={preventLoad:{key:`${T}-preventload`},debugMode:{key:`${T}-debug`},src:{key:"src",values:{finsweet:"@finsweet/attributes"}},dev:{key:`${T}-dev`}},[R,vt]=w(A);var N=e=>{let{currentScript:t}=document,r={};if(!t)return{attributes:r,preventsLoad:!1};let i={preventsLoad:typeof t.getAttribute(A.preventLoad.key)=="string",attributes:r};for(let o in e){let s=t.getAttribute(e[o]);i.attributes[o]=s}return i};var V=()=>{if(window.fsAttributes&&!Array.isArray(window.fsAttributes))return;let e={cms:{},push(...t){var r,n;for(let[i,o]of t)(n=(r=this[i])==null?void 0:r.loading)==null||n.then(o)}};W(e),Q(e),window.fsAttributes=e,window.FsAttributes=window.fsAttributes,L()},W=e=>{let t=R("src","finsweet",{operator:"contains"}),r=R("dev"),i=[...document.querySelectorAll(`script${t}, script${r}`)].reduce((o,s)=>{var a;let c=s.getAttribute(A.dev.key)||((a=s.src.match(/[\w-. ]+(?=(\.js)$)/))==null?void 0:a[0]);return c&&!o.includes(c)&&o.push(c),o},[]);for(let o of i){e[o]={};let s=e[o];s.loading=new Promise(c=>{s.resolve=a=>{c(a),delete s.resolve}})}},Q=e=>{let t=Array.isArray(window.fsAttributes)?window.fsAttributes:[];e.push(...t)};var O="1.5.0";var J=`fs-${m}`,Z="list",tt="previous",et="previous-empty",rt="next",ot="next-empty",st={element:{key:`${J}-element`,values:{list:Z,previous:tt,previousEmpty:et,next:rt,nextEmpty:ot}}},[k,x]=w(st);var K=()=>{let e=x("previous",{operator:"prefixed"}),t=x("next",{operator:"prefixed"});if(!e&&!t)return;let r=x("previousEmpty",{operator:"prefixed"});r==null||r.remove();let n=x("nextEmpty",{operator:"prefixed"});return n==null||n.remove(),{previousPlaceholder:e,nextPlaceholder:t,previousEmptyElement:r,nextEmptyElement:n}};var h=async()=>{var g,v,U;let e=await b();if(!e)return[];await((g=window.fsAttributes[B])==null?void 0:g.loading);let t=!1,r=!1,n=e.createCMSListInstances([k("element","list",{operator:"prefixed"})]);if(!n.length)return[];let i=K();if(!i)return[];let{previousPlaceholder:o,nextPlaceholder:s,previousEmptyElement:c,nextEmptyElement:a}=i,{origin:p,pathname:d}=window.location,u=p+d,C=()=>(!o||o&&t)&&(!s||s&&r);for(let E of n){if(C())break;let y=S=>{if(C()){E.off("additems",y),E.wrapper.remove();return}let _=S.findIndex(({href:l})=>l&&I(l)===I(u));if(!(_<0)){if(o){let l=S[_-1];l&&!t?(c==null||c.remove(),o.appendChild(l.element),t=!0):c&&o.appendChild(c)}if(s){let l=S[_+1];l&&!r?(a==null||a.remove(),s.appendChild(l.element),r=!0):a&&s.appendChild(a)}}};E.on("additems",y),y(E.items),E.wrapper.style.display="none"}return(U=(v=window.fsAttributes[m]).resolve)==null||U.call(v,n),n};V();b();var $,D;($=window.fsAttributes)[D=m]||($[D]={});var{preventsLoad:nt}=N(),F=window.fsAttributes[m];F.version=O;nt?F.init=h:(window.Webflow||(window.Webflow=[]),window.Webflow.push(h));})(); |
{ | ||
"name": "@finsweet/attributes-cmsprevnext", | ||
"version": "1.4.8", | ||
"version": "1.5.0", | ||
"description": "Add Previous and Next buttons in Collection Template Pages.", | ||
@@ -37,6 +37,6 @@ "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/constants": "1.1.0", | ||
"@global/factory": "1.1.4" | ||
}, | ||
@@ -43,0 +43,0 @@ "scripts": { |
10287
+ Added@finsweet/attributes-cmscore@1.7.2(transitive)
- Removed@finsweet/attributes-cmscore@1.7.1(transitive)
Updated@global/constants@1.1.0
Updated@global/factory@1.1.4