@unocss/rule-utils 66.6.7 → 66.7.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +6 -9
- package/package.json +2 -5
package/dist/index.mjs
CHANGED
|
@@ -286,7 +286,7 @@ function transformThemeFn(code, theme, throwOnMissing = true) {
|
|
|
286
286
|
}
|
|
287
287
|
function transformThemeString(code, theme, throwOnMissing = true) {
|
|
288
288
|
const [rawKey, alpha] = code.split("/");
|
|
289
|
-
let value = rawKey.trim().split(".").reduce((t, k) => t
|
|
289
|
+
let value = rawKey.trim().split(".").reduce((t, k) => t?.[k], theme);
|
|
290
290
|
if (typeof value === "object") value = value.DEFAULT;
|
|
291
291
|
if (typeof value === "string") {
|
|
292
292
|
if (alpha) {
|
|
@@ -297,8 +297,7 @@ function transformThemeString(code, theme, throwOnMissing = true) {
|
|
|
297
297
|
} else if (throwOnMissing) throw new Error(`theme of "${code}" did not found`);
|
|
298
298
|
}
|
|
299
299
|
function calcMaxWidthBySize(size) {
|
|
300
|
-
|
|
301
|
-
const value = ((_size$match = size.match(/^-?\d+\.?\d*/)) === null || _size$match === void 0 ? void 0 : _size$match[0]) || "";
|
|
300
|
+
const value = size.match(/^-?\d+\.?\d*/)?.[0] || "";
|
|
302
301
|
const unit = size.slice(value.length);
|
|
303
302
|
if (unit === "px") {
|
|
304
303
|
const maxWidth = Number.parseFloat(value) - .1;
|
|
@@ -310,8 +309,7 @@ function calcMaxWidthBySize(size) {
|
|
|
310
309
|
//#region src/handlers.ts
|
|
311
310
|
function createValueHandler(handlers) {
|
|
312
311
|
const handler = function(str, theme) {
|
|
313
|
-
|
|
314
|
-
const s = ((_this$__options = this.__options) === null || _this$__options === void 0 ? void 0 : _this$__options.sequence) || [];
|
|
312
|
+
const s = this.__options?.sequence || [];
|
|
315
313
|
this.__options.sequence = [];
|
|
316
314
|
for (const n of s) {
|
|
317
315
|
const res = handlers[n](str, theme);
|
|
@@ -435,13 +433,12 @@ function createTaggedPseudoClassMatcher(tag, parent, combinator, utils) {
|
|
|
435
433
|
let pseudoColonRE;
|
|
436
434
|
let pseudoVarRE;
|
|
437
435
|
const matchBracket = (input) => {
|
|
438
|
-
var _rest$split;
|
|
439
436
|
const body = variantGetBracket(`${tag}-`, input, []);
|
|
440
437
|
if (!body) return;
|
|
441
438
|
const [match, rest] = body;
|
|
442
439
|
const bracketValue = h.bracket(match);
|
|
443
440
|
if (bracketValue == null) return;
|
|
444
|
-
const label =
|
|
441
|
+
const label = rest.split(splitRE, 1)?.[0] ?? "";
|
|
445
442
|
const prefix = `${parent}${escapeSelector(label)}`;
|
|
446
443
|
return [
|
|
447
444
|
label,
|
|
@@ -586,8 +583,8 @@ function createPseudoClassFunctions(utils) {
|
|
|
586
583
|
};
|
|
587
584
|
}
|
|
588
585
|
function createTaggedPseudoClasses(options, utils) {
|
|
589
|
-
const attributify = !!
|
|
590
|
-
let firstPrefix =
|
|
586
|
+
const attributify = !!options?.attributifyPseudo;
|
|
587
|
+
let firstPrefix = options?.prefix ?? "";
|
|
591
588
|
firstPrefix = escapeSelector((Array.isArray(firstPrefix) ? firstPrefix : [firstPrefix]).filter(Boolean)[0] ?? "");
|
|
592
589
|
const tagWithPrefix = (tag, combinator) => createTaggedPseudoClassMatcher(tag, attributify ? `[${firstPrefix}${tag}=""]` : `.${firstPrefix}${tag}`, combinator, utils);
|
|
593
590
|
return [
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/rule-utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "66.
|
|
4
|
+
"version": "66.7.0-beta.1",
|
|
5
5
|
"description": "Utilities for UnoCSS",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -25,12 +25,9 @@
|
|
|
25
25
|
"files": [
|
|
26
26
|
"dist"
|
|
27
27
|
],
|
|
28
|
-
"engines": {
|
|
29
|
-
"node": ">=14"
|
|
30
|
-
},
|
|
31
28
|
"dependencies": {
|
|
32
29
|
"magic-string": "^0.30.21",
|
|
33
|
-
"@unocss/core": "
|
|
30
|
+
"@unocss/core": "66.7.0-beta.1"
|
|
34
31
|
},
|
|
35
32
|
"scripts": {
|
|
36
33
|
"build": "tsdown",
|