@unocss/preset-mini 0.18.0 → 0.18.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.
@@ -173,7 +173,7 @@ const flex = [
173
173
  ["flex-auto", { flex: "1 1 auto" }],
174
174
  ["flex-initial", { flex: "0 1 auto" }],
175
175
  ["flex-none", { flex: "none" }],
176
- [/^flex-\[(.+)\]$/, ([, d]) => ({ flex: d })],
176
+ [/^flex-(\[.+\])$/, ([, d]) => ({ flex: utilities.handler.bracket(d).replace(/\d+\/\d+/, ($1) => utilities.handler.fraction($1)) })],
177
177
  ["flex-shrink", { "flex-shrink": 1 }],
178
178
  ["flex-shrink-0", { "flex-shrink": 0 }],
179
179
  ["flex-grow", { "flex-grow": 1 }],
@@ -171,7 +171,7 @@ const flex = [
171
171
  ["flex-auto", { flex: "1 1 auto" }],
172
172
  ["flex-initial", { flex: "0 1 auto" }],
173
173
  ["flex-none", { flex: "none" }],
174
- [/^flex-\[(.+)\]$/, ([, d]) => ({ flex: d })],
174
+ [/^flex-(\[.+\])$/, ([, d]) => ({ flex: handler.bracket(d).replace(/\d+\/\d+/, ($1) => handler.fraction($1)) })],
175
175
  ["flex-shrink", { "flex-shrink": 1 }],
176
176
  ["flex-shrink-0", { "flex-shrink": 0 }],
177
177
  ["flex-grow", { "flex-grow": 1 }],
@@ -120,6 +120,7 @@ const variants = (options) => [
120
120
  variantBreakpoints,
121
121
  ...variantCombinators,
122
122
  pseudo.variantPseudoClasses,
123
+ pseudo.variantPseudoClassFunctions,
123
124
  pseudo.variantTaggedPseudoClasses(options),
124
125
  pseudo.variantPseudoElements,
125
126
  pseudo.partClasses,
@@ -1,5 +1,5 @@
1
1
  import { v as variantMatcher } from './variants.mjs';
2
- import { v as variantPseudoClasses, a as variantTaggedPseudoClasses, b as variantPseudoElements, p as partClasses } from './pseudo.mjs';
2
+ import { v as variantPseudoClasses, a as variantPseudoClassFunctions, b as variantTaggedPseudoClasses, c as variantPseudoElements, p as partClasses } from './pseudo.mjs';
3
3
 
4
4
  const regexCache = {};
5
5
  const variantBreakpoints = (matcher, _, theme) => {
@@ -118,6 +118,7 @@ const variants = (options) => [
118
118
  variantBreakpoints,
119
119
  ...variantCombinators,
120
120
  variantPseudoClasses,
121
+ variantPseudoClassFunctions,
121
122
  variantTaggedPseudoClasses(options),
122
123
  variantPseudoElements,
123
124
  partClasses,
@@ -47,23 +47,30 @@ const PseudoElements = [
47
47
  "first-line",
48
48
  "selection"
49
49
  ];
50
+ const PseudoClassFunctions = [
51
+ "not",
52
+ "is",
53
+ "where",
54
+ "has"
55
+ ];
50
56
  const PartClassesRE = /(part-\[(.+)]:)(.+)/;
51
57
  const PseudoElementsRE = new RegExp(`^(${PseudoElements.join("|")})[:-]`);
52
58
  const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
59
+ const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
53
60
  const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
54
- const PseudoClassesNotRE = new RegExp(`^not-(${PseudoClassesStr})[:-]`);
61
+ const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
55
62
  function shouldAdd(entires) {
56
63
  return !entires.find((i) => i[0] === CONTROL_BYPASS_PSEUDO_CLASS) || void 0;
57
64
  }
58
- function taggedPseudoClassMatcher(tag, parent, combinator) {
59
- const re = new RegExp(`^${tag}-((not-)?(${PseudoClassesStr}))[:-]`);
65
+ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
66
+ const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
60
67
  const rawRe = new RegExp(`^${core.escapeRegExp(parent)}:`);
61
68
  return (input) => {
62
69
  const match = input.match(re);
63
70
  if (match) {
64
71
  let pseudo = PseudoClasses[match[3]] || match[3];
65
72
  if (match[2])
66
- pseudo = `not(:${pseudo})`;
73
+ pseudo = `${match[2]}(:${pseudo})`;
67
74
  return {
68
75
  matcher: input.slice(match[1].length + tag.length + 2),
69
76
  selector: (s, body) => {
@@ -72,7 +79,7 @@ function taggedPseudoClassMatcher(tag, parent, combinator) {
72
79
  };
73
80
  }
74
81
  };
75
- }
82
+ };
76
83
  const variantPseudoElements = (input) => {
77
84
  const match = input.match(PseudoElementsRE);
78
85
  if (match) {
@@ -84,7 +91,7 @@ const variantPseudoElements = (input) => {
84
91
  };
85
92
  const variantPseudoClasses = {
86
93
  match: (input) => {
87
- let match = input.match(PseudoClassesRE);
94
+ const match = input.match(PseudoClassesRE);
88
95
  if (match) {
89
96
  const pseudo = PseudoClasses[match[1]] || match[1];
90
97
  return {
@@ -92,12 +99,18 @@ const variantPseudoClasses = {
92
99
  selector: (s, body) => shouldAdd(body) && `${s}:${pseudo}`
93
100
  };
94
101
  }
95
- match = input.match(PseudoClassesNotRE);
102
+ },
103
+ multiPass: true
104
+ };
105
+ const variantPseudoClassFunctions = {
106
+ match: (input) => {
107
+ const match = input.match(PseudoClassFunctionsRE);
96
108
  if (match) {
97
- const pseudo = PseudoClasses[match[1]] || match[1];
109
+ const fn = match[1];
110
+ const pseudo = PseudoClasses[match[2]] || match[2];
98
111
  return {
99
- matcher: input.slice(match[1].length + 5),
100
- selector: (s, body) => shouldAdd(body) && `${s}:not(:${pseudo})`
112
+ matcher: input.slice(match[1].length + match[2].length + 2),
113
+ selector: (s, body) => shouldAdd(body) && `${s}:${fn}(:${pseudo})`
101
114
  };
102
115
  }
103
116
  },
@@ -132,8 +145,8 @@ const partClasses = {
132
145
  };
133
146
 
134
147
  exports.CONTROL_BYPASS_PSEUDO_CLASS = CONTROL_BYPASS_PSEUDO_CLASS;
135
- exports.PseudoClasses = PseudoClasses;
136
148
  exports.partClasses = partClasses;
149
+ exports.variantPseudoClassFunctions = variantPseudoClassFunctions;
137
150
  exports.variantPseudoClasses = variantPseudoClasses;
138
151
  exports.variantPseudoElements = variantPseudoElements;
139
152
  exports.variantTaggedPseudoClasses = variantTaggedPseudoClasses;
@@ -45,23 +45,30 @@ const PseudoElements = [
45
45
  "first-line",
46
46
  "selection"
47
47
  ];
48
+ const PseudoClassFunctions = [
49
+ "not",
50
+ "is",
51
+ "where",
52
+ "has"
53
+ ];
48
54
  const PartClassesRE = /(part-\[(.+)]:)(.+)/;
49
55
  const PseudoElementsRE = new RegExp(`^(${PseudoElements.join("|")})[:-]`);
50
56
  const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
57
+ const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
51
58
  const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
52
- const PseudoClassesNotRE = new RegExp(`^not-(${PseudoClassesStr})[:-]`);
59
+ const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
53
60
  function shouldAdd(entires) {
54
61
  return !entires.find((i) => i[0] === CONTROL_BYPASS_PSEUDO_CLASS) || void 0;
55
62
  }
56
- function taggedPseudoClassMatcher(tag, parent, combinator) {
57
- const re = new RegExp(`^${tag}-((not-)?(${PseudoClassesStr}))[:-]`);
63
+ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
64
+ const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
58
65
  const rawRe = new RegExp(`^${escapeRegExp(parent)}:`);
59
66
  return (input) => {
60
67
  const match = input.match(re);
61
68
  if (match) {
62
69
  let pseudo = PseudoClasses[match[3]] || match[3];
63
70
  if (match[2])
64
- pseudo = `not(:${pseudo})`;
71
+ pseudo = `${match[2]}(:${pseudo})`;
65
72
  return {
66
73
  matcher: input.slice(match[1].length + tag.length + 2),
67
74
  selector: (s, body) => {
@@ -70,7 +77,7 @@ function taggedPseudoClassMatcher(tag, parent, combinator) {
70
77
  };
71
78
  }
72
79
  };
73
- }
80
+ };
74
81
  const variantPseudoElements = (input) => {
75
82
  const match = input.match(PseudoElementsRE);
76
83
  if (match) {
@@ -82,7 +89,7 @@ const variantPseudoElements = (input) => {
82
89
  };
83
90
  const variantPseudoClasses = {
84
91
  match: (input) => {
85
- let match = input.match(PseudoClassesRE);
92
+ const match = input.match(PseudoClassesRE);
86
93
  if (match) {
87
94
  const pseudo = PseudoClasses[match[1]] || match[1];
88
95
  return {
@@ -90,12 +97,18 @@ const variantPseudoClasses = {
90
97
  selector: (s, body) => shouldAdd(body) && `${s}:${pseudo}`
91
98
  };
92
99
  }
93
- match = input.match(PseudoClassesNotRE);
100
+ },
101
+ multiPass: true
102
+ };
103
+ const variantPseudoClassFunctions = {
104
+ match: (input) => {
105
+ const match = input.match(PseudoClassFunctionsRE);
94
106
  if (match) {
95
- const pseudo = PseudoClasses[match[1]] || match[1];
107
+ const fn = match[1];
108
+ const pseudo = PseudoClasses[match[2]] || match[2];
96
109
  return {
97
- matcher: input.slice(match[1].length + 5),
98
- selector: (s, body) => shouldAdd(body) && `${s}:not(:${pseudo})`
110
+ matcher: input.slice(match[1].length + match[2].length + 2),
111
+ selector: (s, body) => shouldAdd(body) && `${s}:${fn}(:${pseudo})`
99
112
  };
100
113
  }
101
114
  },
@@ -129,4 +142,4 @@ const partClasses = {
129
142
  multiPass: true
130
143
  };
131
144
 
132
- export { CONTROL_BYPASS_PSEUDO_CLASS as C, PseudoClasses as P, variantTaggedPseudoClasses as a, variantPseudoElements as b, partClasses as p, variantPseudoClasses as v };
145
+ export { CONTROL_BYPASS_PSEUDO_CLASS as C, variantPseudoClassFunctions as a, variantTaggedPseudoClasses as b, variantPseudoElements as c, partClasses as p, variantPseudoClasses as v };
@@ -1,4 +1,4 @@
1
- import { T as Theme } from './types-7963d0b3';
1
+ import { T as Theme } from './types-a2d2b52f';
2
2
 
3
3
  declare const colors: Theme['colors'];
4
4
 
package/dist/colors.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { c as colors } from './colors-d6b5a5b4';
2
- import './types-7963d0b3';
1
+ export { c as colors } from './colors-6d634692';
2
+ import './types-a2d2b52f';
@@ -1,4 +1,4 @@
1
- import { T as Theme } from './types-7963d0b3';
1
+ import { T as Theme } from './types-a2d2b52f';
2
2
 
3
3
  declare const theme: Theme;
4
4
 
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Preset } from '@unocss/core';
2
- import { T as Theme } from './types-7963d0b3';
3
- export { T as Theme } from './types-7963d0b3';
4
- export { t as theme } from './default-c7c67d23';
5
- export { c as colors } from './colors-d6b5a5b4';
2
+ import { T as Theme } from './types-a2d2b52f';
3
+ export { T as Theme, a as ThemeAnimation } from './types-a2d2b52f';
4
+ export { t as theme } from './default-958434b6';
5
+ export { c as colors } from './colors-6d634692';
6
6
 
7
7
  interface PresetMiniOptions {
8
8
  /**
package/dist/rules.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Rule } from '@unocss/core';
2
- import { T as Theme } from './types-7963d0b3';
2
+ import { T as Theme } from './types-a2d2b52f';
3
3
 
4
4
  declare const verticalAligns: Rule[];
5
5
  declare const textAligns: Rule[];
package/dist/theme.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { c as colors } from './colors-d6b5a5b4';
2
- export { t as theme } from './default-c7c67d23';
3
- import { T as Theme } from './types-7963d0b3';
4
- export { T as Theme } from './types-7963d0b3';
1
+ export { c as colors } from './colors-6d634692';
2
+ export { t as theme } from './default-958434b6';
3
+ import { T as Theme } from './types-a2d2b52f';
4
+ export { T as Theme, a as ThemeAnimation } from './types-a2d2b52f';
5
5
 
6
6
  declare const blur: {
7
7
  DEFAULT: string;
@@ -1,3 +1,9 @@
1
+ interface ThemeAnimation {
2
+ keyframes?: Record<string, string>;
3
+ durations?: Record<string, string>;
4
+ timingFns?: Record<string, string>;
5
+ properties?: Record<string, object>;
6
+ }
1
7
  interface Theme {
2
8
  width?: Record<string, string>;
3
9
  height?: Record<string, string>;
@@ -19,6 +25,7 @@ interface Theme {
19
25
  textStrokeWidth?: Record<string, string>;
20
26
  blur?: Record<string, string>;
21
27
  dropShadow?: Record<string, string | string[]>;
28
+ animation?: ThemeAnimation;
22
29
  }
23
30
 
24
- export { Theme as T };
31
+ export { Theme as T, ThemeAnimation as a };
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
2
  import { VariantHandler, DynamicMatcher, ParsedColorValue } from '@unocss/core';
3
- import { T as Theme } from './types-7963d0b3';
3
+ import { T as Theme } from './types-a2d2b52f';
4
4
 
5
5
  declare const directionMap: Record<string, string[]>;
6
6
  declare const cornerMap: Record<string, string[]>;
package/dist/variants.cjs CHANGED
@@ -18,8 +18,8 @@ exports.variantNegative = _default.variantNegative;
18
18
  exports.variantSpace = _default.variantSpace;
19
19
  exports.variants = _default.variants;
20
20
  exports.CONTROL_BYPASS_PSEUDO_CLASS = pseudo.CONTROL_BYPASS_PSEUDO_CLASS;
21
- exports.PseudoClasses = pseudo.PseudoClasses;
22
21
  exports.partClasses = pseudo.partClasses;
22
+ exports.variantPseudoClassFunctions = pseudo.variantPseudoClassFunctions;
23
23
  exports.variantPseudoClasses = pseudo.variantPseudoClasses;
24
24
  exports.variantPseudoElements = pseudo.variantPseudoElements;
25
25
  exports.variantTaggedPseudoClasses = pseudo.variantTaggedPseudoClasses;
@@ -1,8 +1,8 @@
1
1
  import { Variant, VariantFunction, VariantObject } from '@unocss/core';
2
- import { T as Theme } from './types-7963d0b3';
2
+ import { T as Theme } from './types-a2d2b52f';
3
3
  import { PresetMiniOptions } from './index';
4
- import './default-c7c67d23';
5
- import './colors-d6b5a5b4';
4
+ import './default-958434b6';
5
+ import './colors-6d634692';
6
6
 
7
7
  declare const variantBreakpoints: Variant<Theme>;
8
8
 
@@ -18,10 +18,10 @@ declare const variantNegative: Variant;
18
18
  declare const variantSpace: Variant;
19
19
 
20
20
  declare const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
21
- declare const PseudoClasses: Record<string, string | undefined>;
22
21
  declare const variantPseudoElements: VariantFunction;
23
22
  declare const variantPseudoClasses: VariantObject;
23
+ declare const variantPseudoClassFunctions: VariantObject;
24
24
  declare const variantTaggedPseudoClasses: (options?: PresetMiniOptions) => VariantObject;
25
25
  declare const partClasses: VariantObject;
26
26
 
27
- export { CONTROL_BYPASS_PSEUDO_CLASS, PseudoClasses, partClasses, variantBreakpoints, variantColorsClass, variantColorsMedia, variantCombinators, variantImportant, variantNegative, variantPseudoClasses, variantPseudoElements, variantSpace, variantTaggedPseudoClasses, variants };
27
+ export { CONTROL_BYPASS_PSEUDO_CLASS, partClasses, variantBreakpoints, variantColorsClass, variantColorsMedia, variantCombinators, variantImportant, variantNegative, variantPseudoClassFunctions, variantPseudoClasses, variantPseudoElements, variantSpace, variantTaggedPseudoClasses, variants };
package/dist/variants.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  export { a as variantBreakpoints, c as variantColorsClass, d as variantColorsMedia, b as variantCombinators, e as variantImportant, f as variantNegative, g as variantSpace, v as variants } from './chunks/default3.mjs';
2
- export { C as CONTROL_BYPASS_PSEUDO_CLASS, P as PseudoClasses, p as partClasses, v as variantPseudoClasses, b as variantPseudoElements, a as variantTaggedPseudoClasses } from './chunks/pseudo.mjs';
2
+ export { C as CONTROL_BYPASS_PSEUDO_CLASS, p as partClasses, a as variantPseudoClassFunctions, v as variantPseudoClasses, c as variantPseudoElements, b as variantTaggedPseudoClasses } from './chunks/pseudo.mjs';
3
3
  import './chunks/variants.mjs';
4
4
  import '@unocss/core';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-mini",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
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.18.0"
64
+ "@unocss/core": "0.18.1"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",