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.
Files changed (135) hide show
  1. package/dist/index.js +190 -0
  2. package/dist/types/api-exports.test.d.ts +33 -0
  3. package/dist/types/api-exports.test.d.ts.map +1 -0
  4. package/dist/types/context/RuntimeContext.d.ts +69 -0
  5. package/dist/types/context/RuntimeContext.d.ts.map +1 -0
  6. package/dist/types/context/index.d.ts +23 -0
  7. package/dist/types/context/index.d.ts.map +1 -0
  8. package/dist/types/index.d.ts +52 -0
  9. package/dist/types/index.d.ts.map +1 -0
  10. package/dist/types/types/auth.d.ts +405 -0
  11. package/dist/types/types/auth.d.ts.map +1 -0
  12. package/dist/types/types/capability.d.ts +218 -0
  13. package/dist/types/types/capability.d.ts.map +1 -0
  14. package/dist/types/types/common.d.ts +99 -0
  15. package/dist/types/types/common.d.ts.map +1 -0
  16. package/dist/types/types/config.d.ts +85 -0
  17. package/dist/types/types/config.d.ts.map +1 -0
  18. package/dist/types/types/event.d.ts +658 -0
  19. package/dist/types/types/event.d.ts.map +1 -0
  20. package/dist/types/types/http.d.ts +132 -0
  21. package/dist/types/types/http.d.ts.map +1 -0
  22. package/dist/types/types/i18n.d.ts +327 -0
  23. package/dist/types/types/i18n.d.ts.map +1 -0
  24. package/dist/types/types/index.d.ts +61 -0
  25. package/dist/types/types/index.d.ts.map +1 -0
  26. package/dist/types/types/layout.d.ts +301 -0
  27. package/dist/types/types/layout.d.ts.map +1 -0
  28. package/dist/types/types/module.d.ts +78 -0
  29. package/dist/types/types/module.d.ts.map +1 -0
  30. package/dist/types/types/navigation.d.ts +295 -0
  31. package/dist/types/types/navigation.d.ts.map +1 -0
  32. package/dist/types/types/plugin-loader-capability.d.ts +142 -0
  33. package/dist/types/types/plugin-loader-capability.d.ts.map +1 -0
  34. package/dist/types/types/plugin.d.ts +250 -0
  35. package/dist/types/types/plugin.d.ts.map +1 -0
  36. package/dist/types/types/state.d.ts +306 -0
  37. package/dist/types/types/state.d.ts.map +1 -0
  38. package/dist/types/types/theme.d.ts +279 -0
  39. package/dist/types/types/theme.d.ts.map +1 -0
  40. package/dist/types/types/ui/adapter.d.ts +181 -0
  41. package/dist/types/types/ui/adapter.d.ts.map +1 -0
  42. package/dist/types/types/ui/avatar.d.ts +102 -0
  43. package/dist/types/types/ui/avatar.d.ts.map +1 -0
  44. package/dist/types/types/ui/badge.d.ts +101 -0
  45. package/dist/types/types/ui/badge.d.ts.map +1 -0
  46. package/dist/types/types/ui/button.d.ts +135 -0
  47. package/dist/types/types/ui/button.d.ts.map +1 -0
  48. package/dist/types/types/ui/card.d.ts +105 -0
  49. package/dist/types/types/ui/card.d.ts.map +1 -0
  50. package/dist/types/types/ui/common.d.ts +29 -0
  51. package/dist/types/types/ui/common.d.ts.map +1 -0
  52. package/dist/types/types/ui/icon.d.ts +78 -0
  53. package/dist/types/types/ui/icon.d.ts.map +1 -0
  54. package/dist/types/types/ui/index.d.ts +59 -0
  55. package/dist/types/types/ui/index.d.ts.map +1 -0
  56. package/dist/types/types/ui/input.d.ts +200 -0
  57. package/dist/types/types/ui/input.d.ts.map +1 -0
  58. package/dist/types/types/ui/menu.d.ts +211 -0
  59. package/dist/types/types/ui/menu.d.ts.map +1 -0
  60. package/dist/types/types/ui/message.d.ts +121 -0
  61. package/dist/types/types/ui/message.d.ts.map +1 -0
  62. package/dist/types/types/ui/modal.d.ts +167 -0
  63. package/dist/types/types/ui/modal.d.ts.map +1 -0
  64. package/dist/types/types/ui/select.d.ts +213 -0
  65. package/dist/types/types/ui/select.d.ts.map +1 -0
  66. package/dist/types/types/ui/theme-tokens.d.ts +226 -0
  67. package/dist/types/types/ui/theme-tokens.d.ts.map +1 -0
  68. package/dist/types/types/ui/tooltip.d.ts +98 -0
  69. package/dist/types/types/ui/tooltip.d.ts.map +1 -0
  70. package/dist/types/types/ui.d.ts +49 -0
  71. package/dist/types/types/ui.d.ts.map +1 -0
  72. package/package.json +34 -0
  73. package/src/api-exports.test.ts +199 -0
  74. package/src/context/RuntimeContext.d.ts +69 -0
  75. package/src/context/RuntimeContext.d.ts.map +1 -0
  76. package/src/context/RuntimeContext.ts +75 -0
  77. package/src/context/index.d.ts +23 -0
  78. package/src/context/index.d.ts.map +1 -0
  79. package/src/context/index.ts +23 -0
  80. package/src/index.d.ts +52 -0
  81. package/src/index.d.ts.map +1 -0
  82. package/src/index.ts +59 -0
  83. package/src/types/auth.d.ts +146 -0
  84. package/src/types/auth.d.ts.map +1 -0
  85. package/src/types/auth.ts +479 -0
  86. package/src/types/capability.d.ts +218 -0
  87. package/src/types/capability.d.ts.map +1 -0
  88. package/src/types/capability.ts +302 -0
  89. package/src/types/common.d.ts +99 -0
  90. package/src/types/common.d.ts.map +1 -0
  91. package/src/types/common.ts +115 -0
  92. package/src/types/config.d.ts +64 -0
  93. package/src/types/config.d.ts.map +1 -0
  94. package/src/types/config.ts +96 -0
  95. package/src/types/event.d.ts +206 -0
  96. package/src/types/event.d.ts.map +1 -0
  97. package/src/types/event.ts +776 -0
  98. package/src/types/http.d.ts +132 -0
  99. package/src/types/http.d.ts.map +1 -0
  100. package/src/types/http.ts +156 -0
  101. package/src/types/i18n.ts +420 -0
  102. package/src/types/index.d.ts +50 -0
  103. package/src/types/index.d.ts.map +1 -0
  104. package/src/types/index.ts +120 -0
  105. package/src/types/layout.ts +394 -0
  106. package/src/types/module.d.ts +78 -0
  107. package/src/types/module.d.ts.map +1 -0
  108. package/src/types/module.ts +92 -0
  109. package/src/types/navigation.d.ts +101 -0
  110. package/src/types/navigation.d.ts.map +1 -0
  111. package/src/types/navigation.ts +361 -0
  112. package/src/types/plugin-loader-capability.ts +159 -0
  113. package/src/types/plugin.d.ts +250 -0
  114. package/src/types/plugin.d.ts.map +1 -0
  115. package/src/types/plugin.ts +344 -0
  116. package/src/types/state.d.ts +119 -0
  117. package/src/types/state.d.ts.map +1 -0
  118. package/src/types/state.ts +366 -0
  119. package/src/types/theme.ts +378 -0
  120. package/src/types/ui/adapter.ts +222 -0
  121. package/src/types/ui/avatar.ts +113 -0
  122. package/src/types/ui/badge.ts +112 -0
  123. package/src/types/ui/button.ts +148 -0
  124. package/src/types/ui/card.ts +116 -0
  125. package/src/types/ui/common.ts +29 -0
  126. package/src/types/ui/icon.ts +85 -0
  127. package/src/types/ui/index.ts +78 -0
  128. package/src/types/ui/input.ts +225 -0
  129. package/src/types/ui/menu.ts +237 -0
  130. package/src/types/ui/message.ts +135 -0
  131. package/src/types/ui/modal.ts +188 -0
  132. package/src/types/ui/select.ts +239 -0
  133. package/src/types/ui/theme-tokens.ts +357 -0
  134. package/src/types/ui/tooltip.ts +120 -0
  135. package/src/types/ui.ts +49 -0
