first commit

This commit is contained in:
2025-12-29 14:59:44 +08:00
commit 10c3fbb0d7
5315 changed files with 795443 additions and 0 deletions

76
node_modules/vant/es/signature/Signature.d.ts generated vendored Normal file
View File

@@ -0,0 +1,76 @@
import { type ExtractPropTypes } from 'vue';
export declare const signatureProps: {
tips: StringConstructor;
type: {
type: import("vue").PropType<string>;
default: string;
};
penColor: {
type: import("vue").PropType<string>;
default: string;
};
lineWidth: {
type: NumberConstructor;
default: number;
};
clearButtonText: StringConstructor;
backgroundColor: {
type: import("vue").PropType<string>;
default: string;
};
confirmButtonText: StringConstructor;
};
export type SignatureProps = ExtractPropTypes<typeof signatureProps>;
declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
tips: StringConstructor;
type: {
type: import("vue").PropType<string>;
default: string;
};
penColor: {
type: import("vue").PropType<string>;
default: string;
};
lineWidth: {
type: NumberConstructor;
default: number;
};
clearButtonText: StringConstructor;
backgroundColor: {
type: import("vue").PropType<string>;
default: string;
};
confirmButtonText: StringConstructor;
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("submit" | "clear" | "start" | "end" | "signing")[], "submit" | "clear" | "start" | "end" | "signing", import("vue").PublicProps, Readonly<ExtractPropTypes<{
tips: StringConstructor;
type: {
type: import("vue").PropType<string>;
default: string;
};
penColor: {
type: import("vue").PropType<string>;
default: string;
};
lineWidth: {
type: NumberConstructor;
default: number;
};
clearButtonText: StringConstructor;
backgroundColor: {
type: import("vue").PropType<string>;
default: string;
};
confirmButtonText: StringConstructor;
}>> & Readonly<{
onSubmit?: ((...args: any[]) => any) | undefined;
onClear?: ((...args: any[]) => any) | undefined;
onStart?: ((...args: any[]) => any) | undefined;
onEnd?: ((...args: any[]) => any) | undefined;
onSigning?: ((...args: any[]) => any) | undefined;
}>, {
type: string;
backgroundColor: string;
lineWidth: number;
penColor: string;
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
export default _default;

161
node_modules/vant/es/signature/Signature.mjs generated vendored Normal file
View File

@@ -0,0 +1,161 @@
import { computed, ref, onMounted, defineComponent, watch, createVNode as _createVNode } from "vue";
import { inBrowser, makeNumberProp, makeStringProp, createNamespace, preventDefault, windowWidth } from "../utils/index.mjs";
import { useRect } from "@vant/use";
import { useExpose } from "../composables/use-expose.mjs";
import { Button } from "../button/index.mjs";
const [name, bem, t] = createNamespace("signature");
const signatureProps = {
tips: String,
type: makeStringProp("png"),
penColor: makeStringProp("#000"),
lineWidth: makeNumberProp(3),
clearButtonText: String,
backgroundColor: makeStringProp(""),
confirmButtonText: String
};
const hasCanvasSupport = () => {
var _a;
const canvas = document.createElement("canvas");
return !!((_a = canvas.getContext) == null ? void 0 : _a.call(canvas, "2d"));
};
var stdin_default = defineComponent({
name,
props: signatureProps,
emits: ["submit", "clear", "start", "end", "signing"],
setup(props, {
emit,
slots
}) {
const canvasRef = ref();
const wrapRef = ref();
const ctx = computed(() => {
if (!canvasRef.value) return null;
return canvasRef.value.getContext("2d");
});
const isRenderCanvas = inBrowser ? hasCanvasSupport() : true;
let canvasWidth = 0;
let canvasHeight = 0;
let canvasRect;
const touchStart = () => {
if (!ctx.value) {
return false;
}
ctx.value.beginPath();
ctx.value.lineWidth = props.lineWidth;
ctx.value.strokeStyle = props.penColor;
canvasRect = useRect(canvasRef);
emit("start");
};
const touchMove = (event) => {
if (!ctx.value) {
return false;
}
preventDefault(event);
const touch = event.touches[0];
const mouseX = touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0);
const mouseY = touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0);
ctx.value.lineCap = "round";
ctx.value.lineJoin = "round";
ctx.value.lineTo(mouseX, mouseY);
ctx.value.stroke();
emit("signing", event);
};
const touchEnd = (event) => {
preventDefault(event);
emit("end");
};
const isCanvasEmpty = (canvas) => {
const empty = document.createElement("canvas");
empty.width = canvas.width;
empty.height = canvas.height;
if (props.backgroundColor) {
const emptyCtx = empty.getContext("2d");
setCanvasBgColor(emptyCtx);
}
return canvas.toDataURL() === empty.toDataURL();
};
const setCanvasBgColor = (ctx2) => {
if (ctx2 && props.backgroundColor) {
ctx2.fillStyle = props.backgroundColor;
ctx2.fillRect(0, 0, canvasWidth, canvasHeight);
}
};
const submit = () => {
var _a, _b;
const canvas = canvasRef.value;
if (!canvas) {
return;
}
const isEmpty = isCanvasEmpty(canvas);
const image = isEmpty ? "" : ((_b = (_a = {
jpg: () => canvas.toDataURL("image/jpeg", 0.8),
jpeg: () => canvas.toDataURL("image/jpeg", 0.8)
})[props.type]) == null ? void 0 : _b.call(_a)) || canvas.toDataURL(`image/${props.type}`);
emit("submit", {
image,
canvas
});
};
const clear = () => {
if (ctx.value) {
ctx.value.clearRect(0, 0, canvasWidth, canvasHeight);
ctx.value.closePath();
setCanvasBgColor(ctx.value);
}
emit("clear");
};
const initialize = () => {
var _a, _b, _c;
if (isRenderCanvas && canvasRef.value) {
const canvas = canvasRef.value;
const dpr = inBrowser ? window.devicePixelRatio : 1;
canvasWidth = canvas.width = (((_a = wrapRef.value) == null ? void 0 : _a.offsetWidth) || 0) * dpr;
canvasHeight = canvas.height = (((_b = wrapRef.value) == null ? void 0 : _b.offsetHeight) || 0) * dpr;
(_c = ctx.value) == null ? void 0 : _c.scale(dpr, dpr);
setCanvasBgColor(ctx.value);
}
};
const resize = () => {
if (ctx.value) {
const data = ctx.value.getImageData(0, 0, canvasWidth, canvasHeight);
initialize();
ctx.value.putImageData(data, 0, 0);
}
};
watch(windowWidth, resize);
onMounted(initialize);
useExpose({
resize,
clear,
submit
});
return () => _createVNode("div", {
"class": bem()
}, [_createVNode("div", {
"class": bem("content"),
"ref": wrapRef
}, [isRenderCanvas ? _createVNode("canvas", {
"ref": canvasRef,
"onTouchstartPassive": touchStart,
"onTouchmove": touchMove,
"onTouchend": touchEnd
}, null) : slots.tips ? slots.tips() : _createVNode("p", null, [props.tips])]), _createVNode("div", {
"class": bem("footer")
}, [_createVNode(Button, {
"size": "small",
"onClick": clear
}, {
default: () => [props.clearButtonText || t("clear")]
}), _createVNode(Button, {
"type": "primary",
"size": "small",
"onClick": submit
}, {
default: () => [props.confirmButtonText || t("confirm")]
})])]);
}
});
export {
stdin_default as default,
signatureProps
};

