@unocss/preset-mini 0.36.0 → 0.37.2

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.
package/dist/rules.cjs CHANGED
@@ -4,30 +4,21 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const _default = require('./chunks/default2.cjs');
6
6
  const transform = require('./chunks/transform.cjs');
7
- require('./chunks/index.cjs');
8
- require('@unocss/core');
9
7
  require('./chunks/utilities.cjs');
8
+ require('@unocss/core');
10
9
 
11
10
 
12
11
 
13
12
  exports.alignments = _default.alignments;
14
13
  exports.appearance = _default.appearance;
15
- exports.appearances = _default.appearances;
16
14
  exports.aspectRatio = _default.aspectRatio;
17
15
  exports.bgColors = _default.bgColors;
18
16
  exports.borders = _default.borders;
19
- exports.boxShadows = _default.boxShadows;
20
17
  exports.boxSizing = _default.boxSizing;
21
- exports.breaks = _default.breaks;
22
- exports.contents = _default.contents;
23
18
  exports.cssProperty = _default.cssProperty;
24
19
  exports.cssVariables = _default.cssVariables;
25
- exports.cursors = _default.cursors;
26
- exports.displays = _default.displays;
27
20
  exports.flex = _default.flex;
28
21
  exports.floats = _default.floats;
29
- exports.fontSmoothings = _default.fontSmoothings;
30
- exports.fontStyles = _default.fontStyles;
31
22
  exports.fonts = _default.fonts;
32
23
  exports.gaps = _default.gaps;
33
24
  exports.grids = _default.grids;
@@ -40,11 +31,8 @@ exports.outline = _default.outline;
40
31
  exports.overflows = _default.overflows;
41
32
  exports.paddings = _default.paddings;
42
33
  exports.placements = _default.placements;
43
- exports.pointerEvents = _default.pointerEvents;
44
34
  exports.positions = _default.positions;
45
35
  exports.questionMark = _default.questionMark;
46
- exports.resizes = _default.resizes;
47
- exports.rings = _default.rings;
48
36
  exports.rules = _default.rules;
49
37
  exports.sizes = _default.sizes;
50
38
  exports.svgUtilities = _default.svgUtilities;
@@ -53,16 +41,29 @@ exports.textAligns = _default.textAligns;
53
41
  exports.textColors = _default.textColors;
54
42
  exports.textDecorations = _default.textDecorations;
55
43
  exports.textIndents = _default.textIndents;
56
- exports.textOverflows = _default.textOverflows;
57
44
  exports.textShadows = _default.textShadows;
58
45
  exports.textStrokes = _default.textStrokes;
59
- exports.textTransforms = _default.textTransforms;
60
46
  exports.transitions = _default.transitions;
61
- exports.userSelects = _default.userSelects;
62
- exports.varEmpty = _default.varEmpty;
63
47
  exports.verticalAligns = _default.verticalAligns;
64
- exports.whitespaces = _default.whitespaces;
65
48
  exports.willChange = _default.willChange;
66
49
  exports.zIndexes = _default.zIndexes;
50
+ exports.appearances = transform.appearances;
51
+ exports.boxShadows = transform.boxShadows;
52
+ exports.boxShadowsBase = transform.boxShadowsBase;
53
+ exports.breaks = transform.breaks;
54
+ exports.contents = transform.contents;
55
+ exports.cursors = transform.cursors;
56
+ exports.displays = transform.displays;
57
+ exports.fontSmoothings = transform.fontSmoothings;
58
+ exports.fontStyles = transform.fontStyles;
59
+ exports.pointerEvents = transform.pointerEvents;
60
+ exports.resizes = transform.resizes;
61
+ exports.ringBase = transform.ringBase;
62
+ exports.rings = transform.rings;
63
+ exports.textOverflows = transform.textOverflows;
64
+ exports.textTransforms = transform.textTransforms;
67
65
  exports.transformBase = transform.transformBase;
68
66
  exports.transforms = transform.transforms;
67
+ exports.userSelects = transform.userSelects;
68
+ exports.varEmpty = transform.varEmpty;
69
+ exports.whitespaces = transform.whitespaces;
package/dist/rules.d.ts CHANGED
@@ -47,8 +47,22 @@ declare const boxSizing: Rule[];
47
47
  */
48
48
  declare const questionMark: Rule[];
49
49
 
