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,50 @@
|
|
|
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 Type Definition Unified Export
|
|
18
|
+
* @description Re-exports all type definitions from categorized files
|
|
19
|
+
* @module @brix/runtime-sdk-api-web/types
|
|
20
|
+
* @version 3.2.0
|
|
21
|
+
*
|
|
22
|
+
* [v3.2 Refactoring Notes]
|
|
23
|
+
* Split the original 1000+ lines of code from index.ts into the following modules:
|
|
24
|
+
* - capability.ts: Capability system types
|
|
25
|
+
* - plugin.ts: Plugin system types
|
|
26
|
+
* - navigation.ts: Navigation system types
|
|
27
|
+
* - state.ts: State management types
|
|
28
|
+
* - event.ts: Event system types
|
|
29
|
+
* - module.ts: Module system types
|
|
30
|
+
* - http.ts: HTTP client capability types
|
|
31
|
+
* - auth.ts: Authentication capability types
|
|
32
|
+
* - config.ts: Configuration capability types
|
|
33
|
+
* - common.ts: Common utility types and API response types
|
|
34
|
+
*
|
|
35
|
+
* [Design Principles]
|
|
36
|
+
* - Each file has a single responsibility
|
|
37
|
+
* - Enables on-demand imports
|
|
38
|
+
* - Easy to maintain and extend
|
|
39
|
+
*/
|
|
40
|
+
export * from './capability';
|
|
41
|
+
export * from './plugin';
|
|
42
|
+
export * from './navigation';
|
|
43
|
+
export * from './state';
|
|
44
|
+
export * from './event';
|
|
45
|
+
export * from './module';
|
|
46
|
+
export * from './http';
|
|
47
|
+
export * from './auth';
|
|
48
|
+
export * from './config';
|
|
49
|
+
export * from './common';
|
|
50
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAKH,cAAc,cAAc,CAAC;AAK7B,cAAc,UAAU,CAAC;AAKzB,cAAc,cAAc,CAAC;AAK7B,cAAc,SAAS,CAAC;AAKxB,cAAc,SAAS,CAAC;AAKxB,cAAc,UAAU,CAAC;AAKzB,cAAc,QAAQ,CAAC;AAKvB,cAAc,QAAQ,CAAC;AAKvB,cAAc,UAAU,CAAC;AAKzB,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
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 Type Definitions Unified Export
|
|
18
|
+
* @description Re-export all type definitions from categorized files
|
|
19
|
+
* @module @brix/runtime-sdk-api-web/types
|
|
20
|
+
* @version 3.2.0
|
|
21
|
+
*
|
|
22
|
+
* [v3.2 Refactoring Notes]
|
|
23
|
+
* Split the original 1000+ lines in index.ts into the following modules:
|
|
24
|
+
* - capability.ts: Capability system types
|
|
25
|
+
* - plugin.ts: Plugin system types
|
|
26
|
+
* - navigation.ts: Navigation system types
|
|
27
|
+
* - state.ts: State management types
|
|
28
|
+
* - event.ts: Event system types
|
|
29
|
+
* - module.ts: Module system types
|
|
30
|
+
* - http.ts: HTTP client capability types
|
|
31
|
+
* - auth.ts: Authentication capability types
|
|
32
|
+
* - config.ts: Configuration capability types
|
|
33
|
+
* - common.ts: Common utility types and API response types
|
|
34
|
+
*
|
|
35
|
+
* [v3.2.0 Phase 1 Contract Layer Fix]
|
|
36
|
+
* Added the following capability interface type files:
|
|
37
|
+
* - i18n.ts: Internationalization capability types (I18nCapability)
|
|
38
|
+
* - theme.ts: Theme capability types (ThemeCapability)
|
|
39
|
+
* - layout.ts: Layout capability types (LayoutCapability)
|
|
40
|
+
*
|
|
41
|
+
* [Design Principles]
|
|
42
|
+
* - Each file has a single responsibility
|
|
43
|
+
* - Facilitates on-demand imports
|
|
44
|
+
* - Easy to maintain and extend
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
// =========================================
|
|
48
|
+
// Capability System Types
|
|
49
|
+
// =========================================
|
|
50
|
+
export * from './capability';
|
|
51
|
+
|
|
52
|
+
// =========================================
|
|
53
|
+
// Plugin System Types
|
|
54
|
+
// =========================================
|
|
55
|
+
export * from './plugin';
|
|
56
|
+
|
|
57
|
+
// =========================================
|
|
58
|
+
// Navigation System Types
|
|
59
|
+
// =========================================
|
|
60
|
+
export * from './navigation';
|
|
61
|
+
|
|
62
|
+
// =========================================
|
|
63
|
+
// State Management Types
|
|
64
|
+
// =========================================
|
|
65
|
+
export * from './state';
|
|
66
|
+
|
|
67
|
+
// =========================================
|
|
68
|
+
// Event System Types
|
|
69
|
+
// =========================================
|
|
70
|
+
export * from './event';
|
|
71
|
+
|
|
72
|
+
// =========================================
|
|
73
|
+
// Module System Types
|
|
74
|
+
// =========================================
|
|
75
|
+
export * from './module';
|
|
76
|
+
|
|
77
|
+
// =========================================
|
|
78
|
+
// HTTP Client Capability Types
|
|
79
|
+
// =========================================
|
|
80
|
+
export * from './http';
|
|
81
|
+
|
|
82
|
+
// =========================================
|
|
83
|
+
// Authentication Capability Types
|
|
84
|
+
// =========================================
|
|
85
|
+
export * from './auth';
|
|
86
|
+
|
|
87
|
+
// =========================================
|
|
88
|
+
// Configuration Capability Types
|
|
89
|
+
// =========================================
|
|
90
|
+
export * from './config';
|
|
91
|
+
|
|
92
|
+
// =========================================
|
|
93
|
+
// Common Utility Types
|
|
94
|
+
// =========================================
|
|
95
|
+
export * from './common';
|
|
96
|
+
|
|
97
|
+
// =========================================
|
|
98
|
+
// Internationalization Capability Types (v3.2.0 added)
|
|
99
|
+
// =========================================
|
|
100
|
+
export * from './i18n';
|
|
101
|
+
|
|
102
|
+
// =========================================
|
|
103
|
+
// Theme Capability Types (v3.2.0 added)
|
|
104
|
+
// =========================================
|
|
105
|
+
export * from './theme';
|
|
106
|
+
|
|
107
|
+
// =========================================
|
|
108
|
+
// Layout Capability Types (v3.2.0 added)
|
|
109
|
+
// =========================================
|
|
110
|
+
export * from './layout';
|
|
111
|
+
|
|
112
|
+
// =========================================
|
|
113
|
+
// UI Adapter Capability Types (v3.2.0 Phase 1 UI Adapter)
|
|
114
|
+
// =========================================
|
|
115
|
+
export * from './ui';
|
|
116
|
+
|
|
117
|
+
// =========================================
|
|
118
|
+
// Plugin Loader Capability Types (v3.2.0 D6 Fix)
|
|
119
|
+
// =========================================
|
|
120
|
+
export * from './plugin-loader-capability';
|
|
@@ -0,0 +1,394 @@
|
|
|
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 Layout Capability Type Definitions
|
|
18
|
+
* @description Defines core types for the layout system, including sidebar, header, fullscreen, and other layout controls
|
|
19
|
+
* @module @brix/runtime-sdk-api-web/types/layout
|
|
20
|
+
* @version 3.2.0
|
|
21
|
+
*
|
|
22
|
+
* [v3.2.0 Added]
|
|
23
|
+
* Phase 1 contract layer fix: Promoted the LayoutCapability interface from shell-web to runtime-sdk-api-web.
|
|
24
|
+
*
|
|
25
|
+
* [Design Principles]
|
|
26
|
+
* - Layout is entirely controlled by the Host
|
|
27
|
+
* - Plugins can only "request" layout behavior, Host decides whether to respond
|
|
28
|
+
* - All requests go through governance policy checks
|
|
29
|
+
*
|
|
30
|
+
* [Architectural Constraints]
|
|
31
|
+
* ❌ Directly manipulating document.body is prohibited
|
|
32
|
+
* ❌ Creating global Portals to body is prohibited
|
|
33
|
+
* ❌ Modifying global CSS (like overflow) is prohibited
|
|
34
|
+
* ✅ Request layout changes through LayoutCapability or useLayout hook
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
import type { Unsubscribe } from './event';
|
|
38
|
+
|
|
39
|
+
// =========================================
|
|
40
|
+
// Layout Mode
|
|
41
|
+
// =========================================
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Layout Mode
|
|
45
|
+
*
|
|
46
|
+
* - 'console': Console layout (with sidebar and header)
|
|
47
|
+
* - 'portal': Portal layout (simplified header, no sidebar)
|
|
48
|
+
* - 'minimal': Minimal layout (content area only)
|
|
49
|
+
*/
|
|
50
|
+
export type LayoutMode = 'console' | 'portal' | 'minimal';
|
|
51
|
+
|
|
52
|
+
// =========================================
|
|
53
|
+
// Layout State
|
|
54
|
+
// =========================================
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Layout State (Capability Contract)
|
|
58
|
+
*
|
|
59
|
+
* <p>Describes the complete state of the current layout.</p>
|
|
60
|
+
* <p>This is the readonly capability state exposed to plugins via LayoutCapability.</p>
|
|
61
|
+
*
|
|
62
|
+
* [Note: Canonical Definition]
|
|
63
|
+
* This is the canonical LayoutState for the runtime capability layer.
|
|
64
|
+
* Shell layers may define their own simplified LayoutState with mutable fields
|
|
65
|
+
* for local UI component state (e.g., shinwa-platform-shell-web/AppLayout.tsx).
|
|
66
|
+
* Those are intentionally different as they serve different architectural layers.
|
|
67
|
+
*/
|
|
68
|
+
export interface LayoutState {
|
|
69
|
+
/** Whether in Fullscreen Mode */
|
|
70
|
+
readonly fullscreen: boolean;
|
|
71
|
+
|
|
72
|
+
/** Whether Sidebar is Visible */
|
|
73
|
+
readonly sidebarVisible: boolean;
|
|
74
|
+
|
|
75
|
+
/** Whether Sidebar is Collapsed */
|
|
76
|
+
readonly sidebarCollapsed: boolean;
|
|
77
|
+
|
|
78
|
+
/** Whether Header is Visible */
|
|
79
|
+
readonly headerVisible: boolean;
|
|
80
|
+
|
|
81
|
+
/** Whether Footer is Visible */
|
|
82
|
+
readonly footerVisible: boolean;
|
|
83
|
+
|
|
84
|
+
/** Current Layout Mode */
|
|
85
|
+
readonly layoutMode: LayoutMode;
|
|
86
|
+
|
|
87
|
+
/** Current Breakpoint */
|
|
88
|
+
readonly breakpoint: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
89
|
+
|
|
90
|
+
/** Whether in Mobile View */
|
|
91
|
+
readonly isMobile: boolean;
|
|
92
|
+
|
|
93
|
+
/** Sidebar Width (expanded state) */
|
|
94
|
+
readonly sidebarWidth: number;
|
|
95
|
+
|
|
96
|
+
/** Sidebar Width (collapsed state) */
|
|
97
|
+
readonly sidebarCollapsedWidth: number;
|
|
98
|
+
|
|
99
|
+
/** Header Height */
|
|
100
|
+
readonly headerHeight: number;
|
|
101
|
+
|
|
102
|
+
/** Content Area Available Width */
|
|
103
|
+
readonly contentWidth?: number;
|
|
104
|
+
|
|
105
|
+
/** Content Area Available Height */
|
|
106
|
+
readonly contentHeight?: number;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// =========================================
|
|
110
|
+
// Layout Request Result
|
|
111
|
+
// =========================================
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Layout Request Result
|
|
115
|
+
*
|
|
116
|
+
* <p>Describes the execution result of a layout change request.</p>
|
|
117
|
+
*/
|
|
118
|
+
export interface LayoutRequestResult {
|
|
119
|
+
/**
|
|
120
|
+
* Whether the Request Succeeded
|
|
121
|
+
*/
|
|
122
|
+
readonly success: boolean;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Failure Reason
|
|
126
|
+
*
|
|
127
|
+
* - 'policy_denied': Governance policy denied
|
|
128
|
+
* - 'not_supported': Current layout mode does not support this operation
|
|
129
|
+
* - 'already_applied': Already in the target state
|
|
130
|
+
*/
|
|
131
|
+
readonly reason?: 'policy_denied' | 'not_supported' | 'already_applied';
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Detailed Message
|
|
135
|
+
*/
|
|
136
|
+
readonly message?: string;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// =========================================
|
|
140
|
+
// Layout Change Event
|
|
141
|
+
// =========================================
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Layout Change Event
|
|
145
|
+
*
|
|
146
|
+
* <p>Triggered when layout state changes.</p>
|
|
147
|
+
*/
|
|
148
|
+
export interface LayoutChangeEvent {
|
|
149
|
+
/** Change Type */
|
|
150
|
+
readonly type: 'fullscreen' | 'sidebar' | 'header' | 'footer' | 'breakpoint' | 'mode';
|
|
151
|
+
|
|
152
|
+
/** New State */
|
|
153
|
+
readonly state: LayoutState;
|
|
154
|
+
|
|
155
|
+
/** Previous State */
|
|
156
|
+
readonly previousState: LayoutState;
|
|
157
|
+
|
|
158
|
+
/** Change Source */
|
|
159
|
+
readonly source: 'user' | 'plugin' | 'system';
|
|
160
|
+
|
|
161
|
+
/** Plugin ID that initiated the change (if source is plugin) */
|
|
162
|
+
readonly pluginId?: string;
|
|
163
|
+
|
|
164
|
+
/** Change Timestamp */
|
|
165
|
+
readonly timestamp: number;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Layout Change Handler
|
|
170
|
+
*/
|
|
171
|
+
export type LayoutChangeHandler = (event: LayoutChangeEvent) => void;
|
|
172
|
+
|
|
173
|
+
// =========================================
|
|
174
|
+
// Layout Capability
|
|
175
|
+
// =========================================
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Layout Capability Type Identifier
|
|
179
|
+
*/
|
|
180
|
+
export const LayoutCapabilityType = Symbol.for('LayoutCapability');
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Layout Capability Contract
|
|
184
|
+
*
|
|
185
|
+
* <p>Provides layout control capability for plugins, including fullscreen, sidebar, header, etc.</p>
|
|
186
|
+
*
|
|
187
|
+
* <h3>Design Principles</h3>
|
|
188
|
+
* <ul>
|
|
189
|
+
* <li>Layout is entirely controlled by the Host</li>
|
|
190
|
+
* <li>Plugins can only "request" layout behavior, Host decides whether to respond</li>
|
|
191
|
+
* <li>All requests go through governance policy checks</li>
|
|
192
|
+
* </ul>
|
|
193
|
+
*
|
|
194
|
+
* <h3>Usage Example</h3>
|
|
195
|
+
* ```typescript
|
|
196
|
+
* const layout = context.getCapability<LayoutCapability>(LayoutCapabilityType);
|
|
197
|
+
*
|
|
198
|
+
* // Request fullscreen
|
|
199
|
+
* const success = await layout.requestFullscreen();
|
|
200
|
+
*
|
|
201
|
+
* // Get current state
|
|
202
|
+
* const state = layout.getState();
|
|
203
|
+
* if (state.isMobile) {
|
|
204
|
+
* // Mobile handling...
|
|
205
|
+
* }
|
|
206
|
+
*
|
|
207
|
+
* // Subscribe to layout changes
|
|
208
|
+
* const unsubscribe = layout.onLayoutChange((event) => {
|
|
209
|
+
* console.log(`Layout change: ${event.type}`);
|
|
210
|
+
* });
|
|
211
|
+
* ```
|
|
212
|
+
*
|
|
213
|
+
* @since 3.2.0
|
|
214
|
+
*/
|
|
215
|
+
export interface LayoutCapability {
|
|
216
|
+
// =========================================
|
|
217
|
+
// State Retrieval
|
|
218
|
+
// =========================================
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Get Current Layout State
|
|
222
|
+
*
|
|
223
|
+
* @returns Layout state object
|
|
224
|
+
*/
|
|
225
|
+
getState(): LayoutState;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Check if Fullscreen
|
|
229
|
+
*
|
|
230
|
+
* @returns Whether in fullscreen mode
|
|
231
|
+
*/
|
|
232
|
+
isFullscreen(): boolean;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Check if Sidebar is Visible
|
|
236
|
+
*
|
|
237
|
+
* @returns Whether visible
|
|
238
|
+
*/
|
|
239
|
+
isSidebarVisible(): boolean;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Check if Sidebar is Collapsed
|
|
243
|
+
*
|
|
244
|
+
* @returns Whether collapsed
|
|
245
|
+
*/
|
|
246
|
+
isSidebarCollapsed(): boolean;
|
|
247
|
+
|
|
248
|
+
// =========================================
|
|
249
|
+
// Fullscreen Control
|
|
250
|
+
// =========================================
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Request Enter Fullscreen Mode
|
|
254
|
+
*
|
|
255
|
+
* @returns Whether successful
|
|
256
|
+
*/
|
|
257
|
+
requestFullscreen(): Promise<boolean>;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Request Exit Fullscreen Mode
|
|
261
|
+
*
|
|
262
|
+
* @returns Whether successful
|
|
263
|
+
*/
|
|
264
|
+
requestExitFullscreen(): Promise<boolean>;
|
|
265
|
+
|
|
266
|
+
// =========================================
|
|
267
|
+
// Sidebar Control
|
|
268
|
+
// =========================================
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Request Hide Sidebar
|
|
272
|
+
*
|
|
273
|
+
* @returns Whether successful
|
|
274
|
+
*/
|
|
275
|
+
requestHideSidebar(): Promise<boolean>;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Request Show Sidebar
|
|
279
|
+
*
|
|
280
|
+
* @returns Whether successful
|
|
281
|
+
*/
|
|
282
|
+
requestShowSidebar(): Promise<boolean>;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Request Collapse Sidebar
|
|
286
|
+
*
|
|
287
|
+
* @returns Whether successful
|
|
288
|
+
*/
|
|
289
|
+
requestCollapseSidebar?(): Promise<boolean>;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Request Expand Sidebar
|
|
293
|
+
*
|
|
294
|
+
* @returns Whether successful
|
|
295
|
+
*/
|
|
296
|
+
requestExpandSidebar?(): Promise<boolean>;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Request Toggle Sidebar Collapse State
|
|
300
|
+
*
|
|
301
|
+
* @returns Whether successful
|
|
302
|
+
*/
|
|
303
|
+
requestToggleSidebar?(): Promise<boolean>;
|
|
304
|
+
|
|
305
|
+
// =========================================
|
|
306
|
+
// Header/Footer Control
|
|
307
|
+
// =========================================
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Request Hide Header
|
|
311
|
+
*
|
|
312
|
+
* @returns Whether successful
|
|
313
|
+
*/
|
|
314
|
+
requestHideHeader?(): Promise<boolean>;
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Request Show Header
|
|
318
|
+
*
|
|
319
|
+
* @returns Whether successful
|
|
320
|
+
*/
|
|
321
|
+
requestShowHeader?(): Promise<boolean>;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Request Hide Footer
|
|
325
|
+
*
|
|
326
|
+
* @returns Whether successful
|
|
327
|
+
*/
|
|
328
|
+
requestHideFooter?(): Promise<boolean>;
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Request Show Footer
|
|
332
|
+
*
|
|
333
|
+
* @returns Whether successful
|
|
334
|
+
*/
|
|
335
|
+
requestShowFooter?(): Promise<boolean>;
|
|
336
|
+
|
|
337
|
+
// =========================================
|
|
338
|
+
// Comprehensive Layout Control
|
|
339
|
+
// =========================================
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Request Layout Change
|
|
343
|
+
*
|
|
344
|
+
* <p>Can change multiple layout parameters simultaneously.</p>
|
|
345
|
+
*
|
|
346
|
+
* @param changes Layout change parameters
|
|
347
|
+
* @returns Request result
|
|
348
|
+
*/
|
|
349
|
+
requestLayoutChange?(changes: Partial<{
|
|
350
|
+
fullscreen: boolean;
|
|
351
|
+
sidebarVisible: boolean;
|
|
352
|
+
sidebarCollapsed: boolean;
|
|
353
|
+
headerVisible: boolean;
|
|
354
|
+
footerVisible: boolean;
|
|
355
|
+
}>): Promise<LayoutRequestResult>;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Switch Layout Mode
|
|
359
|
+
*
|
|
360
|
+
* @param mode Target layout mode
|
|
361
|
+
* @returns Whether successful
|
|
362
|
+
*/
|
|
363
|
+
setLayoutMode?(mode: LayoutMode): Promise<boolean>;
|
|
364
|
+
|
|
365
|
+
// =========================================
|
|
366
|
+
// Responsive Information
|
|
367
|
+
// =========================================
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Get Current Breakpoint
|
|
371
|
+
*
|
|
372
|
+
* @returns Breakpoint name
|
|
373
|
+
*/
|
|
374
|
+
getBreakpoint?(): 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Check if Mobile View
|
|
378
|
+
*
|
|
379
|
+
* @returns Whether mobile
|
|
380
|
+
*/
|
|
381
|
+
isMobileView?(): boolean;
|
|
382
|
+
|
|
383
|
+
// =========================================
|
|
384
|
+
// Event Subscription
|
|
385
|
+
// =========================================
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Subscribe to Layout Change Event
|
|
389
|
+
*
|
|
390
|
+
* @param handler Event handler
|
|
391
|
+
* @returns Unsubscribe function
|
|
392
|
+
*/
|
|
393
|
+
onLayoutChange?(handler: LayoutChangeHandler): Unsubscribe;
|
|
394
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
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 Module-Related Type Definitions
|
|
18
|
+
* @description Defines core types for the module system, including module metadata, state, lifecycle events, etc.
|
|
19
|
+
* @module @brix/runtime-sdk-api-web/types/module
|
|
20
|
+
* @version 3.2.0
|
|
21
|
+
*
|
|
22
|
+
* [v3.2 Changes]
|
|
23
|
+
* Extracted from index.ts into a standalone type file.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Module Metadata
|
|
27
|
+
*
|
|
28
|
+
* <p>Describes basic information about a module.</p>
|
|
29
|
+
*/
|
|
30
|
+
export interface ModuleMetadata {
|
|
31
|
+
/** Module ID */
|
|
32
|
+
readonly moduleId: string;
|
|
33
|
+
/** Module name */
|
|
34
|
+
readonly name: string;
|
|
35
|
+
/** Module version */
|
|
36
|
+
readonly version: string;
|
|
37
|
+
/** Module description */
|
|
38
|
+
readonly description?: string;
|
|
39
|
+
/** Author */
|
|
40
|
+
readonly author?: string;
|
|
41
|
+
/** List of dependent modules */
|
|
42
|
+
readonly dependencies?: string[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Module State Enum
|
|
46
|
+
*/
|
|
47
|
+
export declare enum ModuleState {
|
|
48
|
+
/** Unloaded */
|
|
49
|
+
UNLOADED = "UNLOADED",
|
|
50
|
+
/** Loading */
|
|
51
|
+
LOADING = "LOADING",
|
|
52
|
+
/** Loaded */
|
|
53
|
+
LOADED = "LOADED",
|
|
54
|
+
/** Active */
|
|
55
|
+
ACTIVE = "ACTIVE",
|
|
56
|
+
/** Error state */
|
|
57
|
+
ERROR = "ERROR"
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Module Lifecycle Event Enum
|
|
61
|
+
*/
|
|
62
|
+
export declare enum ModuleLifecycleEvent {
|
|
63
|
+
/** Before load */
|
|
64
|
+
BEFORE_LOAD = "BEFORE_LOAD",
|
|
65
|
+
/** After load */
|
|
66
|
+
AFTER_LOAD = "AFTER_LOAD",
|
|
67
|
+
/** Before activate */
|
|
68
|
+
BEFORE_ACTIVATE = "BEFORE_ACTIVATE",
|
|
69
|
+
/** After activate */
|
|
70
|
+
AFTER_ACTIVATE = "AFTER_ACTIVATE",
|
|
71
|
+
/** Before deactivate */
|
|
72
|
+
BEFORE_DEACTIVATE = "BEFORE_DEACTIVATE",
|
|
73
|
+
/** After deactivate */
|
|
74
|
+
AFTER_DEACTIVATE = "AFTER_DEACTIVATE",
|
|
75
|
+
/** Error */
|
|
76
|
+
ERROR = "ERROR"
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["module.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,YAAY;IACZ,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,WAAW;IACX,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,WAAW;IACX,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,WAAW;IACX,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAS;IACT,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa;IACb,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CAClC;AAMD;;GAEG;AACH,oBAAY,WAAW;IACrB,UAAU;IACV,QAAQ,aAAa;IACrB,UAAU;IACV,OAAO,YAAY;IACnB,UAAU;IACV,MAAM,WAAW;IACjB,UAAU;IACV,MAAM,WAAW;IACjB,WAAW;IACX,KAAK,UAAU;CAChB;AAMD;;GAEG;AACH,oBAAY,oBAAoB;IAC9B,UAAU;IACV,WAAW,gBAAgB;IAC3B,UAAU;IACV,UAAU,eAAe;IACzB,UAAU;IACV,eAAe,oBAAoB;IACnC,UAAU;IACV,cAAc,mBAAmB;IACjC,UAAU;IACV,iBAAiB,sBAAsB;IACvC,UAAU;IACV,gBAAgB,qBAAqB;IACrC,SAAS;IACT,KAAK,UAAU;CAChB"}
|