@unocss/preset-uno 0.11.0 → 0.11.4

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.
@@ -0,0 +1,170 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkY6EUTGDCjs = require('./chunk-Y6EUTGDC.js');
4
+
5
+ // src/utils/variants.ts
6
+ var variantMatcher = (name, selector) => {
7
+ const length = name.length + 1;
8
+ const re = new RegExp(`^${name}[:-]`);
9
+ return (input) => {
10
+ return input.match(re) ? {
11
+ matcher: input.slice(length),
12
+ selector
13
+ } : void 0;
14
+ };
15
+ };
16
+
17
+ // src/utils/mappings.ts
18
+ var directionMap = {
19
+ "l": ["-left"],
20
+ "r": ["-right"],
21
+ "t": ["-top"],
22
+ "b": ["-bottom"],
23
+ "s": ["-inline-start"],
24
+ "e": ["-inline-end"],
25
+ "x": ["-left", "-right"],
26
+ "y": ["-top", "-bottom"],
27
+ "": [""],
28
+ "a": [""]
29
+ };
30
+ var cornerMap = {
31
+ "t": ["-top-left", "-top-right"],
32
+ "r": ["-top-right", "-bottom-right"],
33
+ "b": ["-bottom-left", "-bottom-right"],
34
+ "l": ["-bottom-left", "-top-left"],
35
+ "tl": ["-top-left"],
36
+ "lt": ["-top-left"],
37
+ "tr": ["-top-right"],
38
+ "rt": ["-top-right"],
39
+ "bl": ["-bottom-left"],
40
+ "lb": ["-bottom-left"],
41
+ "br": ["-bottom-right"],
42
+ "rb": ["-bottom-right"],
43
+ "": [""]
44
+ };
45
+ var xyzMap = {
46
+ "x": ["-x"],
47
+ "y": ["-y"],
48
+ "z": ["-z"],
49
+ "": ["-x", "-y"]
50
+ };
51
+
52
+ // src/utils/handlers/handlers.ts
53
+ var handlers_exports = {};
54
+ _chunkY6EUTGDCjs.__export.call(void 0, handlers_exports, {
55
+ bracket: () => bracket,
56
+ cssvar: () => cssvar,
57
+ fraction: () => fraction,
58
+ number: () => number,
59
+ percent: () => percent,
60
+ px: () => px,
61
+ rem: () => rem,
62
+ time: () => time
63
+ });
64
+ var numberWithUnitRE = /^(-?[0-9.]+)([a-z]*)$/i;
65
+ var numberRE = /^(-?[0-9.]+)$/i;
66
+ function rem(str) {
67
+ if (str === "auto" || str === "a")
68
+ return "auto";
69
+ const match = str.match(numberWithUnitRE);
70
+ if (!match)
71
+ return;
72
+ const [, n, unit] = match;
73
+ if (unit)
74
+ return str;
75
+ const num = parseFloat(n);
76
+ if (!Number.isNaN(num))
77
+ return `${num / 4}rem`;
78
+ }
79
+ function px(str) {
80
+ const match = str.match(numberWithUnitRE);
81
+ if (!match)
82
+ return;
83
+ const [, n, unit] = match;
84
+ if (unit)
85
+ return str;
86
+ const num = parseFloat(n);
87
+ if (!Number.isNaN(num))
88
+ return `${num}px`;
89
+ }
90
+ function number(str) {
91
+ if (!numberRE.test(str))
92
+ return;
93
+ const num = parseFloat(str);
94
+ if (!Number.isNaN(num))
95
+ return num;
96
+ }
97
+ function percent(str) {
98
+ if (str.endsWith("%"))
99
+ str = str.slice(0, -1);
100
+ const num = parseFloat(str);
101
+ if (!Number.isNaN(num))
102
+ return `${num / 100}`;
103
+ }
104
+ function fraction(str) {
105
+ const [left, right] = str.split("/");
106
+ const num = parseFloat(left) / parseFloat(right);
107
+ if (!Number.isNaN(num))
108
+ return `${num * 100}%`;
109
+ }
110
+ function bracket(str) {
111
+ if (str && str[0] === "[" && str[str.length - 1] === "]")
112
+ return str.slice(1, -1).replace(/_/g, " ");
113
+ }
114
+ function cssvar(str) {
115
+ if (str.startsWith("$"))
116
+ return `var(--${str.slice(1)})`;
117
+ }
118
+ function time(str) {
119
+ const duration = Number(str.replace(/(s|ms)$/, ""));
120
+ if (isNaN(duration))
121
+ return;
122
+ if (/ms|s$/.test(str))
123
+ return str;
124
+ return `${str}ms`;
125
+ }
126
+
127
+ // src/utils/handlers/shorthand.ts
128
+ var handlersNames = Object.keys(handlers_exports);
129
+ var handler = function(str) {
130
+ var _a;
131
+ const s = ((_a = this.__options) == null ? void 0 : _a.sequence) || [];
132
+ this.__options.sequence = [];
133
+ for (const n of s) {
134
+ const res = handlers_exports[n](str);
135
+ if (res != null)
136
+ return res;
137
+ }
138
+ return void 0;
139
+ };
140
+ function addProcessor(that, name) {
141
+ if (!that.__options) {
142
+ that.__options = {
143
+ sequence: []
144
+ };
145
+ }
146
+ that.__options.sequence.push(name);
147
+ return that;
148
+ }
149
+ handlersNames.forEach((i) => {
150
+ Object.defineProperty(handler, i, {
151
+ enumerable: true,
152
+ get() {
153
+ return addProcessor(this, i);
154
+ }
155
+ });
156
+ });
157
+
158
+ // src/utils/index.ts
159
+ function capitalize(str) {
160
+ return str.charAt(0).toUpperCase() + str.slice(1);
161
+ }
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+ exports.directionMap = directionMap; exports.cornerMap = cornerMap; exports.xyzMap = xyzMap; exports.handler = handler; exports.variantMatcher = variantMatcher; exports.capitalize = capitalize;
@@ -450,8 +450,53 @@ var dropShadow = {
450
450
  "none": "0 0 #0000"
451
451
  };
