This commit is contained in:
2025-09-19 14:25:20 +08:00
parent 269893a435
commit fbf3f77229
24949 changed files with 2839404 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
import ConfigProvider from './src/config-provider';
import type { SFCWithInstall } from 'element-plus/es/utils';
export declare const ElConfigProvider: SFCWithInstall<typeof ConfigProvider>;
export default ElConfigProvider;
export * from './src/config-provider';
export * from './src/config-provider-props';
export * from './src/constants';
export * from './src/hooks/use-global-config';

View File

@@ -0,0 +1,11 @@
import ConfigProvider from './src/config-provider.mjs';
export { messageConfig } from './src/config-provider.mjs';
export { configProviderProps } from './src/config-provider-props.mjs';
export { configProviderContextKey } from './src/constants.mjs';
export { provideGlobalConfig, useGlobalComponentSettings, useGlobalConfig } from './src/hooks/use-global-config.mjs';
import { withInstall } from '../../utils/vue/install.mjs';
const ElConfigProvider = withInstall(ConfigProvider);
export { ElConfigProvider, ElConfigProvider as default };
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../../../../../packages/components/config-provider/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\nimport ConfigProvider from './src/config-provider'\n\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nexport const ElConfigProvider: SFCWithInstall<typeof ConfigProvider> =\n withInstall(ConfigProvider)\nexport default ElConfigProvider\n\nexport * from './src/config-provider'\nexport * from './src/config-provider-props'\nexport * from './src/constants'\nexport * from './src/hooks/use-global-config'\n"],"names":[],"mappings":";;;;;;;AAEY,MAAC,gBAAgB,GAAG,WAAW,CAAC,cAAc;;;;"}

View File

