@linyjs/ui-slots-interface 0.0.5 → 0.0.6
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/package.json +5 -1
- package/src/index.ts +0 -18
- package/src/types.ts +0 -87
- package/tsconfig.json +0 -18
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linyjs/ui-slots-interface",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "UI Slots interface definitions for Ling framework",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
8
12
|
"scripts": {
|
|
9
13
|
"build": "tsc",
|
|
10
14
|
"dev": "tsc --watch"
|
package/src/index.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @linyjs/ui-slots-interface
|
|
3
|
-
*
|
|
4
|
-
* UI Slots 接口定义包
|
|
5
|
-
*
|
|
6
|
-
* 提供了 UI 扩展点的标准接口,包括:
|
|
7
|
-
* - SlotPosition: Slot 位置类型
|
|
8
|
-
* - ISlotComponent: Slot 组件定义
|
|
9
|
-
* - ISlotRegistry: Slot 注册表接口
|
|
10
|
-
* - ISlotRenderer: Slot 渲染器接口
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
export type {
|
|
14
|
-
SlotPosition,
|
|
15
|
-
ISlotComponent,
|
|
16
|
-
ISlotRegistry,
|
|
17
|
-
ISlotRenderer,
|
|
18
|
-
} from './types.js';
|
package/src/types.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* UI Slots 接口定义
|
|
3
|
-
*
|
|
4
|
-
* 定义了 UI 扩展点的标准接口,供各个模块实现和使用
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { ReactNode } from 'react';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Slot 位置标识
|
|
11
|
-
*
|
|
12
|
-
* 预定义的 Slot 位置:
|
|
13
|
-
* - admin-sidebar: 管理后台侧边栏
|
|
14
|
-
* - admin-header: 管理后台顶部导航
|
|
15
|
-
* - admin-dashboard: 管理后台仪表盘
|
|
16
|
-
* - personal-dashboard: 个人后台仪表盘
|
|
17
|
-
* - plugin-marketplace: 插件市场
|
|
18
|
-
*
|
|
19
|
-
* 扩展包也可以自定义 Slot 位置
|
|
20
|
-
*/
|
|
21
|
-
export type SlotPosition =
|
|
22
|
-
| 'admin-sidebar'
|
|
23
|
-
| 'admin-header'
|
|
24
|
-
| 'admin-dashboard'
|
|
25
|
-
| 'admin-settings'
|
|
26
|
-
| 'admin-user-list'
|
|
27
|
-
| 'personal-dashboard'
|
|
28
|
-
| 'personal-header'
|
|
29
|
-
| 'plugin-marketplace'
|
|
30
|
-
| string; // 允许自定义 slot
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Slot 组件定义
|
|
34
|
-
*
|
|
35
|
-
* 扩展包通过注册 Slot 组件向 UI 注入自定义内容
|
|
36
|
-
*/
|
|
37
|
-
export interface ISlotComponent {
|
|
38
|
-
/** Slot 唯一标识(在同一 position 下必须唯一) */
|
|
39
|
-
id: string;
|
|
40
|
-
|
|
41
|
-
/** Slot 位置 */
|
|
42
|
-
position: SlotPosition;
|
|
43
|
-
|
|
44
|
-
/** 渲染的组件 */
|
|
45
|
-
component: ReactNode | (() => ReactNode);
|
|
46
|
-
|
|
47
|
-
/** 优先级(数字越大越靠前,默认为 0) */
|
|
48
|
-
priority?: number;
|
|
49
|
-
|
|
50
|
-
/** 来源扩展包名称(可选,用于调试和管理) */
|
|
51
|
-
packageName?: string;
|
|
52
|
-
|
|
53
|
-
/** 显示条件(可选,返回 false 则不渲染) */
|
|
54
|
-
shouldRender?: (context?: any) => boolean;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Slot 注册表接口
|
|
59
|
-
*
|
|
60
|
-
* 各个模块可以实现自己的 SlotRegistry
|
|
61
|
-
*/
|
|
62
|
-
export interface ISlotRegistry {
|
|
63
|
-
/** 注册 Slot 组件 */
|
|
64
|
-
register(slot: ISlotComponent): void;
|
|
65
|
-
|
|
66
|
-
/** 取消注册 */
|
|
67
|
-
unregister(slotId: string): void;
|
|
68
|
-
|
|
69
|
-
/** 获取指定位置的所有 Slot 组件(按优先级排序) */
|
|
70
|
-
getSlots(position: SlotPosition): ISlotComponent[];
|
|
71
|
-
|
|
72
|
-
/** 清空所有 Slot */
|
|
73
|
-
clear(): void;
|
|
74
|
-
|
|
75
|
-
/** 获取所有已注册的 Slot(用于调试) */
|
|
76
|
-
getAllSlots?(): ISlotComponent[];
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Slot 渲染器接口
|
|
81
|
-
*
|
|
82
|
-
* 用于在 React 组件中渲染指定位置的 Slots
|
|
83
|
-
*/
|
|
84
|
-
export interface ISlotRenderer {
|
|
85
|
-
/** 渲染指定位置的所有 Slots */
|
|
86
|
-
renderSlots(position: SlotPosition, context?: any): ReactNode;
|
|
87
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "NodeNext",
|
|
5
|
-
"lib": ["ES2020", "DOM"],
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"outDir": "./dist",
|
|
8
|
-
"rootDir": "./src",
|
|
9
|
-
"strict": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true,
|
|
13
|
-
"moduleResolution": "NodeNext",
|
|
14
|
-
"jsx": "react-jsx"
|
|
15
|
-
},
|
|
16
|
-
"include": ["src/**/*"],
|
|
17
|
-
"exclude": ["node_modules", "dist"]
|
|
18
|
-
}
|