@equinor/fusion-framework-react 7.1.4 → 7.2.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.
@@ -1,6 +1,6 @@
1
- import { FusionConfigurator } from '@equinor/fusion-framework';
1
+ import { FrameworkConfigurator } from '@equinor/fusion-framework';
2
2
  import { PropsWithChildren, ReactNode } from 'react';
3
- type ConfigureCallback = (configurator: FusionConfigurator) => void;
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 { FusionConfigurator } from '@equinor/fusion-framework';
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: FusionConfigurator = (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: FusionConfigurator<TModules>) => void | Promise<void>) => React.LazyExoticComponent<React.FunctionComponent<React.PropsWithChildren<unknown>>>;
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>>>;
@@ -1 +1 @@
1
- export declare const version = "7.1.4";
1
+ export declare const version = "7.2.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/fusion-framework-react",
3
- "version": "7.1.4",
3
+ "version": "7.2.0",
4
4
  "description": "",
5
5
  "main": "dist/esm/index.js",
6
6
  "exports": {
@@ -69,10 +69,10 @@
69
69
  },
70
70
  "dependencies": {
71
71
  "rxjs": "^7.8.1",
72
- "@equinor/fusion-framework": "^7.2.4",
73
- "@equinor/fusion-framework-module": "^4.3.3",
74
- "@equinor/fusion-framework-react-module-http": "^6.0.2",
75
- "@equinor/fusion-framework-react-module": "^3.1.4",
72
+ "@equinor/fusion-framework": "^7.2.5",
73
+ "@equinor/fusion-framework-react-module-http": "^6.0.3",
74
+ "@equinor/fusion-framework-module": "^4.3.4",
75
+ "@equinor/fusion-framework-react-module": "^3.1.5",
76
76
  "@equinor/fusion-observable": "^8.4.0"
77
77
  },
78
78
  "devDependencies": {
@@ -80,18 +80,18 @@
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.3",
84
- "@equinor/fusion-framework-module-app": "^5.3.9",
85
- "@equinor/fusion-framework-module-event": "^4.2.2",
86
- "@equinor/fusion-framework-module-feature-flag": "^1.1.6",
87
- "@equinor/fusion-framework-react-module-context": "^6.2.10"
83
+ "typescript": "^5.5.4",
84
+ "@equinor/fusion-framework-module-app": "^5.3.10",
85
+ "@equinor/fusion-framework-react-module-context": "^6.2.11",
86
+ "@equinor/fusion-framework-module-event": "^4.2.3",
87
+ "@equinor/fusion-framework-module-feature-flag": "^1.1.7"
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-feature-flag": "^1.1.6",
94
- "@equinor/fusion-framework-react-module-signalr": "^3.0.12"
93
+ "@equinor/fusion-framework-module-feature-flag": "^1.1.7",
94
+ "@equinor/fusion-framework-react-module-signalr": "^3.0.13"
95
95
  },
96
96
  "peerDependenciesMeta": {
97
97
  "@equinor/fusion-framework-module-event": {
package/src/Framework.tsx CHANGED
@@ -1,8 +1,9 @@
1
- import { FusionConfigurator } from '@equinor/fusion-framework';
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: FusionConfigurator) => void;
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
- const Component = useMemo(() => createFrameworkProvider(configure), [configure]);
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 { FusionConfigurator } from '@equinor/fusion-framework';
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: FusionConfigurator = (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 = <TModules extends Array<AnyModule> = []>(
29
- cb: (configurator: FusionConfigurator<TModules>) => void | Promise<void>,
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 FusionConfigurator<TModules>();
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.4';
2
+ export const version = '7.2.0';