1
node_modules/vant/es/signature/index.css generated vendored Normal file
View File

@@ -0,0 +1 @@
:root,:host{--van-signature-padding: var(--van-padding-xs);--van-signature-content-height: 200px;--van-signature-content-background: var(--van-background-2);--van-signature-content-border: 1px dotted #dadada}.van-signature{padding:var(--van-signature-padding)}.van-signature__content{display:flex;justify-content:center;align-items:center;height:var(--van-signature-content-height);background-color:var(--van-signature-content-background);border:var(--van-signature-content-border);border-radius:var(--van-radius-lg);overflow:hidden}.van-signature__content canvas{width:100%;height:100%}.van-signature__footer{display:flex;justify-content:flex-end}.van-signature__footer .van-button{padding:0 var(--van-padding-md);margin-top:var(--van-padding-xs);margin-left:var(--van-padding-xs)}

60
node_modules/vant/es/signature/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,60 @@
export declare const Signature: import("../utils").WithInstall<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
tips: StringConstructor;
type: {
type: import("vue").PropType<string>;
default: string;
};
penColor: {
type: import("vue").PropType<string>;
default: string;
};
lineWidth: {
type: NumberConstructor;
default: number;
};
clearButtonText: StringConstructor;
backgroundColor: {
type: import("vue").PropType<string>;
default: string;
};
confirmButtonText: StringConstructor;
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("submit" | "clear" | "start" | "end" | "signing")[], "submit" | "clear" | "start" | "end" | "signing", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
tips: StringConstructor;
type: {
type: import("vue").PropType<string>;
default: string;
};
penColor: {
type: import("vue").PropType<string>;
default: string;
};
lineWidth: {
type: NumberConstructor;
default: number;
};
clearButtonText: StringConstructor;
backgroundColor: {
type: import("vue").PropType<string>;
default: string;
};
confirmButtonText: StringConstructor;
}>> & Readonly<{
onSubmit?: ((...args: any[]) => any) | undefined;
onClear?: ((...args: any[]) => any) | undefined;
onStart?: ((...args: any[]) => any) | undefined;
onEnd?: ((...args: any[]) => any) | undefined;
onSigning?: ((...args: any[]) => any) | undefined;
}>, {
type: string;
backgroundColor: string;
lineWidth: number;
penColor: string;
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
export default Signature;
export type { SignatureProps } from './Signature';
export type { SignatureInstance, SignatureThemeVars } from './types';
declare module 'vue' {
interface GlobalComponents {
Signature: typeof Signature;
}
}

8
node_modules/vant/es/signature/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import { withInstall } from "../utils/index.mjs";
import _Signature from "./Signature.mjs";
const Signature = withInstall(_Signature);
var stdin_default = Signature;
export {
Signature,
stdin_default as default
};

1
node_modules/vant/es/signature/style/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

6
node_modules/vant/es/signature/style/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import "../../style/base.css";
import "../../badge/index.css";
import "../../icon/index.css";
import "../../loading/index.css";
import "../../button/index.css";
import "../index.css";

14
node_modules/vant/es/signature/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import type { ComponentPublicInstance } from 'vue';
import type { SignatureProps } from './Signature';
export type SignatureExpose = {
resize: () => void;
clear: () => void;
submit: () => void;
};
export type SignatureInstance = ComponentPublicInstance<SignatureProps, SignatureExpose>;
export type SignatureThemeVars = {
signaturePadding?: string;
signatureContentHeight?: string;
signatureContentBackground?: string;
signatureContentBorder?: string;
};

0
node_modules/vant/es/signature/types.mjs generated vendored Normal file
View File