@pixelium/web-vue 0.0.2-fix → 0.0.3-alpha
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 +42 -0
- package/README.zh.md +6 -3
- package/dist/font.css +1 -1
- package/dist/index.d.ts +1602 -248
- package/dist/normalize.css +2 -0
- package/dist/pixelium-vue-icon-hn.cjs +1 -1
- package/dist/pixelium-vue-icon-hn.css +2 -1
- package/dist/pixelium-vue-icon-hn.js +8533 -8154
- package/dist/pixelium-vue-icon-hn.umd.cjs +1 -1
- package/dist/pixelium-vue-icon-pa.cjs +1 -1
- package/dist/pixelium-vue-icon-pa.css +2 -1
- package/dist/pixelium-vue-icon-pa.js +10625 -10143
- package/dist/pixelium-vue-icon-pa.umd.cjs +1 -1
- package/dist/pixelium-vue.cjs +2 -2
- package/dist/pixelium-vue.css +2 -1
- package/dist/pixelium-vue.js +7407 -5854
- package/dist/pixelium-vue.umd.cjs +2 -2
- package/es/aside/index.css +1 -0
- package/es/aside/index.js +46 -151
- package/es/auto-complete/draw.d.ts +1 -1
- package/es/auto-complete/draw.js +26 -51
- package/es/auto-complete/index.css +92 -32
- package/es/auto-complete/index.d.ts +12 -15
- package/es/auto-complete/index.js +338 -400
- package/es/auto-complete/type.d.ts +25 -13
- package/es/avatar/css.js +2 -0
- package/es/avatar/draw.d.ts +2 -0
- package/es/avatar/draw.js +11 -0
- package/es/avatar/index.css +49 -0
- package/es/avatar/index.d.ts +15 -0
- package/es/avatar/index.js +110 -0
- package/es/avatar/type.d.ts +34 -0
- package/es/button/draw.d.ts +4 -4
- package/es/button/draw.js +213 -297
- package/es/button/index.css +40 -30
- package/es/button/index.d.ts +0 -4
- package/es/button/index.js +230 -256
- package/es/button/type.d.ts +3 -3
- package/es/button-group/index.css +0 -3
- package/es/button-group/index.d.ts +1 -2
- package/es/button-group/index.js +59 -31
- package/es/button-group/type.d.ts +21 -4
- package/es/checkbox/css.js +2 -0
- package/es/checkbox/draw.d.ts +4 -0
- package/es/checkbox/draw.js +46 -0
- package/es/checkbox/index.css +85 -0
- package/es/checkbox/index.d.ts +31 -0
- package/es/checkbox/index.js +206 -0
- package/es/checkbox/type.d.ts +88 -0
- package/es/checkbox-group/css.js +2 -0
- package/es/checkbox-group/index.css +20 -0
- package/es/checkbox-group/index.d.ts +23 -0
- package/es/checkbox-group/index.js +84 -0
- package/es/checkbox-group/type.d.ts +78 -0
- package/es/col/index.d.ts +2 -2
- package/es/col/index.js +43 -58
- package/es/container/index.css +1 -0
- package/es/container/index.js +18 -31
- package/es/divider/index.js +39 -53
- package/es/empty/index.css +4 -4
- package/es/empty/index.js +16 -71
- package/es/entry.js +102 -0
- package/es/footer/index.css +1 -0
- package/es/footer/index.js +31 -40
- package/es/form/css.js +1 -0
- package/es/form/index.d.ts +27 -0
- package/es/form/index.js +125 -0
- package/es/form/type.d.ts +238 -0
- package/es/form/use-form.d.ts +4 -0
- package/es/form/use-form.js +48 -0
- package/es/form-item/css.js +2 -0
- package/es/form-item/index.css +77 -0
- package/es/form-item/index.d.ts +37 -0
- package/es/form-item/index.js +318 -0
- package/es/form-item/type.d.ts +96 -0
- package/es/grid/index.js +56 -75
- package/es/grid-item/css.js +0 -1
- package/es/grid-item/index.d.ts +1 -1
- package/es/grid-item/index.js +85 -121
- package/es/header/index.css +1 -0
- package/es/header/index.js +31 -40
- package/es/icon/index.js +44 -55
- package/es/icons/css-hn.js +0 -1
- package/es/icons/css-pa.js +0 -1
- package/es/icons/icon-hn.js +10337 -15986
- package/es/icons/icon-pa.js +12573 -17447
- package/es/image/css.js +2 -0
- package/es/image/index.css +69 -0
- package/es/image/index.d.ts +35 -0
- package/es/image/index.js +199 -0
- package/es/image/type.d.ts +126 -0
- package/es/index.css +1 -515
- package/es/index.d.ts +22 -2
- package/es/index.js +144 -123
- package/es/input/draw.d.ts +1 -1
- package/es/input/draw.js +26 -51
- package/es/input/index.css +85 -33
- package/es/input/index.d.ts +9 -16
- package/es/input/index.js +319 -423
- package/es/input/type.d.ts +3 -3
- package/es/input-group/index.css +0 -1
- package/es/input-group/index.d.ts +2 -2
- package/es/input-group/index.js +66 -37
- package/es/input-group/type.d.ts +16 -4
- package/es/input-group-label/draw.d.ts +1 -1
- package/es/input-group-label/draw.js +26 -51
- package/es/input-group-label/index.css +33 -22
- package/es/input-group-label/index.d.ts +1 -4
- package/es/input-group-label/index.js +104 -127
- package/es/input-group-label/type.d.ts +3 -3
- package/es/input-number/draw.d.ts +1 -1
- package/es/input-number/draw.js +26 -51
- package/es/input-number/index.css +90 -35
- package/es/input-number/index.d.ts +9 -16
- package/es/input-number/index.js +428 -536
- package/es/input-number/type.d.ts +3 -3
- package/es/input-tag/draw.d.ts +1 -1
- package/es/input-tag/draw.js +26 -48
- package/es/input-tag/index.css +100 -33
- package/es/input-tag/index.d.ts +7 -13
- package/es/input-tag/index.js +442 -467
- package/es/input-tag/type.d.ts +24 -13
- package/es/link/index.js +75 -106
- package/es/main/index.css +4 -0
- package/es/main/index.d.ts +4 -1
- package/es/main/index.js +15 -15
- package/es/main/type.d.ts +7 -0
- package/es/mask/index.js +94 -115
- package/es/message/index.css +1 -1
- package/es/message/index.js +168 -346
- package/es/message-box/css.js +1 -1
- package/es/message-box/index.js +98 -114
- package/es/message-box/message-box-wrapped.js +33 -46
- package/es/message-box/message-box.js +79 -111
- package/es/option-list/index.css +13 -13
- package/es/option-list/index.d.ts +4 -31
- package/es/option-list/index.js +99 -167
- package/es/option-list/type.d.ts +5 -1
- package/es/pixelate/pixel.d.ts +5 -0
- package/es/pixelate/pixel.js +70 -0
- package/es/pixelate/pixelate.worker.d.ts +1 -0
- package/es/popover/index.d.ts +13 -99
- package/es/popover/index.js +75 -238
- package/es/popover/type.d.ts +7 -2
- package/es/popup/css.js +1 -0
- package/es/popup/index.d.ts +210 -0
- package/es/popup/index.js +203 -0
- package/es/popup/type.d.ts +105 -0
- package/es/popup-content/draw.d.ts +2 -2
- package/es/popup-content/draw.js +98 -143
- package/es/popup-content/index.css +11 -11
- package/es/popup-content/index.d.ts +1 -0
- package/es/popup-content/index.js +253 -1576
- package/es/popup-content/type.d.ts +1 -0
- package/es/popup-trigger/index.d.ts +8 -2
- package/es/popup-trigger/index.js +122 -95
- package/es/popup-trigger/type.d.ts +4 -1
- package/es/popup-wrapper/css.js +2 -0
- package/es/popup-wrapper/index.css +14 -0
- package/es/popup-wrapper/index.d.ts +18 -0
- package/es/popup-wrapper/index.js +67 -0
- package/es/popup-wrapper/type.d.ts +9 -0
- package/es/radio/css.js +1 -0
- package/es/radio/draw.d.ts +4 -0
- package/es/radio/draw.js +47 -0
- package/es/radio/index.d.ts +30 -0
- package/es/radio/index.js +190 -0
- package/es/radio/style.css +73 -0
- package/es/radio/type.d.ts +76 -0
- package/es/radio-group/css.js +2 -0
- package/es/radio-group/index.css +20 -0
- package/es/radio-group/index.d.ts +23 -0
- package/es/radio-group/index.js +77 -0
- package/es/radio-group/type.d.ts +77 -0
- package/es/row/index.js +56 -70
- package/es/select/draw.d.ts +1 -1
- package/es/select/draw.js +26 -51
- package/es/select/index.css +118 -36
- package/es/select/index.d.ts +14 -16
- package/es/select/index.js +625 -675
- package/es/select/type.d.ts +60 -25
- package/es/share/const/event-bus-key.js +1 -6
- package/es/share/const/index.d.ts +4 -0
- package/es/share/const/index.js +22 -24
- package/es/share/const/provide-key.d.ts +5 -0
- package/es/share/const/provide-key.js +6 -5
- package/es/share/const/style.d.ts +6 -0
- package/es/share/const/style.js +7 -0
- package/es/share/hook/use-cancelable-delay.d.ts +1 -0
- package/es/share/hook/use-cancelable-delay.js +42 -0
- package/es/share/hook/use-click-outside-listener.d.ts +1 -1
- package/es/share/hook/use-click-outside-listener.js +28 -41
- package/es/share/hook/use-composition.js +17 -15
- package/es/share/hook/use-controlled-mode.d.ts +3 -3
- package/es/share/hook/use-controlled-mode.js +20 -23
- package/es/share/hook/use-dark-mode.js +51 -65
- package/es/share/hook/use-index-of-children.d.ts +2 -1
- package/es/share/hook/use-index-of-children.js +47 -45
- package/es/share/hook/use-lazy-load.d.ts +10 -0
- package/es/share/hook/use-lazy-load.js +133 -0
- package/es/share/hook/use-props-detect.d.ts +2 -0
- package/es/share/hook/use-resize-observer.d.ts +1 -2
- package/es/share/hook/use-resize-observer.js +28 -20
- package/es/share/hook/use-screen-width.js +27 -36
- package/es/share/hook/use-smooth-transition.d.ts +2 -0
- package/es/share/hook/use-smooth-transition.js +65 -0
- package/es/share/hook/use-textarea-height.js +86 -92
- package/es/share/hook/use-theme-mode.js +41 -42
- package/es/share/hook/use-transition-end.d.ts +2 -0
- package/es/share/hook/use-transition-end.js +12 -0
- package/es/share/hook/use-watch-global-css-var.js +12 -16
- package/es/share/hook/use-window-resize-listener.d.ts +1 -0
- package/es/share/hook/use-window-resize-listener.js +15 -0
- package/es/share/hook/use-z-index.js +30 -27
- package/es/share/style/index.css +5 -0
- package/es/share/type/index.d.ts +18 -3
- package/es/share/util/color.d.ts +5 -3
- package/es/share/util/color.js +156 -149
- package/es/share/util/common.d.ts +7 -2
- package/es/share/util/common.js +127 -65
- package/es/share/util/console.d.ts +3 -3
- package/es/share/util/console.js +10 -7
- package/es/share/util/dom.d.ts +19 -0
- package/es/share/util/dom.js +88 -0
- package/es/share/util/env.d.ts +1 -0
- package/es/share/util/env.js +5 -4
- package/es/share/util/event-bus.js +3 -20
- package/es/share/util/lru-cache.js +29 -33
- package/es/share/util/pixel.d.ts +4 -0
- package/es/share/util/plot.d.ts +8 -3
- package/es/share/util/plot.js +457 -229
- package/es/share/util/reactivity.d.ts +8 -0
- package/es/share/util/reactivity.js +23 -0
- package/es/share/util/render.js +31 -41
- package/es/share/util/theme.d.ts +3 -0
- package/es/share/util/theme.js +77 -57
- package/es/slider/css.js +2 -0
- package/es/slider/draw.d.ts +25 -0
- package/es/slider/draw.js +113 -0
- package/es/slider/index.css +119 -0
- package/es/slider/index.d.ts +66 -0
- package/es/slider/index.js +503 -0
- package/es/slider/type.d.ts +162 -0
- package/es/slider/util.d.ts +37 -0
- package/es/slider/util.js +130 -0
- package/es/space/index.css +24 -29
- package/es/space/index.js +73 -97
- package/es/spin/index.css +18 -17
- package/es/spin/index.js +72 -102
- package/es/spin/type.d.ts +11 -5
- package/es/switch/css.js +2 -0
- package/es/switch/draw.d.ts +2 -0
- package/es/switch/draw.js +18 -0
- package/es/switch/index.css +121 -0
- package/es/switch/index.d.ts +42 -0
- package/es/switch/index.js +259 -0
- package/es/switch/type.d.ts +133 -0
- package/es/tag/draw.d.ts +2 -2
- package/es/tag/draw.js +80 -127
- package/es/tag/index.css +38 -22
- package/es/tag/index.d.ts +2 -2
- package/es/tag/index.js +121 -190
- package/es/tag/type.d.ts +3 -3
- package/es/text-outline/css.js +2 -0
- package/es/text-outline/index.css +4 -0
- package/es/text-outline/index.d.ts +17 -0
- package/es/text-outline/index.js +33 -0
- package/es/text-outline/type.d.ts +23 -0
- package/es/textarea/draw.js +9 -11
- package/es/textarea/index.css +37 -23
- package/es/textarea/index.d.ts +8 -14
- package/es/textarea/index.js +274 -262
- package/es/tooltip/index.d.ts +100 -4
- package/es/tooltip/index.js +70 -226
- package/es/tooltip/type.d.ts +7 -2
- package/es/vendor.js +504 -0
- package/es/virtual-list/css.js +2 -0
- package/es/virtual-list/index.css +25 -0
- package/es/virtual-list/index.d.ts +11 -0
- package/es/virtual-list/index.js +313 -0
- package/es/virtual-list/type.d.ts +26 -0
- package/package.json +10 -16
- package/es/grid-item/index.css +0 -0
- /package/es/message-box/{message-box.css → index.css} +0 -0
package/es/message/index.js
CHANGED
|
@@ -1,348 +1,170 @@
|
|
|
1
1
|
import './css.js'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
2
|
+
import { B as y, V as spinner_third_solid_default, d as octagon_times_solid_default, f as exclamation_triangle_solid_default, l as times_circle_solid_default, p as info_circle_solid_default, u as check_circle_solid_default } from "../vendor.js";
|
|
3
|
+
import { i as canvasPreprocess, n as calcPixelSize } from "../share/util/plot.js";
|
|
4
|
+
import { a as rgbaColor2string, i as parseColor, n as getGlobalThemeColor, r as getGlobalThemeColorString, t as generatePalette } from "../share/util/color.js";
|
|
5
|
+
import { t as useDarkMode } from "../share/hook/use-dark-mode.js";
|
|
6
|
+
import { t as useResizeObserver } from "../share/hook/use-resize-observer.js";
|
|
7
|
+
import { t as useWatchGlobalCssVal } from "../share/hook/use-watch-global-css-var.js";
|
|
8
|
+
import { t as useTransitionEnd } from "../share/hook/use-transition-end.js";
|
|
9
|
+
import { Transition, computed, createVNode, defineComponent, onBeforeUnmount, onMounted, ref, shallowRef, watch } from "vue";
|
|
10
|
+
var message_default = /* @__PURE__ */ defineComponent({
|
|
11
|
+
__name: "index",
|
|
12
|
+
props: {
|
|
13
|
+
content: { default: "" },
|
|
14
|
+
icon: null,
|
|
15
|
+
duration: { default: 3e3 },
|
|
16
|
+
id: null,
|
|
17
|
+
type: { default: "normal" },
|
|
18
|
+
color: null,
|
|
19
|
+
closable: { type: Boolean }
|
|
20
|
+
},
|
|
21
|
+
emits: ["close"],
|
|
22
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
23
|
+
const props = __props;
|
|
24
|
+
const hoverFlag = ref(false);
|
|
25
|
+
const activeFlag = ref(false);
|
|
26
|
+
const toggleActive = (status) => {
|
|
27
|
+
activeFlag.value = status;
|
|
28
|
+
};
|
|
29
|
+
const toggleHover = (status) => {
|
|
30
|
+
hoverFlag.value = status;
|
|
31
|
+
};
|
|
32
|
+
const visible = ref(false);
|
|
33
|
+
let timer = void 0;
|
|
34
|
+
onMounted(() => {
|
|
35
|
+
visible.value = true;
|
|
36
|
+
startTimer();
|
|
37
|
+
});
|
|
38
|
+
onBeforeUnmount(() => {
|
|
39
|
+
clearTimeout(timer);
|
|
40
|
+
});
|
|
41
|
+
function startTimer() {
|
|
42
|
+
timer = setTimeout(() => close(), props.duration);
|
|
43
|
+
}
|
|
44
|
+
function clearTimer() {
|
|
45
|
+
clearTimeout(timer);
|
|
46
|
+
timer = void 0;
|
|
47
|
+
}
|
|
48
|
+
function close() {
|
|
49
|
+
visible.value = false;
|
|
50
|
+
}
|
|
51
|
+
const emits = __emit;
|
|
52
|
+
const afterLeaveHandler = () => {
|
|
53
|
+
emits("close", props.id);
|
|
54
|
+
clearTimer();
|
|
55
|
+
};
|
|
56
|
+
const canvasRef = shallowRef(null);
|
|
57
|
+
const messageRef = shallowRef(null);
|
|
58
|
+
const themeMap = (type) => {
|
|
59
|
+
if (!type) return "normal";
|
|
60
|
+
switch (type) {
|
|
61
|
+
case "info": return "primary";
|
|
62
|
+
case "error": return "danger";
|
|
63
|
+
default: return type;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const darkMode = useDarkMode();
|
|
67
|
+
const palette = computed(() => {
|
|
68
|
+
if (!props.color) return null;
|
|
69
|
+
const color = parseColor(props.color);
|
|
70
|
+
if (!color) return null;
|
|
71
|
+
return generatePalette(color.r, color.g, color.b, color.a, darkMode.value);
|
|
72
|
+
});
|
|
73
|
+
const textColor = computed(() => {
|
|
74
|
+
return palette.value ? rgbaColor2string(palette.value[5]) : void 0;
|
|
75
|
+
});
|
|
76
|
+
const closeIconColor = computed(() => {
|
|
77
|
+
if (!palette.value) return;
|
|
78
|
+
return activeFlag.value ? rgbaColor2string(palette.value[6]) : hoverFlag.value ? rgbaColor2string(palette.value[4]) : rgbaColor2string(palette.value[5]);
|
|
79
|
+
});
|
|
80
|
+
function getBorderColor(type = "normal", palette$1) {
|
|
81
|
+
if (palette$1) return palette$1[5];
|
|
82
|
+
else {
|
|
83
|
+
const theme = themeMap(type);
|
|
84
|
+
if (theme === "normal") return getGlobalThemeColor("neutral", 10);
|
|
85
|
+
else if (theme === "loading") return getGlobalThemeColor("neutral", 8);
|
|
86
|
+
else return getGlobalThemeColor(theme, 6);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const draw = (ctx, width, height, borderColor, pixelSize) => {
|
|
90
|
+
ctx.fillStyle = rgbaColor2string(borderColor);
|
|
91
|
+
ctx.fillRect(pixelSize, 0, width - 2 * pixelSize, pixelSize);
|
|
92
|
+
ctx.fillRect(width - pixelSize, pixelSize, pixelSize, height - 2 * pixelSize);
|
|
93
|
+
ctx.fillRect(pixelSize, height - pixelSize, width - 2 * pixelSize, pixelSize);
|
|
94
|
+
ctx.fillRect(0, pixelSize, pixelSize, height - 2 * pixelSize);
|
|
95
|
+
ctx.fillStyle = getGlobalThemeColorString("neutral", 1);
|
|
96
|
+
ctx.fillRect(pixelSize, pixelSize, width - 2 * pixelSize, height - 2 * pixelSize);
|
|
97
|
+
};
|
|
98
|
+
const drawPixel = () => {
|
|
99
|
+
const preprocessData = canvasPreprocess(messageRef, canvasRef);
|
|
100
|
+
if (!preprocessData) return;
|
|
101
|
+
const { ctx, width, height } = preprocessData;
|
|
102
|
+
const pixelSize = calcPixelSize();
|
|
103
|
+
const borderColor = getBorderColor(props.type, palette.value);
|
|
104
|
+
if (borderColor) draw(ctx, width, height, borderColor, pixelSize);
|
|
105
|
+
};
|
|
106
|
+
useResizeObserver(messageRef, drawPixel);
|
|
107
|
+
useWatchGlobalCssVal(drawPixel);
|
|
108
|
+
useTransitionEnd(messageRef, drawPixel);
|
|
109
|
+
watch([
|
|
110
|
+
() => props.type,
|
|
111
|
+
palette,
|
|
112
|
+
darkMode
|
|
113
|
+
], () => {
|
|
114
|
+
setTimeout(() => {
|
|
115
|
+
drawPixel();
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
__expose({ close });
|
|
119
|
+
return () => {
|
|
120
|
+
return createVNode(Transition, {
|
|
121
|
+
"name": "px-message-fade",
|
|
122
|
+
"onAfterLeave": afterLeaveHandler
|
|
123
|
+
}, { default: () => [visible.value && createVNode("div", {
|
|
124
|
+
"ref": (node) => messageRef.value = node,
|
|
125
|
+
"onMouseenter": clearTimer,
|
|
126
|
+
"onMouseleave": startTimer,
|
|
127
|
+
"class": {
|
|
128
|
+
"px-message": true,
|
|
129
|
+
pixelium: true,
|
|
130
|
+
[`px-message__${props.type || "primary"}`]: true
|
|
131
|
+
}
|
|
132
|
+
}, [
|
|
133
|
+
(!!props.icon || props.type && props.type !== "normal" && props.type !== "sakura") && createVNode("div", { "class": "px-message-icon-wrapper" }, [props.icon ? props.icon() : props.type === "info" ? createVNode(info_circle_solid_default, {
|
|
134
|
+
"class": "px-message-icon",
|
|
135
|
+
"style": { fill: textColor.value }
|
|
136
|
+
}, null) : props.type === "success" ? createVNode(check_circle_solid_default, {
|
|
137
|
+
"class": "px-message-icon",
|
|
138
|
+
"style": { fill: textColor.value }
|
|
139
|
+
}, null) : props.type === "warning" ? createVNode(exclamation_triangle_solid_default, {
|
|
140
|
+
"class": "px-message-icon",
|
|
141
|
+
"style": { fill: textColor.value }
|
|
142
|
+
}, null) : props.type === "error" ? createVNode(octagon_times_solid_default, {
|
|
143
|
+
"class": "px-message-icon",
|
|
144
|
+
"style": { fill: textColor.value }
|
|
145
|
+
}, null) : props.type === "loading" && createVNode(spinner_third_solid_default, {
|
|
146
|
+
"class": "px-message-icon px-animation__loading",
|
|
147
|
+
"style": { fill: textColor.value }
|
|
148
|
+
}, null)]),
|
|
149
|
+
createVNode("span", {
|
|
150
|
+
"class": "px-message-content",
|
|
151
|
+
"style": { color: textColor.value }
|
|
152
|
+
}, [y(props.content) ? props.content : props.content()]),
|
|
153
|
+
props.closable && createVNode("div", { "class": "px-message-close-wrapper" }, [createVNode(times_circle_solid_default, {
|
|
154
|
+
"class": "px-message-icon",
|
|
155
|
+
"style": { fill: closeIconColor.value },
|
|
156
|
+
"onMouseenter": toggleHover(true),
|
|
157
|
+
"onMouseleave": toggleHover(false),
|
|
158
|
+
"onMousedown": toggleActive(true),
|
|
159
|
+
"onMouseup": toggleActive(false),
|
|
160
|
+
"onClick": close
|
|
161
|
+
}, null)]),
|
|
162
|
+
createVNode("canvas", {
|
|
163
|
+
"ref": (node) => canvasRef.value = node,
|
|
164
|
+
"class": "px-message-canvas"
|
|
165
|
+
}, null)
|
|
166
|
+
])] });
|
|
167
|
+
};
|
|
168
|
+
}
|
|
50
169
|
});
|
|
51
|
-
|
|
52
|
-
props: {
|
|
53
|
-
size: {},
|
|
54
|
-
color: {}
|
|
55
|
-
},
|
|
56
|
-
setup(__props) {
|
|
57
|
-
const props = __props;
|
|
58
|
-
return (_ctx, _cache) => {
|
|
59
|
-
return openBlock(), createElementBlock(
|
|
60
|
-
"svg",
|
|
61
|
-
{
|
|
62
|
-
class: "px-icon-hn",
|
|
63
|
-
style: normalizeStyle({ color: props.color, fontSize: props.size + "px" }),
|
|
64
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
65
|
-
viewBox: "0 0 24 24"
|
|
66
|
-
},
|
|
67
|
-
[..._cache[0] || (_cache[0] = [
|
|
68
|
-
createElementVNode(
|
|
69
|
-
"path",
|
|
70
|
-
{ d: "M22 20v-2h-1v-2h-1v-2h-1v-2h-1v-2h-1V8h-1V6h-1V4h-1V2h-1V1h-2v1h-1v2H9v2H8v2H7v2H6v2H5v2H4v2H3v2H2v2H1v2h1v1h20v-1h1v-2zm-12-9h4v3h-1v3h-2v-3h-1zm1 7h2v2h-2z" },
|
|
71
|
-
null,
|
|
72
|
-
-1
|
|
73
|
-
/* CACHED */
|
|
74
|
-
)
|
|
75
|
-
])],
|
|
76
|
-
4
|
|
77
|
-
/* STYLE */
|
|
78
|
-
);
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
const OctagonTimesSolid = /* @__PURE__ */ defineComponent({
|
|
83
|
-
props: {
|
|
84
|
-
size: {},
|
|
85
|
-
color: {}
|
|
86
|
-
},
|
|
87
|
-
setup(__props) {
|
|
88
|
-
const props = __props;
|
|
89
|
-
return (_ctx, _cache) => {
|
|
90
|
-
return openBlock(), createElementBlock(
|
|
91
|
-
"svg",
|
|
92
|
-
{
|
|
93
|
-
class: "px-icon-hn",
|
|
94
|
-
style: normalizeStyle({ color: props.color, fontSize: props.size + "px" }),
|
|
95
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
96
|
-
viewBox: "0 0 24 24"
|
|
97
|
-
},
|
|
98
|
-
[..._cache[0] || (_cache[0] = [
|
|
99
|
-
createElementVNode(
|
|
100
|
-
"path",
|
|
101
|
-
{ d: "M22 8V7h-1V6h-1V5h-1V4h-1V3h-1V2h-1V1H8v1H7v1H6v1H5v1H4v1H3v1H2v1H1v8h1v1h1v1h1v1h1v1h1v1h1v1h1v1h8v-1h1v-1h1v-1h1v-1h1v-1h1v-1h1v-1h1V8zm-6 9h-2v-1h-1v-1h-2v1h-1v1H8v-1H7v-2h1v-1h1v-2H8v-1H7V8h1V7h2v1h1v1h2V8h1V7h2v1h1v2h-1v1h-1v2h1v1h1v2h-1z" },
|
|
102
|
-
null,
|
|
103
|
-
-1
|
|
104
|
-
/* CACHED */
|
|
105
|
-
)
|
|
106
|
-
])],
|
|
107
|
-
4
|
|
108
|
-
/* STYLE */
|
|
109
|
-
);
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
const CheckCircleSolid = /* @__PURE__ */ defineComponent({
|
|
114
|
-
props: {
|
|
115
|
-
size: {},
|
|
116
|
-
color: {}
|
|
117
|
-
},
|
|
118
|
-
setup(__props) {
|
|
119
|
-
const props = __props;
|
|
120
|
-
return (_ctx, _cache) => {
|
|
121
|
-
return openBlock(), createElementBlock(
|
|
122
|
-
"svg",
|
|
123
|
-
{
|
|
124
|
-
class: "px-icon-hn",
|
|
125
|
-
style: normalizeStyle({ color: props.color, fontSize: props.size + "px" }),
|
|
126
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
127
|
-
viewBox: "0 0 24 24"
|
|
128
|
-
},
|
|
129
|
-
[..._cache[0] || (_cache[0] = [
|
|
130
|
-
createElementVNode(
|
|
131
|
-
"path",
|
|
132
|
-
{ d: "M22 9V7h-1V5h-1V4h-1V3h-2V2h-2V1H9v1H7v1H5v1H4v1H3v2H2v2H1v6h1v2h1v2h1v1h1v1h2v1h2v1h6v-1h2v-1h2v-1h1v-1h1v-2h1v-2h1V9zm-4 3h-1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-2v-1H9v-1H8v-1H7v-1H6v-2h1v-1h2v1h1v1h2v-1h1v-1h1v-1h1V9h1V8h2v1h1v2h-1z" },
|
|
133
|
-
null,
|
|
134
|
-
-1
|
|
135
|
-
/* CACHED */
|
|
136
|
-
)
|
|
137
|
-
])],
|
|
138
|
-
4
|
|
139
|
-
/* STYLE */
|
|
140
|
-
);
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
145
|
-
__name: "index",
|
|
146
|
-
props: {
|
|
147
|
-
content: {
|
|
148
|
-
default: ""
|
|
149
|
-
},
|
|
150
|
-
icon: null,
|
|
151
|
-
duration: {
|
|
152
|
-
default: 3e3
|
|
153
|
-
},
|
|
154
|
-
id: null,
|
|
155
|
-
type: {
|
|
156
|
-
default: "normal"
|
|
157
|
-
},
|
|
158
|
-
color: null,
|
|
159
|
-
closable: {
|
|
160
|
-
type: Boolean
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
emits: ["close"],
|
|
164
|
-
setup(__props, {
|
|
165
|
-
expose: __expose,
|
|
166
|
-
emit: __emit
|
|
167
|
-
}) {
|
|
168
|
-
const props = __props;
|
|
169
|
-
const hoverFlag = ref(false);
|
|
170
|
-
const activeFlag = ref(false);
|
|
171
|
-
const toggleActive = (status) => {
|
|
172
|
-
activeFlag.value = status;
|
|
173
|
-
};
|
|
174
|
-
const toggleHover = (status) => {
|
|
175
|
-
hoverFlag.value = status;
|
|
176
|
-
};
|
|
177
|
-
const visible = ref(false);
|
|
178
|
-
let timer = void 0;
|
|
179
|
-
onMounted(() => {
|
|
180
|
-
visible.value = true;
|
|
181
|
-
startTimer();
|
|
182
|
-
});
|
|
183
|
-
onBeforeUnmount(() => {
|
|
184
|
-
clearTimeout(timer);
|
|
185
|
-
});
|
|
186
|
-
function startTimer() {
|
|
187
|
-
timer = setTimeout(() => close(), props.duration);
|
|
188
|
-
}
|
|
189
|
-
function clearTimer() {
|
|
190
|
-
clearTimeout(timer);
|
|
191
|
-
timer = void 0;
|
|
192
|
-
}
|
|
193
|
-
function close() {
|
|
194
|
-
visible.value = false;
|
|
195
|
-
}
|
|
196
|
-
const emits = __emit;
|
|
197
|
-
const afterLeaveHandler = () => {
|
|
198
|
-
emits("close", props.id);
|
|
199
|
-
clearTimer();
|
|
200
|
-
};
|
|
201
|
-
const canvasRef = shallowRef(null);
|
|
202
|
-
const messageRef = shallowRef(null);
|
|
203
|
-
const themeMap = (type) => {
|
|
204
|
-
if (!type) {
|
|
205
|
-
return "normal";
|
|
206
|
-
}
|
|
207
|
-
switch (type) {
|
|
208
|
-
case "info":
|
|
209
|
-
return "primary";
|
|
210
|
-
case "error":
|
|
211
|
-
return "danger";
|
|
212
|
-
default:
|
|
213
|
-
return type;
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
const darkMode = useDarkMode();
|
|
217
|
-
const palette = computed(() => {
|
|
218
|
-
if (!props.color) return null;
|
|
219
|
-
const color = parseColor(props.color);
|
|
220
|
-
const palette2 = generatePalette(color.r, color.g, color.b, color.a, darkMode.value);
|
|
221
|
-
return palette2;
|
|
222
|
-
});
|
|
223
|
-
const textColor = computed(() => {
|
|
224
|
-
return palette.value ? rgbaColor2string(palette.value[5]) : void 0;
|
|
225
|
-
});
|
|
226
|
-
const closeIconColor = computed(() => {
|
|
227
|
-
if (!palette.value) {
|
|
228
|
-
return void 0;
|
|
229
|
-
}
|
|
230
|
-
return activeFlag.value ? rgbaColor2string(palette.value[6]) : hoverFlag.value ? rgbaColor2string(palette.value[4]) : rgbaColor2string(palette.value[5]);
|
|
231
|
-
});
|
|
232
|
-
function getBorderColor(type = "normal", palette2) {
|
|
233
|
-
if (palette2) {
|
|
234
|
-
return palette2[5];
|
|
235
|
-
} else {
|
|
236
|
-
const theme = themeMap(type);
|
|
237
|
-
if (theme === "normal") {
|
|
238
|
-
return getGlobalThemeColor("neutral", 10);
|
|
239
|
-
} else if (theme === "loading") {
|
|
240
|
-
return getGlobalThemeColor("neutral", 8);
|
|
241
|
-
} else {
|
|
242
|
-
return getGlobalThemeColor(theme, 6);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
const draw = (ctx, width, height, borderColor, pixelSize) => {
|
|
247
|
-
ctx.fillStyle = rgbaColor2string(borderColor);
|
|
248
|
-
ctx.fillRect(pixelSize, 0, width - 2 * pixelSize, pixelSize);
|
|
249
|
-
ctx.fillRect(width - pixelSize, pixelSize, pixelSize, height - 2 * pixelSize);
|
|
250
|
-
ctx.fillRect(pixelSize, height - pixelSize, width - 2 * pixelSize, pixelSize);
|
|
251
|
-
ctx.fillRect(0, pixelSize, pixelSize, height - 2 * pixelSize);
|
|
252
|
-
const backgroundColor = getGlobalThemeColor("neutral", 1);
|
|
253
|
-
ctx.fillStyle = rgbaColor2string(backgroundColor);
|
|
254
|
-
ctx.fillRect(pixelSize, pixelSize, width - 2 * pixelSize, height - 2 * pixelSize);
|
|
255
|
-
};
|
|
256
|
-
const drawPixel = () => {
|
|
257
|
-
const preprocessData = canvasPreprocess(messageRef, canvasRef);
|
|
258
|
-
if (!preprocessData) {
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
const {
|
|
262
|
-
ctx,
|
|
263
|
-
width,
|
|
264
|
-
height
|
|
265
|
-
} = preprocessData;
|
|
266
|
-
const pixelSize = calcPixelSize();
|
|
267
|
-
const borderColor = getBorderColor(props.type, palette.value);
|
|
268
|
-
draw(ctx, width, height, borderColor, pixelSize);
|
|
269
|
-
};
|
|
270
|
-
useResizeObserver(messageRef, drawPixel);
|
|
271
|
-
useWatchGlobalCssVal(drawPixel);
|
|
272
|
-
watch([() => props.type, palette, darkMode], () => {
|
|
273
|
-
setTimeout(() => {
|
|
274
|
-
drawPixel();
|
|
275
|
-
});
|
|
276
|
-
});
|
|
277
|
-
__expose({
|
|
278
|
-
close
|
|
279
|
-
});
|
|
280
|
-
return () => {
|
|
281
|
-
return createVNode(Transition, {
|
|
282
|
-
"name": "px-message-fade",
|
|
283
|
-
"onAfterLeave": afterLeaveHandler
|
|
284
|
-
}, {
|
|
285
|
-
default: () => [visible.value && createVNode("div", {
|
|
286
|
-
"ref": (node) => messageRef.value = node,
|
|
287
|
-
"onMouseenter": clearTimer,
|
|
288
|
-
"onMouseleave": startTimer,
|
|
289
|
-
"class": {
|
|
290
|
-
"px-message": true,
|
|
291
|
-
pixelium: true,
|
|
292
|
-
[`px-message__${props.type || "primary"}`]: true
|
|
293
|
-
}
|
|
294
|
-
}, [(!!props.icon || props.type && props.type !== "normal" && props.type !== "sakura") && createVNode("div", {
|
|
295
|
-
"class": "px-message-icon-wrapper"
|
|
296
|
-
}, [props.icon ? props.icon() : props.type === "info" ? createVNode(InfoCircleSolid, {
|
|
297
|
-
"class": "px-message-icon",
|
|
298
|
-
"style": {
|
|
299
|
-
fill: textColor.value
|
|
300
|
-
}
|
|
301
|
-
}, null) : props.type === "success" ? createVNode(CheckCircleSolid, {
|
|
302
|
-
"class": "px-message-icon",
|
|
303
|
-
"style": {
|
|
304
|
-
fill: textColor.value
|
|
305
|
-
}
|
|
306
|
-
}, null) : props.type === "warning" ? createVNode(ExclamationTriangleSolid, {
|
|
307
|
-
"class": "px-message-icon",
|
|
308
|
-
"style": {
|
|
309
|
-
fill: textColor.value
|
|
310
|
-
}
|
|
311
|
-
}, null) : props.type === "error" ? createVNode(OctagonTimesSolid, {
|
|
312
|
-
"class": "px-message-icon",
|
|
313
|
-
"style": {
|
|
314
|
-
fill: textColor.value
|
|
315
|
-
}
|
|
316
|
-
}, null) : props.type === "loading" && createVNode(SpinnerThirdSolid, {
|
|
317
|
-
"class": "px-message-icon px-animation__loading",
|
|
318
|
-
"style": {
|
|
319
|
-
fill: textColor.value
|
|
320
|
-
}
|
|
321
|
-
}, null)]), createVNode("span", {
|
|
322
|
-
"class": "px-message-content",
|
|
323
|
-
"style": {
|
|
324
|
-
color: textColor.value
|
|
325
|
-
}
|
|
326
|
-
}, [p(props.content) ? props.content : props.content()]), props.closable && createVNode("div", {
|
|
327
|
-
"class": "px-message-close-wrapper"
|
|
328
|
-
}, [createVNode(TimesCircleSolid, {
|
|
329
|
-
"class": "px-message-icon",
|
|
330
|
-
"style": {
|
|
331
|
-
fill: closeIconColor.value
|
|
332
|
-
},
|
|
333
|
-
"onMouseenter": toggleHover(true),
|
|
334
|
-
"onMouseleave": toggleHover(false),
|
|
335
|
-
"onMousedown": toggleActive(true),
|
|
336
|
-
"onMouseup": toggleActive(false),
|
|
337
|
-
"onClick": close
|
|
338
|
-
}, null)]), createVNode("canvas", {
|
|
339
|
-
"ref": (node) => canvasRef.value = node,
|
|
340
|
-
"class": "px-message-canvas"
|
|
341
|
-
}, null)])]
|
|
342
|
-
});
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
});
|
|
346
|
-
export {
|
|
347
|
-
_sfc_main as _
|
|
348
|
-
};
|
|
170
|
+
export { message_default as t };
|
package/es/message-box/css.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import '../index.css'
|
|
2
|
-
import './
|
|
2
|
+
import './index.css'
|