50
+ declare const ringBase: {
51
+ '--un-ring-inset': string;
52
+ '--un-ring-offset-width': string;
53
+ '--un-ring-offset-color': string;
54
+ '--un-ring-width': string;
55
+ '--un-ring-color': string;
56
+ '--un-shadow': string;
57
+ };
50
58
  declare const rings: Rule<Theme>[];
51
59
 
60
+ declare const boxShadowsBase: {
61
+ '--un-ring-offset-shadow': string;
62
+ '--un-ring-shadow': string;
63
+ '--un-shadow-inset': string;
64
+ '--un-shadow': string;
65
+ };
52
66
  declare const boxShadows: Rule<Theme>[];
53
67
 
54
68
  declare const sizes: Rule<Theme>[];
@@ -104,4 +118,4 @@ declare const cssProperty: Rule[];
104
118
 
105
119
  declare const textDecorations: Rule<Theme>[];
106
120
 
107
- export { alignments, appearance, appearances, aspectRatio, bgColors, borders, boxShadows, boxSizing, breaks, contents, cssProperty, cssVariables, cursors, displays, flex, floats, fontSmoothings, fontStyles, fonts, gaps, grids, insets, justifies, margins, opacity, orders, outline, overflows, paddings, placements, pointerEvents, positions, questionMark, resizes, rings, rules, sizes, svgUtilities, tabSizes, textAligns, textColors, textDecorations, textIndents, textOverflows, textShadows, textStrokes, textTransforms, transformBase, transforms, transitions, userSelects, varEmpty, verticalAligns, whitespaces, willChange, zIndexes };
121
+ export { alignments, appearance, appearances, aspectRatio, bgColors, borders, boxShadows, boxShadowsBase, boxSizing, breaks, contents, cssProperty, cssVariables, cursors, displays, flex, floats, fontSmoothings, fontStyles, fonts, gaps, grids, insets, justifies, margins, opacity, orders, outline, overflows, paddings, placements, pointerEvents, positions, questionMark, resizes, ringBase, rings, rules, sizes, svgUtilities, tabSizes, textAligns, textColors, textDecorations, textIndents, textOverflows, textShadows, textStrokes, textTransforms, transformBase, transforms, transitions, userSelects, varEmpty, verticalAligns, whitespaces, willChange, zIndexes };
package/dist/rules.mjs CHANGED
@@ -1,5 +1,4 @@
1
- export { l as alignments, a as appearance, G as appearances, B as aspectRatio, e as bgColors, b as borders, y as boxShadows, s as boxSizing, N as breaks, M as contents, _ as cssProperty, Z as cssVariables, H as cursors, F as displays, f as flex, q as floats, R as fontSmoothings, Q as fontStyles, U as fonts, g as gaps, h as grids, n as insets, j as justifies, D as margins, c as opacity, k as orders, o as outline, i as overflows, C as paddings, m as placements, I as pointerEvents, p as positions, u as questionMark, J as resizes, x as rings, r as rules, A as sizes, S as svgUtilities, V as tabSizes, t as textAligns, d as textColors, $ as textDecorations, W as textIndents, O as textOverflows, Y as textShadows, X as textStrokes, P as textTransforms, T as transitions, K as userSelects, E as varEmpty, v as verticalAligns, L as whitespaces, w as willChange, z as zIndexes } from './chunks/default2.mjs';
2
- export { t as transformBase, a as transforms } from './chunks/transform.mjs';
3
- import './chunks/index.mjs';
4
- import '@unocss/core';
1
+ export { l as alignments, a as appearance, y as aspectRatio, e as bgColors, b as borders, s as boxSizing, K as cssProperty, J as cssVariables, f as flex, q as floats, E as fonts, g as gaps, h as grids, n as insets, j as justifies, B as margins, c as opacity, k as orders, o as outline, i as overflows, A as paddings, m as placements, p as positions, u as questionMark, r as rules, x as sizes, C as svgUtilities, F as tabSizes, t as textAligns, d as textColors, L as textDecorations, G as textIndents, I as textShadows, H as textStrokes, D as transitions, v as verticalAligns, w as willChange, z as zIndexes } from './chunks/default2.mjs';
2
+ export { k as appearances, h as boxShadows, b as boxShadowsBase, m as breaks, c as contents, j as cursors, d as displays, g as fontSmoothings, f as fontStyles, p as pointerEvents, l as resizes, r as ringBase, i as rings, a as textOverflows, e as textTransforms, t as transformBase, n as transforms, u as userSelects, v as varEmpty, w as whitespaces } from './chunks/transform.mjs';
5
3
  import './chunks/utilities.mjs';
