@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/spin/index.js
CHANGED
|
@@ -1,104 +1,74 @@
|
|
|
1
1
|
import './css.js'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
-
}
|
|
2
|
+
import { B as y, V as spinner_third_solid_default, g as A } from "../vendor.js";
|
|
3
|
+
import { n as COVER_Z_INDEX } from "../share/const/index.js";
|
|
4
|
+
import { t as mask_default } from "../mask/index.js";
|
|
5
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, normalizeClass, normalizeStyle, openBlock, renderSlot, unref, useSlots } from "vue";
|
|
6
|
+
var _hoisted_1 = { class: "px-spin-content" };
|
|
7
|
+
var spin_default = /* @__PURE__ */ defineComponent({
|
|
8
|
+
name: "Spin",
|
|
9
|
+
__name: "index",
|
|
10
|
+
props: {
|
|
11
|
+
loading: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: void 0
|
|
14
|
+
},
|
|
15
|
+
size: { default: "medium" },
|
|
16
|
+
maskProps: null,
|
|
17
|
+
zIndex: { default: 20 },
|
|
18
|
+
maskColor: null,
|
|
19
|
+
maskStep: { default: 1 },
|
|
20
|
+
maskLineWidth: { default: 2 },
|
|
21
|
+
maskGrid: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: true
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
setup(__props) {
|
|
27
|
+
const props = __props;
|
|
28
|
+
const slots = useSlots();
|
|
29
|
+
const sizeValue = computed(() => {
|
|
30
|
+
return A(props.size) ? `${props.size}px` : void 0;
|
|
31
|
+
});
|
|
32
|
+
const loadingComputed = computed(() => {
|
|
33
|
+
return slots.default ? !!props.loading : props.loading !== false;
|
|
34
|
+
});
|
|
35
|
+
return (_ctx, _cache) => {
|
|
36
|
+
return openBlock(), createElementBlock("div", {
|
|
37
|
+
class: normalizeClass(["pixelium px-spin", { [`px-spin__${props.size}`]: unref(y)(props.size) }]),
|
|
38
|
+
style: normalizeStyle({
|
|
39
|
+
minWidth: sizeValue.value,
|
|
40
|
+
minHeight: sizeValue.value
|
|
41
|
+
})
|
|
42
|
+
}, [renderSlot(_ctx.$slots, "default"), loadingComputed.value ? (openBlock(), createElementBlock("div", {
|
|
43
|
+
key: 0,
|
|
44
|
+
class: "px-spin-cover",
|
|
45
|
+
style: normalizeStyle({ zIndex: props.zIndex })
|
|
46
|
+
}, [unref(slots).default ? (openBlock(), createBlock(mask_default, mergeProps({
|
|
47
|
+
key: 0,
|
|
48
|
+
"z-index": 0,
|
|
49
|
+
color: props.maskColor,
|
|
50
|
+
step: props.maskStep,
|
|
51
|
+
"line-width": props.maskLineWidth,
|
|
52
|
+
grid: props.maskGrid
|
|
53
|
+
}, props.maskProps), null, 16, [
|
|
54
|
+
"color",
|
|
55
|
+
"step",
|
|
56
|
+
"line-width",
|
|
57
|
+
"grid"
|
|
58
|
+
])) : createCommentVNode("v-if", true), createElementVNode("div", _hoisted_1, [createElementVNode("div", {
|
|
59
|
+
class: normalizeClass(["px-spin-icon-wrapper", {
|
|
60
|
+
"px-spin-icon-wrapper__last": !unref(slots).description,
|
|
61
|
+
[`px-spin-icon-wrapper__${props.size}`]: unref(y)(props.size)
|
|
62
|
+
}]),
|
|
63
|
+
style: normalizeStyle({ fontSize: sizeValue.value })
|
|
64
|
+
}, [renderSlot(_ctx.$slots, "icon", {}, () => [createVNode(unref(spinner_third_solid_default), {
|
|
65
|
+
class: "px-spin-icon px-animation__loading",
|
|
66
|
+
style: normalizeStyle({
|
|
67
|
+
width: sizeValue.value,
|
|
68
|
+
height: sizeValue.value
|
|
69
|
+
})
|
|
70
|
+
}, null, 8, ["style"])])], 6), renderSlot(_ctx.$slots, "description")])], 4)) : createCommentVNode("v-if", true)], 6);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
101
73
|
});
|
|
102
|
-
export {
|
|
103
|
-
_sfc_main as _
|
|
104
|
-
};
|
|
74
|
+
export { spin_default as t };
|
package/es/spin/type.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MaskProps } from '../mask/type';
|
|
1
2
|
export type SpinProps = {
|
|
2
3
|
/**
|
|
3
4
|
* @property {boolean} [loading]
|
|
@@ -9,6 +10,16 @@ export type SpinProps = {
|
|
|
9
10
|
* @version 0.0.2
|
|
10
11
|
*/
|
|
11
12
|
size?: 'medium' | 'large' | 'small' | number;
|
|
13
|
+
/**
|
|
14
|
+
* @property {Omit<MaskProps, 'zIndex'>} [maskProps]
|
|
15
|
+
* @version 0.0.3
|
|
16
|
+
*/
|
|
17
|
+
maskProps?: Omit<MaskProps, 'zIndex'>;
|
|
18
|
+
/**
|
|
19
|
+
* @property {number} [zIndex=20]
|
|
20
|
+
* @version 0.0.2
|
|
21
|
+
*/
|
|
22
|
+
zIndex?: number;
|
|
12
23
|
/**
|
|
13
24
|
* @property {string} [maskColor]
|
|
14
25
|
* @version 0.0.2
|
|
@@ -29,11 +40,6 @@ export type SpinProps = {
|
|
|
29
40
|
* @version 0.0.2
|
|
30
41
|
*/
|
|
31
42
|
maskGrid?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* @property {number} [zIndex=20]
|
|
34
|
-
* @version 0.0.2
|
|
35
|
-
*/
|
|
36
|
-
zIndex?: number;
|
|
37
43
|
};
|
|
38
44
|
export type SpinSlots = {
|
|
39
45
|
/**
|
package/es/switch/css.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { RgbaColor } from '../share/type';
|
|
2
|
+
export declare const drawBorder: (ctx: CanvasRenderingContext2D, width: number, height: number, center: [number, number][], borderRadius: number[], rad: [number, number][], borderColor: RgbaColor, pixelSize: number, paddingX?: number, paddingY?: number, small?: boolean, smooth?: boolean) => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { a as drawCircle, o as drawSmoothCircle } from "../share/util/plot.js";
|
|
2
|
+
import { a as rgbaColor2string } from "../share/util/color.js";
|
|
3
|
+
const drawBorder = (ctx, width, height, center, borderRadius, rad, borderColor, pixelSize, paddingX = 0, paddingY = 0, small = false, smooth = false) => {
|
|
4
|
+
ctx.fillStyle = rgbaColor2string(borderColor);
|
|
5
|
+
for (let i = 0; i < 4; i++) if (borderRadius[i] > pixelSize || small && borderRadius[i] === pixelSize) if (!smooth) drawCircle(ctx, center[i][0] + paddingX, center[i][1] + paddingY, borderRadius[i], rad[i][0], rad[i][1], pixelSize);
|
|
6
|
+
else drawSmoothCircle(ctx, center[i][0] + paddingX, center[i][1] + paddingY, borderRadius[i], rad[i][0], rad[i][1], pixelSize);
|
|
7
|
+
if (center[1][0] + pixelSize > center[0][0]) {
|
|
8
|
+
let length = center[1][0] - center[0][0] + pixelSize;
|
|
9
|
+
ctx.fillRect(center[0][0] + paddingX, paddingY, length, pixelSize);
|
|
10
|
+
}
|
|
11
|
+
if (center[2][1] + pixelSize > center[1][1]) ctx.fillRect(width - pixelSize + paddingX, center[1][1] + paddingY, pixelSize, center[2][1] - center[1][1] + pixelSize);
|
|
12
|
+
if (center[3][0] < center[2][0] + pixelSize) {
|
|
13
|
+
let length = center[2][0] - center[3][0] + pixelSize;
|
|
14
|
+
ctx.fillRect(center[3][0] + paddingX, height - pixelSize + paddingY, length, pixelSize);
|
|
15
|
+
}
|
|
16
|
+
if (center[3][1] + pixelSize > center[0][1]) ctx.fillRect(paddingX, center[0][1] + paddingY, pixelSize, center[3][1] - center[0][1] + pixelSize);
|
|
17
|
+
};
|
|
18
|
+
export { drawBorder as t };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
.px-switch-canvas {
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: 50%;
|
|
4
|
+
left: 50%;
|
|
5
|
+
transform: translate(-50%, -50%);
|
|
6
|
+
z-index: -1;
|
|
7
|
+
pointer-events: none;
|
|
8
|
+
}
|
|
9
|
+
.px-switch {
|
|
10
|
+
--switch-height: var(--px-medium-compat-size);
|
|
11
|
+
--switch-width: calc(var(--switch-height) * 2);
|
|
12
|
+
--text-color: var(--px-neutral-10);
|
|
13
|
+
--switch-button-size: calc(var(--switch-height) - 8px);
|
|
14
|
+
--icon-size: calc(var(--switch-button-size) - 4px - 2px);
|
|
15
|
+
min-height: var(--switch-height);
|
|
16
|
+
min-width: var(--switch-width);
|
|
17
|
+
background-color: transparent;
|
|
18
|
+
color: var(--text-color);
|
|
19
|
+
display: inline-flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
position: relative;
|
|
22
|
+
transition: 0.25s;
|
|
23
|
+
z-index: 0;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
}
|
|
26
|
+
.px-switch.px-switch__small {
|
|
27
|
+
font-size: 12px;
|
|
28
|
+
}
|
|
29
|
+
.px-switch.px-switch__medium {
|
|
30
|
+
font-size: 14px;
|
|
31
|
+
}
|
|
32
|
+
.px-switch.px-switch__large {
|
|
33
|
+
font-size: 15px;
|
|
34
|
+
}
|
|
35
|
+
.px-switch__active .px-switch-canvas-wrapper {
|
|
36
|
+
padding-left: 8px;
|
|
37
|
+
padding-right: calc(var(--switch-button-size) + 4px + 2px);
|
|
38
|
+
}
|
|
39
|
+
.px-switch__inactive .px-switch-canvas-wrapper {
|
|
40
|
+
padding-right: 8px;
|
|
41
|
+
padding-left: calc(var(--switch-button-size) + 4px + 2px);
|
|
42
|
+
}
|
|
43
|
+
.px-switch-canvas-wrapper {
|
|
44
|
+
transition: 0.25s;
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
border-color: transparent;
|
|
47
|
+
border-width: var(--px-bit);
|
|
48
|
+
border-style: solid;
|
|
49
|
+
min-width: var(--switch-width);
|
|
50
|
+
height: var(--switch-height);
|
|
51
|
+
position: relative;
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
}
|
|
55
|
+
.px-switch__small {
|
|
56
|
+
--switch-height: var(--px-small-compat-size);
|
|
57
|
+
}
|
|
58
|
+
.px-switch__large {
|
|
59
|
+
--switch-height: var(--px-large-compat-size);
|
|
60
|
+
}
|
|
61
|
+
.px-switch-inner {
|
|
62
|
+
position: absolute;
|
|
63
|
+
width: 0;
|
|
64
|
+
height: 0;
|
|
65
|
+
opacity: 0;
|
|
66
|
+
margin: 0;
|
|
67
|
+
}
|
|
68
|
+
.px-switch__readonly {
|
|
69
|
+
cursor: auto;
|
|
70
|
+
}
|
|
71
|
+
.px-switch__disabled {
|
|
72
|
+
cursor: not-allowed;
|
|
73
|
+
}
|
|
74
|
+
.px-switch-button {
|
|
75
|
+
position: absolute;
|
|
76
|
+
height: var(--switch-button-size);
|
|
77
|
+
width: var(--switch-button-size);
|
|
78
|
+
display: flex;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
align-items: center;
|
|
81
|
+
top: 50%;
|
|
82
|
+
transform: translateY(-50%);
|
|
83
|
+
user-select: none;
|
|
84
|
+
font-size: var(--icon-size);
|
|
85
|
+
}
|
|
86
|
+
.px-switch-button .px-switch-icon {
|
|
87
|
+
width: 1em;
|
|
88
|
+
height: 1em;
|
|
89
|
+
}
|
|
90
|
+
.px-switch-prefix-wrapper {
|
|
91
|
+
flex-shrink: 0;
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
margin-right: 4px;
|
|
95
|
+
}
|
|
96
|
+
.px-switch-prefix-wrapper__on {
|
|
97
|
+
color: var(--px-primary-6);
|
|
98
|
+
}
|
|
99
|
+
.px-switch-suffix-wrapper {
|
|
100
|
+
flex-shrink: 0;
|
|
101
|
+
display: flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
margin-left: 4px;
|
|
104
|
+
}
|
|
105
|
+
.px-switch-suffix-wrapper__on {
|
|
106
|
+
color: var(--px-primary-6);
|
|
107
|
+
}
|
|
108
|
+
.px-switch-active-wrapper {
|
|
109
|
+
flex-shrink: 0;
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
color: var(--px-neutral-1);
|
|
113
|
+
user-select: none;
|
|
114
|
+
}
|
|
115
|
+
.px-switch-inactive-wrapper {
|
|
116
|
+
flex-shrink: 0;
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
color: var(--px-neutral-1);
|
|
120
|
+
user-select: none;
|
|
121
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { SwitchProps } from './type';
|
|
2
|
+
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_12: {}, __VLS_14: {}, __VLS_16: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
'inactive-label'?: (props: typeof __VLS_1) => any;
|
|
5
|
+
} & {
|
|
6
|
+
'active-tip'?: (props: typeof __VLS_3) => any;
|
|
7
|
+
} & {
|
|
8
|
+
'inactive-tip'?: (props: typeof __VLS_5) => any;
|
|
9
|
+
} & {
|
|
10
|
+
'active-icon'?: (props: typeof __VLS_12) => any;
|
|
11
|
+
} & {
|
|
12
|
+
'inactive-icon'?: (props: typeof __VLS_14) => any;
|
|
13
|
+
} & {
|
|
14
|
+
'active-label'?: (props: typeof __VLS_16) => any;
|
|
15
|
+
};
|
|
16
|
+
declare const __VLS_component: import("vue").DefineComponent<SwitchProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
17
|
+
change: (value: boolean, event: Event) => any;
|
|
18
|
+
blur: (event: FocusEvent) => any;
|
|
19
|
+
input: (value: boolean, event: InputEvent) => any;
|
|
20
|
+
focus: (event: FocusEvent) => any;
|
|
21
|
+
"update:modelValue": (value: boolean) => any;
|
|
22
|
+
}, string, import("vue").PublicProps, Readonly<SwitchProps> & Readonly<{
|
|
23
|
+
onChange?: ((value: boolean, event: Event) => any) | undefined;
|
|
24
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
25
|
+
onInput?: ((value: boolean, event: InputEvent) => any) | undefined;
|
|
26
|
+
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
27
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
28
|
+
}>, {
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
readonly: boolean;
|
|
31
|
+
shape: "round" | "rect" | "default";
|
|
32
|
+
loading: boolean;
|
|
33
|
+
modelValue: boolean | null;
|
|
34
|
+
defaultValue: boolean | null;
|
|
35
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
36
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
37
|
+
export default _default;
|
|
38
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
39
|
+
new (): {
|
|
40
|
+
$slots: S;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import './css.js'
|
|
2
|
+
import { V as spinner_third_solid_default } from "../vendor.js";
|
|
3
|
+
import { l as TRANSPARENT_RGBA_COLOR_OBJECT, t as BORDER_CORNER_RAD_RANGE } from "../share/const/index.js";
|
|
4
|
+
import { t as inBrowser } from "../share/util/env.js";
|
|
5
|
+
import { n as INTERVAL } from "../share/const/style.js";
|
|
6
|
+
import { i as canvasPreprocess, l as getBorderRadius, n as calcPixelSize, o as drawSmoothCircle, s as floodFill, t as calcBorderCornerCenter } from "../share/util/plot.js";
|
|
7
|
+
import { a as rgbaColor2string, i as parseColor, n as getGlobalThemeColor } from "../share/util/color.js";
|
|
8
|
+
import { t as useDarkMode } from "../share/hook/use-dark-mode.js";
|
|
9
|
+
import { t as useResizeObserver } from "../share/hook/use-resize-observer.js";
|
|
10
|
+
import { t as useWatchGlobalCssVal } from "../share/hook/use-watch-global-css-var.js";
|
|
11
|
+
import { i as FORM_ITEM_PROVIDE } from "../share/const/provide-key.js";
|
|
12
|
+
import { t as createProvideComputed } from "../share/util/reactivity.js";
|
|
13
|
+
import { t as useTransitionEnd } from "../share/hook/use-transition-end.js";
|
|
14
|
+
import { t as useControlledMode } from "../share/hook/use-controlled-mode.js";
|
|
15
|
+
import { t as drawBorder } from "./draw.js";
|
|
16
|
+
import { t as useSmoothTransition } from "../share/hook/use-smooth-transition.js";
|
|
17
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, inject, nextTick, normalizeClass, normalizeStyle, onMounted, openBlock, ref, renderSlot, shallowRef, toDisplayString, unref, useSlots, watch, withModifiers } from "vue";
|
|
18
|
+
var _hoisted_1 = {
|
|
19
|
+
key: 0,
|
|
20
|
+
class: "px-switch-active-wrapper"
|
|
21
|
+
};
|
|
22
|
+
var _hoisted_2 = {
|
|
23
|
+
key: 1,
|
|
24
|
+
class: "px-switch-inactive-wrapper"
|
|
25
|
+
};
|
|
26
|
+
var _hoisted_3 = ["disabled", "checked"];
|
|
27
|
+
var MID_PROGRESS = .5;
|
|
28
|
+
var ANIMATION_DURATION = 250;
|
|
29
|
+
var switch_default = /* @__PURE__ */ defineComponent({
|
|
30
|
+
name: "Switch",
|
|
31
|
+
__name: "index",
|
|
32
|
+
props: {
|
|
33
|
+
modelValue: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: void 0
|
|
36
|
+
},
|
|
37
|
+
defaultValue: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: void 0
|
|
40
|
+
},
|
|
41
|
+
shape: { default: "round" },
|
|
42
|
+
size: null,
|
|
43
|
+
readonly: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: false
|
|
46
|
+
},
|
|
47
|
+
disabled: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false
|
|
50
|
+
},
|
|
51
|
+
loading: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false
|
|
54
|
+
},
|
|
55
|
+
activeTip: null,
|
|
56
|
+
inactiveTip: null,
|
|
57
|
+
activeLabel: null,
|
|
58
|
+
inactiveLabel: null,
|
|
59
|
+
activeColor: null,
|
|
60
|
+
inactiveColor: null
|
|
61
|
+
},
|
|
62
|
+
emits: [
|
|
63
|
+
"update:modelValue",
|
|
64
|
+
"input",
|
|
65
|
+
"change",
|
|
66
|
+
"focus",
|
|
67
|
+
"blur"
|
|
68
|
+
],
|
|
69
|
+
setup(__props, { emit: __emit }) {
|
|
70
|
+
const props = __props;
|
|
71
|
+
const emits = __emit;
|
|
72
|
+
const slots = useSlots();
|
|
73
|
+
const darkMode = useDarkMode();
|
|
74
|
+
const canvasRef = shallowRef(null);
|
|
75
|
+
const buttonCanvasRef = shallowRef(null);
|
|
76
|
+
const switchButtonRef = shallowRef(null);
|
|
77
|
+
const canvasWrapperRef = shallowRef(null);
|
|
78
|
+
const [modelValue, updateModelValue] = useControlledMode("modelValue", props, emits, {
|
|
79
|
+
defaultField: "defaultValue",
|
|
80
|
+
transform(nextValue) {
|
|
81
|
+
return !!nextValue;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
const formItemProvide = inject(FORM_ITEM_PROVIDE, void 0);
|
|
85
|
+
const disabledComputed = createProvideComputed("disabled", [formItemProvide, props], "or");
|
|
86
|
+
const readonlyComputed = createProvideComputed("readonly", [formItemProvide, props], "or");
|
|
87
|
+
const sizeComputed = createProvideComputed("size", () => [
|
|
88
|
+
props.size && props,
|
|
89
|
+
formItemProvide,
|
|
90
|
+
props
|
|
91
|
+
], "nullish", (val) => val || "medium");
|
|
92
|
+
const [progress, play] = useSmoothTransition(ANIMATION_DURATION, modelValue.value ? 1 : 0);
|
|
93
|
+
const inputHandler = async (e) => {
|
|
94
|
+
const newValue = e.target.checked;
|
|
95
|
+
modelValue.value = newValue;
|
|
96
|
+
emits("input", newValue, e);
|
|
97
|
+
await updateModelValue(newValue);
|
|
98
|
+
play(modelValue.value ? "forward" : "backward");
|
|
99
|
+
formItemProvide === null || formItemProvide === void 0 || formItemProvide.inputHandler();
|
|
100
|
+
};
|
|
101
|
+
const changeHandler = (e) => {
|
|
102
|
+
const target = e.target;
|
|
103
|
+
emits("change", target.checked, e);
|
|
104
|
+
formItemProvide === null || formItemProvide === void 0 || formItemProvide.changeHandler();
|
|
105
|
+
};
|
|
106
|
+
const blurHandler = (e) => {
|
|
107
|
+
emits("blur", e);
|
|
108
|
+
formItemProvide === null || formItemProvide === void 0 || formItemProvide.blurHandler();
|
|
109
|
+
};
|
|
110
|
+
const focusHandler = (e) => {
|
|
111
|
+
emits("focus", e);
|
|
112
|
+
};
|
|
113
|
+
onMounted(() => {
|
|
114
|
+
nextTick(() => {
|
|
115
|
+
drawPixel();
|
|
116
|
+
updateIconLeft();
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
const updateSize = () => {
|
|
120
|
+
if (!canvasWrapperRef.value) return;
|
|
121
|
+
size.value = [canvasWrapperRef.value.clientWidth, canvasWrapperRef.value.clientHeight];
|
|
122
|
+
};
|
|
123
|
+
const size = ref([0, 0]);
|
|
124
|
+
const updateIconLeft = () => {
|
|
125
|
+
if (size.value[0] === 0 || size.value[1] === 0) return 0;
|
|
126
|
+
const pixelSize = calcPixelSize();
|
|
127
|
+
const intervalSize = 4;
|
|
128
|
+
const sliceHeight = size.value[1] + 2 * pixelSize - intervalSize * 2;
|
|
129
|
+
const start = intervalSize / 2;
|
|
130
|
+
iconLeft.value = start + (size.value[0] - sliceHeight - intervalSize / 2 - start) * progress.value;
|
|
131
|
+
};
|
|
132
|
+
const iconLeft = ref(0);
|
|
133
|
+
const getMainColor = () => {
|
|
134
|
+
if (!inBrowser()) return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
135
|
+
return progress.value > MID_PROGRESS ? props.activeColor ? parseColor(props.activeColor) : disabledComputed.value ? getGlobalThemeColor("primary", 2) : getGlobalThemeColor("primary", 6) : props.inactiveColor ? parseColor(props.inactiveColor) : disabledComputed.value ? getGlobalThemeColor("neutral", 6) : getGlobalThemeColor("neutral", 8);
|
|
136
|
+
};
|
|
137
|
+
const iconColor = computed(() => {
|
|
138
|
+
const color = getMainColor();
|
|
139
|
+
return color ? rgbaColor2string(color) : void 0;
|
|
140
|
+
});
|
|
141
|
+
watch([
|
|
142
|
+
size,
|
|
143
|
+
progress,
|
|
144
|
+
sizeComputed
|
|
145
|
+
], () => {
|
|
146
|
+
updateIconLeft();
|
|
147
|
+
}, { deep: true });
|
|
148
|
+
watch([
|
|
149
|
+
darkMode,
|
|
150
|
+
progress,
|
|
151
|
+
sizeComputed,
|
|
152
|
+
() => props.shape,
|
|
153
|
+
disabledComputed,
|
|
154
|
+
() => props.activeColor,
|
|
155
|
+
() => props.inactiveColor,
|
|
156
|
+
iconLeft
|
|
157
|
+
], () => {
|
|
158
|
+
drawPixel();
|
|
159
|
+
});
|
|
160
|
+
const drawButton = () => {
|
|
161
|
+
const buttonPreprocessData = canvasPreprocess(switchButtonRef, buttonCanvasRef);
|
|
162
|
+
if (!buttonPreprocessData) return;
|
|
163
|
+
const { ctx, width, height } = buttonPreprocessData;
|
|
164
|
+
const size$1 = Math.min(width, height);
|
|
165
|
+
const pixelSize = calcPixelSize();
|
|
166
|
+
const sliceColor = getGlobalThemeColor("neutral", 1);
|
|
167
|
+
if (!sliceColor) return;
|
|
168
|
+
ctx.fillStyle = rgbaColor2string(sliceColor);
|
|
169
|
+
const radius = Math.round(size$1 / 2 - pixelSize / 2);
|
|
170
|
+
if (props.shape === "round") drawSmoothCircle(ctx, radius, radius, radius, 0, Math.PI * 2, pixelSize);
|
|
171
|
+
else ctx.fillRect(0, 0, size$1, size$1);
|
|
172
|
+
floodFill(ctx, Math.round(radius + 1), Math.round(radius + 1), sliceColor);
|
|
173
|
+
};
|
|
174
|
+
const drawPixel = () => {
|
|
175
|
+
const preprocessData = canvasPreprocess(canvasWrapperRef, canvasRef);
|
|
176
|
+
if (!preprocessData) return;
|
|
177
|
+
const { ctx, width, height, canvas } = preprocessData;
|
|
178
|
+
const pixelSize = calcPixelSize();
|
|
179
|
+
const borderRadius = getBorderRadius(canvas, pixelSize, void 0, props.shape, "medium", false, false, false);
|
|
180
|
+
const backgroundColor = getMainColor();
|
|
181
|
+
const center = calcBorderCornerCenter(borderRadius, width, height, pixelSize);
|
|
182
|
+
const rad = BORDER_CORNER_RAD_RANGE;
|
|
183
|
+
if (backgroundColor) {
|
|
184
|
+
drawBorder(ctx, width, height, center, borderRadius, rad, backgroundColor, pixelSize, 0, 0, sizeComputed.value === "small" && props.shape === "round");
|
|
185
|
+
floodFill(ctx, Math.round(width / 2), Math.round(height / 2), backgroundColor);
|
|
186
|
+
}
|
|
187
|
+
drawButton();
|
|
188
|
+
};
|
|
189
|
+
const refresh = () => {
|
|
190
|
+
drawPixel();
|
|
191
|
+
updateSize();
|
|
192
|
+
};
|
|
193
|
+
useResizeObserver(canvasWrapperRef, refresh);
|
|
194
|
+
useWatchGlobalCssVal(refresh);
|
|
195
|
+
useTransitionEnd(canvasWrapperRef, refresh);
|
|
196
|
+
return (_ctx, _cache) => {
|
|
197
|
+
return openBlock(), createElementBlock("label", {
|
|
198
|
+
class: normalizeClass(["pixelium px-switch", {
|
|
199
|
+
[`px-switch__${unref(sizeComputed)}`]: unref(sizeComputed),
|
|
200
|
+
[`px-switch__readonly`]: unref(readonlyComputed),
|
|
201
|
+
[`px-switch__disabled`]: unref(disabledComputed),
|
|
202
|
+
[`px-switch__active`]: unref(progress) > MID_PROGRESS,
|
|
203
|
+
[`px-switch__inactive`]: unref(progress) <= MID_PROGRESS
|
|
204
|
+
}]),
|
|
205
|
+
ref: "switchRef"
|
|
206
|
+
}, [
|
|
207
|
+
unref(slots)["inactive-label"] || props.inactiveLabel ? (openBlock(), createElementBlock("div", {
|
|
208
|
+
key: 0,
|
|
209
|
+
class: normalizeClass(["px-switch-prefix-wrapper", { "px-switch-prefix-wrapper__on": unref(progress) <= MID_PROGRESS }])
|
|
210
|
+
}, [renderSlot(_ctx.$slots, "inactive-label", {}, () => [createTextVNode(toDisplayString(props.inactiveLabel), 1)])], 2)) : createCommentVNode("v-if", true),
|
|
211
|
+
createElementVNode("div", {
|
|
212
|
+
class: "px-switch-canvas-wrapper",
|
|
213
|
+
ref_key: "canvasWrapperRef",
|
|
214
|
+
ref: canvasWrapperRef
|
|
215
|
+
}, [
|
|
216
|
+
(unref(slots)["active-tip"] || props.activeTip) && unref(progress) > MID_PROGRESS ? (openBlock(), createElementBlock("div", _hoisted_1, [renderSlot(_ctx.$slots, "active-tip", {}, () => [createTextVNode(toDisplayString(props.activeTip), 1)])])) : createCommentVNode("v-if", true),
|
|
217
|
+
(unref(slots)["inactive-tip"] || props.inactiveTip) && unref(progress) <= MID_PROGRESS ? (openBlock(), createElementBlock("div", _hoisted_2, [renderSlot(_ctx.$slots, "inactive-tip", {}, () => [createTextVNode(toDisplayString(props.inactiveTip), 1)])])) : createCommentVNode("v-if", true),
|
|
218
|
+
createElementVNode("canvas", {
|
|
219
|
+
ref_key: "canvasRef",
|
|
220
|
+
ref: canvasRef,
|
|
221
|
+
class: "px-switch-canvas"
|
|
222
|
+
}, null, 512),
|
|
223
|
+
createElementVNode("div", {
|
|
224
|
+
class: "px-switch-button",
|
|
225
|
+
ref_key: "switchButtonRef",
|
|
226
|
+
ref: switchButtonRef,
|
|
227
|
+
style: normalizeStyle({
|
|
228
|
+
left: `${iconLeft.value}px`,
|
|
229
|
+
fill: iconColor.value,
|
|
230
|
+
color: iconColor.value
|
|
231
|
+
})
|
|
232
|
+
}, [props.loading ? (openBlock(), createBlock(unref(spinner_third_solid_default), {
|
|
233
|
+
key: 0,
|
|
234
|
+
class: "px-switch-icon px-animation__loading"
|
|
235
|
+
})) : unref(progress) > MID_PROGRESS ? renderSlot(_ctx.$slots, "active-icon", { key: 1 }) : renderSlot(_ctx.$slots, "inactive-icon", { key: 2 }), createElementVNode("canvas", {
|
|
236
|
+
ref_key: "buttonCanvasRef",
|
|
237
|
+
ref: buttonCanvasRef,
|
|
238
|
+
class: "px-switch-canvas"
|
|
239
|
+
}, null, 512)], 4)
|
|
240
|
+
], 512),
|
|
241
|
+
unref(slots)["active-label"] || props.activeLabel ? (openBlock(), createElementBlock("div", {
|
|
242
|
+
key: 1,
|
|
243
|
+
class: normalizeClass(["px-switch-suffix-wrapper", { "px-switch-suffix-wrapper__on": unref(progress) > MID_PROGRESS }])
|
|
244
|
+
}, [renderSlot(_ctx.$slots, "active-label", {}, () => [createTextVNode(toDisplayString(props.activeLabel), 1)])], 2)) : createCommentVNode("v-if", true),
|
|
245
|
+
createElementVNode("input", {
|
|
246
|
+
type: "checkbox",
|
|
247
|
+
class: "px-switch-inner",
|
|
248
|
+
disabled: unref(disabledComputed) || unref(readonlyComputed),
|
|
249
|
+
checked: !!unref(modelValue),
|
|
250
|
+
onFocus: focusHandler,
|
|
251
|
+
onBlur: blurHandler,
|
|
252
|
+
onInput: withModifiers(inputHandler, ["stop"]),
|
|
253
|
+
onChange: withModifiers(changeHandler, ["stop"])
|
|
254
|
+
}, null, 40, _hoisted_3)
|
|
255
|
+
], 2);
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
export { switch_default as t };
|