Socket
Socket
Sign inDemoInstall

@finsweet/attributes-cmscss

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@finsweet/attributes-cmscss - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

changesets.json

0

cmscss.js
(()=>{var p=(e,t,r)=>new Promise((n,s)=>{var m=o=>{try{i(r.next(o))}catch(c){s(c)}},a=o=>{try{i(r.throw(o))}catch(c){s(c)}},i=o=>o.done?n(o.value):Promise.resolve(o.value).then(m,a);i((r=r.apply(e,t)).next())});var u=class{static activateAlerts(){this.alertsActivated=!0}static alert(t,r){if(this.alertsActivated&&window.alert(t),r==="error")throw new Error(t)}};u.alertsActivated=!1;var A="fs-attributes",g={preventLoad:{key:`${A}-preventload`},debugMode:{key:`${A}-debug`}};var x=()=>{window.fsAttributes||(window.fsAttributes={cms:{}})},C=e=>{let{preventLoad:t,debugMode:r}=g,n=typeof(e==null?void 0:e.getAttribute(t.key))=="string";return typeof(e==null?void 0:e.getAttribute(r.key))=="string"&&u.activateAlerts(),{preventsLoad:n}},I=e=>t=>`${e}${t?`-${t}`:""}`,$=e=>(r,n,s)=>{let m=e[r],{key:a,values:i}=m,o;if(!n)return`[${a}]`;let c=i==null?void 0:i[n];if(typeof c=="string"?o=c:o=c(s&&"instanceIndex"in s?s.instanceIndex:void 0),!(s==null?void 0:s.operator))return`[${a}="${o}"]`;switch(s.operator){case"prefixed":return`[${a}^="${o}"]`;case"suffixed":return`[${a}$="${o}"]`;case"contains":return`[${a}*="${o}"]`}};var V="https://cdn.jsdelivr.net/npm/@finsweet/attributes-cmscore@1/cmscore.js";var l=()=>p(void 0,null,function*(){let{fsAttributes:e}=window;e.cms||(e.cms={});let{cms:t}=e;if(t.coreImport)return t.coreImport;try{let r=import(V);return t.coreImport=r,r.then(n=>{n&&(t.coreVersion||(t.coreVersion=n.version))}),r}catch(r){u.alert(`${r}`,"error");return}});var f="fs-cmscss",d={element:{key:`${f}-element`,values:{list:I("list")}},pseudo:{key:`${f}-pseudo`},class:{key:`${f}-class`}},w=$(d);var{pseudo:{key:b},class:{key:M}}=d,y=e=>{for(let{element:t}of e){let{attributes:r}=t;for(let{name:n}of r){if(!n.startsWith(b))continue;let s=n.split(`${b}-`)[1],m=`${b}${s?`-${s}`:""}`,a=`${M}${s?`-${s}`:""}`,i=t.getAttribute(m),o=t.getAttribute(a);if(!i||!o)continue;let c=i.replace(/^\:/,""),T=o.replace(/^\./,""),v=t.matches(`[${m}]:${c}`);t.classList[v?"add":"remove"](T)}}};var S=()=>p(void 0,null,function*(){let e=yield l();if(!e)return[];let t=e.createCMSListInstances([w("element","list",{operator:"prefixed"})]);return yield Promise.all(t.map(k)),t}),k=e=>p(void 0,null,function*(){let{items:t}=e;y(t),e.on("renderitems",r=>y(r))});x();var{currentScript:E}=document,{preventsLoad:h}=C(E);l();h?window.fsAttributes.cmscss={init:S}:(window.Webflow||(window.Webflow=[]),window.Webflow.push(S));})();

2

examples.json

@@ -1,1 +0,1 @@

[]
[]
{
"name": "@finsweet/attributes-cmscss",
"version": "1.1.1",
"version": "1.2.0",
"description": "Add CSS classes to Collection Item elements based on a media query.",

@@ -8,3 +8,5 @@ "main": "cmscss.js",

"cmscss.js",
"examples.json"
"examples.json",
"schema.json",
"changesets.json"
],

@@ -11,0 +13,0 @@ "type": "module",

# `cmscss` Attribute
Add CSS classes to Collection Item elements based on a media query.
## CDN Import
```html
<!-- [Attributes by Finsweet] CMS CSS -->
<script async src="https://cdn.jsdelivr.net/npm/@finsweet/attributes-cmscss@1/cmscss.js"></script>
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc