@finsweet/attributes-cmsprevnext
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -1,1 +0,1 @@ | ||
"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));})(); | ||
"use strict";(()=>{var H=Object.create;var w=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var G=(t,e,r)=>e in t?w(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var W=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,r)=>(typeof require!="undefined"?require:e)[r]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var Q=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of X(e))!Y.call(t,s)&&s!==r&&w(t,s,{get:()=>e[s],enumerable:!(n=j(e,s))||n.enumerable});return t};var z=(t,e,r)=>(r=t!=null?H(q(t)):{},Q(e||!t||!t.__esModule?w(r,"default",{value:t,enumerable:!0}):r,t));var P=(t,e,r)=>(G(t,typeof e!="symbol"?e+"":e,r),r);var T=class{static activateAlerts(){this.alertsActivated=!0}static alert(e,r){if(this.alertsActivated&&window.alert(e),r==="error")throw new Error(e)}};P(T,"alertsActivated",!1);var I=t=>t.replace(/\/+$/,"");var A=async()=>{let{fsAttributes:t}=window;t.cms||(t.cms={});let{cms:e}=t;if(e.coreImport)return e.coreImport;try{let r=import("https://cdn.jsdelivr.net/npm/@finsweet/attributes-cmscore@1/cmscore.js");return e.coreImport=r,r.then(n=>{n&&(e.coreVersion||(e.coreVersion=n.version))}),r}catch(r){T.alert(`${r}`,"error");return}};var f="fs-attributes";var B="cmsattribute";var m="cmsprevnext";var J=`${f}-support`,Z="https://cdn.jsdelivr.net/npm/@finsweet/attributes-support@1/support.js",L=async()=>{let{fsAttributes:t,location:e}=window,{host:r,searchParams:n}=new URL(e.href);if(!r.includes("webflow.io")||!n.has(J))return!1;if(t.supportImport)return t.supportImport;try{t.supportImport=new Promise((s,o)=>{let i=document.createElement("script");i.src=Z,i.onload=()=>s(!0),i.onerror=o,document.head.append(i)})}catch(s){return!1}return t.supportImport};var S=t=>{let e=(n,s,o)=>{let i=t[n],{key:c,values:a}=i,p;if(!s)return`[${c}]`;let E=a==null?void 0:a[s];typeof E=="string"?p=E:p=E(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,s){let o=e("element",n,s),i=(s==null?void 0:s.scope)||document;return s!=null&&s.all?i.querySelectorAll(o):i.querySelector(o)}return[e,r]};var x={preventLoad:{key:`${f}-preventload`},debugMode:{key:`${f}-debug`},src:{key:"src",values:{finsweet:"@finsweet/attributes"}},dev:{key:`${f}-dev`}},[C,Pt]=S(x);var O=t=>{let{currentScript:e}=document,r={};if(!e)return{attributes:r,preventsLoad:!1};let s={preventsLoad:typeof e.getAttribute(x.preventLoad.key)=="string",attributes:r};for(let o in t){let i=e.getAttribute(t[o]);s.attributes[o]=i}return s};var V=()=>{if(window.fsAttributes&&!Array.isArray(window.fsAttributes))return;let t={cms:{},push(...e){var r,n;for(let[s,o]of e)(n=(r=this[s])==null?void 0:r.loading)==null||n.then(o)}};tt(t),et(t),window.fsAttributes=t,window.FsAttributes=window.fsAttributes,L()},tt=t=>{let e=C("src","finsweet",{operator:"contains"}),r=C("dev"),s=[...document.querySelectorAll(`script${e}, script${r}`)].reduce((o,i)=>{var a;let c=i.getAttribute(x.dev.key)||((a=i.src.match(/[\w-. ]+(?=(\.js)$)/))==null?void 0:a[0]);return c&&!o.includes(c)&&o.push(c),o},[]);for(let o of s){t[o]={};let i=t[o];i.loading=new Promise(c=>{i.resolve=a=>{c(a),delete i.resolve}})}},et=t=>{let e=Array.isArray(window.fsAttributes)?window.fsAttributes:[];t.push(...e)};var N="1.5.1";var ot=`fs-${m}`,st="list",nt="previous",it="previous-empty",ct="next",at="next-empty",pt={element:{key:`${ot}-element`,values:{list:st,previous:nt,previousEmpty:it,next:ct,nextEmpty:at}}},[K,b]=S(pt);var k=()=>{let t=b("previous",{operator:"prefixed"}),e=b("next",{operator:"prefixed"});if(!t&&!e)return;let r=b("previousEmpty",{operator:"prefixed"});r==null||r.remove();let n=b("nextEmpty",{operator:"prefixed"});return n==null||n.remove(),{previousPlaceholder:t,nextPlaceholder:e,previousEmptyElement:r,nextEmptyElement:n}};var v=async()=>{var h,g,M;let t=await A();if(!t)return[];await((h=window.fsAttributes[B])==null?void 0:h.loading);let e=!1,r=!1,n=t.createCMSListInstances([K("element","list",{operator:"prefixed"})]);if(!n.length)return[];let s=k();if(!s)return[];let{previousPlaceholder:o,nextPlaceholder:i,previousEmptyElement:c,nextEmptyElement:a}=s,{origin:p,pathname:E}=window.location,u=p+E,U=()=>(!o||o&&e)&&(!i||i&&r);for(let d of n){if(U())break;let y=_=>{if(U()){d.off("additems",y),d.wrapper.remove();return}let R=_.findIndex(({href:l})=>l&&I(l)===I(u));if(!(R<0)){if(o){let l=_[R-1];l&&!e?(c==null||c.remove(),o.appendChild(l.element),e=!0):c&&o.appendChild(c)}if(i){let l=_[R+1];l&&!r?(a==null||a.remove(),i.appendChild(l.element),r=!0):a&&i.appendChild(a)}}};d.on("additems",y),y(d.items),d.wrapper.style.display="none"}return(M=(g=window.fsAttributes[m]).resolve)==null||M.call(g,n),n};V();A();var $,D;($=window.fsAttributes)[D=m]||($[D]={});var{preventsLoad:lt}=O(),F=window.fsAttributes[m];F.version=N;lt?F.init=v:(window.Webflow||(window.Webflow=[]),window.Webflow.push(v));})(); |
{ | ||
"name": "@finsweet/attributes-cmsprevnext", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"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.2", | ||
"@finsweet/attributes-cmscore": "1.8.0", | ||
"@finsweet/ts-utils": "^0.33.1", | ||
"@global/constants": "1.1.0", | ||
"@global/factory": "1.1.4" | ||
"@global/constants": "1.2.0", | ||
"@global/factory": "1.1.5" | ||
}, | ||
@@ -43,0 +43,0 @@ "scripts": { |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
10998
21
1
3
+ Added@finsweet/attributes-cmscore@1.8.0(transitive)
- Removed@finsweet/attributes-cmscore@1.7.2(transitive)
Updated@global/constants@1.2.0
Updated@global/factory@1.1.5