@unocss/preset-mini 0.32.0 → 0.32.1

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.
@@ -540,7 +540,10 @@ const whitespaces = [
540
540
  [/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v }), { autocomplete: "(whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)" }]
541
541
  ];
542
542
  const contents = [
543
- [/^content-\[(.+)\]$/, ([, v]) => ({ content: `"${v}"` })],
543
+ [/^content-(.+)$/, ([, v]) => {
544
+ const c = utilities.handler.bracket.cssvar(v);
545
+ return { content: c == null ? `"${v}"` : c };
546
+ }],
544
547
  ["content-empty", { content: '""' }],
545
548
  ["content-none", { content: '""' }]
546
549
  ];
@@ -538,7 +538,10 @@ const whitespaces = [
538
538
  [/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v }), { autocomplete: "(whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)" }]
539
539
  ];
540
540
  const contents = [
541
- [/^content-\[(.+)\]$/, ([, v]) => ({ content: `"${v}"` })],
541
+ [/^content-(.+)$/, ([, v]) => {
542
+ const c = handler.bracket.cssvar(v);
543
+ return { content: c == null ? `"${v}"` : c };
544
+ }],
542
545
  ["content-empty", { content: '""' }],
543
546
  ["content-none", { content: '""' }]
544
547
  ];
@@ -181,6 +181,8 @@ const variantNegative = {
181
181
  };
182
182
 
183
183
  const PseudoClasses = Object.fromEntries([
184
+ ["first-letter", "::first"],
185
+ ["first-line", "::first"],
184
186
  "any-link",
185
187
  "link",
186
188
  "visited",
@@ -217,31 +219,22 @@ const PseudoClasses = Object.fromEntries([
217
219
  "last-of-type",
218
220
  ["last", ":last-child"],
219
221
  "only-child",
220
- "only-of-type"
221
- ].map(core.toArray));
222
- const PseudoElements = Object.fromEntries([
223
- "placeholder",
224
- "before",
225
- "after",
226
- "first-letter",
227
- "first-line",
228
- "selection",
229
- "marker",
222
+ "only-of-type",
223
+ ["placeholder", "::placeholder"],
224
+ ["before", "::before"],
225
+ ["after", "::after"],
226
+ ["selection", "::selection"],
227
+ ["marker", "::marker"],
230
228
  ["file", "::file-selector-button"]
231
- ].map(core.toArray));
229
+ ].map((key) => typeof key === "string" ? [key, `:${key}`] : key));
232
230
  const PseudoClassFunctions = [
233
231
  "not",
234
232
  "is",
235
233
  "where",
236
234
  "has"
237
235
  ];
238
- const PseudoElementsStr = Object.keys(PseudoElements).join("|");
239
- const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
236
+ const PseudoClassesStr = Object.entries(PseudoClasses).filter(([, pseudo]) => !pseudo.startsWith("::")).map(([key]) => key).join("|");
240
237
  const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
241
- const PartClassesRE = /(part-\[(.+)]:)(.+)/;
242
- const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
243
- const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
244
- const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
245
238
  const sortValue = (pseudo) => {
246
239
  if (pseudo === "active")
247
240
  return 1;
@@ -263,22 +256,11 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
263
256
  }
264
257
  };
265
258
  };
