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.
Files changed (132) hide show
  1. package/README.md +6 -6
  2. package/es/barrage/index.d.ts +1 -1
  3. package/es/barrage/types.d.ts +6 -0
  4. package/es/composables/use-touch.d.ts +1 -0
  5. package/es/composables/use-touch.mjs +8 -1
  6. package/es/config-provider/types.d.ts +1 -1
  7. package/es/dropdown-menu/index.d.ts +1 -1
  8. package/es/field/Field.mjs +1 -1
  9. package/es/floating-bubble/FloatingBubble.d.ts +86 -0
  10. package/es/floating-bubble/FloatingBubble.mjs +177 -0
  11. package/es/floating-bubble/index.css +1 -0
  12. package/es/floating-bubble/index.d.ts +63 -0
  13. package/es/floating-bubble/index.mjs +10 -0
  14. package/es/floating-bubble/style/index.d.ts +1 -0
  15. package/es/floating-bubble/style/index.mjs +4 -0
  16. package/es/floating-bubble/types.d.ts +8 -0
  17. package/es/floating-bubble/types.mjs +0 -0
  18. package/es/floating-panel/FloatingPanel.mjs +5 -7
  19. package/es/floating-panel/index.d.ts +3 -2
  20. package/es/floating-panel/index.mjs +3 -1
  21. package/es/floating-panel/types.d.ts +9 -0
  22. package/es/floating-panel/types.mjs +0 -0
  23. package/es/image-preview/ImagePreviewItem.mjs +1 -2
  24. package/es/index.d.ts +3 -1
  25. package/es/index.mjs +7 -1
  26. package/es/lazyload/vue-lazyload/util.d.ts +2 -2
  27. package/es/picker/PickerColumn.mjs +7 -2
  28. package/es/rate/Rate.d.ts +4 -0
  29. package/es/rate/Rate.mjs +16 -10
  30. package/es/rate/index.css +1 -1
  31. package/es/rate/index.d.ts +3 -0
  32. package/es/rolling-text/RollingText.d.ts +104 -0
  33. package/es/rolling-text/RollingText.mjs +98 -0
  34. package/es/rolling-text/RollingTextItem.d.ts +67 -0
  35. package/es/rolling-text/RollingTextItem.mjs +47 -0
  36. package/es/rolling-text/index.css +1 -0
  37. package/es/rolling-text/index.d.ts +79 -0
  38. package/es/rolling-text/index.mjs +10 -0
  39. package/es/rolling-text/style/index.d.ts +1 -0
  40. package/es/rolling-text/style/index.mjs +2 -0
  41. package/es/rolling-text/types.d.ts +17 -0
  42. package/es/rolling-text/types.mjs +0 -0
  43. package/es/signature/index.d.ts +1 -0
  44. package/es/signature/types.d.ts +6 -0
  45. package/es/signature/types.mjs +0 -0
  46. package/es/slider/Slider.d.ts +1 -1
  47. package/es/slider/index.d.ts +1 -1
  48. package/es/stepper/Stepper.d.ts +1 -1
  49. package/es/stepper/index.d.ts +1 -1
  50. package/es/style/base.css +1 -1
  51. package/es/submit-bar/types.d.ts +0 -1
  52. package/es/uploader/Uploader.mjs +6 -4
  53. package/es/uploader/UploaderPreviewItem.mjs +1 -1
  54. package/es/uploader/types.d.ts +1 -0
  55. package/es/utils/closest.d.ts +1 -0
  56. package/es/utils/closest.mjs +8 -0
  57. package/es/utils/constant.d.ts +1 -0
  58. package/es/utils/constant.mjs +3 -1
  59. package/es/utils/index.d.ts +1 -0
  60. package/es/utils/index.mjs +1 -0
  61. package/es/watermark/index.d.ts +1 -0
  62. package/es/watermark/types.d.ts +3 -0
  63. package/es/watermark/types.mjs +0 -0
  64. package/lib/barrage/index.d.ts +1 -1
  65. package/lib/barrage/types.d.ts +6 -0
  66. package/lib/composables/use-touch.d.ts +1 -0
  67. package/lib/composables/use-touch.js +8 -1
  68. package/lib/config-provider/types.d.ts +1 -1
  69. package/lib/dropdown-menu/index.d.ts +1 -1
  70. package/lib/field/Field.js +1 -1
  71. package/lib/floating-bubble/FloatingBubble.d.ts +86 -0
  72. package/lib/floating-bubble/FloatingBubble.js +206 -0
  73. package/lib/floating-bubble/index.css +1 -0
  74. package/lib/floating-bubble/index.d.ts +63 -0
  75. package/lib/floating-bubble/index.js +39 -0
  76. package/lib/floating-bubble/style/index.d.ts +1 -0
  77. package/lib/floating-bubble/style/index.js +4 -0
  78. package/lib/floating-bubble/types.d.ts +8 -0
  79. package/lib/floating-bubble/types.js +15 -0
  80. package/lib/floating-panel/FloatingPanel.js +6 -8
  81. package/lib/floating-panel/index.d.ts +3 -2
  82. package/lib/floating-panel/index.js +3 -1
  83. package/lib/floating-panel/types.d.ts +9 -0
  84. package/lib/floating-panel/types.js +15 -0
  85. package/lib/image-preview/ImagePreviewItem.js +1 -2
  86. package/lib/index.css +1 -1
  87. package/lib/index.d.ts +3 -1
  88. package/lib/index.js +7 -1
  89. package/lib/lazyload/vue-lazyload/util.d.ts +2 -2
  90. package/lib/picker/PickerColumn.js +7 -2
  91. package/lib/rate/Rate.d.ts +4 -0
  92. package/lib/rate/Rate.js +16 -10
  93. package/lib/rate/index.css +1 -1
  94. package/lib/rate/index.d.ts +3 -0
  95. package/lib/rolling-text/RollingText.d.ts +104 -0
  96. package/lib/rolling-text/RollingText.js +127 -0
  97. package/lib/rolling-text/RollingTextItem.d.ts +67 -0
  98. package/lib/rolling-text/RollingTextItem.js +66 -0
  99. package/lib/rolling-text/index.css +1 -0
  100. package/lib/rolling-text/index.d.ts +79 -0
  101. package/lib/rolling-text/index.js +39 -0
  102. package/lib/rolling-text/style/index.d.ts +1 -0
  103. package/lib/rolling-text/style/index.js +2 -0
  104. package/lib/rolling-text/types.d.ts +17 -0
  105. package/lib/rolling-text/types.js +15 -0
  106. package/lib/signature/index.d.ts +1 -0
  107. package/lib/signature/types.d.ts +6 -0
  108. package/lib/signature/types.js +15 -0
  109. package/lib/slider/Slider.d.ts +1 -1
  110. package/lib/slider/index.d.ts +1 -1
  111. package/lib/stepper/Stepper.d.ts +1 -1
  112. package/lib/stepper/index.d.ts +1 -1
  113. package/lib/style/base.css +1 -1
  114. package/lib/submit-bar/types.d.ts +0 -1
  115. package/lib/uploader/Uploader.js +6 -4
  116. package/lib/uploader/UploaderPreviewItem.js +1 -1
  117. package/lib/uploader/types.d.ts +1 -0
  118. package/lib/utils/closest.d.ts +1 -0
  119. package/lib/utils/closest.js +27 -0
  120. package/lib/utils/constant.d.ts +1 -0
  121. package/lib/utils/constant.js +3 -1
  122. package/lib/utils/index.d.ts +1 -0
  123. package/lib/utils/index.js +1 -0
  124. package/lib/vant.cjs.js +2355 -2028
  125. package/lib/vant.es.js +2355 -2028
  126. package/lib/vant.js +2366 -2166
  127. package/lib/vant.min.js +1 -1
  128. package/lib/watermark/index.d.ts +1 -0
  129. package/lib/watermark/types.d.ts +3 -0
  130. package/lib/watermark/types.js +15 -0
  131. package/lib/web-types.json +1 -1
  132. package/package.json +1 -1
