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;

16
node_modules/vant/es/composables/on-popup-reopen.mjs generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import { inject, watch } from "vue";
const POPUP_TOGGLE_KEY = Symbol();
function onPopupReopen(callback) {
const popupToggleStatus = inject(POPUP_TOGGLE_KEY, null);
if (popupToggleStatus) {
watch(popupToggleStatus, (show) => {
if (show) {
callback();
}
});
}
}
export {
POPUP_TOGGLE_KEY,
onPopupReopen
};

1
node_modules/vant/es/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;

11
node_modules/vant/es/composables/use-expose.mjs generated vendored Normal file
View File

@@ -0,0 +1,11 @@
import { getCurrentInstance } from "vue";
import { extend } from "../utils/index.mjs";
function useExpose(apis) {
const instance = getCurrentInstance();
if (instance) {
extend(instance.proxy, apis);
}
}
export {
useExpose
};

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,9 @@
let globalZIndex = 2e3;
const useGlobalZIndex = () => ++globalZIndex;
const setGlobalZIndex = (val) => {
globalZIndex = val;
};
export {
setGlobalZIndex,
useGlobalZIndex
};

2
node_modules/vant/es/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>;

24
node_modules/vant/es/composables/use-height.mjs generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import { useRect } from "@vant/use";
import { ref, onMounted, nextTick, watch } from "vue";
import { windowHeight, windowWidth } from "../utils/index.mjs";
import { onPopupReopen } from "./on-popup-reopen.mjs";
const useHeight = (element, withSafeArea) => {
const height = ref();
const setHeight = () => {
height.value = useRect(element).height;
};
onMounted(() => {
nextTick(setHeight);
if (withSafeArea) {
for (let i = 1; i <= 3; i++) {
setTimeout(setHeight, 100 * i);
}
}
});
onPopupReopen(() => nextTick(setHeight));
watch([windowWidth, windowHeight], setHeight);
return height;
};
export {
useHeight
};

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

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

13
node_modules/vant/es/composables/use-id.mjs generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import { getCurrentInstance } from "vue";
let current = 0;
function useId() {
const vm = getCurrentInstance();
const { name = "unknown" } = (vm == null ? void 0 : vm.type) || {};
if (process.env.NODE_ENV === "test") {
return name;
}
return `${name}-${++current}`;
}
export {
useId
};

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;

17
node_modules/vant/es/composables/use-lazy-render.mjs generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import { ref, watch } from "vue";
function useLazyRender(show) {
const inited = ref(false);
watch(
show,
(value) => {
if (value) {
inited.value = value;
}
},
{ immediate: true }
);
return (render) => () => inited.value ? render() : null;
}
export {
useLazyRender
};

View File

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

58
node_modules/vant/es/composables/use-lock-scroll.mjs generated vendored Normal file
View File

@@ -0,0 +1,58 @@
import { watch, onBeforeUnmount, onDeactivated } from "vue";
import { getScrollParent, onMountedOrActivated } from "@vant/use";
import { useTouch } from "./use-touch.mjs";
import { preventDefault } from "../utils/index.mjs";
let totalLockCount = 0;
const BODY_LOCK_CLASS = "van-overflow-hidden";
function useLockScroll(rootRef, shouldLock) {
const 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 = 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))) {
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();
onMountedOrActivated(init);
onDeactivated(destroy);
onBeforeUnmount(destroy);
watch(shouldLock, (value) => {
value ? lock() : unlock();
});
}
export {
useLockScroll
};

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;

14
node_modules/vant/es/composables/use-placeholder.mjs generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import { createVNode as _createVNode } from "vue";
import { useHeight } from "./use-height.mjs";
function usePlaceholder(contentRef, bem) {
const height = useHeight(contentRef, true);
return (renderContent) => _createVNode("div", {
"class": bem("placeholder"),
"style": {
height: height.value ? `${height.value}px` : void 0
}
}, [renderContent()]);
}
export {
usePlaceholder
};

2
node_modules/vant/es/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];

