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

View File

@@ -0,0 +1,3 @@
import { InjectionKey } from 'vue';
export declare const POPUP_TOGGLE_KEY: InjectionKey<() => boolean>;
export declare function onPopupReopen(callback: () => void): void;

35
node_modules/vant/lib/composables/on-popup-reopen.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
POPUP_TOGGLE_KEY: () => POPUP_TOGGLE_KEY,
onPopupReopen: () => onPopupReopen
});
module.exports = __toCommonJS(stdin_exports);
var import_vue = require("vue");
const POPUP_TOGGLE_KEY = Symbol();
function onPopupReopen(callback) {
const popupToggleStatus = (0, import_vue.inject)(POPUP_TOGGLE_KEY, null);
if (popupToggleStatus) {
(0, import_vue.watch)(popupToggleStatus, (show) => {
if (show) {
callback();
}
});
}
}

1
node_modules/vant/lib/composables/use-expose.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export declare function useExpose<T = Record<string, any>>(apis: T): void;

30
node_modules/vant/lib/composables/use-expose.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
useExpose: () => useExpose
});
module.exports = __toCommonJS(stdin_exports);
var import_vue = require("vue");
var import_utils = require("../utils");
function useExpose(apis) {
const instance = (0, import_vue.getCurrentInstance)();
if (instance) {
(0, import_utils.extend)(instance.proxy, apis);
}
}

View File

@@ -0,0 +1,4 @@
/** the global z-index is automatically incremented after reading */
export declare const useGlobalZIndex: () => number;
/** reset the global z-index */
export declare const setGlobalZIndex: (val: number) => void;

View File

@@ -0,0 +1,28 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
setGlobalZIndex: () => setGlobalZIndex,
useGlobalZIndex: () => useGlobalZIndex
});
module.exports = __toCommonJS(stdin_exports);
let globalZIndex = 2e3;
const useGlobalZIndex = () => ++globalZIndex;
const setGlobalZIndex = (val) => {
globalZIndex = val;
};

2
node_modules/vant/lib/composables/use-height.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Ref } from 'vue';
export declare const useHeight: (element: Element | Ref<Element | undefined>, withSafeArea?: boolean) => Ref<number | undefined, number | undefined>;

43
node_modules/vant/lib/composables/use-height.js generated vendored Normal file
View File

@@ -0,0 +1,43 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
useHeight: () => useHeight
});
module.exports = __toCommonJS(stdin_exports);
var import_use = require("@vant/use");
var import_vue = require("vue");
var import_utils = require("../utils");
var import_on_popup_reopen = require("./on-popup-reopen");
const useHeight = (element, withSafeArea) => {
const height = (0, import_vue.ref)();
const setHeight = () => {
height.value = (0, import_use.useRect)(element).height;
};
(0, import_vue.onMounted)(() => {
(0, import_vue.nextTick)(setHeight);
if (withSafeArea) {
for (let i = 1; i <= 3; i++) {
setTimeout(setHeight, 100 * i);
}
}
});
(0, import_on_popup_reopen.onPopupReopen)(() => (0, import_vue.nextTick)(setHeight));
(0, import_vue.watch)([import_utils.windowWidth, import_utils.windowHeight], setHeight);
return height;
};

1
node_modules/vant/lib/composables/use-id.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export declare function useId(): string;

32
node_modules/vant/lib/composables/use-id.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
useId: () => useId
});
module.exports = __toCommonJS(stdin_exports);
var import_vue = require("vue");
let current = 0;
function useId() {
const vm = (0, import_vue.getCurrentInstance)();
const { name = "unknown" } = (vm == null ? void 0 : vm.type) || {};
if (process.env.NODE_ENV === "test") {
return name;
}
return `${name}-${++current}`;
}

View File

@@ -0,0 +1,2 @@
import { WatchSource } from 'vue';
export declare function useLazyRender(show: WatchSource<boolean | undefined>): (render: () => JSX.Element | undefined) => () => JSX.Element | null | undefined;

