vant 4.1.2 → 4.2.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/es/index.d.ts +2 -1
- package/es/index.mjs +5 -2
- package/es/pagination/Pagination.d.ts +26 -0
- package/es/pagination/Pagination.mjs +14 -4
- package/es/pagination/index.css +1 -1
- package/es/pagination/index.d.ts +18 -0
- package/es/picker/Picker.d.ts +2 -1
- package/es/picker/Picker.mjs +16 -6
- package/es/picker/PickerColumn.d.ts +2 -1
- package/es/picker/PickerColumn.mjs +10 -4
- package/es/picker/index.d.ts +2 -1
- package/es/share-sheet/ShareSheet.mjs +11 -10
- package/es/sticky/Sticky.mjs +20 -4
- package/es/swipe/Swipe.mjs +1 -1
- package/es/tab/Tab.mjs +24 -6
- package/es/{tabs/TabsTitle.d.ts → tab/TabTitle.d.ts} +1 -2
- package/es/{tabs/TabsTitle.mjs → tab/TabTitle.mjs} +2 -2
- package/es/tabs/Tabs.d.ts +1 -1
- package/es/tabs/Tabs.mjs +15 -30
- package/es/tabs/index.d.ts +1 -1
- package/es/tabs/style/index.mjs +0 -1
- package/es/tabs/types.d.ts +3 -1
- package/es/text-ellipsis/TextEllipsis.d.ts +13 -0
- package/es/text-ellipsis/TextEllipsis.mjs +4 -3
- package/es/text-ellipsis/index.d.ts +9 -0
- package/es/watermark/Watermark.d.ts +112 -0
- package/es/watermark/Watermark.mjs +133 -0
- package/es/watermark/index.css +1 -0
- package/es/watermark/index.d.ts +83 -0
- package/es/watermark/index.mjs +10 -0
- package/es/watermark/style/index.d.ts +1 -0
- package/es/watermark/style/index.mjs +2 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +5 -2
- package/lib/pagination/Pagination.d.ts +26 -0
- package/lib/pagination/Pagination.js +13 -3
- package/lib/pagination/index.css +1 -1
- package/lib/pagination/index.d.ts +18 -0
- package/lib/picker/Picker.d.ts +2 -1
- package/lib/picker/Picker.js +16 -6
- package/lib/picker/PickerColumn.d.ts +2 -1
- package/lib/picker/PickerColumn.js +9 -3
- package/lib/picker/index.d.ts +2 -1
- package/lib/share-sheet/ShareSheet.js +11 -10
- package/lib/sticky/Sticky.js +18 -2
- package/lib/swipe/Swipe.js +1 -1
- package/lib/tab/Tab.js +21 -3
- package/lib/{tabs/TabsTitle.d.ts → tab/TabTitle.d.ts} +1 -2
- package/lib/{tabs/TabsTitle.js → tab/TabTitle.js} +2 -2
- package/lib/tabs/Tabs.d.ts +1 -1
- package/lib/tabs/Tabs.js +13 -28
- package/lib/tabs/index.d.ts +1 -1
- package/lib/tabs/style/index.js +0 -1
- package/lib/tabs/types.d.ts +3 -1
- package/lib/text-ellipsis/TextEllipsis.d.ts +13 -0
- package/lib/text-ellipsis/TextEllipsis.js +4 -3
- package/lib/text-ellipsis/index.d.ts +9 -0
- package/lib/vant.cjs.js +1158 -981
- package/lib/vant.es.js +1160 -983
- package/lib/vant.js +1159 -982
- package/lib/vant.min.js +1 -1
- package/lib/watermark/Watermark.d.ts +112 -0
- package/lib/watermark/Watermark.js +152 -0
- package/lib/watermark/index.css +1 -0
- package/lib/watermark/index.d.ts +83 -0
- package/lib/watermark/index.js +39 -0
- package/lib/watermark/style/index.d.ts +1 -0
- package/lib/watermark/style/index.js +2 -0
- package/lib/web-types.json +1 -1
- package/package.json +1 -1
@@ -0,0 +1,112 @@
|
|
1
|
+
import { type ExtractPropTypes } from 'vue';
|
2
|
+
export declare const watermarkProps: {
|
3
|
+
gapX: {
|
4
|
+
type: NumberConstructor;
|
5
|
+
default: number;
|
6
|
+
};
|
7
|
+
gapY: {
|
8
|
+
type: NumberConstructor;
|
9
|
+
default: number;
|
10
|
+
};
|
11
|
+
image: StringConstructor;
|
12
|
+
width: {
|
13
|
+
type: NumberConstructor;
|
14
|
+
default: number;
|
15
|
+
};
|
16
|
+
height: {
|
17
|
+
type: NumberConstructor;
|
18
|
+
default: number;
|
19
|
+
};
|
20
|
+
rotate: {
|
21
|
+
type: (NumberConstructor | StringConstructor)[];
|
22
|
+
default: number;
|
23
|
+
};
|
24
|
+
zIndex: (NumberConstructor | StringConstructor)[];
|
25
|
+
content: StringConstructor;
|
26
|
+
opacity: (NumberConstructor | StringConstructor)[];
|
27
|
+
fullPage: {
|
28
|
+
type: BooleanConstructor;
|
29
|
+
default: true;
|
30
|
+
};
|
31
|
+
textColor: {
|
32
|
+
type: import("vue").PropType<string>;
|
33
|
+
default: string;
|
34
|
+
};
|
35
|
+
};
|
36
|
+
export type WatermarkProps = ExtractPropTypes<typeof watermarkProps>;
|
37
|
+
declare const _default: import("vue").DefineComponent<{
|
38
|
+
gapX: {
|
39
|
+
type: NumberConstructor;
|
40
|
+
default: number;
|
41
|
+
};
|
42
|
+
gapY: {
|
43
|
+
type: NumberConstructor;
|
44
|
+
default: number;
|
45
|
+
};
|
46
|
+
image: StringConstructor;
|
47
|
+
width: {
|
48
|
+
type: NumberConstructor;
|
49
|
+
default: number;
|
50
|
+
};
|
51
|
+
height: {
|
52
|
+
type: NumberConstructor;
|
53
|
+
default: number;
|
54
|
+
};
|
55
|
+
rotate: {
|
56
|
+
type: (NumberConstructor | StringConstructor)[];
|
57
|
+
default: number;
|
58
|
+
};
|
59
|
+
zIndex: (NumberConstructor | StringConstructor)[];
|
60
|
+
content: StringConstructor;
|
61
|
+
opacity: (NumberConstructor | StringConstructor)[];
|
62
|
+
fullPage: {
|
63
|
+
type: BooleanConstructor;
|
64
|
+
default: true;
|
65
|
+
};
|
66
|
+
textColor: {
|
67
|
+
type: import("vue").PropType<string>;
|
68
|
+
default: string;
|
69
|
+
};
|
70
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
71
|
+
gapX: {
|
72
|
+
type: NumberConstructor;
|
73
|
+
default: number;
|
74
|
+
};
|
75
|
+
gapY: {
|
76
|
+
type: NumberConstructor;
|
77
|
+
default: number;
|
78
|
+
};
|
79
|
+
image: StringConstructor;
|
80
|
+
width: {
|
81
|
+
type: NumberConstructor;
|
82
|
+
default: number;
|
83
|
+
};
|
84
|
+
height: {
|
85
|
+
type: NumberConstructor;
|
86
|
+
default: number;
|
87
|
+
};
|
88
|
+
rotate: {
|
89
|
+
type: (NumberConstructor | StringConstructor)[];
|
90
|
+
default: number;
|
91
|
+
};
|
92
|
+
zIndex: (NumberConstructor | StringConstructor)[];
|
93
|
+
content: StringConstructor;
|
94
|
+
opacity: (NumberConstructor | StringConstructor)[];
|
95
|
+
fullPage: {
|
96
|
+
type: BooleanConstructor;
|
97
|
+
default: true;
|
98
|
+
};
|
99
|
+
textColor: {
|
100
|
+
type: import("vue").PropType<string>;
|
101
|
+
default: string;
|
102
|
+
};
|
103
|
+
}>>, {
|
104
|
+
width: number;
|
105
|
+
height: number;
|
106
|
+
textColor: string;
|
107
|
+
rotate: string | number;
|
108
|
+
gapX: number;
|
109
|
+
gapY: number;
|
110
|
+
fullPage: boolean;
|
111
|
+
}>;
|
112
|
+
export default _default;
|
@@ -0,0 +1,152 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __export = (target, all) => {
|
6
|
+
for (var name2 in all)
|
7
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
8
|
+
};
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
+
}
|
15
|
+
return to;
|
16
|
+
};
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
+
var stdin_exports = {};
|
19
|
+
__export(stdin_exports, {
|
20
|
+
default: () => stdin_default,
|
21
|
+
watermarkProps: () => watermarkProps
|
22
|
+
});
|
23
|
+
module.exports = __toCommonJS(stdin_exports);
|
24
|
+
var import_vue = require("vue");
|
25
|
+
var import_vue2 = require("vue");
|
26
|
+
var import_utils = require("../utils");
|
27
|
+
const [name, bem] = (0, import_utils.createNamespace)("watermark");
|
28
|
+
const watermarkProps = {
|
29
|
+
gapX: (0, import_utils.makeNumberProp)(0),
|
30
|
+
gapY: (0, import_utils.makeNumberProp)(0),
|
31
|
+
image: String,
|
32
|
+
width: (0, import_utils.makeNumberProp)(100),
|
33
|
+
height: (0, import_utils.makeNumberProp)(100),
|
34
|
+
rotate: (0, import_utils.makeNumericProp)(-22),
|
35
|
+
zIndex: import_utils.numericProp,
|
36
|
+
content: String,
|
37
|
+
opacity: import_utils.numericProp,
|
38
|
+
fullPage: import_utils.truthProp,
|
39
|
+
textColor: (0, import_utils.makeStringProp)("#dcdee0")
|
40
|
+
};
|
41
|
+
var stdin_default = (0, import_vue2.defineComponent)({
|
42
|
+
name,
|
43
|
+
props: watermarkProps,
|
44
|
+
setup(props, {
|
45
|
+
slots
|
46
|
+
}) {
|
47
|
+
const svgElRef = (0, import_vue2.ref)();
|
48
|
+
const watermarkUrl = (0, import_vue2.ref)("");
|
49
|
+
const imageBase64 = (0, import_vue2.ref)("");
|
50
|
+
const renderWatermark = () => {
|
51
|
+
const rotateStyle = {
|
52
|
+
transformOrigin: "center",
|
53
|
+
transform: `rotate(${props.rotate}deg)`
|
54
|
+
};
|
55
|
+
const svgInner = () => {
|
56
|
+
if (props.image && !slots.content) {
|
57
|
+
return (0, import_vue.createVNode)("image", {
|
58
|
+
"href": imageBase64.value,
|
59
|
+
"xlink:href": imageBase64.value,
|
60
|
+
"x": "0",
|
61
|
+
"y": "0",
|
62
|
+
"width": props.width,
|
63
|
+
"height": props.height,
|
64
|
+
"style": rotateStyle
|
65
|
+
}, null);
|
66
|
+
}
|
67
|
+
return (0, import_vue.createVNode)("foreignObject", {
|
68
|
+
"x": "0",
|
69
|
+
"y": "0",
|
70
|
+
"width": props.width,
|
71
|
+
"height": props.height
|
72
|
+
}, [(0, import_vue.createVNode)("div", {
|
73
|
+
"xmlns": "http://www.w3.org/1999/xhtml",
|
74
|
+
"style": rotateStyle
|
75
|
+
}, [slots.content ? slots.content() : (0, import_vue.createVNode)("span", {
|
76
|
+
"style": {
|
77
|
+
color: props.textColor
|
78
|
+
}
|
79
|
+
}, [props.content])])]);
|
80
|
+
};
|
81
|
+
const svgWidth = props.width + props.gapX;
|
82
|
+
const svgHeight = props.height + props.gapY;
|
83
|
+
return (0, import_vue.createVNode)("svg", {
|
84
|
+
"viewBox": `0 0 ${svgWidth} ${svgHeight}`,
|
85
|
+
"width": svgWidth,
|
86
|
+
"height": svgHeight,
|
87
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
88
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
89
|
+
"style": {
|
90
|
+
padding: `0 ${props.gapX}px ${props.gapY}px 0`,
|
91
|
+
opacity: props.opacity
|
92
|
+
}
|
93
|
+
}, [svgInner()]);
|
94
|
+
};
|
95
|
+
const makeImageToBase64 = (url) => {
|
96
|
+
const canvas = document.createElement("canvas");
|
97
|
+
const image = new Image();
|
98
|
+
image.crossOrigin = "anonymous";
|
99
|
+
image.referrerPolicy = "no-referrer";
|
100
|
+
image.onload = () => {
|
101
|
+
canvas.width = image.naturalWidth;
|
102
|
+
canvas.height = image.naturalHeight;
|
103
|
+
const ctx = canvas.getContext("2d");
|
104
|
+
ctx == null ? void 0 : ctx.drawImage(image, 0, 0);
|
105
|
+
imageBase64.value = canvas.toDataURL();
|
106
|
+
};
|
107
|
+
image.src = url;
|
108
|
+
};
|
109
|
+
const makeSvgToBlobUrl = (svgStr) => {
|
110
|
+
const svgBlob = new Blob([svgStr], {
|
111
|
+
type: "image/svg+xml"
|
112
|
+
});
|
113
|
+
return URL.createObjectURL(svgBlob);
|
114
|
+
};
|
115
|
+
(0, import_vue2.watchEffect)(() => {
|
116
|
+
if (props.image) {
|
117
|
+
makeImageToBase64(props.image);
|
118
|
+
}
|
119
|
+
});
|
120
|
+
(0, import_vue2.watch)(() => [imageBase64.value, props.content, props.textColor, props.height, props.width, props.rotate, props.gapX, props.gapY], () => {
|
121
|
+
(0, import_vue2.nextTick)(() => {
|
122
|
+
if (svgElRef.value) {
|
123
|
+
if (watermarkUrl.value) {
|
124
|
+
URL.revokeObjectURL(watermarkUrl.value);
|
125
|
+
}
|
126
|
+
watermarkUrl.value = makeSvgToBlobUrl(svgElRef.value.innerHTML);
|
127
|
+
}
|
128
|
+
});
|
129
|
+
}, {
|
130
|
+
immediate: true
|
131
|
+
});
|
132
|
+
(0, import_vue2.onUnmounted)(() => {
|
133
|
+
if (watermarkUrl.value) {
|
134
|
+
URL.revokeObjectURL(watermarkUrl.value);
|
135
|
+
}
|
136
|
+
});
|
137
|
+
return () => {
|
138
|
+
const style = (0, import_utils.extend)({
|
139
|
+
backgroundImage: `url(${watermarkUrl.value})`
|
140
|
+
}, (0, import_utils.getZIndexStyle)(props.zIndex));
|
141
|
+
return (0, import_vue.createVNode)("div", {
|
142
|
+
"class": bem({
|
143
|
+
full: props.fullPage
|
144
|
+
}),
|
145
|
+
"style": style
|
146
|
+
}, [(0, import_vue.createVNode)("div", {
|
147
|
+
"class": bem("wrapper"),
|
148
|
+
"ref": svgElRef
|
149
|
+
}, [renderWatermark()])]);
|
150
|
+
};
|
151
|
+
}
|
152
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
:root{--van-watermark-z-index: 100}.van-watermark{position:absolute;height:100%;width:100%;left:0;top:0;z-index:var(--van-watermark-z-index);background-repeat:repeat;pointer-events:none}.van-watermark__wrapper{display:none}.van-watermark--full{position:fixed}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
export declare const Watermark: import("../utils").WithInstall<import("vue").DefineComponent<{
|
2
|
+
gapX: {
|
3
|
+
type: NumberConstructor;
|
4
|
+
default: number;
|
5
|
+
};
|
6
|
+
gapY: {
|
7
|
+
type: NumberConstructor;
|
8
|
+
default: number;
|
9
|
+
};
|
10
|
+
image: StringConstructor;
|
11
|
+
width: {
|
12
|
+
type: NumberConstructor;
|
13
|
+
default: number;
|
14
|
+
};
|
15
|
+
height: {
|
16
|
+
type: NumberConstructor;
|
17
|
+
default: number;
|
18
|
+
};
|
19
|
+
rotate: {
|
20
|
+
type: (NumberConstructor | StringConstructor)[];
|
21
|
+
default: number;
|
22
|
+
};
|
23
|
+
zIndex: (NumberConstructor | StringConstructor)[];
|
24
|
+
content: StringConstructor;
|
25
|
+
opacity: (NumberConstructor | StringConstructor)[];
|
26
|
+
fullPage: {
|
27
|
+
type: BooleanConstructor;
|
28
|
+
default: true;
|
29
|
+
};
|
30
|
+
textColor: {
|
31
|
+
type: import("vue").PropType<string>;
|
32
|
+
default: string;
|
33
|
+
};
|
34
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
35
|
+
gapX: {
|
36
|
+
type: NumberConstructor;
|
37
|
+
default: number;
|
38
|
+
};
|
39
|
+
gapY: {
|
40
|
+
type: NumberConstructor;
|
41
|
+
default: number;
|
42
|
+
};
|
43
|
+
image: StringConstructor;
|
44
|
+
width: {
|
45
|
+
type: NumberConstructor;
|
46
|
+
default: number;
|
47
|
+
};
|
48
|
+
height: {
|
49
|
+
type: NumberConstructor;
|
50
|
+
default: number;
|
51
|
+
};
|
52
|
+
rotate: {
|
53
|
+
type: (NumberConstructor | StringConstructor)[];
|
54
|
+
default: number;
|
55
|
+
};
|
56
|
+
zIndex: (NumberConstructor | StringConstructor)[];
|
57
|
+
content: StringConstructor;
|
58
|
+
opacity: (NumberConstructor | StringConstructor)[];
|
59
|
+
fullPage: {
|
60
|
+
type: BooleanConstructor;
|
61
|
+
default: true;
|
62
|
+
};
|
63
|
+
textColor: {
|
64
|
+
type: import("vue").PropType<string>;
|
65
|
+
default: string;
|
66
|
+
};
|
67
|
+
}>>, {
|
68
|
+
width: number;
|
69
|
+
height: number;
|
70
|
+
textColor: string;
|
71
|
+
rotate: string | number;
|
72
|
+
gapX: number;
|
73
|
+
gapY: number;
|
74
|
+
fullPage: boolean;
|
75
|
+
}>>;
|
76
|
+
export default Watermark;
|
77
|
+
export { watermarkProps } from './Watermark';
|
78
|
+
export type { WatermarkProps } from './Watermark';
|
79
|
+
declare module 'vue' {
|
80
|
+
interface GlobalComponents {
|
81
|
+
VanWatermark: typeof Watermark;
|
82
|
+
}
|
83
|
+
}
|
@@ -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
|
+
Watermark: () => Watermark,
|
31
|
+
default: () => stdin_default,
|
32
|
+
watermarkProps: () => import_Watermark2.watermarkProps
|
33
|
+
});
|
34
|
+
module.exports = __toCommonJS(stdin_exports);
|
35
|
+
var import_utils = require("../utils");
|
36
|
+
var import_Watermark = __toESM(require("./Watermark"));
|
37
|
+
var import_Watermark2 = require("./Watermark");
|
38
|
+
const Watermark = (0, import_utils.withInstall)(import_Watermark.default);
|
39
|
+
var stdin_default = Watermark;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|