@unocss/preset-wind 0.20.4 → 0.22.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.
Files changed (3) hide show
  1. package/dist/index.cjs +174 -119
  2. package/dist/index.mjs +175 -120
  3. package/package.json +3 -3
package/dist/index.cjs CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ const variants = require('@unocss/preset-mini/variants');
5
6
  const core = require('@unocss/core');
6
7
  const theme$1 = require('@unocss/preset-mini/theme');
7
8
  const presetMini = require('@unocss/preset-mini');
8
9
  const rules$1 = require('@unocss/preset-mini/rules');
9
10
  const utils = require('@unocss/preset-mini/utils');
10
- const variants$1 = require('@unocss/preset-mini/variants');
11
11
 
12
12
  const animations = [
13
13
  [/^keyframes-(.+)$/, ([, name], { theme, constructCSS }) => {
@@ -71,22 +71,6 @@ const bgGradientColorResolver = (mode) => ([, body], { theme }) => {
71
71
  }
72
72
  };
73
73
  const backgroundStyles = [
74
- ["bg-blend-multiply", { "background-blend-mode": "multiply" }],
75
- ["bg-blend-screen", { "background-blend-mode": "screen" }],
76
- ["bg-blend-overlay", { "background-blend-mode": "overlay" }],
77
- ["bg-blend-darken", { "background-blend-mode": "darken" }],
78
- ["bg-blend-lighten", { "background-blend-mode": "lighten" }],
79
- ["bg-blend-color-dodge", { "background-blend-mode": "color-dodge" }],
80
- ["bg-blend-color-burn", { "background-blend-mode": "color-burn" }],
81
- ["bg-blend-hard-light", { "background-blend-mode": "hard-light" }],
82
- ["bg-blend-soft-light", { "background-blend-mode": "soft-light" }],
83
- ["bg-blend-difference", { "background-blend-mode": "difference" }],
84
- ["bg-blend-exclusion", { "background-blend-mode": "exclusion" }],
85
- ["bg-blend-hue", { "background-blend-mode": "hue" }],
86
- ["bg-blend-saturation", { "background-blend-mode": "saturation" }],
87
- ["bg-blend-color", { "background-blend-mode": "color" }],
88
- ["bg-blend-luminosity", { "background-blend-mode": "luminosity" }],
89
- ["bg-blend-normal", { "background-blend-mode": "normal" }],
90
74
  [/^(?:bg-gradient-)?from-(.+)$/, bgGradientColorResolver("from")],
91
75
  [/^(?:bg-gradient-)?to-(.+)$/, bgGradientColorResolver("to")],
92
76
  [/^(?:bg-gradient-)?via-(.+)$/, bgGradientColorResolver("via")],
@@ -122,34 +106,28 @@ const backgroundStyles = [
122
106
  ["bg-origin-content", { "background-origin": "content-box" }]
123
107
  ];
124
108
 
125
- const listStyleProps = ["disc", "circle", "square", "decimal", "zero-decimal", "greek", "roman", "upper-roman", "alpha", "upper-alpha"];
126
109
  const listStyle = [
127
- [new RegExp(`^list-((?:${listStyleProps.join("|")})(?:-outside|-inside)?)$`), ([, value]) => {
128
- const style = value.split(/-outside|-inside/)[0];
129
- const position = /outside|inside/.exec(value) ?? [];
130
- if (position.length) {
110
+ [/^list-(disc|circle|square|decimal|zero-decimal|greek|roman|upper-roman|alpha|upper-alpha)(?:-(outside|inside))?$/, ([, style, position]) => {
111
+ if (position != null) {
131
112
  return {
132
- "list-style-position": `${position[0]}`,
113
+ "list-style-position": position,
133
114
  "list-style-type": style
134
115
  };
135
116
  }
136
117
  return { "list-style-type": style };
137
118
  }],
138
- [/^list-(outside|inside)$/, ([, value]) => ({ "list-style-position": value })],
119
+ ["list-outside", { "list-style-position": "outside" }],
120
+ ["list-inside", { "list-style-position": "inside" }],
139
121
  ["list-none", { "list-style-type": "none" }]
140
122
  ];
141
- const accentOpacity = [
123
+ const accents = [
124
+ [/^accent-(.+)$/, utils.colorResolver("accent-color", "accent")],
142
125
  [/^accent-op(?:acity)?-?(.+)$/, ([, d]) => ({ "--un-accent-opacity": utils.handler.bracket.percent(d) })]
143
126
  ];
144
- const accentColors = [
145
- [/^accent-(.+)$/, utils.colorResolver("accent-color", "accent")]
146
- ];
147
- const caretOpacity = [
127
+ const carets = [
128
+ [/^caret-(.+)$/, utils.colorResolver("caret-color", "caret")],
148
129
  [/^caret-op(?:acity)?-?(.+)$/, ([, d]) => ({ "--un-caret-opacity": utils.handler.bracket.percent(d) })]
149
130
  ];
150
- const caretColors = [
151
- [/^caret-(.+)$/, utils.colorResolver("caret-color", "caret")]
152
- ];
153
131
  const imageRenderings = [
154
132
  ["image-render-auto", { "image-rendering": "auto" }],
155
133
  ["image-render-edge", { "image-rendering": "crisp-edges" }],
@@ -235,21 +213,19 @@ const containerShortcuts = [
235
213
  }]
236
214
  ];
237
215
 
238
- const filterContnet = "var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia) var(--un-drop-shadow)";
239
216
  const filterBase = {
240
217
  "--un-blur": rules$1.varEmpty,
241
218
  "--un-brightness": rules$1.varEmpty,
242
219
  "--un-contrast": rules$1.varEmpty,
220
+ "--un-drop-shadow": rules$1.varEmpty,
243
221
  "--un-grayscale": rules$1.varEmpty,
244
222
  "--un-hue-rotate": rules$1.varEmpty,
245
223
  "--un-invert": rules$1.varEmpty,
246
224
  "--un-saturate": rules$1.varEmpty,
247
225
  "--un-sepia": rules$1.varEmpty,
248
- "--un-drop-shadow": rules$1.varEmpty,
249
- "filter": filterContnet,
250
- [variants$1.CONTROL_BYPASS_PSEUDO_CLASS]: ""
226
+ "--un-filter": "var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)",
227
+ [core.CONTROL_SHORTCUT_NO_MERGE]: ""
251
228
  };
252
- const backdropFilterContent = "var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-saturate) var(--un-backdrop-sepia)";
253
229
  const backdropFilterBase = {
254
230
  "--un-backdrop-blur": rules$1.varEmpty,
255
231
  "--un-backdrop-brightness": rules$1.varEmpty,
@@ -257,72 +233,87 @@ const backdropFilterBase = {
257
233
  "--un-backdrop-grayscale": rules$1.varEmpty,
258
234
  "--un-backdrop-hue-rotate": rules$1.varEmpty,
259
235
  "--un-backdrop-invert": rules$1.varEmpty,
236
+ "--un-backdrop-opacity": rules$1.varEmpty,
260
237
  "--un-backdrop-saturate": rules$1.varEmpty,
261
238
  "--un-backdrop-sepia": rules$1.varEmpty,
262
- "-webkit-backdrop-filter": backdropFilterContent,
263
- "backdrop-filter": backdropFilterContent,
264
- [variants$1.CONTROL_BYPASS_PSEUDO_CLASS]: ""
239
+ "--un-backdrop-filter": "var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia)",
240
+ [core.CONTROL_SHORTCUT_NO_MERGE]: ""
265
241
  };
266
- const percentWithDefault = (defaultValue = "1") => (str) => {
267
- const v = str ? utils.handler.bracket.percent(str) : defaultValue;
268
- return v && parseFloat(v) <= 1 ? v : void 0;
242
+ const percentWithDefault = (str) => {
243
+ let v = utils.handler.bracket(str || "");
244
+ if (v != null)
245
+ return v;
246
+ v = str ? utils.handler.percent(str) : "1";
247
+ if (v != null && parseFloat(v) <= 1)
248
+ return v;
269
249
  };
270
250
  const toFilter = (varName, resolver) => ([, b, s], { theme }) => {
271
251
  const value = resolver(s, theme);
272
- if (value) {
273
- return [
274
- b ? backdropFilterBase : filterBase,
275
- { [`--un-${b || ""}${varName}`]: `${varName}(${value})` }
276
- ];
252
+ if (value != null && value !== "") {
253
+ if (b) {
254
+ return [
255
+ backdropFilterBase,
256
+ {
257
+ [`--un-${b}${varName}`]: `${varName}(${value})`,
258
+ "-webkit-backdrop-filter": "var(--un-backdrop-filter)",
259
+ "backdrop-filter": "var(--un-backdrop-filter)"
260
+ }
261
+ ];
262
+ } else {
263
+ return [
264
+ filterBase,
265
+ {
266
+ [`--un-${varName}`]: `${varName}(${value})`,
267
+ filter: "var(--un-filter)"
268
+ }
269
+ ];
270
+ }
277
271
  }
278
272
  };
279
273
  const filters = [
280
- ["filter", filterBase],
281
- ["backdrop-filter", backdropFilterBase],
282
274
  [/^(backdrop-)?blur(?:-(.+))?$/, toFilter("blur", (s, theme) => theme.blur?.[s || "DEFAULT"] || utils.handler.bracket.px(s))],
283
- [/^(backdrop-)?brightness-(\d+)$/, toFilter("brightness", (s) => utils.handler.bracket.percent(s))],
284
- [/^(backdrop-)?contrast-(\d+)$/, toFilter("contrast", (s) => utils.handler.bracket.percent(s))],
275
+ [/^(backdrop-)?brightness-(.+)$/, toFilter("brightness", (s) => utils.handler.bracket.percent(s))],
276
+ [/^(backdrop-)?contrast-(.+)$/, toFilter("contrast", (s) => utils.handler.bracket.percent(s))],
285
277
  [/^()?drop-shadow(?:-(.+))?$/, toFilter("drop-shadow", (s, theme) => {
286
- const v = utils.handler.bracket(s) || theme.dropShadow?.[s || "DEFAULT"];
287
- if (v)
278
+ let v = theme.dropShadow?.[s || "DEFAULT"];
279
+ if (v != null)
288
280
  return core.toArray(v).map((v2) => `drop-shadow(${v2})`).join(" ");
281
+ v = utils.handler.bracket(s);
282
+ if (v != null)
283
+ return `drop-shadow(${v})`;
289
284
  })],
290
- [/^(backdrop-)?grayscale(?:-(\d+))?$/, toFilter("grayscale", percentWithDefault())],
291
- [/^(backdrop-)?hue-rotate-(\d+)$/, toFilter("hue-rotate", (s) => `${utils.handler.bracket.number(s)}deg`)],
292
- [/^(backdrop-)?invert(?:-(\d+))?$/, toFilter("invert", percentWithDefault())],
293
- [/^(backdrop-)?saturate(?:-(\d+))?$/, toFilter("saturate", percentWithDefault("0"))],
294
- [/^(backdrop-)?sepia(?:-(\d+))?$/, toFilter("sepia", percentWithDefault())],
285
+ [/^(backdrop-)?grayscale(?:-(.+))?$/, toFilter("grayscale", percentWithDefault)],
286
+ [/^(backdrop-)?hue-rotate-(.+)$/, toFilter("hue-rotate", (s) => utils.handler.bracket.degree(s))],
287
+ [/^(backdrop-)?invert(?:-(.+))?$/, toFilter("invert", percentWithDefault)],
288
+ [/^(backdrop-)opacity-(.+)$/, toFilter("opacity", (s) => utils.handler.bracket.percent(s))],
289
+ [/^(backdrop-)?saturate-(.+)$/, toFilter("saturate", (s) => utils.handler.bracket.percent(s))],
290
+ [/^(backdrop-)?sepia(?:-(.+))?$/, toFilter("sepia", percentWithDefault)],
291
+ [/^filter$/, () => [
292
+ filterBase,
293
+ { filter: "var(--un-filter)" }
294
+ ]],
295
+ [/^backdrop-filter$/, () => [
296
+ backdropFilterBase,
297
+ {
298
+ "-webkit-backdrop-filter": "var(--un-backdrop-filter)",
299
+ "backdrop-filter": "var(--un-backdrop-filter)"
300
+ }
301
+ ]],
295
302
  ["filter-none", { filter: "none" }],
296
303
  ["backdrop-filter-none", {
297
304
  "-webkit-backdrop-filter": "none",
298
305
  "backdrop-filter": "none"
299
- }]
300
- ];
301
-
302
- const mixBlendModes = [
303
- ["mix-blend-multiply", { "mix-blend-mode": "multiply" }],
304
- ["mix-blend-screen", { "mix-blend-mode": "screen" }],
305
- ["mix-blend-overlay", { "mix-blend-mode": "overlay" }],
306
- ["mix-blend-darken", { "mix-blend-mode": "darken" }],
307
- ["mix-blend-lighten", { "mix-blend-mode": "lighten" }],
308
- ["mix-blend-color-dodge", { "mix-blend-mode": "color-dodge" }],
309
- ["mix-blend-color-burn", { "mix-blend-mode": "color-burn" }],
310
- ["mix-blend-hard-light", { "mix-blend-mode": "hard-light" }],
311
- ["mix-blend-soft-light", { "mix-blend-mode": "soft-light" }],
312
- ["mix-blend-difference", { "mix-blend-mode": "difference" }],
313
- ["mix-blend-exclusion", { "mix-blend-mode": "exclusion" }],
314
- ["mix-blend-hue", { "mix-blend-mode": "hue" }],
315
- ["mix-blend-saturation", { "mix-blend-mode": "saturation" }],
316
- ["mix-blend-color", { "mix-blend-mode": "color" }],
317
- ["mix-blend-luminosity", { "mix-blend-mode": "luminosity" }],
318
- ["mix-blend-normal", { "mix-blend-mode": "normal" }]
306
+ }],
307
+ [/^(blur|brightness|contrast|drop-shadow|grayscale|hue-rotate|invert|saturate|sepia)-none$/, ([, s]) => ({ filter: `${s}(0)` })],
308
+ [/^backdrop-(blur|brightness|contrast|grayscale|hue-rotate|invert|opacity|saturate|sepia)-none$/, ([, s]) => ({
309
+ "-webkit-backdrop-filter": `${s}(0)`,
310
+ "backdrop-filter": `${s}(0)`
311
+ })]
319
312
  ];
320
313
 
321
314
  const spaces = [
322
315
  [/^space-?([xy])-?(-?.+)$/, (match) => {
323
- const [, direction, size] = match;
324
- if (size === "reverse")
325
- return { [`--un-space-${direction}-reverse`]: 1 };
316
+ const [, direction] = match;
326
317
  const results = utils.directionSize("margin")(match)?.map((item) => {
327
318
  const value = item[0].endsWith("right") || item[0].endsWith("bottom") ? `calc(${item[1]} * var(--un-space-${direction}-reverse))` : `calc(${item[1]} * calc(1 - var(--un-space-${direction}-reverse)))`;
328
319
  return [item[0], value];
@@ -333,7 +324,8 @@ const spaces = [
333
324
  ...results
334
325
  ];
335
326
  }
336
- }]
327
+ }],
328
+ [/^space-?([xy])-reverse$/, ([, d]) => ({ [`--un-space-${d}-reverse`]: 1 })]
337
329
  ];
338
330
 
339
331
  const textTransforms = [
@@ -400,7 +392,8 @@ const screenReadersAccess = [
400
392
  ];
401
393
  const isolations = [
402
394
  ["isolate", { isolation: "isolate" }],
403
- ["isolate-auto", { isolation: "auto" }]
395
+ ["isolate-auto", { isolation: "auto" }],
396
+ ["isolation-auto", { isolation: "auto" }]
404
397
  ];
405
398
  const objectPositions = [
406
399
  ["object-cover", { "object-fit": "cover" }],
@@ -408,7 +401,43 @@ const objectPositions = [
408
401
  ["object-fill", { "object-fit": "fill" }],
409
402
  ["object-scale-down", { "object-fit": "scale-down" }],
410
403
  ["object-none", { "object-fit": "none" }],
411
- [/^object-([\w]+)$/, ([, s]) => ({ "object-position": utils.positionMap[s] })]
404
+ [/^object-([-\w]+)$/, ([, s]) => ({ "object-position": utils.positionMap[s] })]
405
+ ];
406
+ const backgroundBlendModes = [
407
+ ["bg-blend-multiply", { "background-blend-mode": "multiply" }],
408
+ ["bg-blend-screen", { "background-blend-mode": "screen" }],
409
+ ["bg-blend-overlay", { "background-blend-mode": "overlay" }],
410
+ ["bg-blend-darken", { "background-blend-mode": "darken" }],
411
+ ["bg-blend-lighten", { "background-blend-mode": "lighten" }],
412
+ ["bg-blend-color-dodge", { "background-blend-mode": "color-dodge" }],
413
+ ["bg-blend-color-burn", { "background-blend-mode": "color-burn" }],
414
+ ["bg-blend-hard-light", { "background-blend-mode": "hard-light" }],
415
+ ["bg-blend-soft-light", { "background-blend-mode": "soft-light" }],
416
+ ["bg-blend-difference", { "background-blend-mode": "difference" }],
417
+ ["bg-blend-exclusion", { "background-blend-mode": "exclusion" }],
418
+ ["bg-blend-hue", { "background-blend-mode": "hue" }],
419
+ ["bg-blend-saturation", { "background-blend-mode": "saturation" }],
420
+ ["bg-blend-color", { "background-blend-mode": "color" }],
421
+ ["bg-blend-luminosity", { "background-blend-mode": "luminosity" }],
422
+ ["bg-blend-normal", { "background-blend-mode": "normal" }]
423
+ ];
424
+ const mixBlendModes = [
425
+ ["mix-blend-multiply", { "mix-blend-mode": "multiply" }],
426
+ ["mix-blend-screen", { "mix-blend-mode": "screen" }],
427
+ ["mix-blend-overlay", { "mix-blend-mode": "overlay" }],
428
+ ["mix-blend-darken", { "mix-blend-mode": "darken" }],
429
+ ["mix-blend-lighten", { "mix-blend-mode": "lighten" }],
430
+ ["mix-blend-color-dodge", { "mix-blend-mode": "color-dodge" }],
431
+ ["mix-blend-color-burn", { "mix-blend-mode": "color-burn" }],
432
+ ["mix-blend-hard-light", { "mix-blend-mode": "hard-light" }],
433
+ ["mix-blend-soft-light", { "mix-blend-mode": "soft-light" }],
434
+ ["mix-blend-difference", { "mix-blend-mode": "difference" }],
435
+ ["mix-blend-exclusion", { "mix-blend-mode": "exclusion" }],
436
+ ["mix-blend-hue", { "mix-blend-mode": "hue" }],
437
+ ["mix-blend-saturation", { "mix-blend-mode": "saturation" }],
438
+ ["mix-blend-color", { "mix-blend-mode": "color" }],
439
+ ["mix-blend-luminosity", { "mix-blend-mode": "luminosity" }],
440
+ ["mix-blend-normal", { "mix-blend-mode": "normal" }]
412
441
  ];
413
442
 
414
443
  const tables = [
@@ -454,25 +483,19 @@ const cssVariables = [[
454
483
  }
455
484
  ]];
456
485
 
457
- const divideColors = [
458
- [/^divide-(.+)$/, utils.colorResolver("border-color", "divide")],
459
- [/^divide-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-divide-opacity": utils.handler.bracket.percent(opacity) })]
460
- ];
461
- const divideSizes = [
486
+ const divides = [
462
487
  [/^divide-?([xy])$/, handlerDivide],
463
488
  [/^divide-?([xy])-?(-?.+)$/, handlerDivide],
464
- [/^divide-?([xy])-reverse$/, ([, d]) => [[`--un-divide-${d}-reverse`, 1]]]
465
- ];
466
- const divideStyles = [
489
+ [/^divide-?([xy])-reverse$/, ([, d]) => ({ [`--un-divide-${d}-reverse`]: 1 })],
490
+ [/^divide-(.+)$/, utils.colorResolver("border-color", "divide")],
491
+ [/^divide-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-divide-opacity": utils.handler.bracket.percent(opacity) })],
467
492
  ["divide-solid", { "border-style": "solid" }],
468
493
  ["divide-dashed", { "border-style": "dashed" }],
469
494
  ["divide-dotted", { "border-style": "dotted" }],
470
495
  ["divide-double", { "border-style": "double" }],
471
496
  ["divide-none", { "border-style": "none" }]
472
497
  ];
473
- const divides = [divideSizes, divideColors, divideStyles].flat(1);
474
- function handlerDivide([, a, b]) {
475
- const [d, s = "1"] = utils.directionMap[a] ? [a, b] : ["", a];
498
+ function handlerDivide([, d, s = "1"]) {
476
499
  const v = utils.handler.bracket.px(s);
477
500
  if (v != null) {
478
501
  const results = utils.directionMap[d].map((item) => {
@@ -505,18 +528,25 @@ const fontVariantNumericBase = {
505
528
  "--un-numeric-figure": rules$1.varEmpty,
506
529
  "--un-numeric-spacing": rules$1.varEmpty,
507
530
  "--un-numeric-fraction": rules$1.varEmpty,
508
- "font-variant-numeric": "var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)",
509
- [variants$1.CONTROL_BYPASS_PSEUDO_CLASS]: ""
531
+ "--un-font-variant-numeric": "var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)",
532
+ [core.CONTROL_SHORTCUT_NO_MERGE]: ""
510
533
  };
534
+ const toEntries = (entry) => [
535
+ fontVariantNumericBase,
536
+ {
537
+ ...entry,
538
+ "font-variant-numeric": "var(--un-font-variant-numeric)"
539
+ }
540
+ ];
511
541
  const fontVariantNumeric = [
512
- [/^ordinal$/, () => [fontVariantNumericBase, { "--un-ordinal": "ordinal" }]],
513
- [/^slashed-zero$/, () => [fontVariantNumericBase, { "--un-slashed-zero": "slashed-zero" }]],
514
- [/^lining-nums$/, () => [fontVariantNumericBase, { "--un-numeric-figure": "lining-nums" }]],
515
- [/^oldstyle-nums$/, () => [fontVariantNumericBase, { "--un-numeric-figure": "oldstyle-nums" }]],
516
- [/^proportional-nums$/, () => [fontVariantNumericBase, { "--un-numeric-spacing": "proportional-nums" }]],
517
- [/^tabular-nums$/, () => [fontVariantNumericBase, { "--un-numeric-spacing": "tabular-nums" }]],
518
- [/^diagonal-fractions$/, () => [fontVariantNumericBase, { "--un-numeric-fraction": "diagonal-fractions" }]],
519
- [/^stacked-fractions$/, () => [fontVariantNumericBase, { "--un-numeric-fraction": "stacked-fractions" }]],
542
+ [/^ordinal$/, () => toEntries({ "--un-ordinal": "ordinal" })],
543
+ [/^slashed-zero$/, () => toEntries({ "--un-slashed-zero": "slashed-zero" })],
544
+ [/^lining-nums$/, () => toEntries({ "--un-numeric-figure": "lining-nums" })],
545
+ [/^oldstyle-nums$/, () => toEntries({ "--un-numeric-figure": "oldstyle-nums" })],
546
+ [/^proportional-nums$/, () => toEntries({ "--un-numeric-spacing": "proportional-nums" })],
547
+ [/^tabular-nums$/, () => toEntries({ "--un-numeric-spacing": "tabular-nums" })],
548
+ [/^diagonal-fractions$/, () => toEntries({ "--un-numeric-fraction": "diagonal-fractions" })],
549
+ [/^stacked-fractions$/, () => toEntries({ "--un-numeric-fraction": "stacked-fractions" })],
520
550
  ["normal-nums", { "font-variant-numeric": "normal" }]
521
551
  ];
522
552
 
@@ -525,7 +555,7 @@ const touchActionBase = {
525
555
  "--un-pan-y": rules$1.varEmpty,
526
556
  "--un-pinch-zoom": rules$1.varEmpty,
527
557
  "--un-touch-action": "var(--un-pan-x) var(--un-pan-y) var(--un-pinch-zoom)",
528
- [variants$1.CONTROL_BYPASS_PSEUDO_CLASS]: ""
558
+ [core.CONTROL_SHORTCUT_NO_MERGE]: ""
529
559
  };
530
560
  const touchActions = [
531
561
  [/^touch-pan-(x|left|right)$/, ([, d]) => [
@@ -555,10 +585,10 @@ const touchActions = [
555
585
  ];
556
586
 
557
587
  const scrolls = [
558
- [/^snap-(x|y|base)$/, ([, d]) => [
588
+ [/^snap-(x|y|both)$/, ([, d]) => [
559
589
  {
560
590
  "--un-scroll-snap-strictness": "proximity",
561
- [variants$1.CONTROL_BYPASS_PSEUDO_CLASS]: ""
591
+ [core.CONTROL_SHORTCUT_NO_MERGE]: ""
562
592
  },
563
593
  {
564
594
  "scroll-snap-type": `${d} var(--un-scroll-snap-strictness)`
@@ -581,6 +611,11 @@ const scrolls = [
581
611
  [/^scroll-p-?([rltb])-?(-?.+)$/, utils.directionSize("scroll-padding")]
582
612
  ];
583
613
 
614
+ const placeholders = [
615
+ [/^\$-placeholder-(.+)$/, utils.colorResolver("color", "placeholder")],
616
+ [/^\$-placeholder-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-placeholder-opacity": utils.handler.bracket.percent.cssvar(opacity) })]
617
+ ];
618
+
584
619
  const rules = [
585
620
  rules$1.cssVariables,
586
621
  cssVariables,
@@ -647,11 +682,10 @@ const rules = [
647
682
  hyphens,
648
683
  writingModes,
649
684
  writingOrientations,
650
- caretColors,
651
- caretOpacity,
652
- accentColors,
653
- accentOpacity,
685
+ carets,
686
+ accents,
654
687
  rules$1.opacity,
688
+ backgroundBlendModes,
655
689
  mixBlendModes,
656
690
  rules$1.boxShadows,
657
691
  rules$1.outline,
@@ -661,6 +695,7 @@ const rules = [
661
695
  rules$1.transitions,
662
696
  rules$1.willChange,
663
697
  rules$1.contents,
698
+ placeholders,
664
699
  rules$1.questionMark
665
700
  ].flat(1);
666
701
 
@@ -836,11 +871,26 @@ const variantSpaceAndDivide = (matcher) => {
836
871
  }
837
872
  };
838
873
 
839
- const variants = [
840
- variantSpaceAndDivide,
841
- ...variants$1.variants,
842
- ...variantColorsScheme
843
- ];
874
+ const placeholderModifier = (input, { theme }) => {
875
+ const m = input.match(/^(.*)\b(placeholder-)(.+?)$/);
876
+ if (m) {
877
+ const [, pre = "", p, body] = m;
878
+ if (hasColorValue(body, theme) || hasOpacityValue(body)) {
879
+ return {
880
+ matcher: `${pre}${p}$-placeholder-${body}`
881
+ };
882
+ }
883
+ }
884
+ };
885
+ function hasColorValue(body, theme) {
886
+ return !!utils.parseColor(body, theme)?.color;
887
+ }
888
+ function hasOpacityValue(body) {
889
+ const match = body.match(/^op(?:acity)?-?(.+)$/);
890
+ if (match && match[1] != null)
891
+ return utils.handler.bracket.percent.cssvar(match[1]) != null;
892
+ return false;
893
+ }
844
894
 
845
895
  const presetWind = (options = {}) => {
846
896
  options.dark = options.dark ?? "class";
@@ -852,7 +902,12 @@ const presetWind = (options = {}) => {
852
902
  shortcuts: [
853
903
  ...containerShortcuts
854
904
  ],
855
- variants,
905
+ variants: [
906
+ placeholderModifier,
907
+ variantSpaceAndDivide,
908
+ ...variants.variants(options),
909
+ ...variantColorsScheme
910
+ ],
856
911
  options
857
912
  };
858
913
  };
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { toArray } from '@unocss/core';
1
+ import { variants } from '@unocss/preset-mini/variants';
2
+ import { toArray, CONTROL_SHORTCUT_NO_MERGE } from '@unocss/core';
2
3
  import { theme as theme$1 } from '@unocss/preset-mini/theme';
3
4
  export { colors } from '@unocss/preset-mini';
4
5
  import { varEmpty, cssVariables as cssVariables$1, pointerEvents, appearances, positions, insets, zIndexes, orders, grids, floats, margins, boxSizing, displays, aspectRatio, sizes, flex, transforms, cursors, userSelects, resizes, appearance, placements, alignments, justifies, gaps, overflows, textOverflows, whitespaces, breaks, borders, bgColors, svgUtilities, paddings, textAligns, textIndents, verticalAligns, fonts, fontStyles, textColors, textDecorations, fontSmoothings, tabSizes, textStrokes, textShadows, opacity, boxShadows, outline, rings, transitions, willChange, contents, questionMark } from '@unocss/preset-mini/rules';
5
6
  import { handler, positionMap, parseColor, colorResolver, directionSize, directionMap, variantMatcher, variantParentMatcher } from '@unocss/preset-mini/utils';
6
- import { CONTROL_BYPASS_PSEUDO_CLASS, variants as variants$1 } from '@unocss/preset-mini/variants';
7
7
 
8
8
  const animations = [
9
9
  [/^keyframes-(.+)$/, ([, name], { theme, constructCSS }) => {
@@ -67,22 +67,6 @@ const bgGradientColorResolver = (mode) => ([, body], { theme }) => {
67
67
  }
68
68
  };
69
69
  const backgroundStyles = [
70
- ["bg-blend-multiply", { "background-blend-mode": "multiply" }],
71
- ["bg-blend-screen", { "background-blend-mode": "screen" }],
72
- ["bg-blend-overlay", { "background-blend-mode": "overlay" }],
73
- ["bg-blend-darken", { "background-blend-mode": "darken" }],
74
- ["bg-blend-lighten", { "background-blend-mode": "lighten" }],
75
- ["bg-blend-color-dodge", { "background-blend-mode": "color-dodge" }],
76
- ["bg-blend-color-burn", { "background-blend-mode": "color-burn" }],
77
- ["bg-blend-hard-light", { "background-blend-mode": "hard-light" }],
78
- ["bg-blend-soft-light", { "background-blend-mode": "soft-light" }],
79
- ["bg-blend-difference", { "background-blend-mode": "difference" }],
80
- ["bg-blend-exclusion", { "background-blend-mode": "exclusion" }],
81
- ["bg-blend-hue", { "background-blend-mode": "hue" }],
82
- ["bg-blend-saturation", { "background-blend-mode": "saturation" }],
83
- ["bg-blend-color", { "background-blend-mode": "color" }],
84
- ["bg-blend-luminosity", { "background-blend-mode": "luminosity" }],
85
- ["bg-blend-normal", { "background-blend-mode": "normal" }],
86
70
  [/^(?:bg-gradient-)?from-(.+)$/, bgGradientColorResolver("from")],
87
71
  [/^(?:bg-gradient-)?to-(.+)$/, bgGradientColorResolver("to")],
88
72
  [/^(?:bg-gradient-)?via-(.+)$/, bgGradientColorResolver("via")],
@@ -118,34 +102,28 @@ const backgroundStyles = [
118
102
  ["bg-origin-content", { "background-origin": "content-box" }]
119
103
  ];
120
104
 
121
- const listStyleProps = ["disc", "circle", "square", "decimal", "zero-decimal", "greek", "roman", "upper-roman", "alpha", "upper-alpha"];
122
105
  const listStyle = [
123
- [new RegExp(`^list-((?:${listStyleProps.join("|")})(?:-outside|-inside)?)$`), ([, value]) => {
124
- const style = value.split(/-outside|-inside/)[0];
125
- const position = /outside|inside/.exec(value) ?? [];
126
- if (position.length) {
106
+ [/^list-(disc|circle|square|decimal|zero-decimal|greek|roman|upper-roman|alpha|upper-alpha)(?:-(outside|inside))?$/, ([, style, position]) => {
107
+ if (position != null) {
127
108
  return {
128
- "list-style-position": `${position[0]}`,
109
+ "list-style-position": position,
129
110
  "list-style-type": style
130
111
  };
131
112
  }
132
113
  return { "list-style-type": style };
133
114
  }],
134
- [/^list-(outside|inside)$/, ([, value]) => ({ "list-style-position": value })],
115
+ ["list-outside", { "list-style-position": "outside" }],
116
+ ["list-inside", { "list-style-position": "inside" }],
135
117
  ["list-none", { "list-style-type": "none" }]
136
118
  ];
137
- const accentOpacity = [
119
+ const accents = [
120
+ [/^accent-(.+)$/, colorResolver("accent-color", "accent")],
138
121
  [/^accent-op(?:acity)?-?(.+)$/, ([, d]) => ({ "--un-accent-opacity": handler.bracket.percent(d) })]
139
122
  ];
140
- const accentColors = [
141
- [/^accent-(.+)$/, colorResolver("accent-color", "accent")]
142
- ];
143
- const caretOpacity = [
123
+ const carets = [
124
+ [/^caret-(.+)$/, colorResolver("caret-color", "caret")],
144
125
  [/^caret-op(?:acity)?-?(.+)$/, ([, d]) => ({ "--un-caret-opacity": handler.bracket.percent(d) })]
145
126
  ];
146
- const caretColors = [
147
- [/^caret-(.+)$/, colorResolver("caret-color", "caret")]
148
- ];
149
127
  const imageRenderings = [
150
128
  ["image-render-auto", { "image-rendering": "auto" }],
151
129
  ["image-render-edge", { "image-rendering": "crisp-edges" }],
@@ -231,21 +209,19 @@ const containerShortcuts = [
231
209
  }]
232
210
  ];
233
211
 
234
- const filterContnet = "var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia) var(--un-drop-shadow)";
235
212
  const filterBase = {
236
213
  "--un-blur": varEmpty,
237
214
  "--un-brightness": varEmpty,
238
215
  "--un-contrast": varEmpty,
216
+ "--un-drop-shadow": varEmpty,
239
217
  "--un-grayscale": varEmpty,
240
218
  "--un-hue-rotate": varEmpty,
241
219
  "--un-invert": varEmpty,
242
220
  "--un-saturate": varEmpty,
243
221
  "--un-sepia": varEmpty,
244
- "--un-drop-shadow": varEmpty,
245
- "filter": filterContnet,
246
- [CONTROL_BYPASS_PSEUDO_CLASS]: ""
222
+ "--un-filter": "var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)",
223
+ [CONTROL_SHORTCUT_NO_MERGE]: ""
247
224
  };
248
- const backdropFilterContent = "var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-saturate) var(--un-backdrop-sepia)";
249
225
  const backdropFilterBase = {
250
226
  "--un-backdrop-blur": varEmpty,
251
227
  "--un-backdrop-brightness": varEmpty,
@@ -253,72 +229,87 @@ const backdropFilterBase = {
253
229
  "--un-backdrop-grayscale": varEmpty,
254
230
  "--un-backdrop-hue-rotate": varEmpty,
255
231
  "--un-backdrop-invert": varEmpty,
232
+ "--un-backdrop-opacity": varEmpty,
256
233
  "--un-backdrop-saturate": varEmpty,
257
234
  "--un-backdrop-sepia": varEmpty,
258
- "-webkit-backdrop-filter": backdropFilterContent,
259
- "backdrop-filter": backdropFilterContent,
260
- [CONTROL_BYPASS_PSEUDO_CLASS]: ""
235
+ "--un-backdrop-filter": "var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia)",
236
+ [CONTROL_SHORTCUT_NO_MERGE]: ""
261
237
  };
262
- const percentWithDefault = (defaultValue = "1") => (str) => {
263
- const v = str ? handler.bracket.percent(str) : defaultValue;
264
- return v && parseFloat(v) <= 1 ? v : void 0;
238
+ const percentWithDefault = (str) => {
239
+ let v = handler.bracket(str || "");
240
+ if (v != null)
241
+ return v;
242
+ v = str ? handler.percent(str) : "1";
243
+ if (v != null && parseFloat(v) <= 1)
244
+ return v;
265
245
  };
266
246
  const toFilter = (varName, resolver) => ([, b, s], { theme }) => {
267
247
  const value = resolver(s, theme);
268
- if (value) {
269
- return [
270
- b ? backdropFilterBase : filterBase,
271
- { [`--un-${b || ""}${varName}`]: `${varName}(${value})` }
272
- ];
248
+ if (value != null && value !== "") {
249
+ if (b) {
250
+ return [
251
+ backdropFilterBase,
252
+ {
253
+ [`--un-${b}${varName}`]: `${varName}(${value})`,
254
+ "-webkit-backdrop-filter": "var(--un-backdrop-filter)",
255
+ "backdrop-filter": "var(--un-backdrop-filter)"
256
+ }
257
+ ];
258
+ } else {
259
+ return [
260
+ filterBase,
261
+ {
262
+ [`--un-${varName}`]: `${varName}(${value})`,
263
+ filter: "var(--un-filter)"
264
+ }
265
+ ];
266
+ }
273
267
  }
274
268
  };
275
269
  const filters = [
276
- ["filter", filterBase],
277
- ["backdrop-filter", backdropFilterBase],
278
270
  [/^(backdrop-)?blur(?:-(.+))?$/, toFilter("blur", (s, theme) => theme.blur?.[s || "DEFAULT"] || handler.bracket.px(s))],
279
- [/^(backdrop-)?brightness-(\d+)$/, toFilter("brightness", (s) => handler.bracket.percent(s))],
280
- [/^(backdrop-)?contrast-(\d+)$/, toFilter("contrast", (s) => handler.bracket.percent(s))],
271
+ [/^(backdrop-)?brightness-(.+)$/, toFilter("brightness", (s) => handler.bracket.percent(s))],
272
+ [/^(backdrop-)?contrast-(.+)$/, toFilter("contrast", (s) => handler.bracket.percent(s))],
281
273
  [/^()?drop-shadow(?:-(.+))?$/, toFilter("drop-shadow", (s, theme) => {
282
- const v = handler.bracket(s) || theme.dropShadow?.[s || "DEFAULT"];
283
- if (v)
274
+ let v = theme.dropShadow?.[s || "DEFAULT"];
275
+ if (v != null)
284
276
  return toArray(v).map((v2) => `drop-shadow(${v2})`).join(" ");
277
+ v = handler.bracket(s);
278
+ if (v != null)
279
+ return `drop-shadow(${v})`;
285
280
  })],
286
- [/^(backdrop-)?grayscale(?:-(\d+))?$/, toFilter("grayscale", percentWithDefault())],
287
- [/^(backdrop-)?hue-rotate-(\d+)$/, toFilter("hue-rotate", (s) => `${handler.bracket.number(s)}deg`)],
288
- [/^(backdrop-)?invert(?:-(\d+))?$/, toFilter("invert", percentWithDefault())],
289
- [/^(backdrop-)?saturate(?:-(\d+))?$/, toFilter("saturate", percentWithDefault("0"))],
290
- [/^(backdrop-)?sepia(?:-(\d+))?$/, toFilter("sepia", percentWithDefault())],
281
+ [/^(backdrop-)?grayscale(?:-(.+))?$/, toFilter("grayscale", percentWithDefault)],
282
+ [/^(backdrop-)?hue-rotate-(.+)$/, toFilter("hue-rotate", (s) => handler.bracket.degree(s))],
283
+ [/^(backdrop-)?invert(?:-(.+))?$/, toFilter("invert", percentWithDefault)],
284
+ [/^(backdrop-)opacity-(.+)$/, toFilter("opacity", (s) => handler.bracket.percent(s))],
285
+ [/^(backdrop-)?saturate-(.+)$/, toFilter("saturate", (s) => handler.bracket.percent(s))],
286
+ [/^(backdrop-)?sepia(?:-(.+))?$/, toFilter("sepia", percentWithDefault)],
287
+ [/^filter$/, () => [
288
+ filterBase,
289
+ { filter: "var(--un-filter)" }
290
+ ]],
291
+ [/^backdrop-filter$/, () => [
292
+ backdropFilterBase,
293
+ {
294
+ "-webkit-backdrop-filter": "var(--un-backdrop-filter)",
295
+ "backdrop-filter": "var(--un-backdrop-filter)"
296
+ }
297
+ ]],
291
298
  ["filter-none", { filter: "none" }],
292
299
  ["backdrop-filter-none", {
293
300
  "-webkit-backdrop-filter": "none",
294
301
  "backdrop-filter": "none"
295
- }]
296
- ];
297
-
298
- const mixBlendModes = [
299
- ["mix-blend-multiply", { "mix-blend-mode": "multiply" }],
300
- ["mix-blend-screen", { "mix-blend-mode": "screen" }],
301
- ["mix-blend-overlay", { "mix-blend-mode": "overlay" }],
302
- ["mix-blend-darken", { "mix-blend-mode": "darken" }],
303
- ["mix-blend-lighten", { "mix-blend-mode": "lighten" }],
304
- ["mix-blend-color-dodge", { "mix-blend-mode": "color-dodge" }],
305
- ["mix-blend-color-burn", { "mix-blend-mode": "color-burn" }],
306
- ["mix-blend-hard-light", { "mix-blend-mode": "hard-light" }],
307
- ["mix-blend-soft-light", { "mix-blend-mode": "soft-light" }],
308
- ["mix-blend-difference", { "mix-blend-mode": "difference" }],
309
- ["mix-blend-exclusion", { "mix-blend-mode": "exclusion" }],
310
- ["mix-blend-hue", { "mix-blend-mode": "hue" }],
311
- ["mix-blend-saturation", { "mix-blend-mode": "saturation" }],
312
- ["mix-blend-color", { "mix-blend-mode": "color" }],
313
- ["mix-blend-luminosity", { "mix-blend-mode": "luminosity" }],
314
- ["mix-blend-normal", { "mix-blend-mode": "normal" }]
302
+ }],
303
+ [/^(blur|brightness|contrast|drop-shadow|grayscale|hue-rotate|invert|saturate|sepia)-none$/, ([, s]) => ({ filter: `${s}(0)` })],
304
+ [/^backdrop-(blur|brightness|contrast|grayscale|hue-rotate|invert|opacity|saturate|sepia)-none$/, ([, s]) => ({
305
+ "-webkit-backdrop-filter": `${s}(0)`,
306
+ "backdrop-filter": `${s}(0)`
307
+ })]
315
308
  ];
316
309
 
317
310
  const spaces = [
318
311
  [/^space-?([xy])-?(-?.+)$/, (match) => {
319
- const [, direction, size] = match;
320
- if (size === "reverse")
321
- return { [`--un-space-${direction}-reverse`]: 1 };
312
+ const [, direction] = match;
322
313
  const results = directionSize("margin")(match)?.map((item) => {
323
314
  const value = item[0].endsWith("right") || item[0].endsWith("bottom") ? `calc(${item[1]} * var(--un-space-${direction}-reverse))` : `calc(${item[1]} * calc(1 - var(--un-space-${direction}-reverse)))`;
324
315
  return [item[0], value];
@@ -329,7 +320,8 @@ const spaces = [
329
320
  ...results
330
321
  ];
331
322
  }
332
- }]
323
+ }],
324
+ [/^space-?([xy])-reverse$/, ([, d]) => ({ [`--un-space-${d}-reverse`]: 1 })]
333
325
  ];
334
326
 
335
327
  const textTransforms = [
@@ -396,7 +388,8 @@ const screenReadersAccess = [
396
388
  ];
397
389
  const isolations = [
398
390
  ["isolate", { isolation: "isolate" }],
399
- ["isolate-auto", { isolation: "auto" }]
391
+ ["isolate-auto", { isolation: "auto" }],
392
+ ["isolation-auto", { isolation: "auto" }]
400
393
  ];
401
394
  const objectPositions = [
402
395
  ["object-cover", { "object-fit": "cover" }],
@@ -404,7 +397,43 @@ const objectPositions = [
404
397
  ["object-fill", { "object-fit": "fill" }],
405
398
  ["object-scale-down", { "object-fit": "scale-down" }],
406
399
  ["object-none", { "object-fit": "none" }],
407
- [/^object-([\w]+)$/, ([, s]) => ({ "object-position": positionMap[s] })]
400
+ [/^object-([-\w]+)$/, ([, s]) => ({ "object-position": positionMap[s] })]
401
+ ];
402
+ const backgroundBlendModes = [
403
+ ["bg-blend-multiply", { "background-blend-mode": "multiply" }],
404
+ ["bg-blend-screen", { "background-blend-mode": "screen" }],
405
+ ["bg-blend-overlay", { "background-blend-mode": "overlay" }],
406
+ ["bg-blend-darken", { "background-blend-mode": "darken" }],
407
+ ["bg-blend-lighten", { "background-blend-mode": "lighten" }],
408
+ ["bg-blend-color-dodge", { "background-blend-mode": "color-dodge" }],
409
+ ["bg-blend-color-burn", { "background-blend-mode": "color-burn" }],
410
+ ["bg-blend-hard-light", { "background-blend-mode": "hard-light" }],
411
+ ["bg-blend-soft-light", { "background-blend-mode": "soft-light" }],
412
+ ["bg-blend-difference", { "background-blend-mode": "difference" }],
413
+ ["bg-blend-exclusion", { "background-blend-mode": "exclusion" }],
414
+ ["bg-blend-hue", { "background-blend-mode": "hue" }],
415
+ ["bg-blend-saturation", { "background-blend-mode": "saturation" }],
416
+ ["bg-blend-color", { "background-blend-mode": "color" }],
417
+ ["bg-blend-luminosity", { "background-blend-mode": "luminosity" }],
418
+ ["bg-blend-normal", { "background-blend-mode": "normal" }]
419
+ ];
420
+ const mixBlendModes = [
421
+ ["mix-blend-multiply", { "mix-blend-mode": "multiply" }],
422
+ ["mix-blend-screen", { "mix-blend-mode": "screen" }],
423
+ ["mix-blend-overlay", { "mix-blend-mode": "overlay" }],
424
+ ["mix-blend-darken", { "mix-blend-mode": "darken" }],
425
+ ["mix-blend-lighten", { "mix-blend-mode": "lighten" }],
426
+ ["mix-blend-color-dodge", { "mix-blend-mode": "color-dodge" }],
427
+ ["mix-blend-color-burn", { "mix-blend-mode": "color-burn" }],
428
+ ["mix-blend-hard-light", { "mix-blend-mode": "hard-light" }],
429
+ ["mix-blend-soft-light", { "mix-blend-mode": "soft-light" }],
430
+ ["mix-blend-difference", { "mix-blend-mode": "difference" }],
431
+ ["mix-blend-exclusion", { "mix-blend-mode": "exclusion" }],
432
+ ["mix-blend-hue", { "mix-blend-mode": "hue" }],
433
+ ["mix-blend-saturation", { "mix-blend-mode": "saturation" }],
434
+ ["mix-blend-color", { "mix-blend-mode": "color" }],
435
+ ["mix-blend-luminosity", { "mix-blend-mode": "luminosity" }],
436
+ ["mix-blend-normal", { "mix-blend-mode": "normal" }]
408
437
  ];
409
438
 
410
439
  const tables = [
@@ -450,25 +479,19 @@ const cssVariables = [[
450
479
  }
451
480
  ]];
452
481
 
453
- const divideColors = [
454
- [/^divide-(.+)$/, colorResolver("border-color", "divide")],
455
- [/^divide-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-divide-opacity": handler.bracket.percent(opacity) })]
456
- ];
457
- const divideSizes = [
482
+ const divides = [
458
483
  [/^divide-?([xy])$/, handlerDivide],
459
484
  [/^divide-?([xy])-?(-?.+)$/, handlerDivide],
460
- [/^divide-?([xy])-reverse$/, ([, d]) => [[`--un-divide-${d}-reverse`, 1]]]
461
- ];
462
- const divideStyles = [
485
+ [/^divide-?([xy])-reverse$/, ([, d]) => ({ [`--un-divide-${d}-reverse`]: 1 })],
486
+ [/^divide-(.+)$/, colorResolver("border-color", "divide")],
487
+ [/^divide-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-divide-opacity": handler.bracket.percent(opacity) })],
463
488
  ["divide-solid", { "border-style": "solid" }],
464
489
  ["divide-dashed", { "border-style": "dashed" }],
465
490
  ["divide-dotted", { "border-style": "dotted" }],
466
491
  ["divide-double", { "border-style": "double" }],
467
492
  ["divide-none", { "border-style": "none" }]
468
493
  ];
469
- const divides = [divideSizes, divideColors, divideStyles].flat(1);
470
- function handlerDivide([, a, b]) {
471
- const [d, s = "1"] = directionMap[a] ? [a, b] : ["", a];
494
+ function handlerDivide([, d, s = "1"]) {
472
495
  const v = handler.bracket.px(s);
473
496
  if (v != null) {
474
497
  const results = directionMap[d].map((item) => {
@@ -501,18 +524,25 @@ const fontVariantNumericBase = {
501
524
  "--un-numeric-figure": varEmpty,
502
525
  "--un-numeric-spacing": varEmpty,
503
526
  "--un-numeric-fraction": varEmpty,
504
- "font-variant-numeric": "var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)",
505
- [CONTROL_BYPASS_PSEUDO_CLASS]: ""
527
+ "--un-font-variant-numeric": "var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)",
528
+ [CONTROL_SHORTCUT_NO_MERGE]: ""
506
529
  };
530
+ const toEntries = (entry) => [
531
+ fontVariantNumericBase,
532
+ {
533
+ ...entry,
534
+ "font-variant-numeric": "var(--un-font-variant-numeric)"
535
+ }
536
+ ];
507
537
  const fontVariantNumeric = [
508
- [/^ordinal$/, () => [fontVariantNumericBase, { "--un-ordinal": "ordinal" }]],
509
- [/^slashed-zero$/, () => [fontVariantNumericBase, { "--un-slashed-zero": "slashed-zero" }]],
510
- [/^lining-nums$/, () => [fontVariantNumericBase, { "--un-numeric-figure": "lining-nums" }]],
511
- [/^oldstyle-nums$/, () => [fontVariantNumericBase, { "--un-numeric-figure": "oldstyle-nums" }]],
512
- [/^proportional-nums$/, () => [fontVariantNumericBase, { "--un-numeric-spacing": "proportional-nums" }]],
513
- [/^tabular-nums$/, () => [fontVariantNumericBase, { "--un-numeric-spacing": "tabular-nums" }]],
514
- [/^diagonal-fractions$/, () => [fontVariantNumericBase, { "--un-numeric-fraction": "diagonal-fractions" }]],
515
- [/^stacked-fractions$/, () => [fontVariantNumericBase, { "--un-numeric-fraction": "stacked-fractions" }]],
538
+ [/^ordinal$/, () => toEntries({ "--un-ordinal": "ordinal" })],
539
+ [/^slashed-zero$/, () => toEntries({ "--un-slashed-zero": "slashed-zero" })],
540
+ [/^lining-nums$/, () => toEntries({ "--un-numeric-figure": "lining-nums" })],
541
+ [/^oldstyle-nums$/, () => toEntries({ "--un-numeric-figure": "oldstyle-nums" })],
542
+ [/^proportional-nums$/, () => toEntries({ "--un-numeric-spacing": "proportional-nums" })],
543
+ [/^tabular-nums$/, () => toEntries({ "--un-numeric-spacing": "tabular-nums" })],
544
+ [/^diagonal-fractions$/, () => toEntries({ "--un-numeric-fraction": "diagonal-fractions" })],
545
+ [/^stacked-fractions$/, () => toEntries({ "--un-numeric-fraction": "stacked-fractions" })],
516
546
  ["normal-nums", { "font-variant-numeric": "normal" }]
517
547
  ];
518
548
 
@@ -521,7 +551,7 @@ const touchActionBase = {
521
551
  "--un-pan-y": varEmpty,
522
552
  "--un-pinch-zoom": varEmpty,
523
553
  "--un-touch-action": "var(--un-pan-x) var(--un-pan-y) var(--un-pinch-zoom)",
524
- [CONTROL_BYPASS_PSEUDO_CLASS]: ""
554
+ [CONTROL_SHORTCUT_NO_MERGE]: ""
525
555
  };
526
556
  const touchActions = [
527
557
  [/^touch-pan-(x|left|right)$/, ([, d]) => [
@@ -551,10 +581,10 @@ const touchActions = [
551
581
  ];
552
582
 
553
583
  const scrolls = [
554
- [/^snap-(x|y|base)$/, ([, d]) => [
584
+ [/^snap-(x|y|both)$/, ([, d]) => [
555
585
  {
556
586
  "--un-scroll-snap-strictness": "proximity",
557
- [CONTROL_BYPASS_PSEUDO_CLASS]: ""
587
+ [CONTROL_SHORTCUT_NO_MERGE]: ""
558
588
  },
559
589
  {
560
590
  "scroll-snap-type": `${d} var(--un-scroll-snap-strictness)`
@@ -577,6 +607,11 @@ const scrolls = [
577
607
  [/^scroll-p-?([rltb])-?(-?.+)$/, directionSize("scroll-padding")]
578
608
  ];
579
609
 
610
+ const placeholders = [
611
+ [/^\$-placeholder-(.+)$/, colorResolver("color", "placeholder")],
612
+ [/^\$-placeholder-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-placeholder-opacity": handler.bracket.percent.cssvar(opacity) })]
613
+ ];
614
+
580
615
  const rules = [
581
616
  cssVariables$1,
582
617
  cssVariables,
@@ -643,11 +678,10 @@ const rules = [
643
678
  hyphens,
644
679
  writingModes,
645
680
  writingOrientations,
646
- caretColors,
647
- caretOpacity,
648
- accentColors,
649
- accentOpacity,
681
+ carets,
682
+ accents,
650
683
  opacity,
684
+ backgroundBlendModes,
651
685
  mixBlendModes,
652
686
  boxShadows,
653
687
  outline,
@@ -657,6 +691,7 @@ const rules = [
657
691
  transitions,
658
692
  willChange,
659
693
  contents,
694
+ placeholders,
660
695
  questionMark
661
696
  ].flat(1);
662
697
 
@@ -832,11 +867,26 @@ const variantSpaceAndDivide = (matcher) => {
832
867
  }
833
868
  };
834
869
 
835
- const variants = [
836
- variantSpaceAndDivide,
837
- ...variants$1,
838
- ...variantColorsScheme
839
- ];
870
+ const placeholderModifier = (input, { theme }) => {
871
+ const m = input.match(/^(.*)\b(placeholder-)(.+?)$/);
872
+ if (m) {
873
+ const [, pre = "", p, body] = m;
874
+ if (hasColorValue(body, theme) || hasOpacityValue(body)) {
875
+ return {
876
+ matcher: `${pre}${p}$-placeholder-${body}`
877
+ };
878
+ }
879
+ }
880
+ };
881
+ function hasColorValue(body, theme) {
882
+ return !!parseColor(body, theme)?.color;
883
+ }
884
+ function hasOpacityValue(body) {
885
+ const match = body.match(/^op(?:acity)?-?(.+)$/);
886
+ if (match && match[1] != null)
887
+ return handler.bracket.percent.cssvar(match[1]) != null;
888
+ return false;
889
+ }
840
890
 
841
891
  const presetWind = (options = {}) => {
842
892
  options.dark = options.dark ?? "class";
@@ -848,7 +898,12 @@ const presetWind = (options = {}) => {
848
898
  shortcuts: [
849
899
  ...containerShortcuts
850
900
  ],
851
- variants,
901
+ variants: [
902
+ placeholderModifier,
903
+ variantSpaceAndDivide,
904
+ ...variants(options),
905
+ ...variantColorsScheme
906
+ ],
852
907
  options
853
908
  };
854
909
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-wind",
3
- "version": "0.20.4",
3
+ "version": "0.22.0",
4
4
  "description": "Tailwind / Windi CSS compact preset for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
@@ -35,8 +35,8 @@
35
35
  "*.css"
36
36
  ],
37
37
  "dependencies": {
38
- "@unocss/core": "0.20.4",
39
- "@unocss/preset-mini": "0.20.4"
38
+ "@unocss/core": "0.22.0",
39
+ "@unocss/preset-mini": "0.22.0"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "unbuild",