@unocss/preset-mini 0.20.4 → 0.22.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/dist/theme.d.ts CHANGED
@@ -77,8 +77,6 @@ declare const baseSize: {
77
77
  '5xl': string;
78
78
  '6xl': string;
79
79
  '7xl': string;
80
- min: string;
81
- max: string;
82
80
  prose: string;
83
81
  };
84
82
  declare const width: {
@@ -94,8 +92,6 @@ declare const width: {
94
92
  '5xl': string;
95
93
  '6xl': string;
96
94
  '7xl': string;
97
- min: string;
98
- max: string;
99
95
  prose: string;
100
96
  auto: string;
101
97
  };
@@ -112,8 +108,6 @@ declare const maxWidth: {
112
108
  '5xl': string;
113
109
  '6xl': string;
114
110
  '7xl': string;
115
- min: string;
116
- max: string;
117
111
  prose: string;
118
112
  none: string;
119
113
  };
@@ -130,8 +124,6 @@ declare const height: {
130
124
  '5xl': string;
131
125
  '6xl': string;
132
126
  '7xl': string;
133
- min: string;
134
- max: string;
135
127
  prose: string;
136
128
  auto: string;
137
129
  };
@@ -148,8 +140,6 @@ declare const maxHeight: {
148
140
  '5xl': string;
149
141
  '6xl': string;
150
142
  '7xl': string;
151
- min: string;
152
- max: string;
153
143
  prose: string;
154
144
  none: string;
155
145
  };
@@ -0,0 +1,56 @@
1
+ import { DynamicMatcher, ParsedColorValue } from '@unocss/core';
2
+ import { T as Theme } from './types-a2d2b52f';
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.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
- import { VariantHandler, DynamicMatcher, ParsedColorValue } from '@unocss/core';
3
- import { T as Theme } from './types-a2d2b52f';
2
+ import { VariantHandler } from '@unocss/core';
3
+ export { c as capitalize, a as colorResolver, d as directionSize, p as parseColor } from './utilities-22a522e2';
4
+ import './types-a2d2b52f';
4
5
 
5
6
  declare const directionMap: Record<string, string[]>;
6
7
  declare const cornerMap: Record<string, string[]>;
@@ -17,6 +18,7 @@ declare function fraction(str: string): string | undefined;
17
18
  declare function bracket(str: string): string | undefined;
18
19
  declare function cssvar(str: string): string | undefined;
19
20
  declare function time(str: string): string | undefined;
21
+ declare function degree(str: string): string | undefined;
20
22
  declare function global(str: string): string | undefined;
21
23
  declare function properties(str: string): string | undefined;
22
24
 
@@ -30,6 +32,7 @@ declare const handlers_fraction: typeof fraction;
30
32
  declare const handlers_bracket: typeof bracket;
31
33
  declare const handlers_cssvar: typeof cssvar;
32
34
  declare const handlers_time: typeof time;
35
+ declare const handlers_degree: typeof degree;
33
36
  declare const handlers_global: typeof global;
34
37
  declare const handlers_properties: typeof properties;
35
38
  declare namespace handlers {
@@ -44,67 +47,16 @@ declare namespace handlers {
44
47
  handlers_bracket as bracket,
45
48
  handlers_cssvar as cssvar,
46
49
  handlers_time as time,
50
+ handlers_degree as degree,
47
51
  handlers_global as global,
48
52
  handlers_properties as properties,
49
53
  };
50
54
  }
51
55
 
52
- declare const handler: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global" | "properties">;
53
- declare const h: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global" | "properties">;
56
+ declare const handler: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "degree" | "global" | "properties">;
57
+ declare const h: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "degree" | "global" | "properties">;
54
58
 
55
59
  declare const variantMatcher: (name: string, selector?: ((input: string) => string | undefined) | undefined) => (input: string) => VariantHandler | undefined;
56
60
  declare const variantParentMatcher: (name: string, parent: string) => (input: string) => VariantHandler | undefined;
57
61
 
58
- declare function capitalize<T extends string>(str: T): Capitalize<T>;
59
- /**
60
- * Provide {@link DynamicMatcher} function returning spacing definition. See spacing rules.
61
- *
62
- * @param {string} propertyPrefix - Property for the css value to be created. Postfix will be appended according to direction matched.
63
- * @return {DynamicMatcher} {@link DynamicMatcher}
64
- * @see {@link directionMap}
65
- */
66
- declare const directionSize: (propertyPrefix: string) => DynamicMatcher;
67
- /**
68
- * Parse color string into rgba (if possible) with opacity opacity. Color value will be matched to theme object before converting to rgb value.
69
- *
70
- * @example Parseable strings:
71
- * 'red' // From theme, if 'red' is available
72
- * 'red-100' // From theme, plus scale
73
- * 'red-100/20' // From theme, plus scale/opacity
74
- * '#f12' // Hex color
75
- * 'hex-f12' // Alternative hex color
76
- * '[rgb(100,2,3)]/[var(--op)]' // Bracket with rgb color and bracket with opacity
77
- *
78
- * @param {string} body - Color string to be parsed.
79
- * @param {Theme} theme - {@link Theme} object.
80
- * @return {ParsedColorValue|undefined} {@link ParsedColorValue} object if string is parseable.
81
- */
82
- declare const parseColor: (body: string, theme: Theme) => ParsedColorValue | undefined;
83
- /**
84
- * Provide {@link DynamicMatcher} function to produce color value matched from rule.
85
- *
86
- * @see {@link parseColor}
87
- *
88
- * @example Resolving 'red' from theme:
89
- * colorResolver('background-color', 'background')('', 'red')
90
- * return { 'background-color': '#f12' }
91
- *
92
- * @example Resolving 'red-100' from theme:
93
- * colorResolver('background-color', 'background')('', 'red-100')
94
- * return { '--un-background-opacity': '1', 'background-color': 'rgba(254,226,226,var(--un-bg-opacity))' }
95
- *
96
- * @example Resolving 'red-100/20' from theme:
97
- * colorResolver('background-color', 'background')('', 'red-100/20')
98
- * return { 'background-color': 'rgba(204,251,241,0.22)' }
99
- *
100
- * @example Resolving 'hex-124':
101
- * colorResolver('color', 'text')('', 'hex-124')
102
- * return { '--un-text-opacity': '1', 'color': 'rgba(17,34,68,var(--un-text-opacity))' }
103
- *
104
- * @param {string} property - Property for the css value to be created.
105
- * @param {string} varName - Base name for the opacity variable.
106
- * @return {DynamicMatcher} {@link DynamicMatcher} object.
107
- */
108
- declare const colorResolver: (property: string, varName: string) => DynamicMatcher;
109
-
110
- export { capitalize, colorResolver, cornerMap, directionMap, directionSize, h, handler, parseColor, positionMap, handlers as valueHandlers, variantMatcher, variantParentMatcher, xyzMap };
62
+ export { cornerMap, directionMap, h, handler, positionMap, handlers as valueHandlers, variantMatcher, variantParentMatcher, xyzMap };
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;
@@ -1,16 +1,20 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
2
  import { Variant, VariantFunction, VariantObject } from '@unocss/core';
3
3
  import { T as Theme } from './types-a2d2b52f';
4
+ import { PresetMiniOptions } from './index';
5
+ import './default-958434b6';
6
+ import './colors-6d634692';
7
+ import './utilities-22a522e2';
4
8
 
5
9
  declare const variantBreakpoints: Variant<Theme>;
6
10
 
7
11
  declare const variantCombinators: Variant[];
8
12
 
9
- declare const variantColorsMediaOrClass: Variant[];
13
+ declare const variantColorsMediaOrClass: (options?: PresetMiniOptions) => VariantFunction[];
10
14
 
11
15
  declare const variantLanguageDirections: Variant[];
12
16
 
13
- declare const variants: Variant<Theme>[];
17
+ declare const variants: (options: PresetMiniOptions) => Variant<Theme>[];
14
18
 
15
19
  declare const variantImportant: Variant;
16
20
  declare const variantNegative: Variant;
@@ -25,7 +29,7 @@ declare const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
25
29
  declare const variantPseudoElements: VariantFunction;
26
30
  declare const variantPseudoClasses: VariantObject;
27
31
  declare const variantPseudoClassFunctions: VariantObject;
28
- declare const variantTaggedPseudoClasses: VariantObject;
32
+ declare const variantTaggedPseudoClasses: (options?: PresetMiniOptions) => VariantObject[];
29
33
  declare const partClasses: VariantObject;
30
34
 
31
35
  export { CONTROL_BYPASS_PSEUDO_CLASS, partClasses, variantBreakpoints, variantColorsMediaOrClass, variantCombinators, variantImportant, variantLanguageDirections, variantMotions, variantNegative, variantOrientations, variantPrint, variantPseudoClassFunctions, variantPseudoClasses, variantPseudoElements, variantTaggedPseudoClasses, variants };
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.20.4",
3
+ "version": "0.22.0",
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.20.4"
64
+ "@unocss/core": "0.22.0"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",
@@ -1,158 +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 = {
127
- match: (input, { options: { attributifyPseudo } }) => {
128
- const g = taggedPseudoClassMatcher("group", attributifyPseudo ? '[group=""]' : ".group", " ")(input);
129
- if (g)
130
- return g;
131
- const p = taggedPseudoClassMatcher("peer", attributifyPseudo ? '[peer=""]' : ".peer", "~")(input);
132
- if (p)
133
- return p;
134
- },
135
- multiPass: true
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
- exports.CONTROL_BYPASS_PSEUDO_CLASS = CONTROL_BYPASS_PSEUDO_CLASS;
154
- exports.partClasses = partClasses;
155
- exports.variantPseudoClassFunctions = variantPseudoClassFunctions;
156
- exports.variantPseudoClasses = variantPseudoClasses;
157
- exports.variantPseudoElements = variantPseudoElements;
158
- exports.variantTaggedPseudoClasses = variantTaggedPseudoClasses;
@@ -1,151 +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 = {
125
- match: (input, { options: { attributifyPseudo } }) => {
126
- const g = taggedPseudoClassMatcher("group", attributifyPseudo ? '[group=""]' : ".group", " ")(input);
127
- if (g)
128
- return g;
129
- const p = taggedPseudoClassMatcher("peer", attributifyPseudo ? '[peer=""]' : ".peer", "~")(input);
130
- if (p)
131
- return p;
132
- },
133
- multiPass: true
134
- };
135
- const partClasses = {
136
- match: (input) => {
137
- const match = input.match(PartClassesRE);
138
- if (match) {
139
- const part = `part(${match[2]})`;
140
- return {
141
- matcher: input.slice(match[1].length),
142
- selector: (s, body) => {
143
- return shouldAdd(body) && `${s}::${part}`;
144
- }
145
- };
146
- }
147
- },
148
- multiPass: true
149
- };
150
-
151
- export { CONTROL_BYPASS_PSEUDO_CLASS as C, variantPseudoClassFunctions as a, variantTaggedPseudoClasses as b, variantPseudoElements as c, partClasses as p, variantPseudoClasses as v };