@equinor/fusion-framework-react 1.1.1 → 1.3.2

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 (51) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/esm/app/index.js +7 -0
  3. package/dist/esm/app/index.js.map +1 -0
  4. package/dist/esm/app/useApp.js +23 -0
  5. package/dist/esm/app/useApp.js.map +1 -0
  6. package/dist/esm/app/useAppConfig.js +30 -0
  7. package/dist/esm/app/useAppConfig.js.map +1 -0
  8. package/dist/esm/app/useAppEnv.js +9 -0
  9. package/dist/esm/app/useAppEnv.js.map +1 -0
  10. package/dist/esm/app/useApps.js +23 -0
  11. package/dist/esm/app/useApps.js.map +1 -0
  12. package/dist/esm/app/useCurrentApp.js +14 -0
  13. package/dist/esm/app/useCurrentApp.js.map +1 -0
  14. package/dist/esm/app/useCurrentAppChanged.js +8 -0
  15. package/dist/esm/app/useCurrentAppChanged.js.map +1 -0
  16. package/dist/esm/context/index.js +3 -0
  17. package/dist/esm/context/index.js.map +1 -0
  18. package/dist/esm/context/useCurrentContext.js +5 -0
  19. package/dist/esm/context/useCurrentContext.js.map +1 -0
  20. package/dist/esm/hooks/use-framework.js +3 -11
  21. package/dist/esm/hooks/use-framework.js.map +1 -1
  22. package/dist/esm/index.js +1 -0
  23. package/dist/esm/index.js.map +1 -1
  24. package/dist/esm/useFramework.js +15 -0
  25. package/dist/esm/useFramework.js.map +1 -0
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/dist/types/app/index.d.ts +7 -0
  28. package/dist/types/app/useApp.d.ts +7 -0
  29. package/dist/types/app/useAppConfig.d.ts +10 -0
  30. package/dist/types/app/useAppEnv.d.ts +7 -0
  31. package/dist/types/app/useApps.d.ts +7 -0
  32. package/dist/types/app/useCurrentApp.d.ts +5 -0
  33. package/dist/types/app/useCurrentAppChanged.d.ts +3 -0
  34. package/dist/types/context/index.d.ts +2 -0
  35. package/dist/types/context/useCurrentContext.d.ts +5 -0
  36. package/dist/types/index.d.ts +1 -0
  37. package/dist/types/useFramework.d.ts +4 -0
  38. package/package.json +16 -6
  39. package/src/app/index.ts +8 -0
  40. package/src/app/useApp.ts +26 -0
  41. package/src/app/useAppConfig.ts +43 -0
  42. package/src/app/useAppEnv.ts +11 -0
  43. package/src/app/useApps.ts +26 -0
  44. package/src/app/useCurrentApp.ts +19 -0
  45. package/src/app/useCurrentAppChanged.ts +12 -0
  46. package/src/context/index.ts +3 -0
  47. package/src/context/useCurrentContext.ts +6 -0
  48. package/src/hooks/use-framework.ts +9 -16
  49. package/src/index.tsx +2 -0
  50. package/src/useFramework.ts +27 -0
  51. package/tsconfig.json +9 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,31 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.3.2](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-react@1.3.1...@equinor/fusion-framework-react@1.3.2) (2022-11-02)
