@finsweet/attributes-cmsprevnext
Advanced tools
Comparing version 1.5.1 to 1.6.0
@@ -1,1 +0,1 @@ | ||
[{"version":"v1.4.1","date":"03 May 2022","markdown":"- Selector for Collection List updated in schema.\n"},{"version":"v1.4.0","date":"19 April 2022","markdown":"- Added support wizard and publishing new schema version\n"},{"version":"v1.3.0","date":"10 February 2022","markdown":"Included a new `window.fsAttributes.push()` method in the developer API that provides a standarized way to safely access any Attribute internals once it has fully loaded.\nIt can be used like:\n\n```html\n<script>\n window.fsAttributes = window.fsAttributes || [];\n window.fsAttributes.push([\n 'cmsprevnext',\n (cmsLists) => {\n console.log('Attribute has successfully loaded!');\n console.log(cmsLists);\n },\n ]);\n</script>\n```\n"},{"version":"v1.3.0-beta.0","date":"24 January 2022","markdown":"- Internal: implemented `schema.json` and improvements in constants.\n"},{"version":"v1.2.0","date":"29 November 2021","markdown":"- Created `changesets.json` API.\n"},{"version":"v1.1.2","date":"24 November 2021","markdown":"- Added support to compare URLs with and without a trailing slash `/`.\n Now cases like this will match:\n - Current URL: https://www.finsweet.com/attributes/attractions/capri-island/\n - Collection Item URL: https://www.finsweet.com/attributes/attractions/capri-island\n"},{"version":"v1.1.1","date":"17 November 2021","markdown":"- Fixed `examples.json` not being available on NPM.\n"},{"version":"v1.1.0","date":"17 November 2021","markdown":"- Added support for `cmscore` versioning.\n"},{"version":"v1.0.4","date":"16 November 2021","markdown":"- Updated `cmscore` import.\n"},{"version":"v1.0.3","date":"16 November 2021","markdown":"- Updated `cmscore` import.\n"},{"version":"v1.0.2","date":"11 November 2021","markdown":"- Updated `cmscore` import.\n"},{"version":"v1.0.1","date":"11 November 2021","markdown":"- Updated `cmscore` import.\n"},{"version":"v1.0.0","date":"24 October 2021","markdown":"- Created attribute package.\n"}] | ||
[{"version":"1.6.0","markdown":"- e4b3b680: Created new `window.fsAttributes.destroy()` method to support SPA environments.\n This new method allows users to destroy all Attributes instances, cleaning up event listeners, observers, states, global variables, etc.\n\n Websites that use a client-side router that simulates an SPA environment like [barba.js](https://barba.js.org/) or [Swup](https://swup.js.org/) can now properly init and destroy Attributes.\n After destroying, Attributes can be manually re-initted by calling `window.fsAttribute[ATTRIBUTE_KEY].init()`.\n\n Updated changesets system, now all updates will be correctly reflected in [the official updates page](https://www.finsweet.com/attributes/updates)."},{"version":"1.5.1","markdown":"- Updated dependencies [4792998a]\n- Updated dependencies [4792998a]\n - @global/constants@1.2.0\n - @finsweet/attributes-cmscore@1.8.0\n - @global/factory@1.1.5"},{"version":"1.5.0","markdown":"- 07f32375: Created `fs-cmsattribute` Attribute- Updated dependencies [07f32375]\n - @global/constants@1.1.0\n - @global/factory@1.1.4\n - @finsweet/attributes-cmscore@1.7.2"},{"version":"1.4.8","markdown":"- Updated dependencies [d8a4bf6f]\n - @finsweet/attributes-cmscore@1.7.1"},{"version":"1.4.7","markdown":"- Updated dependencies [ef56d454]\n - @finsweet/attributes-cmscore@1.7.0"},{"version":"1.4.6","markdown":"- Updated dependencies [299fd136]\n - @finsweet/attributes-cmscore@1.6.10"},{"version":"1.4.5","markdown":"- Updated dependencies [7542dcdb]\n - @global/constants@1.0.2\n - @global/factory@1.1.3\n - @finsweet/attributes-cmscore@1.6.9"},{"version":"1.4.4","markdown":"- Updated dependencies [bdd1a78]\n - @global/constants@1.0.1\n - @global/factory@1.1.2\n - @finsweet/attributes-cmscore@1.6.8"},{"version":"1.4.3","markdown":"- Updated dependencies [13c3e23]\n - @global/factory@1.1.1\n - @finsweet/attributes-cmscore@1.6.7"},{"version":"1.4.2","markdown":"- Updated dependencies [627bf25]\n - @global/factory@1.1.0\n - @finsweet/attributes-cmscore@1.6.7"},{"version":"1.4.1","markdown":"- Selector for Collection List updated in schema."},{"version":"1.4.0","markdown":"- Added support wizard and publishing new schema version"},{"version":"1.3.0","markdown":"Included a new `window.fsAttributes.push()` method in the developer API that provides a standarized way to safely access any Attribute internals once it has fully loaded.\nIt can be used like:\n\n```html\n<script>\n window.fsAttributes = window.fsAttributes || [];\n window.fsAttributes.push([\n 'cmsprevnext',\n (cmsLists) => {\n console.log('Attribute has successfully loaded!');\n console.log(cmsLists);\n },\n ]);\n</script>\n```"},{"version":"1.2.0","markdown":"- Created `changesets.json` API."},{"version":"1.1.2","markdown":"- Added support to compare URLs with and without a trailing slash `/`.\n Now cases like this will match:\n - Current URL: https://www.finsweet.com/attributes/attractions/capri-island/\n - Collection Item URL: https://www.finsweet.com/attributes/attractions/capri-island"},{"version":"1.1.1","markdown":"- Fixed `examples.json` not being available on NPM."},{"version":"1.1.0","markdown":"- Added support for `cmscore` versioning."},{"version":"1.0.4","markdown":"- Updated `cmscore` import."},{"version":"1.0.3","markdown":"- Updated `cmscore` import."},{"version":"1.0.2","markdown":"- Updated `cmscore` import."},{"version":"1.0.1","markdown":"- Updated `cmscore` import."},{"version":"1.0.0","markdown":"- Created attribute package."}] |
@@ -1,1 +0,1 @@ | ||
"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));})(); | ||
"use strict";(()=>{var F=Object.create;var I=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var Y=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var q=(e,t,r)=>t in e?I(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var G=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var z=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of X(t))!j.call(e,o)&&o!==r&&I(e,o,{get:()=>t[o],enumerable:!(s=H(t,o))||s.enumerable});return e};var W=(e,t,r)=>(r=e!=null?F(Y(e)):{},z(t||!e||!e.__esModule?I(r,"default",{value:e,enumerable:!0}):r,e));var g=(e,t,r)=>(q(e,typeof t!="symbol"?t+"":t,r),r);var d="fs-attributes";var C="cmsattribute";var E="cmsprevnext";var h=async(...e)=>{var r;let t=[];for(let s of e){let o=await((r=window.fsAttributes[s])==null?void 0:r.loading);t.push(o)}return t};var A=class{static activateAlerts(){this.alertsActivated=!0}static alert(t,r){if(this.alertsActivated&&window.alert(t),r==="error")throw new Error(t)}};g(A,"alertsActivated",!1);var v=()=>{};var y=e=>e.replace(/\/+$/,"");function B(e,t,r){var o;let s=window.fsAttributes[e];return s.destroy=r||v,(o=s.resolve)==null||o.call(s,t),t}var P=async()=>{let{fsAttributes:e}=window;e.cmscore||(e.cmscore={});let{cmscore:t}=e;if(t.import)return t.import;try{return t.import=import("https://cdn.jsdelivr.net/npm/@finsweet/attributes-cmscore@1/cmscore.js"),t.import.then(r=>{r&&(t.version||(t.version=r.version))}),t.import}catch(r){A.alert(`${r}`,"error");return}};var Q=`${d}-support`,J="https://cdn.jsdelivr.net/npm/@finsweet/attributes-support@1/support.js",M=async()=>{let{fsAttributes:e,location:t}=window,{host:r,searchParams:s}=new URL(t.href);e.support||(e.support={});let{support:o}=e;if(!r.includes("webflow.io")||!s.has(Q))return!1;if(o.import)return o.import;try{o.import=new Promise((n,i)=>{let c=document.createElement("script");c.src=J,c.onload=()=>n(!0),c.onerror=i,document.head.append(c)})}catch(n){return!1}return o.import};var _=e=>{let t=(s,o,n)=>{let i=e[s],{key:c,values:l}=i,a;if(!o)return`[${c}]`;let f=l==null?void 0:l[o];typeof f=="string"?a=f:a=f(n&&"instanceIndex"in n?n.instanceIndex:void 0);let T=n&&"caseInsensitive"in n&&n.caseInsensitive?"i":"";if(!(n!=null&&n.operator))return`[${c}="${a}"${T}]`;switch(n.operator){case"prefixed":return`[${c}^="${a}"${T}]`;case"suffixed":return`[${c}$="${a}"${T}]`;case"contains":return`[${c}*="${a}"${T}]`}};function r(s,o){let n=t("element",s,o),i=(o==null?void 0:o.scope)||document;return o!=null&&o.all?[...i.querySelectorAll(n)]:i.querySelector(n)}return[t,r]};var b={preventLoad:{key:`${d}-preventload`},debugMode:{key:`${d}-debug`},src:{key:"src",values:{finsweet:"@finsweet/attributes"}},dev:{key:`${d}-dev`}},[w,Bt]=_(b);var L=e=>{let{currentScript:t}=document,r={};if(!t)return{attributes:r,preventsLoad:!1};let o={preventsLoad:typeof t.getAttribute(b.preventLoad.key)=="string",attributes:r};for(let n in e){let i=t.getAttribute(e[n]);o.attributes[n]=i}return o};var K=({scriptAttributes:e,attributeKey:t,version:r,init:s})=>{var c;Z(),(c=window.fsAttributes)[t]||(c[t]={});let{preventsLoad:o,attributes:n}=L(e),i=window.fsAttributes[t];i.version=r,i.init=s,o||(window.Webflow||(window.Webflow=[]),window.Webflow.push(()=>s(n)))},Z=()=>{let e=tt();if(window.fsAttributes&&!Array.isArray(window.fsAttributes)){V(window.fsAttributes,e);return}let t={cms:{},push(...r){var s,o;for(let[n,i]of r)(o=(s=this[n])==null?void 0:s.loading)==null||o.then(i)},destroy(){var r,s;for(let o of e)(s=(r=window.fsAttributes[o])==null?void 0:r.destroy)==null||s.call(r)}};V(t,e),et(t),window.fsAttributes=t,window.FsAttributes=window.fsAttributes,M()},tt=()=>{let e=w("src","finsweet",{operator:"contains"}),t=w("dev");return[...document.querySelectorAll(`script${e}, script${t}`)].reduce((o,n)=>{var c;let i=n.getAttribute(b.dev.key)||((c=n.src.match(/[\w-. ]+(?=(\.js)$)/))==null?void 0:c[0]);return i&&!o.includes(i)&&o.push(i),o},[])},V=(e,t)=>{for(let r of t){if(e[r])continue;e[r]={};let s=e[r];s.loading=new Promise(o=>{s.resolve=n=>{o(n),delete s.resolve}})}},et=e=>{let t=Array.isArray(window.fsAttributes)?window.fsAttributes:[];e.push(...t)};var N="1.6.0";var ot=`fs-${E}`,st="list",nt="previous",it="previous-empty",ct="next",at="next-empty",lt={element:{key:`${ot}-element`,values:{list:st,previous:nt,previousEmpty:it,next:ct,nextEmpty:at}}},[O,x]=_(lt);var $=()=>{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 s=x("nextEmpty",{operator:"prefixed"});return s==null||s.remove(),{previousPlaceholder:e,nextPlaceholder:t,previousEmptyElement:r,nextEmptyElement:s}};var k=async()=>{let e=await P();if(!e)return[];await h(C);let t=!1,r=!1,s=e.createCMSListInstances([O("element","list",{operator:"prefixed"})]),o=()=>B(E,s,()=>{var u;for(let m of s)(u=m.destroy)==null||u.call(m)}),n=$();if(!n)return o();let{previousPlaceholder:i,nextPlaceholder:c,previousEmptyElement:l,nextEmptyElement:a}=n,{origin:f,pathname:T}=window.location,D=f+T,U=()=>(!i||i&&t)&&(!c||c&&r);for(let u of s){if(U())break;let m=R=>{if(U()){u.off("additems",m),u.wrapper.remove();return}let S=R.findIndex(({href:p})=>p&&y(p)===y(D));if(!(S<0)){if(i){let p=R[S-1];p&&!t?(l==null||l.remove(),i.appendChild(p.element),t=!0):l&&i.appendChild(l)}if(c){let p=R[S+1];p&&!r?(a==null||a.remove(),c.appendChild(p.element),r=!0):a&&c.appendChild(a)}}};u.on("additems",m),m(u.items),u.wrapper.style.display="none"}return o()};K({init:k,version:N,attributeKey:E});})(); |
{ | ||
"name": "@finsweet/attributes-cmsprevnext", | ||
"version": "1.5.1", | ||
"version": "1.6.0", | ||
"description": "Add Previous and Next buttons in Collection Template Pages.", | ||
@@ -31,15 +31,5 @@ "homepage": "https://www.finsweet.com/attributes", | ||
}, | ||
"devDependencies": { | ||
"@global/build": "1.0.0", | ||
"@global/tests": "1.0.0", | ||
"@global/types": "1.0.0" | ||
}, | ||
"dependencies": { | ||
"@finsweet/attributes-cmscore": "1.8.0", | ||
"@finsweet/ts-utils": "^0.33.1", | ||
"@global/constants": "1.2.0", | ||
"@global/factory": "1.1.5" | ||
}, | ||
"scripts": { | ||
"dev": "cross-env NODE_ENV=development node ./bin/build.js", | ||
"build:dev": "cross-env NODE_ENV=test node ./bin/build.js", | ||
"build": "cross-env NODE_ENV=production node ./bin/build.js", | ||
@@ -46,0 +36,0 @@ "lint": "eslint ./src && prettier --check ./src", |
12840
0
0
23
- Removed@finsweet/attributes-cmscore@1.8.0
- Removed@finsweet/ts-utils@^0.33.1
- Removed@global/constants@1.2.0
- Removed@global/factory@1.1.5
- Removed@finsweet/attributes-cmscore@1.8.0(transitive)
- Removed@finsweet/ts-utils@0.33.2(transitive)
- Removedemittery@0.11.0(transitive)