From 324e9d865a38e35e3a93960bc02a212f2ca8e7c7 Mon Sep 17 00:00:00 2001 From: Marius Sarca Date: Thu, 14 Apr 2022 23:11:15 +0300 Subject: [PATCH] Allow alias overwrite & added clip-path alias --- dist/assembler.cjs.js | 7 ++++--- dist/assembler.es.js | 7 ++++--- dist/assembler.js | 7 ++++--- dist/assembler.min.js | 2 +- package.json | 2 +- src/helpers.ts | 6 +++--- src/list.ts | 1 + types/list.d.ts | 1 + 8 files changed, 19 insertions(+), 14 deletions(-) diff --git a/dist/assembler.cjs.js b/dist/assembler.cjs.js index 06d4a19..5476f5f 100644 --- a/dist/assembler.cjs.js +++ b/dist/assembler.cjs.js @@ -188,6 +188,7 @@ const PROPERTY_VARIANTS = { "background-clip": ["-webkit-background-clip", "-moz-background-clip"], "backdrop-filter": ["-webkit-backdrop-filter"], "box-orient": ["-webkit-box-orient"], + "clip-path": ["-webkit-clip-path"], "column-gap": ["-moz-column-gap"], "line-clamp": ["-webkit-line-clamp"], "user-select": ["-webkit-user-select", "-moz-user-select"], @@ -774,9 +775,9 @@ function getUserSettings(dataset) { const prop = registeredProperties[i]; if (PROPERTY_LIST.indexOf(prop.name) === -1) { PROPERTY_LIST.push(prop.name); - if (prop.aliases.length > 0) { - PROPERTY_VARIANTS[prop.name] = prop.aliases; - } + } + if (prop.aliases.length > 0) { + PROPERTY_VARIANTS[prop.name] = prop.aliases; } } // Consider all bp diff --git a/dist/assembler.es.js b/dist/assembler.es.js index 8173ec9..722ed1d 100644 --- a/dist/assembler.es.js +++ b/dist/assembler.es.js @@ -184,6 +184,7 @@ const PROPERTY_VARIANTS = { "background-clip": ["-webkit-background-clip", "-moz-background-clip"], "backdrop-filter": ["-webkit-backdrop-filter"], "box-orient": ["-webkit-box-orient"], + "clip-path": ["-webkit-clip-path"], "column-gap": ["-moz-column-gap"], "line-clamp": ["-webkit-line-clamp"], "user-select": ["-webkit-user-select", "-moz-user-select"], @@ -770,9 +771,9 @@ function getUserSettings(dataset) { const prop = registeredProperties[i]; if (PROPERTY_LIST.indexOf(prop.name) === -1) { PROPERTY_LIST.push(prop.name); - if (prop.aliases.length > 0) { - PROPERTY_VARIANTS[prop.name] = prop.aliases; - } + } + if (prop.aliases.length > 0) { + PROPERTY_VARIANTS[prop.name] = prop.aliases; } } // Consider all bp diff --git a/dist/assembler.js b/dist/assembler.js index f837e5e..ffc2c69 100644 --- a/dist/assembler.js +++ b/dist/assembler.js @@ -190,6 +190,7 @@ "background-clip": ["-webkit-background-clip", "-moz-background-clip"], "backdrop-filter": ["-webkit-backdrop-filter"], "box-orient": ["-webkit-box-orient"], + "clip-path": ["-webkit-clip-path"], "column-gap": ["-moz-column-gap"], "line-clamp": ["-webkit-line-clamp"], "user-select": ["-webkit-user-select", "-moz-user-select"], @@ -776,9 +777,9 @@ const prop = registeredProperties[i]; if (PROPERTY_LIST.indexOf(prop.name) === -1) { PROPERTY_LIST.push(prop.name); - if (prop.aliases.length > 0) { - PROPERTY_VARIANTS[prop.name] = prop.aliases; - } + } + if (prop.aliases.length > 0) { + PROPERTY_VARIANTS[prop.name] = prop.aliases; } } // Consider all bp diff --git a/dist/assembler.min.js b/dist/assembler.min.js index f608eb5..d2556c6 100644 --- a/dist/assembler.min.js +++ b/dist/assembler.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).AssemblerCSS={})}(this,(function(e){"use strict";const t=/^[0-9]+(\.5)?$/,r=/^-?[0-9]+(\.5)?$/,o=/^(xs|sm|base|lg|([2-9])?xl)$/,i=/^(none|tight|snug|normal|relaxed|loose)$/,s=/^[0-9]|1[0-9]|2[0-4]$/,n=/^[1-6]$/,a=/^(tighter|tight|normal|wide|wider|widest)$/,l=/^(xs|sm|md|lg|xl|pill)$/,p=/^(first|last|none)$/,c=["align-content","align-items","align-self","animation","appearance","backdrop-filter","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-position","background-repeat","background-size","backface-visibility","border","border-bottom","border-bottom-color","border-bottom-style","border-bottom-width","border-bottom-left-radius","border-bottom-right-radius","border-collapse","border-color","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-style","border-top","border-top-color","border-top-style","border-top-width","border-top-left-radius","border-top-right-radius","border-width","bottom","box-orient","box-shadow","box-sizing","clear","clip","clip-path","color","column-gap","content","cursor","display","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","font-family","font-size","font-style","font-weight","font-variant-numeric","gap","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","height","isolation","justify-content","justify-items","justify-self","left","letter-spacing","line-break","line-clamp","line-height","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","max-height","max-width","min-height","min-width","object-fit","object-position","opacity","order","outline","outline-offset","overflow","overflow-wrap","overflow-x","overflow-y","overscroll-behavior","overscroll-behavior-x","overscroll-behavior-y","padding","padding-bottom","padding-left","padding-right","padding-top","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","resize","right","row-gap","table-layout","text-align","text-decoration","text-decoration-style","text-fill-color","text-overflow","text-shadow","text-transform","top","transform","transform-box","transform-origin","transform-style","transition","user-select","vertical-align","visibility","white-space","width","word-break","z-index"],d={animation:["-webkit-animation"],appearance:["-webkit-appearance","-moz-appearance"],"background-clip":["-webkit-background-clip","-moz-background-clip"],"backdrop-filter":["-webkit-backdrop-filter"],"box-orient":["-webkit-box-orient"],"column-gap":["-moz-column-gap"],"line-clamp":["-webkit-line-clamp"],"user-select":["-webkit-user-select","-moz-user-select"],"text-fill-color":["-webkit-text-fill-color","-moz-text-fill-color"]},x=["normal","link","visited","empty","placeholder-shown","default","checked","indeterminate","valid","invalid","required","optional","out-of-range","in-range","hover","focus","focus-within","focus-visible","active","read-only","read-write","disabled","enabled"],m={backdrop:"backdrop-filter",bg:"background","bg-attachment":"background-attachment","bg-blend":"background-blend-mode","bg-clip":"background-clip","bg-color":"background-color","bg-image":"background-image","bg-position":"background-position","bg-repeat":"background-repeat","bg-size":"background-size",radius:"border-radius","radius-top":["border-top-left-radius","border-top-right-radius"],"radius-bottom":["border-bottom-left-radius","border-bottom-right-radius"],"radius-left":["border-bottom-left-radius","border-top-left-radius"],"radius-right":["border-bottom-right-radius","border-top-right-radius"],"radius-bl":"border-bottom-left-radius","radius-br":"border-bottom-right-radius","radius-tl":"border-top-left-radius","radius-tr":"border-top-right-radius",b:"border",bc:"border-color",bs:"border-style",bw:"border-width",bt:"border-top",bl:"border-left",br:"border-right",bb:"border-bottom","bt-color":"border-top-color","bt-style":"border-top-style","bt-width":"border-top-width","bl-color":"border-left-color","bl-style":"border-left-style","bl-width":"border-left-width","br-color":"border-right-color","br-style":"border-right-style","br-width":"border-right-width","bb-color":"border-bottom-color","bb-style":"border-bottom-style","bb-width":"border-bottom-width",m:"margin",mt:"margin-top",mb:"margin-bottom",ml:"margin-left",mr:"margin-right",mx:["margin-left","margin-right"],my:["margin-top","margin-bottom"],p:"padding",pt:"padding-top",pb:"padding-bottom",pl:"padding-left",pr:"padding-right",px:["padding-left","padding-right"],py:["padding-top","padding-bottom"],"min-w":"min-width","max-w":"max-width","min-h":"min-height","max-h":"max-height",w:"width",h:"height",img:"background-image",gradient:"background-image","radial-gradient":"background-image","conic-gradient":"background-image","flex-dir":"flex-direction","col-reverse":"flex-direction","row-reverse":"flex-direction","grid-rows":"grid-template-rows","grid-flow":"grid-auto-flow","row-start":"grid-row-start","row-span":"grid-row-end","grid-cols":"grid-template-columns","col-start":"grid-column-start","col-span":"grid-column-end","col-gap":"column-gap","auto-cols":"grid-auto-columns","auto-rows":"grid-auto-rows",e:"box-shadow",shadow:"box-shadow",overscroll:"overscroll-behavior","overscroll-x":"overscroll-behavior-x","overscroll-y":"overscroll-behavior-y",inset:["top","bottom","left","right"],"inset-x":["left","right"],"inset-y":["top","bottom"],z:"z-index",decoration:"text-decoration","v-align":"vertical-align",ws:"white-space",ring:"box-shadow",leading:"line-height",tracking:"letter-spacing",break:e=>"words"===e?["overflow-wrap"]:"all"===e?["word-break"]:["overflow-wrap","word-break"],truncate:["overflow","text-overflow","white-space"],flex:e=>e?"flex":"display","inline-flex":"display",grid:"display","inline-grid":"display",hidden:"display",block:"display","inline-block":"display",static:"position",fixed:"position",absolute:"position",relative:"position",sticky:"position",visible:"visibility",invisible:"visibility","flex-row":"flex-direction","flex-col":"flex-direction",list:e=>"inside"===e||"outside"===e?"list-style-position":"list-style-type",text:e=>o.test(e)?["font-size","line-height"]:"font-size",uppercase:"text-transform",lowercase:"text-transform",capitalize:"text-transform","normal-case":"text-transform",variant:"font-variant-numeric"},u={border:["1px solid transparent"],truncate:["hidden","ellipsis","nowrap"],flex:"flex","inline-flex":"inline-flex",grid:"grid","inline-grid":"inline-grid",hidden:"none",block:"block","inline-block":"inline-block",static:"static",fixed:"fixed",absolute:"absolute",relative:"relative",sticky:"sticky",visible:"visible",invisible:"hidden","flex-row":"row","flex-col":"column","flex-wrap":"wrap","flex-grow":"1","flex-shrink":"1","col-reverse":"column-reverse","row-reverse":"row-reverse",uppercase:"uppercase",lowercase:"lowercase",capitalize:"capitalize","normal-case":"none",radius:"sm",shadow:"1"},b=e=>r.test(e)?`calc(${e} * @unit-size)`:e,g=e=>t.test(e)?`calc(${e} * @unit-size)`:e,h=e=>`repeat(${e}, minmax(0, 1fr))`,f=e=>`span ${e}`,w=e=>l.test(e)?"@border-radius-"+e:e,y={img:e=>`url(${e})`,gradient:e=>`linear-gradient(${e})`,"radial-gradient":e=>`radial-gradient(${e})`,"conic-gradient":e=>`conic-gradient(${e})`,"grid-rows":h,"row-span":f,"grid-cols":h,"col-span":f,e:e=>s.test(e)?`@elevation-${e}`:e,shadow:e=>n.test(e)?`@shadow-${e}`:e,ring:e=>`0 0 0 ${e}`,"font-size":e=>o.test(e)?"@font-size-"+e:e,leading:e=>t.test(e)?`calc(${e} * @unit-size)`:i.test(e)?"@line-height-"+e:e,tracking:e=>a.test(e)?"@letter-spacing-"+e:e,text:e=>o.test(e)?["@font-size-"+e,"@font-size-leading-"+e]:e,radius:w,"radius-top":w,"radius-left":w,"radius-bottom":w,"radius-right":w,"radius-tl":w,"radius-bl":w,"radius-tr":w,"radius-br":w,"border-radius":w,break:e=>"all"===e?"break-all":"words"===e?"break-word":["normal","normal"],"flex-wrap":e=>"reverse"===e?"wrap-reverse":e,"flex-row":e=>"reverse"===e?"row-reverse":e,"flex-col":e=>"reverse"===e?"column-reverse":e,order:e=>p.test(e)?"first"===e?"-9999":"last"===e?"9999":"0":e,padding:g,"padding-top":g,"padding-bottom":g,"padding-left":g,"padding-right":g,p:g,pt:g,pb:g,pl:g,pr:g,px:g,py:g,margin:b,"margin-top":b,"margin-bottom":b,"margin-left":b,"margin-right":b,m:b,mt:b,mb:b,ml:b,mr:b,mx:b,my:b,w:g,h:g,width:g,height:g,"min-w":g,"max-w":g,"min-h":g,"max-h":g,"min-width":g,"max-width":g,"min-height":g,"max-height":g},v=["0px 0px 0px 0px","0px 2px 1px -1px","0px 3px 1px -2px","0px 3px 3px -2px","0px 2px 4px -1px","0px 3px 5px -1px","0px 3px 5px -1px","0px 4px 5px -2px","0px 5px 5px -3px","0px 5px 6px -3px","0px 6px 6px -3px","0px 6px 7px -4px","0px 7px 8px -4px","0px 7px 8px -4px","0px 7px 9px -4px","0px 8px 9px -5px","0px 8px 10px -5px","0px 8px 11px -5px","0px 9px 11px -5px","0px 9px 12px -6px","0px 10px 13px -6px","0px 10px 13px -6px","0px 10px 14px -6px","0px 11px 14px -7px","0px 11px 15px -7px"],k=["0px 0px 0px 0px","0px 1px 1px 0px","0px 2px 2px 0px","0px 3px 4px 0px","0px 4px 5px 0px","0px 5px 8px 0px","0px 6px 10px 0px","0px 7px 10px 1px","0px 8px 10px 1px","0px 9px 12px 1px","0px 10px 14px 1px","0px 11px 15px 1px","0px 12px 17px 2px","0px 13px 19px 2px","0px 14px 21px 2px","0px 15px 22px 2px","0px 16px 24px 2px","0px 17px 26px 2px","0px 18px 28px 2px","0px 19px 29px 2px","0px 20px 31px 3px","0px 21px 33px 3px","0px 22px 35px 3px","0px 23px 36px 3px","0px 24px 38px 3px"],$=["0px 0px 0px 0px","0px 1px 3px 0px","0px 1px 5px 0px","0px 1px 8px 0px","0px 1px 10px 0px","0px 1px 14px 0px","0px 1px 18px 0px","0px 2px 16px 1px","0px 3px 14px 2px","0px 3px 16px 2px","0px 4px 18px 3px","0px 4px 20px 3px","0px 5px 22px 4px","0px 5px 24px 4px","0px 5px 26px 4px","0px 6px 28px 5px","0px 6px 30px 5px","0px 6px 32px 5px","0px 7px 34px 6px","0px 7px 36px 6px","0px 8px 38px 7px","0px 8px 40px 7px","0px 8px 42px 7px","0px 9px 44px 8px","0px 9px 46px 8px"],S={none:"0",xs:"0.125rem",sm:"0.25rem",md:"0.5rem",lg:"0.75rem",xl:"1rem",pill:"9999px"},A={tighter:"-0.05rem",tight:"-0.025rem",normal:"0",wide:"0.025rem",wider:"0.05rem",widest:"0.1rem"},z={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2"},O={xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem","5xl":"3rem","6xl":"3.75rem","7xl":"4.5rem","8xl":"6rem","9xl":"8rem"},E={xs:"1rem",sm:"1.25rem",base:"1.5rem",lg:"1.75rem",xl:"1.75rem","2xl":"2rem","3xl":"2.25rem","4xl":"2.5rem","5xl":"1","6xl":"1","7xl":"1","8xl":"1","9xl":"1"},j={"sans-serif":"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol",serif:"Georgia, Cambria, Times New Roman, Times, serif",monospace:"Lucida Console, Monaco, monospace"},C=["0px 2px 4px 0px hsla(0, 0%, 20%, 0.1), 0px 6px 6px -8px hsla(0, 0%, 0%, 15%)","0px 2px 8px -1px hsla(0, 0%, 20%, 0.1), 0px 16px 16px -12px hsla(0, 0%, 0%, 15%)","0px 2px 16px -2px hsla(0, 0%, 20%, 0.1), 0px 22px 18px -16px hsla(0, 0%, 0%, 15%)","0px 2px 20px -3px hsla(0, 0%, 20%, 0.1), 0px 28px 22px -18px hsla(0, 0%, 0%, 15%)","0px 2px 32px -2px hsla(0, 0%, 20%, 0.1), 0px 32px 26px -18px hsla(0, 0%, 0%, 15%)","0px 2px 36px -1px hsla(0, 0%, 20%, 0.1), 0px 42px 34px -24px hsla(0, 0%, 0%, 15%)"];function P(e){let t="--elevation-umbra: rgba(0, 0, 0, .2);--elevation-penumbra: rgba(0, 0, 0, .14);--elevation-ambient: rgba(0, 0, 0, .12);";for(let e=0;e<25;e++)t+=`--elevation-${e}:${v[e]} var(--elevation-umbra), ${k[e]} var(--elevation-penumbra), ${$[e]} var(--elevation-ambient);`;for(let e=0;e<6;e++)t+=`--shadow-${e+1}:${C[e]};`;for(const[e,r]of Object.entries(S))t+=`--border-radius-${e}:${r};`;for(const[e,r]of Object.entries(A))t+=`--letter-spacing-${e}:${r};`;for(const[e,r]of Object.entries(z))t+=`--line-height-${e}:${r};`;for(const[e,r]of Object.entries(j))t+=`--${e}:${r};`;for(const[e,r]of Object.entries(O))t+=`--font-size-${e}:${r};`;for(const[e,r]of Object.entries(E))t+=`--font-size-leading-${e}:${r};`;for(const r of e.breakpoints)"all"!==r&&(t+=`--breakpoint-${r}: ${e.media[r]};`);return t+="--unit-size:0.25rem;",":root{"+t+"}"}const R=/\\\n/g,I=/^--([a-zA-Z0-9-_]+)--(scope|mixin|register)$/;const M=new class{constructor(){this.cache=new Map,this.scopes=["","text-clip","selection","placeholder","before","after","first-letter","first-line","l1","l2","marker-l1","marker","sibling","child","even","odd","first","last","dark","light","landscape","portrait","motion-reduce","motion-safe"],this.registeredProperties=[];const{cache:e}=this;e.set("--text-clip--scope","$selector {-webkit-background-clip: text !important;-moz-background-clip:text !important;background-clip:text !important;}"),e.set("--l1--scope","$selector > * {$body}"),e.set("--l2--scope","$selector > * > * {$body}"),e.set("--sibling--scope","$selector > * + * {$body}"),e.set("--child--scope","$selector > $class {$body}"),e.set("--selection--scope","$selector::selection {$body}"),e.set("--placeholder--scope","$selector::placeholder {$body}"),e.set("--marker--scope","$selector::marker {$body}"),e.set("--marker-l1--scope","$selector > *::marker {$body}"),e.set("--before--scope","$selector::before {$body}"),e.set("--after--scope","$selector::after {$body}"),e.set("--even--scope","$selector:nth-child(even) {$body}"),e.set("--odd--scope","$selector:nth-child(odd) {$body}"),e.set("--first--scope","$selector:first-child {$body}"),e.set("--last--scope","$selector:last-child {$body}"),e.set("--first-letter--scope","$selector::first-letter {$body}"),e.set("--first-line--scope","$selector::first-line {$body}"),e.set("--dark--scope","@media(prefers-color-scheme: dark) {$selector {$body}}"),e.set("--light--scope","@media(prefers-color-scheme: light) {$selector {$body}}"),e.set("--landscape--scope","@media(orientation: landscape) {$selector {$body}}"),e.set("--portrait--scope","@media(orientation: portrait) {$selector {$body}}"),e.set("--motion-reduce--scope","@media(prefers-reduced-motion: reduce) {$selector {$body}}"),e.set("--motion-safe--scope","@media(prefers-reduced-motion: no-preference) {$selector {$body}}"),this.initialize()}initialize(){const{cache:e,scopes:t,registeredProperties:r}=this;for(const o of this.getComputedStyles())for(const i of o){const s=I.exec(i);if(null==s)continue;const n=s[1],a=this.getValue(o,i);switch(e.set(i,a),s[2]){case"scope":-1===t.indexOf(n)&&t.push(n);break;case"register":if("true"===a||""===a)r.push({name:n,aliases:[]});else{const e=a.split(",").map((e=>e.trim())).filter((e=>""!==e));r.push({name:n,aliases:e})}}}}getComputedStyles(){const e=[];for(let t=0,r=document.styleSheets.length;t[a-z]{2})\|)?(?:(?[-a-zA-Z0-9]+)!)?(?[-a-z]+)(?:\.(?[-a-z]+))?$/m;function N(e){const t=void 0===e.enabled||"true"===e.enabled,r=void 0!==e.generate&&"true"===e.generate,o=void 0===e.constructable||"true"===e.constructable,i=void 0!==e.mode&&"desktop-first"===e.mode,s=void 0===e.selectorAttribute?"class":e.selectorAttribute,n=void 0===e.cache?null:e.cache,a=void 0===e.cacheKey?"assembler-css-cache":e.cacheKey,l=M.getRegisteredProperties(),p=M.getRegisteredScopes();for(let e=0,t=l.length;e0&&(d[t.name]=t.aliases))}let x=["xs","sm","md","lg","xl"];i?(x.pop(),x.reverse()):x.shift(),x.unshift("all");const m=void 0===e.states?["normal","hover"]:function(e,t=!0){const r=e.replace(/[,;]/g," ").split(/\s\s*/g).map(T).filter(V);return t?r.filter(W):r}(e.states.toLowerCase());-1===m.indexOf("normal")&&m.unshift("normal");return{enabled:t,generate:r,constructable:o,cache:n,cacheKey:a,desktopFirst:i,scopes:p,states:m,breakpoints:x,media:{xs:e.breakpointXs||"512px",sm:e.breakpointSm||(i?"768px":"512px"),md:e.breakpointMd||(i?"1024px":"768px"),lg:e.breakpointLg||(i?"1280px":"1024px"),xl:e.breakpointXl||"1280px"},xStyleAttribute:e.xStyleAttribute||"x-style",selectorAttribute:s,registeredProperties:l}}function F(e){if("string"==typeof e)return e.trim();if(Array.isArray(e))return e.map(F).join(";");const t=[];for(const r in e){const o=e[r];if(void 0===o)continue;const i=r.replace(_,"$1-$2").toLowerCase();t.push(null===o?i:i+":"+o)}return t.join(";")}function T(e){return e.trim()}function V(e){return""!==e}function W(e,t,r){return r.indexOf(e)===t}function U(e){if(e.cache){const t=localStorage.getItem(e.cacheKey+":"+e.cache);if(null!==t){const e=JSON.parse(t);return e.tracker=new Set(e.tracker),e}const r=localStorage.getItem(e.cacheKey);null!==r&&localStorage.removeItem(e.cacheKey+":"+r),localStorage.setItem(e.cacheKey,e.cache)}else{const t=localStorage.getItem(e.cacheKey);null!==t&&(localStorage.removeItem(e.cacheKey+":"+t),localStorage.removeItem(e.cacheKey))}const t=x.length,r=[],o=e.breakpoints,i=e.media,s=e.desktopFirst,n=e.states,a=new Set,l=e.selectorAttribute,p="class"===l?".asm\\#":"["+l+'~="'+"asm#",m="class"===l?"":'"]';r.push(P(e));for(let e=0,l=o.length;e0?l+"--":"")+o+(n>0?"__"+i[n]:"");a.add(c);let g=d[o],h="";if(g)for(let e=0,t=g.length;e0?":"+s:""}{${h}${o}:var(${b}) !important}`}}0!==e&&(u+="}"),r.push(u)}const u={content:r.join(""),tracker:a};return e.cache&&(localStorage.setItem(e.cacheKey,e.cache),localStorage.setItem(e.cacheKey+":"+e.cache,JSON.stringify({content:u.content,tracker:[...a]}))),u}let Z=null,H=null,B=null;const D=new WeakMap;function J(e,t){for(let r=e;null!=r;r=r.nextElementSibling)D.has(r)?J(r.firstElementChild,t):X(r,t)}function X(e,t){if(D.has(e))return;const r=e.attributes.getNamedItem(t.userSettings.xStyleAttribute);D.set(e,r?t.handleStyleChange(e,r.value,[]):[]),function(e,t){null===H&&(H=new MutationObserver((function(e){for(const r of e){const e=r.target;D.set(e,t.handleStyleChange(e,e.getAttribute(r.attributeName),D.get(e)))}}))),H.observe(e,{attributes:!0,attributeOldValue:!0,childList:!1,attributeFilter:[t.userSettings.xStyleAttribute]})}(e,t);for(let r=e.firstElementChild;null!=r;r=r.nextElementSibling)X(r,t)}const q=new Map,G=/\${([0-9]+)(?:=([^}]+))?}/g;function Y(e,t,r){return q.has(t)?F(q.get(t)(e.userSettings,...r)):F(((e,t,r)=>{if(t.startsWith(".")){if(null!==e.currentElement){const o="data-mixin-"+(t=t.substring(1));for(let t=e.currentElement.parentElement;null!=t;t=t.parentElement)if(t.hasAttribute(o))return t.getAttribute(o).replace(G,((e,t,o)=>r[parseInt(t)]||o||""))}return""}return M.getPropertyValue("--"+t+"--mixin").replace(G,((e,t,o)=>r[parseInt(t)]||o||""))})(e,t,r))}q.set("space-x",(function(e,t,r){return"true"===r?`sibling!mr:${t||"0"}`:`sibling!ml:${t||"0"}`})),q.set("space-y",(function(e,t,r){return"true"===r?`sibling!mb:${t||"0"}`:`sibling!mt:${t||"0"}`})),q.set("grid",(function(){return"grid; l1!wb:break-all; l2!max-w:100%; child!justify-self:normal; child!align-self:normal"})),q.set("stack",(function(){return'grid; grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr); \n grid-template-areas:"stackarea"; l1!grid-area:stackarea; l1!z:0; w:100%; h:100%'})),q.set("sr-only",(function(){return"absolute; w:1px; h:1px; p:0; m:-1px; bw:0; overflow:hidden; clip:rect(0, 0, 0, 0); left:-9999px"})),q.set("container",(function(e){return e.desktopFirst?"px: 1rem; mx:auto; max-w:@breakpoint-lg; lg|max-w:@breakpoint-md; md|max-w:@breakpoint-sm; sm|max-w:@breakpoint-xs; xs|max-w:100%":"px: 1rem; mx:auto; max-w:100%; sm|max-w:@breakpoint-sm; md|max-w:@breakpoint-md; lg|max-w:@breakpoint-lg; xl|max-w:@breakpoint-xl"}));const Q=/@([a-zA-Z0-9\-_]+)/g,ee=/\$(selector|body|class|value|property|state|variants|var)/g,te=/;/,re=/\s*,\s*(?![^(]*\))/gm;class oe{constructor(e,t,r){this._currentElement=null,this.style=t,this.settings=e,this.tracker=r,this.mediaSettings=e.media,this.desktopFirst=e.desktopFirst,this.breakpoints=e.breakpoints,this.rules=[],this.padding=t.cssRules.length,this.selectorAttribute=e.selectorAttribute}get userSettings(){return this.settings}get currentElement(){return this._currentElement}handleStyleChange(e,t,r){if(this._currentElement=e,null===t)return this.handleStyleRemoved(e,r);const o=this.getStyleEntries(t),i=e.hasAttribute(this.selectorAttribute)?e.getAttribute(this.selectorAttribute).split(" "):[],s=[];for(const{n:t,p:s,e:n}of r)if(!o.has(t)){const t=i.indexOf(n);t>=0&&i.splice(t,1),e.style.removeProperty(s)}for(const t of o.values()){const{entry:r,property:o,hash:n,value:a,name:l}=t;i.indexOf(r)<0&&i.push(r),this.tracker.has(n)||this.generateCSS(t),e.style.setProperty(o,a),s.push({e:r,n:l,p:o})}return e.setAttribute(this.selectorAttribute,i.join(" ")),this._currentElement=null,s}handleStyleRemoved(e,t){this._currentElement=null;const r=e.hasAttribute(this.selectorAttribute)?e.getAttribute(this.selectorAttribute).split(" "):[];for(const{p:o,e:i}of t){const t=r.indexOf(i);t>=0&&r.splice(t,1),e.style.removeProperty(o)}return e.setAttribute(this.selectorAttribute,r.join(" ")),[]}extract(e,t=null){var r;const o=null===(r=K.exec(e))||void 0===r?void 0:r.groups;if(!o||!o.property)return[];const i=this.breakpoints.indexOf(o.media||"all"),s=x.indexOf(o.state||"normal");if(i<0||s<0)return[];let n=o.property;const a=n,l=this.settings.scopes;m.hasOwnProperty(n)&&(n=m[n],"function"==typeof n&&(n=n(t))),Array.isArray(n)||(n=[n]),null===t&&(t=u[a]||""),y.hasOwnProperty(a)&&(t=y[a](t,a,i,s)),t=Array.isArray(t)?t.map((e=>e.replace(Q,"var(--$1)"))):Array(n.length).fill(t.replace(Q,"var(--$1)"));const p=[],d=x.length;let b=-1;for(const e of n){b++;const r=c.indexOf(e);if(r<0)continue;const n=o.scope||"",a=(r*d+i)*d+s,x=a.toString(16)+(n?`-${n}`:""),m=1e5*l.indexOf(n),u=(o.media?o.media+"--":"")+(n?n+"__":"")+e+(o.state?"__"+o.state:"");p.push({name:(o.media?o.media+"|":"")+(n?n+"!":"")+e+(o.state?"."+o.state:""),property:L+u,entry:"asm#"+x,value:t[b],media:o.media||"",state:o.state||"",cssProperty:e,hash:x,scope:n,rank:m<0?-1:a+m})}return p}getStyleEntries(e){const t=new Map;for(let r of this.getResolvedProperties(e)){let e=null;const o=r.indexOf(":");o>=0&&(e=r.substr(o+1),r=r.substr(0,o).trim());for(const o of this.extract(r,e))t.set(o.name,o)}return t}getResolvedProperties(e,t=[]){const r=[];for(let o of e.split(te))if(o=o.trim(),""!==o)if(o.startsWith("^")){const e=o.indexOf(":");let i,s;if(e<0?(i=o.substr(1),s=[]):(i=o.substr(1,e-1),s=o.substr(e+1).split(re).map(T)),t.indexOf(i)>=0)throw t.push(i),new Error("Recursive mixin detected: "+t.join("->"));t.push(i),r.push(...this.getResolvedProperties(Y(this,i,s),t)),t.pop()}else r.push(o);return r}generateCSS(e){const{tracker:t,mediaSettings:r,desktopFirst:o,style:i}=this,{hash:s,media:n,state:a,cssProperty:l,property:p,scope:c,rank:x}=e,m=""!==n,u=this.settings.selectorAttribute,b="class"===u?".asm\\#":"["+u+'~="'+"asm#",g="class"===u?"":'"]';if(t.add(s),x<0)return;let h="";m&&(h+=o?`@media only screen and (max-width: ${r[n]}) {`:`@media only screen and (min-width: ${r[n]}) {`);let f=d[l],w="";if(f)for(let e=0,t=f.length;e{switch(t){case"selector":return`${b+s+g}${a?":"+a:""}`;case"body":return w+l+": var("+p+") !important";case"variants":return w;case"property":return l;case"value":return`var(${p})`;case"class":return b+s+g;case"state":return a?":"+a:"";case"var":return p}return t}))}else h+=`${b+s+g}${a?":"+a:""}{${w}${l}: var(${p}) !important}`;m&&(h+="}");const y=this.getRuleIndex(x);this.rules.splice(y,0,x);try{i.insertRule(h,this.padding+y)}catch(e){this.rules.splice(y,1),console.warn("Unsupported rule:",h)}}getRuleIndex(e){const{rules:t}=this;for(let r=0,o=t.length;r"words"===e?["overflow-wrap"]:"all"===e?["word-break"]:["overflow-wrap","word-break"],truncate:["overflow","text-overflow","white-space"],flex:e=>e?"flex":"display","inline-flex":"display",grid:"display","inline-grid":"display",hidden:"display",block:"display","inline-block":"display",static:"position",fixed:"position",absolute:"position",relative:"position",sticky:"position",visible:"visibility",invisible:"visibility","flex-row":"flex-direction","flex-col":"flex-direction",list:e=>"inside"===e||"outside"===e?"list-style-position":"list-style-type",text:e=>o.test(e)?["font-size","line-height"]:"font-size",uppercase:"text-transform",lowercase:"text-transform",capitalize:"text-transform","normal-case":"text-transform",variant:"font-variant-numeric"},u={border:["1px solid transparent"],truncate:["hidden","ellipsis","nowrap"],flex:"flex","inline-flex":"inline-flex",grid:"grid","inline-grid":"inline-grid",hidden:"none",block:"block","inline-block":"inline-block",static:"static",fixed:"fixed",absolute:"absolute",relative:"relative",sticky:"sticky",visible:"visible",invisible:"hidden","flex-row":"row","flex-col":"column","flex-wrap":"wrap","flex-grow":"1","flex-shrink":"1","col-reverse":"column-reverse","row-reverse":"row-reverse",uppercase:"uppercase",lowercase:"lowercase",capitalize:"capitalize","normal-case":"none",radius:"sm",shadow:"1"},b=e=>r.test(e)?`calc(${e} * @unit-size)`:e,g=e=>t.test(e)?`calc(${e} * @unit-size)`:e,h=e=>`repeat(${e}, minmax(0, 1fr))`,f=e=>`span ${e}`,w=e=>l.test(e)?"@border-radius-"+e:e,y={img:e=>`url(${e})`,gradient:e=>`linear-gradient(${e})`,"radial-gradient":e=>`radial-gradient(${e})`,"conic-gradient":e=>`conic-gradient(${e})`,"grid-rows":h,"row-span":f,"grid-cols":h,"col-span":f,e:e=>s.test(e)?`@elevation-${e}`:e,shadow:e=>n.test(e)?`@shadow-${e}`:e,ring:e=>`0 0 0 ${e}`,"font-size":e=>o.test(e)?"@font-size-"+e:e,leading:e=>t.test(e)?`calc(${e} * @unit-size)`:i.test(e)?"@line-height-"+e:e,tracking:e=>a.test(e)?"@letter-spacing-"+e:e,text:e=>o.test(e)?["@font-size-"+e,"@font-size-leading-"+e]:e,radius:w,"radius-top":w,"radius-left":w,"radius-bottom":w,"radius-right":w,"radius-tl":w,"radius-bl":w,"radius-tr":w,"radius-br":w,"border-radius":w,break:e=>"all"===e?"break-all":"words"===e?"break-word":["normal","normal"],"flex-wrap":e=>"reverse"===e?"wrap-reverse":e,"flex-row":e=>"reverse"===e?"row-reverse":e,"flex-col":e=>"reverse"===e?"column-reverse":e,order:e=>p.test(e)?"first"===e?"-9999":"last"===e?"9999":"0":e,padding:g,"padding-top":g,"padding-bottom":g,"padding-left":g,"padding-right":g,p:g,pt:g,pb:g,pl:g,pr:g,px:g,py:g,margin:b,"margin-top":b,"margin-bottom":b,"margin-left":b,"margin-right":b,m:b,mt:b,mb:b,ml:b,mr:b,mx:b,my:b,w:g,h:g,width:g,height:g,"min-w":g,"max-w":g,"min-h":g,"max-h":g,"min-width":g,"max-width":g,"min-height":g,"max-height":g},v=["0px 0px 0px 0px","0px 2px 1px -1px","0px 3px 1px -2px","0px 3px 3px -2px","0px 2px 4px -1px","0px 3px 5px -1px","0px 3px 5px -1px","0px 4px 5px -2px","0px 5px 5px -3px","0px 5px 6px -3px","0px 6px 6px -3px","0px 6px 7px -4px","0px 7px 8px -4px","0px 7px 8px -4px","0px 7px 9px -4px","0px 8px 9px -5px","0px 8px 10px -5px","0px 8px 11px -5px","0px 9px 11px -5px","0px 9px 12px -6px","0px 10px 13px -6px","0px 10px 13px -6px","0px 10px 14px -6px","0px 11px 14px -7px","0px 11px 15px -7px"],k=["0px 0px 0px 0px","0px 1px 1px 0px","0px 2px 2px 0px","0px 3px 4px 0px","0px 4px 5px 0px","0px 5px 8px 0px","0px 6px 10px 0px","0px 7px 10px 1px","0px 8px 10px 1px","0px 9px 12px 1px","0px 10px 14px 1px","0px 11px 15px 1px","0px 12px 17px 2px","0px 13px 19px 2px","0px 14px 21px 2px","0px 15px 22px 2px","0px 16px 24px 2px","0px 17px 26px 2px","0px 18px 28px 2px","0px 19px 29px 2px","0px 20px 31px 3px","0px 21px 33px 3px","0px 22px 35px 3px","0px 23px 36px 3px","0px 24px 38px 3px"],$=["0px 0px 0px 0px","0px 1px 3px 0px","0px 1px 5px 0px","0px 1px 8px 0px","0px 1px 10px 0px","0px 1px 14px 0px","0px 1px 18px 0px","0px 2px 16px 1px","0px 3px 14px 2px","0px 3px 16px 2px","0px 4px 18px 3px","0px 4px 20px 3px","0px 5px 22px 4px","0px 5px 24px 4px","0px 5px 26px 4px","0px 6px 28px 5px","0px 6px 30px 5px","0px 6px 32px 5px","0px 7px 34px 6px","0px 7px 36px 6px","0px 8px 38px 7px","0px 8px 40px 7px","0px 8px 42px 7px","0px 9px 44px 8px","0px 9px 46px 8px"],S={none:"0",xs:"0.125rem",sm:"0.25rem",md:"0.5rem",lg:"0.75rem",xl:"1rem",pill:"9999px"},A={tighter:"-0.05rem",tight:"-0.025rem",normal:"0",wide:"0.025rem",wider:"0.05rem",widest:"0.1rem"},z={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2"},O={xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem","5xl":"3rem","6xl":"3.75rem","7xl":"4.5rem","8xl":"6rem","9xl":"8rem"},E={xs:"1rem",sm:"1.25rem",base:"1.5rem",lg:"1.75rem",xl:"1.75rem","2xl":"2rem","3xl":"2.25rem","4xl":"2.5rem","5xl":"1","6xl":"1","7xl":"1","8xl":"1","9xl":"1"},j={"sans-serif":"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol",serif:"Georgia, Cambria, Times New Roman, Times, serif",monospace:"Lucida Console, Monaco, monospace"},C=["0px 2px 4px 0px hsla(0, 0%, 20%, 0.1), 0px 6px 6px -8px hsla(0, 0%, 0%, 15%)","0px 2px 8px -1px hsla(0, 0%, 20%, 0.1), 0px 16px 16px -12px hsla(0, 0%, 0%, 15%)","0px 2px 16px -2px hsla(0, 0%, 20%, 0.1), 0px 22px 18px -16px hsla(0, 0%, 0%, 15%)","0px 2px 20px -3px hsla(0, 0%, 20%, 0.1), 0px 28px 22px -18px hsla(0, 0%, 0%, 15%)","0px 2px 32px -2px hsla(0, 0%, 20%, 0.1), 0px 32px 26px -18px hsla(0, 0%, 0%, 15%)","0px 2px 36px -1px hsla(0, 0%, 20%, 0.1), 0px 42px 34px -24px hsla(0, 0%, 0%, 15%)"];function P(e){let t="--elevation-umbra: rgba(0, 0, 0, .2);--elevation-penumbra: rgba(0, 0, 0, .14);--elevation-ambient: rgba(0, 0, 0, .12);";for(let e=0;e<25;e++)t+=`--elevation-${e}:${v[e]} var(--elevation-umbra), ${k[e]} var(--elevation-penumbra), ${$[e]} var(--elevation-ambient);`;for(let e=0;e<6;e++)t+=`--shadow-${e+1}:${C[e]};`;for(const[e,r]of Object.entries(S))t+=`--border-radius-${e}:${r};`;for(const[e,r]of Object.entries(A))t+=`--letter-spacing-${e}:${r};`;for(const[e,r]of Object.entries(z))t+=`--line-height-${e}:${r};`;for(const[e,r]of Object.entries(j))t+=`--${e}:${r};`;for(const[e,r]of Object.entries(O))t+=`--font-size-${e}:${r};`;for(const[e,r]of Object.entries(E))t+=`--font-size-leading-${e}:${r};`;for(const r of e.breakpoints)"all"!==r&&(t+=`--breakpoint-${r}: ${e.media[r]};`);return t+="--unit-size:0.25rem;",":root{"+t+"}"}const R=/\\\n/g,I=/^--([a-zA-Z0-9-_]+)--(scope|mixin|register)$/;const M=new class{constructor(){this.cache=new Map,this.scopes=["","text-clip","selection","placeholder","before","after","first-letter","first-line","l1","l2","marker-l1","marker","sibling","child","even","odd","first","last","dark","light","landscape","portrait","motion-reduce","motion-safe"],this.registeredProperties=[];const{cache:e}=this;e.set("--text-clip--scope","$selector {-webkit-background-clip: text !important;-moz-background-clip:text !important;background-clip:text !important;}"),e.set("--l1--scope","$selector > * {$body}"),e.set("--l2--scope","$selector > * > * {$body}"),e.set("--sibling--scope","$selector > * + * {$body}"),e.set("--child--scope","$selector > $class {$body}"),e.set("--selection--scope","$selector::selection {$body}"),e.set("--placeholder--scope","$selector::placeholder {$body}"),e.set("--marker--scope","$selector::marker {$body}"),e.set("--marker-l1--scope","$selector > *::marker {$body}"),e.set("--before--scope","$selector::before {$body}"),e.set("--after--scope","$selector::after {$body}"),e.set("--even--scope","$selector:nth-child(even) {$body}"),e.set("--odd--scope","$selector:nth-child(odd) {$body}"),e.set("--first--scope","$selector:first-child {$body}"),e.set("--last--scope","$selector:last-child {$body}"),e.set("--first-letter--scope","$selector::first-letter {$body}"),e.set("--first-line--scope","$selector::first-line {$body}"),e.set("--dark--scope","@media(prefers-color-scheme: dark) {$selector {$body}}"),e.set("--light--scope","@media(prefers-color-scheme: light) {$selector {$body}}"),e.set("--landscape--scope","@media(orientation: landscape) {$selector {$body}}"),e.set("--portrait--scope","@media(orientation: portrait) {$selector {$body}}"),e.set("--motion-reduce--scope","@media(prefers-reduced-motion: reduce) {$selector {$body}}"),e.set("--motion-safe--scope","@media(prefers-reduced-motion: no-preference) {$selector {$body}}"),this.initialize()}initialize(){const{cache:e,scopes:t,registeredProperties:r}=this;for(const o of this.getComputedStyles())for(const i of o){const s=I.exec(i);if(null==s)continue;const n=s[1],a=this.getValue(o,i);switch(e.set(i,a),s[2]){case"scope":-1===t.indexOf(n)&&t.push(n);break;case"register":if("true"===a||""===a)r.push({name:n,aliases:[]});else{const e=a.split(",").map((e=>e.trim())).filter((e=>""!==e));r.push({name:n,aliases:e})}}}}getComputedStyles(){const e=[];for(let t=0,r=document.styleSheets.length;t[a-z]{2})\|)?(?:(?[-a-zA-Z0-9]+)!)?(?[-a-z]+)(?:\.(?[-a-z]+))?$/m;function N(e){const t=void 0===e.enabled||"true"===e.enabled,r=void 0!==e.generate&&"true"===e.generate,o=void 0===e.constructable||"true"===e.constructable,i=void 0!==e.mode&&"desktop-first"===e.mode,s=void 0===e.selectorAttribute?"class":e.selectorAttribute,n=void 0===e.cache?null:e.cache,a=void 0===e.cacheKey?"assembler-css-cache":e.cacheKey,l=M.getRegisteredProperties(),p=M.getRegisteredScopes();for(let e=0,t=l.length;e0&&(d[t.name]=t.aliases)}let x=["xs","sm","md","lg","xl"];i?(x.pop(),x.reverse()):x.shift(),x.unshift("all");const m=void 0===e.states?["normal","hover"]:function(e,t=!0){const r=e.replace(/[,;]/g," ").split(/\s\s*/g).map(T).filter(V);return t?r.filter(W):r}(e.states.toLowerCase());-1===m.indexOf("normal")&&m.unshift("normal");return{enabled:t,generate:r,constructable:o,cache:n,cacheKey:a,desktopFirst:i,scopes:p,states:m,breakpoints:x,media:{xs:e.breakpointXs||"512px",sm:e.breakpointSm||(i?"768px":"512px"),md:e.breakpointMd||(i?"1024px":"768px"),lg:e.breakpointLg||(i?"1280px":"1024px"),xl:e.breakpointXl||"1280px"},xStyleAttribute:e.xStyleAttribute||"x-style",selectorAttribute:s,registeredProperties:l}}function F(e){if("string"==typeof e)return e.trim();if(Array.isArray(e))return e.map(F).join(";");const t=[];for(const r in e){const o=e[r];if(void 0===o)continue;const i=r.replace(_,"$1-$2").toLowerCase();t.push(null===o?i:i+":"+o)}return t.join(";")}function T(e){return e.trim()}function V(e){return""!==e}function W(e,t,r){return r.indexOf(e)===t}function U(e){if(e.cache){const t=localStorage.getItem(e.cacheKey+":"+e.cache);if(null!==t){const e=JSON.parse(t);return e.tracker=new Set(e.tracker),e}const r=localStorage.getItem(e.cacheKey);null!==r&&localStorage.removeItem(e.cacheKey+":"+r),localStorage.setItem(e.cacheKey,e.cache)}else{const t=localStorage.getItem(e.cacheKey);null!==t&&(localStorage.removeItem(e.cacheKey+":"+t),localStorage.removeItem(e.cacheKey))}const t=x.length,r=[],o=e.breakpoints,i=e.media,s=e.desktopFirst,n=e.states,a=new Set,l=e.selectorAttribute,p="class"===l?".asm\\#":"["+l+'~="'+"asm#",m="class"===l?"":'"]';r.push(P(e));for(let e=0,l=o.length;e0?l+"--":"")+o+(n>0?"__"+i[n]:"");a.add(c);let g=d[o],h="";if(g)for(let e=0,t=g.length;e0?":"+s:""}{${h}${o}:var(${b}) !important}`}}0!==e&&(u+="}"),r.push(u)}const u={content:r.join(""),tracker:a};return e.cache&&(localStorage.setItem(e.cacheKey,e.cache),localStorage.setItem(e.cacheKey+":"+e.cache,JSON.stringify({content:u.content,tracker:[...a]}))),u}let Z=null,H=null,B=null;const D=new WeakMap;function J(e,t){for(let r=e;null!=r;r=r.nextElementSibling)D.has(r)?J(r.firstElementChild,t):X(r,t)}function X(e,t){if(D.has(e))return;const r=e.attributes.getNamedItem(t.userSettings.xStyleAttribute);D.set(e,r?t.handleStyleChange(e,r.value,[]):[]),function(e,t){null===H&&(H=new MutationObserver((function(e){for(const r of e){const e=r.target;D.set(e,t.handleStyleChange(e,e.getAttribute(r.attributeName),D.get(e)))}}))),H.observe(e,{attributes:!0,attributeOldValue:!0,childList:!1,attributeFilter:[t.userSettings.xStyleAttribute]})}(e,t);for(let r=e.firstElementChild;null!=r;r=r.nextElementSibling)X(r,t)}const q=new Map,G=/\${([0-9]+)(?:=([^}]+))?}/g;function Y(e,t,r){return q.has(t)?F(q.get(t)(e.userSettings,...r)):F(((e,t,r)=>{if(t.startsWith(".")){if(null!==e.currentElement){const o="data-mixin-"+(t=t.substring(1));for(let t=e.currentElement.parentElement;null!=t;t=t.parentElement)if(t.hasAttribute(o))return t.getAttribute(o).replace(G,((e,t,o)=>r[parseInt(t)]||o||""))}return""}return M.getPropertyValue("--"+t+"--mixin").replace(G,((e,t,o)=>r[parseInt(t)]||o||""))})(e,t,r))}q.set("space-x",(function(e,t,r){return"true"===r?`sibling!mr:${t||"0"}`:`sibling!ml:${t||"0"}`})),q.set("space-y",(function(e,t,r){return"true"===r?`sibling!mb:${t||"0"}`:`sibling!mt:${t||"0"}`})),q.set("grid",(function(){return"grid; l1!wb:break-all; l2!max-w:100%; child!justify-self:normal; child!align-self:normal"})),q.set("stack",(function(){return'grid; grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr); \n grid-template-areas:"stackarea"; l1!grid-area:stackarea; l1!z:0; w:100%; h:100%'})),q.set("sr-only",(function(){return"absolute; w:1px; h:1px; p:0; m:-1px; bw:0; overflow:hidden; clip:rect(0, 0, 0, 0); left:-9999px"})),q.set("container",(function(e){return e.desktopFirst?"px: 1rem; mx:auto; max-w:@breakpoint-lg; lg|max-w:@breakpoint-md; md|max-w:@breakpoint-sm; sm|max-w:@breakpoint-xs; xs|max-w:100%":"px: 1rem; mx:auto; max-w:100%; sm|max-w:@breakpoint-sm; md|max-w:@breakpoint-md; lg|max-w:@breakpoint-lg; xl|max-w:@breakpoint-xl"}));const Q=/@([a-zA-Z0-9\-_]+)/g,ee=/\$(selector|body|class|value|property|state|variants|var)/g,te=/;/,re=/\s*,\s*(?![^(]*\))/gm;class oe{constructor(e,t,r){this._currentElement=null,this.style=t,this.settings=e,this.tracker=r,this.mediaSettings=e.media,this.desktopFirst=e.desktopFirst,this.breakpoints=e.breakpoints,this.rules=[],this.padding=t.cssRules.length,this.selectorAttribute=e.selectorAttribute}get userSettings(){return this.settings}get currentElement(){return this._currentElement}handleStyleChange(e,t,r){if(this._currentElement=e,null===t)return this.handleStyleRemoved(e,r);const o=this.getStyleEntries(t),i=e.hasAttribute(this.selectorAttribute)?e.getAttribute(this.selectorAttribute).split(" "):[],s=[];for(const{n:t,p:s,e:n}of r)if(!o.has(t)){const t=i.indexOf(n);t>=0&&i.splice(t,1),e.style.removeProperty(s)}for(const t of o.values()){const{entry:r,property:o,hash:n,value:a,name:l}=t;i.indexOf(r)<0&&i.push(r),this.tracker.has(n)||this.generateCSS(t),e.style.setProperty(o,a),s.push({e:r,n:l,p:o})}return e.setAttribute(this.selectorAttribute,i.join(" ")),this._currentElement=null,s}handleStyleRemoved(e,t){this._currentElement=null;const r=e.hasAttribute(this.selectorAttribute)?e.getAttribute(this.selectorAttribute).split(" "):[];for(const{p:o,e:i}of t){const t=r.indexOf(i);t>=0&&r.splice(t,1),e.style.removeProperty(o)}return e.setAttribute(this.selectorAttribute,r.join(" ")),[]}extract(e,t=null){var r;const o=null===(r=K.exec(e))||void 0===r?void 0:r.groups;if(!o||!o.property)return[];const i=this.breakpoints.indexOf(o.media||"all"),s=x.indexOf(o.state||"normal");if(i<0||s<0)return[];let n=o.property;const a=n,l=this.settings.scopes;m.hasOwnProperty(n)&&(n=m[n],"function"==typeof n&&(n=n(t))),Array.isArray(n)||(n=[n]),null===t&&(t=u[a]||""),y.hasOwnProperty(a)&&(t=y[a](t,a,i,s)),t=Array.isArray(t)?t.map((e=>e.replace(Q,"var(--$1)"))):Array(n.length).fill(t.replace(Q,"var(--$1)"));const p=[],d=x.length;let b=-1;for(const e of n){b++;const r=c.indexOf(e);if(r<0)continue;const n=o.scope||"",a=(r*d+i)*d+s,x=a.toString(16)+(n?`-${n}`:""),m=1e5*l.indexOf(n),u=(o.media?o.media+"--":"")+(n?n+"__":"")+e+(o.state?"__"+o.state:"");p.push({name:(o.media?o.media+"|":"")+(n?n+"!":"")+e+(o.state?"."+o.state:""),property:L+u,entry:"asm#"+x,value:t[b],media:o.media||"",state:o.state||"",cssProperty:e,hash:x,scope:n,rank:m<0?-1:a+m})}return p}getStyleEntries(e){const t=new Map;for(let r of this.getResolvedProperties(e)){let e=null;const o=r.indexOf(":");o>=0&&(e=r.substr(o+1),r=r.substr(0,o).trim());for(const o of this.extract(r,e))t.set(o.name,o)}return t}getResolvedProperties(e,t=[]){const r=[];for(let o of e.split(te))if(o=o.trim(),""!==o)if(o.startsWith("^")){const e=o.indexOf(":");let i,s;if(e<0?(i=o.substr(1),s=[]):(i=o.substr(1,e-1),s=o.substr(e+1).split(re).map(T)),t.indexOf(i)>=0)throw t.push(i),new Error("Recursive mixin detected: "+t.join("->"));t.push(i),r.push(...this.getResolvedProperties(Y(this,i,s),t)),t.pop()}else r.push(o);return r}generateCSS(e){const{tracker:t,mediaSettings:r,desktopFirst:o,style:i}=this,{hash:s,media:n,state:a,cssProperty:l,property:p,scope:c,rank:x}=e,m=""!==n,u=this.settings.selectorAttribute,b="class"===u?".asm\\#":"["+u+'~="'+"asm#",g="class"===u?"":'"]';if(t.add(s),x<0)return;let h="";m&&(h+=o?`@media only screen and (max-width: ${r[n]}) {`:`@media only screen and (min-width: ${r[n]}) {`);let f=d[l],w="";if(f)for(let e=0,t=f.length;e{switch(t){case"selector":return`${b+s+g}${a?":"+a:""}`;case"body":return w+l+": var("+p+") !important";case"variants":return w;case"property":return l;case"value":return`var(${p})`;case"class":return b+s+g;case"state":return a?":"+a:"";case"var":return p}return t}))}else h+=`${b+s+g}${a?":"+a:""}{${w}${l}: var(${p}) !important}`;m&&(h+="}");const y=this.getRuleIndex(x);this.rules.splice(y,0,x);try{i.insertRule(h,this.padding+y)}catch(e){this.rules.splice(y,1),console.warn("Unsupported rule:",h)}}getRuleIndex(e){const{rules:t}=this;for(let r=0,o=t.length;r 0) { - PROPERTY_VARIANTS[prop.name] = prop.aliases; - } + } + if (prop.aliases.length > 0) { + PROPERTY_VARIANTS[prop.name] = prop.aliases; } } diff --git a/src/list.ts b/src/list.ts index 41284b5..0f726d9 100644 --- a/src/list.ts +++ b/src/list.ts @@ -186,6 +186,7 @@ export const PROPERTY_VARIANTS = { "background-clip": ["-webkit-background-clip", "-moz-background-clip"], "backdrop-filter": ["-webkit-backdrop-filter"], "box-orient": ["-webkit-box-orient"], + "clip-path": ["-webkit-clip-path"], "column-gap": ["-moz-column-gap"], "line-clamp": ["-webkit-line-clamp"], "user-select": ["-webkit-user-select", "-moz-user-select"], diff --git a/types/list.d.ts b/types/list.d.ts index 3938509..e0e045d 100644 --- a/types/list.d.ts +++ b/types/list.d.ts @@ -5,6 +5,7 @@ export declare const PROPERTY_VARIANTS: { "background-clip": string[]; "backdrop-filter": string[]; "box-orient": string[]; + "clip-path": string[]; "column-gap": string[]; "line-clamp": string[]; "user-select": string[];