@equinor/fusion-framework-react-app 8.0.0 → 9.0.0-next.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 +50 -14
- package/dist/esm/apploader/Apploader.js +1 -1
- package/dist/esm/apploader/Apploader.js.map +1 -1
- package/dist/esm/http/selectors.js +2 -0
- package/dist/esm/http/selectors.js.map +1 -0
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/make-component.js +1 -1
- package/dist/esm/make-component.js.map +1 -1
- package/dist/esm/render-app.js +7 -1
- package/dist/esm/render-app.js.map +1 -1
- package/dist/esm/render-component.js +22 -23
- package/dist/esm/render-component.js.map +1 -1
- package/dist/esm/useAppModules.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/apploader/Apploader.d.ts +3 -2
- package/dist/types/http/selectors.d.ts +1 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/render-app.d.ts +7 -1
- package/dist/types/render-component.d.ts +7 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +34 -24
- package/src/__tests__/render-app.test.tsx +113 -0
- package/src/apploader/Apploader.tsx +3 -3
- package/src/http/selectors.ts +1 -0
- package/src/index.ts +4 -2
- package/src/make-component.tsx +1 -1
- package/src/render-app.ts +7 -1
- package/src/render-component.tsx +24 -27
- package/src/useAppModules.ts +2 -2
- package/src/version.ts +1 -1
- package/tsconfig.json +1 -1
- package/vitest.config.ts +20 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,60 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 9.0.0-next.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#3820](https://github.com/equinor/fusion-framework/pull/3820) [`9f7597e`](https://github.com/equinor/fusion-framework/commit/9f7597ee237ef069dc24cbe39c73b5b26db157dd) Thanks [@odinr](https://github.com/odinr)! - Require React 18+ and modernize `renderComponent` and `renderApp` functions to use React 18's `createRoot` API. These functions are no longer deprecated.
|
|
8
|
+
|
|
9
|
+
**Migration:** Update to React 18+. If you use `renderComponent` or `renderApp`, these functions now use the `createRoot` API internally. No immediate migration is required unless you are using features specific to React 17.
|
|
10
|
+
|
|
11
|
+
Closes https://github.com/equinor/fusion-framework/issues/3504
|
|
12
|
+
|
|
13
|
+
- [#3820](https://github.com/equinor/fusion-framework/pull/3820) [`75c068f`](https://github.com/equinor/fusion-framework/commit/75c068fea13c32435ac26bd9043cc156482bfaf1) Thanks [@odinr](https://github.com/odinr)! - Upgrade to React 19 and remove support for React versions lower than 18.
|
|
14
|
+
|
|
15
|
+
**Breaking changes:**
|
|
16
|
+
- Peer dependencies now require React 18 or 19 (`^18.0.0 || ^19.0.0`)
|
|
17
|
+
- React 16 and 17 are no longer supported
|
|
18
|
+
- Dev dependencies upgraded to React 19.2.1 and @types/react 19.2.7
|
|
19
|
+
|
|
20
|
+
**Migration:**
|
|
21
|
+
- Update your React version to 18.0.0 or higher before upgrading these packages
|
|
22
|
+
- If using React 16 or 17, upgrade to React 18 or 19 first
|
|
23
|
+
|
|
24
|
+
### Minor Changes
|
|
25
|
+
|
|
26
|
+
- [#3820](https://github.com/equinor/fusion-framework/pull/3820) [`d252b0d`](https://github.com/equinor/fusion-framework/commit/d252b0d442b7c8c1b50bf2768cf9ecbbb55a76f8) Thanks [@odinr](https://github.com/odinr)! - Export `Fusion` type from `@equinor/fusion-framework-react-app` for better type reusability.
|
|
27
|
+
|
|
28
|
+
The `Fusion` type is now available directly from the react-app package:
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import type { Fusion } from "@equinor/fusion-framework-react-app";
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- [#3820](https://github.com/equinor/fusion-framework/pull/3820) [`265bb76`](https://github.com/equinor/fusion-framework/commit/265bb767249989eeb1971e83f3fba94879e0813b) Thanks [@odinr](https://github.com/odinr)! - relase next
|
|
37
|
+
|
|
38
|
+
- [#3820](https://github.com/equinor/fusion-framework/pull/3820) [`9f7597e`](https://github.com/equinor/fusion-framework/commit/9f7597ee237ef069dc24cbe39c73b5b26db157dd) Thanks [@odinr](https://github.com/odinr)! - Add test suite for `renderApp` function using Vitest and React Testing Library.
|
|
39
|
+
|
|
40
|
+
Includes test coverage for component rendering, teardown functionality, and React 18 createRoot integration.
|
|
41
|
+
|
|
42
|
+
- Updated dependencies [[`265bb76`](https://github.com/equinor/fusion-framework/commit/265bb767249989eeb1971e83f3fba94879e0813b), [`d252b0d`](https://github.com/equinor/fusion-framework/commit/d252b0d442b7c8c1b50bf2768cf9ecbbb55a76f8), [`d252b0d`](https://github.com/equinor/fusion-framework/commit/d252b0d442b7c8c1b50bf2768cf9ecbbb55a76f8), [`d252b0d`](https://github.com/equinor/fusion-framework/commit/d252b0d442b7c8c1b50bf2768cf9ecbbb55a76f8), [`9f7597e`](https://github.com/equinor/fusion-framework/commit/9f7597ee237ef069dc24cbe39c73b5b26db157dd), [`75c068f`](https://github.com/equinor/fusion-framework/commit/75c068fea13c32435ac26bd9043cc156482bfaf1), [`d252b0d`](https://github.com/equinor/fusion-framework/commit/d252b0d442b7c8c1b50bf2768cf9ecbbb55a76f8)]:
|
|
43
|
+
- @equinor/fusion-framework-react-module@4.0.0-next.0
|
|
44
|
+
- @equinor/fusion-framework-module-navigation@7.0.0-next.1
|
|
45
|
+
- @equinor/fusion-framework-react-module-http@11.0.0-next.0
|
|
46
|
+
- @equinor/fusion-framework-react@8.0.0-next.0
|
|
47
|
+
- @equinor/fusion-framework-module-app@7.2.0-next.0
|
|
48
|
+
- @equinor/fusion-framework-app@10.1.3-next.0
|
|
49
|
+
- @equinor/fusion-framework-module-http@7.0.6-next.0
|
|
50
|
+
- @equinor/fusion-framework-module@5.0.6-next.0
|
|
51
|
+
- @equinor/fusion-framework-module-msal@7.0.0-next.0
|
|
52
|
+
|
|
3
53
|
## 8.0.0
|
|
4
54
|
|
|
5
55
|
### Patch Changes
|
|
6
56
|
|
|
7
57
|
- [#3714](https://github.com/equinor/fusion-framework/pull/3714) [`11fe961`](https://github.com/equinor/fusion-framework/commit/11fe961794e4960ccb987bc320268cc9b263f1f8) Thanks [@odinr](https://github.com/odinr)! - Fix MSAL v4 compatibility issues in React app hooks.
|
|
8
|
-
|
|
9
58
|
- Update useCurrentAccount to use account property instead of deprecated defaultAccount
|
|
10
59
|
- Fix useToken hook to properly handle AcquireTokenResult type
|
|
11
60
|
- Ensure proper null/undefined handling for account information
|
|
@@ -61,14 +110,12 @@
|
|
|
61
110
|
- [#3075](https://github.com/equinor/fusion-framework/pull/3075) [`8fffbfb`](https://github.com/equinor/fusion-framework/commit/8fffbfb12daa9748bf5290e5084cd4d409aed253) Thanks [@odinr](https://github.com/odinr)! - Refactored the `Bookmark` type to be an intersection of `BookmarkWithoutData` and an optional `payload` property, improving type safety and flexibility. Updated `useBookmarkNavigate` to use proper TypeScript typing for bookmark events.
|
|
62
111
|
|
|
63
112
|
**Module Bookmark Changes:**
|
|
64
|
-
|
|
65
113
|
- Refactored `Bookmark` type in `packages/modules/bookmark/src/types.ts`
|
|
66
114
|
- Added export for `BookmarkProviderEvents` type in `packages/modules/bookmark/src/index.ts`
|
|
67
115
|
- Updated JSDoc comment from `@note` to `@remarks` in `packages/modules/bookmark/src/BookmarkClient.ts`
|
|
68
116
|
- Reordered tsconfig references (event before services)
|
|
69
117
|
|
|
70
118
|
**React Changes:**
|
|
71
|
-
|
|
72
119
|
- Updated `packages/react/modules/bookmark/src/portal/useBookmarkNavigate.ts` to use proper TypeScript typing for bookmark provider events
|
|
73
120
|
- Removed React paths configuration from `packages/react/app/tsconfig.json`
|
|
74
121
|
|
|
@@ -115,7 +162,6 @@
|
|
|
115
162
|
### Patch Changes
|
|
116
163
|
|
|
117
164
|
- [#3088](https://github.com/equinor/fusion-framework/pull/3088) [`7441b13`](https://github.com/equinor/fusion-framework/commit/7441b13aa50dd7362d1629086a27b6b4e571575d) Thanks [@eikeland](https://github.com/eikeland)! - chore: update package typesVersions
|
|
118
|
-
|
|
119
165
|
- Updated package.json typesVersions.
|
|
120
166
|
- Ensures backward compatibility with older node versions.
|
|
121
167
|
- Ensured consistency with workspace and repository configuration.
|
|
@@ -175,7 +221,6 @@
|
|
|
175
221
|
`appKey (string)`: The key of the Fusion app to load and mount.
|
|
176
222
|
|
|
177
223
|
### Returns
|
|
178
|
-
|
|
179
224
|
- **loading** `(boolean)`: true while the app is loading.
|
|
180
225
|
- **error** `(Error | undefined)`: Error object if loading fails, otherwise undefined.
|
|
181
226
|
- **appRef** `(React.RefObject<HTMLDivElement | null>)`: Ref to the DOM element where the child app is mounted.
|
|
@@ -209,7 +254,6 @@
|
|
|
209
254
|
```
|
|
210
255
|
|
|
211
256
|
### Notes
|
|
212
|
-
|
|
213
257
|
- The hook is designed to be used in a parent Fusion app context.
|
|
214
258
|
- The returned appRef should be appended to a container element in your component.
|
|
215
259
|
- Handles subscription and cleanup automatically.
|
|
@@ -493,7 +537,6 @@
|
|
|
493
537
|
### Minor Changes
|
|
494
538
|
|
|
495
539
|
- [#2577](https://github.com/equinor/fusion-framework/pull/2577) [`c3ba9f1`](https://github.com/equinor/fusion-framework/commit/c3ba9f109d9f96d6dc6ee2f0ddac00c8b3090982) Thanks [@eikeland](https://github.com/eikeland)! - #### Changes:
|
|
496
|
-
|
|
497
540
|
1. **AppClient.ts**
|
|
498
541
|
- Added `updateAppSettings` method to set app settings by appKey.
|
|
499
542
|
2. **AppModuleProvider.ts**
|
|
@@ -541,7 +584,6 @@
|
|
|
541
584
|
### Minor Changes
|
|
542
585
|
|
|
543
586
|
- [#2410](https://github.com/equinor/fusion-framework/pull/2410) [`9d1cb90`](https://github.com/equinor/fusion-framework/commit/9d1cb9003fa10e7ccaa95c20ef86f0a618034641) Thanks [@odinr](https://github.com/odinr)! - Updated bookmark namespace in `@equinor/fusion-react-app` to include new hooks and updated `useCurrentBookmark` hook.
|
|
544
|
-
|
|
545
587
|
- Updated `index.ts` to re-export everything from `@equinor/fusion-framework-react-module-bookmark` instead of individual exports.
|
|
546
588
|
- Marked `useBookmark` as deprecated in `useBookmark.ts`.
|
|
547
589
|
- Enhanced `useCurrentBookmark` in `useCurrentBookmark.ts` to accept a `BookmarkPayloadGenerator` and use the `BookmarkModule` from `useAppModule`.
|
|
@@ -583,12 +625,10 @@
|
|
|
583
625
|
> This will introduce breaking changes to the configuration of `AppConfigurator.client`.
|
|
584
626
|
|
|
585
627
|
**Added**
|
|
586
|
-
|
|
587
628
|
- Introduced `AppClient` class to handle application manifest and configuration queries.
|
|
588
629
|
- Added `zod` to validate the application manifest.
|
|
589
630
|
|
|
590
631
|
**Changed**
|
|
591
|
-
|
|
592
632
|
- Updated `AppModuleProvider` to use `AppClient` for fetching application manifests and configurations.
|
|
593
633
|
- Modified `AppConfigurator` to utilize `AppClient` for client configuration.
|
|
594
634
|
- Updated `useApps` hook with new input parameter for `filterByCurrentUser` in `fusion-framework-react`.
|
|
@@ -720,7 +760,6 @@
|
|
|
720
760
|
- [#2320](https://github.com/equinor/fusion-framework/pull/2320) [`1dd85f3`](https://github.com/equinor/fusion-framework/commit/1dd85f3a408a73df556d1812a5f280945cc100ee) Thanks [@odinr](https://github.com/odinr)! - Removed the `removeComments` option from the `tsconfig.base.json` file.
|
|
721
761
|
|
|
722
762
|
Removing the `removeComments` option allows TypeScript to preserve comments in the compiled JavaScript output. This can be beneficial for several reasons:
|
|
723
|
-
|
|
724
763
|
1. Improved debugging: Preserved comments can help developers understand the code better during debugging sessions.
|
|
725
764
|
2. Documentation: JSDoc comments and other important code documentation will be retained in the compiled output.
|
|
726
765
|
3. Source map accuracy: Keeping comments can lead to more accurate source maps, which is crucial for debugging and error tracking.
|
|
@@ -1089,7 +1128,6 @@
|
|
|
1089
1128
|
### Minor Changes
|
|
1090
1129
|
|
|
1091
1130
|
- [#1646](https://github.com/equinor/fusion-framework/pull/1646) [`5eab8af`](https://github.com/equinor/fusion-framework/commit/5eab8afe3c3106cc67ad14ce4cbee6c7e4e8dfb1) Thanks [@odinr](https://github.com/odinr)! - Created namespace for MSAL:
|
|
1092
|
-
|
|
1093
1131
|
- Created hooks for accessing current authenticated account
|
|
1094
1132
|
- Created hooks for acquiring token
|
|
1095
1133
|
- Created hooks for acquiring access token
|
|
@@ -1316,7 +1354,6 @@
|
|
|
1316
1354
|
### Minor Changes
|
|
1317
1355
|
|
|
1318
1356
|
- [#934](https://github.com/equinor/fusion-framework/pull/934) [`ea081696`](https://github.com/equinor/fusion-framework/commit/ea0816967244917b01a3aa43b75cd3cf59573958) Thanks [@odinr](https://github.com/odinr)! - **Add tooling for navigation in React App package**
|
|
1319
|
-
|
|
1320
1357
|
- add hook for using the navigation module
|
|
1321
1358
|
- add hook for creating a react router
|
|
1322
1359
|
|
|
@@ -1347,7 +1384,6 @@
|
|
|
1347
1384
|
### Patch Changes
|
|
1348
1385
|
|
|
1349
1386
|
- [#905](https://github.com/equinor/fusion-framework/pull/905) [`a7858a1c`](https://github.com/equinor/fusion-framework/commit/a7858a1c01542e2dc94370709f122b4b99c3219c) Thanks [@odinr](https://github.com/odinr)! - **🚧 Chore: dedupe packages**
|
|
1350
|
-
|
|
1351
1387
|
- align all versions of typescript
|
|
1352
1388
|
- update types to build
|
|
1353
1389
|
- a couple of typecasts did not [satisfies](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0.html#satisfies-support-in-jsdoc) and was recasted as `unknwon`, marked with `TODO`, should be fixed in future
|
|
@@ -9,7 +9,7 @@ import { useApploader } from './useApploader';
|
|
|
9
9
|
*
|
|
10
10
|
* @param { ApploaderProps } props - The props for the component.
|
|
11
11
|
* @param { string } props.appKey - The key of the Fusion app to load and mount.
|
|
12
|
-
* @returns {
|
|
12
|
+
* @returns { ReactElement } The rendered component, which displays loading, error, or the embedded app.
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* <Apploader appKey="my-app" />
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Apploader.js","sourceRoot":"","sources":["../../../src/apploader/Apploader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Apploader.js","sourceRoot":"","sources":["../../../src/apploader/Apploader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAqB,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAM9C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,MAAM,EAAkB,EAAgB,EAAE;IACpE,MAAM,QAAQ,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IACrD,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAE5D,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,QAAQ,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACzC,OAAO;QACT,CAAC;QAED,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAErB,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,sCAAc,MAAM,IAAO,CAAC;IACrC,CAAC;IACD,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,CACL,4CACiB,MAAM,eAAW,KAAK,CAAC,OAAO,IACzC,CACP,CAAC;IACJ,CAAC;IAED,OAAO,cAAK,GAAG,EAAE,QAAQ,GAAI,CAAC;AAChC,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../src/http/selectors.ts"],"names":[],"mappings":"AAAA,cAAc,iDAAiD,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -3,9 +3,8 @@ export { useAppModules } from './useAppModules';
|
|
|
3
3
|
export { useAppEnvironmentVariables } from './useAppEnvironmentVariables';
|
|
4
4
|
export { makeComponent } from './make-component';
|
|
5
5
|
export { createLegacyApp } from './create-legacy-app';
|
|
6
|
-
// TODO deprecate
|
|
7
|
-
export { renderApp } from './render-app';
|
|
8
6
|
export { createComponent } from './create-component';
|
|
7
|
+
export { renderApp } from './render-app';
|
|
9
8
|
export { renderComponent } from './render-component';
|
|
10
9
|
export { default } from './render-app';
|
|
11
10
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAuB,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAKrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -26,7 +26,7 @@ import { ModuleProvider as AppModuleProvider } from '@equinor/fusion-framework-r
|
|
|
26
26
|
*/
|
|
27
27
|
export const makeComponent = (Component, args, configure) => lazy(async () => {
|
|
28
28
|
const init = configureModules(configure);
|
|
29
|
-
const modules =
|
|
29
|
+
const modules = await init(args);
|
|
30
30
|
const { fusion } = args;
|
|
31
31
|
modules.event.dispatchEvent('onReactAppLoaded', {
|
|
32
32
|
detail: { modules, fusion, env: args.env },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-component.js","sourceRoot":"","sources":["../../src/make-component.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAe,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAO9E,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAY7F;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAK3B,SAA0B,EAC1B,IAAiC,EACjC,SAAoD,EACJ,EAAE,CAClD,IAAI,CAAC,KAAK,IAAI,EAAE;IACd,MAAM,IAAI,GAAG,gBAAgB,CAAuB,SAAS,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"make-component.js","sourceRoot":"","sources":["../../src/make-component.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAe,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAO9E,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAY7F;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAK3B,SAA0B,EAC1B,IAAiC,EACjC,SAAoD,EACJ,EAAE,CAClD,IAAI,CAAC,KAAK,IAAI,EAAE;IACd,MAAM,IAAI,GAAG,gBAAgB,CAAuB,SAAS,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;IAEjC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAExB,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,kBAAkB,EAAE;QAC9C,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE;QAC1C,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,GAAG,EAAE,CAAC,CACb,KAAC,iBAAiB,IAAC,KAAK,EAAE,MAAM,YAC9B,KAAC,iBAAiB,IAAC,KAAK,EAAE,OAAO,YAAG,SAAS,GAAqB,GAChD,CACrB;KACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAaL,eAAe,aAAa,CAAC"}
|
package/dist/esm/render-app.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { createComponent } from './create-component';
|
|
2
2
|
import { renderComponent } from './render-component';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Creates a render function for an app component.
|
|
5
|
+
* Uses React 18's createRoot API via renderComponent.
|
|
6
|
+
*
|
|
7
|
+
* @param componentArgs - Arguments to pass to createComponent
|
|
8
|
+
* @returns A function that renders the app into a DOM element
|
|
9
|
+
*/
|
|
4
10
|
export const renderApp = (...componentArgs) => {
|
|
5
11
|
const renderer = renderComponent(createComponent(...componentArgs));
|
|
6
12
|
return (el, args) => {
|
|
@@ -1 +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,EAAuB,MAAM,oBAAoB,CAAC;AAI1E
|
|
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,EAAuB,MAAM,oBAAoB,CAAC;AAI1E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAG,aAAiD,EAAE,EAAE;IAChF,MAAM,QAAQ,GAAG,eAAe,CAAC,eAAe,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,EAAe,EAAE,IAAyB,EAAkB,EAAE;QACpE,OAAO,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Suspense, StrictMode } from 'react';
|
|
3
|
-
import
|
|
4
|
-
/**
|
|
3
|
+
import { createRoot } from 'react-dom/client';
|
|
4
|
+
/**
|
|
5
|
+
* Renders a React component into a DOM element using React 18's createRoot API.
|
|
6
|
+
*
|
|
7
|
+
* @param el - The DOM element to render into
|
|
8
|
+
* @param Component - The React component to render
|
|
9
|
+
* @returns A teardown function that unmounts the component
|
|
10
|
+
*/
|
|
11
|
+
const render = (el, Component) => {
|
|
12
|
+
const root = createRoot(el);
|
|
13
|
+
root.render(_jsx(StrictMode, { children: _jsx(Suspense, { fallback: _jsx("p", { children: "loading app" }), children: _jsx(Component, {}) }) }));
|
|
14
|
+
return () => {
|
|
15
|
+
root.unmount();
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Creates a render function for a component renderer.
|
|
20
|
+
* Uses React 18's createRoot API instead of the deprecated ReactDOM.render.
|
|
21
|
+
*
|
|
22
|
+
* @param renderer - A function that creates a component from fusion and env
|
|
23
|
+
* @returns A function that renders the component into a DOM element
|
|
24
|
+
*/
|
|
5
25
|
export const renderComponent = (renderer) => {
|
|
6
26
|
return (el, args) => {
|
|
7
27
|
const Component = renderer(args.fusion, args.env);
|
|
8
28
|
return render(el, Component);
|
|
9
29
|
};
|
|
10
30
|
};
|
|
11
|
-
const render = (el, Component) => {
|
|
12
|
-
// eslint-disable-next-line react/no-deprecated
|
|
13
|
-
ReactDOM.render(_jsx(StrictMode, { children: _jsx(Suspense, { fallback: _jsx("p", { children: "loading app" }), children: _jsx(Component, {}) }) }), el);
|
|
14
|
-
return () => {
|
|
15
|
-
// eslint-disable-next-line react/no-deprecated
|
|
16
|
-
ReactDOM.unmountComponentAtNode(el);
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
// const render = (el: Element, Component: FunctionComponent): RenderTeardown => {
|
|
20
|
-
// const root = createRoot(el);
|
|
21
|
-
// root.render(
|
|
22
|
-
// <StrictMode>
|
|
23
|
-
// <Suspense fallback={<p>loading app</p>}>
|
|
24
|
-
// <Component />
|
|
25
|
-
// </Suspense>
|
|
26
|
-
// </StrictMode>
|
|
27
|
-
// );
|
|
28
|
-
// return () => {
|
|
29
|
-
// root.unmount();
|
|
30
|
-
// };
|
|
31
|
-
// };
|
|
32
31
|
export default renderComponent;
|
|
33
32
|
//# sourceMappingURL=render-component.js.map
|
|
@@ -1 +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;
|
|
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;AAE7C,OAAO,EAAE,UAAU,EAAa,MAAM,kBAAkB,CAAC;AAKzD;;;;;;GAMG;AACH,MAAM,MAAM,GAAG,CAAC,EAAW,EAAE,SAA4B,EAAkB,EAAE;IAC3E,MAAM,IAAI,GAAS,UAAU,CAAC,EAAE,CAAC,CAAC;IAClC,IAAI,CAAC,MAAM,CACT,KAAC,UAAU,cACT,KAAC,QAAQ,IAAC,QAAQ,EAAE,sCAAkB,YACpC,KAAC,SAAS,KAAG,GACJ,GACA,CACd,CAAC;IACF,OAAO,GAAG,EAAE;QACV,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAA2B,EAAE,EAAE;IAC7D,OAAO,CAAC,EAAe,EAAE,IAAyB,EAAkB,EAAE;QACpE,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QAClD,OAAO,MAAM,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IAC/B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAppModules.js","sourceRoot":"","sources":["../../src/useAppModules.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAEF,EAAE,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"useAppModules.js","sourceRoot":"","sources":["../../src/useAppModules.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAEF,EAAE,CAAC,UAAU,EAA0C,CAAC;AAEnF,eAAe,aAAa,CAAC"}
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,cAAc,CAAC"}
|