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,71 @@
import { type PropType, type InjectionKey, type ExtractPropTypes } from 'vue';
import { type Numeric } from '../utils';
export type ConfigProviderTheme = 'light' | 'dark';
export type ConfigProviderThemeVarsScope = 'local' | 'global';
export type ConfigProviderProvide = {
iconPrefix?: string;
};
export declare const CONFIG_PROVIDER_KEY: InjectionKey<ConfigProviderProvide>;
export type ThemeVars = PropType<Record<string, Numeric>>;
export declare const configProviderProps: {
tag: {
type: PropType<keyof HTMLElementTagNameMap>;
default: keyof HTMLElementTagNameMap;
};
theme: {
type: PropType<ConfigProviderTheme>;
default: ConfigProviderTheme;
};
zIndex: NumberConstructor;
themeVars: ThemeVars;
themeVarsDark: ThemeVars;
themeVarsLight: ThemeVars;
themeVarsScope: {
type: PropType<ConfigProviderThemeVarsScope>;
default: ConfigProviderThemeVarsScope;
};
iconPrefix: StringConstructor;
};
export type ConfigProviderProps = ExtractPropTypes<typeof configProviderProps>;
declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
tag: {
type: PropType<keyof HTMLElementTagNameMap>;
default: keyof HTMLElementTagNameMap;
};
theme: {
type: PropType<ConfigProviderTheme>;
default: ConfigProviderTheme;
};
zIndex: NumberConstructor;
themeVars: ThemeVars;
themeVarsDark: ThemeVars;
themeVarsLight: ThemeVars;
themeVarsScope: {
type: PropType<ConfigProviderThemeVarsScope>;
default: ConfigProviderThemeVarsScope;
};
iconPrefix: StringConstructor;
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ExtractPropTypes<{
tag: {
type: PropType<keyof HTMLElementTagNameMap>;
default: keyof HTMLElementTagNameMap;
};
theme: {
type: PropType<ConfigProviderTheme>;
default: ConfigProviderTheme;
};
zIndex: NumberConstructor;
themeVars: ThemeVars;
themeVarsDark: ThemeVars;
themeVarsLight: ThemeVars;
themeVarsScope: {
type: PropType<ConfigProviderThemeVarsScope>;
default: ConfigProviderThemeVarsScope;
};
iconPrefix: StringConstructor;
}>> & Readonly<{}>, {
tag: keyof HTMLElementTagNameMap;
theme: ConfigProviderTheme;
themeVarsScope: ConfigProviderThemeVarsScope;
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
export default _default;

102
node_modules/vant/es/config-provider/ConfigProvider.mjs generated vendored Normal file
View File

@@ -0,0 +1,102 @@
import { watch, provide, computed, watchEffect, onActivated, onDeactivated, onBeforeUnmount, defineComponent, createVNode as _createVNode } from "vue";
import { extend, inBrowser, kebabCase, makeStringProp, createNamespace } from "../utils/index.mjs";
import { setGlobalZIndex } from "../composables/use-global-z-index.mjs";
const [name, bem] = createNamespace("config-provider");
const CONFIG_PROVIDER_KEY = Symbol(name);
const configProviderProps = {
tag: makeStringProp("div"),
theme: makeStringProp("light"),
zIndex: Number,
themeVars: Object,
themeVarsDark: Object,
themeVarsLight: Object,
themeVarsScope: makeStringProp("local"),
iconPrefix: String
};
function insertDash(str) {
return str.replace(/([a-zA-Z])(\d)/g, "$1-$2");
}
function mapThemeVarsToCSSVars(themeVars) {
const cssVars = {};
Object.keys(themeVars).forEach((key) => {
const formattedKey = insertDash(kebabCase(key));
cssVars[`--van-${formattedKey}`] = themeVars[key];
});
return cssVars;
}
function syncThemeVarsOnRoot(newStyle = {}, oldStyle = {}) {
Object.keys(newStyle).forEach((key) => {
if (newStyle[key] !== oldStyle[key]) {
document.documentElement.style.setProperty(key, newStyle[key]);
}
});
Object.keys(oldStyle).forEach((key) => {
if (!newStyle[key]) {
document.documentElement.style.removeProperty(key);
}
});
}
var stdin_default = defineComponent({
name,
props: configProviderProps,
setup(props, {
slots
}) {
const style = computed(() => mapThemeVarsToCSSVars(extend({}, props.themeVars, props.theme === "dark" ? props.themeVarsDark : props.themeVarsLight)));
if (inBrowser) {
const addTheme = () => {
document.documentElement.classList.add(`van-theme-${props.theme}`);
};
const removeTheme = (theme = props.theme) => {
document.documentElement.classList.remove(`van-theme-${theme}`);
};
watch(() => props.theme, (newVal, oldVal) => {
if (oldVal) {
removeTheme(oldVal);
}
addTheme();
}, {
immediate: true
});
onActivated(addTheme);
onDeactivated(removeTheme);
onBeforeUnmount(removeTheme);
watch(style, (newStyle, oldStyle) => {
if (props.themeVarsScope === "global") {
syncThemeVarsOnRoot(newStyle, oldStyle);
}
});
watch(() => props.themeVarsScope, (newScope, oldScope) => {
if (oldScope === "global") {
syncThemeVarsOnRoot({}, style.value);
}
if (newScope === "global") {
syncThemeVarsOnRoot(style.value, {});
}
});
if (props.themeVarsScope === "global") {
syncThemeVarsOnRoot(style.value, {});
}
}
provide(CONFIG_PROVIDER_KEY, props);
watchEffect(() => {
if (props.zIndex !== void 0) {
setGlobalZIndex(props.zIndex);
}
});
return () => _createVNode(props.tag, {
"class": bem(),
"style": props.themeVarsScope === "local" ? style.value : void 0
}, {
default: () => {
var _a;
return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
}
});
}
});
export {
CONFIG_PROVIDER_KEY,
configProviderProps,
stdin_default as default
};

50
node_modules/vant/es/config-provider/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,50 @@
export declare const ConfigProvider: import("../utils").WithInstall<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
tag: {
type: import("vue").PropType<keyof HTMLElementTagNameMap>;
default: keyof HTMLElementTagNameMap;
};
theme: {
type: import("vue").PropType<import("./ConfigProvider").ConfigProviderTheme>;
default: import("./ConfigProvider").ConfigProviderTheme;
};
zIndex: NumberConstructor;
themeVars: import("./ConfigProvider").ThemeVars;
themeVarsDark: import("./ConfigProvider").ThemeVars;
themeVarsLight: import("./ConfigProvider").ThemeVars;
themeVarsScope: {
type: import("vue").PropType<import("./ConfigProvider").ConfigProviderThemeVarsScope>;
default: import("./ConfigProvider").ConfigProviderThemeVarsScope;
};
iconPrefix: StringConstructor;
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
tag: {
type: import("vue").PropType<keyof HTMLElementTagNameMap>;
default: keyof HTMLElementTagNameMap;
};
theme: {
type: import("vue").PropType<import("./ConfigProvider").ConfigProviderTheme>;
default: import("./ConfigProvider").ConfigProviderTheme;
};
zIndex: NumberConstructor;
themeVars: import("./ConfigProvider").ThemeVars;
themeVarsDark: import("./ConfigProvider").ThemeVars;
themeVarsLight: import("./ConfigProvider").ThemeVars;
themeVarsScope: {
type: import("vue").PropType<import("./ConfigProvider").ConfigProviderThemeVarsScope>;
default: import("./ConfigProvider").ConfigProviderThemeVarsScope;
};
iconPrefix: StringConstructor;
}>> & Readonly<{}>, {
tag: keyof HTMLElementTagNameMap;
theme: import("./ConfigProvider").ConfigProviderTheme;
themeVarsScope: import("./ConfigProvider").ConfigProviderThemeVarsScope;
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
export default ConfigProvider;
export { configProviderProps } from './ConfigProvider';
export type { ConfigProviderProps, ConfigProviderTheme, ConfigProviderThemeVarsScope, } from './ConfigProvider';
export type { ConfigProviderThemeVars } from './types';
declare module 'vue' {
interface GlobalComponents {
VanConfigProvider: typeof ConfigProvider;
}
}

10
node_modules/vant/es/config-provider/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import { withInstall } from "../utils/index.mjs";
import _ConfigProvider from "./ConfigProvider.mjs";
const ConfigProvider = withInstall(_ConfigProvider);
var stdin_default = ConfigProvider;
import { configProviderProps } from "./ConfigProvider.mjs";
export {
ConfigProvider,
configProviderProps,
stdin_default as default
};

View File

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

1
node_modules/vant/es/config-provider/style/index.mjs generated vendored Normal file
View File

@@ -0,0 +1 @@
import "../../style/base.css";

61
node_modules/vant/es/config-provider/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,61 @@
type BaseThemeVars = {
black?: string;
white?: string;
gray1?: string;
gray2?: string;
gray3?: string;
gray4?: string;
gray5?: string;
gray6?: string;
gray7?: string;
gray8?: string;
red?: string;
blue?: string;
orange?: string;
orangeDark?: string;
orangeLight?: string;
green?: string;
gradientRed?: string;
gradientOrange?: string;
primaryColor?: string;
successColor?: string;
dangerColor?: string;
warningColor?: string;
textColor?: string;
textColor2?: string;
textColor3?: string;
activeColor?: string;
activeOpacity?: number;
disabledOpacity?: number;
background?: string;
background2?: string;
paddingBase?: string;
paddingXs?: string;
paddingSm?: string;
paddingMd?: string;
paddingLg?: string;
paddingXl?: string;
fontSizeXs?: string;
fontSizeSm?: string;
fontSizeMd?: string;
fontSizeLg?: string;
fontBold?: number;
lineHeightXs?: string;
lineHeightSm?: string;
lineHeightMd?: string;
lineHeightLg?: string;
baseFont?: string;
priceFont?: string;
durationBase?: string;
durationFast?: string;
easeOut?: string;
easeIn?: string;
borderColor?: string;
borderWidth?: string;
radiusSm?: string;
radiusMd?: string;
radiusLg?: string;
radiusMax?: string;
};
export type ConfigProviderThemeVars = BaseThemeVars & import('../action-bar').ActionBarThemeVars & import('../action-bar-button').ActionBarButtonThemeVars & import('../action-bar-icon').ActionBarIconThemeVars & import('../action-sheet').ActionSheetThemeVars & import('../address-edit').AddressEditThemeVars & import('../address-list').AddressListThemeVars & import('../back-top').BackTopThemeVars & import('../badge').BadgeThemeVars & import('../barrage').BarrageThemeVars & import('../button').ButtonThemeVars & import('../calendar').CalendarThemeVars & import('../card').CardThemeVars & import('../cascader').CascaderThemeVars & import('../cell').CellThemeVars & import('../cell-group').CellGroupThemeVars & import('../checkbox').CheckboxThemeVars & import('../circle').CircleThemeVars & import('../collapse-item').CollapseItemThemeVars & import('../contact-card').ContactCardThemeVars & import('../contact-edit').ContactEditThemeVars & import('../contact-list').ContactListThemeVars & import('../count-down').CountDownThemeVars & import('../coupon').CouponThemeVars & import('../coupon-cell').CouponCellThemeVars & import('../coupon-list').CouponListThemeVars & import('../dialog').DialogThemeVars & import('../divider').DividerThemeVars & import('../dropdown-item').DropdownItemThemeVars & import('../dropdown-menu').DropdownMenuThemeVars & import('../empty').EmptyThemeVars & import('../highlight').HighlightThemeVars & import('../field').FieldThemeVars & import('../floating-bubble').FloatingBubbleThemeVars & import('../floating-panel').FloatingPanelThemeVars & import('../grid-item').GridItemThemeVars & import('../image').ImageThemeVars & import('../image-preview').ImagePreviewThemeVars & import('../index-anchor').IndexAnchorThemeVars & import('../index-bar').IndexBarThemeVars & import('../list').ListThemeVars & import('../loading').LoadingThemeVars & import('../nav-bar').NavBarThemeVars & import('../notice-bar').NoticeBarThemeVars & import('../notify').NotifyThemeVars & import('../number-keyboard').NumberKeyboardThemeVars & import('../overlay').OverlayThemeVars & import('../pagination').PaginationThemeVars & import('../password-input').PasswordInputThemeVars & import('../picker').PickerThemeVars & import('../picker-group').PickerGroupThemeVars & import('../popover').PopoverThemeVars & import('../popup').PopupThemeVars & import('../progress').ProgressThemeVars & import('../pull-refresh').PullRefreshThemeVars & import('../radio').RadioThemeVars & import('../rate').RateThemeVars & import('../rolling-text').RollingTextThemeVars & import('../search').SearchThemeVars & import('../share-sheet').ShareSheetThemeVars & import('../sidebar').SidebarThemeVars & import('../sidebar-item').SidebarItemThemeVars & import('../signature').SignatureThemeVars & import('../skeleton').SkeletonThemeVars & import('../slider').SliderThemeVars & import('../step').StepThemeVars & import('../stepper').StepperThemeVars & import('../steps').StepsThemeVars & import('../sticky').StickyThemeVars & import('../submit-bar').SubmitBarThemeVars & import('../swipe').SwipeThemeVars & import('../switch').SwitchThemeVars & import('../tabbar').TabbarThemeVars & import('../tabbar-item').TabbarItemThemeVars & import('../tabs').TabsThemeVars & import('../tag').TagThemeVars & import('../toast').ToastThemeVars & import('../tree-select').TreeSelectThemeVars & import('../uploader').UploaderThemeVars & import('../watermark').WatermarkThemeVars;
export {};

0
node_modules/vant/es/config-provider/types.mjs generated vendored Normal file
View File