@equinor/fusion-framework-react 7.1.4 → 7.2.1
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 +40 -0
- package/dist/esm/Framework.js +4 -1
- package/dist/esm/Framework.js.map +1 -1
- package/dist/esm/app/useCurrentAppModules.js +1 -1
- package/dist/esm/app/useCurrentAppModules.js.map +1 -1
- package/dist/esm/create-framework-provider.js +6 -6
- package/dist/esm/create-framework-provider.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/Framework.d.ts +2 -2
- package/dist/types/create-framework-provider.d.ts +4 -4
- package/dist/types/version.d.ts +1 -1
- package/package.json +13 -13
- package/src/Framework.tsx +6 -3
- package/src/app/useCurrentAppModules.ts +1 -1
- package/src/create-framework-provider.tsx +13 -8
- package/src/version.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FrameworkConfigurator } from '@equinor/fusion-framework';
|
|
2
2
|
import { PropsWithChildren, ReactNode } from 'react';
|
|
3
|
-
type ConfigureCallback = (configurator:
|
|
3
|
+
type ConfigureCallback = (configurator: FrameworkConfigurator) => void;
|
|
4
4
|
export declare const Framework: (props: PropsWithChildren<{
|
|
5
5
|
readonly configure: ConfigureCallback;
|
|
6
6
|
readonly fallback: NonNullable<ReactNode> | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import type { AnyModule } from '@equinor/fusion-framework-module';
|
|
2
|
+
import { FrameworkConfigurator } from '@equinor/fusion-framework';
|
|
3
|
+
import type { AnyModule, ModulesInstanceType } from '@equinor/fusion-framework-module';
|
|
4
4
|
/**
|
|
5
5
|
* Create a framework provider for react.
|
|
6
6
|
*
|
|
@@ -9,7 +9,7 @@ import type { AnyModule } from '@equinor/fusion-framework-module';
|
|
|
9
9
|
* @param configurator - callback for configuring modules
|
|
10
10
|
* @example
|
|
11
11
|
* ```tsx
|
|
12
|
-
* const config:
|
|
12
|
+
* const config: FrameworkConfigurator = (config) => {}
|
|
13
13
|
* const Portal = () => {
|
|
14
14
|
* const Framework = createFrameworkProvider(config);
|
|
15
15
|
* return (
|
|
@@ -20,4 +20,4 @@ import type { AnyModule } from '@equinor/fusion-framework-module';
|
|
|
20
20
|
* };
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
export declare const createFrameworkProvider: <TModules extends Array<AnyModule> = []>(cb: (configurator:
|
|
23
|
+
export declare const createFrameworkProvider: <TModules extends Array<AnyModule> = [], TRef extends ModulesInstanceType<[AnyModule]> = any>(cb: (configurator: FrameworkConfigurator<TModules>, ref?: TRef) => void | Promise<void>, ref?: TRef) => React.LazyExoticComponent<React.FunctionComponent<React.PropsWithChildren<unknown>>>;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "7.1
|
|
1
|
+
export declare const version = "7.2.1";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework-react",
|
|
3
|
-
"version": "7.1
|
|
3
|
+
"version": "7.2.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -69,29 +69,29 @@
|
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"rxjs": "^7.8.1",
|
|
72
|
-
"@equinor/fusion-framework": "^7.2.
|
|
73
|
-
"@equinor/fusion-framework-module": "^
|
|
74
|
-
"@equinor/fusion-framework-
|
|
75
|
-
"@equinor/fusion-
|
|
76
|
-
"@equinor/fusion-
|
|
72
|
+
"@equinor/fusion-framework": "^7.2.6",
|
|
73
|
+
"@equinor/fusion-framework-react-module": "^3.1.5",
|
|
74
|
+
"@equinor/fusion-framework-module": "^4.3.4",
|
|
75
|
+
"@equinor/fusion-observable": "^8.4.1",
|
|
76
|
+
"@equinor/fusion-framework-react-module-http": "^6.0.3"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@types/react": "^18.2.50",
|
|
80
80
|
"@types/react-dom": "^18.2.7",
|
|
81
81
|
"react": "^18.2.0",
|
|
82
82
|
"react-dom": "^18.2.0",
|
|
83
|
-
"typescript": "^5.5.
|
|
84
|
-
"@equinor/fusion-framework-module-
|
|
85
|
-
"@equinor/fusion-framework-module-
|
|
86
|
-
"@equinor/fusion-framework-module-
|
|
87
|
-
"@equinor/fusion-framework-react-module-context": "^6.2.
|
|
83
|
+
"typescript": "^5.5.4",
|
|
84
|
+
"@equinor/fusion-framework-module-feature-flag": "^1.1.8",
|
|
85
|
+
"@equinor/fusion-framework-module-app": "^5.3.11",
|
|
86
|
+
"@equinor/fusion-framework-module-event": "^4.2.3",
|
|
87
|
+
"@equinor/fusion-framework-react-module-context": "^6.2.12"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
90
|
"@types/react": "^17.0.0 || ^18.0.0",
|
|
91
91
|
"react": "^17.0.0 || ^18.0.0",
|
|
92
92
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
93
|
-
"@equinor/fusion-framework-module-
|
|
94
|
-
"@equinor/fusion-framework-
|
|
93
|
+
"@equinor/fusion-framework-react-module-signalr": "^3.0.14",
|
|
94
|
+
"@equinor/fusion-framework-module-feature-flag": "^1.1.8"
|
|
95
95
|
},
|
|
96
96
|
"peerDependenciesMeta": {
|
|
97
97
|
"@equinor/fusion-framework-module-event": {
|
package/src/Framework.tsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FrameworkConfigurator } from '@equinor/fusion-framework';
|
|
2
2
|
import { createFrameworkProvider } from './create-framework-provider';
|
|
3
3
|
import { PropsWithChildren, ReactNode, Suspense, useMemo } from 'react';
|
|
4
|
+
import { useModules } from '@equinor/fusion-framework-react-module';
|
|
4
5
|
|
|
5
|
-
type ConfigureCallback = (configurator:
|
|
6
|
+
type ConfigureCallback = (configurator: FrameworkConfigurator) => void;
|
|
6
7
|
|
|
7
8
|
export const Framework = (
|
|
8
9
|
props: PropsWithChildren<{
|
|
@@ -11,7 +12,9 @@ export const Framework = (
|
|
|
11
12
|
}>,
|
|
12
13
|
) => {
|
|
13
14
|
const { configure, fallback, children } = props;
|
|
14
|
-
|
|
15
|
+
//import modules from parent context
|
|
16
|
+
const ref = useModules<[]>();
|
|
17
|
+
const Component = useMemo(() => createFrameworkProvider(configure, ref), [configure, ref]);
|
|
15
18
|
return (
|
|
16
19
|
<Suspense fallback={fallback}>
|
|
17
20
|
<Component>{children}</Component>
|
|
@@ -32,7 +32,7 @@ export const useCurrentAppModules = <TModules extends Array<AnyModule> = []>():
|
|
|
32
32
|
error,
|
|
33
33
|
complete,
|
|
34
34
|
} = useObservableState(modules$, {
|
|
35
|
-
initial: currentApp === undefined ? undefined : currentApp?.instance ?? null,
|
|
35
|
+
initial: currentApp === undefined ? undefined : (currentApp?.instance ?? null),
|
|
36
36
|
});
|
|
37
37
|
return {
|
|
38
38
|
modules,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { lazy } from 'react';
|
|
2
2
|
import initFusion from '@equinor/fusion-framework';
|
|
3
|
-
import {
|
|
3
|
+
import { FrameworkConfigurator } from '@equinor/fusion-framework';
|
|
4
4
|
|
|
5
5
|
import { FrameworkProvider } from './context';
|
|
6
|
-
import type { AnyModule } from '@equinor/fusion-framework-module';
|
|
6
|
+
import type { AnyModule, ModulesInstanceType } from '@equinor/fusion-framework-module';
|
|
7
7
|
import { ModuleProvider } from '@equinor/fusion-framework-react-module';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -14,7 +14,7 @@ import { ModuleProvider } from '@equinor/fusion-framework-react-module';
|
|
|
14
14
|
* @param configurator - callback for configuring modules
|
|
15
15
|
* @example
|
|
16
16
|
* ```tsx
|
|
17
|
-
* const config:
|
|
17
|
+
* const config: FrameworkConfigurator = (config) => {}
|
|
18
18
|
* const Portal = () => {
|
|
19
19
|
* const Framework = createFrameworkProvider(config);
|
|
20
20
|
* return (
|
|
@@ -25,13 +25,18 @@ import { ModuleProvider } from '@equinor/fusion-framework-react-module';
|
|
|
25
25
|
* };
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
|
-
export const createFrameworkProvider = <
|
|
29
|
-
|
|
28
|
+
export const createFrameworkProvider = <
|
|
29
|
+
TModules extends Array<AnyModule> = [],
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
|
+
TRef extends ModulesInstanceType<[AnyModule]> = any,
|
|
32
|
+
>(
|
|
33
|
+
cb: (configurator: FrameworkConfigurator<TModules>, ref?: TRef) => void | Promise<void>,
|
|
34
|
+
ref?: TRef,
|
|
30
35
|
): React.LazyExoticComponent<React.FunctionComponent<React.PropsWithChildren<unknown>>> =>
|
|
31
36
|
lazy(async () => {
|
|
32
|
-
const configurator = new
|
|
33
|
-
await cb(configurator);
|
|
34
|
-
const framework = await initFusion(configurator);
|
|
37
|
+
const configurator = new FrameworkConfigurator<TModules>();
|
|
38
|
+
await cb(configurator, ref);
|
|
39
|
+
const framework = await initFusion(configurator, ref);
|
|
35
40
|
return {
|
|
36
41
|
default: ({ children }: { children?: React.ReactNode }) => (
|
|
37
42
|
<FrameworkProvider value={framework}>
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '7.1
|
|
2
|
+
export const version = '7.2.1';
|