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,98 @@
|
|
|
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 Tooltip Component Type Definitions
|
|
18
|
+
* @description Defines types for the Tooltip component in the UI adapter system
|
|
19
|
+
* @module @brix/runtime-sdk-api-web/types/ui/tooltip
|
|
20
|
+
* @version 3.2.0
|
|
21
|
+
*/
|
|
22
|
+
import type { ReactNode, CSSProperties } from 'react';
|
|
23
|
+
/**
|
|
24
|
+
* Tooltip Placement Options
|
|
25
|
+
*/
|
|
26
|
+
export type TooltipPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
|
|
27
|
+
/**
|
|
28
|
+
* Tooltip Component Props
|
|
29
|
+
*
|
|
30
|
+
* Informative text that appears on hover or focus.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <Tooltip title="Save changes" placement="top">
|
|
35
|
+
* <Button startIcon="save">Save</Button>
|
|
36
|
+
* </Tooltip>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export interface TooltipProps {
|
|
40
|
+
/**
|
|
41
|
+
* Tooltip Content
|
|
42
|
+
*
|
|
43
|
+
* The content displayed in the tooltip.
|
|
44
|
+
*/
|
|
45
|
+
title: ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* Tooltip Placement
|
|
48
|
+
*
|
|
49
|
+
* Position of the tooltip relative to the target element.
|
|
50
|
+
* @default 'top'
|
|
51
|
+
*/
|
|
52
|
+
placement?: TooltipPlacement;
|
|
53
|
+
/**
|
|
54
|
+
* Show Arrow
|
|
55
|
+
*
|
|
56
|
+
* When true, displays an arrow pointing to the target element.
|
|
57
|
+
* @default true
|
|
58
|
+
*/
|
|
59
|
+
arrow?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Enter Delay (ms)
|
|
62
|
+
*
|
|
63
|
+
* Delay before showing the tooltip.
|
|
64
|
+
* @default 100
|
|
65
|
+
*/
|
|
66
|
+
enterDelay?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Leave Delay (ms)
|
|
69
|
+
*
|
|
70
|
+
* Delay before hiding the tooltip.
|
|
71
|
+
* @default 0
|
|
72
|
+
*/
|
|
73
|
+
leaveDelay?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Disabled State
|
|
76
|
+
*
|
|
77
|
+
* When true, the tooltip is disabled.
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
disabled?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Custom Inline Styles
|
|
83
|
+
*
|
|
84
|
+
* Styles applied to the tooltip popup.
|
|
85
|
+
*/
|
|
86
|
+
style?: CSSProperties;
|
|
87
|
+
/**
|
|
88
|
+
* Custom CSS Class Name
|
|
89
|
+
*/
|
|
90
|
+
className?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Tooltip Target Element
|
|
93
|
+
*
|
|
94
|
+
* The element that triggers the tooltip on hover/focus.
|
|
95
|
+
*/
|
|
96
|
+
children: ReactNode;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=tooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../src/types/ui/tooltip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,KAAK,GACL,WAAW,GACX,SAAS,GACT,QAAQ,GACR,cAAc,GACd,YAAY,GACZ,MAAM,GACN,YAAY,GACZ,UAAU,GACV,OAAO,GACP,aAAa,GACb,WAAW,CAAC;AAEhB;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAE7B;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;OAIG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IAEtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
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 UI Adapter Type Definitions - Backward Compatibility Re-export
|
|
18
|
+
* @description Re-exports all UI adapter types from the ui/ subfolder for backward compatibility.
|
|
19
|
+
* @module @brix/runtime-sdk-api-web/types/ui
|
|
20
|
+
* @version 3.2.0
|
|
21
|
+
*
|
|
22
|
+
* [v3.2.0 Refactoring]
|
|
23
|
+
* The original 2100+ line file has been split into component-specific modules in the ui/ folder:
|
|
24
|
+
* - ui/common.ts: Shared types (ComponentSize)
|
|
25
|
+
* - ui/button.ts: Button component types
|
|
26
|
+
* - ui/input.ts: Input component types
|
|
27
|
+
* - ui/select.ts: Select component types
|
|
28
|
+
* - ui/card.ts: Card component types
|
|
29
|
+
* - ui/avatar.ts: Avatar component types
|
|
30
|
+
* - ui/badge.ts: Badge component types
|
|
31
|
+
* - ui/tooltip.ts: Tooltip component types
|
|
32
|
+
* - ui/menu.ts: Menu and MenuItem component types
|
|
33
|
+
* - ui/modal.ts: Modal component types
|
|
34
|
+
* - ui/message.ts: Message API types
|
|
35
|
+
* - ui/theme-tokens.ts: Theme tokens and preset values
|
|
36
|
+
* - ui/icon.ts: Icon component types
|
|
37
|
+
* - ui/adapter.ts: UIAdapter interface and capability symbol
|
|
38
|
+
*
|
|
39
|
+
* This file re-exports everything from the ui/ folder for backward compatibility.
|
|
40
|
+
* New code should import directly from '@brix/runtime-sdk-api-web/types/ui/[component]'.
|
|
41
|
+
*
|
|
42
|
+
* [Architectural Constraints - v3.0.4 Blueprint]
|
|
43
|
+
* - UIAdapter only contains ATOMIC components
|
|
44
|
+
* - Layout components (Sidebar, Header, Layout) are FORBIDDEN in UIAdapter
|
|
45
|
+
* - Shell layer assembles layouts using these atomic components
|
|
46
|
+
* - Host layer selects adapter via configuration
|
|
47
|
+
*/
|
|
48
|
+
export * from './ui/index';
|
|
49
|
+
//# sourceMappingURL=ui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../src/types/ui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,cAAc,YAAY,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "brix-runtime-sdk-api-web",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Brix Runtime SDK Web API - UI capability contracts and shared types (merged from runtime-sdk-shared)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/types/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"src"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsup && tsc --declaration --emitDeclarationOnly",
|
|
22
|
+
"dev": "tsup --watch",
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"test:update": "vitest run -u"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@types/react": "^18.0.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"tsup": "^8.0.0",
|
|
31
|
+
"typescript": "^5.7.3",
|
|
32
|
+
"vitest": "^1.2.0"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
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 Public API Snapshot Test (Golden File)
|
|
18
|
+
* @description Validates stability of public API exports to prevent accidental breaking changes
|
|
19
|
+
* @module @brix/runtime-sdk-api-web/test
|
|
20
|
+
* @version 3.2.0
|
|
21
|
+
*
|
|
22
|
+
* [Test Description]
|
|
23
|
+
* Golden File tests ensure the following by creating API export snapshots:
|
|
24
|
+
* 1. Public APIs are not accidentally modified
|
|
25
|
+
* 2. Type exports remain stable
|
|
26
|
+
* 3. Any API changes require explicit confirmation
|
|
27
|
+
*
|
|
28
|
+
* [Update Snapshot]
|
|
29
|
+
* When intentionally modifying the API, run:
|
|
30
|
+
* pnpm test -- -u
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
import { describe, it, expect } from 'vitest';
|
|
34
|
+
import * as ApiExports from './index';
|
|
35
|
+
|
|
36
|
+
// ============================================================================
|
|
37
|
+
// Public API Export List
|
|
38
|
+
// ============================================================================
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Expected capability type identifiers to be exported
|
|
42
|
+
*/
|
|
43
|
+
const EXPECTED_CAPABILITY_TYPES = [
|
|
44
|
+
'NavigationCapabilityType',
|
|
45
|
+
'EventBusCapabilityType',
|
|
46
|
+
'PluginStateCapabilityType',
|
|
47
|
+
'AuthCapabilityType',
|
|
48
|
+
'HttpCapabilityType',
|
|
49
|
+
'ConfigCapabilityType',
|
|
50
|
+
'I18nCapabilityType',
|
|
51
|
+
'ThemeCapabilityType',
|
|
52
|
+
'LayoutCapabilityType',
|
|
53
|
+
] as const;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Expected context-related exports
|
|
57
|
+
*/
|
|
58
|
+
const EXPECTED_CONTEXT_EXPORTS = [
|
|
59
|
+
'RuntimeContext',
|
|
60
|
+
'RuntimeContextProvider',
|
|
61
|
+
'createRuntimeContext',
|
|
62
|
+
] as const;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Expected plugin-related type exports
|
|
66
|
+
*/
|
|
67
|
+
const EXPECTED_PLUGIN_EXPORTS = [
|
|
68
|
+
'PluginEntry',
|
|
69
|
+
'PluginLifecycle',
|
|
70
|
+
'PluginContext',
|
|
71
|
+
'PluginStatus',
|
|
72
|
+
'PluginManifest',
|
|
73
|
+
] as const;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Expected navigation-related type exports
|
|
77
|
+
*/
|
|
78
|
+
const EXPECTED_NAVIGATION_EXPORTS = [
|
|
79
|
+
'NavigateResult',
|
|
80
|
+
'NavigateOptions',
|
|
81
|
+
'PageInfo',
|
|
82
|
+
'RouteContribution',
|
|
83
|
+
] as const;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Expected state-related type exports
|
|
87
|
+
*/
|
|
88
|
+
const EXPECTED_STATE_EXPORTS = [
|
|
89
|
+
'StatePersistenceOptions',
|
|
90
|
+
'PluginStateChangeEvent',
|
|
91
|
+
'PluginStateSubscribeOptions',
|
|
92
|
+
] as const;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Expected event-related type exports
|
|
96
|
+
*/
|
|
97
|
+
const EXPECTED_EVENT_EXPORTS = [
|
|
98
|
+
'EventHandler',
|
|
99
|
+
'EventSubscription',
|
|
100
|
+
'EventType',
|
|
101
|
+
'Unsubscribe',
|
|
102
|
+
] as const;
|
|
103
|
+
|
|
104
|
+
// ============================================================================
|
|
105
|
+
// Golden File Tests
|
|
106
|
+
// ============================================================================
|
|
107
|
+
|
|
108
|
+
describe('API Export Stability Tests (Golden File)', () => {
|
|
109
|
+
it('should export all expected modules', () => {
|
|
110
|
+
// Get actual exported keys
|
|
111
|
+
const actualExports = Object.keys(ApiExports);
|
|
112
|
+
|
|
113
|
+
// Snapshot verification
|
|
114
|
+
expect(actualExports.sort()).toMatchSnapshot('api-exports');
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
describe('Capability Type Identifiers', () => {
|
|
118
|
+
it('should export all capability type identifiers', () => {
|
|
119
|
+
for (const capType of EXPECTED_CAPABILITY_TYPES) {
|
|
120
|
+
expect(
|
|
121
|
+
ApiExports,
|
|
122
|
+
`Missing capability type identifier: ${capType}`
|
|
123
|
+
).toHaveProperty(capType);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('capability type identifier structure should remain stable', () => {
|
|
128
|
+
const capabilityTypes: Record<string, unknown> = {};
|
|
129
|
+
|
|
130
|
+
for (const capType of EXPECTED_CAPABILITY_TYPES) {
|
|
131
|
+
const exported = (ApiExports as Record<string, unknown>)[capType];
|
|
132
|
+
if (exported && typeof exported === 'object') {
|
|
133
|
+
capabilityTypes[capType] = {
|
|
134
|
+
id: (exported as { id?: string }).id,
|
|
135
|
+
name: (exported as { name?: string }).name,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
expect(capabilityTypes).toMatchSnapshot('capability-types');
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
describe('Context Exports', () => {
|
|
145
|
+
it('should export runtime context related modules', () => {
|
|
146
|
+
for (const contextExport of EXPECTED_CONTEXT_EXPORTS) {
|
|
147
|
+
// Context exports may be functions or components
|
|
148
|
+
const hasExport = contextExport in ApiExports;
|
|
149
|
+
if (!hasExport) {
|
|
150
|
+
// Some context exports may be type-only exports, skip check
|
|
151
|
+
console.warn(`Context export ${contextExport} may be a type-only export`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
describe('Type Export Completeness', () => {
|
|
158
|
+
it('plugin-related types should be accessible', () => {
|
|
159
|
+
// Types only exist at compile time, cannot be directly verified at runtime
|
|
160
|
+
// This test is mainly for documentation purposes
|
|
161
|
+
const typeNames = EXPECTED_PLUGIN_EXPORTS;
|
|
162
|
+
expect(typeNames.length).toBeGreaterThan(0);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it('navigation-related types should be accessible', () => {
|
|
166
|
+
const typeNames = EXPECTED_NAVIGATION_EXPORTS;
|
|
167
|
+
expect(typeNames.length).toBeGreaterThan(0);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
it('state-related types should be accessible', () => {
|
|
171
|
+
const typeNames = EXPECTED_STATE_EXPORTS;
|
|
172
|
+
expect(typeNames.length).toBeGreaterThan(0);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it('event-related types should be accessible', () => {
|
|
176
|
+
const typeNames = EXPECTED_EVENT_EXPORTS;
|
|
177
|
+
expect(typeNames.length).toBeGreaterThan(0);
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
// ============================================================================
|
|
183
|
+
// API Signature Stability
|
|
184
|
+
// ============================================================================
|
|
185
|
+
|
|
186
|
+
describe('API Signature Stability', () => {
|
|
187
|
+
it('export count should not decrease (prevent accidental deletion)', () => {
|
|
188
|
+
const actualExportCount = Object.keys(ApiExports).length;
|
|
189
|
+
|
|
190
|
+
// Set minimum export count baseline (adjust based on actual situation)
|
|
191
|
+
// This number should be set after the API stabilizes
|
|
192
|
+
const MIN_EXPECTED_EXPORTS = 5;
|
|
193
|
+
|
|
194
|
+
expect(
|
|
195
|
+
actualExportCount,
|
|
196
|
+
`Export count (${actualExportCount}) is below expected minimum (${MIN_EXPECTED_EXPORTS})`
|
|
197
|
+
).toBeGreaterThanOrEqual(MIN_EXPECTED_EXPORTS);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
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 Runtime Context Abstract Definition
|
|
18
|
+
* @description Defines the core interface for runtime context (no React dependency)
|
|
19
|
+
* @module @brix/runtime-sdk-api-web/context/RuntimeContext
|
|
20
|
+
* @version 3.2.0
|
|
21
|
+
*
|
|
22
|
+
* [v3.2 Refactoring Notes]
|
|
23
|
+
* Extracted RuntimeContext abstraction from index.ts to keep the contract layer free of React dependencies.
|
|
24
|
+
* React-related Context and Hooks are migrated to @brix/runtime-sdk-react package.
|
|
25
|
+
*
|
|
26
|
+
* [Design Principles]
|
|
27
|
+
* - Pure abstract interface, no dependency on any UI framework
|
|
28
|
+
* - Can be used in React, Vue, native JS, and other environments
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Runtime Context Interface
|
|
32
|
+
*
|
|
33
|
+
* <p>Provides a unified entry point for plugins to access runtime capabilities.</p>
|
|
34
|
+
*
|
|
35
|
+
* <h3>Responsibilities</h3>
|
|
36
|
+
* <ul>
|
|
37
|
+
* <li>Provides module ID identification</li>
|
|
38
|
+
* <li>Provides tenant ID identification</li>
|
|
39
|
+
* <li>Provides capability retrieval method</li>
|
|
40
|
+
* </ul>
|
|
41
|
+
*
|
|
42
|
+
* <h3>Usage Example</h3>
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const http = context.getCapability<HttpCapability>(HttpCapabilityType);
|
|
45
|
+
* const nav = context.getCapability<NavigationCapability>(NavigationCapabilityType);
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export interface RuntimeContext {
|
|
49
|
+
/**
|
|
50
|
+
* Module/Plugin ID
|
|
51
|
+
*
|
|
52
|
+
* <p>Unique identifier for the current plugin.</p>
|
|
53
|
+
*/
|
|
54
|
+
readonly moduleId: string;
|
|
55
|
+
/**
|
|
56
|
+
* Tenant ID
|
|
57
|
+
*
|
|
58
|
+
* <p>Tenant identifier for the current runtime environment.</p>
|
|
59
|
+
*/
|
|
60
|
+
readonly tenantId: string;
|
|
61
|
+
/**
|
|
62
|
+
* Get capability instance
|
|
63
|
+
*
|
|
64
|
+
* @param capabilityType Capability type identifier (Symbol)
|
|
65
|
+
* @returns Capability instance, returns undefined if not found
|
|
66
|
+
*/
|
|
67
|
+
getCapability<T>(capabilityType: symbol): T | undefined;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=RuntimeContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuntimeContext.d.ts","sourceRoot":"","sources":["RuntimeContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B;;;;;OAKG;IACH,aAAa,CAAC,CAAC,EAAE,cAAc,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;CACzD"}
|
|
@@ -0,0 +1,75 @@
|
|
|
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 Runtime Context Abstract Definition
|
|
18
|
+
* @description Defines the core interface for runtime context (no React dependency)
|
|
19
|
+
* @module @brix/runtime-sdk-api-web/context/RuntimeContext
|
|
20
|
+
* @version 3.2.0
|
|
21
|
+
*
|
|
22
|
+
* [v3.2 Refactoring Notes]
|
|
23
|
+
* Extracted RuntimeContext abstraction from index.ts to keep the contract layer free of React dependencies.
|
|
24
|
+
* React-related Context and Hooks are migrated to @brix/runtime-sdk-react package.
|
|
25
|
+
*
|
|
26
|
+
* [Design Principles]
|
|
27
|
+
* - Pure abstract interface, no dependency on any UI framework
|
|
28
|
+
* - Can be used in React, Vue, native JS, and other environments
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
// =========================================
|
|
32
|
+
// Runtime Context Interface
|
|
33
|
+
// =========================================
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Runtime Context Interface
|
|
37
|
+
*
|
|
38
|
+
* <p>Provides a unified entry point for plugins to access runtime capabilities.</p>
|
|
39
|
+
*
|
|
40
|
+
* <h3>Responsibilities</h3>
|
|
41
|
+
* <ul>
|
|
42
|
+
* <li>Provides module ID identification</li>
|
|
43
|
+
* <li>Provides tenant ID identification</li>
|
|
44
|
+
* <li>Provides capability retrieval method</li>
|
|
45
|
+
* </ul>
|
|
46
|
+
*
|
|
47
|
+
* <h3>Usage Example</h3>
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const http = context.getCapability<HttpCapability>(HttpCapabilityType);
|
|
50
|
+
* const nav = context.getCapability<NavigationCapability>(NavigationCapabilityType);
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export interface RuntimeContext {
|
|
54
|
+
/**
|
|
55
|
+
* Module/Plugin ID
|
|
56
|
+
*
|
|
57
|
+
* <p>Unique identifier for the current plugin.</p>
|
|
58
|
+
*/
|
|
59
|
+
readonly moduleId: string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Tenant ID
|
|
63
|
+
*
|
|
64
|
+
* <p>Tenant identifier for the current runtime environment.</p>
|
|
65
|
+
*/
|
|
66
|
+
readonly tenantId: string;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Get capability instance
|
|
70
|
+
*
|
|
71
|
+
* @param capabilityType Capability type identifier (Symbol)
|
|
72
|
+
* @returns Capability instance, returns undefined if not found
|
|
73
|
+
*/
|
|
74
|
+
getCapability<T>(capabilityType: symbol): T | undefined;
|
|
75
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 Context Module Unified Export
|
|
18
|
+
* @description Exports runtime context related types
|
|
19
|
+
* @module @brix/runtime-sdk-api-web/context
|
|
20
|
+
* @version 3.2.0
|
|
21
|
+
*/
|
|
22
|
+
export * from './RuntimeContext';
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 Context Module Unified Export
|
|
18
|
+
* @description Exports runtime context related types
|
|
19
|
+
* @module @brix/runtime-sdk-api-web/context
|
|
20
|
+
* @version 3.2.0
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
export * from './RuntimeContext';
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
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 @brix/runtime-sdk-api-web Unified Entry Point
|
|
18
|
+
* @description UI Capability Contract Definitions - Web Platform (Framework-agnostic)
|
|
19
|
+
* @module @brix/runtime-sdk-api-web
|
|
20
|
+
* @version 3.2.1
|
|
21
|
+
*
|
|
22
|
+
* [Module Responsibilities]
|
|
23
|
+
* Defines UI runtime capability contracts for plugins to obtain and use via RuntimeContext.
|
|
24
|
+
*
|
|
25
|
+
* [Capability Categories]
|
|
26
|
+
* - Navigation Capability: Page navigation, router management
|
|
27
|
+
* - Auth Capability: User identity, permission verification
|
|
28
|
+
* - State Capability: Plugin state management
|
|
29
|
+
* - EventBus Capability: Cross-plugin communication
|
|
30
|
+
* - Config Capability: Runtime configuration reading
|
|
31
|
+
* - Http Capability: Unified HTTP requests
|
|
32
|
+
*
|
|
33
|
+
* [Design Principles]
|
|
34
|
+
* - This module is a pure contract definition layer, containing no concrete implementations
|
|
35
|
+
* - Framework-agnostic: No dependency on React/Vue/Angular or other UI frameworks
|
|
36
|
+
* - Plugins only need to depend on this module
|
|
37
|
+
* - For React bindings, use @brix/runtime-sdk-react
|
|
38
|
+
*
|
|
39
|
+
* [v3.2.1 Refactoring Notes (v3.0.4 Architectural Constraint Fix)]
|
|
40
|
+
* - Removed all 963 lines of inline type declarations, eliminating duplicate type export issues
|
|
41
|
+
* - All type definitions are now exported uniformly from types/ directory
|
|
42
|
+
* - Context definitions are exported from context/ directory
|
|
43
|
+
* - Removed React dependency, achieving true framework independence
|
|
44
|
+
*
|
|
45
|
+
* [v3.2 Refactoring Notes]
|
|
46
|
+
* - Split into modular type files (types/)
|
|
47
|
+
* - Removed React dependency, React Hooks migrated to @brix/runtime-sdk-react
|
|
48
|
+
* - RouteContribution.component type changed to framework-agnostic ComponentType
|
|
49
|
+
*/
|
|
50
|
+
export * from './types';
|
|
51
|
+
export * from './context';
|
|
52
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAKH,cAAc,SAAS,CAAC;AAKxB,cAAc,WAAW,CAAC"}
|