36
node_modules/vant/lib/composables/use-lazy-render.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
useLazyRender: () => useLazyRender
});
module.exports = __toCommonJS(stdin_exports);
var import_vue = require("vue");
function useLazyRender(show) {
const inited = (0, import_vue.ref)(false);
(0, import_vue.watch)(
show,
(value) => {
if (value) {
inited.value = value;
}
},
{ immediate: true }
);
return (render) => () => inited.value ? render() : null;
}

View File

@@ -0,0 +1,2 @@
import { Ref } from 'vue';
export declare function useLockScroll(rootRef: Ref<HTMLElement | undefined>, shouldLock: () => boolean): void;

77
node_modules/vant/lib/composables/use-lock-scroll.js generated vendored Normal file
View File

@@ -0,0 +1,77 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
useLockScroll: () => useLockScroll
});
module.exports = __toCommonJS(stdin_exports);
var import_vue = require("vue");
var import_use = require("@vant/use");
var import_use_touch = require("./use-touch");
var import_utils = require("../utils");
let totalLockCount = 0;
const BODY_LOCK_CLASS = "van-overflow-hidden";
function useLockScroll(rootRef, shouldLock) {
const touch = (0, import_use_touch.useTouch)();
const DIRECTION_UP = "01";
const DIRECTION_DOWN = "10";
const onTouchMove = (event) => {
touch.move(event);
const direction = touch.deltaY.value > 0 ? DIRECTION_DOWN : DIRECTION_UP;
const el = (0, import_use.getScrollParent)(
event.target,
rootRef.value
);
const { scrollHeight, offsetHeight, scrollTop } = el;
let status = "11";
if (scrollTop === 0) {
status = offsetHeight >= scrollHeight ? "00" : "01";
} else if (scrollTop + offsetHeight >= scrollHeight) {
status = "10";
}
if (status !== "11" && touch.isVertical() && !(parseInt(status, 2) & parseInt(direction, 2))) {
(0, import_utils.preventDefault)(event, true);
}
};
const lock = () => {
document.addEventListener("touchstart", touch.start);
document.addEventListener("touchmove", onTouchMove, { passive: false });
if (!totalLockCount) {
document.body.classList.add(BODY_LOCK_CLASS);
}
totalLockCount++;
};
const unlock = () => {
if (totalLockCount) {
document.removeEventListener("touchstart", touch.start);
document.removeEventListener("touchmove", onTouchMove);
totalLockCount--;
if (!totalLockCount) {
document.body.classList.remove(BODY_LOCK_CLASS);
}
}
};
const init = () => shouldLock() && lock();
const destroy = () => shouldLock() && unlock();
(0, import_use.onMountedOrActivated)(init);
(0, import_vue.onDeactivated)(destroy);
(0, import_vue.onBeforeUnmount)(destroy);
(0, import_vue.watch)(shouldLock, (value) => {
value ? lock() : unlock();
});
}

View File

@@ -0,0 +1,3 @@
import { Ref } from 'vue';
import type { BEM } from '../utils/create';
export declare function usePlaceholder(contentRef: Ref<Element | undefined>, bem: BEM): (renderContent: () => JSX.Element) => import("vue/jsx-runtime").JSX.Element;

33
node_modules/vant/lib/composables/use-placeholder.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
usePlaceholder: () => usePlaceholder
});
module.exports = __toCommonJS(stdin_exports);
var import_vue = require("vue");
var import_use_height = require("./use-height");
function usePlaceholder(contentRef, bem) {
const height = (0, import_use_height.useHeight)(contentRef, true);
return (renderContent) => (0, import_vue.createVNode)("div", {
"class": bem("placeholder"),
"style": {
height: height.value ? `${height.value}px` : void 0
}
}, [renderContent()]);
}

2
node_modules/vant/lib/composables/use-refs.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Ref } from 'vue';
export declare function useRefs<T = Element>(): readonly [Ref<T[], T[]>, (index: number) => (el: unknown) => void];

39
node_modules/vant/lib/composables/use-refs.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
useRefs: () => useRefs
});
module.exports = __toCommonJS(stdin_exports);
var import_vue = require("vue");
function useRefs() {
const refs = (0, import_vue.ref)([]);
const cache = [];
(0, import_vue.onBeforeUpdate)(() => {
refs.value = [];
});
const setRefs = (index) => {
if (!cache[index]) {
cache[index] = (el) => {
refs.value[index] = el;
};
}
return cache[index];
};
return [refs, setRefs];
}