@@ -0,0 +1,63 @@
1
+ export declare const FloatingBubble: import("../utils").WithInstall<import("vue").DefineComponent<{
2
+ axis: {
3
+ type: import("vue").PropType<import("./FloatingBubble").FloatingBubbleAxis>;
4
+ default: import("./FloatingBubble").FloatingBubbleAxis;
5
+ };
6
+ magnetic: import("vue").PropType<import("./FloatingBubble").FloatingBubbleMagnetic>;
7
+ icon: StringConstructor;
8
+ gap: {
9
+ type: NumberConstructor;
10
+ default: number;
11
+ };
12
+ offset: {
13
+ type: import("vue").PropType<import("./FloatingBubble").FloatingBubbleOffset>;
14
+ default: () => {
15
+ x: number;
16
+ y: number;
17
+ };
18
+ };
19
+ teleport: {
20
+ type: import("vue").PropType<string | import("vue").RendererElement | null | undefined>;
21
+ default: string;
22
+ };
23
+ }, () => 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<import("vue").ExtractPropTypes<{
24
+ axis: {
25
+ type: import("vue").PropType<import("./FloatingBubble").FloatingBubbleAxis>;
26
+ default: import("./FloatingBubble").FloatingBubbleAxis;
27
+ };
28
+ magnetic: import("vue").PropType<import("./FloatingBubble").FloatingBubbleMagnetic>;
29
+ icon: StringConstructor;
30
+ gap: {
31
+ type: NumberConstructor;
32
+ default: number;
33
+ };
34
+ offset: {
35
+ type: import("vue").PropType<import("./FloatingBubble").FloatingBubbleOffset>;
36
+ default: () => {
37
+ x: number;
38
+ y: number;
39
+ };
40
+ };
41
+ teleport: {
42
+ type: import("vue").PropType<string | import("vue").RendererElement | null | undefined>;
43
+ default: string;
44
+ };
45
+ }>> & {
46
+ onClick?: ((...args: any[]) => any) | undefined;
47
+ "onUpdate:offset"?: ((...args: any[]) => any) | undefined;
48
+ onOffsetChange?: ((...args: any[]) => any) | undefined;
49
+ }, {
50
+ offset: import("./FloatingBubble").FloatingBubbleOffset;
51
+ teleport: string | import("vue").RendererElement | null | undefined;
52
+ gap: number;
53
+ axis: import("./FloatingBubble").FloatingBubbleAxis;
54
+ }, {}>>;
55
+ export default FloatingBubble;
56
+ export { floatingBubbleProps } from './FloatingBubble';
57
+ export type { FloatingBubbleProps, FloatingBubbleAxis, FloatingBubbleMagnetic, FloatingBubbleOffset, } from './FloatingBubble';
58
+ export type { FloatingBubbleThemeVars } from './types';
59
+ declare module 'vue' {
60
+ interface GlobalComponents {
61
+ FloatingBubble: typeof FloatingBubble;
62
+ }
63
+ }
@@ -0,0 +1,39 @@
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 name in all)
9
+ __defProp(target, name, { get: all[name], 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
+ FloatingBubble: () => FloatingBubble,
31
+ default: () => stdin_default,
32
+ floatingBubbleProps: () => import_FloatingBubble2.floatingBubbleProps
33
+ });
34
+ module.exports = __toCommonJS(stdin_exports);
35
+ var import_utils = require("../utils");
36
+ var import_FloatingBubble = __toESM(require("./FloatingBubble"));
37
+ var import_FloatingBubble2 = require("./FloatingBubble");
38
+ const FloatingBubble = (0, import_utils.withInstall)(import_FloatingBubble.default);
39
+ var stdin_default = FloatingBubble;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ require("../../style/base.css");
2
+ require("../../badge/index.css");
3
+ require("../../icon/index.css");
4
+ require("../index.css");
@@ -0,0 +1,8 @@
1
+ export type FloatingBubbleThemeVars = {
2
+ floatingBubbleSize?: string;
3
+ floatingBubbleInitialGap?: string;
4
+ floatingBubbleIconSize?: string;
5
+ floatingBubbleBackground?: string;
6
+ floatingBubbleColor?: string;
7
+ floatingBubbleZIndex?: number | string;
8
+ };
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var stdin_exports = {};
15
+ module.exports = __toCommonJS(stdin_exports);
@@ -28,9 +28,6 @@ var import_use = require("@vant/use");
28
28
  var import_use_lock_scroll = require("../composables/use-lock-scroll");
