@thi.ng/meta-css 0.5.0 → 0.5.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2023-12-28T23:24:39Z
3
+ - **Last updated**: 2023-12-31T09:44:23Z
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,12 @@ 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.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/meta-css@0.5.1) (2023-12-31)
13
+
14
+ #### ♻️ Refactoring
15
+
16
+ - update spec format (key & variations) ([f7f2d09](https://github.com/thi-ng/umbrella/commit/f7f2d09))
17
+
12
18
  ## [0.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/meta-css@0.5.0) (2023-12-28)
13
19
 
14
20
  #### 🚀 Features
package/README.md CHANGED
@@ -7,8 +7,9 @@
7
7
  ![npm downloads](https://img.shields.io/npm/dm/@thi.ng/meta-css.svg)
8
8
  [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)
9
9
 
10
- This project is part of the
11
- [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo and anti-framework.
10
+ This is a standalone project, maintained as part of the
11
+ [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo and
12
+ anti-framework.
12
13
 
13
14
  - [About](#about)
14
15
  - [Generating CSS frameworks](#generating-css-frameworks)
@@ -44,42 +45,51 @@ This project is part of the
44
45
 
45
46
  Data-driven CSS framework codegen, transpiler & bundler.
46
47
 
47
- This toolchain and the overall workflow proposed by it is heavily building atop
48
- the concept of _CSS utility classes_ (as known from Tachyons, Turret or the
49
- newer Tailwind projects). How and where those CSS classes are applied is however
50
- a defining point of difference to other existing approaches. Furthermore, using
51
- JSON as data format for expressing generative rules and as intermediate format
52
- for generated frameworks, removes the need for any complex CSS-related
53
- dependencies and makes it trivial to build secondary tooling around (e.g. part
54
- of this readme is an auto-generated report of the included base framework
55
- specs).
48
+ This toolkit (started as experiment in 2016) and the overall design approach and
49
+ workflows proposed by it are heavily building atop the concept of _CSS utility
50
+ classes_ (as known from [Tachyons](https://tachyons.io/),
51
+ [Turret](https://turretcss.com/) or the newer
52
+ [Tailwind](https://tailwindcss.com/) projects). How and where those CSS classes
53
+ are defined and later applied is however a major defining point of difference to
54
+ these other existing approaches and will be explained in this document. To
55
+ remove the need for any complex & bloated CSS-related dependencies (parsers
56
+ etc.) and to simplify building secondary tooling (e.g. part of this readme is an
57
+ [auto-generated report of the included base framework
58
+ specs](#bundled-css-base-framework)), we're using JSON — rather than CSS — as
59
+ data format to: 1) express the _generative_ rules to define all the CSS classes,
60
+ declarations, media query criteria which are forming a framework and
61
+ 2) as intermediate data format for a generated CSS framework itself. **The
62
+ entire toolkit (incl. all bundled dependencies) is currently only 32KB!**
56
63
 
57
64
  This readme aims to provide a thorough overview of this toolchain and some
58
65
  concrete usage examples...
59
66
 
60
67
  Note: In all cases, final CSS generation itself is handled by
61
68
  [thi.ng/hiccup-css](https://github.com/thi-ng/umbrella/blob/develop/packages/hiccup-css/).
69
+ Please see its readme for further useful information.
62
70
 
63
- **👷🏻 This is all WIP!** Also see included & linked examples for basic usage...
71
+ **👷🏻 This is all WIP!** See included & [linked examples](#usage-examples) for
72
+ concrete usage...
64
73
 
65
74
  ## Generating CSS frameworks
66
75
 
67
- The `generate` command is used to generate custom frameworks with (likely)
68
- hundreds of CSS utility classes from a number of extremely compact, parametric
69
- JSON rule specs. This process generates all desired, combinatorial versions of
70
- various rules/declarations and exports them to another JSON file used as
71
- intermediary for the other commands provided by this toolchain. The
72
- [syntax/format of the generator rules](#framework-generation-specs--syntax) is explained
73
- further on. These rule specs can be split up into multiple files for better
74
- handling, can define [arbitrary media query criteria]() (all later combinable),
75
- shared lookup tables for colors, margins, sizes, timings etc.
76
-
77
- The package includes generator specs for a basic, fully customizable,
78
- [tachyons.io](https://tachyons.io)-derived [CSS
79
- framework](#bundled-css-base-framework). These specs and resulting framework are
80
- still being worked on and are used for some example projects in this repo, but
81
- are mostly intended as basic starting points for creating other custom
82
- frameworks (in the hope they'll be shared back similarly)...
76
+ The `generate` command is used to generate custom CSS frameworks with (likely)
77
+ hundreds of utility classes, all derived from a number of extremely compact,
78
+ parametric JSON rule specs. This process generates all desired, combinatorial
79
+ versions of various rules/declarations and exports them to a framework JSON file
80
+ used as intermediary stage for the other commands provided by this toolchain.
81
+ The [syntax/format of the generator rules](#framework-generation-specs--syntax)
82
+ is explained further on. These rule specs can be split up into multiple files
83
+ for better handling, can define [arbitrary media query
84
+ criteria](#media-query-definitions) (all later combinable), shared lookup tables
85
+ for colors, margins, sizes, timings etc.
86
+
87
+ The package includes dozens of generator specs for a basic, fully customizable,
88
+ Tachyons-derived [CSS framework](#bundled-css-base-framework). These specs and
89
+ resulting framework are still being worked on and are used for some example
90
+ projects in this repo, but are mostly intended as basic starting points for
91
+ creating other custom frameworks (_in the hope some useful specs will be shared back
92
+ similarly_)...
83
93
 
84
94
  ```text
85
95
  metacss generate --help
@@ -100,8 +110,8 @@ Main:
100
110
  ### Framework generation specs & syntax
101
111
 
102
112
  This section gives an overview of the JSON format used to generate CSS
103
- frameworks of dozens (usually hundreds) of utility classes, including many
104
- possible variations (per spec).
113
+ frameworks of dozens (usually hundreds or thousands) of utility classes,
114
+ including many possible variations (per spec).
105
115
 
106
116
  Generation specs use a simple JSON structure as shown below. The specs can be
107
117
  split over multiple files and will all be merged by the `generate` command of
@@ -117,14 +127,15 @@ the toolchain.
117
127
  // optional media queries and their criteria, will be merged from multiple spec files
118
128
  "media": {
119
129
  "large": { "min-width": "60rem" },
120
- "dark": { "prefers-color-scheme": "dark" }
130
+ "dark": { "prefers-color-scheme": "dark" },
131
+ "anim": { "prefers-reduced-motion": false }
121
132
  },
122
133
  // optional shared values/LUTs (arrays or objects)
123
- // tables are always local to the current spec file only...
134
+ // (local to the current file only)
124
135
  "tables": {
125
136
  "margins": [0, 0.25, 0.5, 1, 2, 4]
126
137
  },
127
- // optional shared variations
138
+ // optional shared variations (local to current file only)
128
139
  "vars": {
129
140
  "size": ["width", "height"]
130
141
  },
@@ -150,7 +161,7 @@ For each additional value added to the `margins` table, 7 more CSS classes will
150
161
  generated. The `name` (class) and `props` (CSS property name) are parametric and
151
162
  will be explained in more detail further below.
152
163
 
153
- ```json tangle:export/readme-margins.json
164
+ ```json tangle:export/readme-margins.mcss.json
154
165
  {
155
166
  "tables": {
156
167
  "margins": [0, 0.5, 1]
@@ -161,18 +172,18 @@ will be explained in more detail further below.
161
172
  "props": "margin<var>",
162
173
  "values": "margins",
163
174
  "unit": "rem",
164
- "var": ["a", "t", "r", "b", "l", "h", "v"]
175
+ "vars": ["a", "t", "r", "b", "l", "h", "v"]
165
176
  }
166
177
  ]
167
178
  }
168
179
  ```
169
180
 
170
- Assuming the above spec has been saved to file `myspecs.json`...
181
+ Assuming the above spec has been saved to file `margins.mcss.json`...
171
182
 
172
183
  ```bash
173
184
  # the generate cmd can merge specs from multiple input files
174
185
  # if no `--out` file is given, the result will go to stdout
175
- metacss generate --pretty myspecs.json
186
+ metacss generate --pretty margins.mcss.json
176
187
  ```
177
188
 
178
189
  ...this command (with the above spec) will generate the following output (here
@@ -221,26 +232,28 @@ An individual generator spec JSON object can contain the following keys:
221
232
 
222
233
  | **ID** | **Type** | **Description** |
223
234
  |----------|-------------------------|--------------------------------------------------------------|
235
+ | `key` | string, optional | Method for deriving keys from current value |
224
236
  | `name` | string | Parametric name for the generated CSS class(es) |
225
237
  | `props` | string or object | CSS property name(s), possibly parametric |
226
- | `values` | string, array or object | Values to be assigned to CSS properties, possibly parametric |
227
238
  | `unit` | string, optional | CSS unit to use for values |
228
- | `key` | string, optional | Method for deriving keys from current value |
229
- | `var` | string[], optional | Array of variation IDs (see section below) |
230
- | `user` | any, optional | Custom user data, comments, metadata etc. |
239
+ | `user` | any, optional | Custom, arbitrary user data, comments, metadata etc. |
240
+ | `values` | string, array or object | Values to be assigned to CSS properties, possibly parametric |
241
+ | `vars` | string[], optional | Array of variation IDs (see section below) |
231
242
 
232
243
  The number of generated CSS classes per spec is the number of items in `values`
233
244
  multiplied by the number of variations in `var` (if any).
234
245
 
235
246
  Any `user` data will be stored (as is) with each generated CSS class, but
236
- currently has no other direct use in the toolchain and is meant for additional
237
- user-defined tooling.
247
+ currently has no direct use in the toolchain and is purely intended for
248
+ additional user-defined custom tooling.
238
249
 
239
250
  #### Variations
240
251
 
241
252
  Variations can be requested by providing an array of valid variation IDs. If
242
- used, `<vid>` or `<var>` parameters must be used in the `name` or else naming
243
- conflicts will occur.
253
+ used, `<vid>` or `<var>` parameters **must** be used in the `name` or else
254
+ naming conflicts will occur.
255
+
256
+ The following variation presets are available:
244
257
 
245
258
  | **ID** | **Expanded values** |
246
259
  |------------|-----------------------|
@@ -259,26 +272,60 @@ conflicts will occur.
259
272
  | `"x"` | `["-x"]` |
260
273
  | `"y"` | `["-y"]` |
261
274
 
275
+ Custom, file-local variations can also be used (parameters in `name` and `props`
276
+ will be explained next), e.g.:
277
+
278
+ ```json tangle:export/readme-custom-vars.mcss.json
279
+ {
280
+ "vars": {
281
+ "svg": ["fill", "stroke"]
282
+ },
283
+ "specs": [
284
+ {
285
+ "name": "<var>-<k>",
286
+ "props": { "<var>": "<v>" },
287
+ "values": { "black": "#000", "white": "#fff", "current": "currentColor" },
288
+ "vars": ["svg"]
289
+ }
290
+ ]
291
+ }
292
+ ```
293
+
294
+ This spec will generate the following classes:
295
+
296
+ ```json
297
+ {
298
+ "fill-black": { "fill": "#000" },
299
+ "fill-white": { "fill": "#fff" },
300
+ "fill-current": { "fill": "currentColor" },
301
+ "stroke-black": { "stroke": "#000" },
302
+ "stroke-white": { "stroke": "#fff" },
303
+ "stroke-current": { "stroke": "currentColor" }
304
+ }
305
+ ```
306
+
262
307
  #### Parametric IDs
263
308
 
264
309
  The following parameters can (and should) be used in a spec's `name` and `props`
265
310
  to generate multiple pattern-based values (more examples below).
266
311
 
267
- - `<vid>` is a value from the ID column of the above variations table. If no
268
- variations are requested, its value will be an empty string.
269
- - `<var>` is one of the expanded values for the current variation (2nd column of
270
- variations table). If no variations are defined, this too will be an empty
271
- string.
312
+ - `<vid>` is the ID of the currently processed variation (e.g. a value from the
313
+ ID column in the above table). If no variations are requested, this value will
314
+ be an empty string.
315
+ - `<var>` is one of the expanded values for the current variation (e.g. 2nd
316
+ column of variations table). If no variations are defined, this too will be an
317
+ empty string.
272
318
  - `<v>` is the currently processed value of a spec's `values`.
273
- - `<k>` is the key (possibly derived) for the currently processed value of a
274
- spec's `values` and will depend on the type of `values` (see below)
319
+ - `<k>` is the (possibly derived) key for the currently processed value of a
320
+ spec's `values` collection and will depend on the type of `values` (see [key
321
+ value generation](#key-value-generation))
275
322
 
276
323
  #### Values
277
324
 
278
325
  The `values` are used to populate the `props` (CSS properties). If `values` is a
279
326
  string it will be used as table-name to look up in the current spec file's
280
- `tables`, an object storing values which should be shared among specs (only in
281
- the same file).
327
+ `tables`, an object storing value collections which should be shared among specs
328
+ (only in the same file).
282
329
 
283
330
  Other allowed types of `values`: string array, numeric array or object of
284
331
  key-value pairs (where values are strings or numbers too). The following
@@ -293,7 +340,7 @@ Using a named `tables` entry:
293
340
  },
294
341
  "specs": [
295
342
  {
296
- "name": "test<v>",
343
+ "name": "test-<v>",
297
344
  "props": "color",
298
345
  "values": "test"
299
346
  }
@@ -305,7 +352,7 @@ Using an array directly (here only showing the spec itself for brevity):
305
352
 
306
353
  ```json
307
354
  {
308
- "name": "test<v>",
355
+ "name": "test-<v>",
309
356
  "props": "color",
310
357
  "values": ["red", "green", "blue"]
311
358
  }
@@ -315,7 +362,7 @@ Using an object (ignoring the keys, only using the values here):
315
362
 
316
363
  ```json
317
364
  {
318
- "name": "test<v>",
365
+ "name": "test-<v>",
319
366
  "props": "color",
320
367
  "values": { "r": "red", "g": "green", "b": "blue"}
321
368
  }
@@ -363,13 +410,13 @@ Will result in these definitions:
363
410
 
364
411
  The `key` field is only used when `values` is resolving to an array. In this
365
412
  case this field determines how a "key" value (aka the `<k>` param for string
366
- interpolation, see below) will be derived for each value in `values`:
413
+ interpolation) will be derived for each value in `values`:
367
414
 
368
415
  | **`key`** | **`values`** | **Description** | **Examples** |
369
416
  |-----------|-----------------|-------------------------|--------------|
370
417
  | `v` | `[10, 20, ...]` | Actual array item value | 10, 20, ... |
371
418
  | `i` | `[10, 20, ...]` | Array item index | 0, 1,... |
372
- | `i1` | `[10, 20, ...]` | Array item index + 1 | 1, 2,... |
419
+ | `i+1` | `[10, 20, ...]` | Array item index + 1 | 1, 2,... |
373
420
 
374
421
  If `values` resolves to an object, the `<k>` param will always be the key of the
375
422
  currently processed value.
@@ -413,7 +460,7 @@ specs](https://github.com/thi-ng/umbrella/blob/982fff7bfcc48f108b6ad88f854ef00be
413
460
  ## Converting meta stylesheets to CSS
414
461
 
415
462
  The `convert` command is used to compile & bundle actual CSS from user-provided
416
- MetaCSS stylesheets (`*.meta` files) and the JSON framework specs created by the
463
+ MetaCSS stylesheets (`*.mcss` files) and the JSON framework specs created by the
417
464
  `generate` command. The meta-stylesheets support any CSS selectors, are nestable
418
465
  and compose full CSS declarations from lists of the utility classes in the
419
466
  generated framework.
@@ -429,7 +476,7 @@ from multiple input files. **The resulting CSS will only contain referenced
429
476
  rules** and can be generated in minified or pretty printed formats (it's also
430
477
  possible to [force include CSS classes which are otherwise
431
478
  unreferenced](#force-inclusion-of-unreferenced-classes)). Additionally, multiple
432
- `.meta` stylesheets can be watched for changes (their definitions getting
479
+ `.mcss` stylesheets can be watched for changes (their definitions getting
433
480
  merged), and existing CSS files can be included (prepended) in the bundled
434
481
  output too.
435
482
 
@@ -480,8 +527,8 @@ selector {
480
527
 
481
528
  #### Class identifiers & media query prefixes
482
529
 
483
- As indicated by the above file structure, `*.meta` stylesheets purely consist of
484
- CSS selectors and the names of the generated framework-defined utility classes.
530
+ As indicated by the above file structure, `*.mcss` stylesheets purely consist of
531
+ CSS selectors and the names of the utility classes defined in a generated framework.
485
532
  For example, using the [bundled framework specs](#bundled-css-base-framework),
486
533
  this simple meta-stylesheet `body { ma0 monospace blue }` creates a CSS rule for
487
534
  `body` with the definitions of the generated `ma0`, `monospace` and `blue`
@@ -498,11 +545,11 @@ body {
498
545
  #### Media query prefixes
499
546
 
500
547
  This toolchain doesn't pre-generate media-query-specific versions of any CSS
501
- class, and any class ID/token can be prefixed with any number of media query IDs
502
- (separated by `:`). These [media queries are defined as part of the framework
503
- generation specs](#media-query-definitions) and when used as a prefix, multiple
504
- query IDs can be combined freely. For example, the meta-stylesheet `a:hover {
505
- dark:bg-blue dark:anim:bg-anim2 }` will auto-create two separate CSS
548
+ class, and any utility class ID/token can be prefixed with any number of media
549
+ query IDs (separated by `:`). These [media queries are defined as part of the
550
+ framework generation specs](#media-query-definitions) and when used as a prefix,
551
+ multiple query IDs can be combined freely. For example, the meta-stylesheet
552
+ `a:hover { dark:bg-blue dark:anim:bg-anim2 }` will auto-create two separate CSS
506
553
  `@media`-query blocks for the query IDs `dark` and `(dark AND anim)`:
507
554
 
508
555
  ```css
@@ -521,9 +568,9 @@ dark:bg-blue dark:anim:bg-anim2 }` will auto-create two separate CSS
521
568
 
522
569
  A more detailed example, split over two files (for merging & bundling):
523
570
 
524
- readme.meta:
571
+ readme.mcss:
525
572
 
526
- ```text tangle:export/readme.meta
573
+ ```text tangle:export/readme.mcss
527
574
  body {
528
575
  // no margins
529
576
  ma0
@@ -549,16 +596,17 @@ body {
549
596
  }
550
597
  ```
551
598
 
552
- readme2.meta:
599
+ readme2.mcss:
553
600
 
554
601
  We will merge the definitions in this file with the ones above (i.e. adding &
555
602
  overriding some of the declarations, here: a larger border radius):
556
603
 
557
- ```text tangle:export/readme2.meta
604
+ ```text tangle:export/readme2.mcss
558
605
  #app { pa2 }
559
606
 
560
607
  .bt-group-v > a {
561
608
  {
609
+ // override border radii
562
610
  :first-child { brt4 }
563
611
  :last-child { brb4 }
564
612
  }
@@ -568,10 +616,10 @@ overriding some of the declarations, here: a larger border radius):
568
616
  ```bash
569
617
  # if no --out dir is specified, writes result to stdout...
570
618
  # use previously generated framework for resolving all identifiers & media queries
571
- metacss convert --pretty --specs framework.json readme.meta readme2.meta
619
+ metacss convert --pretty --specs framework.json readme.mcss readme2.mcss
572
620
  ```
573
621
 
574
- Resulting CSS bundle output:
622
+ Resulting merged CSS bundle output:
575
623
 
576
624
  ```css
577
625
  /*! MetaCSS base v0.0.1 - generated by thi.ng/meta-css @ 2023-12-18T12:22:36.548Z */
@@ -665,7 +713,7 @@ verbatim and will **not** be transformed or reformatted in any way.
665
713
  ### Force inclusion of unreferenced classes
666
714
 
667
715
  Only the CSS classes (and their optionally associated media queries) referenced
668
- in a `.meta` stylesheet will appear in the export CSS bundle. This ensures that
716
+ in a `.mcss` stylesheet will appear in the export CSS bundle. This ensures that
669
717
  the resulting CSS will only contain what's actually used (same effect as
670
718
  tree-shaking, only vastly more efficient). However, this also means any CSS
671
719
  classes (and optionally, their media query qualifiers) which are otherwise
@@ -759,7 +807,7 @@ Currently available CSS classes in MetaCSS base v0.0.1:
759
807
 
760
808
  #### Colors <!-- notoc -->
761
809
 
762
- `b--black` / `b--blue` / `b--dark-blue` / `b--dark-gray` / `b--dark-green` / `b--dark-pink` / `b--dark-red` / `b--gold` / `b--gray` / `b--green` / `b--hot-pink` / `b--light-blue` / `b--light-gray` / `b--light-green` / `b--light-pink` / `b--light-purple` / `b--light-red` / `b--light-silver` / `b--light-yellow` / `b--lightest-blue` / `b--mid-gray` / `b--moon-gray` / `b--navy` / `b--near-black` / `b--near-white` / `b--orange` / `b--pink` / `b--purple` / `b--red` / `b--silver` / `b--transparent` / `b--vcol1` / `b--vcol10` / `b--vcol11` / `b--vcol12` / `b--vcol13` / `b--vcol14` / `b--vcol15` / `b--vcol16` / `b--vcol2` / `b--vcol3` / `b--vcol4` / `b--vcol5` / `b--vcol6` / `b--vcol7` / `b--vcol8` / `b--vcol9` / `b--washed-blue` / `b--washed-green` / `b--washed-red` / `b--washed-yellow` / `b--white` / `b--yellow` / `bg-black` / `bg-blue` / `bg-dark-blue` / `bg-dark-gray` / `bg-dark-green` / `bg-dark-pink` / `bg-dark-red` / `bg-gold` / `bg-gray` / `bg-green` / `bg-hot-pink` / `bg-light-blue` / `bg-light-gray` / `bg-light-green` / `bg-light-pink` / `bg-light-purple` / `bg-light-red` / `bg-light-silver` / `bg-light-yellow` / `bg-lightest-blue` / `bg-mid-gray` / `bg-moon-gray` / `bg-navy` / `bg-near-black` / `bg-near-white` / `bg-orange` / `bg-pink` / `bg-purple` / `bg-red` / `bg-silver` / `bg-transparent` / `bg-vcol1` / `bg-vcol10` / `bg-vcol11` / `bg-vcol12` / `bg-vcol13` / `bg-vcol14` / `bg-vcol15` / `bg-vcol16` / `bg-vcol2` / `bg-vcol3` / `bg-vcol4` / `bg-vcol5` / `bg-vcol6` / `bg-vcol7` / `bg-vcol8` / `bg-vcol9` / `bg-washed-blue` / `bg-washed-green` / `bg-washed-red` / `bg-washed-yellow` / `bg-white` / `bg-yellow` / `black` / `blue` / `dark-blue` / `dark-gray` / `dark-green` / `dark-pink` / `dark-red` / `gold` / `gray` / `green` / `hot-pink` / `light-blue` / `light-gray` / `light-green` / `light-pink` / `light-purple` / `light-red` / `light-silver` / `light-yellow` / `lightest-blue` / `mid-gray` / `moon-gray` / `navy` / `near-black` / `near-white` / `o-0` / `o-10` / `o-100` / `o-20` / `o-30` / `o-40` / `o-50` / `o-60` / `o-70` / `o-80` / `o-90` / `orange` / `pink` / `purple` / `red` / `silver` / `transparent` / `vcol1` / `vcol10` / `vcol11` / `vcol12` / `vcol13` / `vcol14` / `vcol15` / `vcol16` / `vcol2` / `vcol3` / `vcol4` / `vcol5` / `vcol6` / `vcol7` / `vcol8` / `vcol9` / `washed-blue` / `washed-green` / `washed-red` / `washed-yellow` / `white` / `yellow`
810
+ `b--black` / `b--blue` / `b--current` / `b--dark-blue` / `b--dark-gray` / `b--dark-green` / `b--dark-pink` / `b--dark-red` / `b--gold` / `b--gray` / `b--green` / `b--hot-pink` / `b--light-blue` / `b--light-gray` / `b--light-green` / `b--light-pink` / `b--light-purple` / `b--light-red` / `b--light-silver` / `b--light-yellow` / `b--lightest-blue` / `b--mid-gray` / `b--moon-gray` / `b--navy` / `b--near-black` / `b--near-white` / `b--orange` / `b--pink` / `b--purple` / `b--red` / `b--silver` / `b--transparent` / `b--vcol1` / `b--vcol10` / `b--vcol11` / `b--vcol12` / `b--vcol13` / `b--vcol14` / `b--vcol15` / `b--vcol16` / `b--vcol2` / `b--vcol3` / `b--vcol4` / `b--vcol5` / `b--vcol6` / `b--vcol7` / `b--vcol8` / `b--vcol9` / `b--washed-blue` / `b--washed-green` / `b--washed-red` / `b--washed-yellow` / `b--white` / `b--yellow` / `bg-black` / `bg-blue` / `bg-current` / `bg-dark-blue` / `bg-dark-gray` / `bg-dark-green` / `bg-dark-pink` / `bg-dark-red` / `bg-gold` / `bg-gray` / `bg-green` / `bg-hot-pink` / `bg-light-blue` / `bg-light-gray` / `bg-light-green` / `bg-light-pink` / `bg-light-purple` / `bg-light-red` / `bg-light-silver` / `bg-light-yellow` / `bg-lightest-blue` / `bg-mid-gray` / `bg-moon-gray` / `bg-navy` / `bg-near-black` / `bg-near-white` / `bg-orange` / `bg-pink` / `bg-purple` / `bg-red` / `bg-silver` / `bg-transparent` / `bg-vcol1` / `bg-vcol10` / `bg-vcol11` / `bg-vcol12` / `bg-vcol13` / `bg-vcol14` / `bg-vcol15` / `bg-vcol16` / `bg-vcol2` / `bg-vcol3` / `bg-vcol4` / `bg-vcol5` / `bg-vcol6` / `bg-vcol7` / `bg-vcol8` / `bg-vcol9` / `bg-washed-blue` / `bg-washed-green` / `bg-washed-red` / `bg-washed-yellow` / `bg-white` / `bg-yellow` / `black` / `blue` / `current` / `dark-blue` / `dark-gray` / `dark-green` / `dark-pink` / `dark-red` / `fill-black` / `fill-blue` / `fill-current` / `fill-dark-blue` / `fill-dark-gray` / `fill-dark-green` / `fill-dark-pink` / `fill-dark-red` / `fill-gold` / `fill-gray` / `fill-green` / `fill-hot-pink` / `fill-light-blue` / `fill-light-gray` / `fill-light-green` / `fill-light-pink` / `fill-light-purple` / `fill-light-red` / `fill-light-silver` / `fill-light-yellow` / `fill-lightest-blue` / `fill-mid-gray` / `fill-moon-gray` / `fill-navy` / `fill-near-black` / `fill-near-white` / `fill-orange` / `fill-pink` / `fill-purple` / `fill-red` / `fill-silver` / `fill-transparent` / `fill-vcol1` / `fill-vcol10` / `fill-vcol11` / `fill-vcol12` / `fill-vcol13` / `fill-vcol14` / `fill-vcol15` / `fill-vcol16` / `fill-vcol2` / `fill-vcol3` / `fill-vcol4` / `fill-vcol5` / `fill-vcol6` / `fill-vcol7` / `fill-vcol8` / `fill-vcol9` / `fill-washed-blue` / `fill-washed-green` / `fill-washed-red` / `fill-washed-yellow` / `fill-white` / `fill-yellow` / `gold` / `gray` / `green` / `hot-pink` / `light-blue` / `light-gray` / `light-green` / `light-pink` / `light-purple` / `light-red` / `light-silver` / `light-yellow` / `lightest-blue` / `mid-gray` / `moon-gray` / `navy` / `near-black` / `near-white` / `o-0` / `o-10` / `o-100` / `o-20` / `o-30` / `o-40` / `o-50` / `o-60` / `o-70` / `o-80` / `o-90` / `orange` / `pink` / `purple` / `red` / `silver` / `stroke-black` / `stroke-blue` / `stroke-current` / `stroke-dark-blue` / `stroke-dark-gray` / `stroke-dark-green` / `stroke-dark-pink` / `stroke-dark-red` / `stroke-gold` / `stroke-gray` / `stroke-green` / `stroke-hot-pink` / `stroke-light-blue` / `stroke-light-gray` / `stroke-light-green` / `stroke-light-pink` / `stroke-light-purple` / `stroke-light-red` / `stroke-light-silver` / `stroke-light-yellow` / `stroke-lightest-blue` / `stroke-mid-gray` / `stroke-moon-gray` / `stroke-navy` / `stroke-near-black` / `stroke-near-white` / `stroke-orange` / `stroke-pink` / `stroke-purple` / `stroke-red` / `stroke-silver` / `stroke-transparent` / `stroke-vcol1` / `stroke-vcol10` / `stroke-vcol11` / `stroke-vcol12` / `stroke-vcol13` / `stroke-vcol14` / `stroke-vcol15` / `stroke-vcol16` / `stroke-vcol2` / `stroke-vcol3` / `stroke-vcol4` / `stroke-vcol5` / `stroke-vcol6` / `stroke-vcol7` / `stroke-vcol8` / `stroke-vcol9` / `stroke-washed-blue` / `stroke-washed-green` / `stroke-washed-red` / `stroke-washed-yellow` / `stroke-white` / `stroke-yellow` / `transparent` / `vcol1` / `vcol10` / `vcol11` / `vcol12` / `vcol13` / `vcol14` / `vcol15` / `vcol16` / `vcol2` / `vcol3` / `vcol4` / `vcol5` / `vcol6` / `vcol7` / `vcol8` / `vcol9` / `washed-blue` / `washed-green` / `washed-red` / `washed-yellow` / `white` / `yellow`
763
811
 
764
812
  #### Cursors <!-- notoc -->
765
813
 
@@ -947,6 +995,7 @@ directory are using this package:
947
995
  | Screenshot | Description | Live demo | Source |
948
996
  |:-----------------------------------------------------------------------------------------------------------------------|:-----------------------------------------|:------------------------------------------------------|:-----------------------------------------------------------------------------------|
949
997
  | <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) |
998
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rdom-dnd.png" width="240"/> | rdom drag & drop example | [Demo](https://demo.thi.ng/umbrella/rdom-dnd/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rdom-dnd) |
950
999
  | <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) |
951
1000
 
952
1001
  ## Authors
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  // @bun
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:`
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 l0 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 n0={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(n0).reduce((X,J)=>(X[J]=m5(Z,n0[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 l5={length:(Z)=>Z.length,split:(Z,X)=>X},E1={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}},v1=(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))},n5=(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);v1(U,Q,z,X),Z=Z.substring(q),z=X,V=Y.length(Z)}return v1(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:l5,...X};for(let Y of g(Z,X.delimWord||/\s/g)){const B=J[J.length-1];n5(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:E1,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 S1=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)L1(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
+ `),L1(Z,W);const z=await Z.ctx({logger:new l0(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)}},L1=(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 E=(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 S=(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*l(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 v0=(Z,X,J=l)=>{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)?l(w(Z),X):(J)=>{const W=J[2];return Z0(J,(Y,B)=>W(Y,Z(B)))}};function*E0(...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*l1(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=":[",n1=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=E(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?[...E0(Z,X)]:X,O8=(Z,X,J,W)=>{const Y=W.format,B=A(W),U=W.scope?N8(n1,W.scope):n1;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(E(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?[...l1(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 n=(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):E(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]=E(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)?l(W1(Z),X):w(E(Z)?(J)=>[Z(J),J]:(J)=>[Z,J])};var Y1=function(...Z){const X=v0(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=v0(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,L)=>{const v=J(L);if(V.has(v)){if(Q[v]=L,z.add(v),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,L)=>{const v=J(L);if(V.has(v)){let C0=q.get(v);!C0&&q.set(v,C0=[]),C0.length>=U&&e(`max back pressure (${U}) exceeded for input: ${String(v)}`),C0.push(L),z.add(v);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}}),S2=U1(2,"0"),D5=U1(3,"0"),y2=U1(4,"0");var V1=function(Z,X){return G(X)?l(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"})},L0={include:c({alias:"I",desc:"Include CSS files (prepend)"})},S0={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,...L0,...S0,...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=S(H0(Z.opts.specs),Z.logger),J=v8(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(n(U.decls,{format:q.format,fns:p}));z.forEach(($)=>E8($,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(n(W0(L8(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(n(B,{format:W,fns:p}))},v8=(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?v5(B,q,`.${$}`,$):E5(U,`.${$}`,$)}return{mediaQueryRules:B,plainRules:U}},E8=(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)v5(W,H,Q.path,$);else E5(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}},L8=(Z,X)=>X.split(Q1).reduce((J,W)=>Object.assign(J,Z[W]),{}),v5=(Z,X,J,W)=>{if(!Z[X])Z[X]={};(Z[X][J]||(Z[X][J]=new Set)).add(W)},E5=(Z,X,J)=>(Z[X]||(Z[X]=new Set)).add(J);import{resolve as _5} from"path";var L5={desc:"Export entire generated framework as CSS",opts:{...L0,...S0,...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=S(_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(n(q.decls,{format:U?Q0:x,fns:p}));Q.push(S8(q,W,U,X)),B0(V,Q,X)}},S8=(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 n(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 S5={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=S(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.vars)?X.vars:[""],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 E0(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]),L=K0(!H||P(b)?String(b):S5[H](b),z,q,Q,_);J[$][M]=L,W.debug($,M,L)}}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==="i+1"?(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=S5[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=S(x8(import.meta.dir,"package.json"));S1({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:L5,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
8
  \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2502 ${q1.name} ${q1.version}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/meta-css",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Data-driven CSS framework codegen, transpiler & bundler",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -38,19 +38,19 @@
38
38
  "test": "bun test"
39
39
  },
40
40
  "dependencies": {
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"
41
+ "@thi.ng/api": "^8.9.16",
42
+ "@thi.ng/args": "^2.3.4",
43
+ "@thi.ng/arrays": "^2.7.13",
44
+ "@thi.ng/checks": "^3.4.16",
45
+ "@thi.ng/compose": "^2.1.55",
46
+ "@thi.ng/errors": "^2.4.10",
47
+ "@thi.ng/file-io": "^1.1.4",
48
+ "@thi.ng/hiccup-css": "^2.3.6",
49
+ "@thi.ng/logger": "^2.1.3",
50
+ "@thi.ng/rstream": "^8.2.19",
51
+ "@thi.ng/strings": "^3.7.7",
52
+ "@thi.ng/text-format": "^2.0.3",
53
+ "@thi.ng/transducers": "^8.8.20"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@microsoft/api-extractor": "^7.39.0",
@@ -105,5 +105,5 @@
105
105
  "status": "alpha",
106
106
  "year": 2023
107
107
  },
108
- "gitHead": "775c664723cd87d6ac5909cedf91195317add287\n"
108
+ "gitHead": "b3db173682e1148cf08a6bd907b8d90b47b7c066\n"
109
109
  }
@@ -4,7 +4,7 @@
4
4
  {
5
5
  "user": "animations / transitions",
6
6
  "name": "fadein<k>",
7
- "key": "i1",
7
+ "key": "i+1",
8
8
  "props": { "animation": "fadein <v> ease-in-out forwards" },
9
9
  "values": [0.25, 0.5, 1],
10
10
  "unit": "second"
@@ -12,7 +12,7 @@
12
12
  {
13
13
  "user": "animations / transitions",
14
14
  "name": "bg-anim<k>",
15
- "key": "i1",
15
+ "key": "i+1",
16
16
  "props": { "transition": "<v> background-color ease-in-out" },
17
17
  "values": [0.15, 0.25, 0.5],
18
18
  "unit": "second"
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "values": "borders-r",
22
22
  "unit": "rem",
23
- "var": ["l", "r"]
23
+ "vars": ["l", "r"]
24
24
  },
25
25
  {
26
26
  "user": "border radius",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "values": "borders-r",
33
33
  "unit": "rem",
34
- "var": ["t", "b"]
34
+ "vars": ["t", "b"]
35
35
  },
36
36
  {
37
37
  "user": "border radius",
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "values": "borders-w",
50
50
  "unit": "rem",
51
- "var": ["", "t", "r", "b", "l"]
51
+ "vars": ["", "t", "r", "b", "l"]
52
52
  },
53
53
  {
54
54
  "user": "border width",
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "values": [1],
61
61
  "unit": "px",
62
- "var": ["", "t", "r", "b", "l"]
62
+ "vars": ["", "t", "r", "b", "l"]
63
63
  }
64
64
  ]
65
65
  }
@@ -1,7 +1,24 @@
1
1
  {
2
2
  "tables": {
3
3
  "__var_comment": "16 custom CSS color slots",
4
- "var-palette": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
4
+ "var-palette": [
5
+ "var(--color1)",
6
+ "var(--color2)",
7
+ "var(--color3)",
8
+ "var(--color4)",
9
+ "var(--color5)",
10
+ "var(--color6)",
11
+ "var(--color7)",
12
+ "var(--color8)",
13
+ "var(--color9)",
14
+ "var(--color10)",
15
+ "var(--color11)",
16
+ "var(--color12)",
17
+ "var(--color13)",
18
+ "var(--color14)",
19
+ "var(--color15)",
20
+ "var(--color16)"
21
+ ],
5
22
  "__grays_comment": "Tachyons CSS colors",
6
23
  "grays": {
7
24
  "black": "#000",
@@ -19,6 +36,7 @@
19
36
  },
20
37
  "__palette_comment": "Tachyons CSS colors",
21
38
  "palette": {
39
+ "current": "currentColor",
22
40
  "dark-red": "#e7040f",
23
41
  "red": "#ff4136",
24
42
  "light-red": "#ff725c",
@@ -46,11 +64,15 @@
46
64
  "washed-red": "#ffdfdf"
47
65
  }
48
66
  },
67
+ "vars": {
68
+ "fill-stroke": ["fill", "stroke"]
69
+ },
49
70
  "specs": [
50
71
  {
51
72
  "user": "colors",
52
- "name": "b--vcol<v>",
53
- "props": { "border-color": "var(--color<v>)" },
73
+ "name": "b--vcol<k>",
74
+ "key": "i+1",
75
+ "props": { "border-color": "<v>" },
54
76
  "values": "var-palette"
55
77
  },
56
78
  {
@@ -67,8 +89,9 @@
67
89
  },
68
90
  {
69
91
  "user": "colors",
70
- "name": "vcol<v>",
71
- "props": { "color": "var(--color<v>)" },
92
+ "name": "vcol<k>",
93
+ "key": "i+1",
94
+ "props": { "color": "<v>" },
72
95
  "values": "var-palette"
73
96
  },
74
97
  {
@@ -85,8 +108,9 @@
85
108
  },
86
109
  {
87
110
  "user": "colors",
88
- "name": "bg-vcol<v>",
89
- "props": { "background-color": "var(--color<v>)" },
111
+ "name": "bg-vcol<k>",
112
+ "key": "i+1",
113
+ "props": { "background-color": "<v>" },
90
114
  "values": "var-palette"
91
115
  },
92
116
  {
@@ -101,6 +125,28 @@
101
125
  "props": "background-color",
102
126
  "values": "grays"
103
127
  },
128
+ {
129
+ "user": "colors",
130
+ "name": "<var>-vcol<k>",
131
+ "key": "i+1",
132
+ "props": { "<var>": "<v>" },
133
+ "values": "var-palette",
134
+ "vars": ["fill-stroke"]
135
+ },
136
+ {
137
+ "user": "colors",
138
+ "name": "<var>-<k>",
139
+ "props": { "<var>": "<v>" },
140
+ "values": "palette",
141
+ "vars": ["fill-stroke"]
142
+ },
143
+ {
144
+ "user": "colors",
145
+ "name": "<var>-<k>",
146
+ "props": { "<var>": "<v>" },
147
+ "values": "grays",
148
+ "vars": ["fill-stroke"]
149
+ },
104
150
  {
105
151
  "user": "colors",
106
152
  "name": "o-<k>",
@@ -14,11 +14,11 @@
14
14
  {
15
15
  "user": "<var>",
16
16
  "name": "<vid><k>",
17
- "key": "i1",
17
+ "key": "i+1",
18
18
  "props": "<var>",
19
19
  "values": "sizes-abs",
20
20
  "unit": "rem",
21
- "var": ["w", "h"]
21
+ "vars": ["w", "h"]
22
22
  },
23
23
  {
24
24
  "user": "<var>",
@@ -26,16 +26,16 @@
26
26
  "props": "<var>",
27
27
  "values": "sizes-rel",
28
28
  "unit": "%",
29
- "var": ["w", "h"]
29
+ "vars": ["w", "h"]
30
30
  },
31
31
  {
32
32
  "user": "min. <var>",
33
33
  "name": "min<vid><k>",
34
- "key": "i1",
34
+ "key": "i+1",
35
35
  "props": "min-<var>",
36
36
  "values": "sizes-abs",
37
37
  "unit": "rem",
38
- "var": ["w", "h"]
38
+ "vars": ["w", "h"]
39
39
  },
40
40
  {
41
41
  "user": "min. <var>",
@@ -43,16 +43,16 @@
43
43
  "props": "min-<var>",
44
44
  "values": "sizes-rel",
45
45
  "unit": "%",
46
- "var": ["w", "h"]
46
+ "vars": ["w", "h"]
47
47
  },
48
48
  {
49
49
  "user": "max. <var>",
50
50
  "name": "max<vid><k>",
51
- "key": "i1",
51
+ "key": "i+1",
52
52
  "props": "max-<var>",
53
53
  "values": "sizes-abs",
54
54
  "unit": "rem",
55
- "var": ["w", "h"]
55
+ "vars": ["w", "h"]
56
56
  },
57
57
  {
58
58
  "user": "max. <var>",
@@ -60,14 +60,14 @@
60
60
  "props": "max-<var>",
61
61
  "values": "sizes-rel",
62
62
  "unit": "%",
63
- "var": ["w", "h"]
63
+ "vars": ["w", "h"]
64
64
  },
65
65
  {
66
66
  "name": "v<vid>-<v>",
67
67
  "props": "<var>",
68
68
  "values": [25, 50, 75, 100],
69
69
  "unit": "v<vid>",
70
- "var": ["w", "h"]
70
+ "vars": ["w", "h"]
71
71
  }
72
72
  ]
73
73
  }
@@ -12,7 +12,7 @@
12
12
  {
13
13
  "user": "grid layout",
14
14
  "name": "grid-<vid>-<k>",
15
- "key": "i1",
15
+ "key": "i+1",
16
16
  "props": "grid-template-<var>",
17
17
  "values": [
18
18
  "1fr",
@@ -26,7 +26,7 @@
26
26
  "repeat(9,1fr)",
27
27
  "repeat(10,1fr)"
28
28
  ],
29
- "var": ["cols", "rows"]
29
+ "vars": ["cols", "rows"]
30
30
  },
31
31
  {
32
32
  "user": "grid layout",
@@ -47,14 +47,14 @@
47
47
  "name": "<var>-self-<v>",
48
48
  "props": "<var>-self",
49
49
  "values": "align",
50
- "var": ["align", "justify"]
50
+ "vars": ["align", "justify"]
51
51
  },
52
52
  {
53
53
  "user": "grid layout",
54
54
  "name": "<var>-items-<v>",
55
55
  "props": "<var>-items",
56
56
  "values": "align",
57
- "var": ["align", "justify"]
57
+ "vars": ["align", "justify"]
58
58
  }
59
59
  ]
60
60
  }
@@ -3,7 +3,7 @@
3
3
  {
4
4
  "user": "icons",
5
5
  "name": "icon-<k>",
6
- "key": "i1",
6
+ "key": "i+1",
7
7
  "props": {
8
8
  "display": "inline-block",
9
9
  "width": "<v>",
@@ -9,7 +9,7 @@
9
9
  "props": "padding<var>",
10
10
  "values": "margins",
11
11
  "unit": "rem",
12
- "var": ["a", "h", "v", "t", "r", "b", "l"]
12
+ "vars": ["a", "h", "v", "t", "r", "b", "l"]
13
13
  },
14
14
  {
15
15
  "user": "margin",
@@ -17,7 +17,7 @@
17
17
  "props": "margin<var>",
18
18
  "values": "margins",
19
19
  "unit": "rem",
20
- "var": ["a", "h", "v", "t", "r", "b", "l"]
20
+ "vars": ["a", "h", "v", "t", "r", "b", "l"]
21
21
  },
22
22
  {
23
23
  "user": "margin",
@@ -8,7 +8,7 @@
8
8
  "name": "overflow<var>-<v>",
9
9
  "props": { "overflow<var>": "<v>" },
10
10
  "values": "overflow",
11
- "var": ["", "x", "y"]
11
+ "vars": ["", "x", "y"]
12
12
  }
13
13
  ]
14
14
  }
@@ -15,7 +15,7 @@
15
15
  "props": "<var>",
16
16
  "values": "pos",
17
17
  "unit": "rem",
18
- "var": ["top", "right", "bottom", "left"]
18
+ "vars": ["top", "right", "bottom", "left"]
19
19
  },
20
20
  {
21
21
  "user": "z-indices",
@@ -11,21 +11,21 @@
11
11
  {
12
12
  "user": "shadow",
13
13
  "name": "box-shadow-<k>",
14
- "key": "i1",
14
+ "key": "i+1",
15
15
  "props": "box-shadow",
16
16
  "values": "shadows"
17
17
  },
18
18
  {
19
19
  "user": "shadow",
20
20
  "name": "box-shadow-i-<k>",
21
- "key": "i1",
21
+ "key": "i+1",
22
22
  "props": { "box-shadow": "<v> inset" },
23
23
  "values": "shadows"
24
24
  },
25
25
  {
26
26
  "user": "shadow",
27
27
  "name": "text-shadow-<k>",
28
- "key": "i1",
28
+ "key": "i+1",
29
29
  "props": "text-shadow",
30
30
  "values": [
31
31
  "1px 1px 2px #0003",
@@ -20,7 +20,7 @@
20
20
  {
21
21
  "user": "font sizes",
22
22
  "name": "f<k>",
23
- "key": "i1",
23
+ "key": "i+1",
24
24
  "props": "font-size",
25
25
  "values": [3, 2.25, 1.5, 1.25, 1, 0.875, 0.75],
26
26
  "unit": "rem"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes