@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
|
@@ -1,12 +1,9 @@
|
|
|
1
|
+
import type { OptionListGroupOption, OptionListOption } from '../option-list/type';
|
|
1
2
|
import type { NumberOrPercentage } from '../share/type';
|
|
2
|
-
import type {
|
|
3
|
-
export interface AutoCompleteOption extends
|
|
4
|
-
value: string;
|
|
5
|
-
disabled?: boolean;
|
|
3
|
+
import type { VirtualListProps } from '../virtual-list/type';
|
|
4
|
+
export interface AutoCompleteOption extends OptionListOption<string> {
|
|
6
5
|
}
|
|
7
|
-
export interface AutoCompleteGroupOption extends
|
|
8
|
-
label: string;
|
|
9
|
-
key: string | number | symbol;
|
|
6
|
+
export interface AutoCompleteGroupOption extends OptionListGroupOption {
|
|
10
7
|
children: (AutoCompleteOption | string)[];
|
|
11
8
|
}
|
|
12
9
|
export type AutoCompleteProps = {
|
|
@@ -50,6 +47,16 @@ export type AutoCompleteProps = {
|
|
|
50
47
|
* @version 0.0.2
|
|
51
48
|
*/
|
|
52
49
|
loading?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* @property {'medium' | 'large' | 'small'} [size='medium']
|
|
52
|
+
* @version 0.0.2
|
|
53
|
+
*/
|
|
54
|
+
size?: 'medium' | 'large' | 'small';
|
|
55
|
+
/**
|
|
56
|
+
* @property {'rect' | 'round'} [shape='rect']
|
|
57
|
+
* @version 0.0.3
|
|
58
|
+
*/
|
|
59
|
+
shape?: 'rect' | 'round' | 'default';
|
|
53
60
|
/**
|
|
54
61
|
* @property {boolean} [showPopoverEmpty=false]
|
|
55
62
|
* @version 0.0.2
|
|
@@ -71,15 +78,15 @@ export type AutoCompleteProps = {
|
|
|
71
78
|
*/
|
|
72
79
|
append?: boolean;
|
|
73
80
|
/**
|
|
74
|
-
* @property {
|
|
75
|
-
* @version 0.0.
|
|
81
|
+
* @property {boolean} [virtualScroll=false]
|
|
82
|
+
* @version 0.0.3
|
|
76
83
|
*/
|
|
77
|
-
|
|
84
|
+
virtualScroll?: boolean;
|
|
78
85
|
/**
|
|
79
|
-
* @property {'
|
|
80
|
-
* @version 0.0.
|
|
86
|
+
* @property {Omit<VirtualListProps, 'list' | 'fixedHeight'>} [virtualListProps]
|
|
87
|
+
* @version 0.0.3
|
|
81
88
|
*/
|
|
82
|
-
|
|
89
|
+
virtualListProps?: Omit<VirtualListProps, 'list' | 'fixedHeight'>;
|
|
83
90
|
/**
|
|
84
91
|
* @property {NumberOrPercentage | NumberOrPercentage[]} [borderRadius]
|
|
85
92
|
* @version 0.0.2
|
|
@@ -95,6 +102,11 @@ export type AutoCompleteProps = {
|
|
|
95
102
|
* @version 0.0.2
|
|
96
103
|
*/
|
|
97
104
|
autofocus?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* @property {boolean} [optionsDestroyOnHide=false]
|
|
107
|
+
* @version 0.0.3
|
|
108
|
+
*/
|
|
109
|
+
optionsDestroyOnHide?: boolean;
|
|
98
110
|
};
|
|
99
111
|
export type AutoCompleteEvents = {
|
|
100
112
|
/**
|
package/es/avatar/css.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { 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) => {
|
|
4
|
+
ctx.fillStyle = rgbaColor2string(borderColor);
|
|
5
|
+
for (let i = 0; i < 4; i++) if (borderRadius[i] > pixelSize) drawSmoothCircle(ctx, center[i][0], center[i][1], borderRadius[i], rad[i][0], rad[i][1], pixelSize);
|
|
6
|
+
if (center[1][0] + pixelSize > center[0][0]) ctx.fillRect(center[0][0], 0, center[1][0] - center[0][0] + pixelSize, pixelSize);
|
|
7
|
+
if (center[2][1] + pixelSize > center[1][1]) ctx.fillRect(width - pixelSize, center[1][1], pixelSize, center[2][1] - center[1][1] + pixelSize);
|
|
8
|
+
if (center[3][0] < center[2][0] + pixelSize) ctx.fillRect(center[3][0], height - pixelSize, center[2][0] - center[3][0] + pixelSize, pixelSize);
|
|
9
|
+
if (center[3][1] + pixelSize > center[0][1]) ctx.fillRect(0, center[0][1], pixelSize, center[3][1] - center[0][1] + pixelSize);
|
|
10
|
+
};
|
|
11
|
+
export { drawBorder as t };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
.px-avatar {
|
|
2
|
+
--avatar-size: var(--px-medium-size);
|
|
3
|
+
--text-color: var(--px-neutral-1);
|
|
4
|
+
background-color: transparent;
|
|
5
|
+
border-color: transparent;
|
|
6
|
+
border-width: var(--px-bit);
|
|
7
|
+
border-style: solid;
|
|
8
|
+
display: inline-block;
|
|
9
|
+
position: relative;
|
|
10
|
+
color: var(--text-color);
|
|
11
|
+
user-select: none;
|
|
12
|
+
transition: 0.25s;
|
|
13
|
+
z-index: 0;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
width: var(--avatar-size);
|
|
16
|
+
height: var(--avatar-size);
|
|
17
|
+
}
|
|
18
|
+
.px-avatar.px-avatar {
|
|
19
|
+
font-size: 14px;
|
|
20
|
+
}
|
|
21
|
+
.px-avatar__large {
|
|
22
|
+
--avatar-size: var(--px-large-size);
|
|
23
|
+
font-size: 15px;
|
|
24
|
+
}
|
|
25
|
+
.px-avatar__small {
|
|
26
|
+
--avatar-size: var(--px-small-size);
|
|
27
|
+
font-size: 12px;
|
|
28
|
+
}
|
|
29
|
+
.px-avatar-canvas,
|
|
30
|
+
.px-avatar-inner {
|
|
31
|
+
position: absolute;
|
|
32
|
+
top: 50%;
|
|
33
|
+
left: 50%;
|
|
34
|
+
transform: translate(-50%, -50%);
|
|
35
|
+
pointer-events: none;
|
|
36
|
+
}
|
|
37
|
+
.px-avatar-canvas {
|
|
38
|
+
z-index: -1;
|
|
39
|
+
}
|
|
40
|
+
.px-avatar-inner {
|
|
41
|
+
z-index: 0;
|
|
42
|
+
display: flex;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
align-items: center;
|
|
45
|
+
width: var(--avatar-size);
|
|
46
|
+
height: var(--avatar-size);
|
|
47
|
+
border-width: 0;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AvatarProps } from './type';
|
|
2
|
+
declare var __VLS_1: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
default?: (props: typeof __VLS_1) => any;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_component: import("vue").DefineComponent<AvatarProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AvatarProps> & Readonly<{}>, {
|
|
7
|
+
bordered: boolean;
|
|
8
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
10
|
+
export default _default;
|
|
11
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
12
|
+
new (): {
|
|
13
|
+
$slots: S;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import './css.js'
|
|
2
|
+
import { B as y, g as A } from "../vendor.js";
|
|
3
|
+
import { t as BORDER_CORNER_RAD_RANGE } from "../share/const/index.js";
|
|
4
|
+
import { o as offsetOutward } from "../share/util/common.js";
|
|
5
|
+
import { c as floodFillEdge, i as canvasPreprocess, l as getBorderRadius, n as calcPixelSize, s as floodFill, t as calcBorderCornerCenter, u as outerEdgePoints } from "../share/util/plot.js";
|
|
6
|
+
import { i as parseColor, n as getGlobalThemeColor } from "../share/util/color.js";
|
|
7
|
+
import { t as useDarkMode } from "../share/hook/use-dark-mode.js";
|
|
8
|
+
import { t as useResizeObserver } from "../share/hook/use-resize-observer.js";
|
|
9
|
+
import { t as useWatchGlobalCssVal } from "../share/hook/use-watch-global-css-var.js";
|
|
10
|
+
import { t as useTransitionEnd } from "../share/hook/use-transition-end.js";
|
|
11
|
+
import { t as drawBorder } from "./draw.js";
|
|
12
|
+
import { computed, createElementBlock, createElementVNode, defineComponent, nextTick, normalizeClass, normalizeStyle, onMounted, openBlock, ref, renderSlot, shallowRef, unref, watch } from "vue";
|
|
13
|
+
var avatar_default = /* @__PURE__ */ defineComponent({
|
|
14
|
+
name: "Avatar",
|
|
15
|
+
__name: "index",
|
|
16
|
+
props: {
|
|
17
|
+
shape: null,
|
|
18
|
+
size: null,
|
|
19
|
+
bordered: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
},
|
|
23
|
+
backgroundColor: null,
|
|
24
|
+
borderColor: null
|
|
25
|
+
},
|
|
26
|
+
setup(__props) {
|
|
27
|
+
const props = __props;
|
|
28
|
+
const sizeComputed = computed(() => {
|
|
29
|
+
return props.size ?? "medium";
|
|
30
|
+
});
|
|
31
|
+
const shapeComputed = computed(() => {
|
|
32
|
+
return props.shape ?? "circle";
|
|
33
|
+
});
|
|
34
|
+
const hoverFlag = ref(false);
|
|
35
|
+
const activeFlag = ref(false);
|
|
36
|
+
const darkMode = useDarkMode();
|
|
37
|
+
const canvasRef = shallowRef(null);
|
|
38
|
+
const avatarRef = shallowRef(null);
|
|
39
|
+
onMounted(() => {
|
|
40
|
+
nextTick(() => {
|
|
41
|
+
drawPixel();
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
watch([
|
|
45
|
+
() => props.bordered,
|
|
46
|
+
shapeComputed,
|
|
47
|
+
sizeComputed,
|
|
48
|
+
hoverFlag,
|
|
49
|
+
activeFlag,
|
|
50
|
+
darkMode,
|
|
51
|
+
() => props.backgroundColor,
|
|
52
|
+
() => props.borderColor
|
|
53
|
+
], () => {
|
|
54
|
+
drawPixel();
|
|
55
|
+
});
|
|
56
|
+
const polygon = ref("");
|
|
57
|
+
const drawPixel = () => {
|
|
58
|
+
const preprocessData = canvasPreprocess(avatarRef, canvasRef);
|
|
59
|
+
if (!preprocessData) return;
|
|
60
|
+
const pixelSize = calcPixelSize();
|
|
61
|
+
const { ctx, width, height, canvas } = preprocessData;
|
|
62
|
+
const borderRadius = getBorderRadius(canvas, pixelSize, void 0, shapeComputed.value, void 0, false, false, false);
|
|
63
|
+
const backgroundColor = props.backgroundColor && parseColor(props.backgroundColor) || getGlobalThemeColor("neutral", 7);
|
|
64
|
+
const borderColor = props.bordered ? props.borderColor && parseColor(props.borderColor) || getGlobalThemeColor("neutral", 10) : backgroundColor;
|
|
65
|
+
const center = calcBorderCornerCenter(borderRadius, width, height, pixelSize);
|
|
66
|
+
const rad = BORDER_CORNER_RAD_RANGE;
|
|
67
|
+
if (borderColor) drawBorder(ctx, width, height, center, borderRadius, rad, borderColor, pixelSize);
|
|
68
|
+
let dots = props.bordered ? backgroundColor ? floodFillEdge(ctx, Math.round(width / 2 + pixelSize / 2), Math.round(height / 2 + pixelSize / 2), backgroundColor) : [] : outerEdgePoints(ctx);
|
|
69
|
+
if (dots.length) {
|
|
70
|
+
dots.push(dots.at(-1));
|
|
71
|
+
dots = offsetOutward([Math.round(width / 2), Math.round(height / 2)], dots, pixelSize / 4).map((e) => {
|
|
72
|
+
return [e[0] + .5, e[1] + .5];
|
|
73
|
+
});
|
|
74
|
+
polygon.value = dots.map((e) => {
|
|
75
|
+
return `${e[0]}px ${e[1]}px`;
|
|
76
|
+
}).join(",");
|
|
77
|
+
} else polygon.value = "";
|
|
78
|
+
if (backgroundColor) floodFill(ctx, Math.round(width / 2), Math.round(height / 2), backgroundColor);
|
|
79
|
+
};
|
|
80
|
+
useResizeObserver(avatarRef, drawPixel);
|
|
81
|
+
useWatchGlobalCssVal(drawPixel);
|
|
82
|
+
useTransitionEnd(avatarRef, drawPixel);
|
|
83
|
+
return (_ctx, _cache) => {
|
|
84
|
+
return openBlock(), createElementBlock("div", {
|
|
85
|
+
class: normalizeClass(["pixelium px-avatar", {
|
|
86
|
+
[`px-avatar__${sizeComputed.value}`]: unref(y)(sizeComputed.value),
|
|
87
|
+
[`px-avatar__${shapeComputed.value}`]: true
|
|
88
|
+
}]),
|
|
89
|
+
style: normalizeStyle({
|
|
90
|
+
height: unref(A)(sizeComputed.value) ? `${sizeComputed.value}px` : void 0,
|
|
91
|
+
width: unref(A)(sizeComputed.value) ? `${sizeComputed.value}px` : void 0
|
|
92
|
+
}),
|
|
93
|
+
ref_key: "avatarRef",
|
|
94
|
+
ref: avatarRef
|
|
95
|
+
}, [createElementVNode("canvas", {
|
|
96
|
+
ref_key: "canvasRef",
|
|
97
|
+
ref: canvasRef,
|
|
98
|
+
class: "px-avatar-canvas"
|
|
99
|
+
}, null, 512), createElementVNode("div", {
|
|
100
|
+
class: "px-avatar-inner",
|
|
101
|
+
style: normalizeStyle({
|
|
102
|
+
height: unref(A)(sizeComputed.value) ? `${sizeComputed.value}px` : void 0,
|
|
103
|
+
width: unref(A)(sizeComputed.value) ? `${sizeComputed.value}px` : void 0,
|
|
104
|
+
clipPath: polygon.value ? `polygon(${polygon.value})` : void 0
|
|
105
|
+
})
|
|
106
|
+
}, [renderSlot(_ctx.$slots, "default")], 4)], 6);
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
export { avatar_default as t };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type AvatarProps = {
|
|
2
|
+
/**
|
|
3
|
+
* @property {'circle' | 'square''} [shape='circle']
|
|
4
|
+
* @version 0.0.3
|
|
5
|
+
*/
|
|
6
|
+
shape?: 'circle' | 'square';
|
|
7
|
+
/**
|
|
8
|
+
* @property {'medium' | 'large' | 'small' | number} [size='medium']
|
|
9
|
+
* @version 0.0.3
|
|
10
|
+
*/
|
|
11
|
+
size?: 'medium' | 'large' | 'small' | number;
|
|
12
|
+
/**
|
|
13
|
+
* @property {boolean} [bordered=false]
|
|
14
|
+
* @version 0.0.3
|
|
15
|
+
*/
|
|
16
|
+
bordered?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* @property {string} [backgroundColor]
|
|
19
|
+
* @version 0.0.3
|
|
20
|
+
*/
|
|
21
|
+
backgroundColor?: string;
|
|
22
|
+
/**
|
|
23
|
+
* @property {string} [borderColor]
|
|
24
|
+
* @version 0.0.3
|
|
25
|
+
*/
|
|
26
|
+
borderColor?: string;
|
|
27
|
+
};
|
|
28
|
+
export type AvatarSlots = {
|
|
29
|
+
/**
|
|
30
|
+
* @slot default
|
|
31
|
+
* @version 0.0.3
|
|
32
|
+
*/
|
|
33
|
+
default: {};
|
|
34
|
+
};
|
package/es/button/draw.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { RgbaColor } from '../share/type';
|
|
2
2
|
import type { ButtonProps } from './type';
|
|
3
|
-
export declare function getBackgroundColor(disabled: boolean, loading: boolean, type: ButtonProps['variant'], theme: ButtonProps['theme'], palette: RgbaColor[] | null, hoverFlag: boolean, activeFlag: boolean): RgbaColor;
|
|
4
|
-
export declare function getBorderColor(disabled: boolean, loading: boolean, type: ButtonProps['variant'], theme: ButtonProps['theme'], palette: RgbaColor[] | null, hoverFlag: boolean, activeFlag: boolean): RgbaColor;
|
|
5
|
-
export declare const drawBorder: (ctx: CanvasRenderingContext2D, width: number, height: number, center: [number, number][], borderRadius: number[], rad: [number, number][], borderColor: RgbaColor, pixelSize: number, type: ButtonProps["variant"], inner: boolean, first: boolean, last: boolean) => void;
|
|
6
|
-
export declare function getGradientColor(disabled: boolean, loading: boolean, theme: ButtonProps['theme'], palette: RgbaColor[] | null, hoverFlag: boolean, activeFlag: boolean): RgbaColor;
|
|
3
|
+
export declare function getBackgroundColor(disabled: boolean, loading: boolean, type: ButtonProps['variant'], theme: ButtonProps['theme'], palette: RgbaColor[] | null, hoverFlag: boolean, activeFlag: boolean): RgbaColor | null;
|
|
4
|
+
export declare function getBorderColor(disabled: boolean, loading: boolean, type: ButtonProps['variant'], theme: ButtonProps['theme'], palette: RgbaColor[] | null, hoverFlag: boolean, activeFlag: boolean): RgbaColor | null;
|
|
5
|
+
export declare const drawBorder: (ctx: CanvasRenderingContext2D, width: number, height: number, center: [number, number][], borderRadius: number[], rad: [number, number][], borderColor: RgbaColor, pixelSize: number, type: ButtonProps["variant"], inner: boolean, first: boolean, last: boolean, nextIsTextButton: boolean) => void;
|
|
6
|
+
export declare function getGradientColor(disabled: boolean, loading: boolean, theme: ButtonProps['theme'], palette: RgbaColor[] | null, hoverFlag: boolean, activeFlag: boolean): RgbaColor | null;
|
|
7
7
|
export declare const drawGradient: (ctx: CanvasRenderingContext2D, width: number, height: number, center: [number, number][], borderRadius: number[], rad: [number, number][], pixelSize: number, disabled: boolean, loading: boolean, theme: ButtonProps["theme"], palette: RgbaColor[] | null, inner: boolean, first: boolean, last: boolean, hoverFlag: boolean, activeFlag: boolean) => void;
|
|
8
8
|
export declare const getTextColorWithPalette: (palette: RgbaColor[] | null, type: ButtonProps["variant"], disabled: boolean, loading: boolean, hoverFlag: boolean, activeFlag: boolean) => string | undefined;
|