29
29
  var import_use_touch = require("../composables/use-touch");
30
30
  var import_use_sync_prop_ref = require("../composables/use-sync-prop-ref");
31
- const {
32
- height: windowHeight
33
- } = (0, import_use.useWindowSize)();
34
31
  const floatingPanelProps = {
35
32
  height: (0, import_utils.makeNumericProp)(0),
36
33
  anchors: (0, import_utils.makeArrayProp)(),
@@ -55,7 +52,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
55
52
  var _a, _b;
56
53
  return {
57
54
  min: (_a = props.anchors[0]) != null ? _a : 100,
58
- max: (_b = props.anchors[props.anchors.length - 1]) != null ? _b : Math.round(windowHeight.value * 0.6)
55
+ max: (_b = props.anchors[props.anchors.length - 1]) != null ? _b : Math.round(import_utils.windowHeight.value * 0.6)
59
56
  };
60
57
  });
61
58
  const anchors = (0, import_vue2.computed)(() => props.anchors.length >= 2 ? props.anchors : [boundary.value.min, boundary.value.max]);
@@ -79,7 +76,6 @@ var stdin_default = (0, import_vue2.defineComponent)({
79
76
  }
80
77
  return moveY;
81
78
  };
82
- const closest = (arr, target) => arr.reduce((pre, cur) => Math.abs(pre - target) < Math.abs(cur - target) ? pre : cur);
83
79
  let startY;