13
node_modules/vant/lib/composables/use-route.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
/**
* Vue Router support
*/
import { type PropType, type ExtractPropTypes, type ComponentPublicInstance } from 'vue';
import type { RouteLocationRaw } from 'vue-router';
export declare const routeProps: {
to: PropType<RouteLocationRaw>;
url: StringConstructor;
replace: BooleanConstructor;
};
export type RouteProps = ExtractPropTypes<typeof routeProps>;
export declare function route({ to, url, replace, $router: router, }: ComponentPublicInstance<RouteProps>): void;
export declare function useRoute(): () => void;

46
node_modules/vant/lib/composables/use-route.js generated vendored Normal file
View File

@@ -0,0 +1,46 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
route: () => route,
routeProps: () => routeProps,
useRoute: () => useRoute
});
module.exports = __toCommonJS(stdin_exports);
var import_vue = require("vue");
const routeProps = {
to: [String, Object],
url: String,
replace: Boolean
};
function route({
to,
url,
replace,
$router: router
}) {
if (to && router) {
router[replace ? "replace" : "push"](to);
} else if (url) {
replace ? location.replace(url) : location.href = url;
}
}
function useRoute() {
const vm = (0, import_vue.getCurrentInstance)().proxy;
return () => route(vm);
}

3
node_modules/vant/lib/composables/use-scope-id.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export declare const useScopeId: () => {
[x: string]: string;
} | null;

28
node_modules/vant/lib/composables/use-scope-id.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
useScopeId: () => useScopeId
});
module.exports = __toCommonJS(stdin_exports);
var import_vue = require("vue");
const useScopeId = () => {
var _a;
const { scopeId } = ((_a = (0, import_vue.getCurrentInstance)()) == null ? void 0 : _a.vnode) || {};
return scopeId ? { [scopeId]: "" } : null;
};

View File

@@ -0,0 +1,2 @@
import { Ref } from 'vue';
export declare const useSyncPropRef: <T>(getProp: () => T, setProp: (value: T) => void) => Ref<T, T>;

37
node_modules/vant/lib/composables/use-sync-prop-ref.js generated vendored Normal file
View File

@@ -0,0 +1,37 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
useSyncPropRef: () => useSyncPropRef
});
module.exports = __toCommonJS(stdin_exports);
var import_vue = require("vue");
const useSyncPropRef = (getProp, setProp) => {
const propRef = (0, import_vue.ref)(getProp());
(0, import_vue.watch)(getProp, (value) => {
if (value !== propRef.value) {
propRef.value = value;
}
});
(0, import_vue.watch)(propRef, (value) => {
if (value !== getProp()) {
setProp(value);
}
});
return propRef;
};

View File

@@ -0,0 +1,6 @@
import { ComputedRef, InjectionKey } from 'vue';
export declare const TAB_STATUS_KEY: InjectionKey<ComputedRef<boolean>>;
export declare const ALL_TAB_STATUS_KEY: InjectionKey<ComputedRef<boolean>>;
export declare const useTabStatus: () => ComputedRef<boolean> | null;
export declare const useAllTabStatus: () => ComputedRef<boolean> | null;
export declare const useProvideTabStatus: (status: ComputedRef<boolean>) => void;

41
node_modules/vant/lib/composables/use-tab-status.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
ALL_TAB_STATUS_KEY: () => ALL_TAB_STATUS_KEY,
TAB_STATUS_KEY: () => TAB_STATUS_KEY,
useAllTabStatus: () => useAllTabStatus,
useProvideTabStatus: () => useProvideTabStatus,
useTabStatus: () => useTabStatus
});
module.exports = __toCommonJS(stdin_exports);
var import_vue = require("vue");
const TAB_STATUS_KEY = Symbol();
const ALL_TAB_STATUS_KEY = Symbol();
const useTabStatus = () => (0, import_vue.inject)(TAB_STATUS_KEY, null);
const useAllTabStatus = () => (0, import_vue.inject)(ALL_TAB_STATUS_KEY, null);
const useProvideTabStatus = (status) => {
const allTabStatus = useAllTabStatus();
(0, import_vue.provide)(TAB_STATUS_KEY, status);
(0, import_vue.provide)(
ALL_TAB_STATUS_KEY,
(0, import_vue.computed)(() => {
return (allTabStatus == null || allTabStatus.value) && status.value;
})
);
};

