@unocss/preset-mini 0.22.7 → 0.23.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.
@@ -155,6 +155,7 @@ const bgColors = [
155
155
  const transitionPropertyGroup = {
156
156
  all: "all",
157
157
  colors: ["color", "background-color", "border-color", "text-decoration-color", "fill", "stroke"].join(","),
158
+ none: "none",
158
159
  opacity: "opacity",
159
160
  shadow: "box-shadow",
160
161
  transform: "transform"
@@ -177,8 +178,6 @@ const transitions = [
177
178
  [/^(?:transition-)?delay-(.+)$/, ([, d]) => ({ "transition-delay": utilities.handler.bracket.cssvar.time(d) })],
178
179
  [/^(?:transition-)?ease(?:-(.+))?$/, ([, d], { theme }) => ({ "transition-timing-function": theme.easing?.[d || "DEFAULT"] ?? utilities.handler.bracket.cssvar(d) })],
179
180
  [/^(?:transition-)?property-(.+)$/, ([, v]) => ({ "transition-property": utilities.handler.global(v) || transitionProperty(v) })],
180
- ["transition-property-none", { "transition-property": "none" }],
181
- ["property-none", { "transition-property": "none" }],
182
181
  ["transition-none", { transition: "none" }]
183
182
  ];
184
183
 
@@ -213,7 +212,8 @@ const displays = [
213
212
  ["contents", { display: "contents" }],
214
213
  ["flow-root", { display: "flow-root" }],
215
214
  ["list-item", { display: "list-item" }],
216
- ["hidden", { display: "none" }]
215
+ ["hidden", { display: "none" }],
216
+ [/^display-(.+)$/, ([, c]) => ({ display: utilities.handler.bracket.cssvar(c) || c })]
217
217
  ];
218
218
  const appearances = [
219
219
  ["visible", { visibility: "visible" }],
@@ -540,8 +540,7 @@ const floats = [
540
540
  ["clear-none", { clear: "none" }]
541
541
  ];
542
542
  const zIndexes = [
543
- [/^z-(.+)$/, ([, v]) => ({ "z-index": utilities.handler.bracket.cssvar.number(v) })],
544
- ["z-auto", { "z-index": "auto" }]
543
+ [/^z-(.+)$/, ([, v]) => ({ "z-index": utilities.handler.bracket.cssvar.auto.number(v) })]
545
544
  ];
546
545
  const boxSizing = [
547
546
  ["box-border", { "box-sizing": "border-box" }],
@@ -823,11 +822,7 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
823
822
  ];
824
823
 
825
824
  const textDecorations = [
826
- ["underline", { "text-decoration-line": "underline" }],
827
- ["overline", { "text-decoration-line": "overline" }],
828
- ["line-through", { "text-decoration-line": "line-through" }],
829
- ["decoration-underline", { "text-decoration-line": "underline" }],
830
- ["decoration-line-through", { "text-decoration-line": "line-through" }],
825
+ [/^(?:decoration-)?(underline|overline|line-through)$/, ([, s]) => ({ "text-decoration-line": s })],
831
826
  [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": utilities.handler.bracket.cssvar.px(s) })],
832
827
  [/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
833
828
  [/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
@@ -153,6 +153,7 @@ const bgColors = [
153
153
  const transitionPropertyGroup = {
154
154
  all: "all",
155
155
  colors: ["color", "background-color", "border-color", "text-decoration-color", "fill", "stroke"].join(","),
156
+ none: "none",
156
157
  opacity: "opacity",
157
158
  shadow: "box-shadow",
158
159
  transform: "transform"
@@ -175,8 +176,6 @@ const transitions = [
175
176
  [/^(?:transition-)?delay-(.+)$/, ([, d]) => ({ "transition-delay": handler.bracket.cssvar.time(d) })],
176
177
  [/^(?:transition-)?ease(?:-(.+))?$/, ([, d], { theme }) => ({ "transition-timing-function": theme.easing?.[d || "DEFAULT"] ?? handler.bracket.cssvar(d) })],
177
178
  [/^(?:transition-)?property-(.+)$/, ([, v]) => ({ "transition-property": handler.global(v) || transitionProperty(v) })],
178
- ["transition-property-none", { "transition-property": "none" }],
179
- ["property-none", { "transition-property": "none" }],
180
179
  ["transition-none", { transition: "none" }]
181
180
  ];
182
181
 
@@ -211,7 +210,8 @@ const displays = [
211
210
  ["contents", { display: "contents" }],
212
211
  ["flow-root", { display: "flow-root" }],
213
212
  ["list-item", { display: "list-item" }],
214
- ["hidden", { display: "none" }]
213
+ ["hidden", { display: "none" }],
214
+ [/^display-(.+)$/, ([, c]) => ({ display: handler.bracket.cssvar(c) || c })]
215
215
  ];
216
216
  const appearances = [
217
217
  ["visible", { visibility: "visible" }],
@@ -538,8 +538,7 @@ const floats = [
538
538
  ["clear-none", { clear: "none" }]
539
539
  ];
540
540
  const zIndexes = [
541
- [/^z-(.+)$/, ([, v]) => ({ "z-index": handler.bracket.cssvar.number(v) })],
542
- ["z-auto", { "z-index": "auto" }]
541
+ [/^z-(.+)$/, ([, v]) => ({ "z-index": handler.bracket.cssvar.auto.number(v) })]
543
542
  ];
544
543
  const boxSizing = [
545
544
  ["box-border", { "box-sizing": "border-box" }],
@@ -821,11 +820,7 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
821
820
  ];
822
821
 
823
822
  const textDecorations = [
824
- ["underline", { "text-decoration-line": "underline" }],
825
- ["overline", { "text-decoration-line": "overline" }],
826
- ["line-through", { "text-decoration-line": "line-through" }],
827
- ["decoration-underline", { "text-decoration-line": "underline" }],
828
- ["decoration-line-through", { "text-decoration-line": "line-through" }],
823
+ [/^(?:decoration-)?(underline|overline|line-through)$/, ([, s]) => ({ "text-decoration-line": s })],
829
824
  [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": handler.bracket.cssvar.px(s) })],
830
825
  [/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
831
826
  [/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
@@ -37,12 +37,28 @@ const variantBreakpoints = (matcher, { theme }) => {
37
37
  }
38
38
  };
39
39
 
40
+ const scopeMatcher = (strict, name, template) => {
41
+ const re = strict ? new RegExp(`^${name}(?:-\\[(.+?)\\])[:-]`) : new RegExp(`^${name}(?:-\\[(.+?)\\])?[:-]`);
42
+ return (matcher) => {
43
+ const match = matcher.match(re);
44
+ if (match) {
45
+ return {
46
+ matcher: matcher.slice(match[0].length),
47
+ selector: (s) => template.replace("&&-s", s).replace("&&-c", match[1] ?? "*")
48
+ };
49
+ }
50
+ };
51
+ };
40
52
  const variantCombinators = [
41
- variants$1.variantMatcher("all", (input) => `${input} *`),
42
- variants$1.variantMatcher("children", (input) => `${input}>*`),
43
- variants$1.variantMatcher("next", (input) => `${input}+*`),
44
- variants$1.variantMatcher("sibling", (input) => `${input}+*`),
45
- variants$1.variantMatcher("siblings", (input) => `${input}~*`),
53
+ scopeMatcher(false, "all", "&&-s &&-c"),
54
+ scopeMatcher(false, "children", "&&-s>&&-c"),
55
+ scopeMatcher(false, "next", "&&-s+&&-c"),
56
+ scopeMatcher(false, "sibling", "&&-s+&&-c"),
57
+ scopeMatcher(false, "siblings", "&&-s~&&-c"),
58
+ scopeMatcher(true, "group", "&&-c &&-s"),
59
+ scopeMatcher(true, "parent", "&&-c>&&-s"),
60
+ scopeMatcher(true, "previous", "&&-c+&&-s"),
61
+ scopeMatcher(true, "peer", "&&-c~&&-s"),
46
62
  variants$1.variantMatcher("svg", (input) => `${input} svg`)
47
63
  ];
48
64
 
@@ -191,7 +207,7 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
191
207
  if (match[2])
192
208
  pseudo = `:${match[2]}(${pseudo})`;
193
209
  return {
194
- matcher: input.slice(match[1].length + tag.length + 2),
210
+ matcher: input.slice(match[0].length),
195
211
  selector: (s) => rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`
196
212
  };
197
213
  }
@@ -202,7 +218,7 @@ const variantPseudoElements = (input) => {
202
218
  if (match) {
203
219
  const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
204
220
  return {
205
- matcher: input.slice(match[1].length + 1),
221
+ matcher: input.slice(match[0].length),
206
222
  selector: (s) => `${s}${pseudo}`
207
223
  };
208
224
  }
@@ -213,7 +229,7 @@ const variantPseudoClasses = {
213
229
  if (match) {
214
230
  const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
215
231
  return {
216
- matcher: input.slice(match[1].length + 1),
232
+ matcher: input.slice(match[0].length),
217
233
  selector: (s) => `${s}${pseudo}`
218
234
  };
219
235
  }
@@ -227,7 +243,7 @@ const variantPseudoClassFunctions = {
227
243
  const fn = match[1];
228
244
  const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
229
245
  return {
230
- matcher: input.slice(match[1].length + match[2].length + 2),
246
+ matcher: input.slice(match[0].length),
231
247
  selector: (s) => `${s}:${fn}(${pseudo})`
232
248
  };
233
249
  }
@@ -248,6 +264,10 @@ const variantTaggedPseudoClasses = (options = {}) => {
248
264
  {
249
265
  match: taggedPseudoClassMatcher("parent", attributify ? '[parent=""]' : ".parent", ">"),
250
266
  multiPass: true
267
+ },
268
+ {
269
+ match: taggedPseudoClassMatcher("previous", attributify ? '[previous=""]' : ".previous", "+"),
270
+ multiPass: true
251
271
  }
252
272
  ];
253
273
  };
@@ -35,12 +35,28 @@ const variantBreakpoints = (matcher, { theme }) => {
35
35
  }
36
36
  };
37
37
 
38
+ const scopeMatcher = (strict, name, template) => {
39
+ const re = strict ? new RegExp(`^${name}(?:-\\[(.+?)\\])[:-]`) : new RegExp(`^${name}(?:-\\[(.+?)\\])?[:-]`);
40
+ return (matcher) => {
41
+ const match = matcher.match(re);
42
+ if (match) {
43
+ return {
44
+ matcher: matcher.slice(match[0].length),
45
+ selector: (s) => template.replace("&&-s", s).replace("&&-c", match[1] ?? "*")
46
+ };
47
+ }
48
+ };
49
+ };
38
50
  const variantCombinators = [
39
- variantMatcher("all", (input) => `${input} *`),
40
- variantMatcher("children", (input) => `${input}>*`),
41
- variantMatcher("next", (input) => `${input}+*`),
42
- variantMatcher("sibling", (input) => `${input}+*`),
43
- variantMatcher("siblings", (input) => `${input}~*`),
51
+ scopeMatcher(false, "all", "&&-s &&-c"),
52
+ scopeMatcher(false, "children", "&&-s>&&-c"),
53
+ scopeMatcher(false, "next", "&&-s+&&-c"),
54
+ scopeMatcher(false, "sibling", "&&-s+&&-c"),
55
+ scopeMatcher(false, "siblings", "&&-s~&&-c"),
56
+ scopeMatcher(true, "group", "&&-c &&-s"),
57
+ scopeMatcher(true, "parent", "&&-c>&&-s"),
58
+ scopeMatcher(true, "previous", "&&-c+&&-s"),
59
+ scopeMatcher(true, "peer", "&&-c~&&-s"),
44
60
  variantMatcher("svg", (input) => `${input} svg`)
45
61
  ];
46
62
 
@@ -189,7 +205,7 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
189
205
  if (match[2])
190
206
  pseudo = `:${match[2]}(${pseudo})`;
191
207
  return {
192
- matcher: input.slice(match[1].length + tag.length + 2),
208
+ matcher: input.slice(match[0].length),
193
209
  selector: (s) => rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`
194
210
  };
195
211
  }
@@ -200,7 +216,7 @@ const variantPseudoElements = (input) => {
200
216
  if (match) {
201
217
  const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
202
218
  return {
203
- matcher: input.slice(match[1].length + 1),
219
+ matcher: input.slice(match[0].length),
204
220
  selector: (s) => `${s}${pseudo}`
205
221
  };
206
222
  }
@@ -211,7 +227,7 @@ const variantPseudoClasses = {
211
227
  if (match) {
212
228
  const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
213
229
  return {
214
- matcher: input.slice(match[1].length + 1),
230
+ matcher: input.slice(match[0].length),
215
231
  selector: (s) => `${s}${pseudo}`
216
232
  };
217
233
  }
@@ -225,7 +241,7 @@ const variantPseudoClassFunctions = {
225
241
  const fn = match[1];
226
242
  const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
227
243
  return {
228
- matcher: input.slice(match[1].length + match[2].length + 2),
244
+ matcher: input.slice(match[0].length),
229
245
  selector: (s) => `${s}:${fn}(${pseudo})`
230
246
  };
231
247
  }
@@ -246,6 +262,10 @@ const variantTaggedPseudoClasses = (options = {}) => {
246
262
  {
247
263
  match: taggedPseudoClassMatcher("parent", attributify ? '[parent=""]' : ".parent", ">"),
248
264
  multiPass: true
265
+ },
266
+ {
267
+ match: taggedPseudoClassMatcher("previous", attributify ? '[previous=""]' : ".previous", "+"),
268
+ multiPass: true
249
269
  }
250
270
  ];
251
271
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-mini",
3
- "version": "0.22.7",
3
+ "version": "0.23.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.22.7"
64
+ "@unocss/core": "0.23.0"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",