20
node_modules/vant/es/composables/use-refs.mjs generated vendored Normal file
View File

@@ -0,0 +1,20 @@
import { ref, onBeforeUpdate } from "vue";
function useRefs() {
const refs = ref([]);
const cache = [];
onBeforeUpdate(() => {
refs.value = [];
});
const setRefs = (index) => {
if (!cache[index]) {
cache[index] = (el) => {
refs.value[index] = el;
};
}
return cache[index];
};
return [refs, setRefs];
}
export {
useRefs
};

13
node_modules/vant/es/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;

29
node_modules/vant/es/composables/use-route.mjs generated vendored Normal file
View File

@@ -0,0 +1,29 @@
import {
getCurrentInstance
} from "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 = getCurrentInstance().proxy;
return () => route(vm);
}
export {
route,
routeProps,
useRoute
};

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

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

9
node_modules/vant/es/composables/use-scope-id.mjs generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import { getCurrentInstance } from "vue";
const useScopeId = () => {
var _a;
const { scopeId } = ((_a = getCurrentInstance()) == null ? void 0 : _a.vnode) || {};
return scopeId ? { [scopeId]: "" } : null;
};
export {
useScopeId
};

View File

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

18
node_modules/vant/es/composables/use-sync-prop-ref.mjs generated vendored Normal file
View File

@@ -0,0 +1,18 @@
import { ref, watch } from "vue";
const useSyncPropRef = (getProp, setProp) => {
const propRef = ref(getProp());
watch(getProp, (value) => {
if (value !== propRef.value) {
propRef.value = value;
}
});
watch(propRef, (value) => {
if (value !== getProp()) {
setProp(value);
}
});
return propRef;
};
export {
useSyncPropRef
};

6
node_modules/vant/es/composables/use-tab-status.d.ts generated vendored Normal file
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;

22
node_modules/vant/es/composables/use-tab-status.mjs generated vendored Normal file
View File

@@ -0,0 +1,22 @@
import { inject, provide, computed } from "vue";
const TAB_STATUS_KEY = Symbol();
const ALL_TAB_STATUS_KEY = Symbol();
const useTabStatus = () => inject(TAB_STATUS_KEY, null);
const useAllTabStatus = () => inject(ALL_TAB_STATUS_KEY, null);
const useProvideTabStatus = (status) => {
const allTabStatus = useAllTabStatus();
provide(TAB_STATUS_KEY, status);
provide(
ALL_TAB_STATUS_KEY,
computed(() => {
return (allTabStatus == null || allTabStatus.value) && status.value;
})
);
};
export {
ALL_TAB_STATUS_KEY,
TAB_STATUS_KEY,
useAllTabStatus,
useProvideTabStatus,
useTabStatus
};

17
node_modules/vant/es/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 {};

68
node_modules/vant/es/composables/use-touch.mjs generated vendored Normal file
View File

@@ -0,0 +1,68 @@
import { ref } from "vue";
import { TAP_OFFSET } from "../utils/index.mjs";
function getDirection(x, y) {
if (x > y) {
return "horizontal";
}
if (y > x) {
return "vertical";
}
return "";
}
function useTouch() {
const startX = ref(0);
const startY = ref(0);
const deltaX = ref(0);
const deltaY = ref(0);
const offsetX = ref(0);
const offsetY = ref(0);
const direction = ref("");
const isTap = 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 > TAP_OFFSET || offsetY.value > TAP_OFFSET)) {
isTap.value = false;
}
};
return {
move,
start,
reset,
startX,
startY,
deltaX,
deltaY,
offsetX,
offsetY,
direction,
isVertical,
isHorizontal,
isTap
};
}
export {
useTouch
};

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,30 @@
import { inBrowser } from "../utils/index.mjs";
import { onDeactivated, onBeforeUnmount } from "vue";
import { onMountedOrActivated } from "@vant/use";
function useVisibilityChange(target, onChange) {
if (!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);
}
};
onDeactivated(unobserve);
onBeforeUnmount(unobserve);
onMountedOrActivated(observe);
}
export {
useVisibilityChange
};