@thi.ng/meta-css 0.4.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 +14 -1
- package/README.md +137 -90
- package/index.js +6 -6
- package/package.json +18 -18
- package/specs/anim.mcss.json +21 -0
- package/specs/{borders.json → borders.mcss.json} +4 -4
- package/specs/{colors.json → colors.mcss.json} +53 -7
- package/specs/{dimensions.json → dimensions.mcss.json} +10 -10
- package/specs/{grids.json → grids.mcss.json} +4 -4
- package/specs/{icons.json → icons.mcss.json} +1 -1
- package/specs/{margins.json → margins.mcss.json} +2 -2
- package/specs/{normalize.json → normalize.mcss.json} +3 -1
- package/specs/{overflows.json → overflows.mcss.json} +1 -1
- package/specs/{positions.json → positions.mcss.json} +1 -1
- package/specs/{shadows.json → shadows.mcss.json} +3 -3
- package/specs/{typography.json → typography.mcss.json} +1 -1
- package/specs/anim.json +0 -12
- /package/specs/{_info.json → _info.mcss.json} +0 -0
- /package/specs/{a11y.json → a11y.mcss.json} +0 -0
- /package/specs/{aspect.json → aspect.mcss.json} +0 -0
- /package/specs/{background.json → background.mcss.json} +0 -0
- /package/specs/{cursor.json → cursor.mcss.json} +0 -0
- /package/specs/{display.json → display.mcss.json} +0 -0
- /package/specs/{lists.json → lists.mcss.json} +0 -0
- /package/specs/{selection.json → selection.mcss.json} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2023-12-
|
|
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,19 @@ 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
|
+
|
|
18
|
+
## [0.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/meta-css@0.5.0) (2023-12-28)
|
|
19
|
+
|
|
20
|
+
#### 🚀 Features
|
|
21
|
+
|
|
22
|
+
- add supported for quoted fns ([5d8e2fc](https://github.com/thi-ng/umbrella/commit/5d8e2fc))
|
|
23
|
+
- update generate cmd input handling ([c156762](https://github.com/thi-ng/umbrella/commit/c156762))
|
|
24
|
+
|
|
12
25
|
## [0.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/meta-css@0.4.0) (2023-12-26)
|
|
13
26
|
|
|
14
27
|
#### 🚀 Features
|
package/README.md
CHANGED
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|

|
|
8
8
|
[](https://mastodon.thi.ng/@toxi)
|
|
9
9
|
|
|
10
|
-
This project
|
|
11
|
-
[@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo and
|
|
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,47 +45,56 @@ This project is part of the
|
|
|
44
45
|
|
|
45
46
|
Data-driven CSS framework codegen, transpiler & bundler.
|
|
46
47
|
|
|
47
|
-
This
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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!**
|
|
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
|
|
69
|
-
JSON rule specs. This process generates all desired, combinatorial
|
|
70
|
-
various rules/declarations and exports them to
|
|
71
|
-
intermediary for the other commands provided by this toolchain.
|
|
72
|
-
[syntax/format of the generator rules](#framework-generation-specs--syntax)
|
|
73
|
-
further on. These rule specs can be split up into multiple files
|
|
74
|
-
handling, can define [arbitrary media query
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
framework](#bundled-css-base-framework). These specs and
|
|
80
|
-
still being worked on and are used for some example
|
|
81
|
-
are mostly intended as basic starting points for
|
|
82
|
-
frameworks (
|
|
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
|
|
86
96
|
|
|
87
|
-
Usage: metacss generate [opts]
|
|
97
|
+
Usage: metacss generate [opts] inputs...
|
|
88
98
|
|
|
89
99
|
Flags:
|
|
90
100
|
|
|
@@ -100,12 +110,12 @@ 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,
|
|
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
|
-
split over multiple files
|
|
108
|
-
|
|
117
|
+
split over multiple files and will all be merged by the `generate` command of
|
|
118
|
+
the toolchain.
|
|
109
119
|
|
|
110
120
|
```json5
|
|
111
121
|
{
|
|
@@ -117,14 +127,15 @@ split over multiple files within a directory and will all be merged by the
|
|
|
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
|
-
//
|
|
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,21 +172,18 @@ will be explained in more detail further below.
|
|
|
161
172
|
"props": "margin<var>",
|
|
162
173
|
"values": "margins",
|
|
163
174
|
"unit": "rem",
|
|
164
|
-
"
|
|
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
|
|
171
|
-
directory...
|
|
181
|
+
Assuming the above spec has been saved to file `margins.mcss.json`...
|
|
172
182
|
|
|
173
183
|
```bash
|
|
174
|
-
# the
|
|
175
|
-
# JSON files in the provided dir (recursively)...
|
|
176
|
-
|
|
184
|
+
# the generate cmd can merge specs from multiple input files
|
|
177
185
|
# if no `--out` file is given, the result will go to stdout
|
|
178
|
-
metacss generate --pretty
|
|
186
|
+
metacss generate --pretty margins.mcss.json
|
|
179
187
|
```
|
|
180
188
|
|
|
181
189
|
...this command (with the above spec) will generate the following output (here
|
|
@@ -224,26 +232,28 @@ An individual generator spec JSON object can contain the following keys:
|
|
|
224
232
|
|
|
225
233
|
| **ID** | **Type** | **Description** |
|
|
226
234
|
|----------|-------------------------|--------------------------------------------------------------|
|
|
235
|
+
| `key` | string, optional | Method for deriving keys from current value |
|
|
227
236
|
| `name` | string | Parametric name for the generated CSS class(es) |
|
|
228
237
|
| `props` | string or object | CSS property name(s), possibly parametric |
|
|
229
|
-
| `values` | string, array or object | Values to be assigned to CSS properties, possibly parametric |
|
|
230
238
|
| `unit` | string, optional | CSS unit to use for values |
|
|
231
|
-
| `
|
|
232
|
-
| `
|
|
233
|
-
| `
|
|
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) |
|
|
234
242
|
|
|
235
243
|
The number of generated CSS classes per spec is the number of items in `values`
|
|
236
244
|
multiplied by the number of variations in `var` (if any).
|
|
237
245
|
|
|
238
246
|
Any `user` data will be stored (as is) with each generated CSS class, but
|
|
239
|
-
currently has no
|
|
240
|
-
user-defined tooling.
|
|
247
|
+
currently has no direct use in the toolchain and is purely intended for
|
|
248
|
+
additional user-defined custom tooling.
|
|
241
249
|
|
|
242
250
|
#### Variations
|
|
243
251
|
|
|
244
252
|
Variations can be requested by providing an array of valid variation IDs. If
|
|
245
|
-
used, `<vid>` or `<var>` parameters must be used in the `name` or else
|
|
246
|
-
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:
|
|
247
257
|
|
|
248
258
|
| **ID** | **Expanded values** |
|
|
249
259
|
|------------|-----------------------|
|
|
@@ -262,26 +272,60 @@ conflicts will occur.
|
|
|
262
272
|
| `"x"` | `["-x"]` |
|
|
263
273
|
| `"y"` | `["-y"]` |
|
|
264
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
|
+
|
|
265
307
|
#### Parametric IDs
|
|
266
308
|
|
|
267
309
|
The following parameters can (and should) be used in a spec's `name` and `props`
|
|
268
310
|
to generate multiple pattern-based values (more examples below).
|
|
269
311
|
|
|
270
|
-
- `<vid>` is
|
|
271
|
-
variations are requested,
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
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.
|
|
275
318
|
- `<v>` is the currently processed value of a spec's `values`.
|
|
276
|
-
- `<k>` is the
|
|
277
|
-
spec's `values` and will depend on the type of `values` (see
|
|
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))
|
|
278
322
|
|
|
279
323
|
#### Values
|
|
280
324
|
|
|
281
325
|
The `values` are used to populate the `props` (CSS properties). If `values` is a
|
|
282
326
|
string it will be used as table-name to look up in the current spec file's
|
|
283
|
-
`tables`, an object storing
|
|
284
|
-
the same file).
|
|
327
|
+
`tables`, an object storing value collections which should be shared among specs
|
|
328
|
+
(only in the same file).
|
|
285
329
|
|
|
286
330
|
Other allowed types of `values`: string array, numeric array or object of
|
|
287
331
|
key-value pairs (where values are strings or numbers too). The following
|
|
@@ -296,7 +340,7 @@ Using a named `tables` entry:
|
|
|
296
340
|
},
|
|
297
341
|
"specs": [
|
|
298
342
|
{
|
|
299
|
-
"name": "test
|
|
343
|
+
"name": "test-<v>",
|
|
300
344
|
"props": "color",
|
|
301
345
|
"values": "test"
|
|
302
346
|
}
|
|
@@ -308,7 +352,7 @@ Using an array directly (here only showing the spec itself for brevity):
|
|
|
308
352
|
|
|
309
353
|
```json
|
|
310
354
|
{
|
|
311
|
-
"name": "test
|
|
355
|
+
"name": "test-<v>",
|
|
312
356
|
"props": "color",
|
|
313
357
|
"values": ["red", "green", "blue"]
|
|
314
358
|
}
|
|
@@ -318,7 +362,7 @@ Using an object (ignoring the keys, only using the values here):
|
|
|
318
362
|
|
|
319
363
|
```json
|
|
320
364
|
{
|
|
321
|
-
"name": "test
|
|
365
|
+
"name": "test-<v>",
|
|
322
366
|
"props": "color",
|
|
323
367
|
"values": { "r": "red", "g": "green", "b": "blue"}
|
|
324
368
|
}
|
|
@@ -366,13 +410,13 @@ Will result in these definitions:
|
|
|
366
410
|
|
|
367
411
|
The `key` field is only used when `values` is resolving to an array. In this
|
|
368
412
|
case this field determines how a "key" value (aka the `<k>` param for string
|
|
369
|
-
interpolation
|
|
413
|
+
interpolation) will be derived for each value in `values`:
|
|
370
414
|
|
|
371
415
|
| **`key`** | **`values`** | **Description** | **Examples** |
|
|
372
416
|
|-----------|-----------------|-------------------------|--------------|
|
|
373
417
|
| `v` | `[10, 20, ...]` | Actual array item value | 10, 20, ... |
|
|
374
418
|
| `i` | `[10, 20, ...]` | Array item index | 0, 1,... |
|
|
375
|
-
| `
|
|
419
|
+
| `i+1` | `[10, 20, ...]` | Array item index + 1 | 1, 2,... |
|
|
376
420
|
|
|
377
421
|
If `values` resolves to an object, the `<k>` param will always be the key of the
|
|
378
422
|
currently processed value.
|
|
@@ -416,7 +460,7 @@ specs](https://github.com/thi-ng/umbrella/blob/982fff7bfcc48f108b6ad88f854ef00be
|
|
|
416
460
|
## Converting meta stylesheets to CSS
|
|
417
461
|
|
|
418
462
|
The `convert` command is used to compile & bundle actual CSS from user-provided
|
|
419
|
-
MetaCSS stylesheets (`*.
|
|
463
|
+
MetaCSS stylesheets (`*.mcss` files) and the JSON framework specs created by the
|
|
420
464
|
`generate` command. The meta-stylesheets support any CSS selectors, are nestable
|
|
421
465
|
and compose full CSS declarations from lists of the utility classes in the
|
|
422
466
|
generated framework.
|
|
@@ -432,7 +476,7 @@ from multiple input files. **The resulting CSS will only contain referenced
|
|
|
432
476
|
rules** and can be generated in minified or pretty printed formats (it's also
|
|
433
477
|
possible to [force include CSS classes which are otherwise
|
|
434
478
|
unreferenced](#force-inclusion-of-unreferenced-classes)). Additionally, multiple
|
|
435
|
-
`.
|
|
479
|
+
`.mcss` stylesheets can be watched for changes (their definitions getting
|
|
436
480
|
merged), and existing CSS files can be included (prepended) in the bundled
|
|
437
481
|
output too.
|
|
438
482
|
|
|
@@ -483,8 +527,8 @@ selector {
|
|
|
483
527
|
|
|
484
528
|
#### Class identifiers & media query prefixes
|
|
485
529
|
|
|
486
|
-
As indicated by the above file structure, `*.
|
|
487
|
-
CSS selectors and the names of the
|
|
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.
|
|
488
532
|
For example, using the [bundled framework specs](#bundled-css-base-framework),
|
|
489
533
|
this simple meta-stylesheet `body { ma0 monospace blue }` creates a CSS rule for
|
|
490
534
|
`body` with the definitions of the generated `ma0`, `monospace` and `blue`
|
|
@@ -501,11 +545,11 @@ body {
|
|
|
501
545
|
#### Media query prefixes
|
|
502
546
|
|
|
503
547
|
This toolchain doesn't pre-generate media-query-specific versions of any CSS
|
|
504
|
-
class, and any class ID/token can be prefixed with any number of media
|
|
505
|
-
(separated by `:`). These [media queries are defined as part of the
|
|
506
|
-
generation specs](#media-query-definitions) and when used as a prefix,
|
|
507
|
-
query IDs can be combined freely. For example, the meta-stylesheet
|
|
508
|
-
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
|
|
509
553
|
`@media`-query blocks for the query IDs `dark` and `(dark AND anim)`:
|
|
510
554
|
|
|
511
555
|
```css
|
|
@@ -524,9 +568,9 @@ dark:bg-blue dark:anim:bg-anim2 }` will auto-create two separate CSS
|
|
|
524
568
|
|
|
525
569
|
A more detailed example, split over two files (for merging & bundling):
|
|
526
570
|
|
|
527
|
-
readme.
|
|
571
|
+
readme.mcss:
|
|
528
572
|
|
|
529
|
-
```text tangle:export/readme.
|
|
573
|
+
```text tangle:export/readme.mcss
|
|
530
574
|
body {
|
|
531
575
|
// no margins
|
|
532
576
|
ma0
|
|
@@ -552,16 +596,17 @@ body {
|
|
|
552
596
|
}
|
|
553
597
|
```
|
|
554
598
|
|
|
555
|
-
readme2.
|
|
599
|
+
readme2.mcss:
|
|
556
600
|
|
|
557
601
|
We will merge the definitions in this file with the ones above (i.e. adding &
|
|
558
602
|
overriding some of the declarations, here: a larger border radius):
|
|
559
603
|
|
|
560
|
-
```text tangle:export/readme2.
|
|
604
|
+
```text tangle:export/readme2.mcss
|
|
561
605
|
#app { pa2 }
|
|
562
606
|
|
|
563
607
|
.bt-group-v > a {
|
|
564
608
|
{
|
|
609
|
+
// override border radii
|
|
565
610
|
:first-child { brt4 }
|
|
566
611
|
:last-child { brb4 }
|
|
567
612
|
}
|
|
@@ -571,10 +616,10 @@ overriding some of the declarations, here: a larger border radius):
|
|
|
571
616
|
```bash
|
|
572
617
|
# if no --out dir is specified, writes result to stdout...
|
|
573
618
|
# use previously generated framework for resolving all identifiers & media queries
|
|
574
|
-
metacss convert --pretty --specs framework.json readme.
|
|
619
|
+
metacss convert --pretty --specs framework.json readme.mcss readme2.mcss
|
|
575
620
|
```
|
|
576
621
|
|
|
577
|
-
Resulting CSS bundle output:
|
|
622
|
+
Resulting merged CSS bundle output:
|
|
578
623
|
|
|
579
624
|
```css
|
|
580
625
|
/*! MetaCSS base v0.0.1 - generated by thi.ng/meta-css @ 2023-12-18T12:22:36.548Z */
|
|
@@ -668,7 +713,7 @@ verbatim and will **not** be transformed or reformatted in any way.
|
|
|
668
713
|
### Force inclusion of unreferenced classes
|
|
669
714
|
|
|
670
715
|
Only the CSS classes (and their optionally associated media queries) referenced
|
|
671
|
-
in a `.
|
|
716
|
+
in a `.mcss` stylesheet will appear in the export CSS bundle. This ensures that
|
|
672
717
|
the resulting CSS will only contain what's actually used (same effect as
|
|
673
718
|
tree-shaking, only vastly more efficient). However, this also means any CSS
|
|
674
719
|
classes (and optionally, their media query qualifiers) which are otherwise
|
|
@@ -742,7 +787,7 @@ Currently available CSS classes in MetaCSS base v0.0.1:
|
|
|
742
787
|
|
|
743
788
|
#### Animations / transitions <!-- notoc -->
|
|
744
789
|
|
|
745
|
-
`bg-anim1` / `bg-anim2` / `bg-anim3`
|
|
790
|
+
`bg-anim1` / `bg-anim2` / `bg-anim3` / `fadein1` / `fadein2` / `fadein3`
|
|
746
791
|
|
|
747
792
|
#### Aspect ratios <!-- notoc -->
|
|
748
793
|
|
|
@@ -762,7 +807,7 @@ Currently available CSS classes in MetaCSS base v0.0.1:
|
|
|
762
807
|
|
|
763
808
|
#### Colors <!-- notoc -->
|
|
764
809
|
|
|
765
|
-
`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`
|
|
766
811
|
|
|
767
812
|
#### Cursors <!-- notoc -->
|
|
768
813
|
|
|
@@ -923,7 +968,7 @@ distributed as CLI bundle with **no runtime dependencies**. The following
|
|
|
923
968
|
dependencies are only shown for informational purposes and are (partially)
|
|
924
969
|
included in the bundle.
|
|
925
970
|
|
|
926
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 11.
|
|
971
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 11.46 KB
|
|
927
972
|
|
|
928
973
|
## Dependencies
|
|
929
974
|
|
|
@@ -943,13 +988,15 @@ Package sizes (brotli'd, pre-treeshake): ESM: 11.38 KB
|
|
|
943
988
|
|
|
944
989
|
## Usage examples
|
|
945
990
|
|
|
946
|
-
|
|
991
|
+
Several projects in this repo's
|
|
947
992
|
[/examples](https://github.com/thi-ng/umbrella/tree/develop/examples)
|
|
948
|
-
directory
|
|
993
|
+
directory are using this package:
|
|
949
994
|
|
|
950
|
-
| Screenshot | Description
|
|
951
|
-
|
|
952
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/meta-css-basics.png" width="240"/> | Basic thi.ng/meta-css usage & testbed
|
|
995
|
+
| Screenshot | Description | Live demo | Source |
|
|
996
|
+
|:-----------------------------------------------------------------------------------------------------------------------|:-----------------------------------------|:------------------------------------------------------|:-----------------------------------------------------------------------------------|
|
|
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) |
|
|
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) |
|
|
953
1000
|
|
|
954
1001
|
## Authors
|
|
955
1002
|
|
package/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
3
|
-
`)}}var
|
|
4
|
-
`]:[],...Y(
|
|
5
|
-
`),b1(Z,W);const Q=await Z.ctx({logger:new g0(process.stderr,Z.name,"INFO"),format:J?M0:O1,opts:V.result,inputs:V.rest},B);if(await B.fn(Q),Z.post)await Z.post(Q,B)}catch(Y){process.stderr.write(Y.message+"\n\n"),process.exit(1)}},b1=(Z,X)=>{process.stderr.write(W0(Z.opts,X)),process.exit(1)},X4=(Z)=>["\nAvailable commands:\n",...Object.keys(Z).map((X)=>`${H0(16)(X)}: ${Z[X].desc}`),"\n"].join("\n");import{existsSync as J4,mkdirSync as W4,statSync as Y4} from"fs";import{sep as B4} from"path";var L1=(Z)=>{const X=Z.substring(0,Z.lastIndexOf(B4));return X.length>0&&!J4(X)?(W4(X,{recursive:!0}),!0):!1},S1=(Z)=>Y4(Z).isDirectory();var k=(Z)=>typeof Z==="function";var F=(Z)=>typeof Z==="string";import{readdirSync as U4,statSync as TZ} from"fs";import{sep as V4} from"path";function*h1(Z,X="",J,W=Infinity,Y=0){if(Y>=W)return;const B=z4(X);for(let U of U4(Z).sort()){const V=Z+V4+U;try{if(S1(V))yield*h1(V,X,J,W,Y+1);else if(B(V))yield V}catch(Q){J&&J.warn(`ignoring file: ${U} (${Q.message})`)}}}var y1=(Z,X="",J=Infinity,W)=>h1(Z,X,W,J,0);var Q4=(Z)=>F(Z)?new RegExp(`${Z.replace(/\./g,"\\.")}\$`):Z,z4=(Z)=>k(Z)?Z:(Z=Q4(Z),(X)=>Z.test(X));import{readFileSync as $4} from"fs";import{writeFileSync as q4} from"fs";var f1=(Z,X,J,W,Y=!1)=>{if(W&&W.info(`${Y?"[dryrun] ":""}writing file: ${Z}`),Y)return;L1(Z),q4(Z,X,!J&&F(X)?"utf-8":J)};var A=(Z,X,J="utf-8")=>{return X&&X.debug("reading file:",Z),$4(Z,J)},p0=(Z,X,J,W=!1)=>f1(Z,P(X)?X.join("\n"):X,"utf-8",J,W);var L=(Z,X)=>JSON.parse(A(Z,X));var P0=Object.freeze({level:C.NONE,enabled:()=>!1,fine(){},debug(){},info(){},warn(){},severe(){}});import{join as l4} from"path";var K4=I(()=>"Assertion failed"),N0=(typeof process!=="undefined"&&process.env!==void 0?!0:import.meta.env?import.meta.env.MODE!=="production"||!!import.meta.env.UMBRELLA_ASSERTS||!!import.meta.env.VITE_UMBRELLA_ASSERTS:!0)?(Z,X)=>{if(typeof Z==="function"&&!Z()||!Z)throw new K4(typeof X==="function"?X():X)}:()=>{};var w0=(Z)=>Z!=null&&typeof Z!=="function"&&Z.length!==void 0;var m1=(Z)=>{return(Z==null||!Z[Symbol.iterator])&&H(`value is not iterable: ${Z}`),Z};var u1=(Z)=>w0(Z)?Z:[...m1(Z)];var B0=(Z)=>Z[Z.length-1];var H4=I(()=>"illegal arity"),c=(Z)=>{throw new H4(Z)};var C4=I(()=>"illegal state"),r=(Z)=>{throw new C4(Z)};var o0=function(...Z){let[X,J,W,Y,B,U,V,Q,q,z]=Z;switch(Z.length){case 0:c(0);case 1:return X;case 2:return(...K)=>X(J(...K));case 3:return(...K)=>X(J(W(...K)));case 4:return(...K)=>X(J(W(Y(...K))));case 5:return(...K)=>X(J(W(Y(B(...K)))));case 6:return(...K)=>X(J(W(Y(B(U(...K))))));case 7:return(...K)=>X(J(W(Y(B(U(V(...K)))))));case 8:return(...K)=>X(J(W(Y(B(U(V(Q(...K))))))));case 9:return(...K)=>X(J(W(Y(B(U(V(Q(q(...K)))))))));case 10:default:const $=(...K)=>X(J(W(Y(B(U(V(Q(q(z(...K))))))))));return Z.length===10?$:o0($,...Z.slice(10))}};var g1=(Z,X)=>new Promise((J)=>setTimeout(()=>J(Z),X));var x1=(Z)=>Z;var d1=["-moz-","-ms-","-o-","-webkit-"],g={rules:"",ruleSep:",",valSep:"",decls:"",declStart:"{",declEnd:"}",indent:"",comments:!1},U0={rules:"\n",ruleSep:", ",valSep:" ",decls:"\n",declStart:" {\n",declEnd:"}\n",indent:" ",comments:!0};var G=(Z)=>Z!=null&&typeof Z[Symbol.iterator]==="function";var O0=(Z,X)=>Z!=null&&typeof Z[X]==="function";var x=(Z)=>O0(Z,"xform")?Z.xform():Z;var S=function(...Z){return Z=Z.map(x),o0.apply(null,Z)};var D0=(Z)=>Z!=null&&typeof Z!=="string"&&typeof Z[Symbol.iterator]==="function";var s=(Z,X)=>[Z[0],Z[1],X];var y=Symbol(),i0=()=>{};class a0{value;constructor(Z){this.value=Z}deref(){return this.value}}var j=(Z)=>Z instanceof a0;var h=(Z)=>Z instanceof a0?Z.deref():Z;var G0=function(...Z){const X=Z[0],J=X[0],W=X[1],Y=X[2];Z=M4(Z);const B=Z[0]==null?J():Z[0],U=Z[1];return h(W(O0(U,"$reduce")?U.$reduce(Y,B):w0(U)?F4(Y,B,U):P4(Y,B,U)))};var M4=(Z)=>Z.length===2?[void 0,Z[1]]:Z.length===3?[Z[1],Z[2]]:c(Z.length),F4=(Z,X,J)=>{for(let W=0,Y=J.length;W<Y;W++)if(X=Z(X,J[W]),j(X)){X=X.deref();break}return X},P4=(Z,X,J)=>{for(let W of J)if(X=Z(X,W),j(X)){X=X.deref();break}return X},e=(Z,X)=>[Z,(J)=>J,X];var j0=function(Z){return Z?[...Z]:e(()=>[],(X,J)=>(X.push(J),X))};function*k0(Z,X){const J=x(Z)(j0()),W=J[1],Y=J[2];for(let B of X){const U=Y([],B);if(j(U)){yield*h(W(U.deref()));return}if(U.length)yield*U}yield*h(W([]))}function*d(Z,X){const J=x(Z)([i0,i0,(W,Y)=>Y])[2];for(let W of X){let Y=J(y,W);if(j(Y)){if(Y=h(Y.deref()),Y!==y)yield Y;return}if(Y!==y)yield Y}}var T0=(Z,X,J=d)=>{const W=X.length-1;return G(X[W])?X.length>1?J(Z.apply(null,X.slice(0,W)),X[W]):J(Z(),X[0]):void 0};var t0=function(Z,X){return G(X)?k0(t0(Z),F(X)?[X]:X):(J)=>{const W=J[2],Y=(B,U)=>{const V=Z(U);if(V){for(let Q of V)if(B=Y(B,Q),j(B))break;return B}return W(B,U)};return s(J,Y)}};var n1=function(Z){return t0((X)=>D0(X)?X:void 0,Z)};var N=function(Z,X){return G(X)?d(N(Z),X):(J)=>{const W=J[2];return s(J,(Y,B)=>W(Y,Z(B)))}};function*I0(...Z){const X=Z.length-1;if(X<0)return;const J=new Array(X+1).fill(0),W=Z.map(u1),Y=W.reduce((B,U)=>B*U.length,1);for(let B=0;B<Y;B++){const U=[];for(let V=X;V>=0;V--){const Q=W[V];let q=J[V];if(q===Q.length)J[V]=q=0,V>0&&J[V-1]++;U[V]=Q[q]}J[X]++,yield U}}function*l1(Z,X=Infinity){while(X-- >0)yield Z}var c0=function(Z,X){Z=Z||"";let J=!0;return X?[...X].join(Z):e(()=>"",(W,Y)=>(W=J?W+Y:W+Z+Y,J=!1,W))};var R0=function(...Z){return N4(R0,G0,Z)};var N4=(Z,X,J)=>{let W,Y;switch(J.length){case 4:Y=J[3],W=J[2];break;case 3:Y=J[2];break;case 2:return N((B)=>Z(J[0],J[1],B));default:c(J.length)}return X(x(J[0])(J[1]),W,Y)};var w4=new Set,O4=":[",p1=S(n1(),N((Z)=>O4.indexOf(Z.charAt(0))>=0?Z:" "+Z)),D4=(Z,X)=>S(Z,N((J)=>F(J)&&J.indexOf(" .")==0?J+X:J)),Z0=(Z,X,J,W)=>{const Y=J.length,B=[];let U,V;const Q=(q,z)=>{let $=null;if(P(z))Z0(Z,r0(X,B),z,W);else if(G(z)&&!F(z))Z0(Z,r0(X,B),[...z],W);else if((V=k(z))||($=W.fns[z]))if(!X.length){if($)return $.apply(null,J.slice(q+1))(Z,W),!0;z(Z,W)}else if(V)Q(q,z());else H(`quoted fn ('${z}') only allowed at head position`);else if(R(z))U=Object.assign(U||{},z);else if(z!=null)B.push(z)};for(let q=0;q<Y;q++)if(Q(q,J[q]))return Z;return U&&Z.push(G4(X,B,U,W)),Z},r0=(Z,X)=>Z.length?[...I0(Z,X)]:X,G4=(Z,X,J,W)=>{const Y=W.format,B=A0(W),U=W.scope?D4(p1,W.scope):p1;return[B,R0(N((V)=>R0(U,c0(),P(V)?V:[V]).trim()),c0(Y.ruleSep),r0(Z,X)),Y.declStart,s0(J,W),B,Y.declEnd].join("")},s0=(Z,X)=>{const J=X.format,W=X.autoprefix||w4,Y=A0(X,X.depth+1),B=[];for(let U in Z)if(Z.hasOwnProperty(U)){let V=Z[U];if(k(V))V=V(Z);if(P(V))V=V.map((Q)=>P(Q)?Q.join(" "):Q).join(J.ruleSep);if(W.has(U))for(let Q of X.vendors)B.push(`${Y}${Q}${U}:${J.valSep}${V};`);B.push(`${Y}${U}:${J.valSep}${V};`)}return B.join(J.decls)+J.decls},A0=(Z,X=Z.depth)=>X>1?[...l1(Z.format.indent,X)].join(""):X>0?Z.format.indent:"";var i1=(Z,X,J)=>(W,Y)=>{const B=A0(Y);return W.push(`${B}${Z} ${j4(X)}${Y.format.declStart}`),Y.depth++,Z0(W,[],J,Y),Y.depth--,W.push(B+Y.format.declEnd),W},j4=(Z)=>{if(F(Z))return Z;const X=[];for(let J in Z)if(Z.hasOwnProperty(J)){let W=Z[J];if(W===!0)W=o1.has(J)?J:`(${J})`;else if(W===!1)W=`(not ${o1.has(J)?J:`(${J})`})`;else if(W==="only")W+=" "+J;else W=`(${J}:${W})`;X.push(W)}return X.join(" and ")},o1=new Set(["all","print","screen"]);var n=(Z,X)=>{return X={format:g,vendors:d1,fns:{},depth:0,...X},P(X.autoprefix)&&(X.autoprefix=new Set(X.autoprefix)),R(Z)?s0(Z,X):k(Z)?Z([],X).join(X.format.rules):Z0([],[],P(Z)?Z:D0(Z)?[...Z]:H("invalid rules"),X).join(X.format.rules)};var E0=(Z,X)=>i1("@media",Z,X);var a1=4,t1=(Z)=>a1=Z,D=(Z)=>Z===(Z|0)?String(Z):Z.toFixed(a1).replace(/^0./,".").replace(/^-0./,"-.").replace(/0+$/,""),c1=(Z)=>`${D(Z)}em`,r1=(Z)=>`${D(Z)}ex`,s1=(Z)=>`${D(Z)}rem`,e0=(Z)=>`${D(Z)}%`,e1=(Z)=>`${D(Z)}px`,Z8=(Z)=>`${D(Z)}vh`,X8=(Z)=>`${D(Z)}vw`,J8=(Z)=>`${D(Z)}vmin`,W8=(Z)=>`${D(Z)}vmax`,Y8=(Z)=>`${Z|0}ms`,B8=(Z)=>`${D(Z)}s`;var U8=(Z)=>`${D(Z)}deg`,V8=(Z)=>`${D(Z)}rad`,Q8=(Z)=>`${D(Z)}turn`,z8=(Z)=>`url(${Z})`;var w=((Z)=>{return Z[Z.IDLE=0]="IDLE",Z[Z.ACTIVE=1]="ACTIVE",Z[Z.DONE=2]="DONE",Z[Z.UNSUBSCRIBED=3]="UNSUBSCRIBED",Z[Z.ERROR=4]="ERROR",Z})(w||{}),T=((Z)=>{return Z[Z.NEVER=0]="NEVER",Z[Z.FIRST=1]="FIRST",Z[Z.LAST=2]="LAST",Z})(T||{});var k4=0,T4=()=>k4++,l=(Z,X)=>!X||!X.id?{...X,id:Z+"-"+T4()}:X;var O=P0;class f{constructor(Z,X){this.wrapped=Z,X=l("sub",{closeIn:T.LAST,closeOut:T.LAST,cache:!0,...X}),this.parent=X.parent,this.id=X.id,this.closeIn=X.closeIn,this.closeOut=X.closeOut,this.cacheLast=X.cache,X.xform&&(this.xform=X.xform(j0()))}id;closeIn;closeOut;parent;__owner;xform;cacheLast;last=y;state=w.IDLE;subs=[];deref(){return this.last!==y?this.last:void 0}getState(){return this.state}setState(Z){this.state=Z}subscribe(Z,X={}){this.ensureState();let J;if(Z instanceof f&&!X.xform)Z.ensureState(),N0(!Z.parent,`sub '${Z.id}' already has a parent`),Z.parent=this,J=Z;else J=new f(Z,{...X,parent:this});return this.subs.push(J),this.setState(w.ACTIVE),J.setState(w.ACTIVE),this.last!=y&&J.next(this.last),J}transform(...Z){let X,J;if(R(B0(Z)))J=Z.pop(),X={error:J.error};return this.subscribe(X,l("xform",Z.length>0?{...J,xform:S(...Z)}:J))}map(Z,X){return this.transform(N(Z),X||{})}unsubscribe(Z){return Z?this.unsubscribeChild(Z):this.unsubscribeSelf()}unsubscribeSelf(){return O.debug(this.id,"unsub self"),this.parent&&this.parent.unsubscribe(this),this.state<w.UNSUBSCRIBED&&(this.state=w.UNSUBSCRIBED),this.release(),!0}unsubscribeChild(Z){O.debug(this.id,"unsub child",Z.id);const X=this.subs.indexOf(Z);if(X>=0){if(this.subs.splice(X,1),this.closeOut===T.FIRST||!this.subs.length&&this.closeOut!==T.NEVER)this.unsubscribe();return!0}return!1}next(Z){if(this.state>=w.DONE)return;this.xform?this.dispatchXform(Z):this.dispatch(Z)}done(){if(O.debug(this.id,"entering done()"),this.state>=w.DONE)return;if(this.xform){if(!this.dispatchXformDone())return}if(this.state=w.DONE,this.dispatchTo("done"))this.state<w.UNSUBSCRIBED&&this.unsubscribe();O.debug(this.id,"exiting done()")}error(Z){const X=this.wrapped,J=X&&X.error;return J&&O.debug(this.id,"attempting wrapped error handler"),J&&X.error(Z)||this.unhandledError(Z)}unhandledError(Z){return(O!==P0?O:console).warn(this.id,"unhandled error:",Z),this.unsubscribe(),this.state=w.ERROR,!1}dispatchTo(Z,X){let J=this.wrapped;if(J)try{J[Z]&&J[Z](X)}catch(Y){if(!this.error(Y))return!1}const W=Z==="next"?this.subs:[...this.subs];for(let Y=W.length;Y-- >0;){J=W[Y];try{J[Z]&&J[Z](X)}catch(B){if(Z==="error"||!J.error||!J.error(B))return this.unhandledError(B)}}return!0}dispatch(Z){O.debug(this.id,"dispatch",Z),this.cacheLast&&(this.last=Z),this.dispatchTo("next",Z)}dispatchXform(Z){let X;try{X=this.xform[2]([],Z)}catch(J){this.error(J);return}if(this.dispatchXformVals(X))j(X)&&this.done()}dispatchXformDone(){let Z;try{Z=this.xform[1]([])}catch(X){return this.error(X)}return this.dispatchXformVals(Z)}dispatchXformVals(Z){const X=h(Z);for(let J=0,W=X.length;J<W&&this.state<w.DONE;J++)this.dispatch(X[J]);return this.state<w.ERROR}ensureState(){if(this.state>=w.DONE)r(`operation not allowed in state ${this.state}`)}release(){this.subs.length=0,delete this.parent,delete this.xform,delete this.last}}var q8=(Z,X)=>{const J=new $8(X);return J.next(Z),J};class $8 extends f{src;_cancel;_inited;constructor(Z,X){const[J,W]=k(Z)?[Z,X||{}]:[void 0,Z||{}];super(W.error?{error:W.error}:void 0,l("stream",W));this.src=J,this._inited=!1}subscribe(Z,X={}){const J=super.subscribe(Z,X);if(!this._inited){if(this.src)try{this._cancel=this.src(this)||(()=>{return})}catch(W){let Y=this.wrapped;if(!Y||!Y.error||!Y.error(W))this.unhandledError(W)}this._inited=!0}return J}unsubscribe(Z){const X=super.unsubscribe(Z);if(X&&(!Z||(!this.subs||!this.subs.length)&&this.closeOut!==T.NEVER))this.cancel();return X}done(){this.cancel(),super.done(),delete this.src,delete this._cancel}error(Z){if(super.error(Z))return!0;return this.cancel(),!1}cancel(){if(this._cancel){O.debug(this.id,"cancel");const Z=this._cancel;delete this._cancel,Z()}}}var K8=(Z,X)=>Z===T.FIRST||Z===T.LAST&&!X;var Z1=function(Z){return Z?G0(Z1(),Z):e(()=>({}),(X,[J,W])=>(X[J]=W,X))};var X1=function(Z,X){return G(X)?d(X1(Z),X):N(k(Z)?(J)=>[Z(J),J]:(J)=>[Z,J])};var J1=function(...Z){const X=T0(J1,Z);if(X)return X;const J=Z[0],W=Z[1]!==!1;return N((Y)=>{const B=W?{}:Y;for(let U in Y)B[U]=J(Y[U]);return B})};var W1=function(...Z){const X=T0(W1,Z,k0);if(X)return X;const{key:J,mergeOnly:W,reset:Y,all:B,backPressure:U}={key:x1,mergeOnly:!1,reset:!0,all:!0,backPressure:0,...Z[1]},V=P(Z[0])?new Set(Z[0]):Z[0],Q=new Set,q=new Map;let z={};const $=([K,v,p])=>{let b=!0;if(W||U<1)return[K,(M)=>{if(Y&&B&&Q.size>0||!Y&&b)M=p(M,z),z={},Q.clear(),b=!1;return v(M)},(M,_)=>{const E=J(_);if(V.has(E)){if(z[E]=_,Q.add(E),W||H8(V,Q))if(M=p(M,z),b=!1,Y)z={},Q.clear();else z={...z}}return M}];else return[K,(M)=>{if(B&&Q.size>0)M=p(M,C8(q,Q)),q.clear(),Q.clear();return v(M)},(M,_)=>{const E=J(_);if(V.has(E)){let q0=q.get(E);!q0&&q.set(E,q0=[]),q0.length>=U&&r(`max back pressure (${U}) exceeded for input: ${String(E)}`),q0.push(_),Q.add(E);while(H8(V,Q))if(M=p(M,C8(q,Q)),b=!1,j(M))break}return M}]};return $.keys=()=>V,$.clear=()=>{q.clear(),V.clear(),Q.clear(),z={}},$.add=(K)=>{V.add(K)},$.delete=(K,v=!0)=>{if(q.delete(K),V.delete(K),v)Q.delete(K),delete z[K]},$},H8=(Z,X)=>{if(X.size<Z.size)return!1;for(let J of Z)if(!X.has(J))return!1;return!0},C8=(Z,X)=>{const J={};for(let W of X){const Y=Z.get(W);J[W]=Y.shift(),!Y.length&&X.delete(W)}return J};var M8=(Z,X)=>{let J=!0;for(let W of X)J=Z.removeID(W)&&J;return J};var F8=(Z)=>new P8(Z);class P8 extends f{sources;idSources;realSourceIDs;invRealSourceIDs;psync;clean;constructor(Z){const X=W1(new Set,{key:(W)=>W[0],mergeOnly:Z.mergeOnly===!0,reset:Z.reset===!0,all:Z.all!==!1,backPressure:Z.backPressure||0}),J=J1((W)=>W[1]);super(void 0,l("streamsync",{...Z,xform:Z.xform?S(X,J,Z.xform):S(X,J)}));this.sources=new Map,this.realSourceIDs=new Map,this.invRealSourceIDs=new Map,this.idSources=new Map,this.psync=X,this.clean=!!Z.clean,Z.src&&this.addAll(Z.src)}add(Z,X){X||(X=Z.id),this.ensureState(),this.psync.add(X),this.realSourceIDs.set(X,Z.id),this.invRealSourceIDs.set(Z.id,X),this.idSources.set(Z.id,Z),this.sources.set(Z,Z.subscribe({next:(J)=>J[1]instanceof f?this.add(J[1]):this.next(J),done:()=>this.markDone(Z),__owner:this},{xform:X1(X),id:`in-${X}`}))}addAll(Z){for(let X in Z)this.psync.add(X);for(let X in Z)this.add(Z[X],X)}remove(Z){const X=this.sources.get(Z);if(X){const J=this.invRealSourceIDs.get(Z.id);return O.info(`removing src: ${Z.id} (${J})`),this.psync.delete(J,this.clean),this.realSourceIDs.delete(J),this.invRealSourceIDs.delete(Z.id),this.idSources.delete(Z.id),this.sources.delete(Z),X.unsubscribe(),!0}return!1}removeID(Z){const X=this.getSourceForID(Z);return X?this.remove(X):!1}removeAll(Z){for(let J of Z)this.psync.delete(this.invRealSourceIDs.get(J.id));let X=!0;for(let J of Z)X=this.remove(J)&&X;return X}removeAllIDs(Z){return M8(this,Z)}getSourceForID(Z){return this.idSources.get(this.realSourceIDs.get(Z))}getSources(){const Z={};for(let[X,J]of this.idSources)Z[this.invRealSourceIDs.get(X)]=J;return Z}unsubscribe(Z){if(!Z){O.debug(this.id,"unsub sources");for(let X of this.sources.values())X.unsubscribe();this.sources.clear(),this.psync.clear(),this.realSourceIDs.clear(),this.invRealSourceIDs.clear(),this.idSources.clear()}return super.unsubscribe(Z)}markDone(Z){this.remove(Z),K8(this.closeIn,this.sources.size)&&this.done()}}var Y1=o((Z,X=" ")=>{const J=i(String(X),Z);return(W,Y)=>{if(W==null)return J;return W=W.toString(),Y=Y!==void 0?Y:W.length,Y<Z?J.substring(Y)+W:W}}),A2=Y1(2,"0"),N8=Y1(3,"0"),E2=Y1(4,"0");var B1=function(Z,X){return G(X)?d(B1(Z),X):(J)=>{const W=J[2];return s(J,(Y,B)=>Z(B)?W(Y,B):Y)}};import{watch as R4} from"fs";import{resolve as Q0} from"path";var w8={specs:a({alias:"s",optional:!1,desc:"Path to generated JSON defs"})},v0={include:t({alias:"I",desc:"Include CSS files (prepend)"})},b0={noDecls:m({alias:"d",desc:"Don't emit framework decls"})},X0={pretty:m({alias:"p",desc:"Pretty print output"})},_0={noHeader:m({desc:"Don't emit generated header comment"})},O8={watch:m({alias:"w",desc:"Watch input files for changes"})};import{resolve as I4} from"path";var J0=(Z,X,J)=>{X=F(X)?X:X.join("\n"),Z?p0(I4(Z),X,J):console.log(X)},L0=({info:{name:Z,version:X}})=>`/*! ${Z} v${X} - generated by thi.ng/meta-css @ ${(new Date()).toISOString()} */`;var G8={desc:"Transpile & bundle meta stylesheets to CSS",opts:{...w8,...v0,...b0,...X0,..._0,...O8,eval:a({alias:"e",desc:"eval meta stylesheet in given string (ignores other inputs & includes)"}),force:t({alias:"f",hint:"STR",desc:"CSS classes to force include (wildcards are supported, @-prefix will read from file)",delim:","})},fn:async(Z)=>{const X=L(Q0(Z.opts.specs),Z.logger),J=b4(X,Z.opts.force||[],Z.logger);if(Z.opts.watch)await A4(Z,X,J);else if(Z.opts.eval)U1(Z,X,J,[Z.opts.eval]);else U1(Z,X,J,Z.inputs.map((W)=>A(Q0(W),Z.logger)))}},A4=async(Z,X,J)=>{let W=!0;const Y=()=>{Z.logger.info("closing watchers..."),B.forEach((U)=>U.watcher.close()),W=!1},B=Z.inputs.map((U,V)=>{U=Q0(U);const Q=q8(A(U,Z.logger),{id:`in${N8(V)}`});return{input:Q,watcher:R4(U,{},(q)=>{if(q==="change")try{Q.next(A(U,Z.logger))}catch(z){Z.logger.warn(z.message),Y()}else Z.logger.warn("input removed:",U),Y()})}});F8({src:Z1(N(({input:U})=>[U.id,U],B))}).subscribe({next(U){try{U1(Z,X,J,Object.keys(U).sort().map((V)=>U[V]))}catch(V){Z.logger.warn(V.message)}}}),process.on("SIGINT",Y);while(W)await g1(null,250)},U1=({logger:Z,opts:{include:X,noDecls:J,noHeader:W,out:Y,pretty:B}},U,V,Q)=>{const q={logger:Z,specs:U,format:B?U0:g,mediaQueryIDs:new Set(Object.keys(U.media)),mediaQueryRules:{...V.mediaQueryRules},plainRules:{...V.plainRules}},z=X?X.map(($)=>A(Q0($),Z).trim()):[];if(!W)z.push(L0(U));if(!J&&U.decls.length)z.push(n(U.decls,{format:q.format}));Q.forEach(($)=>_4($,q)),v4(z,q),E4(z,q),J0(Y,z,Z)},E4=(Z,{logger:X,specs:J,format:W,mediaQueryRules:Y})=>{for(let B in Y){const U=k8(Y[B],J);X.debug("mediaquery rules",B,U),Z.push(n(E0(y4(J.media,B),U),{format:W}))}},v4=(Z,{logger:X,specs:J,format:W,plainRules:Y})=>{const B=k8(Y,J);X.debug("plain rules",B),Z.push(n(B,{format:W}))},b4=(Z,X,J)=>{const W=new Set(Object.keys(Z.media)),Y=new Set(Object.keys(Z.classes)),B={},U={};if(X.length&&X[0][0]==="@")X=[...u(A(Q0(X[0].substring(1)),J))];for(let V of X){if(!V||V.startsWith("//"))continue;const{token:Q,query:q}=T8(V,W);let z;if(Q.includes("*")){const $=new RegExp(`^${Q.replace("*",".*")}\$`);z=[...B1((K)=>$.test(K),Y)]}else if(Y.has(Q))z=[Q];else{J.warn(`unknown include rule ID: ${V}, skipping...`);continue}for(let $ of z)J.debug("including class:",$),q?I8(B,q,`.${$}`,$):R8(U,`.${$}`,$)}return{mediaQueryRules:B,plainRules:U}},_4=(Z,{specs:X,mediaQueryIDs:J,mediaQueryRules:W,plainRules:Y})=>{const B=V0(),U=V0(B),V={root:B,curr:U,scopes:[U]};for(let Q of u(Z)){if(!Q||/^\s*\/\//.test(Q))continue;for(let q of u(Q,/\s+/g)){if(!q)continue;let z=V.curr;switch(z.state){case"sel":case"nest":if(q==="{"){if(z.state==="sel")z.sel=z.sel.map(($)=>$.replace(",","")),z.path=L4(V.scopes);z.state="class"}else if(q==="}")D8(V);else{const $=B0(z.sel);if(!$||$.endsWith(","))z.sel.push(q);else z.sel[z.sel.length-1]+=" "+q}break;case"class":if(q==="{")z.state="nest",V.scopes.push(V.curr=V0(z));else if(q==="}")D8(V);else{let{token:$,query:K}=T8(q,J);if(!X.classes[$])H(`unknown class ID: ${$}`);if(K)I8(W,K,z.path,$);else R8(Y,z.path,$)}break;default:r(z.state)}}}},V1=":",j8="///",V0=(Z)=>({state:"sel",sel:Z?[]:["<root>"],path:"",parent:Z}),D8=(Z)=>{const X=!Z.curr.sel.length;if(N0(!!Z.curr.parent,"stack underflow"),Z.scopes.pop(),Z.scopes.length>0){if(Z.curr=B0(Z.scopes),!X&&Z.curr.state==="nest")Z.scopes.push(Z.curr=V0(Z.curr))}else Z.scopes.push(Z.curr=V0(Z.root))},L4=(Z)=>Z.map((X)=>X.sel.join(",")).join(j8),k8=(Z,X)=>Object.entries(Z).map(([J,W])=>S4(J,W,X)),S4=(Z,X,J)=>{const W=[];let Y=W;const B=Z.split(j8);for(let U=0;U<B.length;U++){const V=B[U].split(",");if(U==B.length-1){const Q=Object.assign({},...N((q)=>J.classes[q],X));if("__user"in Q)delete Q.__user;V.push(Q)}Y.push(V),Y=V}return W[0]},T8=(Z,X)=>{if(/^::?/.test(Z))return{token:Z};const J=Z.lastIndexOf(V1);if(J<0)return{token:Z};const W=Z.substring(0,J);if(!W.split(V1).every((B)=>X.has(B)))H(`invalid media query in token: ${Z}`);return{token:Z.substring(J+1),query:W}},y4=(Z,X)=>X.split(V1).reduce((J,W)=>Object.assign(J,Z[W]),{}),I8=(Z,X,J,W)=>{if(!Z[X])Z[X]={};(Z[X][J]||(Z[X][J]=new Set)).add(W)},R8=(Z,X,J)=>(Z[X]||(Z[X]=new Set)).add(J);import{resolve as A8} from"path";var v8={desc:"Export entire generated framework as CSS",opts:{...v0,...b0,...X0,..._0,media:t({alias:"m",hint:"ID",desc:"Media query IDs (use 'ALL' for all)",delim:","})},inputs:1,fn:async(Z)=>{const{logger:X,opts:{include:J,media:W,noDecls:Y,noHeader:B,pretty:U,out:V},inputs:Q}=Z,q=L(A8(Q[0]),X),z=J?J.map(($)=>A(A8($),X).trim()):[];if(!B)z.push(L0(q));if(!Y&&q.decls.length)z.push(n(q.decls,{format:U?U0:g}));z.push(h4(q,W,U,X)),J0(V,z,X)}},h4=(Z,X,J,W)=>{const Y=E8("",Z);if(X){const B=X[0]==="ALL"?Object.keys(Z.media):X;for(let U of B)if(Z.media[U])Y.push(E0(Z.media[U],E8("-"+U,Z)));else W.warn(`invalid media query ID: ${U}, skipping...`)}return n(Y,{format:J?U0:g})},E8=(Z,X)=>Object.entries(X.classes).map(([J,W])=>[`.${J}${Z}`,f4(W)]),f4=(Z)=>{if("__user"in Z)Z={...Z},delete Z.__user;return Z};import{statSync as m4} from"fs";import{resolve as u4} from"path";var b8={deg:U8,em:c1,ex:r1,ms:Y8,percent:e0,px:e1,rad:V8,rem:s1,second:B8,turn:Q8,url:z8,vh:Z8,vmax:W8,vmin:J8,vw:X8,"%":e0},g4={"":[""],a:[""],h:["-left","-right"],v:["-top","-bottom"],t:["-top"],top:["top"],b:["-bottom"],bottom:["bottom"],r:["-right"],right:["right"],l:["-left"],left:["left"],x:["-x"],y:["-y"]},_8={desc:"Generate framework rules from specs",opts:{...X0,prec:M1({default:3,desc:"Number of fractional digits"})},inputs:1,fn:async(Z)=>{const{logger:X,opts:{prec:J,out:W,pretty:Y},inputs:B}=Z,U=u4(B[0]);if(!m4(U).isDirectory())H(`${U} is not a directory`);const V={info:{name:"TODO",version:"0.0.0"},media:{},classes:{},decls:[]};t1(J);for(let Q of y1(U,".json")){const q=L(Q,X);if(Object.assign(V.info,q.info),Object.assign(V.media,q.media),q.decls)V.decls.push(...q.decls);for(let z of q.specs)x4(q,z,V.classes,X)}J0(W,JSON.stringify(V,null,Y?4:0),X)}},x4=(Z,X,J,W)=>{const Y=P(X.var)?X.var:[""],B=F(X.props)?{[X.props]:"<v>"}:X.props,U=d4(X,Z),V=new Set;for(let Q of Y)for(let[q,z]of I0(Z.vars?.[Q]||g4[Q],Object.keys(U))){const $=z0(X.name,Q,q,z,U[z]),K=X.unit?z0(X.unit,Q,q,z,U[z]):void 0,v=n4(U[z],K);if(!J[$])J[$]=X.user!=null?{__user:z0(X.user,Q,q,z,U[z])}:{};else if(!V.has($))H(`duplicate class ID: ${$}`);V.add($);for(let[p,b]of Object.entries(B)){const M=z0(p,Q,q,z,U[z]),_=z0(!K||F(b)?String(b):b8[K](b),Q,q,z,v);J[$][M]=_,W.debug($,M,_)}}return J},d4=(Z,X)=>{const J=F(Z.values)?X.tables?.[Z.values]||H(`invalid table ID: ${Z.values}`):Z.values;if(R(J))return J;const W=Z.key==="v"?(Y)=>String(Y):Z.key==="i1"?(Y,B)=>String(B+1):Z.key===void 0?(Y,B)=>String(B):H(`invalid key type: ${Z.key}`);return J.reduce((Y,B,U)=>{return Y[W(B,U)]=B,Y},{})},n4=(Z,X)=>{if(!X||F(Z))return Z;const J=b8[X];if(!J)H(`invalid unit: ${X}`);return J(Z)},z0=(Z,X,J,W,Y)=>Z.replace("<vid>",X).replace("<var>",J).replace("<k>",W).replace("<v>",String(Y));var Q1=L(l4(import.meta.dir,"package.json"));_1({name:"metacss",opts:{out:a({alias:"o",desc:"Output file (or stdout)"}),verbose:m({alias:"v",desc:"Display extra process information"})},commands:{convert:G8,export:v8,generate:_8},ctx:async(Z)=>{if(Z.opts.verbose)Z.logger.level=C.DEBUG;return{...Z,format:M0}},usage:{prefix:`
|
|
2
|
+
var f0={default:95,hint:90,multi:90,param:96,required:33};var m0=(Z)=>Z;var a=function(Z,X){return!X&&(X={}),(...J)=>{const W=JSON.stringify(J);if(W!==void 0)return W in X?X[W]:X[W]=Z.apply(null,J);return Z.apply(null,J)}};var t=a((Z,X)=>Z.repeat(X));var $1=(Z)=>/^[a-f0-9]+$/i.test(Z);var H1=(Z)=>/^[-+]?\d+$/.test(Z),K1=(Z)=>/^[-+]?\d*\.?\d+(e[-+]?\d+)?$/i.test(Z);var T=(Z,X=(J)=>J!==void 0?": "+J:"")=>class extends Error{constructor(J){super(Z(J)+X(J))}};var h5=T(()=>"illegal argument(s)"),K=(Z)=>{throw new h5(Z)};var u0=(Z)=>K1(Z)?parseFloat(Z):K(`not a numeric value: ${Z}`),C1=(Z)=>Z.map(u0),g0=(Z)=>$1(Z)?parseInt(Z,16):K(`not a hex value: ${Z}`),M1=(Z)=>Z.map(g0),x0=(Z)=>H1(Z)?parseInt(Z):K(`not an integer: ${Z}`),F1=(Z)=>Z.map(x0);var M0=(Z,X)=>(J)=>({coerce:Z,hint:X,group:"main",...J}),F0=(Z,X)=>(J)=>({hint:f5(X,J.delim),multi:!0,coerce:Z,group:"main",...J}),f5=(Z,X)=>Z+(X?`[${X}..]`:""),u=(Z)=>({flag:!0,default:!1,group:"flags",...Z}),r=M0(m0,"STR"),c=F0(m0,"STR"),Q4=M0(u0,"NUM"),q4=M0(g0,"HEX"),P1=M0(x0,"INT"),$4=F0(C1,"NUM"),H4=F0(M1,"HEX"),K4=F0(F1,"INT");var C=((Z)=>{return Z[Z.FINE=0]="FINE",Z[Z.DEBUG=1]="DEBUG",Z[Z.INFO=2]="INFO",Z[Z.WARN=3]="WARN",Z[Z.SEVERE=4]="SEVERE",Z[Z.NONE=5]="NONE",Z})(C||{});class d0{id;level;constructor(Z,X=C.FINE){this.id=Z,this.level=typeof X==="string"?C[X]:X}enabled(Z){return this.level<=Z}fine(...Z){this.level<=C.FINE&&this.log(C.FINE,Z)}debug(...Z){this.level<=C.DEBUG&&this.log(C.DEBUG,Z)}info(...Z){this.level<=C.INFO&&this.log(C.INFO,Z)}warn(...Z){this.level<=C.WARN&&this.log(C.WARN,Z)}severe(...Z){this.level<=C.SEVERE&&this.log(C.SEVERE,Z)}}var w1=(Z)=>Z.map((X)=>{if(typeof X==="function")X=X();if(!(typeof X==="string"||typeof X==="number"))X=JSON.stringify(X);return X}).join(" ");class 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
|
-
\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2502 ${
|
|
9
|
-
\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2502 ${
|
|
8
|
+
\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2502 ${q1.name} ${q1.version}
|
|
9
|
+
\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2502 ${q1.description}
|
|
10
10
|
\u2588 \u2502
|
|
11
11
|
\u2588 \u2588 \u2502
|
|
12
12
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/meta-css",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Data-driven CSS framework codegen, transpiler & bundler",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -38,26 +38,26 @@
|
|
|
38
38
|
"test": "bun test"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@thi.ng/api": "^8.9.
|
|
42
|
-
"@thi.ng/args": "^2.3.
|
|
43
|
-
"@thi.ng/arrays": "^2.7.
|
|
44
|
-
"@thi.ng/checks": "^3.4.
|
|
45
|
-
"@thi.ng/compose": "^2.1.
|
|
46
|
-
"@thi.ng/errors": "^2.4.
|
|
47
|
-
"@thi.ng/file-io": "^1.1.
|
|
48
|
-
"@thi.ng/hiccup-css": "^2.3.
|
|
49
|
-
"@thi.ng/logger": "^2.1.
|
|
50
|
-
"@thi.ng/rstream": "^8.2.
|
|
51
|
-
"@thi.ng/strings": "^3.7.
|
|
52
|
-
"@thi.ng/text-format": "^2.0.
|
|
53
|
-
"@thi.ng/transducers": "^8.8.
|
|
41
|
+
"@thi.ng/api": "^8.9.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
|
-
"@microsoft/api-extractor": "^7.
|
|
57
|
-
"esbuild": "^0.19.
|
|
56
|
+
"@microsoft/api-extractor": "^7.39.0",
|
|
57
|
+
"esbuild": "^0.19.10",
|
|
58
58
|
"rimraf": "^5.0.5",
|
|
59
59
|
"typedoc": "^0.25.4",
|
|
60
|
-
"typescript": "^5.3.
|
|
60
|
+
"typescript": "^5.3.3"
|
|
61
61
|
},
|
|
62
62
|
"keywords": [
|
|
63
63
|
"browser",
|
|
@@ -105,5 +105,5 @@
|
|
|
105
105
|
"status": "alpha",
|
|
106
106
|
"year": 2023
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "b3db173682e1148cf08a6bd907b8d90b47b7c066\n"
|
|
109
109
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"decls": [["@keyframes", "fadein", { "opacity": 0 }, { "opacity": 1 }]],
|
|
3
|
+
"specs": [
|
|
4
|
+
{
|
|
5
|
+
"user": "animations / transitions",
|
|
6
|
+
"name": "fadein<k>",
|
|
7
|
+
"key": "i+1",
|
|
8
|
+
"props": { "animation": "fadein <v> ease-in-out forwards" },
|
|
9
|
+
"values": [0.25, 0.5, 1],
|
|
10
|
+
"unit": "second"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"user": "animations / transitions",
|
|
14
|
+
"name": "bg-anim<k>",
|
|
15
|
+
"key": "i+1",
|
|
16
|
+
"props": { "transition": "<v> background-color ease-in-out" },
|
|
17
|
+
"values": [0.15, 0.25, 0.5],
|
|
18
|
+
"unit": "second"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"values": "borders-r",
|
|
22
22
|
"unit": "rem",
|
|
23
|
-
"
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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": [
|
|
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<
|
|
53
|
-
"
|
|
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<
|
|
71
|
-
"
|
|
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<
|
|
89
|
-
"
|
|
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": "
|
|
17
|
+
"key": "i+1",
|
|
18
18
|
"props": "<var>",
|
|
19
19
|
"values": "sizes-abs",
|
|
20
20
|
"unit": "rem",
|
|
21
|
-
"
|
|
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
|
-
"
|
|
29
|
+
"vars": ["w", "h"]
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
"user": "min. <var>",
|
|
33
33
|
"name": "min<vid><k>",
|
|
34
|
-
"key": "
|
|
34
|
+
"key": "i+1",
|
|
35
35
|
"props": "min-<var>",
|
|
36
36
|
"values": "sizes-abs",
|
|
37
37
|
"unit": "rem",
|
|
38
|
-
"
|
|
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
|
-
"
|
|
46
|
+
"vars": ["w", "h"]
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
"user": "max. <var>",
|
|
50
50
|
"name": "max<vid><k>",
|
|
51
|
-
"key": "
|
|
51
|
+
"key": "i+1",
|
|
52
52
|
"props": "max-<var>",
|
|
53
53
|
"values": "sizes-abs",
|
|
54
54
|
"unit": "rem",
|
|
55
|
-
"
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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": "
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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
|
-
"
|
|
57
|
+
"vars": ["align", "justify"]
|
|
58
58
|
}
|
|
59
59
|
]
|
|
60
60
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"props": "padding<var>",
|
|
10
10
|
"values": "margins",
|
|
11
11
|
"unit": "rem",
|
|
12
|
-
"
|
|
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
|
-
"
|
|
20
|
+
"vars": ["a", "h", "v", "t", "r", "b", "l"]
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"user": "margin",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"decls": [
|
|
3
|
+
["@comment", "----- start: CSS normalization -----"],
|
|
3
4
|
[":root", { "font-size": "16px" }],
|
|
4
5
|
["html", { "line-height": 1.15, "-webkit-text-size-adjust": "100%" }],
|
|
5
6
|
["body", { "margin": 0 }],
|
|
@@ -150,7 +151,8 @@
|
|
|
150
151
|
"ul li",
|
|
151
152
|
[":first-child", { "margin-top": 0 }],
|
|
152
153
|
[":last-child", { "margin-bottom": 0 }]
|
|
153
|
-
]
|
|
154
|
+
],
|
|
155
|
+
["@comment", "----- end: CSS normalization -----"]
|
|
154
156
|
],
|
|
155
157
|
"specs": []
|
|
156
158
|
}
|
|
@@ -11,21 +11,21 @@
|
|
|
11
11
|
{
|
|
12
12
|
"user": "shadow",
|
|
13
13
|
"name": "box-shadow-<k>",
|
|
14
|
-
"key": "
|
|
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": "
|
|
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": "
|
|
28
|
+
"key": "i+1",
|
|
29
29
|
"props": "text-shadow",
|
|
30
30
|
"values": [
|
|
31
31
|
"1px 1px 2px #0003",
|
package/specs/anim.json
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|