vant 4.1.1 → 4.2.0
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/field/Field.mjs +11 -5
- package/es/field/index.css +1 -1
- package/es/image-preview/ImagePreviewItem.mjs +1 -1
- package/es/index.d.ts +2 -1
- package/es/index.mjs +5 -2
- package/es/locale/lang/km-KH.d.ts +62 -0
- package/es/locale/lang/km-KH.mjs +64 -0
- package/es/share-sheet/ShareSheet.mjs +11 -10
- package/es/swipe/Swipe.mjs +1 -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 +131 -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/field/Field.js +11 -5
- package/lib/field/index.css +1 -1
- package/lib/image-preview/ImagePreviewItem.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +5 -2
- package/lib/locale/lang/km-KH.d.ts +62 -0
- package/lib/locale/lang/km-KH.js +83 -0
- package/lib/share-sheet/ShareSheet.js +11 -10
- package/lib/swipe/Swipe.js +1 -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 +1035 -899
- package/lib/vant.es.js +1036 -900
- package/lib/vant.js +1035 -899
- package/lib/vant.min.js +1 -1
- package/lib/watermark/Watermark.d.ts +112 -0
- package/lib/watermark/Watermark.js +150 -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 +7 -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,150 @@
|
|
|
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
|
+
"x": "0",
|
|
60
|
+
"y": "0",
|
|
61
|
+
"width": props.width,
|
|
62
|
+
"height": props.height,
|
|
63
|
+
"style": rotateStyle
|
|
64
|
+
}, null);
|
|
65
|
+
}
|
|
66
|
+
return (0, import_vue.createVNode)("foreignObject", {
|
|
67
|
+
"x": "0",
|
|
68
|
+
"y": "0",
|
|
69
|
+
"width": props.width,
|
|
70
|
+
"height": props.height
|
|
71
|
+
}, [(0, import_vue.createVNode)("div", {
|
|
72
|
+
"xmlns": "http://www.w3.org/1999/xhtml",
|
|
73
|
+
"style": rotateStyle
|
|
74
|
+
}, [slots.content ? slots.content() : (0, import_vue.createVNode)("span", {
|
|
75
|
+
"style": {
|
|
76
|
+
color: props.textColor
|
|
77
|
+
}
|
|
78
|
+
}, [props.content])])]);
|
|
79
|
+
};
|
|
80
|
+
const svgWidth = props.width + props.gapX;
|
|
81
|
+
const svgHeight = props.height + props.gapY;
|
|
82
|
+
return (0, import_vue.createVNode)("svg", {
|
|
83
|
+
"viewBox": `0 0 ${svgWidth} ${svgHeight}`,
|
|
84
|
+
"width": svgWidth,
|
|
85
|
+
"height": svgHeight,
|
|
86
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
87
|
+
"style": {
|
|
88
|
+
padding: `0 ${props.gapX}px ${props.gapY}px 0`,
|
|
89
|
+
opacity: props.opacity
|
|
90
|
+
}
|
|
91
|
+
}, [svgInner()]);
|
|
92
|
+
};
|
|
93
|
+
const makeImageToBase64 = (url) => {
|
|
94
|
+
const canvas = document.createElement("canvas");
|
|
95
|
+
const image = new Image();
|
|
96
|
+
image.crossOrigin = "anonymous";
|
|
97
|
+
image.referrerPolicy = "no-referrer";
|
|
98
|
+
image.onload = () => {
|
|
99
|
+
canvas.width = image.naturalWidth;
|
|
100
|
+
canvas.height = image.naturalHeight;
|
|
101
|
+
const ctx = canvas.getContext("2d");
|
|
102
|
+
ctx == null ? void 0 : ctx.drawImage(image, 0, 0);
|
|
103
|
+
imageBase64.value = canvas.toDataURL();
|
|
104
|
+
};
|
|
105
|
+
image.src = url;
|
|
106
|
+
};
|
|
107
|
+
const makeSvgToBlobUrl = (svgStr) => {
|
|
108
|
+
const svgBlob = new Blob([svgStr], {
|
|
109
|
+
type: "image/svg+xml;charset=utf-8"
|
|
110
|
+
});
|
|
111
|
+
return URL.createObjectURL(svgBlob);
|
|
112
|
+
};
|
|
113
|
+
(0, import_vue2.watchEffect)(() => {
|
|
114
|
+
if (props.image) {
|
|
115
|
+
makeImageToBase64(props.image);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
(0, import_vue2.watch)(() => [imageBase64.value, props.content, props.textColor, props.height, props.width, props.rotate, props.gapX, props.gapY], () => {
|
|
119
|
+
(0, import_vue2.nextTick)(() => {
|
|
120
|
+
if (svgElRef.value) {
|
|
121
|
+
if (watermarkUrl.value) {
|
|
122
|
+
URL.revokeObjectURL(watermarkUrl.value);
|
|
123
|
+
}
|
|
124
|
+
watermarkUrl.value = makeSvgToBlobUrl(svgElRef.value.innerHTML);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}, {
|
|
128
|
+
immediate: true
|
|
129
|
+
});
|
|
130
|
+
(0, import_vue2.onUnmounted)(() => {
|
|
131
|
+
if (watermarkUrl.value) {
|
|
132
|
+
URL.revokeObjectURL(watermarkUrl.value);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
return () => {
|
|
136
|
+
const style = (0, import_utils.extend)({
|
|
137
|
+
backgroundImage: `url(${watermarkUrl.value})`
|
|
138
|
+
}, (0, import_utils.getZIndexStyle)(props.zIndex));
|
|
139
|
+
return (0, import_vue.createVNode)("div", {
|
|
140
|
+
"class": bem({
|
|
141
|
+
full: props.fullPage
|
|
142
|
+
}),
|
|
143
|
+
"style": style
|
|
144
|
+
}, [(0, import_vue.createVNode)("div", {
|
|
145
|
+
"class": bem("wrapper"),
|
|
146
|
+
"ref": svgElRef
|
|
147
|
+
}, [renderWatermark()])]);
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
});
|
|
@@ -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 {};
|