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,62 @@
import { PropType, TeleportProps, type ExtractPropTypes } from 'vue';
import { FloatingBubbleAxis, FloatingBubbleMagnetic, FloatingBubbleOffset, FloatingBubbleGap } from './types';
export declare const floatingBubbleProps: {
gap: {
type: PropType<FloatingBubbleGap>;
default: number;
};
icon: StringConstructor;
axis: {
type: PropType<FloatingBubbleAxis>;
default: FloatingBubbleAxis;
};
magnetic: PropType<FloatingBubbleMagnetic>;
offset: PropType<FloatingBubbleOffset>;
teleport: {
type: PropType<TeleportProps["to"]>;
default: string;
};
};
export type FloatingBubbleProps = ExtractPropTypes<typeof floatingBubbleProps>;
declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
gap: {
type: PropType<FloatingBubbleGap>;
default: number;
};
icon: StringConstructor;
axis: {
type: PropType<FloatingBubbleAxis>;
default: FloatingBubbleAxis;
};
magnetic: PropType<FloatingBubbleMagnetic>;
offset: PropType<FloatingBubbleOffset>;
teleport: {
type: PropType<TeleportProps["to"]>;
default: string;
};
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "update:offset" | "offsetChange")[], "click" | "update:offset" | "offsetChange", import("vue").PublicProps, Readonly<ExtractPropTypes<{
gap: {
type: PropType<FloatingBubbleGap>;
default: number;
};
icon: StringConstructor;
axis: {
type: PropType<FloatingBubbleAxis>;
default: FloatingBubbleAxis;
};
magnetic: PropType<FloatingBubbleMagnetic>;
offset: PropType<FloatingBubbleOffset>;
teleport: {
type: PropType<TeleportProps["to"]>;
default: string;
};
}>> & Readonly<{
onClick?: ((...args: any[]) => any) | undefined;
"onUpdate:offset"?: ((...args: any[]) => any) | undefined;
onOffsetChange?: ((...args: any[]) => any) | undefined;
}>, {
teleport: string | import("vue").RendererElement | null | undefined;
gap: FloatingBubbleGap;
axis: FloatingBubbleAxis;
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
export default _default;

202
node_modules/vant/lib/floating-bubble/FloatingBubble.js generated vendored Normal file
View File

@@ -0,0 +1,202 @@
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name2 in all)
__defProp(target, name2, { get: all[name2], 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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
default: () => stdin_default,
floatingBubbleProps: () => floatingBubbleProps
});
module.exports = __toCommonJS(stdin_exports);
var import_vue = require("vue");
var import_utils = require("../utils");
var import_use = require("@vant/use");
var import_use_touch = require("../composables/use-touch");
var import_icon = __toESM(require("../icon"));
const floatingBubbleProps = {
gap: {
type: [Number, Object],
default: 24
},
icon: String,
axis: (0, import_utils.makeStringProp)("y"),
magnetic: String,
offset: Object,
teleport: {
type: [String, Object],
default: "body"
}
};
const [name, bem] = (0, import_utils.createNamespace)("floating-bubble");
var stdin_default = (0, import_vue.defineComponent)({
name,
inheritAttrs: false,
props: floatingBubbleProps,
emits: ["click", "update:offset", "offsetChange"],
setup(props, {
slots,
emit,
attrs
}) {
const rootRef = (0, import_vue.ref)();
const state = (0, import_vue.ref)({
x: 0,
y: 0,
width: 0,
height: 0
});
const gapX = (0, import_vue.computed)(() => (0, import_utils.isObject)(props.gap) ? props.gap.x : props.gap);
const gapY = (0, import_vue.computed)(() => (0, import_utils.isObject)(props.gap) ? props.gap.y : props.gap);
const boundary = (0, import_vue.computed)(() => ({
top: gapY.value,
right: import_utils.windowWidth.value - state.value.width - gapX.value,
bottom: import_utils.windowHeight.value - state.value.height - gapY.value,
left: gapX.value
}));
const dragging = (0, import_vue.ref)(false);
let initialized = false;
const rootStyle = (0, import_vue.computed)(() => {
const style = {};
const x = (0, import_utils.addUnit)(state.value.x);
const y = (0, import_utils.addUnit)(state.value.y);
style.transform = `translate3d(${x}, ${y}, 0)`;
if (dragging.value || !initialized) {
style.transition = "none";
}
return style;
});
const updateState = () => {
if (!show.value) return;
const {
width,
height
} = (0, import_use.useRect)(rootRef.value);
const {
offset
} = props;
state.value = {
x: offset ? offset.x : import_utils.windowWidth.value - width - gapX.value,
y: offset ? offset.y : import_utils.windowHeight.value - height - gapY.value,
width,
height
};
};
const touch = (0, import_use_touch.useTouch)();
let prevX = 0;
let prevY = 0;
const onTouchStart = (e) => {
touch.start(e);
dragging.value = true;
prevX = state.value.x;
prevY = state.value.y;
};
const onTouchMove = (e) => {
e.preventDefault();
touch.move(e);
if (props.axis === "lock") return;
if (!touch.isTap.value) {
if (props.axis === "x" || props.axis === "xy") {
let nextX = prevX + touch.deltaX.value;
if (nextX < boundary.value.left) nextX = boundary.value.left;
if (nextX > boundary.value.right) nextX = boundary.value.right;
state.value.x = nextX;
}
if (props.axis === "y" || props.axis === "xy") {
let nextY = prevY + touch.deltaY.value;
if (nextY < boundary.value.top) nextY = boundary.value.top;
if (nextY > boundary.value.bottom) nextY = boundary.value.bottom;
state.value.y = nextY;
}
const offset = (0, import_utils.pick)(state.value, ["x", "y"]);
emit("update:offset", offset);
}
};
(0, import_use.useEventListener)("touchmove", onTouchMove, {
target: rootRef
});
const onTouchEnd = () => {
dragging.value = false;
(0, import_vue.nextTick)(() => {
if (props.magnetic === "x") {
const nextX = (0, import_utils.closest)([boundary.value.left, boundary.value.right], state.value.x);
state.value.x = nextX;
}
if (props.magnetic === "y") {
const nextY = (0, import_utils.closest)([boundary.value.top, boundary.value.bottom], state.value.y);
state.value.y = nextY;
}
if (!touch.isTap.value) {
const offset = (0, import_utils.pick)(state.value, ["x", "y"]);
emit("update:offset", offset);
if (prevX !== offset.x || prevY !== offset.y) {
emit("offsetChange", offset);
}
}
});
};
const onClick = (e) => {
if (touch.isTap.value) emit("click", e);
else e.stopPropagation();
};
(0, import_vue.onMounted)(() => {
updateState();
(0, import_vue.nextTick)(() => {
initialized = true;
});
});
(0, import_vue.watch)([import_utils.windowWidth, import_utils.windowHeight, gapX, gapY, () => props.offset], updateState, {
deep: true
});
const show = (0, import_vue.ref)(true);
(0, import_vue.onActivated)(() => {
show.value = true;
});
(0, import_vue.onDeactivated)(() => {
if (props.teleport) {
show.value = false;
}
});
return () => {
const Content = (0, import_vue.withDirectives)((0, import_vue.createVNode)("div", (0, import_vue.mergeProps)({
"class": bem(),
"ref": rootRef,
"onTouchstartPassive": onTouchStart,
"onTouchend": onTouchEnd,
"onTouchcancel": onTouchEnd,
"onClickCapture": onClick,
"style": rootStyle.value
}, attrs), [slots.default ? slots.default() : (0, import_vue.createVNode)(import_icon.default, {
"name": props.icon,
"class": bem("icon")
}, null)]), [[import_vue.vShow, show.value]]);
return props.teleport ? (0, import_vue.createVNode)(import_vue.Teleport, {
"to": props.teleport
}, {
default: () => [Content]
}) : Content;
};
}
});