4
+ import '@unocss/core';
package/dist/theme.cjs CHANGED
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const colors = require('./chunks/colors.cjs');
6
6
  const _default = require('./chunks/default.cjs');
7
7
  require('./chunks/transform.cjs');
8
- require('./chunks/index.cjs');
8
+ require('./chunks/utilities.cjs');
9
9
  require('@unocss/core');
10
10
 
11
11
 
package/dist/theme.d.ts CHANGED
@@ -195,6 +195,15 @@ declare const maxHeight: {
195
195
  };
196
196
 
197
197
  declare const preflightBase: {
198
+ '--un-ring-inset': string;
199
+ '--un-ring-offset-width': string;
200
+ '--un-ring-offset-color': string;
201
+ '--un-ring-width': string;
202
+ '--un-ring-color': string;
203
+ '--un-shadow': string;
204
+ '--un-ring-offset-shadow': string;
205
+ '--un-ring-shadow': string;
206
+ '--un-shadow-inset': string;
198
207
  '--un-rotate': number;
199
208
  '--un-rotate-x': number;
200
209
  '--un-rotate-y': number;
package/dist/theme.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  export { c as colors } from './chunks/colors.mjs';
2
2
  export { p as baseSize, b as blur, m as borderRadius, n as boxShadow, i as breakpoints, d as dropShadow, k as duration, o as easing, f as fontFamily, a as fontSize, x as height, h as letterSpacing, l as lineHeight, j as lineWidth, y as maxHeight, u as maxWidth, z as preflightBase, r as ringWidth, s as spacing, c as textIndent, g as textShadow, e as textStrokeWidth, t as theme, v as verticalBreakpoints, q as width, w as wordSpacing } from './chunks/default.mjs';
3
3
  import './chunks/transform.mjs';
4
- import './chunks/index.mjs';
4
+ import './chunks/utilities.mjs';
5
5
  import '@unocss/core';
package/dist/utils.cjs CHANGED
@@ -3,7 +3,6 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const utilities = require('./chunks/utilities.cjs');
6
- const index = require('./chunks/index.cjs');
7
6
  const variants = require('./chunks/variants.cjs');
8
7
  require('@unocss/core');
9
8
 
@@ -13,22 +12,22 @@ exports.CONTROL_MINI_NO_NEGATIVE = utilities.CONTROL_MINI_NO_NEGATIVE;
13
12
  exports.colorResolver = utilities.colorResolver;
14
13
  exports.colorToString = utilities.colorToString;
15
14
  exports.colorableShadows = utilities.colorableShadows;
15
+ exports.cornerMap = utilities.cornerMap;
16
+ exports.directionMap = utilities.directionMap;
16
17
  exports.directionSize = utilities.directionSize;
17
18
  exports.getComponents = utilities.getComponents;
19
+ exports.globalKeywords = utilities.globalKeywords;
20
+ exports.h = utilities.h;
21
+ exports.handler = utilities.handler;
18
22
  exports.hasParseableColor = utilities.hasParseableColor;
19
23
  exports.hex2rgba = utilities.hex2rgba;
24
+ exports.insetMap = utilities.insetMap;
20
25
  exports.parseColor = utilities.parseColor;
21
26
  exports.parseCssColor = utilities.parseCssColor;
27
+ exports.positionMap = utilities.positionMap;
22
28
  exports.resolveBreakpoints = utilities.resolveBreakpoints;
23
29
  exports.resolveVerticalBreakpoints = utilities.resolveVerticalBreakpoints;
24
- exports.cornerMap = index.cornerMap;
25
- exports.directionMap = index.directionMap;
26
- exports.globalKeywords = index.globalKeywords;
27
- exports.h = index.h;
28
- exports.handler = index.handler;
29
- exports.insetMap = index.insetMap;
30
- exports.positionMap = index.positionMap;
31
- exports.valueHandlers = index.valueHandlers;
32
- exports.xyzMap = index.xyzMap;
30
+ exports.valueHandlers = utilities.valueHandlers;
31
+ exports.xyzMap = utilities.xyzMap;
33
32
  exports.variantMatcher = variants.variantMatcher;
34
33
  exports.variantParentMatcher = variants.variantParentMatcher;
package/dist/utils.mjs CHANGED
@@ -1,4 +1,3 @@
1
- export { C as CONTROL_MINI_NO_NEGATIVE, c as colorResolver, a as colorToString, b as colorableShadows, e as directionSize, i as getComponents, h as hasParseableColor, f as hex2rgba, p as parseColor, g as parseCssColor, d as resolveBreakpoints, r as resolveVerticalBreakpoints } from './chunks/utilities.mjs';
2
- export { c as cornerMap, d as directionMap, g as globalKeywords, a as h, h as handler, i as insetMap, p as positionMap, v as valueHandlers, x as xyzMap } from './chunks/index.mjs';
1
+ export { C as CONTROL_MINI_NO_NEGATIVE, c as colorResolver, b as colorToString, f as colorableShadows, e as cornerMap, d as directionMap, k as directionSize, o as getComponents, g as globalKeywords, q as h, h as handler, a as hasParseableColor, m as hex2rgba, i as insetMap, p as parseColor, n as parseCssColor, l as positionMap, j as resolveBreakpoints, r as resolveVerticalBreakpoints, v as valueHandlers, x as xyzMap } from './chunks/utilities.mjs';
3
2
  export { a as variantMatcher, v as variantParentMatcher } from './chunks/variants.mjs';
4
3
  import '@unocss/core';
package/dist/variants.cjs CHANGED
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const _default = require('./chunks/default3.cjs');
6
6
  require('./chunks/utilities.cjs');
7
7
  require('@unocss/core');
8
- require('./chunks/index.cjs');
9
8
  require('./chunks/variants.cjs');
10
9
 
11
10
 
package/dist/variants.mjs CHANGED
@@ -1,5 +1,4 @@
1
1
  export { p as partClasses, a as variantBreakpoints, e as variantColorsMediaOrClass, b as variantCombinators, h as variantCssLayer, d as variantCustomMedia, k as variantImportant, i as variantInternalLayer, f as variantLanguageDirections, l as variantNegative, c as variantPrint, n as variantPseudoClassFunctions, m as variantPseudoClassesAndElements, j as variantScope, g as variantSelector, o as variantTaggedPseudoClasses, v as variants } from './chunks/default3.mjs';
2
2
  import './chunks/utilities.mjs';
3
3
  import '@unocss/core';
4
- import './chunks/index.mjs';
5
4
  import './chunks/variants.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-mini",
3
- "version": "0.36.0",
3
+ "version": "0.37.2",
4
4
  "description": "The minimal preset for UnoCSS",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -61,7 +61,7 @@
61
61
  "*.css"
62
62
  ],