84
80
  const touch = (0, import_use_touch.useTouch)();
85
81
  const onTouchstart = (e) => {
@@ -107,7 +103,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
107
103
  };
108
104
  const onTouchend = () => {
109
105
  dragging.value = false;
110
- height.value = closest(anchors.value, height.value);
106
+ height.value = (0, import_utils.closest)(anchors.value, height.value);
111
107
  if (height.value !== -startY) {
112
108
  emit("heightChange", {
113
109
  height: height.value
@@ -115,11 +111,14 @@ var stdin_default = (0, import_vue2.defineComponent)({
115
111
  }
116
112
  };
117
113
  (0, import_vue2.watch)(boundary, () => {
118
- height.value = closest(anchors.value, height.value);
114
+ height.value = (0, import_utils.closest)(anchors.value, height.value);
119
115
  }, {
120
116
  immediate: true
121
117
  });
122
118
  (0, import_use_lock_scroll.useLockScroll)(rootRef, () => true);
119
+ (0, import_use.useEventListener)("touchmove", onTouchmove, {
120
+ target: rootRef
121
+ });
123
122
  return () => {
124
123
  var _a;
125
124
  return (0, import_vue.createVNode)("div", {
@@ -129,7 +128,6 @@ var stdin_default = (0, import_vue2.defineComponent)({
129
128
  "ref": rootRef,
130
129
  "style": rootStyle.value,
131
130
  "onTouchstartPassive": onTouchstart,
132
- "onTouchmove": onTouchmove,
133
131
  "onTouchend": onTouchend,
134
132
  "onTouchcancel": onTouchend
135
133
  }, [(0, import_vue.createVNode)("div", {
@@ -1,4 +1,3 @@
1
- import { FloatingPanelProps } from './FloatingPanel';
2
1
  export declare const FloatingPanel: import("../utils").WithInstall<import("vue").DefineComponent<{
3
2
  height: {
4
3
  type: (NumberConstructor | StringConstructor)[];
@@ -52,7 +51,9 @@ export declare const FloatingPanel: import("../utils").WithInstall<import("vue")
52
51
  contentDraggable: boolean;
53
52
  }, {}>>;
54
53
  export default FloatingPanel;
55
- export type { FloatingPanelProps };
54
+ export { floatingPanelProps } from './FloatingPanel';
55
+ export type { FloatingPanelProps } from './FloatingPanel';
56
+ export type { FloatingPanelThemeVars } from './types';
56
57
  declare module 'vue' {
57
58
  interface GlobalComponents {
58
59
  VanFloatingPanel: typeof FloatingPanel;
@@ -28,10 +28,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
28
28
  var stdin_exports = {};
29
29
  __export(stdin_exports, {
30
30
  FloatingPanel: () => FloatingPanel,
31
- default: () => stdin_default
31
+ default: () => stdin_default,
32
+ floatingPanelProps: () => import_FloatingPanel2.floatingPanelProps
32
33
  });
33
34
  module.exports = __toCommonJS(stdin_exports);
34
35
  var import_utils = require("../utils");
35
36
  var import_FloatingPanel = __toESM(require("./FloatingPanel"));
37
+ var import_FloatingPanel2 = require("./FloatingPanel");
36
38
  const FloatingPanel = (0, import_utils.withInstall)(import_FloatingPanel.default);
37
39
  var stdin_default = FloatingPanel;
@@ -0,0 +1,9 @@
1
+ export type FloatingPanelThemeVars = {
2
+ floatingPanelBorderRadius?: string;
3
+ floatingPanelHeaderHeight?: string;
4
+ floatingPanelZIndex?: number | string;
5
+ floatingPanelBackground?: string;
6
+ floatingPanelBarWidth?: string;
7
+ floatingPanelBarHeight?: string;
8
+ floatingPanelBarColor?: string;
9
+ };
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var stdin_exports = {};
15
+ module.exports = __toCommonJS(stdin_exports);
@@ -214,8 +214,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
214
214
  } = touch;
215
215
  const deltaTime = Date.now() - touchStartTime;
216
216
  const TAP_TIME = 250;
217
- const TAP_OFFSET = 5;
218
- if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET) {
217
+ if (offsetX.value < import_utils.TAP_OFFSET && offsetY.value < import_utils.TAP_OFFSET) {
219
218
  if (deltaTime < TAP_TIME) {
220
219
  if (doubleTapTimer) {
221
220
  clearTimeout(doubleTapTimer);