@unocss/preset-uno 0.1.0-beta.2 → 0.1.3
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/README.md +1 -1
- package/dist/chunk-5VZAX2M2.js +23 -0
- package/dist/chunk-7JQ3YQ3R.js +181 -0
- package/dist/chunk-C52N6GD5.mjs +23 -0
- package/dist/chunk-DFXBYGDQ.js +742 -0
- package/dist/chunk-DZNLHHE7.js +408 -0
- package/dist/chunk-GZCILHEZ.mjs +181 -0
- package/dist/chunk-S5DFLDKC.mjs +408 -0
- package/dist/chunk-S7XMIAO4.mjs +742 -0
- package/dist/index.js +16 -1
- package/dist/index.mjs +16 -1
- package/dist/rules.js +9 -1
- package/dist/rules.mjs +9 -1
- package/dist/theme.js +13 -1
- package/dist/theme.mjs +13 -1
- package/dist/variants.d.ts +18 -0
- package/dist/variants.js +27 -1
- package/dist/variants.mjs +27 -1
- package/package.json +2 -2
- package/dist/chunk-23VNEA2F.mjs +0 -1
- package/dist/chunk-2GX2NBYT.mjs +0 -1
- package/dist/chunk-4OCNSGZJ.mjs +0 -1
- package/dist/chunk-IRVOVJSX.js +0 -1
- package/dist/chunk-UZPC3RPP.js +0 -1
- package/dist/chunk-VIBF67CT.mjs +0 -1
- package/dist/chunk-WB7VET2U.js +0 -1
- package/dist/chunk-ZZFFLETS.js +0 -1
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ For example, both `ml-3` (Tailwind), `ms-2` (Bootstrap), `ma4` (Tachyons), `mt-1
|
|
|
33
33
|
.mt-10px { margin-top: 10px; }
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
For more details about the default preset, you can check out our [playground](https://unocss
|
|
36
|
+
For more details about the default preset, you can check out our [playground](https://unocss.antfu.me/) and try out. Meanwhile, you can also check out [the implementation](./src/rules).
|
|
37
37
|
|
|
38
38
|
## License
|
|
39
39
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
__markAsModule(target);
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __reExport = (target, module, desc) => {
|
|
12
|
+
if (module && typeof module === "object" || typeof module === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(module))
|
|
14
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
15
|
+
__defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return target;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
exports.__export = __export; exports.__reExport = __reExport;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/variants/breakpoints.ts
|
|
2
|
+
var regexCache = {};
|
|
3
|
+
var variantBreakpoints = {
|
|
4
|
+
match(input, theme) {
|
|
5
|
+
for (const point of Object.keys(theme.breakpoints || {})) {
|
|
6
|
+
if (!regexCache[point])
|
|
7
|
+
regexCache[point] = new RegExp(`^((?:lt-)?${point}[:-])`);
|
|
8
|
+
const match = input.match(regexCache[point]);
|
|
9
|
+
if (match)
|
|
10
|
+
return input.slice(match[1].length);
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
mediaQuery(input, theme) {
|
|
14
|
+
var _a;
|
|
15
|
+
const [, d, s] = input.match(/^(lt-)?(\w+)[:-]/) || [];
|
|
16
|
+
if (!s)
|
|
17
|
+
return;
|
|
18
|
+
let direction = "min";
|
|
19
|
+
if (d === "lt-")
|
|
20
|
+
direction = "max";
|
|
21
|
+
const point = (_a = theme.breakpoints) == null ? void 0 : _a[s];
|
|
22
|
+
if (point)
|
|
23
|
+
return `@media (${direction}-width: ${point})`;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// ../core/src/utils/basic.ts
|
|
28
|
+
function toArray(value = []) {
|
|
29
|
+
return Array.isArray(value) ? value : [value];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// ../core/src/utils/variant.ts
|
|
33
|
+
var variantMatcher = (name) => {
|
|
34
|
+
const length = name.length + 1;
|
|
35
|
+
const re = new RegExp(`^${name}[:-]`);
|
|
36
|
+
return (input) => input.match(re) ? input.slice(length) : void 0;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// src/variants/children.ts
|
|
40
|
+
var variantChildren = [
|
|
41
|
+
{
|
|
42
|
+
match: variantMatcher("children"),
|
|
43
|
+
selector: (input) => `${input} > *`
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
match: variantMatcher("all"),
|
|
47
|
+
selector: (input) => `${input} *`
|
|
48
|
+
}
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
// src/variants/dark.ts
|
|
52
|
+
var variantColorsClass = [
|
|
53
|
+
{
|
|
54
|
+
match: variantMatcher("dark"),
|
|
55
|
+
selector: (input) => `.dark $$ ${input}`
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
match: variantMatcher("light"),
|
|
59
|
+
selector: (input) => `.light $$ ${input}`
|
|
60
|
+
}
|
|
61
|
+
];
|
|
62
|
+
var variantColorsMedia = [
|
|
63
|
+
{
|
|
64
|
+
match: variantMatcher("dark"),
|
|
65
|
+
mediaQuery: () => "@media (prefers-color-scheme: dark)"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
match: variantMatcher("light"),
|
|
69
|
+
mediaQuery: () => "@media (prefers-color-scheme: light)"
|
|
70
|
+
}
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
// src/variants/pseudo.ts
|
|
74
|
+
function createPseudoClassVariant(name, pseudo = name) {
|
|
75
|
+
return [
|
|
76
|
+
{
|
|
77
|
+
match: variantMatcher(name),
|
|
78
|
+
selector: (input) => `${input}:${pseudo}`
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
match: variantMatcher(`not-${name}`),
|
|
82
|
+
selector: (input) => `${input}:not(:${pseudo})`
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
match: variantMatcher(`group-${name}`),
|
|
86
|
+
selector: (input) => `.group:${pseudo} ${input}`
|
|
87
|
+
}
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
function createPseudoElementVariant(name) {
|
|
91
|
+
return {
|
|
92
|
+
match: variantMatcher(name),
|
|
93
|
+
selector: (input) => `${input}::${name}`
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
var variantPseudoClasses = [
|
|
97
|
+
"active",
|
|
98
|
+
"checked",
|
|
99
|
+
"default",
|
|
100
|
+
"empty",
|
|
101
|
+
"enabled",
|
|
102
|
+
"first-of-type",
|
|
103
|
+
"first",
|
|
104
|
+
"focus-visible",
|
|
105
|
+
"focus-within",
|
|
106
|
+
"focus",
|
|
107
|
+
"hover",
|
|
108
|
+
"indeterminate",
|
|
109
|
+
"invalid",
|
|
110
|
+
"last-of-type",
|
|
111
|
+
"last",
|
|
112
|
+
"link",
|
|
113
|
+
"only-child",
|
|
114
|
+
"only-of-type",
|
|
115
|
+
"optional",
|
|
116
|
+
"placeholder-shown",
|
|
117
|
+
"read-only",
|
|
118
|
+
"read-write",
|
|
119
|
+
"required",
|
|
120
|
+
"root",
|
|
121
|
+
"target",
|
|
122
|
+
"valid",
|
|
123
|
+
"visited",
|
|
124
|
+
["even-of-type", "nth-of-type(even)"],
|
|
125
|
+
["even", "nth-child(even)"],
|
|
126
|
+
["odd-of-type", "nth-of-type(odd)"],
|
|
127
|
+
["odd", "nth-child(odd)"]
|
|
128
|
+
].flatMap((i) => createPseudoClassVariant(...toArray(i)));
|
|
129
|
+
var variantPseudoElements = [
|
|
130
|
+
"before",
|
|
131
|
+
"after",
|
|
132
|
+
"first-letter",
|
|
133
|
+
"first-line",
|
|
134
|
+
"selection"
|
|
135
|
+
].map(createPseudoElementVariant);
|
|
136
|
+
|
|
137
|
+
// src/variants/index.ts
|
|
138
|
+
var variantImportant = {
|
|
139
|
+
match: (input) => input.startsWith("!") ? input.slice(1) : void 0,
|
|
140
|
+
rewrite: (input) => {
|
|
141
|
+
input.forEach((v) => {
|
|
142
|
+
if (v[1])
|
|
143
|
+
v[1] += " !important";
|
|
144
|
+
});
|
|
145
|
+
return input;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
var variantNegative = {
|
|
149
|
+
match: (input) => input.startsWith("-") ? input.slice(1) : void 0,
|
|
150
|
+
rewrite: (input) => {
|
|
151
|
+
input.forEach((v) => {
|
|
152
|
+
var _a;
|
|
153
|
+
if ((_a = v[1]) == null ? void 0 : _a.toString().match(/^\d/))
|
|
154
|
+
v[1] = `-${v[1]}`;
|
|
155
|
+
});
|
|
156
|
+
return input;
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
var variants = [
|
|
160
|
+
variantNegative,
|
|
161
|
+
variantImportant,
|
|
162
|
+
variantBreakpoints,
|
|
163
|
+
...variantChildren,
|
|
164
|
+
...variantColorsClass,
|
|
165
|
+
...variantPseudoClasses,
|
|
166
|
+
...variantPseudoElements
|
|
167
|
+
];
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
exports.variantBreakpoints = variantBreakpoints; exports.variantChildren = variantChildren; exports.variantColorsClass = variantColorsClass; exports.variantColorsMedia = variantColorsMedia; exports.createPseudoClassVariant = createPseudoClassVariant; exports.createPseudoElementVariant = createPseudoElementVariant; exports.variantPseudoClasses = variantPseudoClasses; exports.variantPseudoElements = variantPseudoElements; exports.variantImportant = variantImportant; exports.variantNegative = variantNegative; exports.variants = variants;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
__markAsModule(target);
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __reExport = (target, module, desc) => {
|
|
12
|
+
if (module && typeof module === "object" || typeof module === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(module))
|
|
14
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
15
|
+
__defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return target;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
__export,
|
|
22
|
+
__reExport
|
|
23
|
+
};
|