@equinor/fusion-framework-react 8.0.0-next.0 → 8.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/CHANGELOG.md +48 -12
- package/README.md +164 -31
- package/dist/esm/Framework.js +32 -0
- package/dist/esm/Framework.js.map +1 -1
- package/dist/esm/app/index.js.map +1 -1
- package/dist/esm/app/useAppProvider.js +11 -2
- package/dist/esm/app/useAppProvider.js.map +1 -1
- package/dist/esm/app/useApps.js +17 -3
- package/dist/esm/app/useApps.js.map +1 -1
- package/dist/esm/app/useCurrentApp.js +25 -4
- package/dist/esm/app/useCurrentApp.js.map +1 -1
- package/dist/esm/app/useCurrentAppModule.js +13 -7
- package/dist/esm/app/useCurrentAppModule.js.map +1 -1
- package/dist/esm/app/useCurrentAppModules.js +14 -4
- package/dist/esm/app/useCurrentAppModules.js.map +1 -1
- package/dist/esm/context/index.js +10 -0
- package/dist/esm/context/index.js.map +1 -1
- package/dist/esm/context/useCurrentContext.js +16 -0
- package/dist/esm/context/useCurrentContext.js.map +1 -1
- package/dist/esm/context.js +9 -0
- package/dist/esm/context.js.map +1 -1
- package/dist/esm/create-framework-provider.js +29 -8
- package/dist/esm/create-framework-provider.js.map +1 -1
- package/dist/esm/feature-flag/index.js +10 -0
- package/dist/esm/feature-flag/index.js.map +1 -1
- package/dist/esm/feature-flag/useCurrentAppFeatures.js +12 -2
- package/dist/esm/feature-flag/useCurrentAppFeatures.js.map +1 -1
- package/dist/esm/feature-flag/useFeature.js +12 -5
- package/dist/esm/feature-flag/useFeature.js.map +1 -1
- package/dist/esm/feature-flag/useFeatures.js +14 -5
- package/dist/esm/feature-flag/useFeatures.js.map +1 -1
- package/dist/esm/feature-flag/useFrameworkFeature.js +12 -5
- package/dist/esm/feature-flag/useFrameworkFeature.js.map +1 -1
- package/dist/esm/feature-flag/useFrameworkFeatures.js +11 -4
- package/dist/esm/feature-flag/useFrameworkFeatures.js.map +1 -1
- package/dist/esm/hooks/index.js +8 -0
- package/dist/esm/hooks/index.js.map +1 -1
- package/dist/esm/hooks/use-current-user.js +14 -0
- package/dist/esm/hooks/use-current-user.js.map +1 -1
- package/dist/esm/hooks/use-http-client.js +13 -0
- package/dist/esm/hooks/use-http-client.js.map +1 -1
- package/dist/esm/http/index.js +10 -0
- package/dist/esm/http/index.js.map +1 -1
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/useFramework.js +16 -4
- package/dist/esm/useFramework.js.map +1 -1
- package/dist/esm/useFrameworkModule.js +13 -6
- package/dist/esm/useFrameworkModule.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/Framework.d.ts +37 -0
- package/dist/types/app/index.d.ts +10 -0
- package/dist/types/app/useAppProvider.d.ts +11 -2
- package/dist/types/app/useApps.d.ts +17 -3
- package/dist/types/app/useCurrentApp.d.ts +25 -4
- package/dist/types/app/useCurrentAppModule.d.ts +13 -7
- package/dist/types/app/useCurrentAppModules.d.ts +14 -4
- package/dist/types/context/index.d.ts +10 -0
- package/dist/types/context/useCurrentContext.d.ts +16 -0
- package/dist/types/context.d.ts +0 -1
- package/dist/types/create-framework-provider.d.ts +29 -8
- package/dist/types/feature-flag/index.d.ts +10 -0
- package/dist/types/feature-flag/useCurrentAppFeatures.d.ts +12 -2
- package/dist/types/feature-flag/useFeature.d.ts +23 -6
- package/dist/types/feature-flag/useFeatures.d.ts +23 -6
- package/dist/types/feature-flag/useFrameworkFeature.d.ts +12 -5
- package/dist/types/feature-flag/useFrameworkFeatures.d.ts +11 -4
- package/dist/types/hooks/index.d.ts +8 -0
- package/dist/types/hooks/use-current-user.d.ts +14 -0
- package/dist/types/hooks/use-http-client.d.ts +15 -0
- package/dist/types/http/index.d.ts +10 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/useFramework.d.ts +16 -4
- package/dist/types/useFrameworkModule.d.ts +13 -6
- package/dist/types/version.d.ts +1 -1
- package/package.json +15 -14
- package/src/Framework.tsx +37 -0
- package/src/app/index.ts +10 -0
- package/src/app/useAppProvider.ts +11 -2
- package/src/app/useApps.ts +17 -3
- package/src/app/useCurrentApp.ts +25 -4
- package/src/app/useCurrentAppModule.ts +13 -7
- package/src/app/useCurrentAppModules.ts +14 -4
- package/src/context/index.ts +10 -0
- package/src/context/useCurrentContext.ts +16 -0
- package/src/context.ts +9 -0
- package/src/create-framework-provider.tsx +29 -8
- package/src/feature-flag/index.ts +10 -0
- package/src/feature-flag/useCurrentAppFeatures.ts +12 -2
- package/src/feature-flag/useFeature.ts +23 -6
- package/src/feature-flag/useFeatures.ts +23 -6
- package/src/feature-flag/useFrameworkFeature.ts +12 -5
- package/src/feature-flag/useFrameworkFeatures.ts +11 -4
- package/src/hooks/index.ts +8 -0
- package/src/hooks/use-current-user.ts +14 -0
- package/src/hooks/use-http-client.ts +16 -0
- package/src/http/index.ts +10 -0
- package/src/index.tsx +8 -0
- package/src/useFramework.ts +16 -4
- package/src/useFrameworkModule.ts +13 -6
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
## 8.0.0
|
|
3
|
+
## 8.0.0
|
|
4
4
|
|
|
5
5
|
### Major Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- abffa53: Major version bump for Fusion Framework React 19 release.
|
|
8
|
+
|
|
9
|
+
All packages are bumped to the next major version as part of the React 19 upgrade. This release drops support for React versions below 18 and includes breaking changes across the framework.
|
|
10
|
+
|
|
11
|
+
**Breaking changes:**
|
|
12
|
+
- Peer dependencies now require React 18 or 19 (`^18.0.0 || ^19.0.0`)
|
|
13
|
+
- React Router upgraded from v6 to v7
|
|
14
|
+
- Navigation module refactored with new history API
|
|
15
|
+
- `renderComponent` and `renderApp` now use `createRoot` API
|
|
16
|
+
|
|
17
|
+
**Migration:**
|
|
18
|
+
- Update your React version to 18.0.0 or higher before upgrading
|
|
19
|
+
- Replace `NavigationProvider.createRouter()` with `@equinor/fusion-framework-react-router`
|
|
20
|
+
- See individual package changelogs for package-specific migration steps
|
|
21
|
+
|
|
22
|
+
- abffa53: Require React 18+ as peer dependency. React 17 is no longer supported.
|
|
8
23
|
|
|
9
24
|
**Migration:** Update your application to React 18+ to continue using these packages.
|
|
10
25
|
|
|
11
26
|
Closes https://github.com/equinor/fusion-framework/issues/3504
|
|
12
27
|
|
|
13
|
-
-
|
|
28
|
+
- abffa53: Upgrade to React 19 and remove support for React versions lower than 18.
|
|
14
29
|
|
|
15
30
|
**Breaking changes:**
|
|
16
31
|
- Peer dependencies now require React 18 or 19 (`^18.0.0 || ^19.0.0`)
|
|
@@ -21,18 +36,39 @@
|
|
|
21
36
|
- Update your React version to 18.0.0 or higher before upgrading these packages
|
|
22
37
|
- If using React 16 or 17, upgrade to React 18 or 19 first
|
|
23
38
|
|
|
39
|
+
Closes https://github.com/equinor/fusion-framework/issues/3504
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Updated dependencies [abffa53]
|
|
44
|
+
- Updated dependencies [abffa53]
|
|
45
|
+
- Updated dependencies [abffa53]
|
|
46
|
+
- Updated dependencies [abffa53]
|
|
47
|
+
- Updated dependencies [abffa53]
|
|
48
|
+
- Updated dependencies [abffa53]
|
|
49
|
+
- Updated dependencies [aaa3f74]
|
|
50
|
+
- @equinor/fusion-framework@8.0.0
|
|
51
|
+
- @equinor/fusion-framework-module@6.0.0
|
|
52
|
+
- @equinor/fusion-framework-module-feature-flag@2.0.0
|
|
53
|
+
- @equinor/fusion-framework-react-module@4.0.0
|
|
54
|
+
- @equinor/fusion-framework-react-module-http@11.0.0
|
|
55
|
+
- @equinor/fusion-framework-react-module-signalr@4.0.0
|
|
56
|
+
- @equinor/fusion-observable@9.0.0
|
|
57
|
+
|
|
58
|
+
## 7.4.20
|
|
59
|
+
|
|
24
60
|
### Patch Changes
|
|
25
61
|
|
|
26
|
-
- [#
|
|
62
|
+
- [#4157](https://github.com/equinor/fusion-framework/pull/4157) [`6aa8e1f`](https://github.com/equinor/fusion-framework/commit/6aa8e1f5c9d852b25e97aa7d98a63008c64d4581) Thanks [@Noggling](https://github.com/Noggling)! - Internal: patch release to align TypeScript types across packages for consistent type compatibility.
|
|
27
63
|
|
|
28
|
-
- Updated dependencies [[`
|
|
29
|
-
- @equinor/fusion-framework
|
|
30
|
-
- @equinor/fusion-framework-module-feature-flag@
|
|
31
|
-
- @equinor/fusion-framework-
|
|
32
|
-
- @equinor/fusion-framework-react-module-http@
|
|
33
|
-
- @equinor/fusion-
|
|
34
|
-
- @equinor/fusion-framework@
|
|
35
|
-
- @equinor/fusion-
|
|
64
|
+
- Updated dependencies [[`6aa8e1f`](https://github.com/equinor/fusion-framework/commit/6aa8e1f5c9d852b25e97aa7d98a63008c64d4581)]:
|
|
65
|
+
- @equinor/fusion-framework@7.4.13
|
|
66
|
+
- @equinor/fusion-framework-module-feature-flag@1.1.28
|
|
67
|
+
- @equinor/fusion-framework-module@5.0.6
|
|
68
|
+
- @equinor/fusion-framework-react-module-http@10.0.1
|
|
69
|
+
- @equinor/fusion-framework-react-module@3.1.14
|
|
70
|
+
- @equinor/fusion-framework-react-module-signalr@3.0.37
|
|
71
|
+
- @equinor/fusion-observable@8.5.8
|
|
36
72
|
|
|
37
73
|
## 7.4.19
|
|
38
74
|
|
package/README.md
CHANGED
|
@@ -1,44 +1,177 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @equinor/fusion-framework-react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React bindings for bootstrapping and consuming a [Fusion Framework](https://github.com/equinor/fusion-framework) instance inside a React application tree.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
- **Framework provider** — initialise and distribute the framework via React context with a single component or factory function.
|
|
8
|
+
- **`useFramework` hook** — access the active `Fusion` instance from any descendant component.
|
|
9
|
+
- **Module hooks** — retrieve individual framework modules (`useFrameworkModule`) without manual wiring.
|
|
10
|
+
- **App hooks** — observe the currently active application, query app manifests, and access app-level modules.
|
|
11
|
+
- **Context hook** — read the currently selected Fusion context.
|
|
12
|
+
- **Feature-flag hooks** — read, toggle, and observe feature flags at the framework or application level.
|
|
13
|
+
- **HTTP hook** — obtain pre-configured HTTP clients (`portal`, `people`) from the framework.
|
|
14
|
+
- **Auth hook** — retrieve the currently authenticated user.
|
|
15
|
+
- **SignalR hook** — subscribe to real-time SignalR hub topics.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
pnpm add @equinor/fusion-framework-react
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### Bootstrap the framework (declarative)
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { Framework } from '@equinor/fusion-framework-react';
|
|
29
|
+
|
|
30
|
+
const App = () => (
|
|
31
|
+
<Framework
|
|
32
|
+
configure={(configurator) => {
|
|
33
|
+
configurator.http.configureClient('my-api', {
|
|
34
|
+
baseUri: 'https://api.example.com',
|
|
35
|
+
});
|
|
36
|
+
}}
|
|
37
|
+
fallback={<span>Loading…</span>}
|
|
38
|
+
>
|
|
39
|
+
<MyApp />
|
|
40
|
+
</Framework>
|
|
41
|
+
);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Bootstrap the framework (factory)
|
|
10
45
|
|
|
11
46
|
```tsx
|
|
12
47
|
import { createFrameworkProvider } from '@equinor/fusion-framework-react';
|
|
48
|
+
import { Suspense, useMemo } from 'react';
|
|
13
49
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
50
|
+
const Portal = () => {
|
|
51
|
+
const Provider = useMemo(
|
|
52
|
+
() =>
|
|
53
|
+
createFrameworkProvider((config) => {
|
|
54
|
+
config.http.configureClient('my-api', {
|
|
55
|
+
baseUri: 'https://api.example.com',
|
|
56
|
+
});
|
|
57
|
+
}),
|
|
58
|
+
[],
|
|
59
|
+
);
|
|
19
60
|
|
|
20
61
|
return (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
62
|
+
<Suspense fallback={<span>Loading…</span>}>
|
|
63
|
+
<Provider>
|
|
64
|
+
<App />
|
|
65
|
+
</Provider>
|
|
66
|
+
</Suspense>
|
|
24
67
|
);
|
|
25
|
-
}
|
|
68
|
+
};
|
|
69
|
+
```
|
|
26
70
|
|
|
27
|
-
|
|
28
|
-
const framework = useFramework();
|
|
29
|
-
const [foo, setFoo] = useState();
|
|
71
|
+
### Consume the framework
|
|
30
72
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
client.fetch('/foobar').subscribe(x => setFoo(x.json()));
|
|
34
|
-
}, [framework.http])
|
|
35
|
-
}
|
|
73
|
+
```ts
|
|
74
|
+
import { useFramework } from '@equinor/fusion-framework-react';
|
|
36
75
|
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
76
|
+
const useMyService = () => {
|
|
77
|
+
const fusion = useFramework();
|
|
78
|
+
return fusion.modules.http.createClient('my-api');
|
|
79
|
+
};
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Get a specific module
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
import { useFrameworkModule } from '@equinor/fusion-framework-react';
|
|
86
|
+
import type { HttpModule } from '@equinor/fusion-framework-module-http';
|
|
87
|
+
|
|
88
|
+
const http = useFrameworkModule<HttpModule>('http');
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## API Reference
|
|
92
|
+
|
|
93
|
+
### Components
|
|
94
|
+
|
|
95
|
+
| Export | Description |
|
|
96
|
+
| --- | --- |
|
|
97
|
+
| `Framework` | Declarative component that initialises the framework and wraps children in providers. |
|
|
98
|
+
| `FrameworkProvider` | Low-level React context provider for an existing `Fusion` instance. |
|
|
99
|
+
|
|
100
|
+
### Factory
|
|
101
|
+
|
|
102
|
+
| Export | Description |
|
|
103
|
+
| --- | --- |
|
|
104
|
+
| `createFrameworkProvider(cb, ref?)` | Creates a `React.lazy` component that initialises the framework asynchronously. Must be rendered inside `<Suspense>`. |
|
|
105
|
+
|
|
106
|
+
### Core hooks
|
|
107
|
+
|
|
108
|
+
| Hook | Description |
|
|
109
|
+
| --- | --- |
|
|
110
|
+
| `useFramework()` | Returns the active `Fusion` instance from context. |
|
|
111
|
+
| `useFrameworkModule(name)` | Returns a specific module from the framework by key. |
|
|
112
|
+
|
|
113
|
+
### App hooks (`/app`)
|
|
114
|
+
|
|
115
|
+
| Hook | Description |
|
|
116
|
+
| --- | --- |
|
|
117
|
+
| `useApps(args?)` | Lists available app manifests. |
|
|
118
|
+
| `useCurrentApp()` | Observes and returns the currently active app. |
|
|
119
|
+
| `useCurrentAppModule(key)` | Retrieves a module from the current app. |
|
|
120
|
+
| `useCurrentAppModules()` | Observes initialised modules of the current app. |
|
|
121
|
+
| `useAppProvider()` | Returns the raw `AppModule` provider. |
|
|
122
|
+
|
|
123
|
+
### Context hook (`/context`)
|
|
124
|
+
|
|
125
|
+
| Hook | Description |
|
|
126
|
+
| --- | --- |
|
|
127
|
+
| `useCurrentContext()` | Returns the currently selected Fusion context. |
|
|
128
|
+
|
|
129
|
+
### Feature-flag hooks (`/feature-flag`)
|
|
130
|
+
|
|
131
|
+
| Hook | Description |
|
|
132
|
+
| --- | --- |
|
|
133
|
+
| `useFeature(provider, key)` | Reads and toggles a single feature flag. |
|
|
134
|
+
| `useFeatures(provider, selector?)` | Returns all feature flags with optional filtering. |
|
|
135
|
+
| `useFrameworkFeature(key)` | Reads a feature flag from the framework provider. |
|
|
136
|
+
| `useFrameworkFeatures()` | Returns all framework-level feature flags. |
|
|
137
|
+
| `useCurrentAppFeatures()` | Returns feature flags for the current app. |
|
|
138
|
+
|
|
139
|
+
### HTTP hook (`/http`)
|
|
140
|
+
|
|
141
|
+
| Hook | Description |
|
|
142
|
+
| --- | --- |
|
|
143
|
+
| `useFrameworkHttpClient(name)` | Returns a pre-configured HTTP client. |
|
|
144
|
+
|
|
145
|
+
### Convenience hooks (`/hooks`)
|
|
146
|
+
|
|
147
|
+
| Hook | Description |
|
|
148
|
+
| --- | --- |
|
|
149
|
+
| `useHttpClient(name)` | Returns a framework HTTP client (`'portal'` or `'people'`). |
|
|
150
|
+
| `useCurrentUser()` | Returns the authenticated user's account info. |
|
|
151
|
+
|
|
152
|
+
### SignalR hook (`/signalr`)
|
|
153
|
+
|
|
154
|
+
| Hook | Description |
|
|
155
|
+
| --- | --- |
|
|
156
|
+
| `useSignalR(hubId, topicId)` | Subscribes to a SignalR hub topic. |
|
|
157
|
+
|
|
158
|
+
### Re-exported types
|
|
159
|
+
|
|
160
|
+
| Type | Source |
|
|
161
|
+
| --- | --- |
|
|
162
|
+
| `Fusion` | `@equinor/fusion-framework` |
|
|
163
|
+
| `FusionConfigurator` | `@equinor/fusion-framework` |
|
|
164
|
+
| `AppManifest`, `AppConfig`, `AppType`, `IApp` | `@equinor/fusion-framework-module-app` |
|
|
165
|
+
| `IFeatureFlag`, `IFeatureFlagProvider` | `@equinor/fusion-framework-module-feature-flag` |
|
|
166
|
+
|
|
167
|
+
## Sub-entry-points
|
|
168
|
+
|
|
169
|
+
The package exposes several sub-entry-points for tree-shakeable imports:
|
|
170
|
+
|
|
171
|
+
- `@equinor/fusion-framework-react` — core providers and hooks
|
|
172
|
+
- `@equinor/fusion-framework-react/app` — application hooks
|
|
173
|
+
- `@equinor/fusion-framework-react/context` — context hooks
|
|
174
|
+
- `@equinor/fusion-framework-react/feature-flag` — feature-flag hooks
|
|
175
|
+
- `@equinor/fusion-framework-react/hooks` — convenience hooks
|
|
176
|
+
- `@equinor/fusion-framework-react/http` — HTTP hooks
|
|
177
|
+
- `@equinor/fusion-framework-react/signalr` — SignalR hooks
|
package/dist/esm/Framework.js
CHANGED
|
@@ -2,6 +2,38 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { createFrameworkProvider } from './create-framework-provider';
|
|
3
3
|
import { Suspense, useMemo } from 'react';
|
|
4
4
|
import { useModules } from '@equinor/fusion-framework-react-module';
|
|
5
|
+
/**
|
|
6
|
+
* Declarative React component that initialises a Fusion Framework instance
|
|
7
|
+
* and provides it to descendant components via context.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Internally calls {@link createFrameworkProvider} and wraps the lazy-loaded
|
|
11
|
+
* provider in a `<Suspense>` boundary. This is the recommended high-level
|
|
12
|
+
* component for portal / host applications that need to bootstrap the
|
|
13
|
+
* framework inside a React tree.
|
|
14
|
+
*
|
|
15
|
+
* @param props.configure - Callback that receives a {@link FrameworkConfigurator}
|
|
16
|
+
* for registering modules and configuration.
|
|
17
|
+
* @param props.fallback - React node shown while the framework is initialising.
|
|
18
|
+
* @param props.parent - Optional parent module instance to inherit configuration from.
|
|
19
|
+
* @param props.children - Application content rendered after initialisation.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* import { Framework } from '@equinor/fusion-framework-react';
|
|
24
|
+
*
|
|
25
|
+
* const App = () => (
|
|
26
|
+
* <Framework
|
|
27
|
+
* configure={(configurator) => {
|
|
28
|
+
* configurator.http.configureClient('my-api', { baseUri: 'https://api.example.com' });
|
|
29
|
+
* }}
|
|
30
|
+
* fallback={<span>Loading…</span>}
|
|
31
|
+
* >
|
|
32
|
+
* <MyApp />
|
|
33
|
+
* </Framework>
|
|
34
|
+
* );
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
5
37
|
export const Framework = (props) => {
|
|
6
38
|
const { configure, fallback, parent, children } = props;
|
|
7
39
|
//import modules from parent context
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Framework.js","sourceRoot":"","sources":["../../src/Framework.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAA0C,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"Framework.js","sourceRoot":"","sources":["../../src/Framework.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAA0C,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAUpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,KAKE,EACF,EAAE;IACF,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACxD,oCAAoC;IACpC,MAAM,GAAG,GAAG,UAAU,EAAM,CAAC;IAC7B,MAAM,SAAS,GAAG,OAAO,CACvB,GAAG,EAAE,CAAC,uBAAuB,CAAC,SAAS,EAAE,MAAM,IAAI,GAAG,CAAC,EACvD,CAAC,SAAS,EAAE,GAAG,EAAE,MAAM,CAAC,CACzB,CAAC;IACF,OAAO,CACL,KAAC,QAAQ,IAAC,QAAQ,EAAE,QAAQ,YAC1B,KAAC,SAAS,cAAE,QAAQ,GAAa,GACxB,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/app/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/app/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { useFramework } from '../useFramework';
|
|
2
2
|
/**
|
|
3
|
-
* React
|
|
4
|
-
*
|
|
3
|
+
* React hook that returns the App module provider from the framework.
|
|
4
|
+
*
|
|
5
|
+
* @returns The app module instance (`AppModule`) for querying and managing
|
|
6
|
+
* application manifests and the currently active app.
|
|
7
|
+
* @throws {Error} If the `AppModule` is not configured in the framework.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const provider = useAppProvider();
|
|
12
|
+
* provider.getAppManifests().subscribe(console.log);
|
|
13
|
+
* ```
|
|
5
14
|
*/
|
|
6
15
|
export const useAppProvider = () => {
|
|
7
16
|
const provider = useFramework().modules.app;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAppProvider.js","sourceRoot":"","sources":["../../../src/app/useAppProvider.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C
|
|
1
|
+
{"version":3,"file":"useAppProvider.js","sourceRoot":"","sources":["../../../src/app/useAppProvider.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAA8C,EAAE;IAC5E,MAAM,QAAQ,GAAG,YAAY,EAAe,CAAC,OAAO,CAAC,GAAG,CAAC;IACzD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/esm/app/useApps.js
CHANGED
|
@@ -2,9 +2,23 @@ import { useObservableState } from '@equinor/fusion-observable/react';
|
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { useAppProvider } from './useAppProvider';
|
|
4
4
|
/**
|
|
5
|
-
* React
|
|
6
|
-
*
|
|
7
|
-
* @
|
|
5
|
+
* React hook that retrieves available application manifests from the framework.
|
|
6
|
+
*
|
|
7
|
+
* @param args - Optional filtering options.
|
|
8
|
+
* @param args.filterByCurrentUser - When `true`, only apps accessible to the
|
|
9
|
+
* current user are returned.
|
|
10
|
+
* @returns An object containing:
|
|
11
|
+
* - `apps` — Array of {@link AppManifest} objects, or `undefined` while loading.
|
|
12
|
+
* - `isLoading` — `true` until the observable completes.
|
|
13
|
+
* - `error` — Any error emitted by the underlying observable.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* const { apps, isLoading, error } = useApps({ filterByCurrentUser: true });
|
|
18
|
+
* if (isLoading) return <Spinner />;
|
|
19
|
+
* return <AppList apps={apps} />;
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
8
22
|
* @since 7.1.1
|
|
9
23
|
*/
|
|
10
24
|
export const useApps = (args) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useApps.js","sourceRoot":"","sources":["../../../src/app/useApps.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AASlD
|
|
1
|
+
{"version":3,"file":"useApps.js","sourceRoot":"","sources":["../../../src/app/useApps.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AASlD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,IAAkB,EACuD,EAAE;IAC3E,MAAM,QAAQ,GAAG,cAAc,EAAE,CAAC;IAElC,MAAM,EAAE,mBAAmB,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC;IAE3C,MAAM,EACJ,KAAK,EAAE,IAAI,EACX,QAAQ,EACR,KAAK,GACN,GAAG,kBAAkB,CACpB,OAAO,CACL,GAAG,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EACzF,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAChC,CACF,CAAC;IAEF,OAAO,EAAE,IAAI,EAAE,IAAiC,EAAE,SAAS,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC;AAClF,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -2,12 +2,33 @@ import { useMemo } from 'react';
|
|
|
2
2
|
import { useObservableState } from '@equinor/fusion-observable/react';
|
|
3
3
|
import { useFramework } from '../useFramework';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* React hook that observes and returns the currently active application.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Subscribes to the `current$` stream on the App module and returns the
|
|
9
|
+
* latest value together with helpers to change or clear the active app.
|
|
8
10
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
+
* **Warning:** The template parameters are compile-time hints only — the
|
|
12
|
+
* hook does not validate that the specified modules are actually enabled.
|
|
13
|
+
*
|
|
14
|
+
* @template TModules - Tuple of module types the current app is expected to
|
|
15
|
+
* have configured (type-hint only).
|
|
16
|
+
* @template TEnv - Expected environment configuration shape (type-hint only).
|
|
17
|
+
*
|
|
18
|
+
* @returns An object containing:
|
|
19
|
+
* - `currentApp` — The current {@link CurrentApp} instance, `null` when
|
|
20
|
+
* explicitly cleared, or `undefined` while loading.
|
|
21
|
+
* - `setCurrentApp(appKey)` — Sets the active app by its key.
|
|
22
|
+
* - `clearCurrentApp()` — Clears the currently active app.
|
|
23
|
+
* - `error` — Any error emitted by the observable.
|
|
24
|
+
*
|
|
25
|
+
* @throws {Error} If the `AppModule` is not configured in the framework.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* const { currentApp, setCurrentApp } = useCurrentApp();
|
|
30
|
+
* return <button onClick={() => setCurrentApp('my-app')}>{currentApp?.manifest?.name}</button>;
|
|
31
|
+
* ```
|
|
11
32
|
*/
|
|
12
33
|
export const useCurrentApp = () => {
|
|
13
34
|
const provider = useFramework().modules.app;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentApp.js","sourceRoot":"","sources":["../../../src/app/useCurrentApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAStE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C
|
|
1
|
+
{"version":3,"file":"useCurrentApp.js","sourceRoot":"","sources":["../../../src/app/useCurrentApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAStE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAQ3B,EAAE;IACF,MAAM,QAAQ,GAAG,YAAY,EAAe,CAAC,OAAO,CAAC,GAAG,CAAC;IACzD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACtE,CAAC;IACD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,kBAAkB,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACxF,OAAO;QACL,UAAU,EAAE,KAAmC;QAC/C,aAAa,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;QAC/E,eAAe,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;QACnF,KAAK;KACN,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import useCurrentAppModules from './useCurrentAppModules';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* @template
|
|
6
|
-
* @
|
|
7
|
-
* @
|
|
3
|
+
* React hook that retrieves a specific module from the current application.
|
|
4
|
+
*
|
|
5
|
+
* @template TType - The expected module type.
|
|
6
|
+
* @template TKey - The module key used for look-up.
|
|
7
|
+
* @param moduleKey - The key of the module to retrieve.
|
|
8
|
+
* @returns An object containing:
|
|
9
|
+
* - `module` — The resolved module instance, `null` when no app is
|
|
10
|
+
* selected, or `undefined` if the app does not enable the requested module.
|
|
11
|
+
* - `error` — Any error emitted during initialisation.
|
|
12
|
+
* - `complete` — `true` when the observable has completed.
|
|
13
|
+
*
|
|
8
14
|
* @remarks
|
|
9
|
-
*
|
|
10
|
-
*
|
|
15
|
+
* - A `null` value means no application is currently selected.
|
|
16
|
+
* - An `undefined` value means the application has not enabled the requested module.
|
|
11
17
|
*/
|
|
12
18
|
export const useCurrentAppModule = (moduleKey) => {
|
|
13
19
|
const { modules, error, complete } = useCurrentAppModules();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentAppModule.js","sourceRoot":"","sources":["../../../src/app/useCurrentAppModule.ts"],"names":[],"mappings":"AAOA,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D
|
|
1
|
+
{"version":3,"file":"useCurrentAppModule.js","sourceRoot":"","sources":["../../../src/app/useCurrentAppModule.ts"],"names":[],"mappings":"AAOA,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAIjC,SAAe,EASf,EAAE;IACF,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC5D,MAAM,MAAM,GACV,OAAO,KAAK,IAAI;QACd,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,OAAO,KAAK,SAAS;YACrB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,8DAA8D;gBAC7D,OAAO,CAAC,SAAiC,CAAS,CAAC;IAC5D,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACrC,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -3,12 +3,22 @@ import useCurrentApp from './useCurrentApp';
|
|
|
3
3
|
import { of } from 'rxjs';
|
|
4
4
|
import { useObservableState } from '@equinor/fusion-observable/react';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* React hook that observes the initialised modules of the current application.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Subscribes to the `instance$` stream of the current app and returns the
|
|
10
|
+
* resolved module instances.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
+
* **Warning:** The template parameter is a compile-time hint only — the
|
|
13
|
+
* hook does not validate that the specified modules are actually enabled.
|
|
14
|
+
*
|
|
15
|
+
* @template TModules - Tuple of module types expected on the current app
|
|
16
|
+
* (type-hint only).
|
|
17
|
+
* @returns An object containing:
|
|
18
|
+
* - `modules` — The initialised {@link AppModulesInstance}, `null` when no
|
|
19
|
+
* app is selected, or `undefined` while loading.
|
|
20
|
+
* - `error` — Any error emitted during initialisation.
|
|
21
|
+
* - `complete` — `true` when the observable has completed.
|
|
12
22
|
*/
|
|
13
23
|
export const useCurrentAppModules = () => {
|
|
14
24
|
const { currentApp, error: appError } = useCurrentApp();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentAppModules.js","sourceRoot":"","sources":["../../../src/app/useCurrentAppModules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAmB,EAAE,EAAE,MAAM,MAAM,CAAC;AAE3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE
|
|
1
|
+
{"version":3,"file":"useCurrentAppModules.js","sourceRoot":"","sources":["../../../src/app/useCurrentAppModules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAmB,EAAE,EAAE,MAAM,MAAM,CAAC;AAE3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAIlC,EAAE;IACF,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,aAAa,EAAY,CAAC;IAClE,MAAM,QAAQ,GAAG,OAAO,CACtB,GAAG,EAAE,CACH,UAAU,CAAC,CAAC,CAAE,UAAU,CAAC,SAAsD,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAC5F,CAAC,UAAU,CAAC,CACb,CAAC;IACF,MAAM,EACJ,KAAK,EAAE,OAAO,EACd,KAAK,EACL,QAAQ,GACT,GAAG,kBAAkB,CAAC,QAAQ,EAAE;QAC/B,OAAO,EAAE,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,QAAQ,IAAI,IAAI,CAAC;KAC/E,CAAC,CAAC;IACH,OAAO;QACL,OAAO;QACP,KAAK,EAAE,KAAK,IAAI,QAAQ;QACxB,QAAQ;KACT,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context React hooks.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Available via the `@equinor/fusion-framework-react/context` sub-entry-point.
|
|
6
|
+
* Re-exports the context module’s React API and adds a convenience
|
|
7
|
+
* `useCurrentContext` hook that resolves the module from the framework.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
1
11
|
export * from '@equinor/fusion-framework-react-module-context';
|
|
2
12
|
export { useCurrentContext } from './useCurrentContext';
|
|
3
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/context/index.ts"],"names":[],"mappings":"AAAA,cAAc,gDAAgD,CAAC;AAE/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/context/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,cAAc,gDAAgD,CAAC;AAE/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import { useCurrentContext as _useCurrentContext } from '@equinor/fusion-framework-react-module-context';
|
|
2
2
|
import { useFramework } from '../useFramework';
|
|
3
|
+
/**
|
|
4
|
+
* React hook that returns the currently selected Fusion context.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This is a convenience wrapper that resolves the context module from the
|
|
8
|
+
* framework instance and delegates to the underlying
|
|
9
|
+
* `useCurrentContext` hook from `@equinor/fusion-framework-react-module-context`.
|
|
10
|
+
*
|
|
11
|
+
* @returns The current context state as defined by the context module.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const { currentContext } = useCurrentContext();
|
|
16
|
+
* console.log(currentContext?.id);
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
3
19
|
export const useCurrentContext = () => _useCurrentContext(useFramework().modules.context);
|
|
4
20
|
export default useCurrentContext;
|
|
5
21
|
//# sourceMappingURL=useCurrentContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentContext.js","sourceRoot":"","sources":["../../../src/context/useCurrentContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,IAAI,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACzG,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,kBAAkB,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAE1F,eAAe,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"useCurrentContext.js","sourceRoot":"","sources":["../../../src/context/useCurrentContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,IAAI,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACzG,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,kBAAkB,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAE1F,eAAe,iBAAiB,CAAC"}
|
package/dist/esm/context.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Internal React context that holds the current {@link Fusion} instance.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Consumers should not use this directly — prefer the {@link useFramework}
|
|
7
|
+
* hook or the {@link FrameworkProvider} component.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
2
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3
12
|
export const context = createContext(null);
|
|
4
13
|
/**
|
package/dist/esm/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,8DAA8D;AAC9D,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAqB,IAAI,CAAC,CAAC;AAE/D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC;;;;;;;;GAQG;AACH,8DAA8D;AAC9D,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAqB,IAAI,CAAC,CAAC;AAE/D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC"}
|
|
@@ -5,20 +5,41 @@ import { FrameworkConfigurator } from '@equinor/fusion-framework';
|
|
|
5
5
|
import { FrameworkProvider } from './context';
|
|
6
6
|
import { ModuleProvider } from '@equinor/fusion-framework-react-module';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Creates a lazy-loaded React component that initialises a Fusion Framework
|
|
9
|
+
* instance and exposes it via context providers.
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* This is the low-level factory used by the {@link Framework} component.
|
|
13
|
+
* Call it when you need fine-grained control over memoisation or when you
|
|
14
|
+
* want to embed the provider in a custom `<Suspense>` boundary.
|
|
15
|
+
*
|
|
16
|
+
* The returned component is created with `React.lazy`, so it **must** be
|
|
17
|
+
* rendered inside a `<Suspense>` boundary.
|
|
18
|
+
*
|
|
19
|
+
* @template TModules - Tuple of additional module types to register.
|
|
20
|
+
* @template TRef - Type of the optional parent module-instance reference.
|
|
21
|
+
*
|
|
22
|
+
* @param cb - Callback that receives a {@link FrameworkConfigurator} (and an
|
|
23
|
+
* optional parent ref) for registering modules and configuration.
|
|
24
|
+
* @param ref - Optional parent module instance to inherit configuration from.
|
|
25
|
+
* @returns A `React.lazy` component that provides the initialised framework
|
|
26
|
+
* to its children.
|
|
11
27
|
*
|
|
12
|
-
* @param configurator - callback for configuring modules
|
|
13
28
|
* @example
|
|
14
29
|
* ```tsx
|
|
15
|
-
*
|
|
30
|
+
* import { createFrameworkProvider } from '@equinor/fusion-framework-react';
|
|
31
|
+
*
|
|
16
32
|
* const Portal = () => {
|
|
17
|
-
* const
|
|
33
|
+
* const FrameworkProvider = createFrameworkProvider((config) => {
|
|
34
|
+
* config.http.configureClient('my-api', { baseUri: 'https://api.example.com' });
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
18
37
|
* return (
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
38
|
+
* <Suspense fallback={<span>Loading…</span>}>
|
|
39
|
+
* <FrameworkProvider>
|
|
40
|
+
* <App />
|
|
41
|
+
* </FrameworkProvider>
|
|
42
|
+
* </Suspense>
|
|
22
43
|
* );
|
|
23
44
|
* };
|
|
24
45
|
* ```
|