@unocss/preset-uno 0.2.0 → 0.4.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.
@@ -62,17 +62,7 @@ var variantColorsMedia = [
62
62
 
63
63
  // src/variants/pseudo.ts
64
64
  var _core = require('@unocss/core');
65
- function createPseudoClassVariant(name, pseudo = name) {
66
- return [
67
- variantMatcher(name, (input) => `${input}:${pseudo}`),
68
- variantMatcher(`not-${name}`, (input) => `${input}:not(:${pseudo})`),
69
- variantMatcher(`group-${name}`, (input) => `.group:${pseudo} ${input}`)
70
- ];
71
- }
72
- function createPseudoElementVariant(name) {
73
- return variantMatcher(name, (input) => `${input}::${name}`);
74
- }
75
- var variantPseudoClasses = [
65
+ var PseudoClasses = Object.fromEntries([
76
66
  "active",
77
67
  "checked",
78
68
  "default",
@@ -104,14 +94,57 @@ var variantPseudoClasses = [
104
94
  ["even", "nth-child(even)"],
105
95
  ["odd-of-type", "nth-of-type(odd)"],
106
96
  ["odd", "nth-child(odd)"]
107
- ].flatMap((i) => createPseudoClassVariant(..._core.toArray.call(void 0, i)));
108
- var variantPseudoElements = [
97
+ ].map(_core.toArray));
98
+ var PseudoElements = [
109
99
  "before",
110
100
  "after",
111
101
  "first-letter",
112
102
  "first-line",
113
103
  "selection"
114
- ].map(createPseudoElementVariant);
104
+ ];
105
+ var PseudoElementsRE = new RegExp(`^(${PseudoElements.join("|")})[:-]`);
106
+ var PseudoClassesStr = Object.keys(PseudoClasses).join("|");
107
+ var PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
108
+ var PseudoClassesNotRE = new RegExp(`^not-(${PseudoClassesStr})[:-]`);
109
+ var PseudoClassesGroupRE = new RegExp(`^group-(${PseudoClassesStr})[:-]`);
110
+ var variantPseudoElements = (input) => {
111
+ const match = input.match(PseudoElementsRE);
112
+ if (match) {
113
+ return {
114
+ matcher: input.slice(match[1].length + 1),
115
+ selector: (input2) => `${input2}::${match[1]}`
116
+ };
117
+ }
118
+ };
119
+ var variantPseudoClasses = {
120
+ match: (input) => {
121
+ let match = input.match(PseudoClassesRE);
122
+ if (match) {
123
+ const pseudo = PseudoClasses[match[1]] || match[1];
124
+ return {
125
+ matcher: input.slice(match[1].length + 1),
126
+ selector: (input2) => `${input2}:${pseudo}`
127
+ };
128
+ }
129
+ match = input.match(PseudoClassesNotRE);
130
+ if (match) {
131
+ const pseudo = PseudoClasses[match[1]] || match[1];
132
+ return {
133
+ matcher: input.slice(match[1].length + 5),
134
+ selector: (input2) => `${input2}:not(:${pseudo})`
135
+ };
136
+ }
137
+ match = input.match(PseudoClassesGroupRE);
138
+ if (match) {
139
+ const pseudo = PseudoClasses[match[1]] || match[1];
140
+ return {
141
+ matcher: input.slice(match[1].length + 7),
142
+ selector: (input2) => `.group:${pseudo} ${input2}`
143
+ };
144
+ }
145
+ },
146
+ multiPass: true
147
+ };
115
148
 
116
149
  // src/variants/index.ts
117
150
  var variantImportant = {
@@ -153,8 +186,8 @@ var variants = [
153
186
  variantBreakpoints,
154
187
  ...variantChildren,
155
188
  ...variantColorsClass,
156
- ...variantPseudoClasses,
157
- ...variantPseudoElements
189
+ variantPseudoClasses,
190
+ variantPseudoElements
158
191
  ];
159
192
 
160
193
 
@@ -168,5 +201,4 @@ var variants = [
168
201
 
169
202
 
170
203
 
171
-
172
- 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;
204
+ exports.variantBreakpoints = variantBreakpoints; exports.variantChildren = variantChildren; exports.variantColorsClass = variantColorsClass; exports.variantColorsMedia = variantColorsMedia; exports.PseudoClasses = PseudoClasses; exports.variantPseudoElements = variantPseudoElements; exports.variantPseudoClasses = variantPseudoClasses; exports.variantImportant = variantImportant; exports.variantNegative = variantNegative; exports.variants = variants;
@@ -2,15 +2,75 @@ import {
2
2
  __export
3
3
  } from "./chunk-YI4MPAID.mjs";
4
4
 
5
- // src/rules/animation.ts
6
- var transitionProps = ["background-color", "border-color", "color", "fill", "stroke", "opacity", "box-shadow", "transform", "filter", "backdrop-filter"];
5
+ // src/rules/transition.ts
6
+ var transitionBasicProps = [
7
+ "color",
8
+ "border-color",
9
+ "background-color",
10
+ "flex-grow",
11
+ "flex",
12
+ "flex-shrink",
13
+ "caret-color",
14
+ "font",
15
+ "gap",
16
+ "opacity",
17
+ "visibility",
18
+ "z-index",
19
+ "font-weight",
20
+ "zoom",
21
+ "text-shadow",
22
+ "transform",
23
+ "box-shadow"
24
+ ];
25
+ var transitionPositionProps = [
26
+ "backround-position",
27
+ "left",
28
+ "right",
29
+ "top",
30
+ "bottom",
31
+ "object-position"
32
+ ];
33
+ var transitionSizeProps = [
34
+ "max-height",
35
+ "min-height",
36
+ "max-width",
37
+ "min-width",
38
+ "height",
39
+ "width",
40
+ "border-width",
41
+ "margin",
42
+ "padding",
43
+ "outline-width",
44
+ "outline-offset",
45
+ "font-size",
46
+ "line-height",
47
+ "text-indent",
48
+ "vertical-align",
49
+ "border-spacing",
50
+ "letter-spacing",
51
+ "word-spacing"
52
+ ];
53
+ var transitionSwtichProps = ["all", "none"];
54
+ var transitionEnhanceProps = ["stroke", "filter", "backdrop-filter", "fill", "mask", "mask-size", "mask-border", "clip-path", "clip"];
55
+ var transitionProps = [
56
+ ...transitionBasicProps,
57
+ ...transitionPositionProps,
58
+ ...transitionSizeProps,
59
+ ...transitionEnhanceProps
60
+ ];
7
61
  var transitionPropsStr = transitionProps.join(", ");
62
+ var validateProperty = (prop) => {
63
+ if (prop && ![...transitionProps, ...transitionSwtichProps].includes(prop))
64
+ return;
65
+ return prop || transitionPropsStr;
66
+ };
8
67
  var transitions = [
9
68
  [/^transition(?:-([a-z-]+))?(?:-(\d+))?$/, ([, prop, duration = "150"]) => {
10
- if (prop && !transitionProps.includes(prop))
69
+ const transitionProperty = validateProperty(prop);
70
+ if (!transitionProperty)
11
71
  return;
12
72
  return {
13
- "transition-property": prop || transitionPropsStr,
73
+ "transition-property": transitionProperty,
14
74
  "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)",
15
75
  "transition-duration": `${duration}ms`
16
76
  };
@@ -23,7 +83,14 @@ var transitions = [
23
83
  ["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
24
84
  ["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
25
85
  ["ease-out", { "transition-timing-function": "cubic-bezier(0, 0, 0.2, 1)" }],
26
- ["ease-in-out", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }]
86
+ ["ease-in-out", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
87
+ [/^transition-delay-(\d+)$/, ([, v]) => ({ "transition-delay": `${v}ms` })],
88
+ [/^transition-duration-(\d+)$/, ([, v]) => ({ "transition-duration": `${v}ms` })],
89
+ [/^(?:transition-)?property-([a-z-]+)$/, ([, v]) => {
90
+ const transitionProperty = validateProperty(v);
91
+ if (transitionProperty)
92
+ return { "transition-property": transitionProperty };
93
+ }]
27
94
  ];
28
95
 
29
96
  // src/utils/mappings.ts
@@ -155,7 +222,7 @@ handlersNames.forEach((i) => {
155
222
 
156
223
  // src/rules/color.ts
157
224
  import { hex2rgba } from "@unocss/core";
158
- var colorResolver = (attribute, varName) => ([, body], theme) => {
225
+ var colorResolver = (attribute, varName) => ([, body], { theme }) => {
159
226
  var _a;
160
227
  const [main, opacity2] = body.split(/(?:\/|:)/);
161
228
  const [name, no = "DEFAULT"] = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
@@ -261,7 +328,7 @@ function handlerBorder([, a, b]) {
261
328
  ];
262
329
  }
263
330
  }
264
- function handlerRounded([, a, b], theme) {
331
+ function handlerRounded([, a, b], { theme }) {
265
332
  var _a;
266
333
  const [d, s = "DEFAULT"] = cornerMap[a] ? [a, b] : ["", a];
267
334
  const v = ((_a = theme.borderRadius) == null ? void 0 : _a[s]) || handler.bracket.fraction.rem(s);
@@ -315,7 +382,7 @@ var flex = [
315
382
  // src/rules/font.ts
316
383
  import { toArray } from "@unocss/core";
317
384
  var fontsFamilies = [
318
- [/^font-(\w+)$/, ([, d], theme) => {
385
+ [/^font-(\w+)$/, ([, d], { theme }) => {
319
386
  var _a;
320
387
  const font = (_a = theme.fontFamily) == null ? void 0 : _a[d];
321
388
  if (font) {
@@ -337,7 +404,7 @@ var weightMap = {
337
404
  black: "900"
338
405
  };
339
406
  var fontSizes = [
340
- [/^text-([^-]+)$/, ([, s = "base"], theme) => {
407
+ [/^text-([^-]+)$/, ([, s = "base"], { theme }) => {
341
408
  var _a;
342
409
  const result = toArray(((_a = theme.fontSize) == null ? void 0 : _a[s]) || handler.bracket.rem(s));
343
410
  if (result == null ? void 0 : result[0]) {
@@ -357,7 +424,7 @@ var fontWeights = [
357
424
  }]
358
425
  ];
359
426
  var leadings = [
360
- [/^(?:leading|lh)-([^-]+)$/, ([, s], theme) => {
427
+ [/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => {
361
428
  var _a;
362
429
  const v = ((_a = theme.lineHeight) == null ? void 0 : _a[s]) || handler.bracket.rem(s);
363
430
  if (v !== null)
@@ -365,7 +432,7 @@ var leadings = [
365
432
  }]
366
433
  ];
367
434
  var trackings = [
368
- [/^tracking-([^-]+)$/, ([, s], theme) => {
435
+ [/^tracking-([^-]+)$/, ([, s], { theme }) => {
369
436
  var _a;
370
437
  const v = ((_a = theme.letterSpacing) == null ? void 0 : _a[s]) || handler.bracket.rem(s);
371
438
  if (v !== null)
@@ -410,13 +477,59 @@ var gaps = [
410
477
  ];
411
478
 
412
479
  // src/rules/grid.ts
480
+ import { toArray as toArray2 } from "@unocss/core";
481
+ var calSize = (s, theme) => {
482
+ var _a;
483
+ return toArray2(((_a = theme.fontSize) == null ? void 0 : _a[s]) || handler.bracket.rem(s))[0];
484
+ };
485
+ var isNumber = (s) => !isNaN(Number(s));
486
+ var autoDirection = (selector, theme) => {
487
+ if (selector === "min")
488
+ return "min-content";
489
+ else if (selector === "max")
490
+ return "max-content";
491
+ else if (selector === "fr")
492
+ return "minmax(0, 1fr)";
493
+ return calSize(selector, theme);
494
+ };
413
495
  var grids = [
414
496
  ["grid", { display: "grid" }],
415
497
  ["inline-grid", { display: "inline-grid" }],
416
498
  [/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d}, minmax(0, 1fr))` })],
417
499
  [/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d}, minmax(0, 1fr))` })],
418
500
  [/^grid-cols-\[(.+)\]$/, ([, v]) => ({ "grid-template-columns": v.replace(/,/g, " ") })],
419
- [/^grid-rows-\[(.+)\]$/, ([, v]) => ({ "grid-template-rows": v.replace(/,/g, " ") })]
501
+ [/^grid-rows-\[(.+)\]$/, ([, v]) => ({ "grid-template-rows": v.replace(/,/g, " ") })],
502
+ [/^(?:grid-)?auto-flow-(.+)$/, ([, v]) => ({ "grid-auto-flow": `${v.replace("col", "column").split("-").join(" ")}` })],
503
+ [/^(?:grid-)?row-start-(.+)$/, ([, v]) => ({ "grid-row-start": `${v}` })],
504
+ [/^(?:grid-)?row-end-(.+)$/, ([, v]) => ({ "grid-row-end": `${v}` })],
505
+ [/^(?:grid-)?col-start-(.+)$/, ([, v]) => ({ "grid-column-start": `${v}` })],
506
+ [/^(?:grid-)?col-end-(.+)$/, ([, v]) => ({ "grid-column-end": `${v}` })],
507
+ [/^(?:grid-)?auto-rows-(.+)$/, ([, v], { theme }) => ({ "grid-auto-rows": `${autoDirection(v, theme)}` })],
508
+ [/^(?:grid-)?auto-cols-(.+)$/, ([, v], { theme }) => ({ "grid-auto-columns": `${autoDirection(v, theme)}` })],
509
+ [/^(?:grid-)?row-((?!(start)|(end)).+)$/, ([, v]) => {
510
+ const shortArr = v.split("-");
511
+ if (shortArr[0] === "span") {
512
+ if (shortArr[1] === "full") {
513
+ return {
514
+ "grid-row": "1 / -1"
515
+ };
516
+ }
517
+ return isNumber(shortArr[1]) ? { "grid-row": `span ${shortArr[1]} / span ${shortArr[1]}` } : void 0;
518
+ }
519
+ return { "grid-row": v.split("-").join(" ") };
520
+ }],
521
+ [/^(?:grid-)?col-((?!(start)|(end)).+)$/, ([, v]) => {
522
+ const shortArr = v.split("-");
523
+ if (shortArr[0] === "span") {
524
+ if (shortArr[1] === "full") {
525
+ return {
526
+ "grid-column": "1 / -1"
527
+ };
528
+ }
529
+ return isNumber(shortArr[1]) ? { "grid-column": `span ${shortArr[1]} / span ${shortArr[1]}` } : void 0;
530
+ }
531
+ return { "grid-column": v.split("-").join(" ") };
532
+ }]
420
533
  ];
421
534
 
422
535
  // src/rules/layout.ts
@@ -552,7 +665,7 @@ var rings = [
552
665
 
553
666
  // src/rules/shadow.ts
554
667
  var shadows = [
555
- [/^shadow-?(.*)$/, ([, d], theme) => {
668
+ [/^shadow-?(.*)$/, ([, d], { theme }) => {
556
669
  var _a;
557
670
  const value = (_a = theme == null ? void 0 : theme.textShadow) == null ? void 0 : _a[d || "DEFAULT"];
558
671
  if (value) {
@@ -2,15 +2,75 @@
2
2
 
3
3
  var _chunkOFR2H3GIjs = require('./chunk-OFR2H3GI.js');
4
4
 
5
- // src/rules/animation.ts
6
- var transitionProps = ["background-color", "border-color", "color", "fill", "stroke", "opacity", "box-shadow", "transform", "filter", "backdrop-filter"];
5
+ // src/rules/transition.ts
6
+ var transitionBasicProps = [
7
+ "color",
8
+ "border-color",
9
+ "background-color",
10
+ "flex-grow",
11
+ "flex",
12
+ "flex-shrink",
13
+ "caret-color",
14
+ "font",
15
+ "gap",
16
+ "opacity",
17
+ "visibility",
18
+ "z-index",
19
+ "font-weight",
20
+ "zoom",
21
+ "text-shadow",
22
+ "transform",
23
+ "box-shadow"
24
+ ];
25
+ var transitionPositionProps = [
26
+ "backround-position",
27
+ "left",
28
+ "right",
29
+ "top",
30
+ "bottom",
31
+ "object-position"
32
+ ];
33
+ var transitionSizeProps = [
34
+ "max-height",
35
+ "min-height",
36
+ "max-width",
37
+ "min-width",
38
+ "height",
39
+ "width",
40
+ "border-width",
41
+ "margin",
42
+ "padding",
43
+ "outline-width",
44
+ "outline-offset",
45
+ "font-size",
46
+ "line-height",
47
+ "text-indent",
48
+ "vertical-align",
49
+ "border-spacing",
50
+ "letter-spacing",
51
+ "word-spacing"
52
+ ];
53
+ var transitionSwtichProps = ["all", "none"];
54
+ var transitionEnhanceProps = ["stroke", "filter", "backdrop-filter", "fill", "mask", "mask-size", "mask-border", "clip-path", "clip"];
55
+ var transitionProps = [
56
+ ...transitionBasicProps,
57
+ ...transitionPositionProps,
58
+ ...transitionSizeProps,
59
+ ...transitionEnhanceProps
60
+ ];
7
61
  var transitionPropsStr = transitionProps.join(", ");
62
+ var validateProperty = (prop) => {
63
+ if (prop && ![...transitionProps, ...transitionSwtichProps].includes(prop))
64
+ return;
65
+ return prop || transitionPropsStr;
66
+ };
8
67
  var transitions = [
9
68
  [/^transition(?:-([a-z-]+))?(?:-(\d+))?$/, ([, prop, duration = "150"]) => {
10
- if (prop && !transitionProps.includes(prop))
69
+ const transitionProperty = validateProperty(prop);
70
+ if (!transitionProperty)
11
71
  return;
12
72
  return {
13
- "transition-property": prop || transitionPropsStr,
73
+ "transition-property": transitionProperty,
14
74
  "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)",
15
75
  "transition-duration": `${duration}ms`
16
76
  };
@@ -23,7 +83,14 @@ var transitions = [
23
83
  ["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
24
84
  ["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
25
85
  ["ease-out", { "transition-timing-function": "cubic-bezier(0, 0, 0.2, 1)" }],
26
- ["ease-in-out", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }]
86
+ ["ease-in-out", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
87
+ [/^transition-delay-(\d+)$/, ([, v]) => ({ "transition-delay": `${v}ms` })],
88
+ [/^transition-duration-(\d+)$/, ([, v]) => ({ "transition-duration": `${v}ms` })],
89
+ [/^(?:transition-)?property-([a-z-]+)$/, ([, v]) => {
90
+ const transitionProperty = validateProperty(v);
91
+ if (transitionProperty)
92
+ return { "transition-property": transitionProperty };
93
+ }]
27
94
  ];
28
95
 
29
96
  // src/utils/mappings.ts
@@ -155,7 +222,7 @@ handlersNames.forEach((i) => {
155
222
 
156
223
  // src/rules/color.ts
157
224
  var _core = require('@unocss/core');
158
- var colorResolver = (attribute, varName) => ([, body], theme) => {
225
+ var colorResolver = (attribute, varName) => ([, body], { theme }) => {
159
226
  var _a;
160
227
  const [main, opacity2] = body.split(/(?:\/|:)/);
161
228
  const [name, no = "DEFAULT"] = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
@@ -261,7 +328,7 @@ function handlerBorder([, a, b]) {
261
328
  ];
262
329
  }
263
330
  }
264
- function handlerRounded([, a, b], theme) {
331
+ function handlerRounded([, a, b], { theme }) {
265
332
  var _a;
266
333
  const [d, s = "DEFAULT"] = cornerMap[a] ? [a, b] : ["", a];
267
334
  const v = ((_a = theme.borderRadius) == null ? void 0 : _a[s]) || handler.bracket.fraction.rem(s);
@@ -315,7 +382,7 @@ var flex = [
315
382
  // src/rules/font.ts
316
383
 
317
384
  var fontsFamilies = [
318
- [/^font-(\w+)$/, ([, d], theme) => {
385
+ [/^font-(\w+)$/, ([, d], { theme }) => {
319
386
  var _a;
320
387
  const font = (_a = theme.fontFamily) == null ? void 0 : _a[d];
321
388
  if (font) {
@@ -337,7 +404,7 @@ var weightMap = {
337
404
  black: "900"
338
405
  };
339
406
  var fontSizes = [
340
- [/^text-([^-]+)$/, ([, s = "base"], theme) => {
407
+ [/^text-([^-]+)$/, ([, s = "base"], { theme }) => {
341
408
  var _a;
342
409
  const result = _core.toArray.call(void 0, ((_a = theme.fontSize) == null ? void 0 : _a[s]) || handler.bracket.rem(s));
343
410
  if (result == null ? void 0 : result[0]) {
@@ -357,7 +424,7 @@ var fontWeights = [
357
424
  }]
358
425
  ];
359
426
  var leadings = [
360
- [/^(?:leading|lh)-([^-]+)$/, ([, s], theme) => {
427
+ [/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => {
361
428
  var _a;
362
429
  const v = ((_a = theme.lineHeight) == null ? void 0 : _a[s]) || handler.bracket.rem(s);
363
430
  if (v !== null)
@@ -365,7 +432,7 @@ var leadings = [
365
432
  }]
366
433
  ];
367
434
  var trackings = [
368
- [/^tracking-([^-]+)$/, ([, s], theme) => {
435
+ [/^tracking-([^-]+)$/, ([, s], { theme }) => {
369
436
  var _a;
370
437
  const v = ((_a = theme.letterSpacing) == null ? void 0 : _a[s]) || handler.bracket.rem(s);
371
438
  if (v !== null)
@@ -410,13 +477,59 @@ var gaps = [
410
477
  ];
411
478
 
412
479
  // src/rules/grid.ts
480
+
481
+ var calSize = (s, theme) => {
482
+ var _a;
483
+ return _core.toArray.call(void 0, ((_a = theme.fontSize) == null ? void 0 : _a[s]) || handler.bracket.rem(s))[0];
484
+ };
485
+ var isNumber = (s) => !isNaN(Number(s));
486
+ var autoDirection = (selector, theme) => {
487
+ if (selector === "min")
488
+ return "min-content";
489
+ else if (selector === "max")
490
+ return "max-content";
491
+ else if (selector === "fr")
492
+ return "minmax(0, 1fr)";
493
+ return calSize(selector, theme);
494
+ };
413
495
  var grids = [
414
496
  ["grid", { display: "grid" }],
415
497
  ["inline-grid", { display: "inline-grid" }],
416
498
  [/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d}, minmax(0, 1fr))` })],
417
499
  [/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d}, minmax(0, 1fr))` })],
418
500
  [/^grid-cols-\[(.+)\]$/, ([, v]) => ({ "grid-template-columns": v.replace(/,/g, " ") })],
419
- [/^grid-rows-\[(.+)\]$/, ([, v]) => ({ "grid-template-rows": v.replace(/,/g, " ") })]
501
+ [/^grid-rows-\[(.+)\]$/, ([, v]) => ({ "grid-template-rows": v.replace(/,/g, " ") })],
502
+ [/^(?:grid-)?auto-flow-(.+)$/, ([, v]) => ({ "grid-auto-flow": `${v.replace("col", "column").split("-").join(" ")}` })],
503
+ [/^(?:grid-)?row-start-(.+)$/, ([, v]) => ({ "grid-row-start": `${v}` })],
504
+ [/^(?:grid-)?row-end-(.+)$/, ([, v]) => ({ "grid-row-end": `${v}` })],
505
+ [/^(?:grid-)?col-start-(.+)$/, ([, v]) => ({ "grid-column-start": `${v}` })],
506
+ [/^(?:grid-)?col-end-(.+)$/, ([, v]) => ({ "grid-column-end": `${v}` })],
507
+ [/^(?:grid-)?auto-rows-(.+)$/, ([, v], { theme }) => ({ "grid-auto-rows": `${autoDirection(v, theme)}` })],
508
+ [/^(?:grid-)?auto-cols-(.+)$/, ([, v], { theme }) => ({ "grid-auto-columns": `${autoDirection(v, theme)}` })],
509
+ [/^(?:grid-)?row-((?!(start)|(end)).+)$/, ([, v]) => {
510
+ const shortArr = v.split("-");
511
+ if (shortArr[0] === "span") {
512
+ if (shortArr[1] === "full") {
513
+ return {
514
+ "grid-row": "1 / -1"
515
+ };
516
+ }
517
+ return isNumber(shortArr[1]) ? { "grid-row": `span ${shortArr[1]} / span ${shortArr[1]}` } : void 0;
518
+ }
519
+ return { "grid-row": v.split("-").join(" ") };
520
+ }],
521
+ [/^(?:grid-)?col-((?!(start)|(end)).+)$/, ([, v]) => {
522
+ const shortArr = v.split("-");
523
+ if (shortArr[0] === "span") {
524
+ if (shortArr[1] === "full") {
525
+ return {
526
+ "grid-column": "1 / -1"
527
+ };
528
+ }
529
+ return isNumber(shortArr[1]) ? { "grid-column": `span ${shortArr[1]} / span ${shortArr[1]}` } : void 0;
530
+ }
531
+ return { "grid-column": v.split("-").join(" ") };
532
+ }]
420
533
  ];
421
534
 
422
535
  // src/rules/layout.ts
@@ -552,7 +665,7 @@ var rings = [
552
665
 
553
666
  // src/rules/shadow.ts
554
667
  var shadows = [
555
- [/^shadow-?(.*)$/, ([, d], theme) => {
668
+ [/^shadow-?(.*)$/, ([, d], { theme }) => {
556
669
  var _a;
557
670
  const value = (_a = theme == null ? void 0 : theme.textShadow) == null ? void 0 : _a[d || "DEFAULT"];
558
671
  if (value) {
@@ -62,17 +62,7 @@ var variantColorsMedia = [
62
62
 
63
63
  // src/variants/pseudo.ts
64
64
  import { toArray } from "@unocss/core";
65
- function createPseudoClassVariant(name, pseudo = name) {
66
- return [
67
- variantMatcher(name, (input) => `${input}:${pseudo}`),
68
- variantMatcher(`not-${name}`, (input) => `${input}:not(:${pseudo})`),
69
- variantMatcher(`group-${name}`, (input) => `.group:${pseudo} ${input}`)
70
- ];
71
- }
72
- function createPseudoElementVariant(name) {
73
- return variantMatcher(name, (input) => `${input}::${name}`);
74
- }
75
- var variantPseudoClasses = [
65
+ var PseudoClasses = Object.fromEntries([
76
66
  "active",
77
67
  "checked",
78
68
  "default",
@@ -104,14 +94,57 @@ var variantPseudoClasses = [
104
94
  ["even", "nth-child(even)"],
105
95
  ["odd-of-type", "nth-of-type(odd)"],
106
96
  ["odd", "nth-child(odd)"]
107
- ].flatMap((i) => createPseudoClassVariant(...toArray(i)));
108
- var variantPseudoElements = [
97
+ ].map(toArray));
98
+ var PseudoElements = [
109
99
  "before",
110
100
  "after",
111
101
  "first-letter",
112
102
  "first-line",
113
103
  "selection"
114
- ].map(createPseudoElementVariant);
104
+ ];
105
+ var PseudoElementsRE = new RegExp(`^(${PseudoElements.join("|")})[:-]`);
106
+ var PseudoClassesStr = Object.keys(PseudoClasses).join("|");
107
+ var PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
108
+ var PseudoClassesNotRE = new RegExp(`^not-(${PseudoClassesStr})[:-]`);
109
+ var PseudoClassesGroupRE = new RegExp(`^group-(${PseudoClassesStr})[:-]`);
110
+ var variantPseudoElements = (input) => {
111
+ const match = input.match(PseudoElementsRE);
112
+ if (match) {
113
+ return {
114
+ matcher: input.slice(match[1].length + 1),
115
+ selector: (input2) => `${input2}::${match[1]}`
116
+ };
117
+ }
118
+ };
119
+ var variantPseudoClasses = {
120
+ match: (input) => {
121
+ let match = input.match(PseudoClassesRE);
122
+ if (match) {
123
+ const pseudo = PseudoClasses[match[1]] || match[1];
124
+ return {
125
+ matcher: input.slice(match[1].length + 1),
126
+ selector: (input2) => `${input2}:${pseudo}`
127
+ };
128
+ }
129
+ match = input.match(PseudoClassesNotRE);
130
+ if (match) {
131
+ const pseudo = PseudoClasses[match[1]] || match[1];
132
+ return {
133
+ matcher: input.slice(match[1].length + 5),
134
+ selector: (input2) => `${input2}:not(:${pseudo})`
135
+ };
136
+ }
137
+ match = input.match(PseudoClassesGroupRE);
138
+ if (match) {
139
+ const pseudo = PseudoClasses[match[1]] || match[1];
140
+ return {
141
+ matcher: input.slice(match[1].length + 7),
142
+ selector: (input2) => `.group:${pseudo} ${input2}`
143
+ };
144
+ }
145
+ },
146
+ multiPass: true
147
+ };
115
148
 
116
149
  // src/variants/index.ts
117
150
  var variantImportant = {
@@ -153,8 +186,8 @@ var variants = [
153
186
  variantBreakpoints,
154
187
  ...variantChildren,
155
188
  ...variantColorsClass,
156
- ...variantPseudoClasses,
157
- ...variantPseudoElements
189
+ variantPseudoClasses,
190
+ variantPseudoElements
158
191
  ];
159
192
 
160
193
  export {
@@ -162,10 +195,9 @@ export {
162
195
  variantChildren,
163
196
  variantColorsClass,
164
197
  variantColorsMedia,
165
- createPseudoClassVariant,
166
- createPseudoElementVariant,
167
- variantPseudoClasses,
198
+ PseudoClasses,
168
199
  variantPseudoElements,
200
+ variantPseudoClasses,
169
201
  variantImportant,
170
202
  variantNegative,
171
203
  variants
package/dist/index.js CHANGED
@@ -1,20 +1,20 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkMOLERL6Bjs = require('./chunk-MOLERL6B.js');
3
+ var _chunkNYCCT2OFjs = require('./chunk-NYCCT2OF.js');
4
4
 
5
5
 
6
6
 
7
7
  var _chunkPZ7CZSZDjs = require('./chunk-PZ7CZSZD.js');
8
8
 
9
9
 
10
- var _chunkAMSMQAHKjs = require('./chunk-AMSMQAHK.js');
10
+ var _chunk54CWTYJQjs = require('./chunk-54CWTYJQ.js');
11
11
  require('./chunk-OFR2H3GI.js');
12
12
 
13
13
  // src/index.ts
14
14
  var preset = () => ({
15
15
  theme: _chunkPZ7CZSZDjs.theme,
16
- rules: _chunkMOLERL6Bjs.rules,
17
- variants: _chunkAMSMQAHKjs.variants
16
+ rules: _chunkNYCCT2OFjs.rules,
17
+ variants: _chunk54CWTYJQjs.variants
18
18
  });
19
19
  var src_default = preset;
20
20
 
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  rules
3
- } from "./chunk-FLQHQX4K.mjs";
3
+ } from "./chunk-MM5LB6YL.mjs";
4
4
  import {
5
5
  colors,
6
6
  theme
7
7
  } from "./chunk-3LKDVPSG.mjs";
8
8
  import {
9
9
  variants
10
- } from "./chunk-7Y7AX4FR.mjs";
10
+ } from "./chunk-VZLJK4OI.mjs";
11
11
  import "./chunk-YI4MPAID.mjs";
12
12
 
13
13
  // src/index.ts
package/dist/rules.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkMOLERL6Bjs = require('./chunk-MOLERL6B.js');
3
+ var _chunkNYCCT2OFjs = require('./chunk-NYCCT2OF.js');
4
4
  require('./chunk-OFR2H3GI.js');
5
5
 
6
6
 
7
- exports.rules = _chunkMOLERL6Bjs.rules;
7
+ exports.rules = _chunkNYCCT2OFjs.rules;
package/dist/rules.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  rules
3
- } from "./chunk-FLQHQX4K.mjs";
3
+ } from "./chunk-MM5LB6YL.mjs";
4
4
  import "./chunk-YI4MPAID.mjs";
5
5
  export {
6
6
  rules
@@ -1,5 +1,4 @@
1
- import * as _unocss_core from '@unocss/core';
2
- import { Variant } from '@unocss/core';
1
+ import { Variant, VariantFunction, VariantObject } from '@unocss/core';
3
2
  import { T as Theme } from './index-3b695534';
4
3
 
5
4
  declare const variantBreakpoints: Variant<Theme>;
@@ -9,13 +8,12 @@ declare const variantColorsMedia: Variant[];
9
8
 
10
9
  declare const variantChildren: Variant[];
11
10
 
12
- declare function createPseudoClassVariant(name: string, pseudo?: string): Variant[];
13
- declare function createPseudoElementVariant(name: string): Variant;
14
- declare const variantPseudoClasses: Variant<{}>[];
15
- declare const variantPseudoElements: Variant<{}>[];
11
+ declare const PseudoClasses: Record<string, string | undefined>;
12
+ declare const variantPseudoElements: VariantFunction;
13
+ declare const variantPseudoClasses: VariantObject;
16
14
 
17
15
  declare const variantImportant: Variant;
18
16
  declare const variantNegative: Variant;
19
- declare const variants: (_unocss_core.VariantFunction<Theme> | _unocss_core.VariantObject<Theme>)[];
17
+ declare const variants: Variant<Theme>[];
20
18
 
21
- export { createPseudoClassVariant, createPseudoElementVariant, variantBreakpoints, variantChildren, variantColorsClass, variantColorsMedia, variantImportant, variantNegative, variantPseudoClasses, variantPseudoElements, variants };
19
+ export { PseudoClasses, variantBreakpoints, variantChildren, variantColorsClass, variantColorsMedia, variantImportant, variantNegative, variantPseudoClasses, variantPseudoElements, variants };
package/dist/variants.js CHANGED
@@ -9,8 +9,7 @@
9
9
 
10
10
 
11
11
 
12
-
13
- var _chunkAMSMQAHKjs = require('./chunk-AMSMQAHK.js');
12
+ var _chunk54CWTYJQjs = require('./chunk-54CWTYJQ.js');
14
13
  require('./chunk-OFR2H3GI.js');
15
14
 
16
15
 
@@ -23,5 +22,4 @@ require('./chunk-OFR2H3GI.js');
23
22
 
24
23
 
25
24
 
26
-
27
- exports.createPseudoClassVariant = _chunkAMSMQAHKjs.createPseudoClassVariant; exports.createPseudoElementVariant = _chunkAMSMQAHKjs.createPseudoElementVariant; exports.variantBreakpoints = _chunkAMSMQAHKjs.variantBreakpoints; exports.variantChildren = _chunkAMSMQAHKjs.variantChildren; exports.variantColorsClass = _chunkAMSMQAHKjs.variantColorsClass; exports.variantColorsMedia = _chunkAMSMQAHKjs.variantColorsMedia; exports.variantImportant = _chunkAMSMQAHKjs.variantImportant; exports.variantNegative = _chunkAMSMQAHKjs.variantNegative; exports.variantPseudoClasses = _chunkAMSMQAHKjs.variantPseudoClasses; exports.variantPseudoElements = _chunkAMSMQAHKjs.variantPseudoElements; exports.variants = _chunkAMSMQAHKjs.variants;
25
+ exports.PseudoClasses = _chunk54CWTYJQjs.PseudoClasses; exports.variantBreakpoints = _chunk54CWTYJQjs.variantBreakpoints; exports.variantChildren = _chunk54CWTYJQjs.variantChildren; exports.variantColorsClass = _chunk54CWTYJQjs.variantColorsClass; exports.variantColorsMedia = _chunk54CWTYJQjs.variantColorsMedia; exports.variantImportant = _chunk54CWTYJQjs.variantImportant; exports.variantNegative = _chunk54CWTYJQjs.variantNegative; exports.variantPseudoClasses = _chunk54CWTYJQjs.variantPseudoClasses; exports.variantPseudoElements = _chunk54CWTYJQjs.variantPseudoElements; exports.variants = _chunk54CWTYJQjs.variants;
package/dist/variants.mjs CHANGED
@@ -1,6 +1,5 @@
1
1
  import {
2
- createPseudoClassVariant,
3
- createPseudoElementVariant,
2
+ PseudoClasses,
4
3
  variantBreakpoints,
5
4
  variantChildren,
6
5
  variantColorsClass,
@@ -10,11 +9,10 @@ import {
10
9
  variantPseudoClasses,
11
10
  variantPseudoElements,
12
11
  variants
13
- } from "./chunk-7Y7AX4FR.mjs";
12
+ } from "./chunk-VZLJK4OI.mjs";
14
13
  import "./chunk-YI4MPAID.mjs";
15
14
  export {
16
- createPseudoClassVariant,
17
- createPseudoElementVariant,
15
+ PseudoClasses,
18
16
  variantBreakpoints,
19
17
  variantChildren,
20
18
  variantColorsClass,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-uno",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/antfu/unocss#readme",
@@ -41,7 +41,7 @@
41
41
  "*.css"
42
42
  ],
43
43
  "dependencies": {
44
- "@unocss/core": "0.2.0"
44
+ "@unocss/core": "0.4.0"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "tsup",