@unocss/preset-mini 0.21.1 → 0.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/default.cjs +25 -19
- package/dist/chunks/default.mjs +25 -19
- package/dist/chunks/default2.cjs +273 -151
- package/dist/chunks/default2.mjs +273 -154
- package/dist/chunks/default3.cjs +162 -6
- package/dist/chunks/default3.mjs +152 -2
- package/dist/chunks/utilities.cjs +33 -4
- package/dist/chunks/utilities.mjs +33 -5
- package/dist/{colors-6d634692.d.ts → colors-338f482c.d.ts} +1 -1
- package/dist/colors.d.ts +2 -2
- package/dist/{default-958434b6.d.ts → default-17948303.d.ts} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +5 -4
- package/dist/index.mjs +1 -2
- package/dist/rules.cjs +3 -1
- package/dist/rules.d.ts +11 -2
- package/dist/rules.mjs +1 -2
- package/dist/theme.d.ts +8 -8
- package/dist/{types-a2d2b52f.d.ts → types-c14b808b.d.ts} +8 -2
- package/dist/utilities-13c33ba5.d.ts +56 -0
- package/dist/utils.cjs +1 -0
- package/dist/utils.d.ts +5 -55
- package/dist/utils.mjs +1 -1
- package/dist/variants.cjs +6 -7
- package/dist/variants.d.ts +4 -3
- package/dist/variants.mjs +1 -2
- package/package.json +2 -2
- package/dist/chunks/pseudo.cjs +0 -160
- package/dist/chunks/pseudo.mjs +0 -153
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { DynamicMatcher, ParsedColorValue } from '@unocss/core';
|
|
2
|
+
import { T as Theme } from './types-c14b808b';
|
|
3
|
+
|
|
4
|
+
declare function capitalize<T extends string>(str: T): Capitalize<T>;
|
|
5
|
+
/**
|
|
6
|
+
* Provide {@link DynamicMatcher} function returning spacing definition. See spacing rules.
|
|
7
|
+
*
|
|
8
|
+
* @param {string} propertyPrefix - Property for the css value to be created. Postfix will be appended according to direction matched.
|
|
9
|
+
* @return {DynamicMatcher} {@link DynamicMatcher}
|
|
10
|
+
* @see {@link directionMap}
|
|
11
|
+
*/
|
|
12
|
+
declare const directionSize: (propertyPrefix: string) => DynamicMatcher;
|
|
13
|
+
/**
|
|
14
|
+
* Parse color string into rgba (if possible) with opacity. Color value will be matched to theme object before converting to rgb value.
|
|
15
|
+
*
|
|
16
|
+
* @example Parseable strings:
|
|
17
|
+
* 'red' // From theme, if 'red' is available
|
|
18
|
+
* 'red-100' // From theme, plus scale
|
|
19
|
+
* 'red-100/20' // From theme, plus scale/opacity
|
|
20
|
+
* '#f12' // Hex color
|
|
21
|
+
* 'hex-f12' // Alternative hex color
|
|
22
|
+
* '[rgb(100,2,3)]/[var(--op)]' // Bracket with rgb color and bracket with opacity
|
|
23
|
+
*
|
|
24
|
+
* @param {string} body - Color string to be parsed.
|
|
25
|
+
* @param {Theme} theme - {@link Theme} object.
|
|
26
|
+
* @return {ParsedColorValue|undefined} {@link ParsedColorValue} object if string is parseable.
|
|
27
|
+
*/
|
|
28
|
+
declare const parseColor: (body: string, theme: Theme) => ParsedColorValue | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Provide {@link DynamicMatcher} function to produce color value matched from rule.
|
|
31
|
+
*
|
|
32
|
+
* @see {@link parseColor}
|
|
33
|
+
*
|
|
34
|
+
* @example Resolving 'red' from theme:
|
|
35
|
+
* colorResolver('background-color', 'background')('', 'red')
|
|
36
|
+
* return { 'background-color': '#f12' }
|
|
37
|
+
*
|
|
38
|
+
* @example Resolving 'red-100' from theme:
|
|
39
|
+
* colorResolver('background-color', 'background')('', 'red-100')
|
|
40
|
+
* return { '--un-background-opacity': '1', 'background-color': 'rgba(254,226,226,var(--un-bg-opacity))' }
|
|
41
|
+
*
|
|
42
|
+
* @example Resolving 'red-100/20' from theme:
|
|
43
|
+
* colorResolver('background-color', 'background')('', 'red-100/20')
|
|
44
|
+
* return { 'background-color': 'rgba(204,251,241,0.22)' }
|
|
45
|
+
*
|
|
46
|
+
* @example Resolving 'hex-124':
|
|
47
|
+
* colorResolver('color', 'text')('', 'hex-124')
|
|
48
|
+
* return { '--un-text-opacity': '1', 'color': 'rgba(17,34,68,var(--un-text-opacity))' }
|
|
49
|
+
*
|
|
50
|
+
* @param {string} property - Property for the css value to be created.
|
|
51
|
+
* @param {string} varName - Base name for the opacity variable.
|
|
52
|
+
* @return {DynamicMatcher} {@link DynamicMatcher} object.
|
|
53
|
+
*/
|
|
54
|
+
declare const colorResolver: (property: string, varName: string) => DynamicMatcher;
|
|
55
|
+
|
|
56
|
+
export { colorResolver as a, capitalize as c, directionSize as d, parseColor as p };
|
package/dist/utils.cjs
CHANGED
|
@@ -15,6 +15,7 @@ exports.directionMap = utilities.directionMap;
|
|
|
15
15
|
exports.directionSize = utilities.directionSize;
|
|
16
16
|
exports.h = utilities.h;
|
|
17
17
|
exports.handler = utilities.handler;
|
|
18
|
+
exports.insetMap = utilities.insetMap;
|
|
18
19
|
exports.parseColor = utilities.parseColor;
|
|
19
20
|
exports.positionMap = utilities.positionMap;
|
|
20
21
|
exports.valueHandlers = utilities.valueHandlers;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as _unocss_core from '@unocss/core';
|
|
2
|
-
import { VariantHandler
|
|
3
|
-
|
|
2
|
+
import { VariantHandler } from '@unocss/core';
|
|
3
|
+
export { c as capitalize, a as colorResolver, d as directionSize, p as parseColor } from './utilities-13c33ba5';
|
|
4
|
+
import './types-c14b808b';
|
|
4
5
|
|
|
5
6
|
declare const directionMap: Record<string, string[]>;
|
|
7
|
+
declare const insetMap: Record<string, string[]>;
|
|
6
8
|
declare const cornerMap: Record<string, string[]>;
|
|
7
9
|
declare const xyzMap: Record<string, string[]>;
|
|
8
10
|
declare const positionMap: Record<string, string>;
|
|
@@ -58,56 +60,4 @@ declare const h: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit"
|
|
|
58
60
|
declare const variantMatcher: (name: string, selector?: ((input: string) => string | undefined) | undefined) => (input: string) => VariantHandler | undefined;
|
|
59
61
|
declare const variantParentMatcher: (name: string, parent: string) => (input: string) => VariantHandler | undefined;
|
|
60
62
|
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Provide {@link DynamicMatcher} function returning spacing definition. See spacing rules.
|
|
64
|
-
*
|
|
65
|
-
* @param {string} propertyPrefix - Property for the css value to be created. Postfix will be appended according to direction matched.
|
|
66
|
-
* @return {DynamicMatcher} {@link DynamicMatcher}
|
|
67
|
-
* @see {@link directionMap}
|
|
68
|
-
*/
|
|
69
|
-
declare const directionSize: (propertyPrefix: string) => DynamicMatcher;
|
|
70
|
-
/**
|
|
71
|
-
* Parse color string into rgba (if possible) with opacity opacity. Color value will be matched to theme object before converting to rgb value.
|
|
72
|
-
*
|
|
73
|
-
* @example Parseable strings:
|
|
74
|
-
* 'red' // From theme, if 'red' is available
|
|
75
|
-
* 'red-100' // From theme, plus scale
|
|
76
|
-
* 'red-100/20' // From theme, plus scale/opacity
|
|
77
|
-
* '#f12' // Hex color
|
|
78
|
-
* 'hex-f12' // Alternative hex color
|
|
79
|
-
* '[rgb(100,2,3)]/[var(--op)]' // Bracket with rgb color and bracket with opacity
|
|
80
|
-
*
|
|
81
|
-
* @param {string} body - Color string to be parsed.
|
|
82
|
-
* @param {Theme} theme - {@link Theme} object.
|
|
83
|
-
* @return {ParsedColorValue|undefined} {@link ParsedColorValue} object if string is parseable.
|
|
84
|
-
*/
|
|
85
|
-
declare const parseColor: (body: string, theme: Theme) => ParsedColorValue | undefined;
|
|
86
|
-
/**
|
|
87
|
-
* Provide {@link DynamicMatcher} function to produce color value matched from rule.
|
|
88
|
-
*
|
|
89
|
-
* @see {@link parseColor}
|
|
90
|
-
*
|
|
91
|
-
* @example Resolving 'red' from theme:
|
|
92
|
-
* colorResolver('background-color', 'background')('', 'red')
|
|
93
|
-
* return { 'background-color': '#f12' }
|
|
94
|
-
*
|
|
95
|
-
* @example Resolving 'red-100' from theme:
|
|
96
|
-
* colorResolver('background-color', 'background')('', 'red-100')
|
|
97
|
-
* return { '--un-background-opacity': '1', 'background-color': 'rgba(254,226,226,var(--un-bg-opacity))' }
|
|
98
|
-
*
|
|
99
|
-
* @example Resolving 'red-100/20' from theme:
|
|
100
|
-
* colorResolver('background-color', 'background')('', 'red-100/20')
|
|
101
|
-
* return { 'background-color': 'rgba(204,251,241,0.22)' }
|
|
102
|
-
*
|
|
103
|
-
* @example Resolving 'hex-124':
|
|
104
|
-
* colorResolver('color', 'text')('', 'hex-124')
|
|
105
|
-
* return { '--un-text-opacity': '1', 'color': 'rgba(17,34,68,var(--un-text-opacity))' }
|
|
106
|
-
*
|
|
107
|
-
* @param {string} property - Property for the css value to be created.
|
|
108
|
-
* @param {string} varName - Base name for the opacity variable.
|
|
109
|
-
* @return {DynamicMatcher} {@link DynamicMatcher} object.
|
|
110
|
-
*/
|
|
111
|
-
declare const colorResolver: (property: string, varName: string) => DynamicMatcher;
|
|
112
|
-
|
|
113
|
-
export { capitalize, colorResolver, cornerMap, directionMap, directionSize, h, handler, parseColor, positionMap, handlers as valueHandlers, variantMatcher, variantParentMatcher, xyzMap };
|
|
63
|
+
export { cornerMap, directionMap, h, handler, insetMap, positionMap, handlers as valueHandlers, variantMatcher, variantParentMatcher, xyzMap };
|
package/dist/utils.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { g as capitalize, c as colorResolver, a as cornerMap, d as directionMap, b as directionSize, f as h, h as handler, i as insetMap, p as parseColor, e as positionMap, v as valueHandlers, x as xyzMap } from './chunks/utilities.mjs';
|
|
2
2
|
export { v as variantMatcher, a as variantParentMatcher } from './chunks/variants.mjs';
|
|
3
3
|
import '@unocss/core';
|
package/dist/variants.cjs
CHANGED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const _default = require('./chunks/default3.cjs');
|
|
6
|
-
const pseudo = require('./chunks/pseudo.cjs');
|
|
7
6
|
require('./chunks/variants.cjs');
|
|
8
7
|
require('@unocss/core');
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
|
|
11
|
+
exports.CONTROL_BYPASS_PSEUDO_CLASS = _default.CONTROL_BYPASS_PSEUDO_CLASS;
|
|
12
|
+
exports.partClasses = _default.partClasses;
|
|
12
13
|
exports.variantBreakpoints = _default.variantBreakpoints;
|
|
13
14
|
exports.variantColorsMediaOrClass = _default.variantColorsMediaOrClass;
|
|
14
15
|
exports.variantCombinators = _default.variantCombinators;
|
|
@@ -18,10 +19,8 @@ exports.variantMotions = _default.variantMotions;
|
|
|
18
19
|
exports.variantNegative = _default.variantNegative;
|
|
19
20
|
exports.variantOrientations = _default.variantOrientations;
|
|
20
21
|
exports.variantPrint = _default.variantPrint;
|
|
22
|
+
exports.variantPseudoClassFunctions = _default.variantPseudoClassFunctions;
|
|
23
|
+
exports.variantPseudoClasses = _default.variantPseudoClasses;
|
|
24
|
+
exports.variantPseudoElements = _default.variantPseudoElements;
|
|
25
|
+
exports.variantTaggedPseudoClasses = _default.variantTaggedPseudoClasses;
|
|
21
26
|
exports.variants = _default.variants;
|
|
22
|
-
exports.CONTROL_BYPASS_PSEUDO_CLASS = pseudo.CONTROL_BYPASS_PSEUDO_CLASS;
|
|
23
|
-
exports.partClasses = pseudo.partClasses;
|
|
24
|
-
exports.variantPseudoClassFunctions = pseudo.variantPseudoClassFunctions;
|
|
25
|
-
exports.variantPseudoClasses = pseudo.variantPseudoClasses;
|
|
26
|
-
exports.variantPseudoElements = pseudo.variantPseudoElements;
|
|
27
|
-
exports.variantTaggedPseudoClasses = pseudo.variantTaggedPseudoClasses;
|
package/dist/variants.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as _unocss_core from '@unocss/core';
|
|
2
2
|
import { Variant, VariantFunction, VariantObject } from '@unocss/core';
|
|
3
|
-
import { T as Theme } from './types-
|
|
3
|
+
import { T as Theme } from './types-c14b808b';
|
|
4
4
|
import { PresetMiniOptions } from './index';
|
|
5
|
-
import './default-
|
|
6
|
-
import './colors-
|
|
5
|
+
import './default-17948303';
|
|
6
|
+
import './colors-338f482c';
|
|
7
|
+
import './utilities-13c33ba5';
|
|
7
8
|
|
|
8
9
|
declare const variantBreakpoints: Variant<Theme>;
|
|
9
10
|
|
package/dist/variants.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { a as variantBreakpoints, c as variantColorsMediaOrClass, b as variantCombinators, e as variantImportant, d as variantLanguageDirections, g as variantMotions, f as variantNegative, h as variantOrientations, i as variantPrint, v as variants } from './chunks/default3.mjs';
|
|
2
|
-
export { C as CONTROL_BYPASS_PSEUDO_CLASS, p as partClasses, a as variantPseudoClassFunctions, v as variantPseudoClasses, c as variantPseudoElements, b as variantTaggedPseudoClasses } from './chunks/pseudo.mjs';
|
|
1
|
+
export { C as CONTROL_BYPASS_PSEUDO_CLASS, p as partClasses, a as variantBreakpoints, c as variantColorsMediaOrClass, b as variantCombinators, e as variantImportant, d as variantLanguageDirections, g as variantMotions, f as variantNegative, h as variantOrientations, i as variantPrint, l as variantPseudoClassFunctions, k as variantPseudoClasses, j as variantPseudoElements, m as variantTaggedPseudoClasses, v as variants } from './chunks/default3.mjs';
|
|
3
2
|
import './chunks/variants.mjs';
|
|
4
3
|
import '@unocss/core';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-mini",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.2",
|
|
4
4
|
"description": "The minimal preset for UnoCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unocss",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"*.css"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@unocss/core": "0.
|
|
64
|
+
"@unocss/core": "0.22.2"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "unbuild",
|
package/dist/chunks/pseudo.cjs
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const core = require('@unocss/core');
|
|
4
|
-
|
|
5
|
-
const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
|
|
6
|
-
const PseudoClasses = Object.fromEntries([
|
|
7
|
-
"any-link",
|
|
8
|
-
"link",
|
|
9
|
-
"visited",
|
|
10
|
-
"target",
|
|
11
|
-
["open", "[open]"],
|
|
12
|
-
"hover",
|
|
13
|
-
"active",
|
|
14
|
-
"focus-visible",
|
|
15
|
-
"focus-within",
|
|
16
|
-
"focus",
|
|
17
|
-
"autofill",
|
|
18
|
-
"enabled",
|
|
19
|
-
"disabled",
|
|
20
|
-
"read-only",
|
|
21
|
-
"read-write",
|
|
22
|
-
"placeholder-shown",
|
|
23
|
-
"default",
|
|
24
|
-
"checked",
|
|
25
|
-
"indeterminate",
|
|
26
|
-
"valid",
|
|
27
|
-
"invalid",
|
|
28
|
-
"in-range",
|
|
29
|
-
"out-of-range",
|
|
30
|
-
"required",
|
|
31
|
-
"optional",
|
|
32
|
-
"root",
|
|
33
|
-
"empty",
|
|
34
|
-
["even-of-type", ":nth-of-type(even)"],
|
|
35
|
-
["even", ":nth-child(even)"],
|
|
36
|
-
["odd-of-type", ":nth-of-type(odd)"],
|
|
37
|
-
["odd", ":nth-child(odd)"],
|
|
38
|
-
"first-of-type",
|
|
39
|
-
["first", ":first-child"],
|
|
40
|
-
"last-of-type",
|
|
41
|
-
["last", ":last-child"],
|
|
42
|
-
"only-child",
|
|
43
|
-
"only-of-type"
|
|
44
|
-
].map(core.toArray));
|
|
45
|
-
const PseudoElements = Object.fromEntries([
|
|
46
|
-
"placeholder",
|
|
47
|
-
"before",
|
|
48
|
-
"after",
|
|
49
|
-
"first-letter",
|
|
50
|
-
"first-line",
|
|
51
|
-
"selection",
|
|
52
|
-
"marker",
|
|
53
|
-
["file", "::file-selector-button"]
|
|
54
|
-
].map(core.toArray));
|
|
55
|
-
const PseudoClassFunctions = [
|
|
56
|
-
"not",
|
|
57
|
-
"is",
|
|
58
|
-
"where",
|
|
59
|
-
"has"
|
|
60
|
-
];
|
|
61
|
-
const PseudoElementsStr = Object.keys(PseudoElements).join("|");
|
|
62
|
-
const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
|
|
63
|
-
const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
|
|
64
|
-
const PartClassesRE = /(part-\[(.+)]:)(.+)/;
|
|
65
|
-
const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
|
|
66
|
-
const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
|
|
67
|
-
const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
|
|
68
|
-
function shouldAdd(entires) {
|
|
69
|
-
return !entires.find((i) => i[0] === CONTROL_BYPASS_PSEUDO_CLASS) || void 0;
|
|
70
|
-
}
|
|
71
|
-
const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
72
|
-
const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
|
|
73
|
-
const rawRe = new RegExp(`^${core.escapeRegExp(parent)}:`);
|
|
74
|
-
return (input) => {
|
|
75
|
-
const match = input.match(re);
|
|
76
|
-
if (match) {
|
|
77
|
-
let pseudo = PseudoClasses[match[3]] || `:${match[3]}`;
|
|
78
|
-
if (match[2])
|
|
79
|
-
pseudo = `:${match[2]}(${pseudo})`;
|
|
80
|
-
return {
|
|
81
|
-
matcher: input.slice(match[1].length + tag.length + 2),
|
|
82
|
-
selector: (s, body) => {
|
|
83
|
-
return shouldAdd(body) && rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`;
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
const variantPseudoElements = (input) => {
|
|
90
|
-
const match = input.match(PseudoElementsRE);
|
|
91
|
-
if (match) {
|
|
92
|
-
const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
|
|
93
|
-
return {
|
|
94
|
-
matcher: input.slice(match[1].length + 1),
|
|
95
|
-
selector: (s) => `${s}${pseudo}`
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
const variantPseudoClasses = {
|
|
100
|
-
match: (input) => {
|
|
101
|
-
const match = input.match(PseudoClassesRE);
|
|
102
|
-
if (match) {
|
|
103
|
-
const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
|
|
104
|
-
return {
|
|
105
|
-
matcher: input.slice(match[1].length + 1),
|
|
106
|
-
selector: (s, body) => shouldAdd(body) && `${s}${pseudo}`
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
multiPass: true
|
|
111
|
-
};
|
|
112
|
-
const variantPseudoClassFunctions = {
|
|
113
|
-
match: (input) => {
|
|
114
|
-
const match = input.match(PseudoClassFunctionsRE);
|
|
115
|
-
if (match) {
|
|
116
|
-
const fn = match[1];
|
|
117
|
-
const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
|
|
118
|
-
return {
|
|
119
|
-
matcher: input.slice(match[1].length + match[2].length + 2),
|
|
120
|
-
selector: (s, body) => shouldAdd(body) && `${s}:${fn}(${pseudo})`
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
multiPass: true
|
|
125
|
-
};
|
|
126
|
-
const variantTaggedPseudoClasses = (options = {}) => {
|
|
127
|
-
const attributify = !!options?.attributifyPseudo;
|
|
128
|
-
return [
|
|
129
|
-
{
|
|
130
|
-
match: taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " "),
|
|
131
|
-
multiPass: true
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
match: taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~"),
|
|
135
|
-
multiPass: true
|
|
136
|
-
}
|
|
137
|
-
];
|
|
138
|
-
};
|
|
139
|
-
const partClasses = {
|
|
140
|
-
match: (input) => {
|
|
141
|
-
const match = input.match(PartClassesRE);
|
|
142
|
-
if (match) {
|
|
143
|
-
const part = `part(${match[2]})`;
|
|
144
|
-
return {
|
|
145
|
-
matcher: input.slice(match[1].length),
|
|
146
|
-
selector: (s, body) => {
|
|
147
|
-
return shouldAdd(body) && `${s}::${part}`;
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
multiPass: true
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
exports.CONTROL_BYPASS_PSEUDO_CLASS = CONTROL_BYPASS_PSEUDO_CLASS;
|
|
156
|
-
exports.partClasses = partClasses;
|
|
157
|
-
exports.variantPseudoClassFunctions = variantPseudoClassFunctions;
|
|
158
|
-
exports.variantPseudoClasses = variantPseudoClasses;
|
|
159
|
-
exports.variantPseudoElements = variantPseudoElements;
|
|
160
|
-
exports.variantTaggedPseudoClasses = variantTaggedPseudoClasses;
|
package/dist/chunks/pseudo.mjs
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { toArray, escapeRegExp } from '@unocss/core';
|
|
2
|
-
|
|
3
|
-
const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
|
|
4
|
-
const PseudoClasses = Object.fromEntries([
|
|
5
|
-
"any-link",
|
|
6
|
-
"link",
|
|
7
|
-
"visited",
|
|
8
|
-
"target",
|
|
9
|
-
["open", "[open]"],
|
|
10
|
-
"hover",
|
|
11
|
-
"active",
|
|
12
|
-
"focus-visible",
|
|
13
|
-
"focus-within",
|
|
14
|
-
"focus",
|
|
15
|
-
"autofill",
|
|
16
|
-
"enabled",
|
|
17
|
-
"disabled",
|
|
18
|
-
"read-only",
|
|
19
|
-
"read-write",
|
|
20
|
-
"placeholder-shown",
|
|
21
|
-
"default",
|
|
22
|
-
"checked",
|
|
23
|
-
"indeterminate",
|
|
24
|
-
"valid",
|
|
25
|
-
"invalid",
|
|
26
|
-
"in-range",
|
|
27
|
-
"out-of-range",
|
|
28
|
-
"required",
|
|
29
|
-
"optional",
|
|
30
|
-
"root",
|
|
31
|
-
"empty",
|
|
32
|
-
["even-of-type", ":nth-of-type(even)"],
|
|
33
|
-
["even", ":nth-child(even)"],
|
|
34
|
-
["odd-of-type", ":nth-of-type(odd)"],
|
|
35
|
-
["odd", ":nth-child(odd)"],
|
|
36
|
-
"first-of-type",
|
|
37
|
-
["first", ":first-child"],
|
|
38
|
-
"last-of-type",
|
|
39
|
-
["last", ":last-child"],
|
|
40
|
-
"only-child",
|
|
41
|
-
"only-of-type"
|
|
42
|
-
].map(toArray));
|
|
43
|
-
const PseudoElements = Object.fromEntries([
|
|
44
|
-
"placeholder",
|
|
45
|
-
"before",
|
|
46
|
-
"after",
|
|
47
|
-
"first-letter",
|
|
48
|
-
"first-line",
|
|
49
|
-
"selection",
|
|
50
|
-
"marker",
|
|
51
|
-
["file", "::file-selector-button"]
|
|
52
|
-
].map(toArray));
|
|
53
|
-
const PseudoClassFunctions = [
|
|
54
|
-
"not",
|
|
55
|
-
"is",
|
|
56
|
-
"where",
|
|
57
|
-
"has"
|
|
58
|
-
];
|
|
59
|
-
const PseudoElementsStr = Object.keys(PseudoElements).join("|");
|
|
60
|
-
const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
|
|
61
|
-
const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
|
|
62
|
-
const PartClassesRE = /(part-\[(.+)]:)(.+)/;
|
|
63
|
-
const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
|
|
64
|
-
const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
|
|
65
|
-
const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
|
|
66
|
-
function shouldAdd(entires) {
|
|
67
|
-
return !entires.find((i) => i[0] === CONTROL_BYPASS_PSEUDO_CLASS) || void 0;
|
|
68
|
-
}
|
|
69
|
-
const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
70
|
-
const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
|
|
71
|
-
const rawRe = new RegExp(`^${escapeRegExp(parent)}:`);
|
|
72
|
-
return (input) => {
|
|
73
|
-
const match = input.match(re);
|
|
74
|
-
if (match) {
|
|
75
|
-
let pseudo = PseudoClasses[match[3]] || `:${match[3]}`;
|
|
76
|
-
if (match[2])
|
|
77
|
-
pseudo = `:${match[2]}(${pseudo})`;
|
|
78
|
-
return {
|
|
79
|
-
matcher: input.slice(match[1].length + tag.length + 2),
|
|
80
|
-
selector: (s, body) => {
|
|
81
|
-
return shouldAdd(body) && rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`;
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
const variantPseudoElements = (input) => {
|
|
88
|
-
const match = input.match(PseudoElementsRE);
|
|
89
|
-
if (match) {
|
|
90
|
-
const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
|
|
91
|
-
return {
|
|
92
|
-
matcher: input.slice(match[1].length + 1),
|
|
93
|
-
selector: (s) => `${s}${pseudo}`
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
const variantPseudoClasses = {
|
|
98
|
-
match: (input) => {
|
|
99
|
-
const match = input.match(PseudoClassesRE);
|
|
100
|
-
if (match) {
|
|
101
|
-
const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
|
|
102
|
-
return {
|
|
103
|
-
matcher: input.slice(match[1].length + 1),
|
|
104
|
-
selector: (s, body) => shouldAdd(body) && `${s}${pseudo}`
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
multiPass: true
|
|
109
|
-
};
|
|
110
|
-
const variantPseudoClassFunctions = {
|
|
111
|
-
match: (input) => {
|
|
112
|
-
const match = input.match(PseudoClassFunctionsRE);
|
|
113
|
-
if (match) {
|
|
114
|
-
const fn = match[1];
|
|
115
|
-
const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
|
|
116
|
-
return {
|
|
117
|
-
matcher: input.slice(match[1].length + match[2].length + 2),
|
|
118
|
-
selector: (s, body) => shouldAdd(body) && `${s}:${fn}(${pseudo})`
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
multiPass: true
|
|
123
|
-
};
|
|
124
|
-
const variantTaggedPseudoClasses = (options = {}) => {
|
|
125
|
-
const attributify = !!options?.attributifyPseudo;
|
|
126
|
-
return [
|
|
127
|
-
{
|
|
128
|
-
match: taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " "),
|
|
129
|
-
multiPass: true
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
match: taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~"),
|
|
133
|
-
multiPass: true
|
|
134
|
-
}
|
|
135
|
-
];
|
|
136
|
-
};
|
|
137
|
-
const partClasses = {
|
|
138
|
-
match: (input) => {
|
|
139
|
-
const match = input.match(PartClassesRE);
|
|
140
|
-
if (match) {
|
|
141
|
-
const part = `part(${match[2]})`;
|
|
142
|
-
return {
|
|
143
|
-
matcher: input.slice(match[1].length),
|
|
144
|
-
selector: (s, body) => {
|
|
145
|
-
return shouldAdd(body) && `${s}::${part}`;
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
multiPass: true
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
export { CONTROL_BYPASS_PSEUDO_CLASS as C, variantPseudoClassFunctions as a, variantTaggedPseudoClasses as b, variantPseudoElements as c, partClasses as p, variantPseudoClasses as v };
|