@pixelium/web-vue 0.0.1-beta → 0.0.2
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 +21 -10
- package/README.zh.md +21 -10
- package/dist/icon-pa.d.ts +490 -0
- package/dist/index.d.ts +1586 -10
- package/dist/pixelium-vue-icon-pa.cjs +1 -0
- package/dist/pixelium-vue-icon-pa.css +1 -0
- package/dist/pixelium-vue-icon-pa.js +10143 -0
- package/dist/pixelium-vue-icon-pa.umd.cjs +1 -0
- package/dist/pixelium-vue.cjs +12 -1
- package/dist/pixelium-vue.css +1 -1
- package/dist/pixelium-vue.js +5368 -1093
- package/dist/pixelium-vue.umd.cjs +12 -1
- package/es/aside/css.js +1 -1
- package/es/aside/index.js +60 -13
- package/es/auto-complete/css.js +2 -0
- package/es/auto-complete/draw.d.ts +2 -0
- package/es/auto-complete/draw.js +52 -0
- package/es/auto-complete/index.css +123 -0
- package/es/auto-complete/index.d.ts +35 -0
- package/es/auto-complete/index.js +402 -0
- package/es/auto-complete/type.d.ts +192 -0
- package/es/button/css.js +1 -1
- package/es/button/draw.d.ts +1 -2
- package/es/button/draw.js +105 -123
- package/es/button/index.css +24 -14
- package/es/button/index.js +70 -121
- package/es/button-group/css.js +1 -1
- package/es/button-group/index.d.ts +0 -1
- package/es/button-group/index.js +11 -37
- package/es/button-group/type.d.ts +1 -1
- package/es/col/css.js +1 -1
- package/es/col/index.d.ts +2 -2
- package/es/container/css.js +1 -1
- package/es/divider/css.js +1 -1
- package/es/empty/css.js +2 -0
- package/es/empty/index.css +19 -0
- package/es/empty/index.d.ts +17 -0
- package/es/empty/index.js +73 -0
- package/es/empty/type.d.ts +19 -0
- package/es/footer/css.js +1 -1
- package/es/grid/css.js +1 -1
- package/es/grid/index.js +5 -1
- package/es/grid-item/css.js +1 -1
- package/es/grid-item/index.d.ts +1 -1
- package/es/grid-item/index.js +7 -3
- package/es/header/css.js +1 -1
- package/es/icon/css.js +1 -1
- package/es/icon/index.css +0 -3
- package/es/icon/index.js +1 -1
- package/es/icons/css-pa.js +2 -0
- package/es/icons/icon-hn.js +1 -1
- package/es/icons/icon-pa.css +9 -0
- package/es/icons/icon-pa.d.ts +490 -0
- package/es/icons/icon-pa.js +17449 -0
- package/es/index.css +22 -8
- package/es/index.d.ts +18 -1
- package/es/index.js +63 -2
- package/es/input/css.js +2 -0
- package/es/input/draw.d.ts +2 -0
- package/es/input/draw.js +52 -0
- package/es/input/index.css +138 -0
- package/es/input/index.d.ts +50 -0
- package/es/input/index.js +432 -0
- package/es/input/type.d.ts +175 -0
- package/es/input-group/css.js +2 -0
- package/es/input-group/index.css +24 -0
- package/es/input-group/index.d.ts +17 -0
- package/es/input-group/index.js +40 -0
- package/es/input-group/type.d.ts +30 -0
- package/es/input-group-label/css.js +2 -0
- package/es/input-group-label/draw.d.ts +2 -0
- package/es/input-group-label/draw.js +52 -0
- package/es/input-group-label/index.css +50 -0
- package/es/input-group-label/index.d.ts +16 -0
- package/es/input-group-label/index.js +129 -0
- package/es/input-group-label/type.d.ts +30 -0
- package/es/input-number/css.js +2 -0
- package/es/input-number/draw.d.ts +2 -0
- package/es/input-number/draw.js +52 -0
- package/es/input-number/index.css +161 -0
- package/es/input-number/index.d.ts +47 -0
- package/es/input-number/index.js +543 -0
- package/es/input-number/type.d.ts +183 -0
- package/es/input-tag/css.js +2 -0
- package/es/input-tag/draw.d.ts +2 -0
- package/es/input-tag/draw.js +49 -0
- package/es/input-tag/index.css +133 -0
- package/es/input-tag/index.d.ts +73 -0
- package/es/input-tag/index.js +474 -0
- package/es/input-tag/type.d.ts +212 -0
- package/es/link/css.js +1 -1
- package/es/link/index.css +2 -5
- package/es/link/index.js +10 -6
- package/es/main/css.js +1 -1
- package/es/mask/css.js +2 -0
- package/es/mask/index.css +17 -0
- package/es/mask/index.d.ts +8 -0
- package/es/mask/index.js +117 -0
- package/es/mask/type.d.ts +27 -0
- package/es/message/css.js +1 -1
- package/es/message/index.css +26 -26
- package/es/message/index.d.ts +1 -1
- package/es/message/index.js +22 -50
- package/es/message-box/css.js +1 -1
- package/es/message-box/index.js +40 -30
- package/es/message-box/message-box-wrapped.d.ts +0 -1
- package/es/message-box/message-box-wrapped.js +2 -2
- package/es/message-box/message-box.d.ts +2 -1
- package/es/message-box/message-box.js +10 -8
- package/es/message-box/type.d.ts +14 -4
- package/es/option-list/css.js +2 -0
- package/es/option-list/index.css +57 -0
- package/es/option-list/index.d.ts +38 -0
- package/es/option-list/index.js +169 -0
- package/es/option-list/type.d.ts +16 -0
- package/es/popover/css.js +1 -0
- package/es/popover/index.d.ts +203 -0
- package/es/popover/index.js +240 -0
- package/es/popover/type.d.ts +100 -0
- package/es/popup-content/css.js +2 -0
- package/es/popup-content/draw.d.ts +6 -0
- package/es/popup-content/draw.js +151 -0
- package/es/popup-content/index.css +99 -0
- package/es/popup-content/index.d.ts +30 -0
- package/es/popup-content/index.js +1578 -0
- package/es/popup-content/type.d.ts +20 -0
- package/es/popup-trigger/css.js +1 -0
- package/es/popup-trigger/index.d.ts +22 -0
- package/es/popup-trigger/index.js +97 -0
- package/es/popup-trigger/type.d.ts +9 -0
- package/es/row/css.js +1 -1
- package/es/select/css.js +2 -0
- package/es/select/draw.d.ts +2 -0
- package/es/select/draw.js +52 -0
- package/es/select/index.css +152 -0
- package/es/select/index.d.ts +44 -0
- package/es/select/index.js +674 -0
- package/es/select/type.d.ts +252 -0
- package/es/share/const/event-bus-key.d.ts +4 -0
- package/es/share/const/event-bus-key.js +10 -0
- package/es/share/const/index.d.ts +4 -0
- package/es/share/const/index.js +11 -2
- package/es/share/const/provide-key.d.ts +3 -0
- package/es/share/const/provide-key.js +8 -0
- package/es/share/hook/use-click-outside-listener.d.ts +4 -0
- package/es/share/hook/use-click-outside-listener.js +44 -0
- package/es/share/hook/use-composition.d.ts +5 -0
- package/es/share/hook/use-composition.js +17 -0
- package/es/share/hook/use-controlled-mode.d.ts +6 -0
- package/es/share/hook/use-controlled-mode.js +25 -0
- package/es/share/hook/use-dark-mode.js +11 -3
- package/es/share/hook/use-index-of-children.d.ts +2 -1
- package/es/share/hook/use-index-of-children.js +25 -35
- package/es/share/hook/use-resize-observer.js +1 -1
- package/es/share/hook/use-textarea-height.d.ts +5 -0
- package/es/share/hook/use-textarea-height.js +116 -0
- package/es/share/hook/use-watch-global-css-var.d.ts +1 -0
- package/es/share/hook/use-watch-global-css-var.js +19 -0
- package/es/share/hook/use-z-index.d.ts +6 -0
- package/es/share/hook/use-z-index.js +32 -0
- package/es/share/type/index.d.ts +9 -1
- package/es/share/util/color.js +4 -2
- package/es/share/util/common.d.ts +5 -0
- package/es/share/util/common.js +71 -0
- package/es/share/util/event-bus.d.ts +1 -0
- package/es/share/util/event-bus.js +20 -0
- package/es/share/util/plot.d.ts +15 -2
- package/es/share/util/plot.js +200 -30
- package/es/share/util/render.d.ts +1 -0
- package/es/share/util/render.js +10 -2
- package/es/share/util/theme.js +23 -4
- package/es/space/css.js +1 -1
- package/es/space/index.css +5 -0
- package/es/space/index.js +2 -2
- package/es/spin/css.js +2 -0
- package/es/spin/index.css +66 -0
- package/es/spin/index.d.ts +24 -0
- package/es/spin/index.js +104 -0
- package/es/spin/type.d.ts +54 -0
- package/es/tag/css.js +2 -0
- package/es/tag/draw.d.ts +6 -0
- package/es/tag/draw.js +135 -0
- package/es/tag/index.css +372 -0
- package/es/tag/index.d.ts +23 -0
- package/es/tag/index.js +193 -0
- package/es/tag/type.d.ts +58 -0
- package/es/textarea/css.js +2 -0
- package/es/textarea/draw.d.ts +2 -0
- package/es/textarea/draw.js +13 -0
- package/es/textarea/index.css +108 -0
- package/es/textarea/index.d.ts +49 -0
- package/es/textarea/index.js +267 -0
- package/es/textarea/type.d.ts +169 -0
- package/es/tooltip/css.js +1 -0
- package/es/tooltip/index.d.ts +20 -0
- package/es/tooltip/index.js +228 -0
- package/es/tooltip/type.d.ts +77 -0
- package/package.json +17 -3
- package/es/icons/{css.js → css-hn.js} +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
.px-spin {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: inline-block;
|
|
4
|
+
min-height: var(--px-medium-base-size);
|
|
5
|
+
min-width: var(--px-medium-base-size);
|
|
6
|
+
}
|
|
7
|
+
.px-spin__small {
|
|
8
|
+
min-height: var(--px-small-base-size);
|
|
9
|
+
min-width: var(--px-small-base-size);
|
|
10
|
+
}
|
|
11
|
+
.px-spin__large {
|
|
12
|
+
min-height: var(--px-large-base-size);
|
|
13
|
+
min-width: var(--px-large-base-size);
|
|
14
|
+
}
|
|
15
|
+
.px-spin-cover {
|
|
16
|
+
position: absolute;
|
|
17
|
+
top: 0;
|
|
18
|
+
left: 0;
|
|
19
|
+
bottom: 0;
|
|
20
|
+
right: 0;
|
|
21
|
+
}
|
|
22
|
+
.px-spin-content,
|
|
23
|
+
.px-spin-cover {
|
|
24
|
+
position: absolute;
|
|
25
|
+
top: 0;
|
|
26
|
+
left: 0;
|
|
27
|
+
bottom: 0;
|
|
28
|
+
right: 0;
|
|
29
|
+
}
|
|
30
|
+
.px-spin-content {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
align-items: center;
|
|
35
|
+
color: var(--px-primary-6);
|
|
36
|
+
font-size: var(--px-large-font-size);
|
|
37
|
+
}
|
|
38
|
+
.px-spin-icon-wrapper {
|
|
39
|
+
display: flex;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
align-items: center;
|
|
42
|
+
margin-bottom: var(--px-interval-2);
|
|
43
|
+
font-size: var(--px-medium-base-size);
|
|
44
|
+
}
|
|
45
|
+
.px-spin-icon-wrapper__last {
|
|
46
|
+
margin-bottom: 0;
|
|
47
|
+
}
|
|
48
|
+
.px-spin-icon-wrapper .px-spin-icon {
|
|
49
|
+
height: var(--px-medium-base-size);
|
|
50
|
+
width: var(--px-medium-base-size);
|
|
51
|
+
fill: var(--px-primary-6);
|
|
52
|
+
}
|
|
53
|
+
.px-spin-icon-wrapper__small {
|
|
54
|
+
font-size: var(--px-small-base-size);
|
|
55
|
+
}
|
|
56
|
+
.px-spin-icon-wrapper__small .px-spin-icon {
|
|
57
|
+
height: var(--px-small-base-size);
|
|
58
|
+
width: var(--px-small-base-size);
|
|
59
|
+
}
|
|
60
|
+
.px-spin-icon-wrapper__large {
|
|
61
|
+
font-size: var(--px-large-base-size);
|
|
62
|
+
}
|
|
63
|
+
.px-spin-icon-wrapper__large .px-spin-icon {
|
|
64
|
+
height: var(--px-large-base-size);
|
|
65
|
+
width: var(--px-large-base-size);
|
|
66
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SpinProps } from './type';
|
|
2
|
+
declare var __VLS_1: {}, __VLS_7: {}, __VLS_14: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
default?: (props: typeof __VLS_1) => any;
|
|
5
|
+
} & {
|
|
6
|
+
icon?: (props: typeof __VLS_7) => any;
|
|
7
|
+
} & {
|
|
8
|
+
description?: (props: typeof __VLS_14) => any;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_component: import("vue").DefineComponent<SpinProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SpinProps> & Readonly<{}>, {
|
|
11
|
+
size: "medium" | "large" | "small" | number;
|
|
12
|
+
loading: boolean;
|
|
13
|
+
zIndex: number;
|
|
14
|
+
maskStep: number;
|
|
15
|
+
maskLineWidth: number;
|
|
16
|
+
maskGrid: boolean;
|
|
17
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
21
|
+
new (): {
|
|
22
|
+
$slots: S;
|
|
23
|
+
};
|
|
24
|
+
};
|
package/es/spin/index.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import './css.js'
|
|
2
|
+
import { defineComponent, useSlots, computed, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, renderSlot, createCommentVNode, createBlock, createElementVNode, createVNode } from "vue";
|
|
3
|
+
import { C as COVER_Z_INDEX } from "../share/const/index.js";
|
|
4
|
+
import { _ as _sfc_main$1 } from "../mask/index.js";
|
|
5
|
+
import { S as SpinnerThirdSolid } from "../auto-complete/index.js";
|
|
6
|
+
import { k, p } from "../aside/index.js";
|
|
7
|
+
const _hoisted_1 = { class: "px-spin-content" };
|
|
8
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9
|
+
...{
|
|
10
|
+
name: "Spin"
|
|
11
|
+
},
|
|
12
|
+
__name: "index",
|
|
13
|
+
props: {
|
|
14
|
+
loading: { type: Boolean, default: void 0 },
|
|
15
|
+
size: { default: "medium" },
|
|
16
|
+
maskColor: null,
|
|
17
|
+
maskStep: { default: 1 },
|
|
18
|
+
maskLineWidth: { default: 2 },
|
|
19
|
+
maskGrid: { type: Boolean, default: true },
|
|
20
|
+
zIndex: { default: COVER_Z_INDEX }
|
|
21
|
+
},
|
|
22
|
+
setup(__props) {
|
|
23
|
+
const props = __props;
|
|
24
|
+
const slots = useSlots();
|
|
25
|
+
const sizeValue = computed(() => {
|
|
26
|
+
return k(props.size) ? `${props.size}px` : void 0;
|
|
27
|
+
});
|
|
28
|
+
const loadingComputed = computed(() => {
|
|
29
|
+
return slots.default ? !!props.loading : props.loading !== false;
|
|
30
|
+
});
|
|
31
|
+
return (_ctx, _cache) => {
|
|
32
|
+
return openBlock(), createElementBlock(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
class: normalizeClass(["pixelium px-spin", {
|
|
36
|
+
[`px-spin__${props.size}`]: unref(p)(props.size)
|
|
37
|
+
}]),
|
|
38
|
+
style: normalizeStyle({
|
|
39
|
+
minWidth: sizeValue.value,
|
|
40
|
+
minHeight: sizeValue.value
|
|
41
|
+
})
|
|
42
|
+
},
|
|
43
|
+
[
|
|
44
|
+
renderSlot(_ctx.$slots, "default"),
|
|
45
|
+
loadingComputed.value ? (openBlock(), createElementBlock(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
key: 0,
|
|
49
|
+
class: "px-spin-cover",
|
|
50
|
+
style: normalizeStyle({
|
|
51
|
+
zIndex: props.zIndex
|
|
52
|
+
})
|
|
53
|
+
},
|
|
54
|
+
[
|
|
55
|
+
unref(slots).default ? (openBlock(), createBlock(_sfc_main$1, {
|
|
56
|
+
key: 0,
|
|
57
|
+
"z-index": 0,
|
|
58
|
+
color: props.maskColor,
|
|
59
|
+
step: props.maskStep,
|
|
60
|
+
"line-width": props.maskLineWidth,
|
|
61
|
+
grid: props.maskGrid
|
|
62
|
+
}, null, 8, ["color", "step", "line-width", "grid"])) : createCommentVNode("v-if", true),
|
|
63
|
+
createElementVNode("div", _hoisted_1, [
|
|
64
|
+
createElementVNode(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
class: normalizeClass(["px-spin-icon-wrapper", {
|
|
68
|
+
"px-spin-icon-wrapper__last": !unref(slots).description,
|
|
69
|
+
[`px-spin-icon-wrapper__${props.size}`]: unref(p)(props.size)
|
|
70
|
+
}]),
|
|
71
|
+
style: normalizeStyle({
|
|
72
|
+
fontSize: sizeValue.value
|
|
73
|
+
})
|
|
74
|
+
},
|
|
75
|
+
[
|
|
76
|
+
renderSlot(_ctx.$slots, "icon", {}, () => [
|
|
77
|
+
createVNode(unref(SpinnerThirdSolid), {
|
|
78
|
+
class: "px-spin-icon px-animation__loading",
|
|
79
|
+
style: normalizeStyle({
|
|
80
|
+
width: sizeValue.value,
|
|
81
|
+
height: sizeValue.value
|
|
82
|
+
})
|
|
83
|
+
}, null, 8, ["style"])
|
|
84
|
+
])
|
|
85
|
+
],
|
|
86
|
+
6
|
|
87
|
+
/* CLASS, STYLE */
|
|
88
|
+
),
|
|
89
|
+
renderSlot(_ctx.$slots, "description")
|
|
90
|
+
])
|
|
91
|
+
],
|
|
92
|
+
4
|
|
93
|
+
/* STYLE */
|
|
94
|
+
)) : createCommentVNode("v-if", true)
|
|
95
|
+
],
|
|
96
|
+
6
|
|
97
|
+
/* CLASS, STYLE */
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
export {
|
|
103
|
+
_sfc_main as _
|
|
104
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export type SpinProps = {
|
|
2
|
+
/**
|
|
3
|
+
* @property {boolean} [loading]
|
|
4
|
+
* @version 0.0.2
|
|
5
|
+
*/
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* @property {'medium' | 'large' | 'small' | number} [size='medium']
|
|
9
|
+
* @version 0.0.2
|
|
10
|
+
*/
|
|
11
|
+
size?: 'medium' | 'large' | 'small' | number;
|
|
12
|
+
/**
|
|
13
|
+
* @property {string} [maskColor]
|
|
14
|
+
* @version 0.0.2
|
|
15
|
+
*/
|
|
16
|
+
maskColor?: string;
|
|
17
|
+
/**
|
|
18
|
+
* @property {number} [maskStep=1]
|
|
19
|
+
* @version 0.0.2
|
|
20
|
+
*/
|
|
21
|
+
maskStep?: number;
|
|
22
|
+
/**
|
|
23
|
+
* @property {number} [maskLineWidth=2]
|
|
24
|
+
* @version 0.0.2
|
|
25
|
+
*/
|
|
26
|
+
maskLineWidth?: number;
|
|
27
|
+
/**
|
|
28
|
+
* @property {boolean} [maskGrid=true]
|
|
29
|
+
* @version 0.0.2
|
|
30
|
+
*/
|
|
31
|
+
maskGrid?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @property {number} [zIndex=20]
|
|
34
|
+
* @version 0.0.2
|
|
35
|
+
*/
|
|
36
|
+
zIndex?: number;
|
|
37
|
+
};
|
|
38
|
+
export type SpinSlots = {
|
|
39
|
+
/**
|
|
40
|
+
* @slot default
|
|
41
|
+
* @version 0.0.2
|
|
42
|
+
*/
|
|
43
|
+
default: {};
|
|
44
|
+
/**
|
|
45
|
+
* @slot icon
|
|
46
|
+
* @version 0.0.2
|
|
47
|
+
*/
|
|
48
|
+
icon: {};
|
|
49
|
+
/**
|
|
50
|
+
* @slot description
|
|
51
|
+
* @version 0.0.2
|
|
52
|
+
*/
|
|
53
|
+
description: {};
|
|
54
|
+
};
|
package/es/tag/css.js
ADDED
package/es/tag/draw.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RgbaColor } from '../share/type';
|
|
2
|
+
import type { TagProps } from './type';
|
|
3
|
+
export declare function getBackgroundColor(disabled: boolean, type: TagProps['variant'], theme: TagProps['theme'], palette: RgbaColor[] | null): RgbaColor;
|
|
4
|
+
export declare function getBorderColor(disabled: boolean, type: TagProps['variant'], theme: TagProps['theme'], palette: RgbaColor[] | null): RgbaColor;
|
|
5
|
+
export declare const drawBorder: (ctx: CanvasRenderingContext2D, width: number, height: number, center: [number, number][], borderRadius: number[], rad: [number, number][], borderColor: RgbaColor, pixelSize: number) => void;
|
|
6
|
+
export declare const getTextColorWithPalette: (palette: RgbaColor[] | null, type: TagProps["variant"], disabled: boolean) => string | undefined;
|
package/es/tag/draw.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { T as TRANSPARENT_RGBA_COLOR_OBJECT } from "../share/const/index.js";
|
|
2
|
+
import { r as rgbaColor2string, g as getGlobalThemeColor } from "../share/util/color.js";
|
|
3
|
+
import { d as drawCircle } from "../share/util/plot.js";
|
|
4
|
+
function getBackgroundColor(disabled, type, theme = "primary", palette) {
|
|
5
|
+
if (palette) {
|
|
6
|
+
switch (type) {
|
|
7
|
+
case "outline":
|
|
8
|
+
return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
9
|
+
case "plain":
|
|
10
|
+
if (disabled) return palette[0];
|
|
11
|
+
return palette[0];
|
|
12
|
+
default:
|
|
13
|
+
if (disabled) return palette[1];
|
|
14
|
+
return palette[5];
|
|
15
|
+
}
|
|
16
|
+
} else if (theme !== "info") {
|
|
17
|
+
switch (type) {
|
|
18
|
+
case "outline":
|
|
19
|
+
return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
20
|
+
case "plain":
|
|
21
|
+
if (disabled) return getGlobalThemeColor(theme, 1);
|
|
22
|
+
return getGlobalThemeColor(theme, 1);
|
|
23
|
+
default:
|
|
24
|
+
if (disabled) return getGlobalThemeColor(theme, 2);
|
|
25
|
+
return getGlobalThemeColor(theme, 6);
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
switch (type) {
|
|
29
|
+
case "outline":
|
|
30
|
+
return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
31
|
+
case "plain":
|
|
32
|
+
if (disabled) return getGlobalThemeColor("neutral", 1);
|
|
33
|
+
return getGlobalThemeColor("neutral", 1);
|
|
34
|
+
default:
|
|
35
|
+
if (disabled) return getGlobalThemeColor("neutral", 7);
|
|
36
|
+
return getGlobalThemeColor("neutral", 8);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function getBorderColor(disabled, type, theme = "primary", palette) {
|
|
41
|
+
if (palette) {
|
|
42
|
+
switch (type) {
|
|
43
|
+
case "plain":
|
|
44
|
+
if (disabled) return palette[1];
|
|
45
|
+
return palette[1];
|
|
46
|
+
case "outline":
|
|
47
|
+
if (disabled) return palette[0];
|
|
48
|
+
return palette[5];
|
|
49
|
+
default:
|
|
50
|
+
if (disabled) return palette[0];
|
|
51
|
+
return palette[4];
|
|
52
|
+
}
|
|
53
|
+
} else if (theme !== "info") {
|
|
54
|
+
switch (type) {
|
|
55
|
+
case "plain":
|
|
56
|
+
if (disabled) return getGlobalThemeColor(theme, 2);
|
|
57
|
+
return getGlobalThemeColor(theme, 2);
|
|
58
|
+
case "outline":
|
|
59
|
+
if (disabled) return getGlobalThemeColor(theme, 1);
|
|
60
|
+
return getGlobalThemeColor(theme, 6);
|
|
61
|
+
default:
|
|
62
|
+
if (disabled) return getGlobalThemeColor(theme, 1);
|
|
63
|
+
return getGlobalThemeColor(theme, 5);
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
switch (type) {
|
|
67
|
+
case "plain":
|
|
68
|
+
if (disabled) return getGlobalThemeColor("neutral", 5);
|
|
69
|
+
return getGlobalThemeColor("neutral", 7);
|
|
70
|
+
case "outline":
|
|
71
|
+
if (disabled) return getGlobalThemeColor("neutral", 7);
|
|
72
|
+
return getGlobalThemeColor("neutral", 9);
|
|
73
|
+
}
|
|
74
|
+
return disabled ? getGlobalThemeColor("neutral", 5) : getGlobalThemeColor("neutral", 7);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const drawBorder = (ctx, width, height, center, borderRadius, rad, borderColor, pixelSize) => {
|
|
78
|
+
ctx.fillStyle = rgbaColor2string(borderColor);
|
|
79
|
+
for (let i = 0; i < 4; i++) {
|
|
80
|
+
if (borderRadius[i] > pixelSize) {
|
|
81
|
+
drawCircle(
|
|
82
|
+
ctx,
|
|
83
|
+
center[i][0],
|
|
84
|
+
center[i][1],
|
|
85
|
+
borderRadius[i],
|
|
86
|
+
rad[i][0],
|
|
87
|
+
rad[i][1],
|
|
88
|
+
pixelSize
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (center[1][0] + pixelSize > center[0][0]) {
|
|
93
|
+
ctx.fillRect(center[0][0], 0, center[1][0] - center[0][0] + pixelSize, pixelSize);
|
|
94
|
+
}
|
|
95
|
+
if (center[2][1] + pixelSize > center[1][1]) {
|
|
96
|
+
ctx.fillRect(
|
|
97
|
+
width - pixelSize,
|
|
98
|
+
center[1][1],
|
|
99
|
+
pixelSize,
|
|
100
|
+
center[2][1] - center[1][1] + pixelSize
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
if (center[3][0] < center[2][0] + pixelSize) {
|
|
104
|
+
ctx.fillRect(
|
|
105
|
+
center[3][0],
|
|
106
|
+
height - pixelSize,
|
|
107
|
+
center[2][0] - center[3][0] + pixelSize,
|
|
108
|
+
pixelSize
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
if (center[3][1] + pixelSize > center[0][1]) {
|
|
112
|
+
ctx.fillRect(0, center[0][1], pixelSize, center[3][1] - center[0][1] + pixelSize);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const getTextColorWithPalette = (palette, type, disabled) => {
|
|
116
|
+
if (!palette || type === "primary") return void 0;
|
|
117
|
+
if (disabled) {
|
|
118
|
+
if (type === "plain") return rgbaColor2string(palette[2]);
|
|
119
|
+
return rgbaColor2string(palette[1]);
|
|
120
|
+
}
|
|
121
|
+
switch (type) {
|
|
122
|
+
case "outline":
|
|
123
|
+
return rgbaColor2string(palette[5]);
|
|
124
|
+
case "plain":
|
|
125
|
+
return rgbaColor2string(palette[5]);
|
|
126
|
+
default:
|
|
127
|
+
return void 0;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
export {
|
|
131
|
+
getBorderColor as a,
|
|
132
|
+
getBackgroundColor as b,
|
|
133
|
+
drawBorder as d,
|
|
134
|
+
getTextColorWithPalette as g
|
|
135
|
+
};
|