vant 4.5.0 → 4.6.1
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 +6 -6
- package/es/barrage/index.d.ts +1 -1
- package/es/barrage/types.d.ts +6 -0
- package/es/composables/use-touch.d.ts +1 -0
- package/es/composables/use-touch.mjs +8 -1
- package/es/config-provider/types.d.ts +1 -1
- package/es/dropdown-menu/index.d.ts +1 -1
- package/es/field/Field.mjs +1 -1
- package/es/floating-bubble/FloatingBubble.d.ts +86 -0
- package/es/floating-bubble/FloatingBubble.mjs +177 -0
- package/es/floating-bubble/index.css +1 -0
- package/es/floating-bubble/index.d.ts +63 -0
- package/es/floating-bubble/index.mjs +10 -0
- package/es/floating-bubble/style/index.d.ts +1 -0
- package/es/floating-bubble/style/index.mjs +4 -0
- package/es/floating-bubble/types.d.ts +8 -0
- package/es/floating-bubble/types.mjs +0 -0
- package/es/floating-panel/FloatingPanel.mjs +5 -7
- package/es/floating-panel/index.d.ts +3 -2
- package/es/floating-panel/index.mjs +3 -1
- package/es/floating-panel/types.d.ts +9 -0
- package/es/floating-panel/types.mjs +0 -0
- package/es/image-preview/ImagePreviewItem.mjs +1 -2
- package/es/index.d.ts +3 -1
- package/es/index.mjs +7 -1
- package/es/lazyload/vue-lazyload/util.d.ts +2 -2
- package/es/picker/PickerColumn.mjs +7 -2
- package/es/rate/Rate.d.ts +4 -0
- package/es/rate/Rate.mjs +16 -10
- package/es/rate/index.css +1 -1
- package/es/rate/index.d.ts +3 -0
- package/es/rolling-text/RollingText.d.ts +104 -0
- package/es/rolling-text/RollingText.mjs +98 -0
- package/es/rolling-text/RollingTextItem.d.ts +67 -0
- package/es/rolling-text/RollingTextItem.mjs +47 -0
- package/es/rolling-text/index.css +1 -0
- package/es/rolling-text/index.d.ts +79 -0
- package/es/rolling-text/index.mjs +10 -0
- package/es/rolling-text/style/index.d.ts +1 -0
- package/es/rolling-text/style/index.mjs +2 -0
- package/es/rolling-text/types.d.ts +17 -0
- package/es/rolling-text/types.mjs +0 -0
- package/es/signature/index.d.ts +1 -0
- package/es/signature/types.d.ts +6 -0
- package/es/signature/types.mjs +0 -0
- package/es/slider/Slider.d.ts +1 -1
- package/es/slider/index.d.ts +1 -1
- package/es/stepper/Stepper.d.ts +1 -1
- package/es/stepper/index.d.ts +1 -1
- package/es/style/base.css +1 -1
- package/es/submit-bar/types.d.ts +0 -1
- package/es/uploader/Uploader.mjs +6 -4
- package/es/uploader/UploaderPreviewItem.mjs +1 -1
- package/es/uploader/types.d.ts +1 -0
- package/es/utils/closest.d.ts +1 -0
- package/es/utils/closest.mjs +8 -0
- package/es/utils/constant.d.ts +1 -0
- package/es/utils/constant.mjs +3 -1
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.mjs +1 -0
- package/es/watermark/index.d.ts +1 -0
- package/es/watermark/types.d.ts +3 -0
- package/es/watermark/types.mjs +0 -0
- package/lib/barrage/index.d.ts +1 -1
- package/lib/barrage/types.d.ts +6 -0
- package/lib/composables/use-touch.d.ts +1 -0
- package/lib/composables/use-touch.js +8 -1
- package/lib/config-provider/types.d.ts +1 -1
- package/lib/dropdown-menu/index.d.ts +1 -1
- package/lib/field/Field.js +1 -1
- package/lib/floating-bubble/FloatingBubble.d.ts +86 -0
- package/lib/floating-bubble/FloatingBubble.js +206 -0
- package/lib/floating-bubble/index.css +1 -0
- package/lib/floating-bubble/index.d.ts +63 -0
- package/lib/floating-bubble/index.js +39 -0
- package/lib/floating-bubble/style/index.d.ts +1 -0
- package/lib/floating-bubble/style/index.js +4 -0
- package/lib/floating-bubble/types.d.ts +8 -0
- package/lib/floating-bubble/types.js +15 -0
- package/lib/floating-panel/FloatingPanel.js +6 -8
- package/lib/floating-panel/index.d.ts +3 -2
- package/lib/floating-panel/index.js +3 -1
- package/lib/floating-panel/types.d.ts +9 -0
- package/lib/floating-panel/types.js +15 -0
- package/lib/image-preview/ImagePreviewItem.js +1 -2
- package/lib/index.css +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +7 -1
- package/lib/lazyload/vue-lazyload/util.d.ts +2 -2
- package/lib/picker/PickerColumn.js +7 -2
- package/lib/rate/Rate.d.ts +4 -0
- package/lib/rate/Rate.js +16 -10
- package/lib/rate/index.css +1 -1
- package/lib/rate/index.d.ts +3 -0
- package/lib/rolling-text/RollingText.d.ts +104 -0
- package/lib/rolling-text/RollingText.js +127 -0
- package/lib/rolling-text/RollingTextItem.d.ts +67 -0
- package/lib/rolling-text/RollingTextItem.js +66 -0
- package/lib/rolling-text/index.css +1 -0
- package/lib/rolling-text/index.d.ts +79 -0
- package/lib/rolling-text/index.js +39 -0
- package/lib/rolling-text/style/index.d.ts +1 -0
- package/lib/rolling-text/style/index.js +2 -0
- package/lib/rolling-text/types.d.ts +17 -0
- package/lib/rolling-text/types.js +15 -0
- package/lib/signature/index.d.ts +1 -0
- package/lib/signature/types.d.ts +6 -0
- package/lib/signature/types.js +15 -0
- package/lib/slider/Slider.d.ts +1 -1
- package/lib/slider/index.d.ts +1 -1
- package/lib/stepper/Stepper.d.ts +1 -1
- package/lib/stepper/index.d.ts +1 -1
- package/lib/style/base.css +1 -1
- package/lib/submit-bar/types.d.ts +0 -1
- package/lib/uploader/Uploader.js +6 -4
- package/lib/uploader/UploaderPreviewItem.js +1 -1
- package/lib/uploader/types.d.ts +1 -0
- package/lib/utils/closest.d.ts +1 -0
- package/lib/utils/closest.js +27 -0
- package/lib/utils/constant.d.ts +1 -0
- package/lib/utils/constant.js +3 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +1 -0
- package/lib/vant.cjs.js +2355 -2028
- package/lib/vant.es.js +2355 -2028
- package/lib/vant.js +2366 -2166
- package/lib/vant.min.js +1 -1
- package/lib/watermark/index.d.ts +1 -0
- package/lib/watermark/types.d.ts +3 -0
- package/lib/watermark/types.js +15 -0
- package/lib/web-types.json +1 -1
- package/package.json +1 -1
File without changes
|
package/es/slider/Slider.d.ts
CHANGED
package/es/slider/index.d.ts
CHANGED
@@ -63,8 +63,8 @@ export declare const Slider: import("../utils").WithInstall<import("vue").Define
|
|
63
63
|
modelValue: number | [number, number];
|
64
64
|
readonly: boolean;
|
65
65
|
vertical: boolean;
|
66
|
-
step: string | number;
|
67
66
|
min: string | number;
|
67
|
+
step: string | number;
|
68
68
|
}, {}>>;
|
69
69
|
export default Slider;
|
70
70
|
export { sliderProps } from './Slider';
|
package/es/stepper/Stepper.d.ts
CHANGED
@@ -177,9 +177,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
177
177
|
name: string | number;
|
178
178
|
max: string | number;
|
179
179
|
disabled: boolean;
|
180
|
+
min: string | number;
|
180
181
|
longPress: boolean;
|
181
182
|
step: string | number;
|
182
|
-
min: string | number;
|
183
183
|
integer: boolean;
|
184
184
|
showPlus: boolean;
|
185
185
|
showMinus: boolean;
|
package/es/stepper/index.d.ts
CHANGED
@@ -118,9 +118,9 @@ export declare const Stepper: import("../utils").WithInstall<import("vue").Defin
|
|
118
118
|
name: string | number;
|
119
119
|
max: string | number;
|
120
120
|
disabled: boolean;
|
121
|
+
min: string | number;
|
121
122
|
longPress: boolean;
|
122
123
|
step: string | number;
|
123
|
-
min: string | number;
|
124
124
|
integer: boolean;
|
125
125
|
showPlus: boolean;
|
126
126
|
showMinus: boolean;
|
package/es/style/base.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
:root{--van-black: #000;--van-white: #fff;--van-gray-1: #f7f8fa;--van-gray-2: #f2f3f5;--van-gray-3: #ebedf0;--van-gray-4: #dcdee0;--van-gray-5: #c8c9cc;--van-gray-6: #969799;--van-gray-7: #646566;--van-gray-8: #323233;--van-red: #ee0a24;--van-blue: #1989fa;--van-orange: #ff976a;--van-orange-dark: #ed6a0c;--van-orange-light: #fffbe8;--van-green: #07c160;--van-gradient-red: linear-gradient(to right, #ff6034, #ee0a24);--van-gradient-orange: linear-gradient(to right, #ffd01e, #ff8917);--van-primary-color: var(--van-blue);--van-success-color: var(--van-green);--van-danger-color: var(--van-red);--van-warning-color: var(--van-orange);--van-text-color: var(--van-gray-8);--van-text-color-2: var(--van-gray-6);--van-text-color-3: var(--van-gray-5);--van-active-color: var(--van-gray-2);--van-active-opacity: .6;--van-disabled-opacity: .5;--van-background: var(--van-gray-1);--van-background-2: var(--van-white);--van-background-3: var(--van-white);--van-padding-base: 4px;--van-padding-xs: 8px;--van-padding-sm: 12px;--van-padding-md: 16px;--van-padding-lg: 24px;--van-padding-xl: 32px;--van-font-bold: 600;--van-font-size-xs: 10px;--van-font-size-sm: 12px;--van-font-size-md: 14px;--van-font-size-lg: 16px;--van-line-height-xs: 14px;--van-line-height-sm: 18px;--van-line-height-md: 20px;--van-line-height-lg: 22px;--van-base-font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Segoe UI, Arial, Roboto, "PingFang SC", "miui", "Hiragino Sans GB", "Microsoft Yahei", sans-serif;--van-price-font: avenir-heavy, "PingFang SC", helvetica neue, arial, sans-serif;--van-duration-base: .3s;--van-duration-fast: .2s;--van-ease-out: ease-out;--van-ease-in: ease-in;--van-border-color: var(--van-gray-3);--van-border-width: 1px;--van-radius-sm: 2px;--van-radius-md: 4px;--van-radius-lg: 8px;--van-radius-max: 999px}.van-theme-dark{--van-text-color: #f5f5f5;--van-text-color-2: #707070;--van-text-color-3: #4d4d4d;--van-border-color: #3a3a3c;--van-active-color: #3a3a3c;--van-background: #000;--van-background-2: #1c1c1e;--van-background-3: #37363b}html{-webkit-tap-highlight-color:transparent}body{margin:0;font-family:var(--van-base-font)}a{text-decoration:none}input,button,textarea{color:inherit;font:inherit}a:focus,input:focus,button:focus,textarea:focus,[class*=van-]:focus{outline:none}ol,ul{margin:0;padding:0;list-style:none}@keyframes van-slide-up-enter{0%{transform:translate3d(0,100%,0)}}@keyframes van-slide-up-leave{to{transform:translate3d(0,100%,0)}}@keyframes van-slide-down-enter{0%{transform:translate3d(0,-100%,0)}}@keyframes van-slide-down-leave{to{transform:translate3d(0,-100%,0)}}@keyframes van-slide-left-enter{0%{transform:translate3d(-100%,0,0)}}@keyframes van-slide-left-leave{to{transform:translate3d(-100%,0,0)}}@keyframes van-slide-right-enter{0%{transform:translate3d(100%,0,0)}}@keyframes van-slide-right-leave{to{transform:translate3d(100%,0,0)}}@keyframes van-fade-in{0%{opacity:0}to{opacity:1}}@keyframes van-fade-out{0%{opacity:1}to{opacity:0}}@keyframes van-rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.van-fade-enter-active{animation:var(--van-duration-base) van-fade-in both var(--van-ease-out)}.van-fade-leave-active{animation:var(--van-duration-base) van-fade-out both var(--van-ease-in)}.van-slide-up-enter-active{animation:van-slide-up-enter var(--van-duration-base) both var(--van-ease-out)}.van-slide-up-leave-active{animation:van-slide-up-leave var(--van-duration-base) both var(--van-ease-in)}.van-slide-down-enter-active{animation:van-slide-down-enter var(--van-duration-base) both var(--van-ease-out)}.van-slide-down-leave-active{animation:van-slide-down-leave var(--van-duration-base) both var(--van-ease-in)}.van-slide-left-enter-active{animation:van-slide-left-enter var(--van-duration-base) both var(--van-ease-out)}.van-slide-left-leave-active{animation:van-slide-left-leave var(--van-duration-base) both var(--van-ease-in)}.van-slide-right-enter-active{animation:van-slide-right-enter var(--van-duration-base) both var(--van-ease-out)}.van-slide-right-leave-active{animation:van-slide-right-leave var(--van-duration-base) both var(--van-ease-in)}.van-clearfix:after{display:table;clear:both;content:""}.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-line-clamp:2;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-line-clamp:3;-webkit-box-orient:vertical}.van-safe-area-top{padding-top:constant(safe-area-inset-top);padding-top:env(safe-area-inset-top)}.van-safe-area-bottom{padding-bottom:constant(safe-area-inset-bottom);padding-bottom:env(safe-area-inset-bottom)}.van-haptics-feedback{cursor:pointer}.van-haptics-feedback:active{opacity:var(--van-active-opacity)}[class*=van-hairline]:after{position:absolute;box-sizing:border-box;content:" ";pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid var(--van-border-color);transform:scale(.5)}.van-hairline,.van-hairline--top,.van-hairline--left,.van-hairline--right,.van-hairline--bottom,.van-hairline--surround,.van-hairline--top-bottom{position:relative}.van-hairline--top:after{border-top-width:var(--van-border-width)}.van-hairline--left:after{border-left-width:var(--van-border-width)}.van-hairline--right:after{border-right-width:var(--van-border-width)}.van-hairline--bottom:after{border-bottom-width:var(--van-border-width)}.van-hairline--top-bottom:after,.van-hairline-unset--top-bottom:after{border-width:var(--van-border-width) 0}.van-hairline--surround:after{border-width:var(--van-border-width)}
|
1
|
+
:root{--van-black: #000;--van-white: #fff;--van-gray-1: #f7f8fa;--van-gray-2: #f2f3f5;--van-gray-3: #ebedf0;--van-gray-4: #dcdee0;--van-gray-5: #c8c9cc;--van-gray-6: #969799;--van-gray-7: #646566;--van-gray-8: #323233;--van-red: #ee0a24;--van-blue: #1989fa;--van-orange: #ff976a;--van-orange-dark: #ed6a0c;--van-orange-light: #fffbe8;--van-green: #07c160;--van-gradient-red: linear-gradient(to right, #ff6034, #ee0a24);--van-gradient-orange: linear-gradient(to right, #ffd01e, #ff8917);--van-primary-color: var(--van-blue);--van-success-color: var(--van-green);--van-danger-color: var(--van-red);--van-warning-color: var(--van-orange);--van-text-color: var(--van-gray-8);--van-text-color-2: var(--van-gray-6);--van-text-color-3: var(--van-gray-5);--van-active-color: var(--van-gray-2);--van-active-opacity: .6;--van-disabled-opacity: .5;--van-background: var(--van-gray-1);--van-background-2: var(--van-white);--van-background-3: var(--van-white);--van-padding-base: 4px;--van-padding-xs: 8px;--van-padding-sm: 12px;--van-padding-md: 16px;--van-padding-lg: 24px;--van-padding-xl: 32px;--van-font-bold: 600;--van-font-size-xs: 10px;--van-font-size-sm: 12px;--van-font-size-md: 14px;--van-font-size-lg: 16px;--van-line-height-xs: 14px;--van-line-height-sm: 18px;--van-line-height-md: 20px;--van-line-height-lg: 22px;--van-base-font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Segoe UI, Arial, Roboto, "PingFang SC", "miui", "Hiragino Sans GB", "Microsoft Yahei", sans-serif;--van-price-font: avenir-heavy, "PingFang SC", helvetica neue, arial, sans-serif;--van-duration-base: .3s;--van-duration-fast: .2s;--van-ease-out: ease-out;--van-ease-in: ease-in;--van-border-color: var(--van-gray-3);--van-border-width: 1px;--van-radius-sm: 2px;--van-radius-md: 4px;--van-radius-lg: 8px;--van-radius-max: 999px}.van-theme-dark{--van-text-color: #f5f5f5;--van-text-color-2: #707070;--van-text-color-3: #4d4d4d;--van-border-color: #3a3a3c;--van-active-color: #3a3a3c;--van-background: #000;--van-background-2: #1c1c1e;--van-background-3: #37363b}html{-webkit-tap-highlight-color:transparent}body{margin:0;font-family:var(--van-base-font)}a{text-decoration:none}input,button,textarea{color:inherit;font:inherit}a:focus,input:focus,button:focus,textarea:focus,[class*=van-]:focus{outline:none}ol,ul{margin:0;padding:0;list-style:none}@keyframes van-slide-up-enter{0%{transform:translate3d(0,100%,0)}}@keyframes van-slide-up-leave{to{transform:translate3d(0,100%,0)}}@keyframes van-slide-down-enter{0%{transform:translate3d(0,-100%,0)}}@keyframes van-slide-down-leave{to{transform:translate3d(0,-100%,0)}}@keyframes van-slide-left-enter{0%{transform:translate3d(-100%,0,0)}}@keyframes van-slide-left-leave{to{transform:translate3d(-100%,0,0)}}@keyframes van-slide-right-enter{0%{transform:translate3d(100%,0,0)}}@keyframes van-slide-right-leave{to{transform:translate3d(100%,0,0)}}@keyframes van-fade-in{0%{opacity:0}to{opacity:1}}@keyframes van-fade-out{0%{opacity:1}to{opacity:0}}@keyframes van-rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.van-fade-enter-active{animation:var(--van-duration-base) van-fade-in both var(--van-ease-out)}.van-fade-leave-active{animation:var(--van-duration-base) van-fade-out both var(--van-ease-in)}.van-slide-up-enter-active{animation:van-slide-up-enter var(--van-duration-base) both var(--van-ease-out)}.van-slide-up-leave-active{animation:van-slide-up-leave var(--van-duration-base) both var(--van-ease-in)}.van-slide-down-enter-active{animation:van-slide-down-enter var(--van-duration-base) both var(--van-ease-out)}.van-slide-down-leave-active{animation:van-slide-down-leave var(--van-duration-base) both var(--van-ease-in)}.van-slide-left-enter-active{animation:van-slide-left-enter var(--van-duration-base) both var(--van-ease-out)}.van-slide-left-leave-active{animation:van-slide-left-leave var(--van-duration-base) both var(--van-ease-in)}.van-slide-right-enter-active{animation:van-slide-right-enter var(--van-duration-base) both var(--van-ease-out)}.van-slide-right-leave-active{animation:van-slide-right-leave var(--van-duration-base) both var(--van-ease-in)}.van-clearfix:after{display:table;clear:both;content:""}.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-line-clamp:2;line-break:anywhere;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-line-clamp:3;line-break:anywhere;-webkit-box-orient:vertical}.van-safe-area-top{padding-top:constant(safe-area-inset-top);padding-top:env(safe-area-inset-top)}.van-safe-area-bottom{padding-bottom:constant(safe-area-inset-bottom);padding-bottom:env(safe-area-inset-bottom)}.van-haptics-feedback{cursor:pointer}.van-haptics-feedback:active{opacity:var(--van-active-opacity)}[class*=van-hairline]:after{position:absolute;box-sizing:border-box;content:" ";pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid var(--van-border-color);transform:scale(.5)}.van-hairline,.van-hairline--top,.van-hairline--left,.van-hairline--right,.van-hairline--bottom,.van-hairline--surround,.van-hairline--top-bottom{position:relative}.van-hairline--top:after{border-top-width:var(--van-border-width)}.van-hairline--left:after{border-left-width:var(--van-border-width)}.van-hairline--right:after{border-right-width:var(--van-border-width)}.van-hairline--bottom:after{border-bottom-width:var(--van-border-width)}.van-hairline--top-bottom:after,.van-hairline-unset--top-bottom:after{border-width:var(--van-border-width) 0}.van-hairline--surround:after{border-width:var(--van-border-width)}
|
package/es/submit-bar/types.d.ts
CHANGED
@@ -7,7 +7,6 @@ export type SubmitBarThemeVars = {
|
|
7
7
|
submitBarPriceFontSize?: string;
|
8
8
|
submitBarPriceIntegerFontSize?: string;
|
9
9
|
submitBarPriceFont?: string;
|
10
|
-
submitBarCurrencyFontSize?: string;
|
11
10
|
submitBarTextColor?: string;
|
12
11
|
submitBarTextFontSize?: string;
|
13
12
|
submitBarTipPadding?: string;
|
package/es/uploader/Uploader.mjs
CHANGED
@@ -100,7 +100,8 @@ var stdin_default = defineComponent({
|
|
100
100
|
const result = {
|
101
101
|
file,
|
102
102
|
status: "",
|
103
|
-
message: ""
|
103
|
+
message: "",
|
104
|
+
objectUrl: URL.createObjectURL(file)
|
104
105
|
};
|
105
106
|
if (contents[index]) {
|
106
107
|
result.content = contents[index];
|
@@ -114,7 +115,8 @@ var stdin_default = defineComponent({
|
|
114
115
|
const result = {
|
115
116
|
file: files,
|
116
117
|
status: "",
|
117
|
-
message: ""
|
118
|
+
message: "",
|
119
|
+
objectUrl: URL.createObjectURL(files)
|
118
120
|
};
|
119
121
|
if (content) {
|
120
122
|
result.content = content;
|
@@ -156,8 +158,8 @@ var stdin_default = defineComponent({
|
|
156
158
|
if (props.previewFullImage) {
|
157
159
|
const imageFiles = props.modelValue.filter(isImageFile);
|
158
160
|
const images = imageFiles.map((item2) => {
|
159
|
-
if (item2.
|
160
|
-
item2.url =
|
161
|
+
if (item2.objectUrl && !item2.url && item2.status !== "failed") {
|
162
|
+
item2.url = item2.objectUrl;
|
161
163
|
urls.push(item2.url);
|
162
164
|
}
|
163
165
|
return item2.url;
|
@@ -101,7 +101,7 @@ var stdin_default = defineComponent({
|
|
101
101
|
if (isImageFile(item)) {
|
102
102
|
return _createVNode(Image, {
|
103
103
|
"fit": imageFit,
|
104
|
-
"src": item.content || item.url,
|
104
|
+
"src": item.objectUrl || item.content || item.url,
|
105
105
|
"class": bem("preview-image"),
|
106
106
|
"width": Array.isArray(previewSize) ? previewSize[0] : previewSize,
|
107
107
|
"height": Array.isArray(previewSize) ? previewSize[1] : previewSize,
|
package/es/uploader/types.d.ts
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
export declare function closest(arr: number[], target: number): number;
|
package/es/utils/constant.d.ts
CHANGED
@@ -11,3 +11,4 @@ export declare const BORDER_UNSET_TOP_BOTTOM: string;
|
|
11
11
|
export declare const HAPTICS_FEEDBACK = "van-haptics-feedback";
|
12
12
|
export declare const FORM_KEY: InjectionKey<FormProvide>;
|
13
13
|
export declare const LONG_PRESS_START_TIME = 500;
|
14
|
+
export declare const TAP_OFFSET = 5;
|
package/es/utils/constant.mjs
CHANGED
@@ -9,6 +9,7 @@ const BORDER_UNSET_TOP_BOTTOM = `${BORDER}-unset--top-bottom`;
|
|
9
9
|
const HAPTICS_FEEDBACK = "van-haptics-feedback";
|
10
10
|
const FORM_KEY = Symbol("van-form");
|
11
11
|
const LONG_PRESS_START_TIME = 500;
|
12
|
+
const TAP_OFFSET = 5;
|
12
13
|
export {
|
13
14
|
BORDER,
|
14
15
|
BORDER_BOTTOM,
|
@@ -20,5 +21,6 @@ export {
|
|
20
21
|
BORDER_UNSET_TOP_BOTTOM,
|
21
22
|
FORM_KEY,
|
22
23
|
HAPTICS_FEEDBACK,
|
23
|
-
LONG_PRESS_START_TIME
|
24
|
+
LONG_PRESS_START_TIME,
|
25
|
+
TAP_OFFSET
|
24
26
|
};
|
package/es/utils/index.d.ts
CHANGED
package/es/utils/index.mjs
CHANGED
package/es/watermark/index.d.ts
CHANGED
@@ -76,6 +76,7 @@ export declare const Watermark: import("../utils").WithInstall<import("vue").Def
|
|
76
76
|
export default Watermark;
|
77
77
|
export { watermarkProps } from './Watermark';
|
78
78
|
export type { WatermarkProps } from './Watermark';
|
79
|
+
export type { WatermarkThemeVars } from './types';
|
79
80
|
declare module 'vue' {
|
80
81
|
interface GlobalComponents {
|
81
82
|
VanWatermark: typeof Watermark;
|
File without changes
|
package/lib/barrage/index.d.ts
CHANGED
@@ -61,7 +61,7 @@ export declare const Barrage: import("../utils").WithInstall<import("vue").Defin
|
|
61
61
|
export default Barrage;
|
62
62
|
export { barrageProps } from './Barrage';
|
63
63
|
export type { BarrageProps, BarrageItem } from './Barrage';
|
64
|
-
export type { BarrageInstance } from './types';
|
64
|
+
export type { BarrageInstance, BarrageThemeVars } from './types';
|
65
65
|
declare module 'vue' {
|
66
66
|
interface GlobalComponents {
|
67
67
|
VanBarrage: typeof Barrage;
|
package/lib/barrage/types.d.ts
CHANGED
@@ -5,3 +5,9 @@ export type BarrageExpose = {
|
|
5
5
|
pause(): void;
|
6
6
|
};
|
7
7
|
export type BarrageInstance = ComponentPublicInstance<BarrageProps, BarrageExpose>;
|
8
|
+
export type BarrageThemeVars = {
|
9
|
+
barrageFontSize?: string;
|
10
|
+
barrageSpace?: string;
|
11
|
+
barrageFont?: string;
|
12
|
+
barrageColor?: string;
|
13
|
+
};
|
@@ -21,6 +21,7 @@ __export(stdin_exports, {
|
|
21
21
|
});
|
22
22
|
module.exports = __toCommonJS(stdin_exports);
|
23
23
|
var import_vue = require("vue");
|
24
|
+
var import_utils = require("../utils");
|
24
25
|
function getDirection(x, y) {
|
25
26
|
if (x > y) {
|
26
27
|
return "horizontal";
|
@@ -38,6 +39,7 @@ function useTouch() {
|
|
38
39
|
const offsetX = (0, import_vue.ref)(0);
|
39
40
|
const offsetY = (0, import_vue.ref)(0);
|
40
41
|
const direction = (0, import_vue.ref)("");
|
42
|
+
const isTap = (0, import_vue.ref)(true);
|
41
43
|
const isVertical = () => direction.value === "vertical";
|
42
44
|
const isHorizontal = () => direction.value === "horizontal";
|
43
45
|
const reset = () => {
|
@@ -46,6 +48,7 @@ function useTouch() {
|
|
46
48
|
offsetX.value = 0;
|
47
49
|
offsetY.value = 0;
|
48
50
|
direction.value = "";
|
51
|
+
isTap.value = true;
|
49
52
|
};
|
50
53
|
const start = (event) => {
|
51
54
|
reset();
|
@@ -62,6 +65,9 @@ function useTouch() {
|
|
62
65
|
if (!direction.value || offsetX.value < LOCK_DIRECTION_DISTANCE && offsetY.value < LOCK_DIRECTION_DISTANCE) {
|
63
66
|
direction.value = getDirection(offsetX.value, offsetY.value);
|
64
67
|
}
|
68
|
+
if (isTap.value && (offsetX.value > import_utils.TAP_OFFSET || offsetY.value > import_utils.TAP_OFFSET)) {
|
69
|
+
isTap.value = false;
|
70
|
+
}
|
65
71
|
};
|
66
72
|
return {
|
67
73
|
move,
|
@@ -75,6 +81,7 @@ function useTouch() {
|
|
75
81
|
offsetY,
|
76
82
|
direction,
|
77
83
|
isVertical,
|
78
|
-
isHorizontal
|
84
|
+
isHorizontal,
|
85
|
+
isTap
|
79
86
|
};
|
80
87
|
}
|
@@ -1 +1 @@
|
|
1
|
-
export type ConfigProviderThemeVars = import('../action-bar').ActionBarThemeVars & import('../action-bar-button').ActionBarButtonThemeVars & import('../action-bar-icon').ActionBarIconThemeVars & import('../action-sheet').ActionSheetThemeVars & import('../address-edit').AddressEditThemeVars & import('../address-list').AddressListThemeVars & import('../badge').BadgeThemeVars & import('../button').ButtonThemeVars & import('../calendar').CalendarThemeVars & import('../card').CardThemeVars & import('../cascader').CascaderThemeVars & import('../cell').CellThemeVars & import('../cell-group').CellGroupThemeVars & import('../checkbox').CheckboxThemeVars & import('../circle').CircleThemeVars & import('../collapse-item').CollapseItemThemeVars & import('../contact-card').ContactCardThemeVars & import('../contact-edit').ContactEditThemeVars & import('../contact-list').ContactListThemeVars & import('../count-down').CountDownThemeVars & import('../coupon').CouponThemeVars & import('../coupon-cell').CouponCellThemeVars & import('../coupon-list').CouponListThemeVars & import('../dialog').DialogThemeVars & import('../divider').DividerThemeVars & import('../dropdown-item').DropdownItemThemeVars & import('../dropdown-menu').DropdownMenuThemeVars & import('../empty').EmptyThemeVars & import('../field').FieldThemeVars & import('../grid-item').GridItemThemeVars & import('../image').ImageThemeVars & import('../image-preview').ImagePreviewThemeVars & import('../index-anchor').IndexAnchorThemeVars & import('../index-bar').IndexBarThemeVars & import('../list').ListThemeVars & import('../loading').LoadingThemeVars & import('../nav-bar').NavBarThemeVars & import('../notice-bar').NoticeBarThemeVars & import('../notify').NotifyThemeVars & import('../number-keyboard').NumberKeyboardThemeVars & import('../overlay').OverlayThemeVars & import('../pagination').PaginationThemeVars & import('../password-input').PasswordInputThemeVars & import('../picker').PickerThemeVars & import('../picker-group').PickerGroupThemeVars & import('../popover').PopoverThemeVars & import('../popup').PopupThemeVars & import('../progress').ProgressThemeVars & import('../pull-refresh').PullRefreshThemeVars & import('../radio').RadioThemeVars & import('../rate').RateThemeVars & import('../search').SearchThemeVars & import('../share-sheet').ShareSheetThemeVars & import('../sidebar').SidebarThemeVars & import('../sidebar-item').SidebarItemThemeVars & import('../skeleton').SkeletonThemeVars & import('../slider').SliderThemeVars & import('../step').StepThemeVars & import('../stepper').StepperThemeVars & import('../steps').StepsThemeVars & import('../sticky').StickyThemeVars & import('../submit-bar').SubmitBarThemeVars & import('../swipe').SwipeThemeVars & import('../switch').SwitchThemeVars & import('../tabbar').TabbarThemeVars & import('../tabbar-item').TabbarItemThemeVars & import('../tabs').TabsThemeVars & import('../tag').TagThemeVars & import('../toast').ToastThemeVars & import('../tree-select').TreeSelectThemeVars & import('../uploader').UploaderThemeVars;
|
1
|
+
export type ConfigProviderThemeVars = import('../action-bar').ActionBarThemeVars & import('../action-bar-button').ActionBarButtonThemeVars & import('../action-bar-icon').ActionBarIconThemeVars & import('../action-sheet').ActionSheetThemeVars & import('../address-edit').AddressEditThemeVars & import('../address-list').AddressListThemeVars & import('../badge').BadgeThemeVars & import('../barrage').BarrageThemeVars & import('../button').ButtonThemeVars & import('../calendar').CalendarThemeVars & import('../card').CardThemeVars & import('../cascader').CascaderThemeVars & import('../cell').CellThemeVars & import('../cell-group').CellGroupThemeVars & import('../checkbox').CheckboxThemeVars & import('../circle').CircleThemeVars & import('../collapse-item').CollapseItemThemeVars & import('../contact-card').ContactCardThemeVars & import('../contact-edit').ContactEditThemeVars & import('../contact-list').ContactListThemeVars & import('../count-down').CountDownThemeVars & import('../coupon').CouponThemeVars & import('../coupon-cell').CouponCellThemeVars & import('../coupon-list').CouponListThemeVars & import('../dialog').DialogThemeVars & import('../divider').DividerThemeVars & import('../dropdown-item').DropdownItemThemeVars & import('../dropdown-menu').DropdownMenuThemeVars & import('../empty').EmptyThemeVars & import('../field').FieldThemeVars & import('../floating-bubble').FloatingBubbleThemeVars & import('../floating-panel').FloatingPanelThemeVars & import('../grid-item').GridItemThemeVars & import('../image').ImageThemeVars & import('../image-preview').ImagePreviewThemeVars & import('../index-anchor').IndexAnchorThemeVars & import('../index-bar').IndexBarThemeVars & import('../list').ListThemeVars & import('../loading').LoadingThemeVars & import('../nav-bar').NavBarThemeVars & import('../notice-bar').NoticeBarThemeVars & import('../notify').NotifyThemeVars & import('../number-keyboard').NumberKeyboardThemeVars & import('../overlay').OverlayThemeVars & import('../pagination').PaginationThemeVars & import('../password-input').PasswordInputThemeVars & import('../picker').PickerThemeVars & import('../picker-group').PickerGroupThemeVars & import('../popover').PopoverThemeVars & import('../popup').PopupThemeVars & import('../progress').ProgressThemeVars & import('../pull-refresh').PullRefreshThemeVars & import('../radio').RadioThemeVars & import('../rate').RateThemeVars & import('../rolling-text').RollingTextThemeVars & import('../search').SearchThemeVars & import('../share-sheet').ShareSheetThemeVars & import('../sidebar').SidebarThemeVars & import('../sidebar-item').SidebarItemThemeVars & import('../signature').SignatureThemeVars & import('../skeleton').SkeletonThemeVars & import('../slider').SliderThemeVars & import('../step').StepThemeVars & import('../stepper').StepperThemeVars & import('../steps').StepsThemeVars & import('../sticky').StickyThemeVars & import('../submit-bar').SubmitBarThemeVars & import('../swipe').SwipeThemeVars & import('../switch').SwitchThemeVars & import('../tabbar').TabbarThemeVars & import('../tabbar-item').TabbarItemThemeVars & import('../tabs').TabsThemeVars & import('../tag').TagThemeVars & import('../toast').ToastThemeVars & import('../tree-select').TreeSelectThemeVars & import('../uploader').UploaderThemeVars & import('../watermark').WatermarkThemeVars;
|
@@ -55,7 +55,7 @@ export declare const DropdownMenu: import("../utils").WithInstall<import("vue").
|
|
55
55
|
export default DropdownMenu;
|
56
56
|
export { dropdownMenuProps } from './DropdownMenu';
|
57
57
|
export type { DropdownMenuProps };
|
58
|
-
export type { DropdownMenuDirection, DropdownMenuThemeVars } from './types';
|
58
|
+
export type { DropdownMenuInstance, DropdownMenuDirection, DropdownMenuThemeVars, } from './types';
|
59
59
|
declare module 'vue' {
|
60
60
|
interface GlobalComponents {
|
61
61
|
VanDropdownMenu: typeof DropdownMenu;
|
package/lib/field/Field.js
CHANGED
@@ -451,7 +451,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
451
451
|
if (props.label) {
|
452
452
|
return (0, import_vue.createVNode)("label", {
|
453
453
|
"id": `${id}-label`,
|
454
|
-
"for": getInputId(),
|
454
|
+
"for": slots.input ? void 0 : getInputId(),
|
455
455
|
"onClick": (event) => {
|
456
456
|
(0, import_utils.preventDefault)(event);
|
457
457
|
focus();
|
@@ -0,0 +1,86 @@
|
|
1
|
+
import { PropType, type ExtractPropTypes } from 'vue';
|
2
|
+
export type FloatingBubbleAxis = 'x' | 'y' | 'xy' | 'lock';
|
3
|
+
export type FloatingBubbleMagnetic = 'x' | 'y';
|
4
|
+
export type FloatingBubbleOffset = {
|
5
|
+
x: number;
|
6
|
+
y: number;
|
7
|
+
};
|
8
|
+
export declare const floatingBubbleProps: {
|
9
|
+
axis: {
|
10
|
+
type: PropType<FloatingBubbleAxis>;
|
11
|
+
default: FloatingBubbleAxis;
|
12
|
+
};
|
13
|
+
magnetic: PropType<FloatingBubbleMagnetic>;
|
14
|
+
icon: StringConstructor;
|
15
|
+
gap: {
|
16
|
+
type: NumberConstructor;
|
17
|
+
default: number;
|
18
|
+
};
|
19
|
+
offset: {
|
20
|
+
type: PropType<FloatingBubbleOffset>;
|
21
|
+
default: () => {
|
22
|
+
x: number;
|
23
|
+
y: number;
|
24
|
+
};
|
25
|
+
};
|
26
|
+
teleport: {
|
27
|
+
type: PropType<string | import("vue").RendererElement | null | undefined>;
|
28
|
+
default: string;
|
29
|
+
};
|
30
|
+
};
|
31
|
+
export type FloatingBubbleProps = ExtractPropTypes<typeof floatingBubbleProps>;
|
32
|
+
declare const _default: import("vue").DefineComponent<{
|
33
|
+
axis: {
|
34
|
+
type: PropType<FloatingBubbleAxis>;
|
35
|
+
default: FloatingBubbleAxis;
|
36
|
+
};
|
37
|
+
magnetic: PropType<FloatingBubbleMagnetic>;
|
38
|
+
icon: StringConstructor;
|
39
|
+
gap: {
|
40
|
+
type: NumberConstructor;
|
41
|
+
default: number;
|
42
|
+
};
|
43
|
+
offset: {
|
44
|
+
type: PropType<FloatingBubbleOffset>;
|
45
|
+
default: () => {
|
46
|
+
x: number;
|
47
|
+
y: number;
|
48
|
+
};
|
49
|
+
};
|
50
|
+
teleport: {
|
51
|
+
type: PropType<string | import("vue").RendererElement | null | undefined>;
|
52
|
+
default: string;
|
53
|
+
};
|
54
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "update:offset" | "offsetChange")[], "click" | "update:offset" | "offsetChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
55
|
+
axis: {
|
56
|
+
type: PropType<FloatingBubbleAxis>;
|
57
|
+
default: FloatingBubbleAxis;
|
58
|
+
};
|
59
|
+
magnetic: PropType<FloatingBubbleMagnetic>;
|
60
|
+
icon: StringConstructor;
|
61
|
+
gap: {
|
62
|
+
type: NumberConstructor;
|
63
|
+
default: number;
|
64
|
+
};
|
65
|
+
offset: {
|
66
|
+
type: PropType<FloatingBubbleOffset>;
|
67
|
+
default: () => {
|
68
|
+
x: number;
|
69
|
+
y: number;
|
70
|
+
};
|
71
|
+
};
|
72
|
+
teleport: {
|
73
|
+
type: PropType<string | import("vue").RendererElement | null | undefined>;
|
74
|
+
default: string;
|
75
|
+
};
|
76
|
+
}>> & {
|
77
|
+
onClick?: ((...args: any[]) => any) | undefined;
|
78
|
+
"onUpdate:offset"?: ((...args: any[]) => any) | undefined;
|
79
|
+
onOffsetChange?: ((...args: any[]) => any) | undefined;
|
80
|
+
}, {
|
81
|
+
offset: FloatingBubbleOffset;
|
82
|
+
teleport: string | import("vue").RendererElement | null | undefined;
|
83
|
+
gap: number;
|
84
|
+
axis: FloatingBubbleAxis;
|
85
|
+
}, {}>;
|
86
|
+
export default _default;
|
@@ -0,0 +1,206 @@
|
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __export = (target, all) => {
|
8
|
+
for (var name2 in all)
|
9
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
10
|
+
};
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
+
for (let key of __getOwnPropNames(from))
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
+
}
|
17
|
+
return to;
|
18
|
+
};
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
25
|
+
mod
|
26
|
+
));
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
28
|
+
var stdin_exports = {};
|
29
|
+
__export(stdin_exports, {
|
30
|
+
default: () => stdin_default,
|
31
|
+
floatingBubbleProps: () => floatingBubbleProps
|
32
|
+
});
|
33
|
+
module.exports = __toCommonJS(stdin_exports);
|
34
|
+
var import_vue = require("vue");
|
35
|
+
var import_vue2 = require("vue");
|
36
|
+
var import_use = require("@vant/use");
|
37
|
+
var import_use_touch = require("../composables/use-touch");
|
38
|
+
var import_utils = require("../utils");
|
39
|
+
var import_icon = __toESM(require("../icon"));
|
40
|
+
const floatingBubbleProps = {
|
41
|
+
axis: (0, import_utils.makeStringProp)("y"),
|
42
|
+
magnetic: String,
|
43
|
+
icon: String,
|
44
|
+
gap: (0, import_utils.makeNumberProp)(24),
|
45
|
+
offset: {
|
46
|
+
type: Object,
|
47
|
+
default: () => ({
|
48
|
+
x: -1,
|
49
|
+
y: -1
|
50
|
+
})
|
51
|
+
},
|
52
|
+
teleport: {
|
53
|
+
type: [String, Object],
|
54
|
+
default: "body"
|
55
|
+
}
|
56
|
+
};
|
57
|
+
const [name, bem] = (0, import_utils.createNamespace)("floating-bubble");
|
58
|
+
var stdin_default = (0, import_vue2.defineComponent)({
|
59
|
+
name,
|
60
|
+
props: floatingBubbleProps,
|
61
|
+
emits: ["click", "update:offset", "offsetChange"],
|
62
|
+
setup(props, {
|
63
|
+
slots,
|
64
|
+
emit
|
65
|
+
}) {
|
66
|
+
const rootRef = (0, import_vue2.ref)();
|
67
|
+
const state = (0, import_vue2.ref)({
|
68
|
+
x: 0,
|
69
|
+
y: 0,
|
70
|
+
width: 0,
|
71
|
+
height: 0
|
72
|
+
});
|
73
|
+
const boundary = (0, import_vue2.computed)(() => ({
|
74
|
+
top: props.gap,
|
75
|
+
right: import_utils.windowWidth.value - state.value.height - props.gap,
|
76
|
+
bottom: import_utils.windowHeight.value - state.value.width - props.gap,
|
77
|
+
left: props.gap
|
78
|
+
}));
|
79
|
+
const dragging = (0, import_vue2.ref)(false);
|
80
|
+
let initialized = false;
|
81
|
+
const rootStyle = (0, import_vue2.computed)(() => {
|
82
|
+
const style = {};
|
83
|
+
const x = (0, import_utils.addUnit)(state.value.x);
|
84
|
+
const y = (0, import_utils.addUnit)(state.value.y);
|
85
|
+
style.transform = `translate3d(${x}, ${y}, 0)`;
|
86
|
+
if (dragging.value || !initialized) {
|
87
|
+
style.transition = "none";
|
88
|
+
}
|
89
|
+
return style;
|
90
|
+
});
|
91
|
+
const updateState = () => {
|
92
|
+
const {
|
93
|
+
width,
|
94
|
+
height
|
95
|
+
} = (0, import_use.useRect)(rootRef.value);
|
96
|
+
const {
|
97
|
+
offset
|
98
|
+
} = props;
|
99
|
+
state.value = {
|
100
|
+
x: offset.x > -1 ? offset.x : import_utils.windowWidth.value - width - props.gap,
|
101
|
+
y: offset.y > -1 ? offset.y : import_utils.windowHeight.value - height - props.gap,
|
102
|
+
width,
|
103
|
+
height
|
104
|
+
};
|
105
|
+
};
|
106
|
+
const touch = (0, import_use_touch.useTouch)();
|
107
|
+
let prevX = 0;
|
108
|
+
let prevY = 0;
|
109
|
+
const onTouchStart = (e) => {
|
110
|
+
touch.start(e);
|
111
|
+
dragging.value = true;
|
112
|
+
prevX = state.value.x;
|
113
|
+
prevY = state.value.y;
|
114
|
+
};
|
115
|
+
const onTouchMove = (e) => {
|
116
|
+
e.preventDefault();
|
117
|
+
touch.move(e);
|
118
|
+
if (props.axis === "lock")
|
119
|
+
return;
|
120
|
+
if (!touch.isTap.value) {
|
121
|
+
if (props.axis === "x" || props.axis === "xy") {
|
122
|
+
let nextX = prevX + touch.deltaX.value;
|
123
|
+
if (nextX < boundary.value.left)
|
124
|
+
nextX = boundary.value.left;
|
125
|
+
if (nextX > boundary.value.right)
|
126
|
+
nextX = boundary.value.right;
|
127
|
+
state.value.x = nextX;
|
128
|
+
}
|
129
|
+
if (props.axis === "y" || props.axis === "xy") {
|
130
|
+
let nextY = prevY + touch.deltaY.value;
|
131
|
+
if (nextY < boundary.value.top)
|
132
|
+
nextY = boundary.value.top;
|
133
|
+
if (nextY > boundary.value.bottom)
|
134
|
+
nextY = boundary.value.bottom;
|
135
|
+
state.value.y = nextY;
|
136
|
+
}
|
137
|
+
const offset = (0, import_utils.pick)(state.value, ["x", "y"]);
|
138
|
+
emit("update:offset", offset);
|
139
|
+
}
|
140
|
+
};
|
141
|
+
(0, import_use.useEventListener)("touchmove", onTouchMove, {
|
142
|
+
target: rootRef
|
143
|
+
});
|
144
|
+
const onTouchEnd = () => {
|
145
|
+
dragging.value = false;
|
146
|
+
(0, import_vue2.nextTick)(() => {
|
147
|
+
if (props.magnetic === "x") {
|
148
|
+
const nextX = (0, import_utils.closest)([boundary.value.left, boundary.value.right], state.value.x);
|
149
|
+
state.value.x = nextX;
|
150
|
+
}
|
151
|
+
if (props.magnetic === "y") {
|
152
|
+
const nextY = (0, import_utils.closest)([boundary.value.top, boundary.value.bottom], state.value.y);
|
153
|
+
state.value.y = nextY;
|
154
|
+
}
|
155
|
+
if (!touch.isTap.value) {
|
156
|
+
const offset = (0, import_utils.pick)(state.value, ["x", "y"]);
|
157
|
+
emit("update:offset", offset);
|
158
|
+
if (prevX !== offset.x || prevY !== offset.y) {
|
159
|
+
emit("offsetChange", offset);
|
160
|
+
}
|
161
|
+
}
|
162
|
+
});
|
163
|
+
};
|
164
|
+
const onClick = (e) => {
|
165
|
+
if (touch.isTap.value)
|
166
|
+
emit("click", e);
|
167
|
+
};
|
168
|
+
(0, import_vue2.onMounted)(() => {
|
169
|
+
updateState();
|
170
|
+
(0, import_vue2.nextTick)(() => {
|
171
|
+
initialized = true;
|
172
|
+
});
|
173
|
+
});
|
174
|
+
(0, import_vue2.watch)([import_utils.windowWidth, import_utils.windowHeight, () => props.gap, () => props.offset], () => updateState(), {
|
175
|
+
deep: true
|
176
|
+
});
|
177
|
+
const show = (0, import_vue2.ref)(true);
|
178
|
+
(0, import_vue2.onActivated)(() => {
|
179
|
+
show.value = true;
|
180
|
+
});
|
181
|
+
(0, import_vue2.onDeactivated)(() => {
|
182
|
+
if (props.teleport) {
|
183
|
+
show.value = false;
|
184
|
+
}
|
185
|
+
});
|
186
|
+
return () => {
|
187
|
+
const Content = (0, import_vue.withDirectives)((0, import_vue.createVNode)("div", {
|
188
|
+
"class": bem(),
|
189
|
+
"ref": rootRef,
|
190
|
+
"onTouchstartPassive": onTouchStart,
|
191
|
+
"onTouchend": onTouchEnd,
|
192
|
+
"onTouchcancel": onTouchEnd,
|
193
|
+
"onClick": onClick,
|
194
|
+
"style": rootStyle.value
|
195
|
+
}, [slots.default ? slots.default() : (0, import_vue.createVNode)(import_icon.default, {
|
196
|
+
"name": props.icon,
|
197
|
+
"class": bem("icon")
|
198
|
+
}, null)]), [[import_vue.vShow, show.value]]);
|
199
|
+
return props.teleport ? (0, import_vue.createVNode)(import_vue2.Teleport, {
|
200
|
+
"to": props.teleport
|
201
|
+
}, {
|
202
|
+
default: () => [Content]
|
203
|
+
}) : Content;
|
204
|
+
};
|
205
|
+
}
|
206
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
:root{--van-floating-bubble-size: 48px;--van-floating-bubble-initial-gap: 24px;--van-floating-bubble-icon-size: 28px;--van-floating-bubble-background: var(--van-primary-color);--van-floating-bubble-color: var(--van-background-2);--van-floating-bubble-z-index: 999}.van-floating-bubble{position:fixed;left:0;top:0;right:var(--van-floating-bubble-initial-gap);bottom:var(--van-floating-bubble-initial-gap);width:var(--van-floating-bubble-size);height:var(--van-floating-bubble-size);box-sizing:border-box;display:flex;justify-content:center;align-items:center;overflow:hidden;cursor:pointer;-webkit-user-select:none;user-select:none;touch-action:none;background:var(--van-floating-bubble-background);color:var(--van-floating-bubble-color);border-radius:var(--van-radius-max);z-index:var(--van-floating-bubble-z-index);transition:transform .3s}.van-floating-bubble:active{opacity:.9}.van-floating-bubble__icon{font-size:var(--van-floating-bubble-icon-size)}
|