@thi.ng/meta-css 0.4.0 → 0.5.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 +8 -1
- package/README.md +14 -16
- package/index.js +6 -6
- package/package.json +18 -18
- package/specs/anim.json +11 -2
- package/specs/normalize.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2023-12-
|
|
3
|
+
- **Last updated**: 2023-12-28T23:24:39Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,13 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [0.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/meta-css@0.5.0) (2023-12-28)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add supported for quoted fns ([5d8e2fc](https://github.com/thi-ng/umbrella/commit/5d8e2fc))
|
|
17
|
+
- update generate cmd input handling ([c156762](https://github.com/thi-ng/umbrella/commit/c156762))
|
|
18
|
+
|
|
12
19
|
## [0.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/meta-css@0.4.0) (2023-12-26)
|
|
13
20
|
|
|
14
21
|
#### 🚀 Features
|
package/README.md
CHANGED
|
@@ -84,7 +84,7 @@ frameworks (in the hope they'll be shared back similarly)...
|
|
|
84
84
|
```text
|
|
85
85
|
metacss generate --help
|
|
86
86
|
|
|
87
|
-
Usage: metacss generate [opts]
|
|
87
|
+
Usage: metacss generate [opts] inputs...
|
|
88
88
|
|
|
89
89
|
Flags:
|
|
90
90
|
|
|
@@ -104,8 +104,8 @@ frameworks of dozens (usually hundreds) of utility classes, including many
|
|
|
104
104
|
possible variations (per spec).
|
|
105
105
|
|
|
106
106
|
Generation specs use a simple JSON structure as shown below. The specs can be
|
|
107
|
-
split over multiple files
|
|
108
|
-
|
|
107
|
+
split over multiple files and will all be merged by the `generate` command of
|
|
108
|
+
the toolchain.
|
|
109
109
|
|
|
110
110
|
```json5
|
|
111
111
|
{
|
|
@@ -167,15 +167,12 @@ will be explained in more detail further below.
|
|
|
167
167
|
}
|
|
168
168
|
```
|
|
169
169
|
|
|
170
|
-
Assuming the above spec has been saved to
|
|
171
|
-
directory...
|
|
170
|
+
Assuming the above spec has been saved to file `myspecs.json`...
|
|
172
171
|
|
|
173
172
|
```bash
|
|
174
|
-
# the
|
|
175
|
-
# JSON files in the provided dir (recursively)...
|
|
176
|
-
|
|
173
|
+
# the generate cmd can merge specs from multiple input files
|
|
177
174
|
# if no `--out` file is given, the result will go to stdout
|
|
178
|
-
metacss generate --pretty myspecs
|
|
175
|
+
metacss generate --pretty myspecs.json
|
|
179
176
|
```
|
|
180
177
|
|
|
181
178
|
...this command (with the above spec) will generate the following output (here
|
|
@@ -742,7 +739,7 @@ Currently available CSS classes in MetaCSS base v0.0.1:
|
|
|
742
739
|
|
|
743
740
|
#### Animations / transitions <!-- notoc -->
|
|
744
741
|
|
|
745
|
-
`bg-anim1` / `bg-anim2` / `bg-anim3`
|
|
742
|
+
`bg-anim1` / `bg-anim2` / `bg-anim3` / `fadein1` / `fadein2` / `fadein3`
|
|
746
743
|
|
|
747
744
|
#### Aspect ratios <!-- notoc -->
|
|
748
745
|
|
|
@@ -923,7 +920,7 @@ distributed as CLI bundle with **no runtime dependencies**. The following
|
|
|
923
920
|
dependencies are only shown for informational purposes and are (partially)
|
|
924
921
|
included in the bundle.
|
|
925
922
|
|
|
926
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 11.
|
|
923
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 11.46 KB
|
|
927
924
|
|
|
928
925
|
## Dependencies
|
|
929
926
|
|
|
@@ -943,13 +940,14 @@ Package sizes (brotli'd, pre-treeshake): ESM: 11.38 KB
|
|
|
943
940
|
|
|
944
941
|
## Usage examples
|
|
945
942
|
|
|
946
|
-
|
|
943
|
+
Several projects in this repo's
|
|
947
944
|
[/examples](https://github.com/thi-ng/umbrella/tree/develop/examples)
|
|
948
|
-
directory
|
|
945
|
+
directory are using this package:
|
|
949
946
|
|
|
950
|
-
| Screenshot | Description
|
|
951
|
-
|
|
952
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/meta-css-basics.png" width="240"/> | Basic thi.ng/meta-css usage & testbed
|
|
947
|
+
| Screenshot | Description | Live demo | Source |
|
|
948
|
+
|:-----------------------------------------------------------------------------------------------------------------------|:-----------------------------------------|:------------------------------------------------------|:-----------------------------------------------------------------------------------|
|
|
949
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/meta-css-basics.png" width="240"/> | Basic thi.ng/meta-css usage & testbed | [Demo](https://demo.thi.ng/umbrella/meta-css-basics/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/meta-css-basics) |
|
|
950
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rdom-lazy-load.png" width="240"/> | Lazy loading components via @thi.ng/rdom | [Demo](https://demo.thi.ng/umbrella/rdom-lazy-load/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rdom-lazy-load) |
|
|
953
951
|
|
|
954
952
|
## Authors
|
|
955
953
|
|
package/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
3
|
-
`)}}var
|
|
4
|
-
`]:[],...Y(
|
|
5
|
-
`),b1(Z,W);const Q=await Z.ctx({logger:new g0(process.stderr,Z.name,"INFO"),format:J?M0:O1,opts:V.result,inputs:V.rest},B);if(await B.fn(Q),Z.post)await Z.post(Q,B)}catch(Y){process.stderr.write(Y.message+"\n\n"),process.exit(1)}},b1=(Z,X)=>{process.stderr.write(W0(Z.opts,X)),process.exit(1)},X4=(Z)=>["\nAvailable commands:\n",...Object.keys(Z).map((X)=>`${H0(16)(X)}: ${Z[X].desc}`),"\n"].join("\n");import{existsSync as J4,mkdirSync as W4,statSync as Y4} from"fs";import{sep as B4} from"path";var L1=(Z)=>{const X=Z.substring(0,Z.lastIndexOf(B4));return X.length>0&&!J4(X)?(W4(X,{recursive:!0}),!0):!1},S1=(Z)=>Y4(Z).isDirectory();var k=(Z)=>typeof Z==="function";var F=(Z)=>typeof Z==="string";import{readdirSync as U4,statSync as TZ} from"fs";import{sep as V4} from"path";function*h1(Z,X="",J,W=Infinity,Y=0){if(Y>=W)return;const B=z4(X);for(let U of U4(Z).sort()){const V=Z+V4+U;try{if(S1(V))yield*h1(V,X,J,W,Y+1);else if(B(V))yield V}catch(Q){J&&J.warn(`ignoring file: ${U} (${Q.message})`)}}}var y1=(Z,X="",J=Infinity,W)=>h1(Z,X,W,J,0);var Q4=(Z)=>F(Z)?new RegExp(`${Z.replace(/\./g,"\\.")}\$`):Z,z4=(Z)=>k(Z)?Z:(Z=Q4(Z),(X)=>Z.test(X));import{readFileSync as $4} from"fs";import{writeFileSync as q4} from"fs";var f1=(Z,X,J,W,Y=!1)=>{if(W&&W.info(`${Y?"[dryrun] ":""}writing file: ${Z}`),Y)return;L1(Z),q4(Z,X,!J&&F(X)?"utf-8":J)};var A=(Z,X,J="utf-8")=>{return X&&X.debug("reading file:",Z),$4(Z,J)},p0=(Z,X,J,W=!1)=>f1(Z,P(X)?X.join("\n"):X,"utf-8",J,W);var L=(Z,X)=>JSON.parse(A(Z,X));var P0=Object.freeze({level:C.NONE,enabled:()=>!1,fine(){},debug(){},info(){},warn(){},severe(){}});import{join as l4} from"path";var K4=I(()=>"Assertion failed"),N0=(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 K4(typeof X==="function"?X():X)}:()=>{};var w0=(Z)=>Z!=null&&typeof Z!=="function"&&Z.length!==void 0;var m1=(Z)=>{return(Z==null||!Z[Symbol.iterator])&&H(`value is not iterable: ${Z}`),Z};var u1=(Z)=>w0(Z)?Z:[...m1(Z)];var B0=(Z)=>Z[Z.length-1];var H4=I(()=>"illegal arity"),c=(Z)=>{throw new H4(Z)};var C4=I(()=>"illegal state"),r=(Z)=>{throw new C4(Z)};var o0=function(...Z){let[X,J,W,Y,B,U,V,Q,q,z]=Z;switch(Z.length){case 0:c(0);case 1:return X;case 2:return(...K)=>X(J(...K));case 3:return(...K)=>X(J(W(...K)));case 4:return(...K)=>X(J(W(Y(...K))));case 5:return(...K)=>X(J(W(Y(B(...K)))));case 6:return(...K)=>X(J(W(Y(B(U(...K))))));case 7:return(...K)=>X(J(W(Y(B(U(V(...K)))))));case 8:return(...K)=>X(J(W(Y(B(U(V(Q(...K))))))));case 9:return(...K)=>X(J(W(Y(B(U(V(Q(q(...K)))))))));case 10:default:const $=(...K)=>X(J(W(Y(B(U(V(Q(q(z(...K))))))))));return Z.length===10?$:o0($,...Z.slice(10))}};var g1=(Z,X)=>new Promise((J)=>setTimeout(()=>J(Z),X));var x1=(Z)=>Z;var d1=["-moz-","-ms-","-o-","-webkit-"],g={rules:"",ruleSep:",",valSep:"",decls:"",declStart:"{",declEnd:"}",indent:"",comments:!1},U0={rules:"\n",ruleSep:", ",valSep:" ",decls:"\n",declStart:" {\n",declEnd:"}\n",indent:" ",comments:!0};var G=(Z)=>Z!=null&&typeof Z[Symbol.iterator]==="function";var O0=(Z,X)=>Z!=null&&typeof Z[X]==="function";var x=(Z)=>O0(Z,"xform")?Z.xform():Z;var S=function(...Z){return Z=Z.map(x),o0.apply(null,Z)};var D0=(Z)=>Z!=null&&typeof Z!=="string"&&typeof Z[Symbol.iterator]==="function";var s=(Z,X)=>[Z[0],Z[1],X];var y=Symbol(),i0=()=>{};class a0{value;constructor(Z){this.value=Z}deref(){return this.value}}var j=(Z)=>Z instanceof a0;var h=(Z)=>Z instanceof a0?Z.deref():Z;var G0=function(...Z){const X=Z[0],J=X[0],W=X[1],Y=X[2];Z=M4(Z);const B=Z[0]==null?J():Z[0],U=Z[1];return h(W(O0(U,"$reduce")?U.$reduce(Y,B):w0(U)?F4(Y,B,U):P4(Y,B,U)))};var M4=(Z)=>Z.length===2?[void 0,Z[1]]:Z.length===3?[Z[1],Z[2]]:c(Z.length),F4=(Z,X,J)=>{for(let W=0,Y=J.length;W<Y;W++)if(X=Z(X,J[W]),j(X)){X=X.deref();break}return X},P4=(Z,X,J)=>{for(let W of J)if(X=Z(X,W),j(X)){X=X.deref();break}return X},e=(Z,X)=>[Z,(J)=>J,X];var j0=function(Z){return Z?[...Z]:e(()=>[],(X,J)=>(X.push(J),X))};function*k0(Z,X){const J=x(Z)(j0()),W=J[1],Y=J[2];for(let B of X){const U=Y([],B);if(j(U)){yield*h(W(U.deref()));return}if(U.length)yield*U}yield*h(W([]))}function*d(Z,X){const J=x(Z)([i0,i0,(W,Y)=>Y])[2];for(let W of X){let Y=J(y,W);if(j(Y)){if(Y=h(Y.deref()),Y!==y)yield Y;return}if(Y!==y)yield Y}}var T0=(Z,X,J=d)=>{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 t0=function(Z,X){return G(X)?k0(t0(Z),F(X)?[X]:X):(J)=>{const W=J[2],Y=(B,U)=>{const V=Z(U);if(V){for(let Q of V)if(B=Y(B,Q),j(B))break;return B}return W(B,U)};return s(J,Y)}};var n1=function(Z){return t0((X)=>D0(X)?X:void 0,Z)};var N=function(Z,X){return G(X)?d(N(Z),X):(J)=>{const W=J[2];return s(J,(Y,B)=>W(Y,Z(B)))}};function*I0(...Z){const X=Z.length-1;if(X<0)return;const J=new Array(X+1).fill(0),W=Z.map(u1),Y=W.reduce((B,U)=>B*U.length,1);for(let B=0;B<Y;B++){const U=[];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]++;U[V]=Q[q]}J[X]++,yield U}}function*l1(Z,X=Infinity){while(X-- >0)yield Z}var c0=function(Z,X){Z=Z||"";let J=!0;return X?[...X].join(Z):e(()=>"",(W,Y)=>(W=J?W+Y:W+Z+Y,J=!1,W))};var R0=function(...Z){return N4(R0,G0,Z)};var N4=(Z,X,J)=>{let W,Y;switch(J.length){case 4:Y=J[3],W=J[2];break;case 3:Y=J[2];break;case 2:return N((B)=>Z(J[0],J[1],B));default:c(J.length)}return X(x(J[0])(J[1]),W,Y)};var w4=new Set,O4=":[",p1=S(n1(),N((Z)=>O4.indexOf(Z.charAt(0))>=0?Z:" "+Z)),D4=(Z,X)=>S(Z,N((J)=>F(J)&&J.indexOf(" .")==0?J+X:J)),Z0=(Z,X,J,W)=>{const Y=J.length,B=[];let U,V;const Q=(q,z)=>{let $=null;if(P(z))Z0(Z,r0(X,B),z,W);else if(G(z)&&!F(z))Z0(Z,r0(X,B),[...z],W);else if((V=k(z))||($=W.fns[z]))if(!X.length){if($)return $.apply(null,J.slice(q+1))(Z,W),!0;z(Z,W)}else if(V)Q(q,z());else H(`quoted fn ('${z}') only allowed at head position`);else if(R(z))U=Object.assign(U||{},z);else if(z!=null)B.push(z)};for(let q=0;q<Y;q++)if(Q(q,J[q]))return Z;return U&&Z.push(G4(X,B,U,W)),Z},r0=(Z,X)=>Z.length?[...I0(Z,X)]:X,G4=(Z,X,J,W)=>{const Y=W.format,B=A0(W),U=W.scope?D4(p1,W.scope):p1;return[B,R0(N((V)=>R0(U,c0(),P(V)?V:[V]).trim()),c0(Y.ruleSep),r0(Z,X)),Y.declStart,s0(J,W),B,Y.declEnd].join("")},s0=(Z,X)=>{const J=X.format,W=X.autoprefix||w4,Y=A0(X,X.depth+1),B=[];for(let U in Z)if(Z.hasOwnProperty(U)){let V=Z[U];if(k(V))V=V(Z);if(P(V))V=V.map((Q)=>P(Q)?Q.join(" "):Q).join(J.ruleSep);if(W.has(U))for(let Q of X.vendors)B.push(`${Y}${Q}${U}:${J.valSep}${V};`);B.push(`${Y}${U}:${J.valSep}${V};`)}return B.join(J.decls)+J.decls},A0=(Z,X=Z.depth)=>X>1?[...l1(Z.format.indent,X)].join(""):X>0?Z.format.indent:"";var i1=(Z,X,J)=>(W,Y)=>{const B=A0(Y);return W.push(`${B}${Z} ${j4(X)}${Y.format.declStart}`),Y.depth++,Z0(W,[],J,Y),Y.depth--,W.push(B+Y.format.declEnd),W},j4=(Z)=>{if(F(Z))return Z;const X=[];for(let J in Z)if(Z.hasOwnProperty(J)){let W=Z[J];if(W===!0)W=o1.has(J)?J:`(${J})`;else if(W===!1)W=`(not ${o1.has(J)?J:`(${J})`})`;else if(W==="only")W+=" "+J;else W=`(${J}:${W})`;X.push(W)}return X.join(" and ")},o1=new Set(["all","print","screen"]);var n=(Z,X)=>{return X={format:g,vendors:d1,fns:{},depth:0,...X},P(X.autoprefix)&&(X.autoprefix=new Set(X.autoprefix)),R(Z)?s0(Z,X):k(Z)?Z([],X).join(X.format.rules):Z0([],[],P(Z)?Z:D0(Z)?[...Z]:H("invalid rules"),X).join(X.format.rules)};var E0=(Z,X)=>i1("@media",Z,X);var a1=4,t1=(Z)=>a1=Z,D=(Z)=>Z===(Z|0)?String(Z):Z.toFixed(a1).replace(/^0./,".").replace(/^-0./,"-.").replace(/0+$/,""),c1=(Z)=>`${D(Z)}em`,r1=(Z)=>`${D(Z)}ex`,s1=(Z)=>`${D(Z)}rem`,e0=(Z)=>`${D(Z)}%`,e1=(Z)=>`${D(Z)}px`,Z8=(Z)=>`${D(Z)}vh`,X8=(Z)=>`${D(Z)}vw`,J8=(Z)=>`${D(Z)}vmin`,W8=(Z)=>`${D(Z)}vmax`,Y8=(Z)=>`${Z|0}ms`,B8=(Z)=>`${D(Z)}s`;var U8=(Z)=>`${D(Z)}deg`,V8=(Z)=>`${D(Z)}rad`,Q8=(Z)=>`${D(Z)}turn`,z8=(Z)=>`url(${Z})`;var w=((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})(w||{}),T=((Z)=>{return Z[Z.NEVER=0]="NEVER",Z[Z.FIRST=1]="FIRST",Z[Z.LAST=2]="LAST",Z})(T||{});var k4=0,T4=()=>k4++,l=(Z,X)=>!X||!X.id?{...X,id:Z+"-"+T4()}:X;var O=P0;class f{constructor(Z,X){this.wrapped=Z,X=l("sub",{closeIn:T.LAST,closeOut:T.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(j0()))}id;closeIn;closeOut;parent;__owner;xform;cacheLast;last=y;state=w.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(),N0(!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(w.ACTIVE),J.setState(w.ACTIVE),this.last!=y&&J.next(this.last),J}transform(...Z){let X,J;if(R(B0(Z)))J=Z.pop(),X={error:J.error};return this.subscribe(X,l("xform",Z.length>0?{...J,xform:S(...Z)}:J))}map(Z,X){return this.transform(N(Z),X||{})}unsubscribe(Z){return Z?this.unsubscribeChild(Z):this.unsubscribeSelf()}unsubscribeSelf(){return O.debug(this.id,"unsub self"),this.parent&&this.parent.unsubscribe(this),this.state<w.UNSUBSCRIBED&&(this.state=w.UNSUBSCRIBED),this.release(),!0}unsubscribeChild(Z){O.debug(this.id,"unsub child",Z.id);const X=this.subs.indexOf(Z);if(X>=0){if(this.subs.splice(X,1),this.closeOut===T.FIRST||!this.subs.length&&this.closeOut!==T.NEVER)this.unsubscribe();return!0}return!1}next(Z){if(this.state>=w.DONE)return;this.xform?this.dispatchXform(Z):this.dispatch(Z)}done(){if(O.debug(this.id,"entering done()"),this.state>=w.DONE)return;if(this.xform){if(!this.dispatchXformDone())return}if(this.state=w.DONE,this.dispatchTo("done"))this.state<w.UNSUBSCRIBED&&this.unsubscribe();O.debug(this.id,"exiting done()")}error(Z){const X=this.wrapped,J=X&&X.error;return J&&O.debug(this.id,"attempting wrapped error handler"),J&&X.error(Z)||this.unhandledError(Z)}unhandledError(Z){return(O!==P0?O:console).warn(this.id,"unhandled error:",Z),this.unsubscribe(),this.state=w.ERROR,!1}dispatchTo(Z,X){let J=this.wrapped;if(J)try{J[Z]&&J[Z](X)}catch(Y){if(!this.error(Y))return!1}const W=Z==="next"?this.subs:[...this.subs];for(let Y=W.length;Y-- >0;){J=W[Y];try{J[Z]&&J[Z](X)}catch(B){if(Z==="error"||!J.error||!J.error(B))return this.unhandledError(B)}}return!0}dispatch(Z){O.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=h(Z);for(let J=0,W=X.length;J<W&&this.state<w.DONE;J++)this.dispatch(X[J]);return this.state<w.ERROR}ensureState(){if(this.state>=w.DONE)r(`operation not allowed in state ${this.state}`)}release(){this.subs.length=0,delete this.parent,delete this.xform,delete this.last}}var q8=(Z,X)=>{const J=new $8(X);return J.next(Z),J};class $8 extends f{src;_cancel;_inited;constructor(Z,X){const[J,W]=k(Z)?[Z,X||{}]:[void 0,Z||{}];super(W.error?{error:W.error}:void 0,l("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 Y=this.wrapped;if(!Y||!Y.error||!Y.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!==T.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){O.debug(this.id,"cancel");const Z=this._cancel;delete this._cancel,Z()}}}var K8=(Z,X)=>Z===T.FIRST||Z===T.LAST&&!X;var Z1=function(Z){return Z?G0(Z1(),Z):e(()=>({}),(X,[J,W])=>(X[J]=W,X))};var X1=function(Z,X){return G(X)?d(X1(Z),X):N(k(Z)?(J)=>[Z(J),J]:(J)=>[Z,J])};var J1=function(...Z){const X=T0(J1,Z);if(X)return X;const J=Z[0],W=Z[1]!==!1;return N((Y)=>{const B=W?{}:Y;for(let U in Y)B[U]=J(Y[U]);return B})};var W1=function(...Z){const X=T0(W1,Z,k0);if(X)return X;const{key:J,mergeOnly:W,reset:Y,all:B,backPressure:U}={key:x1,mergeOnly:!1,reset:!0,all:!0,backPressure:0,...Z[1]},V=P(Z[0])?new Set(Z[0]):Z[0],Q=new Set,q=new Map;let z={};const $=([K,v,p])=>{let b=!0;if(W||U<1)return[K,(M)=>{if(Y&&B&&Q.size>0||!Y&&b)M=p(M,z),z={},Q.clear(),b=!1;return v(M)},(M,_)=>{const E=J(_);if(V.has(E)){if(z[E]=_,Q.add(E),W||H8(V,Q))if(M=p(M,z),b=!1,Y)z={},Q.clear();else z={...z}}return M}];else return[K,(M)=>{if(B&&Q.size>0)M=p(M,C8(q,Q)),q.clear(),Q.clear();return v(M)},(M,_)=>{const E=J(_);if(V.has(E)){let q0=q.get(E);!q0&&q.set(E,q0=[]),q0.length>=U&&r(`max back pressure (${U}) exceeded for input: ${String(E)}`),q0.push(_),Q.add(E);while(H8(V,Q))if(M=p(M,C8(q,Q)),b=!1,j(M))break}return M}]};return $.keys=()=>V,$.clear=()=>{q.clear(),V.clear(),Q.clear(),z={}},$.add=(K)=>{V.add(K)},$.delete=(K,v=!0)=>{if(q.delete(K),V.delete(K),v)Q.delete(K),delete z[K]},$},H8=(Z,X)=>{if(X.size<Z.size)return!1;for(let J of Z)if(!X.has(J))return!1;return!0},C8=(Z,X)=>{const J={};for(let W of X){const Y=Z.get(W);J[W]=Y.shift(),!Y.length&&X.delete(W)}return J};var M8=(Z,X)=>{let J=!0;for(let W of X)J=Z.removeID(W)&&J;return J};var F8=(Z)=>new P8(Z);class P8 extends f{sources;idSources;realSourceIDs;invRealSourceIDs;psync;clean;constructor(Z){const X=W1(new Set,{key:(W)=>W[0],mergeOnly:Z.mergeOnly===!0,reset:Z.reset===!0,all:Z.all!==!1,backPressure:Z.backPressure||0}),J=J1((W)=>W[1]);super(void 0,l("streamsync",{...Z,xform:Z.xform?S(X,J,Z.xform):S(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:X1(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 O.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 M8(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){O.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),K8(this.closeIn,this.sources.size)&&this.done()}}var Y1=o((Z,X=" ")=>{const J=i(String(X),Z);return(W,Y)=>{if(W==null)return J;return W=W.toString(),Y=Y!==void 0?Y:W.length,Y<Z?J.substring(Y)+W:W}}),A2=Y1(2,"0"),N8=Y1(3,"0"),E2=Y1(4,"0");var B1=function(Z,X){return G(X)?d(B1(Z),X):(J)=>{const W=J[2];return s(J,(Y,B)=>Z(B)?W(Y,B):Y)}};import{watch as R4} from"fs";import{resolve as Q0} from"path";var w8={specs:a({alias:"s",optional:!1,desc:"Path to generated JSON defs"})},v0={include:t({alias:"I",desc:"Include CSS files (prepend)"})},b0={noDecls:m({alias:"d",desc:"Don't emit framework decls"})},X0={pretty:m({alias:"p",desc:"Pretty print output"})},_0={noHeader:m({desc:"Don't emit generated header comment"})},O8={watch:m({alias:"w",desc:"Watch input files for changes"})};import{resolve as I4} from"path";var J0=(Z,X,J)=>{X=F(X)?X:X.join("\n"),Z?p0(I4(Z),X,J):console.log(X)},L0=({info:{name:Z,version:X}})=>`/*! ${Z} v${X} - generated by thi.ng/meta-css @ ${(new Date()).toISOString()} */`;var G8={desc:"Transpile & bundle meta stylesheets to CSS",opts:{...w8,...v0,...b0,...X0,..._0,...O8,eval:a({alias:"e",desc:"eval meta stylesheet in given string (ignores other inputs & includes)"}),force:t({alias:"f",hint:"STR",desc:"CSS classes to force include (wildcards are supported, @-prefix will read from file)",delim:","})},fn:async(Z)=>{const X=L(Q0(Z.opts.specs),Z.logger),J=b4(X,Z.opts.force||[],Z.logger);if(Z.opts.watch)await A4(Z,X,J);else if(Z.opts.eval)U1(Z,X,J,[Z.opts.eval]);else U1(Z,X,J,Z.inputs.map((W)=>A(Q0(W),Z.logger)))}},A4=async(Z,X,J)=>{let W=!0;const Y=()=>{Z.logger.info("closing watchers..."),B.forEach((U)=>U.watcher.close()),W=!1},B=Z.inputs.map((U,V)=>{U=Q0(U);const Q=q8(A(U,Z.logger),{id:`in${N8(V)}`});return{input:Q,watcher:R4(U,{},(q)=>{if(q==="change")try{Q.next(A(U,Z.logger))}catch(z){Z.logger.warn(z.message),Y()}else Z.logger.warn("input removed:",U),Y()})}});F8({src:Z1(N(({input:U})=>[U.id,U],B))}).subscribe({next(U){try{U1(Z,X,J,Object.keys(U).sort().map((V)=>U[V]))}catch(V){Z.logger.warn(V.message)}}}),process.on("SIGINT",Y);while(W)await g1(null,250)},U1=({logger:Z,opts:{include:X,noDecls:J,noHeader:W,out:Y,pretty:B}},U,V,Q)=>{const q={logger:Z,specs:U,format:B?U0:g,mediaQueryIDs:new Set(Object.keys(U.media)),mediaQueryRules:{...V.mediaQueryRules},plainRules:{...V.plainRules}},z=X?X.map(($)=>A(Q0($),Z).trim()):[];if(!W)z.push(L0(U));if(!J&&U.decls.length)z.push(n(U.decls,{format:q.format}));Q.forEach(($)=>_4($,q)),v4(z,q),E4(z,q),J0(Y,z,Z)},E4=(Z,{logger:X,specs:J,format:W,mediaQueryRules:Y})=>{for(let B in Y){const U=k8(Y[B],J);X.debug("mediaquery rules",B,U),Z.push(n(E0(y4(J.media,B),U),{format:W}))}},v4=(Z,{logger:X,specs:J,format:W,plainRules:Y})=>{const B=k8(Y,J);X.debug("plain rules",B),Z.push(n(B,{format:W}))},b4=(Z,X,J)=>{const W=new Set(Object.keys(Z.media)),Y=new Set(Object.keys(Z.classes)),B={},U={};if(X.length&&X[0][0]==="@")X=[...u(A(Q0(X[0].substring(1)),J))];for(let V of X){if(!V||V.startsWith("//"))continue;const{token:Q,query:q}=T8(V,W);let z;if(Q.includes("*")){const $=new RegExp(`^${Q.replace("*",".*")}\$`);z=[...B1((K)=>$.test(K),Y)]}else if(Y.has(Q))z=[Q];else{J.warn(`unknown include rule ID: ${V}, skipping...`);continue}for(let $ of z)J.debug("including class:",$),q?I8(B,q,`.${$}`,$):R8(U,`.${$}`,$)}return{mediaQueryRules:B,plainRules:U}},_4=(Z,{specs:X,mediaQueryIDs:J,mediaQueryRules:W,plainRules:Y})=>{const B=V0(),U=V0(B),V={root:B,curr:U,scopes:[U]};for(let Q of u(Z)){if(!Q||/^\s*\/\//.test(Q))continue;for(let q of u(Q,/\s+/g)){if(!q)continue;let z=V.curr;switch(z.state){case"sel":case"nest":if(q==="{"){if(z.state==="sel")z.sel=z.sel.map(($)=>$.replace(",","")),z.path=L4(V.scopes);z.state="class"}else if(q==="}")D8(V);else{const $=B0(z.sel);if(!$||$.endsWith(","))z.sel.push(q);else z.sel[z.sel.length-1]+=" "+q}break;case"class":if(q==="{")z.state="nest",V.scopes.push(V.curr=V0(z));else if(q==="}")D8(V);else{let{token:$,query:K}=T8(q,J);if(!X.classes[$])H(`unknown class ID: ${$}`);if(K)I8(W,K,z.path,$);else R8(Y,z.path,$)}break;default:r(z.state)}}}},V1=":",j8="///",V0=(Z)=>({state:"sel",sel:Z?[]:["<root>"],path:"",parent:Z}),D8=(Z)=>{const X=!Z.curr.sel.length;if(N0(!!Z.curr.parent,"stack underflow"),Z.scopes.pop(),Z.scopes.length>0){if(Z.curr=B0(Z.scopes),!X&&Z.curr.state==="nest")Z.scopes.push(Z.curr=V0(Z.curr))}else Z.scopes.push(Z.curr=V0(Z.root))},L4=(Z)=>Z.map((X)=>X.sel.join(",")).join(j8),k8=(Z,X)=>Object.entries(Z).map(([J,W])=>S4(J,W,X)),S4=(Z,X,J)=>{const W=[];let Y=W;const B=Z.split(j8);for(let U=0;U<B.length;U++){const V=B[U].split(",");if(U==B.length-1){const Q=Object.assign({},...N((q)=>J.classes[q],X));if("__user"in Q)delete Q.__user;V.push(Q)}Y.push(V),Y=V}return W[0]},T8=(Z,X)=>{if(/^::?/.test(Z))return{token:Z};const J=Z.lastIndexOf(V1);if(J<0)return{token:Z};const W=Z.substring(0,J);if(!W.split(V1).every((B)=>X.has(B)))H(`invalid media query in token: ${Z}`);return{token:Z.substring(J+1),query:W}},y4=(Z,X)=>X.split(V1).reduce((J,W)=>Object.assign(J,Z[W]),{}),I8=(Z,X,J,W)=>{if(!Z[X])Z[X]={};(Z[X][J]||(Z[X][J]=new Set)).add(W)},R8=(Z,X,J)=>(Z[X]||(Z[X]=new Set)).add(J);import{resolve as A8} from"path";var v8={desc:"Export entire generated framework as CSS",opts:{...v0,...b0,...X0,..._0,media:t({alias:"m",hint:"ID",desc:"Media query IDs (use 'ALL' for all)",delim:","})},inputs:1,fn:async(Z)=>{const{logger:X,opts:{include:J,media:W,noDecls:Y,noHeader:B,pretty:U,out:V},inputs:Q}=Z,q=L(A8(Q[0]),X),z=J?J.map(($)=>A(A8($),X).trim()):[];if(!B)z.push(L0(q));if(!Y&&q.decls.length)z.push(n(q.decls,{format:U?U0:g}));z.push(h4(q,W,U,X)),J0(V,z,X)}},h4=(Z,X,J,W)=>{const Y=E8("",Z);if(X){const B=X[0]==="ALL"?Object.keys(Z.media):X;for(let U of B)if(Z.media[U])Y.push(E0(Z.media[U],E8("-"+U,Z)));else W.warn(`invalid media query ID: ${U}, skipping...`)}return n(Y,{format:J?U0:g})},E8=(Z,X)=>Object.entries(X.classes).map(([J,W])=>[`.${J}${Z}`,f4(W)]),f4=(Z)=>{if("__user"in Z)Z={...Z},delete Z.__user;return Z};import{statSync as m4} from"fs";import{resolve as u4} from"path";var b8={deg:U8,em:c1,ex:r1,ms:Y8,percent:e0,px:e1,rad:V8,rem:s1,second:B8,turn:Q8,url:z8,vh:Z8,vmax:W8,vmin:J8,vw:X8,"%":e0},g4={"":[""],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"]},_8={desc:"Generate framework rules from specs",opts:{...X0,prec:M1({default:3,desc:"Number of fractional digits"})},inputs:1,fn:async(Z)=>{const{logger:X,opts:{prec:J,out:W,pretty:Y},inputs:B}=Z,U=u4(B[0]);if(!m4(U).isDirectory())H(`${U} is not a directory`);const V={info:{name:"TODO",version:"0.0.0"},media:{},classes:{},decls:[]};t1(J);for(let Q of y1(U,".json")){const q=L(Q,X);if(Object.assign(V.info,q.info),Object.assign(V.media,q.media),q.decls)V.decls.push(...q.decls);for(let z of q.specs)x4(q,z,V.classes,X)}J0(W,JSON.stringify(V,null,Y?4:0),X)}},x4=(Z,X,J,W)=>{const Y=P(X.var)?X.var:[""],B=F(X.props)?{[X.props]:"<v>"}:X.props,U=d4(X,Z),V=new Set;for(let Q of Y)for(let[q,z]of I0(Z.vars?.[Q]||g4[Q],Object.keys(U))){const $=z0(X.name,Q,q,z,U[z]),K=X.unit?z0(X.unit,Q,q,z,U[z]):void 0,v=n4(U[z],K);if(!J[$])J[$]=X.user!=null?{__user:z0(X.user,Q,q,z,U[z])}:{};else if(!V.has($))H(`duplicate class ID: ${$}`);V.add($);for(let[p,b]of Object.entries(B)){const M=z0(p,Q,q,z,U[z]),_=z0(!K||F(b)?String(b):b8[K](b),Q,q,z,v);J[$][M]=_,W.debug($,M,_)}}return J},d4=(Z,X)=>{const J=F(Z.values)?X.tables?.[Z.values]||H(`invalid table ID: ${Z.values}`):Z.values;if(R(J))return J;const W=Z.key==="v"?(Y)=>String(Y):Z.key==="i1"?(Y,B)=>String(B+1):Z.key===void 0?(Y,B)=>String(B):H(`invalid key type: ${Z.key}`);return J.reduce((Y,B,U)=>{return Y[W(B,U)]=B,Y},{})},n4=(Z,X)=>{if(!X||F(Z))return Z;const J=b8[X];if(!J)H(`invalid unit: ${X}`);return J(Z)},z0=(Z,X,J,W,Y)=>Z.replace("<vid>",X).replace("<var>",J).replace("<k>",W).replace("<v>",String(Y));var Q1=L(l4(import.meta.dir,"package.json"));_1({name:"metacss",opts:{out:a({alias:"o",desc:"Output file (or stdout)"}),verbose:m({alias:"v",desc:"Display extra process information"})},commands:{convert:G8,export:v8,generate:_8},ctx:async(Z)=>{if(Z.opts.verbose)Z.logger.level=C.DEBUG;return{...Z,format:M0}},usage:{prefix:`
|
|
2
|
+
var f0={default:95,hint:90,multi:90,param:96,required:33};var m0=(Z)=>Z;var a=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 t=a((Z,X)=>Z.repeat(X));var $1=(Z)=>/^[a-f0-9]+$/i.test(Z);var H1=(Z)=>/^[-+]?\d+$/.test(Z),K1=(Z)=>/^[-+]?\d*\.?\d+(e[-+]?\d+)?$/i.test(Z);var T=(Z,X=(J)=>J!==void 0?": "+J:"")=>class extends Error{constructor(J){super(Z(J)+X(J))}};var h5=T(()=>"illegal argument(s)"),K=(Z)=>{throw new h5(Z)};var u0=(Z)=>K1(Z)?parseFloat(Z):K(`not a numeric value: ${Z}`),C1=(Z)=>Z.map(u0),g0=(Z)=>$1(Z)?parseInt(Z,16):K(`not a hex value: ${Z}`),M1=(Z)=>Z.map(g0),x0=(Z)=>H1(Z)?parseInt(Z):K(`not an integer: ${Z}`),F1=(Z)=>Z.map(x0);var M0=(Z,X)=>(J)=>({coerce:Z,hint:X,group:"main",...J}),F0=(Z,X)=>(J)=>({hint:f5(X,J.delim),multi:!0,coerce:Z,group:"main",...J}),f5=(Z,X)=>Z+(X?`[${X}..]`:""),u=(Z)=>({flag:!0,default:!1,group:"flags",...Z}),r=M0(m0,"STR"),c=F0(m0,"STR"),Q4=M0(u0,"NUM"),q4=M0(g0,"HEX"),P1=M0(x0,"INT"),$4=F0(C1,"NUM"),H4=F0(M1,"HEX"),K4=F0(F1,"INT");var C=((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})(C||{});class d0{id;level;constructor(Z,X=C.FINE){this.id=Z,this.level=typeof X==="string"?C[X]:X}enabled(Z){return this.level<=Z}fine(...Z){this.level<=C.FINE&&this.log(C.FINE,Z)}debug(...Z){this.level<=C.DEBUG&&this.log(C.DEBUG,Z)}info(...Z){this.level<=C.INFO&&this.log(C.INFO,Z)}warn(...Z){this.level<=C.WARN&&this.log(C.WARN,Z)}severe(...Z){this.level<=C.SEVERE&&this.log(C.SEVERE,Z)}}var w1=(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 n0 extends d0{constructor(Z,X,J=C.FINE){super(X,J);this.target=Z}log(Z,X){this.target.write(`[${C[Z]}] ${this.id}: ${w1(X)}
|
|
3
|
+
`)}}var P0=a((Z,X=" ")=>{const J=t(String(X),Z);return(W,Y)=>{if(W==null)return J;return W=W.toString(),Y=Y!==void 0?Y:W.length,Y<Z?W+J.substring(Y):W}});var N1=(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 l0={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 m5=(Z,X)=>(J)=>Z.format(X,J),p0=(Z)=>Object.keys(l0).reduce((X,J)=>(X[J]=m5(Z,l0[J]),X),{format:Z});var O1="\x1B[0m",u5=["","1","2","1;2","4","1;4","2;4","1;2;4"],w0={format:(Z,X)=>w0.start(Z)+X+w0.end,start:N1((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:O1,prefix:O1,suffix:"\n"};var D1={format:(Z,X)=>String(X),prefix:"",suffix:"\n",start:()=>"",end:""};var N0=p0(w0),G1=p0(D1);var F=Array.isArray;var g5=(Z)=>Z.toUpperCase(),k1=(Z)=>Z.toLowerCase(),j1=(Z)=>Z.length?Z[0].toUpperCase()+Z.substring(1):Z,T1=(Z,X="-")=>k1(Z.replace(/([a-z0-9\u00e0-\u00fd])([A-Z\u00c0-\u00dd])/g,(J,W,Y)=>W+X+Y));var I1=(Z,X="-")=>k1(Z).replace(new RegExp(`\\${X}+(\\w)`,"g"),(J,W)=>g5(W));var R1=Object.getPrototypeOf,I=(Z)=>{let X;return Z!=null&&typeof Z==="object"&&((X=R1(Z))===null||R1(X)===null)};var x5=/\x1b\[[0-9;]+m/g,d5=(Z)=>Z.replace(x5,"");var O0=(Z)=>d5(Z).length;var A1=(Z=!1,X)=>(J)=>Z||typeof J!=="string"&&typeof J!=="number"?JSON.stringify(J,null,X):String(J);function*g(Z,X=/\r?\n/g,J=!1){let W=0;const Y=Z.length,B=~~J;let U;if(typeof X==="string")U=new RegExp(X,"g");else if(!X.flags.includes("g"))U=new RegExp(X,X.flags+"g");else U=X;for(;W<Y;){const V=U.exec(Z);if(!V){yield Z.substring(W);return}const z=V[0].length;yield Z.substring(W,V.index+B*z),W=V.index+z}}class o0{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 n5={length:(Z)=>Z.length,split:(Z,X)=>X},v1={length:O0,split:(Z,X)=>{const J=/\x1b\[[0-9;]+m/g;let W=X,Y;while(Y=J.exec(Z)){if(Y.index>=X)break;const B=Y[0].length;W+=B,X+=B}return W}},E1=(Z,X,J,W)=>{const Y=Z[Z.length-1];Y&&W-Y.n>J?Y.add(X,J):Z.push(new o0(X,J))},l5=(Z,{width:X,min:J,hard:W,splitter:Y},B=0,U=[])=>{let V=Y.length(Z),z=X-B;if(z<J&&z<V)z=X;while(W&&V>z){const q=Y.split(Z,z),Q=Z.substring(0,q);E1(U,Q,z,X),Z=Z.substring(q),z=X,V=Y.length(Z)}return E1(U,Z,V,X),U},p5=(Z,X,J=[])=>{if(!Z.length)return J.push(new o0),J;const W={width:80,min:4,hard:!1,splitter:n5,...X};for(let Y of g(Z,X.delimWord||/\s/g)){const B=J[J.length-1];l5(Y,W,B&&B.n>0?B.n+1:0,J)}return J},_1=(Z,X)=>{let J=[];for(let W of g(Z,X.delimLine))J=J.concat(p5(W,X));return J};var U0=(Z,X={})=>{X={lineWidth:80,paramWidth:32,showDefaults:!0,prefix:"",suffix:"",groups:["flags","main"],...X};const J=I(X.color)?{...f0,...X.color}:X.color?f0:{},W=t(" ",X.paramWidth),Y=(V)=>V.map((z)=>o5(z,Z[z],X,J,W)),B=Object.keys(Z).sort(),U=X.groups?X.groups.map((V)=>[V,B.filter((z)=>Z[z].group===V)]).filter((V)=>!!V[1].length):[["options",B]];return[...i0(X.prefix,X.lineWidth),...U.map(([V,z])=>[...X.showGroupNames?[`${j1(V)}:
|
|
4
|
+
`]:[],...Y(z),""].join("\n")),...i0(X.suffix,X.lineWidth)].join("\n")},o5=(Z,X,J,W,Y)=>{const B=i5(X,W),U=a5(X,W,B),V=V0(`--${T1(Z)}`,W.param),z=`${U}${V}${B}`,q=X.optional===!1&&X.default===void 0,Q=[];q&&Q.push("required"),X.multi&&Q.push("multiple");const $=t5(Q,W,q)+(X.desc||"")+r5(X,J,W);return P0(J.paramWidth)(z,O0(z))+i0($,J.lineWidth-J.paramWidth).map((H,_)=>_>0?Y+H:H).join("\n")},i5=(Z,X)=>Z.hint?V0(" "+Z.hint,X.hint):"",a5=(Z,X,J)=>Z.alias?`${V0("-"+Z.alias,X.param)}${J}, `:"",t5=(Z,X,J)=>Z.length?V0(`[${Z.join(", ")}] `,J?X.required:X.multi):"",r5=(Z,X,J)=>X.showDefaults&&Z.default!=null&&Z.default!==!1?V0(` (default: ${A1(!0)(Z.defaultHint!=null?Z.defaultHint:Z.default)})`,J.default):"",V0=(Z,X)=>X!=null?`\x1B[${X}m${Z}\x1B[0m`:Z,i0=(Z,X)=>Z?_1(Z,{width:X,splitter:v1,hard:!1}):[];var c5=T(()=>"parse error"),b1=(Z,X,J)=>{J={start:2,showUsage:!0,help:["--help","-h"],...J};try{return s5(Z,X,J)}catch(W){if(J.showUsage)console.log(W.message+"\n\n"+U0(Z,J.usageOpts));throw new c5(W.message)}},s5=(Z,X,J)=>{const W=e5(Z),Y={};let B,U,V=J.start;for(;V<X.length;){const z=X[V];if(!B){if(J.help.includes(z)){console.log(U0(Z,J.usageOpts));return}const q=Z8(Z,W,Y,z);if(B=q.id,U=q.spec,V=V+~~(q.state<2),q.state)break}else{if(X8(U,Y,B,z))break;B=null,V++}}return B&&K(`missing value for: --${B}`),{result:J8(Z,Y),index:V,rest:X.slice(V),done:V>=X.length}},e5=(Z)=>Object.entries(Z).reduce((X,[J,W])=>W.alias?(X[W.alias]=J,X):X,{}),Z8=(Z,X,J,W)=>{if(W[0]==="-"){let Y;if(W[1]==="-"){if(W==="--")return{state:1};Y=I1(W.substring(2))}else Y=X[W.substring(1)],!Y&&K(`unknown option: ${W}`);const B=Z[Y];if(!B&&K(Y),B.flag){if(J[Y]=!0,Y=void 0,B.fn&&!B.fn("true"))return{state:1,spec:B}}return{state:0,id:Y,spec:B}}return{state:2}},X8=(Z,X,J,W)=>{if(/^-[a-z]/i.test(W)&&K(`missing value for: --${J}`),Z.multi)F(X[J])?X[J].push(W):X[J]=[W];else X[J]=W;return Z.fn&&!Z.fn(W)},J8=(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)K(`missing arg: --${W}`)}else if(J.coerce)W8(J,X,W);return X},W8=(Z,X,J)=>{try{if(Z.multi&&Z.delim)X[J]=X[J].reduce((W,Y)=>(W.push(...Y.split(Z.delim)),W),[]);X[J]=Z.coerce(X[J])}catch(W){throw new Error(`arg --${J}: ${W.message}`)}};var L1=async(Z)=>{const X=Z.argv||process.argv,J=!process.env.NO_COLOR,W={prefix:"",color:J,...Z.usage};try{let Y,B,U=Z.start??2;if(Z.single){if(Y=Object.keys(Z.commands)[0],!Y)K("no command provided");B=Z.commands[Y]}else{if(Y=X[U],B=Z.commands[Y],W.prefix+=Y8(Z.commands),!B)S1(Z,W);U++}let V;try{V=b1({...Z.opts,...B.opts},X,{showUsage:!0,usageOpts:W,start:U})}catch(q){}if(!V)process.exit(1);if(B.inputs!==void 0&&B.inputs!==V.rest.length)process.stderr.write(`expected ${B.inputs||0} input(s)
|
|
5
|
+
`),S1(Z,W);const z=await Z.ctx({logger:new n0(process.stderr,Z.name,"INFO"),format:J?N0:G1,opts:V.result,inputs:V.rest},B);if(await B.fn(z),Z.post)await Z.post(z,B)}catch(Y){process.stderr.write(Y.message+"\n\n"),process.exit(1)}},S1=(Z,X)=>{process.stderr.write(U0(Z.opts,X)),process.exit(1)},Y8=(Z)=>["\nAvailable commands:\n",...Object.keys(Z).map((X)=>`${P0(16)(X)}: ${Z[X].desc}`),"\n"].join("\n");import{existsSync as B8,mkdirSync as U8,statSync as MZ} from"fs";import{sep as V8} from"path";var y1=(Z)=>{const X=Z.substring(0,Z.lastIndexOf(V8));return X.length>0&&!B8(X)?(U8(X,{recursive:!0}),!0):!1};var v=(Z)=>typeof Z==="function";var P=(Z)=>typeof Z==="string";import{readFileSync as Q8} from"fs";import{writeFileSync as z8} from"fs";var h1=(Z,X,J,W,Y=!1)=>{if(W&&W.info(`${Y?"[dryrun] ":""}writing file: ${Z}`),Y)return;y1(Z),z8(Z,X,!J&&P(X)?"utf-8":J)};var R=(Z,X,J="utf-8")=>{return X&&X.debug("reading file:",Z),Q8(Z,J)},a0=(Z,X,J,W=!1)=>h1(Z,F(X)?X.join("\n"):X,"utf-8",J,W);var L=(Z,X)=>JSON.parse(R(Z,X));var D0=Object.freeze({level:C.NONE,enabled:()=>!1,fine(){},debug(){},info(){},warn(){},severe(){}});import{join as x8} from"path";var q8=T(()=>"Assertion failed"),G0=(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 q8(typeof X==="function"?X():X)}:()=>{};var k0=(Z)=>Z!=null&&typeof Z!=="function"&&Z.length!==void 0;var f1=(Z)=>{return(Z==null||!Z[Symbol.iterator])&&K(`value is not iterable: ${Z}`),Z};var m1=(Z)=>k0(Z)?Z:[...f1(Z)];var z0=(Z)=>Z[Z.length-1];var $8=T(()=>"illegal arity"),s=(Z)=>{throw new $8(Z)};var H8=T(()=>"illegal state"),e=(Z)=>{throw new H8(Z)};var t0=function(...Z){let[X,J,W,Y,B,U,V,z,q,Q]=Z;switch(Z.length){case 0:s(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(Y(...H))));case 5:return(...H)=>X(J(W(Y(B(...H)))));case 6:return(...H)=>X(J(W(Y(B(U(...H))))));case 7:return(...H)=>X(J(W(Y(B(U(V(...H)))))));case 8:return(...H)=>X(J(W(Y(B(U(V(z(...H))))))));case 9:return(...H)=>X(J(W(Y(B(U(V(z(q(...H)))))))));case 10:default:const $=(...H)=>X(J(W(Y(B(U(V(z(q(Q(...H))))))))));return Z.length===10?$:t0($,...Z.slice(10))}};var u1=(Z,X)=>new Promise((J)=>setTimeout(()=>J(Z),X));var g1=(Z)=>Z;var x1=["-moz-","-ms-","-o-","-webkit-"],x={rules:"",ruleSep:",",valSep:"",decls:"",declStart:"{",declEnd:"}",indent:"",comments:!1},Q0={rules:"\n",ruleSep:", ",valSep:" ",decls:"\n",declStart:" {\n",declEnd:"}\n",indent:" ",comments:!0};var G=(Z)=>Z!=null&&typeof Z[Symbol.iterator]==="function";var j0=(Z,X)=>Z!=null&&typeof Z[X]==="function";var d=(Z)=>j0(Z,"xform")?Z.xform():Z;var y=function(...Z){return Z=Z.map(d),t0.apply(null,Z)};var T0=(Z)=>Z!=null&&typeof Z!=="string"&&typeof Z[Symbol.iterator]==="function";var Z0=(Z,X)=>[Z[0],Z[1],X];var h=Symbol(),r0=()=>{};class c0{value;constructor(Z){this.value=Z}deref(){return this.value}}var k=(Z)=>Z instanceof c0;var f=(Z)=>Z instanceof c0?Z.deref():Z;var I0=function(...Z){const X=Z[0],J=X[0],W=X[1],Y=X[2];Z=K8(Z);const B=Z[0]==null?J():Z[0],U=Z[1];return f(W(j0(U,"$reduce")?U.$reduce(Y,B):k0(U)?C8(Y,B,U):M8(Y,B,U)))};var K8=(Z)=>Z.length===2?[void 0,Z[1]]:Z.length===3?[Z[1],Z[2]]:s(Z.length),C8=(Z,X,J)=>{for(let W=0,Y=J.length;W<Y;W++)if(X=Z(X,J[W]),k(X)){X=X.deref();break}return X},M8=(Z,X,J)=>{for(let W of J)if(X=Z(X,W),k(X)){X=X.deref();break}return X},X0=(Z,X)=>[Z,(J)=>J,X];var R0=function(Z){return Z?[...Z]:X0(()=>[],(X,J)=>(X.push(J),X))};function*A0(Z,X){const J=d(Z)(R0()),W=J[1],Y=J[2];for(let B of X){const U=Y([],B);if(k(U)){yield*f(W(U.deref()));return}if(U.length)yield*U}yield*f(W([]))}function*n(Z,X){const J=d(Z)([r0,r0,(W,Y)=>Y])[2];for(let W of X){let Y=J(h,W);if(k(Y)){if(Y=f(Y.deref()),Y!==h)yield Y;return}if(Y!==h)yield Y}}var E0=(Z,X,J=n)=>{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 s0=function(Z,X){return G(X)?A0(s0(Z),P(X)?[X]:X):(J)=>{const W=J[2],Y=(B,U)=>{const V=Z(U);if(V){for(let z of V)if(B=Y(B,z),k(B))break;return B}return W(B,U)};return Z0(J,Y)}};var d1=function(Z){return s0((X)=>T0(X)?X:void 0,Z)};var w=function(Z,X){return G(X)?n(w(Z),X):(J)=>{const W=J[2];return Z0(J,(Y,B)=>W(Y,Z(B)))}};function*v0(...Z){const X=Z.length-1;if(X<0)return;const J=new Array(X+1).fill(0),W=Z.map(m1),Y=W.reduce((B,U)=>B*U.length,1);for(let B=0;B<Y;B++){const U=[];for(let V=X;V>=0;V--){const z=W[V];let q=J[V];if(q===z.length)J[V]=q=0,V>0&&J[V-1]++;U[V]=z[q]}J[X]++,yield U}}function*n1(Z,X=Infinity){while(X-- >0)yield Z}var e0=function(Z,X){Z=Z||"";let J=!0;return X?[...X].join(Z):X0(()=>"",(W,Y)=>(W=J?W+Y:W+Z+Y,J=!1,W))};var _0=function(...Z){return F8(_0,I0,Z)};var F8=(Z,X,J)=>{let W,Y;switch(J.length){case 4:Y=J[3],W=J[2];break;case 3:Y=J[2];break;case 2:return w((B)=>Z(J[0],J[1],B));default:s(J.length)}return X(d(J[0])(J[1]),W,Y)};var P8=new Set,w8=":[",l1=y(d1(),w((Z)=>w8.indexOf(Z.charAt(0))>=0?Z:" "+Z)),N8=(Z,X)=>y(Z,w((J)=>P(J)&&J.indexOf(" .")==0?J+X:J)),J0=(Z,X,J,W)=>{const Y=J.length,B=[];let U,V;const z=(q,Q)=>{let $=null;if(F(Q))J0(Z,Z1(X,B),Q,W);else if(G(Q)&&!P(Q))J0(Z,Z1(X,B),[...Q],W);else if((V=v(Q))||($=W.fns[Q]))if(!X.length){if($)return $.apply(null,J.slice(q+1))(Z,W),!0;Q(Z,W)}else if(V)z(q,Q());else K(`quoted fn ('${Q}') only allowed at head position`);else if(I(Q))U=Object.assign(U||{},Q);else if(Q!=null)B.push(Q)};for(let q=0;q<Y;q++)if(z(q,J[q]))return Z;return U&&Z.push(O8(X,B,U,W)),Z},Z1=(Z,X)=>Z.length?[...v0(Z,X)]:X,O8=(Z,X,J,W)=>{const Y=W.format,B=A(W),U=W.scope?N8(l1,W.scope):l1;return[B,_0(w((V)=>_0(U,e0(),F(V)?V:[V]).trim()),e0(Y.ruleSep),Z1(Z,X)),Y.declStart,q0(J,W),B,Y.declEnd].join("")},q0=(Z,X)=>{const J=X.format,W=X.autoprefix||P8,Y=A(X,X.depth+1),B=[];for(let U in Z)if(Z.hasOwnProperty(U)){let V=Z[U];if(v(V))V=V(Z);if(F(V))V=V.map((z)=>F(z)?z.join(" "):z).join(J.ruleSep);if(W.has(U))for(let z of X.vendors)B.push(`${Y}${z}${U}:${J.valSep}${V};`);B.push(`${Y}${U}:${J.valSep}${V};`)}return B.join(J.decls)+J.decls},A=(Z,X=Z.depth)=>X>1?[...n1(Z.format.indent,X)].join(""):X>0?Z.format.indent:"";var p1=function(Z,...X){const J=X.length===1?X[0]:{0:X[0],100:X[1]};return(W,Y)=>{const B=A(Y);Y.depth++;const U=A(Y);W.push(`${B}@keyframes ${Z}${Y.format.declStart}`);for(let V in J)if(J.hasOwnProperty(V))W.push([U,V+"%",Y.format.declStart,q0(J[V],Y),U,Y.format.declEnd].join(""));return Y.depth--,W.push(B+Y.format.declEnd),W}};var o1=(Z,X=!1)=>(J,W)=>{const Y=A(W),B=A(W,W.depth+1);if(W.format.comments||X)J.push(Y+"/*",Z.split("\n").map((U)=>B+U).join("\n"),Y+"*/");return J};var b0=(Z,X,J)=>(W,Y)=>{const B=A(Y);return W.push(`${B}${Z} ${D8(X)}${Y.format.declStart}`),Y.depth++,J0(W,[],J,Y),Y.depth--,W.push(B+Y.format.declEnd),W},D8=(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=i1.has(J)?J:`(${J})`;else if(W===!1)W=`(not ${i1.has(J)?J:`(${J})`})`;else if(W==="only")W+=" "+J;else W=`(${J}:${W})`;X.push(W)}return X.join(" and ")},i1=new Set(["all","print","screen"]);var l=(Z,X)=>{return X={format:x,vendors:x1,fns:{},depth:0,...X},F(X.autoprefix)&&(X.autoprefix=new Set(X.autoprefix)),I(Z)?q0(Z,X):v(Z)?Z([],X).join(X.format.rules):J0([],[],F(Z)?Z:T0(Z)?[...Z]:K("invalid rules"),X).join(X.format.rules)};var a1=(Z,...X)=>(J,W)=>(J.push(X.length?`@import url(${Z}) ${X.join(W.format.ruleSep)};`:`@import url(${Z});`),J);var W0=(Z,X)=>b0("@media",Z,X);var t1=function(...Z){return(X,J)=>(X.push(Z.length>1?`@namespace ${Z[0]} url(${Z[1]});`:`@namespace url(${Z[0]});`),X)};var r1=(Z,X)=>b0("@supports",Z,X);var p={"@comment":o1,"@import":a1,"@keyframes":p1,"@media":W0,"@namespace":t1,"@supports":r1};var c1=4,s1=(Z)=>c1=Z,D=(Z)=>Z===(Z|0)?String(Z):Z.toFixed(c1).replace(/^0./,".").replace(/^-0./,"-.").replace(/0+$/,""),e1=(Z)=>`${D(Z)}em`,Z5=(Z)=>`${D(Z)}ex`,X5=(Z)=>`${D(Z)}rem`,X1=(Z)=>`${D(Z)}%`,J5=(Z)=>`${D(Z)}px`,W5=(Z)=>`${D(Z)}vh`,Y5=(Z)=>`${D(Z)}vw`,B5=(Z)=>`${D(Z)}vmin`,U5=(Z)=>`${D(Z)}vmax`,V5=(Z)=>`${Z|0}ms`,z5=(Z)=>`${D(Z)}s`;var Q5=(Z)=>`${D(Z)}deg`,q5=(Z)=>`${D(Z)}rad`,$5=(Z)=>`${D(Z)}turn`,H5=(Z)=>`url(${Z})`;var N=((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})(N||{}),j=((Z)=>{return Z[Z.NEVER=0]="NEVER",Z[Z.FIRST=1]="FIRST",Z[Z.LAST=2]="LAST",Z})(j||{});var G8=0,k8=()=>G8++,o=(Z,X)=>!X||!X.id?{...X,id:Z+"-"+k8()}:X;var O=D0;class m{constructor(Z,X){this.wrapped=Z,X=o("sub",{closeIn:j.LAST,closeOut:j.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(R0()))}id;closeIn;closeOut;parent;__owner;xform;cacheLast;last=h;state=N.IDLE;subs=[];deref(){return this.last!==h?this.last:void 0}getState(){return this.state}setState(Z){this.state=Z}subscribe(Z,X={}){this.ensureState();let J;if(Z instanceof m&&!X.xform)Z.ensureState(),G0(!Z.parent,`sub '${Z.id}' already has a parent`),Z.parent=this,J=Z;else J=new m(Z,{...X,parent:this});return this.subs.push(J),this.setState(N.ACTIVE),J.setState(N.ACTIVE),this.last!=h&&J.next(this.last),J}transform(...Z){let X,J;if(I(z0(Z)))J=Z.pop(),X={error:J.error};return this.subscribe(X,o("xform",Z.length>0?{...J,xform:y(...Z)}:J))}map(Z,X){return this.transform(w(Z),X||{})}unsubscribe(Z){return Z?this.unsubscribeChild(Z):this.unsubscribeSelf()}unsubscribeSelf(){return O.debug(this.id,"unsub self"),this.parent&&this.parent.unsubscribe(this),this.state<N.UNSUBSCRIBED&&(this.state=N.UNSUBSCRIBED),this.release(),!0}unsubscribeChild(Z){O.debug(this.id,"unsub child",Z.id);const X=this.subs.indexOf(Z);if(X>=0){if(this.subs.splice(X,1),this.closeOut===j.FIRST||!this.subs.length&&this.closeOut!==j.NEVER)this.unsubscribe();return!0}return!1}next(Z){if(this.state>=N.DONE)return;this.xform?this.dispatchXform(Z):this.dispatch(Z)}done(){if(O.debug(this.id,"entering done()"),this.state>=N.DONE)return;if(this.xform){if(!this.dispatchXformDone())return}if(this.state=N.DONE,this.dispatchTo("done"))this.state<N.UNSUBSCRIBED&&this.unsubscribe();O.debug(this.id,"exiting done()")}error(Z){const X=this.wrapped,J=X&&X.error;return J&&O.debug(this.id,"attempting wrapped error handler"),J&&X.error(Z)||this.unhandledError(Z)}unhandledError(Z){return(O!==D0?O:console).warn(this.id,"unhandled error:",Z),this.unsubscribe(),this.state=N.ERROR,!1}dispatchTo(Z,X){let J=this.wrapped;if(J)try{J[Z]&&J[Z](X)}catch(Y){if(!this.error(Y))return!1}const W=Z==="next"?this.subs:[...this.subs];for(let Y=W.length;Y-- >0;){J=W[Y];try{J[Z]&&J[Z](X)}catch(B){if(Z==="error"||!J.error||!J.error(B))return this.unhandledError(B)}}return!0}dispatch(Z){O.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))k(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=f(Z);for(let J=0,W=X.length;J<W&&this.state<N.DONE;J++)this.dispatch(X[J]);return this.state<N.ERROR}ensureState(){if(this.state>=N.DONE)e(`operation not allowed in state ${this.state}`)}release(){this.subs.length=0,delete this.parent,delete this.xform,delete this.last}}var K5=(Z,X)=>{const J=new C5(X);return J.next(Z),J};class C5 extends m{src;_cancel;_inited;constructor(Z,X){const[J,W]=v(Z)?[Z,X||{}]:[void 0,Z||{}];super(W.error?{error:W.error}:void 0,o("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 Y=this.wrapped;if(!Y||!Y.error||!Y.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!==j.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){O.debug(this.id,"cancel");const Z=this._cancel;delete this._cancel,Z()}}}var M5=(Z,X)=>Z===j.FIRST||Z===j.LAST&&!X;var J1=function(Z){return Z?I0(J1(),Z):X0(()=>({}),(X,[J,W])=>(X[J]=W,X))};var W1=function(Z,X){return G(X)?n(W1(Z),X):w(v(Z)?(J)=>[Z(J),J]:(J)=>[Z,J])};var Y1=function(...Z){const X=E0(Y1,Z);if(X)return X;const J=Z[0],W=Z[1]!==!1;return w((Y)=>{const B=W?{}:Y;for(let U in Y)B[U]=J(Y[U]);return B})};var B1=function(...Z){const X=E0(B1,Z,A0);if(X)return X;const{key:J,mergeOnly:W,reset:Y,all:B,backPressure:U}={key:g1,mergeOnly:!1,reset:!0,all:!0,backPressure:0,...Z[1]},V=F(Z[0])?new Set(Z[0]):Z[0],z=new Set,q=new Map;let Q={};const $=([H,_,i])=>{let b=!0;if(W||U<1)return[H,(M)=>{if(Y&&B&&z.size>0||!Y&&b)M=i(M,Q),Q={},z.clear(),b=!1;return _(M)},(M,S)=>{const E=J(S);if(V.has(E)){if(Q[E]=S,z.add(E),W||F5(V,z))if(M=i(M,Q),b=!1,Y)Q={},z.clear();else Q={...Q}}return M}];else return[H,(M)=>{if(B&&z.size>0)M=i(M,P5(q,z)),q.clear(),z.clear();return _(M)},(M,S)=>{const E=J(S);if(V.has(E)){let C0=q.get(E);!C0&&q.set(E,C0=[]),C0.length>=U&&e(`max back pressure (${U}) exceeded for input: ${String(E)}`),C0.push(S),z.add(E);while(F5(V,z))if(M=i(M,P5(q,z)),b=!1,k(M))break}return M}]};return $.keys=()=>V,$.clear=()=>{q.clear(),V.clear(),z.clear(),Q={}},$.add=(H)=>{V.add(H)},$.delete=(H,_=!0)=>{if(q.delete(H),V.delete(H),_)z.delete(H),delete Q[H]},$},F5=(Z,X)=>{if(X.size<Z.size)return!1;for(let J of Z)if(!X.has(J))return!1;return!0},P5=(Z,X)=>{const J={};for(let W of X){const Y=Z.get(W);J[W]=Y.shift(),!Y.length&&X.delete(W)}return J};var w5=(Z,X)=>{let J=!0;for(let W of X)J=Z.removeID(W)&&J;return J};var N5=(Z)=>new O5(Z);class O5 extends m{sources;idSources;realSourceIDs;invRealSourceIDs;psync;clean;constructor(Z){const X=B1(new Set,{key:(W)=>W[0],mergeOnly:Z.mergeOnly===!0,reset:Z.reset===!0,all:Z.all!==!1,backPressure:Z.backPressure||0}),J=Y1((W)=>W[1]);super(void 0,o("streamsync",{...Z,xform:Z.xform?y(X,J,Z.xform):y(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 m?this.add(J[1]):this.next(J),done:()=>this.markDone(Z),__owner:this},{xform:W1(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 O.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 w5(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){O.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),M5(this.closeIn,this.sources.size)&&this.done()}}var U1=a((Z,X=" ")=>{const J=t(String(X),Z);return(W,Y)=>{if(W==null)return J;return W=W.toString(),Y=Y!==void 0?Y:W.length,Y<Z?J.substring(Y)+W:W}}),L2=U1(2,"0"),D5=U1(3,"0"),y2=U1(4,"0");var V1=function(Z,X){return G(X)?n(V1(Z),X):(J)=>{const W=J[2];return Z0(J,(Y,B)=>Z(B)?W(Y,B):Y)}};import{watch as T8} from"fs";import{resolve as H0} from"path";var G5={specs:r({alias:"s",optional:!1,desc:"Path to generated JSON defs"})},S0={include:c({alias:"I",desc:"Include CSS files (prepend)"})},L0={noDecls:u({alias:"d",desc:"Don't emit framework decls"})},Y0={pretty:u({alias:"p",desc:"Pretty print output"})},y0={noHeader:u({desc:"Don't emit generated header comment"})},k5={watch:u({alias:"w",desc:"Watch input files for changes"})};import{resolve as j8} from"path";var B0=(Z,X,J)=>{X=P(X)?X:X.join("\n"),Z?a0(j8(Z),X,J):console.log(X)},h0=({info:{name:Z,version:X}})=>`/*! ${Z} v${X} - generated by thi.ng/meta-css @ ${(new Date()).toISOString()} */`;var T5={desc:"Transpile & bundle meta stylesheets to CSS",opts:{...G5,...S0,...L0,...Y0,...y0,...k5,eval:r({alias:"e",desc:"eval meta stylesheet in given string (ignores other inputs & includes)"}),force:c({alias:"f",hint:"STR",desc:"CSS classes to force include (wildcards are supported, @-prefix will read from file)",delim:","})},fn:async(Z)=>{const X=L(H0(Z.opts.specs),Z.logger),J=E8(X,Z.opts.force||[],Z.logger);if(Z.opts.watch)await I8(Z,X,J);else if(Z.opts.eval)z1(Z,X,J,[Z.opts.eval]);else z1(Z,X,J,Z.inputs.map((W)=>R(H0(W),Z.logger)))}},I8=async(Z,X,J)=>{let W=!0;const Y=()=>{Z.logger.info("closing watchers..."),B.forEach((U)=>U.watcher.close()),W=!1},B=Z.inputs.map((U,V)=>{U=H0(U);const z=K5(R(U,Z.logger),{id:`in${D5(V)}`});return{input:z,watcher:T8(U,{},(q)=>{if(q==="change")try{z.next(R(U,Z.logger))}catch(Q){Z.logger.warn(Q.message),Y()}else Z.logger.warn("input removed:",U),Y()})}});N5({src:J1(w(({input:U})=>[U.id,U],B))}).subscribe({next(U){try{z1(Z,X,J,Object.keys(U).sort().map((V)=>U[V]))}catch(V){Z.logger.warn(V.message)}}}),process.on("SIGINT",Y);while(W)await u1(null,250)},z1=({logger:Z,opts:{include:X,noDecls:J,noHeader:W,out:Y,pretty:B}},U,V,z)=>{const q={logger:Z,specs:U,format:B?Q0:x,mediaQueryIDs:new Set(Object.keys(U.media)),mediaQueryRules:{...V.mediaQueryRules},plainRules:{...V.plainRules}},Q=X?X.map(($)=>R(H0($),Z).trim()):[];if(!W)Q.push(h0(U));if(!J&&U.decls.length)Q.push(l(U.decls,{format:q.format,fns:p}));z.forEach(($)=>v8($,q)),A8(Q,q),R8(Q,q),B0(Y,Q,Z)},R8=(Z,{logger:X,specs:J,format:W,mediaQueryRules:Y})=>{for(let B in Y){const U=R5(Y[B],J);X.debug("mediaquery rules",B,U),Z.push(l(W0(S8(J.media,B),U),{format:W,fns:p}))}},A8=(Z,{logger:X,specs:J,format:W,plainRules:Y})=>{const B=R5(Y,J);X.debug("plain rules",B),Z.push(l(B,{format:W,fns:p}))},E8=(Z,X,J)=>{const W=new Set(Object.keys(Z.media)),Y=new Set(Object.keys(Z.classes)),B={},U={};if(X.length&&X[0][0]==="@")X=[...g(R(H0(X[0].substring(1)),J))];for(let V of X){if(!V||V.startsWith("//"))continue;const{token:z,query:q}=A5(V,W);let Q;if(z.includes("*")){const $=new RegExp(`^${z.replace("*",".*")}\$`);Q=[...V1((H)=>$.test(H),Y)]}else if(Y.has(z))Q=[z];else{J.warn(`unknown include rule ID: ${V}, skipping...`);continue}for(let $ of Q)J.debug("including class:",$),q?E5(B,q,`.${$}`,$):v5(U,`.${$}`,$)}return{mediaQueryRules:B,plainRules:U}},v8=(Z,{specs:X,mediaQueryIDs:J,mediaQueryRules:W,plainRules:Y})=>{const B=$0(),U=$0(B),V={root:B,curr:U,scopes:[U]};for(let z of g(Z)){if(!z||/^\s*\/\//.test(z))continue;for(let q of g(z,/\s+/g)){if(!q)continue;let Q=V.curr;switch(Q.state){case"sel":case"nest":if(q==="{"){if(Q.state==="sel")Q.sel=Q.sel.map(($)=>$.replace(",","")),Q.path=_8(V.scopes);Q.state="class"}else if(q==="}")j5(V);else{const $=z0(Q.sel);if(!$||$.endsWith(","))Q.sel.push(q);else Q.sel[Q.sel.length-1]+=" "+q}break;case"class":if(q==="{")Q.state="nest",V.scopes.push(V.curr=$0(Q));else if(q==="}")j5(V);else{let{token:$,query:H}=A5(q,J);if(!X.classes[$])K(`unknown class ID: ${$}`);if(H)E5(W,H,Q.path,$);else v5(Y,Q.path,$)}break;default:e(Q.state)}}}},Q1=":",I5="///",$0=(Z)=>({state:"sel",sel:Z?[]:["<root>"],path:"",parent:Z}),j5=(Z)=>{const X=!Z.curr.sel.length;if(G0(!!Z.curr.parent,"stack underflow"),Z.scopes.pop(),Z.scopes.length>0){if(Z.curr=z0(Z.scopes),!X&&Z.curr.state==="nest")Z.scopes.push(Z.curr=$0(Z.curr))}else Z.scopes.push(Z.curr=$0(Z.root))},_8=(Z)=>Z.map((X)=>X.sel.join(",")).join(I5),R5=(Z,X)=>Object.entries(Z).map(([J,W])=>b8(J,W,X)),b8=(Z,X,J)=>{const W=[];let Y=W;const B=Z.split(I5);for(let U=0;U<B.length;U++){const V=B[U].split(",");if(U==B.length-1){const z=Object.assign({},...w((q)=>J.classes[q],X));if("__user"in z)delete z.__user;V.push(z)}Y.push(V),Y=V}return W[0]},A5=(Z,X)=>{if(/^::?/.test(Z))return{token:Z};const J=Z.lastIndexOf(Q1);if(J<0)return{token:Z};const W=Z.substring(0,J);if(!W.split(Q1).every((B)=>X.has(B)))K(`invalid media query in token: ${Z}`);return{token:Z.substring(J+1),query:W}},S8=(Z,X)=>X.split(Q1).reduce((J,W)=>Object.assign(J,Z[W]),{}),E5=(Z,X,J,W)=>{if(!Z[X])Z[X]={};(Z[X][J]||(Z[X][J]=new Set)).add(W)},v5=(Z,X,J)=>(Z[X]||(Z[X]=new Set)).add(J);import{resolve as _5} from"path";var S5={desc:"Export entire generated framework as CSS",opts:{...S0,...L0,...Y0,...y0,media:c({alias:"m",hint:"ID",desc:"Media query IDs (use 'ALL' for all)",delim:","})},inputs:1,fn:async(Z)=>{const{logger:X,opts:{include:J,media:W,noDecls:Y,noHeader:B,pretty:U,out:V},inputs:z}=Z,q=L(_5(z[0]),X),Q=J?J.map(($)=>R(_5($),X).trim()):[];if(!B)Q.push(h0(q));if(!Y&&q.decls.length)Q.push(l(q.decls,{format:U?Q0:x,fns:p}));Q.push(L8(q,W,U,X)),B0(V,Q,X)}},L8=(Z,X,J,W)=>{const Y=b5("",Z);if(X){const B=X[0]==="ALL"?Object.keys(Z.media):X;for(let U of B)if(Z.media[U])Y.push(W0(Z.media[U],b5("-"+U,Z)));else W.warn(`invalid media query ID: ${U}, skipping...`)}return l(Y,{format:J?Q0:x,fns:p})},b5=(Z,X)=>Object.entries(X.classes).map(([J,W])=>[`.${J}${Z}`,y8(W)]),y8=(Z)=>{if("__user"in Z)Z={...Z},delete Z.__user;return Z};import{resolve as h8} from"path";var L5={deg:Q5,em:e1,ex:Z5,ms:V5,percent:X1,px:J5,rad:q5,rem:X5,second:z5,turn:$5,url:H5,vh:W5,vmax:U5,vmin:B5,vw:Y5,"%":X1},f8={"":[""],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"]},y5={desc:"Generate framework rules from specs",opts:{...Y0,prec:P1({default:3,desc:"Number of fractional digits"})},fn:async(Z)=>{const{logger:X,opts:{prec:J,out:W,pretty:Y},inputs:B}=Z,U={info:{name:"TODO",version:"0.0.0"},media:{},classes:{},decls:[]};s1(J);for(let V of B){const z=L(h8(V),X);if(Object.assign(U.info,z.info),Object.assign(U.media,z.media),z.decls)U.decls.push(...z.decls);for(let q of z.specs)m8(z,q,U.classes,X)}B0(W,JSON.stringify(U,null,Y?4:0),X)}},m8=(Z,X,J,W)=>{const Y=F(X.var)?X.var:[""],B=P(X.props)?{[X.props]:"<v>"}:X.props,U=u8(X,Z),V=new Set;for(let z of Y)for(let[q,Q]of v0(Z.vars?.[z]||f8[z],Object.keys(U))){const $=K0(X.name,z,q,Q,U[Q]),H=X.unit?K0(X.unit,z,q,Q,U[Q]):void 0,_=g8(U[Q],H);if(!J[$])J[$]=X.user!=null?{__user:K0(X.user,z,q,Q,U[Q])}:{};else if(!V.has($))K(`duplicate class ID: ${$}`);V.add($);for(let[i,b]of Object.entries(B)){const M=K0(i,z,q,Q,U[Q]),S=K0(!H||P(b)?String(b):L5[H](b),z,q,Q,_);J[$][M]=S,W.debug($,M,S)}}return J},u8=(Z,X)=>{const J=P(Z.values)?X.tables?.[Z.values]||K(`invalid table ID: ${Z.values}`):Z.values;if(I(J))return J;const W=Z.key==="v"?(Y)=>String(Y):Z.key==="i1"?(Y,B)=>String(B+1):Z.key===void 0?(Y,B)=>String(B):K(`invalid key type: ${Z.key}`);return J.reduce((Y,B,U)=>{return Y[W(B,U)]=B,Y},{})},g8=(Z,X)=>{if(!X||P(Z))return Z;const J=L5[X];if(!J)K(`invalid unit: ${X}`);return J(Z)},K0=(Z,X,J,W,Y)=>Z.replace("<vid>",X).replace("<var>",J).replace("<k>",W).replace("<v>",String(Y));var q1=L(x8(import.meta.dir,"package.json"));L1({name:"metacss",opts:{out:r({alias:"o",desc:"Output file (or stdout)"}),verbose:u({alias:"v",desc:"Display extra process information"})},commands:{convert:T5,export:S5,generate:y5},ctx:async(Z)=>{if(Z.opts.verbose)Z.logger.level=C.DEBUG;return{...Z,format:N0}},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 ${q1.name} ${q1.version}
|
|
9
|
+
\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2502 ${q1.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.5.0",
|
|
4
4
|
"description": "Data-driven CSS framework codegen, transpiler & bundler",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -38,26 +38,26 @@
|
|
|
38
38
|
"test": "bun test"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@thi.ng/api": "^8.9.
|
|
42
|
-
"@thi.ng/args": "^2.3.
|
|
43
|
-
"@thi.ng/arrays": "^2.7.
|
|
44
|
-
"@thi.ng/checks": "^3.4.
|
|
45
|
-
"@thi.ng/compose": "^2.1.
|
|
46
|
-
"@thi.ng/errors": "^2.4.
|
|
47
|
-
"@thi.ng/file-io": "^1.1.
|
|
48
|
-
"@thi.ng/hiccup-css": "^2.3.
|
|
49
|
-
"@thi.ng/logger": "^2.1.
|
|
50
|
-
"@thi.ng/rstream": "^8.2.
|
|
51
|
-
"@thi.ng/strings": "^3.7.
|
|
52
|
-
"@thi.ng/text-format": "^2.0.
|
|
53
|
-
"@thi.ng/transducers": "^8.8.
|
|
41
|
+
"@thi.ng/api": "^8.9.15",
|
|
42
|
+
"@thi.ng/args": "^2.3.3",
|
|
43
|
+
"@thi.ng/arrays": "^2.7.12",
|
|
44
|
+
"@thi.ng/checks": "^3.4.15",
|
|
45
|
+
"@thi.ng/compose": "^2.1.54",
|
|
46
|
+
"@thi.ng/errors": "^2.4.9",
|
|
47
|
+
"@thi.ng/file-io": "^1.1.3",
|
|
48
|
+
"@thi.ng/hiccup-css": "^2.3.5",
|
|
49
|
+
"@thi.ng/logger": "^2.1.2",
|
|
50
|
+
"@thi.ng/rstream": "^8.2.18",
|
|
51
|
+
"@thi.ng/strings": "^3.7.6",
|
|
52
|
+
"@thi.ng/text-format": "^2.0.2",
|
|
53
|
+
"@thi.ng/transducers": "^8.8.19"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@microsoft/api-extractor": "^7.
|
|
57
|
-
"esbuild": "^0.19.
|
|
56
|
+
"@microsoft/api-extractor": "^7.39.0",
|
|
57
|
+
"esbuild": "^0.19.10",
|
|
58
58
|
"rimraf": "^5.0.5",
|
|
59
59
|
"typedoc": "^0.25.4",
|
|
60
|
-
"typescript": "^5.3.
|
|
60
|
+
"typescript": "^5.3.3"
|
|
61
61
|
},
|
|
62
62
|
"keywords": [
|
|
63
63
|
"browser",
|
|
@@ -105,5 +105,5 @@
|
|
|
105
105
|
"status": "alpha",
|
|
106
106
|
"year": 2023
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "775c664723cd87d6ac5909cedf91195317add287\n"
|
|
109
109
|
}
|
package/specs/anim.json
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
{
|
|
2
|
+
"decls": [["@keyframes", "fadein", { "opacity": 0 }, { "opacity": 1 }]],
|
|
2
3
|
"specs": [
|
|
4
|
+
{
|
|
5
|
+
"user": "animations / transitions",
|
|
6
|
+
"name": "fadein<k>",
|
|
7
|
+
"key": "i1",
|
|
8
|
+
"props": { "animation": "fadein <v> ease-in-out forwards" },
|
|
9
|
+
"values": [0.25, 0.5, 1],
|
|
10
|
+
"unit": "second"
|
|
11
|
+
},
|
|
3
12
|
{
|
|
4
13
|
"user": "animations / transitions",
|
|
5
14
|
"name": "bg-anim<k>",
|
|
6
15
|
"key": "i1",
|
|
7
|
-
"props": { "transition": "<v>
|
|
16
|
+
"props": { "transition": "<v> background-color ease-in-out" },
|
|
8
17
|
"values": [0.15, 0.25, 0.5],
|
|
9
|
-
"unit":
|
|
18
|
+
"unit": "second"
|
|
10
19
|
}
|
|
11
20
|
]
|
|
12
21
|
}
|
package/specs/normalize.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"decls": [
|
|
3
|
+
["@comment", "----- start: CSS normalization -----"],
|
|
3
4
|
[":root", { "font-size": "16px" }],
|
|
4
5
|
["html", { "line-height": 1.15, "-webkit-text-size-adjust": "100%" }],
|
|
5
6
|
["body", { "margin": 0 }],
|
|
@@ -150,7 +151,8 @@
|
|
|
150
151
|
"ul li",
|
|
151
152
|
[":first-child", { "margin-top": 0 }],
|
|
152
153
|
[":last-child", { "margin-bottom": 0 }]
|
|
153
|
-
]
|
|
154
|
+
],
|
|
155
|
+
["@comment", "----- end: CSS normalization -----"]
|
|
154
156
|
],
|
|
155
157
|
"specs": []
|
|
156
158
|
}
|