7
+
8
+ **Note:** Version bump only for package @equinor/fusion-framework-react
9
+
10
+ ## [1.3.1](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-react@1.3.0...@equinor/fusion-framework-react@1.3.1) (2022-11-02)
11
+
12
+ **Note:** Version bump only for package @equinor/fusion-framework-react
13
+
14
+ ## 1.3.0 (2022-11-02)
15
+
16
+ ### Features
17
+
18
+ - **framework-react:** create hook for current context ([4ee803f](https://github.com/equinor/fusion-framework/commit/4ee803fd0e457c3ec7414b35100e12186327fb6f))
19
+ - **framework-react:** react tooling for context ([b530114](https://github.com/equinor/fusion-framework/commit/b53011475a9c1a25b4e0756b66b57fd9b5711bbd))
20
+
21
+ ## [1.2.1](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-react@1.2.0...@equinor/fusion-framework-react@1.2.1) (2022-11-02)
22
+
23
+ **Note:** Version bump only for package @equinor/fusion-framework-react
24
+
25
+ ## [1.2.0](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-react@1.1.1...@equinor/fusion-framework-react@1.2.0) (2022-11-01)
26
+
27
+ ### Features
28
+
29
+ - **framework-react:** expose app hooks ([46c1ea2](https://github.com/equinor/fusion-framework/commit/46c1ea28f88cb3dd0ff350a589850c5cd9a45a88))
30
+
6
31
  ## 1.1.1 (2022-11-01)
7
32
 
8
33
  **Note:** Version bump only for package @equinor/fusion-framework-react
@@ -0,0 +1,7 @@
1
+ export { useApp } from './useApp';
2
+ export { useApps } from './useApps';
3
+ export { useCurrentApp } from './useCurrentApp';
4
+ export { useCurrentAppChanged } from './useCurrentAppChanged';
5
+ export { useAppConfig } from './useAppConfig';
6
+ export { useAppEnv } from './useAppEnv';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/app/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { useFramework } from '../hooks';
3
+ export const useApp = (appKey) => {
4
+ const provider = useFramework().modules.app;
5
+ const [value, setValue] = useState(undefined);
6
+ const [error, setError] = useState();
7
+ const [isLoading, setIsLoading] = useState(false);
8
+ useEffect(() => {
9
+ setIsLoading(true);
10
+ const request = provider.getApp(appKey).subscribe({
11
+ next: (value) => setValue(value),
12
+ error: (err) => setError(err),
13
+ complete: () => setIsLoading(false),
14
+ });
15
+ return () => {
16
+ setIsLoading(false);
17
+ request.unsubscribe();
18
+ };
19
+ }, [provider, setValue, setError, setIsLoading, appKey]);
20
+ return { value, error, isLoading };
21
+ };
22
+ export default useApp;
23
+ //# sourceMappingURL=useApp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useApp.js","sourceRoot":"","sources":["../../../src/app/useApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,EAAE;IACrC,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC;IAC5C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAA0B,SAAS,CAAC,CAAC;IACvE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAqB,CAAC;IACxD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IAE3D,SAAS,CAAC,GAAG,EAAE;QACX,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC;YAC9C,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;YAChC,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC7B,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC;SACtC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE;YACR,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC,WAAW,EAAE,CAAC;QAC1B,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;IACzD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AACvC,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { useFramework } from '../hooks';
3
+ export const useAppConfig = (args) => {
4
+ const { appKey } = args;
5
+ const provider = useFramework().modules.app;
6
+ const [value, setValue] = useState();
7
+ const [error, setError] = useState();
8
+ const [isLoading, setIsLoading] = useState(false);
9
+ useEffect(() => {
10
+ setValue(undefined);
11
+ }, [setValue, appKey]);
12
+ useEffect(() => {
13
+ if (!appKey) {
14
+ return;
15
+ }
16
+ setIsLoading(true);
17
+ const request = provider.getAppConfig(appKey).subscribe({
18
+ next: (value) => setValue(value),
19
+ error: (err) => setError(err),
20
+ complete: () => setIsLoading(false),
21
+ });
22
+ return () => {
23
+ setIsLoading(false);
24
+ request.unsubscribe();
25
+ };
26
+ }, [provider, setValue, setError, setIsLoading, appKey]);
27
+ return { value, error, isLoading };
28
+ };
29
+ export default useAppConfig;
30
+ //# sourceMappingURL=useAppConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAppConfig.js","sourceRoot":"","sources":["../../../src/app/useAppConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAQxC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAQ,IAEnC,EAA4B,EAAE;IAC3B,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACxB,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC;IAC5C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAgC,CAAC;IACnE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAqB,CAAC;IACxD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IAE3D,SAAS,CAAC,GAAG,EAAE;QACX,QAAQ,CAAC,SAAS,CAAC,CAAC;IACxB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IAEvB,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,CAAC,MAAM,EAAE;YACT,OAAO;SACV;QACD,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,MAAM,OAAO,GAAG,QAAQ,CAAC,YAAY,CAAQ,MAAM,CAAC,CAAC,SAAS,CAAC;YAC3D,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;YAChC,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC7B,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC;SACtC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE;YACR,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC,WAAW,EAAE,CAAC;QAC1B,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;IACzD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AACvC,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { useApp } from './useApp';
2
+ import { useAppConfig } from './useAppConfig';
3
+ export const useAppEnv = (appKey) => {
4
+ const { value: manifest, isLoading: manifestLoading } = useApp(appKey);
5
+ const { value: config, isLoading: configLoading } = useAppConfig({ appKey });
6
+ return { manifest, config, isLoading: manifestLoading || configLoading };
7
+ };
8
+ export default useApp;
9
+ //# sourceMappingURL=useAppEnv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAppEnv.js","sourceRoot":"","sources":["../../../src/app/useAppEnv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAc,EAAE,EAAE;IACxC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IACvE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAE7E,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,IAAI,aAAa,EAAE,CAAC;AAC7E,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { useFramework } from '../hooks';
3
+ export const useApps = () => {
4
+ const provider = useFramework().modules.app;
5
+ const [value, setValue] = useState(undefined);
6
+ const [error, setError] = useState();
7
+ const [isLoading, setIsLoading] = useState(false);
8
+ useEffect(() => {
9
+ setIsLoading(true);
10
+ const request = provider.getAllApps().subscribe({
11
+ next: (value) => setValue(value),
12
+ error: (err) => setError(err),
13
+ complete: () => setIsLoading(false),
14
+ });
15
+ return () => {
16
+ setIsLoading(false);
17
+ request.unsubscribe();
18
+ };
19
+ }, [provider, setValue, setError, setIsLoading]);
20
+ return { value, error, isLoading };
21
+ };
22
+ export default useApps;
23
+ //# sourceMappingURL=useApps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useApps.js","sourceRoot":"","sources":["../../../src/app/useApps.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,EAAE;IACxB,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC;IAC5C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAA4B,SAAS,CAAC,CAAC;IACzE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAqB,CAAC;IACxD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IAE3D,SAAS,CAAC,GAAG,EAAE;QACX,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC,SAAS,CAAC;YAC5C,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;YAChC,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC7B,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC;SACtC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE;YACR,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC,WAAW,EAAE,CAAC;QAC1B,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;IACjD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AACvC,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { useObservableState } from '@equinor/fusion-observable/react';
2
+ import { useCallback } from 'react';
3
+ import { useFramework } from '../hooks/use-framework';
4
+ export const useCurrentApp = () => {
5
+ const provider = useFramework().modules.app;
6
+ const currentApp = useObservableState(provider.current$);
7
+ const setCurrentApp = useCallback((appKey) => provider.setCurrentApp(appKey), [provider]);
8
+ return {
9
+ currentApp,
10
+ setCurrentApp,
11
+ };
12
+ };
13
+ export default useCurrentApp;
14
+ //# sourceMappingURL=useCurrentApp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCurrentApp.js","sourceRoot":"","sources":["../../../src/app/useCurrentApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE;IAC9B,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC;IAC5C,MAAM,UAAU,GAAG,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACzD,MAAM,aAAa,GAAG,WAAW,CAC7B,CAAC,MAAc,EAAE,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,EAClD,CAAC,QAAQ,CAAC,CACb,CAAC;IACF,OAAO;QACH,UAAU;QACV,aAAa;KAChB,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { useEffect } from 'react';
2
+ import { useFramework } from '../hooks/use-framework';
3
+ export const useCurrentAppChanged = (cb) => {
4
+ const { event } = useFramework().modules;
5
+ useEffect(() => event.addEventListener('onCurrentAppChanged', cb), [event, cb]);
6
+ };
7
+ export default useCurrentAppChanged;
8
+ //# sourceMappingURL=useCurrentAppChanged.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCurrentAppChanged.js","sourceRoot":"","sources":["../../../src/app/useCurrentAppChanged.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAChC,EAAyE,EAC3E,EAAE;IACA,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,EAAE,CAAC,OAAO,CAAC;IACzC,SAAS,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,qBAAqB,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;AACpF,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from '@equinor/fusion-framework-react-module-context';
2
+ export { useCurrentContext } from './useCurrentContext';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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"}
@@ -0,0 +1,5 @@
1
+ import { useCurrentContext as _useCurrentContext } from '@equinor/fusion-framework-react-module-context';
2
+ import { useFramework } from '../useFramework';
3
+ export const useCurrentContext = () => _useCurrentContext(useFramework().modules.context);
4
+ export default useCurrentContext;
5
+ //# sourceMappingURL=useCurrentContext.js.map
@@ -0,0 +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,14 +1,6 @@
1
- import { useContext } from 'react';
2
- import { context } from '../context';
1
+ import _useFramework from '../useFramework';
3
2
  export const useFramework = () => {
4
- let framework = useContext(context);
5
- if (!framework) {
6
- console.warn('could not locate fusion in context!');
7
- }
8
- framework !== null && framework !== void 0 ? framework : (framework = window.Fusion);
9
- if (!framework) {
10
- console.error('Could not load framework, might not be initiated?');
11
- }
12
- return framework;
3
+ console.warn('@deprecated', 'import { useFramework } from @equinor/fusion-framework');
4
+ return _useFramework();
13
5
  };
14
6
  //# sourceMappingURL=use-framework.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-framework.js","sourceRoot":"","sources":["../../../src/hooks/use-framework.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAUrC,MAAM,CAAC,MAAM,YAAY,GAAG,GAA6D,EAAE;IACvF,IAAI,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,CAAC,SAAS,EAAE;QACZ,OAAO,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;KACvD;IACD,SAAS,aAAT,SAAS,cAAT,SAAS,IAAT,SAAS,GAAK,MAAM,CAAC,MAAM,EAAC;IAC5B,IAAI,CAAC,SAAS,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAC;KACtE;IACD,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC"}
1
+ {"version":3,"file":"use-framework.js","sourceRoot":"","sources":["../../../src/hooks/use-framework.ts"],"names":[],"mappings":"AAGA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAW5C,MAAM,CAAC,MAAM,YAAY,GAAG,GAA6D,EAAE;IACvF,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,wDAAwD,CAAC,CAAC;IACtF,OAAO,aAAa,EAAE,CAAC;AAC3B,CAAC,CAAC"}
package/dist/esm/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { FusionConfigurator } from '@equinor/fusion-framework';
2
2
  export { createFrameworkProvider } from './create-framework-provider';
3
3
  export { FrameworkProvider } from './context';
4
+ export { useFramework } from './useFramework';
4
5
  export { default, Framework } from './Framework';
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { useContext } from 'react';
2
+ import { context } from './context';
3
+ export const useFramework = () => {
4
+ let framework = useContext(context);
5
+ if (!framework) {
6
+ console.warn('could not locate fusion in context!');
7
+ }
8
+ framework !== null && framework !== void 0 ? framework : (framework = window.Fusion);
9
+ if (!framework) {
10
+ console.error('Could not load framework, might not be initiated?');
11
+ }
12
+ return framework;
13
+ };
14
+ export default useFramework;
15
+ //# sourceMappingURL=useFramework.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFramework.js","sourceRoot":"","sources":["../../src/useFramework.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,MAAM,CAAC,MAAM,YAAY,GAAG,GAA6D,EAAE;IACvF,IAAI,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,CAAC,SAAS,EAAE;QACZ,OAAO,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;KACvD;IACD,SAAS,aAAT,SAAS,cAAT,SAAS,IAAT,SAAS,GAAK,MAAM,CAAC,MAAM,EAAC;IAC5B,IAAI,CAAC,SAAS,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAC;KACtE;IACD,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}