452
452
 
453
+ // src/theme/size.ts
454
+ var baseSize = {
455
+ "xs": "20rem",
456
+ "sm": "24rem",
457
+ "md": "28rem",
458
+ "lg": "32rem",
459
+ "xl": "36rem",
460
+ "2xl": "42rem",
461
+ "3xl": "48rem",
462
+ "4xl": "56rem",
463
+ "5xl": "64rem",
464
+ "6xl": "72rem",
465
+ "7xl": "80rem",
466
+ "full": "100%",
467
+ "min": "min-content",
468
+ "max": "max-content",
469
+ "prose": "65ch"
470
+ };
471
+ var width = {
472
+ auto: "auto",
473
+ ...baseSize,
474
+ screen: "100vw"
475
+ };
476
+ var maxWidth = {
477
+ none: "none",
478
+ ...baseSize,
479
+ screen: "100vw"
480
+ };
481
+ var height = {
482
+ auto: "auto",
483
+ ...baseSize,
484
+ screen: "100vh"
485
+ };
486
+ var maxHeight = {
487
+ none: "none",
488
+ ...baseSize,
489
+ screen: "100vh"
490
+ };
491
+
453
492
  // src/theme/index.ts
454
493
  var theme = {
494
+ width,
495
+ height,
496
+ maxWidth,
497
+ maxHeight,
498
+ minWidth: maxWidth,
499
+ minHeight: maxHeight,
455
500
  colors,
456
501
  fontFamily,
457
502
  fontSize,
@@ -450,8 +450,53 @@ var dropShadow = {
450
450
  "none": "0 0 #0000"
451
451
  };
452
452
 
453
+ // src/theme/size.ts
454
+ var baseSize = {
455
+ "xs": "20rem",
456
+ "sm": "24rem",
457
+ "md": "28rem",
458
+ "lg": "32rem",
459
+ "xl": "36rem",
460
+ "2xl": "42rem",
461
+ "3xl": "48rem",
462
+ "4xl": "56rem",
463
+ "5xl": "64rem",
464
+ "6xl": "72rem",
465
+ "7xl": "80rem",
466
+ "full": "100%",
467
+ "min": "min-content",
468
+ "max": "max-content",
469
+ "prose": "65ch"
470
+ };
471
+ var width = {
472
+ auto: "auto",
473
+ ...baseSize,
474
+ screen: "100vw"
475
+ };
476
+ var maxWidth = {
477
+ none: "none",
478
+ ...baseSize,
479
+ screen: "100vw"
480
+ };
481
+ var height = {
482
+ auto: "auto",
483
+ ...baseSize,
484
+ screen: "100vh"
485
+ };
486
+ var maxHeight = {
487
+ none: "none",
488
+ ...baseSize,
489
+ screen: "100vh"
490
+ };
491
+
453
492
  // src/theme/index.ts
454
493
  var theme = {
494
+ width,
495
+ height,
496
+ maxWidth,
497
+ maxHeight,
498
+ minWidth: maxWidth,
499
+ minHeight: maxHeight,
455
500
  colors,
456
501
  fontFamily,
457
502
  fontSize,