stillwind 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/README.md +1 -1
- package/css/builtin-utilities/tw-borders.css +59 -59
- package/css/builtin-utilities/tw-effects.css +53 -53
- package/css/builtin-utilities/tw-typography.css +13 -13
- package/dist/class-object-C87DR3v2.js +6 -0
- package/dist/class-object-C87DR3v2.js.map +1 -0
- package/dist/class-object-CR0QHoF9.d.ts +10 -0
- package/dist/{class-string-DQmH4PZX.d.ts → class-string-BlClX8JK.d.ts} +2 -2
- package/dist/class-string-CiNTVHYm.js +6 -0
- package/dist/{class-string-CrQnTRvI.js.map → class-string-CiNTVHYm.js.map} +1 -1
- package/dist/{formats-Ctf2WFc-.js → formats-DP9B9SG6.js} +228 -113
- package/dist/formats-DP9B9SG6.js.map +1 -0
- package/dist/{formats-aeLCNAXl.d.ts → formats-NBNjMP5R.d.ts} +34 -12
- package/dist/frameworks/alpine.d.ts +5 -3
- package/dist/frameworks/alpine.js +3 -1
- package/dist/frameworks/alpine.js.map +1 -1
- package/dist/frameworks/astro.d.ts +3 -3
- package/dist/frameworks/astro.js +1 -1
- package/dist/frameworks/lit.d.ts +5 -3
- package/dist/frameworks/lit.js +3 -1
- package/dist/frameworks/lit.js.map +1 -1
- package/dist/frameworks/preact.d.ts +3 -3
- package/dist/frameworks/preact.js +1 -1
- package/dist/frameworks/qwik.d.ts +3 -3
- package/dist/frameworks/qwik.js +1 -1
- package/dist/frameworks/react.d.ts +2 -2
- package/dist/frameworks/react.js +1 -1
- package/dist/frameworks/solid.d.ts +3 -3
- package/dist/frameworks/solid.js +1 -1
- package/dist/frameworks/svelte.d.ts +3 -3
- package/dist/frameworks/svelte.js +1 -1
- package/dist/frameworks/vanilla.d.ts +5 -3
- package/dist/frameworks/vanilla.js +6 -1
- package/dist/frameworks/vanilla.js.map +1 -0
- package/dist/frameworks/vue.d.ts +3 -3
- package/dist/frameworks/vue.js +1 -1
- package/dist/{index-uw1R9t_P.d.ts → index-DpaDcczW.d.ts} +150 -50
- package/dist/macro/index.d.ts +2 -2
- package/dist/macro/index.js +1 -1
- package/dist/runtime/development.d.ts +16 -8
- package/dist/runtime/development.js +57 -21
- package/dist/runtime/development.js.map +1 -1
- package/dist/runtime/index.d.ts +2 -2
- package/dist/runtime/index.js +1 -1
- package/dist/{style-Bzuux32Y.js → style-dMBm8aX_.js} +6 -3
- package/dist/style-dMBm8aX_.js.map +1 -0
- package/docs/at-rules/apply.md +1 -1
- package/docs/at-rules/custom-variant.md +1 -1
- package/docs/at-rules/slot.md +1 -1
- package/docs/at-rules/stillwind-property.md +1 -1
- package/docs/at-rules/stillwind-registry.md +7 -7
- package/docs/at-rules/stillwind-require-properties.md +1 -1
- package/docs/at-rules/stillwind-undef-arbitrary-property.md +1 -1
- package/docs/at-rules/stillwind-undef-utility.md +1 -1
- package/docs/at-rules/stillwind-undef-variant.md +1 -1
- package/docs/at-rules/theme.md +5 -5
- package/docs/at-rules/utility.md +43 -4
- package/docs/at-rules/variant.md +1 -1
- package/docs/concepts/css-ordering.md +46 -7
- package/docs/concepts/how-styles-compile.md +8 -8
- package/docs/errors/SW10006.md +34 -0
- package/docs/errors/index.md +1 -0
- package/docs/guides/migrating-from-tailwind.md +52 -9
- package/docs/guides/reusable-styles.md +2 -2
- package/docs/integrations.md +20 -1
- package/docs/lints/conflicting-utilities.md +9 -0
- package/docs/lints/cyclic-style-order.md +61 -0
- package/docs/lints/index.md +14 -10
- package/docs/lints/{invalid-cva-config.md → invalid-recipe-config.md} +8 -8
- package/docs/lints/{invalid-cva-input.md → invalid-recipe-input.md} +9 -9
- package/docs/lints/multiple-style-forwards.md +59 -0
- package/docs/lints/partial-utility-override.md +77 -0
- package/docs/lints/utility-class-selector.md +72 -0
- package/docs/llms.txt +8 -3
- package/docs/macros/index.md +1 -1
- package/docs/macros/recipe.md +246 -0
- package/docs/macros/style.md +62 -0
- package/docs/macros/when.md +1 -1
- package/package.json +6 -6
- package/skills/stillwind/SKILL.md +1 -1
- package/dist/class-object-CXvJOi2z.d.ts +0 -9
- package/dist/class-object-CzD1oMD_.js +0 -6
- package/dist/class-object-CzD1oMD_.js.map +0 -1
- package/dist/class-string-CrQnTRvI.js +0 -6
- package/dist/formats-Ctf2WFc-.js.map +0 -1
- package/dist/style-Bzuux32Y.js.map +0 -1
- package/docs/macros/cva.md +0 -155
|
@@ -1,3 +1,73 @@
|
|
|
1
|
+
// src/runtime/shared.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts a dynamic value into text for a generated CSS declaration.
|
|
4
|
+
*
|
|
5
|
+
* @param value - CSS text, a number, a URL, or a boolean. URLs are quoted and CSS-escaped. True
|
|
6
|
+
* becomes a space and false becomes `initial`.
|
|
7
|
+
* @returns CSS value text. Strings and numbers are converted with `String`.
|
|
8
|
+
*/
|
|
9
|
+
function stillwindCssValue(value) {
|
|
10
|
+
if (typeof value === "boolean") return value ? " " : "initial";
|
|
11
|
+
if (value instanceof URL) return `url("${value.href.replace(/["\\\n\r\f]/g, (character) => `\\${character.codePointAt(0).toString(16)} `)}")`;
|
|
12
|
+
return String(value);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Flattens class contributions and joins nonempty values with spaces.
|
|
16
|
+
*
|
|
17
|
+
* @param values - Strings, numbers, bigints, nested arrays, or objects whose truthy values enable
|
|
18
|
+
* their keys. Other values are ignored.
|
|
19
|
+
* @returns Class text in contribution order, without deduplication.
|
|
20
|
+
*/
|
|
21
|
+
function stillwindClsx(...values) {
|
|
22
|
+
return values.flatMap(flatten).filter(Boolean).join(" ");
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Escapes text for use as one CSS identifier.
|
|
26
|
+
*
|
|
27
|
+
* @param value - Unescaped identifier text.
|
|
28
|
+
* @returns `CSS.escape` output when available, otherwise escaped text with NUL replaced by U+FFFD.
|
|
29
|
+
*/
|
|
30
|
+
function stillwindEscapedIdentifier(value) {
|
|
31
|
+
if (typeof CSS !== "undefined" && typeof CSS.escape === "function") return CSS.escape(value);
|
|
32
|
+
const characters = Array.from(value);
|
|
33
|
+
let escaped = "";
|
|
34
|
+
for (const [index, character] of characters.entries()) {
|
|
35
|
+
const code = character.codePointAt(0);
|
|
36
|
+
const isDigit = code >= 48 && code <= 57;
|
|
37
|
+
const isControl = code >= 1 && code <= 31 || code === 127;
|
|
38
|
+
if (code === 0) escaped += "�";
|
|
39
|
+
else if (isControl) escaped += `\\${code.toString(16)} `;
|
|
40
|
+
else if (index === 0 && isDigit) escaped += `\\${code.toString(16)} `;
|
|
41
|
+
else if (index === 0 && character === "-" && characters.length === 1) escaped += "\\-";
|
|
42
|
+
else if (index === 1 && isDigit && characters[0] === "-") escaped += `\\${code.toString(16)} `;
|
|
43
|
+
else if (isDigit || code >= 65 && code <= 90 || code >= 97 && code <= 122 || code === 45 || code === 95 || code >= 128) escaped += character;
|
|
44
|
+
else escaped += `\\${character}`;
|
|
45
|
+
}
|
|
46
|
+
return escaped;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Builds a CSS identifier for one keyed view transition.
|
|
50
|
+
*
|
|
51
|
+
* @param value - Nonempty class token or an object whose `v` property contains that token.
|
|
52
|
+
* @param key - Key appended to the token after a hyphen using `String`.
|
|
53
|
+
* @returns The combined token and key escaped as a CSS identifier.
|
|
54
|
+
*/
|
|
55
|
+
function stillwindViewTransitionName(value, key) {
|
|
56
|
+
return stillwindEscapedIdentifier(`${typeof value === "string" ? value : value.v}-${String(key)}`);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Expands one class contribution into strings without splitting class text.
|
|
60
|
+
*
|
|
61
|
+
* @param value - Class text, a number, a bigint, a nested array, or an object with enabled class
|
|
62
|
+
* keys.
|
|
63
|
+
* @returns Strings in traversal or object-entry order. Unsupported values produce an empty list.
|
|
64
|
+
*/
|
|
65
|
+
function flatten(value) {
|
|
66
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "bigint") return [String(value)];
|
|
67
|
+
if (Array.isArray(value)) return value.flatMap(flatten);
|
|
68
|
+
if (value && typeof value === "object") return Object.entries(value).filter(([, enabled]) => Boolean(enabled)).map(([name]) => name);
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
1
71
|
// src/runtime/fragment.ts
|
|
2
72
|
function isObject(value) {
|
|
3
73
|
return typeof value === "object" && value !== null;
|
|
@@ -18,6 +88,49 @@ function serializeStyle(payload, styleFormat) {
|
|
|
18
88
|
return payload;
|
|
19
89
|
}
|
|
20
90
|
/**
|
|
91
|
+
* Merges a forwarded style value after the style that a call produced.
|
|
92
|
+
*
|
|
93
|
+
* Objects merge with the forwarded entries last, and strings are joined with `;`. When one
|
|
94
|
+
* value is a string and the other is an object, a framework that accepts style arrays receives
|
|
95
|
+
* both values in an array. Otherwise the object is serialized, because declaration text cannot
|
|
96
|
+
* be parsed into an object reliably. A forwarded array is used only when `styleArrays` is true.
|
|
97
|
+
*
|
|
98
|
+
* @param own - The style that the call produced, or undefined.
|
|
99
|
+
* @param forwarded - The style value that a caller forwarded.
|
|
100
|
+
* @param styleFormat - The style convention of the output format.
|
|
101
|
+
* @param styleArrays - Whether the framework accepts an array of style values.
|
|
102
|
+
* @returns The merged style, or undefined when neither value contributes.
|
|
103
|
+
*/
|
|
104
|
+
function mergeForwardedStyle(own, forwarded, styleFormat, styleArrays) {
|
|
105
|
+
if (forwarded == null || forwarded === "" || Array.isArray(forwarded) && !styleArrays) return own;
|
|
106
|
+
if (own == null || own === "") return Array.isArray(forwarded) ? forwarded : serializeStyle(forwarded, styleFormat);
|
|
107
|
+
if (Array.isArray(own) || Array.isArray(forwarded)) return [own, forwarded];
|
|
108
|
+
if (isObject(own) && isObject(forwarded)) return {
|
|
109
|
+
...own,
|
|
110
|
+
...forwarded
|
|
111
|
+
};
|
|
112
|
+
if (styleArrays && isObject(own) !== isObject(forwarded)) return [own, forwarded];
|
|
113
|
+
return [serializeStyle(own, "string"), serializeStyle(forwarded, "string")].filter(Boolean).join(";");
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Creates a fragment from the class and style props that a component received.
|
|
117
|
+
*
|
|
118
|
+
* @param options - The receiving framework's prop conventions and fragment keys.
|
|
119
|
+
* @param value - Received props. Both `class` and `className` are read, as `stillwindClsx` reads
|
|
120
|
+
* class values. Other props are ignored, and a value that is not an object contributes nothing.
|
|
121
|
+
* @param styleArrays - Whether the framework accepts an array of style values.
|
|
122
|
+
* @returns A fragment that `mergeFragments` applies after every other fragment.
|
|
123
|
+
*/
|
|
124
|
+
function forwardFragment(options, value, styleArrays) {
|
|
125
|
+
if (!isObject(value)) return {};
|
|
126
|
+
const forwarded = {
|
|
127
|
+
class: stillwindClsx(value.class, value.className),
|
|
128
|
+
style: value.style,
|
|
129
|
+
styleArrays
|
|
130
|
+
};
|
|
131
|
+
return { [options[5]]: forwarded };
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
21
134
|
* Materializes class and style fragments without mutating the inputs.
|
|
22
135
|
*
|
|
23
136
|
* @param options - Framework conventions and the keys of the runtime that created the fragments.
|
|
@@ -25,11 +138,14 @@ function serializeStyle(payload, styleFormat) {
|
|
|
25
138
|
* Nonobjects are ignored. Materialized bases must first be converted with `toFragment`.
|
|
26
139
|
* @returns Props with classes joined in traversal order. The last non-null fragment
|
|
27
140
|
* style supplies inline style, and generated custom properties are combined and applied
|
|
28
|
-
*
|
|
141
|
+
* after it. Forwarded fragments apply last, in traversal order: their classes follow the
|
|
142
|
+
* other classes, and their styles merge as `mergeForwardedStyle` describes. Fragment
|
|
143
|
+
* symbol channels do not appear in the result.
|
|
29
144
|
*/
|
|
30
145
|
function mergeFragments(options, values) {
|
|
31
|
-
const [classProperty, styleFormat, stillwindClassKey, stillwindStyleKey, stillwindCustomPropertiesKey] = options;
|
|
146
|
+
const [classProperty, styleFormat, stillwindClassKey, stillwindStyleKey, stillwindCustomPropertiesKey, stillwindForwardKey] = options;
|
|
32
147
|
const classes = [];
|
|
148
|
+
const forwards = [];
|
|
33
149
|
const customProperties = {};
|
|
34
150
|
let style;
|
|
35
151
|
let hasStyle = false;
|
|
@@ -40,6 +156,7 @@ function mergeFragments(options, values) {
|
|
|
40
156
|
return;
|
|
41
157
|
}
|
|
42
158
|
if (!isObject(value)) return;
|
|
159
|
+
if (Object.hasOwn(value, stillwindForwardKey)) forwards.push(value[stillwindForwardKey]);
|
|
43
160
|
if (Object.hasOwn(value, stillwindClassKey) || Object.hasOwn(value, stillwindStyleKey) || Object.hasOwn(value, stillwindCustomPropertiesKey)) {
|
|
44
161
|
const custom = value[stillwindCustomPropertiesKey];
|
|
45
162
|
if (isObject(custom)) Object.assign(customProperties, custom);
|
|
@@ -65,6 +182,11 @@ function mergeFragments(options, values) {
|
|
|
65
182
|
...isObject(result.style) ? result.style : {},
|
|
66
183
|
...customProperties
|
|
67
184
|
};
|
|
185
|
+
for (const forwarded of forwards) {
|
|
186
|
+
if (forwarded.class) result[classProperty] = result[classProperty] ? `${result[classProperty]} ${forwarded.class}` : forwarded.class;
|
|
187
|
+
const style = mergeForwardedStyle(result.style, forwarded.style, styleFormat, forwarded.styleArrays);
|
|
188
|
+
if (style !== void 0) result.style = style;
|
|
189
|
+
}
|
|
68
190
|
return result;
|
|
69
191
|
}
|
|
70
192
|
/**
|
|
@@ -83,121 +205,95 @@ function toFragment(options, value) {
|
|
|
83
205
|
const [classProperty, , stillwindClassKey] = options;
|
|
84
206
|
return { [stillwindClassKey]: Object.hasOwn(value, stillwindClassKey) ? value[stillwindClassKey] : value[classProperty] ?? value[classProperty === "class" ? "className" : "class"] };
|
|
85
207
|
}
|
|
86
|
-
// src/runtime/
|
|
87
|
-
/**
|
|
88
|
-
* Converts a dynamic value into text for a generated CSS declaration.
|
|
89
|
-
*
|
|
90
|
-
* @param value - CSS text, a number, a URL, or a boolean. URLs are quoted and CSS-escaped. True
|
|
91
|
-
* becomes a space and false becomes `initial`.
|
|
92
|
-
* @returns CSS value text. Strings and numbers are converted with `String`.
|
|
93
|
-
*/
|
|
94
|
-
function stillwindCssValue(value) {
|
|
95
|
-
if (typeof value === "boolean") return value ? " " : "initial";
|
|
96
|
-
if (value instanceof URL) return `url("${value.href.replace(/["\\\n\r\f]/g, (character) => `\\${character.codePointAt(0).toString(16)} `)}")`;
|
|
97
|
-
return String(value);
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Flattens class contributions and joins nonempty values with spaces.
|
|
101
|
-
*
|
|
102
|
-
* @param values - Strings, numbers, bigints, nested arrays, or objects whose truthy values enable
|
|
103
|
-
* their keys. Other values are ignored.
|
|
104
|
-
* @returns Class text in contribution order, without deduplication.
|
|
105
|
-
*/
|
|
106
|
-
function stillwindClsx(...values) {
|
|
107
|
-
return values.flatMap(flatten).filter(Boolean).join(" ");
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Escapes text for use as one CSS identifier.
|
|
111
|
-
*
|
|
112
|
-
* @param value - Unescaped identifier text.
|
|
113
|
-
* @returns `CSS.escape` output when available, otherwise escaped text with NUL replaced by U+FFFD.
|
|
114
|
-
*/
|
|
115
|
-
function stillwindEscapedIdentifier(value) {
|
|
116
|
-
if (typeof CSS !== "undefined" && typeof CSS.escape === "function") return CSS.escape(value);
|
|
117
|
-
const characters = Array.from(value);
|
|
118
|
-
let escaped = "";
|
|
119
|
-
for (const [index, character] of characters.entries()) {
|
|
120
|
-
const code = character.codePointAt(0);
|
|
121
|
-
const isDigit = code >= 48 && code <= 57;
|
|
122
|
-
const isControl = code >= 1 && code <= 31 || code === 127;
|
|
123
|
-
if (code === 0) escaped += "�";
|
|
124
|
-
else if (isControl) escaped += `\\${code.toString(16)} `;
|
|
125
|
-
else if (index === 0 && isDigit) escaped += `\\${code.toString(16)} `;
|
|
126
|
-
else if (index === 0 && character === "-" && characters.length === 1) escaped += "\\-";
|
|
127
|
-
else if (index === 1 && isDigit && characters[0] === "-") escaped += `\\${code.toString(16)} `;
|
|
128
|
-
else if (isDigit || code >= 65 && code <= 90 || code >= 97 && code <= 122 || code === 45 || code === 95 || code >= 128) escaped += character;
|
|
129
|
-
else escaped += `\\${character}`;
|
|
130
|
-
}
|
|
131
|
-
return escaped;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Builds a CSS identifier for one keyed view transition.
|
|
135
|
-
*
|
|
136
|
-
* @param value - Nonempty class token or an object whose `v` property contains that token.
|
|
137
|
-
* @param key - Key appended to the token after a hyphen using `String`.
|
|
138
|
-
* @returns The combined token and key escaped as a CSS identifier.
|
|
139
|
-
*/
|
|
140
|
-
function stillwindViewTransitionName(value, key) {
|
|
141
|
-
return stillwindEscapedIdentifier(`${typeof value === "string" ? value : value.v}-${String(key)}`);
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Expands one class contribution into strings without splitting class text.
|
|
145
|
-
*
|
|
146
|
-
* @param value - Class text, a number, a bigint, a nested array, or an object with enabled class
|
|
147
|
-
* keys.
|
|
148
|
-
* @returns Strings in traversal or object-entry order. Unsupported values produce an empty list.
|
|
149
|
-
*/
|
|
150
|
-
function flatten(value) {
|
|
151
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "bigint") return [String(value)];
|
|
152
|
-
if (Array.isArray(value)) return value.flatMap(flatten);
|
|
153
|
-
if (value && typeof value === "object") return Object.entries(value).filter(([, enabled]) => Boolean(enabled)).map(([name]) => name);
|
|
154
|
-
return [];
|
|
155
|
-
}
|
|
156
|
-
// src/runtime/cva.ts
|
|
208
|
+
// src/runtime/recipe.ts
|
|
157
209
|
function optionKey(value) {
|
|
158
210
|
return typeof value === "boolean" ? String(value) : value === 0 ? "0" : value;
|
|
159
211
|
}
|
|
212
|
+
function isSlotMap(value) {
|
|
213
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) && Object.keys(value).length > 0;
|
|
214
|
+
}
|
|
215
|
+
function compound(entry, reserved) {
|
|
216
|
+
return {
|
|
217
|
+
conditions: Object.entries(entry).filter(([key]) => !reserved.includes(key)),
|
|
218
|
+
class: entry.class,
|
|
219
|
+
className: entry.className,
|
|
220
|
+
slots: entry.slots
|
|
221
|
+
};
|
|
222
|
+
}
|
|
160
223
|
/**
|
|
161
224
|
* Creates a selector over compiler-produced values using the supplied framework channels.
|
|
162
225
|
* Values are captured at creation. Each call returns fresh props without mutating inputs.
|
|
163
226
|
* Undefined selections keep defaults; null suppresses an option. Matching compounds
|
|
164
|
-
* contribute in array order, followed by external class and className inputs.
|
|
227
|
+
* contribute in array order, followed by external class and className inputs. The optional
|
|
228
|
+
* second argument is a fragment that `style.forward()` produced. It applies after every other
|
|
229
|
+
* contribution.
|
|
230
|
+
*
|
|
231
|
+
* With `config.slots`, the selector returns an object with one selector for each slot and for
|
|
232
|
+
* `base`. The `base` value and the classes and forwarded value of the outer call apply to the
|
|
233
|
+
* `base` slot only. A slot selector accepts variant choices that replace the outer choices, and
|
|
234
|
+
* its own external classes and forwarded value. A slot receives, in order: `base` (for the `base`
|
|
235
|
+
* slot) and its slot value, its value of each selected option, the matching compound variants,
|
|
236
|
+
* and the matching compound slots that list it.
|
|
165
237
|
*
|
|
166
238
|
* @param options - Framework conventions and the keys used by compiled fragments.
|
|
167
|
-
* @param base - Compiled styles included in every selection.
|
|
168
|
-
* @param config - Immutable compiled option maps, defaults, and compound conditions.
|
|
239
|
+
* @param base - Compiled styles included in every selection, or in the `base` slot.
|
|
240
|
+
* @param config - Immutable compiled slots, option maps, defaults, and compound conditions.
|
|
169
241
|
* @param classes - Concatenates external class inputs. Development calls supply validation.
|
|
170
242
|
* @param merge - Materializes selected fragments. Development calls supply validation.
|
|
171
|
-
* @returns A selector that materializes class and optional style props without private symbols
|
|
243
|
+
* @returns A selector that materializes class and optional style props without private symbols,
|
|
244
|
+
* or a selector of slot selectors when `config.slots` is present.
|
|
172
245
|
*/
|
|
173
|
-
function
|
|
246
|
+
function createRecipe(options, base, config = {}, classes = stillwindClsx, merge = mergeFragments) {
|
|
174
247
|
const axes = Object.keys(config.variants ?? {});
|
|
175
|
-
const compounds = (config.compoundVariants ?? []).map((
|
|
176
|
-
|
|
177
|
-
class
|
|
178
|
-
className
|
|
179
|
-
|
|
248
|
+
const compounds = (config.compoundVariants ?? []).map((entry) => compound(entry, ["class", "className"]));
|
|
249
|
+
const compoundSlots = (config.compoundSlots ?? []).map((entry) => compound(entry, [
|
|
250
|
+
"class",
|
|
251
|
+
"className",
|
|
252
|
+
"slots"
|
|
253
|
+
]));
|
|
254
|
+
const slots = config.slots;
|
|
180
255
|
const fragment = (value) => typeof value === "string" ? { [options[2]]: value } : value;
|
|
181
|
-
|
|
182
|
-
|
|
256
|
+
const pick = (value, slot) => fragment(slot === void 0 ? value : isSlotMap(value) ? Object.hasOwn(value, slot) ? value[slot] : void 0 : slot === "base" ? value : void 0);
|
|
257
|
+
const matches = (conditions, resolved) => conditions.every(([key, expected]) => Array.isArray(expected) ? expected.includes(resolved[key]) : expected === resolved[key]);
|
|
258
|
+
const select = (props, slot) => {
|
|
259
|
+
const values = [];
|
|
260
|
+
if (slot === void 0 || slot === "base") values.push(fragment(base));
|
|
261
|
+
if (slot !== void 0 && slots && Object.hasOwn(slots, slot)) values.push(fragment(slots[slot]));
|
|
183
262
|
const variants = config.variants;
|
|
263
|
+
if (variants) for (const axis of axes) {
|
|
264
|
+
const supplied = props[axis];
|
|
265
|
+
if (supplied === null) continue;
|
|
266
|
+
const key = optionKey(supplied) || optionKey(config.defaultVariants?.[axis]);
|
|
267
|
+
const choices = variants[axis];
|
|
268
|
+
if ((typeof key === "string" || typeof key === "number") && Object.hasOwn(choices, key)) values.push(pick(choices[key], slot));
|
|
269
|
+
}
|
|
270
|
+
const resolved = {
|
|
271
|
+
...config.defaultVariants,
|
|
272
|
+
...Object.fromEntries(Object.entries(props).filter(([, value]) => value !== void 0))
|
|
273
|
+
};
|
|
184
274
|
if (variants) {
|
|
185
|
-
for (const
|
|
186
|
-
const supplied = props[axis];
|
|
187
|
-
if (supplied === null) continue;
|
|
188
|
-
const key = optionKey(supplied) || optionKey(config.defaultVariants?.[axis]);
|
|
189
|
-
const choices = variants[axis];
|
|
190
|
-
if ((typeof key === "string" || typeof key === "number") && Object.hasOwn(choices, key)) values.push(fragment(choices[key]));
|
|
191
|
-
}
|
|
192
|
-
const resolved = {
|
|
193
|
-
...config.defaultVariants,
|
|
194
|
-
...Object.fromEntries(Object.entries(props).filter(([, value]) => value !== void 0))
|
|
195
|
-
};
|
|
196
|
-
for (const compound of compounds) if (compound.conditions.every(([key, expected]) => Array.isArray(expected) ? expected.includes(resolved[key]) : expected === resolved[key])) values.push(fragment(compound.class), fragment(compound.className));
|
|
275
|
+
for (const entry of compounds) if (matches(entry.conditions, resolved)) values.push(pick(entry.class, slot), pick(entry.className, slot));
|
|
197
276
|
}
|
|
198
|
-
|
|
199
|
-
|
|
277
|
+
if (slot !== void 0) {
|
|
278
|
+
for (const entry of compoundSlots) if (entry.slots?.includes(slot) && matches(entry.conditions, resolved)) values.push(fragment(entry.class), fragment(entry.className));
|
|
279
|
+
}
|
|
280
|
+
return values;
|
|
200
281
|
};
|
|
282
|
+
if (!slots) return (props = {}, forwarded) => merge(options, [
|
|
283
|
+
...select(props, void 0),
|
|
284
|
+
{ [options[2]]: classes(props.class, props.className) },
|
|
285
|
+
forwarded
|
|
286
|
+
]);
|
|
287
|
+
const names = ["base", ...Object.keys(slots).filter((name) => name !== "base")];
|
|
288
|
+
return (props = {}, forwarded) => Object.fromEntries(names.map((slot) => [slot, (slotProps = {}, slotForwarded) => {
|
|
289
|
+
const values = select({
|
|
290
|
+
...props,
|
|
291
|
+
...Object.fromEntries(Object.entries(slotProps).filter(([, value]) => value !== void 0))
|
|
292
|
+
}, slot);
|
|
293
|
+
if (slot === "base") values.push({ [options[2]]: classes(props.class, props.className) }, forwarded);
|
|
294
|
+
values.push({ [options[2]]: classes(slotProps.class, slotProps.className) }, slotForwarded);
|
|
295
|
+
return merge(options, values);
|
|
296
|
+
}]));
|
|
201
297
|
}
|
|
202
298
|
// src/runtime/formats.ts
|
|
203
299
|
/**
|
|
@@ -214,7 +310,8 @@ const classObjectOptions = [
|
|
|
214
310
|
"object",
|
|
215
311
|
stillwindClassObjectClassKey,
|
|
216
312
|
stillwindClassObjectStyleKey,
|
|
217
|
-
stillwindClassObjectCustomPropertiesKey
|
|
313
|
+
stillwindClassObjectCustomPropertiesKey,
|
|
314
|
+
/* @__PURE__ */ Symbol("stillwind.class-object.forward")
|
|
218
315
|
];
|
|
219
316
|
/** Materializes ordered fragments with `class` and object styles. */
|
|
220
317
|
function stillwindClassObjectMerge(...values) {
|
|
@@ -228,9 +325,17 @@ function stillwindClassObjectToFragment(value) {
|
|
|
228
325
|
function stillwindClassObjectStyleValue(value) {
|
|
229
326
|
return value == null ? void 0 : serializeStyle(value, "object");
|
|
230
327
|
}
|
|
231
|
-
/**
|
|
232
|
-
function
|
|
233
|
-
return
|
|
328
|
+
/** Creates a fragment from forwarded props for a framework without style arrays. */
|
|
329
|
+
function stillwindClassObjectForward(value) {
|
|
330
|
+
return forwardFragment(classObjectOptions, value, false);
|
|
331
|
+
}
|
|
332
|
+
/** Creates a fragment from forwarded props for a framework that accepts style arrays. */
|
|
333
|
+
function stillwindClassObjectForwardArrays(value) {
|
|
334
|
+
return forwardFragment(classObjectOptions, value, true);
|
|
335
|
+
}
|
|
336
|
+
/** Selects compiled recipe values and returns fresh props with `class` and object styles. */
|
|
337
|
+
function stillwindClassObjectRecipe(base, config) {
|
|
338
|
+
return createRecipe(classObjectOptions, base, config);
|
|
234
339
|
}
|
|
235
340
|
const stillwindClassStringClassKey = /* @__PURE__ */ Symbol("stillwind.class-string.class");
|
|
236
341
|
const stillwindClassStringStyleKey = /* @__PURE__ */ Symbol("stillwind.class-string.style");
|
|
@@ -240,7 +345,8 @@ const classStringOptions = [
|
|
|
240
345
|
"string",
|
|
241
346
|
stillwindClassStringClassKey,
|
|
242
347
|
stillwindClassStringStyleKey,
|
|
243
|
-
stillwindClassStringCustomPropertiesKey
|
|
348
|
+
stillwindClassStringCustomPropertiesKey,
|
|
349
|
+
/* @__PURE__ */ Symbol("stillwind.class-string.forward")
|
|
244
350
|
];
|
|
245
351
|
/** Materializes ordered fragments with `class` and string styles. */
|
|
246
352
|
function stillwindClassStringMerge(...values) {
|
|
@@ -254,9 +360,13 @@ function stillwindClassStringToFragment(value) {
|
|
|
254
360
|
function stillwindClassStringStyleValue(value) {
|
|
255
361
|
return value == null ? void 0 : serializeStyle(value, "string");
|
|
256
362
|
}
|
|
257
|
-
/**
|
|
258
|
-
function
|
|
259
|
-
return
|
|
363
|
+
/** Creates a fragment from forwarded props for a framework without style arrays. */
|
|
364
|
+
function stillwindClassStringForward(value) {
|
|
365
|
+
return forwardFragment(classStringOptions, value, false);
|
|
366
|
+
}
|
|
367
|
+
/** Selects compiled recipe values and returns fresh props with `class` and string styles. */
|
|
368
|
+
function stillwindClassStringRecipe(base, config) {
|
|
369
|
+
return createRecipe(classStringOptions, base, config);
|
|
260
370
|
}
|
|
261
371
|
const stillwindClassNameObjectClassKey = /* @__PURE__ */ Symbol("stillwind.class-name-object.class");
|
|
262
372
|
const stillwindClassNameObjectStyleKey = /* @__PURE__ */ Symbol("stillwind.class-name-object.style");
|
|
@@ -266,7 +376,8 @@ const classNameObjectOptions = [
|
|
|
266
376
|
"object",
|
|
267
377
|
stillwindClassNameObjectClassKey,
|
|
268
378
|
stillwindClassNameObjectStyleKey,
|
|
269
|
-
stillwindClassNameObjectCustomPropertiesKey
|
|
379
|
+
stillwindClassNameObjectCustomPropertiesKey,
|
|
380
|
+
/* @__PURE__ */ Symbol("stillwind.class-name-object.forward")
|
|
270
381
|
];
|
|
271
382
|
/** Materializes ordered fragments with `className` and object styles. */
|
|
272
383
|
function stillwindClassNameObjectMerge(...values) {
|
|
@@ -280,10 +391,14 @@ function stillwindClassNameObjectToFragment(value) {
|
|
|
280
391
|
function stillwindClassNameObjectStyleValue(value) {
|
|
281
392
|
return value == null ? void 0 : serializeStyle(value, "object");
|
|
282
393
|
}
|
|
283
|
-
/**
|
|
284
|
-
function
|
|
285
|
-
return
|
|
394
|
+
/** Creates a fragment from forwarded props for a framework without style arrays. */
|
|
395
|
+
function stillwindClassNameObjectForward(value) {
|
|
396
|
+
return forwardFragment(classNameObjectOptions, value, false);
|
|
397
|
+
}
|
|
398
|
+
/** Selects compiled recipe values and returns fresh props with `className` and object styles. */
|
|
399
|
+
function stillwindClassNameObjectRecipe(base, config) {
|
|
400
|
+
return createRecipe(classNameObjectOptions, base, config);
|
|
286
401
|
}
|
|
287
|
-
export { classNameObjectOptions, classObjectOptions, classStringOptions,
|
|
402
|
+
export { classNameObjectOptions, classObjectOptions, classStringOptions, createRecipe, forwardFragment, isObject, mergeFragments, stillwindClassNameObjectClassKey, stillwindClassNameObjectCustomPropertiesKey, stillwindClassNameObjectForward, stillwindClassNameObjectMerge, stillwindClassNameObjectRecipe, stillwindClassNameObjectStyleKey, stillwindClassNameObjectStyleValue, stillwindClassNameObjectToFragment, stillwindClassObjectClassKey, stillwindClassObjectCustomPropertiesKey, stillwindClassObjectForward, stillwindClassObjectForwardArrays, stillwindClassObjectMerge, stillwindClassObjectRecipe, stillwindClassObjectStyleKey, stillwindClassObjectStyleValue, stillwindClassObjectToFragment, stillwindClassStringClassKey, stillwindClassStringCustomPropertiesKey, stillwindClassStringForward, stillwindClassStringMerge, stillwindClassStringRecipe, stillwindClassStringStyleKey, stillwindClassStringStyleValue, stillwindClassStringToFragment, stillwindClsx, stillwindCssValue, stillwindEscapedIdentifier, stillwindViewTransitionName, toFragment };
|
|
288
403
|
|
|
289
|
-
//# sourceMappingURL=formats-
|
|
404
|
+
//# sourceMappingURL=formats-DP9B9SG6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formats-DP9B9SG6.js","names":[],"sources":["../src/runtime/shared.ts","../src/runtime/fragment.ts","../src/runtime/recipe.ts","../src/runtime/formats.ts"],"sourcesContent":["/**\n * Converts a dynamic value into text for a generated CSS declaration.\n *\n * @param value - CSS text, a number, a URL, or a boolean. URLs are quoted and CSS-escaped. True\n * becomes a space and false becomes `initial`.\n * @returns CSS value text. Strings and numbers are converted with `String`.\n */\nexport function stillwindCssValue(value: URL | string | number | boolean): string {\n if (typeof value === \"boolean\") {\n return value ? \" \" : \"initial\";\n }\n if (value instanceof URL) {\n const escaped = value.href.replace(\n /[\"\\\\\\n\\r\\f]/g,\n (character) => `\\\\${character.codePointAt(0)!.toString(16)} `,\n );\n return `url(\"${escaped}\")`;\n }\n return String(value);\n}\n\n/**\n * Flattens class contributions and joins nonempty values with spaces.\n *\n * @param values - Strings, numbers, bigints, nested arrays, or objects whose truthy values enable\n * their keys. Other values are ignored.\n * @returns Class text in contribution order, without deduplication.\n */\nexport function stillwindClsx(...values: readonly unknown[]): string {\n return values.flatMap(flatten).filter(Boolean).join(\" \");\n}\n\n/**\n * Escapes text for use as one CSS identifier.\n *\n * @param value - Unescaped identifier text.\n * @returns `CSS.escape` output when available, otherwise escaped text with NUL replaced by U+FFFD.\n */\nexport function stillwindEscapedIdentifier(value: string): string {\n if (typeof CSS !== \"undefined\" && typeof CSS.escape === \"function\") {\n return CSS.escape(value);\n }\n const characters = Array.from(value);\n let escaped = \"\";\n for (const [index, character] of characters.entries()) {\n const code = character.codePointAt(0)!;\n const isDigit = code >= 48 && code <= 57;\n const isControl = (code >= 1 && code <= 31) || code === 127;\n if (code === 0) {\n escaped += \"\\uFFFD\";\n } else if (isControl) {\n escaped += `\\\\${code.toString(16)} `;\n } else if (index === 0 && isDigit) {\n escaped += `\\\\${code.toString(16)} `;\n } else if (index === 0 && character === \"-\" && characters.length === 1) {\n escaped += \"\\\\-\";\n } else if (index === 1 && isDigit && characters[0] === \"-\") {\n escaped += `\\\\${code.toString(16)} `;\n } else if (\n isDigit ||\n (code >= 65 && code <= 90) ||\n (code >= 97 && code <= 122) ||\n code === 45 ||\n code === 95 ||\n code >= 128\n ) {\n escaped += character;\n } else {\n escaped += `\\\\${character}`;\n }\n }\n return escaped;\n}\n\n/**\n * Builds a CSS identifier for one keyed view transition.\n *\n * @param value - Nonempty class token or an object whose `v` property contains that token.\n * @param key - Key appended to the token after a hyphen using `String`.\n * @returns The combined token and key escaped as a CSS identifier.\n */\nexport function stillwindViewTransitionName(value: unknown, key: string | number): string {\n const token = typeof value === \"string\" ? value : (value as { v: string }).v;\n return stillwindEscapedIdentifier(`${token}-${String(key)}`);\n}\n\n/**\n * Expands one class contribution into strings without splitting class text.\n *\n * @param value - Class text, a number, a bigint, a nested array, or an object with enabled class\n * keys.\n * @returns Strings in traversal or object-entry order. Unsupported values produce an empty list.\n */\nfunction flatten(value: unknown): string[] {\n if (typeof value === \"string\" || typeof value === \"number\" || typeof value === \"bigint\") {\n return [String(value)];\n }\n if (Array.isArray(value)) {\n return value.flatMap(flatten);\n }\n if (value && typeof value === \"object\") {\n return Object.entries(value as Record<string, unknown>)\n .filter(([, enabled]) => Boolean(enabled))\n .map(([name]) => name);\n }\n return [];\n}\n","import { stillwindClsx } from \"./shared.ts\";\n\n/**\n * Framework conventions and private channels used to materialize fragments.\n * The four keys must be distinct and belong to the runtime that created the fragments.\n */\nexport type FragmentRuntimeOptions = readonly [\n /** Element prop that receives the combined class text. */\n classProperty: \"class\" | \"className\",\n /** Whether style records become objects or semicolon-separated declaration text. */\n styleFormat: \"object\" | \"string\",\n /** Own fragment property containing class text. */\n stillwindClassKey: symbol,\n /** Own fragment property containing the last authored style payload. */\n stillwindStyleKey: symbol,\n /** Own fragment property containing generated custom properties. */\n stillwindCustomPropertiesKey: symbol,\n /** Own fragment property containing props that a caller forwarded, applied after all others. */\n stillwindForwardKey: symbol,\n];\n\n/** Class and style props that a component received from its caller. */\ninterface ForwardedProps {\n /** Class text joined from the forwarded `class` and `className` values. */\n readonly class: string;\n /** The forwarded style value, unchanged. */\n readonly style: unknown;\n /** Whether the framework accepts an array of style values. */\n readonly styleArrays: boolean;\n}\n\nexport function isObject(value: unknown): value is Record<PropertyKey, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\n/**\n * Converts a style payload using the framework's style convention.\n *\n * @param payload - Arbitrary payload. String mode accepts text and objects whose entries become declarations.\n * @param styleFormat - Object mode returns the payload unchanged; string mode serializes object entries in order.\n * @returns The payload, declaration text, or undefined for an unsupported string-mode payload.\n */\nexport function serializeStyle(payload: unknown, styleFormat: \"object\" | \"string\"): unknown {\n if (styleFormat === \"string\") {\n if (typeof payload === \"string\") {\n return payload;\n }\n if (isObject(payload)) {\n return Object.entries(payload)\n .map(([name, value]) => `${name}:${String(value)}`)\n .join(\";\");\n }\n return undefined;\n }\n return payload;\n}\n\n/**\n * Merges a forwarded style value after the style that a call produced.\n *\n * Objects merge with the forwarded entries last, and strings are joined with `;`. When one\n * value is a string and the other is an object, a framework that accepts style arrays receives\n * both values in an array. Otherwise the object is serialized, because declaration text cannot\n * be parsed into an object reliably. A forwarded array is used only when `styleArrays` is true.\n *\n * @param own - The style that the call produced, or undefined.\n * @param forwarded - The style value that a caller forwarded.\n * @param styleFormat - The style convention of the output format.\n * @param styleArrays - Whether the framework accepts an array of style values.\n * @returns The merged style, or undefined when neither value contributes.\n */\nexport function mergeForwardedStyle(\n own: unknown,\n forwarded: unknown,\n styleFormat: \"object\" | \"string\",\n styleArrays: boolean,\n): unknown {\n if (forwarded == null || forwarded === \"\" || (Array.isArray(forwarded) && !styleArrays)) {\n return own;\n }\n if (own == null || own === \"\") {\n return Array.isArray(forwarded) ? forwarded : serializeStyle(forwarded, styleFormat);\n }\n if (Array.isArray(own) || Array.isArray(forwarded)) {\n return [own, forwarded];\n }\n if (isObject(own) && isObject(forwarded)) {\n return {\n ...own,\n ...forwarded,\n };\n }\n if (styleArrays && isObject(own) !== isObject(forwarded)) {\n return [own, forwarded];\n }\n return [serializeStyle(own, \"string\"), serializeStyle(forwarded, \"string\")]\n .filter(Boolean)\n .join(\";\");\n}\n\n/**\n * Creates a fragment from the class and style props that a component received.\n *\n * @param options - The receiving framework's prop conventions and fragment keys.\n * @param value - Received props. Both `class` and `className` are read, as `stillwindClsx` reads\n * class values. Other props are ignored, and a value that is not an object contributes nothing.\n * @param styleArrays - Whether the framework accepts an array of style values.\n * @returns A fragment that `mergeFragments` applies after every other fragment.\n */\nexport function forwardFragment(\n options: FragmentRuntimeOptions,\n value: unknown,\n styleArrays: boolean,\n): Record<PropertyKey, unknown> {\n if (!isObject(value)) {\n return {};\n }\n const forwarded: ForwardedProps = {\n class: stillwindClsx(value.class, value.className),\n style: value.style,\n styleArrays,\n };\n return {\n [options[5]]: forwarded,\n };\n}\n\n/**\n * Materializes class and style fragments without mutating the inputs.\n *\n * @param options - Framework conventions and the keys of the runtime that created the fragments.\n * @param values - Fragments or nested arrays.\n * Nonobjects are ignored. Materialized bases must first be converted with `toFragment`.\n * @returns Props with classes joined in traversal order. The last non-null fragment\n * style supplies inline style, and generated custom properties are combined and applied\n * after it. Forwarded fragments apply last, in traversal order: their classes follow the\n * other classes, and their styles merge as `mergeForwardedStyle` describes. Fragment\n * symbol channels do not appear in the result.\n */\nexport function mergeFragments(\n options: FragmentRuntimeOptions,\n values: readonly unknown[],\n): Record<string, unknown> {\n const [\n classProperty,\n styleFormat,\n stillwindClassKey,\n stillwindStyleKey,\n stillwindCustomPropertiesKey,\n stillwindForwardKey,\n ] = options;\n const classes: string[] = [];\n const forwards: ForwardedProps[] = [];\n const customProperties: Record<string, string> = {};\n let style: unknown;\n let hasStyle = false;\n\n const collect = (value: unknown): void => {\n if (!value) {\n return;\n }\n if (Array.isArray(value)) {\n for (const element of value) {\n collect(element);\n }\n return;\n }\n if (!isObject(value)) {\n return;\n }\n if (Object.hasOwn(value, stillwindForwardKey)) {\n forwards.push(value[stillwindForwardKey] as ForwardedProps);\n }\n const fragment =\n Object.hasOwn(value, stillwindClassKey) ||\n Object.hasOwn(value, stillwindStyleKey) ||\n Object.hasOwn(value, stillwindCustomPropertiesKey);\n if (fragment) {\n const custom = value[stillwindCustomPropertiesKey];\n if (isObject(custom)) {\n Object.assign(customProperties, custom);\n }\n const contribution = value[stillwindClassKey];\n if (typeof contribution === \"string\" && contribution.length > 0) {\n classes.push(contribution);\n }\n if (Object.hasOwn(value, stillwindStyleKey)) {\n const payload = value[stillwindStyleKey];\n if (payload !== undefined && payload !== null) {\n style = payload;\n hasStyle = true;\n }\n }\n }\n };\n\n for (const value of values) {\n collect(value);\n }\n\n const result: Record<string, unknown> = {};\n if (classes.length > 0) {\n result[classProperty] = classes.join(\" \");\n }\n if (hasStyle) {\n const materialized = serializeStyle(style, styleFormat);\n if (materialized !== undefined) {\n result.style = materialized;\n }\n }\n if (Object.keys(customProperties).length > 0) {\n result.style =\n styleFormat === \"string\"\n ? [serializeStyle(result.style, styleFormat), serializeStyle(customProperties, styleFormat)]\n .filter(Boolean)\n .join(\";\")\n : {\n ...(isObject(result.style) ? result.style : {}),\n ...customProperties,\n };\n }\n for (const forwarded of forwards) {\n if (forwarded.class) {\n result[classProperty] = result[classProperty]\n ? `${result[classProperty] as string} ${forwarded.class}`\n : forwarded.class;\n }\n const style = mergeForwardedStyle(\n result.style,\n forwarded.style,\n styleFormat,\n forwarded.styleArrays,\n );\n if (style !== undefined) {\n result.style = style;\n }\n }\n return result;\n}\n\n/**\n * Converts a composition base to a fragment that contributes only its class.\n *\n * A base contributes either `class` or `className`, or the class channel of a fragment\n * from this runtime. The receiving output's prop takes precedence unless it is null or\n * undefined. Style payloads and custom properties are ignored.\n *\n * @param options - The receiving framework's prop conventions and fragment keys.\n * @param value - A non-null object containing materialized props or this runtime's\n * fragment channels.\n * @returns A new fragment whose class channel holds the base's class value.\n */\nexport function toFragment(\n options: FragmentRuntimeOptions,\n value: Record<PropertyKey, unknown>,\n): Record<PropertyKey, unknown> {\n const [classProperty, , stillwindClassKey] = options;\n return {\n [stillwindClassKey]: Object.hasOwn(value, stillwindClassKey)\n ? value[stillwindClassKey]\n : (value[classProperty] ?? value[classProperty === \"class\" ? \"className\" : \"class\"]),\n };\n}\n","import { mergeFragments, type FragmentRuntimeOptions } from \"./fragment.ts\";\nimport { stillwindClsx } from \"./shared.ts\";\n\n/**\n * Compiler-produced class text, fragment channels, or nested fragment arrays.\n */\nexport type RecipeValue = string | boolean | null | undefined | object;\n\n/**\n * Compiled configuration whose structure is immutable after factory creation.\n */\nexport interface CompiledRecipeConfig {\n /**\n * Values of named element parts. With slots, a variant option, compound `class`, or compound\n * `className` value may be an object whose string keys name slots. Any other value applies to\n * the `base` slot. Compiled values have no string keys, so they are never read as slot maps.\n */\n readonly slots?: Readonly<Record<string, RecipeValue>>;\n readonly variants?: Readonly<Record<string, Readonly<Record<string, RecipeValue>>>>;\n readonly defaultVariants?: Readonly<Record<string, string | number | boolean | null | undefined>>;\n readonly compoundVariants?: readonly Readonly<Record<string, unknown>>[];\n /** Conditions that add `class` and `className` to every slot listed in `slots`. */\n readonly compoundSlots?: readonly Readonly<Record<string, unknown>>[];\n}\n\n/** Returns props for one element from variant choices, external classes, and a forwarded value. */\nexport type RecipeSelector = (\n props?: Readonly<Record<string, unknown>>,\n forwarded?: unknown,\n) => Record<string, unknown>;\n\nfunction optionKey(value: unknown): unknown {\n return typeof value === \"boolean\" ? String(value) : value === 0 ? \"0\" : value;\n}\n\nfunction isSlotMap(value: unknown): value is Readonly<Record<string, RecipeValue>> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n !Array.isArray(value) &&\n Object.keys(value).length > 0\n );\n}\n\nfunction compound(entry: Readonly<Record<string, unknown>>, reserved: readonly string[]) {\n return {\n conditions: Object.entries(entry).filter(([key]) => !reserved.includes(key)),\n class: entry.class as RecipeValue,\n className: entry.className as RecipeValue,\n slots: entry.slots as readonly string[] | undefined,\n };\n}\n\n/**\n * Creates a selector over compiler-produced values using the supplied framework channels.\n * Values are captured at creation. Each call returns fresh props without mutating inputs.\n * Undefined selections keep defaults; null suppresses an option. Matching compounds\n * contribute in array order, followed by external class and className inputs. The optional\n * second argument is a fragment that `style.forward()` produced. It applies after every other\n * contribution.\n *\n * With `config.slots`, the selector returns an object with one selector for each slot and for\n * `base`. The `base` value and the classes and forwarded value of the outer call apply to the\n * `base` slot only. A slot selector accepts variant choices that replace the outer choices, and\n * its own external classes and forwarded value. A slot receives, in order: `base` (for the `base`\n * slot) and its slot value, its value of each selected option, the matching compound variants,\n * and the matching compound slots that list it.\n *\n * @param options - Framework conventions and the keys used by compiled fragments.\n * @param base - Compiled styles included in every selection, or in the `base` slot.\n * @param config - Immutable compiled slots, option maps, defaults, and compound conditions.\n * @param classes - Concatenates external class inputs. Development calls supply validation.\n * @param merge - Materializes selected fragments. Development calls supply validation.\n * @returns A selector that materializes class and optional style props without private symbols,\n * or a selector of slot selectors when `config.slots` is present.\n */\nexport function createRecipe(\n options: FragmentRuntimeOptions,\n base: RecipeValue,\n config: CompiledRecipeConfig = {},\n classes: typeof stillwindClsx = stillwindClsx,\n merge: typeof mergeFragments = mergeFragments,\n): RecipeSelector {\n const axes = Object.keys(config.variants ?? {});\n const compounds = (config.compoundVariants ?? []).map((entry) =>\n compound(entry, [\"class\", \"className\"]),\n );\n const compoundSlots = (config.compoundSlots ?? []).map((entry) =>\n compound(entry, [\"class\", \"className\", \"slots\"]),\n );\n const slots = config.slots;\n const fragment = (value: RecipeValue): unknown =>\n typeof value === \"string\" ? { [options[2]]: value } : value;\n // Without slots, `slot` is undefined and every value applies as written.\n const pick = (value: RecipeValue, slot: string | undefined): unknown =>\n fragment(\n slot === undefined\n ? value\n : isSlotMap(value)\n ? Object.hasOwn(value, slot)\n ? value[slot]\n : undefined\n : slot === \"base\"\n ? value\n : undefined,\n );\n const matches = (\n conditions: readonly [string, unknown][],\n resolved: Readonly<Record<string, unknown>>,\n ) =>\n conditions.every(([key, expected]) =>\n Array.isArray(expected) ? expected.includes(resolved[key]) : expected === resolved[key],\n );\n\n const select = (props: Readonly<Record<string, unknown>>, slot: string | undefined) => {\n const values: unknown[] = [];\n if (slot === undefined || slot === \"base\") {\n values.push(fragment(base));\n }\n if (slot !== undefined && slots && Object.hasOwn(slots, slot)) {\n values.push(fragment(slots[slot]));\n }\n const variants = config.variants;\n if (variants) {\n for (const axis of axes) {\n const supplied = props[axis];\n if (supplied === null) {\n continue;\n }\n const key = optionKey(supplied) || optionKey(config.defaultVariants?.[axis]);\n const choices = variants[axis]!;\n if ((typeof key === \"string\" || typeof key === \"number\") && Object.hasOwn(choices, key)) {\n values.push(pick(choices[key], slot));\n }\n }\n }\n const resolved = {\n ...config.defaultVariants,\n ...Object.fromEntries(Object.entries(props).filter(([, value]) => value !== undefined)),\n };\n if (variants) {\n for (const entry of compounds) {\n if (matches(entry.conditions, resolved)) {\n values.push(pick(entry.class, slot), pick(entry.className, slot));\n }\n }\n }\n if (slot !== undefined) {\n for (const entry of compoundSlots) {\n if (entry.slots?.includes(slot) && matches(entry.conditions, resolved)) {\n values.push(fragment(entry.class), fragment(entry.className));\n }\n }\n }\n return values;\n };\n\n if (!slots) {\n return (props = {}, forwarded) =>\n merge(options, [\n ...select(props, undefined),\n {\n [options[2]]: classes(props.class, props.className),\n },\n forwarded,\n ]);\n }\n const names = [\"base\", ...Object.keys(slots).filter((name) => name !== \"base\")];\n return (props = {}, forwarded) =>\n Object.fromEntries(\n names.map((slot): [string, RecipeSelector] => [\n slot,\n (slotProps = {}, slotForwarded) => {\n const values = select(\n {\n ...props,\n ...Object.fromEntries(\n Object.entries(slotProps).filter(([, value]) => value !== undefined),\n ),\n },\n slot,\n );\n if (slot === \"base\") {\n values.push(\n {\n [options[2]]: classes(props.class, props.className),\n },\n forwarded,\n );\n }\n values.push(\n {\n [options[2]]: classes(slotProps.class, slotProps.className),\n },\n slotForwarded,\n );\n return merge(options, values);\n },\n ]),\n );\n}\n","/**\n * Fragment keys and production operations for each output format.\n *\n * Each format owns distinct symbol keys, so a fragment must be materialized by the format that\n * created it. Export names start with the format name because all formats share one entrypoint.\n */\n\nimport {\n forwardFragment,\n mergeFragments,\n serializeStyle,\n toFragment,\n type FragmentRuntimeOptions,\n} from \"./fragment.ts\";\nimport { createRecipe, type CompiledRecipeConfig, type RecipeValue } from \"./recipe.ts\";\n\nexport const stillwindClassObjectClassKey = /* @__PURE__ */ Symbol(\"stillwind.class-object.class\");\n\nexport const stillwindClassObjectStyleKey = /* @__PURE__ */ Symbol(\"stillwind.class-object.style\");\n\nexport const stillwindClassObjectCustomPropertiesKey = /* @__PURE__ */ Symbol(\n \"stillwind.class-object.custom-properties\",\n);\n\nconst stillwindClassObjectForwardKey = /* @__PURE__ */ Symbol(\"stillwind.class-object.forward\");\n\nexport const classObjectOptions: FragmentRuntimeOptions = [\n \"class\",\n \"object\",\n stillwindClassObjectClassKey,\n stillwindClassObjectStyleKey,\n stillwindClassObjectCustomPropertiesKey,\n stillwindClassObjectForwardKey,\n];\n\n/** Materializes ordered fragments with `class` and object styles. */\nexport function stillwindClassObjectMerge(...values: readonly unknown[]): Record<string, unknown> {\n return mergeFragments(classObjectOptions, values);\n}\n\n/** Converts either class prop of a composition base to a class-only fragment. */\nexport function stillwindClassObjectToFragment(\n value: Record<PropertyKey, unknown>,\n): Record<PropertyKey, unknown> {\n return toFragment(classObjectOptions, value);\n}\n\n/** Returns the supplied style payload, or undefined for null or undefined. */\nexport function stillwindClassObjectStyleValue(value: unknown): unknown {\n return value == null ? undefined : serializeStyle(value, \"object\");\n}\n\n/** Creates a fragment from forwarded props for a framework without style arrays. */\nexport function stillwindClassObjectForward(value: unknown): Record<PropertyKey, unknown> {\n return forwardFragment(classObjectOptions, value, false);\n}\n\n/** Creates a fragment from forwarded props for a framework that accepts style arrays. */\nexport function stillwindClassObjectForwardArrays(value: unknown): Record<PropertyKey, unknown> {\n return forwardFragment(classObjectOptions, value, true);\n}\n\n/** Selects compiled recipe values and returns fresh props with `class` and object styles. */\nexport function stillwindClassObjectRecipe(base?: RecipeValue, config?: CompiledRecipeConfig) {\n return createRecipe(classObjectOptions, base, config);\n}\n\nexport const stillwindClassStringClassKey = /* @__PURE__ */ Symbol(\"stillwind.class-string.class\");\n\nexport const stillwindClassStringStyleKey = /* @__PURE__ */ Symbol(\"stillwind.class-string.style\");\n\nexport const stillwindClassStringCustomPropertiesKey = /* @__PURE__ */ Symbol(\n \"stillwind.class-string.custom-properties\",\n);\n\nconst stillwindClassStringForwardKey = /* @__PURE__ */ Symbol(\"stillwind.class-string.forward\");\n\nexport const classStringOptions: FragmentRuntimeOptions = [\n \"class\",\n \"string\",\n stillwindClassStringClassKey,\n stillwindClassStringStyleKey,\n stillwindClassStringCustomPropertiesKey,\n stillwindClassStringForwardKey,\n];\n\n/** Materializes ordered fragments with `class` and string styles. */\nexport function stillwindClassStringMerge(...values: readonly unknown[]): Record<string, unknown> {\n return mergeFragments(classStringOptions, values);\n}\n\n/** Converts either class prop of a composition base to a class-only fragment. */\nexport function stillwindClassStringToFragment(\n value: Record<PropertyKey, unknown>,\n): Record<PropertyKey, unknown> {\n return toFragment(classStringOptions, value);\n}\n\n/** Serializes object style declarations or preserves a string. Other inputs omit style. */\nexport function stillwindClassStringStyleValue(value: unknown): unknown {\n return value == null ? undefined : serializeStyle(value, \"string\");\n}\n\n/** Creates a fragment from forwarded props for a framework without style arrays. */\nexport function stillwindClassStringForward(value: unknown): Record<PropertyKey, unknown> {\n return forwardFragment(classStringOptions, value, false);\n}\n\n/** Selects compiled recipe values and returns fresh props with `class` and string styles. */\nexport function stillwindClassStringRecipe(base?: RecipeValue, config?: CompiledRecipeConfig) {\n return createRecipe(classStringOptions, base, config);\n}\n\nexport const stillwindClassNameObjectClassKey = /* @__PURE__ */ Symbol(\n \"stillwind.class-name-object.class\",\n);\n\nexport const stillwindClassNameObjectStyleKey = /* @__PURE__ */ Symbol(\n \"stillwind.class-name-object.style\",\n);\n\nexport const stillwindClassNameObjectCustomPropertiesKey = /* @__PURE__ */ Symbol(\n \"stillwind.class-name-object.custom-properties\",\n);\n\nconst stillwindClassNameObjectForwardKey = /* @__PURE__ */ Symbol(\n \"stillwind.class-name-object.forward\",\n);\n\nexport const classNameObjectOptions: FragmentRuntimeOptions = [\n \"className\",\n \"object\",\n stillwindClassNameObjectClassKey,\n stillwindClassNameObjectStyleKey,\n stillwindClassNameObjectCustomPropertiesKey,\n stillwindClassNameObjectForwardKey,\n];\n\n/** Materializes ordered fragments with `className` and object styles. */\nexport function stillwindClassNameObjectMerge(\n ...values: readonly unknown[]\n): Record<string, unknown> {\n return mergeFragments(classNameObjectOptions, values);\n}\n\n/** Converts either class prop of a composition base to a class-only fragment. */\nexport function stillwindClassNameObjectToFragment(\n value: Record<PropertyKey, unknown>,\n): Record<PropertyKey, unknown> {\n return toFragment(classNameObjectOptions, value);\n}\n\n/** Returns the supplied style payload, or undefined for null or undefined. */\nexport function stillwindClassNameObjectStyleValue(value: unknown): unknown {\n return value == null ? undefined : serializeStyle(value, \"object\");\n}\n\n/** Creates a fragment from forwarded props for a framework without style arrays. */\nexport function stillwindClassNameObjectForward(value: unknown): Record<PropertyKey, unknown> {\n return forwardFragment(classNameObjectOptions, value, false);\n}\n\n/** Selects compiled recipe values and returns fresh props with `className` and object styles. */\nexport function stillwindClassNameObjectRecipe(base?: RecipeValue, config?: CompiledRecipeConfig) {\n return createRecipe(classNameObjectOptions, base, config);\n}\n"],"mappings":";;;;;;;;AAOA,SAAgB,kBAAkB,OAAgD;CAChF,IAAI,OAAO,UAAU,WACnB,OAAO,QAAQ,MAAM;CAEvB,IAAI,iBAAiB,KAKnB,OAAO,QAJS,MAAM,KAAK,QACzB,iBACC,cAAc,KAAK,UAAU,YAAY,CAAC,CAAC,CAAE,SAAS,EAAE,EAAE,EAExC,EAAE;CAEzB,OAAO,OAAO,KAAK;AACrB;;;;;;;;AASA,SAAgB,cAAc,GAAG,QAAoC;CACnE,OAAO,OAAO,QAAQ,OAAO,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;AACzD;;;;;;;AAQA,SAAgB,2BAA2B,OAAuB;CAChE,IAAI,OAAO,QAAQ,eAAe,OAAO,IAAI,WAAW,YACtD,OAAO,IAAI,OAAO,KAAK;CAEzB,MAAM,aAAa,MAAM,KAAK,KAAK;CACnC,IAAI,UAAU;CACd,KAAK,MAAM,CAAC,OAAO,cA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AAgB,8BACd,GAAG,QACsB;CACzB,OAAO,eAAe,wBAAwB,MAAM;AACtD;;AAGA,SAAgB,mCACd,OAC8B;CAC9B,OAAO,WAAW,wBAAwB,KAAK;AACjD;;AAGA,SAAgB,mCAAmC,OAAyB;CAC1E,OAAO,SAAS,OAAO,KAAA,IAAY,eAAe,OAAO,QAAQ;AACnE;;AAGA,SAAgB,gCAAgC,OAA8C;CAC5F,OAAO,gBAAgB,wBAAwB,OAAO,KAAK;AAC7D;;AAGA,SAAgB,+BAA+B,MAAoB,QAA+B;CAChG,OAAO,aAAa,wBAAwB,MAAM,MAAM;AAC1D"}
|
|
@@ -29,14 +29,28 @@ export declare function stillwindEscapedIdentifier(value: string): string;
|
|
|
29
29
|
* @returns The combined token and key escaped as a CSS identifier.
|
|
30
30
|
*/
|
|
31
31
|
export declare function stillwindViewTransitionName(value: unknown, key: string | number): string;
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export
|
|
36
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Compiler-produced class text, fragment channels, or nested fragment arrays.
|
|
34
|
+
*/
|
|
35
|
+
export type RecipeValue = string | boolean | null | undefined | object;
|
|
36
|
+
/**
|
|
37
|
+
* Compiled configuration whose structure is immutable after factory creation.
|
|
38
|
+
*/
|
|
39
|
+
export interface CompiledRecipeConfig {
|
|
40
|
+
/**
|
|
41
|
+
* Values of named element parts. With slots, a variant option, compound `class`, or compound
|
|
42
|
+
* `className` value may be an object whose string keys name slots. Any other value applies to
|
|
43
|
+
* the `base` slot. Compiled values have no string keys, so they are never read as slot maps.
|
|
44
|
+
*/
|
|
45
|
+
readonly slots?: Readonly<Record<string, RecipeValue>>;
|
|
46
|
+
readonly variants?: Readonly<Record<string, Readonly<Record<string, RecipeValue>>>>;
|
|
37
47
|
readonly defaultVariants?: Readonly<Record<string, string | number | boolean | null | undefined>>;
|
|
38
48
|
readonly compoundVariants?: readonly Readonly<Record<string, unknown>>[];
|
|
49
|
+
/** Conditions that add `class` and `className` to every slot listed in `slots`. */
|
|
50
|
+
readonly compoundSlots?: readonly Readonly<Record<string, unknown>>[];
|
|
39
51
|
}
|
|
52
|
+
/** Returns props for one element from variant choices, external classes, and a forwarded value. */
|
|
53
|
+
export type RecipeSelector = (props?: Readonly<Record<string, unknown>>, forwarded?: unknown) => Record<string, unknown>;
|
|
40
54
|
export declare const stillwindClassObjectClassKey: unique symbol;
|
|
41
55
|
export declare const stillwindClassObjectStyleKey: unique symbol;
|
|
42
56
|
export declare const stillwindClassObjectCustomPropertiesKey: unique symbol;
|
|
@@ -46,8 +60,12 @@ export declare function stillwindClassObjectMerge(...values: readonly unknown[])
|
|
|
46
60
|
export declare function stillwindClassObjectToFragment(value: Record<PropertyKey, unknown>): Record<PropertyKey, unknown>;
|
|
47
61
|
/** Returns the supplied style payload, or undefined for null or undefined. */
|
|
48
62
|
export declare function stillwindClassObjectStyleValue(value: unknown): unknown;
|
|
49
|
-
/**
|
|
50
|
-
export declare function
|
|
63
|
+
/** Creates a fragment from forwarded props for a framework without style arrays. */
|
|
64
|
+
export declare function stillwindClassObjectForward(value: unknown): Record<PropertyKey, unknown>;
|
|
65
|
+
/** Creates a fragment from forwarded props for a framework that accepts style arrays. */
|
|
66
|
+
export declare function stillwindClassObjectForwardArrays(value: unknown): Record<PropertyKey, unknown>;
|
|
67
|
+
/** Selects compiled recipe values and returns fresh props with `class` and object styles. */
|
|
68
|
+
export declare function stillwindClassObjectRecipe(base?: RecipeValue, config?: CompiledRecipeConfig): RecipeSelector;
|
|
51
69
|
export declare const stillwindClassStringClassKey: unique symbol;
|
|
52
70
|
export declare const stillwindClassStringStyleKey: unique symbol;
|
|
53
71
|
export declare const stillwindClassStringCustomPropertiesKey: unique symbol;
|
|
@@ -57,8 +75,10 @@ export declare function stillwindClassStringMerge(...values: readonly unknown[])
|
|
|
57
75
|
export declare function stillwindClassStringToFragment(value: Record<PropertyKey, unknown>): Record<PropertyKey, unknown>;
|
|
58
76
|
/** Serializes object style declarations or preserves a string. Other inputs omit style. */
|
|
59
77
|
export declare function stillwindClassStringStyleValue(value: unknown): unknown;
|
|
60
|
-
/**
|
|
61
|
-
export declare function
|
|
78
|
+
/** Creates a fragment from forwarded props for a framework without style arrays. */
|
|
79
|
+
export declare function stillwindClassStringForward(value: unknown): Record<PropertyKey, unknown>;
|
|
80
|
+
/** Selects compiled recipe values and returns fresh props with `class` and string styles. */
|
|
81
|
+
export declare function stillwindClassStringRecipe(base?: RecipeValue, config?: CompiledRecipeConfig): RecipeSelector;
|
|
62
82
|
export declare const stillwindClassNameObjectClassKey: unique symbol;
|
|
63
83
|
export declare const stillwindClassNameObjectStyleKey: unique symbol;
|
|
64
84
|
export declare const stillwindClassNameObjectCustomPropertiesKey: unique symbol;
|
|
@@ -68,6 +88,8 @@ export declare function stillwindClassNameObjectMerge(...values: readonly unknow
|
|
|
68
88
|
export declare function stillwindClassNameObjectToFragment(value: Record<PropertyKey, unknown>): Record<PropertyKey, unknown>;
|
|
69
89
|
/** Returns the supplied style payload, or undefined for null or undefined. */
|
|
70
90
|
export declare function stillwindClassNameObjectStyleValue(value: unknown): unknown;
|
|
71
|
-
/**
|
|
72
|
-
export declare function
|
|
73
|
-
|
|
91
|
+
/** Creates a fragment from forwarded props for a framework without style arrays. */
|
|
92
|
+
export declare function stillwindClassNameObjectForward(value: unknown): Record<PropertyKey, unknown>;
|
|
93
|
+
/** Selects compiled recipe values and returns fresh props with `className` and object styles. */
|
|
94
|
+
export declare function stillwindClassNameObjectRecipe(base?: RecipeValue, config?: CompiledRecipeConfig): RecipeSelector;
|
|
95
|
+
//# sourceMappingURL=formats-NBNjMP5R.d.ts.map
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AnchorScope, ContainerType, ContainerVariant, CssWideKeyword,
|
|
1
|
+
import { StyleMacroWithoutForward, StyleProps, StyleResult } from "../class-object-CR0QHoF9.js";
|
|
2
|
+
import { AnchorScope, ContainerType, ContainerVariant, CssWideKeyword, RecipeClassProps, RecipeCompound, RecipeConditions, RecipeConfig, RecipeInput, RecipeResult, RecipeRuleInput, RecipeSelection, RecipeSlotConfig, RecipeSlotInput, RecipeSlotName, RecipeSlotVariants, RecipeSlotVariantsOf, RecipeSlots, RecipeVariants, RefScope, RefVariant, ScopedRefVariant, StillwindClassValue, StillwindDeclarationIdentity, StyleArgument, StyleCssGroup, StyleCssInput, StyleCssOptions, StyleCustomProperties, StyleCustomPropertyValue, StyleForward, StyleForwardProps, StyleKeyframes, StyleKeyframesDefinition, StyleKeyframesFrames, StyleKeyframesUse, StyleMacroWithoutForward as StyleMacroWithoutForward$1, StyleRef, StyleRefProjection, StyleResult as StyleResult$1, StyleStoredVariant, StyleVariant, StyleVariantKey, StyleVariantObject, StyleVariantValue, StyleViewTransition, StyleViewTransitionDefinition, StyleViewTransitionUse, VariantProps, createStyleMacro } from "../index-DpaDcczW.js";
|
|
3
|
+
/** The `style` macro. Elements here receive no component props, so it has no `forward()`. */
|
|
4
|
+
export declare const style: StyleMacroWithoutForward;
|
|
3
5
|
type Alpine = {
|
|
4
6
|
directive(name: string, handler: (element: HTMLElement, directive: {
|
|
5
7
|
expression: string;
|
|
@@ -16,5 +18,5 @@ type Alpine = {
|
|
|
16
18
|
* Updates replace the directive's contribution, and directive removal clears it.
|
|
17
19
|
*/
|
|
18
20
|
export declare function stillwind(alpine: Alpine): void;
|
|
19
|
-
export {
|
|
21
|
+
export type { AnchorScope, ContainerType, ContainerVariant, CssWideKeyword, RecipeClassProps, RecipeCompound, RecipeConditions, RecipeConfig, RecipeInput, RecipeResult, RecipeRuleInput, RecipeSelection, RecipeSlotConfig, RecipeSlotInput, RecipeSlotName, RecipeSlotVariants, RecipeSlotVariantsOf, RecipeSlots, RecipeVariants, RefScope, RefVariant, ScopedRefVariant, StillwindClassValue, StillwindDeclarationIdentity, StyleArgument, StyleCssGroup, StyleCssInput, StyleCssOptions, StyleCustomProperties, StyleCustomPropertyValue, StyleForward, StyleForwardProps, StyleKeyframes, StyleKeyframesDefinition, StyleKeyframesFrames, StyleKeyframesUse, StyleMacroWithoutForward as StyleMacro, StyleMacroWithoutForward$1 as StyleMacroWithoutForward, StyleProps, StyleRef, StyleRefProjection, StyleResult, StyleResult$1 as StyleResultOf, StyleStoredVariant, StyleVariant, StyleVariantKey, StyleVariantObject, StyleVariantValue, StyleViewTransition, StyleViewTransitionDefinition, StyleViewTransitionUse, VariantProps, createStyleMacro };
|
|
20
22
|
//# sourceMappingURL=alpine.d.ts.map
|