vant 4.8.0 → 4.8.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 CHANGED
@@ -66,6 +66,20 @@ pnpm add vant
66
66
  bun add vant
67
67
  ```
68
68
 
69
+ ## Scaffold
70
+
71
+ It is recommended to use [Rsbuild](https://github.com/web-infra-dev/rsbuild) to create a scaffold project.
72
+
73
+ Rsbuild is a build tool based on Rspack, developed by the author of Vant, with first-class build speed and development experience, providing first-priority support for Vant.
74
+
75
+ You can create a Rsbuild project with the following command:
76
+
77
+ ```bash
78
+ npm create rsbuild@latest
79
+ ```
80
+
81
+ Please visit the [Rsbuild repository](https://github.com/web-infra-dev/rsbuild) for more information.
82
+
69
83
  ## Quickstart
70
84
 
71
85
  ```js
package/es/index.d.ts CHANGED
@@ -106,4 +106,4 @@ declare namespace _default {
106
106
  }
107
107
  export default _default;
108
108
  export function install(app: any): void;
109
- export const version: "4.8.0";
109
+ export const version: "4.8.1";
package/es/index.mjs CHANGED
@@ -99,7 +99,7 @@ import { Toast } from "./toast/index.mjs";
99
99
  import { TreeSelect } from "./tree-select/index.mjs";
100
100
  import { Uploader } from "./uploader/index.mjs";
101
101
  import { Watermark } from "./watermark/index.mjs";
