@finsweet/attributes-cmscss
Advanced tools
Comparing version 1.4.1 to 1.5.0
@@ -1,1 +0,1 @@ | ||
[{"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 'cmscss',\n (cmsLists) => {\n console.log('Attribute has successfully loaded!');\n console.log(cmsLists);\n },\n ]);\n</script>\n```\n"},{"version":"v1.2.0","date":"29 November 2021","markdown":"- Created `changesets.json` API.\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.2","date":"16 November 2021","markdown":"- Updated `cmscore` import.\n"},{"version":"v1.0.1","date":"16 November 2021","markdown":"- Updated `cmscore` import.\n"},{"version":"v1.0.0","date":"14 November 2021","markdown":"- Created the attribute package.\n"}] | ||
[{"version":"1.5.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.4.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.4.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.3.7","markdown":"- Updated dependencies [d8a4bf6f]\n - @finsweet/attributes-cmscore@1.7.1"},{"version":"1.3.6","markdown":"- Updated dependencies [ef56d454]\n - @finsweet/attributes-cmscore@1.7.0"},{"version":"1.3.5","markdown":"- Updated dependencies [299fd136]\n - @finsweet/attributes-cmscore@1.6.10"},{"version":"1.3.4","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.3.3","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.3.2","markdown":"- Updated dependencies [13c3e23]\n - @global/factory@1.1.1\n - @finsweet/attributes-cmscore@1.6.7"},{"version":"1.3.1","markdown":"- Updated dependencies [627bf25]\n - @global/factory@1.1.0\n - @finsweet/attributes-cmscore@1.6.7"},{"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 'cmscss',\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.1","markdown":"- Fixed `examples.json` not being available on NPM."},{"version":"1.1.0","markdown":"- Added support for `cmscore` versioning."},{"version":"1.0.2","markdown":"- Updated `cmscore` import."},{"version":"1.0.1","markdown":"- Updated `cmscore` import."},{"version":"1.0.0","markdown":"- Created the attribute package."}] |
@@ -1,1 +0,1 @@ | ||
"use strict";(()=>{var O=Object.create;var E=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var K=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var D=(e,t,r)=>t in e?E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var F=(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 j=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of V(t))!N.call(e,s)&&s!==r&&E(e,s,{get:()=>t[s],enumerable:!(n=k(t,s))||n.enumerable});return e};var q=(e,t,r)=>(r=e!=null?O(K(e)):{},j(t||!e||!e.__esModule?E(r,"default",{value:e,enumerable:!0}):r,e));var C=(e,t,r)=>(D(e,typeof t!="symbol"?t+"":t,r),r);var p=class{static activateAlerts(){this.alertsActivated=!0}static alert(t,r){if(this.alertsActivated&&window.alert(t),r==="error")throw new Error(t)}};C(p,"alertsActivated",!1);var b=async()=>{let{fsAttributes:e}=window;e.cms||(e.cms={});let{cms:t}=e;if(t.coreImport)return t.coreImport;try{let r=import("https://cdn.jsdelivr.net/npm/@finsweet/attributes-cmscore@1/cmscore.js");return t.coreImport=r,r.then(n=>{n&&(t.coreVersion||(t.coreVersion=n.version))}),r}catch(r){p.alert(`${r}`,"error");return}};var l="fs-attributes";var _="cmsattribute";var G=`${l}-support`,H="https://cdn.jsdelivr.net/npm/@finsweet/attributes-support@1/support.js",U=async()=>{let{fsAttributes:e,location:t}=window,{host:r,searchParams:n}=new URL(t.href);if(!r.includes("webflow.io")||!n.has(G))return!1;if(e.supportImport)return e.supportImport;try{e.supportImport=new Promise((s,o)=>{let i=document.createElement("script");i.src=H,i.onload=()=>s(!0),i.onerror=o,document.head.append(i)})}catch(s){return!1}return e.supportImport};var g=e=>t=>`${e}${t?`-${t}`:""}`,f=e=>{let t=(n,s,o)=>{let i=e[n],{key:c,values:a}=i,u;if(!s)return`[${c}]`;let A=a==null?void 0:a[s];typeof A=="string"?u=A:u=A(o&&"instanceIndex"in o?o.instanceIndex:void 0);let m=o&&"caseInsensitive"in o&&o.caseInsensitive?"i":"";if(!(o!=null&&o.operator))return`[${c}="${u}"${m}]`;switch(o.operator){case"prefixed":return`[${c}^="${u}"${m}]`;case"suffixed":return`[${c}$="${u}"${m}]`;case"contains":return`[${c}*="${u}"${m}]`}};function r(n,s){let o=t("element",n,s),i=(s==null?void 0:s.scope)||document;return s!=null&&s.all?i.querySelectorAll(o):i.querySelector(o)}return[t,r]};var d={preventLoad:{key:`${l}-preventload`},debugMode:{key:`${l}-debug`},src:{key:"src",values:{finsweet:"@finsweet/attributes"}},dev:{key:`${l}-dev`}},[S,ft]=f(d);var B=e=>{let{currentScript:t}=document,r={};if(!t)return{attributes:r,preventsLoad:!1};let s={preventsLoad:typeof t.getAttribute(d.preventLoad.key)=="string",attributes:r};for(let o in e){let i=t.getAttribute(e[o]);s.attributes[o]=i}return s};var h=()=>{if(window.fsAttributes&&!Array.isArray(window.fsAttributes))return;let e={cms:{},push(...t){var r,n;for(let[s,o]of t)(n=(r=this[s])==null?void 0:r.loading)==null||n.then(o)}};X(e),W(e),window.fsAttributes=e,window.FsAttributes=window.fsAttributes,U()},X=e=>{let t=S("src","finsweet",{operator:"contains"}),r=S("dev"),s=[...document.querySelectorAll(`script${t}, script${r}`)].reduce((o,i)=>{var a;let c=i.getAttribute(d.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){e[o]={};let i=e[o];i.loading=new Promise(c=>{i.resolve=a=>{c(a),delete i.resolve}})}},W=e=>{let t=Array.isArray(window.fsAttributes)?window.fsAttributes:[];e.push(...t)};var M="1.4.1";var T="cmscss",I=`fs-${T}`,y={element:{key:`${I}-element`,values:{list:g("list")}},pseudo:{key:`${I}-pseudo`},class:{key:`${I}-class`}},[v,ht]=f(y);var{pseudo:{key:x},class:{key:Q}}=y,w=e=>{for(let{element:t}of e){let{attributes:r}=t;for(let{name:n}of r){if(!n.startsWith(x))continue;let s=n.split(`${x}-`)[1],o=`${x}${s?`-${s}`:""}`,i=`${Q}${s?`-${s}`:""}`,c=t.getAttribute(o),a=t.getAttribute(i);if(!c||!a)continue;let u=c.replace(/^\:/,""),A=a.replace(/^\./,""),m=t.matches(`[${o}]:${u}`);t.classList[m?"add":"remove"](A)}}};var R=async()=>{var r,n,s;let e=await b();if(!e)return[];await((r=window.fsAttributes[_])==null?void 0:r.loading);let t=e.createCMSListInstances([v("element","list",{operator:"prefixed"})]);return await Promise.all(t.map(z)),(s=(n=window.fsAttributes[T]).resolve)==null||s.call(n,t),t},z=async e=>{let{items:t}=e;w(t),e.on("renderitems",r=>w(r))};h();b();var P,$;(P=window.fsAttributes)[$=T]||(P[$]={});var{preventsLoad:J}=B(),L=window.fsAttributes[T];L.version=M;J?L.init=R:(window.Webflow||(window.Webflow=[]),window.Webflow.push(R));})(); | ||
"use strict";(()=>{var $=Object.create;var f=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var F=(e,t,r)=>t in e?f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var j=(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 q=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of k(t))!D.call(e,s)&&s!==r&&f(e,s,{get:()=>t[s],enumerable:!(o=O(t,s))||o.enumerable});return e};var G=(e,t,r)=>(r=e!=null?$(N(e)):{},q(t||!e||!e.__esModule?f(r,"default",{value:e,enumerable:!0}):r,e));var _=(e,t,r)=>(F(e,typeof t!="symbol"?t+"":t,r),r);var p="fs-attributes";var w="cmsattribute";var m="cmscss";var C=async(...e)=>{var r;let t=[];for(let o of e){let s=await((r=window.fsAttributes[o])==null?void 0:r.loading);t.push(s)}return t};var T=class{static activateAlerts(){this.alertsActivated=!0}static alert(t,r){if(this.alertsActivated&&window.alert(t),r==="error")throw new Error(t)}};_(T,"alertsActivated",!1);var E=()=>{};function U(e,t,r){var s;let o=window.fsAttributes[e];return o.destroy=r||E,(s=o.resolve)==null||s.call(o,t),t}var g=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){T.alert(`${r}`,"error");return}};var H=`${p}-support`,X="https://cdn.jsdelivr.net/npm/@finsweet/attributes-support@1/support.js",v=async()=>{let{fsAttributes:e,location:t}=window,{host:r,searchParams:o}=new URL(t.href);e.support||(e.support={});let{support:s}=e;if(!r.includes("webflow.io")||!o.has(H))return!1;if(s.import)return s.import;try{s.import=new Promise((i,n)=>{let c=document.createElement("script");c.src=X,c.onload=()=>i(!0),c.onerror=n,document.head.append(c)})}catch(i){return!1}return s.import};var B=e=>t=>`${e}${t?`-${t}`:""}`,b=e=>{let t=(o,s,i)=>{let n=e[o],{key:c,values:u}=n,a;if(!s)return`[${c}]`;let A=u==null?void 0:u[s];typeof A=="string"?a=A:a=A(i&&"instanceIndex"in i?i.instanceIndex:void 0);let l=i&&"caseInsensitive"in i&&i.caseInsensitive?"i":"";if(!(i!=null&&i.operator))return`[${c}="${a}"${l}]`;switch(i.operator){case"prefixed":return`[${c}^="${a}"${l}]`;case"suffixed":return`[${c}$="${a}"${l}]`;case"contains":return`[${c}*="${a}"${l}]`}};function r(o,s){let i=t("element",o,s),n=(s==null?void 0:s.scope)||document;return s!=null&&s.all?[...n.querySelectorAll(i)]:n.querySelector(i)}return[t,r]};var d={preventLoad:{key:`${p}-preventload`},debugMode:{key:`${p}-debug`},src:{key:"src",values:{finsweet:"@finsweet/attributes"}},dev:{key:`${p}-dev`}},[S,St]=b(d);var h=e=>{let{currentScript:t}=document,r={};if(!t)return{attributes:r,preventsLoad:!1};let s={preventsLoad:typeof t.getAttribute(d.preventLoad.key)=="string",attributes:r};for(let i in e){let n=t.getAttribute(e[i]);s.attributes[i]=n}return s};var V=({scriptAttributes:e,attributeKey:t,version:r,init:o})=>{var c;Y(),(c=window.fsAttributes)[t]||(c[t]={});let{preventsLoad:s,attributes:i}=h(e),n=window.fsAttributes[t];n.version=r,n.init=o,s||(window.Webflow||(window.Webflow=[]),window.Webflow.push(()=>o(i)))},Y=()=>{let e=z();if(window.fsAttributes&&!Array.isArray(window.fsAttributes)){P(window.fsAttributes,e);return}let t={cms:{},push(...r){var o,s;for(let[i,n]of r)(s=(o=this[i])==null?void 0:o.loading)==null||s.then(n)},destroy(){var r,o;for(let s of e)(o=(r=window.fsAttributes[s])==null?void 0:r.destroy)==null||o.call(r)}};P(t,e),W(t),window.fsAttributes=t,window.FsAttributes=window.fsAttributes,v()},z=()=>{let e=S("src","finsweet",{operator:"contains"}),t=S("dev");return[...document.querySelectorAll(`script${e}, script${t}`)].reduce((s,i)=>{var c;let n=i.getAttribute(d.dev.key)||((c=i.src.match(/[\w-. ]+(?=(\.js)$)/))==null?void 0:c[0]);return n&&!s.includes(n)&&s.push(n),s},[])},P=(e,t)=>{for(let r of t){if(e[r])continue;e[r]={};let o=e[r];o.loading=new Promise(s=>{o.resolve=i=>{s(i),delete o.resolve}})}},W=e=>{let t=Array.isArray(window.fsAttributes)?window.fsAttributes:[];e.push(...t)};var M="1.5.0";var y=`fs-${m}`,x={element:{key:`${y}-element`,values:{list:B("list")}},pseudo:{key:`${y}-pseudo`},class:{key:`${y}-class`}},[K,Bt]=b(x);var{pseudo:{key:R},class:{key:J}}=x,I=e=>{for(let{element:t}of e){let{attributes:r}=t;for(let{name:o}of r){if(!o.startsWith(R))continue;let s=o.split(`${R}-`)[1],i=`${R}${s?`-${s}`:""}`,n=`${J}${s?`-${s}`:""}`,c=t.getAttribute(i),u=t.getAttribute(n);if(!c||!u)continue;let a=c.replace(/^\:/,""),A=u.replace(/^\./,""),l=t.matches(`[${i}]:${a}`);t.classList[l?"add":"remove"](A)}}};var L=async()=>{let e=await g();if(!e)return[];await C(w);let t=e.createCMSListInstances([K("element","list",{operator:"prefixed"})]);return await Promise.all(t.map(Z)),U(m,t,()=>{var r;for(let o of t)(r=o.destroy)==null||r.call(o)})},Z=async e=>{let{items:t}=e;I(t),e.on("renderitems",r=>I(r))};V({init:L,version:M,attributeKey:m});})(); |
{ | ||
"name": "@finsweet/attributes-cmscss", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"description": "Add CSS classes to Collection Item elements based on a media query.", | ||
@@ -31,14 +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", | ||
"@global/factory": "1.1.5", | ||
"@global/constants": "1.2.0" | ||
}, | ||
"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", | ||
@@ -45,0 +36,0 @@ "lint": "eslint ./src && prettier --check ./src", |
9614
0
0
21
- Removed@finsweet/attributes-cmscore@1.8.0
- 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)