1
node_modules/vant/lib/floating-bubble/index.css generated vendored Normal file
View File

@@ -0,0 +1 @@
:root,:host{--van-floating-bubble-size: 48px;--van-floating-bubble-initial-gap: 24px;--van-floating-bubble-icon-size: 28px;--van-floating-bubble-background: var(--van-primary-color);--van-floating-bubble-color: var(--van-background-2);--van-floating-bubble-z-index: 999;--van-floating-bubble-border-radius: var(--van-radius-max)}.van-floating-bubble{position:fixed;left:0;top:0;right:var(--van-floating-bubble-initial-gap);bottom:var(--van-floating-bubble-initial-gap);width:var(--van-floating-bubble-size);height:var(--van-floating-bubble-size);box-sizing:border-box;display:flex;justify-content:center;align-items:center;overflow:hidden;cursor:pointer;-webkit-user-select:none;user-select:none;touch-action:none;background:var(--van-floating-bubble-background);color:var(--van-floating-bubble-color);border-radius:var(--van-floating-bubble-border-radius);z-index:var(--van-floating-bubble-z-index);transition:transform var(--van-duration-base)}.van-floating-bubble:active{opacity:.8}.van-floating-bubble__icon{font-size:var(--van-floating-bubble-icon-size)}

50
node_modules/vant/lib/floating-bubble/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,50 @@
export declare const FloatingBubble: import("../utils").WithInstall<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
gap: {
type: import("vue").PropType<import("./types").FloatingBubbleGap>;
default: number;
};
icon: StringConstructor;
axis: {
type: import("vue").PropType<import("./types").FloatingBubbleAxis>;
default: import("./types").FloatingBubbleAxis;
};
magnetic: import("vue").PropType<import("./types").FloatingBubbleMagnetic>;
offset: import("vue").PropType<import("./types").FloatingBubbleOffset>;
teleport: {
type: import("vue").PropType<import("vue").TeleportProps["to"]>;
default: string;
};
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "update:offset" | "offsetChange")[], "click" | "update:offset" | "offsetChange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
gap: {
type: import("vue").PropType<import("./types").FloatingBubbleGap>;
default: number;
};
icon: StringConstructor;
axis: {
type: import("vue").PropType<import("./types").FloatingBubbleAxis>;
default: import("./types").FloatingBubbleAxis;
};
magnetic: import("vue").PropType<import("./types").FloatingBubbleMagnetic>;
offset: import("vue").PropType<import("./types").FloatingBubbleOffset>;
teleport: {
type: import("vue").PropType<import("vue").TeleportProps["to"]>;
default: string;
};
}>> & Readonly<{
onClick?: ((...args: any[]) => any) | undefined;
"onUpdate:offset"?: ((...args: any[]) => any) | undefined;
onOffsetChange?: ((...args: any[]) => any) | undefined;
}>, {
teleport: string | import("vue").RendererElement | null | undefined;
gap: import("./types").FloatingBubbleGap;
axis: import("./types").FloatingBubbleAxis;
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
export default FloatingBubble;
export { floatingBubbleProps } from './FloatingBubble';
export type { FloatingBubbleProps } from './FloatingBubble';
export type { FloatingBubbleThemeVars, FloatingBubbleAxis, FloatingBubbleMagnetic, FloatingBubbleOffset, } from './types';
declare module 'vue' {
interface GlobalComponents {
VanFloatingBubble: typeof FloatingBubble;
}
}

39
node_modules/vant/lib/floating-bubble/index.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
FloatingBubble: () => FloatingBubble,
default: () => stdin_default,
floatingBubbleProps: () => import_FloatingBubble2.floatingBubbleProps
});
module.exports = __toCommonJS(stdin_exports);
var import_utils = require("../utils");
var import_FloatingBubble = __toESM(require("./FloatingBubble"));
var import_FloatingBubble2 = require("./FloatingBubble");
const FloatingBubble = (0, import_utils.withInstall)(import_FloatingBubble.default);
var stdin_default = FloatingBubble;

View File

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

4
node_modules/vant/lib/floating-bubble/style/index.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
require("../../style/base.css");
require("../../badge/index.css");
require("../../icon/index.css");
require("../index.css");

24
node_modules/vant/lib/floating-bubble/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,24 @@
export type FloatingBubbleThemeVars = {
floatingBubbleSize?: string;
floatingBubbleInitialGap?: string;
floatingBubbleIconSize?: string;
floatingBubbleBackground?: string;
floatingBubbleColor?: string;
floatingBubbleZIndex?: number | string;
};
export type FloatingBubbleAxis = 'x' | 'y' | 'xy' | 'lock';
export type FloatingBubbleMagnetic = 'x' | 'y';
export type FloatingBubbleOffset = {
x: number;
y: number;
};
export type FloatingBubbleGap = number | {
x: number;
y: number;
};
export type FloatingBubbleBoundary = {
top: number;
right: number;
bottom: number;
left: number;
};

15
node_modules/vant/lib/floating-bubble/types.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 = {};
module.exports = __toCommonJS(stdin_exports);