@teacss/classes 0.10.0 → 0.10.2
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/README.md +59 -5
- package/dist/attributes.d.ts +13 -0
- package/dist/attributes.js +20 -0
- package/dist/cache.d.ts +25 -0
- package/dist/cache.js +101 -0
- package/dist/generated/merge-policy.d.ts +5 -0
- package/dist/generated/merge-policy.js +37 -0
- package/dist/index.d.ts +6 -190
- package/dist/index.js +3 -1
- package/dist/input.d.ts +15 -0
- package/dist/input.js +116 -0
- package/dist/merge.d.ts +58 -0
- package/dist/merge.js +475 -0
- package/dist/recipe.d.ts +193 -0
- package/dist/recipe.js +594 -0
- package/dist/syntax/group.d.ts +35 -0
- package/dist/syntax/group.js +306 -0
- package/dist/syntax/literal.d.ts +17 -0
- package/dist/syntax/literal.js +152 -0
- package/dist/syntax/token.d.ts +51 -0
- package/dist/syntax/token.js +132 -0
- package/package.json +28 -16
package/README.md
CHANGED
|
@@ -8,6 +8,10 @@ No other package re-exports these helpers. Classes do not
|
|
|
8
8
|
generate CSS or validate utility values; merger plugins and custom conflict
|
|
9
9
|
configuration are not supported.
|
|
10
10
|
|
|
11
|
+
The full [usage reference](docs/usage.md) covers every `cn` input, the merge
|
|
12
|
+
model, recipe fields and selections. [Coverage principles](docs/coverage-principles.md)
|
|
13
|
+
records the constraints and design lessons behind the conflict rules.
|
|
14
|
+
|
|
11
15
|
## Recipes
|
|
12
16
|
|
|
13
17
|
A string `defaults` defines a single-element recipe. Calling it returns a
|
|
@@ -91,7 +95,7 @@ type-only and can infer types across package copies.
|
|
|
91
95
|
## Class merging
|
|
92
96
|
|
|
93
97
|
```sh
|
|
94
|
-
|
|
98
|
+
npm install @teacss/classes
|
|
95
99
|
```
|
|
96
100
|
|
|
97
101
|
```ts
|
|
@@ -108,8 +112,15 @@ templates, numbers, bigints, and falsy branches. Ordinary `0` and `0n` are
|
|
|
108
112
|
ignored; template interpolation preserves them. Getters run on each call and
|
|
109
113
|
user exceptions propagate unchanged. Invalid array lengths throw `TypeError`.
|
|
110
114
|
|
|
111
|
-
Only tokens with identical ordered conditions can conflict
|
|
112
|
-
|
|
115
|
+
Only tokens with identical ordered conditions can conflict. Like the generator,
|
|
116
|
+
`cn` orders conditions by selector role, so `p:4@md@hover` and `p:2@hover@md`
|
|
117
|
+
conflict, while `p:1@hover@focus` and `p:2@focus@hover` do not. The guards
|
|
118
|
+
`dark`, `light`, `surface-hairline`, `surface-layered`, `rtl` and `ltr` are the
|
|
119
|
+
exception within one role (they have no negated form): consecutive guards apply to
|
|
120
|
+
the same element, so their order is free, and `p:4@rtl@dark` and `p:2@dark@rtl`
|
|
121
|
+
conflict. A combinator between guards keeps them apart: `p:4@rtl@>li` and
|
|
122
|
+
`p:2@>li@rtl` do not conflict. Complete
|
|
123
|
+
language-tag payloads in `lang-` / `!lang-` compare without ASCII case. For example,
|
|
113
124
|
`cn("p:1@lang-zh-CN", "p:2@lang-zh-cn")` returns `"p:2@lang-zh-cn"`.
|
|
114
125
|
Winning tokens retain their spelling, including unsupported conditions; use
|
|
115
126
|
complete BCP 47 tags for CSS generation. `zh`, `zh-CN`, and `zh-Hans` have
|
|
@@ -119,6 +130,20 @@ it covers. Fixed composite-property exceptions preserve filter, shadow,
|
|
|
119
130
|
scrollbar, transform, image, and gradient behavior. Surviving raw tokens retain
|
|
120
131
|
their order.
|
|
121
132
|
|
|
133
|
+
Coverage follows the shorthands browsers ship, not only the specifications.
|
|
134
|
+
CSS Text 4 and CSS Inline 3 define `text-align` and `vertical-align` as
|
|
135
|
+
shorthands, but browsers keep them as longhands that do not reset
|
|
136
|
+
`text-align-last`, `baseline-source`, `alignment-baseline` or `baseline-shift`.
|
|
137
|
+
So `cn("text-align-last:right", "text-align:center")` and
|
|
138
|
+
`cn("baseline-shift:super", "vertical-align:top")` retain both tokens. When the
|
|
139
|
+
longhands a shorthand covers are not shipped yet, the specification decides:
|
|
140
|
+
`text-align:` still removes an earlier `text-align-all:`, and `white-space:`
|
|
141
|
+
removes an earlier `white-space-trim:`. The `corner` shorthands
|
|
142
|
+
(`corner:`, `corner-t:` and the other corner rows) and `text-spacing:` also follow their
|
|
143
|
+
specifications, although no browser parses them yet. A later one of these
|
|
144
|
+
removes an earlier `rd:`, `corner-shape:`, `text-autospace:` or
|
|
145
|
+
`text-spacing-trim:` token that the browser still applies.
|
|
146
|
+
|
|
122
147
|
The `dimensions`, `min-dimensions`, `max-dimensions`, `size`, `min-size`, and
|
|
123
148
|
`max-size` declarations also accumulate coverage from their two matching axes.
|
|
124
149
|
For example, `cn("dimensions:4x", "w:8", "h:10")` returns `"w:8 h:10"`, while
|
|
@@ -168,7 +193,36 @@ The exports are `cn`, `recipe`, `omitAttributes`, and the types `ClassDict`,
|
|
|
168
193
|
`ClassValue`, `Merger`, `ClassProp`, `RecipeIntrospection`, `Reciper`, `VariantProps`.
|
|
169
194
|
`Merger` and `Reciper` describe callable interfaces, not configurable factories.
|
|
170
195
|
|
|
171
|
-
|
|
172
|
-
|
|
196
|
+
## Where the conflict policy comes from
|
|
197
|
+
|
|
198
|
+
The conflict footprints are not written in this package. They live in the Rust
|
|
199
|
+
rule tables of the [teacss-rs](https://github.com/teacss/teacss-rs) repository,
|
|
200
|
+
next to the rules they describe; paths below are relative to its root. Each
|
|
201
|
+
Standard family declares its footprints in the `MERGE` table of
|
|
202
|
+
`crates/teacss-standard/src/<family>.rs`. The `icon` row is in
|
|
203
|
+
`crates/teacss-icons/src/merge.rs`, and the numbered typography group is in
|
|
204
|
+
`crates/teacss-official/src/merge.rs`.
|
|
205
|
+
|
|
206
|
+
Rust tests bind every row to its family's rules and compile the tables into one
|
|
207
|
+
policy, written as the snapshot
|
|
208
|
+
`crates/teacss-engine/tests/snapshots/merge_policy__policy.snap`.
|
|
209
|
+
`packages/classes/scripts/gen-merge-policy.mjs` only encodes that snapshot into
|
|
210
|
+
`packages/classes/src/generated/merge-policy.ts`; which classes conflict, and
|
|
211
|
+
which one wins, is decided in Rust. The runtime keeps three steps carried from
|
|
212
|
+
0.10.1 that read that data rather than add to it: how filter, backdrop-filter,
|
|
213
|
+
scrollbar-color and box-shadow parts are sequenced with `!`, the combined sizing
|
|
214
|
+
families, and the fallback for a prefix the policy does not know. A conflict
|
|
215
|
+
change is therefore a change to a Rust table, followed by
|
|
216
|
+
`INSTA_UPDATE=always cargo test -p teacss-engine --test merge_policy` and
|
|
217
|
+
`node packages/classes/scripts/gen-merge-policy.mjs`.
|
|
218
|
+
|
|
219
|
+
The token parser, class-list splitter and group expansion that `cn` runs first
|
|
220
|
+
are copied from 0.10.1. `packages/classes/scripts/gen-syntax-parity.mjs` writes
|
|
221
|
+
their output for about 15,000 cases to
|
|
222
|
+
`crates/teacss-syntax/tests/data/classes-syntax.json`, and a Rust test asserts
|
|
223
|
+
that the engine's `teacss-syntax` crate returns the same. The fixture lists the
|
|
224
|
+
inputs where Rust group expansion differs and the reason for each.
|
|
225
|
+
|
|
226
|
+
The package has no runtime dependencies and does not load the engine.
|
|
173
227
|
|
|
174
228
|
Pre-1.0. Public recipe and merge APIs may change before the stable release.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attribute helpers for component authors composing recipes with arbitrary
|
|
3
|
+
* pass-through DOM attributes.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Return a shallow copy of `attributes` without the entries whose names appear
|
|
7
|
+
* in `ownedNames`, compared case-insensitively — HTML attribute names are
|
|
8
|
+
* case-insensitive, so `onClick` and `onclick` collide on the same attribute.
|
|
9
|
+
* Use it to strip component-owned attributes before spreading the rest onto an
|
|
10
|
+
* element. The input object is not mutated; symbol-keyed entries are preserved.
|
|
11
|
+
*/
|
|
12
|
+
export declare function omitAttributes<T extends object>(attributes: T, ownedNames: readonly string[]): Partial<T>;
|
|
13
|
+
//# sourceMappingURL=attributes.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attribute helpers for component authors composing recipes with arbitrary
|
|
3
|
+
* pass-through DOM attributes.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Return a shallow copy of `attributes` without the entries whose names appear
|
|
7
|
+
* in `ownedNames`, compared case-insensitively — HTML attribute names are
|
|
8
|
+
* case-insensitive, so `onClick` and `onclick` collide on the same attribute.
|
|
9
|
+
* Use it to strip component-owned attributes before spreading the rest onto an
|
|
10
|
+
* element. The input object is not mutated; symbol-keyed entries are preserved.
|
|
11
|
+
*/
|
|
12
|
+
export function omitAttributes(attributes, ownedNames) {
|
|
13
|
+
const safeAttributes = { ...attributes };
|
|
14
|
+
const owned = new Set(ownedNames.map((name) => name.toLowerCase()));
|
|
15
|
+
for (const name of Object.keys(safeAttributes)) {
|
|
16
|
+
if (owned.has(name.toLowerCase()))
|
|
17
|
+
delete safeAttributes[name];
|
|
18
|
+
}
|
|
19
|
+
return safeAttributes;
|
|
20
|
+
}
|
package/dist/cache.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare class StringCache<Value> {
|
|
2
|
+
readonly max: number;
|
|
3
|
+
readonly budget: number;
|
|
4
|
+
readonly weight: (key: string, value: Value) => number;
|
|
5
|
+
readonly values: Map<string, Value>;
|
|
6
|
+
private readonly queue;
|
|
7
|
+
private head;
|
|
8
|
+
private tail;
|
|
9
|
+
bytes: number;
|
|
10
|
+
constructor(max: number, budget: number, weight: (key: string, value: Value) => number);
|
|
11
|
+
get(key: string): Value | undefined;
|
|
12
|
+
set(key: string, value: Value): void;
|
|
13
|
+
}
|
|
14
|
+
/** The FIFO Map is also the queue, so evictions cannot leave an unbounded tail. */
|
|
15
|
+
export declare class TupleCache {
|
|
16
|
+
private readonly root;
|
|
17
|
+
private readonly entries;
|
|
18
|
+
bytes: number;
|
|
19
|
+
nodes: number;
|
|
20
|
+
get size(): number;
|
|
21
|
+
get(args: readonly string[]): string | undefined;
|
|
22
|
+
set(args: readonly string[], result: string): void;
|
|
23
|
+
private prune;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=cache.d.ts.map
|
package/dist/cache.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/** Private FIFO caches: hits do not rewrite insertion order. */
|
|
2
|
+
import { setOwnArrayIndex } from "./input.js";
|
|
3
|
+
export class StringCache {
|
|
4
|
+
max;
|
|
5
|
+
budget;
|
|
6
|
+
weight;
|
|
7
|
+
values = new Map();
|
|
8
|
+
queue = [];
|
|
9
|
+
head = 0;
|
|
10
|
+
tail = 0;
|
|
11
|
+
bytes = 0;
|
|
12
|
+
constructor(max, budget, weight) {
|
|
13
|
+
this.max = max;
|
|
14
|
+
this.budget = budget;
|
|
15
|
+
this.weight = weight;
|
|
16
|
+
}
|
|
17
|
+
get(key) {
|
|
18
|
+
return this.values.get(key);
|
|
19
|
+
}
|
|
20
|
+
set(key, value) {
|
|
21
|
+
const bytes = this.weight(key, value);
|
|
22
|
+
if (bytes > this.budget || this.max === 0 || this.values.has(key))
|
|
23
|
+
return;
|
|
24
|
+
while (this.values.size >= this.max || this.bytes + bytes > this.budget) {
|
|
25
|
+
const first = this.queue[this.head];
|
|
26
|
+
this.bytes -= this.weight(first, this.values.get(first));
|
|
27
|
+
this.values.delete(first);
|
|
28
|
+
this.queue[this.head] = "";
|
|
29
|
+
this.head = (this.head + 1) % this.max;
|
|
30
|
+
}
|
|
31
|
+
this.values.set(key, value);
|
|
32
|
+
if (this.tail < this.queue.length)
|
|
33
|
+
this.queue[this.tail] = key;
|
|
34
|
+
else
|
|
35
|
+
setOwnArrayIndex(this.queue, this.tail, key);
|
|
36
|
+
this.tail = (this.tail + 1) % this.max;
|
|
37
|
+
this.bytes += bytes;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** The FIFO Map is also the queue, so evictions cannot leave an unbounded tail. */
|
|
41
|
+
export class TupleCache {
|
|
42
|
+
root = { children: new Map(), result: undefined };
|
|
43
|
+
entries = new Map();
|
|
44
|
+
bytes = 0;
|
|
45
|
+
nodes = 1;
|
|
46
|
+
get size() {
|
|
47
|
+
return this.entries.size;
|
|
48
|
+
}
|
|
49
|
+
get(args) {
|
|
50
|
+
let node = this.root;
|
|
51
|
+
for (let index = 0; index < args.length; index++) {
|
|
52
|
+
const child = node.children.get(args[index]);
|
|
53
|
+
if (!child)
|
|
54
|
+
return;
|
|
55
|
+
node = child;
|
|
56
|
+
}
|
|
57
|
+
return node.result;
|
|
58
|
+
}
|
|
59
|
+
set(args, result) {
|
|
60
|
+
let bytes = result.length * 2;
|
|
61
|
+
for (let index = 0; index < args.length; index++)
|
|
62
|
+
bytes += args[index].length * 2;
|
|
63
|
+
if (bytes > 65536)
|
|
64
|
+
return;
|
|
65
|
+
// Only successful misses enter here; an existing arity terminal is not rewritten.
|
|
66
|
+
if (this.get(args) !== undefined)
|
|
67
|
+
return;
|
|
68
|
+
while (this.entries.size >= 64 || this.bytes + bytes > 65536) {
|
|
69
|
+
const first = this.entries.keys().next().value;
|
|
70
|
+
const entry = this.entries.get(first);
|
|
71
|
+
first.result = undefined;
|
|
72
|
+
this.prune(this.root, entry.args, 0);
|
|
73
|
+
this.entries.delete(first);
|
|
74
|
+
this.bytes -= entry.bytes;
|
|
75
|
+
}
|
|
76
|
+
let node = this.root;
|
|
77
|
+
for (let index = 0; index < args.length; index++) {
|
|
78
|
+
let child = node.children.get(args[index]);
|
|
79
|
+
if (!child) {
|
|
80
|
+
child = { children: new Map(), result: undefined };
|
|
81
|
+
node.children.set(args[index], child);
|
|
82
|
+
this.nodes++;
|
|
83
|
+
}
|
|
84
|
+
node = child;
|
|
85
|
+
}
|
|
86
|
+
node.result = result;
|
|
87
|
+
this.entries.set(node, { args, bytes });
|
|
88
|
+
this.bytes += bytes;
|
|
89
|
+
}
|
|
90
|
+
prune(node, args, index) {
|
|
91
|
+
if (index === args.length)
|
|
92
|
+
return;
|
|
93
|
+
const key = args[index];
|
|
94
|
+
const child = node.children.get(key);
|
|
95
|
+
this.prune(child, args, index + 1);
|
|
96
|
+
if (child.children.size === 0 && child.result === undefined) {
|
|
97
|
+
node.children.delete(key);
|
|
98
|
+
this.nodes--;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const prefixes: string[];
|
|
2
|
+
export declare const rows: number[][], equalRows: number[], importantRows: number[];
|
|
3
|
+
export declare const finalizerFlags: Uint8Array<ArrayBuffer>;
|
|
4
|
+
export declare const typographyNames: ReadonlySet<string>;
|
|
5
|
+
//# sourceMappingURL=merge-policy.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Generated by packages/classes/scripts/gen-merge-policy.mjs from crates/teacss-engine/tests/snapshots/merge_policy__policy.snap. Do not edit.
|
|
2
|
+
// E: same importance, later deletes earlier. I: important deletes ordinary.
|
|
3
|
+
// Every descriptor's self edge is implicit. Row zero is empty.
|
|
4
|
+
function numbers(value) {
|
|
5
|
+
return value ? value.split(",").map((item) => Number.parseInt(item, 36)) : [];
|
|
6
|
+
}
|
|
7
|
+
function decodePrefixes(value) {
|
|
8
|
+
let previous = "";
|
|
9
|
+
return value.split(" ").map((item) => (previous = previous.slice(0, Number.parseInt(item[0], 36)) + item.slice(1)));
|
|
10
|
+
}
|
|
11
|
+
export const prefixes = decodePrefixes("0alc 2i 2s 1nimation 9-delay birection buration afill aiteration aname aplay arange-end gstart atimeline ding 0backdrop-blur arightness 9contrast 9filter 9grayscale 9hue-rotate 9invert 9opacity 9saturate aepia 1g-g 4-1 6-angle 7color 7position 52 6-angle 7color 7position 53 6-angle 7color 7position 54 6-angle 7color 7position 55 6-angle 7color 7position 56 6-angle 7color 7position 57 6-angle 7color 7position 58 6-angle 7color 7position 59 6-angle 7color 7position 5angle 5to 3image 1lock-size 7tep a-align binsert bround bsize 2ur 1order 6-b 8-color 9style 9width 8lock c-color dstyle dwidth 7color 7e 8-color 9style 9width 7g 8-1 a-angle bcolor bposition 92 a-angle bcolor bposition 93 a-angle bcolor bposition 94 a-angle bcolor bposition 95 a-angle bcolor bposition 96 a-angle bcolor bposition 97 a-angle bcolor bposition 98 a-angle bcolor bposition 99 a-angle bcolor bposition 9angle 9to 7image c-outset drepeat dslice eource dwidth 8nline d-color estyle ewidth 7l 8-color 9style 9width 7n 8-color 9style 9width 7r 8-color 9style 9width 7s 8-color 9style 9width 8pacing e-x fy 8tyle 7t 8-color 9style 9width 7u 8-color 9style 9width 7width 7x 8-color 9style 9width 7y 8-color 9style 9width 2x-shadow 1rightness 0column-count 7height 7width 8rap 6s 2ntrast 2rner 6-b 8-shape 8l 9-shape 8r 9-shape 7e 8-shape 8e 9-shape 8s 9-shape 7l 8-shape 7n 8-shape 7r 8-shape 7s 8-shape 8e 9-shape 8hape 8s 9-shape 7t 8-shape 8l 9-shape 8r 9-shape 7u 8-shape 0d 1imensions 1rop-shadow 0filter 6-opacity 1lex 4-basis 5grow 5shrink 0g-1 3-angle 4color 4position 22 3-angle 4color 4position 23 3-angle 4color 4position 24 3-angle 4color 4position 25 3-angle 4color 4position 26 3-angle 4color 4position 27 3-angle 4color 4position 28 3-angle 4color 4position 29 3-angle 4color 4position 2angle 2to 1ap 3-column 4row 1rayscale 2id-area 5column b-end cspan dtart 5row 8-end 9span atart 0h 1ue-rotate 0i 1-b 3lock 2e 2inline 2l 2n 2r 2s 2t 2u 2x 2y 1nline-size 2set-shadow c-outline-width 2vert 0juc 2i 2s 0line-clamp 0m 1-b 3lock 2e 2inline 2l 2n 2r 2s 2t 2u 2x 2y 1ask-b-1-color 9position 79-color 9position 5composite 5g 6-1 8-angle 9color 9position 72 8-angle 9color 9position 73 8-angle 9color 9position 74 8-angle 9color 9position 75 8-angle 9color 9position 76 8-angle 9color 9position 77 8-angle 9color 9position 78 8-angle 9color 9position 79 8-angle 9color 9position 7angle 7conic c-1 e-angle fcolor d2 e-angle fcolor d3 e-angle fcolor d4 e-angle fcolor d5 e-angle fcolor d6 e-angle fcolor d7 e-angle fcolor d8 e-angle fcolor d9 e-angle fcolor 7linear d-1 f-color gposition e2 f-color gposition e3 f-color gposition e4 f-color gposition e5 f-color gposition e6 f-color gposition e7 f-color gposition e8 f-color gposition e9 f-color gposition eangle eto 7radial d-1 f-color gposition e2 f-color gposition e3 f-color gposition e4 f-color gposition e5 f-color gposition e6 f-color gposition e7 f-color gposition e8 f-color gposition e9 f-color gposition 7to 5image 5l-1-color 9position 79-color 9position 5r-1-color 9position 79-color 9position 5t-1-color 9position 79-color 9position 5x-1-color 9position 79-color 9position 5y-1-color 9position 79-color 9position 2x-block-size 4dimensions 4h 4inline-size 4size 4w 1in-block-size 4dimensions 4h 4inline-size 4size 4w 0outline 7-color 8style 8width 1verflow 8-block 9clip-m f-b hlock ge ginline gl gn gr gs gt gu gx gy 9inline 9x 9y 4scroll-behavior j-block kinline kx ky 0p 1-b 3lock 2e 2inline 2l 2n 2r 2s 2t 2u 2x 2y 1lc 2i 2s 0rd 2-b 4l 4r 3e 4e 4s 3l 3n 3r 3s 4e 4s 3t 4l 4r 3u 1otate-x 7y 7z 1ule 4-break 5color 8umn b-break ccolor cinset h-cap iend ijunction istart cstyle cvis cwidth 5inset a-cap bend bjunction bstart 5row 8-break 9color 9inset e-cap fend fjunction fstart 9style 9vis 9width 5style 5vis 5width 0saturate 1cale 5-x 6y 6z 2roll-m 8-b alock 9e 9inline 9l 9n 9r 9s 9t 9u 9x 9y 7p 8-b alock 9e 9inline 9l 9n 9r 9s 9t 9u 9x 9y 6bar-color athumb brack 1epia 1hadow 6-outline-width 1ize 1kew 4-x 5y 0text-align a-all 6utospace 5emphasis d-color estyle 5spacing c-trim 6troke b-color cwidth 5wrap 9-mode astyle 1ransform 5ition a-behavior bdelay curation bproperty btiming 5late 9-x ay az 0w 1hite-space b-collapse ctrim");
|
|
12
|
+
function decodeRows(patternData, equalData, importantData) {
|
|
13
|
+
const patterns = patternData.split("|").map((data) => {
|
|
14
|
+
let previous = 0;
|
|
15
|
+
return numbers(data).map((gap) => (previous += gap));
|
|
16
|
+
});
|
|
17
|
+
const rows = [[]];
|
|
18
|
+
const seen = new Map([["", 0]]);
|
|
19
|
+
const decode = (data) => numbers(data).map((pattern, source) => {
|
|
20
|
+
const row = patterns[pattern].map((offset) => source + offset);
|
|
21
|
+
const key = row.join(",");
|
|
22
|
+
let id = seen.get(key);
|
|
23
|
+
if (id === undefined) {
|
|
24
|
+
id = rows.length;
|
|
25
|
+
Object.defineProperty(rows, id, { value: row, configurable: true, enumerable: true, writable: true });
|
|
26
|
+
seen.set(key, id);
|
|
27
|
+
}
|
|
28
|
+
return id;
|
|
29
|
+
});
|
|
30
|
+
return { rows, equalRows: decode(equalData), importantRows: decode(importantData) };
|
|
31
|
+
}
|
|
32
|
+
export const { rows, equalRows, importantRows } = decodeRows("|1,1,1,1,1,1,1,1,1,1,1|3|2|1|-3,1,1,2,1,1,1,1,1|-1|-2|-3|-4|-5|-6|13|1,1,1|-13|1,1,1,1|42|1,1,1,1,1,1,1,1,1,1,1,1,1,14,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1|1,1,1,1n,1,1,1,h,1,1,1|1q,k|-7,4,5,1d,4,4,4,4,8,4,5,4|17|-13,14,1,1,1,1|-1d,1,1,1,1b,1,1,d,1,1,1|-1d,1t|1,1|-27,4,5,1d,4,4,4,4,8,4,5,4|-2f,4,5,1d,4,4,4,4,8,4,5,4|-t,1,1,1,5,1,1,1,j,1,1|-t,8|-2n,1,1,1,27,1,1,1,b,1,1|-2n,2a|3a,1,8p,1|18|-4,1,1,1|12|1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,8f,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1|1,1,1,1,1,97,1,1|2,2|1,9a|1,99|1,1,1,b,1,8u,1,6|2,c|1,97|1,96|-a,1,a,e,1,8l,5,7|-a,p|-6,1,1,1,4,91,1,2|-6,2|-c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,0,3t,0,0");
|
|
33
|
+
export const finalizerFlags = new Uint8Array(prefixes.length);
|
|
34
|
+
const flags = numbers("f,4,g,4,h,4,i,5,j,4,k,4,l,4,m,4,n,4,o,4,1z,2,4s,9,4t,2,4z,2,60,2,61,3,62,2,7c,2,7n,2,82,8,83,8,84,2,ft,2,go,7,gp,6,gq,6,gr,2,gs,8,gt,8");
|
|
35
|
+
for (let index = 0; index < flags.length; index += 2)
|
|
36
|
+
finalizerFlags[flags[index]] = flags[index + 1];
|
|
37
|
+
export const typographyNames = new Set(["heading-1x", "heading-1x-mono", "heading-2x", "heading-2x-mono", "heading-3x", "heading-3x-mono", "heading-4x", "heading-4x-mono", "heading-5x", "heading-5x-mono", "heading-6x", "heading-6x-mono", "heading-7x", "heading-7x-mono", "heading-8x", "heading-8x-mono", "heading-9x", "heading-9x-mono", "label-1x", "label-1x-mono", "label-2x", "label-2x-mono", "label-3x", "label-3x-mono", "label-4x", "label-4x-mono", "label-5x", "label-5x-mono", "label-6x", "label-6x-mono", "label-7x", "label-7x-mono", "label-8x", "label-8x-mono", "label-9x", "label-9x-mono", "prose-1x", "prose-1x-mono", "prose-2x", "prose-2x-mono", "prose-3x", "prose-3x-mono", "prose-4x", "prose-4x-mono", "prose-5x", "prose-5x-mono", "prose-6x", "prose-6x-mono", "prose-7x", "prose-7x-mono", "prose-8x", "prose-8x-mono", "prose-9x", "prose-9x-mono"]);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,190 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* Return a shallow copy of `attributes` without the entries whose names appear
|
|
8
|
-
* in `ownedNames`, compared case-insensitively — HTML attribute names are
|
|
9
|
-
* case-insensitive, so `onClick` and `onclick` collide on the same attribute.
|
|
10
|
-
* Use it to strip component-owned attributes before spreading the rest onto an
|
|
11
|
-
* element. The input object is not mutated; symbol-keyed entries are preserved.
|
|
12
|
-
*/
|
|
13
|
-
export declare function omitAttributes<T extends object>(attributes: T, ownedNames: readonly string[]): Partial<T>;
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/input.d.ts
|
|
16
|
-
type ClassDict = Record<string, any>;
|
|
17
|
-
type ClassValue = string | number | bigint | null | undefined | boolean | readonly ClassValue[] | ClassDict;
|
|
18
|
-
interface Merger {
|
|
19
|
-
(strings: TemplateStringsArray, ...expressions: ClassValue[]): string;
|
|
20
|
-
(...inputs: ClassValue[]): string;
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region src/merge.d.ts
|
|
24
|
-
interface Token {
|
|
25
|
-
readonly raw: string;
|
|
26
|
-
readonly id: number;
|
|
27
|
-
readonly important: number;
|
|
28
|
-
readonly condition: string;
|
|
29
|
-
readonly identity: string;
|
|
30
|
-
readonly family: number;
|
|
31
|
-
}
|
|
32
|
-
interface PreparedFragment {
|
|
33
|
-
readonly raw: string;
|
|
34
|
-
readonly tokens?: readonly Token[];
|
|
35
|
-
}
|
|
36
|
-
declare const cn: Merger, prepareFragment: (raw: string) => PreparedFragment, mergePrepared: (fragments: readonly PreparedFragment[], caller: ClassValue) => string;
|
|
37
|
-
//#endregion
|
|
38
|
-
//#region src/recipe.d.ts
|
|
39
|
-
type ClassProp = {
|
|
40
|
-
className?: ClassValue;
|
|
41
|
-
};
|
|
42
|
-
type ReservedSlotName = "class" | "className" | "then" | "toJSON" | "toString" | "valueOf";
|
|
43
|
-
type ReservedVariantName = "class" | "className" | "classKeys";
|
|
44
|
-
type StaticallyUnsafeSchemaName = "__proto__";
|
|
45
|
-
type CanonicalKey<Key> = Key extends string ? Key : Key extends number ? `${Key}` : never;
|
|
46
|
-
type CanonicalKeys<Value> = CanonicalKey<Extract<keyof Value, string | number>>;
|
|
47
|
-
type SchemaWhitespace = "\t" | "\v" | "\f" | " " | " " | " " | " " | " " | " " | " " | " " | " " | " " | " " | " " | " " | " " | "
" | "
" | " " | " " | " " | "" | "\n" | "\r";
|
|
48
|
-
type StripLeadingWhitespace<Value extends string> = Value extends `${SchemaWhitespace}${infer Rest}` ? StripLeadingWhitespace<Rest> : Value;
|
|
49
|
-
type WhitespaceOnlyName<Name extends string> = Name extends unknown ? (StripLeadingWhitespace<Name> extends "" ? Name : never) : never;
|
|
50
|
-
type NumericChoiceInput<Key extends string> = Key extends `${infer Numeric extends number}` ? (number extends Numeric ? never : `${Numeric}` extends Key ? Numeric : never) : never;
|
|
51
|
-
type ChoiceInput<Choices extends string> = Choices | NumericChoiceInput<Choices> | (Extract<Choices, "true" | "false"> extends never ? never : boolean);
|
|
52
|
-
type VariantSelection<Choices extends string> = ChoiceInput<Choices> | null;
|
|
53
|
-
type VariantSchema = Readonly<Record<string, string>>;
|
|
54
|
-
type RecordInput = Readonly<Record<string, any>>;
|
|
55
|
-
type NonRecordInput = readonly unknown[] | ((...args: any[]) => any) | (abstract new (...args: any[]) => any);
|
|
56
|
-
type VariantSelections<Variants extends VariantSchema> = keyof Variants extends never ? Readonly<Record<symbol, unknown>> : { readonly [Name in keyof Variants]?: VariantSelection<Extract<Variants[Name], string>> | undefined; };
|
|
57
|
-
type DefinitionVariantSelections<Variants extends VariantSchema> = VariantSelections<Variants> & Readonly<Record<symbol, unknown>>;
|
|
58
|
-
/**
|
|
59
|
-
* Read-only introspection snapshot carried by every recipe function so
|
|
60
|
-
* tooling (dead-token guards, docs generators, Storybook controls) can
|
|
61
|
-
* enumerate the variant space without parsing source. `anatomy` lists the
|
|
62
|
-
* declared `defaults` object keys (empty for single-element recipes),
|
|
63
|
-
* `variants` maps each axis to its choice names, `defaultVariants` reports
|
|
64
|
-
* declared defaults (booleans in their normalized `"true"`/`"false"`
|
|
65
|
-
* spelling), and `compoundVariantCount` counts the declared compound
|
|
66
|
-
* entries.
|
|
67
|
-
*/
|
|
68
|
-
interface RecipeIntrospection {
|
|
69
|
-
readonly anatomy: readonly string[];
|
|
70
|
-
readonly variants: Readonly<Record<string, readonly string[]>>;
|
|
71
|
-
readonly defaultVariants: Readonly<Record<string, string>>;
|
|
72
|
-
readonly compoundVariantCount: number;
|
|
73
|
-
}
|
|
74
|
-
type RecipeCarrier = {
|
|
75
|
-
readonly [Symbol.unscopables]: never;
|
|
76
|
-
readonly config: RecipeIntrospection;
|
|
77
|
-
};
|
|
78
|
-
type IsAny<Value> = 0 extends 1 & Value ? true : false;
|
|
79
|
-
type IsUnion<Value, Whole = Value> = IsAny<Value> extends true ? false : Value extends Whole ? ([Whole] extends [Value] ? false : true) : never;
|
|
80
|
-
type InvalidRecordShape<Value> = Value extends unknown ? (Value extends NonRecordInput ? true : false) : never;
|
|
81
|
-
type OptionalSchemaKeys<Value> = Value extends unknown ? { [Key in Extract<keyof Value, string | number>]-?: {} extends Pick<Value, Key> ? Key : never; }[Extract<keyof Value, string | number>] : never;
|
|
82
|
-
type OpenSchemaKeys<Value> = string extends keyof Value ? string : number extends keyof Value ? number : never;
|
|
83
|
-
type ValidateStableSchema<Value> = IsAny<Value> extends true ? unknown : true extends IsUnion<Value> ? never : true extends InvalidRecordShape<Value> ? never : OpenSchemaKeys<Value> extends never ? (OptionalSchemaKeys<Value> extends never ? unknown : never) : never;
|
|
84
|
-
type ValidateNonUnion<Value> = IsAny<Value> extends true ? unknown : true extends IsUnion<Value> ? never : unknown;
|
|
85
|
-
type ValidateRecordShape<Value> = IsAny<Value> extends true ? unknown : true extends InvalidRecordShape<Value> ? never : unknown;
|
|
86
|
-
type ValidateKnownKeys<Value, Keys extends PropertyKey> = IsAny<Value> extends true ? unknown : Exclude<Extract<keyof Value, string | number>, Keys> extends never ? unknown : never;
|
|
87
|
-
type ValidatePropsInput<Input, Props> = IsAny<Input> extends true ? unknown : true extends InvalidRecordShape<Exclude<Input, undefined>> ? never : Exclude<CanonicalKeys<Exclude<Input, undefined>>, CanonicalKeys<Props>> extends never ? unknown : never;
|
|
88
|
-
type SlotProps<Variants extends VariantSchema> = keyof Variants extends never ? ClassProp : VariantSelections<Variants> & ClassProp;
|
|
89
|
-
type SingleRecipeProps<Variants extends VariantSchema> = VariantSelections<Variants> & ClassProp;
|
|
90
|
-
type RecipeResult<Slots extends string, Variants extends VariantSchema> = { readonly [Slot in Slots]: <const Input>(props?: Input & SlotProps<Variants> & NoInfer<ValidatePropsInput<Input, SlotProps<Variants>>>) => string; };
|
|
91
|
-
type TeaRecipeResult<Slots extends string, Variants extends VariantSchema> = RecipeResult<Slots, Variants>;
|
|
92
|
-
type TeaSingleRecipe<Variants extends VariantSchema> = (<const Input>(props?: Input & SingleRecipeProps<Variants> & NoInfer<ValidatePropsInput<Input, SingleRecipeProps<Variants>>>) => string) & RecipeCarrier;
|
|
93
|
-
type TeaMultiElementRecipe<Slots extends string, Variants extends VariantSchema> = (<const Input>(props?: Input & VariantSelections<Variants> & NoInfer<ValidatePropsInput<Input, VariantSelections<Variants>>>) => TeaRecipeResult<Slots, Variants>) & RecipeCarrier;
|
|
94
|
-
type BrandedRecipe = Function & RecipeCarrier;
|
|
95
|
-
type SingleBrandedRecipe = BrandedRecipe & ((props?: any) => string);
|
|
96
|
-
type MultiElementBrandedRecipe = BrandedRecipe & ((props?: any) => Readonly<Record<string, (props?: any) => string>>);
|
|
97
|
-
type SchemaFromSelections<Selections> = { readonly [Name in Exclude<Extract<keyof NonNullable<Selections>, string>, keyof ClassProp>]: Extract<NonNullable<Selections>[Name], string>; };
|
|
98
|
-
type ParentSchema<Parent> = [Parent] extends [RecipeCarrier & ((props?: infer Selections) => infer Result)] ? {
|
|
99
|
-
readonly classKeys: Result extends string ? never : Extract<keyof Result, string>;
|
|
100
|
-
readonly variants: SchemaFromSelections<Selections>;
|
|
101
|
-
} : {
|
|
102
|
-
readonly classKeys: never;
|
|
103
|
-
readonly variants: {};
|
|
104
|
-
};
|
|
105
|
-
type ParentClassKeys<Parent> = Extract<ParentSchema<Parent>["classKeys"], string>;
|
|
106
|
-
type ParentVariants<Parent> = ParentSchema<Parent>["variants"] extends (infer Variants extends VariantSchema) ? Variants : {};
|
|
107
|
-
type StylesInput = RecordInput;
|
|
108
|
-
type SlotNames<Styles> = CanonicalKeys<Styles>;
|
|
109
|
-
type EffectiveSlots<Parent, Styles> = ParentClassKeys<Parent> | SlotNames<Styles>;
|
|
110
|
-
type SlotTargetMap<Slots extends string> = Readonly<Partial<Record<Slots, ClassValue>>>;
|
|
111
|
-
type VariantsInput = RecordInput;
|
|
112
|
-
type OwnVariantSchema<Variants> = [Variants] extends [VariantsInput] ? { readonly [Name in keyof Variants as CanonicalKey<Name>]: CanonicalKeys<Variants[Name]>; } : {};
|
|
113
|
-
type VariantChoicesAt<Schema, Name extends PropertyKey> = Extract<Schema extends Readonly<Record<Name, infer Choices>> ? Choices : never, string>;
|
|
114
|
-
type MergeVariantSchemas<Parent, Child> = { readonly [Name in Extract<keyof Parent | keyof Child, string>]: VariantChoicesAt<Parent, Name> | VariantChoicesAt<Child, Name>; };
|
|
115
|
-
type EffectiveVariants<Parent, Variants> = MergeVariantSchemas<ParentVariants<Parent>, OwnVariantSchema<Variants>>;
|
|
116
|
-
type CompoundConditions<Variants extends VariantSchema> = { readonly [Name in keyof Variants]?: VariantSelection<Extract<Variants[Name], string>> | readonly [VariantSelection<Extract<Variants[Name], string>>, ...VariantSelection<Extract<Variants[Name], string>>[]]; };
|
|
117
|
-
type SingleCompoundDefinition<Variants extends VariantSchema> = {
|
|
118
|
-
readonly className: string;
|
|
119
|
-
} & CompoundConditions<Variants>;
|
|
120
|
-
type MultiElementCompoundDefinition<Slots extends string, Variants extends VariantSchema> = ({
|
|
121
|
-
readonly className: SlotTargetMap<NoInfer<Slots>>;
|
|
122
|
-
readonly classKeys?: never;
|
|
123
|
-
} | {
|
|
124
|
-
readonly className: string;
|
|
125
|
-
readonly classKeys: readonly [NoInfer<Slots>, ...NoInfer<Slots>[]];
|
|
126
|
-
}) & CompoundConditions<Variants>;
|
|
127
|
-
type InvalidSlotNames<Styles> = Extract<SlotNames<Styles>, ReservedSlotName | StaticallyUnsafeSchemaName> | WhitespaceOnlyName<SlotNames<Styles>>;
|
|
128
|
-
type InvalidVariantNames<Variants> = Extract<CanonicalKeys<NonNullable<Variants>>, ReservedVariantName | StaticallyUnsafeSchemaName> | WhitespaceOnlyName<CanonicalKeys<NonNullable<Variants>>>;
|
|
129
|
-
type InvalidChoiceNames<Choices> = Extract<CanonicalKeys<Choices>, StaticallyUnsafeSchemaName>;
|
|
130
|
-
type AllowedSlotNames<Styles> = InvalidSlotNames<Styles> extends never ? unknown : never;
|
|
131
|
-
type AllowedVariantNames<Variants> = InvalidVariantNames<Variants> extends never ? unknown : never;
|
|
132
|
-
type ValidateStyles<Styles> = SlotNames<Styles> extends never ? never : Styles extends Readonly<Record<Extract<keyof Styles, string | number>, ClassValue>> ? unknown : never;
|
|
133
|
-
type SlotTargetNames<Targets> = Targets extends unknown ? CanonicalKeys<Targets> : never;
|
|
134
|
-
type ValidateSlotTargetValues<Targets> = Targets extends RecordInput ? { readonly [Name in keyof Targets]: Name extends symbol ? Targets[Name] : Targets[Name] extends ClassValue ? Targets[Name] : never; } : never;
|
|
135
|
-
type InvalidSlotTargetValueNames<Targets> = Targets extends RecordInput ? { readonly [Name in Extract<keyof Targets, string | number>]-?: IsAny<Targets[Name]> extends true ? never : Targets[Name] extends ClassValue ? never : Name; }[Extract<keyof Targets, string | number>] : never;
|
|
136
|
-
type ValidateSlotTargets<Targets, Slots extends string> = IsAny<Targets> extends true ? unknown : true extends InvalidRecordShape<Targets> ? never : [Targets] extends [RecordInput] ? (Exclude<SlotTargetNames<Targets>, Slots> extends never ? (InvalidSlotTargetValueNames<Targets> extends never ? ValidateSlotTargetValues<Targets> : never) : never) : never;
|
|
137
|
-
type ValidateSingleChoices<Choices> = ValidateStableSchema<Choices> extends never ? never : InvalidChoiceNames<Choices> extends never ? CanonicalKeys<Choices> extends never ? never : Choices extends RecordInput ? { readonly [Name in keyof Choices]: Name extends symbol ? Choices[Name] : IsAny<Choices[Name]> extends true ? unknown : [Choices[Name]] extends [string] ? Choices[Name] : never; } : never : never;
|
|
138
|
-
type ValidateMultiElementChoices<Choices, Slots extends string> = ValidateStableSchema<Choices> extends never ? never : InvalidChoiceNames<Choices> extends never ? CanonicalKeys<Choices> extends never ? never : Choices extends RecordInput ? { readonly [Name in keyof Choices]: ValidateSlotTargets<Choices[Name], Slots>; } : never : never;
|
|
139
|
-
type ValidateSingleVariants<Variants> = [Variants] extends [VariantsInput] ? { readonly [Name in keyof Variants]: ValidateSingleChoices<Variants[Name]>; } : unknown;
|
|
140
|
-
type ValidateMultiElementVariants<Variants, Slots extends string> = [Variants] extends [VariantsInput] ? { readonly [Name in keyof Variants]: ValidateMultiElementChoices<Variants[Name], Slots>; } : unknown;
|
|
141
|
-
type ValidateCompoundCondition<Condition> = undefined extends Condition ? never : Condition extends readonly [] ? never : Condition;
|
|
142
|
-
type ValidateSingleCompoundOutput<Output> = IsAny<Output> extends true ? unknown : [Output] extends [string] ? Output : never;
|
|
143
|
-
type ValidateMultiElementCompoundOutput<Output, Slots extends string> = SlotTargetNames<Output> extends never ? never : ValidateSlotTargets<Output, Slots>;
|
|
144
|
-
type HasDuplicateClassKeys<Targets extends readonly unknown[], Seen = never> = Targets extends readonly [infer Target, ...infer Rest] ? (Extract<Target, Seen> extends never ? HasDuplicateClassKeys<Rest, Seen | Target> : true) : false;
|
|
145
|
-
type ValidateCompoundClassKeys<Targets, Slots extends string> = IsAny<Targets> extends true ? unknown : Targets extends readonly [unknown, ...unknown[]] ? (Exclude<Targets[number], Slots> extends never ? (HasDuplicateClassKeys<Targets> extends false ? Targets : never) : never) : never;
|
|
146
|
-
type ValidateSingleCompoundEntry<Entry, Variants extends VariantSchema> = true extends InvalidRecordShape<Entry> ? never : Entry extends RecordInput ? { readonly [Name in keyof Entry]: Name extends symbol ? Entry[Name] : Name extends "className" ? ValidateSingleCompoundOutput<Entry[Name]> : Name extends string | number ? (CanonicalKey<Name> extends keyof Variants ? ValidateCompoundCondition<Entry[Name]> : never) : never; } : never;
|
|
147
|
-
type ValidateMultiElementCompoundEntry<Entry, Slots extends string, Variants extends VariantSchema> = true extends InvalidRecordShape<Entry> ? never : Entry extends RecordInput ? "classKeys" extends OptionalSchemaKeys<Entry> ? never : { readonly [Name in keyof Entry]: Name extends symbol ? Entry[Name] : Name extends "className" ? "classKeys" extends keyof Entry ? ValidateSingleCompoundOutput<Entry[Name]> : ValidateMultiElementCompoundOutput<Entry[Name], Slots> : Name extends "classKeys" ? ValidateCompoundClassKeys<Entry[Name], Slots> : Name extends string | number ? CanonicalKey<Name> extends keyof Variants ? ValidateCompoundCondition<Entry[Name]> : never : never; } : never;
|
|
148
|
-
type ValidateSingleCompounds<Compounds, Variants extends VariantSchema> = Compounds extends readonly unknown[] ? { readonly [Index in keyof Compounds]: ValidateSingleCompoundEntry<Compounds[Index], Variants>; } : unknown;
|
|
149
|
-
type ValidateMultiElementCompounds<Compounds, Slots extends string, Variants extends VariantSchema> = Compounds extends readonly unknown[] ? { readonly [Index in keyof Compounds]: ValidateMultiElementCompoundEntry<Compounds[Index], Slots, Variants>; } : unknown;
|
|
150
|
-
type SingleRecipeDefinition<Style extends string, Parent extends SingleBrandedRecipe | undefined, Variants extends VariantsInput | undefined, Compounds extends readonly SingleCompoundDefinition<EffectiveVariants<Parent, Variants>>[] | undefined> = {
|
|
151
|
-
readonly defaults: Style;
|
|
152
|
-
readonly variants?: (Variants & ValidateStableSchema<Exclude<Variants, undefined>> & AllowedVariantNames<Variants> & ValidateSingleVariants<Variants>) | undefined;
|
|
153
|
-
readonly defaultVariants?: DefinitionVariantSelections<NoInfer<EffectiveVariants<Parent, Variants>>> | undefined;
|
|
154
|
-
readonly compoundVariants?: (Compounds & ValidateSingleCompounds<Compounds, EffectiveVariants<Parent, Variants>>) | undefined;
|
|
155
|
-
readonly extend?: (Parent & ValidateNonUnion<Parent>) | undefined;
|
|
156
|
-
};
|
|
157
|
-
type MultiElementRecipeDefinition<Styles extends StylesInput, Parent extends MultiElementBrandedRecipe | undefined, Variants extends VariantsInput | undefined, Compounds extends readonly MultiElementCompoundDefinition<EffectiveSlots<Parent, Styles>, EffectiveVariants<Parent, Variants>>[] | undefined> = {
|
|
158
|
-
readonly defaults: Styles & ValidateStyles<Styles> & ValidateStableSchema<Styles> & AllowedSlotNames<Styles>;
|
|
159
|
-
readonly variants?: (Variants & ValidateStableSchema<Exclude<Variants, undefined>> & AllowedVariantNames<Variants> & ValidateMultiElementVariants<Variants, EffectiveSlots<Parent, Styles>>) | undefined;
|
|
160
|
-
readonly defaultVariants?: DefinitionVariantSelections<NoInfer<EffectiveVariants<Parent, Variants>>> | undefined;
|
|
161
|
-
readonly compoundVariants?: (Compounds & ValidateMultiElementCompounds<Compounds, EffectiveSlots<Parent, Styles>, EffectiveVariants<Parent, Variants>>) | undefined;
|
|
162
|
-
readonly extend?: (Parent & ValidateNonUnion<Parent>) | undefined;
|
|
163
|
-
};
|
|
164
|
-
type RecipeInference<Styles, Parent, Variants, Compounds> = {
|
|
165
|
-
readonly defaults: Styles;
|
|
166
|
-
readonly variants?: Variants | undefined;
|
|
167
|
-
readonly compoundVariants?: Compounds | undefined;
|
|
168
|
-
readonly extend?: Parent;
|
|
169
|
-
};
|
|
170
|
-
type ExtendedRecipeInference<Styles, Parent, Variants, Compounds> = Omit<RecipeInference<Styles, Parent, Variants, Compounds>, "extend"> & {
|
|
171
|
-
readonly extend: Parent;
|
|
172
|
-
};
|
|
173
|
-
type InheritedRecipeInference<Parent, Variants, Compounds> = Omit<ExtendedRecipeInference<never, Parent, Variants, Compounds>, "defaults">;
|
|
174
|
-
type InheritedSingleRecipeDefinition<Parent extends SingleBrandedRecipe, Variants extends VariantsInput | undefined, Compounds extends readonly SingleCompoundDefinition<EffectiveVariants<Parent, Variants>>[] | undefined> = Omit<SingleRecipeDefinition<string, Parent, Variants, Compounds>, "defaults">;
|
|
175
|
-
type InheritedMultiElementRecipeDefinition<Parent extends MultiElementBrandedRecipe, Variants extends VariantsInput | undefined, Compounds extends readonly MultiElementCompoundDefinition<ParentClassKeys<Parent>, EffectiveVariants<Parent, Variants>>[] | undefined> = Omit<MultiElementRecipeDefinition<{}, Parent, Variants, Compounds>, "defaults">;
|
|
176
|
-
type RecipeDefinitionField = "defaults" | "compoundVariants" | "defaultVariants" | "extend" | "variants";
|
|
177
|
-
type ValidateDefinitionInput<Definition> = ValidateRecordShape<Definition> & ValidateKnownKeys<Definition, RecipeDefinitionField>;
|
|
178
|
-
type ValidateInheritedDefinitionInput<Definition> = ValidateRecordShape<Definition> & ValidateKnownKeys<Definition, Exclude<RecipeDefinitionField, "defaults">>;
|
|
179
|
-
type Reciper = {
|
|
180
|
-
<const Style extends string, const Variants extends VariantsInput | undefined = undefined, const Compounds extends readonly SingleCompoundDefinition<EffectiveVariants<undefined, Variants>>[] | undefined = undefined, const Definition = unknown>(definition: RecipeInference<Style, undefined, Variants, Compounds> & Definition & NoInfer<SingleRecipeDefinition<Style, undefined, Variants, Compounds>> & NoInfer<ValidateDefinitionInput<Definition>>): TeaSingleRecipe<EffectiveVariants<undefined, Variants>>;
|
|
181
|
-
<const Parent extends SingleBrandedRecipe, const Style extends string, const Variants extends VariantsInput | undefined = undefined, const Compounds extends readonly SingleCompoundDefinition<EffectiveVariants<Parent, Variants>>[] | undefined = undefined, const Definition = unknown>(definition: ExtendedRecipeInference<Style, Parent, Variants, Compounds> & Definition & NoInfer<SingleRecipeDefinition<Style, Parent, Variants, Compounds>> & NoInfer<ValidateDefinitionInput<Definition>>): TeaSingleRecipe<EffectiveVariants<Parent, Variants>>;
|
|
182
|
-
<const Parent extends SingleBrandedRecipe, const Variants extends VariantsInput | undefined = undefined, const Compounds extends readonly SingleCompoundDefinition<EffectiveVariants<Parent, Variants>>[] | undefined = undefined, const Definition = unknown>(definition: InheritedRecipeInference<Parent, Variants, Compounds> & Definition & NoInfer<InheritedSingleRecipeDefinition<Parent, Variants, Compounds>> & NoInfer<ValidateInheritedDefinitionInput<Definition>>): TeaSingleRecipe<EffectiveVariants<Parent, Variants>>;
|
|
183
|
-
<const Styles extends StylesInput, const Variants extends VariantsInput | undefined = undefined, const Compounds extends readonly MultiElementCompoundDefinition<EffectiveSlots<undefined, Styles>, EffectiveVariants<undefined, Variants>>[] | undefined = undefined, const Definition = unknown>(definition: RecipeInference<Styles, undefined, Variants, Compounds> & Definition & NoInfer<MultiElementRecipeDefinition<Styles, undefined, Variants, Compounds>> & NoInfer<ValidateDefinitionInput<Definition>>): TeaMultiElementRecipe<EffectiveSlots<undefined, Styles>, EffectiveVariants<undefined, Variants>>;
|
|
184
|
-
<const Parent extends MultiElementBrandedRecipe, const Variants extends VariantsInput | undefined = undefined, const Compounds extends readonly MultiElementCompoundDefinition<ParentClassKeys<Parent>, EffectiveVariants<Parent, Variants>>[] | undefined = undefined, const Definition = unknown>(definition: InheritedRecipeInference<Parent, Variants, Compounds> & Definition & NoInfer<InheritedMultiElementRecipeDefinition<Parent, Variants, Compounds>> & NoInfer<ValidateInheritedDefinitionInput<Definition>>): TeaMultiElementRecipe<ParentClassKeys<Parent>, EffectiveVariants<Parent, Variants>>;
|
|
185
|
-
<const Parent extends MultiElementBrandedRecipe, const Styles extends StylesInput, const Variants extends VariantsInput | undefined = undefined, const Compounds extends readonly MultiElementCompoundDefinition<EffectiveSlots<Parent, Styles>, EffectiveVariants<Parent, Variants>>[] | undefined = undefined, const Definition = unknown>(definition: ExtendedRecipeInference<Styles, Parent, Variants, Compounds> & Definition & NoInfer<MultiElementRecipeDefinition<Styles, Parent, Variants, Compounds>> & NoInfer<ValidateDefinitionInput<Definition>>): TeaMultiElementRecipe<EffectiveSlots<Parent, Styles>, EffectiveVariants<Parent, Variants>>;
|
|
186
|
-
};
|
|
187
|
-
type VariantProps<Recipe> = Recipe extends RecipeCarrier & ((props?: infer Props) => unknown) ? VariantSelections<SchemaFromSelections<Props>> : never;
|
|
188
|
-
export declare const recipe: Reciper;
|
|
189
|
-
//#endregion
|
|
190
|
-
export { type ClassDict, type ClassProp, type ClassValue, type Merger, type RecipeIntrospection, type Reciper, type VariantProps, cn };
|
|
1
|
+
export { omitAttributes } from "./attributes.js";
|
|
2
|
+
export type { ClassDict, ClassValue, Merger } from "./input.js";
|
|
3
|
+
export { cn } from "./merge.js";
|
|
4
|
+
export type { ClassProp, RecipeIntrospection, Reciper, VariantProps } from "./recipe.js";
|
|
5
|
+
export { recipe } from "./recipe.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
function e(e,t){let n={...e},r=new Set(t.map(e=>e.toLowerCase()));for(let e of Object.keys(n))r.has(e.toLowerCase())&&delete n[e];return n}function t(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function n(e,t){let n=e.length;n in e?Object.defineProperty(e,n,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[n]=t}function r(e){let t=[],r=[],i=new Map,a=!1,o,s;for(let c=0;c<e.length;c++){let l=e[c];if(r.length===0){l===`\\`?(/\s/.test(e[c+1]??``)&&(o=void 0),c++):/\s/.test(l)?o=void 0:l===`"`||l===`'`?o=o===l?void 0:o??l:!o&&l===`[`&&n(r,c);continue}if((s||a)&&l===`[`&&/[:@\s]/.test(e[c-1])){n(r,c),i.set(c,s??a),a=!1,s=void 0;continue}if(a){l===`*`&&e[c+1]===`/`&&(a=!1,c++);continue}if(s){l===`\\`?c++:l===s&&(s=void 0);continue}if(l===`/`&&e[c+1]===`*`)a=!0,c++;else if(l===`"`||l===`'`)s=l;else if(l===`\\`)c++;else if(l===`[`)n(r,c);else if(l===`]`){let o=r.pop(),l=i.get(o);(/[:@]/.test(e[o-1])||e[c+1]===`:`)&&n(t,{end:c+1,start:o}),l===!0?a=!0:l&&(s=l)}}let c=[];for(let e of t.sort((e,t)=>e.start-t.start||t.end-e.end))(!c.length||e.start>=c.at(-1).end)&&n(c,e);return c}function i(e){let t=``,r,i=-1,a=-1,o=-1,s=[];for(let c=0;c<e.length;c++){let l=e[c];if(r){l===`\\`?c++:l===r&&(r=void 0);continue}if((t.length>0||a!==-1)&&l===`\\`){c++;continue}if(t.length>0&&(l===`"`||l===`'`)){r=l;continue}if((t.length>0||a!==-1)&&l===`/`&&e[c+1]===`*`){let t=e.indexOf(`*/`,c+2);if(t<0)break;c=t+1;continue}l===`(`||l===`[`?t+=l===`(`?`)`:`]`:l===t.at(-1)?t=t.slice(0,-1):t.length===0&&(l===`@`?(a===-1&&(a=c),n(s,c)):a===-1&&(l===`:`&&i===-1?i=c:l===`!`&&(o=c)))}let c=a===-1?e.length:a,l=e.slice(0,c),u=!1;c>0&&o===c-1&&(u=!0,l=l.slice(0,-1));let d=[];for(let t=0;t<s.length;t++){let r=s[t]+1,i=t+1<s.length?s[t+1]:e.length;n(d,e.slice(r,i))}return i!==-1&&i<c?{raw:e,body:l,property:e.slice(0,i),value:l.slice(i+1),keyword:!1,important:u,conditions:d}:{raw:e,body:l,keyword:!0,important:u,conditions:d}}function a(e,n,r){let i=e[n];if(r.blockComment)return i===`*`&&e[n+1]===`/`?(r.blockComment=!1,n+1):n;if(r.quote)return i===`\\`?n+1:(i===r.quote&&(r.quote=void 0),n);if(r.closers.length>0&&i===`/`&&e[n+1]===`*`)return r.blockComment=!0,n+1;if(r.closers.length>0&&(i===`"`||i===`'`))return r.quote=i,n;if(i===`\\`)return n+1;if(i===`(`||i===`[`)return t(r.closers,i===`(`?`)`:`]`),n;if(i===r.closers.at(-1))return r.closers.pop(),n}function o(e,t,n=e.length){let r={closers:[]};for(let i=t+1;i<n;i++){let t=e[i],n=a(e,i,r);if(n!==void 0){i=n;continue}if(r.closers.length===0){if(t===`}`)return{index:i,kind:`close`};if(t===`{`)return{index:i,kind:`open`}}}return{index:n,kind:`limit`}}const s=/[\s'"`;{},\])]/;function c(e,t,n=e.length){if(e[t]!==`@`)return{conds:``,end:t};let r={closers:[]},i=t;for(;i<n;i++){let t=e[i],n=a(e,i,r);if(n!==void 0){i=n;continue}if(t===`/`&&(e[i+1]===`/`||e[i+1]===`*`)&&r.closers.length===0||s.test(t)&&r.closers.length===0)break}return{conds:e.slice(t,i),end:i}}function l(e,n=!1){let r=[],i={closers:[]},o=0;for(let s=0;s<e.length;s++){let c=e[s],l=a(e,s,i);if(l!==void 0){s=l;continue}(c===`;`||n&&/\s/.test(c))&&i.closers.length===0&&(t(r,e.slice(o,s)),o=s+1)}return t(r,e.slice(o)),r.map(e=>e.trim()).filter(Boolean)}const u=/^(?:--?[\w-]+|[A-Z_$][\w$-]*|@teacss-skip-bracket-[\da-z]{6})$/i;function d(e,t){let n=t;for(;n>0&&/[\w-]/.test(e[n-1]);)n--;if(n===t||e[n-1]!==`:`)return!1;let r=n-1,i=r;for(;i>0&&/[\w$@-]/.test(e[i-1]);)i--;if(!u.test(e.slice(i,r)))return!1;let a=i-1;for(;a>=0&&/\s/.test(e[a]);)a--;return a<0||!`{,?`.includes(e[a])}function f(e){let n=[],r=[],i=[],a=!1,o;for(let s=0;s<e.length;s++){let c=e[s],l=e[s+1];if(r.length===0){c===`(`&&d(e,s)&&t(r,{attached:!0,start:s});continue}if(a)c===`*`&&l===`/`&&(a=!1,s++);else if(o)c===`\\`?s++:c===o&&(o=void 0);else if(c===`\\`)s++;else if(c===`/`&&l===`*`)a=!0,s++;else if(c===`'`||c===`"`||c==="`")o=c;else if(i.length>0)c===`[`||c===`(`?t(i,c===`[`?`]`:`)`):c===i.at(-1)&&i.pop();else if(c===`[`)t(i,`]`);else if(c===`(`)t(r,{attached:d(e,s),start:s});else if(c===`)`){let e=r.pop();e.attached&&t(n,{end:s+1,start:e.start})}}let s=[];for(let e of n.sort((e,t)=>e.start-t.start||t.end-e.end))(s.length===0||e.start>=s.at(-1).end)&&t(s,e);return s}function p(e){let t={seen:!1},n=m(e,t);for(let e=1;e<5&&t.seen;e++){t.seen=!1;let e=m(n,t);if(e===n)break;n=e}return n}function m(e,t){if(!e.includes(`{`))return e;let n=``,i=0,s=-1,u=0,d=0,p=e.includes(`[`)?r(e):[],m=e.includes(`(`)?f(e):[],h={closers:[]};for(;i<e.length;){for(;u<p.length&&p[u].end<=i;)u++;for(;d<m.length&&m[d].end<=i;)d++;let r=u<p.length?p[u]:void 0,f=d<m.length?m[d]:void 0,g=r?.start===i?r:f?.start===i?f:void 0;if(g&&h.blockComment!==!0&&h.quote===void 0){n+=e.slice(i,g.end),i=g.end;continue}h.closers.length>0&&/\s/.test(e[i])&&(h.blockComment=!1,h.closers.length=0,h.quote=void 0);let _=a(e,i,h);if(_!==void 0){n+=e.slice(i,_+1),i=_+1;continue}let v=e[i];if(h.closers.length>0||v!==`{`){n+=v,i++;continue}let y=o(e,i);if(y.kind!==`close`){y.kind===`open`&&t&&(t.seen=!0),n+=e.slice(i,y.index),i=y.index;continue}let b=y.index,x=e.slice(i+1,b),{conds:S,end:C}=c(e,b+1),w=l(x,!0);if(w.length===0){n+=v,i++;continue}s===i&&n.length>0&&!/\s/.test(n.at(-1))&&(n+=` `),n+=w.map(e=>`${e}${S}`).join(` `),s=C,i=C}return n}function h(e){let t=e.split(/\s+/);return t[0]===``&&t.shift(),t.at(-1)===``&&t.pop(),t}function g(e){if(!e.includes(`[`))return h(e);let t=r(e);if(t.length===0)return h(e);let i=[],a=0,o=-1;for(let r=0;r<e.length;r++){let s=t[a];if(s&&r===s.start){o<0&&(o=r),r=s.end-1,a++;continue}/\s/.test(e[r])?(o>=0&&n(i,e.slice(o,r)),o=-1):o<0&&(o=r)}return o>=0&&n(i,e.slice(o)),i}const _=`must have an integer length from 0 through 4294967294`,v=Symbol(`missing-own-value`);function y(e,t){return`value`in t?t.value:t.get===void 0?void 0:Reflect.apply(t.get,e,[])}function b(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return n===void 0?v:y(e,n)}function x(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function S(e,t){let n=e.length;n in e?x(e,n,t):e[n]=t}function C(e){let t=b(e,`length`);return typeof t==`number`&&Number.isInteger(t)&&t>=0&&t<4294967295?t:null}function w(e){let t=``,n=C(e);if(n===null)throw TypeError(`[TeaCSS classes] class-value array ${_}`);for(let r=0;r<n;r++){let n=b(e,r);if(n===v)continue;let i=ee(n);i&&(t+=(t&&` `)+i)}return t}function ee(e){if(!e)return``;if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`bigint`)return String(e);if(Array.isArray(e))return w(e);if(typeof e==`object`){let t=e,n=``;for(let e of Reflect.ownKeys(t)){if(typeof e!=`string`)continue;let r=Reflect.getOwnPropertyDescriptor(t,e);r!==void 0&&r.enumerable&&y(t,r)&&(n+=(n&&` `)+e)}return n}return``}function te(e,t,n){let r=b(e,n);if(r===v)return``;if(typeof r==`string`)return r;if(Array.isArray(t)){let e=b(t,n);if(typeof e==`string`)return e}return``}function ne(e){return typeof e==`number`||typeof e==`bigint`?String(e):ee(e)}function re(e,t,n){let r=``,i=C(e);if(i===null)throw TypeError(`[TeaCSS classes] tagged-template strings ${_}`);for(let a=0;a<i;a++)if(r+=te(e,t,a),a+1<i&&a+1<n.length){let e=ne(n[a+1]);r+=e}return r}function ie(e){let t=e[0],n=Array.isArray(t)?b(t,`raw`):v;return Array.isArray(n)?re(t,n,e):w(e)}var ae=class{max;budget;weight;values=new Map;queue=[];head=0;tail=0;bytes=0;constructor(e,t,n){this.max=e,this.budget=t,this.weight=n}get(e){return this.values.get(e)}set(e,t){let n=this.weight(e,t);if(!(n>this.budget||this.max===0||this.values.has(e))){for(;this.values.size>=this.max||this.bytes+n>this.budget;){let e=this.queue[this.head];this.bytes-=this.weight(e,this.values.get(e)),this.values.delete(e),this.queue[this.head]=``,this.head=(this.head+1)%this.max}this.values.set(e,t),this.tail<this.queue.length?this.queue[this.tail]=e:x(this.queue,this.tail,e),this.tail=(this.tail+1)%this.max,this.bytes+=n}}},oe=class{root={children:new Map,result:void 0};entries=new Map;bytes=0;nodes=1;get size(){return this.entries.size}get(e){let t=this.root;for(let n=0;n<e.length;n++){let r=t.children.get(e[n]);if(!r)return;t=r}return t.result}set(e,t){let n=t.length*2;for(let t=0;t<e.length;t++)n+=e[t].length*2;if(n>65536||this.get(e)!==void 0)return;for(;this.entries.size>=64||this.bytes+n>65536;){let e=this.entries.keys().next().value,t=this.entries.get(e);e.result=void 0,this.prune(this.root,t.args,0),this.entries.delete(e),this.bytes-=t.bytes}let r=this.root;for(let t=0;t<e.length;t++){let n=r.children.get(e[t]);n||(n={children:new Map,result:void 0},r.children.set(e[t],n),this.nodes++),r=n}r.result=t,this.entries.set(r,{args:e,bytes:n}),this.bytes+=n}prune(e,t,n){if(n===t.length)return;let r=t[n],i=e.children.get(r);this.prune(i,t,n+1),i.children.size===0&&i.result===void 0&&(e.children.delete(r),this.nodes--)}};function T(e){return e?e.split(`,`).map(e=>Number.parseInt(e,36)):[]}function se(e){let t=``;return e.split(` `).map(e=>t=t.slice(0,Number.parseInt(e[0],36))+e.slice(1))}const E=se(`0alc 2i 3gnment-baseline 2s 1nimation 9-delay birection buration afill aiteration aname aplay arange-end gstart atimeline ding 0backdrop-blur arightness 9contrast 9filter 9grayscale 9hue-rotate 9invert 9opacity 9saturate aepia 2seline-shift aource 1g-g 4-1 6-angle 7color 7position 52 6-angle 7color 7position 53 6-angle 7color 7position 54 6-angle 7color 7position 55 6-angle 7color 7position 56 6-angle 7color 7position 57 6-angle 7color 7position 58 6-angle 7color 7position 59 6-angle 7color 7position 5angle 5to 3image 1lock-size 7tep a-align binsert bround bsize 2ur 1order 6-b 8-color 9style 9width 8lock c-color dstyle dwidth 7color 7e 8-color 9style 9width 7g 8-1 a-angle bcolor bposition 92 a-angle bcolor bposition 93 a-angle bcolor bposition 94 a-angle bcolor bposition 95 a-angle bcolor bposition 96 a-angle bcolor bposition 97 a-angle bcolor bposition 98 a-angle bcolor bposition 99 a-angle bcolor bposition 9angle 9to 7image c-outset drepeat dslice eource dwidth 8nline d-color estyle ewidth 7l 8-color 9style 9width 7n 8-color 9style 9width 7r 8-color 9style 9width 7s 8-color 9style 9width 8pacing e-x fy 8tyle 7t 8-color 9style 9width 7u 8-color 9style 9width 7width 7x 8-color 9style 9width 7y 8-color 9style 9width 2x-shadow 1rightness 0column-count 7height 7width 8rap 6s 2ntrast 2rner 6-b 8-shape 8l 9-shape 8r 9-shape 7e 8-shape 8e 9-shape 8s 9-shape 7l 8-shape 7n 8-shape 7r 8-shape 7s 8-shape 8e 9-shape 8hape 8s 9-shape 7t 8-shape 8l 9-shape 8r 9-shape 7u 8-shape 0d 1imensions 1rop-shadow 0filter 6-opacity 1lex 4-basis 5grow 5shrink 0g-1 3-angle 4color 4position 22 3-angle 4color 4position 23 3-angle 4color 4position 24 3-angle 4color 4position 25 3-angle 4color 4position 26 3-angle 4color 4position 27 3-angle 4color 4position 28 3-angle 4color 4position 29 3-angle 4color 4position 2angle 2to 1ap 3-column 4row 1rayscale 2id-area 5column b-end cspan dtart 5row 8-end 9span atart 0h 1ue-rotate 0i 1-b 3lock 2e 2inline 2l 2n 2r 2s 2t 2u 2x 2y 1nline-size 2set-shadow c-outline-width 2vert 0juc 2i 2s 0line-clamp 0m 1-b 3lock 2e 2inline 2l 2n 2r 2s 2t 2u 2x 2y 1ask-b-1-color 9position 79-color 9position 5composite 5g 6-1 8-angle 9color 9position 72 8-angle 9color 9position 73 8-angle 9color 9position 74 8-angle 9color 9position 75 8-angle 9color 9position 76 8-angle 9color 9position 77 8-angle 9color 9position 78 8-angle 9color 9position 79 8-angle 9color 9position 7angle 7conic c-1 e-angle fcolor d2 e-angle fcolor d3 e-angle fcolor d4 e-angle fcolor d5 e-angle fcolor d6 e-angle fcolor d7 e-angle fcolor d8 e-angle fcolor d9 e-angle fcolor 7linear d-1 f-color gposition e2 f-color gposition e3 f-color gposition e4 f-color gposition e5 f-color gposition e6 f-color gposition e7 f-color gposition e8 f-color gposition e9 f-color gposition eangle eto 7radial d-1 f-color gposition e2 f-color gposition e3 f-color gposition e4 f-color gposition e5 f-color gposition e6 f-color gposition e7 f-color gposition e8 f-color gposition e9 f-color gposition 7to 5image 5l-1-color 9position 79-color 9position 5r-1-color 9position 79-color 9position 5t-1-color 9position 79-color 9position 5x-1-color 9position 79-color 9position 5y-1-color 9position 79-color 9position 2x-block-size 4dimensions 4h 4inline-size 4size 4w 1in-block-size 4dimensions 4h 4inline-size 4size 4w 0outline 7-color 8style 8width 1verflow 8-block 9clip-m f-b hlock ge ginline gl gn gr gs gt gu gx gy 9inline 9x 9y 4scroll-behavior j-block kinline kx ky 0p 1-b 3lock 2e 2inline 2l 2n 2r 2s 2t 2u 2x 2y 1lc 2i 2s 1os 3ition-anchor 0rd 2-b 4l 4r 3e 4e 4s 3l 3n 3r 3s 4e 4s 3t 4l 4r 3u 1otate-x 7y 7z 1ule 4-break 5color 8umn b-break ccolor cinset h-cap iend ijunction istart cstyle cvis cwidth 5inset a-cap bend bjunction bstart 5row 8-break 9color 9inset e-cap fend fjunction fstart 9style 9vis 9width 5style 5vis 5width 0saturate 1cale 5-x 6y 6z 2roll-m 8-b alock 9e 9inline 9l 9n 9r 9s 9t 9u 9x 9y 7p 8-b alock 9e 9inline 9l 9n 9r 9s 9t 9u 9x 9y 6bar-color athumb brack 1epia 1hadow 6-outline-width 1ize 1kew 4-x 5y 0text-align a-all blast 6utospace 5emphasis d-color estyle 5spacing c-trim 6troke b-color cwidth 5wrap 9-mode astyle 1ransform 5ition a-behavior bdelay curation bproperty btiming 5late 9-x ay az 0vertical-align 0w 1hite-space b-collapse ctrim`);function ce(e,t,n){let r=e.split(`|`).map(e=>{let t=0;return T(e).map(e=>t+=e)}),i=[[]],a=new Map([[``,0]]),o=e=>T(e).map((e,t)=>{let n=r[e].map(e=>t+e),o=n.join(`,`),s=a.get(o);return s===void 0&&(s=i.length,Object.defineProperty(i,s,{value:n,configurable:!0,enumerable:!0,writable:!0}),a.set(o,s)),s});return{rows:i,equalRows:o(t),importantRows:o(n)}}const{rows:D,equalRows:le,importantRows:O}=ce(`|1,1,1,1,1,1,1,1,1,1,1|3|2|1|-3,1,1,2,1,1,1,1,1|-1|-2|-3|-4|-5|-6|13|1,1,1|-13|1,1,1,1|42|1,1,1,1,1,1,1,1,1,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,0,0,0,0,0,0,0,0,0,0,0,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,6,45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2d,0,46,47,48,49,4a,4b,4c,4d,4e,4f,4g,4h,4i,4j,4k,4l,4m,4n,4o,4p,0,2z,0,0,30,0,0,2z,0,0,30,0,d,0,0,0,31,0,1w,0,1x,0,1y,0,0,0,0,0,0,1d,1z,0,0,0,f,0,0,0,0,1w,0,1x,0,1y,0,0,0,0,0,0,1d,1z,32,32,33,4,0,34,q,0,0,35,0,0,36,37,38,39,0,0,q,0,0,3a,0,0,0,3e,3f,3f,3g,0,0,f,0,0,0,0,0,0,0,3h,3i,3i,3i,3i,3g,0,0,f,0,0,0,0,0,0,0,3j,3j,3j,0,d,6,7,8,1w,0,1x,0,1y,0,0,0,0,0,0,1d,1z,1w,0,1x,0,1y,0,0,0,0,0,0,1d,1z,q,0,0,0,0,0,3o,0,0,0,q,0,0,0,q,0,0,3s,0,q,0,0,q,0,0,3t,3u,0,0,0,0,0,d,6,7,8,3v,0,3w,0,0`),ue=new Uint8Array(E.length),de=T(`g,4,h,4,i,4,j,5,k,4,l,4,m,4,n,4,o,4,p,4,22,2,4v,9,4w,2,52,2,63,2,64,3,65,2,7f,2,7q,2,85,8,86,8,87,2,fy,2,gt,7,gu,6,gv,6,gw,2,gx,8,gy,8`);for(let e=0;e<de.length;e+=2)ue[de[e]]=de[e+1];const k=new Map(E.map((e,t)=>[e,t])),A=[[`dimensions`,`w`,`h`],[`min-dimensions`,`min-w`,`min-h`],[`max-dimensions`,`max-w`,`max-h`],[`size`,`inline-size`,`block-size`],[`min-size`,`min-inline-size`,`min-block-size`],[`max-size`,`max-inline-size`,`max-block-size`]],j=new Map,M=new Map;for(let e=0;e<A.length;e++){let[t,n,r]=A[e],i=k.get(t),a=k.get(n),o=k.get(r);i!==void 0&&a!==void 0&&o!==void 0&&(j.set(i,[e*2,e*2+1]),j.set(a,[e*2]),j.set(o,[e*2+1]),M.set(i,e))}const fe=/[{}[\]()\\'"\x60]|\/\*/,pe=/^!?lang-[a-zA-Z]+(?:-[a-zA-Z0-9]+)*$/,me=/^(?:label|prose|heading)-[1-9]x(?:-mono)?$/,he=E.length*2;function ge(e,t){return 2*(e.length+t.raw.length+t.condition.length+t.identity.length)}function _e(e){if(!e.length)return``;if(e.length===1)return`\0`+ve(e[0]);let t=``;for(let n=0;n<e.length;n++){let r=ve(e[n]);t+=r.length+`:`+r}return t}function ve(e){return pe.test(e)?e.toLowerCase():e}function ye(e){let{keyword:t,property:n,body:r,important:a,conditions:o}=i(e),s=n??r,c=t?-1:k.get(s)??-1;return{raw:e,id:c,important:+a,condition:_e(o),identity:t?me.test(s)?`t`:`k`+s:c<0?`d`+s:``,family:c>=0?ue[c]:0}}function be(e=0){return{dropped:new Uint8Array(e),blocked:new Uint32Array(he),expanded:new Uint32Array(he),epoch:0}}function xe(e={}){let t=e.tupleCache===!1?void 0:new oe,n=e.resultCache===!1?void 0:new ae(1500,1048576,(e,t)=>2*(e.length+t.length)),r=e.descriptorCache===!1?void 0:new ae(4096,524288,ge),i=be(),a=e.epochLimit??4294967295,o=!1;function s(e,t){let n=t?r?.get(e):void 0;if(n!==void 0)return n;let i=t&&r?e.split(``).join(``):e,a=ye(i);return t&&r?.set(i,a),a}function c(e){return e.epoch>=a&&(e.blocked.fill(0),e.expanded.fill(0),e.epoch=0),++e.epoch}function l(e){let t=e.length;if(t===0)return``;if(t===1)return e[0].raw;let n=o||t>4096?be(t):i,r=o;o=!0,n.dropped.length<t&&(n.dropped=new Uint8Array(2**Math.ceil(Math.log2(t))));let a=n.dropped;a.fill(0,0,t);try{let r=!0;for(let n=1;n<t;n++)if(e[n].condition!==e[0].condition){r=!1;break}function i(r){let i=r?.length??t;if(i===2){let t=r?r[0]:0,n=r?r[1]:1,i=e[t],o=e[n];if(i.id>=0&&o.id>=0&&!(i.family||o.family)){if(i.important===o.important)(i.id===o.id||D[le[o.id]].includes(i.id))&&(a[t]=1);else{let e=i.important?i:o,r=i.important?o:i;(e.id===r.id||D[O[e.id]].includes(r.id))&&(a[i.important?n:t]=1)}return}}let o=new Uint8Array(5),s=new Int32Array(5).fill(-1);for(let t=i-1;t>=0;t--){let n=r?r[t]:t,i=e[n];if(!i.family||!i.important)continue;let a=i.family>>1;i.family&1?o[a]&&s[a]<0&&(s[a]=n):o[a]=1}let l;for(let t=0;t<i;t++){let n=r?r[t]:t,i=e[n],c=i.family>>1;if(c&&(n<=s[c]||i.family&1&&!i.important&&o[c]))a[n]=2;else if(i.id<0){let t=l??=new Map,r=t.get(i.identity);if(r!==void 0){if(e[r].important&&!i.important){a[n]=1;continue}a[r]=1}t.set(i.identity,n)}}let{blocked:u,expanded:d}=n,f=c(n);for(let t=0;t<i;t++){let n=r?r[t]:t,i=e[n];if(!(i.id<0||a[n]===2)){if(!i.important)u[i.id]===f&&(a[n]=1);else if(d[i.id]!==f){u[i.id]=f;let e=D[O[i.id]];for(let t=0;t<e.length;t++)u[e[t]]=f;d[i.id]=f}}}f=c(n);for(let t=i-1;t>=0;t--){let n=r?r[t]:t,i=e[n];if(i.id<0||a[n]===2)continue;let o=i.id*2+i.important;if(u[o]===f&&(a[n]=1),d[o]===f)continue;u[o]=f;let s=D[le[i.id]];for(let e=0;e<s.length;e++)u[s[e]*2+i.important]=f;if(i.important){u[o-1]=f;let e=D[O[i.id]];for(let t=0;t<e.length;t++)u[e[t]*2]=f}d[o]=f}let p=!1;for(let t=0;t<i;t++){let n=r?r[t]:t;if(M.has(e[n].id)){p=!0;break}}if(p){let t=new Int32Array(A.length*2).fill(-1);for(let n=0;n<i;n++){let i=r?r[n]:n,a=e[i],o=j.get(a.id);if(o!==void 0)for(let n of o){let r=t[n];(r<0||a.important>=e[r].important)&&(t[n]=i)}}for(let n=0;n<i;n++){let i=r?r[n]:n,o=M.get(e[i].id);o!==void 0&&t[o*2]!==i&&t[o*2+1]!==i&&(a[i]=1)}}}if(r)i();else{let n=new Map;for(let r=0;r<t;r++){let t=e[r].condition,i=n.get(t);i===void 0?n.set(t,r):typeof i==`number`?n.set(t,[i,r]):S(i,r)}for(let e of n.values())typeof e!=`number`&&i(e)}let o=``;for(let n=0;n<t;n++)a[n]===0&&(o+=(o?` `:``)+e[n].raw);return o}finally{o=r}}function u(e){let t=g(p(e).trim()),n=[],r=e.length*2<=524288;for(let e=0;e<t.length;e++)S(n,s(t[e],r));return n}function d(e){let t=n?.get(e);if(t!==void 0)return t;let r=l(u(e));return n?.set(e,r),r}let f=(...e)=>{if(!e.length)return``;let n=e.length<=4;if(n){for(let t=0;t<e.length;t++)if(typeof e[t]!=`string`){n=!1;break}}if(!n)return d(ie(e));let r=e,i=t?.get(r);if(i!==void 0)return i;let a=``;for(let e=0;e<r.length;e++)r[e]&&(a+=(a?` `:``)+r[e]);let o=d(a);return t?.set(r,o),o};function m(e){return{raw:e,tokens:fe.test(e)?void 0:u(e)}}function h(e,t){if(e.length===0&&Array.isArray(t))return f(t);let r=t===void 0?``:w([t]),i=``,a=!fe.test(r);for(let t=0;t<e.length;t++){let n=e[t];n.raw&&(i+=(i?` `:``)+n.raw),a&&=n.tokens!==void 0}if(r&&(i+=(i?` `:``)+r),!a)return d(i);let o=n?.get(i);if(o!==void 0)return o;let s=[];for(let t=0;t<e.length;t++){let n=e[t].tokens;for(let e=0;e<n.length;e++)S(s,n[e])}if(r){let e=u(r);for(let t=0;t<e.length;t++)S(s,e[t])}let c=l(s);return n?.set(i,c),c}return{cn:f,prepareFragment:m,mergePrepared:h,inspect:()=>({tuples:{size:t?.size??0,bytes:t?.bytes??0,nodes:t?.nodes??0},results:{size:n?.values.size??0,bytes:n?.bytes??0},descriptors:{size:r?.values.size??0,bytes:r?.bytes??0},scratch:{bytes:i.dropped.byteLength+i.blocked.byteLength+i.expanded.byteLength}})}}const{cn:Se,prepareFragment:Ce,mergePrepared:we}=xe(),N=Object.prototype.propertyIsEnumerable,P=`definition.defaults`,F=`definition.variants`,I=`definition.defaultVariants`,L=`definition.compoundVariants`,R=`recipe props`,z=`className`,Te=`defaults`,B=`classKeys`,V=`null is not allowed`,Ee=new Set([`defaults`,`variants`,`defaultVariants`,`compoundVariants`,`extend`]),De=new Set([`class`,`className`,`then`,`toJSON`,`toString`,`valueOf`]),Oe=new Set([`class`,`className`,`classKeys`]);function H(e){return e.length>16?new Set(e):void 0}function U(e,t,n){return t?.has(n)??e.includes(n)}function W(e,t){return TypeError(`[TeaCSS recipe] ${e}: ${t}`)}function G(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw W(t,`expected a plain record`);let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)throw W(t,`expected Object.prototype or null prototype`);return Object.keys(e)}function ke(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw W(t,`expected a non-null, non-array object`);return Object.keys(e)}function K(e,t,n){let r=Reflect.getOwnPropertyDescriptor(e,t);if(r===void 0||!r.enumerable)throw W(n,`expected an own enumerable field`);return`value`in r?r.value:r.get===void 0?void 0:Reflect.apply(r.get,e,[])}function Ae(e,t){let n=Reflect.getOwnPropertyDescriptor(e,`length`),r=n!==void 0&&`value`in n?n.value:void 0;if(typeof r!=`number`||!Number.isInteger(r)||r<0||r>=4294967295)throw W(t,`expected an array with a valid own length`);return r}function q(e,t,n){if(!Array.isArray(e))throw W(t,`expected an array`);let r=Object.keys(e),i=Ae(e,t);if(!n&&i===0)throw W(t,`expected a non-empty array`);if(r.length!==i)throw W(t,`expected a dense own-indexed array`);for(let e of r){let n=Number(e);if(!Number.isInteger(n)||n<0||n>=i||String(n)!==e)throw W(t,`expected a dense own-indexed array`)}let a=X(i);for(let n=0;n<i;n++)a[n]=K(e,n,`${t}[${n}]`);return a}function je(e,t){if(e.trim().length===0)throw W(t,`name must contain a non-whitespace character`)}function J(e,t){let n=w([e]);return n.length===0?void 0:t(n)}function Y(e,t,n){if(n===void 0)return;let r=N.call(e,t)?e[t]:void 0;e[t]=r===void 0?[n]:[...r,n]}function X(e){let t=Array(e);for(let n=0;n<e;n++)n in t?x(t,n,void 0):t[n]=void 0;return t}function Z(){return[void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0]}const Me=Z().length;function Ne(e,t,n){t<Me||!(t in e)?e[t]=n:x(e,t,n)}function Q(e,t=e.length){let n=X(t),r=Math.min(e.length,t);for(let t=0;t<r;t++){if(!N.call(e,t))continue;let r=e[t];r!==void 0&&(n[t]=[...r])}return n}function Pe(e,t){return e.map(e=>{let n=Object.create(null);for(let r of Object.keys(e.choices))n[r]={fragmentsBySlot:Q(e.choices[r].fragmentsBySlot,t)};return{...e,choices:n}})}function $(e,t,n){if(e===null)return null;if(typeof e==`number`){if(!Number.isFinite(e))throw W(n,`expected a finite numeric choice`);e=String(e)}if(typeof e==`string`){if(!N.call(t.choices,e))throw W(n,`unknown choice ${JSON.stringify(e)}`);return e}if(typeof e==`boolean`){if(!t.booleanCapable)throw W(n,`boolean selection requires a true or false choice`);return String(e)}throw W(n,`expected null, a declared string or finite numeric choice, or a supported boolean state`)}function Fe(e,t,n,r){if(n&&(e=t.slotNames.length===0?``:{}),typeof e==`string`){if(t!==void 0&&t.slotNames.length>0)throw W(P,`must be a record when extending a multi-element recipe`);let n=t===void 0?X(1):Q(t.baseFragmentsBySlot,1);return Y(n,0,J(e,r)),{names:[],indexes:Object.create(null),baseFragments:n}}let i=G(e,P);if(t!==void 0&&t.slotNames.length===0)throw W(P,`must be a string when extending a single-element recipe`);if(!n&&i.length===0)throw W(P,`expected at least one named class`);for(let e of i){let t=`${P}.${e}`;if(je(e,t),De.has(e))throw W(t,`reserved class name`)}let a=t===void 0?[]:[...t.slotNames],o=Object.create(null);for(let e=0;e<a.length;e++)o[a[e]]=e;let s=t===void 0?[]:Q(t.baseFragmentsBySlot),c=e;for(let e of i){let t=o[e];t===void 0&&(t=a.length,S(a,e),o[e]=t,S(s,void 0)),Y(s,t,J(K(c,e,`${P}.${e}`),r))}return{names:a,indexes:o,baseFragments:s}}function Ie(e,t,n,r,i,a,o){if(n){if(typeof t!=`string`)throw W(i,`expected a primitive string`);Y(e,0,J(t,o));return}let s=G(t,i);if(a&&s.length===0)throw W(i,`expected at least one class target`);let c=t;for(let t of s){let n=r[t];if(n===void 0)throw W(`${i}.${t}`,`unknown class target`);Y(e,n,J(K(c,t,`${i}.${t}`),o))}}function Le(e,t,n,r,i,a){let o=t===void 0?[]:Pe(t.variants,i),s=Object.create(null);for(let e=0;e<o.length;e++)s[o[e].name]=e;if(e===void 0)return{variants:o,indexes:s};if(e===null)throw W(F,V);let c=G(e,F),l=e;for(let e of c){let t=`${F}.${e}`;if(je(e,t),Oe.has(e))throw W(t,`reserved variant name`);let c=K(l,e,t),u=G(c,t);if(u.length===0)throw W(t,`expected at least one choice`);let d=c,f=s[e],p;f===void 0?(f=o.length,s[e]=f,p=Object.create(null),S(o,{name:e,choices:p,booleanCapable:!1})):p=o[f].choices;for(let e of u){let o=`${t}.${e}`,s=K(d,e,o),c=p[e],l=c===void 0?X(i):Q(c.fragmentsBySlot,i);Ie(l,s,n,r,o,!1,a),p[e]={fragmentsBySlot:l}}o[f]={name:e,choices:p,booleanCapable:N.call(p,`true`)||N.call(p,`false`)}}return{variants:o,indexes:s}}function Re(e,t,n,r){let i=X(n.length);if(t!==void 0){let e=Math.min(t.defaultStates.length,n.length);for(let n=0;n<e;n++)N.call(t.defaultStates,n)&&(i[n]=t.defaultStates[n])}if(e===void 0)return i;if(e===null)throw W(I,V);let a=G(e,I),o=H(a);for(let e of a)if(r[e]===void 0)throw W(`${I}.${e}`,`unknown variant`);let s=e;for(let e=0;e<n.length;e++){let t=n[e];if(!U(a,o,t.name))continue;let r=`${I}.${t.name}`,c=K(s,t.name,r);c!==void 0&&(i[e]=$(c,t,r))}return i}function ze(e,t,n){if(!Array.isArray(e)){if(e===void 0)throw W(n,`undefined is not a condition`);return[$(e,t,n)]}let r=q(e,n,!1),i=[];for(let e=0;e<r.length;e++){let a=r[e];if(a===void 0)throw W(`${n}[${e}]`,`undefined is not a condition`);S(i,$(a,t,`${n}[${e}]`))}return i}function Be(e,t,n,r,i,a,o,s){let c=t===void 0?[]:t.compounds.map(e=>({conditions:e.conditions,fragmentsBySlot:Q(e.fragmentsBySlot,i)}));if(e===void 0)return c;if(e===null)throw W(L,V);let l=q(e,L,!0);for(let e=0;e<l.length;e++){let t=l[e],u=`${L}[${e}]`,d=G(t,u),f=H(d),p=U(d,f,B);if(!U(d,f,z))throw W(`${u}.className`,n||p?`required own enumerable string`:`required own enumerable class map`);for(let e of d)if(e!==z&&e!==B&&o[e]===void 0)throw W(`${u}.${e}`,`unknown variant condition`);let m=t,h=[];for(let e=0;e<a.length;e++){let t=a[e];if(!U(d,f,t.name))continue;let n=`${u}.${t.name}`;S(h,{variantIndex:e,states:ze(K(m,t.name,n),t,n)})}let g=`${u}.className`,_=K(m,z,g),v=X(i);if(p){let e=`${u}.classKeys`;if(n)throw W(e,`only valid for multi-element recipes`);if(typeof _!=`string`)throw W(g,`expected a primitive string when classKeys is present`);let t=q(K(m,B,e),e,!1),i=J(_,s);for(let n=0;n<t.length;n++){let a=t[n],o=`${e}[${n}]`;if(typeof a!=`string`)throw W(o,`expected a declared class name`);let s=r[a];if(s===void 0)throw W(o,`unknown class target`);if(t.indexOf(a)!==n)throw W(o,`duplicate class target ${JSON.stringify(a)}`);Y(v,s,i)}}else Ie(v,_,n,r,g,!0,s);S(c,{conditions:h,fragmentsBySlot:v})}return c}function Ve(e,t,n){let r=G(e,`definition`);for(let e of r)if(!Ee.has(e))throw W(`definition.${e}`,`unknown field`);let i=e,a;if(r.includes(`extend`)){let e=K(i,`extend`,`definition.extend`);if(e!==void 0&&(typeof e!=`function`||(a=t.get(e))===void 0))throw W(`definition.extend`,`expected a recipe from this exact reciper`)}let o=r.includes(Te);if(!o&&a===void 0)throw W(P,`required own enumerable field`);let s=Fe(o?K(i,Te,P):void 0,a,!o,n),c=s.baseFragments.length,l=s.names.length===0,u=Le(r.includes(`variants`)?K(i,`variants`,F):void 0,a,l,s.indexes,c,n),d=Re(r.includes(`defaultVariants`)?K(i,`defaultVariants`,I):void 0,a,u.variants,u.indexes),f=Be(r.includes(`compoundVariants`)?K(i,`compoundVariants`,L):void 0,a,l,s.indexes,c,u.variants,u.indexes,n),p=X(c);for(let e of f)for(let t=0;t<c;t++)e.fragmentsBySlot[t]!==void 0&&S(p[t]??=[],e);return{slotNames:s.names,baseFragmentsBySlot:s.baseFragments,variants:u.variants,defaultStates:d,compounds:f,compoundsBySlot:p}}function He(e,t){if(e===void 0)return t.defaultStates;let n=ke(e,R),r=H(n);if(U(n,r,`class`))throw W(`${R}.class`,`reserved field`);if(U(n,r,z))throw W(`${R}.className`,`caller classes belong to a style resolver`);let i=e,a;for(let e=0;e<t.variants.length;e++){let o=t.variants[e];if(!U(n,r,o.name))continue;let s=`${R}.${o.name}`,c=K(i,o.name,s);c!==void 0&&(a??=[...t.defaultStates],a[e]=$(c,o,s))}return a??t.defaultStates}function Ue(e,t,n){if(t!==void 0){let e=n<Me||N.call(t,n)?t[n]:void 0;if(e!==void 0)return e}return e[n]}function We(e,t,n){for(let r of e.conditions)if(!r.states.includes(Ue(t,n,r.variantIndex)))return!1;return!0}function Ge(e,t,n){if(n===void 0)return t;for(let r of n)Ne(e,t,r),t++;return t}function Ke(e,t,n,r,i,a){let o,s;if(r!==void 0){let t=ke(r,i),n=H(t);if(U(t,n,`class`))throw W(`${i}.class`,`reserved field`);let a=r;for(let r=0;r<e.variants.length;r++){let s=e.variants[r];if(!U(t,n,s.name))continue;let c=`${i}.${s.name}`,l=K(a,s.name,c);l!==void 0&&(o??=Z(),Ne(o,r,$(l,s,c)))}U(t,n,`className`)&&(s=K(a,`className`,`${i}.className`))}let c=Z(),l=Ge(c,0,e.baseFragmentsBySlot[t]);for(let r=0;r<e.variants.length;r++){let i=Ue(n,o,r);if(i==null)continue;let a=e.variants[r].choices[i];a!==void 0&&(l=Ge(c,l,a.fragmentsBySlot[t]))}let u=e.compoundsBySlot[t];if(u!==void 0)for(let e of u)We(e,n,o)&&(l=Ge(c,l,e.fragmentsBySlot[t]));return c.length=l,a(c,s)}function qe(e,t,n){Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!0,writable:!0})}function Je(e){let t={};for(let n of e.variants)qe(t,n.name,Object.freeze(Object.keys(n.choices)));let n={};for(let t=0;t<e.variants.length;t++){let r=e.defaultStates[t];typeof r==`string`&&qe(n,e.variants[t].name,r)}return Object.freeze({anatomy:Object.freeze([...e.slotNames]),variants:Object.freeze(t),defaultVariants:Object.freeze(n),compoundVariantCount:e.compounds.length})}function Ye(e,t){let n=e.slotNames.length===0?n=>Ke(e,0,e.defaultStates,n,R,t):n=>{let r=He(n,e),i=Object.create(null);for(let n=0;n<e.slotNames.length;n++){let a=e.slotNames[n];i[a]=i=>Ke(e,n,r,i,`style props.${a}`,t)}return i};return Object.defineProperty(n,"config",{value:Je(e),configurable:!1,enumerable:!1,writable:!1})}const Xe=new WeakMap,Ze=(e=>{let t=Ve(e,Xe,Ce),n=Ye(t,we);return Xe.set(n,t),n});export{Se as cn,e as omitAttributes,Ze as recipe};
|
|
1
|
+
export { omitAttributes } from "./attributes.js";
|
|
2
|
+
export { cn } from "./merge.js";
|
|
3
|
+
export { recipe } from "./recipe.js";
|