diff --git a/dist/assembler.cjs.js b/dist/assembler.cjs.js index 32dec16..61c8308 100644 --- a/dist/assembler.cjs.js +++ b/dist/assembler.cjs.js @@ -70,6 +70,7 @@ const PROPERTY_LIST = [ "border-top-right-radius", "border-width", "bottom", + "box-orient", "box-shadow", "box-sizing", "clear", @@ -117,6 +118,7 @@ const PROPERTY_LIST = [ "justify-self", "left", "letter-spacing", + "line-clamp", "line-height", "list-style-position", "list-style-type", @@ -184,7 +186,9 @@ const PROPERTY_VARIANTS = { "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"] }; @@ -642,6 +646,7 @@ function getUserSettings(dataset) { const cache = dataset.cache === undefined ? null : dataset.cache; const cacheKey = dataset.cacheKey === undefined ? "assembler-css-cache" : dataset.cacheKey; const dataScopes = dataset.scopes === undefined ? [] : getStringItemList(dataset.scopes); + const registeredProperties = dataset.registerProperties === undefined ? [] : getRegisteredProperties(dataset.registerProperties); const 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"]; @@ -651,6 +656,15 @@ function getUserSettings(dataset) { scopes.push(scope); } } + for (let i = 0, l = registeredProperties.length; i < l; i++) { + 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; + } + } + } // Consider all bp let breakpoints = ['xs', 'sm', 'md', 'lg', 'xl']; if (desktopFirst) { @@ -690,6 +704,7 @@ function getUserSettings(dataset) { media: { xs, sm, md, lg, xl }, xStyleAttribute, selectorAttribute, + registeredProperties }; } function style(item) { @@ -718,6 +733,22 @@ function getStringItemList(value, unique = true) { .filter(nonEmptyString); return unique ? items.filter(uniqueItems) : items; } +function getRegisteredProperties(value) { + return value + .split(';') + .map(v => v.trim()) + .filter(v => v !== '') + .map(v => { + const index = v.indexOf(':'); + if (index < 0) { + return { name: v, aliases: [] }; + } + return { + name: v.substr(0, index), + aliases: v.substr(index + 1).split(',').map(v => v.trim()).filter(v => v !== '') + }; + }); +} function trim(value) { return value.trim(); } diff --git a/dist/assembler.es.js b/dist/assembler.es.js index 9ea2797..c1ad2cd 100644 --- a/dist/assembler.es.js +++ b/dist/assembler.es.js @@ -66,6 +66,7 @@ const PROPERTY_LIST = [ "border-top-right-radius", "border-width", "bottom", + "box-orient", "box-shadow", "box-sizing", "clear", @@ -113,6 +114,7 @@ const PROPERTY_LIST = [ "justify-self", "left", "letter-spacing", + "line-clamp", "line-height", "list-style-position", "list-style-type", @@ -180,7 +182,9 @@ const PROPERTY_VARIANTS = { "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"] }; @@ -638,6 +642,7 @@ function getUserSettings(dataset) { const cache = dataset.cache === undefined ? null : dataset.cache; const cacheKey = dataset.cacheKey === undefined ? "assembler-css-cache" : dataset.cacheKey; const dataScopes = dataset.scopes === undefined ? [] : getStringItemList(dataset.scopes); + const registeredProperties = dataset.registerProperties === undefined ? [] : getRegisteredProperties(dataset.registerProperties); const 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"]; @@ -647,6 +652,15 @@ function getUserSettings(dataset) { scopes.push(scope); } } + for (let i = 0, l = registeredProperties.length; i < l; i++) { + 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; + } + } + } // Consider all bp let breakpoints = ['xs', 'sm', 'md', 'lg', 'xl']; if (desktopFirst) { @@ -686,6 +700,7 @@ function getUserSettings(dataset) { media: { xs, sm, md, lg, xl }, xStyleAttribute, selectorAttribute, + registeredProperties }; } function style(item) { @@ -714,6 +729,22 @@ function getStringItemList(value, unique = true) { .filter(nonEmptyString); return unique ? items.filter(uniqueItems) : items; } +function getRegisteredProperties(value) { + return value + .split(';') + .map(v => v.trim()) + .filter(v => v !== '') + .map(v => { + const index = v.indexOf(':'); + if (index < 0) { + return { name: v, aliases: [] }; + } + return { + name: v.substr(0, index), + aliases: v.substr(index + 1).split(',').map(v => v.trim()).filter(v => v !== '') + }; + }); +} function trim(value) { return value.trim(); } diff --git a/dist/assembler.js b/dist/assembler.js index 618eed6..6409bb4 100644 --- a/dist/assembler.js +++ b/dist/assembler.js @@ -72,6 +72,7 @@ "border-top-right-radius", "border-width", "bottom", + "box-orient", "box-shadow", "box-sizing", "clear", @@ -119,6 +120,7 @@ "justify-self", "left", "letter-spacing", + "line-clamp", "line-height", "list-style-position", "list-style-type", @@ -186,7 +188,9 @@ "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"] }; @@ -644,6 +648,7 @@ const cache = dataset.cache === undefined ? null : dataset.cache; const cacheKey = dataset.cacheKey === undefined ? "assembler-css-cache" : dataset.cacheKey; const dataScopes = dataset.scopes === undefined ? [] : getStringItemList(dataset.scopes); + const registeredProperties = dataset.registerProperties === undefined ? [] : getRegisteredProperties(dataset.registerProperties); const 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"]; @@ -653,6 +658,15 @@ scopes.push(scope); } } + for (let i = 0, l = registeredProperties.length; i < l; i++) { + 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; + } + } + } // Consider all bp let breakpoints = ['xs', 'sm', 'md', 'lg', 'xl']; if (desktopFirst) { @@ -692,6 +706,7 @@ media: { xs, sm, md, lg, xl }, xStyleAttribute, selectorAttribute, + registeredProperties }; } function style(item) { @@ -720,6 +735,22 @@ .filter(nonEmptyString); return unique ? items.filter(uniqueItems) : items; } + function getRegisteredProperties(value) { + return value + .split(';') + .map(v => v.trim()) + .filter(v => v !== '') + .map(v => { + const index = v.indexOf(':'); + if (index < 0) { + return { name: v, aliases: [] }; + } + return { + name: v.substr(0, index), + aliases: v.substr(index + 1).split(',').map(v => v.trim()).filter(v => v !== '') + }; + }); + } function trim(value) { return value.trim(); } diff --git a/dist/assembler.min.js b/dist/assembler.min.js index e843624..05f3635 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-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-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"],"column-gap":["-moz-column-gap"],"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}`,y=e=>l.test(e)?"@border-radius-"+e:e,w={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:y,"radius-top":y,"radius-left":y,"radius-bottom":y,"radius-right":y,"radius-tl":y,"radius-bl":y,"radius-tr":y,"radius-br":y,"border-radius":y,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"],$=["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"],k=["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"},z={tighter:"-0.05rem",tight:"-0.025rem",normal:"0",wide:"0.025rem",wider:"0.05rem",widest:"0.1rem"},A={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"},j={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"},C={"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"},P=["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 I(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), ${$[e]} var(--elevation-penumbra), ${k[e]} var(--elevation-ambient);`;for(let e=0;e<6;e++)t+=`--shadow-${e+1}:${P[e]};`;for(const[e,r]of Object.entries(S))t+=`--border-radius-${e}:${r};`;for(const[e,r]of Object.entries(z))t+=`--letter-spacing-${e}:${r};`;for(const[e,r]of Object.entries(A))t+=`--line-height-${e}:${r};`;for(const[e,r]of Object.entries(C))t+=`--${e}:${r};`;for(const[e,r]of Object.entries(O))t+=`--font-size-${e}:${r};`;for(const[e,r]of Object.entries(j))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=/([a-z0-9]|(?=[A-Z]))([A-Z])/g,M="--asm-",E=/^(?:(?[a-z]{2})\|)?(?:(?[-a-zA-Z0-9]+)!)?(?[-a-z]+)(?:\.(?[-a-z]+))?$/m;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(R,"$1-$2").toLowerCase();t.push(null===o?i:i+":"+o)}return t.join(";")}function K(e,t=!0){const r=e.replace(/[,;]/g," ").split(/\s\s*/g).map(L).filter(N);return t?r.filter(_):r}function L(e){return e.trim()}function N(e){return""!==e}function _(e,t,r){return r.indexOf(e)===t}function T(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(I(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 V=null,U=null,W=null;const Z=new WeakMap;function H(e,t){if(Z.has(e))return;const r=e.attributes.getNamedItem(t.userSettings.xStyleAttribute);Z.set(e,r?t.handleStyleChange(e,r.value,[]):[]),function(e,t){null===U&&(U=new MutationObserver((function(e){for(const r of e){const e=r.target;Z.set(e,t.handleStyleChange(e,e.getAttribute(r.attributeName),Z.get(e)))}}))),U.observe(e,{attributes:!0,attributeOldValue:!0,childList:!0,attributeFilter:[t.userSettings.xStyleAttribute]})}(e,t);for(let r=e.firstElementChild;null!=r;r=r.nextElementSibling)H(r,t)}const B=/\\\n/g;const J=new class{constructor(){this.styles=null,this.cache=new Map;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}}")}getComputedStyles(){if(null===this.styles){this.styles=[];for(let e=0,t=document.styleSheets.length;eJ.getPropertyValue(e+"--mixin").replace(q,((e,r,o)=>t[parseInt(r)]||o||"")))(t,r))}X.set("space-x",(function(e,t,r){return"true"===r?`sibling!mr:${t||"0"}`:`sibling!ml:${t||"0"}`})),X.set("space-y",(function(e,t,r){return"true"===r?`sibling!mb:${t||"0"}`:`sibling!mt:${t||"0"}`})),X.set("grid",(function(){return"grid; l1!wb:break-all; l2!max-w:100%; child!justify-self:normal; child!align-self:normal"})),X.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%'})),X.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"})),X.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 Y=/@([a-zA-Z0-9\-_]+)/g,D=/\$(selector|body|class|value|property|state|variants|var)/g,Q=/;/,ee=/\s*,\s*(?![^(]*\))/gm;class te{constructor(e,t,r){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}handleStyleChange(e,t,r){if(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(" ")),s}handleStyleRemoved(e,t){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=E.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]||""),w.hasOwnProperty(a)&&(t=w[a](t,a,i,s)),t=Array.isArray(t)?t.map((e=>e.replace(Y,"var(--$1)"))):Array(n.length).fill(t.replace(Y,"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:M+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(Q))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(ee).map(L)),t.indexOf(i)>=0)throw t.push(i),new Error("Recursive mixin detected: "+t.join("->"));t.push(i),r.push(...this.getResolvedProperties(G(this.settings,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],y="";if(f)for(let e=0,t=f.length;e{switch(t){case"selector":return`${b+s+g}${a?":"+a:""}`;case"body":return y+l+": var("+p+") !important";case"variants":return y;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:""}{${y}${l}: var(${p}) !important}`;m&&(h+="}");const w=this.getRuleIndex(x);this.rules.splice(w,0,x);try{i.insertRule(h,this.padding+w)}catch(e){this.rules.splice(w,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}`,y=e=>l.test(e)?"@border-radius-"+e:e,w={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:y,"radius-top":y,"radius-left":y,"radius-bottom":y,"radius-right":y,"radius-tl":y,"radius-bl":y,"radius-tr":y,"radius-br":y,"border-radius":y,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"],$=["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"],k=["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"},z={tighter:"-0.05rem",tight:"-0.025rem",normal:"0",wide:"0.025rem",wider:"0.05rem",widest:"0.1rem"},A={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"},j={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"},P={"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 I(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), ${$[e]} var(--elevation-penumbra), ${k[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(z))t+=`--letter-spacing-${e}:${r};`;for(const[e,r]of Object.entries(A))t+=`--line-height-${e}:${r};`;for(const[e,r]of Object.entries(P))t+=`--${e}:${r};`;for(const[e,r]of Object.entries(O))t+=`--font-size-${e}:${r};`;for(const[e,r]of Object.entries(j))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=/([a-z0-9]|(?=[A-Z]))([A-Z])/g,M="--asm-",E=/^(?:(?[a-z]{2})\|)?(?:(?[-a-zA-Z0-9]+)!)?(?[-a-z]+)(?:\.(?[-a-z]+))?$/m;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(R,"$1-$2").toLowerCase();t.push(null===o?i:i+":"+o)}return t.join(";")}function K(e,t=!0){const r=e.replace(/[,;]/g," ").split(/\s\s*/g).map(L).filter(N);return t?r.filter(_):r}function L(e){return e.trim()}function N(e){return""!==e}function _(e,t,r){return r.indexOf(e)===t}function T(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(I(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 V=null,U=null,W=null;const Z=new WeakMap;function H(e,t){if(Z.has(e))return;const r=e.attributes.getNamedItem(t.userSettings.xStyleAttribute);Z.set(e,r?t.handleStyleChange(e,r.value,[]):[]),function(e,t){null===U&&(U=new MutationObserver((function(e){for(const r of e){const e=r.target;Z.set(e,t.handleStyleChange(e,e.getAttribute(r.attributeName),Z.get(e)))}}))),U.observe(e,{attributes:!0,attributeOldValue:!0,childList:!0,attributeFilter:[t.userSettings.xStyleAttribute]})}(e,t);for(let r=e.firstElementChild;null!=r;r=r.nextElementSibling)H(r,t)}const B=/\\\n/g;const J=new class{constructor(){this.styles=null,this.cache=new Map;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}}")}getComputedStyles(){if(null===this.styles){this.styles=[];for(let e=0,t=document.styleSheets.length;eJ.getPropertyValue(e+"--mixin").replace(q,((e,r,o)=>t[parseInt(r)]||o||"")))(t,r))}X.set("space-x",(function(e,t,r){return"true"===r?`sibling!mr:${t||"0"}`:`sibling!ml:${t||"0"}`})),X.set("space-y",(function(e,t,r){return"true"===r?`sibling!mb:${t||"0"}`:`sibling!mt:${t||"0"}`})),X.set("grid",(function(){return"grid; l1!wb:break-all; l2!max-w:100%; child!justify-self:normal; child!align-self:normal"})),X.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%'})),X.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"})),X.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 Y=/@([a-zA-Z0-9\-_]+)/g,D=/\$(selector|body|class|value|property|state|variants|var)/g,Q=/;/,ee=/\s*,\s*(?![^(]*\))/gm;class te{constructor(e,t,r){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}handleStyleChange(e,t,r){if(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(" ")),s}handleStyleRemoved(e,t){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=E.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]||""),w.hasOwnProperty(a)&&(t=w[a](t,a,i,s)),t=Array.isArray(t)?t.map((e=>e.replace(Y,"var(--$1)"))):Array(n.length).fill(t.replace(Y,"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:M+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(Q))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(ee).map(L)),t.indexOf(i)>=0)throw t.push(i),new Error("Recursive mixin detected: "+t.join("->"));t.push(i),r.push(...this.getResolvedProperties(G(this.settings,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],y="";if(f)for(let e=0,t=f.length;e{switch(t){case"selector":return`${b+s+g}${a?":"+a:""}`;case"body":return y+l+": var("+p+") !important";case"variants":return y;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:""}{${y}${l}: var(${p}) !important}`;m&&(h+="}");const w=this.getRuleIndex(x);this.rules.splice(w,0,x);try{i.insertRule(h,this.padding+w)}catch(e){this.rules.splice(w,1),console.warn("Unsupported rule:",h)}}getRuleIndex(e){const{rules:t}=this;for(let r=0,o=t.length;re.trim())).filter((e=>""!==e)).map((e=>{const t=e.indexOf(":");return t<0?{name:e,aliases:[]}:{name:e.substr(0,t),aliases:e.substr(t+1).split(",").map((e=>e.trim())).filter((e=>""!==e))}})),x=["","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"];for(let e=0,t=l.length;e0&&(d[t.name]=t.aliases))}let m=["xs","sm","md","lg","xl"];i?(m.pop(),m.reverse()):m.shift(),m.unshift("all");const u=void 0===e.states?["normal","hover"]:K(e.states.toLowerCase());return-1===u.indexOf("normal")&&u.unshift("normal"),{enabled:t,generate:r,constructable:o,cache:n,cacheKey:a,desktopFirst:i,scopes:x,states:u,breakpoints:m,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:p}}(e||document.currentScript.dataset),!ie.enabled)return!1;let t,r;if(ie.constructable&&document.adoptedStyleSheets&&Object.isFrozen(document.adoptedStyleSheets)){if(r=new CSSStyleSheet,ie.generate){const e=T(ie);t=e.tracker,r.replaceSync(e.content)}else t=new Set,r.replaceSync(I(ie));document.adoptedStyleSheets=[...document.adoptedStyleSheets,r]}else{oe=!1;const e=document.createElement("style"),o=T(ie);t=o.tracker,e.id="opis-assembler-css",e.textContent=o.content,document.currentScript.parentElement.insertBefore(e,document.currentScript),r=e.sheet}return re=new te(ie,r,t),function(e,t){null===V&&(V=new MutationObserver((function(e){for(let r=0,o=e.length;r 0) { + PROPERTY_VARIANTS[prop.name] = prop.aliases; + } + } + } + // Consider all bp let breakpoints = ['xs', 'sm', 'md', 'lg', 'xl']; @@ -99,6 +113,7 @@ export function getUserSettings(dataset: {[key: string]: string}): UserSettings media: {xs, sm, md, lg, xl}, xStyleAttribute, selectorAttribute, + registeredProperties }; } @@ -135,6 +150,23 @@ function getStringItemList(value: string, unique: boolean = true): string[] { return unique ? items.filter(uniqueItems) : items; } +function getRegisteredProperties(value: string): {name: string, aliases:string[]}[] { + return value + .split(';') + .map(v => v.trim()) + .filter(v => v !== '') + .map(v => { + const index = v.indexOf(':'); + if (index < 0) { + return {name: v, aliases: []}; + } + return { + name: v.substr(0, index), + aliases: v.substr(index + 1).split(',').map(v => v.trim()).filter(v => v !== '') + } + }); +} + export function trim(value: string): string { return value.trim(); } diff --git a/src/list.ts b/src/list.ts index ee8ef1e..abb0feb 100644 --- a/src/list.ts +++ b/src/list.ts @@ -68,6 +68,7 @@ export const PROPERTY_LIST = [ "border-top-right-radius", "border-width", "bottom", + "box-orient", "box-shadow", "box-sizing", "clear", @@ -115,6 +116,7 @@ export const PROPERTY_LIST = [ "justify-self", "left", "letter-spacing", + "line-clamp", "line-height", "list-style-position", "list-style-type", @@ -182,7 +184,9 @@ export const PROPERTY_VARIANTS = { "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"] }; diff --git a/types/helpers.d.ts b/types/helpers.d.ts index 0bfa477..cf52920 100644 --- a/types/helpers.d.ts +++ b/types/helpers.d.ts @@ -17,6 +17,10 @@ export declare type UserSettings = { scopes: string[]; xStyleAttribute: string; selectorAttribute: string; + registeredProperties: { + name: string; + aliases: string[]; + }[]; }; declare type StyleType = string | { [key: string]: string; diff --git a/types/list.d.ts b/types/list.d.ts index 61af93c..3938509 100644 --- a/types/list.d.ts +++ b/types/list.d.ts @@ -4,7 +4,9 @@ export declare const PROPERTY_VARIANTS: { appearance: string[]; "background-clip": string[]; "backdrop-filter": string[]; + "box-orient": string[]; "column-gap": string[]; + "line-clamp": string[]; "user-select": string[]; "text-fill-color": string[]; };