@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
package/dist/esm/css.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var $=Object.defineProperty;var D=(O,e,t)=>e in O?$(O,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):O[e]=t;var S=(O,e,t)=>(D(O,typeof e!="symbol"?e+"":e,t),t);function N(O){let e=typeof Buffer<"u"?Buffer:null;return!!(e&&O instanceof e||O instanceof Date||O instanceof RegExp)}function I(O){if(typeof Buffer<"u"&&Buffer&&O instanceof Buffer){let e=Buffer.alloc(O.length);return O.copy(e),e}else{if(O instanceof Date)return new Date(O.getTime());if(O instanceof RegExp)return new RegExp(O);throw new Error("Unexpected situation")}}function B(O){let e=[];return O.forEach(function(t,s){typeof t=="object"&&t!==null?Array.isArray(t)?e[s]=B(t):N(t)?e[s]=I(t):e[s]=k({},t):e[s]=t}),e}function L(O,e){return e==="__proto__"?void 0:O[e]}function k(...O){let e={},t,s;return O.forEach(function(d){typeof d!="object"||d===null||Array.isArray(d)||Object.keys(d).forEach(function(x){if(s=L(e,x),t=L(d,x),t!==e)if(typeof t!="object"||t===null){e[x]=t;return}else if(Array.isArray(t)){e[x]=B(t);return}else if(N(t)){e[x]=I(t);return}else if(typeof s!="object"||s===null||Array.isArray(s)){e[x]=k({},t);return}else{e[x]=k(s,t);return}})}),e}import{Rule as Q}from"./rule.js";import{config as F}from"./config/index.js";import{rgbToHex as z}from"./utils/rgb-to-hex.js";import{SELECTOR_SYMBOLS as H}from"./constants/selector-symbols.js";var A=typeof window<"u",j=class{constructor(e){this.config=e;this.config?.override||(this.config=k(F,e)),this.cache(),A&&this.config.observe&&this.observe(document),j.instances.push(this),this.ready=!0}rules=[];ruleOfClass={};countOfClass={};ready=!1;e=A?new MutationObserver(e=>{let t={},s=[],d=[],x=[],w=(c,n)=>{n?c.classList.forEach(y):c.classList.forEach(g);let l=c.children;for(let m=0;m<l.length;m++){let f=l[m];f.classList&&(d.push(f),w(f,n))}},g=c=>{c in t?t[c]++:t[c]=1},y=c=>{c in t?t[c]--:c in this.countOfClass&&(t[c]=-1)},M=(c,n)=>{for(let l=0;l<c.length;l++){let m=c[l];m.classList&&!d.includes(m)&&!x.includes(m)&&(m.isConnected!==n?(d.push(m),w(m,n)):x.push(m))}};for(let c=0;c<e.length;c++){let n=e[c],{addedNodes:l,removedNodes:m,type:f,target:h}=n;if(f==="attributes"){if(s.find(C=>C.target===h))continue;s.push(n)}else M(l,!1),(!h.isConnected||!d.includes(h))&&M(m,!0)}if(!(!s.length&&!Object.keys(t).length)){for(let{oldValue:c,target:n}of s){let l=d.includes(n),m=n.classList,f=c?c.split(" "):[];if(l){if(n.isConnected)continue;for(let h of f)m.contains(h)||y(h)}else if(n.isConnected){m.forEach(h=>{f.includes(h)||g(h)});for(let h of f)m.contains(h)||y(h)}}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:d,colors:x,values:w,breakpoints:g,mediaQueries:y,rules:M}=this.config;function c(r){return r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function n(r,o,i="",u={}){let a=R=>R?(i?i+"-":"")+R:i,b=Object.entries(r),p=[],T=[];for(let R of b){let E=R[1];(typeof E=="object"&&!Array.isArray(E)?p:T).push(R)}for(let[R,E]of p)n(E,o,a(R),u);if(o&&i)T.length&&(u[i]=T.reduce((R,[E,V])=>(R[E]=V,R),{}));else for(let[R,E]of T)u[a(R)]=E;return u}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 u of Array.isArray(o)?o:[o]){let a=u.match(/^::-[a-z]+-/m)?.[0]??"",b=this.selectors[a];b||(b=this.selectors[a]=[]);let p=b.find(([T])=>T===i);p||(p=[i,[]],b.push(p)),p[1].push(u)}}w&&(this.globalValues=n(w,!1)),g&&(this.breakpoints=n(g,!1)),y&&(this.mediaQueries=n(y,!1));let l=t?n(t,!1):{},m=d&&!Array.isArray(d)?Object.entries(d).filter(([,{classes:r}])=>r).reduce((r,[o,{classes:i}])=>(r[o]=n(i,!1),r),{}):{},f=[...Object.keys(l),...Object.entries(m).flatMap(([r,o])=>Object.keys(o))],h=r=>{if(r in this.classes)return;let o=this.classes[r]=[],i=(u,a)=>{if(!a)return;let b=Array.isArray(a)?a:a.replace(/(?:\n(?:\s*))+/g," ").trim().split(" ");for(let p of b){let T=R=>{R in this.relationThemesMap?u in this.relationThemesMap[R]?this.relationThemesMap[R][u].push(r):this.relationThemesMap[R][u]=[r]:this.relationThemesMap[R]={[u]:[r]},o.includes(R)||o.push(R)};if(f.includes(p)){h(p);for(let R of this.classes[p])T(R)}else T(p)}};i("",l?.[r]);for(let[u,a]of Object.entries(m))i(u,a?.[r])};for(let r of f)h(r);for(let r in this.relationThemesMap){let o=this.relations[r]=[];for(let i of Object.values(this.relationThemesMap[r]))for(let u of i)o.includes(u)||o.push(u)}let C=(r,o)=>{if(!o)return;let i=n(o,!0);for(let[u,a]of Object.entries(i)){let b=typeof a=="string"?{"":a}:a;for(let[p,T]of Object.entries(b)){let R=u+(p?"-"+p:"");R in this.colorThemesMap?this.colorThemesMap[R][r]=T:this.colorThemesMap[R]={[r]:T}}}for(let u in o)this.colorNames.includes(u)||this.colorNames.push(u)};if(C("",x),d)if(Array.isArray(d))this.themeNames.push(...d);else for(let r in d){let o=d[r];C(r,o.colors),this.themeNames.push(r)}let v=r=>{for(let[o,i]of Object.entries(this.colorThemesMap))for(let[u,a]of Object.entries(i))a.startsWith("#")||r(o,i,u,a)};if(v((r,o,i,u)=>{let a=/^rgba?\( *([0-9]{1,3}) *(?: |,) *([0-9]{1,3}) *(?: |,) *([0-9]{1,3}) *(?:(?:\/|,) *0?(\.[0-9]))?\)$/.exec(u);if(a){let b="#"+z(+a[1],+a[2],+a[3]);a[4]&&(b+=Math.round(255*+a[4]).toString(16)),o[i]=b}}),v((r,o,i,u)=>{let[a,b]=u.split("/"),p=this.colorThemesMap[a];if(p){let T=(i?p[i]:void 0)??p[""];o[i]=b?T.slice(0,7)+Math.round(255*+b).toString(16):T}else console.warn(`\`${u}\` doesn't exist in the extended config \`.colors\``),delete o[i],Object.keys(o).length||delete this.colorThemesMap[r]}),M)for(let r in M){let o=M[r],{matches:i,prop:u,values:a}=o;if(o.id=r,o.prop=u===!1?"":r.replace(/(?!^)[A-Z]/g,b=>"-"+b).toLowerCase(),a&&(this.values[r]=n(a,!1)),i){let b=Object.keys(this.values[r]??{}),p=i.indexOf("$values");this.matches[r]=new RegExp(p===-1?i:b.length?i.slice(0,p)+b.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(A&&e){this.root=e;let s=e===document;s&&(j.root=this),this.host=s?document.documentElement:root.host;let d=s?document.head:e,x=s?document.styleSheets:e.styleSheets;for(let g of x){let{title:y,href:M,ownerNode:c}=g;(y==="master"||M&&M.startsWith(window.location.origin)&&/master(?:\..+)?\.css/.test(M))&&(this.style=c)}if(this.style)for(let g=0;g<this.style.sheet.cssRules.length;g++){let y=c=>{if(c.selectorText){let l=c.selectorText.split(", ")[0].split(" ");for(let m=0;m<l.length;m++){let f=l[m];if(f[0]==="."){let h=f.slice(1),C="";for(let v=0;v<h.length;v++){let r=h[v],o=h[v+1];if(r==="\\"){if(v++,o!=="\\"){C+=o;continue}}else if(H.includes(r))break;C+=r}if(!(C in this.ruleOfClass)&&!(C in this.classes)){let v=this.create(C)[0];if(v)return v}}}}else if(c.cssRules)for(let n=0;n<c.cssRules.length;n++){let l=y(c.cssRules[n]);if(l)return l}},M=y(this.style.sheet.cssRules[g]);if(M){this.rules.push(M),this.ruleOfClass[M.className]=M;for(let c=0;c<M.natives.length;c++)M.natives[c].cssRule=this.style.sheet.cssRules[g+c];g+=M.natives.length-1}}else{this.style=document.createElement("style"),this.style.title="master";let g=d.querySelector('link[rel="styleSheet"], style');g?g.before(this.style):d.append(this.style)}let w=g=>{g.forEach(y=>{y in this.countOfClass?this.countOfClass[y]++:(this.countOfClass[y]=1,this.insert(y))})};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],d=this.matches[t],{colorStarts:x,symbol:w,prop:g}=s,{colorNames:y,colorThemesMap:M}=this;if(d&&d.test(e))return{origin:"matches",config:s};if(x){if(e.match("^"+x+"(?:(?:#|(rgb|hsl)\\(.*\\))((?!\\|).)*$|(?:transparent|current|inherit))"))return{origin:"matches",config:s};if(y.length&&e.indexOf("|")===-1){let c=e.match("^"+x+"((?:"+y.join("|")+")[0-9a-zA-Z-]*)");if(c&&c[1]in M)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 d=this.match(s);if(d)return new Q(s,d,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,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=d=>{let x=this.ruleOfClass[d];if(!(!x||d in this.relations&&this.relations[d].some(w=>w in this.countOfClass))){if(x.natives.length){let w=x.natives[0];for(let g=0;g<t.cssRules.length;g++)if(t.cssRules[g]===w.cssRule){for(let M=0;M<x.natives.length;M++)t.deleteRule(g);this.rules.splice(this.rules.indexOf(x),1);break}}delete this.ruleOfClass[d]}};if(e in this.classes){for(let d of this.classes[e])d in this.countOfClass||s(d);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,d=this.rules.length-1,{media:x,order:w,priority:g,hasWhere:y,className:M}=t,c=(n,l,m,f)=>{let h=0,C;l&&(h=n.findIndex(l)),m&&(C=n.findIndex(m)),h===-1&&(h=n.length),(C===void 0||C===-1)&&(C=n.length);let v=n.slice(h,C);for(let r=0;r<v.length;r++){let o=v[r];if(!(o.priority===-1||f&&f(o))&&(o.priority<g||o.priority===g&&(y&&!o.hasWhere||o.order>=w)))return h+r}return h+v.length};if(x){let n=this.rules.findIndex(l=>l.media);if(n!==-1){let l=x.features["max-width"],m=x.features["min-width"];if(l&&m){let f=l.value-m.value;for(let h=d;h>=n;h--){s=h;let C=this.rules[h],v=C.media,r=v.features["max-width"],o=v.features["min-width"];if(!r||!o){s++;break}let i=r.value-o.value;if(i===f){if(y!==C.hasWhere)continue;if(g!==-1){let u=[this.rules[h]];for(let a=h-1;a>=n;a--){let b=this.rules[a];if(b.hasWhere!==y)break;let p=b.media,T=p.features["max-width"],R=p.features["min-width"];if(!T||!R||T.value-R.value!==i)break;u.unshift(this.rules[a])}s=c(this.rules,a=>a.media&&a.priority!==-1&&a.media.features["min-width"]&&a.media.features["max-width"])}break}else if(i>f)break}}else if(m)for(let f=n;f<=d;f++){s=f;let h=this.rules[f],C=h.media,v=C.features["max-width"],r=C.features["min-width"];if(v){if(r)break;continue}let o=r?.value;if(o===m.value){if(!y&&h.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=f;i<=d;i++){let u=this.rules[i],a=u.media,b=a.features["min-width"];if(!a.features["max-width"]){if(u.hasWhere!==y||b.value!==o||u.order>=w)break;s=i+1}}break}else{if(o>m.value)break;s++}}else if(l)for(let f=d;f>=n;f--){s=f;let h=this.rules[f],C=h.media,v=C.features["max-width"];if(C.features["min-width"])continue;let o=v?.value;if(!o||o>l.value){s++;break}else if(o===l.value){if(y&&!h.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[f]];for(let u=f-1;u>=n;u--){let a=this.rules[u],b=a.media,p=b.features["min-width"],T=b.features["max-width"];if(!p&&(!T||T.value!==o||a.hasWhere!==y))break;i.unshift(a)}for(let u=0;u<i.length;u++){let a=i[u];if(!a.media.features["min-width"]){if(a.order>=w)break;s=f-i.length+2+u}}}break}}}if(s===void 0)if(n===-1)s=d+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(y){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<=d;l++){s=l;let m=this.rules[l],f=m.media;if(m.priority!==-1||f.features["max-width"]||f.features["min-width"])break;if(m.hasWhere)s++;else if(m.order>=w)break}}else if(g===-1)if(y)s=this.rules.findIndex(n=>!n.hasWhere||n.media||n.priority!==-1||n.order>=w),s===-1&&(s=d+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[M]=t,this.style){let n=this.style.sheet,l=0,m=f=>{let h=this.rules[f];if(h){if(!h.natives.length)return m(f-1);let C=h.natives[h.natives.length-1].cssRule;for(let v=0;v<n.cssRules.length;v++)if(n.cssRules[v]===C){l=v+1;break}}};m(s-1);for(let f=0;f<t.natives.length;)try{let h=t.natives[f];n.insertRule(h.text,l),h.cssRule=n.cssRules[l++],f++}catch(h){console.error(h),t.natives.splice(f,1)}}}}get text(){return this.rules.map(e=>e.text).join("")}},W=j;S(W,"root"),S(W,"config",F),S(W,"instances",[]),S(W,"refresh",e=>{for(let t of j.instances)t.refresh(e)});A&&(window.MasterCSS=W);export{W as MasterCSS};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{MasterCSS as e}from"./css.js";import{Theme as a}from"./theme.js";new e(window.masterCSSConfig);new a(window.masterCSSThemeSettings);
|
package/dist/esm/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export*from"./css.js";export*from"./rule.js";export*from"./theme.js";import{MasterCSS as E}from"./css.js";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.js";export*from"./config/index.js";export{E as default,u as extend};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{hexToRgb as s}from"../utils/hex-to-rgb.js";import{rgbToHex as L}from"../utils/rgb-to-hex.js";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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export*from"./render.js";export*from"./render-from-html.js";export*from"./render-into-html.js";export*from"./fill-color-scale.js";export*from"./define-content.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{MasterCSS as c}from"../css.js";function a(r,n){if(!r)return;let e=new c({...n,observe:!1}),o=/\sclass="([^"]*)"/gm,t;for(;t=o.exec(r);){let i=t[1].replace(/\n/g,"").split(" ").filter(s=>s);for(let s of i)s in e.countOfClass||(e.insert(s),e.countOfClass[s]=1)}return e.text}export{a as renderFromHTML};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{renderFromHTML as t}from"./render-from-html.js";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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{MasterCSS as o}from"../css.js";function i(r,e){if(!r?.length)return;let n=new o({...e,observe:!1});for(let t of r)t in n.countOfClass||n.insert(t)&&(n.countOfClass[t]=1);return n.text}export{i as render};
|
package/dist/esm/rule.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getCssPropertyText as N}from"./utils/get-css-property-text.js";import{analyzeValueToken as ie}from"./utils/analyze-value-token.js";import{parseRuleValue as E}from"./utils/parse-rule-value.js";import{SORTED_SELECTORS as G}from"./constants/sorted-selectors.js";import{cssEscape as se}from"./utils/css-escape.js";var H=class{constructor(y,v,b){this.className=y;this.meta=v;this.css=b;let{id:J,unit:K="rem",order:X=0,colorful:x,prop:Y,analyzeToken:z,getThemeProps:T,parseValue:D,get:F}=v.config||{},{rootSize:Z,scope:P,important:j}=b.config,{themeNames:_,colorNames:$,colorThemesMap:ee,selectors:O,globalValues:Q,breakpoints:q,mediaQueries:M}=b,I=b.values[J],U=b.relationThemesMap[y],h=y;this.order=X;let A,C,m,S;if(v.origin==="semantics"){let[l,r]=v.value;m=h.slice(l.length),A=r}else if(z)[C,S,m]=z.call(this,h,I,Q);else{let l;if(v.origin==="matches"){let r=h.indexOf(":");this.prefix=h.slice(0,r+1),this.prefix.includes("(")?(this.prefix=void 0,l=h):l=h.slice(r+1)}else v.origin==="symbol"&&(this.symbol=h[0],l=h.slice(1));[S,m]=ie(l,I,Q)}m[0]==="!"&&(this.important=!0,m=m.slice(1));let B=l=>{let r=l.split(/(\\'(?:.*?)[^\\]\\')(?=[*_>~+,)])|(\[[^=]+='(?:.*?)[^\\]'\])/).map((t,i)=>i%3?t:t.replace(/_/g," ")).join(""),s=[],o="",u=0;for(let t=0;t<r.length;t++){let i=r[t];if(i==="\\"){o+=i+r[++t];continue}!u&&i===","?(s.push(o),o=""):(o+=i,u&&i===")"?u--:i==="("&&u++)}return o&&s.push(o),s};this.prefixSelectors=C?B(C):[""];let w=m.split("@"),V=w[0];if(V){this.vendorSuffixSelectors={};let l=(t,i,e,n)=>{for(let[a,f]of i)if(a.test(t)){for(let g of f)l(t.replace(a,g),i,e,!0);return}n&&e.push(t)},r=[];""in O?l(V,O[""],r,!0):r.push(V);let s={};for(let[t,i]of Object.entries(O)){if(!t)continue;let e=[];for(let n of r)l(n,i,e,!1);e.length&&(s[t]=e)}let o=(t,i)=>{let e=i.reduce((n,a)=>(n.push(...B(a)),n),[]);t in this.vendorSuffixSelectors?this.vendorSuffixSelectors[t].push(...e):this.vendorSuffixSelectors[t]=e},u=Object.keys(s);if(u.length)for(let t of u)o(t,s[t]);else o("",r);for(let t of Object.values(this.vendorSuffixSelectors))for(let i of t){this.hasWhere!==!1&&(this.hasWhere=i.includes(":where("));for(let e=0;e<G.length;e++)if(i.includes(G[e])){(this.priority===-1||this.priority>e)&&(this.priority=e);break}}}else this.vendorSuffixSelectors={"":[""]};for(let l=1;l<w.length;l++){let r=w[l];if(r)if(_.includes(r))this.theme=r;else if(r==="rtl"||r==="ltr")this.direction=r;else{let s,o,u=r.indexOf("_");if(u!==-1)s=r.slice(0,u),o=r.slice(u);else{let t=r.indexOf("(");t!==-1&&(s=r.slice(0,t),o=r.slice(t))}if(!s){s="media";let t=[];this.media={token:r,features:{}};let i=r.split("&");for(let e of i)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(M&&e in M)t.push(M[e]);else{let n={token:e},a="",f="",g=0;e.startsWith("<=")?(f="<=",a="max-width"):e.startsWith(">=")||q[e]?(f=">=",a="min-width"):e.startsWith(">")?(f=">",a="min-width",g=.02):e.startsWith("<")&&(f="<",a="max-width",g=-.02);let p=f?e.replace(f,""):e,c=q[p];switch(a){case"max-width":case"min-width":c?Object.assign(n,E(c,"px")):Object.assign(n,E(p,"px")),n.unit==="px"&&(n.value+=g),this.media.features[a]=n,t.push("("+a+":"+(n.value+n.unit)+")");break}}o="",this.media.type&&(o=this.media.type),t.length&&(o+=(o?" and ":"")+t.join(" and "))}o&&(this.at[s]=(s in this.at?this.at[s]+" and ":"")+o.replace(/_/g," "))}}let k=(l,r)=>{let s,o,u=(i,e,n)=>{let a="";this.direction&&(a+="[dir="+this.direction+"] ");let f=this.prefixSelectors.map(c=>c+a),g=(c,R)=>f.map(d=>(c?"."+c+" ":"")+(P?P+" ":"")+d).reduce((d,W)=>(d.push(n.reduce((L,te)=>(L.push(W+"."+se(R)+te),L),[]).join(",")),d),[]).join(","),p=g(e,y)+(U?Object.entries(U).filter(([c])=>this.theme||!x||!e||!c||c===e).map(([c,R])=>R.reduce((d,W)=>d+","+g(this.theme??((x||T)&&e||c),W),"")).join(""):"")+"{"+i+"}";for(let c of Object.keys(this.at).sort((R,d)=>d==="supports"?-1:1))p="@"+c+" "+this.at[c]+"{"+p+"}";return p},t=[];if(S){let i,e;for(let n of S)typeof n=="string"?t.push(n):(i=E(n.value,K,x&&$,x&&ee,Z,this.theme?[this.theme,""]:[l]),i.colorMatched!==void 0&&e!==!0&&(e=i.colorMatched),t.push(i.value+i.unit));if(r&&(e===void 0?l:!e))return;if(t.length===1?i?(s=i.value,o=i.unit):s=t[0]:s=t.reduce((n,a,f)=>n+a+(a===","||S[f+1]===","||f===S.length-1?"":" "),""),typeof s!="object"){D&&(s=D.call(this,s,this.css.config)),x&&s==="current"&&(s="currentColor");let n={unit:o,value:s,important:this.important};if(T){let a=T.call(this,n,b);for(let f in a)for(let g of Object.values(this.vendorSuffixSelectors))this.natives.push({unit:o,value:s,text:u(Object.entries(a[f]).map(([p,c])=>N(p,{important:(this.important||j)&&!c.endsWith("!important"),unit:"",value:c})).join(";"),f,g),theme:f});return}else F&&(s=F.call(this,n))}}else s=A;for(let i of Object.values(this.vendorSuffixSelectors))this.natives.push({unit:o,value:s,text:u(typeof s=="object"?Object.entries(s).map(([e,n])=>N(e,{...typeof n=="object"?n:{unit:"",value:n},important:this.important||j})).join(";"):N(Y,{unit:o,value:s,important:this.important||j}),l,i),theme:l})};if(T)k(void 0,!1);else if(this.theme)k(this.theme,!1);else if(x)for(let l of _)k(l,!0);else k("",!1)}at={};priority=-1;natives=[];get text(){return this.natives.map(y=>y.text).join("")}};export{H as Rule};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function l(r,t,n){if(n){let i="",s=r.match(/^([+-.]?\d+(\.?\d+)?)(.*)?/);if(s)if(r.includes("/")){let[e,u]=r.split("/");return{value:+e/+u*100+"%",unit:i}}else{let e=+s[1];return i=s[3]||"",i||((n==="rem"||n==="em")&&(e=e/t),i=n||""),{value:e,unit:i}}}}export{l as analyzeUnitValue};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{START_SYMBOL as a}from"../constants/start-symbol.js";function R(x,h,S,b=[]){let A=[",",...b],f=[],n="",e=0;return function p(r,t,g,l="",o=[],d=[]){let u,c=!1;t&&(t===")"&&n.slice(-1)==="$"?u=n.length-1:(t==="'"||t==='"')&&(c=!0),n+=r[e++]);let m=()=>{let i=n;if(n="",h&&i in h&&!o.includes(i)){let s=e;e=0,p(h[i].toString(),void 0,void 0,void 0,[...o,i],d),e=s}else if(S&&i in S&&!d.includes(i)){let s=e;e=0,p(S[i].toString(),void 0,void 0,void 0,o,[...d,i]),e=s}else f.push({value:i})};for(;e<r.length;e++){let i=r[e];if(i===t){if(n+=i,c){let s=0;for(let y=n.length-2;n[y]==="\\";y--)s++;if(s%2)continue}u!==void 0&&(n=n.slice(0,u)+n.slice(u).replace(/\$\((.*)\)/,"var(--$1)")),g||(c?f.push(n):m(),l="",n="");break}else if(!c&&i in a)p(r,a[i],g===void 0?0:g+1,l,o,d);else if((i==="|"||i===" ")&&t!=="}"&&(!c||l==="path"))t?n+=" ":m();else{if(!t){if(i==="."){if(isNaN(+r[e+1]))break;r[e-1]==="-"&&(n+="0")}else if(A.includes(i)){n&&m(),f.push(i);continue}else if(i==="#"&&(n||f.length&&r[e-1]!=="|"&&f[e-1]!==" ")||["!","*",">","+","~",":","[","@","_"].includes(i))break;l+=i}n+=i}}g===void 0&&n&&m()}(x),[f,x.slice(e)]}export{R as analyzeValueToken};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function B(s,r,t=""){let e="border-";t&&(t="-"+t);let O=/^b(order)?-?(.)?/.exec(s)[2],R=e+"left"+t,n=e+"right"+t,o=e+"top"+t,c=e+"bottom"+t;switch(O){case"x":return{[R]:r,[n]:r};case"y":return{[o]:r,[c]:r};case"l":return{[R]:r};case"r":return{[n]:r};case"t":return{[o]:r};case"b":return{[c]:r};default:return{["border"+t]:r}}}export{B as getBorderProps};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function i(n,t){return(n?n+":":"")+(t.unit?t.value+t.unit:t.value)+(t.important?"!important":"")}export{i as getCssPropertyText};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getType as e}from"./get-type.js";function n(t){return e(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}export{n as isPlainObject};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getType as y}from"./get-type.js";function r(o){return y(o)==="Symbol"}export{r as isSymbol};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{analyzeUnitValue as k}from"./analyze-unit-value.js";function p(a,c,g){let u=t=>t==="+"||t==="-"||t==="*"||t==="/",s="",n,i="",o=!1,l=!1;function r(t,e="",b=""){if(n===2&&!l){let f=k(i,c,g);f&&(i=f.value+f.unit)}s+=i+e+t+b,n=null,l=!1,i=""}for(let t=0;t<a.length;t++){let e=a[t];if(e==="("||e===")")o=e===")",r(e);else if(e===",")r(e,""," ");else{switch(n){case 1:break;case 2:if(u(e)){r(e," "," ");continue}else/[0-9]/.test(e)||(l=!0);break;default:o&&(s+=" "),isNaN(+e)?u(e)||(n=1):n=2;break}n?i+=e:s+=e}}return i&&(s+=i),s}export{p as normalizeCssCalcText};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{analyzeUnitValue as C}from"./analyze-unit-value.js";import{normalizeCssCalcText as R}from"./normalize-css-calc-text.js";function w(e,n,p,s,o,d){let l="",u="",f;if(typeof e=="number")l=e,u=n||"";else{if(s){let g=!1,m=!1;e=e.replace(new RegExp(`(^|,| |\\()((?:${p.join("|")})(?:-(?:[0-9A-Za-z-]+))?)(?:\\/(\\.?[0-9]+%?))?(?=(\\)|\\}|,| |$))`,"gm"),(b,M,x,r)=>{m=!0;let h=s[x];if(h){let i;for(let a of d)if(i=h[a])break;if(i){g=!0;let a=i;if(r){let t=r.endsWith("%")?parseFloat(r)/100:+r;t=isNaN(t)?1:Math.min(Math.max(t,0),1),a+=Math.round(t*255).toString(16).toUpperCase().padStart(2,"0")}return M+a}}return b}),m&&(f=g)}let c=C(e,o,n);if(c)return c;l=(e.indexOf("calc(")===-1?e:R(e,o,n)).replace(/\$\(((\w|-)+)\)/g,"var(--$1)")}return{value:l,unit:u,colorMatched:f}}export{w as parseRuleValue};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function a(r,g,{rootSize:c}){let n="",i=0;return function o(l,u){let e="",s=u?g(u):"",f=()=>{e&&(n+=!s||Number.isNaN(+e)?e:+e/(s==="rem"?c:1)+s,e="")};for(;i<r.length;i++){let t=r[i];if(t===l&&(l!=="'"||r[i+1]===")")){f(),n+=t;break}else t===","||t===" "?(f(),n+=t):!e&&t==="'"?(n+=t,i++,o(t),e=""):e&&t==="("?(n+=e+t,i++,o(")",e),e=""):e+=t}f()}(),n}export{a as parseValueUnit};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|