brix-runtime-sdk-api-web 1.0.0
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/dist/index.js +190 -0
- package/dist/types/api-exports.test.d.ts +33 -0
- package/dist/types/api-exports.test.d.ts.map +1 -0
- package/dist/types/context/RuntimeContext.d.ts +69 -0
- package/dist/types/context/RuntimeContext.d.ts.map +1 -0
- package/dist/types/context/index.d.ts +23 -0
- package/dist/types/context/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +52 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/types/auth.d.ts +405 -0
- package/dist/types/types/auth.d.ts.map +1 -0
- package/dist/types/types/capability.d.ts +218 -0
- package/dist/types/types/capability.d.ts.map +1 -0
- package/dist/types/types/common.d.ts +99 -0
- package/dist/types/types/common.d.ts.map +1 -0
- package/dist/types/types/config.d.ts +85 -0
- package/dist/types/types/config.d.ts.map +1 -0
- package/dist/types/types/event.d.ts +658 -0
- package/dist/types/types/event.d.ts.map +1 -0
- package/dist/types/types/http.d.ts +132 -0
- package/dist/types/types/http.d.ts.map +1 -0
- package/dist/types/types/i18n.d.ts +327 -0
- package/dist/types/types/i18n.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +61 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/layout.d.ts +301 -0
- package/dist/types/types/layout.d.ts.map +1 -0
- package/dist/types/types/module.d.ts +78 -0
- package/dist/types/types/module.d.ts.map +1 -0
- package/dist/types/types/navigation.d.ts +295 -0
- package/dist/types/types/navigation.d.ts.map +1 -0
- package/dist/types/types/plugin-loader-capability.d.ts +142 -0
- package/dist/types/types/plugin-loader-capability.d.ts.map +1 -0
- package/dist/types/types/plugin.d.ts +250 -0
- package/dist/types/types/plugin.d.ts.map +1 -0
- package/dist/types/types/state.d.ts +306 -0
- package/dist/types/types/state.d.ts.map +1 -0
- package/dist/types/types/theme.d.ts +279 -0
- package/dist/types/types/theme.d.ts.map +1 -0
- package/dist/types/types/ui/adapter.d.ts +181 -0
- package/dist/types/types/ui/adapter.d.ts.map +1 -0
- package/dist/types/types/ui/avatar.d.ts +102 -0
- package/dist/types/types/ui/avatar.d.ts.map +1 -0
- package/dist/types/types/ui/badge.d.ts +101 -0
- package/dist/types/types/ui/badge.d.ts.map +1 -0
- package/dist/types/types/ui/button.d.ts +135 -0
- package/dist/types/types/ui/button.d.ts.map +1 -0
- package/dist/types/types/ui/card.d.ts +105 -0
- package/dist/types/types/ui/card.d.ts.map +1 -0
- package/dist/types/types/ui/common.d.ts +29 -0
- package/dist/types/types/ui/common.d.ts.map +1 -0
- package/dist/types/types/ui/icon.d.ts +78 -0
- package/dist/types/types/ui/icon.d.ts.map +1 -0
- package/dist/types/types/ui/index.d.ts +59 -0
- package/dist/types/types/ui/index.d.ts.map +1 -0
- package/dist/types/types/ui/input.d.ts +200 -0
- package/dist/types/types/ui/input.d.ts.map +1 -0
- package/dist/types/types/ui/menu.d.ts +211 -0
- package/dist/types/types/ui/menu.d.ts.map +1 -0
- package/dist/types/types/ui/message.d.ts +121 -0
- package/dist/types/types/ui/message.d.ts.map +1 -0
- package/dist/types/types/ui/modal.d.ts +167 -0
- package/dist/types/types/ui/modal.d.ts.map +1 -0
- package/dist/types/types/ui/select.d.ts +213 -0
- package/dist/types/types/ui/select.d.ts.map +1 -0
- package/dist/types/types/ui/theme-tokens.d.ts +226 -0
- package/dist/types/types/ui/theme-tokens.d.ts.map +1 -0
- package/dist/types/types/ui/tooltip.d.ts +98 -0
- package/dist/types/types/ui/tooltip.d.ts.map +1 -0
- package/dist/types/types/ui.d.ts +49 -0
- package/dist/types/types/ui.d.ts.map +1 -0
- package/package.json +34 -0
- package/src/api-exports.test.ts +199 -0
- package/src/context/RuntimeContext.d.ts +69 -0
- package/src/context/RuntimeContext.d.ts.map +1 -0
- package/src/context/RuntimeContext.ts +75 -0
- package/src/context/index.d.ts +23 -0
- package/src/context/index.d.ts.map +1 -0
- package/src/context/index.ts +23 -0
- package/src/index.d.ts +52 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.ts +59 -0
- package/src/types/auth.d.ts +146 -0
- package/src/types/auth.d.ts.map +1 -0
- package/src/types/auth.ts +479 -0
- package/src/types/capability.d.ts +218 -0
- package/src/types/capability.d.ts.map +1 -0
- package/src/types/capability.ts +302 -0
- package/src/types/common.d.ts +99 -0
- package/src/types/common.d.ts.map +1 -0
- package/src/types/common.ts +115 -0
- package/src/types/config.d.ts +64 -0
- package/src/types/config.d.ts.map +1 -0
- package/src/types/config.ts +96 -0
- package/src/types/event.d.ts +206 -0
- package/src/types/event.d.ts.map +1 -0
- package/src/types/event.ts +776 -0
- package/src/types/http.d.ts +132 -0
- package/src/types/http.d.ts.map +1 -0
- package/src/types/http.ts +156 -0
- package/src/types/i18n.ts +420 -0
- package/src/types/index.d.ts +50 -0
- package/src/types/index.d.ts.map +1 -0
- package/src/types/index.ts +120 -0
- package/src/types/layout.ts +394 -0
- package/src/types/module.d.ts +78 -0
- package/src/types/module.d.ts.map +1 -0
- package/src/types/module.ts +92 -0
- package/src/types/navigation.d.ts +101 -0
- package/src/types/navigation.d.ts.map +1 -0
- package/src/types/navigation.ts +361 -0
- package/src/types/plugin-loader-capability.ts +159 -0
- package/src/types/plugin.d.ts +250 -0
- package/src/types/plugin.d.ts.map +1 -0
- package/src/types/plugin.ts +344 -0
- package/src/types/state.d.ts +119 -0
- package/src/types/state.d.ts.map +1 -0
- package/src/types/state.ts +366 -0
- package/src/types/theme.ts +378 -0
- package/src/types/ui/adapter.ts +222 -0
- package/src/types/ui/avatar.ts +113 -0
- package/src/types/ui/badge.ts +112 -0
- package/src/types/ui/button.ts +148 -0
- package/src/types/ui/card.ts +116 -0
- package/src/types/ui/common.ts +29 -0
- package/src/types/ui/icon.ts +85 -0
- package/src/types/ui/index.ts +78 -0
- package/src/types/ui/input.ts +225 -0
- package/src/types/ui/menu.ts +237 -0
- package/src/types/ui/message.ts +135 -0
- package/src/types/ui/modal.ts +188 -0
- package/src/types/ui/select.ts +239 -0
- package/src/types/ui/theme-tokens.ts +357 -0
- package/src/types/ui/tooltip.ts +120 -0
- package/src/types/ui.ts +49 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Brix Platform Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* @file Plugin Loader Capability Interface
|
|
18
|
+
* @description Abstracts plugin loading/rendering capabilities for dependency injection
|
|
19
|
+
* @module @brix/runtime-sdk-api-web/types/plugin-loader-capability
|
|
20
|
+
* @version 3.2.0
|
|
21
|
+
*
|
|
22
|
+
* [v3.2.0 Added - D6 Fix]
|
|
23
|
+
* Phase 1 contract layer fix: Shell-web should not directly depend on infra-adapter-mf-web.
|
|
24
|
+
* This interface abstracts the plugin loading mechanism so that Shell components
|
|
25
|
+
* don't need to directly import specific loaders (MF, iframe, etc.).
|
|
26
|
+
*
|
|
27
|
+
* [Design Principles]
|
|
28
|
+
* - Shell layer accesses plugin loader through PluginLoaderCapability interface
|
|
29
|
+
* - Host is responsible for injecting the concrete implementation
|
|
30
|
+
* - Supports different plugin loader implementations (MF, iframe, native, etc.)
|
|
31
|
+
*
|
|
32
|
+
* [Architectural Constraints]
|
|
33
|
+
* ❌ Shell components directly importing specific loaders is prohibited
|
|
34
|
+
* ❌ Tight coupling with Module Federation is prohibited
|
|
35
|
+
* ✅ Obtain plugin loader through PluginLoaderCapability or usePluginLoader hook
|
|
36
|
+
*/
|
|
37
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
38
|
+
/**
|
|
39
|
+
* Props for RemoteComponent rendering
|
|
40
|
+
*
|
|
41
|
+
* <p>Standard interface for rendering remote plugin components.</p>
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* const props: RemoteComponentProps = {
|
|
46
|
+
* remoteEntry: 'https://plugin-host.com/remoteEntry.js',
|
|
47
|
+
* exposePath: './pages/UserList',
|
|
48
|
+
* fallback: <Loading />,
|
|
49
|
+
* errorFallback: <ErrorDisplay />,
|
|
50
|
+
* };
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export interface RemoteComponentProps {
|
|
54
|
+
/** Remote entry URL (Module Federation entry point) */
|
|
55
|
+
remoteEntry: string;
|
|
56
|
+
/** Exposed component path (e.g., './ComponentName') */
|
|
57
|
+
exposePath: string;
|
|
58
|
+
/** Loading fallback component */
|
|
59
|
+
fallback?: ReactNode;
|
|
60
|
+
/** Error fallback component */
|
|
61
|
+
errorFallback?: ReactNode;
|
|
62
|
+
/** Props to pass to the remote component */
|
|
63
|
+
props?: Record<string, unknown>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Plugin Loader Capability Type Identifier
|
|
67
|
+
*
|
|
68
|
+
* <p>Used for registration and lookup in RuntimeContext.</p>
|
|
69
|
+
*/
|
|
70
|
+
export declare const PluginLoaderCapabilityType: unique symbol;
|
|
71
|
+
/**
|
|
72
|
+
* Plugin Loader Capability Interface
|
|
73
|
+
*
|
|
74
|
+
* <p>Abstracts the plugin loading mechanism so that Shell components
|
|
75
|
+
* don't need to directly import specific loaders (MF, iframe, etc.).</p>
|
|
76
|
+
*
|
|
77
|
+
* <p>Host is responsible for injecting the concrete implementation
|
|
78
|
+
* (e.g., infra-adapter-mf-web's RemoteComponent).</p>
|
|
79
|
+
*
|
|
80
|
+
* @example Host Registration
|
|
81
|
+
* ```typescript
|
|
82
|
+
* // In host-shell assembly
|
|
83
|
+
* import { RemoteComponent } from '@brix/infra-adapter-mf-web';
|
|
84
|
+
*
|
|
85
|
+
* const pluginLoaderCapability: PluginLoaderCapability = {
|
|
86
|
+
* RemoteComponent,
|
|
87
|
+
* async preload(remoteEntries) {
|
|
88
|
+
* // Implementation for preloading
|
|
89
|
+
* },
|
|
90
|
+
* };
|
|
91
|
+
*
|
|
92
|
+
* capabilityRegistry.register(PluginLoaderCapabilityType, pluginLoaderCapability);
|
|
93
|
+
* ```
|
|
94
|
+
*
|
|
95
|
+
* @example Shell Usage
|
|
96
|
+
* ```tsx
|
|
97
|
+
* // In shell component
|
|
98
|
+
* const { RemoteComponent } = usePluginLoader();
|
|
99
|
+
*
|
|
100
|
+
* return (
|
|
101
|
+
* <RemoteComponent
|
|
102
|
+
* remoteEntry={plugin.remoteEntry}
|
|
103
|
+
* exposePath="./Component"
|
|
104
|
+
* fallback={<Loading />}
|
|
105
|
+
* />
|
|
106
|
+
* );
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export interface PluginLoaderCapability {
|
|
110
|
+
/**
|
|
111
|
+
* RemoteComponent - React component for rendering remote plugins
|
|
112
|
+
*
|
|
113
|
+
* <p>Host injects the actual implementation (e.g., MF adapter's RemoteComponent)</p>
|
|
114
|
+
*/
|
|
115
|
+
RemoteComponent: ComponentType<RemoteComponentProps>;
|
|
116
|
+
/**
|
|
117
|
+
* Preload plugin scripts (optional)
|
|
118
|
+
*
|
|
119
|
+
* <p>Pre-fetches remote entry scripts for faster subsequent loading.</p>
|
|
120
|
+
*
|
|
121
|
+
* @param remoteEntries - Array of remote entry URLs to preload
|
|
122
|
+
* @returns Promise that resolves when preloading is complete
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* await pluginLoader.preload?.([
|
|
127
|
+
* 'https://plugin-a.com/remoteEntry.js',
|
|
128
|
+
* 'https://plugin-b.com/remoteEntry.js',
|
|
129
|
+
* ]);
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
preload?(remoteEntries: string[]): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Check if a remote module is available (optional)
|
|
135
|
+
*
|
|
136
|
+
* @param remoteEntry - Remote entry URL
|
|
137
|
+
* @param exposePath - Exposed component path
|
|
138
|
+
* @returns Whether the module is available
|
|
139
|
+
*/
|
|
140
|
+
isModuleAvailable?(remoteEntry: string, exposePath: string): Promise<boolean>;
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=plugin-loader-capability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-loader-capability.d.ts","sourceRoot":"","sources":["../../../src/types/plugin-loader-capability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMtD;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,oBAAoB;IACnC,uDAAuD;IACvD,WAAW,EAAE,MAAM,CAAC;IAEpB,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IAEnB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB,+BAA+B;IAC/B,aAAa,CAAC,EAAE,SAAS,CAAC;IAE1B,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAMD;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,eAAuC,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,eAAe,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;IAErD;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjD;;;;;;OAMG;IACH,iBAAiB,CAAC,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC/E"}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Brix Platform Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* @file Plugin-Related Type Definitions
|
|
18
|
+
* @description Defines core types for the plugin system, including manifest, instance, lifecycle, etc.
|
|
19
|
+
* @module @brix/runtime-sdk-api-web/types/plugin
|
|
20
|
+
* @version 3.2.1
|
|
21
|
+
*
|
|
22
|
+
* [v3.2.1 Changes]
|
|
23
|
+
* - Removed React dependency, using framework-agnostic ComponentType definition (v3.0.4 architectural constraint fix)
|
|
24
|
+
*
|
|
25
|
+
* [v3.2 Changes]
|
|
26
|
+
* Extracted from index.ts into a standalone type file, and promoted common contracts from infra-adapters.
|
|
27
|
+
*
|
|
28
|
+
* [Design Principles]
|
|
29
|
+
* - Define common plugin contracts, adapters (MF/Iframe/Native) can extend
|
|
30
|
+
* - Use generics to support different manifest and instance types
|
|
31
|
+
* - Framework-agnostic: no dependency on React/Vue/Angular or other UI frameworks
|
|
32
|
+
*/
|
|
33
|
+
import type { CapabilityRegistry } from './capability';
|
|
34
|
+
/**
|
|
35
|
+
* Framework-Agnostic Component Type
|
|
36
|
+
*
|
|
37
|
+
* <p>v3.0.4 architectural constraint fix: contract layer does not depend on any UI framework.
|
|
38
|
+
* Actual component types are defined by specific adapters or React binding layer.</p>
|
|
39
|
+
*
|
|
40
|
+
* <p>Usage:</p>
|
|
41
|
+
* <ul>
|
|
42
|
+
* <li>In React projects, use type definitions from @brix/runtime-sdk-react</li>
|
|
43
|
+
* <li>In Vue projects, use type definitions from @brix/runtime-sdk-vue</li>
|
|
44
|
+
* <li>In framework-agnostic scenarios, use unknown and handle at runtime</li>
|
|
45
|
+
* </ul>
|
|
46
|
+
*/
|
|
47
|
+
export type ComponentType = unknown;
|
|
48
|
+
/**
|
|
49
|
+
* Plugin Status
|
|
50
|
+
*
|
|
51
|
+
* <p>Describes the current state of a plugin in its lifecycle.</p>
|
|
52
|
+
*/
|
|
53
|
+
export type PluginStatus = 'registered' | 'loading' | 'loaded' | 'activating' | 'active' | 'deactivating' | 'inactive' | 'error';
|
|
54
|
+
/**
|
|
55
|
+
* Plugin Manifest Base Interface
|
|
56
|
+
*
|
|
57
|
+
* <p>All adapter manifests (MF, Iframe, Native) must extend this interface.</p>
|
|
58
|
+
*/
|
|
59
|
+
export interface PluginManifest {
|
|
60
|
+
/** Plugin unique identifier */
|
|
61
|
+
readonly id: string;
|
|
62
|
+
/** Plugin name */
|
|
63
|
+
readonly name: string;
|
|
64
|
+
/** Plugin version */
|
|
65
|
+
readonly version: string;
|
|
66
|
+
/** Whether enabled */
|
|
67
|
+
readonly enabled?: boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Plugin Metadata
|
|
71
|
+
*
|
|
72
|
+
* <p>Describes detailed information about a plugin, including required capabilities, published/subscribed events, etc.</p>
|
|
73
|
+
*/
|
|
74
|
+
export interface PluginMetadata {
|
|
75
|
+
/** Version */
|
|
76
|
+
readonly version: string;
|
|
77
|
+
/** Name */
|
|
78
|
+
readonly name: string;
|
|
79
|
+
/** Description */
|
|
80
|
+
readonly description?: string;
|
|
81
|
+
/** List of required capabilities */
|
|
82
|
+
readonly requiredCapabilities?: string[];
|
|
83
|
+
/** List of published events */
|
|
84
|
+
readonly publishedEvents?: string[];
|
|
85
|
+
/** List of subscribed events */
|
|
86
|
+
readonly subscribedEvents?: string[];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Plugin Instance Base Interface
|
|
90
|
+
*
|
|
91
|
+
* <p>All adapter instances must extend this interface.</p>
|
|
92
|
+
*
|
|
93
|
+
* @template M Manifest type
|
|
94
|
+
*/
|
|
95
|
+
export interface PluginInstance<M extends PluginManifest = PluginManifest> {
|
|
96
|
+
/** Plugin ID */
|
|
97
|
+
readonly id: string;
|
|
98
|
+
/** Corresponding manifest */
|
|
99
|
+
readonly manifest: M;
|
|
100
|
+
/** Current status */
|
|
101
|
+
status: string;
|
|
102
|
+
/** Error information */
|
|
103
|
+
readonly error?: Error;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Plugin Loader Interface
|
|
107
|
+
*
|
|
108
|
+
* <p>All adapters (MFPluginLoader, IframePluginLoader, NativePluginLoader)
|
|
109
|
+
* must implement this interface.</p>
|
|
110
|
+
*
|
|
111
|
+
* @template M Manifest type
|
|
112
|
+
* @template I Instance type
|
|
113
|
+
*/
|
|
114
|
+
export interface PluginLoader<M extends PluginManifest = PluginManifest, I extends PluginInstance<M> = PluginInstance<M>> {
|
|
115
|
+
/** Load a single plugin */
|
|
116
|
+
load(manifest: M): Promise<I>;
|
|
117
|
+
/** Unload plugin */
|
|
118
|
+
unload(pluginId: string): void;
|
|
119
|
+
/** Preload multiple plugins */
|
|
120
|
+
preload?(manifests: M[]): Promise<void>;
|
|
121
|
+
/** Get loaded plugins list */
|
|
122
|
+
getLoaded(): I[];
|
|
123
|
+
/** Check if plugin is loaded */
|
|
124
|
+
isLoaded(pluginId: string): boolean;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Plugin Load Error
|
|
128
|
+
*
|
|
129
|
+
* <p>Encapsulates errors that occur during plugin loading, includes error phase information.</p>
|
|
130
|
+
*/
|
|
131
|
+
export declare class PluginLoadError extends Error {
|
|
132
|
+
readonly pluginId: string;
|
|
133
|
+
readonly phase: 'script' | 'init' | 'module' | 'component' | 'iframe' | 'bridge';
|
|
134
|
+
readonly cause?: Error | undefined;
|
|
135
|
+
constructor(message: string, pluginId: string, phase: 'script' | 'init' | 'module' | 'component' | 'iframe' | 'bridge', cause?: Error | undefined);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Plugin Dependency Declaration
|
|
139
|
+
*
|
|
140
|
+
* <p>Describes plugin dependencies on other plugins, used for manifest parsing and dependency validation.</p>
|
|
141
|
+
*/
|
|
142
|
+
export interface PluginDependency {
|
|
143
|
+
/** Dependency plugin name */
|
|
144
|
+
readonly name: string;
|
|
145
|
+
/** Dependency version */
|
|
146
|
+
readonly version: string;
|
|
147
|
+
/** Maven GroupId */
|
|
148
|
+
readonly groupId: string;
|
|
149
|
+
/** Maven ArtifactId (auto-generated: {name}-core) */
|
|
150
|
+
readonly artifactId: string;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Plugin Entry Configuration
|
|
154
|
+
*
|
|
155
|
+
* <p>Defines the loading entry point and basic information for a plugin.</p>
|
|
156
|
+
*/
|
|
157
|
+
export interface PluginEntry {
|
|
158
|
+
/** Plugin unique identifier */
|
|
159
|
+
readonly id: string;
|
|
160
|
+
/** Plugin name */
|
|
161
|
+
readonly name: string;
|
|
162
|
+
/** Plugin version */
|
|
163
|
+
readonly version: string;
|
|
164
|
+
/** Plugin loader function */
|
|
165
|
+
readonly loader: () => Promise<PluginLifecycle>;
|
|
166
|
+
/** List of dependent plugin IDs */
|
|
167
|
+
readonly dependencies?: string[];
|
|
168
|
+
/** Plugin configuration */
|
|
169
|
+
readonly config?: Record<string, unknown>;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Plugin Lifecycle Interface
|
|
173
|
+
*
|
|
174
|
+
* <p>Defines callback methods for plugin activation and deactivation.</p>
|
|
175
|
+
*/
|
|
176
|
+
export interface PluginLifecycle {
|
|
177
|
+
/**
|
|
178
|
+
* Called When Plugin Activates
|
|
179
|
+
*
|
|
180
|
+
* <p>Initialize plugin resources, register capabilities, contribute routes, etc. in this method.</p>
|
|
181
|
+
*
|
|
182
|
+
* @param context Plugin context
|
|
183
|
+
*/
|
|
184
|
+
activate(context: PluginContext): void | Promise<void>;
|
|
185
|
+
/**
|
|
186
|
+
* Called When Plugin Deactivates
|
|
187
|
+
*
|
|
188
|
+
* <p>Clean up plugin resources, unsubscribe, etc. in this method.</p>
|
|
189
|
+
*/
|
|
190
|
+
deactivate?(): void | Promise<void>;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Plugin Context
|
|
194
|
+
*
|
|
195
|
+
* <p>Runtime context provided to plugins, containing capability registry and contribution methods.</p>
|
|
196
|
+
*/
|
|
197
|
+
export interface PluginContext {
|
|
198
|
+
/** Plugin ID */
|
|
199
|
+
readonly pluginId: string;
|
|
200
|
+
/** Capability registry */
|
|
201
|
+
readonly registry: CapabilityRegistry;
|
|
202
|
+
/** Contribute routes */
|
|
203
|
+
contributeRoutes?(routes: RouteContribution[]): void;
|
|
204
|
+
/** Contribute menus */
|
|
205
|
+
contributeMenus?(menus: MenuContribution[]): void;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Route Contribution
|
|
209
|
+
*
|
|
210
|
+
* <p>Route configuration contributed by plugins to the Host.</p>
|
|
211
|
+
*/
|
|
212
|
+
export interface RouteContribution {
|
|
213
|
+
/** Route path */
|
|
214
|
+
path: string;
|
|
215
|
+
/** Route component */
|
|
216
|
+
component: ComponentType;
|
|
217
|
+
/** Exact match */
|
|
218
|
+
exact?: boolean;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Menu Contribution
|
|
222
|
+
*
|
|
223
|
+
* <p>Menu configuration contributed by plugins to the Host.</p>
|
|
224
|
+
*/
|
|
225
|
+
export interface MenuContribution {
|
|
226
|
+
/** Menu ID */
|
|
227
|
+
id: string;
|
|
228
|
+
/** Menu label */
|
|
229
|
+
label: string;
|
|
230
|
+
/** Menu icon */
|
|
231
|
+
icon?: string;
|
|
232
|
+
/** Menu path */
|
|
233
|
+
path?: string;
|
|
234
|
+
/** Sub-menus */
|
|
235
|
+
children?: MenuContribution[];
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Route Page Configuration
|
|
239
|
+
*
|
|
240
|
+
* <p>Page registration format used by adapters.</p>
|
|
241
|
+
*/
|
|
242
|
+
export interface PageConfig {
|
|
243
|
+
/** Page ID (format: pluginId:pageName) */
|
|
244
|
+
readonly pageId: string;
|
|
245
|
+
/** URL path */
|
|
246
|
+
readonly path: string;
|
|
247
|
+
/** Page component */
|
|
248
|
+
readonly component: ComponentType;
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/types/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC;AAMpC;;;;GAIG;AACH,MAAM,MAAM,YAAY,GACpB,YAAY,GACZ,SAAS,GACT,QAAQ,GACR,YAAY,GACZ,QAAQ,GACR,cAAc,GACd,UAAU,GACV,OAAO,CAAC;AAMZ;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,kBAAkB;IAClB,QAAQ,C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