@pixelium/web-vue 0.0.2 → 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 -5852
- 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 -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/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/tag/index.js
CHANGED
|
@@ -1,193 +1,124 @@
|
|
|
1
1
|
import './css.js'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
setup(__props) {
|
|
16
|
-
const props = __props;
|
|
17
|
-
return (_ctx, _cache) => {
|
|
18
|
-
return openBlock(), createElementBlock(
|
|
19
|
-
"svg",
|
|
20
|
-
{
|
|
21
|
-
class: "px-icon-hn",
|
|
22
|
-
style: normalizeStyle({ color: props.color, fontSize: props.size + "px" }),
|
|
23
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
24
|
-
viewBox: "0 0 24 24"
|
|
25
|
-
},
|
|
26
|
-
[..._cache[0] || (_cache[0] = [
|
|
27
|
-
createElementVNode(
|
|
28
|
-
"path",
|
|
29
|
-
{ d: "M14 13h1v1h1v1h1v1h1v1h1v1h1v1h1v1h1v1h-1v1h-1v-1h-1v-1h-1v-1h-1v-1h-1v-1h-1v-1h-1v-1h-1v-1h-2v1h-1v1H9v1H8v1H7v1H6v1H5v1H4v1H3v-1H2v-1h1v-1h1v-1h1v-1h1v-1h1v-1h1v-1h1v-1h1v-2H9v-1H8V9H7V8H6V7H5V6H4V5H3V4H2V3h1V2h1v1h1v1h1v1h1v1h1v1h1v1h1v1h1v1h2V9h1V8h1V7h1V6h1V5h1V4h1V3h1V2h1v1h1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1z" },
|
|
30
|
-
null,
|
|
31
|
-
-1
|
|
32
|
-
/* CACHED */
|
|
33
|
-
)
|
|
34
|
-
])],
|
|
35
|
-
4
|
|
36
|
-
/* STYLE */
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
const _hoisted_1 = {
|
|
42
|
-
key: 0,
|
|
43
|
-
class: "px-tag-icon-wrapper"
|
|
2
|
+
import { r as times_default } from "../vendor.js";
|
|
3
|
+
import { t as BORDER_CORNER_RAD_RANGE } from "../share/const/index.js";
|
|
4
|
+
import { i as canvasPreprocess, l as getBorderRadius, n as calcPixelSize, s as floodFill, t as calcBorderCornerCenter } from "../share/util/plot.js";
|
|
5
|
+
import { i as parseColor, t as generatePalette } from "../share/util/color.js";
|
|
6
|
+
import { t as useDarkMode } from "../share/hook/use-dark-mode.js";
|
|
7
|
+
import { t as useResizeObserver } from "../share/hook/use-resize-observer.js";
|
|
8
|
+
import { t as useWatchGlobalCssVal } from "../share/hook/use-watch-global-css-var.js";
|
|
9
|
+
import { t as useTransitionEnd } from "../share/hook/use-transition-end.js";
|
|
10
|
+
import { i as getTextColorWithPalette, n as getBackgroundColor, r as getBorderColor, t as drawBorder } from "./draw.js";
|
|
11
|
+
import { computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, nextTick, normalizeClass, normalizeStyle, onMounted, openBlock, ref, renderSlot, shallowRef, unref, watch, withModifiers } from "vue";
|
|
12
|
+
var _hoisted_1 = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "px-tag-icon-wrapper"
|
|
44
15
|
};
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
style: normalizeStyle({
|
|
153
|
-
color: textColor.value
|
|
154
|
-
}),
|
|
155
|
-
ref_key: "tagRef",
|
|
156
|
-
ref: tagRef
|
|
157
|
-
},
|
|
158
|
-
[
|
|
159
|
-
createElementVNode(
|
|
160
|
-
"canvas",
|
|
161
|
-
{
|
|
162
|
-
ref_key: "canvasRef",
|
|
163
|
-
ref: canvasRef,
|
|
164
|
-
class: "px-tag-canvas"
|
|
165
|
-
},
|
|
166
|
-
null,
|
|
167
|
-
512
|
|
168
|
-
/* NEED_PATCH */
|
|
169
|
-
),
|
|
170
|
-
renderSlot(_ctx.$slots, "default"),
|
|
171
|
-
props.closable ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
172
|
-
createVNode(unref(Times), {
|
|
173
|
-
onMousedown: _cache[0] || (_cache[0] = ($event) => toggleActive(true)),
|
|
174
|
-
onMouseup: _cache[1] || (_cache[1] = ($event) => toggleActive(false)),
|
|
175
|
-
onMouseenter: _cache[2] || (_cache[2] = ($event) => toggleHover(true)),
|
|
176
|
-
onMouseleave: _cache[3] || (_cache[3] = ($event) => toggleHover(false)),
|
|
177
|
-
onClick: closeHandler,
|
|
178
|
-
class: "px-tag-icon",
|
|
179
|
-
style: normalizeStyle({
|
|
180
|
-
fill: textColor.value
|
|
181
|
-
})
|
|
182
|
-
}, null, 8, ["style"])
|
|
183
|
-
])) : createCommentVNode("v-if", true)
|
|
184
|
-
],
|
|
185
|
-
6
|
|
186
|
-
/* CLASS, STYLE */
|
|
187
|
-
);
|
|
188
|
-
};
|
|
189
|
-
}
|
|
16
|
+
var tag_default = /* @__PURE__ */ defineComponent({
|
|
17
|
+
name: "Tag",
|
|
18
|
+
__name: "index",
|
|
19
|
+
props: {
|
|
20
|
+
borderRadius: null,
|
|
21
|
+
shape: { default: "rect" },
|
|
22
|
+
size: { default: "medium" },
|
|
23
|
+
disabled: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false
|
|
26
|
+
},
|
|
27
|
+
variant: { default: "primary" },
|
|
28
|
+
theme: { default: "primary" },
|
|
29
|
+
color: null,
|
|
30
|
+
closable: { type: Boolean }
|
|
31
|
+
},
|
|
32
|
+
emits: ["close"],
|
|
33
|
+
setup(__props, { emit: __emit }) {
|
|
34
|
+
const props = __props;
|
|
35
|
+
const emits = __emit;
|
|
36
|
+
const closeHoverFlag = ref(false);
|
|
37
|
+
const closeActiveFlag = ref(false);
|
|
38
|
+
const toggleHover = (value) => {
|
|
39
|
+
closeHoverFlag.value = value;
|
|
40
|
+
};
|
|
41
|
+
const toggleActive = (value) => {
|
|
42
|
+
closeActiveFlag.value = value;
|
|
43
|
+
};
|
|
44
|
+
const darkMode = useDarkMode();
|
|
45
|
+
const canvasRef = shallowRef(null);
|
|
46
|
+
const tagRef = shallowRef(null);
|
|
47
|
+
onMounted(() => {
|
|
48
|
+
nextTick(() => {
|
|
49
|
+
drawPixel();
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
const palette = computed(() => {
|
|
53
|
+
if (!props.color) return null;
|
|
54
|
+
const color = parseColor(props.color);
|
|
55
|
+
if (!color) return null;
|
|
56
|
+
return generatePalette(color.r, color.g, color.b, color.a, darkMode.value);
|
|
57
|
+
});
|
|
58
|
+
const textColor = computed(() => {
|
|
59
|
+
return getTextColorWithPalette(palette.value, props.variant, props.disabled);
|
|
60
|
+
});
|
|
61
|
+
const closeHandler = (e) => {
|
|
62
|
+
if (!props.disabled) emits("close", e);
|
|
63
|
+
};
|
|
64
|
+
watch([
|
|
65
|
+
() => props.borderRadius,
|
|
66
|
+
() => props.shape,
|
|
67
|
+
() => props.disabled,
|
|
68
|
+
() => props.variant,
|
|
69
|
+
() => props.theme,
|
|
70
|
+
palette,
|
|
71
|
+
darkMode
|
|
72
|
+
], () => {
|
|
73
|
+
drawPixel();
|
|
74
|
+
});
|
|
75
|
+
const drawPixel = () => {
|
|
76
|
+
const preprocessData = canvasPreprocess(tagRef, canvasRef);
|
|
77
|
+
if (!preprocessData) return;
|
|
78
|
+
const { ctx, width, height, canvas } = preprocessData;
|
|
79
|
+
const pixelSize = calcPixelSize();
|
|
80
|
+
const borderRadius = getBorderRadius(canvas, pixelSize, props.borderRadius, props.shape, "medium", false, false, false);
|
|
81
|
+
const borderColor = getBorderColor(props.disabled, props.variant, props.theme, palette.value);
|
|
82
|
+
const center = calcBorderCornerCenter(borderRadius, width, height, pixelSize);
|
|
83
|
+
const rad = BORDER_CORNER_RAD_RANGE;
|
|
84
|
+
if (borderColor) drawBorder(ctx, width, height, center, borderRadius, rad, borderColor, pixelSize);
|
|
85
|
+
const backgroundColor = getBackgroundColor(props.disabled, props.variant, props.theme, palette.value);
|
|
86
|
+
if (backgroundColor) floodFill(ctx, Math.round(width / 2), Math.round(height / 2), backgroundColor);
|
|
87
|
+
};
|
|
88
|
+
useResizeObserver(tagRef, drawPixel);
|
|
89
|
+
useWatchGlobalCssVal(drawPixel);
|
|
90
|
+
useTransitionEnd(tagRef, drawPixel);
|
|
91
|
+
return (_ctx, _cache) => {
|
|
92
|
+
return openBlock(), createElementBlock("span", {
|
|
93
|
+
class: normalizeClass(["pixelium px-tag", {
|
|
94
|
+
[`px-tag__${props.size}`]: props.size,
|
|
95
|
+
"px-tag__outline": props.variant === "outline",
|
|
96
|
+
"px-tag__plain": props.variant === "plain",
|
|
97
|
+
"px-tag__disabled": props.disabled,
|
|
98
|
+
"px-tag__custom": palette.value,
|
|
99
|
+
[`px-tag__${props.theme || "primary"}`]: true
|
|
100
|
+
}]),
|
|
101
|
+
style: normalizeStyle({ color: textColor.value }),
|
|
102
|
+
ref_key: "tagRef",
|
|
103
|
+
ref: tagRef
|
|
104
|
+
}, [
|
|
105
|
+
createElementVNode("canvas", {
|
|
106
|
+
ref_key: "canvasRef",
|
|
107
|
+
ref: canvasRef,
|
|
108
|
+
class: "px-tag-canvas"
|
|
109
|
+
}, null, 512),
|
|
110
|
+
renderSlot(_ctx.$slots, "default"),
|
|
111
|
+
props.closable ? (openBlock(), createElementBlock("div", _hoisted_1, [createVNode(unref(times_default), {
|
|
112
|
+
onMousedown: _cache[0] || (_cache[0] = withModifiers(($event) => toggleActive(true), ["prevent"])),
|
|
113
|
+
onMouseup: _cache[1] || (_cache[1] = ($event) => toggleActive(false)),
|
|
114
|
+
onMouseenter: _cache[2] || (_cache[2] = ($event) => toggleHover(true)),
|
|
115
|
+
onMouseleave: _cache[3] || (_cache[3] = ($event) => toggleHover(false)),
|
|
116
|
+
onClick: closeHandler,
|
|
117
|
+
class: "px-tag-icon",
|
|
118
|
+
style: normalizeStyle({ fill: textColor.value })
|
|
119
|
+
}, null, 8, ["style"])])) : createCommentVNode("v-if", true)
|
|
120
|
+
], 6);
|
|
121
|
+
};
|
|
122
|
+
}
|
|
190
123
|
});
|
|
191
|
-
export {
|
|
192
|
-
_sfc_main as _
|
|
193
|
-
};
|
|
124
|
+
export { tag_default as t };
|
package/es/tag/type.d.ts
CHANGED
|
@@ -6,10 +6,10 @@ export type TagProps = {
|
|
|
6
6
|
*/
|
|
7
7
|
borderRadius?: NumberOrPercentage | NumberOrPercentage[];
|
|
8
8
|
/**
|
|
9
|
-
* @property {'
|
|
10
|
-
* @version 0.0.
|
|
9
|
+
* @property {'rect' | 'round'} [shape='rect']
|
|
10
|
+
* @version 0.0.3
|
|
11
11
|
*/
|
|
12
|
-
shape?: '
|
|
12
|
+
shape?: 'rect' | 'round' | 'default';
|
|
13
13
|
/**
|
|
14
14
|
* @property {'medium' | 'large' | 'small'} [size='medium']
|
|
15
15
|
* @version 0.0.2
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TextOutlineProps } 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<TextOutlineProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TextOutlineProps> & Readonly<{}>, {
|
|
7
|
+
color: string;
|
|
8
|
+
outlineWidth: number | string;
|
|
9
|
+
autoPadding: boolean;
|
|
10
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
14
|
+
new (): {
|
|
15
|
+
$slots: S;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import './css.js'
|
|
2
|
+
import { computed, createElementBlock, defineComponent, normalizeStyle, openBlock, renderSlot } from "vue";
|
|
3
|
+
var text_outline_default = /* @__PURE__ */ defineComponent({
|
|
4
|
+
name: "TextOutline",
|
|
5
|
+
__name: "index",
|
|
6
|
+
props: {
|
|
7
|
+
color: { default: "var(--px-neutral-1)" },
|
|
8
|
+
outlineWidth: { default: 1 },
|
|
9
|
+
autoPadding: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: true
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
setup(__props) {
|
|
15
|
+
const props = __props;
|
|
16
|
+
const widthValue = computed(() => {
|
|
17
|
+
const val = props.outlineWidth;
|
|
18
|
+
return typeof val === "number" ? `${val}px` : val;
|
|
19
|
+
});
|
|
20
|
+
return (_ctx, _cache) => {
|
|
21
|
+
return openBlock(), createElementBlock("span", {
|
|
22
|
+
class: "pixelium px-text-outline",
|
|
23
|
+
style: normalizeStyle({
|
|
24
|
+
"-webkit-text-stroke": `${widthValue.value} transparent`,
|
|
25
|
+
background: `text ${props.color}`,
|
|
26
|
+
paddingLeft: __props.autoPadding ? widthValue.value : void 0,
|
|
27
|
+
paddingRight: __props.autoPadding ? widthValue.value : void 0
|
|
28
|
+
})
|
|
29
|
+
}, [renderSlot(_ctx.$slots, "default")], 4);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
export { text_outline_default as t };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type TextOutlineProps = {
|
|
2
|
+
/**
|
|
3
|
+
* @property {string} [color]
|
|
4
|
+
* @version 0.0.3
|
|
5
|
+
*/
|
|
6
|
+
color?: string;
|
|
7
|
+
/**
|
|
8
|
+
* @property {number | string} [outlineWidth=1]
|
|
9
|
+
* @version 0.0.3
|
|
10
|
+
*/
|
|
11
|
+
outlineWidth?: number | string;
|
|
12
|
+
/**
|
|
13
|
+
* @property {boolean} [autoPadding=true]
|
|
14
|
+
* @version 0.0.3
|
|
15
|
+
*/
|
|
16
|
+
autoPadding?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type TextOutlineSlots = {
|
|
19
|
+
/**
|
|
20
|
+
* @version 0.0.3
|
|
21
|
+
*/
|
|
22
|
+
default: {};
|
|
23
|
+
};
|
package/es/textarea/draw.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as rgbaColor2string } from "../share/util/color.js";
|
|
2
2
|
const draw = (ctx, width, height, borderColor, backgroundColor, pixelSize) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
draw as d
|
|
3
|
+
ctx.fillStyle = rgbaColor2string(borderColor);
|
|
4
|
+
ctx.fillRect(pixelSize, 0, width - 2 * pixelSize, pixelSize);
|
|
5
|
+
ctx.fillRect(width - pixelSize, pixelSize, pixelSize, height - 2 * pixelSize);
|
|
6
|
+
ctx.fillRect(pixelSize, height - pixelSize, width - 2 * pixelSize, pixelSize);
|
|
7
|
+
ctx.fillRect(0, pixelSize, pixelSize, height - 2 * pixelSize);
|
|
8
|
+
ctx.fillStyle = rgbaColor2string(backgroundColor);
|
|
9
|
+
ctx.fillRect(pixelSize, pixelSize, width - 2 * pixelSize, height - 2 * pixelSize);
|
|
13
10
|
};
|
|
11
|
+
export { draw as t };
|
package/es/textarea/index.css
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
div.px-textarea {
|
|
2
|
-
font-size: var(--text-size);
|
|
3
|
-
}
|
|
4
1
|
.px-textarea {
|
|
5
|
-
--px-medium-padding-x: var(--px-interval-2);
|
|
6
|
-
--px-large-padding-x: var(--px-interval-3);
|
|
7
|
-
--px-small-padding-x: var(--px-interval-2);
|
|
8
|
-
--padding-x-size: var(--px-medium-padding-x);
|
|
9
|
-
--text-size: var(--px-medium-font-size);
|
|
10
2
|
--textarea-size: var(--px-medium-size);
|
|
11
3
|
z-index: 0;
|
|
12
4
|
position: relative;
|
|
@@ -17,6 +9,40 @@ div.px-textarea {
|
|
|
17
9
|
color: var(--px-neutral-10);
|
|
18
10
|
display: flex;
|
|
19
11
|
box-sizing: border-box;
|
|
12
|
+
transition: 0.25s;
|
|
13
|
+
}
|
|
14
|
+
.px-textarea.px-textarea__small {
|
|
15
|
+
font-size: 12px;
|
|
16
|
+
}
|
|
17
|
+
.px-textarea.px-textarea__small .px-textarea-inner {
|
|
18
|
+
padding-right: 8px;
|
|
19
|
+
padding-left: 8px;
|
|
20
|
+
font-size: 12px;
|
|
21
|
+
}
|
|
22
|
+
.px-textarea.px-textarea__small .px-textarea-addition-wrapper {
|
|
23
|
+
right: 8px;
|
|
24
|
+
}
|
|
25
|
+
.px-textarea.px-textarea__medium {
|
|
26
|
+
font-size: 14px;
|
|
27
|
+
}
|
|
28
|
+
.px-textarea.px-textarea__medium .px-textarea-inner {
|
|
29
|
+
padding-right: 8px;
|
|
30
|
+
padding-left: 8px;
|
|
31
|
+
font-size: 14px;
|
|
32
|
+
}
|
|
33
|
+
.px-textarea.px-textarea__medium .px-textarea-addition-wrapper {
|
|
34
|
+
right: 8px;
|
|
35
|
+
}
|
|
36
|
+
.px-textarea.px-textarea__large {
|
|
37
|
+
font-size: 15px;
|
|
38
|
+
}
|
|
39
|
+
.px-textarea.px-textarea__large .px-textarea-inner {
|
|
40
|
+
padding-right: 12px;
|
|
41
|
+
padding-left: 12px;
|
|
42
|
+
font-size: 15px;
|
|
43
|
+
}
|
|
44
|
+
.px-textarea.px-textarea__large .px-textarea-addition-wrapper {
|
|
45
|
+
right: 12px;
|
|
20
46
|
}
|
|
21
47
|
.px-textarea-inner {
|
|
22
48
|
height: 100%;
|
|
@@ -25,10 +51,9 @@ div.px-textarea {
|
|
|
25
51
|
box-sizing: border-box;
|
|
26
52
|
width: 100%;
|
|
27
53
|
font-size: var(--text-size);
|
|
28
|
-
line-height:
|
|
54
|
+
line-height: 1.5;
|
|
29
55
|
font-family: var(--px-font);
|
|
30
|
-
|
|
31
|
-
min-height: calc(var(--textarea-size) - var(--px-bit) * 2);
|
|
56
|
+
min-height: 28px;
|
|
32
57
|
resize: none;
|
|
33
58
|
}
|
|
34
59
|
.px-textarea-inner:focus-visible {
|
|
@@ -45,16 +70,6 @@ div.px-textarea {
|
|
|
45
70
|
.px-textarea__resize .px-textarea-inner {
|
|
46
71
|
resize: vertical;
|
|
47
72
|
}
|
|
48
|
-
.px-textarea__large {
|
|
49
|
-
--padding-x-size: var(--px-large-padding-x);
|
|
50
|
-
--text-size: var(--px-large-font-size);
|
|
51
|
-
--input-size: var(--px-large-size);
|
|
52
|
-
}
|
|
53
|
-
.px-textarea__small {
|
|
54
|
-
--padding-x-size: var(--px-small-padding-x);
|
|
55
|
-
--input-size: var(--px-small-size);
|
|
56
|
-
--text-size: var(--px-small-font-size);
|
|
57
|
-
}
|
|
58
73
|
.px-textarea__disabled {
|
|
59
74
|
cursor: not-allowed;
|
|
60
75
|
}
|
|
@@ -65,7 +80,6 @@ div.px-textarea {
|
|
|
65
80
|
.px-textarea-addition-wrapper {
|
|
66
81
|
position: absolute;
|
|
67
82
|
bottom: 0;
|
|
68
|
-
right: var(--padding-x-size);
|
|
69
83
|
display: flex;
|
|
70
84
|
align-items: center;
|
|
71
85
|
}
|
|
@@ -75,7 +89,7 @@ div.px-textarea {
|
|
|
75
89
|
flex-shrink: 0;
|
|
76
90
|
display: flex;
|
|
77
91
|
align-items: center;
|
|
78
|
-
margin-left:
|
|
92
|
+
margin-left: 8px;
|
|
79
93
|
}
|
|
80
94
|
.px-textarea-close-wrapper .px-textarea-icon {
|
|
81
95
|
width: var(--text-size);
|
package/es/textarea/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TextareaProps } from './type';
|
|
1
|
+
import type { TextareaExpose, TextareaProps } from './type';
|
|
2
2
|
import { type Nullish } from 'parsnip-kit';
|
|
3
3
|
declare var __VLS_9: {
|
|
4
4
|
value: string | Nullish;
|
|
@@ -8,31 +8,25 @@ declare var __VLS_9: {
|
|
|
8
8
|
type __VLS_Slots = {} & {
|
|
9
9
|
count?: (props: typeof __VLS_9) => any;
|
|
10
10
|
};
|
|
11
|
-
declare const __VLS_component: import("vue").DefineComponent<TextareaProps, {
|
|
12
|
-
focus: () => void;
|
|
13
|
-
blur: () => void;
|
|
14
|
-
clear: () => Promise<void>;
|
|
15
|
-
select: () => void;
|
|
16
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
17
|
-
input: (value: string, e: Event) => any;
|
|
18
|
-
change: (value: string, e?: Event | undefined) => any;
|
|
11
|
+
declare const __VLS_component: import("vue").DefineComponent<TextareaProps, TextareaExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
12
|
clear: (value: string) => any;
|
|
13
|
+
change: (value: string, e?: Event | undefined) => any;
|
|
20
14
|
blur: (e: FocusEvent) => any;
|
|
15
|
+
input: (value: string, e: Event) => any;
|
|
21
16
|
focus: (e: FocusEvent) => any;
|
|
22
17
|
"update:modelValue": (value: string) => any;
|
|
23
18
|
}, string, import("vue").PublicProps, Readonly<TextareaProps> & Readonly<{
|
|
24
|
-
onInput?: ((value: string, e: Event) => any) | undefined;
|
|
25
|
-
onChange?: ((value: string, e?: Event | undefined) => any) | undefined;
|
|
26
19
|
onClear?: ((value: string) => any) | undefined;
|
|
20
|
+
onChange?: ((value: string, e?: Event | undefined) => any) | undefined;
|
|
27
21
|
onBlur?: ((e: FocusEvent) => any) | undefined;
|
|
22
|
+
onInput?: ((value: string, e: Event) => any) | undefined;
|
|
28
23
|
onFocus?: ((e: FocusEvent) => any) | undefined;
|
|
29
24
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
30
25
|
}>, {
|
|
31
|
-
size: "medium" | "large" | "small";
|
|
32
26
|
disabled: boolean;
|
|
33
|
-
loading: boolean;
|
|
34
|
-
resize: boolean;
|
|
35
27
|
readonly: boolean;
|
|
28
|
+
resize: boolean;
|
|
29
|
+
loading: boolean;
|
|
36
30
|
clearable: boolean;
|
|
37
31
|
showCount: boolean;
|
|
38
32
|
status: "success" | "warning" | "error" | "normal";
|