@@ -0,0 +1,301 @@
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
+ import type { Unsubscribe } from './event';
37
+ /**
38
+ * Layout Mode
39
+ *
40
+ * - 'console': Console layout (with sidebar and header)
41
+ * - 'portal': Portal layout (simplified header, no sidebar)
42
+ * - 'minimal': Minimal layout (content area only)
43
+ */
44
+ export type LayoutMode = 'console' | 'portal' | 'minimal';
45
+ /**
46
+ * Layout State (Capability Contract)
47
+ *
48
+ * <p>Describes the complete state of the current layout.</p>
49
+ * <p>This is the readonly capability state exposed to plugins via LayoutCapability.</p>
50
+ *
51
+ * [Note: Canonical Definition]
52
+ * This is the canonical LayoutState for the runtime capability layer.
53
+ * Shell layers may define their own simplified LayoutState with mutable fields
54
+ * for local UI component state (e.g., shinwa-platform-shell-web/AppLayout.tsx).
55
+ * Those are intentionally different as they serve different architectural layers.
56
+ */
57
+ export interface LayoutState {
58
+ /** Whether in Fullscreen Mode */
59
+ readonly fullscreen: boolean;
60
+ /** Whether Sidebar is Visible */
61
+ readonly sidebarVisible: boolean;
62
+ /** Whether Sidebar is Collapsed */
63
+ readonly sidebarCollapsed: boolean;
64
+ /** Whether Header is Visible */
65
+ readonly headerVisible: boolean;
66
+ /** Whether Footer is Visible */
67
+ readonly footerVisible: boolean;
68
+ /** Current Layout Mode */
69
+ readonly layoutMode: LayoutMode;
70
+ /** Current Breakpoint */
71
+ readonly breakpoint: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
72
+ /** Whether in Mobile View */
73
+ readonly isMobile: boolean;
74
+ /** Sidebar Width (expanded state) */
75
+ readonly sidebarWidth: number;
76
+ /** Sidebar Width (collapsed state) */
77
+ readonly sidebarCollapsedWidth: number;
78
+ /** Header Height */
79
+ readonly headerHeight: number;
80
+ /** Content Area Available Width */
81
+ readonly contentWidth?: number;
82
+ /** Content Area Available Height */
83
+ readonly contentHeight?: number;
84
+ }
85
+ /**
86
+ * Layout Request Result
87
+ *
88
+ * <p>Describes the execution result of a layout change request.</p>
89
+ */
90
+ export interface LayoutRequestResult {
91
+ /**
92
+ * Whether the Request Succeeded
93
+ */
94
+ readonly success: boolean;
95
+ /**
96
+ * Failure Reason
97
+ *
98
+ * - 'policy_denied': Governance policy denied
99
+ * - 'not_supported': Current layout mode does not support this operation
100
+ * - 'already_applied': Already in the target state
101
+ */
102
+ readonly reason?: 'policy_denied' | 'not_supported' | 'already_applied';
103
+ /**
104
+ * Detailed Message
105
+ */
106
+ readonly message?: string;
107
+ }
108
+ /**
109
+ * Layout Change Event
110
+ *
111
+ * <p>Triggered when layout state changes.</p>
112
+ */
113
+ export interface LayoutChangeEvent {
114
+ /** Change Type */
115
+ readonly type: 'fullscreen' | 'sidebar' | 'header' | 'footer' | 'breakpoint' | 'mode';
116
+ /** New State */
117
+ readonly state: LayoutState;
118
+ /** Previous State */
119
+ readonly previousState: LayoutState;
120
+ /** Change Source */
121
+ readonly source: 'user' | 'plugin' | 'system';
122
+ /** Plugin ID that initiated the change (if source is plugin) */
123
+ readonly pluginId?: string;
124
+ /** Change Timestamp */
125
+ readonly timestamp: number;
126
+ }
127
+ /**
128
+ * Layout Change Handler
129
+ */
130
+ export type LayoutChangeHandler = (event: LayoutChangeEvent) => void;
131
+ /**
132
+ * Layout Capability Type Identifier
133
+ */
134
+ export declare const LayoutCapabilityType: unique symbol;
135
+ /**
136
+ * Layout Capability Contract
137
+ *
138
+ * <p>Provides layout control capability for plugins, including fullscreen, sidebar, header, etc.</p>
139
+ *
140
+ * <h3>Design Principles</h3>
141
+ * <ul>
142
+ * <li>Layout is entirely controlled by the Host</li>
143
+ * <li>Plugins can only "request" layout behavior, Host decides whether to respond</li>
144
+ * <li>All requests go through governance policy checks</li>
145
+ * </ul>
146
+ *
147
+ * <h3>Usage Example</h3>
148
+ * ```typescript
149
+ * const layout = context.getCapability<LayoutCapability>(LayoutCapabilityType);
150
+ *
151
+ * // Request fullscreen
152
+ * const success = await layout.requestFullscreen();
153
+ *
154
+ * // Get current state
155
+ * const state = layout.getState();
156
+ * if (state.isMobile) {
157
+ * // Mobile handling...
158
+ * }
159
+ *
160
+ * // Subscribe to layout changes
161
+ * const unsubscribe = layout.onLayoutChange((event) => {
162
+ * console.log(`Layout change: ${event.type}`);
163
+ * });
164
+ * ```
165
+ *
166
+ * @since 3.2.0
167
+ */
168
+ export interface LayoutCapability {
169
+ /**
170
+ * Get Current Layout State
171
+ *
172
+ * @returns Layout state object
173
+ */
174
+ getState(): LayoutState;
175
+ /**
176
+ * Check if Fullscreen
177
+ *
178
+ * @returns Whether in fullscreen mode
179
+ */
180
+ isFullscreen(): boolean;
181
+ /**
182
+ * Check if Sidebar is Visible
183
+ *
184
+ * @returns Whether visible
185
+ */
186
+ isSidebarVisible(): boolean;
187
+ /**
188
+ * Check if Sidebar is Collapsed
189
+ *
190
+ * @returns Whether collapsed
191
+ */
192
+ isSidebarCollapsed(): boolean;
193
+ /**
194
+ * Request Enter Fullscreen Mode
195
+ *
196
+ * @returns Whether successful
197
+ */
198
+ requestFullscreen(): Promise<boolean>;
199
+ /**
200
+ * Request Exit Fullscreen Mode
201
+ *
202
+ * @returns Whether successful
203
+ */
204
+ requestExitFullscreen(): Promise<boolean>;
205
+ /**
206
+ * Request Hide Sidebar
207
+ *
208
+ * @returns Whether successful
209
+ */
210
+ requestHideSidebar(): Promise<boolean>;
211
+ /**
212
+ * Request Show Sidebar
213
+ *
214
+ * @returns Whether successful
215
+ */
216
+ requestShowSidebar(): Promise<boolean>;
217
+ /**
218
+ * Request Collapse Sidebar
219
+ *
220
+ * @returns Whether successful
221
+ */
222
+ requestCollapseSidebar?(): Promise<boolean>;
223
+ /**
224
+ * Request Expand Sidebar
225
+ *
226
+ * @returns Whether successful
227
+ */
228
+ requestExpandSidebar?(): Promise<boolean>;
229
+ /**
230
+ * Request Toggle Sidebar Collapse State
231
+ *
232
+ * @returns Whether successful
233
+ */
234
+ requestToggleSidebar?(): Promise<boolean>;
235
+ /**
236
+ * Request Hide Header
237
+ *
238
+ * @returns Whether successful
239
+ */
240
+ requestHideHeader?(): Promise<boolean>;
241
+ /**
242
+ * Request Show Header
243
+ *
244
+ * @returns Whether successful
245
+ */
246
+ requestShowHeader?(): Promise<boolean>;
247
+ /**
248
+ * Request Hide Footer
249
+ *
250
+ * @returns Whether successful
251
+ */
252
+ requestHideFooter?(): Promise<boolean>;
253
+ /**
254
+ * Request Show Footer
255
+ *
256
+ * @returns Whether successful
257
+ */
258
+ requestShowFooter?(): Promise<boolean>;
259
+ /**
260
+ * Request Layout Change
261
+ *
262
+ * <p>Can change multiple layout parameters simultaneously.</p>
263
+ *
264
+ * @param changes Layout change parameters
265
+ * @returns Request result
266
+ */
267
+ requestLayoutChange?(changes: Partial<{
268
+ fullscreen: boolean;
269
+ sidebarVisible: boolean;
270
+ sidebarCollapsed: boolean;
271
+ headerVisible: boolean;
272
+ footerVisible: boolean;
273
+ }>): Promise<LayoutRequestResult>;
274
+ /**
275
+ * Switch Layout Mode
276
+ *
277
+ * @param mode Target layout mode
278
+ * @returns Whether successful
279
+ */
280
+ setLayoutMode?(mode: LayoutMode): Promise<boolean>;
281
+ /**
282
+ * Get Current Breakpoint
283
+ *
284
+ * @returns Breakpoint name
285
+ */
286
+ getBreakpoint?(): 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
287
+ /**
288
+ * Check if Mobile View
289
+ *
290
+ * @returns Whether mobile
291
+ */
292
+ isMobileView?(): boolean;
293
+ /**
294
+ * Subscribe to Layout Change Event
295
+ *
296
+ * @param handler Event handler
297
+ * @returns Unsubscribe function
298
+ */
299
+ onLayoutChange?(handler: LayoutChangeHandler): Unsubscribe;
300
+ }
301
+ //# sourceMappingURL=layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/types/layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE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C,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAE5C;;;;OAIG;IACH,oBAAoB,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAE1C;;;;OAIG;IACH,oBAAoB,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAM1C;;;;OAIG;IACH,iBAAiB,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAEvC;;;;OAIG;IACH,iBAAiB,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAEvC;;;;OAIG;IACH,iBAAiB,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAEvC;;;;OAIG;IACH,iBAAiB,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAMvC;;;;;;;OAOG;IACH,mBAAmB,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC;QACpC,UAAU,EAAE,OAAO,CAAC;QACpB,cAAc,EAAE,OAAO,CAAC;QACxB,gBAAgB,EAAE,OAAO,CAAC;QAC1B,aAAa,EAAE,OAAO,CAAC;QACvB,aAAa,EAAE,OAAO,CAAC;KACxB,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAElC;;;;;OAKG;IACH,aAAa,CAAC,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAMnD;;;;OAIG;IACH,aAAa,CAAC,IAAI,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IAE3D;;;;OAIG;IACH,YAAY,CAAC,IAAI,OAAO,CAAC;IAMzB;;;;;OAKG;IACH,cAAc,CAAC,CAAC,OAAO,EAAE,mBAAmB,GAAG,WAAW,CAAC;CAC5D"}
@@ -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
+ /** Dependent Module List */
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":["../../../src/types/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH;;;;;;;;GAQG;AAMH;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,gBAAgB;IAChB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,kBAAkB;IAClB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qBAAqB;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yBAAyB;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,aAAa;IACb,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,4BAA4B;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CAClC;AAMD;;GAEG;AACH,oBAAY,WAAW;IACrB,eAAe;IACf,QAAQ,aAAa;IACrB,cAAc;IACd,OAAO,YAAY;IACnB,aAAa;IACb,MAAM,WAAW;IACjB,aAAa;IACb,MAAM,WAAW;IACjB,kBAAkB;IAClB,KAAK,UAAU;CAChB;AAMD;;GAEG;AACH,oBAAY,oBAAoB;IAC9B,kBAAkB;IAClB,WAAW,gBAAgB;IAC3B,iBAAiB;IACjB,UAAU,eAAe;IACzB,sBAAsB;IACtB,eAAe,oBAAoB;IACnC,qBAAqB;IACrB,cAAc,mBAAmB;IACjC,wBAAwB;IACxB,iBAAiB,sBAAsB;IACvC,uBAAuB;IACvB,gBAAgB,qBAAqB;IACrC,YAAY;IACZ,KAAK,UAAU;CAChB"}
@@ -0,0 +1,295 @@
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 Navigation-Related Type Definitions
18
+ * @description Defines core types for the navigation system, including navigation options, route change listening, etc.
19
+ * @module @brix/runtime-sdk-api-web/types/navigation
20
+ * @version 3.2.0
21
+ *
22
+ * [v3.2 Changes]
23
+ * Extracted from index.ts into a standalone type file, and promoted common contracts from infra-adapter-router-web.
24
+ *
25
+ * [v3.2.0 Phase 1 Additions]
26
+ * - Added NavigateResult: Navigation result type
27
+ * - Added WebNavigateOptions: Web navigation options
28
+ * - Added PageChangeEvent: Page change event
29
+ * - Added PageChangeHandler: Page change handler
30
+ *
31
+ * [Design Principles]
32
+ * - Define common navigation contracts, router adapters implement specific logic
33
+ * - Support declarative navigation (PageId) and imperative navigation (Path)
34
+ */
35
+ import type { Unsubscribe } from './event';
36
+ /**
37
+ * Navigation Options
38
+ *
39
+ * <p>Configuration options controlling navigation behavior.</p>
40
+ */
41
+ export interface NavigateOptions {
42
+ /**
43
+ * Whether to Replace Current History Entry
44
+ *
45
+ * <p>When true, the new page replaces the current page's position in the history stack.</p>
46
+ */
47
+ replace?: boolean;
48
+ /**
49
+ * Route State
50
+ *
51
+ * <p>State data passed to the target page.</p>
52
+ */
53
+ state?: Record<string, unknown>;
54
+ }
55
+ /**
56
+ * Web Navigation Options
57
+ *
58
+ * <p>Compared to basic NavigateOptions, provides richer navigation control.</p>
59
+ *
60
+ * @since 3.2.0
61
+ */
62
+ export interface WebNavigateOptions extends NavigateOptions {
63
+ /**
64
+ * Whether to Open in New Window
65
+ *
66
+ * @default false
67
+ */
68
+ openInNewWindow?: boolean;
69
+ /**
70
+ * Skip Governance Policy Check
71
+ *
72
+ * <p>For Host internal use only, plugins setting this has no effect.</p>
73
+ *
74
+ * @internal
75
+ */
76
+ skipGovernance?: boolean;
77
+ }
78
+ /**
79
+ * Navigation Result
80
+ *
81
+ * <p>Describes the execution result of a navigation request. In governance mode,
82
+ * navigation initiated by plugins is a "request" not a "command", Host may reject navigation.</p>
83
+ *
84
+ * @since 3.2.0
85
+ */
86
+ export interface NavigateResult {
87
+ /**
88
+ * Whether Navigation Succeeded
89
+ */
90
+ readonly success: boolean;
91
+ /**
92
+ * Failure Reason (only has value when success=false)
93
+ *
94
+ * - 'permission_denied': Insufficient permissions
95
+ * - 'feature_disabled': Feature is disabled
96
+ * - 'page_not_found': Page does not exist
97
+ * - 'host_rejected': Host rejected navigation
98
+ * - 'navigation_blocked': Navigation was blocked (e.g., unsaved form)
99
+ */
100
+ readonly reason?: 'permission_denied' | 'feature_disabled' | 'page_not_found' | 'host_rejected' | 'navigation_blocked';
101
+ /**
102
+ * Detailed Error Message
103
+ */
104
+ readonly message?: string;
105
+ }
106
+ /**
107
+ * Page Change Event
108
+ *
109
+ * <p>Describes page switch details for page monitoring and analytics.</p>
110
+ *
111
+ * @since 3.2.0
112
+ */
113
+ export interface PageChangeEvent {
114
+ /**
115
+ * Current Page ID
116
+ *
117
+ * <p>Format: {pluginId}:{pageName}, e.g., 'booking:detail'.</p>
118
+ */
119
+ readonly pageId: string;
120
+ /**
121
+ * Page Parameters
122
+ *
123
+ * <p>Parameter object passed to the target page.</p>
124
+ */
125
+ readonly params?: Record<string, unknown>;
126
+ /**
127
+ * Source Page ID (if any)
128
+ */
129
+ readonly fromPageId?: string;
130
+ /**
131
+ * Navigation Type
132
+ *
133
+ * - 'push': Forward navigation (clicking link/button)
134
+ * - 'pop': Back navigation (browser back)
135
+ * - 'replace': Replace navigation
136
+ */
137
+ readonly navigationType: 'push' | 'pop' | 'replace';
138
+ }
139
+ /**
140
+ * Page Change Handler
141
+ *
142
+ * @since 3.2.0
143
+ */
144
+ export type PageChangeHandler = (event: PageChangeEvent) => void;
145
+ /**
146
+ * Navigation Capability Type Identifier
147
+ */
148
+ export declare const NavigationCapabilityType: unique symbol;
149
+ /**
150
+ * Navigation Capability Contract
151
+ *
152
+ * <p>Provides page navigation capability for plugins, replacing direct use of react-router.</p>
153
+ *
154
+ * <h3>Design Principles</h3>
155
+ * <ul>
156
+ * <li>Plugins only perceive PageId, not URL</li>
157
+ * <li>All navigation is a "request", Host can reject</li>
158
+ * <li>Governance policies support permission checks, plugin isolation, Feature Flags</li>
159
+ * </ul>
160
+ *
161
+ * <h3>Basic Usage (Imperative Navigation)</h3>
162
+ * ```typescript
163
+ * const nav = context.getCapability<NavigationCapability>(NavigationCapabilityType);
164
+ * nav.navigate('/booking/list');
165
+ * nav.goBack();
166
+ * ```
167
+ *
168
+ * <h3>Advanced Usage (Request-Based Navigation)</h3>
169
+ * ```typescript
170
+ * const nav = context.getCapability<NavigationCapability>(NavigationCapabilityType);
171
+ *
172
+ * // Request navigation to page (may be rejected)
173
+ * const result = await nav.requestNavigate('booking:detail', { id: '123' });
174
+ * if (!result.success) {
175
+ * console.error('Navigation failed:', result.reason, result.message);
176
+ * }
177
+ *
178
+ * // Subscribe to page changes
179
+ * const unsubscribe = nav.onPageChange((event) => {
180
+ * console.log('Page changed:', event.pageId);
181
+ * });
182
+ * ```
183
+ *
184
+ * @since 3.0.0
185
+ */
186
+ export interface NavigationCapability {
187
+ /**
188
+ * Navigate to Specified Path
189
+ *
190
+ * <p>Imperative navigation, executed directly. For controlled navigation, use requestNavigate.</p>
191
+ *
192
+ * @param path Target path
193
+ * @param options Navigation options
194
+ */
195
+ navigate(path: string, options?: NavigateOptions): void;
196
+ /**
197
+ * Go Back to Previous Page
198
+ */
199
+ goBack(): void;
200
+ /**
201
+ * Get Current Path
202
+ *
203
+ * @returns Current URL path
204
+ */
205
+ getCurrentPath(): string;
206
+ /**
207
+ * Request Navigation to Specified Page
208
+ *
209
+ * <p>This is a "request" not a "command", Host can reject navigation based on governance policies.</p>
210
+ *
211
+ * @param pageId Target page ID (format: {pluginId}:{pageName})
212
+ * @param params Page parameters
213
+ * @param options Navigation options
214
+ * @returns Navigation result
215
+ *
216
+ * @since 3.2.0
217
+ */
218
+ requestNavigate?(pageId: string, params?: Record<string, unknown>, options?: WebNavigateOptions): Promise<NavigateResult>;
219
+ /**
220
+ * Check If Navigation to Specified Page Is Possible
221
+ *
222
+ * <p>Pre-check, does not execute actual navigation.</p>
223
+ *
224
+ * @param pageId Target page ID
225
+ * @returns Whether navigation is possible
226
+ *
227
+ * @since 3.2.0
228
+ */
229
+ canNavigate?(pageId: string): boolean;
230
+ /**
231
+ * Get Current Page ID
232
+ *
233
+ * @returns Current page ID, returns empty string if unrecognized
234
+ *
235
+ * @since 3.2.0
236
+ */
237
+ getCurrentPageId?(): string;
238
+ /**
239
+ * Get Current Page Parameters
240
+ *
241
+ * @typeParam T Parameter type
242
+ * @returns Page parameter object
243
+ *
244
+ * @since 3.2.0
245
+ */
246
+ getPageParams?<T extends Record<string, unknown> = Record<string, unknown>>(): T;
247
+ /**
248
+ * Request Go Back to Previous Page
249
+ *
250
+ * @returns Navigation result
251
+ *
252
+ * @since 3.2.0
253
+ */
254
+ requestGoBack?(): Promise<NavigateResult>;
255
+ /**
256
+ * Subscribe to Page Change Events
257
+ *
258
+ * @param handler Page change handler
259
+ * @returns Unsubscribe function
260
+ *
261
+ * @since 3.2.0
262
+ */
263
+ onPageChange?(handler: PageChangeHandler): Unsubscribe;
264
+ }
265
+ /**
266
+ * Navigation Options (Compatibility Alias)
267
+ */
268
+ export type NavigationOptions = NavigateOptions;
269
+ /**
270
+ * Route Change Listener
271
+ *
272
+ * <p>Used to listen for route change events.</p>
273
+ */
274
+ export type RouteChangeListener = (path: string) => void;
275
+ /**
276
+ * Router Capability Type Identifier (Compatibility Alias)
277
+ *
278
+ * @deprecated Please use NavigationCapabilityType.
279
+ * This alias will be removed in v4.0.0.
280
+ *
281
+ * @since 3.0.0
282
+ * @see NavigationCapabilityType
283
+ */
284
+ export declare const RouterCapabilityType: symbol;
285
+ /**
286
+ * Router Capability (Compatibility Alias)
287
+ *
288
+ * @deprecated Please use NavigationCapability.
289
+ * This alias will be removed in v4.0.0.
290
+ *
291
+ * @since 3.0.0
292
+ * @see NavigationCapability
293
+ */
294
+ export type RouterCapability = NavigationCapability;
295
+ //# sourceMappingURL=navigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../src/types/navigation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAM3C;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAMD;;;;;;GAMG;AACH,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAMD;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B;;;;;;;;OAQG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,eAAe,GAAG,oBAAoB,CAAC;IAEvH;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAMD;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IA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