first commit
This commit is contained in:
58
node_modules/vant/lib/switch/Switch.d.ts
generated
vendored
Normal file
58
node_modules/vant/lib/switch/Switch.d.ts
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
import { type ExtractPropTypes } from 'vue';
|
||||
export declare const switchProps: {
|
||||
size: (NumberConstructor | StringConstructor)[];
|
||||
loading: BooleanConstructor;
|
||||
disabled: BooleanConstructor;
|
||||
modelValue: import("vue").PropType<unknown>;
|
||||
activeColor: StringConstructor;
|
||||
inactiveColor: StringConstructor;
|
||||
activeValue: {
|
||||
type: import("vue").PropType<unknown>;
|
||||
default: unknown;
|
||||
};
|
||||
inactiveValue: {
|
||||
type: import("vue").PropType<unknown>;
|
||||
default: unknown;
|
||||
};
|
||||
};
|
||||
export type SwitchProps = ExtractPropTypes<typeof switchProps>;
|
||||
declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
||||
size: (NumberConstructor | StringConstructor)[];
|
||||
loading: BooleanConstructor;
|
||||
disabled: BooleanConstructor;
|
||||
modelValue: import("vue").PropType<unknown>;
|
||||
activeColor: StringConstructor;
|
||||
inactiveColor: StringConstructor;
|
||||
activeValue: {
|
||||
type: import("vue").PropType<unknown>;
|
||||
default: unknown;
|
||||
};
|
||||
inactiveValue: {
|
||||
type: import("vue").PropType<unknown>;
|
||||
default: unknown;
|
||||
};
|
||||
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "change")[], "update:modelValue" | "change", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
||||
size: (NumberConstructor | StringConstructor)[];
|
||||
loading: BooleanConstructor;
|
||||
disabled: BooleanConstructor;
|
||||
modelValue: import("vue").PropType<unknown>;
|
||||
activeColor: StringConstructor;
|
||||
inactiveColor: StringConstructor;
|
||||
activeValue: {
|
||||
type: import("vue").PropType<unknown>;
|
||||
default: unknown;
|
||||
};
|
||||
inactiveValue: {
|
||||
type: import("vue").PropType<unknown>;
|
||||
default: unknown;
|
||||
};
|
||||
}>> & Readonly<{
|
||||
onChange?: ((...args: any[]) => any) | undefined;
|
||||
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
||||
}>, {
|
||||
disabled: boolean;
|
||||
loading: boolean;
|
||||
activeValue: unknown;
|
||||
inactiveValue: unknown;
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
||||
export default _default;
|
||||
104
node_modules/vant/lib/switch/Switch.js
generated
vendored
Normal file
104
node_modules/vant/lib/switch/Switch.js
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stdin_exports = {};
|
||||
__export(stdin_exports, {
|
||||
default: () => stdin_default,
|
||||
switchProps: () => switchProps
|
||||
});
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
var import_vue = require("vue");
|
||||
var import_utils = require("../utils");
|
||||
var import_use = require("@vant/use");
|
||||
var import_loading = require("../loading");
|
||||
const [name, bem] = (0, import_utils.createNamespace)("switch");
|
||||
const switchProps = {
|
||||
size: import_utils.numericProp,
|
||||
loading: Boolean,
|
||||
disabled: Boolean,
|
||||
modelValue: import_utils.unknownProp,
|
||||
activeColor: String,
|
||||
inactiveColor: String,
|
||||
activeValue: {
|
||||
type: import_utils.unknownProp,
|
||||
default: true
|
||||
},
|
||||
inactiveValue: {
|
||||
type: import_utils.unknownProp,
|
||||
default: false
|
||||
}
|
||||
};
|
||||
var stdin_default = (0, import_vue.defineComponent)({
|
||||
name,
|
||||
props: switchProps,
|
||||
emits: ["change", "update:modelValue"],
|
||||
setup(props, {
|
||||
emit,
|
||||
slots
|
||||
}) {
|
||||
const isChecked = () => props.modelValue === props.activeValue;
|
||||
const onClick = () => {
|
||||
if (!props.disabled && !props.loading) {
|
||||
const newValue = isChecked() ? props.inactiveValue : props.activeValue;
|
||||
emit("update:modelValue", newValue);
|
||||
emit("change", newValue);
|
||||
}
|
||||
};
|
||||
const renderLoading = () => {
|
||||
if (props.loading) {
|
||||
const color = isChecked() ? props.activeColor : props.inactiveColor;
|
||||
return (0, import_vue.createVNode)(import_loading.Loading, {
|
||||
"class": bem("loading"),
|
||||
"color": color
|
||||
}, null);
|
||||
}
|
||||
if (slots.node) {
|
||||
return slots.node();
|
||||
}
|
||||
};
|
||||
(0, import_use.useCustomFieldValue)(() => props.modelValue);
|
||||
return () => {
|
||||
var _a;
|
||||
const {
|
||||
size,
|
||||
loading,
|
||||
disabled,
|
||||
activeColor,
|
||||
inactiveColor
|
||||
} = props;
|
||||
const checked = isChecked();
|
||||
const style = {
|
||||
fontSize: (0, import_utils.addUnit)(size),
|
||||
backgroundColor: checked ? activeColor : inactiveColor
|
||||
};
|
||||
return (0, import_vue.createVNode)("div", {
|
||||
"role": "switch",
|
||||
"class": bem({
|
||||
on: checked,
|
||||
loading,
|
||||
disabled
|
||||
}),
|
||||
"style": style,
|
||||
"tabindex": disabled ? void 0 : 0,
|
||||
"aria-checked": checked,
|
||||
"onClick": onClick
|
||||
}, [(0, import_vue.createVNode)("div", {
|
||||
"class": bem("node")
|
||||
}, [renderLoading()]), (_a = slots.background) == null ? void 0 : _a.call(slots)]);
|
||||
};
|
||||
}
|
||||
});
|
||||
1
node_modules/vant/lib/switch/index.css
generated
vendored
Normal file
1
node_modules/vant/lib/switch/index.css
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
:root,:host{--van-switch-size: 26px;--van-switch-width: calc(1.8em + 4px) ;--van-switch-height: calc(1em + 4px) ;--van-switch-node-size: 1em;--van-switch-node-background: var(--van-white);--van-switch-node-shadow: 0 3px 1px 0 rgba(0, 0, 0, .05);--van-switch-background: rgba(120, 120, 128, .16);--van-switch-on-background: var(--van-primary-color);--van-switch-duration: var(--van-duration-base);--van-switch-disabled-opacity: var(--van-disabled-opacity)}.van-theme-dark{--van-switch-background: rgba(120, 120, 128, .32)}.van-switch{position:relative;display:inline-block;box-sizing:content-box;width:var(--van-switch-width);height:var(--van-switch-height);font-size:var(--van-switch-size);background:var(--van-switch-background);border-radius:var(--van-switch-node-size);cursor:pointer;transition:background-color var(--van-switch-duration)}.van-switch__node{position:absolute;top:2px;left:2px;width:var(--van-switch-node-size);height:var(--van-switch-node-size);font-size:inherit;background:var(--van-switch-node-background);border-radius:100%;box-shadow:var(--van-switch-node-shadow);transition:transform var(--van-switch-duration) cubic-bezier(.3,1.05,.4,1.05)}.van-switch__loading{top:25%;left:25%;width:50%;height:50%;line-height:1}.van-switch--on{background:var(--van-switch-on-background)}.van-switch--on .van-switch__node{transform:translate(calc(var(--van-switch-width) - var(--van-switch-node-size) - 4px))}.van-switch--on .van-switch__loading{color:var(--van-switch-on-background)}.van-switch--disabled{cursor:not-allowed;opacity:var(--van-switch-disabled-opacity)}.van-switch--loading{cursor:default}
|
||||
48
node_modules/vant/lib/switch/index.d.ts
generated
vendored
Normal file
48
node_modules/vant/lib/switch/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
export declare const Switch: import("../utils").WithInstall<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
||||
size: (NumberConstructor | StringConstructor)[];
|
||||
loading: BooleanConstructor;
|
||||
disabled: BooleanConstructor;
|
||||
modelValue: import("vue").PropType<unknown>;
|
||||
activeColor: StringConstructor;
|
||||
inactiveColor: StringConstructor;
|
||||
activeValue: {
|
||||
type: import("vue").PropType<unknown>;
|
||||
default: unknown;
|
||||
};
|
||||
inactiveValue: {
|
||||
type: import("vue").PropType<unknown>;
|
||||
default: unknown;
|
||||
};
|
||||
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "change")[], "update:modelValue" | "change", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
||||
size: (NumberConstructor | StringConstructor)[];
|
||||
loading: BooleanConstructor;
|
||||
disabled: BooleanConstructor;
|
||||
modelValue: import("vue").PropType<unknown>;
|
||||
activeColor: StringConstructor;
|
||||
inactiveColor: StringConstructor;
|
||||
activeValue: {
|
||||
type: import("vue").PropType<unknown>;
|
||||
default: unknown;
|
||||
};
|
||||
inactiveValue: {
|
||||
type: import("vue").PropType<unknown>;
|
||||
default: unknown;
|
||||
};
|
||||
}>> & Readonly<{
|
||||
onChange?: ((...args: any[]) => any) | undefined;
|
||||
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
||||
}>, {
|
||||
disabled: boolean;
|
||||
loading: boolean;
|
||||
activeValue: unknown;
|
||||
inactiveValue: unknown;
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
|
||||
export default Switch;
|
||||
export { switchProps } from './Switch';
|
||||
export type { SwitchProps } from './Switch';
|
||||
export type { SwitchThemeVars } from './types';
|
||||
declare module 'vue' {
|
||||
interface GlobalComponents {
|
||||
VanSwitch: typeof Switch;
|
||||
}
|
||||
}
|
||||
39
node_modules/vant/lib/switch/index.js
generated
vendored
Normal file
39
node_modules/vant/lib/switch/index.js
generated
vendored
Normal 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, {
|
||||
Switch: () => Switch,
|
||||
default: () => stdin_default,
|
||||
switchProps: () => import_Switch2.switchProps
|
||||
});
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
var import_utils = require("../utils");
|
||||
var import_Switch = __toESM(require("./Switch"));
|
||||
var import_Switch2 = require("./Switch");
|
||||
const Switch = (0, import_utils.withInstall)(import_Switch.default);
|
||||
var stdin_default = Switch;
|
||||
1
node_modules/vant/lib/switch/style/index.d.ts
generated
vendored
Normal file
1
node_modules/vant/lib/switch/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
3
node_modules/vant/lib/switch/style/index.js
generated
vendored
Normal file
3
node_modules/vant/lib/switch/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
require("../../style/base.css");
|
||||
require("../../loading/index.css");
|
||||
require("../index.css");
|
||||
12
node_modules/vant/lib/switch/types.d.ts
generated
vendored
Normal file
12
node_modules/vant/lib/switch/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
export type SwitchThemeVars = {
|
||||
switchSize?: string;
|
||||
switchWidth?: string;
|
||||
switchHeight?: string;
|
||||
switchNodeSize?: string;
|
||||
switchNodeBackground?: string;
|
||||
switchNodeShadow?: string;
|
||||
switchBackground?: string;
|
||||
switchOnBackground?: string;
|
||||
switchDuration?: string;
|
||||
switchDisabledOpacity?: number | string;
|
||||
};
|
||||
15
node_modules/vant/lib/switch/types.js
generated
vendored
Normal file
15
node_modules/vant/lib/switch/types.js
generated
vendored
Normal 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);
|
||||
Reference in New Issue
Block a user