63
63
  "dependencies": {
64
- "@unocss/core": "0.36.0"
64
+ "@unocss/core": "0.37.2"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",
@@ -1,310 +0,0 @@
1
- 'use strict';
2
-
3
- const core = require('@unocss/core');
4
-
5
- const directionMap = {
6
- "l": ["-left"],
7
- "r": ["-right"],
8
- "t": ["-top"],
9
- "b": ["-bottom"],
10
- "s": ["-inline-start"],
11
- "e": ["-inline-end"],
12
- "x": ["-left", "-right"],
13
- "y": ["-top", "-bottom"],
14
- "": [""],
15
- "bs": ["-block-start"],
16
- "be": ["-block-end"],
17
- "is": ["-inline-start"],
18
- "ie": ["-inline-end"],
19
- "block": ["-block-start", "-block-end"],
20
- "inline": ["-inline-start", "-inline-end"]
21
- };
22
- const insetMap = {
23
- ...directionMap,
24
- s: ["-inset-inline-start"],
25
- e: ["-inset-inline-end"],
26
- bs: ["-inset-block-start"],
27
- be: ["-inset-block-end"],
28
- is: ["-inset-inline-start"],
29
- ie: ["-inset-inline-end"],
30
- block: ["-inset-block-start", "-inset-block-end"],
31
- inline: ["-inset-inline-start", "-inset-inline-end"]
32
- };
33
- const cornerMap = {
34
- "l": ["-top-left", "-bottom-left"],
35
- "r": ["-top-right", "-bottom-right"],
36
- "t": ["-top-left", "-top-right"],
37
- "b": ["-bottom-left", "-bottom-right"],
38
- "tl": ["-top-left"],
39
- "lt": ["-top-left"],
40
- "tr": ["-top-right"],
41
- "rt": ["-top-right"],
42
- "bl": ["-bottom-left"],
43
- "lb": ["-bottom-left"],
44
- "br": ["-bottom-right"],
45
- "rb": ["-bottom-right"],
46
- "": [""],
47
- "bs": ["-start-start", "-start-end"],
48
- "be": ["-end-start", "-end-end"],
49
- "is": ["-end-start", "-start-start"],
50
- "ie": ["-start-end", "-end-end"],
51
- "bs-is": ["-start-start"],
52
- "is-bs": ["-start-start"],
53
- "bs-ie": ["-start-end"],
54
- "ie-bs": ["-start-end"],
55
- "be-is": ["-end-start"],
56
- "is-be": ["-end-start"],
57
- "be-ie": ["-end-end"],
58
- "ie-be": ["-end-end"]
59
- };
60
- const xyzMap = {
61
- "x": ["-x"],
62
- "y": ["-y"],
63
- "z": ["-z"],
64
- "": ["-x", "-y"]
65
- };
66
- const basePositionMap = [
67
- "top",
68
- "top center",
69
- "top left",
70
- "top right",
71
- "bottom",
72
- "bottom center",
73
- "bottom left",
74
- "bottom right",
75
- "left",
76
- "left center",
77
- "left top",
78
- "left bottom",
79
- "right",
80
- "right center",
81
- "right top",
82
- "right bottom",
83
- "center",
84
- "center top",
85
- "center bottom",
86
- "center left",
87
- "center right",
88
- "center center"
89
- ];
90
- const positionMap = Object.assign({}, ...basePositionMap.map((p) => ({ [p.replace(/ /, "-")]: p })), ...basePositionMap.map((p) => ({ [p.replace(/\b(\w)\w+/g, "$1").replace(/ /, "")]: p })));
91
- const globalKeywords = [
92
- "inherit",
93
- "initial",
94
- "revert",
95
- "revert-layer",
96
- "unset"
97
- ];
98
-
99
- const cssProps = [
100
- "color",
101
- "border-color",
102
- "background-color",
103
- "flex-grow",
104
- "flex",
105
- "flex-shrink",
106
- "caret-color",
107
- "font",
108
- "gap",
109
- "opacity",
110
- "visibility",
111
- "z-index",
112
- "font-weight",
113
- "zoom",
114
- "text-shadow",
115
- "transform",
116
- "box-shadow",
117
- "backround-position",
118
- "left",
119
- "right",
120
- "top",
121
- "bottom",
122
- "object-position",
123
- "max-height",
124
- "min-height",
125
- "max-width",
126
- "min-width",
127
- "height",
128
- "width",
129
- "border-width",
130
- "margin",
131
- "padding",
132
- "outline-width",
133
- "outline-offset",
134
- "font-size",
135
- "line-height",
136
- "text-indent",
137
- "vertical-align",
138
- "border-spacing",
139
- "letter-spacing",
140
- "word-spacing",
141
- "stroke",
142
- "filter",
143
- "backdrop-filter",
144
- "fill",
145
- "mask",
146
- "mask-size",
147
- "mask-border",
148
- "clip-path",
149
- "clip",
150
- "border-radius"
151
- ];
152
- const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax|rpx)?$/i;
153
- const numberRE = /^(-?[0-9.]+)$/i;
154
- const unitOnlyRE = /^(px)$/i;
155
- function round(n) {
156
- return n.toFixed(10).replace(/\.0+$/, "").replace(/(\.\d+?)0+$/, "$1");
157
- }
158
- function numberWithUnit(str) {
159
- const match = str.match(numberWithUnitRE);
160
- if (!match)
161
- return;
162
- const [, n, unit] = match;
163
- const num = parseFloat(n);
164
- if (unit && !Number.isNaN(num))
165
- return `${round(num)}${unit}`;
166
- }
167
- function auto(str) {
168
- if (str === "auto" || str === "a")
169
- return "auto";
170
- }
171
- function rem(str) {
172
- if (str.match(unitOnlyRE))
173
- return `1${str}`;
174
- const match = str.match(numberWithUnitRE);
175
- if (!match)
176
- return;
177
- const [, n, unit] = match;
178
- const num = parseFloat(n);
179
- if (!Number.isNaN(num))
180
- return unit ? `${round(num)}${unit}` : `${round(num / 4)}rem`;
181
- }
182
- function px(str) {
183
- if (str.match(unitOnlyRE))
184
- return `1${str}`;
185
- const match = str.match(numberWithUnitRE);
186
- if (!match)
187
- return;
188
- const [, n, unit] = match;
189
- const num = parseFloat(n);
190
- if (!Number.isNaN(num))
191
- return unit ? `${round(num)}${unit}` : `${round(num)}px`;
192
- }
193
- function number(str) {
194
- if (!numberRE.test(str))
195
- return;
196
- const num = parseFloat(str);
197
- if (!Number.isNaN(num))
198
- return round(num);
199
- }
200
- function percent(str) {
201
- if (str.endsWith("%"))
202
- str = str.slice(0, -1);
203
- const num = parseFloat(str);
204
- if (!Number.isNaN(num))
205
- return `${round(num / 100)}`;
206
- }
207
- function fraction(str) {
208
- if (str === "full")
209
- return "100%";
210
- const [left, right] = str.split("/");
211
- const num = parseFloat(left) / parseFloat(right);
212
- if (!Number.isNaN(num))
213
- return `${round(num * 100)}%`;
214
- }
215
- const bracketTypeRe = /^\[(color|length|position):/i;
216
- function bracketWithType(str, type) {
217
- if (str && str.startsWith("[") && str.endsWith("]")) {
218
- let base;
219
- const match = str.match(bracketTypeRe);
220
- if (!match)
221
- base = str.slice(1, -1);
222
- else if (type && match[1] === type)
223
- base = str.slice(match[0].length, -1);
224
- if (base !== void 0) {
225
- return base.replace(/(url\(.*?\))/g, (v) => v.replace(/_/g, "\\_")).replace(/([^\\])_/g, "$1 ").replace(/calc\((.*)/g, (v) => {
226
- return v.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
227
- });
228
- }
229
- }
230
- }
231
- function bracket(str) {
232
- return bracketWithType(str);
233
- }
234
- function bracketOfColor(str) {
235
- return bracketWithType(str, "color");
236
- }
237
- function bracketOfLength(str) {
238
- return bracketWithType(str, "length");
239
- }
240
- function bracketOfPosition(str) {
241
- return bracketWithType(str, "position");
242
- }
243
- function cssvar(str) {
244
- if (str.match(/^\$\S/))
245
- return `var(--${core.escapeSelector(str.slice(1))})`;
246
- }
247
- function time(str) {
248
- const match = str.match(/^(-?[0-9.]+)(s|ms)?$/i);
249
- if (!match)
250
- return;
251
- const [, n, unit] = match;
252
- const num = parseFloat(n);
253
- if (!Number.isNaN(num))
254
- return unit ? `${round(num)}${unit}` : `${round(num)}ms`;
255
- }
256
- function degree(str) {
257
- const match = str.match(/^(-?[0-9.]+)(deg|rad|grad|turn)?$/i);
258
- if (!match)
259
- return;
260
- const [, n, unit] = match;
261
- const num = parseFloat(n);
262
- if (!Number.isNaN(num))
263
- return unit ? `${round(num)}${unit}` : `${round(num)}deg`;
264
- }
265
- function global(str) {
266
- if (globalKeywords.includes(str))
267
- return str;
268
- }
269
- function properties(str) {
270
- if (str.split(",").every((prop) => cssProps.includes(prop)))
271
- return str;
272
- }
273
- function position(str) {
274
- if (["top", "left", "right", "bottom", "center"].includes(str))
275
- return str;
276
- }
277
-
278
- const valueHandlers = {
279
- __proto__: null,
280
- numberWithUnit: numberWithUnit,
281
- auto: auto,
282
- rem: rem,
283
- px: px,
284
- number: number,
285
- percent: percent,
286
- fraction: fraction,
287
- bracket: bracket,
288
- bracketOfColor: bracketOfColor,
289
- bracketOfLength: bracketOfLength,
290
- bracketOfPosition: bracketOfPosition,
291
- cssvar: cssvar,
292
- time: time,
293
- degree: degree,
294
- global: global,
295
- properties: properties,
296
- position: position
297
- };
298
-
299
- const handler = core.createValueHandler(valueHandlers);
300
- const h = handler;
301
-
302
- exports.cornerMap = cornerMap;
303
- exports.directionMap = directionMap;
304
- exports.globalKeywords = globalKeywords;
305
- exports.h = h;
306
- exports.handler = handler;
307
- exports.insetMap = insetMap;
308
- exports.positionMap = positionMap;
309
- exports.valueHandlers = valueHandlers;
310
- exports.xyzMap = xyzMap;