102
- const version = "4.8.0";
102
+ const version = "4.8.1";
103
103
  function install(app) {
104
104
  const components = [
105
105
  ActionBar,
@@ -1,7 +1,7 @@
1
1
  import { createVNode as _createVNode } from "vue";
2
2
  import { ref, watch, computed, onMounted, defineComponent } from "vue";
3
- import { useEventListener } from "@vant/use";
4
- import { makeNumericProp, makeStringProp, createNamespace } from "../utils/index.mjs";
3
+ import { makeNumericProp, makeStringProp, createNamespace, windowWidth } from "../utils/index.mjs";
4
+ import { useExpose } from "../composables/use-expose.mjs";
5
5
  const [name, bem] = createNamespace("text-ellipsis");
6
6
  const textEllipsisProps = {
7
7
  rows: makeNumericProp(1),
@@ -117,8 +117,11 @@ var stdin_default = defineComponent({
117
117
  }
118
118
  document.body.removeChild(container);
119
119
  };
120
+ const toggle = (isExpanded = !expanded.value) => {
121
+ expanded.value = isExpanded;
122
+ };
120
123
  const onClickAction = (event) => {
121
- expanded.value = !expanded.value;
124
+ toggle();
122
125
  emit("clickAction", event);
123
126
  };
124
127
  const renderAction = () => _createVNode("span", {
@@ -126,8 +129,10 @@ var stdin_default = defineComponent({
126
129
  "onClick": onClickAction
127
130
  }, [actionText.value]);
128
131
  onMounted(calcEllipsised);
129
- watch(() => [props.content, props.rows, props.position], calcEllipsised);
130
- useEventListener("resize", calcEllipsised);
132
+ watch([windowWidth, () => [props.content, props.rows, props.position]], calcEllipsised);
133
+ useExpose({
134
+ toggle
135
+ });
131
136
  return () => _createVNode("div", {
132
137
  "ref": root,
133
138
  "class": bem()
@@ -61,7 +61,7 @@ export declare const TextEllipsis: import("../utils").WithInstall<import("vue").
61
61
  export default TextEllipsis;
62
62
  export { textEllipsisProps } from './TextEllipsis';
63
63
  export type { TextEllipsisProps } from './TextEllipsis';
64
- export type { TextEllipsisThemeVars } from './types';
64
+ export type { TextEllipsisInstance, TextEllipsisThemeVars } from './types';
65
65
  declare module 'vue' {
66
66
  interface GlobalComponents {
67
67
  VanTextEllipsis: typeof TextEllipsis;
@@ -1,3 +1,9 @@
1
+ import type { ComponentPublicInstance } from 'vue';
2
+ import type { TextEllipsisProps } from './TextEllipsis';
3
+ export type TextEllipsisExpose = {
4
+ toggle: (expanded?: boolean) => void;
5
+ };
6
+ export type TextEllipsisInstance = ComponentPublicInstance<TextEllipsisProps, TextEllipsisExpose>;
1
7
  export type TextEllipsisThemeVars = {
2
8
  textEllipsisActionColor?: string;
3
9
  };
package/lib/index.d.ts CHANGED
@@ -106,4 +106,4 @@ declare namespace _default {
106
106
  }
107
107
  export default _default;
108
108
  export function install(app: any): void;
109
- export const version: "4.8.0";
109
+ export const version: "4.8.1";
package/lib/index.js CHANGED
@@ -226,7 +226,7 @@ __reExport(stdin_exports, require("./toast"), module.exports);
226
226
  __reExport(stdin_exports, require("./tree-select"), module.exports);
227
227
  __reExport(stdin_exports, require("./uploader"), module.exports);
228
228
  __reExport(stdin_exports, require("./watermark"), module.exports);
229
- const version = "4.8.0";
229
+ const version = "4.8.1";
230
230
  function install(app) {
231
231
  const components = [
232
232
  import_action_bar.ActionBar,
@@ -23,8 +23,8 @@ __export(stdin_exports, {
23
23
  module.exports = __toCommonJS(stdin_exports);
24
24
  var import_vue = require("vue");
25
25
  var import_vue2 = require("vue");
26
- var import_use = require("@vant/use");
27
26
  var import_utils = require("../utils");
27
+ var import_use_expose = require("../composables/use-expose");
28
28
  const [name, bem] = (0, import_utils.createNamespace)("text-ellipsis");
29
29
  const textEllipsisProps = {
30
30
  rows: (0, import_utils.makeNumericProp)(1),
@@ -140,8 +140,11 @@ var stdin_default = (0, import_vue2.defineComponent)({
140
140
  }
141
141
  document.body.removeChild(container);
142
142
  };
143
+ const toggle = (isExpanded = !expanded.value) => {
144
+ expanded.value = isExpanded;
145
+ };
143
146
  const onClickAction = (event) => {
144
- expanded.value = !expanded.value;
147
+ toggle();
145
148
  emit("clickAction", event);
146
149
  };
147
150
  const renderAction = () => (0, import_vue.createVNode)("span", {
@@ -149,8 +152,10 @@ var stdin_default = (0, import_vue2.defineComponent)({
149
152
  "onClick": onClickAction
150
153
  }, [actionText.value]);
151
154
  (0, import_vue2.onMounted)(calcEllipsised);
152
- (0, import_vue2.watch)(() => [props.content, props.rows, props.position], calcEllipsised);
153
- (0, import_use.useEventListener)("resize", calcEllipsised);
155
+ (0, import_vue2.watch)([import_utils.windowWidth, () => [props.content, props.rows, props.position]], calcEllipsised);
156
+ (0, import_use_expose.useExpose)({
157
+ toggle
158
+ });
154
159
  return () => (0, import_vue.createVNode)("div", {
155
160
  "ref": root,
156
161
  "class": bem()
@@ -61,7 +61,7 @@ export declare const TextEllipsis: import("../utils").WithInstall<import("vue").
61
61
  export default TextEllipsis;
62
62
  export { textEllipsisProps } from './TextEllipsis';
63
63
  export type { TextEllipsisProps } from './TextEllipsis';
64
- export type { TextEllipsisThemeVars } from './types';
64
+ export type { TextEllipsisInstance, TextEllipsisThemeVars } from './types';
65
65
  declare module 'vue' {
66
66
  interface GlobalComponents {
67
67
  VanTextEllipsis: typeof TextEllipsis;
@@ -1,3 +1,9 @@
1
+ import type { ComponentPublicInstance } from 'vue';
2
+ import type { TextEllipsisProps } from './TextEllipsis';
3
+ export type TextEllipsisExpose = {
4
+ toggle: (expanded?: boolean) => void;
5
+ };
6
+ export type TextEllipsisInstance = ComponentPublicInstance<TextEllipsisProps, TextEllipsisExpose>;
1
7
  export type TextEllipsisThemeVars = {
2
8
  textEllipsisActionColor?: string;
3
9
  };
package/lib/vant.cjs.js CHANGED
@@ -15048,8 +15048,11 @@ var stdin_default$9 = vue.defineComponent({
15048
15048
  }
15049
15049
  document.body.removeChild(container);
15050
15050
  };
15051
+ const toggle = (isExpanded = !expanded.value) => {
15052
+ expanded.value = isExpanded;
15053
+ };
15051
15054
  const onClickAction = (event) => {
15052
- expanded.value = !expanded.value;
15055
+ toggle();
15053
15056
  emit("clickAction", event);
15054
15057
  };
15055
15058
  const renderAction = () => vue.createVNode("span", {
@@ -15057,8 +15060,10 @@ var stdin_default$9 = vue.defineComponent({
15057
15060
  "onClick": onClickAction
15058
15061
  }, [actionText.value]);
15059
15062
  vue.onMounted(calcEllipsised);
15060
- vue.watch(() => [props2.content, props2.rows, props2.position], calcEllipsised);
15061
- use.useEventListener("resize", calcEllipsised);
15063
+ vue.watch([windowWidth, () => [props2.content, props2.rows, props2.position]], calcEllipsised);
15064
+ useExpose({
15065
+ toggle
15066
+ });
15062
15067
  return () => vue.createVNode("div", {
15063
15068
  "ref": root,
15064
15069
  "class": bem$3()
@@ -16725,7 +16730,7 @@ const Lazyload = {
16725
16730
  });
16726
16731
  }
16727
16732
  };
16728
- const version = "4.8.0";
16733
+ const version = "4.8.1";
16729
16734
  function install(app) {
16730
16735
  const components = [
16731
16736
  ActionBar,
package/lib/vant.es.js CHANGED
@@ -15046,8 +15046,11 @@ var stdin_default$9 = defineComponent({
15046
15046
  }
15047
15047
  document.body.removeChild(container);
15048
15048
  };
15049
+ const toggle = (isExpanded = !expanded.value) => {
15050
+ expanded.value = isExpanded;
15051
+ };
15049
15052
  const onClickAction = (event) => {
15050
- expanded.value = !expanded.value;
15053
+ toggle();
15051
15054
  emit("clickAction", event);
15052
15055
  };
15053
15056
  const renderAction = () => createVNode("span", {
@@ -15055,8 +15058,10 @@ var stdin_default$9 = defineComponent({
15055
15058
  "onClick": onClickAction
15056
15059
  }, [actionText.value]);
15057
15060
  onMounted(calcEllipsised);
15058
- watch(() => [props2.content, props2.rows, props2.position], calcEllipsised);
15059
- useEventListener("resize", calcEllipsised);
15061
+ watch([windowWidth, () => [props2.content, props2.rows, props2.position]], calcEllipsised);
15062
+ useExpose({
15063
+ toggle
15064
+ });
15060
15065
  return () => createVNode("div", {
15061
15066
  "ref": root,
15062
15067
  "class": bem$3()
@@ -16723,7 +16728,7 @@ const Lazyload = {
16723
16728
  });
16724
16729
  }
16725
16730
  };
16726
- const version = "4.8.0";
16731
+ const version = "4.8.1";
16727
16732
  function install(app) {
16728
16733
  const components = [
16729
16734
  ActionBar,
package/lib/vant.js CHANGED
@@ -16278,8 +16278,11 @@
16278
16278
  }
16279
16279
  document.body.removeChild(container);
16280
16280
  };
16281
+ const toggle = (isExpanded = !expanded.value) => {
16282
+ expanded.value = isExpanded;
16283
+ };
16281
16284
  const onClickAction = (event) => {
16282
- expanded.value = !expanded.value;
16285
+ toggle();
16283
16286
  emit("clickAction", event);
16284
16287
  };
16285
16288
  const renderAction = () => vue.createVNode("span", {
@@ -16287,8 +16290,10 @@
16287
16290
  "onClick": onClickAction
16288
16291
  }, [actionText.value]);
16289
16292
  vue.onMounted(calcEllipsised);
16290
- vue.watch(() => [props2.content, props2.rows, props2.position], calcEllipsised);
16291
- useEventListener("resize", calcEllipsised);
16293
+ vue.watch([windowWidth, () => [props2.content, props2.rows, props2.position]], calcEllipsised);
16294
+ useExpose({
16295
+ toggle
16296
+ });
16292
16297
  return () => vue.createVNode("div", {
16293
16298
  "ref": root,
16294
16299
  "class": bem$3()
@@ -17935,7 +17940,7 @@
17935
17940
  });
17936
17941
  }
17937
17942
  };
17938
- const version = "4.8.0";
17943
+ const version = "4.8.1";
17939
17944
  function install(app) {
17940
17945
  const components = [
17941
17946
  ActionBar,