@thi.ng/meta-css 0.7.13 → 0.8.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/CHANGELOG.md +48 -1
- package/README.md +1252 -98
- package/index.js +6 -6
- package/package.json +10 -10
- package/specs/_info.mcss.json +5 -3
- package/specs/a11y.mcss.json +2 -2
- package/specs/anim.mcss.json +93 -28
- package/specs/aspect.mcss.json +27 -41
- package/specs/background.mcss.json +2 -2
- package/specs/borders.mcss.json +6 -6
- package/specs/color-ops.mcss.json +160 -0
- package/specs/colors.mcss.json +49 -62
- package/specs/content.mcss.json +1 -1
- package/specs/cursor.mcss.json +1 -1
- package/specs/dimensions.mcss.json +7 -7
- package/specs/display.mcss.json +2 -2
- package/specs/flex.mcss.json +4 -4
- package/specs/grids.mcss.json +16 -5
- package/specs/icons.mcss.json +2 -2
- package/specs/lists.mcss.json +1 -1
- package/specs/margins.mcss.json +5 -5
- package/specs/normalize.mcss.json +1 -2
- package/specs/overflows.mcss.json +1 -1
- package/specs/positions.mcss.json +14 -3
- package/specs/print.mcss.json +1 -1
- package/specs/scroll.mcss.json +3 -3
- package/specs/selection.mcss.json +1 -1
- package/specs/shadows.mcss.json +3 -3
- package/specs/typography.mcss.json +15 -15
package/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
3
|
-
`),this.parent&&this.parent.logEntry(Z)}}var
|
|
4
|
-
`]:[],...B(
|
|
5
|
-
`),l1(Z,W);const Q=await Z.ctx({logger:new v0(process.stderr,Z.name,"INFO"),format:J?R0:S1,opts:V.result,inputs:V.rest},Y);if(await Y.fn(Q),Z.post)await Z.post(Q,Y)}catch(B){process.stderr.write(B.message+"\n\n"),process.exit(1)}},l1=(Z,X)=>{process.stderr.write($0(Z.opts,X)),process.exit(1)},D5=(Z)=>["\nAvailable commands:\n",...Object.keys(Z).map((X)=>`${I0(16)(X)}: ${Z[X].desc}`),"\n"].join("\n");import{existsSync as k5,mkdirSync as N5,statSync as SZ} from"fs";import{dirname as G5} from"path";var j5=(Z)=>Z.length>0&&!k5(Z)?(N5(Z,{recursive:!0}),!0):!1,o1=(Z)=>j5(G5(Z));var A=(Z)=>typeof Z==="function";var P=(Z)=>typeof Z==="string";import{readFileSync as v5} from"fs";import{writeFileSync as T5} from"fs";var i1=(Z,X,J,W,B=!1)=>{if(W&&W.info(`${B?"[dryrun] ":""}writing file: ${Z}`),B)return;o1(Z),T5(Z,X,!J&&P(X)?"utf-8":J)};var O=(Z,X,J="utf-8")=>{return X&&X.debug("reading file:",Z),v5(Z,J)},W1=(Z,X,J,W=!1)=>i1(Z,w(X)?X.join("\n"):X,"utf-8",J,W);var x=(Z,X)=>JSON.parse(O(Z,X));var y=Symbol(),B1=()=>{};var C0=Object.freeze({level:M.NONE,addChild(Z){return Z},childLogger:()=>C0,enabled:()=>!1,fine(){},debug(){},info(){},warn(){},severe(){},logEntry(){}});class Y1 extends K0{set(Z){this.parent=Z}childLogger(Z,X){return new Y1(Z,X??this.level,this)}logEntry(Z){this.parent.logEntry(Z)}}var a1=new Y1("root",M.FINE,C0);import{join as Y8} from"path";var I5=I(()=>"Assertion failed"),A0=(typeof process!=="undefined"&&process.env!==void 0?!0:import.meta.env?import.meta.env.MODE!=="production"||!!import.meta.env.UMBRELLA_ASSERTS||!!import.meta.env.VITE_UMBRELLA_ASSERTS:!0)?(Z,X)=>{if(typeof Z==="function"&&!Z()||!Z)throw new I5(typeof X==="function"?X():X)}:()=>{};var L0=(Z)=>Z!=null&&typeof Z!=="function"&&Z.length!==void 0;var t1=(Z)=>{return(Z==null||!Z[Symbol.iterator])&&H(`value is not iterable: ${Z}`),Z};var r1=(Z)=>L0(Z)?Z:[...t1(Z)];var M0=(Z)=>Z[Z.length-1];var b5=I(()=>"illegal arity"),e=(Z)=>{throw new b5(Z)};var R5=I(()=>"illegal state"),Z0=(Z)=>{throw new R5(Z)};var c1=["-moz-","-ms-","-o-","-webkit-"],n={rules:"",ruleSep:",",valSep:"",decls:"",declStart:"{",declEnd:"}",indent:"",comments:!1},F0={rules:"\n",ruleSep:", ",valSep:" ",decls:"\n",declStart:" {\n",declEnd:"}\n",indent:" ",comments:!0};var G=(Z)=>Z!=null&&typeof Z[Symbol.iterator]==="function";var V1=function(...Z){let[X,J,W,B,Y,z,V,Q,q,U]=Z;switch(Z.length){case 0:e(0);case 1:return X;case 2:return(...$)=>X(J(...$));case 3:return(...$)=>X(J(W(...$)));case 4:return(...$)=>X(J(W(B(...$))));case 5:return(...$)=>X(J(W(B(Y(...$)))));case 6:return(...$)=>X(J(W(B(Y(z(...$))))));case 7:return(...$)=>X(J(W(B(Y(z(V(...$)))))));case 8:return(...$)=>X(J(W(B(Y(z(V(Q(...$))))))));case 9:return(...$)=>X(J(W(B(Y(z(V(Q(q(...$)))))))));case 10:default:const K=(...$)=>X(J(W(B(Y(z(V(Q(q(U(...$))))))))));return Z.length===10?K:V1(K,...Z.slice(10))}};var S0=(Z,X)=>Z!=null&&typeof Z[X]==="function";var l=(Z)=>S0(Z,"xform")?Z.xform():Z;var h=function(...Z){return Z=Z.map(l),V1.apply(null,Z)};var _0=(Z)=>Z!=null&&typeof Z!=="string"&&typeof Z[Symbol.iterator]==="function";var X0=(Z,X)=>[Z[0],Z[1],X];class z1{value;constructor(Z){this.value=Z}deref(){return this.value}}var j=(Z)=>Z instanceof z1;var m=(Z)=>Z instanceof z1?Z.deref():Z;var y0=function(...Z){const X=Z[0],J=X[0],W=X[1],B=X[2];Z=E5(Z);const Y=Z[0]==null?J():Z[0],z=Z[1];return m(W(S0(z,"$reduce")?z.$reduce(B,Y):L0(z)?A5(B,Y,z):L5(B,Y,z)))};var E5=(Z)=>Z.length===2?[void 0,Z[1]]:Z.length===3?[Z[1],Z[2]]:e(Z.length),A5=(Z,X,J)=>{for(let W=0,B=J.length;W<B;W++)if(X=Z(X,J[W]),j(X)){X=X.deref();break}return X},L5=(Z,X,J)=>{for(let W of J)if(X=Z(X,W),j(X)){X=X.deref();break}return X},J0=(Z,X)=>[Z,(J)=>J,X];var h0=function(Z){return Z?[...Z]:J0(()=>[],(X,J)=>(X.push(J),X))};function*m0(Z,X){const J=l(Z)(h0()),W=J[1],B=J[2];for(let Y of X){const z=B([],Y);if(j(z)){yield*m(W(z.deref()));return}if(z.length)yield*z}yield*m(W([]))}function*p(Z,X){const J=l(Z)([B1,B1,(W,B)=>B])[2];for(let W of X){let B=J(y,W);if(j(B)){if(B=m(B.deref()),B!==y)yield B;return}if(B!==y)yield B}}var f0=(Z,X,J=p)=>{const W=X.length-1;return G(X[W])?X.length>1?J(Z.apply(null,X.slice(0,W)),X[W]):J(Z(),X[0]):void 0};var Q1=function(Z,X){return G(X)?m0(Q1(Z),P(X)?[X]:X):(J)=>{const W=J[2],B=(Y,z)=>{const V=Z(z);if(V){for(let Q of V)if(Y=B(Y,Q),j(Y))break;return Y}return W(Y,z)};return X0(J,B)}};var s1=function(Z){return Q1((X)=>_0(X)?X:void 0,Z)};var F=function(Z,X){return G(X)?p(F(Z),X):(J)=>{const W=J[2];return X0(J,(B,Y)=>W(B,Z(Y)))}};function*u0(...Z){const X=Z.length-1;if(X<0)return;const J=new Array(X+1).fill(0),W=Z.map(r1),B=W.reduce((Y,z)=>Y*z.length,1);for(let Y=0;Y<B;Y++){const z=[];for(let V=X;V>=0;V--){const Q=W[V];let q=J[V];if(q===Q.length)J[V]=q=0,V>0&&J[V-1]++;z[V]=Q[q]}J[X]++,yield z}}function*e1(Z,X=Infinity){while(X-- >0)yield Z}var U1=function(Z,X){Z=Z||"";let J=!0;return X?[...X].join(Z):J0(()=>"",(W,B)=>(W=J?W+B:W+Z+B,J=!1,W))};var g0=function(...Z){return S5(g0,y0,Z)};var S5=(Z,X,J)=>{let W,B;switch(J.length){case 4:B=J[3],W=J[2];break;case 3:B=J[2];break;case 2:return F((Y)=>Z(J[0],J[1],Y));default:e(J.length)}return X(l(J[0])(J[1]),W,B)};var _5=new Set,y5=":[",Z4=h(s1(),F((Z)=>y5.indexOf(Z.charAt(0))>=0?Z:" "+Z)),h5=(Z,X)=>h(Z,F((J)=>P(J)&&J.indexOf(" .")==0?J+X:J)),W0=(Z,X,J,W)=>{const B=J.length,Y=[];let z,V;const Q=(q,U)=>{let K=null;if(w(U))W0(Z,q1(X,Y),U,W);else if(G(U)&&!P(U))W0(Z,q1(X,Y),[...U],W);else if((V=A(U))||(K=W.fns[U]))if(!X.length){if(K)return K.apply(null,J.slice(q+1))(Z,W),!0;U(Z,W)}else if(V)Q(q,U());else H(`quoted fn ('${U}') only allowed at head position`);else if(b(U))z=Object.assign(z||{},U);else if(U!=null)Y.push(U)};for(let q=0;q<B;q++)if(Q(q,J[q]))return Z;return z&&Z.push(m5(X,Y,z,W)),Z},q1=(Z,X)=>Z.length?[...u0(Z,X)]:X,m5=(Z,X,J,W)=>{const B=W.format,Y=R(W),z=W.scope?h5(Z4,W.scope):Z4;return[Y,g0(F((V)=>g0(z,U1(),w(V)?V:[V]).trim()),U1(B.ruleSep),q1(Z,X)),B.declStart,w0(J,W),Y,B.declEnd].join("")},w0=(Z,X)=>{const J=X.format,W=X.autoprefix||_5,B=R(X,X.depth+1),Y=[];for(let z in Z)if(Z.hasOwnProperty(z)){let V=Z[z];if(A(V))V=V(Z);if(w(V))V=V.map((Q)=>w(Q)?Q.join(" "):Q).join(J.ruleSep);if(W.has(z))for(let Q of X.vendors)Y.push(`${B}${Q}${z}:${J.valSep}${V};`);Y.push(`${B}${z}:${J.valSep}${V};`)}return Y.join(J.decls)+J.decls},R=(Z,X=Z.depth)=>X>1?[...e1(Z.format.indent,X)].join(""):X>0?Z.format.indent:"";var X4=function(Z,...X){const J=X.length===1?X[0]:X.reduce((W,B,Y)=>{return W[Y/(X.length-1)*100|0]=B,W},{});return(W,B)=>{const Y=R(B);B.depth++;const z=R(B);W.push(`${Y}@keyframes ${Z}${B.format.declStart}`);for(let V in J)if(J.hasOwnProperty(V))W.push([z,V+"%",B.format.declStart,w0(J[V],B),z,B.format.declEnd].join(""));return B.depth--,W.push(Y+B.format.declEnd),W}};var J4=(Z,X=!1)=>(J,W)=>{const B=R(W),Y=R(W,W.depth+1);if(W.format.comments||X)J.push(B+"/*",Z.split("\n").map((z)=>Y+z).join("\n"),B+"*/");return J};var d0=(Z,X,J)=>(W,B)=>{const Y=R(B);return W.push(`${Y}${Z} ${f5(X)}${B.format.declStart}`),B.depth++,W0(W,[],J,B),B.depth--,W.push(Y+B.format.declEnd),W},f5=(Z)=>{if(P(Z))return Z;const X=[];for(let J in Z)if(Z.hasOwnProperty(J)){let W=Z[J];if(W===!0)W=W4.has(J)?J:`(${J})`;else if(W===!1)W=`(not ${W4.has(J)?J:`(${J})`})`;else if(W==="only")W+=" "+J;else W=`(${J}:${W})`;X.push(W)}return X.join(" and ")},W4=new Set(["all","print","screen"]);var o=(Z,X)=>{return X={format:n,vendors:c1,fns:{},depth:0,...X},w(X.autoprefix)&&(X.autoprefix=new Set(X.autoprefix)),b(Z)?w0(Z,X):A(Z)?Z([],X).join(X.format.rules):W0([],[],w(Z)?Z:_0(Z)?[...Z]:H("invalid rules"),X).join(X.format.rules)};var B4=(Z,...X)=>(J,W)=>(J.push(X.length?`@import url(${Z}) ${X.join(W.format.ruleSep)};`:`@import url(${Z});`),J);var B0=(Z,X)=>d0("@media",Z,X);var Y4=function(...Z){return(X,J)=>(X.push(Z.length>1?`@namespace ${Z[0]} url(${Z[1]});`:`@namespace url(${Z[0]});`),X)};var V4=(Z,X)=>d0("@supports",Z,X);var i={"@comment":J4,"@import":B4,"@keyframes":X4,"@media":B0,"@namespace":Y4,"@supports":V4};var z4=4,Q4=(Z)=>z4=Z,N=(Z)=>Z===(Z|0)?String(Z):Z.toFixed(z4).replace(/^0./,".").replace(/^-0./,"-.").replace(/0+$/,"");var U4=(Z)=>`${N(Z)}em`,q4=(Z)=>`${N(Z)}ex`;var K4=(Z)=>`${N(Z)}rem`,K1=(Z)=>`${N(Z)}%`,$4=(Z)=>`${N(Z)}px`,H4=(Z)=>`${N(Z)}vh`,C4=(Z)=>`${N(Z)}vw`,M4=(Z)=>`${N(Z)}vmin`,F4=(Z)=>`${N(Z)}vmax`,w4=(Z)=>`${Z|0}ms`,P4=(Z)=>`${N(Z)}s`;var O4=(Z)=>`${N(Z)}deg`,D4=(Z)=>`${N(Z)}rad`,k4=(Z)=>`${N(Z)}turn`,N4=(Z)=>`url(${Z})`;var D=((Z)=>{return Z[Z.IDLE=0]="IDLE",Z[Z.ACTIVE=1]="ACTIVE",Z[Z.DONE=2]="DONE",Z[Z.UNSUBSCRIBED=3]="UNSUBSCRIBED",Z[Z.ERROR=4]="ERROR",Z})(D||{}),v=((Z)=>{return Z[Z.NEVER=0]="NEVER",Z[Z.FIRST=1]="FIRST",Z[Z.LAST=2]="LAST",Z})(v||{});var u5=0,g5=()=>u5++,a=(Z,X)=>!X||!X.id?{...X,id:Z+"-"+g5()}:X;var k=a1.childLogger("rstream");class f{constructor(Z,X){this.wrapped=Z,X=a("sub",{closeIn:v.LAST,closeOut:v.LAST,cache:!0,...X}),this.parent=X.parent,this.id=X.id,this.closeIn=X.closeIn,this.closeOut=X.closeOut,this.cacheLast=X.cache,X.xform&&(this.xform=X.xform(h0()))}id;closeIn;closeOut;parent;__owner;xform;cacheLast;last=y;state=D.IDLE;subs=[];deref(){return this.last!==y?this.last:void 0}getState(){return this.state}setState(Z){this.state=Z}subscribe(Z,X={}){this.ensureState();let J;if(Z instanceof f&&!X.xform)Z.ensureState(),A0(!Z.parent,`sub '${Z.id}' already has a parent`),Z.parent=this,J=Z;else J=new f(Z,{...X,parent:this});return this.subs.push(J),this.setState(D.ACTIVE),J.setState(D.ACTIVE),this.last!=y&&J.next(this.last),J}transform(...Z){let X,J;if(b(M0(Z)))J=Z.pop(),X={error:J.error};return this.subscribe(X,a("xform",Z.length>0?{...J,xform:h(...Z)}:J))}map(Z,X){return this.transform(F(Z),X||{})}unsubscribe(Z){return Z?this.unsubscribeChild(Z):this.unsubscribeSelf()}unsubscribeSelf(){return k.debug(this.id,"unsub self"),this.parent&&this.parent.unsubscribe(this),this.state<D.UNSUBSCRIBED&&(this.state=D.UNSUBSCRIBED),this.release(),!0}unsubscribeChild(Z){k.debug(this.id,"unsub child",Z.id);const X=this.subs.indexOf(Z);if(X>=0){if(this.subs.splice(X,1),this.closeOut===v.FIRST||!this.subs.length&&this.closeOut!==v.NEVER)this.unsubscribe();return!0}return!1}next(Z){if(this.state>=D.DONE)return;this.xform?this.dispatchXform(Z):this.dispatch(Z)}done(){if(k.debug(this.id,"entering done()"),this.state>=D.DONE)return;if(this.xform){if(!this.dispatchXformDone())return}if(this.state=D.DONE,this.dispatchTo("done"))this.state<D.UNSUBSCRIBED&&this.unsubscribe();k.debug(this.id,"exiting done()")}error(Z){const X=this.wrapped,J=X&&X.error;return J&&k.debug(this.id,"attempting wrapped error handler"),J&&X.error(Z)||this.unhandledError(Z)}unhandledError(Z){return(k.parent!==C0?k:console).warn(this.id,"unhandled error:",Z),this.unsubscribe(),this.state=D.ERROR,!1}dispatchTo(Z,X){let J=this.wrapped;if(J)try{J[Z]&&J[Z](X)}catch(B){if(!this.error(B))return!1}const W=Z==="next"?this.subs:[...this.subs];for(let B=W.length;B-- >0;){J=W[B];try{J[Z]&&J[Z](X)}catch(Y){if(Z==="error"||!J.error||!J.error(Y))return this.unhandledError(Y)}}return!0}dispatch(Z){k.debug(this.id,"dispatch",Z),this.cacheLast&&(this.last=Z),this.dispatchTo("next",Z)}dispatchXform(Z){let X;try{X=this.xform[2]([],Z)}catch(J){this.error(J);return}if(this.dispatchXformVals(X))j(X)&&this.done()}dispatchXformDone(){let Z;try{Z=this.xform[1]([])}catch(X){return this.error(X)}return this.dispatchXformVals(Z)}dispatchXformVals(Z){const X=m(Z);for(let J=0,W=X.length;J<W&&this.state<D.DONE;J++)this.dispatch(X[J]);return this.state<D.ERROR}ensureState(){if(this.state>=D.DONE)Z0(`operation not allowed in state ${this.state}`)}release(){this.subs.length=0,delete this.parent,delete this.xform,delete this.last}}var G4=(Z,X)=>{const J=new j4(X);return J.next(Z),J};class j4 extends f{src;_cancel;_inited;constructor(Z,X){const[J,W]=A(Z)?[Z,X||{}]:[void 0,Z||{}];super(W.error?{error:W.error}:void 0,a("stream",W));this.src=J,this._inited=!1}subscribe(Z,X={}){const J=super.subscribe(Z,X);if(!this._inited){if(this.src)try{this._cancel=this.src(this)||(()=>{return})}catch(W){let B=this.wrapped;if(!B||!B.error||!B.error(W))this.unhandledError(W)}this._inited=!0}return J}unsubscribe(Z){const X=super.unsubscribe(Z);if(X&&(!Z||(!this.subs||!this.subs.length)&&this.closeOut!==v.NEVER))this.cancel();return X}done(){this.cancel(),super.done(),delete this.src,delete this._cancel}error(Z){if(super.error(Z))return!0;return this.cancel(),!1}cancel(){if(this._cancel){k.debug(this.id,"cancel");const Z=this._cancel;delete this._cancel,Z()}}}var T4=(Z,X)=>Z===v.FIRST||Z===v.LAST&&!X;var $1=function(Z){return Z?y0($1(),Z):J0(()=>({}),(X,[J,W])=>(X[J]=W,X))};var H1=function(Z,X){return G(X)?p(H1(Z),X):F(A(Z)?(J)=>[Z(J),J]:(J)=>[Z,J])};var C1=function(...Z){const X=f0(C1,Z);if(X)return X;const J=Z[0],W=Z[1]!==!1;return F((B)=>{const Y=W?{}:B;for(let z in B)Y[z]=J(B[z]);return Y})};var v4=(Z)=>Z;var M1=function(...Z){const X=f0(M1,Z,m0);if(X)return X;const{key:J=v4,mergeOnly:W=!1,reset:B=!0,all:Y=!0,backPressure:z=0}=Z[1],V=w(Z[0])?new Set(Z[0]):Z[0],Q=new Set,q=new Map;let U={};const K=([$,L,r])=>{let S=!0;if(W||z<1)return[$,(C)=>{if(B&&Y&&Q.size>0||!B&&S)C=r(C,U),U={},Q.clear(),S=!1;return L(C)},(C,_)=>{const E=J(_);if(V.has(E)){if(U[E]=_,Q.add(E),W||I4(V,Q))if(C=r(C,U),S=!1,B)U={},Q.clear();else U={...U}}return C}];else return[$,(C)=>{if(Y&&Q.size>0)C=r(C,b4(q,Q)),q.clear(),Q.clear();return L(C)},(C,_)=>{const E=J(_);if(V.has(E)){let N0=q.get(E);!N0&&q.set(E,N0=[]),N0.length>=z&&Z0(`max back pressure (${z}) exceeded for input: ${String(E)}`),N0.push(_),Q.add(E);while(I4(V,Q))if(C=r(C,b4(q,Q)),S=!1,j(C))break}return C}]};return K.keys=()=>V,K.clear=()=>{q.clear(),V.clear(),Q.clear(),U={}},K.add=($)=>{V.add($)},K.delete=($,L=!0)=>{if(q.delete($),V.delete($),L)Q.delete($),delete U[$]},K},I4=(Z,X)=>{if(X.size<Z.size)return!1;for(let J of Z)if(!X.has(J))return!1;return!0},b4=(Z,X)=>{const J={};for(let W of X){const B=Z.get(W);J[W]=B.shift(),!B.length&&X.delete(W)}return J};var R4=(Z,X)=>{let J=!0;for(let W of X)J=Z.removeID(W)&&J;return J};var x0=(Z)=>new E4(Z);class E4 extends f{sources;idSources;realSourceIDs;invRealSourceIDs;psync;clean;constructor(Z){const X=M1(new Set,{key:(W)=>W[0],mergeOnly:Z.mergeOnly===!0,reset:Z.reset===!0,all:Z.all!==!1,backPressure:Z.backPressure||0}),J=C1((W)=>W[1]);super(void 0,a("streamsync",{...Z,xform:Z.xform?h(X,J,Z.xform):h(X,J)}));this.sources=new Map,this.realSourceIDs=new Map,this.invRealSourceIDs=new Map,this.idSources=new Map,this.psync=X,this.clean=!!Z.clean,Z.src&&this.addAll(Z.src)}add(Z,X){X||(X=Z.id),this.ensureState(),this.psync.add(X),this.realSourceIDs.set(X,Z.id),this.invRealSourceIDs.set(Z.id,X),this.idSources.set(Z.id,Z),this.sources.set(Z,Z.subscribe({next:(J)=>J[1]instanceof f?this.add(J[1]):this.next(J),done:()=>this.markDone(Z),__owner:this},{xform:H1(X),id:`in-${X}`}))}addAll(Z){for(let X in Z)this.psync.add(X);for(let X in Z)this.add(Z[X],X)}remove(Z){const X=this.sources.get(Z);if(X){const J=this.invRealSourceIDs.get(Z.id);return k.info(`removing src: ${Z.id} (${J})`),this.psync.delete(J,this.clean),this.realSourceIDs.delete(J),this.invRealSourceIDs.delete(Z.id),this.idSources.delete(Z.id),this.sources.delete(Z),X.unsubscribe(),!0}return!1}removeID(Z){const X=this.getSourceForID(Z);return X?this.remove(X):!1}removeAll(Z){for(let J of Z)this.psync.delete(this.invRealSourceIDs.get(J.id));let X=!0;for(let J of Z)X=this.remove(J)&&X;return X}removeAllIDs(Z){return R4(this,Z)}getSourceForID(Z){return this.idSources.get(this.realSourceIDs.get(Z))}getSources(){const Z={};for(let[X,J]of this.idSources)Z[this.invRealSourceIDs.get(X)]=J;return Z}unsubscribe(Z){if(!Z){k.debug(this.id,"unsub sources");for(let X of this.sources.values())X.unsubscribe();this.sources.clear(),this.psync.clear(),this.realSourceIDs.clear(),this.invRealSourceIDs.clear(),this.idSources.clear()}return super.unsubscribe(Z)}markDone(Z){this.remove(Z),T4(this.closeIn,this.sources.size)&&this.done()}}var F1=c((Z,X=" ")=>{const J=s(String(X),Z);return(W,B)=>{if(W==null)return J;return W=W.toString(),B=B!==void 0?B:W.length,B<Z?J.substring(B)+W:W}}),XJ=F1(2,"0"),JJ=F1(3,"0"),A4=F1(4,"0");var w1=function(Z,X){return G(X)?p(w1(Z),X):(J)=>{const W=J[2];return X0(J,(B,Y)=>Z(Y)?W(B,Y):B)}};import{watch as h4} from"fs";import{resolve as t} from"path";var L4={specs:g({alias:"s",optional:!1,desc:"Path to generated JSON defs"})},n0={bundle:T({alias:"b",desc:"Bundle inputs (see `out` option)"})},Y0={include:T0({alias:"I",desc:"Include CSS files (prepend)"})},l0={eval:g({alias:"e",desc:"eval meta stylesheet in given string (ignores other inputs & includes)"})},p0={force:T0({alias:"f",hint:"STR",desc:"CSS classes to force include (wildcards are supported, @-prefix will read from file)",delim:","})},S4={media:T0({alias:"m",hint:"ID",desc:"Media query IDs (use 'ALL' for all)",delim:","})},_4={onlyDecls:T({desc:"Only emit framework decls"})},V0={out:g({alias:"o",desc:"Output file (or stdout)"})},o0={prec:b1({default:3,desc:"Number of fractional digits"})},u={pretty:T({alias:"p",desc:"Pretty print output"})},z0={noDecls:T({alias:"d",desc:"Don't emit framework decls"})},Q0={noHeader:T({desc:"Don't emit generated header comment"})},U0={watch:T({alias:"w",desc:"Watch input files for changes"})};import{watch as d5} from"fs";import{resolve as y4} from"path";var q0=(Z,X,J)=>{X=P(X)?X:X.join("\n"),Z?W1(y4(Z),X,J):process.stdout.write(X+"\n")},i0=({info:{name:Z,version:X}})=>`/*! ${Z} v${X} - generated by thi.ng/meta-css @ ${(new Date()).toISOString()} */`,P0=(Z,X)=>{const J=()=>{X.info("closing watchers..."),W.forEach((B)=>B.watcher.close())},W=Z.map((B,Y)=>{B=y4(B);const z=G4(O(B,X),{id:`in${A4(Y)}`});return{input:z,watcher:d5(B,{},(V)=>{if(V==="change")try{z.next(O(B,X))}catch(Q){X.warn(Q.message),J()}else X.warn("input removed:",B),J()})}});return process.on("SIGINT",J),x0({src:$1(F(({input:B})=>[B.id,B],W))})};async function O1(Z){const X=x(t(Z.opts.specs),Z.logger),J=o5(X,Z.opts.force||[],Z.logger);if(Z.opts.bundle)if(Z.opts.watch)await n5(Z,J);else O0(Z,X,J,Z.opts.eval?[Z.opts.eval]:Z.inputs.map((W)=>O(t(W),Z.logger)),Z.opts.out);else if(Z.opts.watch)await x5(Z,X,J);else if(Z.opts.eval)try{O0(Z,X,J,[Z.opts.eval])}catch(W){Z.logger.warn(W.message)}else for(let W of Z.inputs)try{W=t(W);const B=!Z.opts.noWrite?W.replace(/\.mcss$/,".css"):void 0;O0(Z,X,J,[O(W,Z.logger)],B)}catch(B){Z.logger.warn(B.message)}}var f4={desc:"Transpile (and optionally bundle) meta stylesheets to CSS",opts:{...n0,...l0,...z0,...p0,...Y0,...Q0,...V0,...u,...L4,...U0,noWrite:T({desc:"Don't write files, use stdout only"})},fn:O1},x5=async(Z,X,J)=>{const W=t(Z.opts.specs);let B,Y={process:()=>{try{return X=x(W,Z.logger),B.forEach((V)=>V.process()),!0}catch(V){return Z.logger.warn(V.message+": "+W),!1}},watcher:h4(W,{},(V)=>{if(V==="change")Y.process();else Z.logger.warn("specs file removed:",W),z()})};const z=()=>{Z.logger.info("closing watchers..."),Y.watcher.close(),B.forEach((V)=>V.watcher.close())};B=Z.inputs.map((V)=>{V=t(V);const Q=!Z.opts.noWrite?V.replace(/\.mcss$/,".css"):void 0,q=()=>{try{return O0(Z,X,J,[O(V,Z.logger)],Q),!0}catch(U){if(Z.logger.warn(U.message+": "+V),B)z();return!1}};if(!q())process.exit(1);return{process:q,watcher:h4(V,{},(U)=>{if(U==="change")q();else Z.logger.warn("input removed:",V),z()})}}),Z.logger.info("waiting for changes, press ctrl+c to cancel..."),process.on("SIGINT",z)},n5=async(Z,X)=>{x0({src:{styles:P0(Z.inputs,Z.logger),specs:P0([Z.opts.specs],Z.logger).map((J)=>JSON.parse(Object.values(J)[0]))}}).subscribe({next({styles:J,specs:W}){try{O0(Z,W,X,Object.keys(J).sort().map((B)=>J[B]),Z.opts.out)}catch(B){Z.logger.warn(B.message)}}})},O0=({logger:Z,opts:{include:X,noDecls:J,noHeader:W,pretty:B}},Y,z,V,Q)=>{const q={logger:Z,specs:Y,format:B?F0:n,mediaQueryIDs:new Set(Object.keys(Y.media)),mediaQueryRules:{...z.mediaQueryRules},plainRules:{...z.plainRules}},U=X?X.map((K)=>O(t(K),Z).trim()):[];if(!W)U.push(i0(Y));if(!J&&Y.decls.length)U.push(o(Y.decls,{format:q.format,fns:i}));V.forEach((K)=>i5(K,q)),p5(U,q),l5(U,q),q0(Q,U,Z)},l5=(Z,{logger:X,specs:J,format:W,mediaQueryRules:B})=>{for(let Y in B){const z=g4(B[Y],J);X.debug("mediaquery rules",Y,z),Z.push(o(B0(r5(J.media,Y),z),{format:W,fns:i}))}},p5=(Z,{logger:X,specs:J,format:W,plainRules:B})=>{const Y=g4(B,J);X.debug("plain rules",Y),Z.push(o(Y,{format:W,fns:i}))},o5=(Z,X,J)=>{const W=new Set(Object.keys(Z.media)),B=new Set(Object.keys(Z.classes)),Y={},z={};if(X.length&&X[0][0]==="@")X=[...d(O(t(X[0].substring(1)),J))];for(let V of X){if(!V||V.startsWith("//"))continue;const{token:Q,query:q}=d4(V,W);let U;if(Q.includes("*")){const K=new RegExp(`^${Q.replace("*",".*")}\$`);U=[...w1(($)=>K.test($),B)]}else if(B.has(Q))U=[Q];else{J.warn(`unknown include rule ID: ${V}, skipping...`);continue}for(let K of U)J.debug("including class:",K),q?x4(Y,q,`.${K}`,K):n4(z,`.${K}`,K)}return{mediaQueryRules:Y,plainRules:z}},i5=(Z,{specs:X,mediaQueryIDs:J,mediaQueryRules:W,plainRules:B})=>{const Y=D0(),z=D0(Y),V={root:Y,curr:z,scopes:[z]};for(let Q of d(Z)){if(!Q||/^\s*\/\//.test(Q))continue;for(let q of d(Q,/\s+/g)){if(!q)continue;let U=V.curr;switch(U.state){case"sel":case"nest":if(q==="{"){if(U.state==="sel")U.sel=U.sel.map((K)=>K.replace(",","")),U.path=a5(V.scopes);U.state="class"}else if(q==="}")m4(V);else{const K=M0(U.sel);if(!K||K.endsWith(","))U.sel.push(q);else U.sel[U.sel.length-1]+=" "+q}break;case"class":if(q==="{")U.state="nest",V.scopes.push(V.curr=D0(U));else if(q==="}")m4(V);else{let{token:K,query:$}=d4(q,J);if(!X.classes[K]&&!K.includes("="))H(`unknown class ID: ${K}`);if($)x4(W,$,U.path,K);else n4(B,U.path,K)}break;default:Z0(U.state)}}}},P1=":",u4="///",D0=(Z)=>({state:"sel",sel:Z?[]:["<root>"],path:"",parent:Z}),m4=(Z)=>{const X=!Z.curr.sel.length;if(A0(!!Z.curr.parent,"stack underflow"),Z.scopes.pop(),Z.scopes.length>0){if(Z.curr=M0(Z.scopes),!X&&Z.curr.state==="nest")Z.scopes.push(Z.curr=D0(Z.curr))}else Z.scopes.push(Z.curr=D0(Z.root))},a5=(Z)=>Z.map((X)=>X.sel.join(",")).join(u4),g4=(Z,X)=>Object.entries(Z).map(([J,W])=>t5(J,W,X)),t5=(Z,X,J)=>{const W=[];let B=W;const Y=Z.split(u4);for(let z=0;z<Y.length;z++){const V=Y[z].split(",");if(z==Y.length-1){const Q=Object.assign({},...F((q)=>c5(J,q),X));if("__user"in Q)delete Q.__user;V.push(Q)}B.push(V),B=V}return W[0]},d4=(Z,X)=>{if(/^::?/.test(Z))return{token:Z};const J=Z.lastIndexOf(P1);if(J<0)return{token:Z};const W=Z.substring(0,J);if(!W.split(P1).every((Y)=>X.has(Y)))H(`invalid media query in token: ${Z}`);return{token:Z.substring(J+1),query:W}},r5=(Z,X)=>X.split(P1).reduce((J,W)=>Object.assign(J,Z[W]),{}),x4=(Z,X,J,W)=>{if(!Z[X])Z[X]={};(Z[X][J]||(Z[X][J]=new Set)).add(W)},n4=(Z,X,J)=>(Z[X]||(Z[X]=new Set)).add(J),c5=(Z,X)=>{const J=X.indexOf("=");return J>0?{[`--${X.substring(0,J)}`]:X.substring(J+1)}:Z.classes[X]};async function D1(Z){if(Z.opts.watch)await e5(Z);else await o4(Z.inputs.map((X)=>O(X,Z.logger)),Z.opts,Z.logger)}var l4={deg:O4,em:U4,ex:q4,ms:w4,percent:K1,px:$4,rad:D4,rem:K4,second:P4,turn:k4,url:N4,vh:H4,vmax:F4,vmin:M4,vw:C4,"%":K1},s5={"":[""],a:[""],h:["-left","-right"],v:["-top","-bottom"],t:["-top"],top:["top"],b:["-bottom"],bottom:["bottom"],r:["-right"],right:["right"],l:["-left"],left:["left"],x:["-x"],y:["-y"]},p4={desc:"Generate framework rules from specs",opts:{...V0,...o0,...u,...U0},fn:D1},e5=async(Z)=>{P0(Z.inputs,Z.logger).subscribe({next(X){try{o4(Object.keys(X).sort().map((J)=>X[J]),Z.opts,Z.logger)}catch(J){Z.logger.warn(J.message)}}})},o4=async(Z,X,J)=>{const W={info:{name:"TODO",version:"0.0.0"},media:{},classes:{},decls:[]};Q4(X.prec);for(let B of Z){const Y=JSON.parse(B);if(Object.assign(W.info,Y.info),Object.assign(W.media,Y.media),Y.decls)W.decls.push(...Y.decls);for(let z of Y.specs)Z8(Y,z,W.classes,J)}return q0(X.out,JSON.stringify(W,null,X.pretty?4:0),J),W},Z8=(Z,X,J,W)=>{const B=w(X.vars)?X.vars:[""],Y=P(X.props)?{[X.props]:"<v>"}:X.props,z=X8(X,Z),V=new Set;for(let Q of B)for(let[q,U]of u0(Z.vars?.[Q]||s5[Q],Object.keys(z))){const K=k0(X.name,Q,q,U,z[U]),$=X.unit?k0(X.unit,Q,q,U,z[U]):void 0,L=J8(z[U],$);if(!J[K])J[K]=X.user!=null?{__user:k0(X.user,Q,q,U,z[U])}:{};else if(!V.has(K))H(`duplicate class ID: ${K}`);V.add(K);for(let[r,S]of Object.entries(Y)){const C=k0(r,Q,q,U,z[U]),_=k0(!$||P(S)?String(S):l4[$](S),Q,q,U,L);J[K][C]=_,W.debug(K,C,_)}}return J},X8=(Z,X)=>{const J=P(Z.values)?X.tables?.[Z.values]||H(`invalid table ID: ${Z.values}`):Z.values;if(b(J))return J;const W=Z.key==="v"?(B)=>String(B):Z.key==="i+1"?(B,Y)=>String(Y+1):Z.key===void 0?(B,Y)=>String(Y):H(`invalid key type: ${Z.key}`);return J.reduce((B,Y,z)=>{return B[W(Y,z)]=Y,B},{})},J8=(Z,X)=>{if(!X||P(Z))return Z;const J=l4[X];if(!J)H(`invalid unit: ${X}`);return J(Z)},k0=(Z,X,J,W,B)=>Z.replace("<vid>",X).replace("<var>",J).replace("<k>",W).replace("<v>",String(B));var i4={desc:"Combination of the generate & convert commands",opts:{...n0,...l0,...p0,...Y0,...z0,...Q0,...o0,...u,...U0,outCss:g({desc:"Output file for CSS bundle",optional:!1}),outSpecs:g({desc:"Output file for framework",optional:!1})},fn:async(Z)=>{const{opts:X,inputs:J}=Z,[W,B]=J.reduce((V,Q)=>(V[Q.endsWith(".json")?0:1].push(Q),V),[[],[]]),Y={inputs:W,format:Z.format,logger:Z.logger,opts:{...X,out:X.outSpecs}},z={inputs:B,format:Z.format,logger:Z.logger,opts:{...X,noWrite:!1,out:X.outCss,specs:X.outSpecs}};await D1(Y),await O1(z)}};import{resolve as a4} from"path";var r4={desc:"Export entire generated framework as CSS",opts:{...Y0,...z0,..._4,...V0,...u,...Q0,...S4},inputs:1,fn:async(Z)=>{const{logger:X,opts:{include:J,media:W,noDecls:B,noHeader:Y,onlyDecls:z,pretty:V,out:Q},inputs:q}=Z,U=x(a4(q[0]),X),K=J?J.map(($)=>O(a4($),X).trim()):[];if(!Y)K.push(i0(U));if(!B&&U.decls.length)K.push(o(U.decls,{format:V?F0:n,fns:i}));if(!z)K.push(W8(U,W,V,X));q0(Q,K,X)}},W8=(Z,X,J,W)=>{const B=t4("",Z);if(X){const Y=X[0]==="ALL"?Object.keys(Z.media):X;for(let z of Y)if(Z.media[z])B.push(B0(Z.media[z],t4("-"+z,Z)));else W.warn(`invalid media query ID: ${z}, skipping...`)}return o(B,{format:J?F0:n,fns:i})},t4=(Z,X)=>Object.entries(X.classes).map(([J,W])=>[`.${J}${Z}`,B8(W)]),B8=(Z)=>{if("__user"in Z)Z={...Z},delete Z.__user;return Z};var k1=x(Y8(import.meta.dir,"package.json"));p1({name:"metacss",opts:{verbose:T({alias:"v",desc:"Display extra process information"})},commands:{convert:f4,develop:i4,export:r4,generate:p4},ctx:async(Z)=>{if(Z.opts.verbose)Z.logger.level=M.DEBUG;return{...Z,format:R0}},usage:{prefix:`
|
|
2
|
+
var r1={default:95,hint:90,multi:90,param:96,required:33};var c1=(Z)=>Z;var s=function(Z,X){return!X&&(X={}),(...J)=>{const W=JSON.stringify(J);if(W!==void 0)return W in X?X[W]:X[W]=Z.apply(null,J);return Z.apply(null,J)}};var e=s((Z,X)=>Z.repeat(X));var T0=(Z)=>/^[a-f0-9]+$/i.test(Z);var b0=(Z)=>/^[-+]?\d+$/.test(Z),I0=(Z)=>/^[-+]?\d*\.?\d+(e[-+]?\d+)?$/i.test(Z);var S=(Z,X=(J)=>J!==void 0?": "+J:"")=>class extends Error{origMessage;constructor(J){super(Z(J)+X(J));this.origMessage=J!==void 0?String(J):""}};var B5=S(()=>"illegal argument(s)"),$=(Z)=>{throw new B5(Z)};var s1=(Z)=>I0(Z)?parseFloat(Z):$(`not a numeric value: ${Z}`),R0=(Z)=>Z.map(s1),e1=(Z)=>T0(Z)?parseInt(Z,16):$(`not a hex value: ${Z}`),S0=(Z)=>Z.map(e1),Z0=(Z)=>b0(Z)?parseInt(Z):$(`not an integer: ${Z}`),E0=(Z)=>Z.map(Z0);var G1=(Z,X)=>(J)=>({coerce:Z,hint:X,group:"main",...J}),k1=(Z,X)=>(J)=>({hint:Y5(X,J.delim),multi:!0,coerce:Z,group:"main",...J}),Y5=(Z,X)=>Z+(X?`[${X}..]`:""),I=(Z)=>({flag:!0,default:!1,group:"flags",...Z}),x=G1(c1,"STR"),T1=k1(c1,"STR"),u8=G1(s1,"NUM"),g8=G1(e1,"HEX"),L0=G1(Z0,"INT"),d8=k1(R0,"NUM"),x8=k1(S0,"HEX"),n8=k1(E0,"INT");var w=((Z)=>{return Z[Z.FINE=0]="FINE",Z[Z.DEBUG=1]="DEBUG",Z[Z.INFO=2]="INFO",Z[Z.WARN=3]="WARN",Z[Z.SEVERE=4]="SEVERE",Z[Z.NONE=5]="NONE",Z})(w||{});var z5=0;class $1{constructor(Z,X=w.FINE,J){this.parent=J,this.id=Z||`logger-${z5++}`,this.level=typeof X==="string"?w[X]:X}id;level;addChild(Z){return Z.parent=this,Z}enabled(Z){return this.level<=Z}fine(...Z){this.log(w.FINE,Z)}debug(...Z){this.log(w.DEBUG,Z)}info(...Z){this.log(w.INFO,Z)}warn(...Z){this.log(w.WARN,Z)}severe(...Z){this.log(w.SEVERE,Z)}log(Z,X){this.level<=Z&&this.logEntry([Z,this.id,Date.now(),...X])}}var A0=(Z)=>Z.map((X)=>{if(typeof X==="function")X=X();if(!(typeof X==="string"||typeof X==="number"))X=JSON.stringify(X);return X}).join(" ");class b1 extends $1{constructor(Z,X,J,W){super(X,J,W);this.target=Z}childLogger(Z,X){return new b1(this.target,Z,X??this.level,this)}logEntry(Z){if(Z[0]<this.level)return;this.target.write(`[${w[Z[0]]}] ${Z[1]}: ${A0(Z.slice(3))}
|
|
3
|
+
`),this.parent&&this.parent.logEntry(Z)}}var I1=s((Z,X=" ")=>{const J=e(String(X),Z);return(W,B)=>{if(W==null)return J;return W=W.toString(),B=B!==void 0?B:W.length,B<Z?W+J.substring(B):W}});var v0=(Z,X)=>{return!X&&(X=new Map),(J)=>{let W;return X.has(J)?X.get(J):(X.set(J,W=Z(J)),W)}};var X0={black:1,blue:5,cyan:7,gray:17,green:3,magenta:6,red:2,white:24,yellow:4,lightBlue:21,lightCyan:23,lightGray:8,lightGreen:19,lightMagenta:22,lightRed:18,lightYellow:20,bgBlack:32,bgBlue:160,bgCyan:224,bgGray:544,bgGreen:96,bgMagenta:192,bgRed:64,bgWhite:768,bgYellow:128,bgLightBlue:672,bgLightCyan:736,bgLightGray:256,bgLightGreen:608,bgLightMagenta:704,bgLightRed:576,bgLightYellow:640};var Q5=(Z,X)=>(J)=>Z.format(X,J),J0=(Z)=>Object.keys(X0).reduce((X,J)=>(X[J]=Q5(Z,X0[J]),X),{format:Z});var _0="\x1B[0m";var U5=["","1","2","1;2","4","1;4","2;4","1;2;4"],R1={format:(Z,X)=>R1.start(Z)+X+R1.end,start:v0((Z)=>{let X=[],J=Z&15;return J&&X.push(29+(Z>>4&1)*60+J),J=Z>>5&15,J&&X.push(39+(Z>>9&1)*60+J),J=Z>>10,J&&X.push(U5[J]),"\x1B["+X.join(";")+"m"}),end:_0,prefix:_0,suffix:"\n"};var y0={format:(Z,X)=>String(X),prefix:"",suffix:"\n",start:()=>"",end:""};var S1=J0(R1),h0=J0(y0);var O=Array.isArray;var V5=(Z)=>Z.toUpperCase(),m0=(Z)=>Z.toLowerCase(),f0=(Z)=>Z.length?Z[0].toUpperCase()+Z.substring(1):Z,u0=(Z,X="-")=>m0(Z.replace(/([a-z0-9\u00e0-\u00fd])([A-Z\u00c0-\u00dd])/g,(J,W,B)=>W+X+B));var g0=(Z,X="-")=>m0(Z).replace(new RegExp(`\\${X}+(\\w)`,"g"),(J,W)=>V5(W));var d0=Object.getPrototypeOf,E=(Z)=>{let X;return Z!=null&&typeof Z==="object"&&((X=d0(Z))===null||d0(X)===null)};var q5=/\x1b\[[0-9;]+m/g,K5=(Z)=>Z.replace(q5,"");var E1=(Z)=>K5(Z).length;var x0=(Z=!1,X)=>(J)=>Z||typeof J!=="string"&&typeof J!=="number"?JSON.stringify(J,null,X):String(J);function*Z1(Z,X=/\r?\n/g,J=!1){let W=0;const B=Z.length,Y=~~J;let Q;if(typeof X==="string")Q=new RegExp(X,"g");else if(!X.flags.includes("g"))Q=new RegExp(X,X.flags+"g");else Q=X;for(;W<B;){const z=Q.exec(Z);if(!z){yield Z.substring(W);return}const U=z[0].length;yield Z.substring(W,z.index+Y*U),W=z.index+U}}class W0{n=0;w=[];constructor(Z,X){Z!=null&&this.add(Z,X)}add(Z,X=Z.length){return this.w.push(Z),this.n+=X+~~(this.n>0),this}toString(){return this.w.join(" ")}}var H5={length:(Z)=>Z.length,split:(Z,X)=>X},l0={length:E1,split:(Z,X)=>{const J=/\x1b\[[0-9;]+m/g;let W=X,B;while(B=J.exec(Z)){if(B.index>=X)break;const Y=B[0].length;W+=Y,X+=Y}return W}},n0=(Z,X,J,W)=>{const B=Z[Z.length-1];B&&W-B.n>J?B.add(X,J):Z.push(new W0(X,J))},$5=(Z,{width:X,min:J,hard:W,splitter:B},Y=0,Q=[])=>{let z=B.length(Z),U=X-Y;if(U<J&&U<z)U=X;while(W&&z>U){const V=B.split(Z,U),q=Z.substring(0,V);n0(Q,q,U,X),Z=Z.substring(V),U=X,z=B.length(Z)}return n0(Q,Z,z,X),Q},C5=(Z,X,J=[])=>{if(!Z.length)return J.push(new W0),J;const W={width:80,min:4,hard:!1,splitter:H5,...X};for(let B of Z1(Z,X.delimWord||/\s/g)){const Y=J[J.length-1];$5(B,W,Y&&Y.n>0?Y.n+1:0,J)}return J},p0=(Z,X)=>{let J=[];for(let W of Z1(Z,X.delimLine))J=J.concat(C5(W,X));return J};var C1=(Z,X={})=>{X={lineWidth:80,paramWidth:32,showDefaults:!0,prefix:"",suffix:"",groups:["flags","main"],...X};const J=E(X.color)?{...r1,...X.color}:X.color?r1:{},W=e(" ",X.paramWidth),B=(z)=>z.map((U)=>M5(U,Z[U],X,J,W)),Y=Object.keys(Z).sort(),Q=X.groups?X.groups.map((z)=>[z,Y.filter((U)=>Z[U].group===z)]).filter((z)=>!!z[1].length):[["options",Y]];return[...B0(X.prefix,X.lineWidth),...Q.map(([z,U])=>[...X.showGroupNames?[`${f0(z)}:
|
|
4
|
+
`]:[],...B(U),""].join("\n")),...B0(X.suffix,X.lineWidth)].join("\n")},M5=(Z,X,J,W,B)=>{const Y=F5(X,W),Q=w5(X,W,Y),z=M1(`--${u0(Z)}`,W.param),U=`${Q}${z}${Y}`,V=X.optional===!1&&X.default===void 0,q=[];V&&q.push("required"),X.multi&&q.push("multiple");const K=P5(q,W,V)+(X.desc||"")+O5(X,J,W);return I1(J.paramWidth)(U,E1(U))+B0(K,J.lineWidth-J.paramWidth).map((H,F)=>F>0?B+H:H).join("\n")},F5=(Z,X)=>Z.hint?M1(" "+Z.hint,X.hint):"",w5=(Z,X,J)=>Z.alias?`${M1("-"+Z.alias,X.param)}${J}, `:"",P5=(Z,X,J)=>Z.length?M1(`[${Z.join(", ")}] `,J?X.required:X.multi):"",O5=(Z,X,J)=>X.showDefaults&&Z.default!=null&&Z.default!==!1?M1(` (default: ${x0(!0)(Z.defaultHint!=null?Z.defaultHint:Z.default)})`,J.default):"",M1=(Z,X)=>X!=null?`\x1B[${X}m${Z}\x1B[0m`:Z,B0=(Z,X)=>Z?p0(Z,{width:X,splitter:l0,hard:!1}):[];var N5=S(()=>"parse error"),o0=(Z,X,J)=>{J={start:2,showUsage:!0,help:["--help","-h"],...J};try{return D5(Z,X,J)}catch(W){if(J.showUsage)console.log(W.message+"\n\n"+C1(Z,J.usageOpts));throw new N5(W.message)}},D5=(Z,X,J)=>{const W=j5(Z),B={};let Y,Q,z=J.start;for(;z<X.length;){const U=X[z];if(!Y){if(J.help.includes(U)){console.log(C1(Z,J.usageOpts));return}const V=G5(Z,W,B,U);if(Y=V.id,Q=V.spec,z=z+~~(V.state<2),V.state)break}else{if(k5(Q,B,Y,U))break;Y=null,z++}}return Y&&$(`missing value for: --${Y}`),{result:T5(Z,B),index:z,rest:X.slice(z),done:z>=X.length}},j5=(Z)=>Object.entries(Z).reduce((X,[J,W])=>W.alias?(X[W.alias]=J,X):X,{}),G5=(Z,X,J,W)=>{if(W[0]==="-"){let B;if(W[1]==="-"){if(W==="--")return{state:1};B=g0(W.substring(2))}else B=X[W.substring(1)],!B&&$(`unknown option: ${W}`);const Y=Z[B];if(!Y&&$(B),Y.flag){if(J[B]=!0,B=void 0,Y.fn&&!Y.fn("true"))return{state:1,spec:Y}}return{state:0,id:B,spec:Y}}return{state:2}},k5=(Z,X,J,W)=>{if(/^-[a-z]/i.test(W)&&$(`missing value for: --${J}`),Z.multi)O(X[J])?X[J].push(W):X[J]=[W];else X[J]=W;return Z.fn&&!Z.fn(W)},T5=(Z,X)=>{let J;for(let W in Z)if(J=Z[W],X[W]===void 0){if(J.default!==void 0)X[W]=J.default;else if(J.optional===!1)$(`missing arg: --${W}`)}else if(J.coerce)b5(J,X,W);return X},b5=(Z,X,J)=>{try{if(Z.multi&&Z.delim)X[J]=X[J].reduce((W,B)=>(W.push(...B.split(Z.delim)),W),[]);X[J]=Z.coerce(X[J])}catch(W){throw new Error(`arg --${J}: ${W.message}`)}};var a0=async(Z)=>{const X=Z.argv||process.argv,J=!process.env.NO_COLOR,W={prefix:"",color:J,...Z.usage};try{let B,Y,Q=Z.start??2;if(Z.single){if(B=Object.keys(Z.commands)[0],!B)$("no command provided");Y=Z.commands[B]}else{if(B=X[Q],Y=Z.commands[B],W.prefix+=I5(Z.commands),!Y)i0(Z,W);Q++}let z;try{z=o0({...Z.opts,...Y.opts},X,{showUsage:!0,usageOpts:W,start:Q})}catch(V){}if(!z)process.exit(1);if(Y.inputs!==void 0&&Y.inputs!==z.rest.length)process.stderr.write(`expected ${Y.inputs||0} input(s)
|
|
5
|
+
`),i0(Z,W);const U=await Z.ctx({logger:new b1(process.stderr,Z.name,"INFO"),format:J?S1:h0,opts:z.result,inputs:z.rest},Y);if(await Y.fn(U),Z.post)await Z.post(U,Y)}catch(B){process.stderr.write(B.message+"\n\n"),process.exit(1)}},i0=(Z,X)=>{process.stderr.write(C1(Z.opts,X)),process.exit(1)},I5=(Z)=>["\nAvailable commands:\n",...Object.keys(Z).map((X)=>`${I1(16)(X)}: ${Z[X].desc}`),"\n"].join("\n");import{existsSync as R5,mkdirSync as S5,statSync as pZ} from"fs";import{dirname as E5} from"path";var L5=(Z)=>Z.length>0&&!R5(Z)?(S5(Z,{recursive:!0}),!0):!1,t0=(Z)=>L5(E5(Z));var v=(Z)=>typeof Z==="function";var M=(Z)=>typeof Z==="string";import{readFileSync as v5} from"fs";import{writeFileSync as A5} from"fs";var r0=(Z,X,J,W,B=!1)=>{if(W&&W.info(`${B?"[dryrun] ":""}writing file: ${Z}`),B)return;t0(Z),A5(Z,X,!J&&M(X)?"utf-8":J)};var N=(Z,X,J="utf-8")=>{return X&&X.debug("reading file:",Z),v5(Z,J)},Y0=(Z,X,J,W=!1)=>r0(Z,O(X)?X.join("\n"):X,"utf-8",J,W);var n=(Z,X)=>JSON.parse(N(Z,X));var y=Symbol(),z0=()=>{};var F1=Object.freeze({level:w.NONE,addChild(Z){return Z},childLogger:()=>F1,enabled:()=>!1,fine(){},debug(){},info(){},warn(){},severe(){},logEntry(){}});class Q0 extends $1{set(Z){this.parent=Z}childLogger(Z,X){return new Q0(Z,X??this.level,this)}logEntry(Z){this.parent.logEntry(Z)}}var c0=new Q0("root",w.FINE,F1);import{join as w8} from"path";var _5=S(()=>"Assertion failed"),L1=(typeof process!=="undefined"&&process.env!==void 0?!0:import.meta.env?import.meta.env.MODE!=="production"||!!import.meta.env.UMBRELLA_ASSERTS||!!import.meta.env.VITE_UMBRELLA_ASSERTS:!0)?(Z,X)=>{if(typeof Z==="function"&&!Z()||!Z)throw new _5(typeof X==="function"?X():X)}:()=>{};var A1=(Z)=>Z!=null&&typeof Z!=="function"&&Z.length!==void 0;var s0=(Z)=>{return(Z==null||!Z[Symbol.iterator])&&$(`value is not iterable: ${Z}`),Z};var e0=(Z)=>A1(Z)?Z:[...s0(Z)];var w1=(Z)=>Z[Z.length-1];var y5=S(()=>"illegal arity"),X1=(Z)=>{throw new y5(Z)};var h5=S(()=>"illegal state"),J1=(Z)=>{throw new h5(Z)};var v1=(Z,X)=>Z!=null&&typeof Z[X]==="function";var T=(Z)=>Z!=null&&typeof Z[Symbol.iterator]==="function";var _1=(Z)=>Z!=null&&typeof Z!=="string"&&typeof Z[Symbol.iterator]==="function";var Z4=["-moz-","-ms-","-o-","-webkit-"],l={rules:"",ruleSep:",",valSep:"",decls:"",declStart:"{",declEnd:"}",indent:"",comments:!1},P1={rules:"\n",ruleSep:", ",valSep:" ",decls:"\n",declStart:" {\n",declEnd:"}\n",indent:" ",comments:!0};var U0=function(...Z){let[X,J,W,B,Y,Q,z,U,V,q]=Z;switch(Z.length){case 0:X1(0);case 1:return X;case 2:return(...H)=>X(J(...H));case 3:return(...H)=>X(J(W(...H)));case 4:return(...H)=>X(J(W(B(...H))));case 5:return(...H)=>X(J(W(B(Y(...H)))));case 6:return(...H)=>X(J(W(B(Y(Q(...H))))));case 7:return(...H)=>X(J(W(B(Y(Q(z(...H)))))));case 8:return(...H)=>X(J(W(B(Y(Q(z(U(...H))))))));case 9:return(...H)=>X(J(W(B(Y(Q(z(U(V(...H)))))))));case 10:default:const K=(...H)=>X(J(W(B(Y(Q(z(U(V(q(...H))))))))));return Z.length===10?K:U0(K,...Z.slice(10))}};var p=(Z)=>v1(Z,"xform")?Z.xform():Z;var h=function(...Z){return Z=Z.map(p),U0.apply(null,Z)};var W1=(Z,X)=>[Z[0],Z[1],X];class V0{value;constructor(Z){this.value=Z}deref(){return this.value}}var b=(Z)=>Z instanceof V0;var m=(Z)=>Z instanceof V0?Z.deref():Z;var y1=function(...Z){const X=Z[0],J=X[0],W=X[1],B=X[2];Z=m5(Z);const Y=Z[0]==null?J():Z[0],Q=Z[1];return m(W(v1(Q,"$reduce")?Q.$reduce(B,Y):A1(Q)?f5(B,Y,Q):u5(B,Y,Q)))};var m5=(Z)=>Z.length===2?[void 0,Z[1]]:Z.length===3?[Z[1],Z[2]]:X1(Z.length),f5=(Z,X,J)=>{for(let W=0,B=J.length;W<B;W++)if(X=Z(X,J[W]),b(X)){X=X.deref();break}return X},u5=(Z,X,J)=>{for(let W of J)if(X=Z(X,W),b(X)){X=X.deref();break}return X},B1=(Z,X)=>[Z,(J)=>J,X];var h1=function(Z){return Z?[...Z]:B1(()=>[],(X,J)=>(X.push(J),X))};function*m1(Z,X){const J=p(Z)(h1()),W=J[1],B=J[2];for(let Y of X){const Q=B([],Y);if(b(Q)){yield*m(W(Q.deref()));return}if(Q.length)yield*Q}yield*m(W([]))}function*o(Z,X){const J=p(Z)([z0,z0,(W,B)=>B])[2];for(let W of X){let B=J(y,W);if(b(B)){if(B=m(B.deref()),B!==y)yield B;return}if(B!==y)yield B}}var f1=(Z,X,J=o)=>{const W=X.length-1;return T(X[W])?X.length>1?J(Z.apply(null,X.slice(0,W)),X[W]):J(Z(),X[0]):void 0};var q0=function(Z,X){return T(X)?m1(q0(Z),M(X)?[X]:X):(J)=>{const W=J[2],B=(Y,Q)=>{const z=Z(Q);if(z){for(let U of z)if(Y=B(Y,U),b(Y))break;return Y}return W(Y,Q)};return W1(J,B)}};var X4=function(Z){return q0((X)=>_1(X)?X:void 0,Z)};var P=function(Z,X){return T(X)?o(P(Z),X):(J)=>{const W=J[2];return W1(J,(B,Y)=>W(B,Z(Y)))}};function*u1(...Z){const X=Z.length-1;if(X<0)return;const J=new Array(X+1).fill(0),W=Z.map(e0),B=W.reduce((Y,Q)=>Y*Q.length,1);for(let Y=0;Y<B;Y++){const Q=[];for(let z=X;z>=0;z--){const U=W[z];let V=J[z];if(V===U.length)J[z]=V=0,z>0&&J[z-1]++;Q[z]=U[V]}J[X]++,yield Q}}function*J4(Z,X=Infinity){while(X-- >0)yield Z}var K0=function(Z,X){Z=Z||"";let J=!0;return X?[...X].join(Z):B1(()=>"",(W,B)=>(W=J?W+B:W+Z+B,J=!1,W))};var g1=function(...Z){return g5(g1,y1,Z)};var g5=(Z,X,J)=>{let W,B;switch(J.length){case 4:B=J[3],W=J[2];break;case 3:B=J[2];break;case 2:return P((Y)=>Z(J[0],J[1],Y));default:X1(J.length)}return X(p(J[0])(J[1]),W,B)};var d5=new Set,x5=":[",W4=h(X4(),P((Z)=>x5.indexOf(Z.charAt(0))>=0?Z:" "+Z)),n5=(Z,X)=>h(Z,P((J)=>M(J)&&J.indexOf(" .")==0?J+X:J)),Y1=(Z,X,J,W)=>{const B=J.length,Y=[];let Q,z;const U=(V,q)=>{let K=null;if(O(q))Y1(Z,H0(X,Y),q,W);else if(T(q)&&!M(q))Y1(Z,H0(X,Y),[...q],W);else if((z=v(q))||(K=W.fns[q]))if(!X.length){if(K)return K.apply(null,J.slice(V+1))(Z,W),!0;q(Z,W)}else if(z)U(V,q());else $(`quoted fn ('${q}') only allowed at head position`);else if(E(q))Q=Object.assign(Q||{},q);else if(q!=null)Y.push(q)};for(let V=0;V<B;V++)if(U(V,J[V]))return Z;return Q&&Z.push(l5(X,Y,Q,W)),Z},H0=(Z,X)=>Z.length?[...u1(Z,X)]:X,l5=(Z,X,J,W)=>{const B=W.format,Y=L(W),Q=W.scope?n5(W4,W.scope):W4;return[Y,g1(P((z)=>g1(Q,K0(),O(z)?z:[z]).trim()),K0(B.ruleSep),H0(Z,X)),B.declStart,O1(J,W),Y,B.declEnd].join("")},O1=(Z,X)=>{const J=X.format,W=X.autoprefix||d5,B=L(X,X.depth+1),Y=[];for(let Q in Z)if(Z.hasOwnProperty(Q)){let z=Z[Q];if(v(z))z=z(Z);if(O(z))z=z.map((U)=>O(U)?U.join(" "):U).join(J.ruleSep);if(W.has(Q))for(let U of X.vendors)Y.push(`${B}${U}${Q}:${J.valSep}${z};`);Y.push(`${B}${Q}:${J.valSep}${z};`)}return Y.join(J.decls)+J.decls},L=(Z,X=Z.depth)=>X>1?[...J4(Z.format.indent,X)].join(""):X>0?Z.format.indent:"";var B4=function(Z,...X){const J=X.length===1?X[0]:X.reduce((W,B,Y)=>{return W[Y/(X.length-1)*100|0]=B,W},{});return(W,B)=>{const Y=L(B);B.depth++;const Q=L(B);W.push(`${Y}@keyframes ${Z}${B.format.declStart}`);for(let z in J)if(J.hasOwnProperty(z))W.push([Q,z+"%",B.format.declStart,O1(J[z],B),Q,B.format.declEnd].join(""));return B.depth--,W.push(Y+B.format.declEnd),W}};var Y4=(Z,X=!1)=>(J,W)=>{const B=L(W),Y=L(W,W.depth+1);if(W.format.comments||X)J.push(B+"/*",Z.split("\n").map((Q)=>Y+Q).join("\n"),B+"*/");return J};var d1=(Z,X,J)=>(W,B)=>{const Y=L(B);return W.push(`${Y}${Z} ${p5(X)}${B.format.declStart}`),B.depth++,Y1(W,[],J,B),B.depth--,W.push(Y+B.format.declEnd),W},p5=(Z)=>{if(M(Z))return Z;const X=[];for(let J in Z)if(Z.hasOwnProperty(J)){let W=Z[J];if(W===!0)W=z4.has(J)?J:`(${J})`;else if(W===!1)W=`(not ${z4.has(J)?J:`(${J})`})`;else if(W==="only")W+=" "+J;else W=`(${J}:${W})`;X.push(W)}return X.join(" and ")},z4=new Set(["all","print","screen"]);var i=(Z,X)=>{return X={format:l,vendors:Z4,fns:{},depth:0,...X},O(X.autoprefix)&&(X.autoprefix=new Set(X.autoprefix)),E(Z)?O1(Z,X):v(Z)?Z([],X).join(X.format.rules):Y1([],[],O(Z)?Z:_1(Z)?[...Z]:$("invalid rules"),X).join(X.format.rules)};var Q4=(Z,...X)=>(J,W)=>(J.push(X.length?`@import url(${Z}) ${X.join(W.format.ruleSep)};`:`@import url(${Z});`),J);var z1=(Z,X)=>d1("@media",Z,X);var U4=function(...Z){return(X,J)=>(X.push(Z.length>1?`@namespace ${Z[0]} url(${Z[1]});`:`@namespace url(${Z[0]});`),X)};var V4=(Z,X)=>d1("@supports",Z,X);var a={"@comment":Y4,"@import":Q4,"@keyframes":B4,"@media":z1,"@namespace":U4,"@supports":V4};var q4=4,K4=(Z)=>q4=Z,k=(Z)=>Z===(Z|0)?String(Z):Z.toFixed(q4).replace(/^0./,".").replace(/^-0./,"-.").replace(/0+$/,"");var H4=(Z)=>`${k(Z)}em`,$4=(Z)=>`${k(Z)}ex`;var C4=(Z)=>`${k(Z)}rem`,$0=(Z)=>`${k(Z)}%`,M4=(Z)=>`${k(Z)}px`,F4=(Z)=>`${k(Z)}vh`,w4=(Z)=>`${k(Z)}vw`,P4=(Z)=>`${k(Z)}vmin`,O4=(Z)=>`${k(Z)}vmax`,N4=(Z)=>`${Z|0}ms`,D4=(Z)=>`${k(Z)}s`;var j4=(Z)=>`${k(Z)}deg`,G4=(Z)=>`${k(Z)}rad`,k4=(Z)=>`${k(Z)}turn`,T4=(Z)=>`url(${Z})`;var D=((Z)=>{return Z[Z.IDLE=0]="IDLE",Z[Z.ACTIVE=1]="ACTIVE",Z[Z.DONE=2]="DONE",Z[Z.UNSUBSCRIBED=3]="UNSUBSCRIBED",Z[Z.ERROR=4]="ERROR",Z})(D||{}),R=((Z)=>{return Z[Z.NEVER=0]="NEVER",Z[Z.FIRST=1]="FIRST",Z[Z.LAST=2]="LAST",Z})(R||{});var o5=0,i5=()=>o5++,t=(Z,X)=>!X||!X.id?{...X,id:Z+"-"+i5()}:X;var j=c0.childLogger("rstream");class f{constructor(Z,X){this.wrapped=Z,X=t("sub",{closeIn:R.LAST,closeOut:R.LAST,cache:!0,...X}),this.parent=X.parent,this.id=X.id,this.closeIn=X.closeIn,this.closeOut=X.closeOut,this.cacheLast=X.cache,X.xform&&(this.xform=X.xform(h1()))}id;closeIn;closeOut;parent;__owner;xform;cacheLast;last=y;state=D.IDLE;subs=[];deref(){return this.last!==y?this.last:void 0}getState(){return this.state}setState(Z){this.state=Z}subscribe(Z,X={}){this.ensureState();let J;if(Z instanceof f&&!X.xform)Z.ensureState(),L1(!Z.parent,`sub '${Z.id}' already has a parent`),Z.parent=this,J=Z;else J=new f(Z,{...X,parent:this});return this.subs.push(J),this.setState(D.ACTIVE),J.setState(D.ACTIVE),this.last!=y&&J.next(this.last),J}transform(...Z){let X,J;if(E(w1(Z)))J=Z.pop(),X={error:J.error};return this.subscribe(X,t("xform",Z.length>0?{...J,xform:h(...Z)}:J))}map(Z,X){return this.transform(P(Z),X||{})}unsubscribe(Z){return Z?this.unsubscribeChild(Z):this.unsubscribeSelf()}unsubscribeSelf(){return j.debug(this.id,"unsub self"),this.parent&&this.parent.unsubscribe(this),this.state<D.UNSUBSCRIBED&&(this.state=D.UNSUBSCRIBED),this.release(),!0}unsubscribeChild(Z){j.debug(this.id,"unsub child",Z.id);const X=this.subs.indexOf(Z);if(X>=0){if(this.subs.splice(X,1),this.closeOut===R.FIRST||!this.subs.length&&this.closeOut!==R.NEVER)this.unsubscribe();return!0}return!1}next(Z){if(this.state>=D.DONE)return;this.xform?this.dispatchXform(Z):this.dispatch(Z)}done(){if(j.debug(this.id,"entering done()"),this.state>=D.DONE)return;if(this.xform){if(!this.dispatchXformDone())return}if(this.state=D.DONE,this.dispatchTo("done"))this.state<D.UNSUBSCRIBED&&this.unsubscribe();j.debug(this.id,"exiting done()")}error(Z){const X=this.wrapped,J=X&&X.error;return J&&j.debug(this.id,"attempting wrapped error handler"),J&&X.error(Z)||this.unhandledError(Z)}unhandledError(Z){return(j.parent!==F1?j:console).warn(this.id,"unhandled error:",Z),this.unsubscribe(),this.state=D.ERROR,!1}dispatchTo(Z,X){let J=this.wrapped;if(J)try{J[Z]&&J[Z](X)}catch(B){if(!this.error(B))return!1}const W=Z==="next"?this.subs:[...this.subs];for(let B=W.length;B-- >0;){J=W[B];try{J[Z]&&J[Z](X)}catch(Y){if(Z==="error"||!J.error||!J.error(Y))return this.unhandledError(Y)}}return!0}dispatch(Z){j.debug(this.id,"dispatch",Z),this.cacheLast&&(this.last=Z),this.dispatchTo("next",Z)}dispatchXform(Z){let X;try{X=this.xform[2]([],Z)}catch(J){this.error(J);return}if(this.dispatchXformVals(X))b(X)&&this.done()}dispatchXformDone(){let Z;try{Z=this.xform[1]([])}catch(X){return this.error(X)}return this.dispatchXformVals(Z)}dispatchXformVals(Z){const X=m(Z);for(let J=0,W=X.length;J<W&&this.state<D.DONE;J++)this.dispatch(X[J]);return this.state<D.ERROR}ensureState(){if(this.state>=D.DONE)J1(`operation not allowed in state ${this.state}`)}release(){this.subs.length=0,delete this.parent,delete this.xform,delete this.last}}var b4=(Z,X)=>{const J=new I4(X);return J.next(Z),J};class I4 extends f{src;_cancel;_inited;constructor(Z,X){const[J,W]=v(Z)?[Z,X||{}]:[void 0,Z||{}];super(W.error?{error:W.error}:void 0,t("stream",W));this.src=J,this._inited=!1}subscribe(Z,X={}){const J=super.subscribe(Z,X);if(!this._inited){if(this.src)try{this._cancel=this.src(this)||(()=>{return})}catch(W){let B=this.wrapped;if(!B||!B.error||!B.error(W))this.unhandledError(W)}this._inited=!0}return J}unsubscribe(Z){const X=super.unsubscribe(Z);if(X&&(!Z||(!this.subs||!this.subs.length)&&this.closeOut!==R.NEVER))this.cancel();return X}done(){this.cancel(),super.done(),delete this.src,delete this._cancel}error(Z){if(super.error(Z))return!0;return this.cancel(),!1}cancel(){if(this._cancel){j.debug(this.id,"cancel");const Z=this._cancel;delete this._cancel,Z()}}}var R4=(Z,X)=>Z===R.FIRST||Z===R.LAST&&!X;var C0=function(Z){return Z?y1(C0(),Z):B1(()=>({}),(X,[J,W])=>(X[J]=W,X))};var M0=function(Z,X){return T(X)?o(M0(Z),X):P(v(Z)?(J)=>[Z(J),J]:(J)=>[Z,J])};var F0=function(...Z){const X=f1(F0,Z);if(X)return X;const J=Z[0],W=Z[1]!==!1;return P((B)=>{const Y=W?{}:B;for(let Q in B)Y[Q]=J(B[Q]);return Y})};var S4=(Z)=>Z;var w0=function(...Z){const X=f1(w0,Z,m1);if(X)return X;const{key:J=S4,mergeOnly:W=!1,reset:B=!0,all:Y=!0,backPressure:Q=0}=Z[1],z=O(Z[0])?new Set(Z[0]):Z[0],U=new Set,V=new Map;let q={};const K=([H,F,A])=>{let g=!0;if(W||Q<1)return[H,(C)=>{if(B&&Y&&U.size>0||!B&&g)C=A(C,q),q={},U.clear(),g=!1;return F(C)},(C,d)=>{const G=J(d);if(z.has(G)){if(q[G]=d,U.add(G),W||E4(z,U))if(C=A(C,q),g=!1,B)q={},U.clear();else q={...q}}return C}];else return[H,(C)=>{if(Y&&U.size>0)C=A(C,L4(V,U)),V.clear(),U.clear();return F(C)},(C,d)=>{const G=J(d);if(z.has(G)){let _=V.get(G);!_&&V.set(G,_=[]),_.length>=Q&&J1(`max back pressure (${Q}) exceeded for input: ${String(G)}`),_.push(d),U.add(G);while(E4(z,U))if(C=A(C,L4(V,U)),g=!1,b(C))break}return C}]};return K.keys=()=>z,K.clear=()=>{V.clear(),z.clear(),U.clear(),q={}},K.add=(H)=>{z.add(H)},K.delete=(H,F=!0)=>{if(V.delete(H),z.delete(H),F)U.delete(H),delete q[H]},K},E4=(Z,X)=>{if(X.size<Z.size)return!1;for(let J of Z)if(!X.has(J))return!1;return!0},L4=(Z,X)=>{const J={};for(let W of X){const B=Z.get(W);J[W]=B.shift(),!B.length&&X.delete(W)}return J};var A4=(Z,X)=>{let J=!0;for(let W of X)J=Z.removeID(W)&&J;return J};var x1=(Z)=>new v4(Z);class v4 extends f{sources;idSources;realSourceIDs;invRealSourceIDs;psync;clean;constructor(Z){const X=w0(new Set,{key:(W)=>W[0],mergeOnly:Z.mergeOnly===!0,reset:Z.reset===!0,all:Z.all!==!1,backPressure:Z.backPressure||0}),J=F0((W)=>W[1]);super(void 0,t("streamsync",{...Z,xform:Z.xform?h(X,J,Z.xform):h(X,J)}));this.sources=new Map,this.realSourceIDs=new Map,this.invRealSourceIDs=new Map,this.idSources=new Map,this.psync=X,this.clean=!!Z.clean,Z.src&&this.addAll(Z.src)}add(Z,X){X||(X=Z.id),this.ensureState(),this.psync.add(X),this.realSourceIDs.set(X,Z.id),this.invRealSourceIDs.set(Z.id,X),this.idSources.set(Z.id,Z),this.sources.set(Z,Z.subscribe({next:(J)=>J[1]instanceof f?this.add(J[1]):this.next(J),done:()=>this.markDone(Z),__owner:this},{xform:M0(X),id:`in-${X}`}))}addAll(Z){for(let X in Z)this.psync.add(X);for(let X in Z)this.add(Z[X],X)}remove(Z){const X=this.sources.get(Z);if(X){const J=this.invRealSourceIDs.get(Z.id);return j.info(`removing src: ${Z.id} (${J})`),this.psync.delete(J,this.clean),this.realSourceIDs.delete(J),this.invRealSourceIDs.delete(Z.id),this.idSources.delete(Z.id),this.sources.delete(Z),X.unsubscribe(),!0}return!1}removeID(Z){const X=this.getSourceForID(Z);return X?this.remove(X):!1}removeAll(Z){for(let J of Z)this.psync.delete(this.invRealSourceIDs.get(J.id));let X=!0;for(let J of Z)X=this.remove(J)&&X;return X}removeAllIDs(Z){return A4(this,Z)}getSourceForID(Z){return this.idSources.get(this.realSourceIDs.get(Z))}getSources(){const Z={};for(let[X,J]of this.idSources)Z[this.invRealSourceIDs.get(X)]=J;return Z}unsubscribe(Z){if(!Z){j.debug(this.id,"unsub sources");for(let X of this.sources.values())X.unsubscribe();this.sources.clear(),this.psync.clear(),this.realSourceIDs.clear(),this.invRealSourceIDs.clear(),this.idSources.clear()}return super.unsubscribe(Z)}markDone(Z){this.remove(Z),R4(this.closeIn,this.sources.size)&&this.done()}}var P0=s((Z,X=" ")=>{const J=e(String(X),Z);return(W,B)=>{if(W==null)return J;return W=W.toString(),B=B!==void 0?B:W.length,B<Z?J.substring(B)+W:W}}),$J=P0(2,"0"),CJ=P0(3,"0"),_4=P0(4,"0");var a5=/\{(\d+)\}/g;var O0=(Z,...X)=>X.length>0?Z.replace(a5,(J,W)=>String(X[parseInt(W,10)])):Z;var N0=function(Z,X){return T(X)?o(N0(Z),X):(J)=>{const W=J[2];return W1(J,(B,Y)=>Z(Y)?W(B,Y):B)}};import{watch as u4} from"fs";import{resolve as r} from"path";var y4={specs:x({alias:"s",optional:!1,desc:"Path to generated JSON defs"})},n1={bundle:I({alias:"b",desc:"Bundle inputs (see `out` option)"})},Q1={include:T1({alias:"I",desc:"Include CSS files (prepend)"})},l1={eval:x({alias:"e",desc:"eval meta stylesheet in given string (ignores other inputs & includes)"})},p1={force:T1({alias:"f",hint:"STR",desc:"CSS classes to force include (wildcards are supported, @-prefix will read from file)",delim:","})},h4={media:T1({alias:"m",hint:"ID",desc:"Media query IDs (use 'ALL' for all)",delim:","})},m4={onlyDecls:I({desc:"Only emit framework decls"})},U1={out:x({alias:"o",desc:"Output file (or stdout)"})},o1={prec:L0({default:3,desc:"Number of fractional digits"})},u={pretty:I({alias:"p",desc:"Pretty print output"})},V1={noDecls:I({alias:"d",desc:"Don't emit framework decls"})},q1={noHeader:I({desc:"Don't emit generated header comment"})},K1={watch:I({alias:"w",desc:"Watch input files for changes"})};import{watch as t5} from"fs";import{resolve as f4} from"path";var H1=(Z,X,J)=>{X=M(X)?X:X.join("\n"),Z?Y0(f4(Z),X,J):process.stdout.write(X+"\n")},i1=({info:{name:Z,version:X}})=>`/*! ${Z} v${X} - generated by thi.ng/meta-css @ ${(new Date()).toISOString()} */`,N1=(Z,X)=>{const J=()=>{X.info("closing watchers..."),W.forEach((B)=>B.watcher.close())},W=Z.map((B,Y)=>{B=f4(B);const Q=b4(N(B,X),{id:`in${_4(Y)}`});return{input:Q,watcher:t5(B,{},(z)=>{if(z==="change")try{Q.next(N(B,X))}catch(U){X.warn(U.message),J()}else X.warn("input removed:",B),J()})}});return process.on("SIGINT",J),x1({src:C0(P(({input:B})=>[B.id,B],W))})},a1=(Z)=>Object.keys(Z).reduce((X,J)=>{if(!J.startsWith("__"))X[J]=Z[J];return X},{});async function j0(Z){const X=n(r(Z.opts.specs),Z.logger),J=Z8(X,Z.opts.force||[],Z.logger);if(Z.opts.bundle)if(Z.opts.watch)await c5(Z,J);else D1(Z,X,J,Z.opts.eval?[Z.opts.eval]:Z.inputs.map((W)=>N(r(W),Z.logger)),Z.opts.out);else if(Z.opts.watch)await r5(Z,X,J);else if(Z.opts.eval)try{D1(Z,X,J,[Z.opts.eval])}catch(W){Z.logger.warn(W.message)}else for(let W of Z.inputs)try{W=r(W);const B=!Z.opts.noWrite?W.replace(/\.mcss$/,".css"):void 0;D1(Z,X,J,[N(W,Z.logger)],B)}catch(B){Z.logger.warn(B.message)}}function*J8(Z){let X=-1,J=Z.length,W=0;for(let B=0;B<J;B++){const Y=Z[B];if(Y===" "||Y==="\t"){if(!W&&X>=0)yield Z.substring(X,B),X=-1}else if(Y==="{"||Y==="}"){if(X>=0)yield Z.substring(X,B);yield Y,X=-1}else if(Y==="(")W++;else if(Y===")"){if(--W<0)$(`invalid nesting in line: '${Z}'`)}else if(X<0)X=B}if(W)$("template calls must be fully on a single line");if(X>=0)yield Z.substring(X,J)}var d4={desc:"Transpile (and optionally bundle) meta stylesheets to CSS",opts:{...n1,...l1,...V1,...p1,...Q1,...q1,...U1,...u,...y4,...K1,noWrite:I({desc:"Don't write files, use stdout only"})},fn:j0},r5=async(Z,X,J)=>{const W=r(Z.opts.specs);let B,Y={process:()=>{try{return X=n(W,Z.logger),B.forEach((z)=>z.process()),!0}catch(z){return Z.logger.warn(z.message+": "+W),!1}},watcher:u4(W,{},(z)=>{if(z==="change")Y.process();else Z.logger.warn("specs file removed:",W),Q()})};const Q=()=>{Z.logger.info("closing watchers..."),Y.watcher.close(),B.forEach((z)=>z.watcher.close())};B=Z.inputs.map((z)=>{z=r(z);const U=!Z.opts.noWrite?z.replace(/\.mcss$/,".css"):void 0,V=()=>{try{return D1(Z,X,J,[N(z,Z.logger)],U),!0}catch(q){if(Z.logger.warn(q.message+": "+z),B)Q();return!1}};if(!V())process.exit(1);return{process:V,watcher:u4(z,{},(q)=>{if(q==="change")V();else Z.logger.warn("input removed:",z),Q()})}}),Z.logger.info("waiting for changes, press ctrl+c to cancel..."),process.on("SIGINT",Q)},c5=async(Z,X)=>{x1({src:{styles:N1(Z.inputs,Z.logger),specs:N1([Z.opts.specs],Z.logger).map((J)=>JSON.parse(Object.values(J)[0]))}}).subscribe({next({styles:J,specs:W}){try{D1(Z,W,X,Object.keys(J).sort().map((B)=>J[B]),Z.opts.out)}catch(B){Z.logger.warn(B.message)}}})},D1=({logger:Z,opts:{include:X,noDecls:J,noHeader:W,pretty:B}},Y,Q,z,U)=>{const V={logger:Z,specs:Y,format:B?P1:l,mediaQueryIDs:new Set(Object.keys(Y.media)),mediaQueryRules:{...Q.mediaQueryRules},plainRules:{...Q.plainRules}},q=X?X.map((K)=>N(r(K),Z).trim()):[];if(!W)q.push(i1(Y));if(!J&&Y.decls.length)q.push(i(Y.decls,{format:V.format,fns:a}));z.forEach((K)=>X8(K,V)),e5(q,V),s5(q,V),H1(U,q,Z)},s5=(Z,{logger:X,specs:J,format:W,mediaQueryRules:B})=>{for(let Y in B){const Q=n4(B[Y],J);X.debug("mediaquery rules",Y,Q),Z.push(i(z1(Y8(J.media,Y),Q),{format:W,fns:a}))}},e5=(Z,{logger:X,specs:J,format:W,plainRules:B})=>{const Y=n4(B,J);X.debug("plain rules",Y),Z.push(i(Y,{format:W,fns:a}))},Z8=(Z,X,J)=>{const W=new Set(Object.keys(Z.media)),B=new Set(Object.keys(Z.classes)),Y={},Q={};if(X.length&&X[0][0]==="@")X=[...Z1(N(r(X[0].substring(1)),J))];for(let z of X){if(!z||z.startsWith("//"))continue;const{token:U,query:V}=l4(z,W);let q;if(U.includes("*")){const K=new RegExp(`^${U.replace("*",".*")}\$`);q=[...N0((H)=>K.test(H),B)]}else if(B.has(U))q=[U];else{J.warn(`unknown include rule ID: ${z}, skipping...`);continue}for(let K of q)J.debug("including class:",K),V?p4(Y,V,`.${K}`,K):o4(Q,`.${K}`,K)}return{mediaQueryRules:Y,plainRules:Q}},X8=(Z,{specs:X,mediaQueryIDs:J,mediaQueryRules:W,plainRules:B})=>{const Y=j1(),Q=j1(Y),z={root:Y,curr:Q,scopes:[Q]};for(let U of Z1(Z)){if(!U||/^\s*\/\//.test(U))continue;for(let V of J8(U)){if(!V)continue;let q=z.curr;switch(q.state){case"sel":case"nest":if(V==="{"){if(q.state==="sel")q.sel=q.sel.map((K)=>K.replace(",","")),q.path=W8(z.scopes);q.state="class"}else if(V==="}")g4(z);else{const K=w1(q.sel);if(!K||K.endsWith(","))q.sel.push(V);else q.sel[q.sel.length-1]+=" "+V}break;case"class":if(V==="{")q.state="nest",z.scopes.push(z.curr=j1(q));else if(V==="}")g4(z);else{let{token:K,query:H}=l4(V,J);if(!X.classes[K]&&!(i4(K)||a4(K)))$(`unknown class ID: ${K}`);if(H)p4(W,H,q.path,K);else o4(B,q.path,K)}break;default:J1(q.state)}}}},D0=":",x4="///",j1=(Z)=>({state:"sel",sel:Z?[]:["<root>"],path:"",parent:Z}),g4=(Z)=>{const X=!Z.curr.sel.length;if(L1(!!Z.curr.parent,"stack underflow"),Z.scopes.pop(),Z.scopes.length>0){if(Z.curr=w1(Z.scopes),!X&&Z.curr.state==="nest")Z.scopes.push(Z.curr=j1(Z.curr))}else Z.scopes.push(Z.curr=j1(Z.root))},W8=(Z)=>Z.map((X)=>X.sel.join(",")).join(x4),n4=(Z,X)=>Object.entries(Z).map(([J,W])=>B8(J,W,X)),B8=(Z,X,J)=>{const W=[];let B=W;const Y=Z.split(x4);for(let Q=0;Q<Y.length;Q++){const z=Y[Q].split(",");if(Q==Y.length-1){const U=Object.assign({},...P((V)=>a4(V)?Q8(J,V):i4(V)?z8(V):a1(J.classes[V]),X));z.push(U)}B.push(z),B=z}return W[0]},l4=(Z,X)=>{if(/^::?/.test(Z))return{token:Z};const J=Z.lastIndexOf(D0);if(J<0)return{token:Z};const W=Z.substring(0,J);if(!W.split(D0).every((Y)=>X.has(Y)))$(`invalid media query in token: ${Z}`);return{token:Z.substring(J+1),query:W}},Y8=(Z,X)=>X.split(D0).reduce((J,W)=>Object.assign(J,Z[W]),{}),p4=(Z,X,J,W)=>{if(!Z[X])Z[X]={};(Z[X][J]||(Z[X][J]=new Set)).add(W)},o4=(Z,X,J)=>(Z[X]||(Z[X]=new Set)).add(J),z8=(Z)=>{const X=Z.indexOf("=");return{[`--${Z.substring(0,X)}`]:Z.substring(X+1)}},Q8=(Z,X)=>{const J=X.indexOf("("),W=X.substring(0,J),B=X.substring(J+1,X.length-1).split(/(?<!\\),/g).map((Q)=>Q.trim().replace("\\,",",")),Y=Z.templates[W];if(B.length!==Y.__arity)$(`template "${W}" expected ${Y.__arity} arguments`);return Object.entries(Y).reduce((Q,[z,U])=>{if(!z.startsWith("__")){if(z=O0(z,...B),M(U))U=O0(U,...B);Q[z]=U}return Q},{})},i4=(Z)=>Z.includes("="),a4=(Z)=>Z.includes("(");async function G0(Z){if(Z.opts.watch)await q8(Z);else await s4(Z.inputs.map((X)=>N(X,Z.logger)),Z.opts,Z.logger)}var r4={deg:j4,em:H4,ex:$4,ms:N4,percent:$0,px:M4,rad:G4,rem:C4,second:D4,turn:k4,url:T4,vh:F4,vmax:O4,vmin:P4,vw:w4,"%":$0},U8={percent:(Z)=>`${Z}%`,second:(Z)=>`${Z}s`,url:(Z)=>`url(${Z})`},V8={"":[""],a:[""],h:["-left","-right"],v:["-top","-bottom"],t:["-top"],top:["top"],b:["-bottom"],bottom:["bottom"],r:["-right"],right:["right"],l:["-left"],left:["left"],x:["-x"],y:["-y"],in:[""],out:[""]},c4={desc:"Generate framework rules from specs",opts:{...U1,...o1,...u,...K1},fn:G0},q8=async(Z)=>{N1(Z.inputs,Z.logger).subscribe({next(X){try{s4(Object.keys(X).sort().map((J)=>X[J]),Z.opts,Z.logger)}catch(J){Z.logger.warn(J.message)}}})},s4=async(Z,X,J)=>{const W={info:{name:"TODO",version:"0.0.0"},media:{},classes:{},templates:{},decls:[]};K4(X.prec);for(let B of Z){const Y=JSON.parse(B);if(Object.assign(W.info,Y.info),Object.assign(W.media,Y.media),Y.decls)W.decls.push(...Y.decls);if(Y.specs)for(let Q of Y.specs)try{e4(Y,Q,W.classes,J)}catch(z){J.warn(`error processing spec: ${Q.name}`,z,", skipping...")}if(Y.templates)for(let Q of Y.templates)K8(Y,Q,W.templates,J)}return H1(X.out,JSON.stringify(W,null,X.pretty?4:0),J),W},e4=(Z,X,J,W,B=!1)=>{const Y=O(X.vars)?X.vars:[""],Q=M(X.props)?{[X.props]:"<v>"}:X.props,z=H8(X,Z),U=new Set;for(let V of Y){const q=Z.vars?.[V]||V8[V];if(!q)$(`unknown variation ID: ${V}`);for(let[K,H]of u1(q,Object.keys(z))){const F=c(X.name,V,K,H,z[H]),A=X.unit?c(X.unit,V,K,H,z[H]):void 0,g=B?C8(A):$8(z[H],A);if(!J[F]){if(J[F]={},X.user!=null)J[F].__user=X.user;if(X.doc!=null)J[F].__doc=M8(X.doc,V,K,H,g)}else if(!U.has(F))$(`duplicate class ID: ${F}`);U.add(F);let C=-1;for(let[d,G]of Object.entries(Q)){const _=c(d,V,K,H,z[H]),t1=c(!A||M(G)?String(G):r4[A](G),V,K,H,g);if(J[F][_]=t1,W.debug(F,_,t1),B)C=t4(t1,t4(_,C))}if(B)J[F].__arity=C+1}}return J},K8=(Z,X,J,W)=>e4(Z,{...X,values:[""]},J,W,!0),t4=(Z,X)=>{const J=/\{(\d+)\}/g;let W;while(W=J.exec(Z))X=Math.max(X,+W[1]);return X},H8=(Z,X)=>{const J=M(Z.values)?X.tables?.[Z.values]||$(`invalid table ID: ${Z.values}`):Z.values;if(E(J))return J;const W=Z.key==="v"?(B)=>String(B):Z.key==="i+1"?(B,Y)=>String(Y+1):Z.key===void 0?(B,Y)=>String(Y):$(`invalid key type: ${Z.key}`);return J.reduce((B,Y,Q)=>{return B[W(Y,Q)]=Y,B},{})},$8=(Z,X)=>{if(!X||M(Z))return Z;const J=r4[X];if(!J)$(`invalid unit: ${X}`);return J(Z)},C8=(Z)=>"{0}"+(Z?U8[Z]||Z:""),c=(Z,X,J,W,B)=>Z.replace(/<vid>/g,X).replace(/<var>/g,J).replace(/<k>/g,W).replace(/<v>/g,String(B)),M8=({group:Z,desc:X,args:J},W,B,Y,Q)=>({group:Z?c(Z,W,B,Y,Q):"TODO",desc:X?c(X,W,B,Y,Q):void 0,args:J?J.map((z)=>c(z,W,B,Y,Q)):void 0});var Z5={desc:"Combination of the generate & convert commands",opts:{...n1,...l1,...p1,...Q1,...V1,...q1,...o1,...u,...K1,outCss:x({desc:"Output file for CSS bundle",optional:!1}),outSpecs:x({desc:"Output file for framework",optional:!1})},fn:async(Z)=>{const{opts:X,inputs:J}=Z,[W,B]=J.reduce((z,U)=>(z[U.endsWith(".json")?0:1].push(U),z),[[],[]]),Y={inputs:W,format:Z.format,logger:Z.logger,opts:{...X,out:X.outSpecs}},Q={inputs:B,format:Z.format,logger:Z.logger,opts:{...X,noWrite:!1,out:X.outCss,specs:X.outSpecs}};await G0(Y),await j0(Q)}};import{resolve as X5} from"path";var W5={desc:"Export entire generated framework as CSS",opts:{...Q1,...V1,...m4,...U1,...u,...q1,...h4},inputs:1,fn:async(Z)=>{const{logger:X,opts:{include:J,media:W,noDecls:B,noHeader:Y,onlyDecls:Q,pretty:z,out:U},inputs:V}=Z,q=n(X5(V[0]),X),K=J?J.map((H)=>N(X5(H),X).trim()):[];if(!Y)K.push(i1(q));if(!B&&q.decls.length)K.push(i(q.decls,{format:z?P1:l,fns:a}));if(!Q)K.push(F8(q,W,z,X));H1(U,K,X)}},F8=(Z,X,J,W)=>{const B=J5("",Z);if(X){const Y=X[0]==="ALL"?Object.keys(Z.media):X;for(let Q of Y)if(Z.media[Q])B.push(z1(Z.media[Q],J5("-"+Q,Z)));else W.warn(`invalid media query ID: ${Q}, skipping...`)}return i(B,{format:J?P1:l,fns:a})},J5=(Z,X)=>Object.entries(X.classes).map(([J,W])=>[`.${J}${Z}`,a1(W)]);var k0=n(w8(import.meta.dir,"package.json"));a0({name:"metacss",opts:{verbose:I({alias:"v",desc:"Display extra process information"})},commands:{convert:d4,develop:Z5,export:W5,generate:c4},ctx:async(Z)=>{if(Z.opts.verbose)Z.logger.level=w.DEBUG;return{...Z,format:S1}},usage:{prefix:`
|
|
6
6
|
\u2588 \u2588 \u2588 \u2502
|
|
7
7
|
\u2588\u2588 \u2588 \u2502
|
|
8
|
-
\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2502 ${
|
|
9
|
-
\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2502 ${
|
|
8
|
+
\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2502 ${k0.name} ${k0.version}
|
|
9
|
+
\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2502 ${k0.description}
|
|
10
10
|
\u2588 \u2502
|
|
11
11
|
\u2588 \u2588 \u2502
|
|
12
12
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/meta-css",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Data-driven CSS framework codegen, transpiler & bundler",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -40,17 +40,17 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@thi.ng/api": "^8.9.30",
|
|
43
|
-
"@thi.ng/args": "^2.3.
|
|
44
|
-
"@thi.ng/arrays": "^2.8.
|
|
43
|
+
"@thi.ng/args": "^2.3.24",
|
|
44
|
+
"@thi.ng/arrays": "^2.8.9",
|
|
45
45
|
"@thi.ng/checks": "^3.5.3",
|
|
46
|
-
"@thi.ng/errors": "^2.5.
|
|
47
|
-
"@thi.ng/file-io": "^1.3.
|
|
48
|
-
"@thi.ng/hiccup-css": "^2.6.
|
|
46
|
+
"@thi.ng/errors": "^2.5.1",
|
|
47
|
+
"@thi.ng/file-io": "^1.3.9",
|
|
48
|
+
"@thi.ng/hiccup-css": "^2.6.12",
|
|
49
49
|
"@thi.ng/logger": "^3.0.6",
|
|
50
|
-
"@thi.ng/rstream": "^8.3.
|
|
51
|
-
"@thi.ng/strings": "^3.7.
|
|
50
|
+
"@thi.ng/rstream": "^8.3.14",
|
|
51
|
+
"@thi.ng/strings": "^3.7.24",
|
|
52
52
|
"@thi.ng/text-format": "^2.1.8",
|
|
53
|
-
"@thi.ng/transducers": "^8.9.
|
|
53
|
+
"@thi.ng/transducers": "^8.9.13"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@microsoft/api-extractor": "^7.42.3",
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
"status": "alpha",
|
|
108
108
|
"year": 2023
|
|
109
109
|
},
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "bc0f3cb07d6f1cab6dbdc5ff57428f5484e711bb\n"
|
|
111
111
|
}
|
package/specs/_info.mcss.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"info": {
|
|
3
3
|
"name": "MetaCSS base",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0"
|
|
5
5
|
},
|
|
6
6
|
"media": {
|
|
7
7
|
"ns": { "min-width": "30rem" },
|
|
@@ -20,7 +20,9 @@
|
|
|
20
20
|
},
|
|
21
21
|
"noanim": {
|
|
22
22
|
"prefers-reduced-motion": true
|
|
23
|
+
},
|
|
24
|
+
"contrast": {
|
|
25
|
+
"forced-colors": true
|
|
23
26
|
}
|
|
24
|
-
}
|
|
25
|
-
"specs": []
|
|
27
|
+
}
|
|
26
28
|
}
|
package/specs/a11y.mcss.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"specs": [
|
|
3
3
|
{
|
|
4
|
-
"
|
|
4
|
+
"doc": { "group": "accessibility" },
|
|
5
5
|
"name": "screen-reader",
|
|
6
6
|
"props": {
|
|
7
7
|
"position": "absolute",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"values": [""]
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
"
|
|
19
|
+
"doc": { "group": "accessibility" },
|
|
20
20
|
"name": "screen-reader-focus",
|
|
21
21
|
"props": {
|
|
22
22
|
"position": "static",
|
package/specs/anim.mcss.json
CHANGED
|
@@ -1,44 +1,109 @@
|
|
|
1
1
|
{
|
|
2
2
|
"decls": [
|
|
3
|
-
["@keyframes", "
|
|
4
|
-
["@keyframes", "
|
|
5
|
-
["@keyframes", "spin", { "rotate": 0 }, { "rotate": "1turn" }]
|
|
3
|
+
["@keyframes", "fade-in", { "opacity": 0 }, { "opacity": 1 }],
|
|
4
|
+
["@keyframes", "fade-out", { "opacity": 1 }, { "opacity": 0 }],
|
|
5
|
+
["@keyframes", "spin", { "rotate": 0 }, { "rotate": "1turn" }],
|
|
6
|
+
[
|
|
7
|
+
"@keyframes",
|
|
8
|
+
"shrink",
|
|
9
|
+
{ "height": "var(--mcss-shrink-size)" },
|
|
10
|
+
{ "height": 0 }
|
|
11
|
+
]
|
|
6
12
|
],
|
|
7
|
-
"vars": {
|
|
8
|
-
"in": [""],
|
|
9
|
-
"out": [""]
|
|
10
|
-
},
|
|
11
13
|
"specs": [
|
|
12
14
|
{
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
"
|
|
15
|
+
"doc": {
|
|
16
|
+
"group": "animation / transition",
|
|
17
|
+
"desc": "direction"
|
|
18
|
+
},
|
|
19
|
+
"name": "anim-<v>",
|
|
20
|
+
"props": "animation-direction",
|
|
21
|
+
"values": ["normal", "reverse", "alternate", "alternate-reverse"]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"doc": { "group": "animation / transition" },
|
|
25
|
+
"name": "anim-<k>",
|
|
26
|
+
"props": "animation-play-state",
|
|
27
|
+
"values": { "pause": "paused", "play": "running" }
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"doc": {
|
|
31
|
+
"group": "animation / transition",
|
|
32
|
+
"desc": "timing function"
|
|
33
|
+
},
|
|
34
|
+
"name": "anim-<v>",
|
|
35
|
+
"props": "animation-timing-function",
|
|
36
|
+
"values": ["ease", "ease-in", "ease-out", "ease-in-out", "linear"]
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"templates": [
|
|
40
|
+
{
|
|
41
|
+
"doc": {
|
|
42
|
+
"group": "animation / transition",
|
|
43
|
+
"args": ["duration: in seconds"],
|
|
44
|
+
"desc": "Animation to change opacity"
|
|
45
|
+
},
|
|
46
|
+
"name": "fade-<vid>",
|
|
47
|
+
"props": { "animation": "fade-<vid> {0}s ease-in-out forwards" },
|
|
19
48
|
"vars": ["in", "out"]
|
|
20
49
|
},
|
|
21
50
|
{
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
51
|
+
"doc": {
|
|
52
|
+
"group": "animation / transition",
|
|
53
|
+
"args": ["duration: in seconds"],
|
|
54
|
+
"desc": "Transition to tween background color"
|
|
55
|
+
},
|
|
56
|
+
"name": "bg-anim",
|
|
57
|
+
"props": { "transition": "{0}s background-color ease-in-out" }
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"doc": {
|
|
61
|
+
"group": "animation / transition",
|
|
62
|
+
"args": ["duration: in seconds"],
|
|
63
|
+
"desc": "Animation which rotates element a full turn, looping indefinitely"
|
|
64
|
+
},
|
|
65
|
+
"name": "spin",
|
|
66
|
+
"props": { "animation": "spin {0}s linear infinite" }
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"doc": {
|
|
70
|
+
"group": "animation / transition",
|
|
71
|
+
"args": [
|
|
72
|
+
"duration: in seconds",
|
|
73
|
+
"height: initial height (incl. units)"
|
|
74
|
+
],
|
|
75
|
+
"desc": "Animation which shrinks the height from given initial value to zero. Target element must NOT have padding (use a wrapper if necessary)."
|
|
76
|
+
},
|
|
77
|
+
"name": "shrink",
|
|
78
|
+
"props": {
|
|
79
|
+
"--mcss-shrink-size": "{1}",
|
|
80
|
+
"animation": "shrink {0}s ease-out forwards"
|
|
81
|
+
}
|
|
28
82
|
},
|
|
29
83
|
{
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
84
|
+
"doc": {
|
|
85
|
+
"group": "animation / transition",
|
|
86
|
+
"args": ["delay: time (in seconds)"]
|
|
87
|
+
},
|
|
88
|
+
"name": "anim-delay",
|
|
89
|
+
"props": "animation-delay",
|
|
35
90
|
"unit": "second"
|
|
36
91
|
},
|
|
37
92
|
{
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
93
|
+
"doc": {
|
|
94
|
+
"group": "animation / transition",
|
|
95
|
+
"args": ["steps: number of steps"]
|
|
96
|
+
},
|
|
97
|
+
"name": "anim-steps",
|
|
98
|
+
"props": { "animation-timing-function": "steps({0})" }
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"doc": {
|
|
102
|
+
"group": "animation / transition",
|
|
103
|
+
"args": ["iter: number of iterations"]
|
|
104
|
+
},
|
|
105
|
+
"name": "anim-iter",
|
|
106
|
+
"props": "animation-iteration-count"
|
|
42
107
|
}
|
|
43
108
|
]
|
|
44
109
|
}
|
package/specs/aspect.mcss.json
CHANGED
|
@@ -1,48 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"specs": [
|
|
3
3
|
{
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"values": {
|
|
8
|
-
"1x1": "1/1",
|
|
9
|
-
"1x2": "1/2",
|
|
10
|
-
"2x1": "2/1",
|
|
11
|
-
"2x3": "2/3",
|
|
12
|
-
"3x2": "3/2",
|
|
13
|
-
"3x4": "3/4",
|
|
14
|
-
"4x3": "4/3",
|
|
15
|
-
"5x7": "5/7",
|
|
16
|
-
"7x5": "7/5",
|
|
17
|
-
"9x16": "9/16",
|
|
18
|
-
"16x9": "16/9"
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"user": "aspect ratios",
|
|
23
|
-
"name": "bg-aspect-ratio-<k>",
|
|
24
|
-
"props": {
|
|
25
|
-
"height": 0,
|
|
26
|
-
"position": "relative",
|
|
27
|
-
"padding-bottom": "<v>"
|
|
28
|
-
},
|
|
29
|
-
"values": {
|
|
30
|
-
"1x1": 100,
|
|
31
|
-
"1x2": 200,
|
|
32
|
-
"2x1": 50,
|
|
33
|
-
"2x3": 150,
|
|
34
|
-
"3x2": 66.6666,
|
|
35
|
-
"3x4": 133.3333,
|
|
36
|
-
"4x3": 75,
|
|
37
|
-
"5x7": 140,
|
|
38
|
-
"7x5": 71.4286,
|
|
39
|
-
"9x16": 177.7777,
|
|
40
|
-
"16x9": 56.25
|
|
4
|
+
"doc": {
|
|
5
|
+
"group": "aspect ratios",
|
|
6
|
+
"desc": "To be used on the element forming the background of a `bg-aspect-ratio()` parent/wrapper"
|
|
41
7
|
},
|
|
42
|
-
"unit": "%"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"user": "aspect ratios",
|
|
46
8
|
"name": "bg-aspect-ratio-object",
|
|
47
9
|
"props": {
|
|
48
10
|
"position": "absolute",
|
|
@@ -56,5 +18,29 @@
|
|
|
56
18
|
},
|
|
57
19
|
"values": [""]
|
|
58
20
|
}
|
|
21
|
+
],
|
|
22
|
+
"templates": [
|
|
23
|
+
{
|
|
24
|
+
"doc": {
|
|
25
|
+
"group": "aspect ratios",
|
|
26
|
+
"desc": "Sets `aspect-ratio` CSS property",
|
|
27
|
+
"args": ["width: aspect width", "height: aspect height"]
|
|
28
|
+
},
|
|
29
|
+
"name": "aspect-ratio",
|
|
30
|
+
"props": { "aspect-ratio": "{0}/{1}" }
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"doc": {
|
|
34
|
+
"group": "aspect ratios",
|
|
35
|
+
"desc": "Sets aspect ratio of background. Use with `bg-aspect-ratio-object` on child element.",
|
|
36
|
+
"args": ["width: aspect width", "height: aspect height"]
|
|
37
|
+
},
|
|
38
|
+
"name": "bg-aspect-ratio",
|
|
39
|
+
"props": {
|
|
40
|
+
"height": 0,
|
|
41
|
+
"position": "relative",
|
|
42
|
+
"padding-bottom": "calc(100% / ({0} / {1}))"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
59
45
|
]
|
|
60
46
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"specs": [
|
|
3
3
|
{
|
|
4
|
-
"
|
|
4
|
+
"doc": { "group": "background" },
|
|
5
5
|
"name": "bg-<v>",
|
|
6
6
|
"props": "background-size",
|
|
7
7
|
"values": ["cover", "contain"]
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
|
-
"
|
|
10
|
+
"doc": { "group": "background", "desc": "<v>" },
|
|
11
11
|
"name": "bg-pos-<k>",
|
|
12
12
|
"props": "background-position",
|
|
13
13
|
"values": {
|
package/specs/borders.mcss.json
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
},
|
|
6
6
|
"specs": [
|
|
7
7
|
{
|
|
8
|
-
"
|
|
8
|
+
"doc": { "group": "border radius", "desc": "<v>" },
|
|
9
9
|
"name": "br<k>",
|
|
10
10
|
"props": "border-radius",
|
|
11
11
|
"values": "borders-r",
|
|
12
12
|
"unit": "rem"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
|
-
"
|
|
15
|
+
"doc": { "group": "border radius", "desc": "<v>" },
|
|
16
16
|
"name": "br<vid><k>",
|
|
17
17
|
"props": {
|
|
18
18
|
"border-top<var>-radius": "<v>",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"vars": ["l", "r"]
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
|
-
"
|
|
26
|
+
"doc": { "group": "border radius", "desc": "<v>" },
|
|
27
27
|
"name": "br<vid><k>",
|
|
28
28
|
"props": {
|
|
29
29
|
"border<var>-left-radius": "<v>",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"vars": ["t", "b"]
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
|
-
"
|
|
37
|
+
"doc": { "group": "border radius", "desc": "<v>" },
|
|
38
38
|
"name": "br-<k>",
|
|
39
39
|
"props": "border-radius",
|
|
40
40
|
"values": { "100": "100%", "pill": "9999px" }
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
|
-
"
|
|
43
|
+
"doc": { "group": "border width", "desc": "<v>" },
|
|
44
44
|
"name": "bw<vid><k>",
|
|
45
45
|
"props": {
|
|
46
46
|
"border<var>-style": "solid",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"vars": ["", "t", "r", "b", "l"]
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
|
-
"
|
|
54
|
+
"doc": { "group": "border width", "desc": "<v>" },
|
|
55
55
|
"name": "bw<vid>-<v>px",
|
|
56
56
|
"props": {
|
|
57
57
|
"border<var>-style": "solid",
|