tailwind-clamp 2.2.3 → 3.0.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/README.md +3 -3
- package/dist/index.js +699 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.cjs +6 -0
- package/dist/index.umd.cjs.map +1 -0
- package/package.json +19 -12
- package/src/clamp.js +0 -84
- package/src/index.js +0 -108
- package/src/log.js +0 -16
- package/src/parse-value.js +0 -71
- package/src/resolve-property.js +0 -302
package/dist/index.js
ADDED
|
@@ -0,0 +1,699 @@
|
|
|
1
|
+
function Z(r) {
|
|
2
|
+
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
3
|
+
}
|
|
4
|
+
var X = {}, K = {};
|
|
5
|
+
(function(r) {
|
|
6
|
+
Object.defineProperty(r, "__esModule", {
|
|
7
|
+
value: !0
|
|
8
|
+
}), Object.defineProperty(r, "default", {
|
|
9
|
+
enumerable: !0,
|
|
10
|
+
get: function() {
|
|
11
|
+
return n;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
function e(t, o) {
|
|
15
|
+
return {
|
|
16
|
+
handler: t,
|
|
17
|
+
config: o
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
e.withOptions = function(t, o = () => ({})) {
|
|
21
|
+
const s = function(i) {
|
|
22
|
+
return {
|
|
23
|
+
__options: i,
|
|
24
|
+
handler: t(i),
|
|
25
|
+
config: o(i)
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
return s.__isOptionsFunction = !0, s.__pluginFunction = t, s.__configFunction = o, s;
|
|
29
|
+
};
|
|
30
|
+
const n = e;
|
|
31
|
+
})(K);
|
|
32
|
+
(function(r) {
|
|
33
|
+
Object.defineProperty(r, "__esModule", {
|
|
34
|
+
value: !0
|
|
35
|
+
}), Object.defineProperty(r, "default", {
|
|
36
|
+
enumerable: !0,
|
|
37
|
+
get: function() {
|
|
38
|
+
return t;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const e = /* @__PURE__ */ n(K);
|
|
42
|
+
function n(o) {
|
|
43
|
+
return o && o.__esModule ? o : {
|
|
44
|
+
default: o
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const t = e.default;
|
|
48
|
+
})(X);
|
|
49
|
+
let j = X;
|
|
50
|
+
var ee = (j.__esModule ? j : { default: j }).default;
|
|
51
|
+
const re = /* @__PURE__ */ Z(ee), N = [
|
|
52
|
+
"translate(var(--tw-translate-x), var(--tw-translate-y))",
|
|
53
|
+
"rotate(var(--tw-rotate))",
|
|
54
|
+
"skewX(var(--tw-skew-x))",
|
|
55
|
+
"skewY(var(--tw-skew-y))",
|
|
56
|
+
"scaleX(var(--tw-scale-x))",
|
|
57
|
+
"scaleY(var(--tw-scale-y))"
|
|
58
|
+
].join(" "), te = (r) => {
|
|
59
|
+
switch (r) {
|
|
60
|
+
case "p":
|
|
61
|
+
return {
|
|
62
|
+
key: "padding",
|
|
63
|
+
props: ["padding"]
|
|
64
|
+
};
|
|
65
|
+
case "pt":
|
|
66
|
+
return {
|
|
67
|
+
key: "padding",
|
|
68
|
+
props: ["paddingTop"]
|
|
69
|
+
};
|
|
70
|
+
case "pb":
|
|
71
|
+
return {
|
|
72
|
+
key: "padding",
|
|
73
|
+
props: ["paddingBottom"]
|
|
74
|
+
};
|
|
75
|
+
case "pl":
|
|
76
|
+
return {
|
|
77
|
+
key: "padding",
|
|
78
|
+
props: ["paddingLeft"]
|
|
79
|
+
};
|
|
80
|
+
case "pr":
|
|
81
|
+
return {
|
|
82
|
+
key: "padding",
|
|
83
|
+
props: ["paddingRight"]
|
|
84
|
+
};
|
|
85
|
+
case "px":
|
|
86
|
+
return {
|
|
87
|
+
key: "padding",
|
|
88
|
+
props: ["paddingLeft", "paddingRight"]
|
|
89
|
+
};
|
|
90
|
+
case "py":
|
|
91
|
+
return {
|
|
92
|
+
key: "padding",
|
|
93
|
+
props: ["paddingTop", "paddingBottom"]
|
|
94
|
+
};
|
|
95
|
+
case "m":
|
|
96
|
+
return {
|
|
97
|
+
key: "margin",
|
|
98
|
+
props: ["margin"]
|
|
99
|
+
};
|
|
100
|
+
case "mt":
|
|
101
|
+
return {
|
|
102
|
+
key: "margin",
|
|
103
|
+
props: ["marginTop"]
|
|
104
|
+
};
|
|
105
|
+
case "mb":
|
|
106
|
+
return {
|
|
107
|
+
key: "margin",
|
|
108
|
+
props: ["marginBottom"]
|
|
109
|
+
};
|
|
110
|
+
case "ml":
|
|
111
|
+
return {
|
|
112
|
+
key: "margin",
|
|
113
|
+
props: ["marginLeft"]
|
|
114
|
+
};
|
|
115
|
+
case "mr":
|
|
116
|
+
return {
|
|
117
|
+
key: "margin",
|
|
118
|
+
props: ["marginRight"]
|
|
119
|
+
};
|
|
120
|
+
case "mx":
|
|
121
|
+
return {
|
|
122
|
+
key: "margin",
|
|
123
|
+
props: ["marginLeft", "marginRight"]
|
|
124
|
+
};
|
|
125
|
+
case "my":
|
|
126
|
+
return {
|
|
127
|
+
key: "margin",
|
|
128
|
+
props: ["marginTop", "marginBottom"]
|
|
129
|
+
};
|
|
130
|
+
case "inset":
|
|
131
|
+
return {
|
|
132
|
+
key: "inset",
|
|
133
|
+
props: ["top", "left", "right", "bottom"]
|
|
134
|
+
};
|
|
135
|
+
case "top":
|
|
136
|
+
return {
|
|
137
|
+
key: "inset",
|
|
138
|
+
props: ["top"]
|
|
139
|
+
};
|
|
140
|
+
case "left":
|
|
141
|
+
return {
|
|
142
|
+
key: "inset",
|
|
143
|
+
props: ["left"]
|
|
144
|
+
};
|
|
145
|
+
case "right":
|
|
146
|
+
return {
|
|
147
|
+
key: "inset",
|
|
148
|
+
props: ["right"]
|
|
149
|
+
};
|
|
150
|
+
case "bottom":
|
|
151
|
+
return {
|
|
152
|
+
key: "inset",
|
|
153
|
+
props: ["bottom"]
|
|
154
|
+
};
|
|
155
|
+
case "text":
|
|
156
|
+
return {
|
|
157
|
+
key: "fontSize",
|
|
158
|
+
props: ["fontSize"]
|
|
159
|
+
};
|
|
160
|
+
case "gap":
|
|
161
|
+
return {
|
|
162
|
+
key: "gap",
|
|
163
|
+
props: ["gap"]
|
|
164
|
+
};
|
|
165
|
+
case "gap-x":
|
|
166
|
+
return {
|
|
167
|
+
key: "gap",
|
|
168
|
+
props: ["columnGap"]
|
|
169
|
+
};
|
|
170
|
+
case "gap-y":
|
|
171
|
+
return {
|
|
172
|
+
key: "gap",
|
|
173
|
+
props: ["rowGap"]
|
|
174
|
+
};
|
|
175
|
+
case "w":
|
|
176
|
+
return {
|
|
177
|
+
key: "width",
|
|
178
|
+
props: ["width"]
|
|
179
|
+
};
|
|
180
|
+
case "h":
|
|
181
|
+
return {
|
|
182
|
+
key: "height",
|
|
183
|
+
props: ["height"]
|
|
184
|
+
};
|
|
185
|
+
case "size":
|
|
186
|
+
return {
|
|
187
|
+
key: "size",
|
|
188
|
+
props: ["width", "height"]
|
|
189
|
+
};
|
|
190
|
+
case "min-w":
|
|
191
|
+
return {
|
|
192
|
+
key: "minWidth",
|
|
193
|
+
props: ["minWidth"]
|
|
194
|
+
};
|
|
195
|
+
case "min-h":
|
|
196
|
+
return {
|
|
197
|
+
key: "minHeight",
|
|
198
|
+
props: ["minHeight"]
|
|
199
|
+
};
|
|
200
|
+
case "max-w":
|
|
201
|
+
return {
|
|
202
|
+
key: "maxWidth",
|
|
203
|
+
props: ["maxWidth"]
|
|
204
|
+
};
|
|
205
|
+
case "max-h":
|
|
206
|
+
return {
|
|
207
|
+
key: "maxHeight",
|
|
208
|
+
props: ["maxHeight"]
|
|
209
|
+
};
|
|
210
|
+
case "rounded":
|
|
211
|
+
return {
|
|
212
|
+
key: "borderRadius",
|
|
213
|
+
props: ["borderRadius"]
|
|
214
|
+
};
|
|
215
|
+
case "rounded-t":
|
|
216
|
+
return {
|
|
217
|
+
key: "borderRadius",
|
|
218
|
+
props: ["borderTopLeftRadius", "borderTopRightRadius"]
|
|
219
|
+
};
|
|
220
|
+
case "rounded-r":
|
|
221
|
+
return {
|
|
222
|
+
key: "borderRadius",
|
|
223
|
+
props: ["borderTopRightRadius", "borderBottomRightRadius"]
|
|
224
|
+
};
|
|
225
|
+
case "rounded-b":
|
|
226
|
+
return {
|
|
227
|
+
key: "borderRadius",
|
|
228
|
+
props: ["borderBottomLeftRadius", "borderBottomRightRadius"]
|
|
229
|
+
};
|
|
230
|
+
case "rounded-l":
|
|
231
|
+
return {
|
|
232
|
+
key: "borderRadius",
|
|
233
|
+
props: ["borderTopLeftRadius", "borderBottomLeftRadius"]
|
|
234
|
+
};
|
|
235
|
+
case "rounded-tl":
|
|
236
|
+
return {
|
|
237
|
+
key: "borderRadius",
|
|
238
|
+
props: ["borderTopLeftRadius"]
|
|
239
|
+
};
|
|
240
|
+
case "rounded-tr":
|
|
241
|
+
return {
|
|
242
|
+
key: "borderRadius",
|
|
243
|
+
props: ["borderTopRightRadius"]
|
|
244
|
+
};
|
|
245
|
+
case "rounded-bl":
|
|
246
|
+
return {
|
|
247
|
+
key: "borderRadius",
|
|
248
|
+
props: ["borderBottomLeftRadius"]
|
|
249
|
+
};
|
|
250
|
+
case "rounded-br":
|
|
251
|
+
return {
|
|
252
|
+
key: "borderRadius",
|
|
253
|
+
props: ["borderBottomRightRadius"]
|
|
254
|
+
};
|
|
255
|
+
case "translate-x":
|
|
256
|
+
return {
|
|
257
|
+
key: "translate",
|
|
258
|
+
props: [
|
|
259
|
+
"--tw-translate-x",
|
|
260
|
+
{ "@defaults transform": {} },
|
|
261
|
+
{ transform: N }
|
|
262
|
+
]
|
|
263
|
+
};
|
|
264
|
+
case "translate-y":
|
|
265
|
+
return {
|
|
266
|
+
key: "translate",
|
|
267
|
+
props: [
|
|
268
|
+
"--tw-translate-y",
|
|
269
|
+
{ "@defaults transform": {} },
|
|
270
|
+
{ transform: N }
|
|
271
|
+
]
|
|
272
|
+
};
|
|
273
|
+
case "stroke":
|
|
274
|
+
return {
|
|
275
|
+
key: "strokeWidth",
|
|
276
|
+
props: ["strokeWidth"]
|
|
277
|
+
};
|
|
278
|
+
case "leading":
|
|
279
|
+
return {
|
|
280
|
+
key: "lineHeight",
|
|
281
|
+
props: ["lineHeight"]
|
|
282
|
+
};
|
|
283
|
+
case "border":
|
|
284
|
+
return {
|
|
285
|
+
key: "borderWidth",
|
|
286
|
+
props: ["borderWidth"]
|
|
287
|
+
};
|
|
288
|
+
case "border-t":
|
|
289
|
+
return {
|
|
290
|
+
key: "borderWidth",
|
|
291
|
+
props: ["borderTopWidth"]
|
|
292
|
+
};
|
|
293
|
+
case "border-b":
|
|
294
|
+
return {
|
|
295
|
+
key: "borderWidth",
|
|
296
|
+
props: ["borderBottomWidth"]
|
|
297
|
+
};
|
|
298
|
+
case "border-l":
|
|
299
|
+
return {
|
|
300
|
+
key: "borderWidth",
|
|
301
|
+
props: ["borderLeftWidth"]
|
|
302
|
+
};
|
|
303
|
+
case "border-r":
|
|
304
|
+
return {
|
|
305
|
+
key: "borderWidth",
|
|
306
|
+
props: ["borderRightWidth"]
|
|
307
|
+
};
|
|
308
|
+
case "border-x":
|
|
309
|
+
return {
|
|
310
|
+
key: "borderWidth",
|
|
311
|
+
props: ["borderLeftWidth", "borderRightWidth"]
|
|
312
|
+
};
|
|
313
|
+
case "border-y":
|
|
314
|
+
return {
|
|
315
|
+
key: "borderWidth",
|
|
316
|
+
props: ["borderTopWidth", "borderBottomWidth"]
|
|
317
|
+
};
|
|
318
|
+
case "scroll-m":
|
|
319
|
+
return {
|
|
320
|
+
key: "scrollMargin",
|
|
321
|
+
props: ["scrollMargin"]
|
|
322
|
+
};
|
|
323
|
+
default:
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
}, P = 10, z = (r = 0) => (e) => `\x1B[${e + r}m`, _ = (r = 0) => (e) => `\x1B[${38 + r};5;${e}m`, H = (r = 0) => (e, n, t) => `\x1B[${38 + r};2;${e};${n};${t}m`, a = {
|
|
327
|
+
modifier: {
|
|
328
|
+
reset: [0, 0],
|
|
329
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
330
|
+
bold: [1, 22],
|
|
331
|
+
dim: [2, 22],
|
|
332
|
+
italic: [3, 23],
|
|
333
|
+
underline: [4, 24],
|
|
334
|
+
overline: [53, 55],
|
|
335
|
+
inverse: [7, 27],
|
|
336
|
+
hidden: [8, 28],
|
|
337
|
+
strikethrough: [9, 29]
|
|
338
|
+
},
|
|
339
|
+
color: {
|
|
340
|
+
black: [30, 39],
|
|
341
|
+
red: [31, 39],
|
|
342
|
+
green: [32, 39],
|
|
343
|
+
yellow: [33, 39],
|
|
344
|
+
blue: [34, 39],
|
|
345
|
+
magenta: [35, 39],
|
|
346
|
+
cyan: [36, 39],
|
|
347
|
+
white: [37, 39],
|
|
348
|
+
// Bright color
|
|
349
|
+
blackBright: [90, 39],
|
|
350
|
+
gray: [90, 39],
|
|
351
|
+
// Alias of `blackBright`
|
|
352
|
+
grey: [90, 39],
|
|
353
|
+
// Alias of `blackBright`
|
|
354
|
+
redBright: [91, 39],
|
|
355
|
+
greenBright: [92, 39],
|
|
356
|
+
yellowBright: [93, 39],
|
|
357
|
+
blueBright: [94, 39],
|
|
358
|
+
magentaBright: [95, 39],
|
|
359
|
+
cyanBright: [96, 39],
|
|
360
|
+
whiteBright: [97, 39]
|
|
361
|
+
},
|
|
362
|
+
bgColor: {
|
|
363
|
+
bgBlack: [40, 49],
|
|
364
|
+
bgRed: [41, 49],
|
|
365
|
+
bgGreen: [42, 49],
|
|
366
|
+
bgYellow: [43, 49],
|
|
367
|
+
bgBlue: [44, 49],
|
|
368
|
+
bgMagenta: [45, 49],
|
|
369
|
+
bgCyan: [46, 49],
|
|
370
|
+
bgWhite: [47, 49],
|
|
371
|
+
// Bright color
|
|
372
|
+
bgBlackBright: [100, 49],
|
|
373
|
+
bgGray: [100, 49],
|
|
374
|
+
// Alias of `bgBlackBright`
|
|
375
|
+
bgGrey: [100, 49],
|
|
376
|
+
// Alias of `bgBlackBright`
|
|
377
|
+
bgRedBright: [101, 49],
|
|
378
|
+
bgGreenBright: [102, 49],
|
|
379
|
+
bgYellowBright: [103, 49],
|
|
380
|
+
bgBlueBright: [104, 49],
|
|
381
|
+
bgMagentaBright: [105, 49],
|
|
382
|
+
bgCyanBright: [106, 49],
|
|
383
|
+
bgWhiteBright: [107, 49]
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
Object.keys(a.modifier);
|
|
387
|
+
const ne = Object.keys(a.color), oe = Object.keys(a.bgColor);
|
|
388
|
+
[...ne, ...oe];
|
|
389
|
+
function se() {
|
|
390
|
+
const r = /* @__PURE__ */ new Map();
|
|
391
|
+
for (const [e, n] of Object.entries(a)) {
|
|
392
|
+
for (const [t, o] of Object.entries(n))
|
|
393
|
+
a[t] = {
|
|
394
|
+
open: `\x1B[${o[0]}m`,
|
|
395
|
+
close: `\x1B[${o[1]}m`
|
|
396
|
+
}, n[t] = a[t], r.set(o[0], o[1]);
|
|
397
|
+
Object.defineProperty(a, e, {
|
|
398
|
+
value: n,
|
|
399
|
+
enumerable: !1
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
return Object.defineProperty(a, "codes", {
|
|
403
|
+
value: r,
|
|
404
|
+
enumerable: !1
|
|
405
|
+
}), a.color.close = "\x1B[39m", a.bgColor.close = "\x1B[49m", a.color.ansi = z(), a.color.ansi256 = _(), a.color.ansi16m = H(), a.bgColor.ansi = z(P), a.bgColor.ansi256 = _(P), a.bgColor.ansi16m = H(P), Object.defineProperties(a, {
|
|
406
|
+
rgbToAnsi256: {
|
|
407
|
+
value(e, n, t) {
|
|
408
|
+
return e === n && n === t ? e < 8 ? 16 : e > 248 ? 231 : Math.round((e - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(e / 255 * 5) + 6 * Math.round(n / 255 * 5) + Math.round(t / 255 * 5);
|
|
409
|
+
},
|
|
410
|
+
enumerable: !1
|
|
411
|
+
},
|
|
412
|
+
hexToRgb: {
|
|
413
|
+
value(e) {
|
|
414
|
+
const n = /[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));
|
|
415
|
+
if (!n)
|
|
416
|
+
return [0, 0, 0];
|
|
417
|
+
let [t] = n;
|
|
418
|
+
t.length === 3 && (t = [...t].map((s) => s + s).join(""));
|
|
419
|
+
const o = Number.parseInt(t, 16);
|
|
420
|
+
return [
|
|
421
|
+
/* eslint-disable no-bitwise */
|
|
422
|
+
o >> 16 & 255,
|
|
423
|
+
o >> 8 & 255,
|
|
424
|
+
o & 255
|
|
425
|
+
/* eslint-enable no-bitwise */
|
|
426
|
+
];
|
|
427
|
+
},
|
|
428
|
+
enumerable: !1
|
|
429
|
+
},
|
|
430
|
+
hexToAnsi256: {
|
|
431
|
+
value: (e) => a.rgbToAnsi256(...a.hexToRgb(e)),
|
|
432
|
+
enumerable: !1
|
|
433
|
+
},
|
|
434
|
+
ansi256ToAnsi: {
|
|
435
|
+
value(e) {
|
|
436
|
+
if (e < 8)
|
|
437
|
+
return 30 + e;
|
|
438
|
+
if (e < 16)
|
|
439
|
+
return 90 + (e - 8);
|
|
440
|
+
let n, t, o;
|
|
441
|
+
if (e >= 232)
|
|
442
|
+
n = ((e - 232) * 10 + 8) / 255, t = n, o = n;
|
|
443
|
+
else {
|
|
444
|
+
e -= 16;
|
|
445
|
+
const u = e % 36;
|
|
446
|
+
n = Math.floor(e / 36) / 5, t = Math.floor(u / 6) / 5, o = u % 6 / 5;
|
|
447
|
+
}
|
|
448
|
+
const s = Math.max(n, t, o) * 2;
|
|
449
|
+
if (s === 0)
|
|
450
|
+
return 30;
|
|
451
|
+
let i = 30 + (Math.round(o) << 2 | Math.round(t) << 1 | Math.round(n));
|
|
452
|
+
return s === 2 && (i += 60), i;
|
|
453
|
+
},
|
|
454
|
+
enumerable: !1
|
|
455
|
+
},
|
|
456
|
+
rgbToAnsi: {
|
|
457
|
+
value: (e, n, t) => a.ansi256ToAnsi(a.rgbToAnsi256(e, n, t)),
|
|
458
|
+
enumerable: !1
|
|
459
|
+
},
|
|
460
|
+
hexToAnsi: {
|
|
461
|
+
value: (e) => a.ansi256ToAnsi(a.hexToAnsi256(e)),
|
|
462
|
+
enumerable: !1
|
|
463
|
+
}
|
|
464
|
+
}), a;
|
|
465
|
+
}
|
|
466
|
+
const c = se(), $ = (() => {
|
|
467
|
+
if (navigator.userAgentData) {
|
|
468
|
+
const r = navigator.userAgentData.brands.find(({ brand: e }) => e === "Chromium");
|
|
469
|
+
if (r && r.version > 93)
|
|
470
|
+
return 3;
|
|
471
|
+
}
|
|
472
|
+
return /\b(Chrome|Chromium)\//.test(navigator.userAgent) ? 1 : 0;
|
|
473
|
+
})(), G = $ !== 0 && {
|
|
474
|
+
level: $,
|
|
475
|
+
hasBasic: !0,
|
|
476
|
+
has256: $ >= 2,
|
|
477
|
+
has16m: $ >= 3
|
|
478
|
+
}, ie = {
|
|
479
|
+
stdout: G,
|
|
480
|
+
stderr: G
|
|
481
|
+
};
|
|
482
|
+
function ae(r, e, n) {
|
|
483
|
+
let t = r.indexOf(e);
|
|
484
|
+
if (t === -1)
|
|
485
|
+
return r;
|
|
486
|
+
const o = e.length;
|
|
487
|
+
let s = 0, i = "";
|
|
488
|
+
do
|
|
489
|
+
i += r.slice(s, t) + e + n, s = t + o, t = r.indexOf(e, s);
|
|
490
|
+
while (t !== -1);
|
|
491
|
+
return i += r.slice(s), i;
|
|
492
|
+
}
|
|
493
|
+
function ue(r, e, n, t) {
|
|
494
|
+
let o = 0, s = "";
|
|
495
|
+
do {
|
|
496
|
+
const i = r[t - 1] === "\r";
|
|
497
|
+
s += r.slice(o, i ? t - 1 : t) + e + (i ? `\r
|
|
498
|
+
` : `
|
|
499
|
+
`) + n, o = t + 1, t = r.indexOf(`
|
|
500
|
+
`, o);
|
|
501
|
+
} while (t !== -1);
|
|
502
|
+
return s += r.slice(o), s;
|
|
503
|
+
}
|
|
504
|
+
const { stdout: I, stderr: Y } = ie, C = Symbol("GENERATOR"), m = Symbol("STYLER"), x = Symbol("IS_EMPTY"), D = [
|
|
505
|
+
"ansi",
|
|
506
|
+
"ansi",
|
|
507
|
+
"ansi256",
|
|
508
|
+
"ansi16m"
|
|
509
|
+
], f = /* @__PURE__ */ Object.create(null), le = (r, e = {}) => {
|
|
510
|
+
if (e.level && !(Number.isInteger(e.level) && e.level >= 0 && e.level <= 3))
|
|
511
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
512
|
+
const n = I ? I.level : 0;
|
|
513
|
+
r.level = e.level === void 0 ? n : e.level;
|
|
514
|
+
}, ce = (r) => {
|
|
515
|
+
const e = (...n) => n.join(" ");
|
|
516
|
+
return le(e, r), Object.setPrototypeOf(e, B.prototype), e;
|
|
517
|
+
};
|
|
518
|
+
function B(r) {
|
|
519
|
+
return ce(r);
|
|
520
|
+
}
|
|
521
|
+
Object.setPrototypeOf(B.prototype, Function.prototype);
|
|
522
|
+
for (const [r, e] of Object.entries(c))
|
|
523
|
+
f[r] = {
|
|
524
|
+
get() {
|
|
525
|
+
const n = A(this, F(e.open, e.close, this[m]), this[x]);
|
|
526
|
+
return Object.defineProperty(this, r, { value: n }), n;
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
f.visible = {
|
|
530
|
+
get() {
|
|
531
|
+
const r = A(this, this[m], !0);
|
|
532
|
+
return Object.defineProperty(this, "visible", { value: r }), r;
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
const V = (r, e, n, ...t) => r === "rgb" ? e === "ansi16m" ? c[n].ansi16m(...t) : e === "ansi256" ? c[n].ansi256(c.rgbToAnsi256(...t)) : c[n].ansi(c.rgbToAnsi(...t)) : r === "hex" ? V("rgb", e, n, ...c.hexToRgb(...t)) : c[n][r](...t), de = ["rgb", "hex", "ansi256"];
|
|
536
|
+
for (const r of de) {
|
|
537
|
+
f[r] = {
|
|
538
|
+
get() {
|
|
539
|
+
const { level: n } = this;
|
|
540
|
+
return function(...t) {
|
|
541
|
+
const o = F(V(r, D[n], "color", ...t), c.color.close, this[m]);
|
|
542
|
+
return A(this, o, this[x]);
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
const e = "bg" + r[0].toUpperCase() + r.slice(1);
|
|
547
|
+
f[e] = {
|
|
548
|
+
get() {
|
|
549
|
+
const { level: n } = this;
|
|
550
|
+
return function(...t) {
|
|
551
|
+
const o = F(V(r, D[n], "bgColor", ...t), c.bgColor.close, this[m]);
|
|
552
|
+
return A(this, o, this[x]);
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
const pe = Object.defineProperties(() => {
|
|
558
|
+
}, {
|
|
559
|
+
...f,
|
|
560
|
+
level: {
|
|
561
|
+
enumerable: !0,
|
|
562
|
+
get() {
|
|
563
|
+
return this[C].level;
|
|
564
|
+
},
|
|
565
|
+
set(r) {
|
|
566
|
+
this[C].level = r;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}), F = (r, e, n) => {
|
|
570
|
+
let t, o;
|
|
571
|
+
return n === void 0 ? (t = r, o = e) : (t = n.openAll + r, o = e + n.closeAll), {
|
|
572
|
+
open: r,
|
|
573
|
+
close: e,
|
|
574
|
+
openAll: t,
|
|
575
|
+
closeAll: o,
|
|
576
|
+
parent: n
|
|
577
|
+
};
|
|
578
|
+
}, A = (r, e, n) => {
|
|
579
|
+
const t = (...o) => he(t, o.length === 1 ? "" + o[0] : o.join(" "));
|
|
580
|
+
return Object.setPrototypeOf(t, pe), t[C] = r, t[m] = e, t[x] = n, t;
|
|
581
|
+
}, he = (r, e) => {
|
|
582
|
+
if (r.level <= 0 || !e)
|
|
583
|
+
return r[x] ? "" : e;
|
|
584
|
+
let n = r[m];
|
|
585
|
+
if (n === void 0)
|
|
586
|
+
return e;
|
|
587
|
+
const { openAll: t, closeAll: o } = n;
|
|
588
|
+
if (e.includes("\x1B"))
|
|
589
|
+
for (; n !== void 0; )
|
|
590
|
+
e = ae(e, n.close, n.open), n = n.parent;
|
|
591
|
+
const s = e.indexOf(`
|
|
592
|
+
`);
|
|
593
|
+
return s !== -1 && (e = ue(e, o, t, s)), t + e + o;
|
|
594
|
+
};
|
|
595
|
+
Object.defineProperties(B.prototype, f);
|
|
596
|
+
const T = B();
|
|
597
|
+
B({ level: Y ? Y.level : 0 });
|
|
598
|
+
const R = {
|
|
599
|
+
error() {
|
|
600
|
+
console.log(T.red(...arguments));
|
|
601
|
+
},
|
|
602
|
+
warn() {
|
|
603
|
+
console.log(T.yellow(...arguments));
|
|
604
|
+
},
|
|
605
|
+
info() {
|
|
606
|
+
console.log(T.blue(...arguments));
|
|
607
|
+
},
|
|
608
|
+
log() {
|
|
609
|
+
console.log(T.gray(...arguments));
|
|
610
|
+
}
|
|
611
|
+
}, d = (r) => {
|
|
612
|
+
const e = `${r}`, n = parseFloat(e);
|
|
613
|
+
let t = "unsupported";
|
|
614
|
+
/^\d+$/.test(e) && n !== 0 && (t = "px");
|
|
615
|
+
const o = e.match(/px|rem|em/);
|
|
616
|
+
return o && (t = o[0]), n === 0 && (t = "zero"), { number: n, unit: t };
|
|
617
|
+
}, U = (r) => {
|
|
618
|
+
const e = {};
|
|
619
|
+
return typeof r == "string" ? e.fontSize = d(r) : Array.isArray(r) && (e.fontSize = d(r[0]), typeof r[1] == "string" ? e.lineHeight = d(r[1]) : typeof r[1] == "object" && ("lineHeight" in r[1] && (e.lineHeight = d(r[1].lineHeight)), "letterSpacing" in r[1] && (e.letterSpacing = d(r[1].letterSpacing)))), e;
|
|
620
|
+
}, q = (r, e, n, t = null) => r.number === e.number ? (R.error(
|
|
621
|
+
`Same value for start an end${t ? ` (${t})` : ""}: "clamp-[${n}]".`
|
|
622
|
+
), null) : r.unit !== e.unit && r.unit !== "zero" && e.unit !== "zero" ? (R.error(
|
|
623
|
+
`Units need to match${t ? ` (${t})` : ""}: "clamp-[${n}]".`
|
|
624
|
+
), null) : r.unit === "unsupported" || e.unit === "unsupported" ? (R.error(
|
|
625
|
+
`Only px, rem and em units are supported${t ? ` (${t})` : ""}: "clamp-[${n}]".`
|
|
626
|
+
), null) : !0, L = (r, e, n = { number: 375, unit: "px" }, t = { number: 1440, unit: "px" }) => {
|
|
627
|
+
const o = r.unit === "zero" ? e.unit : r.unit, s = o === "px";
|
|
628
|
+
let i = r.number, u = e.number, h = !1, l = n.number, y = t.number;
|
|
629
|
+
n.unit !== "px" && s && (l = n.number * 16), n.unit === "px" && !s && (l = n.number / 16), t.unit !== "px" && s && (y = t.number * 16), t.unit === "px" && !s && (y = t.number / 16), u < i && i < 0 && u < 0 ? (i = Math.abs(i), u = Math.abs(u), h = !0) : u < i && i > 0 && u > 0 ? (i = i * -1, u = u * -1, h = !0) : u < i && (i = Math.abs(i) * -1, u = Math.abs(u), h = !0);
|
|
630
|
+
const k = (u - i) / (y - l), O = `${(i - l * k).toFixed(6)}${o} + ${(100 * k).toFixed(6)}vw`, w = `clamp(${i}${o}, ${O}, ${u}${o})`;
|
|
631
|
+
return h ? `calc(${w} * -1)` : w;
|
|
632
|
+
}, be = {
|
|
633
|
+
unit: "rem",
|
|
634
|
+
minViewportWidth: 375,
|
|
635
|
+
maxViewportWidth: 1440
|
|
636
|
+
}, ge = (r, e, n = {
|
|
637
|
+
unit: "rem",
|
|
638
|
+
minViewportWidth: 375,
|
|
639
|
+
maxViewportWidth: 1440
|
|
640
|
+
}) => {
|
|
641
|
+
const t = { ...be, ...n }, o = (s) => t.unit === "rem" ? s / 16 : s;
|
|
642
|
+
return L(
|
|
643
|
+
{ number: o(r), unit: t.unit },
|
|
644
|
+
{ number: o(e), unit: t.unit },
|
|
645
|
+
{ number: o(t.minViewportWidth), unit: t.unit },
|
|
646
|
+
{ number: o(t.maxViewportWidth), unit: t.unit }
|
|
647
|
+
);
|
|
648
|
+
}, S = {
|
|
649
|
+
minViewportWidth: 375,
|
|
650
|
+
maxViewportWidth: 1440
|
|
651
|
+
}, fe = ge, ye = re.withOptions(function(r = S) {
|
|
652
|
+
return function({ matchUtilities: e, theme: n, config: t }) {
|
|
653
|
+
e(
|
|
654
|
+
{
|
|
655
|
+
clamp: (o) => {
|
|
656
|
+
const s = o.split(","), i = d(
|
|
657
|
+
t().theme.screens[s[3]] || s[3] || r.minViewportWidth || S.minViewportWidth
|
|
658
|
+
), u = d(
|
|
659
|
+
t().theme.screens[s[4]] || s[4] || r.maxViewportWidth || S.maxViewportWidth
|
|
660
|
+
);
|
|
661
|
+
if (s.length < 3)
|
|
662
|
+
return R.error(
|
|
663
|
+
`The clamp utility requires at least 3 arguments: "clamp-[${o}]".`
|
|
664
|
+
), null;
|
|
665
|
+
const h = te(s[0]);
|
|
666
|
+
if (!h)
|
|
667
|
+
return R.error(
|
|
668
|
+
`Property "${s[0]}" is not supported: "clamp-[${o}]".`
|
|
669
|
+
), null;
|
|
670
|
+
const { key: l, props: y } = h;
|
|
671
|
+
if (l === "fontSize") {
|
|
672
|
+
const p = U(
|
|
673
|
+
t().theme[l][s[1]] || s[1]
|
|
674
|
+
), b = U(
|
|
675
|
+
t().theme[l][s[2]] || s[2]
|
|
676
|
+
), M = {};
|
|
677
|
+
return Object.keys(p).forEach((g) => {
|
|
678
|
+
if (g in b && q(p[g], b[g], o, g)) {
|
|
679
|
+
const Q = L(p[g], b[g], i, u);
|
|
680
|
+
M[g] = Q;
|
|
681
|
+
}
|
|
682
|
+
}), Object.keys(M).length > 0 ? M : null;
|
|
683
|
+
}
|
|
684
|
+
const k = s[1].startsWith("-"), O = s[2].startsWith("-"), w = k ? s[1].slice(1) : s[1], E = O ? s[2].slice(1) : s[2], v = d(t().theme[l][w] || w), W = d(t().theme[l][E] || E);
|
|
685
|
+
if (k && (v.number = v.number * -1), O && (W.number = W.number * -1), !q(v, W, o))
|
|
686
|
+
return null;
|
|
687
|
+
const J = L(v, W, i, u);
|
|
688
|
+
return y.reduce((p, b) => (typeof b == "string" ? p[b] = J : p = { ...p, ...b }, p), {});
|
|
689
|
+
}
|
|
690
|
+
},
|
|
691
|
+
{ values: n("clamp") }
|
|
692
|
+
);
|
|
693
|
+
};
|
|
694
|
+
});
|
|
695
|
+
export {
|
|
696
|
+
fe as clampValue,
|
|
697
|
+
ye as tailwindClamp
|
|
698
|
+
};
|
|
699
|
+
//# sourceMappingURL=index.js.map
|