@unocss/preset-mini 0.16.3 → 0.18.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.
- package/dist/chunks/default2.cjs +315 -436
- package/dist/chunks/default2.mjs +288 -404
- package/dist/chunks/default3.cjs +13 -7
- package/dist/chunks/default3.mjs +14 -8
- package/dist/chunks/pseudo.cjs +74 -41
- package/dist/chunks/pseudo.mjs +73 -42
- package/dist/chunks/utilities.cjs +294 -0
- package/dist/chunks/utilities.mjs +283 -0
- package/dist/chunks/variants.cjs +8 -6
- package/dist/chunks/variants.mjs +8 -6
- package/dist/index.cjs +2 -5
- package/dist/index.d.ts +4 -0
- package/dist/index.mjs +3 -6
- package/dist/rules.cjs +3 -8
- package/dist/rules.d.ts +5 -17
- package/dist/rules.mjs +2 -2
- package/dist/utils.cjs +11 -8
- package/dist/utils.d.ts +64 -4
- package/dist/utils.mjs +1 -1
- package/dist/variants.cjs +4 -2
- package/dist/variants.d.ts +9 -4
- package/dist/variants.mjs +2 -2
- package/package.json +2 -2
- package/dist/chunks/index.cjs +0 -142
- package/dist/chunks/index.mjs +0 -134
package/dist/rules.cjs
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const _default = require('./chunks/default2.cjs');
|
|
6
|
+
require('./chunks/utilities.cjs');
|
|
6
7
|
require('@unocss/core');
|
|
7
|
-
require('./chunks/index.cjs');
|
|
8
8
|
require('./chunks/pseudo.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
@@ -14,17 +14,14 @@ exports.appearance = _default.appearance;
|
|
|
14
14
|
exports.appearances = _default.appearances;
|
|
15
15
|
exports.aspectRatio = _default.aspectRatio;
|
|
16
16
|
exports.bgColors = _default.bgColors;
|
|
17
|
-
exports.borderColors = _default.borderColors;
|
|
18
17
|
exports.borders = _default.borders;
|
|
19
18
|
exports.boxShadows = _default.boxShadows;
|
|
20
19
|
exports.boxSizing = _default.boxSizing;
|
|
21
20
|
exports.breaks = _default.breaks;
|
|
22
|
-
exports.colorResolver = _default.colorResolver;
|
|
23
21
|
exports.contents = _default.contents;
|
|
24
22
|
exports.cssVariables = _default.cssVariables;
|
|
25
23
|
exports.cursors = _default.cursors;
|
|
26
24
|
exports.displays = _default.displays;
|
|
27
|
-
exports.fillColors = _default.fillColors;
|
|
28
25
|
exports.flex = _default.flex;
|
|
29
26
|
exports.floats = _default.floats;
|
|
30
27
|
exports.fontSmoothings = _default.fontSmoothings;
|
|
@@ -40,18 +37,15 @@ exports.orders = _default.orders;
|
|
|
40
37
|
exports.outline = _default.outline;
|
|
41
38
|
exports.overflows = _default.overflows;
|
|
42
39
|
exports.paddings = _default.paddings;
|
|
43
|
-
exports.parseColorUtil = _default.parseColorUtil;
|
|
44
|
-
exports.placeholder = _default.placeholder;
|
|
45
40
|
exports.placements = _default.placements;
|
|
46
41
|
exports.pointerEvents = _default.pointerEvents;
|
|
47
42
|
exports.positions = _default.positions;
|
|
48
43
|
exports.questionMark = _default.questionMark;
|
|
49
44
|
exports.resizes = _default.resizes;
|
|
50
|
-
exports.ringColors = _default.ringColors;
|
|
51
|
-
exports.ringOffsetColors = _default.ringOffsetColors;
|
|
52
45
|
exports.rings = _default.rings;
|
|
53
46
|
exports.rules = _default.rules;
|
|
54
47
|
exports.sizes = _default.sizes;
|
|
48
|
+
exports.svgUtilities = _default.svgUtilities;
|
|
55
49
|
exports.tabSizes = _default.tabSizes;
|
|
56
50
|
exports.textAligns = _default.textAligns;
|
|
57
51
|
exports.textColors = _default.textColors;
|
|
@@ -67,4 +61,5 @@ exports.userSelects = _default.userSelects;
|
|
|
67
61
|
exports.varEmpty = _default.varEmpty;
|
|
68
62
|
exports.verticalAligns = _default.verticalAligns;
|
|
69
63
|
exports.whitespaces = _default.whitespaces;
|
|
64
|
+
exports.willChange = _default.willChange;
|
|
70
65
|
exports.zIndexes = _default.zIndexes;
|
package/dist/rules.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Rule
|
|
1
|
+
import { Rule } from '@unocss/core';
|
|
2
2
|
import { T as Theme } from './types-7963d0b3';
|
|
3
3
|
|
|
4
4
|
declare const verticalAligns: Rule[];
|
|
@@ -6,20 +6,10 @@ declare const textAligns: Rule[];
|
|
|
6
6
|
|
|
7
7
|
declare const outline: Rule[];
|
|
8
8
|
declare const appearance: Rule[];
|
|
9
|
-
declare const
|
|
9
|
+
declare const willChange: Rule[];
|
|
10
10
|
|
|
11
11
|
declare const borders: Rule[];
|
|
12
12
|
|
|
13
|
-
declare const parseColorUtil: (body: string, theme: Theme) => {
|
|
14
|
-
opacity: string;
|
|
15
|
-
name: string;
|
|
16
|
-
no: string;
|
|
17
|
-
color: string | undefined;
|
|
18
|
-
rgba: [number, number, number, number] | [number, number, number] | undefined;
|
|
19
|
-
} | undefined;
|
|
20
|
-
declare const colorResolver: (attribute: string, varName: string) => ([, body]: string[], { theme }: RuleContext<Theme>) => {
|
|
21
|
-
[x: string]: string | number;
|
|
22
|
-
} | undefined;
|
|
23
13
|
/**
|
|
24
14
|
* @example op10 op-30 opacity-100
|
|
25
15
|
*/
|
|
@@ -29,10 +19,6 @@ declare const opacity: Rule[];
|
|
|
29
19
|
*/
|
|
30
20
|
declare const textColors: Rule[];
|
|
31
21
|
declare const bgColors: Rule[];
|
|
32
|
-
declare const borderColors: Rule[];
|
|
33
|
-
declare const ringColors: Rule[];
|
|
34
|
-
declare const ringOffsetColors: Rule[];
|
|
35
|
-
declare const fillColors: Rule[];
|
|
36
22
|
|
|
37
23
|
declare const rules: Rule[];
|
|
38
24
|
|
|
@@ -86,6 +72,8 @@ declare const textTransforms: Rule[];
|
|
|
86
72
|
declare const fontStyles: Rule[];
|
|
87
73
|
declare const fontSmoothings: Rule[];
|
|
88
74
|
|
|
75
|
+
declare const svgUtilities: Rule[];
|
|
76
|
+
|
|
89
77
|
declare const transforms: Rule[];
|
|
90
78
|
|
|
91
79
|
declare const transitions: Rule[];
|
|
@@ -100,4 +88,4 @@ declare const cssVariables: Rule[];
|
|
|
100
88
|
|
|
101
89
|
declare const textDecorations: Rule[];
|
|
102
90
|
|
|
103
|
-
export { alignments, appearance, appearances, aspectRatio, bgColors,
|
|
91
|
+
export { alignments, appearance, appearances, aspectRatio, bgColors, borders, boxShadows, boxSizing, breaks, contents, 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, transforms, transitions, userSelects, varEmpty, verticalAligns, whitespaces, willChange, zIndexes };
|
package/dist/rules.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
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 cssVariables, H as cursors, F as displays, f as flex, q as floats, R as fontSmoothings, Q as fontStyles, V 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, W as tabSizes, t as textAligns, d as textColors, $ as textDecorations, X as textIndents, O as textOverflows, Z as textShadows, Y as textStrokes, P as textTransforms, T as transforms, U 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
|
+
import './chunks/utilities.mjs';
|
|
2
3
|
import '@unocss/core';
|
|
3
|
-
import './chunks/index.mjs';
|
|
4
4
|
import './chunks/pseudo.mjs';
|
package/dist/utils.cjs
CHANGED
|
@@ -2,17 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const utilities = require('./chunks/utilities.cjs');
|
|
6
6
|
const variants = require('./chunks/variants.cjs');
|
|
7
7
|
require('@unocss/core');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.capitalize =
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
11
|
+
exports.capitalize = utilities.capitalize;
|
|
12
|
+
exports.colorResolver = utilities.colorResolver;
|
|
13
|
+
exports.cornerMap = utilities.cornerMap;
|
|
14
|
+
exports.directionMap = utilities.directionMap;
|
|
15
|
+
exports.directionSize = utilities.directionSize;
|
|
16
|
+
exports.h = utilities.h;
|
|
17
|
+
exports.handler = utilities.handler;
|
|
18
|
+
exports.parseColor = utilities.parseColor;
|
|
19
|
+
exports.valueHandlers = utilities.valueHandlers;
|
|
20
|
+
exports.xyzMap = utilities.xyzMap;
|
|
18
21
|
exports.variantMatcher = variants.variantMatcher;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import * as _unocss_core from '@unocss/core';
|
|
2
|
-
import { VariantHandler } from '@unocss/core';
|
|
2
|
+
import { VariantHandler, DynamicMatcher, ParsedColorValue } from '@unocss/core';
|
|
3
|
+
import { T as Theme } from './types-7963d0b3';
|
|
3
4
|
|
|
4
5
|
declare const directionMap: Record<string, string[]>;
|
|
5
6
|
declare const cornerMap: Record<string, string[]>;
|
|
6
7
|
declare const xyzMap: Record<string, string[]>;
|
|
7
8
|
|
|
9
|
+
declare function numberWithUnit(str: string): string | undefined;
|
|
10
|
+
declare function auto(str: string): "auto" | undefined;
|
|
8
11
|
declare function rem(str: string): string | undefined;
|
|
9
12
|
declare function px(str: string): string | undefined;
|
|
10
13
|
declare function number(str: string): number | undefined;
|
|
@@ -14,7 +17,10 @@ declare function bracket(str: string): string | undefined;
|
|
|
14
17
|
declare function cssvar(str: string): string | undefined;
|
|
15
18
|
declare function time(str: string): string | undefined;
|
|
16
19
|
declare function global(str: string): string | undefined;
|
|
20
|
+
declare function properties(str: string): string | undefined;
|
|
17
21
|
|
|
22
|
+
declare const handlers_numberWithUnit: typeof numberWithUnit;
|
|
23
|
+
declare const handlers_auto: typeof auto;
|
|
18
24
|
declare const handlers_rem: typeof rem;
|
|
19
25
|
declare const handlers_px: typeof px;
|
|
20
26
|
declare const handlers_number: typeof number;
|
|
@@ -24,8 +30,11 @@ declare const handlers_bracket: typeof bracket;
|
|
|
24
30
|
declare const handlers_cssvar: typeof cssvar;
|
|
25
31
|
declare const handlers_time: typeof time;
|
|
26
32
|
declare const handlers_global: typeof global;
|
|
33
|
+
declare const handlers_properties: typeof properties;
|
|
27
34
|
declare namespace handlers {
|
|
28
35
|
export {
|
|
36
|
+
handlers_numberWithUnit as numberWithUnit,
|
|
37
|
+
handlers_auto as auto,
|
|
29
38
|
handlers_rem as rem,
|
|
30
39
|
handlers_px as px,
|
|
31
40
|
handlers_number as number,
|
|
@@ -35,14 +44,65 @@ declare namespace handlers {
|
|
|
35
44
|
handlers_cssvar as cssvar,
|
|
36
45
|
handlers_time as time,
|
|
37
46
|
handlers_global as global,
|
|
47
|
+
handlers_properties as properties,
|
|
38
48
|
};
|
|
39
49
|
}
|
|
40
50
|
|
|
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
|
+
declare const handler: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global" | "properties">;
|
|
52
|
+
declare const h: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global" | "properties">;
|
|
43
53
|
|
|
44
54
|
declare const variantMatcher: (name: string, selector?: ((input: string) => string | undefined) | undefined) => (input: string) => VariantHandler | undefined;
|
|
45
55
|
|
|
46
56
|
declare function capitalize<T extends string>(str: T): Capitalize<T>;
|
|
57
|
+
/**
|
|
58
|
+
* Provide {@link DynamicMatcher} function returning spacing definition. See spacing rules.
|
|
59
|
+
*
|
|
60
|
+
* @param {string} propertyPrefix - Property for the css value to be created. Postfix will be appended according to direction matched.
|
|
61
|
+
* @return {DynamicMatcher} {@link DynamicMatcher}
|
|
62
|
+
* @see {@link directionMap}
|
|
63
|
+
*/
|
|
64
|
+
declare const directionSize: (propertyPrefix: string) => DynamicMatcher;
|
|
65
|
+
/**
|
|
66
|
+
* Parse color string into rgba (if possible) with opacity opacity. Color value will be matched to theme object before converting to rgb value.
|
|
67
|
+
*
|
|
68
|
+
* @example Parseable strings:
|
|
69
|
+
* 'red' // From theme, if 'red' is available
|
|
70
|
+
* 'red-100' // From theme, plus scale
|
|
71
|
+
* 'red-100/20' // From theme, plus scale/opacity
|
|
72
|
+
* '#f12' // Hex color
|
|
73
|
+
* 'hex-f12' // Alternative hex color
|
|
74
|
+
* '[rgb(100,2,3)]/[var(--op)]' // Bracket with rgb color and bracket with opacity
|
|
75
|
+
*
|
|
76
|
+
* @param {string} body - Color string to be parsed.
|
|
77
|
+
* @param {Theme} theme - {@link Theme} object.
|
|
78
|
+
* @return {ParsedColorValue|undefined} {@link ParsedColorValue} object if string is parseable.
|
|
79
|
+
*/
|
|
80
|
+
declare const parseColor: (body: string, theme: Theme) => ParsedColorValue | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Provide {@link DynamicMatcher} function to produce color value matched from rule.
|
|
83
|
+
*
|
|
84
|
+
* @see {@link parseColor}
|
|
85
|
+
*
|
|
86
|
+
* @example Resolving 'red' from theme:
|
|
87
|
+
* colorResolver('background-color', 'background')('', 'red')
|
|
88
|
+
* return { 'background-color': '#f12' }
|
|
89
|
+
*
|
|
90
|
+
* @example Resolving 'red-100' from theme:
|
|
91
|
+
* colorResolver('background-color', 'background')('', 'red-100')
|
|
92
|
+
* return { '--un-background-opacity': '1', 'background-color': 'rgba(254,226,226,var(--un-bg-opacity))' }
|
|
93
|
+
*
|
|
94
|
+
* @example Resolving 'red-100/20' from theme:
|
|
95
|
+
* colorResolver('background-color', 'background')('', 'red-100/20')
|
|
96
|
+
* return { 'background-color': 'rgba(204,251,241,0.22)' }
|
|
97
|
+
*
|
|
98
|
+
* @example Resolving 'hex-124':
|
|
99
|
+
* colorResolver('color', 'text')('', 'hex-124')
|
|
100
|
+
* return { '--un-text-opacity': '1', 'color': 'rgba(17,34,68,var(--un-text-opacity))' }
|
|
101
|
+
*
|
|
102
|
+
* @param {string} property - Property for the css value to be created.
|
|
103
|
+
* @param {string} varName - Base name for the opacity variable.
|
|
104
|
+
* @return {DynamicMatcher} {@link DynamicMatcher} object.
|
|
105
|
+
*/
|
|
106
|
+
declare const colorResolver: (property: string, varName: string) => DynamicMatcher;
|
|
47
107
|
|
|
48
|
-
export { capitalize, cornerMap, directionMap, h, handler, handlers as valueHandlers, variantMatcher, xyzMap };
|
|
108
|
+
export { capitalize, colorResolver, cornerMap, directionMap, directionSize, h, handler, parseColor, handlers as valueHandlers, variantMatcher, xyzMap };
|
package/dist/utils.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { b as capitalize, c as colorResolver, a as cornerMap, d as directionMap, e as directionSize, f as h, h as handler, p as parseColor, v as valueHandlers, x as xyzMap } from './chunks/utilities.mjs';
|
|
2
2
|
export { v as variantMatcher } from './chunks/variants.mjs';
|
|
3
3
|
import '@unocss/core';
|
package/dist/variants.cjs
CHANGED
|
@@ -10,14 +10,16 @@ require('@unocss/core');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
exports.variantBreakpoints = _default.variantBreakpoints;
|
|
13
|
-
exports.variantChildren = _default.variantChildren;
|
|
14
13
|
exports.variantColorsClass = _default.variantColorsClass;
|
|
15
14
|
exports.variantColorsMedia = _default.variantColorsMedia;
|
|
15
|
+
exports.variantCombinators = _default.variantCombinators;
|
|
16
16
|
exports.variantImportant = _default.variantImportant;
|
|
17
17
|
exports.variantNegative = _default.variantNegative;
|
|
18
18
|
exports.variantSpace = _default.variantSpace;
|
|
19
19
|
exports.variants = _default.variants;
|
|
20
|
-
exports.
|
|
20
|
+
exports.CONTROL_BYPASS_PSEUDO_CLASS = pseudo.CONTROL_BYPASS_PSEUDO_CLASS;
|
|
21
21
|
exports.PseudoClasses = pseudo.PseudoClasses;
|
|
22
|
+
exports.partClasses = pseudo.partClasses;
|
|
22
23
|
exports.variantPseudoClasses = pseudo.variantPseudoClasses;
|
|
23
24
|
exports.variantPseudoElements = pseudo.variantPseudoElements;
|
|
25
|
+
exports.variantTaggedPseudoClasses = pseudo.variantTaggedPseudoClasses;
|
package/dist/variants.d.ts
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import { Variant, VariantFunction, VariantObject } from '@unocss/core';
|
|
2
2
|
import { T as Theme } from './types-7963d0b3';
|
|
3
|
+
import { PresetMiniOptions } from './index';
|
|
4
|
+
import './default-c7c67d23';
|
|
5
|
+
import './colors-d6b5a5b4';
|
|
3
6
|
|
|
4
7
|
declare const variantBreakpoints: Variant<Theme>;
|
|
5
8
|
|
|
6
|
-
declare const
|
|
9
|
+
declare const variantCombinators: Variant[];
|
|
7
10
|
|
|
8
11
|
declare const variantColorsClass: Variant[];
|
|
9
12
|
declare const variantColorsMedia: Variant[];
|
|
10
13
|
|
|
11
|
-
declare const variants: Variant<Theme>[];
|
|
14
|
+
declare const variants: (options: PresetMiniOptions) => Variant<Theme>[];
|
|
12
15
|
|
|
13
16
|
declare const variantImportant: Variant;
|
|
14
17
|
declare const variantNegative: Variant;
|
|
15
18
|
declare const variantSpace: Variant;
|
|
16
19
|
|
|
17
|
-
declare const
|
|
20
|
+
declare const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
|
|
18
21
|
declare const PseudoClasses: Record<string, string | undefined>;
|
|
19
22
|
declare const variantPseudoElements: VariantFunction;
|
|
20
23
|
declare const variantPseudoClasses: VariantObject;
|
|
24
|
+
declare const variantTaggedPseudoClasses: (options?: PresetMiniOptions) => VariantObject;
|
|
25
|
+
declare const partClasses: VariantObject;
|
|
21
26
|
|
|
22
|
-
export {
|
|
27
|
+
export { CONTROL_BYPASS_PSEUDO_CLASS, PseudoClasses, partClasses, variantBreakpoints, variantColorsClass, variantColorsMedia, variantCombinators, variantImportant, variantNegative, variantPseudoClasses, variantPseudoElements, variantSpace, variantTaggedPseudoClasses, variants };
|
package/dist/variants.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { C as
|
|
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';
|
|
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.
|
|
3
|
+
"version": "0.18.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.
|
|
64
|
+
"@unocss/core": "0.18.0"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "unbuild",
|
package/dist/chunks/index.cjs
DELETED
|
@@ -1,142 +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
|
-
"a": [""]
|
|
16
|
-
};
|
|
17
|
-
const cornerMap = {
|
|
18
|
-
"t": ["-top-left", "-top-right"],
|
|
19
|
-
"r": ["-top-right", "-bottom-right"],
|
|
20
|
-
"b": ["-bottom-left", "-bottom-right"],
|
|
21
|
-
"l": ["-bottom-left", "-top-left"],
|
|
22
|
-
"tl": ["-top-left"],
|
|
23
|
-
"lt": ["-top-left"],
|
|
24
|
-
"tr": ["-top-right"],
|
|
25
|
-
"rt": ["-top-right"],
|
|
26
|
-
"bl": ["-bottom-left"],
|
|
27
|
-
"lb": ["-bottom-left"],
|
|
28
|
-
"br": ["-bottom-right"],
|
|
29
|
-
"rb": ["-bottom-right"],
|
|
30
|
-
"": [""]
|
|
31
|
-
};
|
|
32
|
-
const xyzMap = {
|
|
33
|
-
"x": ["-x"],
|
|
34
|
-
"y": ["-y"],
|
|
35
|
-
"z": ["-z"],
|
|
36
|
-
"": ["-x", "-y"]
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
|
|
40
|
-
const numberRE = /^(-?[0-9.]+)$/i;
|
|
41
|
-
const unitOnlyRE = /^(px)$/i;
|
|
42
|
-
function rem(str) {
|
|
43
|
-
if (str === "auto" || str === "a")
|
|
44
|
-
return "auto";
|
|
45
|
-
if (str.match(unitOnlyRE))
|
|
46
|
-
return `1${str}`;
|
|
47
|
-
const match = str.match(numberWithUnitRE);
|
|
48
|
-
if (!match)
|
|
49
|
-
return;
|
|
50
|
-
const [, n, unit] = match;
|
|
51
|
-
if (unit)
|
|
52
|
-
return str;
|
|
53
|
-
const num = parseFloat(n);
|
|
54
|
-
if (!Number.isNaN(num))
|
|
55
|
-
return `${num / 4}rem`;
|
|
56
|
-
}
|
|
57
|
-
function px(str) {
|
|
58
|
-
if (str.match(unitOnlyRE))
|
|
59
|
-
return `1${str}`;
|
|
60
|
-
const match = str.match(numberWithUnitRE);
|
|
61
|
-
if (!match)
|
|
62
|
-
return;
|
|
63
|
-
const [, n, unit] = match;
|
|
64
|
-
if (unit)
|
|
65
|
-
return str;
|
|
66
|
-
const num = parseFloat(n);
|
|
67
|
-
if (!Number.isNaN(num))
|
|
68
|
-
return `${num}px`;
|
|
69
|
-
}
|
|
70
|
-
function number(str) {
|
|
71
|
-
if (!numberRE.test(str))
|
|
72
|
-
return;
|
|
73
|
-
const num = parseFloat(str);
|
|
74
|
-
if (!Number.isNaN(num))
|
|
75
|
-
return num;
|
|
76
|
-
}
|
|
77
|
-
function percent(str) {
|
|
78
|
-
if (str.endsWith("%"))
|
|
79
|
-
str = str.slice(0, -1);
|
|
80
|
-
const num = parseFloat(str);
|
|
81
|
-
if (!Number.isNaN(num))
|
|
82
|
-
return `${num / 100}`;
|
|
83
|
-
}
|
|
84
|
-
function fraction(str) {
|
|
85
|
-
if (str === "full")
|
|
86
|
-
return "100%";
|
|
87
|
-
const [left, right] = str.split("/");
|
|
88
|
-
const num = parseFloat(left) / parseFloat(right);
|
|
89
|
-
if (!Number.isNaN(num))
|
|
90
|
-
return `${num * 100}%`;
|
|
91
|
-
}
|
|
92
|
-
function bracket(str) {
|
|
93
|
-
if (str && str[0] === "[" && str[str.length - 1] === "]") {
|
|
94
|
-
return str.slice(1, -1).replace(/_/g, " ").replace(/calc\((.*)/g, (v) => {
|
|
95
|
-
return v.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
function cssvar(str) {
|
|
100
|
-
if (str.startsWith("$"))
|
|
101
|
-
return `var(--${str.slice(1)})`;
|
|
102
|
-
}
|
|
103
|
-
function time(str) {
|
|
104
|
-
const duration = Number(str.replace(/(s|ms)$/, ""));
|
|
105
|
-
if (isNaN(duration))
|
|
106
|
-
return;
|
|
107
|
-
if (/ms|s$/.test(str))
|
|
108
|
-
return str;
|
|
109
|
-
return `${str}ms`;
|
|
110
|
-
}
|
|
111
|
-
function global(str) {
|
|
112
|
-
if (["inherit", "initial", "unset"].includes(str))
|
|
113
|
-
return str;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const valueHandlers = {
|
|
117
|
-
__proto__: null,
|
|
118
|
-
rem: rem,
|
|
119
|
-
px: px,
|
|
120
|
-
number: number,
|
|
121
|
-
percent: percent,
|
|
122
|
-
fraction: fraction,
|
|
123
|
-
bracket: bracket,
|
|
124
|
-
cssvar: cssvar,
|
|
125
|
-
time: time,
|
|
126
|
-
global: global
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const handler = core.createValueHandler(valueHandlers);
|
|
130
|
-
const h = handler;
|
|
131
|
-
|
|
132
|
-
function capitalize(str) {
|
|
133
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
exports.capitalize = capitalize;
|
|
137
|
-
exports.cornerMap = cornerMap;
|
|
138
|
-
exports.directionMap = directionMap;
|
|
139
|
-
exports.h = h;
|
|
140
|
-
exports.handler = handler;
|
|
141
|
-
exports.valueHandlers = valueHandlers;
|
|
142
|
-
exports.xyzMap = xyzMap;
|
package/dist/chunks/index.mjs
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { createValueHandler } from '@unocss/core';
|
|
2
|
-
|
|
3
|
-
const directionMap = {
|
|
4
|
-
"l": ["-left"],
|
|
5
|
-
"r": ["-right"],
|
|
6
|
-
"t": ["-top"],
|
|
7
|
-
"b": ["-bottom"],
|
|
8
|
-
"s": ["-inline-start"],
|
|
9
|
-
"e": ["-inline-end"],
|
|
10
|
-
"x": ["-left", "-right"],
|
|
11
|
-
"y": ["-top", "-bottom"],
|
|
12
|
-
"": [""],
|
|
13
|
-
"a": [""]
|
|
14
|
-
};
|
|
15
|
-
const cornerMap = {
|
|
16
|
-
"t": ["-top-left", "-top-right"],
|
|
17
|
-
"r": ["-top-right", "-bottom-right"],
|
|
18
|
-
"b": ["-bottom-left", "-bottom-right"],
|
|
19
|
-
"l": ["-bottom-left", "-top-left"],
|
|
20
|
-
"tl": ["-top-left"],
|
|
21
|
-
"lt": ["-top-left"],
|
|
22
|
-
"tr": ["-top-right"],
|
|
23
|
-
"rt": ["-top-right"],
|
|
24
|
-
"bl": ["-bottom-left"],
|
|
25
|
-
"lb": ["-bottom-left"],
|
|
26
|
-
"br": ["-bottom-right"],
|
|
27
|
-
"rb": ["-bottom-right"],
|
|
28
|
-
"": [""]
|
|
29
|
-
};
|
|
30
|
-
const xyzMap = {
|
|
31
|
-
"x": ["-x"],
|
|
32
|
-
"y": ["-y"],
|
|
33
|
-
"z": ["-z"],
|
|
34
|
-
"": ["-x", "-y"]
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
|
|
38
|
-
const numberRE = /^(-?[0-9.]+)$/i;
|
|
39
|
-
const unitOnlyRE = /^(px)$/i;
|
|
40
|
-
function rem(str) {
|
|
41
|
-
if (str === "auto" || str === "a")
|
|
42
|
-
return "auto";
|
|
43
|
-
if (str.match(unitOnlyRE))
|
|
44
|
-
return `1${str}`;
|
|
45
|
-
const match = str.match(numberWithUnitRE);
|
|
46
|
-
if (!match)
|
|
47
|
-
return;
|
|
48
|
-
const [, n, unit] = match;
|
|
49
|
-
if (unit)
|
|
50
|
-
return str;
|
|
51
|
-
const num = parseFloat(n);
|
|
52
|
-
if (!Number.isNaN(num))
|
|
53
|
-
return `${num / 4}rem`;
|
|
54
|
-
}
|
|
55
|
-
function px(str) {
|
|
56
|
-
if (str.match(unitOnlyRE))
|
|
57
|
-
return `1${str}`;
|
|
58
|
-
const match = str.match(numberWithUnitRE);
|
|
59
|
-
if (!match)
|
|
60
|
-
return;
|
|
61
|
-
const [, n, unit] = match;
|
|
62
|
-
if (unit)
|
|
63
|
-
return str;
|
|
64
|
-
const num = parseFloat(n);
|
|
65
|
-
if (!Number.isNaN(num))
|
|
66
|
-
return `${num}px`;
|
|
67
|
-
}
|
|
68
|
-
function number(str) {
|
|
69
|
-
if (!numberRE.test(str))
|
|
70
|
-
return;
|
|
71
|
-
const num = parseFloat(str);
|
|
72
|
-
if (!Number.isNaN(num))
|
|
73
|
-
return num;
|
|
74
|
-
}
|
|
75
|
-
function percent(str) {
|
|
76
|
-
if (str.endsWith("%"))
|
|
77
|
-
str = str.slice(0, -1);
|
|
78
|
-
const num = parseFloat(str);
|
|
79
|
-
if (!Number.isNaN(num))
|
|
80
|
-
return `${num / 100}`;
|
|
81
|
-
}
|
|
82
|
-
function fraction(str) {
|
|
83
|
-
if (str === "full")
|
|
84
|
-
return "100%";
|
|
85
|
-
const [left, right] = str.split("/");
|
|
86
|
-
const num = parseFloat(left) / parseFloat(right);
|
|
87
|
-
if (!Number.isNaN(num))
|
|
88
|
-
return `${num * 100}%`;
|
|
89
|
-
}
|
|
90
|
-
function bracket(str) {
|
|
91
|
-
if (str && str[0] === "[" && str[str.length - 1] === "]") {
|
|
92
|
-
return str.slice(1, -1).replace(/_/g, " ").replace(/calc\((.*)/g, (v) => {
|
|
93
|
-
return v.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
function cssvar(str) {
|
|
98
|
-
if (str.startsWith("$"))
|
|
99
|
-
return `var(--${str.slice(1)})`;
|
|
100
|
-
}
|
|
101
|
-
function time(str) {
|
|
102
|
-
const duration = Number(str.replace(/(s|ms)$/, ""));
|
|
103
|
-
if (isNaN(duration))
|
|
104
|
-
return;
|
|
105
|
-
if (/ms|s$/.test(str))
|
|
106
|
-
return str;
|
|
107
|
-
return `${str}ms`;
|
|
108
|
-
}
|
|
109
|
-
function global(str) {
|
|
110
|
-
if (["inherit", "initial", "unset"].includes(str))
|
|
111
|
-
return str;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const valueHandlers = {
|
|
115
|
-
__proto__: null,
|
|
116
|
-
rem: rem,
|
|
117
|
-
px: px,
|
|
118
|
-
number: number,
|
|
119
|
-
percent: percent,
|
|
120
|
-
fraction: fraction,
|
|
121
|
-
bracket: bracket,
|
|
122
|
-
cssvar: cssvar,
|
|
123
|
-
time: time,
|
|
124
|
-
global: global
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
const handler = createValueHandler(valueHandlers);
|
|
128
|
-
const h = handler;
|
|
129
|
-
|
|
130
|
-
function capitalize(str) {
|
|
131
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export { capitalize as a, h as b, cornerMap as c, directionMap as d, handler as h, valueHandlers as v, xyzMap as x };
|