ra-element 0.0.10 → 0.0.11

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,834 +0,0 @@
1
- import { b as ut, u as ct, a as ht, c as dt, d as gt, l as bt, i as L, e as K, _ as et, E as Z, w as vt, f as pt } from "./index-BpWzWPr8.js";
2
- import { inject as _, computed as h, unref as c, getCurrentInstance as mt, ref as W, useSlots as yt, Text as kt, defineComponent as R, createBlock as B, openBlock as y, resolveDynamicComponent as $, mergeProps as rt, withCtx as A, createElementBlock as V, createCommentVNode as G, Fragment as St, renderSlot as w, normalizeClass as j, provide as xt, reactive as Mt, toRef as J, createSlots as wt } from "vue";
3
- const _t = ["", "default", "small", "large"], Bt = ut({
4
- type: String,
5
- values: _t,
6
- required: !1
7
- }), At = Symbol("size"), Ht = () => {
8
- const r = _(At, {});
9
- return h(() => c(r.size) || "");
10
- }, q = Symbol("formContextKey"), nt = Symbol("formItemContextKey"), Rt = () => {
11
- const r = _(q, void 0), e = _(nt, void 0);
12
- return {
13
- form: r,
14
- formItem: e
15
- };
16
- }, at = (r) => {
17
- const e = mt();
18
- return h(() => {
19
- var t, n;
20
- return (n = (t = e?.proxy) == null ? void 0 : t.$props) == null ? void 0 : n[r];
21
- });
22
- }, It = (r, e = {}) => {
23
- const t = W(void 0), n = e.prop ? t : at("size"), a = e.global ? t : Ht(), o = e.form ? { size: void 0 } : _(q, void 0), i = e.formItem ? { size: void 0 } : _(nt, void 0);
24
- return h(() => n.value || c(r) || i?.size || o?.size || a.value || "");
25
- }, ot = (r) => {
26
- const e = at("disabled"), t = _(q, void 0);
27
- return h(() => e.value || c(r) || t?.disabled || !1);
28
- }, it = Symbol("buttonGroupContextKey"), Tt = (r, e) => {
29
- ct({
30
- from: "type.text",
31
- replacement: "link",
32
- version: "3.0.0",
33
- scope: "props",
34
- ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
35
- }, h(() => r.type === "text"));
36
- const t = _(it, void 0), n = ht("button"), { form: a } = Rt(), o = It(h(() => t?.size)), i = ot(), s = W(), l = yt(), p = h(() => {
37
- var f;
38
- return r.type || t?.type || ((f = n.value) == null ? void 0 : f.type) || "";
39
- }), k = h(() => {
40
- var f, d, b;
41
- return (b = (d = r.autoInsertSpace) != null ? d : (f = n.value) == null ? void 0 : f.autoInsertSpace) != null ? b : !1;
42
- }), H = h(() => {
43
- var f, d, b;
44
- return (b = (d = r.plain) != null ? d : (f = n.value) == null ? void 0 : f.plain) != null ? b : !1;
45
- }), N = h(() => {
46
- var f, d, b;
47
- return (b = (d = r.round) != null ? d : (f = n.value) == null ? void 0 : f.round) != null ? b : !1;
48
- }), I = h(() => r.tag === "button" ? {
49
- ariaDisabled: i.value || r.loading,
50
- disabled: i.value || r.loading,
51
- autofocus: r.autofocus,
52
- type: r.nativeType
53
- } : {}), F = h(() => {
54
- var f;
55
- const d = (f = l.default) == null ? void 0 : f.call(l);
56
- if (k.value && d?.length === 1) {
57
- const b = d[0];
58
- if (b?.type === kt) {
59
- const lt = b.children;
60
- return new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(lt.trim());
61
- }
62
- }
63
- return !1;
64
- });
65
- return {
66
- _disabled: i,
67
- _size: o,
68
- _type: p,
69
- _ref: s,
70
- _props: I,
71
- _plain: H,
72
- _round: N,
73
- shouldAddSpace: F,
74
- handleClick: (f) => {
75
- if (i.value || r.loading) {
76
- f.stopPropagation();
77
- return;
78
- }
79
- r.nativeType === "reset" && a?.resetFields(), e("click", f);
80
- }
81
- };
82
- }, Ct = [
83
- "default",
84
- "primary",
85
- "success",
86
- "warning",
87
- "info",
88
- "danger",
89
- "text",
90
- ""
91
- ], Nt = ["button", "submit", "reset"], O = dt({
92
- size: Bt,
93
- disabled: Boolean,
94
- type: {
95
- type: String,
96
- values: Ct,
97
- default: ""
98
- },
99
- icon: {
100
- type: L
101
- },
102
- nativeType: {
103
- type: String,
104
- values: Nt,
105
- default: "button"
106
- },
107
- loading: Boolean,
108
- loadingIcon: {
109
- type: L,
110
- default: () => bt
111
- },
112
- plain: {
113
- type: Boolean,
114
- default: void 0
115
- },
116
- text: Boolean,
117
- link: Boolean,
118
- bg: Boolean,
119
- autofocus: Boolean,
120
- round: {
121
- type: Boolean,
122
- default: void 0
123
- },
124
- circle: Boolean,
125
- color: String,
126
- dark: Boolean,
127
- autoInsertSpace: {
128
- type: Boolean,
129
- default: void 0
130
- },
131
- tag: {
132
- type: gt([String, Object]),
133
- default: "button"
134
- }
135
- }), Ft = {
136
- click: (r) => r instanceof MouseEvent
137
- };
138
- function u(r, e) {
139
- $t(r) && (r = "100%");
140
- var t = Et(r);
141
- return r = e === 360 ? r : Math.min(e, Math.max(0, parseFloat(r))), t && (r = parseInt(String(r * e), 10) / 100), Math.abs(r - e) < 1e-6 ? 1 : (e === 360 ? r = (r < 0 ? r % e + e : r % e) / parseFloat(String(e)) : r = r % e / parseFloat(String(e)), r);
142
- }
143
- function T(r) {
144
- return Math.min(1, Math.max(0, r));
145
- }
146
- function $t(r) {
147
- return typeof r == "string" && r.indexOf(".") !== -1 && parseFloat(r) === 1;
148
- }
149
- function Et(r) {
150
- return typeof r == "string" && r.indexOf("%") !== -1;
151
- }
152
- function st(r) {
153
- return r = parseFloat(r), (isNaN(r) || r < 0 || r > 1) && (r = 1), r;
154
- }
155
- function C(r) {
156
- return r <= 1 ? "".concat(Number(r) * 100, "%") : r;
157
- }
158
- function M(r) {
159
- return r.length === 1 ? "0" + r : String(r);
160
- }
161
- function zt(r, e, t) {
162
- return {
163
- r: u(r, 255) * 255,
164
- g: u(e, 255) * 255,
165
- b: u(t, 255) * 255
166
- };
167
- }
168
- function Y(r, e, t) {
169
- r = u(r, 255), e = u(e, 255), t = u(t, 255);
170
- var n = Math.max(r, e, t), a = Math.min(r, e, t), o = 0, i = 0, s = (n + a) / 2;
171
- if (n === a)
172
- i = 0, o = 0;
173
- else {
174
- var l = n - a;
175
- switch (i = s > 0.5 ? l / (2 - n - a) : l / (n + a), n) {
176
- case r:
177
- o = (e - t) / l + (e < t ? 6 : 0);
178
- break;
179
- case e:
180
- o = (t - r) / l + 2;
181
- break;
182
- case t:
183
- o = (r - e) / l + 4;
184
- break;
185
- }
186
- o /= 6;
187
- }
188
- return { h: o, s: i, l: s };
189
- }
190
- function E(r, e, t) {
191
- return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? r + (e - r) * (6 * t) : t < 1 / 2 ? e : t < 2 / 3 ? r + (e - r) * (2 / 3 - t) * 6 : r;
192
- }
193
- function Pt(r, e, t) {
194
- var n, a, o;
195
- if (r = u(r, 360), e = u(e, 100), t = u(t, 100), e === 0)
196
- a = t, o = t, n = t;
197
- else {
198
- var i = t < 0.5 ? t * (1 + e) : t + e - t * e, s = 2 * t - i;
199
- n = E(s, i, r + 1 / 3), a = E(s, i, r), o = E(s, i, r - 1 / 3);
200
- }
201
- return { r: n * 255, g: a * 255, b: o * 255 };
202
- }
203
- function Q(r, e, t) {
204
- r = u(r, 255), e = u(e, 255), t = u(t, 255);
205
- var n = Math.max(r, e, t), a = Math.min(r, e, t), o = 0, i = n, s = n - a, l = n === 0 ? 0 : s / n;
206
- if (n === a)
207
- o = 0;
208
- else {
209
- switch (n) {
210
- case r:
211
- o = (e - t) / s + (e < t ? 6 : 0);
212
- break;
213
- case e:
214
- o = (t - r) / s + 2;
215
- break;
216
- case t:
217
- o = (r - e) / s + 4;
218
- break;
219
- }
220
- o /= 6;
221
- }
222
- return { h: o, s: l, v: i };
223
- }
224
- function Vt(r, e, t) {
225
- r = u(r, 360) * 6, e = u(e, 100), t = u(t, 100);
226
- var n = Math.floor(r), a = r - n, o = t * (1 - e), i = t * (1 - a * e), s = t * (1 - (1 - a) * e), l = n % 6, p = [t, i, o, o, s, t][l], k = [s, t, t, i, o, o][l], H = [o, o, s, t, t, i][l];
227
- return { r: p * 255, g: k * 255, b: H * 255 };
228
- }
229
- function X(r, e, t, n) {
230
- var a = [
231
- M(Math.round(r).toString(16)),
232
- M(Math.round(e).toString(16)),
233
- M(Math.round(t).toString(16))
234
- ];
235
- return n && a[0].startsWith(a[0].charAt(1)) && a[1].startsWith(a[1].charAt(1)) && a[2].startsWith(a[2].charAt(1)) ? a[0].charAt(0) + a[1].charAt(0) + a[2].charAt(0) : a.join("");
236
- }
237
- function Gt(r, e, t, n, a) {
238
- var o = [
239
- M(Math.round(r).toString(16)),
240
- M(Math.round(e).toString(16)),
241
- M(Math.round(t).toString(16)),
242
- M(jt(n))
243
- ];
244
- return a && o[0].startsWith(o[0].charAt(1)) && o[1].startsWith(o[1].charAt(1)) && o[2].startsWith(o[2].charAt(1)) && o[3].startsWith(o[3].charAt(1)) ? o[0].charAt(0) + o[1].charAt(0) + o[2].charAt(0) + o[3].charAt(0) : o.join("");
245
- }
246
- function jt(r) {
247
- return Math.round(parseFloat(r) * 255).toString(16);
248
- }
249
- function tt(r) {
250
- return g(r) / 255;
251
- }
252
- function g(r) {
253
- return parseInt(r, 16);
254
- }
255
- function Ot(r) {
256
- return {
257
- r: r >> 16,
258
- g: (r & 65280) >> 8,
259
- b: r & 255
260
- };
261
- }
262
- var D = {
263
- aliceblue: "#f0f8ff",
264
- antiquewhite: "#faebd7",
265
- aqua: "#00ffff",
266
- aquamarine: "#7fffd4",
267
- azure: "#f0ffff",
268
- beige: "#f5f5dc",
269
- bisque: "#ffe4c4",
270
- black: "#000000",
271
- blanchedalmond: "#ffebcd",
272
- blue: "#0000ff",
273
- blueviolet: "#8a2be2",
274
- brown: "#a52a2a",
275
- burlywood: "#deb887",
276
- cadetblue: "#5f9ea0",
277
- chartreuse: "#7fff00",
278
- chocolate: "#d2691e",
279
- coral: "#ff7f50",
280
- cornflowerblue: "#6495ed",
281
- cornsilk: "#fff8dc",
282
- crimson: "#dc143c",
283
- cyan: "#00ffff",
284
- darkblue: "#00008b",
285
- darkcyan: "#008b8b",
286
- darkgoldenrod: "#b8860b",
287
- darkgray: "#a9a9a9",
288
- darkgreen: "#006400",
289
- darkgrey: "#a9a9a9",
290
- darkkhaki: "#bdb76b",
291
- darkmagenta: "#8b008b",
292
- darkolivegreen: "#556b2f",
293
- darkorange: "#ff8c00",
294
- darkorchid: "#9932cc",
295
- darkred: "#8b0000",
296
- darksalmon: "#e9967a",
297
- darkseagreen: "#8fbc8f",
298
- darkslateblue: "#483d8b",
299
- darkslategray: "#2f4f4f",
300
- darkslategrey: "#2f4f4f",
301
- darkturquoise: "#00ced1",
302
- darkviolet: "#9400d3",
303
- deeppink: "#ff1493",
304
- deepskyblue: "#00bfff",
305
- dimgray: "#696969",
306
- dimgrey: "#696969",
307
- dodgerblue: "#1e90ff",
308
- firebrick: "#b22222",
309
- floralwhite: "#fffaf0",
310
- forestgreen: "#228b22",
311
- fuchsia: "#ff00ff",
312
- gainsboro: "#dcdcdc",
313
- ghostwhite: "#f8f8ff",
314
- goldenrod: "#daa520",
315
- gold: "#ffd700",
316
- gray: "#808080",
317
- green: "#008000",
318
- greenyellow: "#adff2f",
319
- grey: "#808080",
320
- honeydew: "#f0fff0",
321
- hotpink: "#ff69b4",
322
- indianred: "#cd5c5c",
323
- indigo: "#4b0082",
324
- ivory: "#fffff0",
325
- khaki: "#f0e68c",
326
- lavenderblush: "#fff0f5",
327
- lavender: "#e6e6fa",
328
- lawngreen: "#7cfc00",
329
- lemonchiffon: "#fffacd",
330
- lightblue: "#add8e6",
331
- lightcoral: "#f08080",
332
- lightcyan: "#e0ffff",
333
- lightgoldenrodyellow: "#fafad2",
334
- lightgray: "#d3d3d3",
335
- lightgreen: "#90ee90",
336
- lightgrey: "#d3d3d3",
337
- lightpink: "#ffb6c1",
338
- lightsalmon: "#ffa07a",
339
- lightseagreen: "#20b2aa",
340
- lightskyblue: "#87cefa",
341
- lightslategray: "#778899",
342
- lightslategrey: "#778899",
343
- lightsteelblue: "#b0c4de",
344
- lightyellow: "#ffffe0",
345
- lime: "#00ff00",
346
- limegreen: "#32cd32",
347
- linen: "#faf0e6",
348
- magenta: "#ff00ff",
349
- maroon: "#800000",
350
- mediumaquamarine: "#66cdaa",
351
- mediumblue: "#0000cd",
352
- mediumorchid: "#ba55d3",
353
- mediumpurple: "#9370db",
354
- mediumseagreen: "#3cb371",
355
- mediumslateblue: "#7b68ee",
356
- mediumspringgreen: "#00fa9a",
357
- mediumturquoise: "#48d1cc",
358
- mediumvioletred: "#c71585",
359
- midnightblue: "#191970",
360
- mintcream: "#f5fffa",
361
- mistyrose: "#ffe4e1",
362
- moccasin: "#ffe4b5",
363
- navajowhite: "#ffdead",
364
- navy: "#000080",
365
- oldlace: "#fdf5e6",
366
- olive: "#808000",
367
- olivedrab: "#6b8e23",
368
- orange: "#ffa500",
369
- orangered: "#ff4500",
370
- orchid: "#da70d6",
371
- palegoldenrod: "#eee8aa",
372
- palegreen: "#98fb98",
373
- paleturquoise: "#afeeee",
374
- palevioletred: "#db7093",
375
- papayawhip: "#ffefd5",
376
- peachpuff: "#ffdab9",
377
- peru: "#cd853f",
378
- pink: "#ffc0cb",
379
- plum: "#dda0dd",
380
- powderblue: "#b0e0e6",
381
- purple: "#800080",
382
- rebeccapurple: "#663399",
383
- red: "#ff0000",
384
- rosybrown: "#bc8f8f",
385
- royalblue: "#4169e1",
386
- saddlebrown: "#8b4513",
387
- salmon: "#fa8072",
388
- sandybrown: "#f4a460",
389
- seagreen: "#2e8b57",
390
- seashell: "#fff5ee",
391
- sienna: "#a0522d",
392
- silver: "#c0c0c0",
393
- skyblue: "#87ceeb",
394
- slateblue: "#6a5acd",
395
- slategray: "#708090",
396
- slategrey: "#708090",
397
- snow: "#fffafa",
398
- springgreen: "#00ff7f",
399
- steelblue: "#4682b4",
400
- tan: "#d2b48c",
401
- teal: "#008080",
402
- thistle: "#d8bfd8",
403
- tomato: "#ff6347",
404
- turquoise: "#40e0d0",
405
- violet: "#ee82ee",
406
- wheat: "#f5deb3",
407
- white: "#ffffff",
408
- whitesmoke: "#f5f5f5",
409
- yellow: "#ffff00",
410
- yellowgreen: "#9acd32"
411
- };
412
- function Dt(r) {
413
- var e = { r: 0, g: 0, b: 0 }, t = 1, n = null, a = null, o = null, i = !1, s = !1;
414
- return typeof r == "string" && (r = qt(r)), typeof r == "object" && (m(r.r) && m(r.g) && m(r.b) ? (e = zt(r.r, r.g, r.b), i = !0, s = String(r.r).substr(-1) === "%" ? "prgb" : "rgb") : m(r.h) && m(r.s) && m(r.v) ? (n = C(r.s), a = C(r.v), e = Vt(r.h, n, a), i = !0, s = "hsv") : m(r.h) && m(r.s) && m(r.l) && (n = C(r.s), o = C(r.l), e = Pt(r.h, n, o), i = !0, s = "hsl"), Object.prototype.hasOwnProperty.call(r, "a") && (t = r.a)), t = st(t), {
415
- ok: i,
416
- format: r.format || s,
417
- r: Math.min(255, Math.max(e.r, 0)),
418
- g: Math.min(255, Math.max(e.g, 0)),
419
- b: Math.min(255, Math.max(e.b, 0)),
420
- a: t
421
- };
422
- }
423
- var Kt = "[-\\+]?\\d+%?", Wt = "[-\\+]?\\d*\\.\\d+%?", x = "(?:".concat(Wt, ")|(?:").concat(Kt, ")"), z = "[\\s|\\(]+(".concat(x, ")[,|\\s]+(").concat(x, ")[,|\\s]+(").concat(x, ")\\s*\\)?"), P = "[\\s|\\(]+(".concat(x, ")[,|\\s]+(").concat(x, ")[,|\\s]+(").concat(x, ")[,|\\s]+(").concat(x, ")\\s*\\)?"), v = {
424
- CSS_UNIT: new RegExp(x),
425
- rgb: new RegExp("rgb" + z),
426
- rgba: new RegExp("rgba" + P),
427
- hsl: new RegExp("hsl" + z),
428
- hsla: new RegExp("hsla" + P),
429
- hsv: new RegExp("hsv" + z),
430
- hsva: new RegExp("hsva" + P),
431
- hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
432
- hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
433
- hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
434
- hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
435
- };
436
- function qt(r) {
437
- if (r = r.trim().toLowerCase(), r.length === 0)
438
- return !1;
439
- var e = !1;
440
- if (D[r])
441
- r = D[r], e = !0;
442
- else if (r === "transparent")
443
- return { r: 0, g: 0, b: 0, a: 0, format: "name" };
444
- var t = v.rgb.exec(r);
445
- return t ? { r: t[1], g: t[2], b: t[3] } : (t = v.rgba.exec(r), t ? { r: t[1], g: t[2], b: t[3], a: t[4] } : (t = v.hsl.exec(r), t ? { h: t[1], s: t[2], l: t[3] } : (t = v.hsla.exec(r), t ? { h: t[1], s: t[2], l: t[3], a: t[4] } : (t = v.hsv.exec(r), t ? { h: t[1], s: t[2], v: t[3] } : (t = v.hsva.exec(r), t ? { h: t[1], s: t[2], v: t[3], a: t[4] } : (t = v.hex8.exec(r), t ? {
446
- r: g(t[1]),
447
- g: g(t[2]),
448
- b: g(t[3]),
449
- a: tt(t[4]),
450
- format: e ? "name" : "hex8"
451
- } : (t = v.hex6.exec(r), t ? {
452
- r: g(t[1]),
453
- g: g(t[2]),
454
- b: g(t[3]),
455
- format: e ? "name" : "hex"
456
- } : (t = v.hex4.exec(r), t ? {
457
- r: g(t[1] + t[1]),
458
- g: g(t[2] + t[2]),
459
- b: g(t[3] + t[3]),
460
- a: tt(t[4] + t[4]),
461
- format: e ? "name" : "hex8"
462
- } : (t = v.hex3.exec(r), t ? {
463
- r: g(t[1] + t[1]),
464
- g: g(t[2] + t[2]),
465
- b: g(t[3] + t[3]),
466
- format: e ? "name" : "hex"
467
- } : !1)))))))));
468
- }
469
- function m(r) {
470
- return !!v.CSS_UNIT.exec(String(r));
471
- }
472
- var Ut = (
473
- /** @class */
474
- function() {
475
- function r(e, t) {
476
- e === void 0 && (e = ""), t === void 0 && (t = {});
477
- var n;
478
- if (e instanceof r)
479
- return e;
480
- typeof e == "number" && (e = Ot(e)), this.originalInput = e;
481
- var a = Dt(e);
482
- this.originalInput = e, this.r = a.r, this.g = a.g, this.b = a.b, this.a = a.a, this.roundA = Math.round(100 * this.a) / 100, this.format = (n = t.format) !== null && n !== void 0 ? n : a.format, this.gradientType = t.gradientType, this.r < 1 && (this.r = Math.round(this.r)), this.g < 1 && (this.g = Math.round(this.g)), this.b < 1 && (this.b = Math.round(this.b)), this.isValid = a.ok;
483
- }
484
- return r.prototype.isDark = function() {
485
- return this.getBrightness() < 128;
486
- }, r.prototype.isLight = function() {
487
- return !this.isDark();
488
- }, r.prototype.getBrightness = function() {
489
- var e = this.toRgb();
490
- return (e.r * 299 + e.g * 587 + e.b * 114) / 1e3;
491
- }, r.prototype.getLuminance = function() {
492
- var e = this.toRgb(), t, n, a, o = e.r / 255, i = e.g / 255, s = e.b / 255;
493
- return o <= 0.03928 ? t = o / 12.92 : t = Math.pow((o + 0.055) / 1.055, 2.4), i <= 0.03928 ? n = i / 12.92 : n = Math.pow((i + 0.055) / 1.055, 2.4), s <= 0.03928 ? a = s / 12.92 : a = Math.pow((s + 0.055) / 1.055, 2.4), 0.2126 * t + 0.7152 * n + 0.0722 * a;
494
- }, r.prototype.getAlpha = function() {
495
- return this.a;
496
- }, r.prototype.setAlpha = function(e) {
497
- return this.a = st(e), this.roundA = Math.round(100 * this.a) / 100, this;
498
- }, r.prototype.isMonochrome = function() {
499
- var e = this.toHsl().s;
500
- return e === 0;
501
- }, r.prototype.toHsv = function() {
502
- var e = Q(this.r, this.g, this.b);
503
- return { h: e.h * 360, s: e.s, v: e.v, a: this.a };
504
- }, r.prototype.toHsvString = function() {
505
- var e = Q(this.r, this.g, this.b), t = Math.round(e.h * 360), n = Math.round(e.s * 100), a = Math.round(e.v * 100);
506
- return this.a === 1 ? "hsv(".concat(t, ", ").concat(n, "%, ").concat(a, "%)") : "hsva(".concat(t, ", ").concat(n, "%, ").concat(a, "%, ").concat(this.roundA, ")");
507
- }, r.prototype.toHsl = function() {
508
- var e = Y(this.r, this.g, this.b);
509
- return { h: e.h * 360, s: e.s, l: e.l, a: this.a };
510
- }, r.prototype.toHslString = function() {
511
- var e = Y(this.r, this.g, this.b), t = Math.round(e.h * 360), n = Math.round(e.s * 100), a = Math.round(e.l * 100);
512
- return this.a === 1 ? "hsl(".concat(t, ", ").concat(n, "%, ").concat(a, "%)") : "hsla(".concat(t, ", ").concat(n, "%, ").concat(a, "%, ").concat(this.roundA, ")");
513
- }, r.prototype.toHex = function(e) {
514
- return e === void 0 && (e = !1), X(this.r, this.g, this.b, e);
515
- }, r.prototype.toHexString = function(e) {
516
- return e === void 0 && (e = !1), "#" + this.toHex(e);
517
- }, r.prototype.toHex8 = function(e) {
518
- return e === void 0 && (e = !1), Gt(this.r, this.g, this.b, this.a, e);
519
- }, r.prototype.toHex8String = function(e) {
520
- return e === void 0 && (e = !1), "#" + this.toHex8(e);
521
- }, r.prototype.toHexShortString = function(e) {
522
- return e === void 0 && (e = !1), this.a === 1 ? this.toHexString(e) : this.toHex8String(e);
523
- }, r.prototype.toRgb = function() {
524
- return {
525
- r: Math.round(this.r),
526
- g: Math.round(this.g),
527
- b: Math.round(this.b),
528
- a: this.a
529
- };
530
- }, r.prototype.toRgbString = function() {
531
- var e = Math.round(this.r), t = Math.round(this.g), n = Math.round(this.b);
532
- return this.a === 1 ? "rgb(".concat(e, ", ").concat(t, ", ").concat(n, ")") : "rgba(".concat(e, ", ").concat(t, ", ").concat(n, ", ").concat(this.roundA, ")");
533
- }, r.prototype.toPercentageRgb = function() {
534
- var e = function(t) {
535
- return "".concat(Math.round(u(t, 255) * 100), "%");
536
- };
537
- return {
538
- r: e(this.r),
539
- g: e(this.g),
540
- b: e(this.b),
541
- a: this.a
542
- };
543
- }, r.prototype.toPercentageRgbString = function() {
544
- var e = function(t) {
545
- return Math.round(u(t, 255) * 100);
546
- };
547
- return this.a === 1 ? "rgb(".concat(e(this.r), "%, ").concat(e(this.g), "%, ").concat(e(this.b), "%)") : "rgba(".concat(e(this.r), "%, ").concat(e(this.g), "%, ").concat(e(this.b), "%, ").concat(this.roundA, ")");
548
- }, r.prototype.toName = function() {
549
- if (this.a === 0)
550
- return "transparent";
551
- if (this.a < 1)
552
- return !1;
553
- for (var e = "#" + X(this.r, this.g, this.b, !1), t = 0, n = Object.entries(D); t < n.length; t++) {
554
- var a = n[t], o = a[0], i = a[1];
555
- if (e === i)
556
- return o;
557
- }
558
- return !1;
559
- }, r.prototype.toString = function(e) {
560
- var t = !!e;
561
- e = e ?? this.format;
562
- var n = !1, a = this.a < 1 && this.a >= 0, o = !t && a && (e.startsWith("hex") || e === "name");
563
- return o ? e === "name" && this.a === 0 ? this.toName() : this.toRgbString() : (e === "rgb" && (n = this.toRgbString()), e === "prgb" && (n = this.toPercentageRgbString()), (e === "hex" || e === "hex6") && (n = this.toHexString()), e === "hex3" && (n = this.toHexString(!0)), e === "hex4" && (n = this.toHex8String(!0)), e === "hex8" && (n = this.toHex8String()), e === "name" && (n = this.toName()), e === "hsl" && (n = this.toHslString()), e === "hsv" && (n = this.toHsvString()), n || this.toHexString());
564
- }, r.prototype.toNumber = function() {
565
- return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
566
- }, r.prototype.clone = function() {
567
- return new r(this.toString());
568
- }, r.prototype.lighten = function(e) {
569
- e === void 0 && (e = 10);
570
- var t = this.toHsl();
571
- return t.l += e / 100, t.l = T(t.l), new r(t);
572
- }, r.prototype.brighten = function(e) {
573
- e === void 0 && (e = 10);
574
- var t = this.toRgb();
575
- return t.r = Math.max(0, Math.min(255, t.r - Math.round(255 * -(e / 100)))), t.g = Math.max(0, Math.min(255, t.g - Math.round(255 * -(e / 100)))), t.b = Math.max(0, Math.min(255, t.b - Math.round(255 * -(e / 100)))), new r(t);
576
- }, r.prototype.darken = function(e) {
577
- e === void 0 && (e = 10);
578
- var t = this.toHsl();
579
- return t.l -= e / 100, t.l = T(t.l), new r(t);
580
- }, r.prototype.tint = function(e) {
581
- return e === void 0 && (e = 10), this.mix("white", e);
582
- }, r.prototype.shade = function(e) {
583
- return e === void 0 && (e = 10), this.mix("black", e);
584
- }, r.prototype.desaturate = function(e) {
585
- e === void 0 && (e = 10);
586
- var t = this.toHsl();
587
- return t.s -= e / 100, t.s = T(t.s), new r(t);
588
- }, r.prototype.saturate = function(e) {
589
- e === void 0 && (e = 10);
590
- var t = this.toHsl();
591
- return t.s += e / 100, t.s = T(t.s), new r(t);
592
- }, r.prototype.greyscale = function() {
593
- return this.desaturate(100);
594
- }, r.prototype.spin = function(e) {
595
- var t = this.toHsl(), n = (t.h + e) % 360;
596
- return t.h = n < 0 ? 360 + n : n, new r(t);
597
- }, r.prototype.mix = function(e, t) {
598
- t === void 0 && (t = 50);
599
- var n = this.toRgb(), a = new r(e).toRgb(), o = t / 100, i = {
600
- r: (a.r - n.r) * o + n.r,
601
- g: (a.g - n.g) * o + n.g,
602
- b: (a.b - n.b) * o + n.b,
603
- a: (a.a - n.a) * o + n.a
604
- };
605
- return new r(i);
606
- }, r.prototype.analogous = function(e, t) {
607
- e === void 0 && (e = 6), t === void 0 && (t = 30);
608
- var n = this.toHsl(), a = 360 / t, o = [this];
609
- for (n.h = (n.h - (a * e >> 1) + 720) % 360; --e; )
610
- n.h = (n.h + a) % 360, o.push(new r(n));
611
- return o;
612
- }, r.prototype.complement = function() {
613
- var e = this.toHsl();
614
- return e.h = (e.h + 180) % 360, new r(e);
615
- }, r.prototype.monochromatic = function(e) {
616
- e === void 0 && (e = 6);
617
- for (var t = this.toHsv(), n = t.h, a = t.s, o = t.v, i = [], s = 1 / e; e--; )
618
- i.push(new r({ h: n, s: a, v: o })), o = (o + s) % 1;
619
- return i;
620
- }, r.prototype.splitcomplement = function() {
621
- var e = this.toHsl(), t = e.h;
622
- return [
623
- this,
624
- new r({ h: (t + 72) % 360, s: e.s, l: e.l }),
625
- new r({ h: (t + 216) % 360, s: e.s, l: e.l })
626
- ];
627
- }, r.prototype.onBackground = function(e) {
628
- var t = this.toRgb(), n = new r(e).toRgb(), a = t.a + n.a * (1 - t.a);
629
- return new r({
630
- r: (t.r * t.a + n.r * n.a * (1 - t.a)) / a,
631
- g: (t.g * t.a + n.g * n.a * (1 - t.a)) / a,
632
- b: (t.b * t.a + n.b * n.a * (1 - t.a)) / a,
633
- a
634
- });
635
- }, r.prototype.triad = function() {
636
- return this.polyad(3);
637
- }, r.prototype.tetrad = function() {
638
- return this.polyad(4);
639
- }, r.prototype.polyad = function(e) {
640
- for (var t = this.toHsl(), n = t.h, a = [this], o = 360 / e, i = 1; i < e; i++)
641
- a.push(new r({ h: (n + i * o) % 360, s: t.s, l: t.l }));
642
- return a;
643
- }, r.prototype.equals = function(e) {
644
- return this.toRgbString() === new r(e).toRgbString();
645
- }, r;
646
- }()
647
- );
648
- function S(r, e = 20) {
649
- return r.mix("#141414", e).toString();
650
- }
651
- function Lt(r) {
652
- const e = ot(), t = K("button");
653
- return h(() => {
654
- let n = {}, a = r.color;
655
- if (a) {
656
- const o = a.match(/var\((.*?)\)/);
657
- o && (a = window.getComputedStyle(window.document.documentElement).getPropertyValue(o[1]));
658
- const i = new Ut(a), s = r.dark ? i.tint(20).toString() : S(i, 20);
659
- if (r.plain)
660
- n = t.cssVarBlock({
661
- "bg-color": r.dark ? S(i, 90) : i.tint(90).toString(),
662
- "text-color": a,
663
- "border-color": r.dark ? S(i, 50) : i.tint(50).toString(),
664
- "hover-text-color": `var(${t.cssVarName("color-white")})`,
665
- "hover-bg-color": a,
666
- "hover-border-color": a,
667
- "active-bg-color": s,
668
- "active-text-color": `var(${t.cssVarName("color-white")})`,
669
- "active-border-color": s
670
- }), e.value && (n[t.cssVarBlockName("disabled-bg-color")] = r.dark ? S(i, 90) : i.tint(90).toString(), n[t.cssVarBlockName("disabled-text-color")] = r.dark ? S(i, 50) : i.tint(50).toString(), n[t.cssVarBlockName("disabled-border-color")] = r.dark ? S(i, 80) : i.tint(80).toString());
671
- else {
672
- const l = r.dark ? S(i, 30) : i.tint(30).toString(), p = i.isDark() ? `var(${t.cssVarName("color-white")})` : `var(${t.cssVarName("color-black")})`;
673
- if (n = t.cssVarBlock({
674
- "bg-color": a,
675
- "text-color": p,
676
- "border-color": a,
677
- "hover-bg-color": l,
678
- "hover-text-color": p,
679
- "hover-border-color": l,
680
- "active-bg-color": s,
681
- "active-border-color": s
682
- }), e.value) {
683
- const k = r.dark ? S(i, 50) : i.tint(50).toString();
684
- n[t.cssVarBlockName("disabled-bg-color")] = k, n[t.cssVarBlockName("disabled-text-color")] = r.dark ? "rgba(255, 255, 255, 0.5)" : `var(${t.cssVarName("color-white")})`, n[t.cssVarBlockName("disabled-border-color")] = k;
685
- }
686
- }
687
- }
688
- return n;
689
- });
690
- }
691
- const Zt = R({
692
- name: "ElButton"
693
- }), Jt = /* @__PURE__ */ R({
694
- ...Zt,
695
- props: O,
696
- emits: Ft,
697
- setup(r, { expose: e, emit: t }) {
698
- const n = r, a = Lt(n), o = K("button"), {
699
- _ref: i,
700
- _size: s,
701
- _type: l,
702
- _disabled: p,
703
- _props: k,
704
- _plain: H,
705
- _round: N,
706
- shouldAddSpace: I,
707
- handleClick: F
708
- } = Tt(n, t), U = h(() => [
709
- o.b(),
710
- o.m(l.value),
711
- o.m(s.value),
712
- o.is("disabled", p.value),
713
- o.is("loading", n.loading),
714
- o.is("plain", H.value),
715
- o.is("round", N.value),
716
- o.is("circle", n.circle),
717
- o.is("text", n.text),
718
- o.is("link", n.link),
719
- o.is("has-bg", n.bg)
720
- ]);
721
- return e({
722
- ref: i,
723
- size: s,
724
- type: l,
725
- disabled: p,
726
- shouldAddSpace: I
727
- }), (f, d) => (y(), B($(f.tag), rt({
728
- ref_key: "_ref",
729
- ref: i
730
- }, c(k), {
731
- class: c(U),
732
- style: c(a),
733
- onClick: c(F)
734
- }), {
735
- default: A(() => [
736
- f.loading ? (y(), V(St, { key: 0 }, [
737
- f.$slots.loading ? w(f.$slots, "loading", { key: 0 }) : (y(), B(c(Z), {
738
- key: 1,
739
- class: j(c(o).is("loading"))
740
- }, {
741
- default: A(() => [
742
- (y(), B($(f.loadingIcon)))
743
- ]),
744
- _: 1
745
- }, 8, ["class"]))
746
- ], 64)) : f.icon || f.$slots.icon ? (y(), B(c(Z), { key: 1 }, {
747
- default: A(() => [
748
- f.icon ? (y(), B($(f.icon), { key: 0 })) : w(f.$slots, "icon", { key: 1 })
749
- ]),
750
- _: 3
751
- })) : G("v-if", !0),
752
- f.$slots.default ? (y(), V("span", {
753
- key: 2,
754
- class: j({ [c(o).em("text", "expand")]: c(I) })
755
- }, [
756
- w(f.$slots, "default")
757
- ], 2)) : G("v-if", !0)
758
- ]),
759
- _: 3
760
- }, 16, ["class", "style", "onClick"]));
761
- }
762
- });
763
- var Yt = /* @__PURE__ */ et(Jt, [["__file", "button.vue"]]);
764
- const Qt = {
765
- size: O.size,
766
- type: O.type
767
- }, Xt = R({
768
- name: "ElButtonGroup"
769
- }), te = /* @__PURE__ */ R({
770
- ...Xt,
771
- props: Qt,
772
- setup(r) {
773
- const e = r;
774
- xt(it, Mt({
775
- size: J(e, "size"),
776
- type: J(e, "type")
777
- }));
778
- const t = K("button");
779
- return (n, a) => (y(), V("div", {
780
- class: j(c(t).b("group"))
781
- }, [
782
- w(n.$slots, "default")
783
- ], 2));
784
- }
785
- });
786
- var ft = /* @__PURE__ */ et(te, [["__file", "button-group.vue"]]);
787
- const ee = vt(Yt, {
788
- ButtonGroup: ft
789
- });
790
- pt(ft);
791
- const ae = /* @__PURE__ */ R({
792
- name: "RaButton",
793
- __name: "index",
794
- props: {
795
- // @doc 新增props属性click:可将方法变为同步,是点击后click方法执行完毕才可再次点击
796
- click: { type: Function, default: void 0 }
797
- },
798
- emits: ["click"],
799
- setup(r, { emit: e }) {
800
- const t = e, n = r, a = W(!1), o = async () => {
801
- n.click ? (a.value = !0, await n.click(), a.value = !1) : t("click");
802
- };
803
- return (i, s) => {
804
- const l = ee;
805
- return y(), B(l, rt(i.$attrs, {
806
- loading: c(a),
807
- onClick: o
808
- }), wt({
809
- default: A(() => [
810
- i.$slots.default ? w(i.$slots, "default", { key: 0 }) : G("", !0)
811
- ]),
812
- _: 2
813
- }, [
814
- i.$slots.loading ? {
815
- name: "loading",
816
- fn: A(() => [
817
- w(i.$slots, "loading")
818
- ]),
819
- key: "0"
820
- } : void 0,
821
- i.$slots.icon ? {
822
- name: "icon",
823
- fn: A(() => [
824
- w(i.$slots, "icon")
825
- ]),
826
- key: "1"
827
- } : void 0
828
- ]), 1040, ["loading"]);
829
- };
830
- }
831
- });
832
- export {
833
- ae as default
834
- };