ep-craft 0.1.3 → 0.1.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.
- package/dist/components/button/EpButton.vue.d.ts +3 -3
- package/dist/components/button/button.d.ts +2 -2
- package/dist/components/button/index.d.ts +2 -5
- package/dist/components/button/index.js +4 -7
- package/dist/index.css +1 -2
- package/package.json +1 -1
- package/theme-chalk/src/button.scss +49 -0
- package/theme-chalk/src/common/var.scss +28 -10
- package/dist/components/button/EpButton.vue.js +0 -171
- package/dist/components/button/EpButton2.vue.js +0 -4
- package/dist/components/button/button.js +0 -95
- package/dist/node_modules/@ctrl/tinycolor/dist/module/conversion.js +0 -134
- package/dist/node_modules/@ctrl/tinycolor/dist/module/css-color-names.js +0 -153
- package/dist/node_modules/@ctrl/tinycolor/dist/module/format-input.js +0 -77
- package/dist/node_modules/@ctrl/tinycolor/dist/module/index.js +0 -354
- package/dist/node_modules/@ctrl/tinycolor/dist/module/util.js +0 -32
package/package.json
CHANGED
|
@@ -16,6 +16,30 @@ $button-icon-span-gap: map.merge(
|
|
|
16
16
|
$button-icon-span-gap
|
|
17
17
|
);
|
|
18
18
|
|
|
19
|
+
@mixin button-reverse-variant(
|
|
20
|
+
$text-color,
|
|
21
|
+
$border-color,
|
|
22
|
+
$hover-bg-color,
|
|
23
|
+
$active-bg-color
|
|
24
|
+
) {
|
|
25
|
+
@include set-css-var-value(('button', 'text-color'), $text-color);
|
|
26
|
+
@include set-css-var-value(('button', 'bg-color'), getCssVar('color-white'));
|
|
27
|
+
@include set-css-var-value(('button', 'border-color'), $border-color);
|
|
28
|
+
@include set-css-var-value(('button', 'hover', 'text-color'), $text-color);
|
|
29
|
+
@include set-css-var-value(('button', 'hover', 'bg-color'), $hover-bg-color);
|
|
30
|
+
@include set-css-var-value(('button', 'hover', 'border-color'), $border-color);
|
|
31
|
+
@include set-css-var-value(('button', 'active', 'text-color'), $text-color);
|
|
32
|
+
@include set-css-var-value(('button', 'active', 'bg-color'), $active-bg-color);
|
|
33
|
+
@include set-css-var-value(('button', 'active', 'border-color'), $border-color);
|
|
34
|
+
@include set-css-var-value(('button', 'disabled', 'text-color'), $text-color);
|
|
35
|
+
@include set-css-var-value(('button', 'disabled', 'bg-color'), getCssVar('color-white'));
|
|
36
|
+
@include set-css-var-value(('button', 'disabled', 'border-color'), $border-color);
|
|
37
|
+
|
|
38
|
+
@include when(disabled) {
|
|
39
|
+
opacity: 0.4;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
19
43
|
@include b(button) {
|
|
20
44
|
@include set-component-css-var('button', $button);
|
|
21
45
|
}
|
|
@@ -292,6 +316,31 @@ $button-icon-span-gap: map.merge(
|
|
|
292
316
|
}
|
|
293
317
|
}
|
|
294
318
|
|
|
319
|
+
@include m(rePrimary) {
|
|
320
|
+
@include button-reverse-variant(
|
|
321
|
+
getCssVar('color-primary'),
|
|
322
|
+
#e5e6eb,
|
|
323
|
+
#f5f8ff,
|
|
324
|
+
#e5edff
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
@include m(reSuccess) {
|
|
329
|
+
@include button-reverse-variant(#12b886, #12b886, #f3fbf9, #e7f8f3);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
@include m(reDanger) {
|
|
333
|
+
@include button-reverse-variant(#f14646, #f14646, #fff5f5, #ffc9c9);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
@include m(reWarning) {
|
|
337
|
+
@include button-reverse-variant(#f57f00, #f57f00, #fff6eb, #ffe8cc);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
@include m(reInfo) {
|
|
341
|
+
@include button-reverse-variant(#1d1f29, #e5e6eb, #f7f8fa, #f2f3f5);
|
|
342
|
+
}
|
|
343
|
+
|
|
295
344
|
@each $size in (large, small, mini) {
|
|
296
345
|
@include m($size) {
|
|
297
346
|
@include set-css-var-value(
|
|
@@ -19,22 +19,40 @@ $colors: map.deep-merge(
|
|
|
19
19
|
'white': #ffffff,
|
|
20
20
|
'black': #000000,
|
|
21
21
|
'primary': (
|
|
22
|
-
'base': #
|
|
22
|
+
'base': #1c64fd,
|
|
23
|
+
'light-3': #4480ff,
|
|
24
|
+
'light-5': rgba(28, 100, 253, 0.4),
|
|
25
|
+
'dark-2': #164ed1,
|
|
23
26
|
),
|
|
24
27
|
'success': (
|
|
25
|
-
'base': #
|
|
28
|
+
'base': #12b886,
|
|
29
|
+
'light-3': #59cdaa,
|
|
30
|
+
'light-5': rgba(18, 184, 134, 0.4),
|
|
31
|
+
'dark-2': #0f956c,
|
|
26
32
|
),
|
|
27
33
|
'warning': (
|
|
28
|
-
'base': #
|
|
34
|
+
'base': #f57f00,
|
|
35
|
+
'light-3': #ffa94d,
|
|
36
|
+
'light-5': rgba(245, 127, 0, 0.4),
|
|
37
|
+
'dark-2': #d05706,
|
|
29
38
|
),
|
|
30
39
|
'danger': (
|
|
31
|
-
'base': #
|
|
40
|
+
'base': #f14646,
|
|
41
|
+
'light-3': #fb7c7c,
|
|
42
|
+
'light-5': rgba(241, 70, 70, 0.4),
|
|
43
|
+
'dark-2': #dc2c2c,
|
|
32
44
|
),
|
|
33
45
|
'error': (
|
|
34
|
-
'base': #
|
|
46
|
+
'base': #f14646,
|
|
47
|
+
'light-3': #fb7c7c,
|
|
48
|
+
'light-5': rgba(241, 70, 70, 0.4),
|
|
49
|
+
'dark-2': #dc2c2c,
|
|
35
50
|
),
|
|
36
51
|
'info': (
|
|
37
|
-
'base': #
|
|
52
|
+
'base': #f2f3f5,
|
|
53
|
+
'light-3': #e5e6eb,
|
|
54
|
+
'light-5': rgba(242, 243, 245, 0.4),
|
|
55
|
+
'dark-2': #c9cbd4,
|
|
38
56
|
),
|
|
39
57
|
),
|
|
40
58
|
$colors
|
|
@@ -98,8 +116,8 @@ $color-info: map.get($colors, 'info', 'base') !default;
|
|
|
98
116
|
$text-color: () !default;
|
|
99
117
|
$text-color: map.merge(
|
|
100
118
|
(
|
|
101
|
-
'primary': #
|
|
102
|
-
'regular': #
|
|
119
|
+
'primary': #1d1f29,
|
|
120
|
+
'regular': #1d1f29,
|
|
103
121
|
'secondary': #909399,
|
|
104
122
|
'placeholder': #a8abb2,
|
|
105
123
|
'disabled': #c0c4cc,
|
|
@@ -815,8 +833,8 @@ $button-font-size: map.merge(
|
|
|
815
833
|
(
|
|
816
834
|
'large': getCssVar('font-size', 'base'),
|
|
817
835
|
'default': getCssVar('font-size', 'base'),
|
|
818
|
-
'small':
|
|
819
|
-
'mini':
|
|
836
|
+
'small': getCssVar('font-size', 'base'),
|
|
837
|
+
'mini': getCssVar('font-size', 'extra-small'),
|
|
820
838
|
),
|
|
821
839
|
$button-font-size
|
|
822
840
|
);
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { defineComponent as Z, useSlots as j, inject as G, computed as a, ref as oo, Text as eo, openBlock as d, createBlock as m, resolveDynamicComponent as C, mergeProps as to, withCtx as x, createElementBlock as T, Fragment as ro, renderSlot as _, unref as N, normalizeClass as K, createCommentVNode as A } from "vue";
|
|
2
|
-
import { ElIcon as lo } from "element-plus/es/components/icon/index.mjs";
|
|
3
|
-
import { useFormSize as no, useFormDisabled as ao } from "element-plus/es/components/form/src/hooks/use-form-common-props.mjs";
|
|
4
|
-
import { useFormItem as so } from "element-plus/es/components/form/src/hooks/use-form-item.mjs";
|
|
5
|
-
import { useGlobalConfig as io } from "element-plus/es/components/config-provider/src/hooks/use-global-config.mjs";
|
|
6
|
-
import { buttonGroupContextKey as co } from "element-plus/es/components/button/src/constants.mjs";
|
|
7
|
-
import { buttonEmits as uo, buttonProps as vo } from "./button.js";
|
|
8
|
-
import { TinyColor as po } from "../../node_modules/@ctrl/tinycolor/dist/module/index.js";
|
|
9
|
-
const b = "el", k = "button", So = /* @__PURE__ */ Z({
|
|
10
|
-
name: "EpButton",
|
|
11
|
-
__name: "EpButton",
|
|
12
|
-
props: vo,
|
|
13
|
-
emits: uo,
|
|
14
|
-
setup(U, { expose: q, emit: H }) {
|
|
15
|
-
const w = lo, e = U, J = H, h = j(), L = (o = "") => o ? `${b}-${k}-${o}` : `${b}-${k}`, B = (o) => o ? `${b}-${k}--${o}` : "", i = (o, r = !0) => o && r ? `is-${o}` : "", l = (o) => `--${b}-${k}-${o}`, g = (o) => `--${b}-${o}`, y = (o) => {
|
|
16
|
-
const r = {};
|
|
17
|
-
for (const n in o) o[n] && (r[`--${b}-${k}-${n}`] = o[n]);
|
|
18
|
-
return r;
|
|
19
|
-
}, u = G(co, void 0), v = io("button"), { form: S } = so(), I = no(a(() => u == null ? void 0 : u.size)), c = ao(), E = oo(), z = a(
|
|
20
|
-
() => {
|
|
21
|
-
var o;
|
|
22
|
-
return e.type || (u == null ? void 0 : u.type) || ((o = v.value) == null ? void 0 : o.type) || "";
|
|
23
|
-
}
|
|
24
|
-
), M = a(
|
|
25
|
-
() => {
|
|
26
|
-
var o;
|
|
27
|
-
return e.autoInsertSpace ?? ((o = v.value) == null ? void 0 : o.autoInsertSpace) ?? !1;
|
|
28
|
-
}
|
|
29
|
-
), F = a(() => {
|
|
30
|
-
var o;
|
|
31
|
-
return e.plain ?? ((o = v.value) == null ? void 0 : o.plain) ?? !1;
|
|
32
|
-
}), O = a(() => {
|
|
33
|
-
var o;
|
|
34
|
-
return e.round ?? ((o = v.value) == null ? void 0 : o.round) ?? !1;
|
|
35
|
-
}), V = a(() => {
|
|
36
|
-
var o;
|
|
37
|
-
return e.text ?? ((o = v.value) == null ? void 0 : o.text) ?? !1;
|
|
38
|
-
}), Q = a(() => {
|
|
39
|
-
var o;
|
|
40
|
-
return e.dashed ?? ((o = v.value) == null ? void 0 : o.dashed) ?? !1;
|
|
41
|
-
}), R = a(() => e.tag === "button" ? {
|
|
42
|
-
ariaDisabled: c.value || e.loading,
|
|
43
|
-
disabled: c.value || e.loading,
|
|
44
|
-
autofocus: e.autofocus,
|
|
45
|
-
type: e.nativeType
|
|
46
|
-
} : {}), D = a(() => {
|
|
47
|
-
var r;
|
|
48
|
-
const o = (r = h.default) == null ? void 0 : r.call(h);
|
|
49
|
-
if (M.value && (o == null ? void 0 : o.length) === 1) {
|
|
50
|
-
const n = o[0];
|
|
51
|
-
if ((n == null ? void 0 : n.type) === eo) {
|
|
52
|
-
const t = n.children;
|
|
53
|
-
return new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(t.trim());
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return !1;
|
|
57
|
-
}), W = (o) => {
|
|
58
|
-
if (c.value || e.loading) {
|
|
59
|
-
o.stopPropagation();
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
e.nativeType === "reset" && (S == null || S.resetFields()), J("click", o);
|
|
63
|
-
};
|
|
64
|
-
function s(o, r = 20) {
|
|
65
|
-
return o.mix("#141414", r).toString();
|
|
66
|
-
}
|
|
67
|
-
const X = a(() => {
|
|
68
|
-
let o = {}, r = e.color;
|
|
69
|
-
if (r) {
|
|
70
|
-
const n = r.match(/var\((.*?)\)/);
|
|
71
|
-
n && (r = window.getComputedStyle(window.document.documentElement).getPropertyValue(n[1]));
|
|
72
|
-
const t = new po(r), p = e.dark ? t.tint(20).toString() : s(t, 20);
|
|
73
|
-
if (F.value)
|
|
74
|
-
o = y({
|
|
75
|
-
"bg-color": e.dark ? s(t, 90) : t.tint(90).toString(),
|
|
76
|
-
"text-color": r,
|
|
77
|
-
"border-color": e.dark ? s(t, 50) : t.tint(50).toString(),
|
|
78
|
-
"hover-text-color": `var(${g("color-white")})`,
|
|
79
|
-
"hover-bg-color": r,
|
|
80
|
-
"hover-border-color": r,
|
|
81
|
-
"active-bg-color": p,
|
|
82
|
-
"active-text-color": `var(${g("color-white")})`,
|
|
83
|
-
"active-border-color": p
|
|
84
|
-
}), c.value && (o[l("disabled-bg-color")] = e.dark ? s(t, 90) : t.tint(90).toString(), o[l("disabled-text-color")] = e.dark ? s(t, 50) : t.tint(50).toString(), o[l("disabled-border-color")] = e.dark ? s(t, 80) : t.tint(80).toString());
|
|
85
|
-
else if (e.link || V.value) {
|
|
86
|
-
const f = e.dark ? s(t, 30) : t.tint(30).toString();
|
|
87
|
-
if (o = y({
|
|
88
|
-
"text-color": r,
|
|
89
|
-
"hover-text-color": f,
|
|
90
|
-
"active-text-color": p
|
|
91
|
-
}), e.link && (o[l("hover-link-text-color")] = f, o[l("active-color")] = p), c.value) {
|
|
92
|
-
const $ = e.dark ? s(t, 50) : t.tint(50).toString();
|
|
93
|
-
o[l("disabled-bg-color")] = "transparent", o[l("disabled-text-color")] = $, o[l("disabled-border-color")] = "transparent";
|
|
94
|
-
}
|
|
95
|
-
} else {
|
|
96
|
-
const f = e.dark ? s(t, 30) : t.tint(30).toString(), $ = t.isDark() ? `var(${g("color-white")})` : `var(${g("color-black")})`;
|
|
97
|
-
if (o = y({
|
|
98
|
-
"bg-color": r,
|
|
99
|
-
"text-color": $,
|
|
100
|
-
"border-color": r,
|
|
101
|
-
"hover-bg-color": f,
|
|
102
|
-
"hover-text-color": $,
|
|
103
|
-
"hover-border-color": f,
|
|
104
|
-
"active-bg-color": p,
|
|
105
|
-
"active-border-color": p
|
|
106
|
-
}), c.value) {
|
|
107
|
-
const P = e.dark ? s(t, 50) : t.tint(50).toString();
|
|
108
|
-
o[l("disabled-bg-color")] = P, o[l("disabled-text-color")] = e.dark ? "rgba(255, 255, 255, 0.5)" : `var(${g("color-white")})`, o[l("disabled-border-color")] = P;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return o;
|
|
113
|
-
}), Y = a(() => [
|
|
114
|
-
L(),
|
|
115
|
-
B(z.value),
|
|
116
|
-
B(I.value),
|
|
117
|
-
i("disabled", c.value),
|
|
118
|
-
i("loading", e.loading),
|
|
119
|
-
i("plain", F.value),
|
|
120
|
-
i("round", O.value),
|
|
121
|
-
i("circle", e.circle),
|
|
122
|
-
i("text", V.value),
|
|
123
|
-
i("dashed", Q.value),
|
|
124
|
-
i("link", e.link),
|
|
125
|
-
i("has-bg", e.bg)
|
|
126
|
-
]);
|
|
127
|
-
return q({
|
|
128
|
-
ref: E,
|
|
129
|
-
size: I,
|
|
130
|
-
type: z,
|
|
131
|
-
disabled: c,
|
|
132
|
-
shouldAddSpace: D
|
|
133
|
-
}), (o, r) => (d(), m(C(o.tag), to({
|
|
134
|
-
ref_key: "_ref",
|
|
135
|
-
ref: E
|
|
136
|
-
}, R.value, {
|
|
137
|
-
class: Y.value,
|
|
138
|
-
style: X.value,
|
|
139
|
-
onClick: W
|
|
140
|
-
}), {
|
|
141
|
-
default: x(() => [
|
|
142
|
-
o.loading ? (d(), T(ro, { key: 0 }, [
|
|
143
|
-
o.$slots.loading ? _(o.$slots, "loading", { key: 0 }) : (d(), m(N(w), {
|
|
144
|
-
key: 1,
|
|
145
|
-
class: K("is-loading")
|
|
146
|
-
}, {
|
|
147
|
-
default: x(() => [
|
|
148
|
-
(d(), m(C(o.loadingIcon)))
|
|
149
|
-
]),
|
|
150
|
-
_: 1
|
|
151
|
-
}))
|
|
152
|
-
], 64)) : o.icon || o.$slots.icon ? (d(), m(N(w), { key: 1 }, {
|
|
153
|
-
default: x(() => [
|
|
154
|
-
o.icon ? (d(), m(C(o.icon), { key: 0 })) : _(o.$slots, "icon", { key: 1 })
|
|
155
|
-
]),
|
|
156
|
-
_: 3
|
|
157
|
-
})) : A("", !0),
|
|
158
|
-
o.$slots.default ? (d(), T("span", {
|
|
159
|
-
key: 2,
|
|
160
|
-
class: K({ "el-button__text--expand": D.value })
|
|
161
|
-
}, [
|
|
162
|
-
_(o.$slots, "default")
|
|
163
|
-
], 2)) : A("", !0)
|
|
164
|
-
]),
|
|
165
|
-
_: 3
|
|
166
|
-
}, 16, ["class", "style"]));
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
export {
|
|
170
|
-
So as default
|
|
171
|
-
};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { Loading as e } from "@element-plus/icons-vue";
|
|
2
|
-
const o = [
|
|
3
|
-
"default",
|
|
4
|
-
"primary",
|
|
5
|
-
"success",
|
|
6
|
-
"warning",
|
|
7
|
-
"info",
|
|
8
|
-
"danger",
|
|
9
|
-
"text",
|
|
10
|
-
""
|
|
11
|
-
], n = ["button", "submit", "reset"], l = {
|
|
12
|
-
/** 按钮尺寸 */
|
|
13
|
-
size: {
|
|
14
|
-
type: String,
|
|
15
|
-
values: ["", "large", "default", "small", "mini"]
|
|
16
|
-
},
|
|
17
|
-
/** 是否禁用 */
|
|
18
|
-
disabled: {
|
|
19
|
-
type: Boolean,
|
|
20
|
-
default: void 0
|
|
21
|
-
},
|
|
22
|
-
/** 按钮类型 */
|
|
23
|
-
type: {
|
|
24
|
-
type: String,
|
|
25
|
-
values: o,
|
|
26
|
-
default: ""
|
|
27
|
-
},
|
|
28
|
-
/** 图标组件 */
|
|
29
|
-
icon: {
|
|
30
|
-
type: [String, Object, Function]
|
|
31
|
-
},
|
|
32
|
-
/** 原生 button 类型 */
|
|
33
|
-
nativeType: {
|
|
34
|
-
type: String,
|
|
35
|
-
values: n,
|
|
36
|
-
default: "button"
|
|
37
|
-
},
|
|
38
|
-
/** 是否为加载中状态 */
|
|
39
|
-
loading: Boolean,
|
|
40
|
-
/** 自定义加载中图标组件 */
|
|
41
|
-
loadingIcon: {
|
|
42
|
-
type: [String, Object, Function],
|
|
43
|
-
default: () => e
|
|
44
|
-
},
|
|
45
|
-
/** 是否为朴素按钮 */
|
|
46
|
-
plain: {
|
|
47
|
-
type: Boolean,
|
|
48
|
-
default: void 0
|
|
49
|
-
},
|
|
50
|
-
/** 是否为文字按钮 */
|
|
51
|
-
text: {
|
|
52
|
-
type: Boolean,
|
|
53
|
-
default: void 0
|
|
54
|
-
},
|
|
55
|
-
/** 是否为链接按钮 */
|
|
56
|
-
link: Boolean,
|
|
57
|
-
/** 文字按钮背景色是否常亮 */
|
|
58
|
-
bg: Boolean,
|
|
59
|
-
/** 原生 autofocus */
|
|
60
|
-
autofocus: Boolean,
|
|
61
|
-
/** 是否为圆角按钮 */
|
|
62
|
-
round: {
|
|
63
|
-
type: Boolean,
|
|
64
|
-
default: void 0
|
|
65
|
-
},
|
|
66
|
-
/** 是否为圆形按钮 */
|
|
67
|
-
circle: Boolean,
|
|
68
|
-
/** 是否为虚线按钮 */
|
|
69
|
-
dashed: {
|
|
70
|
-
type: Boolean,
|
|
71
|
-
default: void 0
|
|
72
|
-
},
|
|
73
|
-
/** 自定义按钮颜色,自动计算 hover 和 active 颜色 */
|
|
74
|
-
color: String,
|
|
75
|
-
/** 暗黑模式,将 color 自动转换为暗黑模式颜色 */
|
|
76
|
-
dark: Boolean,
|
|
77
|
-
/** 是否在两个中文字符之间自动插入空格 */
|
|
78
|
-
autoInsertSpace: {
|
|
79
|
-
type: Boolean,
|
|
80
|
-
default: void 0
|
|
81
|
-
},
|
|
82
|
-
/** 自定义元素标签 */
|
|
83
|
-
tag: {
|
|
84
|
-
type: [String, Object],
|
|
85
|
-
default: "button"
|
|
86
|
-
}
|
|
87
|
-
}, i = {
|
|
88
|
-
click: (t) => t instanceof MouseEvent
|
|
89
|
-
};
|
|
90
|
-
export {
|
|
91
|
-
i as buttonEmits,
|
|
92
|
-
n as buttonNativeTypes,
|
|
93
|
-
l as buttonProps,
|
|
94
|
-
o as buttonTypes
|
|
95
|
-
};
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { bound01 as i, pad2 as h } from "./util.js";
|
|
2
|
-
function T(n, o, t) {
|
|
3
|
-
return {
|
|
4
|
-
r: i(n, 255) * 255,
|
|
5
|
-
g: i(o, 255) * 255,
|
|
6
|
-
b: i(t, 255) * 255
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
function g(n, o, t) {
|
|
10
|
-
n = i(n, 255), o = i(o, 255), t = i(t, 255);
|
|
11
|
-
const e = Math.max(n, o, t), c = Math.min(n, o, t);
|
|
12
|
-
let r = 0, a = 0;
|
|
13
|
-
const s = (e + c) / 2;
|
|
14
|
-
if (e === c)
|
|
15
|
-
a = 0, r = 0;
|
|
16
|
-
else {
|
|
17
|
-
const u = e - c;
|
|
18
|
-
switch (a = s > 0.5 ? u / (2 - e - c) : u / (e + c), e) {
|
|
19
|
-
case n:
|
|
20
|
-
r = (o - t) / u + (o < t ? 6 : 0);
|
|
21
|
-
break;
|
|
22
|
-
case o:
|
|
23
|
-
r = (t - n) / u + 2;
|
|
24
|
-
break;
|
|
25
|
-
case t:
|
|
26
|
-
r = (n - o) / u + 4;
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
r /= 6;
|
|
30
|
-
}
|
|
31
|
-
return { h: r, s: a, l: s };
|
|
32
|
-
}
|
|
33
|
-
function M(n, o, t) {
|
|
34
|
-
return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? n + (o - n) * (6 * t) : t < 1 / 2 ? o : t < 2 / 3 ? n + (o - n) * (2 / 3 - t) * 6 : n;
|
|
35
|
-
}
|
|
36
|
-
function k(n, o, t) {
|
|
37
|
-
let e, c, r;
|
|
38
|
-
if (n = i(n, 360), o = i(o, 100), t = i(t, 100), o === 0)
|
|
39
|
-
c = t, r = t, e = t;
|
|
40
|
-
else {
|
|
41
|
-
const a = t < 0.5 ? t * (1 + o) : t + o - t * o, s = 2 * t - a;
|
|
42
|
-
e = M(s, a, n + 1 / 3), c = M(s, a, n), r = M(s, a, n - 1 / 3);
|
|
43
|
-
}
|
|
44
|
-
return { r: e * 255, g: c * 255, b: r * 255 };
|
|
45
|
-
}
|
|
46
|
-
function l(n, o, t) {
|
|
47
|
-
n = i(n, 255), o = i(o, 255), t = i(t, 255);
|
|
48
|
-
const e = Math.max(n, o, t), c = Math.min(n, o, t);
|
|
49
|
-
let r = 0;
|
|
50
|
-
const a = e, s = e - c, u = e === 0 ? 0 : s / e;
|
|
51
|
-
if (e === c)
|
|
52
|
-
r = 0;
|
|
53
|
-
else {
|
|
54
|
-
switch (e) {
|
|
55
|
-
case n:
|
|
56
|
-
r = (o - t) / s + (o < t ? 6 : 0);
|
|
57
|
-
break;
|
|
58
|
-
case o:
|
|
59
|
-
r = (t - n) / s + 2;
|
|
60
|
-
break;
|
|
61
|
-
case t:
|
|
62
|
-
r = (n - o) / s + 4;
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
r /= 6;
|
|
66
|
-
}
|
|
67
|
-
return { h: r, s: u, v: a };
|
|
68
|
-
}
|
|
69
|
-
function H(n, o, t) {
|
|
70
|
-
n = i(n, 360) * 6, o = i(o, 100), t = i(t, 100);
|
|
71
|
-
const e = Math.floor(n), c = n - e, r = t * (1 - o), a = t * (1 - c * o), s = t * (1 - (1 - c) * o), u = e % 6, f = [t, a, r, r, s, t][u], m = [s, t, t, a, r, r][u], d = [r, r, s, t, t, a][u];
|
|
72
|
-
return { r: f * 255, g: m * 255, b: d * 255 };
|
|
73
|
-
}
|
|
74
|
-
function S(n, o, t, e) {
|
|
75
|
-
const c = [
|
|
76
|
-
h(Math.round(n).toString(16)),
|
|
77
|
-
h(Math.round(o).toString(16)),
|
|
78
|
-
h(Math.round(t).toString(16))
|
|
79
|
-
];
|
|
80
|
-
return e && c[0].startsWith(c[0].charAt(1)) && c[1].startsWith(c[1].charAt(1)) && c[2].startsWith(c[2].charAt(1)) ? c[0].charAt(0) + c[1].charAt(0) + c[2].charAt(0) : c.join("");
|
|
81
|
-
}
|
|
82
|
-
function W(n, o, t, e, c) {
|
|
83
|
-
const r = [
|
|
84
|
-
h(Math.round(n).toString(16)),
|
|
85
|
-
h(Math.round(o).toString(16)),
|
|
86
|
-
h(Math.round(t).toString(16)),
|
|
87
|
-
h(x(e))
|
|
88
|
-
];
|
|
89
|
-
return c && r[0].startsWith(r[0].charAt(1)) && r[1].startsWith(r[1].charAt(1)) && r[2].startsWith(r[2].charAt(1)) && r[3].startsWith(r[3].charAt(1)) ? r[0].charAt(0) + r[1].charAt(0) + r[2].charAt(0) + r[3].charAt(0) : r.join("");
|
|
90
|
-
}
|
|
91
|
-
function p(n, o, t, e) {
|
|
92
|
-
const c = n / 100, r = o / 100, a = t / 100, s = e / 100, u = 255 * (1 - c) * (1 - s), f = 255 * (1 - r) * (1 - s), m = 255 * (1 - a) * (1 - s);
|
|
93
|
-
return { r: u, g: f, b: m };
|
|
94
|
-
}
|
|
95
|
-
function y(n, o, t) {
|
|
96
|
-
let e = 1 - n / 255, c = 1 - o / 255, r = 1 - t / 255, a = Math.min(e, c, r);
|
|
97
|
-
return a === 1 ? (e = 0, c = 0, r = 0) : (e = (e - a) / (1 - a) * 100, c = (c - a) / (1 - a) * 100, r = (r - a) / (1 - a) * 100), a *= 100, {
|
|
98
|
-
c: Math.round(e),
|
|
99
|
-
m: Math.round(c),
|
|
100
|
-
y: Math.round(r),
|
|
101
|
-
k: Math.round(a)
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
function x(n) {
|
|
105
|
-
return Math.round(parseFloat(n) * 255).toString(16);
|
|
106
|
-
}
|
|
107
|
-
function C(n) {
|
|
108
|
-
return A(n) / 255;
|
|
109
|
-
}
|
|
110
|
-
function A(n) {
|
|
111
|
-
return parseInt(n, 16);
|
|
112
|
-
}
|
|
113
|
-
function R(n) {
|
|
114
|
-
return {
|
|
115
|
-
r: n >> 16,
|
|
116
|
-
g: (n & 65280) >> 8,
|
|
117
|
-
b: n & 255
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
export {
|
|
121
|
-
p as cmykToRgb,
|
|
122
|
-
x as convertDecimalToHex,
|
|
123
|
-
C as convertHexToDecimal,
|
|
124
|
-
k as hslToRgb,
|
|
125
|
-
H as hsvToRgb,
|
|
126
|
-
R as numberInputToObject,
|
|
127
|
-
A as parseIntFromHex,
|
|
128
|
-
y as rgbToCmyk,
|
|
129
|
-
S as rgbToHex,
|
|
130
|
-
g as rgbToHsl,
|
|
131
|
-
l as rgbToHsv,
|
|
132
|
-
T as rgbToRgb,
|
|
133
|
-
W as rgbaToHex
|
|
134
|
-
};
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
const e = {
|
|
2
|
-
aliceblue: "#f0f8ff",
|
|
3
|
-
antiquewhite: "#faebd7",
|
|
4
|
-
aqua: "#00ffff",
|
|
5
|
-
aquamarine: "#7fffd4",
|
|
6
|
-
azure: "#f0ffff",
|
|
7
|
-
beige: "#f5f5dc",
|
|
8
|
-
bisque: "#ffe4c4",
|
|
9
|
-
black: "#000000",
|
|
10
|
-
blanchedalmond: "#ffebcd",
|
|
11
|
-
blue: "#0000ff",
|
|
12
|
-
blueviolet: "#8a2be2",
|
|
13
|
-
brown: "#a52a2a",
|
|
14
|
-
burlywood: "#deb887",
|
|
15
|
-
cadetblue: "#5f9ea0",
|
|
16
|
-
chartreuse: "#7fff00",
|
|
17
|
-
chocolate: "#d2691e",
|
|
18
|
-
coral: "#ff7f50",
|
|
19
|
-
cornflowerblue: "#6495ed",
|
|
20
|
-
cornsilk: "#fff8dc",
|
|
21
|
-
crimson: "#dc143c",
|
|
22
|
-
cyan: "#00ffff",
|
|
23
|
-
darkblue: "#00008b",
|
|
24
|
-
darkcyan: "#008b8b",
|
|
25
|
-
darkgoldenrod: "#b8860b",
|
|
26
|
-
darkgray: "#a9a9a9",
|
|
27
|
-
darkgreen: "#006400",
|
|
28
|
-
darkgrey: "#a9a9a9",
|
|
29
|
-
darkkhaki: "#bdb76b",
|
|
30
|
-
darkmagenta: "#8b008b",
|
|
31
|
-
darkolivegreen: "#556b2f",
|
|
32
|
-
darkorange: "#ff8c00",
|
|
33
|
-
darkorchid: "#9932cc",
|
|
34
|
-
darkred: "#8b0000",
|
|
35
|
-
darksalmon: "#e9967a",
|
|
36
|
-
darkseagreen: "#8fbc8f",
|
|
37
|
-
darkslateblue: "#483d8b",
|
|
38
|
-
darkslategray: "#2f4f4f",
|
|
39
|
-
darkslategrey: "#2f4f4f",
|
|
40
|
-
darkturquoise: "#00ced1",
|
|
41
|
-
darkviolet: "#9400d3",
|
|
42
|
-
deeppink: "#ff1493",
|
|
43
|
-
deepskyblue: "#00bfff",
|
|
44
|
-
dimgray: "#696969",
|
|
45
|
-
dimgrey: "#696969",
|
|
46
|
-
dodgerblue: "#1e90ff",
|
|
47
|
-
firebrick: "#b22222",
|
|
48
|
-
floralwhite: "#fffaf0",
|
|
49
|
-
forestgreen: "#228b22",
|
|
50
|
-
fuchsia: "#ff00ff",
|
|
51
|
-
gainsboro: "#dcdcdc",
|
|
52
|
-
ghostwhite: "#f8f8ff",
|
|
53
|
-
goldenrod: "#daa520",
|
|
54
|
-
gold: "#ffd700",
|
|
55
|
-
gray: "#808080",
|
|
56
|
-
green: "#008000",
|
|
57
|
-
greenyellow: "#adff2f",
|
|
58
|
-
grey: "#808080",
|
|
59
|
-
honeydew: "#f0fff0",
|
|
60
|
-
hotpink: "#ff69b4",
|
|
61
|
-
indianred: "#cd5c5c",
|
|
62
|
-
indigo: "#4b0082",
|
|
63
|
-
ivory: "#fffff0",
|
|
64
|
-
khaki: "#f0e68c",
|
|
65
|
-
lavenderblush: "#fff0f5",
|
|
66
|
-
lavender: "#e6e6fa",
|
|
67
|
-
lawngreen: "#7cfc00",
|
|
68
|
-
lemonchiffon: "#fffacd",
|
|
69
|
-
lightblue: "#add8e6",
|
|
70
|
-
lightcoral: "#f08080",
|
|
71
|
-
lightcyan: "#e0ffff",
|
|
72
|
-
lightgoldenrodyellow: "#fafad2",
|
|
73
|
-
lightgray: "#d3d3d3",
|
|
74
|
-
lightgreen: "#90ee90",
|
|
75
|
-
lightgrey: "#d3d3d3",
|
|
76
|
-
lightpink: "#ffb6c1",
|
|
77
|
-
lightsalmon: "#ffa07a",
|
|
78
|
-
lightseagreen: "#20b2aa",
|
|
79
|
-
lightskyblue: "#87cefa",
|
|
80
|
-
lightslategray: "#778899",
|
|
81
|
-
lightslategrey: "#778899",
|
|
82
|
-
lightsteelblue: "#b0c4de",
|
|
83
|
-
lightyellow: "#ffffe0",
|
|
84
|
-
lime: "#00ff00",
|
|
85
|
-
limegreen: "#32cd32",
|
|
86
|
-
linen: "#faf0e6",
|
|
87
|
-
magenta: "#ff00ff",
|
|
88
|
-
maroon: "#800000",
|
|
89
|
-
mediumaquamarine: "#66cdaa",
|
|
90
|
-
mediumblue: "#0000cd",
|
|
91
|
-
mediumorchid: "#ba55d3",
|
|
92
|
-
mediumpurple: "#9370db",
|
|
93
|
-
mediumseagreen: "#3cb371",
|
|
94
|
-
mediumslateblue: "#7b68ee",
|
|
95
|
-
mediumspringgreen: "#00fa9a",
|
|
96
|
-
mediumturquoise: "#48d1cc",
|
|
97
|
-
mediumvioletred: "#c71585",
|
|
98
|
-
midnightblue: "#191970",
|
|
99
|
-
mintcream: "#f5fffa",
|
|
100
|
-
mistyrose: "#ffe4e1",
|
|
101
|
-
moccasin: "#ffe4b5",
|
|
102
|
-
navajowhite: "#ffdead",
|
|
103
|
-
navy: "#000080",
|
|
104
|
-
oldlace: "#fdf5e6",
|
|
105
|
-
olive: "#808000",
|
|
106
|
-
olivedrab: "#6b8e23",
|
|
107
|
-
orange: "#ffa500",
|
|
108
|
-
orangered: "#ff4500",
|
|
109
|
-
orchid: "#da70d6",
|
|
110
|
-
palegoldenrod: "#eee8aa",
|
|
111
|
-
palegreen: "#98fb98",
|
|
112
|
-
paleturquoise: "#afeeee",
|
|
113
|
-
palevioletred: "#db7093",
|
|
114
|
-
papayawhip: "#ffefd5",
|
|
115
|
-
peachpuff: "#ffdab9",
|
|
116
|
-
peru: "#cd853f",
|
|
117
|
-
pink: "#ffc0cb",
|
|
118
|
-
plum: "#dda0dd",
|
|
119
|
-
powderblue: "#b0e0e6",
|
|
120
|
-
purple: "#800080",
|
|
121
|
-
rebeccapurple: "#663399",
|
|
122
|
-
red: "#ff0000",
|
|
123
|
-
rosybrown: "#bc8f8f",
|
|
124
|
-
royalblue: "#4169e1",
|
|
125
|
-
saddlebrown: "#8b4513",
|
|
126
|
-
salmon: "#fa8072",
|
|
127
|
-
sandybrown: "#f4a460",
|
|
128
|
-
seagreen: "#2e8b57",
|
|
129
|
-
seashell: "#fff5ee",
|
|
130
|
-
sienna: "#a0522d",
|
|
131
|
-
silver: "#c0c0c0",
|
|
132
|
-
skyblue: "#87ceeb",
|
|
133
|
-
slateblue: "#6a5acd",
|
|
134
|
-
slategray: "#708090",
|
|
135
|
-
slategrey: "#708090",
|
|
136
|
-
snow: "#fffafa",
|
|
137
|
-
springgreen: "#00ff7f",
|
|
138
|
-
steelblue: "#4682b4",
|
|
139
|
-
tan: "#d2b48c",
|
|
140
|
-
teal: "#008080",
|
|
141
|
-
thistle: "#d8bfd8",
|
|
142
|
-
tomato: "#ff6347",
|
|
143
|
-
turquoise: "#40e0d0",
|
|
144
|
-
violet: "#ee82ee",
|
|
145
|
-
wheat: "#f5deb3",
|
|
146
|
-
white: "#ffffff",
|
|
147
|
-
whitesmoke: "#f5f5f5",
|
|
148
|
-
yellow: "#ffff00",
|
|
149
|
-
yellowgreen: "#9acd32"
|
|
150
|
-
};
|
|
151
|
-
export {
|
|
152
|
-
e as names
|
|
153
|
-
};
|