@pixelium/web-vue 0.0.2 → 0.0.3-beta
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/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/coverage-final.json +106 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +926 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +210 -0
- package/dist/font.css +1 -1
- package/dist/index.d.ts +1593 -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 +7402 -5852
- package/dist/pixelium-vue.umd.cjs +2 -2
- 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.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.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.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 +143 -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.js +11 -15
- 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 -672
- 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/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
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
export type SwitchProps = {
|
|
2
|
+
/**
|
|
3
|
+
* @property {boolean | null} [modelValue=undefined]
|
|
4
|
+
* @version 0.0.3
|
|
5
|
+
*/
|
|
6
|
+
modelValue?: boolean | null;
|
|
7
|
+
/**
|
|
8
|
+
* @property {boolean | null} [defaultValue=undefined]
|
|
9
|
+
* @version 0.0.3
|
|
10
|
+
*/
|
|
11
|
+
defaultValue?: boolean | null;
|
|
12
|
+
/**
|
|
13
|
+
* @property {'round' | 'rect'} [shape='round']
|
|
14
|
+
* @version 0.0.3
|
|
15
|
+
*/
|
|
16
|
+
shape?: 'round' | 'rect' | 'default';
|
|
17
|
+
/**
|
|
18
|
+
* @property {'small' | 'medium' | 'large'} [size='medium']
|
|
19
|
+
* @version 0.0.3
|
|
20
|
+
*/
|
|
21
|
+
size?: 'small' | 'medium' | 'large';
|
|
22
|
+
/**
|
|
23
|
+
* @property {boolean} [readonly=false]
|
|
24
|
+
* @version 0.0.3
|
|
25
|
+
*/
|
|
26
|
+
readonly?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* @property {boolean} [disabled=false]
|
|
29
|
+
* @version 0.0.3
|
|
30
|
+
*/
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @property {boolean} [loading=false]
|
|
34
|
+
* @version 0.0.3
|
|
35
|
+
*/
|
|
36
|
+
loading?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* @property {string} [activeTip]
|
|
39
|
+
* @version 0.0.3
|
|
40
|
+
*/
|
|
41
|
+
activeTip?: string;
|
|
42
|
+
/**
|
|
43
|
+
* @property {string} [inactiveTip]
|
|
44
|
+
* @version 0.0.3
|
|
45
|
+
*/
|
|
46
|
+
inactiveTip?: string;
|
|
47
|
+
/**
|
|
48
|
+
* @property {string} [activeLabel]
|
|
49
|
+
* @version 0.0.3
|
|
50
|
+
*/
|
|
51
|
+
activeLabel?: string;
|
|
52
|
+
/**
|
|
53
|
+
* @property {string} [inactiveLabel]
|
|
54
|
+
* @version 0.0.3
|
|
55
|
+
*/
|
|
56
|
+
inactiveLabel?: string;
|
|
57
|
+
/**
|
|
58
|
+
* @property {string} [activeColor]
|
|
59
|
+
* @version 0.0.3
|
|
60
|
+
*/
|
|
61
|
+
activeColor?: string;
|
|
62
|
+
/**
|
|
63
|
+
* @property {string} [inactiveColor]
|
|
64
|
+
* @version 0.0.3
|
|
65
|
+
*/
|
|
66
|
+
inactiveColor?: string;
|
|
67
|
+
};
|
|
68
|
+
export type SwitchEvents = {
|
|
69
|
+
/**
|
|
70
|
+
* @event update:modelValue
|
|
71
|
+
* @version 0.0.3
|
|
72
|
+
* @param {boolean} value
|
|
73
|
+
*/
|
|
74
|
+
'update:modelValue': [value: boolean];
|
|
75
|
+
/**
|
|
76
|
+
* @event input
|
|
77
|
+
* @version 0.0.3
|
|
78
|
+
* @param {boolean} value
|
|
79
|
+
* @param {InputEvent} event
|
|
80
|
+
*/
|
|
81
|
+
input: [value: boolean, event: InputEvent];
|
|
82
|
+
/**
|
|
83
|
+
* @event change
|
|
84
|
+
* @version 0.0.3
|
|
85
|
+
* @param {boolean} value
|
|
86
|
+
* @param {Event} event
|
|
87
|
+
*/
|
|
88
|
+
change: [value: boolean, event: Event];
|
|
89
|
+
/**
|
|
90
|
+
* @event focus
|
|
91
|
+
* @version 0.0.3
|
|
92
|
+
* @param {FocusEvent} event
|
|
93
|
+
*/
|
|
94
|
+
focus: [event: FocusEvent];
|
|
95
|
+
/**
|
|
96
|
+
* @event blur
|
|
97
|
+
* @version 0.0.3
|
|
98
|
+
* @param {FocusEvent} event
|
|
99
|
+
*/
|
|
100
|
+
blur: [event: FocusEvent];
|
|
101
|
+
};
|
|
102
|
+
export type SwitchSlots = {
|
|
103
|
+
/**
|
|
104
|
+
* @slot active-tip
|
|
105
|
+
* @version 0.0.3
|
|
106
|
+
*/
|
|
107
|
+
'active-tip': {};
|
|
108
|
+
/**
|
|
109
|
+
* @slot inactive-tip
|
|
110
|
+
* @version 0.0.3
|
|
111
|
+
*/
|
|
112
|
+
'inactive-tip': {};
|
|
113
|
+
/**
|
|
114
|
+
* @slot active-label
|
|
115
|
+
* @version 0.0.3
|
|
116
|
+
*/
|
|
117
|
+
'active-label': {};
|
|
118
|
+
/**
|
|
119
|
+
* @slot inactive-label
|
|
120
|
+
* @version 0.0.3
|
|
121
|
+
*/
|
|
122
|
+
'inactive-label': {};
|
|
123
|
+
/**
|
|
124
|
+
* @slot active-icon
|
|
125
|
+
* @version 0.0.3
|
|
126
|
+
*/
|
|
127
|
+
'active-icon': {};
|
|
128
|
+
/**
|
|
129
|
+
* @slot inactive-icon
|
|
130
|
+
* @version 0.0.3
|
|
131
|
+
*/
|
|
132
|
+
'inactive-icon': {};
|
|
133
|
+
};
|
package/es/tag/draw.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RgbaColor } from '../share/type';
|
|
2
2
|
import type { TagProps } from './type';
|
|
3
|
-
export declare function getBackgroundColor(disabled: boolean, type: TagProps['variant'], theme: TagProps['theme'], palette: RgbaColor[] | null): RgbaColor;
|
|
4
|
-
export declare function getBorderColor(disabled: boolean, type: TagProps['variant'], theme: TagProps['theme'], palette: RgbaColor[] | null): RgbaColor;
|
|
3
|
+
export declare function getBackgroundColor(disabled: boolean, type: TagProps['variant'], theme: TagProps['theme'], palette: RgbaColor[] | null): RgbaColor | null;
|
|
4
|
+
export declare function getBorderColor(disabled: boolean, type: TagProps['variant'], theme: TagProps['theme'], palette: RgbaColor[] | null): RgbaColor | null;
|
|
5
5
|
export declare const drawBorder: (ctx: CanvasRenderingContext2D, width: number, height: number, center: [number, number][], borderRadius: number[], rad: [number, number][], borderColor: RgbaColor, pixelSize: number) => void;
|
|
6
6
|
export declare const getTextColorWithPalette: (palette: RgbaColor[] | null, type: TagProps["variant"], disabled: boolean) => string | undefined;
|
package/es/tag/draw.js
CHANGED
|
@@ -1,135 +1,88 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { l as TRANSPARENT_RGBA_COLOR_OBJECT } from "../share/const/index.js";
|
|
2
|
+
import { a as drawCircle } from "../share/util/plot.js";
|
|
3
|
+
import { a as rgbaColor2string, n as getGlobalThemeColor } from "../share/util/color.js";
|
|
4
4
|
function getBackgroundColor(disabled, type, theme = "primary", palette) {
|
|
5
|
-
|
|
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
|
-
if (disabled) return getGlobalThemeColor("neutral", 1);
|
|
33
|
-
return getGlobalThemeColor("neutral", 1);
|
|
34
|
-
default:
|
|
35
|
-
if (disabled) return getGlobalThemeColor("neutral", 7);
|
|
36
|
-
return getGlobalThemeColor("neutral", 8);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
5
|
+
if (palette) switch (type) {
|
|
6
|
+
case "outline": return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
7
|
+
case "plain":
|
|
8
|
+
if (disabled) return palette[0];
|
|
9
|
+
return palette[0];
|
|
10
|
+
default:
|
|
11
|
+
if (disabled) return palette[1];
|
|
12
|
+
return palette[5];
|
|
13
|
+
}
|
|
14
|
+
else if (theme !== "info") switch (type) {
|
|
15
|
+
case "outline": return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
16
|
+
case "plain":
|
|
17
|
+
if (disabled) return getGlobalThemeColor(theme, 1);
|
|
18
|
+
return getGlobalThemeColor(theme, 1);
|
|
19
|
+
default:
|
|
20
|
+
if (disabled) return getGlobalThemeColor(theme, 2);
|
|
21
|
+
return getGlobalThemeColor(theme, 6);
|
|
22
|
+
}
|
|
23
|
+
else switch (type) {
|
|
24
|
+
case "outline": return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
25
|
+
case "plain":
|
|
26
|
+
if (disabled) return getGlobalThemeColor("neutral", 1);
|
|
27
|
+
return getGlobalThemeColor("neutral", 1);
|
|
28
|
+
default:
|
|
29
|
+
if (disabled) return getGlobalThemeColor("neutral", 7);
|
|
30
|
+
return getGlobalThemeColor("neutral", 8);
|
|
31
|
+
}
|
|
39
32
|
}
|
|
40
33
|
function getBorderColor(disabled, type, theme = "primary", palette) {
|
|
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
|
-
return disabled ? getGlobalThemeColor("neutral", 5) : getGlobalThemeColor("neutral", 7);
|
|
75
|
-
}
|
|
34
|
+
if (palette) switch (type) {
|
|
35
|
+
case "plain":
|
|
36
|
+
if (disabled) return palette[1];
|
|
37
|
+
return palette[1];
|
|
38
|
+
case "outline":
|
|
39
|
+
if (disabled) return palette[0];
|
|
40
|
+
return palette[5];
|
|
41
|
+
default:
|
|
42
|
+
if (disabled) return palette[0];
|
|
43
|
+
return palette[4];
|
|
44
|
+
}
|
|
45
|
+
else if (theme !== "info") switch (type) {
|
|
46
|
+
case "plain":
|
|
47
|
+
if (disabled) return getGlobalThemeColor(theme, 2);
|
|
48
|
+
return getGlobalThemeColor(theme, 2);
|
|
49
|
+
case "outline":
|
|
50
|
+
if (disabled) return getGlobalThemeColor(theme, 1);
|
|
51
|
+
return getGlobalThemeColor(theme, 6);
|
|
52
|
+
default:
|
|
53
|
+
if (disabled) return getGlobalThemeColor(theme, 1);
|
|
54
|
+
return getGlobalThemeColor(theme, 5);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
switch (type) {
|
|
58
|
+
case "plain":
|
|
59
|
+
if (disabled) return getGlobalThemeColor("neutral", 5);
|
|
60
|
+
return getGlobalThemeColor("neutral", 7);
|
|
61
|
+
case "outline":
|
|
62
|
+
if (disabled) return getGlobalThemeColor("neutral", 7);
|
|
63
|
+
return getGlobalThemeColor("neutral", 9);
|
|
64
|
+
}
|
|
65
|
+
return disabled ? getGlobalThemeColor("neutral", 5) : getGlobalThemeColor("neutral", 7);
|
|
66
|
+
}
|
|
76
67
|
}
|
|
77
68
|
const drawBorder = (ctx, width, height, center, borderRadius, rad, borderColor, pixelSize) => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
center[i][1],
|
|
85
|
-
borderRadius[i],
|
|
86
|
-
rad[i][0],
|
|
87
|
-
rad[i][1],
|
|
88
|
-
pixelSize
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
if (center[1][0] + pixelSize > center[0][0]) {
|
|
93
|
-
ctx.fillRect(center[0][0], 0, center[1][0] - center[0][0] + pixelSize, pixelSize);
|
|
94
|
-
}
|
|
95
|
-
if (center[2][1] + pixelSize > center[1][1]) {
|
|
96
|
-
ctx.fillRect(
|
|
97
|
-
width - pixelSize,
|
|
98
|
-
center[1][1],
|
|
99
|
-
pixelSize,
|
|
100
|
-
center[2][1] - center[1][1] + pixelSize
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
if (center[3][0] < center[2][0] + pixelSize) {
|
|
104
|
-
ctx.fillRect(
|
|
105
|
-
center[3][0],
|
|
106
|
-
height - pixelSize,
|
|
107
|
-
center[2][0] - center[3][0] + pixelSize,
|
|
108
|
-
pixelSize
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
if (center[3][1] + pixelSize > center[0][1]) {
|
|
112
|
-
ctx.fillRect(0, center[0][1], pixelSize, center[3][1] - center[0][1] + pixelSize);
|
|
113
|
-
}
|
|
69
|
+
ctx.fillStyle = rgbaColor2string(borderColor);
|
|
70
|
+
for (let i = 0; i < 4; i++) if (borderRadius[i] > pixelSize) drawCircle(ctx, center[i][0], center[i][1], borderRadius[i], rad[i][0], rad[i][1], pixelSize);
|
|
71
|
+
if (center[1][0] + pixelSize > center[0][0]) ctx.fillRect(center[0][0], 0, center[1][0] - center[0][0] + pixelSize, pixelSize);
|
|
72
|
+
if (center[2][1] + pixelSize > center[1][1]) ctx.fillRect(width - pixelSize, center[1][1], pixelSize, center[2][1] - center[1][1] + pixelSize);
|
|
73
|
+
if (center[3][0] < center[2][0] + pixelSize) ctx.fillRect(center[3][0], height - pixelSize, center[2][0] - center[3][0] + pixelSize, pixelSize);
|
|
74
|
+
if (center[3][1] + pixelSize > center[0][1]) ctx.fillRect(0, center[0][1], pixelSize, center[3][1] - center[0][1] + pixelSize);
|
|
114
75
|
};
|
|
115
76
|
const getTextColorWithPalette = (palette, type, disabled) => {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
default:
|
|
127
|
-
return void 0;
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
export {
|
|
131
|
-
getBorderColor as a,
|
|
132
|
-
getBackgroundColor as b,
|
|
133
|
-
drawBorder as d,
|
|
134
|
-
getTextColorWithPalette as g
|
|
77
|
+
if (!palette || type === "primary") return void 0;
|
|
78
|
+
if (disabled) {
|
|
79
|
+
if (type === "plain") return rgbaColor2string(palette[2]);
|
|
80
|
+
return rgbaColor2string(palette[1]);
|
|
81
|
+
}
|
|
82
|
+
switch (type) {
|
|
83
|
+
case "outline": return rgbaColor2string(palette[5]);
|
|
84
|
+
case "plain": return rgbaColor2string(palette[5]);
|
|
85
|
+
default: return;
|
|
86
|
+
}
|
|
135
87
|
};
|
|
88
|
+
export { getTextColorWithPalette as i, getBackgroundColor as n, getBorderColor as r, drawBorder as t };
|
package/es/tag/index.css
CHANGED
|
@@ -7,39 +7,57 @@
|
|
|
7
7
|
pointer-events: none;
|
|
8
8
|
}
|
|
9
9
|
span.px-tag {
|
|
10
|
-
|
|
10
|
+
line-height: var(--px-medium-sub-base-size);
|
|
11
11
|
}
|
|
12
12
|
.px-tag {
|
|
13
|
-
--tag-size:
|
|
14
|
-
--px-medium-padding-x: var(--px-interval-2);
|
|
15
|
-
--px-large-padding-x: var(--px-interval-3);
|
|
16
|
-
--px-small-padding-x: var(--px-interval-2);
|
|
17
|
-
--padding-x-size: var(--px-medium-padding-x);
|
|
13
|
+
--tag-size: var(--px-medium-sub-size);
|
|
18
14
|
--text-color: var(--px-neutral-1);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
padding-left: var(--padding-x-size);
|
|
22
|
-
padding-right: var(--padding-x-size);
|
|
15
|
+
min-height: var(--tag-size);
|
|
16
|
+
box-sizing: border-box;
|
|
23
17
|
background-color: transparent;
|
|
24
|
-
border-color: transparent;
|
|
25
|
-
border-width: var(--px-bit);
|
|
26
18
|
display: inline-flex;
|
|
27
19
|
align-items: center;
|
|
28
20
|
position: relative;
|
|
29
21
|
color: var(--text-color);
|
|
30
22
|
transition: 0.25s;
|
|
31
23
|
z-index: 0;
|
|
32
|
-
|
|
24
|
+
word-break: break-word;
|
|
25
|
+
border-color: transparent;
|
|
26
|
+
border-width: var(--px-bit);
|
|
27
|
+
border-style: solid;
|
|
28
|
+
}
|
|
29
|
+
.px-tag.px-tag__small {
|
|
30
|
+
padding-right: 8px;
|
|
31
|
+
padding-left: 8px;
|
|
32
|
+
font-size: 12px;
|
|
33
|
+
}
|
|
34
|
+
.px-tag.px-tag__small .px-tag-icon-wrapper {
|
|
35
|
+
height: 8px;
|
|
36
|
+
width: 8px;
|
|
37
|
+
}
|
|
38
|
+
.px-tag.px-tag__medium {
|
|
39
|
+
padding-right: 8px;
|
|
40
|
+
padding-left: 8px;
|
|
41
|
+
font-size: 14px;
|
|
42
|
+
}
|
|
43
|
+
.px-tag.px-tag__medium .px-tag-icon-wrapper {
|
|
44
|
+
height: 10px;
|
|
45
|
+
width: 10px;
|
|
46
|
+
}
|
|
47
|
+
.px-tag.px-tag__large {
|
|
48
|
+
padding-right: 12px;
|
|
49
|
+
padding-left: 12px;
|
|
50
|
+
font-size: 15px;
|
|
51
|
+
}
|
|
52
|
+
.px-tag.px-tag__large .px-tag-icon-wrapper {
|
|
53
|
+
height: 11px;
|
|
54
|
+
width: 11px;
|
|
33
55
|
}
|
|
34
56
|
.px-tag__large {
|
|
35
|
-
--
|
|
36
|
-
--tag-size: calc(var(--px-medium-size));
|
|
37
|
-
--text-size: var(--px-medium-font-size);
|
|
57
|
+
--tag-size: var(--px-large-sub-size);
|
|
38
58
|
}
|
|
39
59
|
.px-tag__small {
|
|
40
|
-
--
|
|
41
|
-
--tag-size: calc(var(--px-small-size) - var(--px-bit) * 2);
|
|
42
|
-
--text-size: var(--px-small-font-size);
|
|
60
|
+
--tag-size: var(--px-small-sub-size);
|
|
43
61
|
}
|
|
44
62
|
.px-tag.px-tag__disabled {
|
|
45
63
|
cursor: not-allowed;
|
|
@@ -48,13 +66,11 @@ span.px-tag {
|
|
|
48
66
|
cursor: not-allowed;
|
|
49
67
|
}
|
|
50
68
|
.px-tag-icon-wrapper {
|
|
51
|
-
margin-left:
|
|
69
|
+
margin-left: 4px;
|
|
52
70
|
display: flex;
|
|
53
71
|
align-items: center;
|
|
54
72
|
}
|
|
55
73
|
.px-tag-icon-wrapper .px-tag-icon {
|
|
56
|
-
height: calc(var(--text-size) - 4px);
|
|
57
|
-
width: calc(var(--text-size) - 4px);
|
|
58
74
|
fill: var(--text-color);
|
|
59
75
|
cursor: pointer;
|
|
60
76
|
}
|
package/es/tag/index.d.ts
CHANGED
|
@@ -8,11 +8,11 @@ declare const __VLS_component: import("vue").DefineComponent<TagProps, {}, {}, {
|
|
|
8
8
|
}, string, import("vue").PublicProps, Readonly<TagProps> & Readonly<{
|
|
9
9
|
onClose?: ((e: MouseEvent) => any) | undefined;
|
|
10
10
|
}>, {
|
|
11
|
-
shape: "default" | "round";
|
|
12
11
|
size: "medium" | "large" | "small";
|
|
13
|
-
disabled: boolean;
|
|
14
12
|
variant: "primary" | "plain" | "outline";
|
|
15
13
|
theme: "primary" | "sakura" | "success" | "warning" | "danger" | "info";
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
shape: "rect" | "round" | "default";
|
|
16
16
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
17
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
18
18
|
export default _default;
|