effcss 1.0.0
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/LICENSE +251 -0
- package/README.md +152 -0
- package/dist/build/define-provider-with-configs.min.js +1 -0
- package/dist/build/define-provider.min.js +1 -0
- package/dist/configs/basic.js +1 -0
- package/dist/configs/ext.js +1 -0
- package/dist/css/dict.js +1 -0
- package/dist/css/functions.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/allConfigs.d.ts +1 -0
- package/dist/types/build/defineProvider.d.ts +1 -0
- package/dist/types/build/defineProviderWithConfigs.d.ts +1 -0
- package/dist/types/defineProvider.d.ts +1 -0
- package/dist/types/defineProviderWithConfigs.d.ts +1 -0
- package/dist/types/src/_provider/constants.d.ts +5 -0
- package/dist/types/src/_provider/manage.d.ts +35 -0
- package/dist/types/src/_provider/process.d.ts +102 -0
- package/dist/types/src/configs/basic/Agent.d.ts +3 -0
- package/dist/types/src/configs/basic/AgentColor.d.ts +3 -0
- package/dist/types/src/configs/basic/Animation.d.ts +3 -0
- package/dist/types/src/configs/basic/Background.d.ts +3 -0
- package/dist/types/src/configs/basic/Border.d.ts +3 -0
- package/dist/types/src/configs/basic/BorderExt.d.ts +3 -0
- package/dist/types/src/configs/basic/Box.d.ts +3 -0
- package/dist/types/src/configs/basic/Color.d.ts +3 -0
- package/dist/types/src/configs/basic/Column.d.ts +3 -0
- package/dist/types/src/configs/basic/FlexContainer.d.ts +3 -0
- package/dist/types/src/configs/basic/FlexItem.d.ts +3 -0
- package/dist/types/src/configs/basic/Font.d.ts +3 -0
- package/dist/types/src/configs/basic/GridContainer.d.ts +3 -0
- package/dist/types/src/configs/basic/GridItem.d.ts +3 -0
- package/dist/types/src/configs/basic/Indent.d.ts +3 -0
- package/dist/types/src/configs/basic/Inset.d.ts +3 -0
- package/dist/types/src/configs/basic/Mask.d.ts +3 -0
- package/dist/types/src/configs/basic/Object.d.ts +3 -0
- package/dist/types/src/configs/basic/Outline.d.ts +3 -0
- package/dist/types/src/configs/basic/Scroll.d.ts +3 -0
- package/dist/types/src/configs/basic/ScrollExt.d.ts +3 -0
- package/dist/types/src/configs/basic/Size.d.ts +3 -0
- package/dist/types/src/configs/basic/SizeExt.d.ts +3 -0
- package/dist/types/src/configs/basic/Text.d.ts +3 -0
- package/dist/types/src/configs/basic/Transform.d.ts +3 -0
- package/dist/types/src/configs/basic/Transition.d.ts +3 -0
- package/dist/types/src/configs/basic/User.d.ts +3 -0
- package/dist/types/src/configs/basic/View.d.ts +3 -0
- package/dist/types/src/configs/basic.d.ts +112 -0
- package/dist/types/src/configs/ext/Keyframes.d.ts +6 -0
- package/dist/types/src/configs/ext/Reset.d.ts +3 -0
- package/dist/types/src/configs/ext.d.ts +8 -0
- package/dist/types/src/css/dict.d.ts +4 -0
- package/dist/types/src/css/functions.d.ts +443 -0
- package/dist/types/src/index.d.ts +11 -0
- package/dist/types/src/types.d.ts +358 -0
- package/dist/types/src/utils.d.ts +88 -0
- package/dist/types/tests/Processor.test.d.ts +1 -0
- package/dist/utils.js +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=(...e)=>e.join("-"),t=(...e)=>e.join(" "),a=(...e)=>e.join(","),r=e=>`(${e})`,s=(e,t)=>Object.fromEntries(Object.entries(e).map((e=>t(e)))),c=(e,t)=>s(e,(e=>[e[0],t(e[1])])),o=e=>"attr"+r(e),i=e=>"url"+r(e),n=e=>"calc"+r(e),l=e=>t("@keyframes",e),m=e=>"fit-content"+r(e),h=(e,t)=>"minmax"+r(a(e,t)),p=(e,t)=>"repeat"+r(a(e,t)),d=e=>"scale3d"+r(e),f=e=>"scaleX"+r(e),v=e=>"scaleY"+r(e),b=e=>"scaleZ"+r(e),$=e=>"scale"+r(e),g=(e,t,s)=>"translate3d"+r(a(e,t,s)),j=e=>"translateX"+r(e),k=e=>"translateY"+r(e),w=e=>"translateZ"+r(e),q=(e,t)=>"translate"+r(a(e,t)),u=e=>"rotate"+r(e),x=e=>"rotateX"+r(e),y=e=>"rotateY"+r(e),O=e=>"rotateZ"+r(e),X=(e,t,s,c)=>"rotate3d"+r(a(e,t,s,c)),Y=(e,t)=>"skew"+r(a(e,t)),E=e=>"skewX"+r(e),Z=e=>"skewY"+r(e),N=e=>"perspective"+r(e),z=e=>"opacity"+r(e),A=e=>"blur"+r(e),B=e=>"contrast"+r(e),C=e=>"drop-shadow"+r(e),D=e=>"saturate"+r(e),F=e=>"invert"+r(e),G=e=>"sepia"+r(e),H=e=>"hue-rotate"+r(e),I=e=>"grayscale"+r(e),J=e=>"brightness"+r(e),K=({f:e,l:t="l",c:a="c",h:r="h",a:s="alpha"})=>`oklch(from ${e} ${t} ${a} ${r} / ${s})`,L=(e,t)=>"light-dark"+r(a(e,t)),M=({m:e,c1:s,c2:c,p1:o,p2:i})=>"color-mix"+r(a(t("in",e),s+(o?` ${o}%`:""),c+(i?` ${i}%`:""))),P=e=>"@media"+r("prefers-color-scheme:"+e),Q=e=>"linear-gradient"+r(e),R=e=>"radial-gradient"+r(e),S=e=>"conic-gradient"+r(e),T=e=>e+":active",U=e=>e+":focus",V=e=>e+":hover",W=e=>e+":visited",_=e=>e+":link",ee=(e="")=>e+"::before",te=(e="")=>e+"::after",ae=e=>"::part"+r(e),re=e=>"::slotted"+r(e),se=e=>":has"+r(e),ce=e=>":is"+r(e),oe=e=>":not"+r(e),ie=e=>":nth-child"+r(e),ne=e=>":nth-of-type"+r(e),le=e=>":host"+r(e),me=e=>":state"+r(e),he=e=>":where"+r(e),pe=()=>ie("odd"),de=()=>ie("even"),fe=e=>e&&c(e,(e=>100*Number(e)+"%")),ve=(...e)=>fe(Object.fromEntries(e.map((e=>[e,e])))),be=e=>e&&c(e,(e=>e+"rem")),$e=e=>e&&c(e,(e=>e+"ms")),ge=e=>e&&c(e,(e=>e+"px")),je=e=>e&&c(e,(e=>e+"deg")),ke=e=>e&&c(e,(e=>e+"vw")),we=e=>e&&c(e,(e=>e+"vh")),qe=e=>e&&c(e,(e=>e+"vmin")),ue=e=>e&&c(e,(e=>e+"vmax")),xe=e=>e&&c(e,(e=>e+"cqb")),ye=e=>e&&c(e,(e=>e+"cqi")),Oe=e=>e&&c(e,(e=>e+"cqw")),Xe=e=>e&&c(e,(e=>e+"cqh")),Ye=e=>e&&c(e,(e=>e+"cqmin")),Ee=e=>e&&c(e,(e=>e+"cqmax")),Ze=e=>e&&c(e,(e=>"span "+e)),Ne=(...e)=>je(Object.fromEntries(e.map((e=>[e,e]))));export{Ne as argsToDeg,ve as argsToPercent,l as atKeyframes,o as attr,A as blur,J as brightness,n as calcExp,M as colorMix,a as comma,S as conicGradient,B as contrast,e as dash,C as dropShadow,m as fitContent,I as grayscale,H as hueRotate,F as invert,L as lightDark,Q as linearGradient,h as minmax,K as oklchFrom,z as opacity,r as parentheses,N as perspective,P as preferColorScheme,T as pseudoActive,te as pseudoAfter,ee as pseudoBefore,de as pseudoEvenChild,U as pseudoFocus,se as pseudoHas,le as pseudoHost,V as pseudoHover,ce as pseudoIs,_ as pseudoLink,oe as pseudoNot,ie as pseudoNthChild,ne as pseudoNthOfType,pe as pseudoOddChild,ae as pseudoPart,re as pseudoSlotted,me as pseudoState,W as pseudoVisited,he as pseudoWhere,R as radialGradient,p as repeat,u as rotate,X as rotate3d,x as rotateX,y as rotateY,O as rotateZ,D as saturate,$ as scale,d as scale3d,f as scaleX,v as scaleY,b as scaleZ,G as sepia,Y as skew,E as skewX,Z as skewY,t as space,xe as toCqb,Xe as toCqh,ye as toCqi,Ee as toCqmax,Ye as toCqmin,Oe as toCqw,je as toDeg,$e as toMs,fe as toPercent,ge as toPx,be as toRem,Ze as toSpan,we as toVh,ue as toVmax,qe as toVmin,ke as toVw,s as transformer,q as translate,g as translate3d,j as translateX,k as translateY,w as translateZ,i as url,c as valTransformer};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{values as e,keys as t}from"./css/dict.js";import{toPercent as s,toCqb as r,toCqi as i,toCqmin as l,toCqmax as o,toVw as n,toVh as c,toVmin as a,toVmax as h,toSpan as p,toRem as m,toDeg as d,toMs as f,toPx as u}from"./css/functions.js";import{COMPONENT_NAME as _,SETTINGS_ID as x,getProviderStyles as y}from"./utils.js";"function"==typeof SuppressedError&&SuppressedError;const v={light:{lig:{def:.75,c:.05,s:.65,m:.75,l:.85,n:.9}},dark:{lig:{def:.4,n:.25,s:.3,m:.4,l:.5,c:.95}},root:Object.assign({lig:{def:.75,c:.05,s:.65,m:.75,l:.85,n:.9},hue:{def:261.35,b:261.35,i:194.77,e:29.23,w:70.66,s:142.49},chr:{def:.03,xs:.03,s:.06,m:.1,l:.15,xl:.25},alp:{def:1,min:0,xs:.1,s:.25,m:.5,l:.75,xl:.9,max:1},rem:{def:16},ff:{def:"Roboto, sans-serif",b:"Georgia, serif"},fwg:{xs:100,s:200,m:400,l:600,xl:700},time:{def:300,xs:100,s:200,m:300,l:450,xl:600,no:0,min:50,max:750},coef:[0,1,2,3,4,5,6,7,8,9,10,11,12].reduce(((e,t)=>(e[t]=t,e)),{}),rat:{1:1,"2/1":2,"1/2":.5,"4/3":1.3333,"3/4":.75,"9/16":.5625,"16/9":1.7778},sp:{"3xs":.125,"2xs":.25,xs:.5,s:.75,m:1,l:1.25,xl:1.5,"2xl":2,"3xl":4},sz:{"3xs":1,"2xs":1.5,xs:2,s:5,m:10,l:15,xl:20,"2xl":25,"3xl":30},szu:{a:"auto",no:0},bp:{xs:30,sm:40,md:48,lg:64,xl:80},o:{min:0,xs:.1,s:.25,m:.5,l:.75,xl:.9,max:1},vu:{0:0,"1/4":25,"1/2":50,"3/4":75,1:100},cqu:{0:0,"1/4":25,"1/2":50,"3/4":75,1:100},fr:{0:0,"1/12":"0.0833","1/10":"0.1","1/6":"0.1667","1/5":"0.2","1/4":"0.25","3/10":"0.3","1/3":"0.3333","2/5":"0.4","5/12":"0.4167","1/2":"0.5","7/12":"0.5833","3/5":"0.6","2/3":"0.6667","7/10":"0.7","3/4":"0.75","4/5":"0.8","5/6":"0.8333","9/10":"0.9","11/12":"0.9167",1:"1"},rad:{s:.5,m:1,l:2},th:{s:.1,m:.25,l:.5},sc:{xs:.5,s:.67,m:1,l:1.5,xl:2},tr:{xs:.25,s:.5,m:1,l:1.5,xl:2},sk:{xs:-15,s:-10,m:0,l:10,xl:15},rot:{xs:-180,s:-90,m:0,l:90,xl:180},zm:{s:.8,m:1,l:1.2},pers:{s:"100px",m:"200px"},fsz:{xs:.25,s:.5,m:1,l:1.5,xl:2},lh:{xs:1,s:1.25,m:1.5,l:1.75,xl:2},lsp:{no:0,s:.05,m:.1,l:.2},zi:{1:1,2:2,3:3,4:4,5:5},ic:{inf:"infinite",1:1,2:2}},e)},S=e=>`{${e}}`,b=Object.assign.bind(Object),g=(e,t)=>`${e}:${t};`,$=(e,t)=>["@property",e,S(g("syntax",t.syn||'"*"')+g("inherits",t.inh||!1)+(t.ini?g("initial-value",t.ini):""))].join(" "),j=e=>`var(${e})`,O=({l:e,c:t,h:s,a:r=1})=>`oklch(${e} ${t} ${s} / ${r})`,w=["l","c","h","a"];class k{constructor(e){this.baseStyles="",this._prefix="eff",this._mode="a",this._params=v,this._compKeys={},this._compValues={},this._analyzeParams=e=>{var t,_;if(e)for(const t in e)this._params[t]=b(this._params[t]||{},e[t]);const{time:x,rem:y,coef:v,szu:S,sz:g,sp:$,rad:j,th:O,fr:w,bp:k,fsz:z,lsp:A,tr:E,sk:V,rot:N,fg:q,fs:R,fb:W,fo:I,ra:P,ro:C,co:K,ca:T,ins:B,cqu:G,cqb:H,cqi:J,cqmin:L,cqmax:M,vu:U,vw:D,vh:F,vmin:Q,vmax:X}=this._params.root,Y=s(w);this._params.root=b(this._params.root,{cqb:r(H||G),cqi:i(J||G),cqmin:l(L||G),cqmax:o(M||G),vw:n(D||U),vh:c(F||U),vmin:a(Q||U),vmax:h(X||U),fo:I||v,fg:q||v,fs:R||v,fb:W||Y,ra:P||p(v),ro:C||v,ca:T||p(v),co:K||v,ins:B||Y,sz:b(m(g)||{},S),sp:b(m($)||{},S),rad:m(j),th:m(O),bp:m(k),fsz:m(z),lsp:m(A),tr:m(E),sk:d(V),rot:d(N),perc:Y,time:f(x),rem:u(y)});const Z=function(e,t){var s={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(s[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(s[r[i]]=e[r[i]])}return s}(this._params,["root"]),ee=Object.entries(Z),te={_mode:{root:{}}},se={};ee.forEach((([e,t])=>{te._mode[e]||(te._mode[e]={}),Object.entries(t).forEach((([t,s])=>{Object.entries(s).forEach((([s,r])=>{const i=this._prepareVarName(t,s);te._mode[e][i]=r,te._mode.root[i]||(te._mode.root[i]=r,se[t]||(se[t]={}),se[t][s]=`var(${i})`)}))}))})),this._compValues=se,this._compKeys=Object.entries(this._compValues.bp||{}).reduce(((e,[t,s])=>(e[t+"_"]=`@media (min-width:${s})`,e[t.toUpperCase()+"_"]=`@media (max-width:${s})`,e)),{}),this.baseStyles=this.compile("init",{c:Object.assign(Object.assign(Object.assign(Object.assign({},te),{$r_:Object.assign(Object.assign({},te._mode.root),{$c:"{uni.inh}",$fsz:"{rem.def}",$ff:"{ff.def}",$:{$c:"{uni.inh}",$fsz:"{rem.def}",$ff:"{ff.def}"}})}),(null===(t=te._mode)||void 0===t?void 0:t.dark)?{$dark_:{$r_:te._mode.dark}}:{}),(null===(_=te._mode)||void 0===_?void 0:_.light)?{$light_:{$r_:te._mode.light}}:{})})},this._prepareVarName=(...e)=>["-",this._prefix,...e].join("-"),this.compile=(e,s)=>{const{_:r,k:i={},v:l={},c:o}=s,n=this._prepareSelector.bind(this),c=this._parseSelector.bind(this);let a=b({},o),h=b({},i),p=b({_:{}},l),m="";if(r)for(let t in r){const s=r[t];if("c"===s.typ){const r={};w.forEach((i=>{const l=t+i,o=this._prepareVarName(e,l);r[i]=o,h["_"+l]=r[i],m+=$(o,s)})),p._[t]=O({l:j(r.l),c:j(r.c),h:j(r.h),a:j(r.a)}),s.all&&(a["_"+t+"l"]=`&lig=>${this._prepareVarName(e,t+"l")}:{1}`,a["_"+t+"c"]=`&chr=>${this._prepareVarName(e,t+"c")}:{1}`,a["_"+t+"h"]=`&hue=>${this._prepareVarName(e,t+"h")}:{1}`,a["_"+t+"a"]=`&alp=>${this._prepareVarName(e,t+"a")}:{1}`)}else{const r=this._prepareVarName(e,t);h["_"+t]=r,p._[t]=j(r),m+=$(r,s)}}const d=e=>h[e]||this._compKeys[e]||t[e],f=e=>p[e]||this._compValues[e]||this._params.root[e],u=e=>e.replaceAll(/\{(.+?)\}/g,((e,t)=>{const[s,r]=t.split(".");if(r){const e=f(s);return(null==e?void 0:e[r])||(null==e?void 0:e.def)}return d(s)})),_=e=>{const t=e.split("?");let s;for(let e in t){const r=t[e],[i,l]=r.split("=>"),[o,n,c]=i.match(/(\w+)(\[[\w,]+\])?/),a=f(n);if(!a)continue;s=a;let h=Object.entries(s);const p=null==c?void 0:c.slice(1,-1).split(",");if(p){const e=new Set(p);h=h.filter((([t,s])=>e.has(t)))}if(l){let[e,t]=l.split("|");void 0===t&&(t=e,e=""),h=h.map((([s,r])=>[e.replace("{0}",s)||s,u(t.replaceAll("{1}",r))]))}(p||l)&&(s=Object.fromEntries(h));break}return s};function x(t,s,r){var i,l,o;let a=""+t;if((null===(i=null==t?void 0:t.startsWith)||void 0===i?void 0:i.call(t,"$"))&&(a=d(t.slice(1)),!a))return"";if(Array.isArray(s))return x(a,Object.assign({},...s.map((e=>"string"==typeof e?_(e):e))),r);if(null==s)return"";if("object"==typeof s){const t=!r||a.startsWith("&")||a.startsWith("@")?"":"&";if(a.startsWith("_")){const{e:r,m:i,mv:l}=c(a);return i&&"string"!=typeof l?Object.entries(s).reduce(((s,[l,o])=>{let c;return c="object"==typeof o?Object.entries(o).reduce(((e,t)=>e+x(...t,a)),""):o+";",s+t+n({b:e,e:r,m:i,mv:l})+S(c)}),""):t+n({b:e,e:r,m:i,mv:l})+S(Object.entries(s).reduce(((e,t)=>e+x(...t,a)),""))}return t+a+S(Object.entries(s).reduce(((e,t)=>e+x(...t,a)),""))}{let e=""+s;return(null===(l=null==e?void 0:e.startsWith)||void 0===l?void 0:l.call(e,"&"))?x(a,_(e.slice(1)),r):(null===(o=null==e?void 0:e.includes)||void 0===o?void 0:o.call(e,"{"))?x(a,u(e),r):g(a,s)}}return m+Object.entries(a).reduce(((e,t)=>e+x(...t)),"")};const{mode:_,prefix:x,params:y}=e;this._mode=_||"a",this._prefix=x||"eff","c"===this._mode?this._prepareSelector=({b:e,e:t,m:s,mv:r,s:i})=>`.${e}${(t?"__"+t:"")+(s?"_"+s:"")+(s&&r?"_"+r:"")+(i?":"+i:"")}`:this._prepareSelector=({b:e,e:t,m:s,mv:r,s:i})=>`[data-${e}${t?"-"+t:""}${s?'~="'+s+(r?"-"+r:"")+(i?":"+i:"")+'"':""}]`,this._analyzeParams(y)}_parseSelector(e){let t,s,r,i;return e.startsWith("__")?[t,s,r]=e.slice(2).split("_"):[t,s,r]=e.split("_"),r&&([r,i]=r.split(":")),{e:t,m:s,mv:r,s:i}}expandSelector(e,t){const{e:s,m:r,mv:i,s:l}=this._parseSelector(t),o=l&&this._getStateSelector(l);return[this._prepareSelector({b:e,e:s,m:r,mv:i}),this._prepareSelector({b:e,e:s,m:r,mv:i,s:l})+"{"+o]}_getStateSelector(e){const s=e+"_",r=this._compKeys[s]||t[s];if(r)return(r.startsWith("&")||r.startsWith("@")?"":"&")+r}}class z{constructor(e){if(this._stylesheets={},this._rules={},this._expandedSelectors={},this._styleSheetsArray=[],e)for(let t in e)this.pack(t,e[t])}get(e){return this._stylesheets[e]}getAll(){return this._stylesheets}add(e,t){if(!this._stylesheets[e])return this._stylesheets[e]=t,this._styleSheetsArray.push(t),this.cacheRules(e,t),!0}remove(e){const t=this.get(e);if(!t)return;const s=this._styleSheetsArray.findIndex((e=>e===t));return s>-1&&(this._styleSheetsArray.splice(s,1),delete this._stylesheets[e],delete this._rules[e],delete this._expandedSelectors[e]),!0}removeAll(){return this._styleSheetsArray.splice(0),this._stylesheets={},this._rules={},this._expandedSelectors={},!0}pack(e,t){const s=new CSSStyleSheet;if(s.replaceSync(t),s.cssRules.length)return this.add(e,s),s;console.log(`StyleSheet '${e}' is empty`)}cacheRules(e,t){[...t.cssRules].forEach((t=>{const s=t.cssText.split(" {")[0];s&&(this._rules[e]||(this._rules[e]={}),this._rules[e][s]=t)})),this._expandedSelectors[e]=new Set}getExpandedSelectors(e){return this._expandedSelectors[e]}expandRule(e,t,s){const r=this._rules[e];if(!r)return void console.log(`No stylesheet found with key '${e}'`);const i=r[t];if(!i)return void console.log(`No rule with selector '${t}' found in stylesheet with key '${e}'`);const[l,o]=i.cssText.split("{");if(i.parentStyleSheet){const t=s+"{"+o+"}",l=i.parentStyleSheet.insertRule(t,i.parentStyleSheet.cssRules.length),n=i.parentStyleSheet.cssRules[l],c=s.split("{")[0];return r[c]=n,this._expandedSelectors[e].add(c),!0}}apply(e){e.adoptedStyleSheets=this._styleSheetsArray}}function A(e){customElements.define((null==e?void 0:e.name)||_,class extends HTMLElement{get settingsId(){return this.getAttribute("settingsid")||x}constructor(){super(),this.getSettings=()=>{var t;const s=null===(t=null===document||void 0===document?void 0:document.getElementById(this.settingsId))||void 0===t?void 0:t.textContent;return s?JSON.parse(s):(null==e?void 0:e.config)||{}}}connectedCallback(){const e=this.getSettings(),{params:t,styles:s,ext:r}=e;this.processor=new k({prefix:this.getAttribute("prefix")||void 0,mode:this.getAttribute("mode")||void 0,params:t}),this.manager=new z({init:y()+this.processor.baseStyles}),this.processStyles(s,r),this.manager.apply(document)}compileStyleSheet(e,t){var s,r;const i=null===(s=this.processor)||void 0===s?void 0:s.compile(e,t);if(i)return null===(r=this.manager)||void 0===r?void 0:r.pack(e,i)}expandStyleSheet(e,t){var s;const r=null===(s=this.manager)||void 0===s?void 0:s.getExpandedSelectors(e);if(this.processor&&r){const s=new Set(t).difference(r),i=s.size;return i&&this.processor&&s.keys().forEach((t=>{var s;const[r,i]=this.processor.expandSelector(e,t);null===(s=this.manager)||void 0===s||s.expandRule(e,r,i)})),i}}processStyles(e,t){if(e)for(let t in e){const s=e[t];this.compileStyleSheet(t,s)}if(t)for(let e in t){const s=t[e];this.expandStyleSheet(e,s)}}})}export{A as defineStyleProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IStyleManager } from 'types';
|
|
2
|
+
/**
|
|
3
|
+
* Style manager
|
|
4
|
+
*/
|
|
5
|
+
export declare class Manager implements IStyleManager {
|
|
6
|
+
/**
|
|
7
|
+
* Stylesheets dict
|
|
8
|
+
*/
|
|
9
|
+
protected _stylesheets: Record<string, CSSStyleSheet>;
|
|
10
|
+
/**
|
|
11
|
+
* Rules dict
|
|
12
|
+
*/
|
|
13
|
+
protected _rules: Record<string, Record<string, CSSRule>>;
|
|
14
|
+
/**
|
|
15
|
+
* Expanded selectors dict
|
|
16
|
+
*/
|
|
17
|
+
protected _expandedSelectors: Record<string, Set<string>>;
|
|
18
|
+
/**
|
|
19
|
+
* Stylesheets array
|
|
20
|
+
*/
|
|
21
|
+
protected readonly _styleSheetsArray: CSSStyleSheet[];
|
|
22
|
+
constructor(config: Record<string, string>);
|
|
23
|
+
get(key: string): CSSStyleSheet;
|
|
24
|
+
getAll(): Record<string, CSSStyleSheet>;
|
|
25
|
+
add(key: string, stylesheet: CSSStyleSheet): true | undefined;
|
|
26
|
+
remove(key: string): true | undefined;
|
|
27
|
+
removeAll(): boolean;
|
|
28
|
+
pack(key: string, styles: string): CSSStyleSheet | undefined;
|
|
29
|
+
cacheRules(key: string, stylesheet: CSSStyleSheet): void;
|
|
30
|
+
getExpandedSelectors(key: string): Set<string>;
|
|
31
|
+
expandRule(key: string, init: string, exp: string): true | undefined;
|
|
32
|
+
apply(root: {
|
|
33
|
+
adoptedStyleSheets: CSSStyleSheet[];
|
|
34
|
+
}): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { IStyleProcessor, TModeValues, TStyleConfig } from 'types';
|
|
2
|
+
/**
|
|
3
|
+
* Style generation mode
|
|
4
|
+
* @description
|
|
5
|
+
* `a` - attributes
|
|
6
|
+
* `c` - classes
|
|
7
|
+
*/
|
|
8
|
+
export type TStyleMode = 'a' | 'c';
|
|
9
|
+
type TPrepareSelector = (params: {
|
|
10
|
+
/**
|
|
11
|
+
* Block
|
|
12
|
+
*/
|
|
13
|
+
b: string;
|
|
14
|
+
/**
|
|
15
|
+
* Element
|
|
16
|
+
*/
|
|
17
|
+
e?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Modifier
|
|
20
|
+
*/
|
|
21
|
+
m?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Modifier value
|
|
24
|
+
*/
|
|
25
|
+
mv?: string;
|
|
26
|
+
/**
|
|
27
|
+
* HTML element state for modifier value activation
|
|
28
|
+
*/
|
|
29
|
+
s?: string;
|
|
30
|
+
}) => string;
|
|
31
|
+
/**
|
|
32
|
+
* Put value in curly braces
|
|
33
|
+
* @param val
|
|
34
|
+
*/
|
|
35
|
+
export declare const curlyBraces: (val: string | number) => string;
|
|
36
|
+
/**
|
|
37
|
+
* Style processor
|
|
38
|
+
*/
|
|
39
|
+
export declare class Processor implements IStyleProcessor {
|
|
40
|
+
/**
|
|
41
|
+
* Initial styles
|
|
42
|
+
*/
|
|
43
|
+
baseStyles: string;
|
|
44
|
+
/**
|
|
45
|
+
* Style identifiers prefix
|
|
46
|
+
*/
|
|
47
|
+
protected _prefix: string;
|
|
48
|
+
/**
|
|
49
|
+
* Style mode
|
|
50
|
+
*/
|
|
51
|
+
protected _mode: TStyleMode;
|
|
52
|
+
/**
|
|
53
|
+
* Manager vars
|
|
54
|
+
*/
|
|
55
|
+
protected _params: TModeValues;
|
|
56
|
+
/**
|
|
57
|
+
* Dictionary keys
|
|
58
|
+
*/
|
|
59
|
+
protected _compKeys: Record<string, string>;
|
|
60
|
+
/**
|
|
61
|
+
* Dictionary values
|
|
62
|
+
*/
|
|
63
|
+
protected _compValues: Record<string, Record<string, string | number>>;
|
|
64
|
+
/**
|
|
65
|
+
* Prepare rule selector
|
|
66
|
+
*/
|
|
67
|
+
protected _prepareSelector: TPrepareSelector;
|
|
68
|
+
constructor(config: {
|
|
69
|
+
mode?: TStyleMode;
|
|
70
|
+
prefix?: string;
|
|
71
|
+
params: Record<string, Record<string, object>>;
|
|
72
|
+
});
|
|
73
|
+
protected _analyzeParams: (params: Record<string, Record<string, object>>) => void;
|
|
74
|
+
/**
|
|
75
|
+
* Parse string to find selector parts
|
|
76
|
+
* @param key
|
|
77
|
+
*/
|
|
78
|
+
protected _parseSelector(key: string): {
|
|
79
|
+
e: string;
|
|
80
|
+
m: string;
|
|
81
|
+
mv: string;
|
|
82
|
+
s: string | undefined;
|
|
83
|
+
};
|
|
84
|
+
expandSelector(b: string, selector: string): [string, string];
|
|
85
|
+
/**
|
|
86
|
+
* Get state selector
|
|
87
|
+
* @param state
|
|
88
|
+
*/
|
|
89
|
+
protected _getStateSelector(state: string): string | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Prepare name of variable
|
|
92
|
+
* @param parts
|
|
93
|
+
*/
|
|
94
|
+
protected _prepareVarName: (...parts: string[]) => string;
|
|
95
|
+
/**
|
|
96
|
+
* Compile style config to CSS stylesheet text content
|
|
97
|
+
* @param styleConfig
|
|
98
|
+
* @param param
|
|
99
|
+
*/
|
|
100
|
+
compile: (b: string, styleConfig: TStyleConfig) => string;
|
|
101
|
+
}
|
|
102
|
+
export {};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flex container
|
|
3
|
+
*/
|
|
4
|
+
export { default as fc } from './basic/FlexContainer';
|
|
5
|
+
/**
|
|
6
|
+
* Flex item
|
|
7
|
+
*/
|
|
8
|
+
export { default as fi } from './basic/FlexItem';
|
|
9
|
+
/**
|
|
10
|
+
* Grid container
|
|
11
|
+
*/
|
|
12
|
+
export { default as gc } from './basic/GridContainer';
|
|
13
|
+
/**
|
|
14
|
+
* Grid item
|
|
15
|
+
*/
|
|
16
|
+
export { default as gi } from './basic/GridItem';
|
|
17
|
+
/**
|
|
18
|
+
* Text
|
|
19
|
+
*/
|
|
20
|
+
export { default as tx } from './basic/Text';
|
|
21
|
+
/**
|
|
22
|
+
* Font
|
|
23
|
+
*/
|
|
24
|
+
export { default as f } from './basic/Font';
|
|
25
|
+
/**
|
|
26
|
+
* Column
|
|
27
|
+
*/
|
|
28
|
+
export { default as col } from './basic/Column';
|
|
29
|
+
/**
|
|
30
|
+
* Object
|
|
31
|
+
*/
|
|
32
|
+
export { default as obj } from './basic/Object';
|
|
33
|
+
/**
|
|
34
|
+
* View
|
|
35
|
+
*/
|
|
36
|
+
export { default as v } from './basic/View';
|
|
37
|
+
/**
|
|
38
|
+
* Mask
|
|
39
|
+
*/
|
|
40
|
+
export { default as mk } from './basic/Mask';
|
|
41
|
+
/**
|
|
42
|
+
* Background
|
|
43
|
+
*/
|
|
44
|
+
export { default as bg } from './basic/Background';
|
|
45
|
+
/**
|
|
46
|
+
* Box
|
|
47
|
+
*/
|
|
48
|
+
export { default as bx } from './basic/Box';
|
|
49
|
+
/**
|
|
50
|
+
* Inset
|
|
51
|
+
*/
|
|
52
|
+
export { default as i } from './basic/Inset';
|
|
53
|
+
/**
|
|
54
|
+
* Size
|
|
55
|
+
*/
|
|
56
|
+
export { default as sz } from './basic/Size';
|
|
57
|
+
/**
|
|
58
|
+
* Size extended
|
|
59
|
+
*/
|
|
60
|
+
export { default as sze } from './basic/SizeExt';
|
|
61
|
+
/**
|
|
62
|
+
* Animation
|
|
63
|
+
*/
|
|
64
|
+
export { default as a } from './basic/Animation';
|
|
65
|
+
/**
|
|
66
|
+
* Transition
|
|
67
|
+
*/
|
|
68
|
+
export { default as t } from './basic/Transition';
|
|
69
|
+
/**
|
|
70
|
+
* Indents
|
|
71
|
+
*/
|
|
72
|
+
export { default as ind } from './basic/Indent';
|
|
73
|
+
/**
|
|
74
|
+
* Transform
|
|
75
|
+
*/
|
|
76
|
+
export { default as tf } from './basic/Transform';
|
|
77
|
+
/**
|
|
78
|
+
* User
|
|
79
|
+
*/
|
|
80
|
+
export { default as u } from './basic/User';
|
|
81
|
+
/**
|
|
82
|
+
* Agent
|
|
83
|
+
*/
|
|
84
|
+
export { default as ag } from './basic/Agent';
|
|
85
|
+
/**
|
|
86
|
+
* Scroll
|
|
87
|
+
*/
|
|
88
|
+
export { default as sc } from './basic/Scroll';
|
|
89
|
+
/**
|
|
90
|
+
* Scroll extended
|
|
91
|
+
*/
|
|
92
|
+
export { default as sce } from './basic/ScrollExt';
|
|
93
|
+
/**
|
|
94
|
+
* Border
|
|
95
|
+
*/
|
|
96
|
+
export { default as b } from './basic/Border';
|
|
97
|
+
/**
|
|
98
|
+
* Border extended
|
|
99
|
+
*/
|
|
100
|
+
export { default as be } from './basic/BorderExt';
|
|
101
|
+
/**
|
|
102
|
+
* Outline
|
|
103
|
+
*/
|
|
104
|
+
export { default as o } from './basic/Outline';
|
|
105
|
+
/**
|
|
106
|
+
* Color
|
|
107
|
+
*/
|
|
108
|
+
export { default as c } from './basic/Color';
|
|
109
|
+
/**
|
|
110
|
+
* Agent color
|
|
111
|
+
*/
|
|
112
|
+
export { default as ac } from './basic/AgentColor';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TStyleConfig } from 'types';
|
|
2
|
+
export interface IKeyframesConfig {
|
|
3
|
+
an: 'zoomIn' | 'zoomOut' | 'pulse' | 'heartbeat' | 'bounceIn' | 'bounceOut' | 'fadeIn' | 'fadeInRight' | 'fadeInLeft' | 'fadeInDown' | 'fadeInUp' | 'fadeOut' | 'fadeOutRight' | 'fadeOutLeft' | 'fadeOutDown' | 'fadeOutUp' | 'flipInX' | 'flipInY' | 'flipOutX' | 'flipOutY' | 'slideInDown' | 'slideInLeft' | 'slideInRight' | 'slideInUp' | 'slideOutDown' | 'slideOutLeft' | 'slideOutRight' | 'slideOutUp';
|
|
4
|
+
}
|
|
5
|
+
declare const _default: TStyleConfig;
|
|
6
|
+
export default _default;
|