@finsweet/attributes-cmscss
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -1,1 +0,1 @@ | ||
(()=>{var N=Object.defineProperty;var U=(e,t,s)=>t in e?N(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var x=(e,t,s)=>(U(e,typeof t!="symbol"?t+"":t,s),s);var C="@finsweet/attributes-cmscore";var m=class{static activateAlerts(){this.alertsActivated=!0}static alert(t,s){if(this.alertsActivated&&window.alert(t),s==="error")throw new Error(t)}};x(m,"alertsActivated",!1);var L=`https://cdn.jsdelivr.net/npm/${C}@1/cmscore.js`,f=async()=>{let{fsAttributes:e}=window;e.cms||(e.cms={});let{cms:t}=e;if(t.coreImport)return t.coreImport;try{let s=import(L);return t.coreImport=s,s.then(i=>{i&&(t.coreVersion||(t.coreVersion=i.version))}),s}catch(s){m.alert(`${s}`,"error");return}};var l="fs-attributes";var D=`${l}-support`,O="https://cdn.jsdelivr.net/npm/@finsweet/attributes-support@1/support.js",I=async()=>{let{fsAttributes:e,location:t}=window,{host:s,searchParams:i}=new URL(t.href);if(!s.includes("webflow.io")||!i.has(D))return!1;if(e.supportImport)return e.supportImport;try{e.supportImport=new Promise((o,r)=>{let n=document.createElement("script");n.src=O,n.onload=()=>o(!0),n.onerror=r,document.head.append(n)})}catch(o){return!1}return e.supportImport};var T=e=>t=>`${e}${t?`-${t}`:""}`,w=e=>{let t=(i,o,r)=>{let n=e[i],{key:a,values:c}=n,u;if(!o)return`[${a}]`;let d=c==null?void 0:c[o];if(typeof d=="string"?u=d:u=d(r&&"instanceIndex"in r?r.instanceIndex:void 0),!(r!=null&&r.operator))return`[${a}="${u}"]`;switch(r.operator){case"prefixed":return`[${a}^="${u}"]`;case"suffixed":return`[${a}$="${u}"]`;case"contains":return`[${a}*="${u}"]`}};function s(i,o){let r=t("element",i,o),n=(o==null?void 0:o.scope)||document;return o!=null&&o.all?n.querySelectorAll(r):n.querySelector(r)}return[t,s]};var b={preventLoad:{key:`${l}-preventload`},debugMode:{key:`${l}-debug`},src:{key:"src",values:{finsweet:"@finsweet/attributes"}},dev:{key:`${l}-dev`}},[y,dt]=w(b);var v=()=>{let{currentScript:e}=document,{preventLoad:t,debugMode:s}=b,i=typeof(e==null?void 0:e.getAttribute(t.key))=="string";return typeof(e==null?void 0:e.getAttribute(s.key))=="string"&&m.activateAlerts(),{preventsLoad:i}};var k=()=>{if(window.fsAttributes&&!Array.isArray(window.fsAttributes))return;let e={cms:{},push(...t){var s,i;for(let[o,r]of t)(i=(s=this[o])==null?void 0:s.loading)==null||i.then(r)}};_(e),B(e),window.fsAttributes=e,window.FsAttributes=window.fsAttributes,I()},_=e=>{let t=y("src","finsweet",{operator:"contains"}),s=y("dev"),o=[...document.querySelectorAll(`script${t}, script${s}`)].reduce((r,n)=>{var c;let a=n.getAttribute(b.dev.key)||((c=n.src.match(/[\w-. ]+(?=(\.js)$)/))==null?void 0:c[0]);return a&&!r.includes(a)&&r.push(a),r},[]);for(let r of o){e[r]={};let n=e[r];n.loading=new Promise(a=>{n.resolve=c=>{a(c),delete n.resolve}})}},B=e=>{let t=Array.isArray(window.fsAttributes)?window.fsAttributes:[];e.push(...t)};var P="1.3.1";var p="cmscss",A=`fs-${p}`,S={element:{key:`${A}-element`,values:{list:T("list")}},pseudo:{key:`${A}-pseudo`},class:{key:`${A}-class`}},[$,vt]=w(S);var{pseudo:{key:E},class:{key:q}}=S,g=e=>{for(let{element:t}of e){let{attributes:s}=t;for(let{name:i}of s){if(!i.startsWith(E))continue;let o=i.split(`${E}-`)[1],r=`${E}${o?`-${o}`:""}`,n=`${q}${o?`-${o}`:""}`,a=t.getAttribute(r),c=t.getAttribute(n);if(!a||!c)continue;let u=a.replace(/^\:/,""),d=c.replace(/^\./,""),M=t.matches(`[${r}]:${u}`);t.classList[M?"add":"remove"](d)}}};var h=async()=>{var s,i;let e=await f();if(!e)return[];let t=e.createCMSListInstances([$("element","list",{operator:"prefixed"})]);return await Promise.all(t.map(W)),(i=(s=window.fsAttributes[p]).resolve)==null||i.call(s,t),t},W=async e=>{let{items:t}=e;g(t),e.on("renderitems",s=>g(s))};k();f();var V,R;(V=window.fsAttributes)[R=p]||(V[R]={});var{preventsLoad:X}=v(),K=window.fsAttributes[p];K.version=P;X?K.init=h:(window.Webflow||(window.Webflow=[]),window.Webflow.push(h));})(); | ||
(()=>{var N=Object.defineProperty;var U=(e,t,s)=>t in e?N(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var I=(e,t,s)=>(U(e,typeof t!="symbol"?t+"":t,s),s);var C="@finsweet/attributes-cmscore";var m=class{static activateAlerts(){this.alertsActivated=!0}static alert(t,s){if(this.alertsActivated&&window.alert(t),s==="error")throw new Error(t)}};I(m,"alertsActivated",!1);var L=`https://cdn.jsdelivr.net/npm/${C}@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 s=import(L);return t.coreImport=s,s.then(i=>{i&&(t.coreVersion||(t.coreVersion=i.version))}),s}catch(s){m.alert(`${s}`,"error");return}};var p="fs-attributes";var D=`${p}-support`,O="https://cdn.jsdelivr.net/npm/@finsweet/attributes-support@1/support.js",v=async()=>{let{fsAttributes:e,location:t}=window,{host:s,searchParams:i}=new URL(t.href);if(!s.includes("webflow.io")||!i.has(D))return!1;if(e.supportImport)return e.supportImport;try{e.supportImport=new Promise((o,r)=>{let n=document.createElement("script");n.src=O,n.onload=()=>o(!0),n.onerror=r,document.head.append(n)})}catch(o){return!1}return e.supportImport};var T=e=>t=>`${e}${t?`-${t}`:""}`,y=e=>{let t=(i,o,r)=>{let n=e[i],{key:a,values:c}=n,u;if(!o)return`[${a}]`;let f=c==null?void 0:c[o];typeof f=="string"?u=f:u=f(r&&"instanceIndex"in r?r.instanceIndex:void 0);let l=r&&"caseInsensitive"in r&&r.caseInsensitive?"i":"";if(!(r!=null&&r.operator))return`[${a}="${u}"${l}]`;switch(r.operator){case"prefixed":return`[${a}^="${u}"${l}]`;case"suffixed":return`[${a}$="${u}"${l}]`;case"contains":return`[${a}*="${u}"${l}]`}};function s(i,o){let r=t("element",i,o),n=(o==null?void 0:o.scope)||document;return o!=null&&o.all?n.querySelectorAll(r):n.querySelector(r)}return[t,s]};var w={preventLoad:{key:`${p}-preventload`},debugMode:{key:`${p}-debug`},src:{key:"src",values:{finsweet:"@finsweet/attributes"}},dev:{key:`${p}-dev`}},[A,dt]=y(w);var k=()=>{let{currentScript:e}=document,{preventLoad:t,debugMode:s}=w,i=typeof(e==null?void 0:e.getAttribute(t.key))=="string";return typeof(e==null?void 0:e.getAttribute(s.key))=="string"&&m.activateAlerts(),{preventsLoad:i}};var $=()=>{if(window.fsAttributes&&!Array.isArray(window.fsAttributes))return;let e={cms:{},push(...t){var s,i;for(let[o,r]of t)(i=(s=this[o])==null?void 0:s.loading)==null||i.then(r)}};_(e),B(e),window.fsAttributes=e,window.FsAttributes=window.fsAttributes,v()},_=e=>{let t=A("src","finsweet",{operator:"contains"}),s=A("dev"),o=[...document.querySelectorAll(`script${t}, script${s}`)].reduce((r,n)=>{var c;let a=n.getAttribute(w.dev.key)||((c=n.src.match(/[\w-. ]+(?=(\.js)$)/))==null?void 0:c[0]);return a&&!r.includes(a)&&r.push(a),r},[]);for(let r of o){e[r]={};let n=e[r];n.loading=new Promise(a=>{n.resolve=c=>{a(c),delete n.resolve}})}},B=e=>{let t=Array.isArray(window.fsAttributes)?window.fsAttributes:[];e.push(...t)};var P="1.3.2";var d="cmscss",S=`fs-${d}`,E={element:{key:`${S}-element`,values:{list:T("list")}},pseudo:{key:`${S}-pseudo`},class:{key:`${S}-class`}},[V,Tt]=y(E);var{pseudo:{key:g},class:{key:q}}=E,h=e=>{for(let{element:t}of e){let{attributes:s}=t;for(let{name:i}of s){if(!i.startsWith(g))continue;let o=i.split(`${g}-`)[1],r=`${g}${o?`-${o}`:""}`,n=`${q}${o?`-${o}`:""}`,a=t.getAttribute(r),c=t.getAttribute(n);if(!a||!c)continue;let u=a.replace(/^\:/,""),f=c.replace(/^\./,""),l=t.matches(`[${r}]:${u}`);t.classList[l?"add":"remove"](f)}}};var x=async()=>{var s,i;let e=await b();if(!e)return[];let t=e.createCMSListInstances([V("element","list",{operator:"prefixed"})]);return await Promise.all(t.map(W)),(i=(s=window.fsAttributes[d]).resolve)==null||i.call(s,t),t},W=async e=>{let{items:t}=e;h(t),e.on("renderitems",s=>h(s))};$();b();var R,K;(R=window.fsAttributes)[K=d]||(R[K]={});var{preventsLoad:X}=k(),M=window.fsAttributes[d];M.version=P;X?M.init=x:(window.Webflow||(window.Webflow=[]),window.Webflow.push(x));})(); |
{ | ||
"name": "@finsweet/attributes-cmscss", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "Add CSS classes to Collection Item elements based on a media query.", | ||
@@ -38,3 +38,3 @@ "homepage": "https://www.finsweet.com/attributes", | ||
"@finsweet/attributes-cmscore": "1.6.7", | ||
"@global/factory": "1.1.0", | ||
"@global/factory": "1.1.1", | ||
"@global/constants": "1.0.0" | ||
@@ -41,0 +41,0 @@ }, |
6630
16
Updated@global/factory@1.1.1