@@ -0,0 +1,66 @@
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
import type { Language } from 'element-plus/es/locale';
import type { ButtonConfigContext } from 'element-plus/es/components/button';
import type { CardConfigContext } from 'element-plus/es/components/card';
import type { DialogConfigContext } from 'element-plus/es/components/dialog';
import type { MessageConfigContext } from 'element-plus/es/components/message';
import type { LinkConfigContext } from 'element-plus/es/components/link';
export type ExperimentalFeatures = {};
export declare const configProviderProps: {
readonly emptyValues: ArrayConstructor;
readonly valueOnClear: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null) | ((new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null))[], unknown, unknown, undefined, boolean>;
readonly a11y: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly locale: {
readonly type: import("vue").PropType<Language>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly button: {
readonly type: import("vue").PropType<ButtonConfigContext>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly card: {
readonly type: import("vue").PropType<CardConfigContext>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly dialog: {
readonly type: import("vue").PropType<DialogConfigContext>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly link: {
readonly type: import("vue").PropType<LinkConfigContext>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly experimentalFeatures: {
readonly type: import("vue").PropType<ExperimentalFeatures>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly keyboardNavigation: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly message: {
readonly type: import("vue").PropType<MessageConfigContext>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly zIndex: NumberConstructor;
readonly namespace: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "el", boolean>;
};
export type ConfigProviderProps = ExtractPropTypes<typeof configProviderProps>;
export type ConfigProviderPropsPublic = __ExtractPublicPropTypes<typeof configProviderProps>;

View File

@@ -0,0 +1,45 @@
import { useEmptyValuesProps } from '../../../hooks/use-empty-values/index.mjs';
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
import { useSizeProp } from '../../../hooks/use-size/index.mjs';
const configProviderProps = buildProps({
a11y: {
type: Boolean,
default: true
},
locale: {
type: definePropType(Object)
},
size: useSizeProp,
button: {
type: definePropType(Object)
},
card: {
type: definePropType(Object)
},
dialog: {
type: definePropType(Object)
},
link: {
type: definePropType(Object)
},
experimentalFeatures: {
type: definePropType(Object)
},
keyboardNavigation: {
type: Boolean,
default: true
},
message: {
type: definePropType(Object)
},
zIndex: Number,
namespace: {
type: String,
default: "el"
},
...useEmptyValuesProps
});
export { configProviderProps };
//# sourceMappingURL=config-provider-props.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"config-provider-props.mjs","sources":["../../../../../../packages/components/config-provider/src/config-provider-props.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\nimport { useEmptyValuesProps, useSizeProp } from '@element-plus/hooks'\n\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\nimport type { Language } from '@element-plus/locale'\nimport type { ButtonConfigContext } from '@element-plus/components/button'\nimport type { CardConfigContext } from '@element-plus/components/card'\nimport type { DialogConfigContext } from '@element-plus/components/dialog'\nimport type { MessageConfigContext } from '@element-plus/components/message'\nimport type { LinkConfigContext } from '@element-plus/components/link'\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport type ExperimentalFeatures = {\n // TO BE Defined\n}\n\nexport const configProviderProps = buildProps({\n /**\n * @description Controlling if the users want a11y features\n */\n a11y: {\n type: Boolean,\n default: true,\n },\n /**\n * @description Locale Object\n */\n locale: {\n type: definePropType<Language>(Object),\n },\n /**\n * @description global component size\n */\n size: useSizeProp,\n /**\n * @description button related configuration, [see the following table](https://element-plus.org/en-US/component/config-provider.html#button-attribute)\n */\n button: {\n type: definePropType<ButtonConfigContext>(Object),\n },\n /**\n * @description card related configuration, [see the following table](https://element-plus.org/en-US/component/config-provider.html#card-attribute)\n */\n card: {\n type: definePropType<CardConfigContext>(Object),\n },\n /**\n * @description dialog related configuration, [see the following table](https://element-plus.org/en-US/component/config-provider.html#dialog-attribute)\n */\n dialog: {\n type: definePropType<DialogConfigContext>(Object),\n },\n /**\n * @description link related configuration, [see the following table](https://element-plus.org/en-US/component/config-provider.html#link-attribute)\n */\n link: {\n type: definePropType<LinkConfigContext>(Object),\n },\n /**\n * @description features at experimental stage to be added, all features are default to be set to false, [see the following table](https://element-plus.org/en-US/component/config-provider.html#experimental-features) | ^[object]\n */\n experimentalFeatures: {\n type: definePropType<ExperimentalFeatures>(Object),\n },\n /**\n * @description Controls if we should handle keyboard navigation\n */\n keyboardNavigation: {\n type: Boolean,\n default: true,\n },\n /**\n * @description message related configuration, [see the following table](https://element-plus.org/en-US/component/config-provider.html#message-attribute)\n */\n message: {\n type: definePropType<MessageConfigContext>(Object),\n },\n /**\n * @description global Initial zIndex\n */\n zIndex: Number,\n /**\n * @description global component className prefix (cooperated with [$namespace](https://github.com/element-plus/element-plus/blob/dev/packages/theme-chalk/src/mixins/config.scss#L1)) | ^[string]\n */\n namespace: {\n type: String,\n default: 'el',\n },\n ...useEmptyValuesProps,\n} as const)\nexport type ConfigProviderProps = ExtractPropTypes<typeof configProviderProps>\nexport type ConfigProviderPropsPublic = __ExtractPublicPropTypes<\n typeof configProviderProps\n>\n"],"names":[],"mappings":";;;;AAEY,MAAC,mBAAmB,GAAG,UAAU,CAAC;AAC9C,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,oBAAoB,EAAE;AACxB,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,kBAAkB,EAAE;AACtB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,MAAM,EAAE,MAAM;AAChB,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,GAAG,mBAAmB;AACxB,CAAC;;;;"}

View File

@@ -0,0 +1,122 @@
import type { MessageConfigContext } from 'element-plus/es/components/message';
export declare const messageConfig: MessageConfigContext;
declare const ConfigProvider: import("vue").DefineComponent<{
readonly emptyValues: ArrayConstructor;
readonly valueOnClear: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null) | ((new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null))[], unknown, unknown, undefined, boolean>;
readonly a11y: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly locale: {
readonly type: import("vue").PropType<import("element-plus/es/locale").Language>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly button: {
readonly type: import("vue").PropType<import("element-plus").ButtonConfigContext>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly card: {
readonly type: import("vue").PropType<import("element-plus").CardConfigContext>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly dialog: {
readonly type: import("vue").PropType<import("element-plus").DialogConfigContext>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly link: {
readonly type: import("vue").PropType<import("element-plus").LinkConfigContext>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly experimentalFeatures: {
readonly type: import("vue").PropType<import("./config-provider-props").ExperimentalFeatures>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly keyboardNavigation: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly message: {
readonly type: import("vue").PropType<MessageConfigContext>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly zIndex: NumberConstructor;
readonly namespace: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "el", boolean>;
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
[key: string]: any;
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
readonly emptyValues: ArrayConstructor;
readonly valueOnClear: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null) | ((new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null))[], unknown, unknown, undefined, boolean>;
readonly a11y: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly locale: {
readonly type: import("vue").PropType<import("element-plus/es/locale").Language>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly button: {
readonly type: import("vue").PropType<import("element-plus").ButtonConfigContext>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly card: {
readonly type: import("vue").PropType<import("element-plus").CardConfigContext>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly dialog: {
readonly type: import("vue").PropType<import("element-plus").DialogConfigContext>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly link: {
readonly type: import("vue").PropType<import("element-plus").LinkConfigContext>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly experimentalFeatures: {
readonly type: import("vue").PropType<import("./config-provider-props").ExperimentalFeatures>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly keyboardNavigation: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly message: {
readonly type: import("vue").PropType<MessageConfigContext>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly zIndex: NumberConstructor;
readonly namespace: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "el", boolean>;
}>>, {
readonly valueOnClear: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null) | ((new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null))[], unknown, unknown>;
readonly a11y: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
readonly keyboardNavigation: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
readonly namespace: string;
}>;
export type ConfigProviderInstance = InstanceType<typeof ConfigProvider> & unknown;
export default ConfigProvider;

View File

@@ -0,0 +1,22 @@
import { defineComponent, watch, renderSlot } from 'vue';
import { provideGlobalConfig } from './hooks/use-global-config.mjs';
import { configProviderProps } from './config-provider-props.mjs';
const messageConfig = {
placement: "top"
};
const ConfigProvider = defineComponent({
name: "ElConfigProvider",
props: configProviderProps,
setup(props, { slots }) {
const config = provideGlobalConfig(props);
watch(() => props.message, (val) => {
var _a, _b;
Object.assign(messageConfig, (_b = (_a = config == null ? void 0 : config.value) == null ? void 0 : _a.message) != null ? _b : {}, val != null ? val : {});
}, { immediate: true, deep: true });
return () => renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
}
});
export { ConfigProvider as default, messageConfig };
//# sourceMappingURL=config-provider.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"config-provider.mjs","sources":["../../../../../../packages/components/config-provider/src/config-provider.ts"],"sourcesContent":["import { defineComponent, renderSlot, watch } from 'vue'\nimport { provideGlobalConfig } from './hooks/use-global-config'\nimport { configProviderProps } from './config-provider-props'\n\nimport type { MessageConfigContext } from '@element-plus/components/message'\n\nexport const messageConfig: MessageConfigContext = {\n placement: 'top',\n}\n\nconst ConfigProvider = defineComponent({\n name: 'ElConfigProvider',\n props: configProviderProps,\n\n setup(props, { slots }) {\n const config = provideGlobalConfig(props)\n watch(\n () => props.message,\n (val) => {\n Object.assign(messageConfig, config?.value?.message ?? {}, val ?? {})\n },\n { immediate: true, deep: true }\n )\n return () => renderSlot(slots, 'default', { config: config?.value })\n },\n})\nexport type ConfigProviderInstance = InstanceType<typeof ConfigProvider> &\n unknown\n\nexport default ConfigProvider\n"],"names":[],"mappings":";;;;AAGY,MAAC,aAAa,GAAG;AAC7B,EAAE,SAAS,EAAE,KAAK;AAClB,EAAE;AACG,MAAC,cAAc,GAAG,eAAe,CAAC;AACvC,EAAE,IAAI,EAAE,kBAAkB;AAC1B,EAAE,KAAK,EAAE,mBAAmB;AAC5B,EAAE,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE;AAC1B,IAAI,MAAM,MAAM,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;AAC9C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC,GAAG,KAAK;AACxC,MAAM,IAAI,EAAE,EAAE,EAAE,CAAC;AACjB,MAAM,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,MAAM,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,KAAK,IAAI,GAAG,EAAE,GAAG,EAAE,EAAE,GAAG,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC,CAAC;AACjK,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACxC,IAAI,OAAO,MAAM,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,MAAM,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;AAClG,GAAG;AACH,CAAC;;;;"}

View File

@@ -0,0 +1,4 @@
import type { ConfigProviderProps } from './config-provider-props';
import type { InjectionKey, Ref } from 'vue';
export type ConfigProviderContext = Partial<ConfigProviderProps>;
export declare const configProviderContextKey: InjectionKey<Ref<ConfigProviderContext>>;

View File

@@ -0,0 +1,4 @@
const configProviderContextKey = Symbol();
export { configProviderContextKey };
//# sourceMappingURL=constants.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"constants.mjs","sources":["../../../../../../packages/components/config-provider/src/constants.ts"],"sourcesContent":["import type { ConfigProviderProps } from './config-provider-props'\nimport type { InjectionKey, Ref } from 'vue'\n\nexport type ConfigProviderContext = Partial<ConfigProviderProps>\n\nexport const configProviderContextKey: InjectionKey<\n Ref<ConfigProviderContext>\n> = Symbol()\n"],"names":[],"mappings":"AAAY,MAAC,wBAAwB,GAAG,MAAM;;;;"}

View File

@@ -0,0 +1,33 @@
import type { MaybeRef } from '@vueuse/core';
import type { App, Ref } from 'vue';
import type { ConfigProviderContext } from '../constants';
export declare function useGlobalConfig<K extends keyof ConfigProviderContext, D extends ConfigProviderContext[K]>(key: K, defaultValue?: D): Ref<Exclude<ConfigProviderContext[K], undefined> | D>;
export declare function useGlobalConfig(): Ref<ConfigProviderContext>;
export declare function useGlobalComponentSettings(block: string, sizeFallback?: MaybeRef<ConfigProviderContext['size']>): {
ns: {
namespace: import("vue").ComputedRef<string>;
b: (blockSuffix?: string) => string;
e: (element?: string) => string;
m: (modifier?: string) => string;
be: (blockSuffix?: string, element?: string) => string;
em: (element?: string, modifier?: string) => string;
bm: (blockSuffix?: string, modifier?: string) => string;
bem: (blockSuffix?: string, element?: string, modifier?: string) => string;
is: {
(name: string, state: boolean | undefined): string;
(name: string): string;
};
cssVar: (object: Record<string, string>) => Record<string, string>;
cssVarName: (name: string) => string;
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
cssVarBlockName: (name: string) => string;
};
locale: import("element-plus/es/hooks").LocaleContext;
zIndex: {
initialZIndex: import("vue").ComputedRef<number>;
currentZIndex: import("vue").ComputedRef<number>;
nextZIndex: () => number;
};
size: import("vue").ComputedRef<"small" | "" | "default" | "large">;
};
export declare const provideGlobalConfig: (config: MaybeRef<ConfigProviderContext>, app?: App, global?: boolean) => import("vue").ComputedRef<Partial<import("element-plus").ConfigProviderProps>> | undefined;

View File

@@ -0,0 +1,88 @@
import { ref, getCurrentInstance, inject, computed, unref, provide } from 'vue';
import { configProviderContextKey } from '../constants.mjs';
import { useNamespace, defaultNamespace, namespaceContextKey } from '../../../../hooks/use-namespace/index.mjs';
import { useZIndex, defaultInitialZIndex, zIndexContextKey } from '../../../../hooks/use-z-index/index.mjs';
import { useLocale, localeContextKey } from '../../../../hooks/use-locale/index.mjs';
import { SIZE_INJECTION_KEY } from '../../../../hooks/use-size/index.mjs';
import { emptyValuesContextKey } from '../../../../hooks/use-empty-values/index.mjs';
import { keysOf } from '../../../../utils/objects.mjs';
const globalConfig = ref();
function useGlobalConfig(key, defaultValue = void 0) {
const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
if (key) {
return computed(() => {
var _a, _b;
return (_b = (_a = config.value) == null ? void 0 : _a[key]) != null ? _b : defaultValue;
});
} else {
return config;
}
}
function useGlobalComponentSettings(block, sizeFallback) {
const config = useGlobalConfig();
const ns = useNamespace(block, computed(() => {
var _a;
return ((_a = config.value) == null ? void 0 : _a.namespace) || defaultNamespace;
}));
const locale = useLocale(computed(() => {
var _a;
return (_a = config.value) == null ? void 0 : _a.locale;
}));
const zIndex = useZIndex(computed(() => {
var _a;
return ((_a = config.value) == null ? void 0 : _a.zIndex) || defaultInitialZIndex;
}));
const size = computed(() => {
var _a;
return unref(sizeFallback) || ((_a = config.value) == null ? void 0 : _a.size) || "";
});
provideGlobalConfig(computed(() => unref(config) || {}));
return {
ns,
locale,
zIndex,
size
};
}
const provideGlobalConfig = (config, app, global = false) => {
var _a;
const inSetup = !!getCurrentInstance();
const oldConfig = inSetup ? useGlobalConfig() : void 0;
const provideFn = (_a = app == null ? void 0 : app.provide) != null ? _a : inSetup ? provide : void 0;
if (!provideFn) {
return;
}
const context = computed(() => {
const cfg = unref(config);
if (!(oldConfig == null ? void 0 : oldConfig.value))
return cfg;
return mergeConfig(oldConfig.value, cfg);
});
provideFn(configProviderContextKey, context);
provideFn(localeContextKey, computed(() => context.value.locale));
provideFn(namespaceContextKey, computed(() => context.value.namespace));
provideFn(zIndexContextKey, computed(() => context.value.zIndex));
provideFn(SIZE_INJECTION_KEY, {
size: computed(() => context.value.size || "")
});
provideFn(emptyValuesContextKey, computed(() => ({
emptyValues: context.value.emptyValues,
valueOnClear: context.value.valueOnClear
})));
if (global || !globalConfig.value) {
globalConfig.value = context.value;
}
return context;
};
const mergeConfig = (a, b) => {
const keys = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
const obj = {};
for (const key of keys) {
obj[key] = b[key] !== void 0 ? b[key] : a[key];
}
return obj;
};
export { provideGlobalConfig, useGlobalComponentSettings, useGlobalConfig };
//# sourceMappingURL=use-global-config.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
import 'element-plus/es/components/base/style/css';
import 'element-plus/theme-chalk/el-config-provider.css';

View File

@@ -0,0 +1,3 @@
import '../../base/style/css.mjs';
import 'element-plus/theme-chalk/el-config-provider.css';
//# sourceMappingURL=css.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"css.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}

View File

@@ -0,0 +1,2 @@
import 'element-plus/es/components/base/style';
import 'element-plus/theme-chalk/src/config-provider.scss';

View File

@@ -0,0 +1,3 @@
import '../../base/style/index.mjs';
import 'element-plus/theme-chalk/src/config-provider.scss';
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}