266
- const variantPseudoElements = {
267
- match: (input) => {
268
- const match = input.match(PseudoElementsRE);
269
- if (match) {
270
- const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
271
- return {
272
- matcher: input.slice(match[0].length),
273
- selector: (s) => `${s}${pseudo}`
274
- };
275
- }
276
- },
277
- autocomplete: `(${PseudoElementsStr}):`
278
- };
279
- const variantPseudoClasses = {
259
+ const PseudoClassesAndElementsStr = Object.entries(PseudoClasses).map(([key]) => key).join("|");
260
+ const PseudoClassesAndElementsRE = new RegExp(`^(${PseudoClassesAndElementsStr})[:-]`);
261
+ const variantPseudoClassesAndElements = {
280
262
  match: (input) => {
281
- const match = input.match(PseudoClassesRE);
263
+ const match = input.match(PseudoClassesAndElementsRE);
282
264
  if (match) {
283
265
  const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
284
266
  return {
@@ -289,8 +271,9 @@ const variantPseudoClasses = {
289
271
  }
290
272
  },
291
273
  multiPass: true,
292
- autocomplete: `(${PseudoClassesStr}):`
274
+ autocomplete: `(${PseudoClassesAndElementsStr}):`
293
275
  };
276
+ const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
294
277
  const variantPseudoClassFunctions = {
295
278
  match: (input) => {
296
279
  const match = input.match(PseudoClassFunctionsRE);
@@ -327,6 +310,7 @@ const variantTaggedPseudoClasses = (options = {}) => {
327
310
  }
328
311
  ];
329
312
  };
313
+ const PartClassesRE = /(part-\[(.+)]:)(.+)/;
330
314
  const partClasses = {
331
315
  match: (input) => {
332
316
  const match = input.match(PartClassesRE);
@@ -350,10 +334,9 @@ const variants = (options) => [
350
334
  variantCustomMedia,
351
335
  variantBreakpoints,
352
336
  ...variantCombinators,
353
- variantPseudoClasses,
337
+ variantPseudoClassesAndElements,
354
338
  variantPseudoClassFunctions,
355
339
  ...variantTaggedPseudoClasses(options),
356
- variantPseudoElements,
357
340
  partClasses,
358
341
  ...variantColorsMediaOrClass(options),
359
342
  ...variantLanguageDirections,
@@ -371,8 +354,7 @@ exports.variantLayer = variantLayer;
371
354
  exports.variantNegative = variantNegative;
372
355
  exports.variantPrint = variantPrint;
373
356
  exports.variantPseudoClassFunctions = variantPseudoClassFunctions;
374
- exports.variantPseudoClasses = variantPseudoClasses;
375
- exports.variantPseudoElements = variantPseudoElements;
357
+ exports.variantPseudoClassesAndElements = variantPseudoClassesAndElements;
376
358
  exports.variantScope = variantScope;
377
359
  exports.variantSelector = variantSelector;
378
360
  exports.variantTaggedPseudoClasses = variantTaggedPseudoClasses;
@@ -1,6 +1,6 @@
1
1
  import { g as resolveBreakpoints } from './utilities.mjs';
2
2
  import { v as variantParentMatcher, a as variantMatcher } from './variants.mjs';
3
- import { toArray, escapeRegExp } from '@unocss/core';
3
+ import { escapeRegExp } from '@unocss/core';
4
4
 
5
5
  const regexCache = {};
6
6
  const calcMaxWidthBySize = (size) => {
@@ -179,6 +179,8 @@ const variantNegative = {
179
179
  };
180
180
 
181
181
  const PseudoClasses = Object.fromEntries([
182
+ ["first-letter", "::first"],
183
+ ["first-line", "::first"],
182
184
  "any-link",
183
185
  "link",
184
186
  "visited",
@@ -215,31 +217,22 @@ const PseudoClasses = Object.fromEntries([
215
217
  "last-of-type",
216
218
  ["last", ":last-child"],
217
219
  "only-child",
218
- "only-of-type"
219
- ].map(toArray));
220
- const PseudoElements = Object.fromEntries([
221
- "placeholder",
222
- "before",
223
- "after",
224
- "first-letter",
225
- "first-line",
226
- "selection",
227
- "marker",
220
+ "only-of-type",
221
+ ["placeholder", "::placeholder"],
222
+ ["before", "::before"],
223
+ ["after", "::after"],
224
+ ["selection", "::selection"],
225
+ ["marker", "::marker"],
228
226
  ["file", "::file-selector-button"]
229
- ].map(toArray));
227
+ ].map((key) => typeof key === "string" ? [key, `:${key}`] : key));
230
228
  const PseudoClassFunctions = [
231
229
  "not",
232
230
  "is",
233
231
  "where",
234
232
  "has"
235
233
  ];
236
- const PseudoElementsStr = Object.keys(PseudoElements).join("|");
237
- const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
234
+ const PseudoClassesStr = Object.entries(PseudoClasses).filter(([, pseudo]) => !pseudo.startsWith("::")).map(([key]) => key).join("|");
238
235
  const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
239
- const PartClassesRE = /(part-\[(.+)]:)(.+)/;
240
- const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
241
- const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
242
- const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
243
236
  const sortValue = (pseudo) => {
244
237
  if (pseudo === "active")
245
238
  return 1;
@@ -261,22 +254,11 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
261
254
  }
262
255
  };
263
256
  };
264
- const variantPseudoElements = {
265
- match: (input) => {
266
- const match = input.match(PseudoElementsRE);
267
- if (match) {
268
- const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
269
- return {
270
- matcher: input.slice(match[0].length),
271
- selector: (s) => `${s}${pseudo}`
272
- };
273
- }
274
- },
275
- autocomplete: `(${PseudoElementsStr}):`
276
- };
277
- const variantPseudoClasses = {
257
+ const PseudoClassesAndElementsStr = Object.entries(PseudoClasses).map(([key]) => key).join("|");
258
+ const PseudoClassesAndElementsRE = new RegExp(`^(${PseudoClassesAndElementsStr})[:-]`);
259
+ const variantPseudoClassesAndElements = {
278
260
  match: (input) => {
279
- const match = input.match(PseudoClassesRE);
261
+ const match = input.match(PseudoClassesAndElementsRE);
280
262
  if (match) {
281
263
  const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
282
264
  return {
@@ -287,8 +269,9 @@ const variantPseudoClasses = {
287
269
  }
288
270
  },
289
271
  multiPass: true,
290
- autocomplete: `(${PseudoClassesStr}):`
272
+ autocomplete: `(${PseudoClassesAndElementsStr}):`
291
273
  };
274
+ const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
292
275
  const variantPseudoClassFunctions = {
293
276
  match: (input) => {
294
277
  const match = input.match(PseudoClassFunctionsRE);
@@ -325,6 +308,7 @@ const variantTaggedPseudoClasses = (options = {}) => {
325
308
  }
326
309
  ];
327
310
  };
311
+ const PartClassesRE = /(part-\[(.+)]:)(.+)/;
328
312
  const partClasses = {
329
313
  match: (input) => {
330
314
  const match = input.match(PartClassesRE);
@@ -348,14 +332,13 @@ const variants = (options) => [
348
332
  variantCustomMedia,
349
333
  variantBreakpoints,
350
334
  ...variantCombinators,
351
- variantPseudoClasses,
335
+ variantPseudoClassesAndElements,
352
336
  variantPseudoClassFunctions,
353
337
  ...variantTaggedPseudoClasses(options),
354
- variantPseudoElements,
355
338
  partClasses,
356
339
  ...variantColorsMediaOrClass(options),
357
340
  ...variantLanguageDirections,
358
341
  variantScope
359
342
  ];
360
343
 
361
- export { variantBreakpoints as a, variantCombinators as b, variantPrint as c, variantCustomMedia as d, variantColorsMediaOrClass as e, variantLanguageDirections as f, variantSelector as g, variantLayer as h, variantScope as i, variantImportant as j, variantNegative as k, variantPseudoElements as l, variantPseudoClasses as m, variantPseudoClassFunctions as n, variantTaggedPseudoClasses as o, partClasses as p, variants as v };
344
+ export { variantBreakpoints as a, variantCombinators as b, variantPrint as c, variantCustomMedia as d, variantColorsMediaOrClass as e, variantLanguageDirections as f, variantSelector as g, variantLayer as h, variantScope as i, variantImportant as j, variantNegative as k, variantPseudoClassesAndElements as l, variantPseudoClassFunctions as m, variantTaggedPseudoClasses as n, partClasses as p, variants as v };
package/dist/variants.cjs CHANGED
@@ -20,8 +20,7 @@ exports.variantLayer = _default.variantLayer;
20
20
  exports.variantNegative = _default.variantNegative;
21
21
  exports.variantPrint = _default.variantPrint;
22
22
  exports.variantPseudoClassFunctions = _default.variantPseudoClassFunctions;
23
- exports.variantPseudoClasses = _default.variantPseudoClasses;
24
- exports.variantPseudoElements = _default.variantPseudoElements;
23
+ exports.variantPseudoClassesAndElements = _default.variantPseudoClassesAndElements;
25
24
  exports.variantScope = _default.variantScope;
26
25
  exports.variantSelector = _default.variantSelector;
27
26
  exports.variantTaggedPseudoClasses = _default.variantTaggedPseudoClasses;
@@ -24,10 +24,9 @@ declare const variantScope: Variant;
24
24
  declare const variantImportant: Variant;
25
25
  declare const variantNegative: Variant;
26
26
 
27
- declare const variantPseudoElements: VariantObject;
28
- declare const variantPseudoClasses: VariantObject;
27
+ declare const variantPseudoClassesAndElements: VariantObject;
29
28
  declare const variantPseudoClassFunctions: VariantObject;
30
29
  declare const variantTaggedPseudoClasses: (options?: PresetMiniOptions) => VariantObject[];
31
30
  declare const partClasses: VariantObject;
32
31
 
33
- export { partClasses, variantBreakpoints, variantColorsMediaOrClass, variantCombinators, variantCustomMedia, variantImportant, variantLanguageDirections, variantLayer, variantNegative, variantPrint, variantPseudoClassFunctions, variantPseudoClasses, variantPseudoElements, variantScope, variantSelector, variantTaggedPseudoClasses, variants };
32
+ export { partClasses, variantBreakpoints, variantColorsMediaOrClass, variantCombinators, variantCustomMedia, variantImportant, variantLanguageDirections, variantLayer, variantNegative, variantPrint, variantPseudoClassFunctions, variantPseudoClassesAndElements, variantScope, variantSelector, variantTaggedPseudoClasses, variants };
package/dist/variants.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { p as partClasses, a as variantBreakpoints, e as variantColorsMediaOrClass, b as variantCombinators, d as variantCustomMedia, j as variantImportant, f as variantLanguageDirections, h as variantLayer, k as variantNegative, c as variantPrint, n as variantPseudoClassFunctions, m as variantPseudoClasses, l as variantPseudoElements, i as variantScope, g as variantSelector, o as variantTaggedPseudoClasses, v as variants } from './chunks/default3.mjs';
1
+ export { p as partClasses, a as variantBreakpoints, e as variantColorsMediaOrClass, b as variantCombinators, d as variantCustomMedia, j as variantImportant, f as variantLanguageDirections, h as variantLayer, k as variantNegative, c as variantPrint, m as variantPseudoClassFunctions, l as variantPseudoClassesAndElements, i as variantScope, g as variantSelector, n as variantTaggedPseudoClasses, v as variants } from './chunks/default3.mjs';
2
2
  import './chunks/utilities.mjs';
3
3
  import '@unocss/core';
4
4
  import './chunks/variants.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-mini",
3
- "version": "0.32.0",
3
+ "version": "0.32.1",
4
4
  "description": "The minimal preset for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
@@ -61,7 +61,7 @@
61
61
  ],
62
62
  "sideEffects": false,
63
63
  "dependencies": {
64
- "@unocss/core": "0.32.0"
64
+ "@unocss/core": "0.32.1"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",