@unocss/preset-mini 0.15.3 → 0.16.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.
@@ -1,3 +1,5 @@
1
+ import { createValueHandler } from '@unocss/core';
2
+
1
3
  const directionMap = {
2
4
  "l": ["-left"],
3
5
  "r": ["-right"],
@@ -34,9 +36,12 @@ const xyzMap = {
34
36
 
35
37
  const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
36
38
  const numberRE = /^(-?[0-9.]+)$/i;
39
+ const unitOnlyRE = /^(px)$/i;
37
40
  function rem(str) {
38
41
  if (str === "auto" || str === "a")
39
42
  return "auto";
43
+ if (str.match(unitOnlyRE))
44
+ return `1${str}`;
40
45
  const match = str.match(numberWithUnitRE);
41
46
  if (!match)
42
47
  return;
@@ -48,6 +53,8 @@ function rem(str) {
48
53
  return `${num / 4}rem`;
49
54
  }
50
55
  function px(str) {
56
+ if (str.match(unitOnlyRE))
57
+ return `1${str}`;
51
58
  const match = str.match(numberWithUnitRE);
52
59
  if (!match)
53
60
  return;
@@ -104,7 +111,7 @@ function global(str) {
104
111
  return str;
105
112
  }
106
113
 
107
- const handlers = {
114
+ const valueHandlers = {
108
115
  __proto__: null,
109
116
  rem: rem,
110
117
  px: px,
@@ -117,37 +124,11 @@ const handlers = {
117
124
  global: global
118
125
  };
119
126
 
120
- const handlersNames = Object.keys(handlers);
121
- const handler = function(str) {
122
- const s = this.__options?.sequence || [];
123
- this.__options.sequence = [];
124
- for (const n of s) {
125
- const res = handlers[n](str);
126
- if (res != null)
127
- return res;
128
- }
129
- return void 0;
130
- };
131
- function addProcessor(that, name) {
132
- if (!that.__options) {
133
- that.__options = {
134
- sequence: []
135
- };
136
- }
137
- that.__options.sequence.push(name);
138
- return that;
139
- }
140
- handlersNames.forEach((i) => {
141
- Object.defineProperty(handler, i, {
142
- enumerable: true,
143
- get() {
144
- return addProcessor(this, i);
145
- }
146
- });
147
- });
127
+ const handler = createValueHandler(valueHandlers);
128
+ const h = handler;
148
129
 
149
130
  function capitalize(str) {
150
131
  return str.charAt(0).toUpperCase() + str.slice(1);
151
132
  }
152
133
 
153
- export { capitalize as a, percent as b, cornerMap as c, directionMap as d, bracket as e, fraction as f, cssvar as g, handler as h, global as i, handlersNames as j, number as n, px as p, rem as r, time as t, xyzMap as x };
134
+ export { capitalize as a, h as b, cornerMap as c, directionMap as d, handler as h, valueHandlers as v, xyzMap as x };
package/dist/rules.cjs CHANGED
@@ -9,17 +9,12 @@ require('./chunks/pseudo.cjs');
9
9
 
10
10
 
11
11
 
12
- exports.alignContents = _default.alignContents;
13
- exports.alignItems = _default.alignItems;
14
- exports.alignSelfs = _default.alignSelfs;
12
+ exports.alignments = _default.alignments;
15
13
  exports.appearance = _default.appearance;
16
14
  exports.appearances = _default.appearances;
17
15
  exports.aspectRatio = _default.aspectRatio;
18
16
  exports.bgColors = _default.bgColors;
19
17
  exports.borderColors = _default.borderColors;
20
- exports.borderRadius = _default.borderRadius;
21
- exports.borderSizes = _default.borderSizes;
22
- exports.borderStyles = _default.borderStyles;
23
18
  exports.borders = _default.borders;
24
19
  exports.boxShadows = _default.boxShadows;
25
20
  exports.boxSizing = _default.boxSizing;
@@ -32,19 +27,13 @@ exports.displays = _default.displays;
32
27
  exports.fillColors = _default.fillColors;
33
28
  exports.flex = _default.flex;
34
29
  exports.floats = _default.floats;
35
- exports.fontSizes = _default.fontSizes;
36
30
  exports.fontSmoothings = _default.fontSmoothings;
37
31
  exports.fontStyles = _default.fontStyles;
38
- exports.fontWeights = _default.fontWeights;
39
32
  exports.fonts = _default.fonts;
40
- exports.fontsFamilies = _default.fontsFamilies;
41
33
  exports.gaps = _default.gaps;
42
34
  exports.grids = _default.grids;
43
35
  exports.insets = _default.insets;
44
36
  exports.justifies = _default.justifies;
45
- exports.justifyItems = _default.justifyItems;
46
- exports.justifySelfs = _default.justifySelfs;
47
- exports.leadings = _default.leadings;
48
37
  exports.margins = _default.margins;
49
38
  exports.opacity = _default.opacity;
50
39
  exports.orders = _default.orders;
@@ -52,10 +41,8 @@ exports.outline = _default.outline;
52
41
  exports.overflows = _default.overflows;
53
42
  exports.paddings = _default.paddings;
54
43
  exports.parseColorUtil = _default.parseColorUtil;
55
- exports.placeContents = _default.placeContents;
56
- exports.placeItems = _default.placeItems;
57
- exports.placeSelfs = _default.placeSelfs;
58
44
  exports.placeholder = _default.placeholder;
45
+ exports.placements = _default.placements;
59
46
  exports.pointerEvents = _default.pointerEvents;
60
47
  exports.positions = _default.positions;
61
48
  exports.questionMark = _default.questionMark;
@@ -68,23 +55,16 @@ exports.sizes = _default.sizes;
68
55
  exports.tabSizes = _default.tabSizes;
69
56
  exports.textAligns = _default.textAligns;
70
57
  exports.textColors = _default.textColors;
71
- exports.textDecorationColors = _default.textDecorationColors;
72
- exports.textDecorationLengths = _default.textDecorationLengths;
73
- exports.textDecorationOffsets = _default.textDecorationOffsets;
74
- exports.textDecorationStyles = _default.textDecorationStyles;
75
58
  exports.textDecorations = _default.textDecorations;
76
59
  exports.textIndents = _default.textIndents;
77
60
  exports.textOverflows = _default.textOverflows;
78
61
  exports.textShadows = _default.textShadows;
79
- exports.textStrokeColors = _default.textStrokeColors;
80
- exports.textStrokeWidths = _default.textStrokeWidths;
62
+ exports.textStrokes = _default.textStrokes;
81
63
  exports.textTransforms = _default.textTransforms;
82
- exports.trackings = _default.trackings;
83
64
  exports.transforms = _default.transforms;
84
65
  exports.transitions = _default.transitions;
85
66
  exports.userSelects = _default.userSelects;
86
67
  exports.varEmpty = _default.varEmpty;
87
68
  exports.verticalAligns = _default.verticalAligns;
88
69
  exports.whitespaces = _default.whitespaces;
89
- exports.wordSpacings = _default.wordSpacings;
90
70
  exports.zIndexes = _default.zIndexes;
package/dist/rules.d.ts CHANGED
@@ -8,10 +8,7 @@ declare const outline: Rule[];
8
8
  declare const appearance: Rule[];
9
9
  declare const placeholder: Rule[];
10
10
 
11
- declare const borderSizes: Rule[];
12
- declare const borderRadius: Rule[];
13
- declare const borderStyles: Rule[];
14
- declare const borders: Rule<{}>[];
11
+ declare const borders: Rule[];
15
12
 
16
13
  declare const parseColorUtil: (body: string, theme: Theme) => {
17
14
  opacity: string;
@@ -31,8 +28,6 @@ declare const opacity: Rule[];
31
28
  * @example c-red color-red5 text-red-300
32
29
  */
33
30
  declare const textColors: Rule[];
34
- declare const textDecorationColors: Rule[];
35
- declare const textStrokeColors: Rule[];
36
31
  declare const bgColors: Rule[];
37
32
  declare const borderColors: Rule[];
38
33
  declare const ringColors: Rule[];
@@ -52,14 +47,8 @@ declare const overflows: Rule[];
52
47
  declare const positions: Rule[];
53
48
  declare const justifies: Rule[];
54
49
  declare const orders: Rule[];
55
- declare const justifyItems: Rule[];
56
- declare const justifySelfs: Rule[];
57
- declare const alignContents: Rule[];
58
- declare const alignItems: Rule[];
59
- declare const alignSelfs: Rule[];
60
- declare const placeContents: Rule[];
61
- declare const placeItems: Rule[];
62
- declare const placeSelfs: Rule[];
50
+ declare const alignments: Rule[];
51
+ declare const placements: Rule[];
63
52
  declare const insets: Rule[];
64
53
  declare const floats: Rule[];
65
54
  declare const zIndexes: Rule[];
@@ -94,8 +83,6 @@ declare const contents: Rule[];
94
83
  declare const breaks: Rule[];
95
84
  declare const textOverflows: Rule[];
96
85
  declare const textTransforms: Rule[];
97
- declare const textDecorations: Rule[];
98
- declare const textDecorationStyles: Rule[];
99
86
  declare const fontStyles: Rule[];
100
87
  declare const fontSmoothings: Rule[];
101
88
 
@@ -103,20 +90,14 @@ declare const transforms: Rule[];
103
90
 
104
91
  declare const transitions: Rule[];
105
92
 
106
- declare const fontsFamilies: Rule<Theme>[];
107
- declare const fontSizes: Rule<Theme>[];
108
- declare const fontWeights: Rule[];
109
- declare const leadings: Rule<Theme>[];
110
- declare const trackings: Rule<Theme>[];
111
- declare const wordSpacings: Rule<Theme>[];
93
+ declare const fonts: Rule<Theme>[];
112
94
  declare const tabSizes: Rule<Theme>[];
113
- declare const textDecorationLengths: Rule<Theme>[];
114
- declare const textDecorationOffsets: Rule<Theme>[];
115
95
  declare const textIndents: Rule<Theme>[];
116
- declare const textStrokeWidths: Rule<Theme>[];
96
+ declare const textStrokes: Rule<Theme>[];
117
97
  declare const textShadows: Rule<Theme>[];
118
- declare const fonts: Rule<Theme>[];
119
98
 
120
99
  declare const cssVariables: Rule[];
121
100
 
122
- export { alignContents, alignItems, alignSelfs, appearance, appearances, aspectRatio, bgColors, borderColors, borderRadius, borderSizes, borderStyles, borders, boxShadows, boxSizing, breaks, colorResolver, contents, cssVariables, cursors, displays, fillColors, flex, floats, fontSizes, fontSmoothings, fontStyles, fontWeights, fonts, fontsFamilies, gaps, grids, insets, justifies, justifyItems, justifySelfs, leadings, margins, opacity, orders, outline, overflows, paddings, parseColorUtil, placeContents, placeItems, placeSelfs, placeholder, pointerEvents, positions, questionMark, resizes, ringColors, ringOffsetColors, rings, rules, sizes, tabSizes, textAligns, textColors, textDecorationColors, textDecorationLengths, textDecorationOffsets, textDecorationStyles, textDecorations, textIndents, textOverflows, textShadows, textStrokeColors, textStrokeWidths, textTransforms, trackings, transforms, transitions, userSelects, varEmpty, verticalAligns, whitespaces, wordSpacings, zIndexes };
101
+ declare const textDecorations: Rule[];
102
+
103
+ export { alignments, appearance, appearances, aspectRatio, bgColors, borderColors, borders, boxShadows, boxSizing, breaks, colorResolver, contents, cssVariables, cursors, displays, fillColors, flex, floats, fontSmoothings, fontStyles, fonts, gaps, grids, insets, justifies, margins, opacity, orders, outline, overflows, paddings, parseColorUtil, placeholder, placements, pointerEvents, positions, questionMark, resizes, ringColors, ringOffsetColors, rings, rules, sizes, tabSizes, textAligns, textColors, textDecorations, textIndents, textOverflows, textShadows, textStrokes, textTransforms, transforms, transitions, userSelects, varEmpty, verticalAligns, whitespaces, zIndexes };
package/dist/rules.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { E as alignContents, F as alignItems, G as alignSelfs, a as appearance, X as appearances, S as aspectRatio, l as bgColors, m as borderColors, c as borderRadius, b as borderSizes, d as borderStyles, e as borders, Q as boxShadows, N as boxSizing, a2 as breaks, g as colorResolver, a1 as contents, ao as cssVariables, Y as cursors, W as displays, s as fillColors, u as flex, L as floats, ac as fontSizes, a8 as fontSmoothings, a7 as fontStyles, ad as fontWeights, an as fonts, ab as fontsFamilies, w as gaps, x as grids, K as insets, A as justifies, C as justifyItems, D as justifySelfs, ae as leadings, U as margins, h as opacity, B as orders, o as outline, y as overflows, T as paddings, f as parseColorUtil, H as placeContents, I as placeItems, J as placeSelfs, p as placeholder, Z as pointerEvents, z as positions, O as questionMark, _ as resizes, n as ringColors, q as ringOffsetColors, P as rings, r as rules, R as sizes, ah as tabSizes, t as textAligns, i as textColors, j as textDecorationColors, ai as textDecorationLengths, aj as textDecorationOffsets, a6 as textDecorationStyles, a5 as textDecorations, ak as textIndents, a3 as textOverflows, am as textShadows, k as textStrokeColors, al as textStrokeWidths, a4 as textTransforms, af as trackings, a9 as transforms, aa as transitions, $ as userSelects, V as varEmpty, v as verticalAligns, a0 as whitespaces, ag as wordSpacings, M as zIndexes } from './chunks/default2.mjs';
1
+ export { x as alignments, a as appearance, M as appearances, H as aspectRatio, g as bgColors, h as borderColors, b as borders, F as boxShadows, C as boxSizing, T as breaks, d as colorResolver, S as contents, a3 as cssVariables, N as cursors, L as displays, k as fillColors, l as flex, A as floats, X as fontSmoothings, W as fontStyles, _ as fonts, m as gaps, n as grids, z as insets, u as justifies, J as margins, e as opacity, w as orders, o as outline, q as overflows, I as paddings, c as parseColorUtil, p as placeholder, y as placements, O as pointerEvents, s as positions, D as questionMark, P as resizes, i as ringColors, j as ringOffsetColors, E as rings, r as rules, G as sizes, $ as tabSizes, t as textAligns, f as textColors, a4 as textDecorations, a0 as textIndents, U as textOverflows, a2 as textShadows, a1 as textStrokes, V as textTransforms, Y as transforms, Z as transitions, Q as userSelects, K as varEmpty, v as verticalAligns, R as whitespaces, B as zIndexes } from './chunks/default2.mjs';
2
2
  import '@unocss/core';
3
3
  import './chunks/index.mjs';
4
4
  import './chunks/pseudo.mjs';
package/dist/utils.cjs CHANGED
@@ -4,22 +4,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./chunks/index.cjs');
6
6
  const variants = require('./chunks/variants.cjs');
7
+ require('@unocss/core');
7
8
 
8
9
 
9
10
 
10
- exports.bracket = index.bracket;
11
11
  exports.capitalize = index.capitalize;
12
12
  exports.cornerMap = index.cornerMap;
13
- exports.cssvar = index.cssvar;
14
13
  exports.directionMap = index.directionMap;
15
- exports.fraction = index.fraction;
16
- exports.global = index.global;
14
+ exports.h = index.h;
17
15
  exports.handler = index.handler;
18
- exports.handlersNames = index.handlersNames;
19
- exports.number = index.number;
20
- exports.percent = index.percent;
21
- exports.px = index.px;
22
- exports.rem = index.rem;
23
- exports.time = index.time;
16
+ exports.valueHandlers = index.valueHandlers;
24
17
  exports.xyzMap = index.xyzMap;
25
18
  exports.variantMatcher = variants.variantMatcher;
package/dist/utils.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as _unocss_core from '@unocss/core';
1
2
  import { VariantHandler } from '@unocss/core';
2
3
 
3
4
  declare const directionMap: Record<string, string[]>;
@@ -37,20 +38,11 @@ declare namespace handlers {
37
38
  };
38
39
  }
39
40
 
40
- declare type HandlerName = keyof typeof handlers;
41
- declare const handlersNames: ("number" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global")[];
42
- declare type Handler = {
43
- [K in HandlerName]: Handler;
44
- } & {
45
- (str: string): string | undefined;
46
- __options: {
47
- sequence: HandlerName[];
48
- };
49
- };
50
- declare const handler: Handler;
41
+ declare const handler: _unocss_core.ValueHandler<"number" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global">;
42
+ declare const h: _unocss_core.ValueHandler<"number" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global">;
51
43
 
52
44
  declare const variantMatcher: (name: string, selector?: ((input: string) => string | undefined) | undefined) => (input: string) => VariantHandler | undefined;
53
45
 
54
46
  declare function capitalize<T extends string>(str: T): Capitalize<T>;
55
47
 
56
- export { Handler, HandlerName, bracket, capitalize, cornerMap, cssvar, directionMap, fraction, global, handler, handlersNames, number, percent, px, rem, time, variantMatcher, xyzMap };
48
+ export { capitalize, cornerMap, directionMap, h, handler, handlers as valueHandlers, variantMatcher, xyzMap };
package/dist/utils.mjs CHANGED
@@ -1,2 +1,3 @@
1
- export { e as bracket, a as capitalize, c as cornerMap, g as cssvar, d as directionMap, f as fraction, i as global, h as handler, j as handlersNames, n as number, b as percent, p as px, r as rem, t as time, x as xyzMap } from './chunks/index.mjs';
1
+ export { a as capitalize, c as cornerMap, d as directionMap, b as h, h as handler, v as valueHandlers, x as xyzMap } from './chunks/index.mjs';
2
2
  export { v as variantMatcher } from './chunks/variants.mjs';
3
+ import '@unocss/core';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-mini",
3
- "version": "0.15.3",
3
+ "version": "0.16.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.15.3"
64
+ "@unocss/core": "0.16.0"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",