cosey 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/audio-card/style/index.d.ts +1 -1
- package/components/audio-viewer/style/index.d.ts +1 -1
- package/components/close/style/index.d.ts +1 -1
- package/components/col/style/index.d.ts +1 -1
- package/components/col/style/index.js +1 -1
- package/components/config-provider/config-provider.vue.js +8 -4
- package/components/config-provider/override-element-plus.d.ts +3 -2
- package/components/config-provider/override-element-plus.js +2 -2
- package/components/container/container.d.ts +0 -1
- package/components/container/container.vue.js +0 -4
- package/components/container/style/index.d.ts +1 -1
- package/components/context-menu/style/index.d.ts +1 -1
- package/components/copy/copy.d.ts +0 -2
- package/components/copy/copy.vue.d.ts +1 -7
- package/components/copy/copy.vue.js +0 -1
- package/components/copy/index.d.ts +3 -19
- package/components/copy/style/index.d.ts +1 -1
- package/components/dnd-sort/dnd-sort-item.vue.js +1 -1
- package/components/dnd-sort/style/index.d.ts +1 -1
- package/components/dnd-sort/style/index.js +1 -0
- package/components/editor/components/color-picker/color-picker.style.d.ts +1 -1
- package/components/editor/components/list/list.style.d.ts +1 -1
- package/components/editor/components/picker/picker.style.d.ts +1 -1
- package/components/editor/components/resize/resize.style.d.ts +1 -1
- package/components/editor/components/table-toolbar/table-toolbar.style.d.ts +1 -1
- package/components/editor/components/toolbar/formats/table.style.d.ts +1 -1
- package/components/editor/editor.d.ts +0 -2
- package/components/editor/editor.vue.js +1 -11
- package/components/editor/modules/image-uploader/formats/image-loading.style.d.ts +1 -1
- package/components/editor/modules/image-uploader/formats/image-loading.style.js +3 -3
- package/components/editor/style/hljs.d.ts +1 -1
- package/components/editor/style/index.d.ts +1 -1
- package/components/file-card/style/index.d.ts +1 -1
- package/components/form/style/index.d.ts +1 -1
- package/components/form-list/style/index.d.ts +1 -1
- package/components/form-query/style/index.d.ts +1 -1
- package/components/highlight/highlight.d.ts +1 -1
- package/components/highlight/highlight.vue.js +11 -4
- package/components/highlight/style/index.d.ts +1 -1
- package/components/highlight/style/index.js +15 -5
- package/components/horizontal-tree/style/index.d.ts +1 -1
- package/components/icon/style/index.d.ts +1 -1
- package/components/image-card/style/index.d.ts +1 -1
- package/components/index.js +1 -0
- package/components/long-text/style/index.d.ts +1 -1
- package/components/mask/style/index.d.ts +1 -1
- package/components/media-card-group/style/index.d.ts +1 -1
- package/components/panel/style/index.d.ts +1 -1
- package/components/row/style/index.d.ts +1 -1
- package/components/scroll-view/style/index.d.ts +1 -1
- package/components/snug-menu/style/index.d.ts +1 -1
- package/components/table/style/index.d.ts +1 -1
- package/components/table/table-column/style/index.d.ts +1 -1
- package/components/table/table-column/table-column.vue.d.ts +3 -3
- package/components/table/table-column-editor/item.vue.js +1 -1
- package/components/table/table-column-editor/style/index.d.ts +1 -1
- package/components/table/table-column-editor/style/index.js +1 -0
- package/components/table/table-export/style/index.d.ts +1 -1
- package/components/table-action/style/index.d.ts +1 -1
- package/components/theme/getGlobalStyleHook.d.ts +2 -3
- package/components/theme/getGlobalStyleHook.js +3 -8
- package/components/theme/getOverrideStyleHook.d.ts +8 -0
- package/components/theme/getOverrideStyleHook.js +39 -0
- package/components/theme/getSimpleStyleHook.d.ts +2 -2
- package/components/theme/getSimpleStyleHook.js +3 -7
- package/components/theme/getStyleHook.d.ts +2 -2
- package/components/theme/getStyleHook.js +3 -7
- package/components/theme/index.d.ts +2 -1
- package/components/theme/index.js +1 -0
- package/components/theme/theme-context.d.ts +11 -2
- package/components/theme/theme-context.js +36 -6
- package/components/theme/useStyleRegister.d.ts +1 -7
- package/components/theme/useStyleRegister.js +3 -4
- package/components/theme/util/useToken.d.ts +4 -4
- package/components/theme/util/useToken.js +6 -6
- package/components/transition/style/index.d.ts +1 -1
- package/components/transition-group/index.d.ts +3 -3
- package/components/transition-group/style/index.d.ts +1 -1
- package/components/transition-group/transition-group.vue.d.ts +1 -1
- package/components/upload/index.d.ts +0 -3
- package/components/upload/style/index.d.ts +1 -1
- package/components/upload/upload.d.ts +0 -2
- package/components/upload/upload.js +0 -1
- package/components/upload/upload.vue.d.ts +0 -1
- package/components/upload/upload.vue.js +0 -4
- package/components/video-card/style/index.d.ts +1 -1
- package/components/video-card/video-card.vue.js +1 -1
- package/components/video-viewer/style/index.d.ts +1 -1
- package/config/http.d.ts +1 -1
- package/config/http.js +1 -1
- package/config/index.d.ts +22 -22
- package/config/nprogress.style.d.ts +1 -1
- package/config/nprogress.style.js +1 -1
- package/hooks/useUpsert.d.ts +15 -16
- package/hooks/useUpsert.js +3 -3
- package/layout/layout-aside/style/index.d.ts +1 -1
- package/layout/layout-auth/style/index.d.ts +1 -1
- package/layout/layout-base/layout-base.vue.js +8 -8
- package/layout/layout-base/style/index.d.ts +1 -1
- package/layout/layout-brand/style/index.d.ts +1 -1
- package/layout/layout-change-password/style/index.d.ts +1 -1
- package/layout/layout-color-scheme/style/index.d.ts +2 -2
- package/layout/layout-content/style/index.d.ts +1 -1
- package/layout/layout-exception/style/index.d.ts +1 -1
- package/layout/layout-header/style/index.d.ts +1 -1
- package/layout/layout-iframe/style/index.d.ts +1 -1
- package/layout/layout-login/style/index.d.ts +1 -1
- package/layout/layout-main/style/index.d.ts +1 -1
- package/layout/layout-mask/style/index.d.ts +1 -1
- package/layout/layout-menu/layout-menu.vue.js +5 -0
- package/layout/layout-menu/style/index.d.ts +1 -1
- package/layout/layout-search/style/index.d.ts +1 -1
- package/layout/layout-sidebar/style/index.d.ts +1 -1
- package/layout/layout-snug-aside/style/index.d.ts +1 -1
- package/layout/layout-switch-effect/style/index.d.ts +1 -1
- package/layout/layout-tabbar/layout-tabbar.vue.js +6 -1
- package/layout/layout-tabbar/style/index.d.ts +1 -1
- package/layout/layout-tabbar/style/index.js +4 -0
- package/layout/layout-topbar/style/index.d.ts +1 -1
- package/layout/layout-user-menu/style/index.d.ts +1 -1
- package/package.json +3 -3
- package/router/guard/index.js +2 -0
- package/router/guard/pageTitle.d.ts +2 -0
- package/router/guard/pageTitle.js +11 -0
- package/router/index.js +1 -1
- package/router/routes/static/auth.js +5 -6
- package/router/routes/static/exception.js +3 -3
- package/router/utils.js +11 -3
- package/store/layout.d.ts +2 -2
- package/store/user.d.ts +3 -3
- package/store/user.js +1 -0
- package/utils/dynamicCSS.d.ts +3 -2
- package/utils/dynamicCSS.js +12 -1
- package/utils/index.js +1 -1
|
@@ -4,7 +4,7 @@ export interface ComponentToken {
|
|
|
4
4
|
export interface TableToken extends FullToken<'Table'> {
|
|
5
5
|
tableHeaderBg: string;
|
|
6
6
|
}
|
|
7
|
-
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string,
|
|
7
|
+
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string, themeManager?: import("../../theme/theme-context").ThemeManager) => {
|
|
8
8
|
hashId: import("vue").Ref<string, string>;
|
|
9
9
|
};
|
|
10
10
|
export default _default;
|
|
@@ -3,7 +3,7 @@ export interface ComponentToken {
|
|
|
3
3
|
}
|
|
4
4
|
export interface TableColumnToken extends FullToken<'TableColumn'> {
|
|
5
5
|
}
|
|
6
|
-
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string,
|
|
6
|
+
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string, themeManager?: import("../../../theme/theme-context").ThemeManager) => {
|
|
7
7
|
hashId: import("vue").Ref<string, string>;
|
|
8
8
|
};
|
|
9
9
|
export default _default;
|
|
@@ -21,7 +21,7 @@ declare const TableColumn: import("vue").DefineComponent<{
|
|
|
21
21
|
sortBy?: string | string[] | ((row: any, index: number) => string) | undefined;
|
|
22
22
|
columnKey?: string | undefined;
|
|
23
23
|
headerAlign?: string | undefined;
|
|
24
|
-
showOverflowTooltip?: boolean | Partial<Pick<import("element-plus/es/components/tooltip/index.mjs").ElTooltipProps, "offset" | "transition" | "enterable" | "appendTo" | "placement" | "
|
|
24
|
+
showOverflowTooltip?: boolean | Partial<Pick<import("element-plus/es/components/tooltip/index.mjs").ElTooltipProps, "offset" | "transition" | "enterable" | "appendTo" | "placement" | "showAfter" | "effect" | "popperClass" | "popperOptions" | "showArrow" | "hideAfter">> | undefined;
|
|
25
25
|
selectable?: ((row: any, index: number) => boolean) | undefined;
|
|
26
26
|
reserveSelection?: boolean | undefined;
|
|
27
27
|
filterMethod?: import("element-plus/es/components/table/src/table-column/defaults.mjs").FilterMethods<any> | undefined;
|
|
@@ -61,7 +61,7 @@ declare const TableColumn: import("vue").DefineComponent<{
|
|
|
61
61
|
sortBy?: string | string[] | ((row: any, index: number) => string) | undefined;
|
|
62
62
|
columnKey?: string | undefined;
|
|
63
63
|
headerAlign?: string | undefined;
|
|
64
|
-
showOverflowTooltip?: boolean | Partial<Pick<import("element-plus/es/components/tooltip/index.mjs").ElTooltipProps, "offset" | "transition" | "enterable" | "appendTo" | "placement" | "
|
|
64
|
+
showOverflowTooltip?: boolean | Partial<Pick<import("element-plus/es/components/tooltip/index.mjs").ElTooltipProps, "offset" | "transition" | "enterable" | "appendTo" | "placement" | "showAfter" | "effect" | "popperClass" | "popperOptions" | "showArrow" | "hideAfter">> | undefined;
|
|
65
65
|
selectable?: ((row: any, index: number) => boolean) | undefined;
|
|
66
66
|
reserveSelection?: boolean | undefined;
|
|
67
67
|
filterMethod?: import("element-plus/es/components/table/src/table-column/defaults.mjs").FilterMethods<any> | undefined;
|
|
@@ -87,7 +87,7 @@ declare const TableColumn: import("vue").DefineComponent<{
|
|
|
87
87
|
resizable: boolean;
|
|
88
88
|
align: "left" | "right" | "center" | undefined;
|
|
89
89
|
sortable: string | boolean;
|
|
90
|
-
showOverflowTooltip: boolean | Partial<Pick<import("element-plus/es/components/tooltip/index.mjs").ElTooltipProps, "offset" | "transition" | "enterable" | "appendTo" | "placement" | "
|
|
90
|
+
showOverflowTooltip: boolean | Partial<Pick<import("element-plus/es/components/tooltip/index.mjs").ElTooltipProps, "offset" | "transition" | "enterable" | "appendTo" | "placement" | "showAfter" | "effect" | "popperClass" | "popperOptions" | "showArrow" | "hideAfter">> | undefined;
|
|
91
91
|
reserveSelection: boolean;
|
|
92
92
|
filterMultiple: boolean;
|
|
93
93
|
sortOrders: ("ascending" | "descending" | null)[];
|
|
@@ -71,7 +71,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
|
|
|
71
71
|
class: `${unref(prefixCls)}-item-holder`
|
|
72
72
|
}), [createVNode(unref(_Icon), {
|
|
73
73
|
name: "co:draggable",
|
|
74
|
-
size: "
|
|
74
|
+
size: "lg"
|
|
75
75
|
})], 16
|
|
76
76
|
/* FULL_PROPS */)) : createCommentVNode("v-if", true), createElementVNode("div", {
|
|
77
77
|
class: normalizeClass(`${unref(prefixCls)}-item-label`)
|
|
@@ -3,7 +3,7 @@ export interface ComponentToken {
|
|
|
3
3
|
}
|
|
4
4
|
export interface TableColumnEditorToken extends FullToken<'TableColumnEditor'> {
|
|
5
5
|
}
|
|
6
|
-
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string,
|
|
6
|
+
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string, themeManager?: import("../../../theme/theme-context").ThemeManager) => {
|
|
7
7
|
hashId: import("vue").Ref<string, string>;
|
|
8
8
|
};
|
|
9
9
|
export default _default;
|
|
@@ -3,7 +3,7 @@ export interface ComponentToken {
|
|
|
3
3
|
}
|
|
4
4
|
export interface TableExportToken extends FullToken<'TableExport'> {
|
|
5
5
|
}
|
|
6
|
-
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string,
|
|
6
|
+
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string, themeManager?: import("../../../theme/theme-context").ThemeManager) => {
|
|
7
7
|
hashId: import("vue").Ref<string, string>;
|
|
8
8
|
};
|
|
9
9
|
export default _default;
|
|
@@ -3,7 +3,7 @@ export interface ComponentToken {
|
|
|
3
3
|
}
|
|
4
4
|
export interface TableActionToken extends FullToken<'TableAction'> {
|
|
5
5
|
}
|
|
6
|
-
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string,
|
|
6
|
+
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string, themeManager?: import("../../theme/theme-context").ThemeManager) => {
|
|
7
7
|
hashId: import("vue").Ref<string, string>;
|
|
8
8
|
};
|
|
9
9
|
export default _default;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ComputedRef } from 'vue';
|
|
2
1
|
import type { CSSInterpolation } from '../cssinjs';
|
|
3
2
|
import type { AliasToken } from './interface';
|
|
4
|
-
import {
|
|
5
|
-
export declare function getGlobalStyleHook(component: string, styleFn: (token: AliasToken) => CSSInterpolation): (
|
|
3
|
+
import { ThemeManager } from './theme-context';
|
|
4
|
+
export declare function getGlobalStyleHook(component: string, styleFn: (token: AliasToken) => CSSInterpolation): (themeManager?: ThemeManager) => void;
|
|
@@ -8,16 +8,11 @@ import { isClient } from '../../utils/env.js';
|
|
|
8
8
|
|
|
9
9
|
const oldGlobalClass = /* @__PURE__ */ new Set();
|
|
10
10
|
function getGlobalStyleHook(component, styleFn) {
|
|
11
|
-
return (
|
|
12
|
-
const { token, hashId } = useToken(
|
|
11
|
+
return (themeManager) => {
|
|
12
|
+
const { token, hashId } = useToken(themeManager);
|
|
13
13
|
const configContext = useConfig();
|
|
14
14
|
useStyleRegister(
|
|
15
|
-
computed(() =>
|
|
16
|
-
path: [component],
|
|
17
|
-
token: token.value,
|
|
18
|
-
hashId: hashId.value,
|
|
19
|
-
global: true
|
|
20
|
-
})),
|
|
15
|
+
computed(() => ["__global", component]),
|
|
21
16
|
() => {
|
|
22
17
|
const cssVar = tokenValueToCssVar(token.value, configContext.prefixCls.value);
|
|
23
18
|
return styleFn(cssVar);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type CSSInterpolation } from '../cssinjs';
|
|
2
|
+
import type { AliasToken, TokenWithCommonCls } from './interface';
|
|
3
|
+
import { ThemeManager } from './theme-context';
|
|
4
|
+
export type AliasTokenWithCommonCls = TokenWithCommonCls<AliasToken>;
|
|
5
|
+
export declare function getOverrideStyleHook(component: string, styleFn: (token: AliasTokenWithCommonCls) => CSSInterpolation): (_themeManager?: ThemeManager) => {
|
|
6
|
+
readonly token: import("vue").ComputedRef<import("./interface").GlobalToken>;
|
|
7
|
+
readonly hashId: import("vue").Ref<string, string>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { watch } from 'vue';
|
|
2
|
+
import { parseStyle } from '../cssinjs/parser.js';
|
|
3
|
+
import { useToken } from './util/useToken.js';
|
|
4
|
+
import { tokenValueToCssVar } from './util/tokenValueToCssVar.js';
|
|
5
|
+
import { useConfig } from '../config-provider/config-provider.js';
|
|
6
|
+
import hash from '@emotion/hash';
|
|
7
|
+
import { normalizeStyle } from './util/normalizeStyle.js';
|
|
8
|
+
|
|
9
|
+
function getOverrideStyleHook(component, styleFn) {
|
|
10
|
+
const pathHash = hash(["__override", component].join("|"));
|
|
11
|
+
return (_themeManager) => {
|
|
12
|
+
const { token, hashId, themeManager } = useToken(_themeManager);
|
|
13
|
+
const configContext = useConfig();
|
|
14
|
+
watch(
|
|
15
|
+
hashId,
|
|
16
|
+
() => {
|
|
17
|
+
const cssVar = tokenValueToCssVar(token.value, configContext.prefixCls.value);
|
|
18
|
+
const styleInterpolation = styleFn({
|
|
19
|
+
...cssVar,
|
|
20
|
+
hashId: hashId.value,
|
|
21
|
+
componentCls: "",
|
|
22
|
+
prefixCls: ""
|
|
23
|
+
});
|
|
24
|
+
const [parsedStr] = parseStyle(styleInterpolation);
|
|
25
|
+
const styleStr = normalizeStyle(parsedStr);
|
|
26
|
+
themeManager.setOverrideStyle(styleStr, pathHash, hash([hashId.value, pathHash].join("|")));
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
immediate: true
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
return {
|
|
33
|
+
token,
|
|
34
|
+
hashId
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { getOverrideStyleHook };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ComputedRef } from 'vue';
|
|
2
2
|
import type { CSSInterpolation } from '../cssinjs';
|
|
3
3
|
import type { AliasToken, TokenWithCommonCls } from './interface';
|
|
4
|
-
import {
|
|
4
|
+
import { ThemeManager } from './theme-context';
|
|
5
5
|
export type AliasTokenWithCommonCls = TokenWithCommonCls<AliasToken>;
|
|
6
|
-
export declare function getSimpleStyleHook(component: string, styleFn: (token: AliasTokenWithCommonCls) => CSSInterpolation): (_prefixCls?: ComputedRef<string> | string,
|
|
6
|
+
export declare function getSimpleStyleHook(component: string, styleFn: (token: AliasTokenWithCommonCls) => CSSInterpolation): (_prefixCls?: ComputedRef<string> | string, themeManager?: ThemeManager) => {
|
|
7
7
|
hashId: import("vue").Ref<string, string>;
|
|
8
8
|
};
|
|
@@ -5,16 +5,12 @@ import { tokenValueToCssVar } from './util/tokenValueToCssVar.js';
|
|
|
5
5
|
import { useConfig } from '../config-provider/config-provider.js';
|
|
6
6
|
|
|
7
7
|
function getSimpleStyleHook(component, styleFn) {
|
|
8
|
-
return (_prefixCls = "",
|
|
8
|
+
return (_prefixCls = "", themeManager) => {
|
|
9
9
|
const prefixCls = computed(() => unref(_prefixCls));
|
|
10
|
-
const { token, hashId } = useToken(
|
|
10
|
+
const { token, hashId } = useToken(themeManager);
|
|
11
11
|
const configContext = useConfig();
|
|
12
12
|
useStyleRegister(
|
|
13
|
-
computed(() =>
|
|
14
|
-
path: [component, prefixCls.value],
|
|
15
|
-
token: token.value,
|
|
16
|
-
hashId: hashId.value
|
|
17
|
-
})),
|
|
13
|
+
computed(() => ["__simple", component, prefixCls.value]),
|
|
18
14
|
() => {
|
|
19
15
|
const componentCls = `.${prefixCls.value}`;
|
|
20
16
|
const cssVar = tokenValueToCssVar(token.value, configContext.prefixCls.value);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComputedRef } from 'vue';
|
|
2
2
|
import type { CSSInterpolation } from '../cssinjs';
|
|
3
3
|
import type { ComponentTokenMap, GlobalToken, TokenWithCommonCls } from './interface';
|
|
4
|
-
import {
|
|
4
|
+
import { ThemeManager } from './theme-context';
|
|
5
5
|
export type OverrideTokenWithoutDerivative = ComponentTokenMap;
|
|
6
6
|
export type OverrideComponent = keyof OverrideTokenWithoutDerivative;
|
|
7
7
|
export type GlobalTokenWithComponent<ComponentName extends OverrideComponent> = GlobalToken & ComponentTokenMap[ComponentName];
|
|
@@ -11,6 +11,6 @@ export interface StyleInfo<ComponentName extends OverrideComponent> {
|
|
|
11
11
|
overrideComponentToken: ComponentTokenMap[ComponentName];
|
|
12
12
|
}
|
|
13
13
|
export type FullToken<ComponentName extends OverrideComponent> = TokenWithCommonCls<GlobalTokenWithComponent<ComponentName>>;
|
|
14
|
-
export declare function getStyleHook<ComponentName extends OverrideComponent>(component: ComponentName, styleFn: (token: FullToken<ComponentName>, info: StyleInfo<ComponentName>) => CSSInterpolation, getDefaultToken?: OverrideTokenWithoutDerivative[ComponentName] | ((token: GlobalToken) => OverrideTokenWithoutDerivative[ComponentName])): (_prefixCls?: ComputedRef<string> | string,
|
|
14
|
+
export declare function getStyleHook<ComponentName extends OverrideComponent>(component: ComponentName, styleFn: (token: FullToken<ComponentName>, info: StyleInfo<ComponentName>) => CSSInterpolation, getDefaultToken?: OverrideTokenWithoutDerivative[ComponentName] | ((token: GlobalToken) => OverrideTokenWithoutDerivative[ComponentName])): (_prefixCls?: ComputedRef<string> | string, themeManager?: ThemeManager) => {
|
|
15
15
|
hashId: import("vue").Ref<string, string>;
|
|
16
16
|
};
|
|
@@ -5,16 +5,12 @@ import { tokenValueToCssVar } from './util/tokenValueToCssVar.js';
|
|
|
5
5
|
import { useConfig } from '../config-provider/config-provider.js';
|
|
6
6
|
|
|
7
7
|
function getStyleHook(component, styleFn, getDefaultToken) {
|
|
8
|
-
return (_prefixCls = "",
|
|
8
|
+
return (_prefixCls = "", themeManager) => {
|
|
9
9
|
const prefixCls = computed(() => unref(_prefixCls));
|
|
10
|
-
const { token, hashId } = useToken(
|
|
10
|
+
const { token, hashId } = useToken(themeManager);
|
|
11
11
|
const configContext = useConfig();
|
|
12
12
|
useStyleRegister(
|
|
13
|
-
computed(() =>
|
|
14
|
-
path: [component, prefixCls.value],
|
|
15
|
-
token: token.value,
|
|
16
|
-
hashId: hashId.value
|
|
17
|
-
})),
|
|
13
|
+
computed(() => ["__default", component, prefixCls.value]),
|
|
18
14
|
() => {
|
|
19
15
|
const componentCls = `.${prefixCls.value}`;
|
|
20
16
|
const defaultComponentToken = typeof getDefaultToken === "function" ? getDefaultToken(token.value) : getDefaultToken;
|
|
@@ -11,6 +11,7 @@ import { getSimpleStyleHook } from './getSimpleStyleHook';
|
|
|
11
11
|
import { useThemeProvide, type ThemeConfig } from './theme-context';
|
|
12
12
|
import { extractCacheStyle, extractStyle } from './extractStyle';
|
|
13
13
|
import { StyleCache, StyleProvider } from './StyleContext';
|
|
14
|
+
import { getOverrideStyleHook } from './getOverrideStyleHook';
|
|
14
15
|
type GenerateStyle<ComponentToken extends object = AliasToken, ReturnType = CSSInterpolation> = (token: ComponentToken) => ReturnType;
|
|
15
|
-
export { seedToken, useToken, defaultAlgorithm, darkAlgorithm, compactAlgorithm, getStyleHook, getSimpleStyleHook, getGlobalStyleHook, useThemeProvide, defaultGenerateColorPalettes, darkGenerateColorPalettes, extractStyle, extractCacheStyle, StyleCache, StyleProvider, };
|
|
16
|
+
export { seedToken, useToken, defaultAlgorithm, darkAlgorithm, compactAlgorithm, getStyleHook, getSimpleStyleHook, getGlobalStyleHook, getOverrideStyleHook, useThemeProvide, defaultGenerateColorPalettes, darkGenerateColorPalettes, extractStyle, extractCacheStyle, StyleCache, StyleProvider, };
|
|
16
17
|
export type { SeedToken, MapToken, AliasToken, GlobalToken, GenerateStyle, FullToken, ThemeConfig, ComponentTokenMap, TokenWithCommonCls, };
|
|
@@ -9,5 +9,6 @@ export { getSimpleStyleHook } from './getSimpleStyleHook.js';
|
|
|
9
9
|
export { useThemeProvide } from './theme-context.js';
|
|
10
10
|
export { extractCacheStyle, extractStyle } from './extractStyle.js';
|
|
11
11
|
export { StyleCache, StyleProvider } from './StyleContext.js';
|
|
12
|
+
export { getOverrideStyleHook } from './getOverrideStyleHook.js';
|
|
12
13
|
export { generateColorPalettes as darkGenerateColorPalettes } from './themes/dark/colors.js';
|
|
13
14
|
export { generateColorPalettes as defaultGenerateColorPalettes } from './themes/default/colors.js';
|
|
@@ -8,6 +8,15 @@ export interface ThemeConfig {
|
|
|
8
8
|
algorithm?: MappingAlgorithm | MappingAlgorithm[];
|
|
9
9
|
inherit?: boolean;
|
|
10
10
|
}
|
|
11
|
+
export declare class ThemeManager {
|
|
12
|
+
theme?: ComputedRef<ThemeConfig | undefined>;
|
|
13
|
+
overrideStyles: Record<string, HTMLStyleElement | null | undefined>;
|
|
14
|
+
style: HTMLStyleElement | null | undefined;
|
|
15
|
+
constructor(theme?: ComputedRef<ThemeConfig | undefined>);
|
|
16
|
+
setStyle(styleStr: string, hashId: string): void;
|
|
17
|
+
setOverrideStyle(styleStr: string, pathHash: string, hashId: string): void;
|
|
18
|
+
destroy(): void;
|
|
19
|
+
}
|
|
11
20
|
export type ThemeContext = ComputedRef<ThemeConfig | undefined>;
|
|
12
|
-
export declare const useThemeProvide: (
|
|
13
|
-
export declare const useTheme: () =>
|
|
21
|
+
export declare const useThemeProvide: (themeManager: ThemeManager) => void;
|
|
22
|
+
export declare const useTheme: (themeManager?: ThemeManager) => ThemeManager;
|
|
@@ -1,11 +1,41 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { inject, provide } from 'vue';
|
|
2
|
+
import { updateCSSByStyle } from '../../utils/dynamicCSS.js';
|
|
2
3
|
|
|
4
|
+
class ThemeManager {
|
|
5
|
+
theme;
|
|
6
|
+
overrideStyles = {};
|
|
7
|
+
style = null;
|
|
8
|
+
constructor(theme) {
|
|
9
|
+
this.theme = theme;
|
|
10
|
+
}
|
|
11
|
+
setStyle(styleStr, hashId) {
|
|
12
|
+
this.style = updateCSSByStyle(this.style, styleStr, hashId);
|
|
13
|
+
}
|
|
14
|
+
setOverrideStyle(styleStr, pathHash, hashId) {
|
|
15
|
+
this.overrideStyles[pathHash] = updateCSSByStyle(
|
|
16
|
+
this.overrideStyles[pathHash],
|
|
17
|
+
styleStr,
|
|
18
|
+
hashId
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
destroy() {
|
|
22
|
+
this.style?.remove();
|
|
23
|
+
Object.values(this.overrideStyles).forEach((style) => {
|
|
24
|
+
style?.remove();
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
3
28
|
const themeContextKey = Symbol("themeContext");
|
|
4
|
-
const useThemeProvide = (
|
|
5
|
-
provide(themeContextKey,
|
|
29
|
+
const useThemeProvide = (themeManager) => {
|
|
30
|
+
provide(themeContextKey, themeManager);
|
|
6
31
|
};
|
|
7
|
-
|
|
8
|
-
|
|
32
|
+
let defaultTheme = void 0;
|
|
33
|
+
const useTheme = (themeManager) => {
|
|
34
|
+
let mergedThemeManager = themeManager || inject(themeContextKey, defaultTheme);
|
|
35
|
+
if (!mergedThemeManager) {
|
|
36
|
+
mergedThemeManager = defaultTheme = new ThemeManager();
|
|
37
|
+
}
|
|
38
|
+
return mergedThemeManager;
|
|
9
39
|
};
|
|
10
40
|
|
|
11
|
-
export { useTheme, useThemeProvide };
|
|
41
|
+
export { ThemeManager, useTheme, useThemeProvide };
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import { ComputedRef } from 'vue';
|
|
2
2
|
import { type CSSInterpolation } from '../cssinjs';
|
|
3
|
-
|
|
4
|
-
export declare function useStyleRegister(info: ComputedRef<{
|
|
5
|
-
path: string[];
|
|
6
|
-
token: GlobalToken;
|
|
7
|
-
hashId: string;
|
|
8
|
-
global?: boolean;
|
|
9
|
-
}>, styleFn: () => CSSInterpolation): void;
|
|
3
|
+
export declare function useStyleRegister(path: ComputedRef<string[]>, styleFn: () => CSSInterpolation): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, watch } from 'vue';
|
|
1
|
+
import { computed, unref, watch } from 'vue';
|
|
2
2
|
import { parseStyle } from '../cssinjs/parser.js';
|
|
3
3
|
import hash from '@emotion/hash';
|
|
4
4
|
import { normalizeStyle } from './util/normalizeStyle.js';
|
|
@@ -6,8 +6,8 @@ import stdin_default from './useHMR.js';
|
|
|
6
6
|
import { useStyleInection } from './StyleContext.js';
|
|
7
7
|
import { updateCSS } from '../../utils/dynamicCSS.js';
|
|
8
8
|
|
|
9
|
-
function useStyleRegister(
|
|
10
|
-
const pathHash = computed(() => hash(
|
|
9
|
+
function useStyleRegister(path, styleFn) {
|
|
10
|
+
const pathHash = computed(() => hash(unref(path).filter(Boolean).join("|")));
|
|
11
11
|
const HMRUpdate = stdin_default();
|
|
12
12
|
const { cache } = useStyleInection();
|
|
13
13
|
watch(
|
|
@@ -16,7 +16,6 @@ function useStyleRegister(info, styleFn) {
|
|
|
16
16
|
if (!cache.has(pathHash.value) || HMRUpdate.value) {
|
|
17
17
|
const styleInterpolation = styleFn();
|
|
18
18
|
const [parsedStr, effectStyle] = parseStyle(styleInterpolation, {
|
|
19
|
-
// hashId: info.value.global ? '' : info.value.hashId,
|
|
20
19
|
// hashPriority: 'low',
|
|
21
20
|
});
|
|
22
21
|
const styleStr = normalizeStyle(parsedStr);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type ThemeConfig } from '../theme-context';
|
|
1
|
+
import { ThemeManager } from '../theme-context';
|
|
3
2
|
import type { AliasToken } from '../interface';
|
|
4
3
|
export declare const cacheToken: {
|
|
5
4
|
cache: [token: Partial<AliasToken> | undefined, algorithm: import("../theme-context").MappingAlgorithm | import("../theme-context").MappingAlgorithm[] | undefined, components: import("../interface").OverrideToken | undefined, token: import("..").GlobalToken][];
|
|
6
5
|
getToken(token?: Partial<AliasToken>, algorithm?: import("../theme-context").MappingAlgorithm | import("../theme-context").MappingAlgorithm[], components?: import("../interface").OverrideToken): import("..").GlobalToken;
|
|
7
6
|
};
|
|
8
|
-
export declare function useToken(
|
|
9
|
-
readonly token: ComputedRef<import("..").GlobalToken>;
|
|
7
|
+
export declare function useToken(themeManager?: ThemeManager): {
|
|
8
|
+
readonly token: import("vue").ComputedRef<import("..").GlobalToken>;
|
|
10
9
|
readonly hashId: import("vue").Ref<string, string>;
|
|
10
|
+
readonly themeManager: ThemeManager;
|
|
11
11
|
};
|
|
@@ -7,7 +7,6 @@ import stdin_default from './unitless.js';
|
|
|
7
7
|
import { normalizeStyle } from './normalizeStyle.js';
|
|
8
8
|
import { useStyleInection } from '../StyleContext.js';
|
|
9
9
|
import { useConfig } from '../../config-provider/config-provider.js';
|
|
10
|
-
import { updateCSS } from '../../../utils/dynamicCSS.js';
|
|
11
10
|
|
|
12
11
|
function stringifyToken(token) {
|
|
13
12
|
return Object.keys(token).map((key) => {
|
|
@@ -26,10 +25,10 @@ function stringifyTokenToCssVar(token, prefix) {
|
|
|
26
25
|
return styleStr;
|
|
27
26
|
}
|
|
28
27
|
const cacheToken = createCacheToken();
|
|
29
|
-
function useToken(
|
|
30
|
-
|
|
28
|
+
function useToken(themeManager) {
|
|
29
|
+
themeManager = useTheme(themeManager);
|
|
31
30
|
const token = computed(() => {
|
|
32
|
-
const { token: token2, algorithm, components } = unref(theme
|
|
31
|
+
const { token: token2, algorithm, components } = unref(themeManager?.theme) || {};
|
|
33
32
|
return cacheToken.getToken(token2, algorithm, components);
|
|
34
33
|
});
|
|
35
34
|
const hashId = ref("");
|
|
@@ -50,7 +49,7 @@ function useToken(theme) {
|
|
|
50
49
|
}
|
|
51
50
|
let styleStr = stringifyTokenToCssVar(token.value, configContext.prefixCls.value);
|
|
52
51
|
styleStr = normalizeStyle(`.${hashId.value}{${styleStr}}`);
|
|
53
|
-
|
|
52
|
+
themeManager.setStyle(styleStr, hashId.value);
|
|
54
53
|
cache.set(hashId.value, styleStr);
|
|
55
54
|
},
|
|
56
55
|
{
|
|
@@ -59,7 +58,8 @@ function useToken(theme) {
|
|
|
59
58
|
);
|
|
60
59
|
return {
|
|
61
60
|
token,
|
|
62
|
-
hashId
|
|
61
|
+
hashId,
|
|
62
|
+
themeManager
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string,
|
|
1
|
+
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string, themeManager?: import("../../theme/theme-context").ThemeManager) => {
|
|
2
2
|
hashId: import("vue").Ref<string, string>;
|
|
3
3
|
};
|
|
4
4
|
export default _default;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from './transition-group';
|
|
2
2
|
declare const _TransitionGroup: {
|
|
3
3
|
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("./transition-group").TransitionGroupProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
|
|
4
|
-
effect: "slide" | "flip" | "fade" | (string & {});
|
|
5
4
|
css: boolean;
|
|
5
|
+
effect: "slide" | "flip" | "fade" | (string & {});
|
|
6
6
|
}, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
7
7
|
P: {};
|
|
8
8
|
B: {};
|
|
@@ -11,15 +11,15 @@ declare const _TransitionGroup: {
|
|
|
11
11
|
M: {};
|
|
12
12
|
Defaults: {};
|
|
13
13
|
}, Readonly<import("./transition-group").TransitionGroupProps> & Readonly<{}>, {}, {}, {}, {}, {
|
|
14
|
-
effect: "slide" | "flip" | "fade" | (string & {});
|
|
15
14
|
css: boolean;
|
|
15
|
+
effect: "slide" | "flip" | "fade" | (string & {});
|
|
16
16
|
}>;
|
|
17
17
|
__isFragment?: never;
|
|
18
18
|
__isTeleport?: never;
|
|
19
19
|
__isSuspense?: never;
|
|
20
20
|
} & import("vue").ComponentOptionsBase<Readonly<import("./transition-group").TransitionGroupProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
21
|
-
effect: "slide" | "flip" | "fade" | (string & {});
|
|
22
21
|
css: boolean;
|
|
22
|
+
effect: "slide" | "flip" | "fade" | (string & {});
|
|
23
23
|
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
24
24
|
$slots: import("./transition-group").TransitionGroupSlots;
|
|
25
25
|
}) & import("vue").Plugin;
|
|
@@ -3,7 +3,7 @@ export interface ComponentToken {
|
|
|
3
3
|
}
|
|
4
4
|
export interface TransitionGroupToken extends FullToken<'TransitionGroup'> {
|
|
5
5
|
}
|
|
6
|
-
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string,
|
|
6
|
+
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string, themeManager?: import("../../theme/theme-context").ThemeManager) => {
|
|
7
7
|
hashId: import("vue").Ref<string, string>;
|
|
8
8
|
};
|
|
9
9
|
export default _default;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type TransitionGroupProps, type TransitionGroupSlots } from './transition-group';
|
|
2
2
|
type __VLS_Slots = TransitionGroupSlots;
|
|
3
3
|
declare const __VLS_component: import("vue").DefineComponent<TransitionGroupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TransitionGroupProps> & Readonly<{}>, {
|
|
4
|
-
effect: "slide" | "flip" | "fade" | (string & {});
|
|
5
4
|
css: boolean;
|
|
5
|
+
effect: "slide" | "flip" | "fade" | (string & {});
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
8
8
|
export default _default;
|
|
@@ -14,7 +14,6 @@ declare const _Upload: {
|
|
|
14
14
|
accept: string;
|
|
15
15
|
validateEvent: boolean;
|
|
16
16
|
limit: number;
|
|
17
|
-
action: string;
|
|
18
17
|
}, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
19
18
|
P: {};
|
|
20
19
|
B: {};
|
|
@@ -31,7 +30,6 @@ declare const _Upload: {
|
|
|
31
30
|
accept: string;
|
|
32
31
|
validateEvent: boolean;
|
|
33
32
|
limit: number;
|
|
34
|
-
action: string;
|
|
35
33
|
}>;
|
|
36
34
|
__isFragment?: never;
|
|
37
35
|
__isTeleport?: never;
|
|
@@ -49,7 +47,6 @@ declare const _Upload: {
|
|
|
49
47
|
accept: string;
|
|
50
48
|
validateEvent: boolean;
|
|
51
49
|
limit: number;
|
|
52
|
-
action: string;
|
|
53
50
|
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
54
51
|
$slots: import("./upload").UploadSlots;
|
|
55
52
|
}) & import("vue").Plugin;
|
|
@@ -3,7 +3,7 @@ export interface ComponentToken {
|
|
|
3
3
|
}
|
|
4
4
|
export interface UploadToken extends FullToken<'Upload'> {
|
|
5
5
|
}
|
|
6
|
-
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string,
|
|
6
|
+
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string, themeManager?: import("../../theme/theme-context").ThemeManager) => {
|
|
7
7
|
hashId: import("vue").Ref<string, string>;
|
|
8
8
|
};
|
|
9
9
|
export default _default;
|
|
@@ -22,7 +22,6 @@ export interface UploadProps {
|
|
|
22
22
|
single?: boolean;
|
|
23
23
|
readonly?: boolean;
|
|
24
24
|
disabled?: boolean;
|
|
25
|
-
action?: string;
|
|
26
25
|
selectOnly?: boolean;
|
|
27
26
|
size?: MediaCardBaseProps['size'];
|
|
28
27
|
request?: UploadContext['request'];
|
|
@@ -31,7 +30,6 @@ export declare const defaultUploadProps: {
|
|
|
31
30
|
accept: string;
|
|
32
31
|
limit: number;
|
|
33
32
|
validateEvent: boolean;
|
|
34
|
-
action: string;
|
|
35
33
|
size: "large";
|
|
36
34
|
};
|
|
37
35
|
export interface UploadSlots {
|
|
@@ -13,7 +13,6 @@ declare const __VLS_component: import("vue").DefineComponent<UploadProps, {}, {}
|
|
|
13
13
|
accept: string;
|
|
14
14
|
validateEvent: boolean;
|
|
15
15
|
limit: number;
|
|
16
|
-
action: string;
|
|
17
16
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
17
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
19
18
|
export default _default;
|
|
@@ -3,7 +3,7 @@ export interface ComponentToken {
|
|
|
3
3
|
}
|
|
4
4
|
export interface VideoCardToken extends FullToken<'VideoCard'> {
|
|
5
5
|
}
|
|
6
|
-
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string,
|
|
6
|
+
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string, themeManager?: import("../../theme/theme-context").ThemeManager) => {
|
|
7
7
|
hashId: import("vue").Ref<string, string>;
|
|
8
8
|
};
|
|
9
9
|
export default _default;
|
|
@@ -91,7 +91,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
|
|
|
91
91
|
}, null, 10, _hoisted_2), createElementVNode("div", {
|
|
92
92
|
class: normalizeClass(`${unref(prefixCls)}-play-mask`)
|
|
93
93
|
}, [createVNode(stdin_default$2, {
|
|
94
|
-
name: "co:play-
|
|
94
|
+
name: "co:play-circle-outline",
|
|
95
95
|
class: normalizeClass(`${unref(prefixCls)}-play-icon`)
|
|
96
96
|
}, null, 8, ["class"])], 2
|
|
97
97
|
/* CLASS */)], 16, _hoisted_1), viewerVisible.value ? (openBlock(), createBlock(stdin_default$3, {
|
|
@@ -3,7 +3,7 @@ export interface ComponentToken {
|
|
|
3
3
|
}
|
|
4
4
|
export interface VideoViewerToken extends FullToken<'VideoViewer'> {
|
|
5
5
|
}
|
|
6
|
-
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string,
|
|
6
|
+
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string, themeManager?: import("../../theme/theme-context").ThemeManager) => {
|
|
7
7
|
hashId: import("vue").Ref<string, string>;
|
|
8
8
|
};
|
|
9
9
|
export default _default;
|