@unocss/preset-uno 0.14.2 → 0.15.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.
@@ -1,190 +0,0 @@
1
- import {
2
- __export
3
- } from "./chunk-5SH5BFJ4.mjs";
4
-
5
- // src/utils/mappings.ts
6
- var directionMap = {
7
- "l": ["-left"],
8
- "r": ["-right"],
9
- "t": ["-top"],
10
- "b": ["-bottom"],
11
- "s": ["-inline-start"],
12
- "e": ["-inline-end"],
13
- "x": ["-left", "-right"],
14
- "y": ["-top", "-bottom"],
15
- "": [""],
16
- "a": [""]
17
- };
18
- var cornerMap = {
19
- "t": ["-top-left", "-top-right"],
20
- "r": ["-top-right", "-bottom-right"],
21
- "b": ["-bottom-left", "-bottom-right"],
22
- "l": ["-bottom-left", "-top-left"],
23
- "tl": ["-top-left"],
24
- "lt": ["-top-left"],
25
- "tr": ["-top-right"],
26
- "rt": ["-top-right"],
27
- "bl": ["-bottom-left"],
28
- "lb": ["-bottom-left"],
29
- "br": ["-bottom-right"],
30
- "rb": ["-bottom-right"],
31
- "": [""]
32
- };
33
- var xyzMap = {
34
- "x": ["-x"],
35
- "y": ["-y"],
36
- "z": ["-z"],
37
- "": ["-x", "-y"]
38
- };
39
-
40
- // src/utils/handlers/handlers.ts
41
- var handlers_exports = {};
42
- __export(handlers_exports, {
43
- bracket: () => bracket,
44
- cssvar: () => cssvar,
45
- fraction: () => fraction,
46
- global: () => global,
47
- number: () => number,
48
- percent: () => percent,
49
- px: () => px,
50
- rem: () => rem,
51
- time: () => time
52
- });
53
- var numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
54
- var numberRE = /^(-?[0-9.]+)$/i;
55
- function rem(str) {
56
- if (str === "auto" || str === "a")
57
- return "auto";
58
- const match = str.match(numberWithUnitRE);
59
- if (!match)
60
- return;
61
- const [, n, unit] = match;
62
- if (unit)
63
- return str;
64
- const num = parseFloat(n);
65
- if (!Number.isNaN(num))
66
- return `${num / 4}rem`;
67
- }
68
- function px(str) {
69
- const match = str.match(numberWithUnitRE);
70
- if (!match)
71
- return;
72
- const [, n, unit] = match;
73
- if (unit)
74
- return str;
75
- const num = parseFloat(n);
76
- if (!Number.isNaN(num))
77
- return `${num}px`;
78
- }
79
- function number(str) {
80
- if (!numberRE.test(str))
81
- return;
82
- const num = parseFloat(str);
83
- if (!Number.isNaN(num))
84
- return num;
85
- }
86
- function percent(str) {
87
- if (str.endsWith("%"))
88
- str = str.slice(0, -1);
89
- const num = parseFloat(str);
90
- if (!Number.isNaN(num))
91
- return `${num / 100}`;
92
- }
93
- function fraction(str) {
94
- if (str === "full")
95
- return "100%";
96
- const [left, right] = str.split("/");
97
- const num = parseFloat(left) / parseFloat(right);
98
- if (!Number.isNaN(num))
99
- return `${num * 100}%`;
100
- }
101
- function bracket(str) {
102
- if (str && str[0] === "[" && str[str.length - 1] === "]") {
103
- return str.slice(1, -1).replace(/_/g, " ").replace(/calc\((.*)/g, (v) => {
104
- return v.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
105
- });
106
- }
107
- }
108
- function cssvar(str) {
109
- if (str.startsWith("$"))
110
- return `var(--${str.slice(1)})`;
111
- }
112
- function time(str) {
113
- const duration = Number(str.replace(/(s|ms)$/, ""));
114
- if (isNaN(duration))
115
- return;
116
- if (/ms|s$/.test(str))
117
- return str;
118
- return `${str}ms`;
119
- }
120
- function global(str) {
121
- if (["inherit", "initial", "unset"].includes(str))
122
- return str;
123
- }
124
-
125
- // src/utils/handlers/shorthand.ts
126
- var handlersNames = Object.keys(handlers_exports);
127
- var handler = function(str) {
128
- var _a;
129
- const s = ((_a = this.__options) == null ? void 0 : _a.sequence) || [];
130
- this.__options.sequence = [];
131
- for (const n of s) {
132
- const res = handlers_exports[n](str);
133
- if (res != null)
134
- return res;
135
- }
136
- return void 0;
137
- };
138
- function addProcessor(that, name) {
139
- if (!that.__options) {
140
- that.__options = {
141
- sequence: []
142
- };
143
- }
144
- that.__options.sequence.push(name);
145
- return that;
146
- }
147
- handlersNames.forEach((i) => {
148
- Object.defineProperty(handler, i, {
149
- enumerable: true,
150
- get() {
151
- return addProcessor(this, i);
152
- }
153
- });
154
- });
155
-
156
- // src/utils/variants.ts
157
- var variantMatcher = (name, selector) => {
158
- const length = name.length + 1;
159
- const re = new RegExp(`^${name}[:-]`);
160
- return (input) => {
161
- return input.match(re) ? {
162
- matcher: input.slice(length),
163
- selector
164
- } : void 0;
165
- };
166
- };
167
-
168
- // src/utils/index.ts
169
- function capitalize(str) {
170
- return str.charAt(0).toUpperCase() + str.slice(1);
171
- }
172
-
173
- export {
174
- directionMap,
175
- cornerMap,
176
- xyzMap,
177
- rem,
178
- px,
179
- number,
180
- percent,
181
- fraction,
182
- bracket,
183
- cssvar,
184
- time,
185
- global,
186
- handlersNames,
187
- handler,
188
- variantMatcher,
189
- capitalize
190
- };
@@ -1,340 +0,0 @@
1
- // src/theme/colors.ts
2
- var colors = {
3
- inherit: "inherit",
4
- current: "currentColor",
5
- transparent: "transparent",
6
- black: "#000",
7
- white: "#fff",
8
- rose: {
9
- 50: "#fff1f2",
10
- 100: "#ffe4e6",
11
- 200: "#fecdd3",
12
- 300: "#fda4af",
13
- 400: "#fb7185",
14
- 500: "#f43f5e",
15
- 600: "#e11d48",
16
- 700: "#be123c",
17
- 800: "#9f1239",
18
- 900: "#881337"
19
- },
20
- pink: {
21
- 50: "#fdf2f8",
22
- 100: "#fce7f3",
23
- 200: "#fbcfe8",
24
- 300: "#f9a8d4",
25
- 400: "#f472b6",
26
- 500: "#ec4899",
27
- 600: "#db2777",
28
- 700: "#be185d",
29
- 800: "#9d174d",
30
- 900: "#831843"
31
- },
32
- fuchsia: {
33
- 50: "#fdf4ff",
34
- 100: "#fae8ff",
35
- 200: "#f5d0fe",
36
- 300: "#f0abfc",
37
- 400: "#e879f9",
38
- 500: "#d946ef",
39
- 600: "#c026d3",
40
- 700: "#a21caf",
41
- 800: "#86198f",
42
- 900: "#701a75"
43
- },
44
- purple: {
45
- 50: "#faf5ff",
46
- 100: "#f3e8ff",
47
- 200: "#e9d5ff",
48
- 300: "#d8b4fe",
49
- 400: "#c084fc",
50
- 500: "#a855f7",
51
- 600: "#9333ea",
52
- 700: "#7e22ce",
53
- 800: "#6b21a8",
54
- 900: "#581c87"
55
- },
56
- violet: {
57
- 50: "#f5f3ff",
58
- 100: "#ede9fe",
59
- 200: "#ddd6fe",
60
- 300: "#c4b5fd",
61
- 400: "#a78bfa",
62
- 500: "#8b5cf6",
63
- 600: "#7c3aed",
64
- 700: "#6d28d9",
65
- 800: "#5b21b6",
66
- 900: "#4c1d95"
67
- },
68
- indigo: {
69
- 50: "#eef2ff",
70
- 100: "#e0e7ff",
71
- 200: "#c7d2fe",
72
- 300: "#a5b4fc",
73
- 400: "#818cf8",
74
- 500: "#6366f1",
75
- 600: "#4f46e5",
76
- 700: "#4338ca",
77
- 800: "#3730a3",
78
- 900: "#312e81"
79
- },
80
- blue: {
81
- 50: "#eff6ff",
82
- 100: "#dbeafe",
83
- 200: "#bfdbfe",
84
- 300: "#93c5fd",
85
- 400: "#60a5fa",
86
- 500: "#3b82f6",
87
- 600: "#2563eb",
88
- 700: "#1d4ed8",
89
- 800: "#1e40af",
90
- 900: "#1e3a8a"
91
- },
92
- sky: {
93
- 50: "#f0f9ff",
94
- 100: "#e0f2fe",
95
- 200: "#bae6fd",
96
- 300: "#7dd3fc",
97
- 400: "#38bdf8",
98
- 500: "#0ea5e9",
99
- 600: "#0284c7",
100
- 700: "#0369a1",
101
- 800: "#075985",
102
- 900: "#0c4a6e"
103
- },
104
- cyan: {
105
- 50: "#ecfeff",
106
- 100: "#cffafe",
107
- 200: "#a5f3fc",
108
- 300: "#67e8f9",
109
- 400: "#22d3ee",
110
- 500: "#06b6d4",
111
- 600: "#0891b2",
112
- 700: "#0e7490",
113
- 800: "#155e75",
114
- 900: "#164e63"
115
- },
116
- teal: {
117
- 50: "#f0fdfa",
118
- 100: "#ccfbf1",
119
- 200: "#99f6e4",
120
- 300: "#5eead4",
121
- 400: "#2dd4bf",
122
- 500: "#14b8a6",
123
- 600: "#0d9488",
124
- 700: "#0f766e",
125
- 800: "#115e59",
126
- 900: "#134e4a"
127
- },
128
- emerald: {
129
- 50: "#ecfdf5",
130
- 100: "#d1fae5",
131
- 200: "#a7f3d0",
132
- 300: "#6ee7b7",
133
- 400: "#34d399",
134
- 500: "#10b981",
135
- 600: "#059669",
136
- 700: "#047857",
137
- 800: "#065f46",
138
- 900: "#064e3b"
139
- },
140
- green: {
141
- 50: "#f0fdf4",
142
- 100: "#dcfce7",
143
- 200: "#bbf7d0",
144
- 300: "#86efac",
145
- 400: "#4ade80",
146
- 500: "#22c55e",
147
- 600: "#16a34a",
148
- 700: "#15803d",
149
- 800: "#166534",
150
- 900: "#14532d"
151
- },
152
- lime: {
153
- 50: "#f7fee7",
154
- 100: "#ecfccb",
155
- 200: "#d9f99d",
156
- 300: "#bef264",
157
- 400: "#a3e635",
158
- 500: "#84cc16",
159
- 600: "#65a30d",
160
- 700: "#4d7c0f",
161
- 800: "#3f6212",
162
- 900: "#365314"
163
- },
164
- yellow: {
165
- 50: "#fefce8",
166
- 100: "#fef9c3",
167
- 200: "#fef08a",
168
- 300: "#fde047",
169
- 400: "#facc15",
170
- 500: "#eab308",
171
- 600: "#ca8a04",
172
- 700: "#a16207",
173
- 800: "#854d0e",
174
- 900: "#713f12"
175
- },
176
- amber: {
177
- 50: "#fffbeb",
178
- 100: "#fef3c7",
179
- 200: "#fde68a",
180
- 300: "#fcd34d",
181
- 400: "#fbbf24",
182
- 500: "#f59e0b",
183
- 600: "#d97706",
184
- 700: "#b45309",
185
- 800: "#92400e",
186
- 900: "#78350f"
187
- },
188
- orange: {
189
- 50: "#fff7ed",
190
- 100: "#ffedd5",
191
- 200: "#fed7aa",
192
- 300: "#fdba74",
193
- 400: "#fb923c",
194
- 500: "#f97316",
195
- 600: "#ea580c",
196
- 700: "#c2410c",
197
- 800: "#9a3412",
198
- 900: "#7c2d12"
199
- },
200
- red: {
201
- 50: "#fef2f2",
202
- 100: "#fee2e2",
203
- 200: "#fecaca",
204
- 300: "#fca5a5",
205
- 400: "#f87171",
206
- 500: "#ef4444",
207
- 600: "#dc2626",
208
- 700: "#b91c1c",
209
- 800: "#991b1b",
210
- 900: "#7f1d1d"
211
- },
212
- gray: {
213
- 50: "#f9fafb",
214
- 100: "#f3f4f6",
215
- 200: "#e5e7eb",
216
- 300: "#d1d5db",
217
- 400: "#9ca3af",
218
- 500: "#6b7280",
219
- 600: "#4b5563",
220
- 700: "#374151",
221
- 800: "#1f2937",
222
- 900: "#111827"
223
- },
224
- slate: {
225
- 50: "#f8fafc",
226
- 100: "#f1f5f9",
227
- 200: "#e2e8f0",
228
- 300: "#cbd5e1",
229
- 400: "#94a3b8",
230
- 500: "#64748b",
231
- 600: "#475569",
232
- 700: "#334155",
233
- 800: "#1e293b",
234
- 900: "#0f172a"
235
- },
236
- zinc: {
237
- 50: "#fafafa",
238
- 100: "#f4f4f5",
239
- 200: "#e4e4e7",
240
- 300: "#d4d4d8",
241
- 400: "#a1a1aa",
242
- 500: "#71717a",
243
- 600: "#52525b",
244
- 700: "#3f3f46",
245
- 800: "#27272a",
246
- 900: "#18181b"
247
- },
248
- neutral: {
249
- 50: "#fafafa",
250
- 100: "#f5f5f5",
251
- 200: "#e5e5e5",
252
- 300: "#d4d4d4",
253
- 400: "#a3a3a3",
254
- 500: "#737373",
255
- 600: "#525252",
256
- 700: "#404040",
257
- 800: "#262626",
258
- 900: "#171717"
259
- },
260
- stone: {
261
- 50: "#fafaf9",
262
- 100: "#f5f5f4",
263
- 200: "#e7e5e4",
264
- 300: "#d6d3d1",
265
- 400: "#a8a29e",
266
- 500: "#78716c",
267
- 600: "#57534e",
268
- 700: "#44403c",
269
- 800: "#292524",
270
- 900: "#1c1917"
271
- },
272
- light: {
273
- 50: "#fdfdfd",
274
- 100: "#fcfcfc",
275
- 200: "#fafafa",
276
- 300: "#f8f9fa",
277
- 400: "#f6f6f6",
278
- 500: "#f2f2f2",
279
- 600: "#f1f3f5",
280
- 700: "#e9ecef",
281
- 800: "#dee2e6",
282
- 900: "#dde1e3"
283
- },
284
- dark: {
285
- 50: "#4a4a4a",
286
- 100: "#3c3c3c",
287
- 200: "#323232",
288
- 300: "#2d2d2d",
289
- 400: "#222222",
290
- 500: "#1f1f1f",
291
- 600: "#1c1c1e",
292
- 700: "#1b1b1b",
293
- 800: "#181818",
294
- 900: "#0f0f0f"
295
- },
296
- get lightblue() {
297
- return this.sky;
298
- },
299
- get lightBlue() {
300
- return this.sky;
301
- },
302
- get warmgray() {
303
- return this.stone;
304
- },
305
- get warmGray() {
306
- return this.stone;
307
- },
308
- get truegray() {
309
- return this.neutral;
310
- },
311
- get trueGray() {
312
- return this.neutral;
313
- },
314
- get coolgray() {
315
- return this.gray;
316
- },
317
- get coolGray() {
318
- return this.gray;
319
- },
320
- get bluegray() {
321
- return this.slate;
322
- },
323
- get blueGray() {
324
- return this.slate;
325
- }
326
- };
327
- Object.values(colors).forEach((color) => {
328
- if (typeof color !== "string") {
329
- color.DEFAULT = color.DEFAULT || color[400];
330
- Object.keys(color).forEach((key) => {
331
- const short = +key / 100;
332
- if (short === Math.round(short))
333
- color[short] = color[key];
334
- });
335
- }
336
- });
337
-
338
- export {
339
- colors
340
- };
@@ -1,139 +0,0 @@
1
- import {
2
- variantPseudoClasses,
3
- variantPseudoElements
4
- } from "./chunk-CKV32YDT.mjs";
5
- import {
6
- variantMatcher
7
- } from "./chunk-O7YRGPXQ.mjs";
8
-
9
- // src/variants/breakpoints.ts
10
- var regexCache = {};
11
- var variantBreakpoints = (matcher, _, theme) => {
12
- const variantEntries = Object.entries(theme.breakpoints || {}).map(([point, size], idx) => [point, size, idx]);
13
- for (const [point, size, idx] of variantEntries) {
14
- if (!regexCache[point])
15
- regexCache[point] = new RegExp(`^((?:[a|l]t-)?${point}[:-])`);
16
- const match = matcher.match(regexCache[point]);
17
- if (!match)
18
- continue;
19
- const [, pre] = match;
20
- let direction = "min";
21
- let order = parseInt(size);
22
- if (pre.startsWith("lt-")) {
23
- direction = "max";
24
- order = -order;
25
- }
26
- const m = matcher.slice(pre.length);
27
- if (m === "container")
28
- continue;
29
- if (pre.startsWith("at-") && idx < variantEntries.length - 1) {
30
- return {
31
- matcher: m,
32
- parent: [`@media (min-width: ${size}) and (max-width: ${variantEntries[idx + 1][1]})`, order]
33
- };
34
- }
35
- return {
36
- matcher: m,
37
- parent: [`@media (${direction}-width: ${size})`, order]
38
- };
39
- }
40
- };
41
-
42
- // src/variants/children.ts
43
- var variantChildren = [
44
- variantMatcher("children", (input) => `${input} > *`),
45
- variantMatcher("all", (input) => `${input} *`),
46
- variantMatcher("next", (input) => `${input}+*`)
47
- ];
48
-
49
- // src/variants/dark.ts
50
- var variantColorsClass = [
51
- variantMatcher("dark", (input) => `.dark $$ ${input}`),
52
- variantMatcher("light", (input) => `.light $$ ${input}`)
53
- ];
54
- var variantColorsMedia = [
55
- (v) => {
56
- const dark = variantMatcher("dark")(v);
57
- if (dark) {
58
- return {
59
- ...dark,
60
- parent: "@media (prefers-color-scheme: dark)"
61
- };
62
- }
63
- const light = variantMatcher("light")(v);
64
- if (light) {
65
- return {
66
- ...light,
67
- parent: "@media (prefers-color-scheme: light)"
68
- };
69
- }
70
- }
71
- ];
72
-
73
- // src/variants/misc.ts
74
- var variantImportant = {
75
- match(matcher) {
76
- if (matcher.startsWith("!")) {
77
- return {
78
- matcher: matcher.slice(1),
79
- body: (body) => {
80
- body.forEach((v) => {
81
- if (v[1])
82
- v[1] += " !important";
83
- });
84
- return body;
85
- }
86
- };
87
- }
88
- }
89
- };
90
- var variantNegative = {
91
- match(matcher) {
92
- if (matcher.startsWith("-")) {
93
- return {
94
- matcher: matcher.slice(1),
95
- body: (body) => {
96
- body.forEach((v) => {
97
- var _a, _b;
98
- if (v[0].startsWith("--un-scale") || ((_a = v[1]) == null ? void 0 : _a.toString()) === "0")
99
- return;
100
- v[1] = (_b = v[1]) == null ? void 0 : _b.toString().replace(/[0-9.]+(?:[a-z]+|%)?/, (i) => `-${i}`);
101
- });
102
- return body;
103
- }
104
- };
105
- }
106
- }
107
- };
108
- var variantSpace = (matcher) => {
109
- if (/^space-?([xy])-?(-?.+)$/.test(matcher) || /^divide-/.test(matcher)) {
110
- return {
111
- matcher,
112
- selector: (input) => {
113
- return `${input}>:not([hidden])~:not([hidden])`;
114
- }
115
- };
116
- }
117
- };
118
-
119
- // src/variants/default.ts
120
- var variants = [
121
- variantSpace,
122
- variantNegative,
123
- variantImportant,
124
- variantBreakpoints,
125
- ...variantChildren,
126
- variantPseudoClasses,
127
- variantPseudoElements
128
- ];
129
-
130
- export {
131
- variantBreakpoints,
132
- variantChildren,
133
- variantColorsClass,
134
- variantColorsMedia,
135
- variantImportant,
136
- variantNegative,
137
- variantSpace,
138
- variants
139
- };