@equinor/fusion-framework-react-app 0.7.3 → 1.0.1-next.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 CHANGED
@@ -3,6 +3,57 @@
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.0.1-next.1](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-react-app@1.0.1-next.0...@equinor/fusion-framework-react-app@1.0.1-next.1) (2022-09-12)
7
+
8
+ **Note:** Version bump only for package @equinor/fusion-framework-react-app
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.0.1-next.0](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-react-app@1.0.0...@equinor/fusion-framework-react-app@1.0.1-next.0) (2022-09-12)
15
+
16
+ **Note:** Version bump only for package @equinor/fusion-framework-react-app
17
+
18
+
19
+
20
+
21
+
22
+ ## [1.0.0](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-react-app@0.8.0...@equinor/fusion-framework-react-app@1.0.0) (2022-09-12)
23
+
24
+
25
+ ### ⚠ BREAKING CHANGES
26
+
27
+ * **react-app:** config is now object
28
+
29
+ ### Features
30
+
31
+ * **react-app:** update init ([a41f102](https://github.com/equinor/fusion-framework/commit/a41f102e2fee94ec4e29b567cf867465c672f16f))
32
+
33
+
34
+
35
+ ## [1.0.0-alpha.0](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-react-app@0.8.0...@equinor/fusion-framework-react-app@1.0.0-alpha.0) (2022-09-12)
36
+
37
+
38
+ ### ⚠ BREAKING CHANGES
39
+
40
+ * **react-app:** config is now object
41
+
42
+ ### Features
43
+
44
+ * **react-app:** update init ([a41f102](https://github.com/equinor/fusion-framework/commit/a41f102e2fee94ec4e29b567cf867465c672f16f))
45
+
46
+
47
+
48
+ ## [0.8.0](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-react-app@0.7.3...@equinor/fusion-framework-react-app@0.8.0) (2022-09-09)
49
+
50
+
51
+ ### Features
52
+
53
+ * **react-app:** create legacy app ([4ae10ab](https://github.com/equinor/fusion-framework/commit/4ae10ab4aec50d9e92ce4cb0c74a1405a0dcc36e))
54
+
55
+
56
+
6
57
  ## [0.7.3](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-react-app@0.7.2...@equinor/fusion-framework-react-app@0.7.3) (2022-09-05)
7
58
 
8
59
  **Note:** Version bump only for package @equinor/fusion-framework-react-app
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { lazy } from 'react';
3
+ import { FrameworkProvider } from '@equinor/fusion-framework-react';
4
+ import { initAppModules } from '@equinor/fusion-framework-app';
5
+ import { ModuleProvider as AppModuleProvider } from '@equinor/fusion-framework-react-module';
6
+ export const createComponent = (Component, configure) => ({ fusion, env }) => lazy(async () => {
7
+ const init = initAppModules(configure);
8
+ const modules = (await init({
9
+ fusion,
10
+ manifest: env,
11
+ }));
12
+ modules.event.dispatchEvent('onReactAppLoaded', {
13
+ detail: { modules, fusion },
14
+ source: Component,
15
+ });
16
+ return {
17
+ default: () => (_jsx(FrameworkProvider, { value: fusion, children: _jsx(AppModuleProvider, { value: modules, children: _jsx(Component, {}) }) })),
18
+ };
19
+ });
20
+ export default createComponent;
21
+ //# sourceMappingURL=create-component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-component.js","sourceRoot":"","sources":["../../src/create-component.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAW/D,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AA8D7F,MAAM,CAAC,MAAM,eAAe,GACxB,CAKI,SAA8B,EAC9B,SAAyD,EACvB,EAAE,CACxC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,CAChB,IAAI,CAAC,KAAK,IAAI,EAAE;IACZ,MAAM,IAAI,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC;QACxB,MAAM;QACN,QAAQ,EAAE,GAAG;KAChB,CAAC,CAAkC,CAAC;IAErC,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,kBAAkB,EAAE;QAC5C,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC3B,MAAM,EAAE,SAAS;KACpB,CAAC,CAAC;IACH,OAAO;QACH,OAAO,EAAE,GAAG,EAAE,CAAC,CACX,KAAC,iBAAiB,IAAC,KAAK,EAAE,MAAM,YAC5B,KAAC,iBAAiB,IAAC,KAAK,EAAE,OAAO,YAC7B,KAAC,SAAS,KAAG,GACG,GACJ,CACvB;KACJ,CAAC;AACN,CAAC,CAAC,CAAC;AAUX,eAAe,eAAe,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Suspense, useMemo } from 'react';
3
+ import { useFramework } from '@equinor/fusion-framework-react/hooks';
4
+ import { createComponent } from './create-component';
5
+ export const createLegacyApp = (Component, configure) => {
6
+ return () => {
7
+ const fusion = useFramework();
8
+ const RenderComponent = useMemo(() => {
9
+ const creator = createComponent(Component, configure);
10
+ return creator({ fusion, env: { name: 'legacy' } });
11
+ }, []);
12
+ return (_jsx(Suspense, { fallback: _jsx("p", { children: "loading app" }), children: _jsx(RenderComponent, {}) }));
13
+ };
14
+ };
15
+ //# sourceMappingURL=create-legacy-app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-legacy-app.js","sourceRoot":"","sources":["../../src/create-legacy-app.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAKrE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,CAAC,MAAM,eAAe,GAAG,CAC3B,SAA8B,EAC9B,SAAwC,EAC1C,EAAE;IACA,OAAO,GAAgB,EAAE;QACrB,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;QAC9B,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,EAAE;YACjC,MAAM,OAAO,GAAG,eAAe,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;YACtD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;QACxD,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,OAAO,CACH,KAAC,QAAQ,IAAC,QAAQ,EAAE,sCAAkB,YAClC,KAAC,eAAe,KAAG,GACZ,CACd,CAAC;IACN,CAAC,CAAC;AACN,CAAC,CAAC"}
package/dist/esm/index.js CHANGED
@@ -1,6 +1,8 @@
1
- export { appModules } from '@equinor/fusion-framework-app';
2
1
  export { useAppModule } from './useAppModule';
3
2
  export { useAppModules } from './useAppModules';
4
- export { createApp } from './create-app';
5
- export { default } from './create-app';
3
+ export { renderApp } from './render-app';
4
+ export { createComponent } from './create-component';
5
+ export { renderComponent } from './render-component';
6
+ export { createLegacyApp } from './create-legacy-app';
7
+ export { default } from './render-app';
6
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAU3D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { createComponent } from './create-component';
2
+ import { renderComponent } from './render-component';
3
+ export const renderApp = (...componentArgs) => {
4
+ const renderer = renderComponent(createComponent(...componentArgs));
5
+ return (el, args) => {
6
+ return renderer(el, args);
7
+ };
8
+ };
9
+ export default renderApp;
10
+ //# sourceMappingURL=render-app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-app.js","sourceRoot":"","sources":["../../src/render-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAkB,MAAM,oBAAoB,CAAC;AAIrE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAG,aAAiD,EAAE,EAAE;IAC9E,MAAM,QAAQ,GAAG,eAAe,CAAC,eAAe,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,EAAe,EAAE,IAAyB,EAAkB,EAAE;QAClE,OAAO,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Suspense, StrictMode } from 'react';
3
+ import ReactDOM from 'react-dom';
4
+ import { createRoot } from 'react-dom/client';
5
+ export const renderComponent = (renderer) => {
6
+ return (el, args) => {
7
+ const Component = renderer(args);
8
+ const renderFn = createRoot ? render : renderLegacy;
9
+ return renderFn(el, Component);
10
+ };
11
+ };
12
+ const renderLegacy = (el, Component) => {
13
+ ReactDOM.render(_jsx(StrictMode, { children: _jsx(Suspense, { fallback: _jsx("p", { children: "loading app" }), children: _jsx(Component, {}) }) }), el);
14
+ return () => {
15
+ ReactDOM.unmountComponentAtNode(el);
16
+ };
17
+ };
18
+ const render = (el, Component) => {
19
+ const root = createRoot(el);
20
+ root.render(_jsx(StrictMode, { children: _jsx(Suspense, { fallback: _jsx("p", { children: "loading app" }), children: _jsx(Component, {}) }) }));
21
+ return () => {
22
+ root.unmount();
23
+ };
24
+ };
25
+ export default renderComponent;
26
+ //# sourceMappingURL=render-component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-component.js","sourceRoot":"","sources":["../../src/render-component.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG7C,OAAO,QAAQ,MAAM,WAAW,CAAC;AAIjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAI9C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAA2B,EAAE,EAAE;IAC3D,OAAO,CAAC,EAAe,EAAE,IAAyB,EAAkB,EAAE;QAClE,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC;QACpD,OAAO,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IACnC,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,EAAW,EAAE,SAA4B,EAAkB,EAAE;IAC/E,QAAQ,CAAC,MAAM,CACX,KAAC,UAAU,cACP,KAAC,QAAQ,IAAC,QAAQ,EAAE,sCAAkB,YAClC,KAAC,SAAS,KAAG,GACN,GACF,EACb,EAAE,CACL,CAAC;IACF,OAAO,GAAG,EAAE;QACR,QAAQ,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,CAAC,EAAW,EAAE,SAA4B,EAAkB,EAAE;IACzE,MAAM,IAAI,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC;IAC5B,IAAI,CAAC,MAAM,CACP,KAAC,UAAU,cACP,KAAC,QAAQ,IAAC,QAAQ,EAAE,sCAAkB,YAClC,KAAC,SAAS,KAAG,GACN,GACF,CAChB,CAAC;IACF,OAAO,GAAG,EAAE;QACR,IAAI,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}