@tenphi/tasty 0.0.0-snapshot.2ea241d → 0.0.0-snapshot.2f41cf6
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/dist/{collector-Crs9kGJW.js → collector-BMEQCkCn.js} +3 -3
- package/dist/{collector-Crs9kGJW.js.map → collector-BMEQCkCn.js.map} +1 -1
- package/dist/{config-BaxtQMS3.js → config-eiremPHv.js} +335 -240
- package/dist/config-eiremPHv.js.map +1 -0
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +6 -6
- package/dist/{core-CmxaoZ-N.js → core-Dm9EkOA_.js} +5 -5
- package/dist/core-Dm9EkOA_.js.map +1 -0
- package/dist/{css-writer-CPy_cbFJ.js → css-writer-BSv8PrEX.js} +3 -3
- package/dist/css-writer-BSv8PrEX.js.map +1 -0
- package/dist/{format-rules-CPirO_Mj.js → format-rules-DcFFQceU.js} +2 -2
- package/dist/{format-rules-CPirO_Mj.js.map → format-rules-DcFFQceU.js.map} +1 -1
- package/dist/{hydrate-CVn-A_3y.js → hydrate-B6SjFHhj.js} +2 -2
- package/dist/{hydrate-CVn-A_3y.js.map → hydrate-B6SjFHhj.js.map} +1 -1
- package/dist/{index-B_k47mc_.d.ts → index-D-OA_O6i.d.ts} +95 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/{keyframes-vpzoVdUR.js → keyframes-DJ8Geo4L.js} +10 -3
- package/dist/keyframes-DJ8Geo4L.js.map +1 -0
- package/dist/{merge-styles-BzQutdAK.js → merge-styles-3il_ClCF.js} +2 -2
- package/dist/{merge-styles-BzQutdAK.js.map → merge-styles-3il_ClCF.js.map} +1 -1
- package/dist/{resolve-recipes-DgH8A3Nn.js → resolve-recipes-B3MSkfFQ.js} +3 -3
- package/dist/{resolve-recipes-DgH8A3Nn.js.map → resolve-recipes-B3MSkfFQ.js.map} +1 -1
- package/dist/ssr/astro-client.js +1 -1
- package/dist/ssr/astro.js +3 -3
- package/dist/ssr/index.js +3 -3
- package/dist/ssr/next.js +4 -4
- package/dist/static/index.js +1 -1
- package/dist/zero/babel.js +4 -4
- package/dist/zero/index.js +1 -1
- package/package.json +11 -2
- package/dist/config-BaxtQMS3.js.map +0 -1
- package/dist/core-CmxaoZ-N.js.map +0 -1
- package/dist/css-writer-CPy_cbFJ.js.map +0 -1
- package/dist/keyframes-vpzoVdUR.js.map +0 -1
|
@@ -55,6 +55,223 @@ function canonicalFuncName(lowered) {
|
|
|
55
55
|
return CANONICAL_FUNC_CASE.get(lowered) ?? lowered;
|
|
56
56
|
}
|
|
57
57
|
//#endregion
|
|
58
|
+
//#region src/properties/index.ts
|
|
59
|
+
const PROPERTIES_KEY = "@properties";
|
|
60
|
+
/**
|
|
61
|
+
* Valid CSS custom property name pattern (after the -- prefix).
|
|
62
|
+
* Must start with a letter or underscore, followed by letters, digits, hyphens, or underscores.
|
|
63
|
+
*/
|
|
64
|
+
const VALID_PROPERTY_NAME_PATTERN = /^[a-z_][a-z0-9-_]*$/i;
|
|
65
|
+
/**
|
|
66
|
+
* Validate a CSS custom property name (the part after --).
|
|
67
|
+
* Returns true if the name is valid for use as a CSS custom property.
|
|
68
|
+
*/
|
|
69
|
+
function isValidPropertyName(name) {
|
|
70
|
+
return VALID_PROPERTY_NAME_PATTERN.test(name);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Check if styles object has local @properties definition.
|
|
74
|
+
* Fast path: single property lookup.
|
|
75
|
+
*/
|
|
76
|
+
function hasLocalProperties(styles) {
|
|
77
|
+
return PROPERTIES_KEY in styles;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Extract local @properties from styles object.
|
|
81
|
+
* Returns null if no local properties (fast path).
|
|
82
|
+
*/
|
|
83
|
+
function extractLocalProperties(styles) {
|
|
84
|
+
const properties = styles[PROPERTIES_KEY];
|
|
85
|
+
if (!properties || typeof properties !== "object") return null;
|
|
86
|
+
return properties;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Parse a property token name and return the CSS property name and whether it's a color.
|
|
90
|
+
* Supports tasty token syntax and validates the property name.
|
|
91
|
+
*
|
|
92
|
+
* Token formats:
|
|
93
|
+
* - `$name` → { cssName: '--name', isColor: false }
|
|
94
|
+
* - `#name` → { cssName: '--name-color', isColor: true }
|
|
95
|
+
* - `--name` → { cssName: '--name', isColor: false } (legacy, auto-detect color by suffix)
|
|
96
|
+
* - `name` → { cssName: '--name', isColor: false } (legacy)
|
|
97
|
+
*
|
|
98
|
+
* @param token - The property token to parse
|
|
99
|
+
* @returns Parsed result with cssName, isColor, isValid, and optional error
|
|
100
|
+
*/
|
|
101
|
+
function parsePropertyToken(token) {
|
|
102
|
+
if (!token || typeof token !== "string") return {
|
|
103
|
+
cssName: "",
|
|
104
|
+
isColor: false,
|
|
105
|
+
isValid: false,
|
|
106
|
+
error: "Property token must be a non-empty string"
|
|
107
|
+
};
|
|
108
|
+
let name;
|
|
109
|
+
let isColor;
|
|
110
|
+
if (token.startsWith("$")) {
|
|
111
|
+
name = token.slice(1);
|
|
112
|
+
isColor = false;
|
|
113
|
+
} else if (token.startsWith("#")) {
|
|
114
|
+
name = token.slice(1);
|
|
115
|
+
isColor = true;
|
|
116
|
+
} else if (token.startsWith("--")) {
|
|
117
|
+
name = token.slice(2);
|
|
118
|
+
isColor = token.endsWith("-color");
|
|
119
|
+
} else {
|
|
120
|
+
name = token;
|
|
121
|
+
isColor = token.endsWith("-color");
|
|
122
|
+
}
|
|
123
|
+
if (!name) return {
|
|
124
|
+
cssName: "",
|
|
125
|
+
isColor,
|
|
126
|
+
isValid: false,
|
|
127
|
+
error: "Property name cannot be empty"
|
|
128
|
+
};
|
|
129
|
+
if (!isValidPropertyName(name)) return {
|
|
130
|
+
cssName: "",
|
|
131
|
+
isColor,
|
|
132
|
+
isValid: false,
|
|
133
|
+
error: `Invalid property name "${name}". Must start with a letter or underscore, followed by letters, digits, hyphens, or underscores.`
|
|
134
|
+
};
|
|
135
|
+
let cssName;
|
|
136
|
+
if (token.startsWith("#")) cssName = `--${name}-color`;
|
|
137
|
+
else cssName = `--${name}`;
|
|
138
|
+
return {
|
|
139
|
+
cssName,
|
|
140
|
+
isColor,
|
|
141
|
+
isValid: true
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Normalize a property definition to a consistent string representation.
|
|
146
|
+
* Used for comparing definitions to detect type conflicts.
|
|
147
|
+
*
|
|
148
|
+
* Only `syntax` and `inherits` are compared — `initialValue` is intentionally
|
|
149
|
+
* excluded because different components may set different defaults for the
|
|
150
|
+
* same typed property (e.g. auto-inferred `0px` vs explicit `6px`).
|
|
151
|
+
*
|
|
152
|
+
* Keys are sorted alphabetically to ensure consistent comparison:
|
|
153
|
+
* { inherits: true, syntax: '<color>' } === { syntax: '<color>', inherits: true }
|
|
154
|
+
*/
|
|
155
|
+
function normalizePropertyDefinition(def) {
|
|
156
|
+
const normalized = {};
|
|
157
|
+
if (def.inherits !== void 0) normalized.inherits = def.inherits;
|
|
158
|
+
if (def.syntax !== void 0) normalized.syntax = def.syntax;
|
|
159
|
+
return JSON.stringify(normalized);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Get the effective property definition for a token.
|
|
163
|
+
* For color tokens (#name), auto-sets syntax to '<color>' and defaults initialValue to 'transparent'.
|
|
164
|
+
*
|
|
165
|
+
* @param token - Property token ($name, #name, --name, or plain name)
|
|
166
|
+
* @param userDefinition - User-provided definition options
|
|
167
|
+
* @returns Effective definition with cssName, definition, isValid, and optional error
|
|
168
|
+
*/
|
|
169
|
+
function getEffectiveDefinition(token, userDefinition) {
|
|
170
|
+
const parsed = parsePropertyToken(token);
|
|
171
|
+
if (!parsed.isValid) return {
|
|
172
|
+
cssName: "",
|
|
173
|
+
definition: userDefinition,
|
|
174
|
+
isColor: false,
|
|
175
|
+
isValid: false,
|
|
176
|
+
error: parsed.error
|
|
177
|
+
};
|
|
178
|
+
if (parsed.isColor) return {
|
|
179
|
+
cssName: parsed.cssName,
|
|
180
|
+
definition: {
|
|
181
|
+
syntax: "<color>",
|
|
182
|
+
inherits: userDefinition.inherits,
|
|
183
|
+
initialValue: userDefinition.initialValue ?? "transparent"
|
|
184
|
+
},
|
|
185
|
+
isColor: true,
|
|
186
|
+
isValid: true
|
|
187
|
+
};
|
|
188
|
+
return {
|
|
189
|
+
cssName: parsed.cssName,
|
|
190
|
+
definition: userDefinition,
|
|
191
|
+
isColor: false,
|
|
192
|
+
isValid: true
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
const UNIT_TO_SYNTAX = {};
|
|
196
|
+
const LENGTH_UNITS = [
|
|
197
|
+
"px",
|
|
198
|
+
"em",
|
|
199
|
+
"rem",
|
|
200
|
+
"vw",
|
|
201
|
+
"vh",
|
|
202
|
+
"vmin",
|
|
203
|
+
"vmax",
|
|
204
|
+
"ch",
|
|
205
|
+
"ex",
|
|
206
|
+
"cap",
|
|
207
|
+
"ic",
|
|
208
|
+
"lh",
|
|
209
|
+
"rlh",
|
|
210
|
+
"svw",
|
|
211
|
+
"svh",
|
|
212
|
+
"lvw",
|
|
213
|
+
"lvh",
|
|
214
|
+
"dvw",
|
|
215
|
+
"dvh",
|
|
216
|
+
"cqw",
|
|
217
|
+
"cqh",
|
|
218
|
+
"cqi",
|
|
219
|
+
"cqb",
|
|
220
|
+
"cqmin",
|
|
221
|
+
"cqmax"
|
|
222
|
+
];
|
|
223
|
+
const ANGLE_UNITS = [
|
|
224
|
+
"deg",
|
|
225
|
+
"rad",
|
|
226
|
+
"grad",
|
|
227
|
+
"turn"
|
|
228
|
+
];
|
|
229
|
+
const TIME_UNITS = ["ms", "s"];
|
|
230
|
+
for (const u of LENGTH_UNITS) UNIT_TO_SYNTAX[u] = {
|
|
231
|
+
syntax: "<length-percentage>",
|
|
232
|
+
initialValue: "0px"
|
|
233
|
+
};
|
|
234
|
+
UNIT_TO_SYNTAX["%"] = {
|
|
235
|
+
syntax: "<length-percentage>",
|
|
236
|
+
initialValue: "0px"
|
|
237
|
+
};
|
|
238
|
+
for (const u of ANGLE_UNITS) UNIT_TO_SYNTAX[u] = {
|
|
239
|
+
syntax: "<angle>",
|
|
240
|
+
initialValue: "0deg"
|
|
241
|
+
};
|
|
242
|
+
for (const u of TIME_UNITS) UNIT_TO_SYNTAX[u] = {
|
|
243
|
+
syntax: "<time>",
|
|
244
|
+
initialValue: "0s"
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* Infer CSS @property syntax from a concrete value.
|
|
248
|
+
* Detects numeric types: \<number\>, \<length-percentage\>, \<angle\>, \<time\>.
|
|
249
|
+
* Length and percentage values both map to \<length-percentage\> for maximum flexibility.
|
|
250
|
+
* Color properties are handled separately via the #name token convention
|
|
251
|
+
* (--name-color gets \<color\> syntax automatically in getEffectiveDefinition).
|
|
252
|
+
*
|
|
253
|
+
* @param value - The CSS value to infer from (e.g. '10px', '1', '45deg')
|
|
254
|
+
* @returns Inferred syntax and initial value, or null if not inferable
|
|
255
|
+
*/
|
|
256
|
+
function inferSyntaxFromValue(value) {
|
|
257
|
+
if (!value || typeof value !== "string") return null;
|
|
258
|
+
const trimmed = value.trim();
|
|
259
|
+
if (!trimmed) return null;
|
|
260
|
+
if (RE_NUMBER.test(trimmed)) {
|
|
261
|
+
if (parseFloat(trimmed) === 0) return null;
|
|
262
|
+
return {
|
|
263
|
+
syntax: "<number>",
|
|
264
|
+
initialValue: "0"
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
const unitMatch = trimmed.match(RE_RAW_UNIT);
|
|
268
|
+
if (unitMatch) {
|
|
269
|
+
const mapping = UNIT_TO_SYNTAX[unitMatch[2]];
|
|
270
|
+
if (mapping) return mapping;
|
|
271
|
+
}
|
|
272
|
+
return null;
|
|
273
|
+
}
|
|
274
|
+
//#endregion
|
|
58
275
|
//#region src/parser/lru.ts
|
|
59
276
|
var Lru = class {
|
|
60
277
|
limit;
|
|
@@ -1131,223 +1348,6 @@ function getComponentPropertySyntax() {
|
|
|
1131
1348
|
}
|
|
1132
1349
|
}
|
|
1133
1350
|
//#endregion
|
|
1134
|
-
//#region src/properties/index.ts
|
|
1135
|
-
const PROPERTIES_KEY = "@properties";
|
|
1136
|
-
/**
|
|
1137
|
-
* Valid CSS custom property name pattern (after the -- prefix).
|
|
1138
|
-
* Must start with a letter or underscore, followed by letters, digits, hyphens, or underscores.
|
|
1139
|
-
*/
|
|
1140
|
-
const VALID_PROPERTY_NAME_PATTERN = /^[a-z_][a-z0-9-_]*$/i;
|
|
1141
|
-
/**
|
|
1142
|
-
* Validate a CSS custom property name (the part after --).
|
|
1143
|
-
* Returns true if the name is valid for use as a CSS custom property.
|
|
1144
|
-
*/
|
|
1145
|
-
function isValidPropertyName(name) {
|
|
1146
|
-
return VALID_PROPERTY_NAME_PATTERN.test(name);
|
|
1147
|
-
}
|
|
1148
|
-
/**
|
|
1149
|
-
* Check if styles object has local @properties definition.
|
|
1150
|
-
* Fast path: single property lookup.
|
|
1151
|
-
*/
|
|
1152
|
-
function hasLocalProperties(styles) {
|
|
1153
|
-
return PROPERTIES_KEY in styles;
|
|
1154
|
-
}
|
|
1155
|
-
/**
|
|
1156
|
-
* Extract local @properties from styles object.
|
|
1157
|
-
* Returns null if no local properties (fast path).
|
|
1158
|
-
*/
|
|
1159
|
-
function extractLocalProperties(styles) {
|
|
1160
|
-
const properties = styles[PROPERTIES_KEY];
|
|
1161
|
-
if (!properties || typeof properties !== "object") return null;
|
|
1162
|
-
return properties;
|
|
1163
|
-
}
|
|
1164
|
-
/**
|
|
1165
|
-
* Parse a property token name and return the CSS property name and whether it's a color.
|
|
1166
|
-
* Supports tasty token syntax and validates the property name.
|
|
1167
|
-
*
|
|
1168
|
-
* Token formats:
|
|
1169
|
-
* - `$name` → { cssName: '--name', isColor: false }
|
|
1170
|
-
* - `#name` → { cssName: '--name-color', isColor: true }
|
|
1171
|
-
* - `--name` → { cssName: '--name', isColor: false } (legacy, auto-detect color by suffix)
|
|
1172
|
-
* - `name` → { cssName: '--name', isColor: false } (legacy)
|
|
1173
|
-
*
|
|
1174
|
-
* @param token - The property token to parse
|
|
1175
|
-
* @returns Parsed result with cssName, isColor, isValid, and optional error
|
|
1176
|
-
*/
|
|
1177
|
-
function parsePropertyToken(token) {
|
|
1178
|
-
if (!token || typeof token !== "string") return {
|
|
1179
|
-
cssName: "",
|
|
1180
|
-
isColor: false,
|
|
1181
|
-
isValid: false,
|
|
1182
|
-
error: "Property token must be a non-empty string"
|
|
1183
|
-
};
|
|
1184
|
-
let name;
|
|
1185
|
-
let isColor;
|
|
1186
|
-
if (token.startsWith("$")) {
|
|
1187
|
-
name = token.slice(1);
|
|
1188
|
-
isColor = false;
|
|
1189
|
-
} else if (token.startsWith("#")) {
|
|
1190
|
-
name = token.slice(1);
|
|
1191
|
-
isColor = true;
|
|
1192
|
-
} else if (token.startsWith("--")) {
|
|
1193
|
-
name = token.slice(2);
|
|
1194
|
-
isColor = token.endsWith("-color");
|
|
1195
|
-
} else {
|
|
1196
|
-
name = token;
|
|
1197
|
-
isColor = token.endsWith("-color");
|
|
1198
|
-
}
|
|
1199
|
-
if (!name) return {
|
|
1200
|
-
cssName: "",
|
|
1201
|
-
isColor,
|
|
1202
|
-
isValid: false,
|
|
1203
|
-
error: "Property name cannot be empty"
|
|
1204
|
-
};
|
|
1205
|
-
if (!isValidPropertyName(name)) return {
|
|
1206
|
-
cssName: "",
|
|
1207
|
-
isColor,
|
|
1208
|
-
isValid: false,
|
|
1209
|
-
error: `Invalid property name "${name}". Must start with a letter or underscore, followed by letters, digits, hyphens, or underscores.`
|
|
1210
|
-
};
|
|
1211
|
-
let cssName;
|
|
1212
|
-
if (token.startsWith("#")) cssName = `--${name}-color`;
|
|
1213
|
-
else cssName = `--${name}`;
|
|
1214
|
-
return {
|
|
1215
|
-
cssName,
|
|
1216
|
-
isColor,
|
|
1217
|
-
isValid: true
|
|
1218
|
-
};
|
|
1219
|
-
}
|
|
1220
|
-
/**
|
|
1221
|
-
* Normalize a property definition to a consistent string representation.
|
|
1222
|
-
* Used for comparing definitions to detect type conflicts.
|
|
1223
|
-
*
|
|
1224
|
-
* Only `syntax` and `inherits` are compared — `initialValue` is intentionally
|
|
1225
|
-
* excluded because different components may set different defaults for the
|
|
1226
|
-
* same typed property (e.g. auto-inferred `0px` vs explicit `6px`).
|
|
1227
|
-
*
|
|
1228
|
-
* Keys are sorted alphabetically to ensure consistent comparison:
|
|
1229
|
-
* { inherits: true, syntax: '<color>' } === { syntax: '<color>', inherits: true }
|
|
1230
|
-
*/
|
|
1231
|
-
function normalizePropertyDefinition(def) {
|
|
1232
|
-
const normalized = {};
|
|
1233
|
-
if (def.inherits !== void 0) normalized.inherits = def.inherits;
|
|
1234
|
-
if (def.syntax !== void 0) normalized.syntax = def.syntax;
|
|
1235
|
-
return JSON.stringify(normalized);
|
|
1236
|
-
}
|
|
1237
|
-
/**
|
|
1238
|
-
* Get the effective property definition for a token.
|
|
1239
|
-
* For color tokens (#name), auto-sets syntax to '<color>' and defaults initialValue to 'transparent'.
|
|
1240
|
-
*
|
|
1241
|
-
* @param token - Property token ($name, #name, --name, or plain name)
|
|
1242
|
-
* @param userDefinition - User-provided definition options
|
|
1243
|
-
* @returns Effective definition with cssName, definition, isValid, and optional error
|
|
1244
|
-
*/
|
|
1245
|
-
function getEffectiveDefinition(token, userDefinition) {
|
|
1246
|
-
const parsed = parsePropertyToken(token);
|
|
1247
|
-
if (!parsed.isValid) return {
|
|
1248
|
-
cssName: "",
|
|
1249
|
-
definition: userDefinition,
|
|
1250
|
-
isColor: false,
|
|
1251
|
-
isValid: false,
|
|
1252
|
-
error: parsed.error
|
|
1253
|
-
};
|
|
1254
|
-
if (parsed.isColor) return {
|
|
1255
|
-
cssName: parsed.cssName,
|
|
1256
|
-
definition: {
|
|
1257
|
-
syntax: "<color>",
|
|
1258
|
-
inherits: userDefinition.inherits,
|
|
1259
|
-
initialValue: userDefinition.initialValue ?? "transparent"
|
|
1260
|
-
},
|
|
1261
|
-
isColor: true,
|
|
1262
|
-
isValid: true
|
|
1263
|
-
};
|
|
1264
|
-
return {
|
|
1265
|
-
cssName: parsed.cssName,
|
|
1266
|
-
definition: userDefinition,
|
|
1267
|
-
isColor: false,
|
|
1268
|
-
isValid: true
|
|
1269
|
-
};
|
|
1270
|
-
}
|
|
1271
|
-
const UNIT_TO_SYNTAX = {};
|
|
1272
|
-
const LENGTH_UNITS = [
|
|
1273
|
-
"px",
|
|
1274
|
-
"em",
|
|
1275
|
-
"rem",
|
|
1276
|
-
"vw",
|
|
1277
|
-
"vh",
|
|
1278
|
-
"vmin",
|
|
1279
|
-
"vmax",
|
|
1280
|
-
"ch",
|
|
1281
|
-
"ex",
|
|
1282
|
-
"cap",
|
|
1283
|
-
"ic",
|
|
1284
|
-
"lh",
|
|
1285
|
-
"rlh",
|
|
1286
|
-
"svw",
|
|
1287
|
-
"svh",
|
|
1288
|
-
"lvw",
|
|
1289
|
-
"lvh",
|
|
1290
|
-
"dvw",
|
|
1291
|
-
"dvh",
|
|
1292
|
-
"cqw",
|
|
1293
|
-
"cqh",
|
|
1294
|
-
"cqi",
|
|
1295
|
-
"cqb",
|
|
1296
|
-
"cqmin",
|
|
1297
|
-
"cqmax"
|
|
1298
|
-
];
|
|
1299
|
-
const ANGLE_UNITS = [
|
|
1300
|
-
"deg",
|
|
1301
|
-
"rad",
|
|
1302
|
-
"grad",
|
|
1303
|
-
"turn"
|
|
1304
|
-
];
|
|
1305
|
-
const TIME_UNITS = ["ms", "s"];
|
|
1306
|
-
for (const u of LENGTH_UNITS) UNIT_TO_SYNTAX[u] = {
|
|
1307
|
-
syntax: "<length-percentage>",
|
|
1308
|
-
initialValue: "0px"
|
|
1309
|
-
};
|
|
1310
|
-
UNIT_TO_SYNTAX["%"] = {
|
|
1311
|
-
syntax: "<length-percentage>",
|
|
1312
|
-
initialValue: "0px"
|
|
1313
|
-
};
|
|
1314
|
-
for (const u of ANGLE_UNITS) UNIT_TO_SYNTAX[u] = {
|
|
1315
|
-
syntax: "<angle>",
|
|
1316
|
-
initialValue: "0deg"
|
|
1317
|
-
};
|
|
1318
|
-
for (const u of TIME_UNITS) UNIT_TO_SYNTAX[u] = {
|
|
1319
|
-
syntax: "<time>",
|
|
1320
|
-
initialValue: "0s"
|
|
1321
|
-
};
|
|
1322
|
-
/**
|
|
1323
|
-
* Infer CSS @property syntax from a concrete value.
|
|
1324
|
-
* Detects numeric types: \<number\>, \<length-percentage\>, \<angle\>, \<time\>.
|
|
1325
|
-
* Length and percentage values both map to \<length-percentage\> for maximum flexibility.
|
|
1326
|
-
* Color properties are handled separately via the #name token convention
|
|
1327
|
-
* (--name-color gets \<color\> syntax automatically in getEffectiveDefinition).
|
|
1328
|
-
*
|
|
1329
|
-
* @param value - The CSS value to infer from (e.g. '10px', '1', '45deg')
|
|
1330
|
-
* @returns Inferred syntax and initial value, or null if not inferable
|
|
1331
|
-
*/
|
|
1332
|
-
function inferSyntaxFromValue(value) {
|
|
1333
|
-
if (!value || typeof value !== "string") return null;
|
|
1334
|
-
const trimmed = value.trim();
|
|
1335
|
-
if (!trimmed) return null;
|
|
1336
|
-
if (RE_NUMBER.test(trimmed)) {
|
|
1337
|
-
if (parseFloat(trimmed) === 0) return null;
|
|
1338
|
-
return {
|
|
1339
|
-
syntax: "<number>",
|
|
1340
|
-
initialValue: "0"
|
|
1341
|
-
};
|
|
1342
|
-
}
|
|
1343
|
-
const unitMatch = trimmed.match(RE_RAW_UNIT);
|
|
1344
|
-
if (unitMatch) {
|
|
1345
|
-
const mapping = UNIT_TO_SYNTAX[unitMatch[2]];
|
|
1346
|
-
if (mapping) return mapping;
|
|
1347
|
-
}
|
|
1348
|
-
return null;
|
|
1349
|
-
}
|
|
1350
|
-
//#endregion
|
|
1351
1351
|
//#region src/utils/hash.ts
|
|
1352
1352
|
/**
|
|
1353
1353
|
* Fast string hash (djb2) for deduplication keys.
|
|
@@ -3783,7 +3783,7 @@ function resetHandlers() {
|
|
|
3783
3783
|
for (const key of Object.keys(STYLE_HANDLER_MAP$1)) delete STYLE_HANDLER_MAP$1[key];
|
|
3784
3784
|
for (const key of Object.keys(initialHandlerMapSnapshot)) STYLE_HANDLER_MAP$1[key] = [...initialHandlerMapSnapshot[key]];
|
|
3785
3785
|
}
|
|
3786
|
-
function defineCustomStyle
|
|
3786
|
+
function defineCustomStyle(names, handler) {
|
|
3787
3787
|
let handlerWithLookup;
|
|
3788
3788
|
if (typeof names === "function") {
|
|
3789
3789
|
handlerWithLookup = names;
|
|
@@ -3798,16 +3798,16 @@ function defineCustomStyle$1(names, handler) {
|
|
|
3798
3798
|
STYLE_HANDLER_MAP$1[name].push(handlerWithLookup);
|
|
3799
3799
|
});
|
|
3800
3800
|
}
|
|
3801
|
-
function defineStyleAlias
|
|
3801
|
+
function defineStyleAlias(styleName, cssStyleName, converter) {
|
|
3802
3802
|
const styleHandler = createStyle(styleName, cssStyleName, converter);
|
|
3803
3803
|
if (!STYLE_HANDLER_MAP$1[styleName]) STYLE_HANDLER_MAP$1[styleName] = [];
|
|
3804
3804
|
STYLE_HANDLER_MAP$1[styleName].push(styleHandler);
|
|
3805
3805
|
}
|
|
3806
3806
|
function predefine() {
|
|
3807
|
-
defineStyleAlias
|
|
3808
|
-
defineStyleAlias
|
|
3809
|
-
defineStyleAlias
|
|
3810
|
-
defineStyleAlias
|
|
3807
|
+
defineStyleAlias("gridAreas", "grid-template-areas");
|
|
3808
|
+
defineStyleAlias("gridColumns", "grid-template-columns", columnsConverter);
|
|
3809
|
+
defineStyleAlias("gridRows", "grid-template-rows", rowsConverter);
|
|
3810
|
+
defineStyleAlias("gridTemplate", "grid-template", (val) => {
|
|
3811
3811
|
if (typeof val !== "string") return;
|
|
3812
3812
|
return val.split("/").map((s, i) => (i ? columnsConverter : rowsConverter)(s)).join("/");
|
|
3813
3813
|
});
|
|
@@ -3833,12 +3833,12 @@ function predefine() {
|
|
|
3833
3833
|
scrollbarStyle,
|
|
3834
3834
|
fadeStyle,
|
|
3835
3835
|
insetStyle
|
|
3836
|
-
].forEach((handler) => defineCustomStyle
|
|
3836
|
+
].forEach((handler) => defineCustomStyle(handler));
|
|
3837
3837
|
captureInitialHandlerState();
|
|
3838
3838
|
return {
|
|
3839
3839
|
STYLE_HANDLER_MAP: STYLE_HANDLER_MAP$1,
|
|
3840
|
-
defineCustomStyle
|
|
3841
|
-
defineStyleAlias
|
|
3840
|
+
defineCustomStyle,
|
|
3841
|
+
defineStyleAlias
|
|
3842
3842
|
};
|
|
3843
3843
|
}
|
|
3844
3844
|
/**
|
|
@@ -3969,7 +3969,7 @@ const styleHandlers = {
|
|
|
3969
3969
|
};
|
|
3970
3970
|
//#endregion
|
|
3971
3971
|
//#region src/styles/index.ts
|
|
3972
|
-
const { STYLE_HANDLER_MAP
|
|
3972
|
+
const { STYLE_HANDLER_MAP } = predefine();
|
|
3973
3973
|
//#endregion
|
|
3974
3974
|
//#region src/injector/sheet-manager.ts
|
|
3975
3975
|
const supportsConstructableSheets = typeof CSSStyleSheet !== "undefined" && (() => {
|
|
@@ -6205,9 +6205,13 @@ function simplifyInner(node) {
|
|
|
6205
6205
|
return node;
|
|
6206
6206
|
}
|
|
6207
6207
|
if (node.kind === "compound") {
|
|
6208
|
+
const key = getConditionUniqueId(node);
|
|
6209
|
+
const cached = simplifyCache.get(key);
|
|
6210
|
+
if (cached) return cached;
|
|
6208
6211
|
const simplifiedChildren = node.children.map((c) => simplifyInner(c));
|
|
6209
|
-
|
|
6210
|
-
|
|
6212
|
+
const result = node.operator === "AND" ? simplifyAnd(simplifiedChildren) : simplifyOr(simplifiedChildren);
|
|
6213
|
+
simplifyCache.set(key, result);
|
|
6214
|
+
return result;
|
|
6211
6215
|
}
|
|
6212
6216
|
return node;
|
|
6213
6217
|
}
|
|
@@ -6225,13 +6229,23 @@ function simplifyAnd(children) {
|
|
|
6225
6229
|
if (hasRangeContradiction(terms)) return falseCondition();
|
|
6226
6230
|
if (hasAttributeConflict(terms)) return falseCondition();
|
|
6227
6231
|
if (hasContainerStyleConflict(terms)) return falseCondition();
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6232
|
+
const MAX_SIMPLIFY_PASSES = 4;
|
|
6233
|
+
for (let pass = 0; pass < MAX_SIMPLIFY_PASSES; pass++) {
|
|
6234
|
+
const lengthBefore = terms.length;
|
|
6235
|
+
const keyBefore = simplifyTermsKey(terms);
|
|
6236
|
+
terms = removeImpliedNegations(terms);
|
|
6237
|
+
terms = deduplicateTerms(terms);
|
|
6238
|
+
terms = mergeRanges(terms);
|
|
6239
|
+
terms = sortTerms(terms);
|
|
6240
|
+
terms = applyAbsorptionAnd(terms);
|
|
6241
|
+
terms = applyConsensusAnd(terms);
|
|
6242
|
+
terms = pruneContradictedOrBranches(terms);
|
|
6243
|
+
if (terms.length === 0) break;
|
|
6244
|
+
if (terms.length === 1) break;
|
|
6245
|
+
if (hasContradiction(terms)) return falseCondition();
|
|
6246
|
+
if (hasAttributeConflict(terms)) return falseCondition();
|
|
6247
|
+
if (terms.length === lengthBefore && simplifyTermsKey(terms) === keyBefore) break;
|
|
6248
|
+
}
|
|
6235
6249
|
if (terms.length === 0) return trueCondition();
|
|
6236
6250
|
if (terms.length === 1) return terms[0];
|
|
6237
6251
|
return {
|
|
@@ -6546,6 +6560,13 @@ function removeImpliedNegations(terms) {
|
|
|
6546
6560
|
const isImplied = buildImpliedNegationCheck(terms);
|
|
6547
6561
|
return terms.filter((t) => !isImplied(t));
|
|
6548
6562
|
}
|
|
6563
|
+
/**
|
|
6564
|
+
* Build a stable, order-insensitive key for a list of AND terms.
|
|
6565
|
+
* Used to detect fixpoint convergence in `simplifyAnd`.
|
|
6566
|
+
*/
|
|
6567
|
+
function simplifyTermsKey(terms) {
|
|
6568
|
+
return terms.map((t) => getConditionUniqueId(t)).sort().join("&");
|
|
6569
|
+
}
|
|
6549
6570
|
function deduplicateTerms(terms) {
|
|
6550
6571
|
const seen = /* @__PURE__ */ new Set();
|
|
6551
6572
|
const result = [];
|
|
@@ -7936,7 +7957,69 @@ function branchesProduceDifferentContexts(branches) {
|
|
|
7936
7957
|
* so here we just collect all variants. Any remaining ORs in the condition
|
|
7937
7958
|
* tree (e.g., from De Morgan expansion) are handled as simple alternatives.
|
|
7938
7959
|
*/
|
|
7960
|
+
/**
|
|
7961
|
+
* Serialize a single negated own-element selector leaf (modifier or pseudo)
|
|
7962
|
+
* to its *positive* selector string, for use inside a combined `:not(...)`.
|
|
7963
|
+
*
|
|
7964
|
+
* Returns `null` when the node is not a negated, own-element selector leaf
|
|
7965
|
+
* (e.g. positive, or a media/container/parent/root/own/supports/starting
|
|
7966
|
+
* wrapper, or a compound), which means it cannot participate in De Morgan
|
|
7967
|
+
* recombination.
|
|
7968
|
+
*/
|
|
7969
|
+
function negatedSelectorLeafToPositiveSelector(node) {
|
|
7970
|
+
if (node.kind !== "state" || !node.negated) return null;
|
|
7971
|
+
if (node.type === "modifier") return modifierToCSS({
|
|
7972
|
+
attribute: node.attribute,
|
|
7973
|
+
value: node.value,
|
|
7974
|
+
operator: node.operator,
|
|
7975
|
+
negated: false
|
|
7976
|
+
});
|
|
7977
|
+
if (node.type === "pseudo") {
|
|
7978
|
+
const p = node.pseudo;
|
|
7979
|
+
if ((p.startsWith(":is(") || p.startsWith(":where(")) && !p.includes(",")) {
|
|
7980
|
+
const inner = p.slice(p.indexOf("(") + 1, -1);
|
|
7981
|
+
if (!/\s/.test(inner)) return inner;
|
|
7982
|
+
return `:is(${inner})`;
|
|
7983
|
+
}
|
|
7984
|
+
return p;
|
|
7985
|
+
}
|
|
7986
|
+
return null;
|
|
7987
|
+
}
|
|
7988
|
+
/**
|
|
7989
|
+
* De Morgan recombination for an OR whose every branch is a negated
|
|
7990
|
+
* own-element selector leaf:
|
|
7991
|
+
*
|
|
7992
|
+
* OR(¬a, ¬b, ¬c) ≡ ¬(a ∧ b ∧ c) → single `:not(a b c)`
|
|
7993
|
+
*
|
|
7994
|
+
* This keeps the catch-all/default exclusive condition (which has no
|
|
7995
|
+
* positive terms to prune against) from exploding into a Cartesian product
|
|
7996
|
+
* of OR branches at `andToCSS`. Returns `null` when recombination does not
|
|
7997
|
+
* apply, so genuine unions (e.g. `:hover | :focus`) fall through to the
|
|
7998
|
+
* normal per-branch materialization.
|
|
7999
|
+
*/
|
|
8000
|
+
function tryRecombineNegatedSelectorOr(children) {
|
|
8001
|
+
if (children.length < 2) return null;
|
|
8002
|
+
const positiveSelectors = [];
|
|
8003
|
+
for (const child of children) {
|
|
8004
|
+
const sel = negatedSelectorLeafToPositiveSelector(child);
|
|
8005
|
+
if (sel === null) return null;
|
|
8006
|
+
positiveSelectors.push(sel);
|
|
8007
|
+
}
|
|
8008
|
+
positiveSelectors.sort();
|
|
8009
|
+
const compound = positiveSelectors.join("");
|
|
8010
|
+
const v = emptyVariant();
|
|
8011
|
+
v.pseudoConditions.push({
|
|
8012
|
+
pseudo: `:is(${compound})`,
|
|
8013
|
+
negated: true
|
|
8014
|
+
});
|
|
8015
|
+
return {
|
|
8016
|
+
variants: [v],
|
|
8017
|
+
isImpossible: false
|
|
8018
|
+
};
|
|
8019
|
+
}
|
|
7939
8020
|
function orToCSS(children) {
|
|
8021
|
+
const recombined = tryRecombineNegatedSelectorOr(children);
|
|
8022
|
+
if (recombined !== null) return recombined;
|
|
7940
8023
|
const allVariants = [];
|
|
7941
8024
|
for (const child of children) {
|
|
7942
8025
|
const childCSS = conditionToCSSInner(child);
|
|
@@ -8165,7 +8248,11 @@ function buildExclusiveConditions(entries) {
|
|
|
8165
8248
|
const priorConditions = [];
|
|
8166
8249
|
for (const entry of entries) {
|
|
8167
8250
|
let exclusive = entry.condition;
|
|
8168
|
-
for (const prior of priorConditions)
|
|
8251
|
+
for (const prior of priorConditions) {
|
|
8252
|
+
if (prior.kind === "true") continue;
|
|
8253
|
+
if (entry.condition.kind !== "true" && simplifyCondition(and(entry.condition, prior)).kind === "false") continue;
|
|
8254
|
+
exclusive = and(exclusive, not(prior));
|
|
8255
|
+
}
|
|
8169
8256
|
const simplified = simplifyCondition(exclusive);
|
|
8170
8257
|
if (simplified.kind === "false") continue;
|
|
8171
8258
|
result.push({
|
|
@@ -8827,7 +8914,15 @@ var Parser = class {
|
|
|
8827
8914
|
return createPseudoCondition(value, false, value);
|
|
8828
8915
|
}
|
|
8829
8916
|
if (value.startsWith(".")) return createPseudoCondition(value, false, value);
|
|
8830
|
-
if (value.startsWith("["))
|
|
8917
|
+
if (value.startsWith("[")) {
|
|
8918
|
+
const attrMatch = /^\[\s*([a-zA-Z_][\w-]*)\s*(?:(=|\^=|\$=|\*=)\s*(?:"([^"]*)"|'([^']*)'|([^\]\s]+)))?\s*\]$/.exec(value);
|
|
8919
|
+
if (attrMatch) {
|
|
8920
|
+
const [, attribute, operator, dq, sq, bare] = attrMatch;
|
|
8921
|
+
if (operator === void 0) return createModifierCondition(attribute, void 0, "=", false, value);
|
|
8922
|
+
return createModifierCondition(attribute, dq ?? sq ?? bare, operator, false, value);
|
|
8923
|
+
}
|
|
8924
|
+
return createPseudoCondition(value, false, value);
|
|
8925
|
+
}
|
|
8831
8926
|
if (value.includes("=")) return this.parseValueModifier(value);
|
|
8832
8927
|
return this.parseBooleanModifier(value);
|
|
8833
8928
|
}
|
|
@@ -10459,6 +10554,6 @@ function resetConfig() {
|
|
|
10459
10554
|
delete storage[GLOBAL_INJECTOR_KEY];
|
|
10460
10555
|
}
|
|
10461
10556
|
//#endregion
|
|
10462
|
-
export { parseColor as $, StyleInjector as A,
|
|
10557
|
+
export { parseColor as $, StyleInjector as A, hasLocalProperties as At, styleHandlers as B, parseStateKey as C, getRgbValuesFromRgbaString as Ct, extractPredefinedStateRefs as D, Lru as Dt, extractLocalPredefinedStates as E, strToRgb as Et, fontFaceContentHash as F, CUSTOM_UNITS as G, warn as H, formatFontFaceRule as I, filterMods as J, DIRECTIONS as K, hasLocalFontFace as L, formatCounterStyleRule as M, hasLocalCounterStyle as N, getGlobalPredefinedStates as O, extractLocalProperties as Ot, extractLocalFontFace as P, normalizeColorTokenValue as Q, SheetManager as R, renderStyles as S, getNamedColorHex as St, createStateParserContext as T, hslToRgbValues as Tt, createStyle as U, deprecationWarning as V, PropertyTypeResolver as W, getGlobalParser as X, getGlobalFuncs as Y, getGlobalPredefinedTokens as Z, markStylesGenerated as _, colorInitialValueToComponents as _t, getGlobalCounterStyle as a, okhslPlugin as at, hasPipelineCacheEntry as b, getColorSpaceSuffix as bt, getGlobalKeyframes as c, DEFAULT_NAME_PREFIX as ct, getNamePrefix as d, makeCounterStyleName as dt, parseStyle as et, hasGlobalKeyframes as f, makeKeyframeName as ft, isTestEnvironment as g, hashString as gt, isConfigLocked as h, isDevEnv as ht, getGlobalConfigTokens as i, okhslFunc as it, extractLocalCounterStyle as j, parsePropertyToken as jt, setGlobalPredefinedStates as k, getEffectiveDefinition as kt, getGlobalRecipes as l, DEFAULT_ZERO_NAME_PREFIX as lt, hasStylesGenerated as m, validateNamePrefix as mt, getConfig as n, setGlobalPredefinedTokens as nt, getGlobalFontFace as o, StyleParser as ot, hasGlobalRecipes as p, tastyClassRegex as pt, customFunc as q, getEffectiveProperties as r, stringifyStyles as rt, getGlobalInjector as s, Bucket as st, configure as t, resetGlobalPredefinedTokens as tt, getGlobalStyles as u, makeClassName as ut, resetConfig as v, getColorSpaceComponents as vt, camelToKebab as w, hexToRgb as wt, isSelector as x, getComponentPropertySyntax as xt, generateTypographyTokens as y, getColorSpaceFunc as yt, STYLE_HANDLER_MAP as z };
|
|
10463
10558
|
|
|
10464
|
-
//# sourceMappingURL=config-
|
|
10559
|
+
//# sourceMappingURL=config-eiremPHv.js.map
|