17
node_modules/vant/lib/composables/use-touch.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
type Direction = '' | 'vertical' | 'horizontal';
export declare function useTouch(): {
move: EventListener;
start: EventListener;
reset: () => void;
startX: import("vue").Ref<number, number>;
startY: import("vue").Ref<number, number>;
deltaX: import("vue").Ref<number, number>;
deltaY: import("vue").Ref<number, number>;
offsetX: import("vue").Ref<number, number>;
offsetY: import("vue").Ref<number, number>;
direction: import("vue").Ref<Direction, Direction>;
isVertical: () => boolean;
isHorizontal: () => boolean;
isTap: import("vue").Ref<boolean, boolean>;
};
export {};

87
node_modules/vant/lib/composables/use-touch.js generated vendored Normal file
View File

@@ -0,0 +1,87 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
useTouch: () => useTouch
});
module.exports = __toCommonJS(stdin_exports);
var import_vue = require("vue");
var import_utils = require("../utils");
function getDirection(x, y) {
if (x > y) {
return "horizontal";
}
if (y > x) {
return "vertical";
}
return "";
}
function useTouch() {
const startX = (0, import_vue.ref)(0);
const startY = (0, import_vue.ref)(0);
const deltaX = (0, import_vue.ref)(0);
const deltaY = (0, import_vue.ref)(0);
const offsetX = (0, import_vue.ref)(0);
const offsetY = (0, import_vue.ref)(0);
const direction = (0, import_vue.ref)("");
const isTap = (0, import_vue.ref)(true);
const isVertical = () => direction.value === "vertical";
const isHorizontal = () => direction.value === "horizontal";
const reset = () => {
deltaX.value = 0;
deltaY.value = 0;
offsetX.value = 0;
offsetY.value = 0;
direction.value = "";
isTap.value = true;
};
const start = (event) => {
reset();
startX.value = event.touches[0].clientX;
startY.value = event.touches[0].clientY;
};
const move = (event) => {
const touch = event.touches[0];
deltaX.value = (touch.clientX < 0 ? 0 : touch.clientX) - startX.value;
deltaY.value = touch.clientY - startY.value;
offsetX.value = Math.abs(deltaX.value);
offsetY.value = Math.abs(deltaY.value);
const LOCK_DIRECTION_DISTANCE = 10;
if (!direction.value || offsetX.value < LOCK_DIRECTION_DISTANCE && offsetY.value < LOCK_DIRECTION_DISTANCE) {
direction.value = getDirection(offsetX.value, offsetY.value);
}
if (isTap.value && (offsetX.value > import_utils.TAP_OFFSET || offsetY.value > import_utils.TAP_OFFSET)) {
isTap.value = false;
}
};
return {
move,
start,
reset,
startX,
startY,
deltaX,
deltaY,
offsetX,
offsetY,
direction,
isVertical,
isHorizontal,
isTap
};
}

View File

@@ -0,0 +1,2 @@
import { Ref } from 'vue';
export declare function useVisibilityChange(target: Ref<Element | undefined>, onChange: (visible: boolean) => void): void;

View File

@@ -0,0 +1,49 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
useVisibilityChange: () => useVisibilityChange
});
module.exports = __toCommonJS(stdin_exports);
var import_utils = require("../utils");
var import_vue = require("vue");
var import_use = require("@vant/use");
function useVisibilityChange(target, onChange) {
if (!import_utils.inBrowser || !window.IntersectionObserver) {
return;
}
const observer = new IntersectionObserver(
(entries) => {
onChange(entries[0].intersectionRatio > 0);
},
{ root: document.body }
);
const observe = () => {
if (target.value) {
observer.observe(target.value);
}
};
const unobserve = () => {
if (target.value) {
observer.unobserve(target.value);
}
};
(0, import_vue.onDeactivated)(unobserve);
(0, import_vue.onBeforeUnmount)(unobserve);
(0, import_use.onMountedOrActivated)(observe);
}