@kine-design/core 0.0.1-beta.11 → 0.0.1-beta.13
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/base/image/__tests__/useImage.test.ts +61 -0
- package/components/base/image/api.ts +2 -2
- package/components/base/image/index.ts +2 -2
- package/components/base/image/props.d.ts +15 -4
- package/components/base/image/useImage.ts +27 -16
- package/components/base/tooltip/api.ts +3 -2
- package/components/base/tooltip/index.ts +3 -2
- package/components/base/tooltip/props.d.ts +12 -6
- package/components/base/tooltip/useTooltip.ts +175 -56
- package/compositions/commandPalette/index.ts +11 -0
- package/compositions/commandPalette/types.ts +29 -0
- package/compositions/commandPalette/useCommandPalette.ts +135 -0
- package/compositions/contextMenu/index.ts +10 -0
- package/compositions/contextMenu/types.ts +21 -0
- package/compositions/contextMenu/useContextMenu.ts +101 -0
- package/compositions/editor/index.ts +18 -0
- package/compositions/editor/types.ts +147 -0
- package/compositions/editor/useEditor.ts +224 -0
- package/compositions/index.ts +15 -0
- package/compositions/overlay/index.ts +14 -0
- package/compositions/overlay/useOverlayStack.ts +146 -0
- package/compositions/peekView/index.ts +10 -0
- package/compositions/peekView/usePeekView.ts +99 -0
- package/compositions/theme/index.ts +17 -0
- package/compositions/theme/presets/compact.ts +117 -0
- package/compositions/theme/presets/dark.ts +113 -0
- package/compositions/theme/presets/index.ts +11 -0
- package/compositions/theme/presets/light.ts +113 -0
- package/compositions/theme/types.ts +46 -0
- package/compositions/theme/useTheme.ts +269 -0
- package/compositions/toast/index.ts +10 -0
- package/compositions/toast/useToast.ts +176 -0
- package/compositions/tooltip/index.ts +9 -0
- package/compositions/tooltip/useTooltip.ts +10 -0
- package/dist/components/base/image/index.d.ts +2 -2
- package/dist/components/base/image/useImage.d.ts +7 -0
- package/dist/components/base/tooltip/index.d.ts +1 -0
- package/dist/components/base/tooltip/useTooltip.d.ts +20 -17
- package/dist/compositions/commandPalette/index.d.ts +11 -0
- package/dist/compositions/commandPalette/types.d.ts +20 -0
- package/dist/compositions/commandPalette/useCommandPalette.d.ts +32 -0
- package/dist/compositions/contextMenu/index.d.ts +10 -0
- package/dist/compositions/contextMenu/types.d.ts +12 -0
- package/dist/compositions/contextMenu/useContextMenu.d.ts +52 -0
- package/dist/compositions/editor/index.d.ts +10 -0
- package/dist/compositions/editor/types.d.ts +132 -0
- package/dist/compositions/editor/useEditor.d.ts +13 -0
- package/dist/compositions/index.d.ts +15 -0
- package/dist/compositions/overlay/index.d.ts +10 -0
- package/dist/compositions/overlay/useOverlayStack.d.ts +188 -0
- package/dist/compositions/peekView/index.d.ts +10 -0
- package/dist/compositions/peekView/usePeekView.d.ts +16 -0
- package/dist/compositions/theme/index.d.ts +11 -0
- package/dist/compositions/theme/presets/compact.d.ts +6 -0
- package/dist/compositions/theme/presets/dark.d.ts +2 -0
- package/dist/compositions/theme/presets/index.d.ts +11 -0
- package/dist/compositions/theme/presets/light.d.ts +2 -0
- package/dist/compositions/theme/types.d.ts +41 -0
- package/dist/compositions/theme/useTheme.d.ts +167 -0
- package/dist/compositions/toast/index.d.ts +10 -0
- package/dist/compositions/toast/useToast.d.ts +71 -0
- package/dist/compositions/tooltip/index.d.ts +9 -0
- package/dist/compositions/tooltip/useTooltip.d.ts +10 -0
- package/dist/core.js +836 -56
- package/dist/index.d.ts +1 -0
- package/index.ts +2 -0
- package/package.json +13 -2
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { ThemeDefinition, ThemeTokenCategory, ThemeTokens } from './types';
|
|
2
|
+
export declare const useThemeStore: import('pinia').StoreDefinition<"kine-theme", Pick<{
|
|
3
|
+
currentThemeId: import('vue').Ref<string, string>;
|
|
4
|
+
themes: import('vue').Ref<Map<string, {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
description?: string | undefined;
|
|
8
|
+
tokens: {
|
|
9
|
+
color?: Record<string, string> | undefined;
|
|
10
|
+
spacing?: Record<string, string> | undefined;
|
|
11
|
+
radius?: Record<string, string> | undefined;
|
|
12
|
+
font?: Record<string, string> | undefined;
|
|
13
|
+
shadow?: Record<string, string> | undefined;
|
|
14
|
+
motion?: Record<string, string> | undefined;
|
|
15
|
+
interaction?: Record<string, string> | undefined;
|
|
16
|
+
};
|
|
17
|
+
}> & Omit<Map<string, ThemeDefinition>, keyof Map<any, any>>, Map<string, ThemeDefinition> | (Map<string, {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
description?: string | undefined;
|
|
21
|
+
tokens: {
|
|
22
|
+
color?: Record<string, string> | undefined;
|
|
23
|
+
spacing?: Record<string, string> | undefined;
|
|
24
|
+
radius?: Record<string, string> | undefined;
|
|
25
|
+
font?: Record<string, string> | undefined;
|
|
26
|
+
shadow?: Record<string, string> | undefined;
|
|
27
|
+
motion?: Record<string, string> | undefined;
|
|
28
|
+
interaction?: Record<string, string> | undefined;
|
|
29
|
+
};
|
|
30
|
+
}> & Omit<Map<string, ThemeDefinition>, keyof Map<any, any>>)>;
|
|
31
|
+
overrides: import('vue').Ref<{
|
|
32
|
+
color?: Record<string, string> | undefined;
|
|
33
|
+
spacing?: Record<string, string> | undefined;
|
|
34
|
+
radius?: Record<string, string> | undefined;
|
|
35
|
+
font?: Record<string, string> | undefined;
|
|
36
|
+
shadow?: Record<string, string> | undefined;
|
|
37
|
+
motion?: Record<string, string> | undefined;
|
|
38
|
+
interaction?: Record<string, string> | undefined;
|
|
39
|
+
}, Partial<ThemeTokens> | {
|
|
40
|
+
color?: Record<string, string> | undefined;
|
|
41
|
+
spacing?: Record<string, string> | undefined;
|
|
42
|
+
radius?: Record<string, string> | undefined;
|
|
43
|
+
font?: Record<string, string> | undefined;
|
|
44
|
+
shadow?: Record<string, string> | undefined;
|
|
45
|
+
motion?: Record<string, string> | undefined;
|
|
46
|
+
interaction?: Record<string, string> | undefined;
|
|
47
|
+
}>;
|
|
48
|
+
currentTheme: import('vue').ComputedRef<ThemeDefinition | undefined>;
|
|
49
|
+
resolvedTokens: import('vue').ComputedRef<Partial<ThemeTokens>>;
|
|
50
|
+
isDark: import('vue').ComputedRef<boolean>;
|
|
51
|
+
themeList: import('vue').ComputedRef<ThemeDefinition[]>;
|
|
52
|
+
registerTheme: (definition: ThemeDefinition) => void;
|
|
53
|
+
setTheme: (id: string) => void;
|
|
54
|
+
setTokenOverride: (category: ThemeTokenCategory, key: string, value: string) => void;
|
|
55
|
+
resetOverrides: () => void;
|
|
56
|
+
init: () => void;
|
|
57
|
+
}, "currentThemeId" | "themes" | "overrides">, Pick<{
|
|
58
|
+
currentThemeId: import('vue').Ref<string, string>;
|
|
59
|
+
themes: import('vue').Ref<Map<string, {
|
|
60
|
+
id: string;
|
|
61
|
+
name: string;
|
|
62
|
+
description?: string | undefined;
|
|
63
|
+
tokens: {
|
|
64
|
+
color?: Record<string, string> | undefined;
|
|
65
|
+
spacing?: Record<string, string> | undefined;
|
|
66
|
+
radius?: Record<string, string> | undefined;
|
|
67
|
+
font?: Record<string, string> | undefined;
|
|
68
|
+
shadow?: Record<string, string> | undefined;
|
|
69
|
+
motion?: Record<string, string> | undefined;
|
|
70
|
+
interaction?: Record<string, string> | undefined;
|
|
71
|
+
};
|
|
72
|
+
}> & Omit<Map<string, ThemeDefinition>, keyof Map<any, any>>, Map<string, ThemeDefinition> | (Map<string, {
|
|
73
|
+
id: string;
|
|
74
|
+
name: string;
|
|
75
|
+
description?: string | undefined;
|
|
76
|
+
tokens: {
|
|
77
|
+
color?: Record<string, string> | undefined;
|
|
78
|
+
spacing?: Record<string, string> | undefined;
|
|
79
|
+
radius?: Record<string, string> | undefined;
|
|
80
|
+
font?: Record<string, string> | undefined;
|
|
81
|
+
shadow?: Record<string, string> | undefined;
|
|
82
|
+
motion?: Record<string, string> | undefined;
|
|
83
|
+
interaction?: Record<string, string> | undefined;
|
|
84
|
+
};
|
|
85
|
+
}> & Omit<Map<string, ThemeDefinition>, keyof Map<any, any>>)>;
|
|
86
|
+
overrides: import('vue').Ref<{
|
|
87
|
+
color?: Record<string, string> | undefined;
|
|
88
|
+
spacing?: Record<string, string> | undefined;
|
|
89
|
+
radius?: Record<string, string> | undefined;
|
|
90
|
+
font?: Record<string, string> | undefined;
|
|
91
|
+
shadow?: Record<string, string> | undefined;
|
|
92
|
+
motion?: Record<string, string> | undefined;
|
|
93
|
+
interaction?: Record<string, string> | undefined;
|
|
94
|
+
}, Partial<ThemeTokens> | {
|
|
95
|
+
color?: Record<string, string> | undefined;
|
|
96
|
+
spacing?: Record<string, string> | undefined;
|
|
97
|
+
radius?: Record<string, string> | undefined;
|
|
98
|
+
font?: Record<string, string> | undefined;
|
|
99
|
+
shadow?: Record<string, string> | undefined;
|
|
100
|
+
motion?: Record<string, string> | undefined;
|
|
101
|
+
interaction?: Record<string, string> | undefined;
|
|
102
|
+
}>;
|
|
103
|
+
currentTheme: import('vue').ComputedRef<ThemeDefinition | undefined>;
|
|
104
|
+
resolvedTokens: import('vue').ComputedRef<Partial<ThemeTokens>>;
|
|
105
|
+
isDark: import('vue').ComputedRef<boolean>;
|
|
106
|
+
themeList: import('vue').ComputedRef<ThemeDefinition[]>;
|
|
107
|
+
registerTheme: (definition: ThemeDefinition) => void;
|
|
108
|
+
setTheme: (id: string) => void;
|
|
109
|
+
setTokenOverride: (category: ThemeTokenCategory, key: string, value: string) => void;
|
|
110
|
+
resetOverrides: () => void;
|
|
111
|
+
init: () => void;
|
|
112
|
+
}, "currentTheme" | "resolvedTokens" | "isDark" | "themeList">, Pick<{
|
|
113
|
+
currentThemeId: import('vue').Ref<string, string>;
|
|
114
|
+
themes: import('vue').Ref<Map<string, {
|
|
115
|
+
id: string;
|
|
116
|
+
name: string;
|
|
117
|
+
description?: string | undefined;
|
|
118
|
+
tokens: {
|
|
119
|
+
color?: Record<string, string> | undefined;
|
|
120
|
+
spacing?: Record<string, string> | undefined;
|
|
121
|
+
radius?: Record<string, string> | undefined;
|
|
122
|
+
font?: Record<string, string> | undefined;
|
|
123
|
+
shadow?: Record<string, string> | undefined;
|
|
124
|
+
motion?: Record<string, string> | undefined;
|
|
125
|
+
interaction?: Record<string, string> | undefined;
|
|
126
|
+
};
|
|
127
|
+
}> & Omit<Map<string, ThemeDefinition>, keyof Map<any, any>>, Map<string, ThemeDefinition> | (Map<string, {
|
|
128
|
+
id: string;
|
|
129
|
+
name: string;
|
|
130
|
+
description?: string | undefined;
|
|
131
|
+
tokens: {
|
|
132
|
+
color?: Record<string, string> | undefined;
|
|
133
|
+
spacing?: Record<string, string> | undefined;
|
|
134
|
+
radius?: Record<string, string> | undefined;
|
|
135
|
+
font?: Record<string, string> | undefined;
|
|
136
|
+
shadow?: Record<string, string> | undefined;
|
|
137
|
+
motion?: Record<string, string> | undefined;
|
|
138
|
+
interaction?: Record<string, string> | undefined;
|
|
139
|
+
};
|
|
140
|
+
}> & Omit<Map<string, ThemeDefinition>, keyof Map<any, any>>)>;
|
|
141
|
+
overrides: import('vue').Ref<{
|
|
142
|
+
color?: Record<string, string> | undefined;
|
|
143
|
+
spacing?: Record<string, string> | undefined;
|
|
144
|
+
radius?: Record<string, string> | undefined;
|
|
145
|
+
font?: Record<string, string> | undefined;
|
|
146
|
+
shadow?: Record<string, string> | undefined;
|
|
147
|
+
motion?: Record<string, string> | undefined;
|
|
148
|
+
interaction?: Record<string, string> | undefined;
|
|
149
|
+
}, Partial<ThemeTokens> | {
|
|
150
|
+
color?: Record<string, string> | undefined;
|
|
151
|
+
spacing?: Record<string, string> | undefined;
|
|
152
|
+
radius?: Record<string, string> | undefined;
|
|
153
|
+
font?: Record<string, string> | undefined;
|
|
154
|
+
shadow?: Record<string, string> | undefined;
|
|
155
|
+
motion?: Record<string, string> | undefined;
|
|
156
|
+
interaction?: Record<string, string> | undefined;
|
|
157
|
+
}>;
|
|
158
|
+
currentTheme: import('vue').ComputedRef<ThemeDefinition | undefined>;
|
|
159
|
+
resolvedTokens: import('vue').ComputedRef<Partial<ThemeTokens>>;
|
|
160
|
+
isDark: import('vue').ComputedRef<boolean>;
|
|
161
|
+
themeList: import('vue').ComputedRef<ThemeDefinition[]>;
|
|
162
|
+
registerTheme: (definition: ThemeDefinition) => void;
|
|
163
|
+
setTheme: (id: string) => void;
|
|
164
|
+
setTokenOverride: (category: ThemeTokenCategory, key: string, value: string) => void;
|
|
165
|
+
resetOverrides: () => void;
|
|
166
|
+
init: () => void;
|
|
167
|
+
}, "init" | "registerTheme" | "setTheme" | "setTokenOverride" | "resetOverrides">>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description toast composition 导出
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/5/22
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
export { useToast } from './useToast';
|
|
10
|
+
export type { ToastType, ToastItem, ToastShowOptions, ToastPromiseOptions } from './useToast';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toast 类型
|
|
3
|
+
*/
|
|
4
|
+
export type ToastType = 'success' | 'error' | 'warning' | 'info' | 'loading';
|
|
5
|
+
/**
|
|
6
|
+
* Toast 队列中每一条 toast 的内部结构
|
|
7
|
+
*/
|
|
8
|
+
export interface ToastItem {
|
|
9
|
+
id: number;
|
|
10
|
+
type: ToastType;
|
|
11
|
+
title: string;
|
|
12
|
+
message?: string;
|
|
13
|
+
duration: number;
|
|
14
|
+
createdAt: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 创建 toast 时的配置参数
|
|
18
|
+
*/
|
|
19
|
+
export interface ToastShowOptions {
|
|
20
|
+
type?: ToastType;
|
|
21
|
+
title: string;
|
|
22
|
+
message?: string;
|
|
23
|
+
duration?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* promise() 方法的三阶段配置
|
|
27
|
+
*/
|
|
28
|
+
export interface ToastPromiseOptions<T> {
|
|
29
|
+
loading: string | {
|
|
30
|
+
title: string;
|
|
31
|
+
message?: string;
|
|
32
|
+
};
|
|
33
|
+
success: string | {
|
|
34
|
+
title: string;
|
|
35
|
+
message?: string;
|
|
36
|
+
} | ((data: T) => string | {
|
|
37
|
+
title: string;
|
|
38
|
+
message?: string;
|
|
39
|
+
});
|
|
40
|
+
error: string | {
|
|
41
|
+
title: string;
|
|
42
|
+
message?: string;
|
|
43
|
+
} | ((err: unknown) => string | {
|
|
44
|
+
title: string;
|
|
45
|
+
message?: string;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Toast 队列 composable
|
|
50
|
+
* 管理 toast 的增删、自动关闭定时器与 Promise 模式
|
|
51
|
+
*/
|
|
52
|
+
export declare function useToast(): {
|
|
53
|
+
toasts: import('vue').Ref<{
|
|
54
|
+
id: number;
|
|
55
|
+
type: ToastType;
|
|
56
|
+
title: string;
|
|
57
|
+
message?: string | undefined;
|
|
58
|
+
duration: number;
|
|
59
|
+
createdAt: number;
|
|
60
|
+
}[], ToastItem[] | {
|
|
61
|
+
id: number;
|
|
62
|
+
type: ToastType;
|
|
63
|
+
title: string;
|
|
64
|
+
message?: string | undefined;
|
|
65
|
+
duration: number;
|
|
66
|
+
createdAt: number;
|
|
67
|
+
}[]>;
|
|
68
|
+
show: (options: ToastShowOptions) => number;
|
|
69
|
+
dismiss: (id: number) => void;
|
|
70
|
+
promise: <T>(p: Promise<T>, options: ToastPromiseOptions<T>) => Promise<T>;
|
|
71
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description tooltip composable re-export from component layer
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/5/22
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
export { useTooltip } from '../../components/base/tooltip/useTooltip';
|
|
10
|
+
export type { TooltipPlacement, TooltipPositionData } from '../../components/base/tooltip/useTooltip';
|