@master/css 2.0.0-beta.127 → 2.0.0-beta.129
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/config/functions.js +1 -0
- package/dist/cjs/config/index.js +1 -1
- package/dist/cjs/config/rules.js +1 -1
- package/dist/cjs/css.js +1 -1
- package/dist/cjs/methods/render-from-html.js +1 -1
- package/dist/cjs/methods/render.js +1 -1
- package/dist/cjs/rule.js +1 -1
- package/dist/cjs/utils/parse-rule-value.js +1 -1
- package/dist/config/functions.d.ts +7 -0
- package/dist/config/index.d.ts +3 -1
- package/dist/css.d.ts +4 -5
- package/dist/esm/bin/index.mjs +2 -0
- package/dist/esm/config/colors.mjs +1 -0
- package/dist/esm/config/functions.mjs +1 -0
- package/dist/esm/config/index.mjs +1 -0
- package/dist/esm/config/rules.mjs +1 -0
- package/dist/esm/constants/sizing-values.mjs +1 -0
- package/dist/esm/css.mjs +1 -0
- package/dist/esm/index.browser.mjs +1 -0
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/methods/fill-color-scale.mjs +1 -0
- package/dist/esm/methods/index.mjs +1 -0
- package/dist/esm/methods/render-from-html.mjs +1 -0
- package/dist/esm/methods/render-into-html.mjs +1 -0
- package/dist/esm/methods/render.mjs +1 -0
- package/dist/esm/rule.mjs +1 -0
- package/dist/esm/utils/is-plain-object.mjs +1 -0
- package/dist/esm/utils/is-symbol.mjs +1 -0
- package/dist/esm/utils/parse-rule-value.mjs +1 -0
- package/dist/index.browser.js +1 -1
- package/dist/index.js +10 -10
- package/dist/index.mjs +11 -11
- package/dist/rule.d.ts +20 -23
- package/package.json +1 -1
- package/dist/cjs/utils/analyze-unit-value.js +0 -1
- package/dist/cjs/utils/analyze-value-token.js +0 -1
- package/dist/cjs/utils/get-border-props.js +0 -1
- package/dist/cjs/utils/get-css-property-text.js +0 -1
- package/dist/cjs/utils/normalize-css-calc-text.js +0 -1
- package/dist/cjs/utils/parse-value-unit.js +0 -1
- package/dist/esm/bin/index.js +0 -2
- package/dist/esm/config/colors.js +0 -1
- package/dist/esm/config/index.js +0 -1
- package/dist/esm/config/rules.js +0 -1
- package/dist/esm/constants/sizing-values.js +0 -1
- package/dist/esm/css.js +0 -1
- package/dist/esm/index.browser.js +0 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/methods/fill-color-scale.js +0 -1
- package/dist/esm/methods/index.js +0 -1
- package/dist/esm/methods/render-from-html.js +0 -1
- package/dist/esm/methods/render-into-html.js +0 -1
- package/dist/esm/methods/render.js +0 -1
- package/dist/esm/rule.js +0 -1
- package/dist/esm/utils/analyze-unit-value.js +0 -1
- package/dist/esm/utils/analyze-value-token.js +0 -1
- package/dist/esm/utils/get-border-props.js +0 -1
- package/dist/esm/utils/get-css-property-text.js +0 -1
- package/dist/esm/utils/is-plain-object.js +0 -1
- package/dist/esm/utils/is-symbol.js +0 -1
- package/dist/esm/utils/normalize-css-calc-text.js +0 -1
- package/dist/esm/utils/parse-rule-value.js +0 -1
- package/dist/esm/utils/parse-value-unit.js +0 -1
- package/dist/utils/analyze-unit-value.d.ts +0 -4
- package/dist/utils/analyze-value-token.d.ts +0 -3
- package/dist/utils/get-border-props.d.ts +0 -3
- package/dist/utils/get-css-property-text.d.ts +0 -5
- package/dist/utils/normalize-css-calc-text.d.ts +0 -5
- package/dist/utils/parse-value-unit.d.ts +0 -2
- /package/dist/esm/config/{breakpoints.js → breakpoints.mjs} +0 -0
- /package/dist/esm/config/{important.js → important.mjs} +0 -0
- /package/dist/esm/config/{observe.js → observe.mjs} +0 -0
- /package/dist/esm/config/{override.js → override.mjs} +0 -0
- /package/dist/esm/config/{root-size.js → root-size.mjs} +0 -0
- /package/dist/esm/config/{scope.js → scope.mjs} +0 -0
- /package/dist/esm/config/{selectors.js → selectors.mjs} +0 -0
- /package/dist/esm/config/{semantics.js → semantics.mjs} +0 -0
- /package/dist/esm/config/{themes.js → themes.mjs} +0 -0
- /package/dist/esm/constants/{box-underneath.js → box-underneath.mjs} +0 -0
- /package/dist/esm/constants/{content-extrema.js → content-extrema.mjs} +0 -0
- /package/dist/esm/constants/{selector-symbols.js → selector-symbols.mjs} +0 -0
- /package/dist/esm/constants/{sorted-selectors.js → sorted-selectors.mjs} +0 -0
- /package/dist/esm/constants/{start-symbol.js → start-symbol.mjs} +0 -0
- /package/dist/esm/methods/{define-content.js → define-content.mjs} +0 -0
- /package/dist/esm/polyfills/{css-escape.js → css-escape.mjs} +0 -0
- /package/dist/esm/{theme.js → theme.mjs} +0 -0
- /package/dist/esm/utils/{concat-arrays.js → concat-arrays.mjs} +0 -0
- /package/dist/esm/utils/{css-escape.js → css-escape.mjs} +0 -0
- /package/dist/esm/utils/{delay.js → delay.mjs} +0 -0
- /package/dist/esm/utils/{get-type.js → get-type.mjs} +0 -0
- /package/dist/esm/utils/{hex-to-rgb.js → hex-to-rgb.mjs} +0 -0
- /package/dist/esm/utils/{read-package.js → read-package.mjs} +0 -0
- /package/dist/esm/utils/{rgb-to-hex.js → rgb-to-hex.mjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var f=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var h=(e,n)=>{for(var s in n)f(e,s,{get:n[s],enumerable:!0})},b=(e,n,s,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of k(n))!w.call(e,i)&&i!==s&&f(e,i,{get:()=>n[i],enumerable:!(a=m(n,i))||a.enumerable});return e};var p=e=>b(f({},"__esModule",{value:!0}),e);var v={};h(v,{functions:()=>c});module.exports=p(v);var c={$:{native:"var",transform(e){return"--"+e}},calc:{transform(e){let n=r=>r==="+"||r==="-"||r==="*"||r==="/",s="",a,i="",g=!1,l=!1,u=(r,t="",d="")=>{if(a===2&&!l){let o=this.analyzeUnitValue(i,c.calc.unit);o&&(i=o.value+o.unit)}s+=i+t+r+d,a=null,l=!1,i=""};for(let r=0;r<e.length;r++){let t=e[r];if(t==="("||t===")")g=t===")",u(t);else if(t===",")u(t,""," ");else{switch(a){case 1:break;case 2:if(n(t)){u(t," "," ");continue}else/[0-9]/.test(t)||(l=!0);break;default:g&&(s+=" "),isNaN(+t)?n(t)||(a=1):a=2;break}a?i+=t:s+=t}}return u(""),s}},translate:{unit:"rem"},translateX:{unit:"rem"},translateY:{unit:"rem"},translateZ:{unit:"rem"},translate3d:{unit:"rem"},skew:{unit:"deg"},skewX:{unit:"deg"},skewY:{unit:"deg"},skewZ:{unit:"deg"},skew3d:{unit:"deg"},rotate:{unit:"deg"},rotateX:{unit:"deg"},rotateY:{unit:"deg"},rotateZ:{unit:"deg"},rotate3d:{unit:"deg"},blur:{unit:"rem"},"drop-shadow":{unit:"rem"},"hue-rotate":{unit:"deg"},rgb:{unit:""},rgba:{unit:""},hsl:{unit:""},hsla:{unit:""}};0&&(module.exports={functions});
|
package/dist/cjs/config/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=Object.defineProperty;var
|
|
1
|
+
var t=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var B=(r,e)=>{for(var o in e)t(r,o,{get:e[o],enumerable:!0})},v=(r,e,o,k)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of S(e))!d.call(r,s)&&s!==o&&t(r,s,{get:()=>e[s],enumerable:!(k=b(e,s))||k.enumerable});return r};var R=r=>v(t({},"__esModule",{value:!0}),r);var x={};B(x,{breakpoints:()=>i.breakpoints,colors:()=>n.colors,config:()=>Q,functions:()=>C.functions,important:()=>y.important,observe:()=>u.observe,override:()=>f.override,rootSize:()=>m.rootSize,rules:()=>g.rules,scope:()=>a.scope,selectors:()=>p.selectors,semantics:()=>l.semantics,themes:()=>c.themes});module.exports=R(x);var i=require("./breakpoints"),n=require("./colors"),m=require("./root-size"),a=require("./scope"),p=require("./selectors"),l=require("./semantics"),c=require("./themes"),g=require("./rules"),f=require("./override"),u=require("./observe"),y=require("./important"),C=require("./functions"),Q={breakpoints:i.breakpoints,colors:n.colors,rootSize:m.rootSize,scope:a.scope,selectors:p.selectors,semantics:l.semantics,themes:c.themes,rules:g.rules,override:f.override,observe:u.observe,important:y.important,functions:C.functions};0&&(module.exports={breakpoints,colors,config,functions,important,observe,override,rootSize,rules,scope,selectors,semantics,themes});
|
package/dist/cjs/config/rules.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var y=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var A=(e,t)=>{for(var r in t)y(e,r,{get:t[r],enumerable:!0})},T=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of C(t))!R.call(e,n)&&n!==r&&y(e,n,{get:()=>t[n],enumerable:!(s=$(t,n))||s.enumerable});return e};var I=e=>T(y({},"__esModule",{value:!0}),e);var z={};A(z,{rules:()=>N});module.exports=I(z);var f=require("../utils/analyze-value-token"),b=require("../utils/get-border-props"),v=require("../utils/parse-value-unit"),k=require("../constants/start-symbol"),p=require("../constants/box-underneath"),x=require("../constants/content-extrema"),m=require("../constants/sizing-values"),w=require("../utils/css-escape"),N={group:{matches:"^(?:.+?[*_>~+])?\\{.+?\\}",unit:"",prop:!1,analyzeToken(e,t,r){let s=0;for(;s<e.length&&!(e[s]==="{"&&e[s-1]!=="\\");s++);return[e.slice(0,s),...(0,f.analyzeValueToken)(e.slice(s),t,r)]},getThemeProps(e,t){let r={},s=(o,a)=>{let i=a.indexOf(":");if(i!==-1){o in r||(r[o]={});let c=r[o],h=a.slice(0,i);h in c||(c[h]=a.slice(i+1))}},n=o=>{let a=(i,c)=>{let h=c.slice((0,w.cssEscape)(o.className).length).match(/\{(.*)\}/)[1].split(";");for(let S of h)s(i,S)};if(this.theme){let i=o.natives.find(c=>c.theme===this.theme)??o.natives.find(c=>!c.theme);i&&a(this.theme,i.text)}else for(let i of o.natives)a(i.theme,i.text)},u=[],l="",d=()=>{l&&(u.push(l.replace(/ /g,"")),l="")},g=1;(function o(a){for(;g<e.value.length;g++){let i=e.value[g];if(!a){if(i===";"){d();continue}if(i==="}")break}if(l+=i,a===i){if(a==="'"||a==='"'){let c=0;for(let h=l.length-2;l[h]==="\\";h--)c++;if(c%2)continue}break}else i in k.START_SYMBOL&&a!=="'"&&a!=='"'&&(g++,o(k.START_SYMBOL[i]))}})(void 0),d();for(let o of u){let a=t.create(o);if(Array.isArray(a))for(let i of a)n(i);else a?n(a):s(this.theme??"",o)}return r}},variable:{matches:"^\\$[^ (){}A-Z]+:[^ ]",unit:"",prop:!1,get(e){return{["--"+this.prefix.slice(1,-1)]:e}}},fontSize:{matches:"^f(?:ont)?:(?:[0-9]|(?:max|min|calc|clamp)\\(.*\\)|$values)[^|]*$"},fontWeight:{matches:"^f(?:ont)?:(?:bolder|$values)(?!\\|)",unit:"",values:{thin:100,extralight:200,light:300,regular:400,medium:500,semibold:600,bold:700,extrabold:800,heavy:900}},fontFamily:{matches:"^f(?:ont)?:(?:$values)(?!\\|)",values:{mono:"ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace",sans:"ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji",serif:"ui-serif,Georgia,Cambria,Times New Roman,Times,serif"}},fontSmoothing:{matches:"^f(?:ont)?:(?:antialiased|subpixel-antialiased|$values)(?!\\|)",unit:"",prop:!1,get(e){let t={};switch(e.value){case"subpixel-antialiased":t["-webkit-font-smoothing"]=t["-moz-osx-font-smoothing"]={...e,value:"auto"};break;case"antialiased":t["-webkit-font-smoothing"]={...e,value:"antialiased"},t["-moz-osx-font-smoothing"]={...e,value:"grayscale"};break}return t}},fontStyle:{matches:"^f(?:ont)?:(?:normal|italic|oblique|$values)(?!\\|)",unit:"deg"},fontVariantNumeric:{matches:"^f(?:ont)?:(?:ordinal|slashed-zero|lining-nums|oldstyle-nums|proportional-nums|tabular-nums|diagonal-fractions|stacked-fractions|$values)(?!\\|)"},fontFeatureSettings:{matches:"^font-feature:."},font:{matches:"^f:.",unit:"",order:-1},color:{matches:"^(?:color|fg|foreground):.",colorful:!0,unit:""},spacing:{matches:"^[pm][xytblr]?:.",prop:!1,get(e){let r=this.prefix[0]==="m"?"margin":"padding",s=r+"-left",n=r+"-right",u=r+"-top",l=r+"-bottom";switch(this.prefix[1]){case"x":return{[s]:e,[n]:e};case"y":return{[u]:e,[l]:e};case"l":return{[s]:e};case"r":return{[n]:e};case"t":return{[u]:e};case"b":return{[l]:e};default:return{[r]:e}}},get order(){return this.prefix==="p:"||this.prefix==="m:"?-1:0}},margin:{matches:"^margin(?:-(?:left|right|top|bottom))?:.",prop:!1,get(e){return{[this.prefix.slice(0,-1)]:e}},get order(){return this.prefix==="margin:"?-1:0}},padding:{matches:"^padding(?:-(?:left|right|top|bottom))?:.",prop:!1,get(e){return{[this.prefix.slice(0,-1)]:e}},get order(){return this.prefix==="padding:"?-1:0}},flexBasis:{values:m.SIZING_VALUES},flexWrap:{matches:"^flex:(?:wrap(?:-reverse)?|nowrap|$values)(?!\\|)"},flexGrow:{unit:""},flexShrink:{unit:""},flexDirection:{matches:"^flex:(?:(?:row|column)(?:-reverse)?|$values)(?!\\|)",values:{col:"column","col-reverse":"column-reverse"}},flex:{unit:"",order:-1},display:{matches:"^d:."},width:{matches:"^w:.",values:m.SIZING_VALUES},height:{matches:"^h:.",values:m.SIZING_VALUES},minWidth:{matches:"^min-w:.",values:m.SIZING_VALUES},minHeight:{matches:"^min-h:.",values:m.SIZING_VALUES},wH:{matches:"^(?:(?:max|min|clamp|calc)\\(.+\\)|[0-9]+[a-z]*?)x(?:(?:max|min|clamp|calc)\\(.+\\)|[0-9]+[a-z]*?)",prop:!1,analyzeToken(e,t,r){return["",...(0,f.analyzeValueToken)(e,t,r,["x"])]},get(e){let[t,r]=e.value.split(" x ");return{width:{...e,value:t},height:{...e,value:r}}}},minWH:{matches:"^min:(?:(?:max|min|clamp|calc)\\(.+\\)|[0-9]+[a-z]*?)x(?:(?:max|min|clamp|calc)\\(.+\\)|[0-9]+[a-z]*?)",prop:!1,analyzeToken(e,t,r){return["",...(0,f.analyzeValueToken)(e.slice(4),t,r,["x"])]},get(e){let[t,r]=e.value.split(" x ");return{"min-width":{...e,value:t},"min-height":{...e,value:r}}}},maxWH:{matches:"^max:(?:(?:max|min|clamp|calc)\\(.+\\)|[0-9]+[a-z]*?)x(?:(?:max|min|clamp|calc)\\(.+\\)|[0-9]+[a-z]*?)",prop:!1,analyzeToken(e,t,r){return["",...(0,f.analyzeValueToken)(e.slice(4),t,r,["x"])]},get(e){let[t,r]=e.value.split(" x ");return{"max-width":{...e,value:t},"max-height":{...e,value:r}}}},contain:{},content:{},counterIncrement:{unit:""},counterReset:{unit:""},letterSpacing:{matches:"^ls:.",unit:"em"},lineHeight:{matches:"^lh:.",unit:""},objectFit:{matches:"^(?:object|obj):(?:contain|cover|fill|scale-down|$values)"},objectPosition:{matches:"^(?:object|obj):(?:top|bottom|right|left|center|$values)"},textAlign:{matches:"^t(?:ext)?:(?:justify|center|left|right|start|end|$values)(?!\\|)"},textDecorationColor:{colorStarts:"text-decoration:",colorful:!0},textDecorationStyle:{matches:"^t(?:ext)?:(?:solid|double|dotted|dashed|wavy|$values)(?!\\|)"},textDecorationThickness:{matches:"^text-decoration:(?:\\.?[0-9]|(?:max|min|calc|clamp)\\(.*\\)|from-font|$values)[^|]*$",unit:"em"},textDecorationLine:{matches:"^t(?:ext)?:(?:none|underline|overline|line-through|$values)(?!\\|)"},textDecoration:{matches:"^t(?:ext)?:(?:underline|line-through|overline|$values)",colorful:!0,order:-1},textUnderlineOffset:{},textOverflow:{matches:"^(?:text-(?:overflow|ovf):.|t(?:ext)?:(?:ellipsis|clip|$values)(?!\\|))"},textOrientation:{matches:"^t(?:ext)?:(?:mixed|upright|sideways-right|sideways|use-glyph-orientation|$values)(?!\\|)"},textTransform:{matches:"^t(?:ext)?:(?:uppercase|lowercase|capitalize|$values)(?!\\|)"},textRendering:{matches:"^t(?:ext)?:(?:optimizeSpeed|optimizeLegibility|geometricPrecision|$values)(?!\\|)"},textIndent:{},verticalAlign:{matches:"^(?:v|vertical):."},columns:{matches:"^(?:columns|cols):.",unit:"",order:-1},whiteSpace:{unit:""},inset:{matches:"^(?:top|bottom|left|right):.",get(e){return{[this.prefix.slice(0,-1)]:e}}},lines:{matches:"^lines:.",unit:"",prop:!1,get(e){return{overflow:{...e,value:"hidden"},display:{...e,value:"-webkit-box"},"overflow-wrap":{...e,value:"break-word"},"text-overflow":{...e,value:"ellipsis"},"-webkit-box-orient":{...e,value:"vertical"},"-webkit-line-clamp":e}}},maxHeight:{matches:"^max-h:.",values:m.SIZING_VALUES},maxWidth:{matches:"^max-w:.",values:m.SIZING_VALUES},boxSizing:{matches:"^box:(?:$values)(?!\\|)",values:{content:"content-box",border:"border-box"}},opacity:{unit:""},visibility:{},clear:{},float:{},isolation:{},overflow:{matches:"^overflow(?:-x|-y)?:(?:visible|overlay|hidden|scroll|auto|clip|inherit|initial|revert|revert-layer|unset|\\$|var|$values)",prop:!1,get(e){if(this.prefix)switch(this.prefix.slice(-2,-1)){case"x":return{"overflow-x":e};case"y":return{"overflow-y":e}}return{overflow:e}},get order(){return-1}},overscrollBehavior:{matches:"^overscroll-behavior(?:-[xy])?:",prop:!1,get(e){switch(this.prefix.slice(-2,-1)){case"x":return{"overscroll-behavior-x":e};case"y":return{"overscroll-behavior-y":e};default:return{"overscroll-behavior":e}}}},zIndex:{matches:"^z:.",unit:""},position:{values:{abs:"absolute",rel:"relative"}},cursor:{},pointerEvents:{},resize:{},touchAction:{},wordBreak:{unit:""},wordSpacing:{unit:"em"},userDrag:{get(e){return{"user-drag":e,"-webkit-user-drag":e}}},userSelect:{get(e){return{"user-select":e,"-webkit-user-select":e}}},textShadow:{colorful:!0},textSize:{matches:"^t(?:ext)?:(?:\\.?[0-9]|(?:max|min|calc|clamp)\\(.*\\)|$values)[^|]*$",prop:!1,get(e){let{unit:t,value:r}=e,s=.75;return{"font-size":e,"line-height":{...e,value:t==="em"?r+s+t:`calc(${r}${t} + ${s}em)`,unit:""}}}},textFillColor:{matches:"^text-fill-color:.",colorStarts:"(?:text-fill|text|t):",colorful:!0,prop:!1,get(e){return{"-webkit-text-fill-color":e}}},textStrokeWidth:{matches:"^text-stroke(:(thin|medium|thick|\\.?[0-9]+|$values)(?!\\|)|-width:.)",prop:!1,get(e){return{"-webkit-text-stroke-width":e}}},textStrokeColor:{matches:"^text-stroke-color:.",colorStarts:"text-stroke:",colorful:!0,prop:!1,get(e){return{"-webkit-text-stroke-color":e}}},textStroke:{matches:"^text-stroke:.",prop:!1,get(e){return{"-webkit-text-stroke":e}}},boxShadow:{matches:"^s(?:hadow)?:.",colorful:!0},tableLayout:{},transformBox:{matches:"^transform:(?:$values)(?!\\|)",values:{...p.BOX_UNDERNEATH,fill:"fill-box",stroke:"stroke-box",view:"view-box"}},transformStyle:{matches:"^transform:(?:flat|preserve-3d|$values)(?!\\|)"},transformOrigin:{matches:"^transform:(?:top|bottom|right|left|center|[0-9]|$values)",unit:"px"},transform:{matches:"^(?:translate|scale|skew|rotate|perspective|matrix)(?:3d|[XYZ])?\\(",unit:"",parseValue(e,{rootSize:t}){return e.replace(/(translate|scale|skew|rotate|perspective|matrix)(3d|[XYZ])?\((.*?)\)/g,(r,s,n,u)=>{let l,d;switch(s){case"translate":l="rem";break;case"skew":l="deg";break;case"rotate":n==="3d"&&(d=!0),l="deg";break;default:return r}let g=u.split(",");return r.replace(u,g.map((o,a)=>!d||g.length-1===a?Number.isNaN(+o)?o:o/(l==="rem"?t:1)+l:o).join(","))})}},transitionProperty:{matches:"^~property:."},transitionTimingFunction:{matches:"^~easing:."},transitionDuration:{matches:"^~duration:.",unit:"ms"},transitionDelay:{matches:"^~delay:.",unit:"ms"},transition:{symbol:"~",order:-1},animationDelay:{matches:"^@delay:.",unit:"ms"},animationDirection:{matches:"^@direction:."},animationDuration:{matches:"^@duration:.",unit:"ms"},animationFillMode:{matches:"^@fill-mode:."},animationIterationCount:{matches:"^@iteration-count:.",unit:""},animationName:{matches:"^@name:."},animationPlayState:{matches:"^@play-state:."},animationTimingFunction:{matches:"^@easing:."},animation:{symbol:"@",unit:"",order:-1},borderColor:{matches:"^border(?:-(?:left|right|top|bottom))?-color:.",colorStarts:"b(?:[xytblr]|(?:order(?:-(?:left|right|top|bottom))?))?:",colorful:!0,prop:!1,get(e){return(0,b.getBorderProps)(this.prefix,e,"color")},get order(){return this.prefix==="border-color:"||this.prefix==="b:"||this.prefix==="border:"?-1:0}},borderRadius:{matches:"^(?:r[tblr]?[tblr]?|border(?:-(?:top|bottom)-(?:left|right))?-radius):.",prop:!1,get(e){if(this.prefix){let r="",s=this.prefix.split("-");if(s.length>1)for(let n=1;n<s.length-1;n++)r+=s[n][0];else r=this.prefix.slice(1,-1);switch(r){case"t":return{"border-top-left-radius":e,"border-top-right-radius":e};case"tl":case"lt":return{"border-top-left-radius":e};case"rt":case"tr":return{"border-top-right-radius":e};case"b":return{"border-bottom-left-radius":e,"border-bottom-right-radius":e};case"bl":case"lb":return{"border-bottom-left-radius":e};case"br":case"rb":return{"border-bottom-right-radius":e};case"l":return{"border-top-left-radius":e,"border-bottom-left-radius":e};case"r":return{"border-top-right-radius":e,"border-bottom-right-radius":e};default:return{"border-radius":e}}}let t=this.prefix?.slice(0,-1);return{[["border-top-left-radius","border-top-right-radius","border-bottom-left-radius","border-bottom-right-radius"].includes(t)?t:"border-radius"]:e}},get order(){return this.prefix==="border-radius:"||this.prefix==="r:"?-1:0}},borderStyle:{matches:"^(?:border(?:-(?:left|right|top|bottom))?-style:.|b(?:[xytblr]|order(?:-(?:left|right|top|bottom))?)?:(?:none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset|$values)(?!\\|))",prop:!1,get(e){return(0,b.getBorderProps)(this.prefix,e,"style")},get order(){return this.prefix==="border-style:"||this.prefix==="b:"||this.prefix==="border:"?-1:0}},borderWidth:{matches:"^(?:border(?:-(?:left|right|top|bottom))?-width:.|b(?:[xytblr]|order(?:-(?:left|right|top|bottom))?)?:(?:\\.?[0-9]|(?:max|min|calc|clamp)\\(.*\\)|$values)[^|]*$)",prop:!1,get(e){return(0,b.getBorderProps)(this.prefix,e,"width")},get order(){return this.prefix==="border-width:"||this.prefix==="b:"||this.prefix==="border:"?-1:0}},borderCollapse:{matches:"^b(?:order)?:(?:collapse|separate|$values)(?!\\|)"},borderSpacing:{},borderImageOutset:{},borderImageRepeat:{matches:"^border-image:(?:stretch|repeat|round|space|$values)(?!\\|)"},borderImageSlice:{unit:""},borderImageSource:{matches:"^border-image:(?:(?:url|linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient|conic-gradient)\\(.*\\)|$values)(?!\\|)"},borderImageWidth:{matches:"^border-image:(?:\\.?[0-9]|(?:max|min|calc|clamp)\\(.*\\)|$values)[^|]*$"},borderImage:{unit:""},border:{matches:"^b(?:[xytblr]?|order(?:-(?:left|right|top|bottom))?):.",colorful:!0,prop:!1,get(e){return(0,b.getBorderProps)(this.prefix,e)},get order(){return this.prefix==="border:"||this.prefix==="b:"?-2:-1}},backgroundAttachment:{matches:"^(?:bg|background):(?:fixed|local|scroll|$values)(?!\\|)"},backgroundBlendMode:{},backgroundColor:{colorStarts:"(?:bg|background):",unit:"",colorful:!0},backgroundClip:{matches:"^(?:bg|background):(?:text|$values)(?!\\|)",get(e){return{"-webkit-background-clip":e,"background-clip":e}},values:p.BOX_UNDERNEATH},backgroundOrigin:{matches:"^(?:bg|background):(?:$values)(?!\\|)",values:p.BOX_UNDERNEATH},backgroundPosition:{matches:"^(?:bg|background):(?:top|bottom|right|left|center|$values)(?!\\|)",unit:"px"},backgroundRepeat:{matches:"^(?:bg|background):(?:space|round|repeat|no-repeat|repeat-x|repeat-y|$values)(?![|a-zA-Z])"},backgroundSize:{matches:"^(?:bg|background):(?:\\.?\\[0-9]+|auto|cover|contain|$values)(?!\\|)"},backgroundImage:{matches:"^(?:bg|background):(?:(?:url|linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient|conic-gradient)\\(.*\\)|$values)(?!\\|)",colorful:!0},background:{matches:"^bg:.",colorful:!0,order:-1},mixBlendMode:{matches:"^blend:."},backdropFilter:{matches:"^bd:.",colorful:!0,get(e){return{"backdrop-filter":e,"-webkit-backdrop-filter":e}},parseValue(e,t){return(0,v.parseValueUnit)(e,r=>{switch(r){case"blur":case"drop-shadow":return"rem";case"hue-rotate":return"deg"}return""},t)}},filter:{matches:"^(?:blur|brightness|contrast|drop-shadow|grayscale|hue-rotate|invert|opacity|saturate|sepia)\\(",colorful:!0,parseValue(e,t){return(0,v.parseValueUnit)(e,r=>{switch(r){case"blur":case"drop-shadow":return"rem";case"hue-rotate":return"deg"}return""},t)}},fill:{colorStarts:"fill:",colorful:!0},strokeDasharray:{},strokeDashoffset:{},strokeWidth:{matches:"^stroke:(?:\\.?[0-9]|(?:max|min|calc|clamp)\\(.*\\)|$values)[^|]*$"},stroke:{colorful:!0},x:{unit:""},y:{unit:""},cx:{unit:""},cy:{unit:""},rx:{unit:""},ry:{unit:""},gridColumnStart:{matches:"^grid-col-start:.",unit:""},gridColumnEnd:{matches:"^grid-col-end:.",unit:""},gridColumn:{matches:"^grid-col(?:umn)?(?:-span)?:.",unit:"",order:-1,parseValue(e){return this.prefix.slice(-5,-1)==="span"&&e!=="auto"?"span "+e+"/span "+e:e}},gridColumns:{matches:"^grid-cols:.",unit:"",get(e){return{display:{...e,value:"grid"},"grid-template-columns":{...this,value:"repeat("+e.value+",minmax(0,1fr))"}}}},gridRowStart:{unit:""},gridRowEnd:{unit:""},gridRow:{matches:"^grid-row-span:.",unit:"",order:-1,parseValue(e){return this.prefix.slice(-5,-1)==="span"&&e!=="auto"?"span "+e+"/span "+e:e}},gridRows:{unit:"",get(e){return{display:{...e,value:"grid"},"grid-auto-flow":{...e,value:"column"},"grid-template-rows":{...e,value:"repeat("+e.value+",minmax(0,1fr))"}}}},gridAutoColumns:{matches:"^grid-auto-cols:.",values:x.CONTENT_EXTREMA},gridAutoFlow:{matches:"^grid-flow:."},gridAutoRows:{values:x.CONTENT_EXTREMA},gridTemplateAreas:{},gridTemplateColumns:{matches:"^grid-template-cols:.",values:x.CONTENT_EXTREMA},gridTemplateRows:{values:x.CONTENT_EXTREMA},gridTemplate:{order:-1},gridArea:{unit:"",order:-1},grid:{order:-1},gap:{matches:"^gap(?:-x|-y)?:.",order:-1,prop:!1,get(e){switch(this.prefix[4]){case"x":return{"column-gap":e};case"y":return{"row-gap":e};default:return{gap:e}}}},order:{matches:"^o:.",unit:"",values:{first:-999999,last:999999}},breakInside:{},breakBefore:{},breakAfter:{},boxDecorationBreak:{matches:"^box:(?:slice|clone|$values)(?!\\|)",get(e){return{"box-decoration-break":e,"-webkit-box-decoration-break":e}}},aspectRatio:{matches:"^aspect:.",unit:""},columnSpan:{matches:"^col-span:."},alignContent:{matches:"^ac:."},alignItems:{matches:"^ai:."},alignSelf:{matches:"^as:"},justifyContent:{matches:"^jc:."},justifyItems:{matches:"^ji:."},justifySelf:{matches:"^js:."},placeContent:{order:-1},placeItems:{order:-1},placeSelf:{order:-1},listStylePosition:{matches:"^list-style:(?:inside|outside|$values)(?!\\|)"},listStyleType:{matches:"^list-style:(?:disc|decimal|$values)(?!\\|)"},listStyleImage:{matches:"^list-style:(?:(?:url|linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient|conic-gradient)\\(.*\\)|$values)(?!\\|)"},listStyle:{order:-1},outlineColor:{colorStarts:"outline:",colorful:!0},outlineOffset:{},outlineStyle:{matches:"^outline:(?:none|dotted|dashed|solid|double|groove|ridge|inset|outset|$values)(?!\\|)"},outlineWidth:{matches:"^outline:(?:\\.?[0-9]|medium|thick|thin|(max|min|calc|clamp)\\(.*\\)|$values)[^|]*$"},outline:{order:-1,colorful:!0},accentColor:{colorStarts:"accent:",colorful:!0},appearance:{},caretColor:{colorStarts:"caret:",colorful:!0},scrollBehavior:{},scrollMargin:{matches:"^scroll-m(?:[xytblr]|argin(?:-(?:top|bottom|left|right))?)?:.",prop:!1,get(e){if(this.prefix.slice(-3,-2)==="m")switch(this.prefix.slice(-2,-1)){case"x":return{"scroll-margin-left":e,"scroll-margin-right":e};case"y":return{"scroll-margin-top":e,"scroll-margin-bottom":e};case"l":return{"scroll-margin-left":e};case"r":return{"scroll-margin-right":e};case"t":return{"scroll-margin-top":e};case"b":return{"scroll-margin-bottom":e}}else return{[this.prefix.replace(/-m(?!argin)/,"-margin").slice(0,-1)]:e}},get order(){return this.prefix==="scroll-margin:"||this.prefix==="scroll-m:"?-1:0}},scrollPadding:{matches:"^scroll-p(?:[xytblr]|adding(?:-(?:top|bottom|left|right))?)?:.",prop:!1,get(e){if(this.prefix.slice(-3,-2)==="p")switch(this.prefix.slice(-2,-1)){case"x":return{"scroll-padding-left":e,"scroll-padding-right":e};case"y":return{"scroll-padding-top":e,"scroll-padding-bottom":e};case"l":return{"scroll-padding-left":e};case"r":return{"scroll-padding-right":e};case"t":return{"scroll-padding-top":e};case"b":return{"scroll-padding-bottom":e}}else return{[this.prefix.replace(/-p(?!adding)/,"-padding").slice(0,-1)]:e}},get order(){return this.prefix==="scroll-padding:"||this.prefix==="scroll-p:"?-1:0}},scrollSnapAlign:{matches:"^scroll-snap:(?:start|end|center|$values)"},scrollSnapStop:{matches:"^scroll-snap:(?:normal|always|$values)(?!\\|)"},scrollSnapType:{matches:"^scroll-snap:(?:(?:[xy]|block|inline|both)(?:\\|(?:proximity|mandatory))?|$values)(?!\\|)"},willChange:{},writingMode:{matches:"^writing:."},direction:{},shapeOutside:{matches:"^shape:(?:(?:inset|circle|ellipse|polygon|url|linear-gradient)\\(.*\\)|$values)(?!\\|)",values:{...p.BOX_UNDERNEATH,margin:"margin-box"}},shapeMargin:{matches:"^shape:(?:\\.?[0-9]|(?:max|min|calc|clamp)\\(.*\\)|$values)[^|]*$"},shapeImageThreshold:{unit:""},clipPath:{matches:"^clip:.",values:{...p.BOX_UNDERNEATH,margin:"margin-box",fill:"fill-box",stroke:"stroke-box",view:"view-box"}},quotes:{},maskImage:{get(e){return{"mask-image":e,"-webkit-mask-image":e}}}};0&&(module.exports={rules});
|
|
1
|
+
var f=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var R=(e,t)=>{for(var r in t)f(e,r,{get:t[r],enumerable:!0})},T=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of C(t))!S.call(e,n)&&n!==r&&f(e,n,{get:()=>t[n],enumerable:!(o=k(t,n))||o.enumerable});return e};var I=e=>T(f({},"__esModule",{value:!0}),e);var z={};R(z,{rules:()=>A});module.exports=I(z);var x=require("../constants/start-symbol"),v=require("../constants/box-underneath"),p=require("../constants/content-extrema"),d=require("../constants/sizing-values"),$=require("../utils/css-escape"),A={group:{match:"^(?:.+?[*_>~+])?\\{.+?\\}",analyze(e){let t=0;for(;t<e.length&&!(e[t]==="{"&&e[t-1]!=="\\");t++);return[e.slice(t),e.slice(0,t)]},declare(e){let t={},r=(l,i)=>{let a=i.indexOf(":");if(a!==-1){l in t||(t[l]={});let c=t[l],g=i.slice(0,a);g in c||(c[g]=i.slice(a+1))}},o=l=>{let i=(a,c)=>{let g=c.slice((0,$.cssEscape)(l.className).length).match(/\{(.*)\}/)[1].split(";");for(let w of g)r(a,w)};if(this.theme){let a=l.natives.find(c=>c.theme===this.theme)??l.natives.find(c=>!c.theme);a&&i(this.theme,a.text)}else for(let a of l.natives)i(a.theme,a.text)},n=[],s="",u=()=>{s&&(n.push(s.replace(/ /g,"")),s="")},h=1;(function l(i){for(;h<e.length;h++){let a=e[h];if(!i){if(a===";"){u();continue}if(a==="}")break}if(s+=a,i===a){if(i==="'"||i==='"'){let c=0;for(let g=s.length-2;s[g]==="\\";g--)c++;if(c%2)continue}break}else a in x.START_SYMBOL&&i!=="'"&&i!=='"'&&(h++,l(x.START_SYMBOL[a]))}})(void 0),u();for(let l of n){let i=this.css.create(l);if(Array.isArray(i))for(let a of i)o(a);else i?o(i):r(this.theme??"",l)}let m={};for(let l in t)for(let[i,a]of Object.entries(t[l]))i in m?m[i][l]=a:m[i]={[l]:a};return console.log(m),m}},variable:{match:"^\\$[^ (){}A-Z]+:[^ ]",declare(e){return{["--"+this.prefix.slice(1,-1)]:e}}},fontSize:{match:"^f(?:ont)?:(?:[0-9]|(?:max|min|calc|clamp)\\(.*\\)|$values)[^|]*$",unit:"rem",native:!0},fontWeight:{match:"^f(?:ont)?:(?:bolder|$values)(?!\\|)",native:!0,values:{thin:100,extralight:200,light:300,regular:400,medium:500,semibold:600,bold:700,extrabold:800,heavy:900}},fontFamily:{match:"^f(?:ont)?:(?:$values)(?!\\|)",native:!0,values:{mono:"ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace",sans:"ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji",serif:"ui-serif,Georgia,Cambria,Times New Roman,Times,serif"}},fontSmoothing:{match:"^f(?:ont)?:(?:antialiased|subpixel-antialiased|$values)(?!\\|)",declare(e){let t={};switch(e){case"subpixel-antialiased":t["-webkit-font-smoothing"]=t["-moz-osx-font-smoothing"]="auto";break;case"antialiased":t["-webkit-font-smoothing"]="antialiased",t["-moz-osx-font-smoothing"]="grayscale";break}return t}},fontStyle:{match:"^f(?:ont)?:(?:normal|italic|oblique|$values)(?!\\|)",native:!0,unit:"deg"},fontVariantNumeric:{match:"^f(?:ont)?:(?:ordinal|slashed-zero|lining-nums|oldstyle-nums|proportional-nums|tabular-nums|diagonal-fractions|stacked-fractions|$values)(?!\\|)",native:!0},fontFeatureSettings:{match:"^font-feature:.",native:!0},font:{match:"^f:.",native:!0,order:-1},color:{match:"^(?:color|fg|foreground):.",native:!0,colored:!0,values:{current:"currentColor"}},margin:{match:"^m(?:argin(?:-(?:left|right|top|bottom))?|[xytblr]?):.",unit:"rem",declare(e,t){return y.call(this,e+t)},get order(){return this.prefix==="margin:"||this.prefix==="m:"?-1:0}},padding:{match:"^p(?:adding(?:-(?:left|right|top|bottom))?|[xytblr]?):.",unit:"rem",declare(e,t){return y.call(this,e+t)},get order(){return this.prefix==="padding:"||this.prefix==="p:"?-1:0}},flexBasis:{values:d.SIZING_VALUES,unit:"rem",native:!0},flexWrap:{match:"^flex:(?:wrap(?:-reverse)?|nowrap|$values)(?!\\|)",native:!0},flexGrow:{native:!0},flexShrink:{native:!0},flexDirection:{match:"^flex:(?:(?:row|column)(?:-reverse)?|$values)(?!\\|)",native:!0,values:{col:"column","col-reverse":"column-reverse"}},flex:{native:!0,order:-1},display:{match:"^d:.",native:!0},width:{match:"^w:.",unit:"rem",native:!0,values:d.SIZING_VALUES},height:{match:"^h:.",unit:"rem",native:!0,values:d.SIZING_VALUES},minWidth:{match:"^min-w:.",unit:"rem",native:!0,values:d.SIZING_VALUES},minHeight:{match:"^min-h:.",unit:"rem",native:!0,values:d.SIZING_VALUES},box:{match:"^(?:(?:max|min|clamp|calc)\\(.+\\)|[0-9]+[a-z]*?)x(?:(?:max|min|clamp|calc)\\(.+\\)|[0-9]+[a-z]*?)",unit:"rem",separators:["x"],analyze(e){return[e]},declare(e){let[t,r]=e.split(" x ");return{width:t,height:r}}},minBox:{match:"^min:(?:(?:max|min|clamp|calc)\\(.+\\)|[0-9]+[a-z]*?)x(?:(?:max|min|clamp|calc)\\(.+\\)|[0-9]+[a-z]*?)",unit:"rem",separators:["x"],analyze(e){return[e.slice(4)]},declare(e){let[t,r]=e.split(" x ");return{"min-width":t,"min-height":r}}},maxBox:{match:"^max:(?:(?:max|min|clamp|calc)\\(.+\\)|[0-9]+[a-z]*?)x(?:(?:max|min|clamp|calc)\\(.+\\)|[0-9]+[a-z]*?)",unit:"rem",separators:["x"],analyze(e){return[e.slice(4)]},declare(e){let[t,r]=e.split(" x ");return{"max-width":t,"max-height":r}}},contain:{native:!0},content:{native:!0},counterIncrement:{native:!0},counterReset:{native:!0},letterSpacing:{match:"^ls:.",native:!0,unit:"em"},lineHeight:{match:"^lh:.",native:!0},objectFit:{match:"^(?:object|obj):(?:contain|cover|fill|scale-down|$values)",native:!0},objectPosition:{match:"^(?:object|obj):(?:top|bottom|right|left|center|$values)",native:!0},textAlign:{match:"^t(?:ext)?:(?:justify|center|left|right|start|end|$values)(?!\\|)",native:!0},textDecorationColor:{match:"^text-decoration:(?:(?:#|(rgb|hsl)\\(.*\\))((?!\\|).)*$|(?:transparent|currentColor|inherit|$values|$colors))",native:!0,colored:!0,values:{current:"currentColor"}},textDecorationStyle:{match:"^t(?:ext)?:(?:solid|double|dotted|dashed|wavy|$values)(?!\\|)",native:!0},textDecorationThickness:{match:"^text-decoration:(?:\\.?[0-9]|(?:max|min|calc|clamp)\\(.*\\)|from-font|$values)[^|]*$",native:!0,unit:"em"},textDecorationLine:{match:"^t(?:ext)?:(?:none|underline|overline|line-through|$values)(?!\\|)",native:!0},textDecoration:{match:"^t(?:ext)?:(?:underline|line-through|overline)",unit:"rem",native:!0,colored:!0,values:{current:"currentColor"},order:-1},textUnderlineOffset:{unit:"rem",native:!0},textOverflow:{match:"^(?:text-(?:overflow|ovf):.|t(?:ext)?:(?:ellipsis|clip|$values)(?!\\|))",native:!0},textOrientation:{match:"^t(?:ext)?:(?:mixed|upright|sideways-right|sideways|use-glyph-orientation|$values)(?!\\|)",native:!0},textTransform:{match:"^t(?:ext)?:(?:uppercase|lowercase|capitalize|$values)(?!\\|)",native:!0},textRendering:{match:"^t(?:ext)?:(?:optimizeSpeed|optimizeLegibility|geometricPrecision|$values)(?!\\|)",native:!0},textIndent:{unit:"rem",native:!0},verticalAlign:{match:"^(?:v|vertical):.",native:!0},columns:{match:"^(?:columns|cols):.",native:!0,order:-1},whiteSpace:{native:!0},inset:{match:"^(?:top|bottom|left|right):.",unit:"rem",native:!0,declare(e,t){return{[this.prefix.slice(0,-1)]:e+t}}},lines:{match:"^lines:.",declare(e,t){return{overflow:"hidden",display:"-webkit-box","overflow-wrap":"break-word","text-overflow":"ellipsis","-webkit-box-orient":"vertical","-webkit-line-clamp":e+t}}},maxHeight:{match:"^max-h:.",unit:"rem",native:!0,values:d.SIZING_VALUES},maxWidth:{match:"^max-w:.",unit:"rem",native:!0,values:d.SIZING_VALUES},boxSizing:{match:"^box:(?:$values)(?!\\|)",native:!0,values:{content:"content-box",border:"border-box"}},opacity:{native:!0},visibility:{native:!0},clear:{native:!0},float:{native:!0},isolation:{native:!0},overflow:{match:"^overflow(?:-x|-y)?:(?:visible|overlay|hidden|scroll|auto|clip|inherit|initial|revert|revert-layer|unset|\\$|var|$values)",declare(e,t){if(this.prefix)switch(this.prefix.slice(-2,-1)){case"x":return{"overflow-x":e+t};case"y":return{"overflow-y":e+t}}return{overflow:e+t}},get order(){return-1}},overscrollBehavior:{match:"^overscroll-behavior(?:-[xy])?:",declare(e,t){switch(this.prefix.slice(-2,-1)){case"x":return{"overscroll-behavior-x":e+t};case"y":return{"overscroll-behavior-y":e+t};default:return{"overscroll-behavior":e+t}}}},zIndex:{match:"^z:.",native:!0},position:{native:!0,values:{abs:"absolute",rel:"relative"}},cursor:{native:!0},pointerEvents:{native:!0},resize:{native:!0},touchAction:{native:!0},wordBreak:{native:!0},wordSpacing:{native:!0,unit:"em"},userDrag:{declare(e,t){return{"user-drag":e+t,"-webkit-user-drag":e+t}}},userSelect:{native:!0,declare(e,t){return{"user-select":e+t,"-webkit-user-select":e+t}}},textShadow:{unit:"rem",native:!0,colored:!0,values:{current:"currentColor"}},textSize:{match:"^t(?:ext)?:(?:\\.?[0-9]|(?:max|min|calc|clamp)\\(.*\\)|$values)[^|]*$",unit:"rem",declare(e,t){return{"font-size":e+t,"line-height":t==="em"?e+.75+t:`calc(${e}${t} + ${.75}em)`}}},textFillColor:{native:!0,match:"^(?:text-fill|text|t):(?:(?:#|(rgb|hsl)\\(.*\\))((?!\\|).)*$|(?:transparent|currentColor|inherit|$values|$colors))",colored:!0,values:{current:"currentColor"},declare(e,t){return{"-webkit-text-fill-color":e+t}}},textStrokeWidth:{match:"^text-stroke(:(thin|medium|thick|\\.?[0-9]+|$values)(?!\\|)|-width:.)",unit:"rem",declare(e,t){return{"-webkit-text-stroke-width":e+t}}},textStrokeColor:{match:"^text-stroke:(?:(?:#|(rgb|hsl)\\(.*\\))((?!\\|).)*$|(?:transparent|currentColor|inherit|$values|$colors))",native:!0,colored:!0,values:{current:"currentColor"},declare(e,t){return{"-webkit-text-stroke-color":e+t}}},textStroke:{unit:"rem",native:!0,declare(e,t){return{"-webkit-text-stroke":e+t}}},boxShadow:{match:"^s(?:hadow)?:.",unit:"rem",native:!0,colored:!0,values:{current:"currentColor"}},tableLayout:{native:!0},transformBox:{match:"^transform:(?:$values)(?!\\|)",native:!0,values:{...v.BOX_UNDERNEATH,fill:"fill-box",stroke:"stroke-box",view:"view-box"}},transformStyle:{match:"^transform:(?:flat|preserve-3d|$values)(?!\\|)",native:!0},transformOrigin:{match:"^transform:(?:top|bottom|right|left|center|[0-9]|$values)",native:!0,unit:"px"},transform:{match:"^(?:translate|scale|skew|rotate|perspective|matrix)(?:3d|[XYZ])?\\(",native:!0},transitionProperty:{match:"^~property:.",native:!0},transitionTimingFunction:{match:"^~easing:.",native:!0},transitionDuration:{match:"^~duration:.",native:!0,unit:"ms"},transitionDelay:{match:"^~delay:.",native:!0,unit:"ms"},transition:{symbol:"~",native:!0,order:-1},animationDelay:{match:"^@delay:.",native:!0,unit:"ms"},animationDirection:{match:"^@direction:.",native:!0},animationDuration:{match:"^@duration:.",native:!0,unit:"ms"},animationFillMode:{match:"^@fill-mode:.",native:!0},animationIterationCount:{match:"^@iteration-count:.",native:!0},animationName:{match:"^@name:.",native:!0},animationPlayState:{match:"^@play-state:.",native:!0},animationTimingFunction:{match:"^@easing:.",native:!0},animation:{symbol:"@",native:!0,order:-1},borderColor:{match:"^b(?:[xytblr]|(?:order(?:-(?:left|right|top|bottom))?))?(?:-color)?:(?:(?:#|(rgb|hsl)\\(.*\\))((?!\\|).)*$|(?:transparent|currentColor|inherit|$values|$colors))",colored:!0,values:{current:"currentColor"},declare(e,t){return b(this.prefix,e+t,"color")},get order(){return this.prefix==="border-color:"||this.prefix==="b:"||this.prefix==="border:"?-1:0}},borderRadius:{match:"^(?:r[tblr]?[tblr]?|border(?:-(?:top|bottom)-(?:left|right))?-radius):.",unit:"rem",declare(e,t){if(this.prefix){let o="",n=this.prefix.split("-");if(n.length>1)for(let s=1;s<n.length-1;s++)o+=n[s][0];else o=this.prefix.slice(1,-1);switch(o){case"t":return{"border-top-left-radius":e+t,"border-top-right-radius":e+t};case"tl":case"lt":return{"border-top-left-radius":e+t};case"rt":case"tr":return{"border-top-right-radius":e+t};case"b":return{"border-bottom-left-radius":e+t,"border-bottom-right-radius":e+t};case"bl":case"lb":return{"border-bottom-left-radius":e+t};case"br":case"rb":return{"border-bottom-right-radius":e+t};case"l":return{"border-top-left-radius":e+t,"border-bottom-left-radius":e+t};case"r":return{"border-top-right-radius":e+t,"border-bottom-right-radius":e+t};default:return{"border-radius":e+t}}}let r=this.prefix?.slice(0,-1);return{[["border-top-left-radius","border-top-right-radius","border-bottom-left-radius","border-bottom-right-radius"].includes(r)?r:"border-radius"]:e+t}},get order(){return this.prefix==="border-radius:"||this.prefix==="r:"?-1:0}},borderStyle:{match:"^(?:border(?:-(?:left|right|top|bottom))?-style:.|b(?:[xytblr]|order(?:-(?:left|right|top|bottom))?)?:(?:none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset|$values)(?!\\|))",declare(e,t){return b(this.prefix,e+t,"style")},get order(){return this.prefix==="border-style:"||this.prefix==="b:"||this.prefix==="border:"?-1:0}},borderWidth:{match:"^(?:border(?:-(?:left|right|top|bottom))?-width:.|b(?:[xytblr]|order(?:-(?:left|right|top|bottom))?)?:(?:\\.?[0-9]|(?:max|min|calc|clamp)\\(.*\\)|$values)[^|]*$)",unit:"rem",declare(e,t){return b(this.prefix,e+t,"width")},get order(){return this.prefix==="border-width:"||this.prefix==="b:"||this.prefix==="border:"?-1:0}},borderCollapse:{match:"^b(?:order)?:(?:collapse|separate|$values)(?!\\|)",native:!0},borderSpacing:{unit:"rem",native:!0},borderImageOutset:{unit:"rem",native:!0},borderImageRepeat:{match:"^border-image:(?:stretch|repeat|round|space|$values)(?!\\|)",native:!0},borderImageSlice:{native:!0},borderImageSource:{match:"^border-image:(?:(?:url|linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient|conic-gradient)\\(.*\\)|$values)(?!\\|)",native:!0},borderImageWidth:{match:"^border-image:(?:\\.?[0-9]|(?:max|min|calc|clamp)\\(.*\\)|$values)[^|]*$",unit:"rem",native:!0},borderImage:{native:!0},border:{match:"^b(?:[xytblr]?|order(?:-(?:left|right|top|bottom))?):.",unit:"rem",colored:!0,values:{current:"currentColor"},declare(e,t){return b(this.prefix,e+t)},get order(){return this.prefix==="border:"||this.prefix==="b:"?-2:-1}},backgroundAttachment:{match:"^(?:bg|background):(?:fixed|local|scroll|$values)(?!\\|)",native:!0},backgroundBlendMode:{native:!0},backgroundColor:{match:"^(?:bg|background):(?:(?:#|(rgb|hsl)\\(.*\\))((?!\\|).)*$|(?:transparent|currentColor|inherit|$values|$colors))",native:!0,colored:!0,values:{current:"currentColor"}},backgroundClip:{match:"^(?:bg|background):(?:text|$values)(?!\\|)",native:!0,declare(e,t){return{"-webkit-background-clip":e+t,"background-clip":e+t}},values:v.BOX_UNDERNEATH},backgroundOrigin:{match:"^(?:bg|background):(?:$values)(?!\\|)",native:!0,values:v.BOX_UNDERNEATH},backgroundPosition:{match:"^(?:bg|background):(?:top|bottom|right|left|center|$values)(?!\\|)",native:!0,unit:"px"},backgroundRepeat:{match:"^(?:bg|background):(?:space|round|repeat|no-repeat|repeat-x|repeat-y|$values)(?![|a-zA-Z])",native:!0},backgroundSize:{match:"^(?:bg|background):(?:\\.?\\[0-9]+|auto|cover|contain|$values)(?!\\|)",unit:"rem",native:!0},backgroundImage:{match:"^(?:bg|background):(?:(?:url|linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient|conic-gradient)\\(.*\\)|$values)(?!\\|)",native:!0,colored:!0,values:{current:"currentColor"}},background:{match:"^bg:.",native:!0,colored:!0,values:{current:"currentColor"},order:-1},mixBlendMode:{match:"^blend:.",native:!0},backdropFilter:{match:"^bd:.",native:!0,colored:!0,values:{current:"currentColor"},declare(e,t){return{"backdrop-filter":e+t,"-webkit-backdrop-filter":e+t}}},filter:{match:"^(?:blur|brightness|contrast|drop-shadow|grayscale|hue-rotate|invert|opacity|saturate|sepia)\\(",native:!0,colored:!0,values:{current:"currentColor"}},fill:{match:"^fill:(?:(?:#|(rgb|hsl)\\(.*\\))((?!\\|).)*$|(?:transparent|currentColor|inherit|$values|$colors))",native:!0,colored:!0,values:{current:"currentColor"}},strokeDasharray:{native:!0},strokeDashoffset:{native:!0},strokeWidth:{match:"^stroke:(?:\\.?[0-9]|(?:max|min|calc|clamp)\\(.*\\)|$values)[^|]*$",native:!0},stroke:{native:!0,colored:!0,values:{current:"currentColor"}},x:{native:!0},y:{native:!0},cx:{native:!0},cy:{native:!0},rx:{native:!0},ry:{native:!0},gridColumnStart:{match:"^grid-col-start:.",native:!0},gridColumnEnd:{match:"^grid-col-end:.",native:!0},gridColumn:{match:"^grid-col(?:umn)?(?:-span)?:.",native:!0,order:-1,transform(e){return this.prefix.slice(-5,-1)==="span"&&e!=="auto"?"span "+e+"/span "+e:e}},gridColumns:{match:"^grid-cols:.",declare(e,t){return{display:"grid","grid-template-columns":"repeat("+e+t+",minmax(0,1fr))"}}},gridRowStart:{native:!0},gridRowEnd:{native:!0},gridRow:{match:"^grid-row-span:.",native:!0,order:-1,transform(e){return this.prefix.slice(-5,-1)==="span"&&e!=="auto"?"span "+e+"/span "+e:e}},gridRows:{declare(e,t){return{display:"grid","grid-auto-flow":"column","grid-template-rows":"repeat("+e+t+",minmax(0,1fr))"}}},gridAutoColumns:{match:"^grid-auto-cols:.",native:!0,values:p.CONTENT_EXTREMA},gridAutoFlow:{match:"^grid-flow:.",native:!0},gridAutoRows:{values:p.CONTENT_EXTREMA,native:!0},gridTemplateAreas:{native:!0},gridTemplateColumns:{match:"^grid-template-cols:.",native:!0,values:p.CONTENT_EXTREMA},gridTemplateRows:{native:!0,values:p.CONTENT_EXTREMA},gridTemplate:{native:!0,order:-1},gridArea:{native:!0,order:-1},grid:{native:!0,order:-1},gap:{match:"^gap(?:-x|-y)?:.",unit:"rem",order:-1,declare(e,t){switch(this.prefix[4]){case"x":return{"column-gap":e+t};case"y":return{"row-gap":e+t};default:return{gap:e+t}}}},order:{match:"^o:.",native:!0,values:{first:-999999,last:999999}},breakInside:{native:!0},breakBefore:{native:!0},breakAfter:{native:!0},boxDecorationBreak:{match:"^box:(?:slice|clone|$values)(?!\\|)",native:!0,declare(e,t){return{"box-decoration-break":e+t,"-webkit-box-decoration-break":e+t}}},aspectRatio:{match:"^aspect:.",native:!0},columnSpan:{match:"^col-span:.",native:!0},alignContent:{match:"^ac:.",native:!0},alignItems:{match:"^ai:.",native:!0},alignSelf:{match:"^as:",native:!0},justifyContent:{match:"^jc:.",native:!0},justifyItems:{match:"^ji:.",native:!0},justifySelf:{match:"^js:.",native:!0},placeContent:{native:!0,order:-1},placeItems:{native:!0,order:-1},placeSelf:{native:!0,order:-1},listStylePosition:{match:"^list-style:(?:inside|outside|$values)(?!\\|)",native:!0},listStyleType:{match:"^list-style:(?:disc|decimal|$values)(?!\\|)",native:!0},listStyleImage:{match:"^list-style:(?:(?:url|linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient|conic-gradient)\\(.*\\)|$values)(?!\\|)",native:!0},listStyle:{native:!0,order:-1},outlineColor:{match:"^outline:(?:(?:#|(rgb|hsl)\\(.*\\))((?!\\|).)*$|(?:transparent|currentColor|inherit|$values|$colors))",native:!0,colored:!0,values:{current:"currentColor"}},outlineOffset:{unit:"rem",native:!0},outlineStyle:{match:"^outline:(?:none|dotted|dashed|solid|double|groove|ridge|inset|outset|$values)(?!\\|)",native:!0},outlineWidth:{match:"^outline:(?:\\.?[0-9]|medium|thick|thin|(max|min|calc|clamp)\\(.*\\)|$values)[^|]*$",unit:"rem",native:!0},outline:{native:!0,unit:"rem",order:-1,colored:!0,values:{current:"currentColor"}},accentColor:{match:"^accent:(?:(?:#|(rgb|hsl)\\(.*\\))((?!\\|).)*$|(?:transparent|currentColor|inherit|$values|$colors))",native:!0,colored:!0,values:{current:"currentColor"}},appearance:{native:!0},caretColor:{match:"^caret:(?:(?:#|(rgb|hsl)\\(.*\\))((?!\\|).)*$|(?:transparent|currentColor|inherit|$values|$colors))",native:!0,colored:!0,values:{current:"currentColor"}},scrollBehavior:{native:!0},scrollMargin:{match:"^scroll-m(?:[xytblr]|argin(?:-(?:top|bottom|left|right))?)?:.",unit:"rem",declare(e,t){if(this.prefix.slice(-3,-2)==="m")switch(this.prefix.slice(-2,-1)){case"x":return{"scroll-margin-left":e+t,"scroll-margin-right":e+t};case"y":return{"scroll-margin-top":e+t,"scroll-margin-bottom":e+t};case"l":return{"scroll-margin-left":e+t};case"r":return{"scroll-margin-right":e+t};case"t":return{"scroll-margin-top":e+t};case"b":return{"scroll-margin-bottom":e+t}}else return{[this.prefix.replace(/-m(?!argin)/,"-margin").slice(0,-1)]:e+t}},get order(){return this.prefix==="scroll-margin:"||this.prefix==="scroll-m:"?-1:0}},scrollPadding:{match:"^scroll-p(?:[xytblr]|adding(?:-(?:top|bottom|left|right))?)?:.",unit:"rem",declare(e,t){if(this.prefix.slice(-3,-2)==="p")switch(this.prefix.slice(-2,-1)){case"x":return{"scroll-padding-left":e+t,"scroll-padding-right":e+t};case"y":return{"scroll-padding-top":e+t,"scroll-padding-bottom":e+t};case"l":return{"scroll-padding-left":e+t};case"r":return{"scroll-padding-right":e+t};case"t":return{"scroll-padding-top":e+t};case"b":return{"scroll-padding-bottom":e+t}}else return{[this.prefix.replace(/-p(?!adding)/,"-padding").slice(0,-1)]:e+t}},get order(){return this.prefix==="scroll-padding:"||this.prefix==="scroll-p:"?-1:0}},scrollSnapAlign:{match:"^scroll-snap:(?:start|end|center|$values)",native:!0},scrollSnapStop:{match:"^scroll-snap:(?:normal|always|$values)(?!\\|)",native:!0},scrollSnapType:{match:"^scroll-snap:(?:(?:[xy]|block|inline|both)(?:\\|(?:proximity|mandatory))?|$values)(?!\\|)",native:!0},willChange:{native:!0},writingMode:{match:"^writing:.",native:!0},direction:{native:!0},shapeOutside:{match:"^shape:(?:(?:inset|circle|ellipse|polygon|url|linear-gradient)\\(.*\\)|$values)(?!\\|)",native:!0,values:{...v.BOX_UNDERNEATH,margin:"margin-box"}},shapeMargin:{match:"^shape:(?:\\.?[0-9]|(?:max|min|calc|clamp)\\(.*\\)|$values)[^|]*$",unit:"rem",native:!0},shapeImageThreshold:{native:!0},clipPath:{match:"^clip:.",native:!0,values:{...v.BOX_UNDERNEATH,margin:"margin-box",fill:"fill-box",stroke:"stroke-box",view:"view-box"}},quotes:{native:!0},maskImage:{native:!0,declare(e,t){return{"mask-image":e+t,"-webkit-mask-image":e+t}}}};function y(e){if(this.prefix.includes("-"))return{[this.prefix.slice(0,-1)]:e};let r=this.prefix[0]==="m"?"margin":"padding",o=r+"-left",n=r+"-right",s=r+"-top",u=r+"-bottom";switch(this.prefix[1]){case"x":return{[o]:e,[n]:e};case"y":return{[s]:e,[u]:e};case"l":return{[o]:e};case"r":return{[n]:e};case"t":return{[s]:e};case"b":return{[u]:e};default:return{[r]:e}}}function b(e,t,r=""){let o="border-";r&&(r="-"+r);let n=/^b(order)?-?(.)?/.exec(e)[2],s=o+"left"+r,u=o+"right"+r,h=o+"top"+r,m=o+"bottom"+r;switch(n){case"x":return{[s]:t,[u]:t};case"y":return{[h]:t,[m]:t};case"l":return{[s]:t};case"r":return{[u]:t};case"t":return{[h]:t};case"b":return{[m]:t};default:return{["border"+r]:t}}}0&&(module.exports={rules});
|
package/dist/cjs/css.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var A=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var Z=(y,e,t)=>e in y?A(y,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):y[e]=t;var P=(y,e)=>{for(var t in e)A(y,t,{get:e[t],enumerable:!0})},U=(y,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of _(e))!q.call(y,a)&&a!==t&&A(y,a,{get:()=>e[a],enumerable:!(s=H(e,a))||s.enumerable});return y};var Y=y=>U(A({},"__esModule",{value:!0}),y);var S=(y,e,t)=>(Z(y,typeof e!="symbol"?e+"":e,t),t);var G={};P(G,{MasterCSS:()=>W});module.exports=Y(G);function I(y){let e=typeof Buffer<"u"?Buffer:null;return!!(e&&y instanceof e||y instanceof Date||y instanceof RegExp)}function B(y){if(typeof Buffer<"u"&&Buffer&&y instanceof Buffer){let e=Buffer.alloc(y.length);return y.copy(e),e}else{if(y instanceof Date)return new Date(y.getTime());if(y instanceof RegExp)return new RegExp(y);throw new Error("Unexpected situation")}}function V(y){let e=[];return y.forEach(function(t,s){typeof t=="object"&&t!==null?Array.isArray(t)?e[s]=V(t):I(t)?e[s]=B(t):e[s]=k({},t):e[s]=t}),e}function N(y,e){return e==="__proto__"?void 0:y[e]}function k(...y){let e={},t,s;return y.forEach(function(a){typeof a!="object"||a===null||Array.isArray(a)||Object.keys(a).forEach(function(C){if(s=N(e,C),t=N(a,C),t!==e)if(typeof t!="object"||t===null){e[C]=t;return}else if(Array.isArray(t)){e[C]=V(t);return}else if(I(t)){e[C]=B(t);return}else if(typeof s!="object"||s===null||Array.isArray(s)){e[C]=k({},t);return}else{e[C]=k(s,t);return}})}),e}var $=require("./rule"),F=require("./config"),D=require("./utils/rgb-to-hex"),Q=require("./constants/selector-symbols");var L=typeof window<"u",j=class{constructor(e){this.config=e;this.config?.override||(this.config=k(F.config,e)),this.cache(),L&&this.config.observe&&this.observe(document),j.instances.push(this),this.ready=!0}rules=[];ruleOfClass={};countOfClass={};ready=!1;e=L?new MutationObserver(e=>{let t={},s=[],a=[],C=[],w=(c,n)=>{n?c.classList.forEach(b):c.classList.forEach(g);let l=c.children;for(let m=0;m<l.length;m++){let u=l[m];u.classList&&(a.push(u),w(u,n))}},g=c=>{c in t?t[c]++:t[c]=1},b=c=>{c in t?t[c]--:c in this.countOfClass&&(t[c]=-1)},O=(c,n)=>{for(let l=0;l<c.length;l++){let m=c[l];m.classList&&!a.includes(m)&&!C.includes(m)&&(m.isConnected!==n?(a.push(m),w(m,n)):C.push(m))}};for(let c=0;c<e.length;c++){let n=e[c],{addedNodes:l,removedNodes:m,type:u,target:f}=n;if(u==="attributes"){if(s.find(v=>v.target===f))continue;s.push(n)}else O(l,!1),(!f.isConnected||!a.includes(f))&&O(m,!0)}if(!(!s.length&&!Object.keys(t).length)){for(let{oldValue:c,target:n}of s){let l=a.includes(n),m=n.classList,u=c?c.split(" "):[];if(l){if(n.isConnected)continue;for(let f of u)m.contains(f)||b(f)}else if(n.isConnected){m.forEach(f=>{u.includes(f)||g(f)});for(let f of u)m.contains(f)||b(f)}}for(let c in t){let n=t[c],l=(this.countOfClass[c]||0)+n;l===0?(delete this.countOfClass[c],this.delete(c)):(c in this.countOfClass||this.insert(c),this.countOfClass[c]=l)}}}):null;cache(){this.semantics=[],this.classes={},this.colorThemesMap={},this.relationThemesMap={},this.relations={},this.colorNames=[],this.themeNames=[""],this.selectors={},this.values={},this.globalValues={},this.breakpoints={},this.mediaQueries={},this.matches={};let{semantics:e,classes:t,selectors:s,themes:a,colors:C,values:w,breakpoints:g,mediaQueries:b,rules:O}=this.config;function c(r){return r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function n(r,o,i="",d={}){let h=x=>x?(i?i+"-":"")+x:i,R=Object.entries(r),p=[],T=[];for(let x of R){let E=x[1];(typeof E=="object"&&!Array.isArray(E)?p:T).push(x)}for(let[x,E]of p)n(E,o,h(x),d);if(o&&i)T.length&&(d[i]=T.reduce((x,[E,z])=>(x[E]=z,x),{}));else for(let[x,E]of T)d[h(x)]=E;return d}if(e)for(let[r,o]of Object.entries(n(e,!0)))this.semantics.push([new RegExp("^"+c(r)+"(?=!|\\*|>|\\+|~|:|\\[|@|_|\\.|$)","m"),[r,o]]);if(s)for(let[r,o]of Object.entries(n(s,!1))){let i=new RegExp(c(r)+"(?![a-z-])");for(let d of Array.isArray(o)?o:[o]){let h=d.match(/^::-[a-z]+-/m)?.[0]??"",R=this.selectors[h];R||(R=this.selectors[h]=[]);let p=R.find(([T])=>T===i);p||(p=[i,[]],R.push(p)),p[1].push(d)}}w&&(this.globalValues=n(w,!1)),g&&(this.breakpoints=n(g,!1)),b&&(this.mediaQueries=n(b,!1));let l=t?n(t,!1):{},m=a&&!Array.isArray(a)?Object.entries(a).filter(([,{classes:r}])=>r).reduce((r,[o,{classes:i}])=>(r[o]=n(i,!1),r),{}):{},u=[...Object.keys(l),...Object.entries(m).flatMap(([r,o])=>Object.keys(o))],f=r=>{if(r in this.classes)return;let o=this.classes[r]=[],i=(d,h)=>{if(!h)return;let R=Array.isArray(h)?h:h.replace(/(?:\n(?:\s*))+/g," ").trim().split(" ");for(let p of R){let T=x=>{x in this.relationThemesMap?d in this.relationThemesMap[x]?this.relationThemesMap[x][d].push(r):this.relationThemesMap[x][d]=[r]:this.relationThemesMap[x]={[d]:[r]},o.includes(x)||o.push(x)};if(u.includes(p)){f(p);for(let x of this.classes[p])T(x)}else T(p)}};i("",l?.[r]);for(let[d,h]of Object.entries(m))i(d,h?.[r])};for(let r of u)f(r);for(let r in this.relationThemesMap){let o=this.relations[r]=[];for(let i of Object.values(this.relationThemesMap[r]))for(let d of i)o.includes(d)||o.push(d)}let v=(r,o)=>{if(!o)return;let i=n(o,!0);for(let[d,h]of Object.entries(i)){let R=typeof h=="string"?{"":h}:h;for(let[p,T]of Object.entries(R)){let x=d+(p?"-"+p:"");x in this.colorThemesMap?this.colorThemesMap[x][r]=T:this.colorThemesMap[x]={[r]:T}}}for(let d in o)this.colorNames.includes(d)||this.colorNames.push(d)};if(v("",C),a)if(Array.isArray(a))this.themeNames.push(...a);else for(let r in a){let o=a[r];v(r,o.colors),this.themeNames.push(r)}let M=r=>{for(let[o,i]of Object.entries(this.colorThemesMap))for(let[d,h]of Object.entries(i))h.startsWith("#")||r(o,i,d,h)};if(M((r,o,i,d)=>{let h=/^rgba?\( *([0-9]{1,3}) *(?: |,) *([0-9]{1,3}) *(?: |,) *([0-9]{1,3}) *(?:(?:\/|,) *0?(\.[0-9]))?\)$/.exec(d);if(h){let R="#"+(0,D.rgbToHex)(+h[1],+h[2],+h[3]);h[4]&&(R+=Math.round(255*+h[4]).toString(16)),o[i]=R}}),M((r,o,i,d)=>{let[h,R]=d.split("/"),p=this.colorThemesMap[h];if(p){let T=(i?p[i]:void 0)??p[""];o[i]=R?T.slice(0,7)+Math.round(255*+R).toString(16):T}else console.warn(`\`${d}\` doesn't exist in the extended config \`.colors\``),delete o[i],Object.keys(o).length||delete this.colorThemesMap[r]}),O)for(let r in O){let o=O[r],{matches:i,prop:d,values:h}=o;if(o.id=r,o.prop=d===!1?"":r.replace(/(?!^)[A-Z]/g,R=>"-"+R).toLowerCase(),h&&(this.values[r]=n(h,!1)),i){let R=Object.keys(this.values[r]??{}),p=i.indexOf("$values");this.matches[r]=new RegExp(p===-1?i:R.length?i.slice(0,p)+R.join("|")+i.slice(p+7):i.slice(0,p-(i[p-1]==="|"?1:0))+i.slice(p+7+(i[p+7]==="|"?1:0)))}}}observe(e,t={subtree:!0,childList:!0}){if(L&&e){this.root=e;let s=e===document;s&&(j.root=this),this.host=s?document.documentElement:root.host;let a=s?document.head:e,C=s?document.styleSheets:e.styleSheets;for(let g of C){let{title:b,href:O,ownerNode:c}=g;(b==="master"||O&&O.startsWith(window.location.origin)&&/master(?:\..+)?\.css/.test(O))&&(this.style=c)}if(this.style)for(let g=0;g<this.style.sheet.cssRules.length;g++){let b=c=>{if(c.selectorText){let l=c.selectorText.split(", ")[0].split(" ");for(let m=0;m<l.length;m++){let u=l[m];if(u[0]==="."){let f=u.slice(1),v="";for(let M=0;M<f.length;M++){let r=f[M],o=f[M+1];if(r==="\\"){if(M++,o!=="\\"){v+=o;continue}}else if(Q.SELECTOR_SYMBOLS.includes(r))break;v+=r}if(!(v in this.ruleOfClass)&&!(v in this.classes)){let M=this.create(v)[0];if(M)return M}}}}else if(c.cssRules)for(let n=0;n<c.cssRules.length;n++){let l=b(c.cssRules[n]);if(l)return l}},O=b(this.style.sheet.cssRules[g]);if(O){this.rules.push(O),this.ruleOfClass[O.className]=O;for(let c=0;c<O.natives.length;c++)O.natives[c].cssRule=this.style.sheet.cssRules[g+c];g+=O.natives.length-1}}else{this.style=document.createElement("style"),this.style.title="master";let g=a.querySelector('link[rel="styleSheet"], style');g?g.before(this.style):a.append(this.style)}let w=g=>{g.forEach(b=>{b in this.countOfClass?this.countOfClass[b]++:(this.countOfClass[b]=1,this.insert(b))})};w(this.host.classList),t.subtree&&this.host.querySelectorAll("[class]").forEach(g=>w(g.classList)),this.e.observe(e,{...t,attributes:!0,attributeOldValue:!0,attributeFilter:["class"]})}return this}disconnect(){this.e.disconnect(),this.ruleOfClass={},this.countOfClass={},this.rules.length=0;let e=this.style.sheet;if(e)for(let t=e.cssRules.length-1;t>=0;t--)e.deleteRule(t);this.style.remove(),this.style=null}match(e){for(let t in this.config.rules){let s=this.config.rules[t],a=this.matches[t],{colorStarts:C,symbol:w,prop:g}=s,{colorNames:b,colorThemesMap:O}=this;if(a&&a.test(e))return{origin:"matches",config:s};if(C){if(e.match("^"+C+"(?:(?:#|(rgb|hsl)\\(.*\\))((?!\\|).)*$|(?:transparent|current|inherit))"))return{origin:"matches",config:s};if(b.length&&e.indexOf("|")===-1){let c=e.match("^"+C+"((?:"+b.join("|")+")[0-9a-zA-Z-]*)");if(c&&c[1]in O)return{origin:"matches",config:s}}}if(w&&e.startsWith(w))return{origin:"symbol",config:s};if(g&&e.startsWith(g+":"))return{origin:"matches",config:s}}for(let t of this.semantics)if(e.match(t[0]))return{origin:"semantics",value:t[1]}}create(e){let t=s=>{if(s in this.ruleOfClass)return this.ruleOfClass[s];let a=this.match(s);if(a)return new $.Rule(s,a,this)};return(e in this.classes?this.classes[e].map(s=>t(s)):[t(e)]).filter(s=>s&&s.text)}refresh(e){if(e?.override?this.config=e:this.config=k(F.config,e),this.cache(),!this.style)return;let t=document.createElement("style");t.title="master",this.style.replaceWith(t),this.style=t,this.rules.length=0,this.ruleOfClass={};for(let s in this.countOfClass)this.insert(s)}destroy(){let e=j.instances;this.disconnect(),e.splice(e.indexOf(this),1)}delete(e){let t=this.style.sheet,s=a=>{let C=this.ruleOfClass[a];if(!(!C||a in this.relations&&this.relations[a].some(w=>w in this.countOfClass))){if(C.natives.length){let w=C.natives[0];for(let g=0;g<t.cssRules.length;g++)if(t.cssRules[g]===w.cssRule){for(let O=0;O<C.natives.length;O++)t.deleteRule(g);this.rules.splice(this.rules.indexOf(C),1);break}}delete this.ruleOfClass[a]}};if(e in this.classes){for(let a of this.classes[e])a in this.countOfClass||s(a);delete this.ruleOfClass[e]}else s(e)}insert(e){let t=this.create(e);return t.length?(this.insertRules(t),!0):!1}insertRules(e){for(let t of e){if(this.ruleOfClass[t.className])continue;let s,a=this.rules.length-1,{media:C,order:w,priority:g,hasWhere:b,className:O}=t,c=(n,l,m,u)=>{let f=0,v;l&&(f=n.findIndex(l)),m&&(v=n.findIndex(m)),f===-1&&(f=n.length),(v===void 0||v===-1)&&(v=n.length);let M=n.slice(f,v);for(let r=0;r<M.length;r++){let o=M[r];if(!(o.priority===-1||u&&u(o))&&(o.priority<g||o.priority===g&&(b&&!o.hasWhere||o.order>=w)))return f+r}return f+M.length};if(C){let n=this.rules.findIndex(l=>l.media);if(n!==-1){let l=C.features["max-width"],m=C.features["min-width"];if(l&&m){let u=l.value-m.value;for(let f=a;f>=n;f--){s=f;let v=this.rules[f],M=v.media,r=M.features["max-width"],o=M.features["min-width"];if(!r||!o){s++;break}let i=r.value-o.value;if(i===u){if(b!==v.hasWhere)continue;if(g!==-1){let d=[this.rules[f]];for(let h=f-1;h>=n;h--){let R=this.rules[h];if(R.hasWhere!==b)break;let p=R.media,T=p.features["max-width"],x=p.features["min-width"];if(!T||!x||T.value-x.value!==i)break;d.unshift(this.rules[h])}s=c(this.rules,h=>h.media&&h.priority!==-1&&h.media.features["min-width"]&&h.media.features["max-width"])}break}else if(i>u)break}}else if(m)for(let u=n;u<=a;u++){s=u;let f=this.rules[u],v=f.media,M=v.features["max-width"],r=v.features["min-width"];if(M){if(r)break;continue}let o=r?.value;if(o===m.value){if(!b&&f.hasWhere){s++;continue}if(g!==-1)s=c(this.rules,i=>i.media,i=>i.media&&i.priority!==-1&&i.media.features["min-width"]&&i.media.features["max-width"],i=>!i.media.features["min-width"]&&!i.media.features["max-width"]);else for(let i=u;i<=a;i++){let d=this.rules[i],h=d.media,R=h.features["min-width"];if(!h.features["max-width"]){if(d.hasWhere!==b||R.value!==o||d.order>=w)break;s=i+1}}break}else{if(o>m.value)break;s++}}else if(l)for(let u=a;u>=n;u--){s=u;let f=this.rules[u],v=f.media,M=v.features["max-width"];if(v.features["min-width"])continue;let o=M?.value;if(!o||o>l.value){s++;break}else if(o===l.value){if(b&&!f.hasWhere)continue;if(g!==-1)s=c(this.rules,i=>i.media,i=>i.media&&i.priority!==-1&&i.media.features["min-width"]&&i.media.features["max-width"],i=>!i.media.features["min-width"]&&!i.media.features["max-width"]);else{let i=[this.rules[u]];for(let d=u-1;d>=n;d--){let h=this.rules[d],R=h.media,p=R.features["min-width"],T=R.features["max-width"];if(!p&&(!T||T.value!==o||h.hasWhere!==b))break;i.unshift(h)}for(let d=0;d<i.length;d++){let h=i[d];if(!h.media.features["min-width"]){if(h.order>=w)break;s=u-i.length+2+d}}}break}}}if(s===void 0)if(n===-1)s=a+1;else if(g!==-1)s=n+c(this.rules.slice(n),void 0,l=>l.media.features["max-width"]||l.media.features["min-width"]);else if(b){let l=n;for(;l<this.rules.length;l++){let m=this.rules[l];if(m.priority!==-1||!m.hasWhere||m.order>=w){s=l;break}}s===void 0&&(s=l)}else for(let l=n;l<=a;l++){s=l;let m=this.rules[l],u=m.media;if(m.priority!==-1||u.features["max-width"]||u.features["min-width"])break;if(m.hasWhere)s++;else if(m.order>=w)break}}else if(g===-1)if(b)s=this.rules.findIndex(n=>!n.hasWhere||n.media||n.priority!==-1||n.order>=w),s===-1&&(s=a+1);else{let n=0;for(;n<this.rules.length;n++){let l=this.rules[n];if(l.media||!l.hasWhere&&(l.order>=w||l.priority!==-1)){s=n;break}}s===void 0&&(s=n)}else s=c(this.rules,void 0,n=>n.media);if(this.rules.splice(s,0,t),this.ruleOfClass[O]=t,this.style){let n=this.style.sheet,l=0,m=u=>{let f=this.rules[u];if(f){if(!f.natives.length)return m(u-1);let v=f.natives[f.natives.length-1].cssRule;for(let M=0;M<n.cssRules.length;M++)if(n.cssRules[M]===v){l=M+1;break}}};m(s-1);for(let u=0;u<t.natives.length;)try{let f=t.natives[u];n.insertRule(f.text,l),f.cssRule=n.cssRules[l++],u++}catch(f){console.error(f),t.natives.splice(u,1)}}}}get text(){return this.rules.map(e=>e.text).join("")}},W=j;S(W,"root"),S(W,"config",F.config),S(W,"instances",[]),S(W,"refresh",e=>{for(let t of j.instances)t.refresh(e)});L&&(window.MasterCSS=W);0&&(module.exports={MasterCSS});
|
|
1
|
+
var O=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var Z=(p,e,t)=>e in p?O(p,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):p[e]=t;var P=(p,e)=>{for(var t in e)O(p,t,{get:e[t],enumerable:!0})},U=(p,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of _(e))!q.call(p,l)&&l!==t&&O(p,l,{get:()=>e[l],enumerable:!(s=H(e,l))||s.enumerable});return p};var Y=p=>U(O({},"__esModule",{value:!0}),p);var T=(p,e,t)=>(Z(p,typeof e!="symbol"?e+"":e,t),t);var G={};P(G,{MasterCSS:()=>k});module.exports=Y(G);function L(p){let e=typeof Buffer<"u"?Buffer:null;return!!(e&&p instanceof e||p instanceof Date||p instanceof RegExp)}function I(p){if(typeof Buffer<"u"&&Buffer&&p instanceof Buffer){let e=Buffer.alloc(p.length);return p.copy(e),e}else{if(p instanceof Date)return new Date(p.getTime());if(p instanceof RegExp)return new RegExp(p);throw new Error("Unexpected situation")}}function $(p){let e=[];return p.forEach(function(t,s){typeof t=="object"&&t!==null?Array.isArray(t)?e[s]=$(t):L(t)?e[s]=I(t):e[s]=j({},t):e[s]=t}),e}function N(p,e){return e==="__proto__"?void 0:p[e]}function j(...p){let e={},t,s;return p.forEach(function(l){typeof l!="object"||l===null||Array.isArray(l)||Object.keys(l).forEach(function(R){if(s=N(e,R),t=N(l,R),t!==e)if(typeof t!="object"||t===null){e[R]=t;return}else if(Array.isArray(t)){e[R]=$(t);return}else if(L(t)){e[R]=I(t);return}else if(typeof s!="object"||s===null||Array.isArray(s)){e[R]=j({},t);return}else{e[R]=j(s,t);return}})}),e}var V=require("./rule"),S=require("./config"),D=require("./utils/rgb-to-hex"),Q=require("./constants/selector-symbols");var F=typeof window<"u",A=class{constructor(e){this.config=e;this.config?.override||(this.config=j(S.config,e)),this.cache(),F&&this.config.observe&&this.observe(document),A.instances.push(this)}rules=[];ruleBy={};countBy={};e=F?new MutationObserver(e=>{let t={},s=[],l=[],R=[],M=(a,i)=>{i?a.classList.forEach(v):a.classList.forEach(y);let c=a.children;for(let m=0;m<c.length;m++){let d=c[m];d.classList&&(l.push(d),M(d,i))}},y=a=>{a in t?t[a]++:t[a]=1},v=a=>{a in t?t[a]--:a in this.countBy&&(t[a]=-1)},B=(a,i)=>{for(let c=0;c<a.length;c++){let m=a[c];m.classList&&!l.includes(m)&&!R.includes(m)&&(m.isConnected!==i?(l.push(m),M(m,i)):R.push(m))}};for(let a=0;a<e.length;a++){let i=e[a],{addedNodes:c,removedNodes:m,type:d,target:f}=i;if(d==="attributes"){if(s.find(w=>w.target===f))continue;s.push(i)}else B(c,!1),(!f.isConnected||!l.includes(f))&&B(m,!0)}if(!(!s.length&&!Object.keys(t).length)){for(let{oldValue:a,target:i}of s){let c=l.includes(i),m=i.classList,d=a?a.split(" "):[];if(c){if(i.isConnected)continue;for(let f of d)m.contains(f)||v(f)}else if(i.isConnected){m.forEach(f=>{d.includes(f)||y(f)});for(let f of d)m.contains(f)||v(f)}}for(let a in t){let i=t[a],c=(this.countBy[a]||0)+i;c===0?(delete this.countBy[a],this.delete(a)):(a in this.countBy||this.insert(a),this.countBy[a]=c)}}}):null;cache(){this.semantics=[],this.classes={},this.colorThemesMap={},this.themeAffectedClassesBy={},this.classesBy={},this.colorNames=[],this.themeNames=[""],this.selectors={},this.values={},this.globalValues={},this.breakpoints={},this.mediaQueries={},this.matches={};let{semantics:e,classes:t,selectors:s,themes:l,colors:R,values:M,breakpoints:y,mediaQueries:v,rules:B}=this.config;function a(r){return r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function i(r,o,n="",u={}){let h=x=>x?(n?n+"-":"")+x:n,g=Object.entries(r),b=[],E=[];for(let x of g){let W=x[1];(typeof W=="object"&&!Array.isArray(W)?b:E).push(x)}for(let[x,W]of b)i(W,o,h(x),u);if(o&&n)E.length&&(u[n]=E.reduce((x,[W,z])=>(x[W]=z,x),{}));else for(let[x,W]of E)u[h(x)]=W;return u}if(e)for(let[r,o]of Object.entries(i(e,!0)))this.semantics.push([new RegExp("^"+a(r)+"(?=!|\\*|>|\\+|~|:|\\[|@|_|\\.|$)","m"),[r,o]]);if(s)for(let[r,o]of Object.entries(i(s,!1))){let n=new RegExp(a(r)+"(?![a-z-])");for(let u of Array.isArray(o)?o:[o]){let h=u.match(/^::-[a-z]+-/m)?.[0]??"",g=this.selectors[h];g||(g=this.selectors[h]=[]);let b=g.find(([E])=>E===n);b||(b=[n,[]],g.push(b)),b[1].push(u)}}M&&(this.globalValues=i(M,!1)),y&&(this.breakpoints=i(y,!1)),v&&(this.mediaQueries=i(v,!1));let c=t?i(t,!1):{},m=l&&!Array.isArray(l)?Object.entries(l).filter(([,{classes:r}])=>r).reduce((r,[o,{classes:n}])=>(r[o]=i(n,!1),r),{}):{},d=[...Object.keys(c),...Object.entries(m).flatMap(([r,o])=>Object.keys(o))],f=r=>{if(r in this.classes)return;let o=this.classes[r]=[],n=(u,h)=>{if(!h)return;let g=Array.isArray(h)?h:h.replace(/(?:\n(?:\s*))+/g," ").trim().split(" ");for(let b of g){let E=x=>{x in this.themeAffectedClassesBy?u in this.themeAffectedClassesBy[x]?this.themeAffectedClassesBy[x][u].push(r):this.themeAffectedClassesBy[x][u]=[r]:this.themeAffectedClassesBy[x]={[u]:[r]},o.includes(x)||o.push(x)};if(d.includes(b)){f(b);for(let x of this.classes[b])E(x)}else E(b)}};n("",c?.[r]);for(let[u,h]of Object.entries(m))n(u,h?.[r])};for(let r of d)f(r);for(let r in this.themeAffectedClassesBy){let o=this.classesBy[r]=[];for(let n of Object.values(this.themeAffectedClassesBy[r]))for(let u of n)o.includes(u)||o.push(u)}let w=(r,o)=>{if(!o)return;let n=i(o,!0);for(let[u,h]of Object.entries(n)){let g=typeof h=="string"?{"":h}:h;for(let[b,E]of Object.entries(g)){let x=u+(b?"-"+b:"");x in this.colorThemesMap?this.colorThemesMap[x][r]=E:this.colorThemesMap[x]={[r]:E}}}for(let u in o)this.colorNames.includes(u)||this.colorNames.push(u)};if(w("",R),l)if(Array.isArray(l))this.themeNames.push(...l);else for(let r in l){let o=l[r];w(r,o.colors),this.themeNames.push(r)}let C=r=>{for(let[o,n]of Object.entries(this.colorThemesMap))for(let[u,h]of Object.entries(n))h.startsWith("#")||r(o,n,u,h)};if(C((r,o,n,u)=>{let h=/^rgba?\( *([0-9]{1,3}) *(?: |,) *([0-9]{1,3}) *(?: |,) *([0-9]{1,3}) *(?:(?:\/|,) *0?(\.[0-9]))?\)$/.exec(u);if(h){let g="#"+(0,D.rgbToHex)(+h[1],+h[2],+h[3]);h[4]&&(g+=Math.round(255*+h[4]).toString(16)),o[n]=g}}),C((r,o,n,u)=>{let[h,g]=u.split("/"),b=this.colorThemesMap[h];if(b){let E=(n?b[n]:void 0)??b[""];o[n]=g?E.slice(0,7)+Math.round(255*+g).toString(16):E}else console.warn(`\`${u}\` doesn't exist in the extended config \`.colors\``),delete o[n],Object.keys(o).length||delete this.colorThemesMap[r]}),B)for(let r in B){let o=B[r],{native:n,values:u,colored:h}=o,g=o.match;if(o.id=r,o.native=n===!0?r.replace(/(?!^)[A-Z]/g,b=>"-"+b).toLowerCase():void 0,u&&(this.values[r]=i(u,!1)),g){let b=Object.keys(this.values[r]??{});g.includes("$values")&&(g=b.length?g.replace(/\$values/,b.join("|")):g.replace(/(?:\|)?\$values/,"")),h&&g.includes("$colors")&&(g=this.colorNames.length?g.replace(/\$colors/,"(?:"+this.colorNames.join("|")+")(?![0-9A-Za-z])"):g.replace(/(?:\|)?\$colors/,"")),this.matches[r]=new RegExp(g)}}}observe(e,t={subtree:!0,childList:!0}){if(F&&e){this.root=e;let s=e===document;s&&(A.root=this),this.host=s?document.documentElement:root.host;let l=s?document.head:e,R=s?document.styleSheets:e.styleSheets;for(let y of R){let{title:v,href:B,ownerNode:a}=y;(v==="master"||B&&B.startsWith(window.location.origin)&&/master(?:\..+)?\.css/.test(B))&&(this.style=a)}if(this.style)for(let y=0;y<this.style.sheet.cssRules.length;y++){let v=a=>{if(a.selectorText){let c=a.selectorText.split(", ")[0].split(" ");for(let m=0;m<c.length;m++){let d=c[m];if(d[0]==="."){let f=d.slice(1),w="";for(let C=0;C<f.length;C++){let r=f[C],o=f[C+1];if(r==="\\"){if(C++,o!=="\\"){w+=o;continue}}else if(Q.SELECTOR_SYMBOLS.includes(r))break;w+=r}if(!(w in this.ruleBy)&&!(w in this.classes)){let C=this.create(w)[0];if(C)return C}}}}else if(a.cssRules)for(let i=0;i<a.cssRules.length;i++){let c=v(a.cssRules[i]);if(c)return c}},B=v(this.style.sheet.cssRules[y]);if(B){this.rules.push(B),this.ruleBy[B.className]=B;for(let a=0;a<B.natives.length;a++)B.natives[a].cssRule=this.style.sheet.cssRules[y+a];y+=B.natives.length-1}}else{this.style=document.createElement("style"),this.style.title="master";let y=l.querySelector('link[rel="styleSheet"], style');y?y.before(this.style):l.append(this.style)}let M=y=>{y.forEach(v=>{v in this.countBy?this.countBy[v]++:(this.countBy[v]=1,this.insert(v))})};M(this.host.classList),t.subtree&&this.host.querySelectorAll("[class]").forEach(y=>M(y.classList)),this.e.observe(e,{...t,attributes:!0,attributeOldValue:!0,attributeFilter:["class"]})}return this}disconnect(){this.e.disconnect(),this.ruleBy={},this.countBy={},this.rules.length=0;let e=this.style.sheet;if(e)for(let t=e.cssRules.length-1;t>=0;t--)e.deleteRule(t);this.style.remove(),this.style=null}match(e){for(let t in this.config.rules){let s=this.config.rules[t],l=this.matches[t],{symbol:R,native:M}=s;if(l&&l.test(e))return{origin:"match",config:s};if(R&&e.startsWith(R))return{origin:"symbol",config:s};if(M&&e.startsWith(M+":"))return{origin:"match",config:s}}for(let t of this.semantics)if(e.match(t[0]))return{origin:"semantics",value:t[1]}}create(e){let t=s=>{if(s in this.ruleBy)return this.ruleBy[s];let l=this.match(s);if(l)return new V.Rule(s,l,this)};return(e in this.classes?this.classes[e].map(s=>t(s)):[t(e)]).filter(s=>s&&s.text)}refresh(e){if(e?.override?this.config=e:this.config=j(S.config,e),this.cache(),!this.style)return;let t=document.createElement("style");t.title="master",this.style.replaceWith(t),this.style=t,this.rules.length=0,this.ruleBy={};for(let s in this.countBy)this.insert(s)}destroy(){let e=A.instances;this.disconnect(),e.splice(e.indexOf(this),1)}delete(e){let t=this.style.sheet,s=l=>{let R=this.ruleBy[l];if(!(!R||l in this.classesBy&&this.classesBy[l].some(M=>M in this.countBy))){if(R.natives.length){let M=R.natives[0];for(let y=0;y<t.cssRules.length;y++)if(t.cssRules[y]===M.cssRule){for(let B=0;B<R.natives.length;B++)t.deleteRule(y);this.rules.splice(this.rules.indexOf(R),1);break}}delete this.ruleBy[l],R.config.delete&&R.config.delete.call(this,l)}};if(e in this.classes){for(let l of this.classes[e])l in this.countBy||s(l);delete this.ruleBy[e]}else s(e)}insert(e){let t=this.create(e);return t.length?(this.insertRules(t),!0):!1}insertRules(e){for(let t of e){if(this.ruleBy[t.className])continue;let s,l=this.rules.length-1,{media:R,order:M,priority:y,hasWhere:v,className:B}=t,a=(i,c,m,d)=>{let f=0,w;c&&(f=i.findIndex(c)),m&&(w=i.findIndex(m)),f===-1&&(f=i.length),(w===void 0||w===-1)&&(w=i.length);let C=i.slice(f,w);for(let r=0;r<C.length;r++){let o=C[r];if(!(o.priority===-1||d&&d(o))&&(o.priority<y||o.priority===y&&(v&&!o.hasWhere||o.order>=M)))return f+r}return f+C.length};if(R){let i=this.rules.findIndex(c=>c.media);if(i!==-1){let c=R.features["max-width"],m=R.features["min-width"];if(c&&m){let d=c.value-m.value;for(let f=l;f>=i;f--){s=f;let w=this.rules[f],C=w.media,r=C.features["max-width"],o=C.features["min-width"];if(!r||!o){s++;break}let n=r.value-o.value;if(n===d){if(v!==w.hasWhere)continue;if(y!==-1){let u=[this.rules[f]];for(let h=f-1;h>=i;h--){let g=this.rules[h];if(g.hasWhere!==v)break;let b=g.media,E=b.features["max-width"],x=b.features["min-width"];if(!E||!x||E.value-x.value!==n)break;u.unshift(this.rules[h])}s=a(this.rules,h=>h.media&&h.priority!==-1&&h.media.features["min-width"]&&h.media.features["max-width"])}break}else if(n>d)break}}else if(m)for(let d=i;d<=l;d++){s=d;let f=this.rules[d],w=f.media,C=w.features["max-width"],r=w.features["min-width"];if(C){if(r)break;continue}let o=r?.value;if(o===m.value){if(!v&&f.hasWhere){s++;continue}if(y!==-1)s=a(this.rules,n=>n.media,n=>n.media&&n.priority!==-1&&n.media.features["min-width"]&&n.media.features["max-width"],n=>!n.media.features["min-width"]&&!n.media.features["max-width"]);else for(let n=d;n<=l;n++){let u=this.rules[n],h=u.media,g=h.features["min-width"];if(!h.features["max-width"]){if(u.hasWhere!==v||g.value!==o||u.order>=M)break;s=n+1}}break}else{if(o>m.value)break;s++}}else if(c)for(let d=l;d>=i;d--){s=d;let f=this.rules[d],w=f.media,C=w.features["max-width"];if(w.features["min-width"])continue;let o=C?.value;if(!o||o>c.value){s++;break}else if(o===c.value){if(v&&!f.hasWhere)continue;if(y!==-1)s=a(this.rules,n=>n.media,n=>n.media&&n.priority!==-1&&n.media.features["min-width"]&&n.media.features["max-width"],n=>!n.media.features["min-width"]&&!n.media.features["max-width"]);else{let n=[this.rules[d]];for(let u=d-1;u>=i;u--){let h=this.rules[u],g=h.media,b=g.features["min-width"],E=g.features["max-width"];if(!b&&(!E||E.value!==o||h.hasWhere!==v))break;n.unshift(h)}for(let u=0;u<n.length;u++){let h=n[u];if(!h.media.features["min-width"]){if(h.order>=M)break;s=d-n.length+2+u}}}break}}}if(s===void 0)if(i===-1)s=l+1;else if(y!==-1)s=i+a(this.rules.slice(i),void 0,c=>c.media.features["max-width"]||c.media.features["min-width"]);else if(v){let c=i;for(;c<this.rules.length;c++){let m=this.rules[c];if(m.priority!==-1||!m.hasWhere||m.order>=M){s=c;break}}s===void 0&&(s=c)}else for(let c=i;c<=l;c++){s=c;let m=this.rules[c],d=m.media;if(m.priority!==-1||d.features["max-width"]||d.features["min-width"])break;if(m.hasWhere)s++;else if(m.order>=M)break}}else if(y===-1)if(v)s=this.rules.findIndex(i=>!i.hasWhere||i.media||i.priority!==-1||i.order>=M),s===-1&&(s=l+1);else{let i=0;for(;i<this.rules.length;i++){let c=this.rules[i];if(c.media||!c.hasWhere&&(c.order>=M||c.priority!==-1)){s=i;break}}s===void 0&&(s=i)}else s=a(this.rules,void 0,i=>i.media);if(this.rules.splice(s,0,t),this.ruleBy[B]=t,this.style){let i=this.style.sheet,c=0,m=d=>{let f=this.rules[d];if(f){if(!f.natives.length)return m(d-1);let w=f.natives[f.natives.length-1].cssRule;for(let C=0;C<i.cssRules.length;C++)if(i.cssRules[C]===w){c=C+1;break}}};m(s-1);for(let d=0;d<t.natives.length;)try{let f=t.natives[d];i.insertRule(f.text,c),f.cssRule=i.cssRules[c++],d++}catch(f){console.error(f),t.natives.splice(d,1)}}}}get text(){return this.rules.map(e=>e.text).join("")}},k=A;T(k,"root"),T(k,"config",S.config),T(k,"instances",[]),T(k,"refresh",e=>{for(let t of A.instances)t.refresh(e)});F&&(window.MasterCSS=k);0&&(module.exports={MasterCSS});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var
|
|
1
|
+
var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var m=(s,e)=>{for(var r in e)i(s,r,{get:e[r],enumerable:!0})},p=(s,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of g(e))!l.call(s,t)&&t!==r&&i(s,t,{get:()=>e[t],enumerable:!(o=a(e,t))||o.enumerable});return s};var u=s=>p(i({},"__esModule",{value:!0}),s);var C={};m(C,{renderFromHTML:()=>x});module.exports=u(C);var c=require("../css");function x(s,e){if(!s)return;let r=new c.MasterCSS({...e,observe:!1}),o=/\sclass="([^"]*)"/gm,t;for(;t=o.exec(s);){let f=t[1].replace(/\n/g,"").split(" ").filter(n=>n);for(let n of f)n in r.countBy||(r.insert(n),r.countBy[n]=1)}return r.text}0&&(module.exports={renderFromHTML});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var i=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var m=(t,n)=>{for(var r in n)i(t,r,{get:n[r],enumerable:!0})},u=(t,n,r,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of c(n))!g.call(t,e)&&e!==r&&i(t,e,{get:()=>n[e],enumerable:!(o=s(n,e))||o.enumerable});return t};var a=t=>u(i({},"__esModule",{value:!0}),t);var C={};m(C,{render:()=>p});module.exports=a(C);var f=require("../css");function p(t,n){if(!t?.length)return;let r=new f.MasterCSS({...n,observe:!1});for(let o of t)o in r.countBy||r.insert(o)&&(r.countBy[o]=1);return r.text}0&&(module.exports={render});
|
package/dist/cjs/rule.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Q=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var pe=Object.prototype.hasOwnProperty;var me=(u,i)=>{for(var s in i)Q(u,s,{get:i[s],enumerable:!0})},xe=(u,i,s,y)=>{if(i&&typeof i=="object"||typeof i=="function")for(let v of de(i))!pe.call(u,v)&&v!==s&&Q(u,v,{get:()=>i[v],enumerable:!(y=ge(i,v))||y.enumerable});return u};var ye=u=>xe(Q({},"__esModule",{value:!0}),u);var ve={};me(ve,{Rule:()=>F});module.exports=ye(ve);var q=require("./constants/sorted-selectors"),$=require("./constants/start-symbol"),ce=require("./utils/css-escape");function oe(u){let i=typeof Buffer<"u"?Buffer:null;return!!(i&&u instanceof i||u instanceof Date||u instanceof RegExp)}function le(u){if(typeof Buffer<"u"&&Buffer&&u instanceof Buffer){let i=Buffer.alloc(u.length);return u.copy(i),i}else{if(u instanceof Date)return new Date(u.getTime());if(u instanceof RegExp)return new RegExp(u);throw new Error("Unexpected situation")}}function fe(u){let i=[];return u.forEach(function(s,y){typeof s=="object"&&s!==null?Array.isArray(s)?i[y]=fe(s):oe(s)?i[y]=le(s):i[y]=A({},s):i[y]=s}),i}function re(u,i){return i==="__proto__"?void 0:u[i]}function A(...u){let i={},s,y;return u.forEach(function(v){typeof v!="object"||v===null||Array.isArray(v)||Object.keys(v).forEach(function(j){if(y=re(i,j),s=re(v,j),s!==i)if(typeof s!="object"||s===null){i[j]=s;return}else if(Array.isArray(s)){i[j]=fe(s);return}else if(oe(s)){i[j]=le(s);return}else if(typeof y!="object"||y===null||Array.isArray(y)){i[j]=A({},s);return}else{i[j]=A(y,s);return}})}),i}var Se={unit:"",order:0,separators:[","]},F=class{constructor(i,s={},y){this.className=i;this.meta=s;this.css=y;this.config=A(Se,s.config);let{unit:v,order:j,colored:C,native:W,analyze:Y,transform:Z,declare:H,create:J}=this.config,{scope:K,important:ae,functions:ue}=y.config,{themeNames:X,colorNames:G,colorThemesMap:ee,selectors:z,breakpoints:te,mediaQueries:D,themeAffectedClassesBy:he,globalValues:I}=y,ie=he[i];this.order=j,J&&J.call(this,i);let _,ne,P,B,w;if(s.origin==="semantics"){let[g,f]=s.value;B=i.slice(g.length),_=f}else{let g;if(Y)[g,P]=Y.call(this,i);else if(s.origin==="match"){let r=i.indexOf(":");this.prefix=i.slice(0,r+1),this.prefix.includes("(")?(this.prefix=void 0,g=i):g=i.slice(r+1)}else s.origin==="symbol"&&(this.symbol=i[0],g=i.slice(1));w=[];let f=this,a=this.values,m=[","];this.config.separators.length&&m.push(...this.config.separators);let n="",t=0;(function r(e,c,l,o=void 0,h=[],b=[],d){let k=o===void 0,S,M=p=>p==="'"||p==='"',V=()=>S=n.length,O=()=>{if(n){let p=n,x=k?p:n.slice(S);if(n="",T="",a&&x in a&&!h.includes(x)){let R=t;t=0,r(a[x].toString(),c,void 0,o,[...h,x],b,d),t=R,k||(n=n.slice(0,S)+n)}else if(I&&x in I&&!b.includes(x)){let R=t;t=0,r(I[x].toString(),c,void 0,o,h,[...b,x],d),t=R,k||(n=n.slice(0,S)+n)}else if(k){let R=!d&&f.analyzeUnitValue(x,c);w.push({value:R?.value??x,unit:R?.unit})}else{let R=!d&&f.analyzeUnitValue(x,c);n=R?p.slice(0,S)+R.value+R.unit:p}V()}},E=M(l);V();let T="";for(;t<e.length;t++){let p=e[t];if(p===l){if(E){n+=p;let x=0;for(let R=n.length-2;n[R]==="\\";R--)x++;if(x%2)continue}else O(),n+=p;return}else if(!E&&p in $.START_SYMBOL){let x=p==="("&&T&&ue?.[T];x?.native&&(n=n.slice(0,n.length-T.length)+x.native,T=x.native),n+=p,t++;let R=$.START_SYMBOL[p];r(e,x?.unit??c,R,T||o||"",h,b,d||!!x?.transform),x?.transform&&(n=n.slice(0,S+T.length+1)+x.transform.call(f,n.slice(S+T.length+1,-1))+n.slice(-1)),k&&(M(R)?(w.push(n),n=""):O()),T=""}else if((p==="|"||p===" ")&&l!=="}"&&(!E||o==="path"))O(),k||(n+=" ",S++);else{if(!E){if(p==="."){if(isNaN(+e[t+1]))break;e[t-1]==="-"&&(n+="0")}else if(m.includes(p)){O(),k?w.push(p):(n+=p,S++);continue}else if(k&&(p==="#"&&(n||w.length&&e[t-1]!=="|"&&w[t-1]!==" ")||["!","*",">","+","~",":","[","@","_"].includes(p)))break;T+=p}n+=p}}o===void 0&&O()})(g,v),B=g.slice(t)}B[0]==="!"&&(this.important=!0,B=B.slice(1));let se=g=>{let f=g.split(/(\\'(?:.*?)[^\\]\\')(?=[*_>~+,)])|(\[[^=]+='(?:.*?)[^\\]'\])/).map((t,r)=>r%3?t:t.replace(/_/g," ")).join(""),a=[],m="",n=0;for(let t=0;t<f.length;t++){let r=f[t];if(r==="\\"){m+=r+f[++t];continue}!n&&r===","?(a.push(m),m=""):(m+=r,n&&r===")"?n--:r==="("&&n++)}return m&&a.push(m),a};this.prefixSelectors=P?se(P):[""];let N=B.split("@"),U=N[0];if(U){this.vendorSuffixSelectors={};let g=(t,r,e,c)=>{for(let[l,o]of r)if(l.test(t)){for(let h of o)g(t.replace(l,h),r,e,!0);return}c&&e.push(t)},f=[];""in z?g(U,z[""],f,!0):f.push(U);let a={};for(let[t,r]of Object.entries(z)){if(!t)continue;let e=[];for(let c of f)g(c,r,e,!1);e.length&&(a[t]=e)}let m=(t,r)=>{let e=r.reduce((c,l)=>(c.push(...se(l)),c),[]);t in this.vendorSuffixSelectors?this.vendorSuffixSelectors[t].push(...e):this.vendorSuffixSelectors[t]=e},n=Object.keys(a);if(n.length)for(let t of n)m(t,a[t]);else m("",f);for(let t of Object.values(this.vendorSuffixSelectors))for(let r of t){this.hasWhere!==!1&&(this.hasWhere=r.includes(":where("));for(let e=0;e<q.SORTED_SELECTORS.length;e++)if(r.includes(q.SORTED_SELECTORS[e])){(this.priority===-1||this.priority>e)&&(this.priority=e);break}}}else this.vendorSuffixSelectors={"":[""]};for(let g=1;g<N.length;g++){let f=N[g];if(f)if(X.includes(f))this.theme=f;else if(f==="rtl"||f==="ltr")this.direction=f;else{let a,m,n=f.indexOf("_");if(n!==-1)a=f.slice(0,n),m=f.slice(n);else{let t=f.indexOf("(");t!==-1&&(a=f.slice(0,t),m=f.slice(t))}if(!a){a="media";let t=[];this.media={token:f,features:{}};let r=f.split("&");for(let e of r)if(e==="all"||e==="print"||e==="screen"||e==="speech")this.media.type=e;else if(e==="\u{1F5A8}")this.media.type="print";else if(e==="landscape"||e==="portrait")t.push("(orientation:"+e+")");else if(e==="motion"||e==="reduced-motion")t.push("(prefers-reduced-motion:"+(e==="motion"?"no-preference":"reduce")+")");else if(D&&e in D)t.push(D[e]);else{let c={token:e},l="",o="",h=0;e.startsWith("<=")?(o="<=",l="max-width"):e.startsWith(">=")||te[e]?(o=">=",l="min-width"):e.startsWith(">")?(o=">",l="min-width",h=.02):e.startsWith("<")&&(o="<",l="max-width",h=-.02);let b=o?e.replace(o,""):e,d=te[b];switch(l){case"max-width":case"min-width":d?Object.assign(c,this.analyzeUnitValue(d.toString(),"px")):Object.assign(c,this.analyzeUnitValue(b,"px")),c.unit==="px"&&(c.value+=h),this.media.features[l]=c,t.push("("+l+":"+(c.value+c.unit)+")");break}}m="",this.media.type&&(m=this.media.type),t.length&&(m+=(m?" and ":"")+t.join(" and "))}m&&(this.at[a]=(a in this.at?this.at[a]+" and ":"")+m.replace(/_/g," "))}}let L=(g,f)=>{let a,m=(r,e,c)=>{let l="";this.direction&&(l+="[dir="+this.direction+"] ");let o=this.prefixSelectors.map(d=>d+l),h=(d,k)=>o.map(S=>(d?"."+d+" ":"")+(K?K+" ":"")+S).reduce((S,M)=>(S.push(c.reduce((V,O)=>(V.push(M+"."+(0,ce.cssEscape)(k)+O),V),[]).join(",")),S),[]).join(","),b=h(e,i)+(ie?Object.entries(ie).filter(([d])=>this.theme||!C||!e||!d||d===e).map(([d,k])=>k.reduce((S,M)=>S+","+h(this.theme??((C||ne)&&e||d),M),"")).join(""):"")+"{"+r+"}";for(let d of Object.keys(this.at).sort((k,S)=>S==="supports"?-1:1))b="@"+d+" "+this.at[d]+"{"+b+"}";return b},n=[];if(w){let r=this.theme?[this.theme,""]:[g],e,c;for(let l of w)if(typeof l=="string")n.push(l);else{let o=l.value;if(l.unit)o+=l.unit;else if(C&&ee&&G){let h=!1,b=!1;o=o.replace(new RegExp(`(^|,| |\\()((?:${G.join("|")})(?:-(?:[0-9A-Za-z-]+))?)(?:\\/(\\.?[0-9]+%?))?(?=(\\)|\\}|,| |$))`,"gm"),(d,k,S,M)=>{b=!0;let V=ee[S];if(V){let O;for(let E of r)if(O=V[E])break;if(O){h=!0;let E=O;if(M){let T=M.endsWith("%")?parseFloat(M)/100:+M;T=isNaN(T)?1:Math.min(Math.max(T,0),1),E+=Math.round(T*255).toString(16).toUpperCase().padStart(2,"0")}return k+E}}return d}),b&&(c=h)}c!==void 0&&!e&&(e=c),n.push(o)}if(f&&(e===void 0?g:!e))return;if(a=n.reduce((l,o,h)=>l+o+(o===","||w[h+1]===","||h===w.length-1?"":" "),""),Z&&(a=Z.call(this,a,this.css.config)),C&&a==="current"&&(a="currentColor"),H){let l,o;if(w.length===1){let h=w[0];typeof h=="object"&&(l=h.value,o=h.unit)}_=H.call(this,o?l:a,o||"")}else _={[W]:a}}let t={};for(let r in _){let e=(o,h)=>{let b=h+((this.important||ae)&&!h.endsWith("!important")?"!important":"");o in t?t[o].push(b):t[o]=[b]},c=r+":",l=_[r];if(typeof l=="object"){ne=!0;for(let o in l)e(o,c+l[o])}else e(g,c+l.toString())}for(let r of Object.values(this.vendorSuffixSelectors))for(let e in t)this.natives.push({text:m(t[e].join(";"),e,r),theme:e})};if(this.theme)L(this.theme,!1);else if(C)for(let g of X)L(g,!0);else L("",!1)}at={};priority=-1;natives=[];config;get values(){return this.css.values[this.config.id]}get text(){return this.natives.map(i=>i.text).join("")}resolveValue(i,s){return Number.isNaN(+i)?i:i/(s==="rem"||s==="em"?this.css.config.rootSize:1)+s}analyzeUnitValue(i,s){let y=s??this.config.unit;if(y){let v="",j=i.match(/^([+-.]?\d+(\.?\d+)?)(.*)?/);if(j)if(i.includes("/")){let[C,W]=i.split("/");return{value:+C/+W*100+"%",unit:v}}else{let C=+j[1];return v=j[3]||"",v||((y==="rem"||y==="em")&&(C=C/this.css.config.rootSize),v=y||""),{value:C,unit:v}}}}};0&&(module.exports={Rule});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var f=Object.defineProperty;var
|
|
1
|
+
var f=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var v=(e,t)=>{for(var r in t)f(e,r,{get:t[r],enumerable:!0})},w=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of C(t))!N.call(e,n)&&n!==r&&f(e,n,{get:()=>t[n],enumerable:!(a=x(t,n))||a.enumerable});return e};var z=e=>w(f({},"__esModule",{value:!0}),e);var $={};v($,{parseRuleValue:()=>V});module.exports=z($);function V(e,t,r,a,n,p){let s="",g="",c;if(typeof e=="number")s=e,g=t||"";else{if(a){let d=!1,h=!1;e=e.replace(new RegExp(`(^|,| |\\()((?:${r.join("|")})(?:-(?:[0-9A-Za-z-]+))?)(?:\\/(\\.?[0-9]+%?))?(?=(\\)|\\}|,| |$))`,"gm"),(b,M,R,i)=>{h=!0;let m=a[R];if(m){let u;for(let l of p)if(u=m[l])break;if(u){d=!0;let l=u;if(i){let o=i.endsWith("%")?parseFloat(i)/100:+i;o=isNaN(o)?1:Math.min(Math.max(o,0),1),l+=Math.round(o*255).toString(16).toUpperCase().padStart(2,"0")}return M+l}}return b}),h&&(c=d)}s=e}return{value:s,unit:g,colorMatched:c}}0&&(module.exports={parseRuleValue});
|
package/dist/config/index.d.ts
CHANGED
|
@@ -9,8 +9,9 @@ import { rules } from './rules';
|
|
|
9
9
|
import { override } from './override';
|
|
10
10
|
import { observe } from './observe';
|
|
11
11
|
import { important } from './important';
|
|
12
|
+
import { functions, FunctionConfig } from './functions';
|
|
12
13
|
declare const config: Config;
|
|
13
|
-
export { config, breakpoints, colors, rootSize, scope, selectors, semantics, themes, rules, override, observe, important };
|
|
14
|
+
export { config, breakpoints, colors, rootSize, scope, selectors, semantics, themes, rules, override, observe, important, functions };
|
|
14
15
|
import type { RuleConfig } from '../rule';
|
|
15
16
|
type Classes = {
|
|
16
17
|
[key: string]: string | Classes;
|
|
@@ -54,4 +55,5 @@ export interface Config {
|
|
|
54
55
|
important?: boolean;
|
|
55
56
|
override?: boolean;
|
|
56
57
|
observe?: boolean;
|
|
58
|
+
functions?: Record<string, FunctionConfig>;
|
|
57
59
|
}
|
package/dist/css.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ export interface MasterCSS {
|
|
|
9
9
|
colorThemesMap: Record<string, Record<string, string>>;
|
|
10
10
|
colorNames: string[];
|
|
11
11
|
themeNames: string[];
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
themeAffectedClassesBy: Record<string, Record<string, string[]>>;
|
|
13
|
+
classesBy: Record<string, string[]>;
|
|
14
14
|
selectors: Record<string, [RegExp, string[]][]>;
|
|
15
15
|
values: Record<string, Record<string, string | number>>;
|
|
16
16
|
globalValues: Record<string, string | number>;
|
|
@@ -25,9 +25,8 @@ export declare class MasterCSS {
|
|
|
25
25
|
static instances: MasterCSS[];
|
|
26
26
|
static refresh: (config: Config) => void;
|
|
27
27
|
readonly rules: Rule[];
|
|
28
|
-
readonly
|
|
29
|
-
readonly
|
|
30
|
-
readonly ready: boolean;
|
|
28
|
+
readonly ruleBy: Record<string, Rule>;
|
|
29
|
+
readonly countBy: {};
|
|
31
30
|
_observer: MutationObserver;
|
|
32
31
|
constructor(config?: Config);
|
|
33
32
|
cache(): void;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{program as c}from"commander";import w from"path";import{readPackage as S}from"../utils/read-package.mjs";import m from"chokidar";import a from"fs";import{defineContent as x}from"../methods/define-content.mjs";import t from"@techor/log";c.command("init").description("Create a Master CSS definition file with configuration").allowUnknownOption().option("--jit","With initialization of the just-in-time program").option("-c, --compiler","With compiler options").option("-o, --override","Override the existing definition file").option("--ext <extension>","Definition extension `ts`, `js`, `mjs`").action(function(l){let{ext:e}=l;if(!e)if(a.existsSync("tsconfig.json"))e="ts";else{let{type:d}=S();d==="module"?e="mjs":e="js"}let i=x({...l,ext:e}),n=`master.css.${e}`,s=a.existsSync(w.join(process.cwd(),n));s?s&&l.override?(a.writeFileSync(n,i),t.ok`**${n}** definition file is overridden`):t.x`**${n}** definition file already exists`:(a.writeFileSync(n,i),t.ok`**${n}** definition file is created`)});c.command("build",{isDefault:!0}).allowUnknownOption().option("-w, --watch","Watch file changed and generate CSS rules.").option("-o, --output <path>","Specify your master CSS file output path","master.css").action(async function({watch:l,output:e}){let i=await new(await import("@master/css-compiler")).default().compile(),n=r=>i.insert(r,a.readFileSync(r,{encoding:"utf-8"})),s=()=>a.writeFileSync(e,i.css.text),d=i.sources;if(console.log(""),t`[sources] ${d}`,l){let r=[],p=async()=>{let{include:o,exclude:y,sources:u}=i.options;o?.length&&g(m.watch(o,{ignored:y,ignoreInitial:!0})),u?.length&&g(m.watch(u,{ignoreInitial:!0})),s(),t.tree(i.options)},h=async o=>{n(o),s()},g=o=>{r.push(o.on("add",h).on("change",h))};await p(),console.log(""),t.t`Start watching source changes`,t.tree(i.options);let f=async()=>{await Promise.all(r.map(o=>o.close())),r.length=0,await i.refresh(),await p()};m.watch([i.resolvedConfigPath],{ignoreInitial:!0}).on("add",f).on("change",f).on("unlink",f)}else s()});var{version:j,name:k,description:v}=S(w.join(__dirname,"../../package.json"));c.name(k);c.description(v);c.version(j);c.parse();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{fillColorScale as f}from"../methods/fill-color-scale.mjs";var a={black:"#000000",white:"#ffffff",slate:f({5:"#141e2b",10:"#19212d",20:"#262f3e",30:"#323e52",40:"#41516b",50:"#616a84",55:"#6c7693",60:"#959db3",70:"#a3abbf",80:"#d7dae3",95:"#f6f7f8"}),gray:f({5:"#1e1d1f",10:"#212022",20:"#2f2e30",30:"#3e3d40",40:"#504f52",50:"#6b6a6d",55:"#777679",60:"#9e9da0",70:"#abaaae",80:"#dad9db",95:"#f5f4f7"}),brown:f({5:"#271b15",10:"#2b1e18",20:"#3c2b22",30:"#50382c",40:"#694839",50:"#8d604b",55:"#9d6b53",60:"#b79788",70:"#c1a598",80:"#efd5c9",95:"#faf2ef"}),orange:f({5:"#2e1907",10:"#331b07",20:"#47260b",30:"#5d320e",40:"#7a4111",50:"#a15717",55:"#b4611a",60:"#e38739",70:"#e79855",80:"#f7d4b5",95:"#fcf1e7"}),gold:f({5:"#281b00",10:"#2d1e01",20:"#3f2a00",30:"#543800",40:"#6d4900",50:"#906000",55:"#9c6d00",60:"#d09100",70:"#dca000",80:"#fbd67f",95:"#fff3d8"}),yellow:f({5:"#251d00",10:"#282000",20:"#3a2e01",30:"#4b3b00",40:"#624e00",50:"#806700",55:"#8e7200",60:"#be9900",70:"#d0a700",80:"#edda8f",95:"#fff5ca"}),grass:f({5:"#162106",10:"#182406",20:"#223308",30:"#2c4408",40:"#3a570b",50:"#4e750e",60:"#74ae15",70:"#7dbc17",80:"#bfe87c",95:"#ebfad4"}),green:f({5:"#042311",10:"#032611",20:"#023717",30:"#03481f",40:"#025d26",50:"#067b34",55:"#07883a",60:"#09b64d",70:"#0ac553",80:"#80f1a4",95:"#e0fae8"}),beryl:f({5:"#002319",10:"#00271c",20:"#003626",30:"#004732",40:"#005c41",50:"#007954",55:"#00875e",60:"#00b37c",70:"#00c387",80:"#72f0c5",95:"#d6fcef"}),teal:f({5:"#012220",10:"#012624",20:"#003532",30:"#004541",40:"#005a54",50:"#00776f",55:"#00857c",60:"#00b1a5",70:"#00bfb2",80:"#6aeee5",95:"#d4fcf8"}),cyan:f({5:"#00222b",10:"#00252e",20:"#013340",30:"#004457",40:"#00576f",50:"#007391",55:"#0080a1",60:"#00abd7",70:"#00b9e9",80:"#97e6fa",95:"#dff8ff"}),sky:f({5:"#031f34",10:"#032339",20:"#04314e",30:"#044169",40:"#065386",50:"#086eb3",55:"#097ac5",60:"#29a4f5",70:"#4db3f7",80:"#b3e0ff",95:"#eaf6fe"}),blue:f({5:"#07194a",10:"#081c53",20:"#0a2773",30:"#0e3496",40:"#1146b6",50:"#175fe9",55:"#2671ea",60:"#6b9ef1",70:"#81acf3",80:"#c6dbfe",95:"#edf4fe"}),indigo:f({5:"#1f1645",10:"#20174f",20:"#2b1f74",30:"#37289d",40:"#463fb1",50:"#5a5bd5",55:"#6464f1",60:"#9393f5",70:"#a1a5ee",80:"#d5d7fe",95:"#f1f2ff"}),violet:f({5:"#2b0a4e",10:"#2e0b57",20:"#3d1179",30:"#4e169f",40:"#5f2eba",50:"#7949e5",55:"#8755f5",60:"#ac8af8",70:"#b89bf9",80:"#e1d4fe",95:"#f5f1ff"}),purple:f({5:"#2e0c47",10:"#330c4e",20:"#460f6c",30:"#5b1390",40:"#7421b1",50:"#9832e4",55:"#a348e7",60:"#c184ef",70:"#ca96f1",80:"#ead1fe",95:"#f9f0ff"}),fuchsia:f({5:"#39092a",10:"#400932",20:"#560d4a",30:"#6f1165",40:"#8c158a",50:"#b61cbb",55:"#ca1fce",60:"#e66ee9",70:"#ea86ed",80:"#facbfb",95:"#feefff"}),pink:f({5:"#3d0722",10:"#430725",20:"#5d0933",30:"#790d44",40:"#9a1058",50:"#ca1473",55:"#e11681",60:"#f170b4",70:"#f388c0",80:"#fdcde6",95:"#fff0f8"}),crimson:f({5:"#430213",10:"#470314",20:"#62041c",30:"#800524",40:"#9f1036",50:"#ce1a4b",55:"#e8144c",60:"#f37596",70:"#f58ba7",80:"#fdceda",95:"#fff1f4"}),red:f({5:"#450001",10:"#490102",20:"#640304",30:"#800506",40:"#a11012",50:"#d11a1e",55:"#ed0a0e",60:"#f97476",70:"#fa8b8d",80:"#fdcfcf",95:"#fff1f1"})};export{a as colors};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var c={$:{native:"var",transform(r){return"--"+r}},calc:{transform(r){let o=e=>e==="+"||e==="-"||e==="*"||e==="/",s="",n,i="",f=!1,u=!1,a=(e,t="",g="")=>{if(n===2&&!u){let l=this.analyzeUnitValue(i,c.calc.unit);l&&(i=l.value+l.unit)}s+=i+t+e+g,n=null,u=!1,i=""};for(let e=0;e<r.length;e++){let t=r[e];if(t==="("||t===")")f=t===")",a(t);else if(t===",")a(t,""," ");else{switch(n){case 1:break;case 2:if(o(t)){a(t," "," ");continue}else/[0-9]/.test(t)||(u=!0);break;default:f&&(s+=" "),isNaN(+t)?o(t)||(n=1):n=2;break}n?i+=t:s+=t}}return a(""),s}},translate:{unit:"rem"},translateX:{unit:"rem"},translateY:{unit:"rem"},translateZ:{unit:"rem"},translate3d:{unit:"rem"},skew:{unit:"deg"},skewX:{unit:"deg"},skewY:{unit:"deg"},skewZ:{unit:"deg"},skew3d:{unit:"deg"},rotate:{unit:"deg"},rotateX:{unit:"deg"},rotateY:{unit:"deg"},rotateZ:{unit:"deg"},rotate3d:{unit:"deg"},blur:{unit:"rem"},"drop-shadow":{unit:"rem"},"hue-rotate":{unit:"deg"},rgb:{unit:""},rgba:{unit:""},hsl:{unit:""},hsla:{unit:""}};export{c as functions};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{breakpoints as e}from"./breakpoints.mjs";import{colors as r}from"./colors.mjs";import{rootSize as s}from"./root-size.mjs";import{scope as o}from"./scope.mjs";import{selectors as t}from"./selectors.mjs";import{semantics as i}from"./semantics.mjs";import{themes as n}from"./themes.mjs";import{rules as m}from"./rules.mjs";import{override as a}from"./override.mjs";import{observe as p}from"./observe.mjs";import{important as l}from"./important.mjs";import{functions as c}from"./functions.mjs";var x={breakpoints:e,colors:r,rootSize:s,scope:o,selectors:t,semantics:i,themes:n,rules:m,override:a,observe:p,important:l,functions:c};export{e as breakpoints,r as colors,x as config,c as functions,l as important,p as observe,a as override,s as rootSize,m as rules,o as scope,t as selectors,i as semantics,n as themes};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{START_SYMBOL as f}from"../constants/start-symbol.mjs";import{BOX_UNDERNEATH as v}from"../constants/box-underneath.mjs";import{CONTENT_EXTREMA as p}from"../constants/content-extrema.mjs";import{SIZING_VALUES as g}from"../constants/sizing-values.mjs";import{cssEscape as $}from"../utils/css-escape.mjs";var T={group:{match:"^(?:.+?[*_>~+])?\\{.+?\\}",analyze(e){let t=0;for(;t<e.length&&!(e[t]==="{"&&e[t-1]!=="\\");t++);return[e.slice(t),e.slice(0,t)]},declare(e){let t={},r=(o,i)=>{let a=i.indexOf(":");if(a!==-1){o in t||(t[o]={});let c=t[o],h=i.slice(0,a);h in c||(c[h]=i.slice(a+1))}},l=o=>{let i=(a,c)=>{let h=c.slice($(o.className).length).match(/\{(.*)\}/)[1].split(";");for(let y of h)r(a,y)};if(this.theme){let a=o.natives.find(c=>c.theme===this.theme)??o.natives.find(c=>!c.theme);a&&i(this.theme,a.text)}else for(let a of o.natives)i(a.theme,a.text)},s=[],n="",u=()=>{n&&(s.push(n.replace(/ /g,"")),n="")},d=1;(function o(i){for(;d<e.length;d++){let a=e[d];if(!i){if(a===";"){u();continue}if(a==="}")break}if(n+=a,i===a){if(i==="'"||i==='"'){let c=0;for(let h=n.length-2;n[h]==="\\";h--)c++;if(c%2)continue}break}else a in f&&i!=="'"&&i!=='"'&&(d++,o(f[a]))}})(void 0),u();for(let o of s){let i=this.css.create(o);if(Array.isArray(i))for(let a of i)l(a);else i?l(i):r(this.theme??"",o)}let m={};for(let o in t)for(let[i,a]of Object.entries(t[o]))i in m?m[i][o]=a:m[i]={[o]:a};return console.log(m),m}},variable:{match:"^\\$[^ (){}A-Z]+:[^ ]",declare(e){return{["--"+this.prefix.slice(1,-1)]:e}}},fontSize:{match:"^f(?:ont)?:(?:[0-9]|(?:max|min|calc|clamp)\\(.*\\)|$values)[^|]*$",unit:"rem",native:!0},fontWeight:{match:"^f(?:ont)?:(?:bolder|$values)(?!\\|)",native:!0,values:{thin:100,extralight:200,light:300,regular:400,medium:500,semibold:600,bold:700,extrabold:800,heavy:900}},fontFamily:{match:"^f(?:ont)?:(?:$values)(?!\\|)",native:!0,values:{mono:"ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace",sans:"ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji",serif:"ui-serif,Georgia,Cambria,Times New Roman,Times,serif"}},fontSmoothing:{match:"^f(?:ont)?:(?:antialiased|subpixel-antialiased|$values)(?!\\|)",declare(e){let t={};switch(e){case"subpixel-antialiased":t["-webkit-font-smoothing"]=t["-moz-osx-font-smoothing"]="auto";break;case"antialiased":t["-webkit-font-smoothing"]="antialiased",t["-moz-osx-font-smoothing"]="grayscale";break}return t}},fontStyle:{match:"^f(?:ont)?:(?:normal|italic|oblique|$values)(?!\\|)",native:!0,unit:"deg"},fontVariantNumeric:{match:"^f(?:ont)?:(?:ordinal|slashed-zero|lining-nums|oldstyle-nums|proportional-nums|tabular-nums|diagonal-fractions|stacked-fractions|$values)(?!\\|)",native:!0},fontFeatureSettings:{match:"^font-feature:.",native:!0},font:{match:"^f:.",native:!0,order:-1},color:{match:"^(?:color|fg|foreground):.",native:!0,colored:!0,values:{current:"currentColor"}},margin:{match:"^m(?:argin(?:-(?:left|right|top|bottom))?|[xytblr]?):.",unit:"rem",declare(e,t){return x.call(this,e+t)},get order(){return this.prefix==="margin:"||this.prefix==="m:"?-1:0}},padding:{match:"^p(?:adding(?:-(?:left|right|top|bottom))?|[xytblr]?):.",unit:"rem",declare(e,t){return x.call(this,e+t)},get order(){return this.prefix==="padding:"||this.prefix==="p:"?-1:0}},flexBasis:{values:g,unit:"rem",native:!0},flexWrap:{match:"^flex:(?:wrap(?:-reverse)?|nowrap|$values)(?!\\|)",native:!0},flexGrow:{native:!0},flexShrink:{native:!0},flexDirection:{match:"^flex:(?:(?:row|column)(?:-reverse)?|$values)(?!\\|)",native:!0,values:{col:"column","col-reverse":"column-reverse"}},flex:{native:!0,order:-1},display:{match:"^d:.",native:!0},width:{match:"^w:.",unit:"rem",native:!0,values:g},height:{match:"^h:.",unit:"rem",native:!0,values:g},minWidth:{match:"^min-w:.",unit:"rem",native:!0,values:g},minHeight:{match:"^min-h:.",unit:"rem",native:!0,values:g},box:{match:"^(?:(?:max|min|clamp|calc)\\(.+\\)|[0-9]+[a-z]*?)x(?:(?:max|min|clamp|calc)\\(.+\\)|[0-9]+[a-z]*?)",unit:"rem",separators:["x"],analyze(e){return[e]},declare(e){let[t,r]=e.split(" x ");return{width:t,height:r}}},minBox:{match:"^min:(?:(?:max|min|clamp|calc)\\(.+\\)|[0-9]+[a-z]*?)x(?:(?:max|min|clamp|calc)\\(.+\\)|[0-9]+[a-z]*?)",unit:"rem",separators:["x"],analyze(e){return[e.slice(4)]},declare(e){let[t,r]=e.split(" x ");return{"min-width":t,"min-height":r}}},maxBox:{match:"^max:(?:(?:max|min|clamp|calc)\\(.+\\)|[0-9]+[a-z]*?)x(?:(?:max|min|clamp|calc)\\(.+\\)|[0-9]+[a-z]*?)",unit:"rem",separators:["x"],analyze(e){return[e.slice(4)]},declare(e){let[t,r]=e.split(" x ");return{"max-width":t,"max-height":r}}},contain:{native:!0},content:{native:!0},counterIncrement:{native:!0},counterReset:{native:!0},letterSpacing:{match:"^ls:.",native:!0,unit:"em"},lineHeight:{match:"^lh:.",native:!0},objectFit:{match:"^(?:object|obj):(?:contain|cover|fill|scale-down|$values)",native:!0},objectPosition:{match:"^(?:object|obj):(?:top|bottom|right|left|center|$values)",native:!0},textAlign:{match:"^t(?:ext)?:(?:justify|center|left|right|start|end|$values)(?!\\|)",native:!0},textDecorationColor:{match:"^text-decoration:(?:(?:#|(rgb|hsl)\\(.*\\))((?!\\|).)*$|(?:transparent|currentColor|inherit|$values|$colors))",native:!0,colored:!0,values:{current:"currentColor"}},textDecorationStyle:{match:"^t(?:ext)?:(?:solid|double|dotted|dashed|wavy|$values)(?!\\|)",native:!0},textDecorationThickness:{match:"^text-decoration:(?:\\.?[0-9]|(?:max|min|calc|clamp)\\(.*\\)|from-font|$values)[^|]*$",native:!0,unit:"em"},textDecorationLine:{match:"^t(?:ext)?:(?:none|underline|overline|line-through|$values)(?!\\|)",native:!0},textDecoration:{match:"^t(?:ext)?:(?:underline|line-through|overline)",unit:"rem",native:!0,colored:!0,values:{current:"currentColor"},order:-1},textUnderlineOffset:{unit:"rem",native:!0},textOverflow:{match:"^(?:text-(?:overflow|ovf):.|t(?:ext)?:(?:ellipsis|clip|$values)(?!\\|))",native:!0},textOrientation:{match:"^t(?:ext)?:(?:mixed|upright|sideways-right|sideways|use-glyph-orientation|$values)(?!\\|)",native:!0},textTransform:{match:"^t(?:ext)?:(?:uppercase|lowercase|capitalize|$values)(?!\\|)",native:!0},textRendering:{match:"^t(?:ext)?:(?:optimizeSpeed|optimizeLegibility|geometricPrecision|$values)(?!\\|)",native:!0},textIndent:{unit:"rem",native:!0},verticalAlign:{match:"^(?:v|vertical):.",native:!0},columns:{match:"^(?:columns|cols):.",native:!0,order:-1},whiteSpace:{native:!0},inset:{match:"^(?:top|bottom|left|right):.",unit:"rem",native:!0,declare(e,t){return{[this.prefix.slice(0,-1)]:e+t}}},lines:{match:"^lines:.",declare(e,t){return{overflow:"hidden",display:"-webkit-box","overflow-wrap":"break-word","text-overflow":"ellipsis","-webkit-box-orient":"vertical","-webkit-line-clamp":e+t}}},maxHeight:{match:"^max-h:.",unit:"rem",native:!0,values:g},maxWidth:{match:"^max-w:.",unit:"rem",native:!0,values:g},boxSizing:{match:"^box:(?:$values)(?!\\|)",native:!0,values:{content:"content-box",border:"border-box"}},opacity:{native:!0},visibility:{native:!0},clear:{native:!0},float:{native:!0},isolation:{native:!0},overflow:{match:"^overflow(?:-x|-y)?:(?:visible|overlay|hidden|scroll|auto|clip|inherit|initial|revert|revert-layer|unset|\\$|var|$values)",declare(e,t){if(this.prefix)switch(this.prefix.slice(-2,-1)){case"x":return{"overflow-x":e+t};case"y":return{"overflow-y":e+t}}return{overflow:e+t}},get order(){return-1}},overscrollBehavior:{match:"^overscroll-behavior(?:-[xy])?:",declare(e,t){switch(this.prefix.slice(-2,-1)){case"x":return{"overscroll-behavior-x":e+t};case"y":return{"overscroll-behavior-y":e+t};default:return{"overscroll-behavior":e+t}}}},zIndex:{match:"^z:.",native:!0},position:{native:!0,values:{abs:"absolute",rel:"relative"}},cursor:{native:!0},pointerEvents:{native:!0},resize:{native:!0},touchAction:{native:!0},wordBreak:{native:!0},wordSpacing:{native:!0,unit:"em"},userDrag:{declare(e,t){return{"user-drag":e+t,"-webkit-user-drag":e+t}}},userSelect:{native:!0,declare(e,t){return{"user-select":e+t,"-webkit-user-select":e+t}}},textShadow:{unit:"rem",native:!0,colored:!0,values:{current:"currentColor"}},textSize:{match:"^t(?:ext)?:(?:\\.?[0-9]|(?:max|min|calc|clamp)\\(.*\\)|$values)[^|]*$",unit:"rem",declare(e,t){return{"font-size":e+t,"line-height":t==="em"?e+.75+t:`calc(${e}${t} + ${.75}em)`}}},textFillColor:{native:!0,match:"^(?:text-fill|text|t):(?:(?:#|(rgb|hsl)\\(.*\\))((?!\\|).)*$|(?:transparent|currentColor|inherit|$values|$colors))",colored:!0,values:{current:"currentColor"},declare(e,t){return{"-webkit-text-fill-color":e+t}}},textStrokeWidth:{match:"^text-stroke(:(thin|medium|thick|\\.?[0-9]+|$values)(?!\\|)|-width:.)",unit:"rem",declare(e,t){return{"-webkit-text-stroke-width":e+t}}},textStrokeColor:{match:"^text-stroke:(?:(?:#|(rgb|hsl)\\(.*\\))((?!\\|).)*$|(?:transparent|currentColor|inherit|$values|$colors))",native:!0,colored:!0,values:{current:"currentColor"},declare(e,t){return{"-webkit-text-stroke-color":e+t}}},textStroke:{unit:"rem",native:!0,declare(e,t){return{"-webkit-text-stroke":e+t}}},boxShadow:{match:"^s(?:hadow)?:.",unit:"rem",native:!0,colored:!0,values:{current:"currentColor"}},tableLayout:{native:!0},transformBox:{match:"^transform:(?:$values)(?!\\|)",native:!0,values:{...v,fill:"fill-box",stroke:"stroke-box",view:"view-box"}},transformStyle:{match:"^transform:(?:flat|preserve-3d|$values)(?!\\|)",native:!0},transformOrigin:{match:"^transform:(?:top|bottom|right|left|center|[0-9]|$values)",native:!0,unit:"px"},transform:{match:"^(?:translate|scale|skew|rotate|perspective|matrix)(?:3d|[XYZ])?\\(",native:!0},transitionProperty:{match:"^~property:.",native:!0},transitionTimingFunction:{match:"^~easing:.",native:!0},transitionDuration:{match:"^~duration:.",native:!0,unit:"ms"},transitionDelay:{match:"^~delay:.",native:!0,unit:"ms"},transition:{symbol:"~",native:!0,order:-1},animationDelay:{match:"^@delay:.",native:!0,unit:"ms"},animationDirection:{match:"^@direction:.",native:!0},animationDuration:{match:"^@duration:.",native:!0,unit:"ms"},animationFillMode:{match:"^@fill-mode:.",native:!0},animationIterationCount:{match:"^@iteration-count:.",native:!0},animationName:{match:"^@name:.",native:!0},animationPlayState:{match:"^@play-state:.",native:!0},animationTimingFunction:{match:"^@easing:.",native:!0},animation:{symbol:"@",native:!0,order:-1},borderColor:{match:"^b(?:[xytblr]|(?:order(?:-(?:left|right|top|bottom))?))?(?:-color)?:(?:(?:#|(rgb|hsl)\\(.*\\))((?!\\|).)*$|(?:transparent|currentColor|inherit|$values|$colors))",colored:!0,values:{current:"currentColor"},declare(e,t){return b(this.prefix,e+t,"color")},get order(){return this.prefix==="border-color:"||this.prefix==="b:"||this.prefix==="border:"?-1:0}},borderRadius:{match:"^(?:r[tblr]?[tblr]?|border(?:-(?:top|bottom)-(?:left|right))?-radius):.",unit:"rem",declare(e,t){if(this.prefix){let l="",s=this.prefix.split("-");if(s.length>1)for(let n=1;n<s.length-1;n++)l+=s[n][0];else l=this.prefix.slice(1,-1);switch(l){case"t":return{"border-top-left-radius":e+t,"border-top-right-radius":e+t};case"tl":case"lt":return{"border-top-left-radius":e+t};case"rt":case"tr":return{"border-top-right-radius":e+t};case"b":return{"border-bottom-left-radius":e+t,"border-bottom-right-radius":e+t};case"bl":case"lb":return{"border-bottom-left-radius":e+t};case"br":case"rb":return{"border-bottom-right-radius":e+t};case"l":return{"border-top-left-radius":e+t,"border-bottom-left-radius":e+t};case"r":return{"border-top-right-radius":e+t,"border-bottom-right-radius":e+t};default:return{"border-radius":e+t}}}let r=this.prefix?.slice(0,-1);return{[["border-top-left-radius","border-top-right-radius","border-bottom-left-radius","border-bottom-right-radius"].includes(r)?r:"border-radius"]:e+t}},get order(){return this.prefix==="border-radius:"||this.prefix==="r:"?-1:0}},borderStyle:{match:"^(?:border(?:-(?:left|right|top|bottom))?-style:.|b(?:[xytblr]|order(?:-(?:left|right|top|bottom))?)?:(?:none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset|$values)(?!\\|))",declare(e,t){return b(this.prefix,e+t,"style")},get order(){return this.prefix==="border-style:"||this.prefix==="b:"||this.prefix==="border:"?-1:0}},borderWidth:{match:"^(?:border(?:-(?:left|right|top|bottom))?-width:.|b(?:[xytblr]|order(?:-(?:left|right|top|bottom))?)?:(?:\\.?[0-9]|(?:max|min|calc|clamp)\\(.*\\)|$values)[^|]*$)",unit:"rem",declare(e,t){return b(this.prefix,e+t,"width")},get order(){return this.prefix==="border-width:"||this.prefix==="b:"||this.prefix==="border:"?-1:0}},borderCollapse:{match:"^b(?:order)?:(?:collapse|separate|$values)(?!\\|)",native:!0},borderSpacing:{unit:"rem",native:!0},borderImageOutset:{unit:"rem",native:!0},borderImageRepeat:{match:"^border-image:(?:stretch|repeat|round|space|$values)(?!\\|)",native:!0},borderImageSlice:{native:!0},borderImageSource:{match:"^border-image:(?:(?:url|linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient|conic-gradient)\\(.*\\)|$values)(?!\\|)",native:!0},borderImageWidth:{match:"^border-image:(?:\\.?[0-9]|(?:max|min|calc|clamp)\\(.*\\)|$values)[^|]*$",unit:"rem",native:!0},borderImage:{native:!0},border:{match:"^b(?:[xytblr]?|order(?:-(?:left|right|top|bottom))?):.",unit:"rem",colored:!0,values:{current:"currentColor"},declare(e,t){return b(this.prefix,e+t)},get order(){return this.prefix==="border:"||this.prefix==="b:"?-2:-1}},backgroundAttachment:{match:"^(?:bg|background):(?:fixed|local|scroll|$values)(?!\\|)",native:!0},backgroundBlendMode:{native:!0},backgroundColor:{match:"^(?:bg|background):(?:(?:#|(rgb|hsl)\\(.*\\))((?!\\|).)*$|(?:transparent|currentColor|inherit|$values|$colors))",native:!0,colored:!0,values:{current:"currentColor"}},backgroundClip:{match:"^(?:bg|background):(?:text|$values)(?!\\|)",native:!0,declare(e,t){return{"-webkit-background-clip":e+t,"background-clip":e+t}},values:v},backgroundOrigin:{match:"^(?:bg|background):(?:$values)(?!\\|)",native:!0,values:v},backgroundPosition:{match:"^(?:bg|background):(?:top|bottom|right|left|center|$values)(?!\\|)",native:!0,unit:"px"},backgroundRepeat:{match:"^(?:bg|background):(?:space|round|repeat|no-repeat|repeat-x|repeat-y|$values)(?![|a-zA-Z])",native:!0},backgroundSize:{match:"^(?:bg|background):(?:\\.?\\[0-9]+|auto|cover|contain|$values)(?!\\|)",unit:"rem",native:!0},backgroundImage:{match:"^(?:bg|background):(?:(?:url|linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient|conic-gradient)\\(.*\\)|$values)(?!\\|)",native:!0,colored:!0,values:{current:"currentColor"}},background:{match:"^bg:.",native:!0,colored:!0,values:{current:"currentColor"},order:-1},mixBlendMode:{match:"^blend:.",native:!0},backdropFilter:{match:"^bd:.",native:!0,colored:!0,values:{current:"currentColor"},declare(e,t){return{"backdrop-filter":e+t,"-webkit-backdrop-filter":e+t}}},filter:{match:"^(?:blur|brightness|contrast|drop-shadow|grayscale|hue-rotate|invert|opacity|saturate|sepia)\\(",native:!0,colored:!0,values:{current:"currentColor"}},fill:{match:"^fill:(?:(?:#|(rgb|hsl)\\(.*\\))((?!\\|).)*$|(?:transparent|currentColor|inherit|$values|$colors))",native:!0,colored:!0,values:{current:"currentColor"}},strokeDasharray:{native:!0},strokeDashoffset:{native:!0},strokeWidth:{match:"^stroke:(?:\\.?[0-9]|(?:max|min|calc|clamp)\\(.*\\)|$values)[^|]*$",native:!0},stroke:{native:!0,colored:!0,values:{current:"currentColor"}},x:{native:!0},y:{native:!0},cx:{native:!0},cy:{native:!0},rx:{native:!0},ry:{native:!0},gridColumnStart:{match:"^grid-col-start:.",native:!0},gridColumnEnd:{match:"^grid-col-end:.",native:!0},gridColumn:{match:"^grid-col(?:umn)?(?:-span)?:.",native:!0,order:-1,transform(e){return this.prefix.slice(-5,-1)==="span"&&e!=="auto"?"span "+e+"/span "+e:e}},gridColumns:{match:"^grid-cols:.",declare(e,t){return{display:"grid","grid-template-columns":"repeat("+e+t+",minmax(0,1fr))"}}},gridRowStart:{native:!0},gridRowEnd:{native:!0},gridRow:{match:"^grid-row-span:.",native:!0,order:-1,transform(e){return this.prefix.slice(-5,-1)==="span"&&e!=="auto"?"span "+e+"/span "+e:e}},gridRows:{declare(e,t){return{display:"grid","grid-auto-flow":"column","grid-template-rows":"repeat("+e+t+",minmax(0,1fr))"}}},gridAutoColumns:{match:"^grid-auto-cols:.",native:!0,values:p},gridAutoFlow:{match:"^grid-flow:.",native:!0},gridAutoRows:{values:p,native:!0},gridTemplateAreas:{native:!0},gridTemplateColumns:{match:"^grid-template-cols:.",native:!0,values:p},gridTemplateRows:{native:!0,values:p},gridTemplate:{native:!0,order:-1},gridArea:{native:!0,order:-1},grid:{native:!0,order:-1},gap:{match:"^gap(?:-x|-y)?:.",unit:"rem",order:-1,declare(e,t){switch(this.prefix[4]){case"x":return{"column-gap":e+t};case"y":return{"row-gap":e+t};default:return{gap:e+t}}}},order:{match:"^o:.",native:!0,values:{first:-999999,last:999999}},breakInside:{native:!0},breakBefore:{native:!0},breakAfter:{native:!0},boxDecorationBreak:{match:"^box:(?:slice|clone|$values)(?!\\|)",native:!0,declare(e,t){return{"box-decoration-break":e+t,"-webkit-box-decoration-break":e+t}}},aspectRatio:{match:"^aspect:.",native:!0},columnSpan:{match:"^col-span:.",native:!0},alignContent:{match:"^ac:.",native:!0},alignItems:{match:"^ai:.",native:!0},alignSelf:{match:"^as:",native:!0},justifyContent:{match:"^jc:.",native:!0},justifyItems:{match:"^ji:.",native:!0},justifySelf:{match:"^js:.",native:!0},placeContent:{native:!0,order:-1},placeItems:{native:!0,order:-1},placeSelf:{native:!0,order:-1},listStylePosition:{match:"^list-style:(?:inside|outside|$values)(?!\\|)",native:!0},listStyleType:{match:"^list-style:(?:disc|decimal|$values)(?!\\|)",native:!0},listStyleImage:{match:"^list-style:(?:(?:url|linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient|conic-gradient)\\(.*\\)|$values)(?!\\|)",native:!0},listStyle:{native:!0,order:-1},outlineColor:{match:"^outline:(?:(?:#|(rgb|hsl)\\(.*\\))((?!\\|).)*$|(?:transparent|currentColor|inherit|$values|$colors))",native:!0,colored:!0,values:{current:"currentColor"}},outlineOffset:{unit:"rem",native:!0},outlineStyle:{match:"^outline:(?:none|dotted|dashed|solid|double|groove|ridge|inset|outset|$values)(?!\\|)",native:!0},outlineWidth:{match:"^outline:(?:\\.?[0-9]|medium|thick|thin|(max|min|calc|clamp)\\(.*\\)|$values)[^|]*$",unit:"rem",native:!0},outline:{native:!0,unit:"rem",order:-1,colored:!0,values:{current:"currentColor"}},accentColor:{match:"^accent:(?:(?:#|(rgb|hsl)\\(.*\\))((?!\\|).)*$|(?:transparent|currentColor|inherit|$values|$colors))",native:!0,colored:!0,values:{current:"currentColor"}},appearance:{native:!0},caretColor:{match:"^caret:(?:(?:#|(rgb|hsl)\\(.*\\))((?!\\|).)*$|(?:transparent|currentColor|inherit|$values|$colors))",native:!0,colored:!0,values:{current:"currentColor"}},scrollBehavior:{native:!0},scrollMargin:{match:"^scroll-m(?:[xytblr]|argin(?:-(?:top|bottom|left|right))?)?:.",unit:"rem",declare(e,t){if(this.prefix.slice(-3,-2)==="m")switch(this.prefix.slice(-2,-1)){case"x":return{"scroll-margin-left":e+t,"scroll-margin-right":e+t};case"y":return{"scroll-margin-top":e+t,"scroll-margin-bottom":e+t};case"l":return{"scroll-margin-left":e+t};case"r":return{"scroll-margin-right":e+t};case"t":return{"scroll-margin-top":e+t};case"b":return{"scroll-margin-bottom":e+t}}else return{[this.prefix.replace(/-m(?!argin)/,"-margin").slice(0,-1)]:e+t}},get order(){return this.prefix==="scroll-margin:"||this.prefix==="scroll-m:"?-1:0}},scrollPadding:{match:"^scroll-p(?:[xytblr]|adding(?:-(?:top|bottom|left|right))?)?:.",unit:"rem",declare(e,t){if(this.prefix.slice(-3,-2)==="p")switch(this.prefix.slice(-2,-1)){case"x":return{"scroll-padding-left":e+t,"scroll-padding-right":e+t};case"y":return{"scroll-padding-top":e+t,"scroll-padding-bottom":e+t};case"l":return{"scroll-padding-left":e+t};case"r":return{"scroll-padding-right":e+t};case"t":return{"scroll-padding-top":e+t};case"b":return{"scroll-padding-bottom":e+t}}else return{[this.prefix.replace(/-p(?!adding)/,"-padding").slice(0,-1)]:e+t}},get order(){return this.prefix==="scroll-padding:"||this.prefix==="scroll-p:"?-1:0}},scrollSnapAlign:{match:"^scroll-snap:(?:start|end|center|$values)",native:!0},scrollSnapStop:{match:"^scroll-snap:(?:normal|always|$values)(?!\\|)",native:!0},scrollSnapType:{match:"^scroll-snap:(?:(?:[xy]|block|inline|both)(?:\\|(?:proximity|mandatory))?|$values)(?!\\|)",native:!0},willChange:{native:!0},writingMode:{match:"^writing:.",native:!0},direction:{native:!0},shapeOutside:{match:"^shape:(?:(?:inset|circle|ellipse|polygon|url|linear-gradient)\\(.*\\)|$values)(?!\\|)",native:!0,values:{...v,margin:"margin-box"}},shapeMargin:{match:"^shape:(?:\\.?[0-9]|(?:max|min|calc|clamp)\\(.*\\)|$values)[^|]*$",unit:"rem",native:!0},shapeImageThreshold:{native:!0},clipPath:{match:"^clip:.",native:!0,values:{...v,margin:"margin-box",fill:"fill-box",stroke:"stroke-box",view:"view-box"}},quotes:{native:!0},maskImage:{native:!0,declare(e,t){return{"mask-image":e+t,"-webkit-mask-image":e+t}}}};function x(e){if(this.prefix.includes("-"))return{[this.prefix.slice(0,-1)]:e};let r=this.prefix[0]==="m"?"margin":"padding",l=r+"-left",s=r+"-right",n=r+"-top",u=r+"-bottom";switch(this.prefix[1]){case"x":return{[l]:e,[s]:e};case"y":return{[n]:e,[u]:e};case"l":return{[l]:e};case"r":return{[s]:e};case"t":return{[n]:e};case"b":return{[u]:e};default:return{[r]:e}}}function b(e,t,r=""){let l="border-";r&&(r="-"+r);let s=/^b(order)?-?(.)?/.exec(e)[2],n=l+"left"+r,u=l+"right"+r,d=l+"top"+r,m=l+"bottom"+r;switch(s){case"x":return{[n]:t,[u]:t};case"y":return{[d]:t,[m]:t};case"l":return{[n]:t};case"r":return{[u]:t};case"t":return{[d]:t};case"b":return{[m]:t};default:return{["border"+r]:t}}}export{T as rules};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{breakpoints as n}from"../config/breakpoints.mjs";var o={full:"100%",fit:"fit-content",max:"max-content",min:"min-content"};for(let t in n)o[t]=n[t]/16+"rem";export{o as SIZING_VALUES};
|
package/dist/esm/css.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var V=Object.defineProperty;var D=(C,e,t)=>e in C?V(C,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):C[e]=t;var T=(C,e,t)=>(D(C,typeof e!="symbol"?e+"":e,t),t);function N(C){let e=typeof Buffer<"u"?Buffer:null;return!!(e&&C instanceof e||C instanceof Date||C instanceof RegExp)}function L(C){if(typeof Buffer<"u"&&Buffer&&C instanceof Buffer){let e=Buffer.alloc(C.length);return C.copy(e),e}else{if(C instanceof Date)return new Date(C.getTime());if(C instanceof RegExp)return new RegExp(C);throw new Error("Unexpected situation")}}function I(C){let e=[];return C.forEach(function(t,s){typeof t=="object"&&t!==null?Array.isArray(t)?e[s]=I(t):N(t)?e[s]=L(t):e[s]=j({},t):e[s]=t}),e}function F(C,e){return e==="__proto__"?void 0:C[e]}function j(...C){let e={},t,s;return C.forEach(function(u){typeof u!="object"||u===null||Array.isArray(u)||Object.keys(u).forEach(function(b){if(s=F(e,b),t=F(u,b),t!==e)if(typeof t!="object"||t===null){e[b]=t;return}else if(Array.isArray(t)){e[b]=I(t);return}else if(N(t)){e[b]=L(t);return}else if(typeof s!="object"||s===null||Array.isArray(s)){e[b]=j({},t);return}else{e[b]=j(s,t);return}})}),e}import{Rule as Q}from"./rule.mjs";import{config as S}from"./config/index.mjs";import{rgbToHex as z}from"./utils/rgb-to-hex.mjs";import{SELECTOR_SYMBOLS as H}from"./constants/selector-symbols.mjs";var O=typeof window<"u",A=class{constructor(e){this.config=e;this.config?.override||(this.config=j(S,e)),this.cache(),O&&this.config.observe&&this.observe(document),A.instances.push(this)}rules=[];ruleBy={};countBy={};e=O?new MutationObserver(e=>{let t={},s=[],u=[],b=[],M=(l,i)=>{i?l.classList.forEach(x):l.classList.forEach(y);let c=l.children;for(let m=0;m<c.length;m++){let d=c[m];d.classList&&(u.push(d),M(d,i))}},y=l=>{l in t?t[l]++:t[l]=1},x=l=>{l in t?t[l]--:l in this.countBy&&(t[l]=-1)},B=(l,i)=>{for(let c=0;c<l.length;c++){let m=l[c];m.classList&&!u.includes(m)&&!b.includes(m)&&(m.isConnected!==i?(u.push(m),M(m,i)):b.push(m))}};for(let l=0;l<e.length;l++){let i=e[l],{addedNodes:c,removedNodes:m,type:d,target:h}=i;if(d==="attributes"){if(s.find(v=>v.target===h))continue;s.push(i)}else B(c,!1),(!h.isConnected||!u.includes(h))&&B(m,!0)}if(!(!s.length&&!Object.keys(t).length)){for(let{oldValue:l,target:i}of s){let c=u.includes(i),m=i.classList,d=l?l.split(" "):[];if(c){if(i.isConnected)continue;for(let h of d)m.contains(h)||x(h)}else if(i.isConnected){m.forEach(h=>{d.includes(h)||y(h)});for(let h of d)m.contains(h)||x(h)}}for(let l in t){let i=t[l],c=(this.countBy[l]||0)+i;c===0?(delete this.countBy[l],this.delete(l)):(l in this.countBy||this.insert(l),this.countBy[l]=c)}}}):null;cache(){this.semantics=[],this.classes={},this.colorThemesMap={},this.themeAffectedClassesBy={},this.classesBy={},this.colorNames=[],this.themeNames=[""],this.selectors={},this.values={},this.globalValues={},this.breakpoints={},this.mediaQueries={},this.matches={};let{semantics:e,classes:t,selectors:s,themes:u,colors:b,values:M,breakpoints:y,mediaQueries:x,rules:B}=this.config;function l(r){return r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function i(r,o,n="",f={}){let a=R=>R?(n?n+"-":"")+R:n,g=Object.entries(r),p=[],E=[];for(let R of g){let W=R[1];(typeof W=="object"&&!Array.isArray(W)?p:E).push(R)}for(let[R,W]of p)i(W,o,a(R),f);if(o&&n)E.length&&(f[n]=E.reduce((R,[W,$])=>(R[W]=$,R),{}));else for(let[R,W]of E)f[a(R)]=W;return f}if(e)for(let[r,o]of Object.entries(i(e,!0)))this.semantics.push([new RegExp("^"+l(r)+"(?=!|\\*|>|\\+|~|:|\\[|@|_|\\.|$)","m"),[r,o]]);if(s)for(let[r,o]of Object.entries(i(s,!1))){let n=new RegExp(l(r)+"(?![a-z-])");for(let f of Array.isArray(o)?o:[o]){let a=f.match(/^::-[a-z]+-/m)?.[0]??"",g=this.selectors[a];g||(g=this.selectors[a]=[]);let p=g.find(([E])=>E===n);p||(p=[n,[]],g.push(p)),p[1].push(f)}}M&&(this.globalValues=i(M,!1)),y&&(this.breakpoints=i(y,!1)),x&&(this.mediaQueries=i(x,!1));let c=t?i(t,!1):{},m=u&&!Array.isArray(u)?Object.entries(u).filter(([,{classes:r}])=>r).reduce((r,[o,{classes:n}])=>(r[o]=i(n,!1),r),{}):{},d=[...Object.keys(c),...Object.entries(m).flatMap(([r,o])=>Object.keys(o))],h=r=>{if(r in this.classes)return;let o=this.classes[r]=[],n=(f,a)=>{if(!a)return;let g=Array.isArray(a)?a:a.replace(/(?:\n(?:\s*))+/g," ").trim().split(" ");for(let p of g){let E=R=>{R in this.themeAffectedClassesBy?f in this.themeAffectedClassesBy[R]?this.themeAffectedClassesBy[R][f].push(r):this.themeAffectedClassesBy[R][f]=[r]:this.themeAffectedClassesBy[R]={[f]:[r]},o.includes(R)||o.push(R)};if(d.includes(p)){h(p);for(let R of this.classes[p])E(R)}else E(p)}};n("",c?.[r]);for(let[f,a]of Object.entries(m))n(f,a?.[r])};for(let r of d)h(r);for(let r in this.themeAffectedClassesBy){let o=this.classesBy[r]=[];for(let n of Object.values(this.themeAffectedClassesBy[r]))for(let f of n)o.includes(f)||o.push(f)}let v=(r,o)=>{if(!o)return;let n=i(o,!0);for(let[f,a]of Object.entries(n)){let g=typeof a=="string"?{"":a}:a;for(let[p,E]of Object.entries(g)){let R=f+(p?"-"+p:"");R in this.colorThemesMap?this.colorThemesMap[R][r]=E:this.colorThemesMap[R]={[r]:E}}}for(let f in o)this.colorNames.includes(f)||this.colorNames.push(f)};if(v("",b),u)if(Array.isArray(u))this.themeNames.push(...u);else for(let r in u){let o=u[r];v(r,o.colors),this.themeNames.push(r)}let w=r=>{for(let[o,n]of Object.entries(this.colorThemesMap))for(let[f,a]of Object.entries(n))a.startsWith("#")||r(o,n,f,a)};if(w((r,o,n,f)=>{let a=/^rgba?\( *([0-9]{1,3}) *(?: |,) *([0-9]{1,3}) *(?: |,) *([0-9]{1,3}) *(?:(?:\/|,) *0?(\.[0-9]))?\)$/.exec(f);if(a){let g="#"+z(+a[1],+a[2],+a[3]);a[4]&&(g+=Math.round(255*+a[4]).toString(16)),o[n]=g}}),w((r,o,n,f)=>{let[a,g]=f.split("/"),p=this.colorThemesMap[a];if(p){let E=(n?p[n]:void 0)??p[""];o[n]=g?E.slice(0,7)+Math.round(255*+g).toString(16):E}else console.warn(`\`${f}\` doesn't exist in the extended config \`.colors\``),delete o[n],Object.keys(o).length||delete this.colorThemesMap[r]}),B)for(let r in B){let o=B[r],{native:n,values:f,colored:a}=o,g=o.match;if(o.id=r,o.native=n===!0?r.replace(/(?!^)[A-Z]/g,p=>"-"+p).toLowerCase():void 0,f&&(this.values[r]=i(f,!1)),g){let p=Object.keys(this.values[r]??{});g.includes("$values")&&(g=p.length?g.replace(/\$values/,p.join("|")):g.replace(/(?:\|)?\$values/,"")),a&&g.includes("$colors")&&(g=this.colorNames.length?g.replace(/\$colors/,"(?:"+this.colorNames.join("|")+")(?![0-9A-Za-z])"):g.replace(/(?:\|)?\$colors/,"")),this.matches[r]=new RegExp(g)}}}observe(e,t={subtree:!0,childList:!0}){if(O&&e){this.root=e;let s=e===document;s&&(A.root=this),this.host=s?document.documentElement:root.host;let u=s?document.head:e,b=s?document.styleSheets:e.styleSheets;for(let y of b){let{title:x,href:B,ownerNode:l}=y;(x==="master"||B&&B.startsWith(window.location.origin)&&/master(?:\..+)?\.css/.test(B))&&(this.style=l)}if(this.style)for(let y=0;y<this.style.sheet.cssRules.length;y++){let x=l=>{if(l.selectorText){let c=l.selectorText.split(", ")[0].split(" ");for(let m=0;m<c.length;m++){let d=c[m];if(d[0]==="."){let h=d.slice(1),v="";for(let w=0;w<h.length;w++){let r=h[w],o=h[w+1];if(r==="\\"){if(w++,o!=="\\"){v+=o;continue}}else if(H.includes(r))break;v+=r}if(!(v in this.ruleBy)&&!(v in this.classes)){let w=this.create(v)[0];if(w)return w}}}}else if(l.cssRules)for(let i=0;i<l.cssRules.length;i++){let c=x(l.cssRules[i]);if(c)return c}},B=x(this.style.sheet.cssRules[y]);if(B){this.rules.push(B),this.ruleBy[B.className]=B;for(let l=0;l<B.natives.length;l++)B.natives[l].cssRule=this.style.sheet.cssRules[y+l];y+=B.natives.length-1}}else{this.style=document.createElement("style"),this.style.title="master";let y=u.querySelector('link[rel="styleSheet"], style');y?y.before(this.style):u.append(this.style)}let M=y=>{y.forEach(x=>{x in this.countBy?this.countBy[x]++:(this.countBy[x]=1,this.insert(x))})};M(this.host.classList),t.subtree&&this.host.querySelectorAll("[class]").forEach(y=>M(y.classList)),this.e.observe(e,{...t,attributes:!0,attributeOldValue:!0,attributeFilter:["class"]})}return this}disconnect(){this.e.disconnect(),this.ruleBy={},this.countBy={},this.rules.length=0;let e=this.style.sheet;if(e)for(let t=e.cssRules.length-1;t>=0;t--)e.deleteRule(t);this.style.remove(),this.style=null}match(e){for(let t in this.config.rules){let s=this.config.rules[t],u=this.matches[t],{symbol:b,native:M}=s;if(u&&u.test(e))return{origin:"match",config:s};if(b&&e.startsWith(b))return{origin:"symbol",config:s};if(M&&e.startsWith(M+":"))return{origin:"match",config:s}}for(let t of this.semantics)if(e.match(t[0]))return{origin:"semantics",value:t[1]}}create(e){let t=s=>{if(s in this.ruleBy)return this.ruleBy[s];let u=this.match(s);if(u)return new Q(s,u,this)};return(e in this.classes?this.classes[e].map(s=>t(s)):[t(e)]).filter(s=>s&&s.text)}refresh(e){if(e?.override?this.config=e:this.config=j(S,e),this.cache(),!this.style)return;let t=document.createElement("style");t.title="master",this.style.replaceWith(t),this.style=t,this.rules.length=0,this.ruleBy={};for(let s in this.countBy)this.insert(s)}destroy(){let e=A.instances;this.disconnect(),e.splice(e.indexOf(this),1)}delete(e){let t=this.style.sheet,s=u=>{let b=this.ruleBy[u];if(!(!b||u in this.classesBy&&this.classesBy[u].some(M=>M in this.countBy))){if(b.natives.length){let M=b.natives[0];for(let y=0;y<t.cssRules.length;y++)if(t.cssRules[y]===M.cssRule){for(let B=0;B<b.natives.length;B++)t.deleteRule(y);this.rules.splice(this.rules.indexOf(b),1);break}}delete this.ruleBy[u],b.config.delete&&b.config.delete.call(this,u)}};if(e in this.classes){for(let u of this.classes[e])u in this.countBy||s(u);delete this.ruleBy[e]}else s(e)}insert(e){let t=this.create(e);return t.length?(this.insertRules(t),!0):!1}insertRules(e){for(let t of e){if(this.ruleBy[t.className])continue;let s,u=this.rules.length-1,{media:b,order:M,priority:y,hasWhere:x,className:B}=t,l=(i,c,m,d)=>{let h=0,v;c&&(h=i.findIndex(c)),m&&(v=i.findIndex(m)),h===-1&&(h=i.length),(v===void 0||v===-1)&&(v=i.length);let w=i.slice(h,v);for(let r=0;r<w.length;r++){let o=w[r];if(!(o.priority===-1||d&&d(o))&&(o.priority<y||o.priority===y&&(x&&!o.hasWhere||o.order>=M)))return h+r}return h+w.length};if(b){let i=this.rules.findIndex(c=>c.media);if(i!==-1){let c=b.features["max-width"],m=b.features["min-width"];if(c&&m){let d=c.value-m.value;for(let h=u;h>=i;h--){s=h;let v=this.rules[h],w=v.media,r=w.features["max-width"],o=w.features["min-width"];if(!r||!o){s++;break}let n=r.value-o.value;if(n===d){if(x!==v.hasWhere)continue;if(y!==-1){let f=[this.rules[h]];for(let a=h-1;a>=i;a--){let g=this.rules[a];if(g.hasWhere!==x)break;let p=g.media,E=p.features["max-width"],R=p.features["min-width"];if(!E||!R||E.value-R.value!==n)break;f.unshift(this.rules[a])}s=l(this.rules,a=>a.media&&a.priority!==-1&&a.media.features["min-width"]&&a.media.features["max-width"])}break}else if(n>d)break}}else if(m)for(let d=i;d<=u;d++){s=d;let h=this.rules[d],v=h.media,w=v.features["max-width"],r=v.features["min-width"];if(w){if(r)break;continue}let o=r?.value;if(o===m.value){if(!x&&h.hasWhere){s++;continue}if(y!==-1)s=l(this.rules,n=>n.media,n=>n.media&&n.priority!==-1&&n.media.features["min-width"]&&n.media.features["max-width"],n=>!n.media.features["min-width"]&&!n.media.features["max-width"]);else for(let n=d;n<=u;n++){let f=this.rules[n],a=f.media,g=a.features["min-width"];if(!a.features["max-width"]){if(f.hasWhere!==x||g.value!==o||f.order>=M)break;s=n+1}}break}else{if(o>m.value)break;s++}}else if(c)for(let d=u;d>=i;d--){s=d;let h=this.rules[d],v=h.media,w=v.features["max-width"];if(v.features["min-width"])continue;let o=w?.value;if(!o||o>c.value){s++;break}else if(o===c.value){if(x&&!h.hasWhere)continue;if(y!==-1)s=l(this.rules,n=>n.media,n=>n.media&&n.priority!==-1&&n.media.features["min-width"]&&n.media.features["max-width"],n=>!n.media.features["min-width"]&&!n.media.features["max-width"]);else{let n=[this.rules[d]];for(let f=d-1;f>=i;f--){let a=this.rules[f],g=a.media,p=g.features["min-width"],E=g.features["max-width"];if(!p&&(!E||E.value!==o||a.hasWhere!==x))break;n.unshift(a)}for(let f=0;f<n.length;f++){let a=n[f];if(!a.media.features["min-width"]){if(a.order>=M)break;s=d-n.length+2+f}}}break}}}if(s===void 0)if(i===-1)s=u+1;else if(y!==-1)s=i+l(this.rules.slice(i),void 0,c=>c.media.features["max-width"]||c.media.features["min-width"]);else if(x){let c=i;for(;c<this.rules.length;c++){let m=this.rules[c];if(m.priority!==-1||!m.hasWhere||m.order>=M){s=c;break}}s===void 0&&(s=c)}else for(let c=i;c<=u;c++){s=c;let m=this.rules[c],d=m.media;if(m.priority!==-1||d.features["max-width"]||d.features["min-width"])break;if(m.hasWhere)s++;else if(m.order>=M)break}}else if(y===-1)if(x)s=this.rules.findIndex(i=>!i.hasWhere||i.media||i.priority!==-1||i.order>=M),s===-1&&(s=u+1);else{let i=0;for(;i<this.rules.length;i++){let c=this.rules[i];if(c.media||!c.hasWhere&&(c.order>=M||c.priority!==-1)){s=i;break}}s===void 0&&(s=i)}else s=l(this.rules,void 0,i=>i.media);if(this.rules.splice(s,0,t),this.ruleBy[B]=t,this.style){let i=this.style.sheet,c=0,m=d=>{let h=this.rules[d];if(h){if(!h.natives.length)return m(d-1);let v=h.natives[h.natives.length-1].cssRule;for(let w=0;w<i.cssRules.length;w++)if(i.cssRules[w]===v){c=w+1;break}}};m(s-1);for(let d=0;d<t.natives.length;)try{let h=t.natives[d];i.insertRule(h.text,c),h.cssRule=i.cssRules[c++],d++}catch(h){console.error(h),t.natives.splice(d,1)}}}}get text(){return this.rules.map(e=>e.text).join("")}},k=A;T(k,"root"),T(k,"config",S),T(k,"instances",[]),T(k,"refresh",e=>{for(let t of A.instances)t.refresh(e)});O&&(window.MasterCSS=k);export{k as MasterCSS};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MasterCSS as e}from"./css.mjs";import{Theme as a}from"./theme.mjs";new e(window.masterCSSConfig);new a(window.masterCSSThemeSettings);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./css.mjs";export*from"./rule.mjs";export*from"./theme.mjs";import{MasterCSS as E}from"./css.mjs";function a(t){let e=typeof Buffer<"u"?Buffer:null;return!!(e&&t instanceof e||t instanceof Date||t instanceof RegExp)}function l(t){if(typeof Buffer<"u"&&Buffer&&t instanceof Buffer){let e=Buffer.alloc(t.length);return t.copy(e),e}else{if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t);throw new Error("Unexpected situation")}}function c(t){let e=[];return t.forEach(function(r,n){typeof r=="object"&&r!==null?Array.isArray(r)?e[n]=c(r):a(r)?e[n]=l(r):e[n]=u({},r):e[n]=r}),e}function i(t,e){return e==="__proto__"?void 0:t[e]}function u(...t){let e={},r,n;return t.forEach(function(o){typeof o!="object"||o===null||Array.isArray(o)||Object.keys(o).forEach(function(f){if(n=i(e,f),r=i(o,f),r!==e)if(typeof r!="object"||r===null){e[f]=r;return}else if(Array.isArray(r)){e[f]=c(r);return}else if(a(r)){e[f]=l(r);return}else if(typeof n!="object"||n===null||Array.isArray(n)){e[f]=u({},r);return}else{e[f]=u(n,r);return}})}),e}export*from"./methods/index.mjs";export*from"./config/index.mjs";export{E as default,u as extend};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{hexToRgb as s}from"../utils/hex-to-rgb.mjs";import{rgbToHex as L}from"../utils/rgb-to-hex.mjs";function x(e){typeof e=="string"&&(e={"":e});let h=""in e,t=!1;for(let o in e)if(o&&+o>=100){t=!0;break}if(!t&&(!h||Object.keys(e).length>1)){let o=0,i="0"in e?s(e[0]):[0,0,0],c,r,l=[],b=()=>{let n=c-o,v=r.map((f,g)=>(f-i[g])/n);for(let f of l){let g=f-o,p=i.map((m,u)=>Math.round(m+v[u]*g));e[f]="#"+L.call(this,...p)}};for(let n=1;n<100;n++)n in e?(l.length?(c=n,r=s(e[n]),b(),l.length=0,i=r):i=s(e[n]),o=n):l.push(n);l.length&&(c=100,r="100"in e?s(e[100]):[255,255,255],b())}return h||(e[""]=e[t?"500":"50"]),e}export{x as fillColorScale};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./render.mjs";export*from"./render-from-html.mjs";export*from"./render-into-html.mjs";export*from"./fill-color-scale.mjs";export*from"./define-content.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MasterCSS as c}from"../css.mjs";function a(r,n){if(!r)return;let s=new c({...n,observe:!1}),o=/\sclass="([^"]*)"/gm,t;for(;t=o.exec(r);){let i=t[1].replace(/\n/g,"").split(" ").filter(e=>e);for(let e of i)e in s.countBy||(s.insert(e),s.countBy[e]=1)}return s.text}export{a as renderFromHTML};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{renderFromHTML as t}from"./render-from-html.mjs";function i(e,r){if(e)return e.replace(/(<link[^>]*?rel="styleSheet".*?>|<style.*?>|<\/head>)/,`<style title="master">${t(e,r)}</style>$1`)}export{i as renderIntoHTML};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MasterCSS as o}from"../css.mjs";function f(r,e){if(!r?.length)return;let n=new o({...e,observe:!1});for(let t of r)t in n.countBy||n.insert(t)&&(n.countBy[t]=1);return n.text}export{f as render};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{SORTED_SELECTORS as re}from"./constants/sorted-selectors.mjs";import{START_SYMBOL as oe}from"./constants/start-symbol.mjs";import{cssEscape as ue}from"./utils/css-escape.mjs";function ie(y){let n=typeof Buffer<"u"?Buffer:null;return!!(n&&y instanceof n||y instanceof Date||y instanceof RegExp)}function ne(y){if(typeof Buffer<"u"&&Buffer&&y instanceof Buffer){let n=Buffer.alloc(y.length);return y.copy(n),n}else{if(y instanceof Date)return new Date(y.getTime());if(y instanceof RegExp)return new RegExp(y);throw new Error("Unexpected situation")}}function se(y){let n=[];return y.forEach(function(l,S){typeof l=="object"&&l!==null?Array.isArray(l)?n[S]=se(l):ie(l)?n[S]=ne(l):n[S]=A({},l):n[S]=l}),n}function te(y,n){return n==="__proto__"?void 0:y[n]}function A(...y){let n={},l,S;return y.forEach(function(T){typeof T!="object"||T===null||Array.isArray(T)||Object.keys(T).forEach(function(j){if(S=te(n,j),l=te(T,j),l!==n)if(typeof l!="object"||l===null){n[j]=l;return}else if(Array.isArray(l)){n[j]=se(l);return}else if(ie(l)){n[j]=ne(l);return}else if(typeof S!="object"||S===null||Array.isArray(S)){n[j]=A({},l);return}else{n[j]=A(S,l);return}})}),n}var he={unit:"",order:0,separators:[","]},le=class{constructor(n,l={},S){this.className=n;this.meta=l;this.css=S;this.config=A(he,l.config);let{unit:T,order:j,colored:C,native:W,analyze:Q,transform:q,declare:$,create:F}=this.config,{scope:Y,important:fe,functions:ce}=S.config,{themeNames:Z,colorNames:H,colorThemesMap:J,selectors:z,breakpoints:K,mediaQueries:D,themeAffectedClassesBy:ae,globalValues:I}=S,X=ae[n];this.order=j,F&&F.call(this,n);let _,G,P,B,w;if(l.origin==="semantics"){let[h,f]=l.value;B=n.slice(h.length),_=f}else{let h;if(Q)[h,P]=Q.call(this,n);else if(l.origin==="match"){let s=n.indexOf(":");this.prefix=n.slice(0,s+1),this.prefix.includes("(")?(this.prefix=void 0,h=n):h=n.slice(s+1)}else l.origin==="symbol"&&(this.symbol=n[0],h=n.slice(1));w=[];let f=this,a=this.values,p=[","];this.config.separators.length&&p.push(...this.config.separators);let i="",t=0;(function s(e,c,o,r=void 0,u=[],v=[],g){let R=r===void 0,x,M=d=>d==="'"||d==='"',V=()=>x=i.length,O=()=>{if(i){let d=i,m=R?d:i.slice(x);if(i="",k="",a&&m in a&&!u.includes(m)){let b=t;t=0,s(a[m].toString(),c,void 0,r,[...u,m],v,g),t=b,R||(i=i.slice(0,x)+i)}else if(I&&m in I&&!v.includes(m)){let b=t;t=0,s(I[m].toString(),c,void 0,r,u,[...v,m],g),t=b,R||(i=i.slice(0,x)+i)}else if(R){let b=!g&&f.analyzeUnitValue(m,c);w.push({value:b?.value??m,unit:b?.unit})}else{let b=!g&&f.analyzeUnitValue(m,c);i=b?d.slice(0,x)+b.value+b.unit:d}V()}},E=M(o);V();let k="";for(;t<e.length;t++){let d=e[t];if(d===o){if(E){i+=d;let m=0;for(let b=i.length-2;i[b]==="\\";b--)m++;if(m%2)continue}else O(),i+=d;return}else if(!E&&d in oe){let m=d==="("&&k&&ce?.[k];m?.native&&(i=i.slice(0,i.length-k.length)+m.native,k=m.native),i+=d,t++;let b=oe[d];s(e,m?.unit??c,b,k||r||"",u,v,g||!!m?.transform),m?.transform&&(i=i.slice(0,x+k.length+1)+m.transform.call(f,i.slice(x+k.length+1,-1))+i.slice(-1)),R&&(M(b)?(w.push(i),i=""):O()),k=""}else if((d==="|"||d===" ")&&o!=="}"&&(!E||r==="path"))O(),R||(i+=" ",x++);else{if(!E){if(d==="."){if(isNaN(+e[t+1]))break;e[t-1]==="-"&&(i+="0")}else if(p.includes(d)){O(),R?w.push(d):(i+=d,x++);continue}else if(R&&(d==="#"&&(i||w.length&&e[t-1]!=="|"&&w[t-1]!==" ")||["!","*",">","+","~",":","[","@","_"].includes(d)))break;k+=d}i+=d}}r===void 0&&O()})(h,T),B=h.slice(t)}B[0]==="!"&&(this.important=!0,B=B.slice(1));let ee=h=>{let f=h.split(/(\\'(?:.*?)[^\\]\\')(?=[*_>~+,)])|(\[[^=]+='(?:.*?)[^\\]'\])/).map((t,s)=>s%3?t:t.replace(/_/g," ")).join(""),a=[],p="",i=0;for(let t=0;t<f.length;t++){let s=f[t];if(s==="\\"){p+=s+f[++t];continue}!i&&s===","?(a.push(p),p=""):(p+=s,i&&s===")"?i--:s==="("&&i++)}return p&&a.push(p),a};this.prefixSelectors=P?ee(P):[""];let N=B.split("@"),U=N[0];if(U){this.vendorSuffixSelectors={};let h=(t,s,e,c)=>{for(let[o,r]of s)if(o.test(t)){for(let u of r)h(t.replace(o,u),s,e,!0);return}c&&e.push(t)},f=[];""in z?h(U,z[""],f,!0):f.push(U);let a={};for(let[t,s]of Object.entries(z)){if(!t)continue;let e=[];for(let c of f)h(c,s,e,!1);e.length&&(a[t]=e)}let p=(t,s)=>{let e=s.reduce((c,o)=>(c.push(...ee(o)),c),[]);t in this.vendorSuffixSelectors?this.vendorSuffixSelectors[t].push(...e):this.vendorSuffixSelectors[t]=e},i=Object.keys(a);if(i.length)for(let t of i)p(t,a[t]);else p("",f);for(let t of Object.values(this.vendorSuffixSelectors))for(let s of t){this.hasWhere!==!1&&(this.hasWhere=s.includes(":where("));for(let e=0;e<re.length;e++)if(s.includes(re[e])){(this.priority===-1||this.priority>e)&&(this.priority=e);break}}}else this.vendorSuffixSelectors={"":[""]};for(let h=1;h<N.length;h++){let f=N[h];if(f)if(Z.includes(f))this.theme=f;else if(f==="rtl"||f==="ltr")this.direction=f;else{let a,p,i=f.indexOf("_");if(i!==-1)a=f.slice(0,i),p=f.slice(i);else{let t=f.indexOf("(");t!==-1&&(a=f.slice(0,t),p=f.slice(t))}if(!a){a="media";let t=[];this.media={token:f,features:{}};let s=f.split("&");for(let e of s)if(e==="all"||e==="print"||e==="screen"||e==="speech")this.media.type=e;else if(e==="\u{1F5A8}")this.media.type="print";else if(e==="landscape"||e==="portrait")t.push("(orientation:"+e+")");else if(e==="motion"||e==="reduced-motion")t.push("(prefers-reduced-motion:"+(e==="motion"?"no-preference":"reduce")+")");else if(D&&e in D)t.push(D[e]);else{let c={token:e},o="",r="",u=0;e.startsWith("<=")?(r="<=",o="max-width"):e.startsWith(">=")||K[e]?(r=">=",o="min-width"):e.startsWith(">")?(r=">",o="min-width",u=.02):e.startsWith("<")&&(r="<",o="max-width",u=-.02);let v=r?e.replace(r,""):e,g=K[v];switch(o){case"max-width":case"min-width":g?Object.assign(c,this.analyzeUnitValue(g.toString(),"px")):Object.assign(c,this.analyzeUnitValue(v,"px")),c.unit==="px"&&(c.value+=u),this.media.features[o]=c,t.push("("+o+":"+(c.value+c.unit)+")");break}}p="",this.media.type&&(p=this.media.type),t.length&&(p+=(p?" and ":"")+t.join(" and "))}p&&(this.at[a]=(a in this.at?this.at[a]+" and ":"")+p.replace(/_/g," "))}}let L=(h,f)=>{let a,p=(s,e,c)=>{let o="";this.direction&&(o+="[dir="+this.direction+"] ");let r=this.prefixSelectors.map(g=>g+o),u=(g,R)=>r.map(x=>(g?"."+g+" ":"")+(Y?Y+" ":"")+x).reduce((x,M)=>(x.push(c.reduce((V,O)=>(V.push(M+"."+ue(R)+O),V),[]).join(",")),x),[]).join(","),v=u(e,n)+(X?Object.entries(X).filter(([g])=>this.theme||!C||!e||!g||g===e).map(([g,R])=>R.reduce((x,M)=>x+","+u(this.theme??((C||G)&&e||g),M),"")).join(""):"")+"{"+s+"}";for(let g of Object.keys(this.at).sort((R,x)=>x==="supports"?-1:1))v="@"+g+" "+this.at[g]+"{"+v+"}";return v},i=[];if(w){let s=this.theme?[this.theme,""]:[h],e,c;for(let o of w)if(typeof o=="string")i.push(o);else{let r=o.value;if(o.unit)r+=o.unit;else if(C&&J&&H){let u=!1,v=!1;r=r.replace(new RegExp(`(^|,| |\\()((?:${H.join("|")})(?:-(?:[0-9A-Za-z-]+))?)(?:\\/(\\.?[0-9]+%?))?(?=(\\)|\\}|,| |$))`,"gm"),(g,R,x,M)=>{v=!0;let V=J[x];if(V){let O;for(let E of s)if(O=V[E])break;if(O){u=!0;let E=O;if(M){let k=M.endsWith("%")?parseFloat(M)/100:+M;k=isNaN(k)?1:Math.min(Math.max(k,0),1),E+=Math.round(k*255).toString(16).toUpperCase().padStart(2,"0")}return R+E}}return g}),v&&(c=u)}c!==void 0&&!e&&(e=c),i.push(r)}if(f&&(e===void 0?h:!e))return;if(a=i.reduce((o,r,u)=>o+r+(r===","||w[u+1]===","||u===w.length-1?"":" "),""),q&&(a=q.call(this,a,this.css.config)),C&&a==="current"&&(a="currentColor"),$){let o,r;if(w.length===1){let u=w[0];typeof u=="object"&&(o=u.value,r=u.unit)}_=$.call(this,r?o:a,r||"")}else _={[W]:a}}let t={};for(let s in _){let e=(r,u)=>{let v=u+((this.important||fe)&&!u.endsWith("!important")?"!important":"");r in t?t[r].push(v):t[r]=[v]},c=s+":",o=_[s];if(typeof o=="object"){G=!0;for(let r in o)e(r,c+o[r])}else e(h,c+o.toString())}for(let s of Object.values(this.vendorSuffixSelectors))for(let e in t)this.natives.push({text:p(t[e].join(";"),e,s),theme:e})};if(this.theme)L(this.theme,!1);else if(C)for(let h of Z)L(h,!0);else L("",!1)}at={};priority=-1;natives=[];config;get values(){return this.css.values[this.config.id]}get text(){return this.natives.map(n=>n.text).join("")}resolveValue(n,l){return Number.isNaN(+n)?n:n/(l==="rem"||l==="em"?this.css.config.rootSize:1)+l}analyzeUnitValue(n,l){let S=l??this.config.unit;if(S){let T="",j=n.match(/^([+-.]?\d+(\.?\d+)?)(.*)?/);if(j)if(n.includes("/")){let[C,W]=n.split("/");return{value:+C/+W*100+"%",unit:T}}else{let C=+j[1];return T=j[3]||"",T||((S==="rem"||S==="em")&&(C=C/this.css.config.rootSize),T=S||""),{value:C,unit:T}}}}};export{le as Rule};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getType as e}from"./get-type.mjs";function n(t){return e(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}export{n as isPlainObject};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getType as y}from"./get-type.mjs";function r(o){return y(o)==="Symbol"}export{r as isSymbol};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function R(e,c,d,l,M,h){let a="",o="",s;if(typeof e=="number")a=e,o=c||"";else{if(l){let u=!1,f=!1;e=e.replace(new RegExp(`(^|,| |\\()((?:${d.join("|")})(?:-(?:[0-9A-Za-z-]+))?)(?:\\/(\\.?[0-9]+%?))?(?=(\\)|\\}|,| |$))`,"gm"),(m,p,b,t)=>{f=!0;let g=l[b];if(g){let i;for(let r of h)if(i=g[r])break;if(i){u=!0;let r=i;if(t){let n=t.endsWith("%")?parseFloat(t)/100:+t;n=isNaN(n)?1:Math.min(Math.max(n,0),1),r+=Math.round(n*255).toString(16).toUpperCase().padStart(2,"0")}return p+r}}return m}),f&&(s=u)}a=e}return{value:a,unit:o,colorMatched:s}}export{R as parseRuleValue};
|