@equinor/fusion-framework-react-app 9.0.7 → 9.0.9-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 +33 -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 -25
- 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,5 +1,38 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 9.0.9-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#3820](https://github.com/equinor/fusion-framework/pull/3820) [`f647825`](https://github.com/equinor/fusion-framework/commit/f647825cb5712763b09dafda21fd996211c78b78) Thanks [@odinr](https://github.com/odinr)! - relase next
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`f647825`](https://github.com/equinor/fusion-framework/commit/f647825cb5712763b09dafda21fd996211c78b78)]:
|
|
10
|
+
- @equinor/fusion-framework-react-module@3.1.15-next.0
|
|
11
|
+
- @equinor/fusion-framework-module-navigation@7.0.0-next.2
|
|
12
|
+
- @equinor/fusion-framework-react-module-http@10.0.2-next.0
|
|
13
|
+
- @equinor/fusion-framework-react@7.4.21-next.0
|
|
14
|
+
- @equinor/fusion-framework-module-app@7.4.2-next.0
|
|
15
|
+
- @equinor/fusion-framework-app@10.4.10-next.0
|
|
16
|
+
- @equinor/fusion-framework-module-http@7.0.9-next.0
|
|
17
|
+
- @equinor/fusion-framework-module@5.0.7-next.0
|
|
18
|
+
- @equinor/fusion-framework-module-msal@7.3.2-next.0
|
|
19
|
+
|
|
20
|
+
## 9.0.8
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- [#4157](https://github.com/equinor/fusion-framework/pull/4157) [`6aa8e1f`](https://github.com/equinor/fusion-framework/commit/6aa8e1f5c9d852b25e97aa7d98a63008c64d4581) Thanks [@Noggling](https://github.com/Noggling)! - Internal: patch release to align TypeScript types across packages for consistent type compatibility.
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [[`6aa8e1f`](https://github.com/equinor/fusion-framework/commit/6aa8e1f5c9d852b25e97aa7d98a63008c64d4581), [`db8fa81`](https://github.com/equinor/fusion-framework/commit/db8fa8134b77a628b15e06f7f72b50f04ef97458)]:
|
|
27
|
+
- @equinor/fusion-framework-app@10.4.9
|
|
28
|
+
- @equinor/fusion-framework-module-app@7.4.1
|
|
29
|
+
- @equinor/fusion-framework-module@5.0.6
|
|
30
|
+
- @equinor/fusion-framework-module-msal@7.3.1
|
|
31
|
+
- @equinor/fusion-framework-module-navigation@6.0.1
|
|
32
|
+
- @equinor/fusion-framework-react@7.4.20
|
|
33
|
+
- @equinor/fusion-framework-react-module-http@10.0.1
|
|
34
|
+
- @equinor/fusion-framework-react-module@3.1.14
|
|
35
|
+
|
|
3
36
|
## 9.0.7
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
|
@@ -114,7 +147,6 @@
|
|
|
114
147
|
### Patch Changes
|
|
115
148
|
|
|
116
149
|
- [#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.
|
|
117
|
-
|
|
118
150
|
- Update useCurrentAccount to use account property instead of deprecated defaultAccount
|
|
119
151
|
- Fix useToken hook to properly handle AcquireTokenResult type
|
|
120
152
|
- Ensure proper null/undefined handling for account information
|
|
@@ -170,14 +202,12 @@
|
|
|
170
202
|
- [#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.
|
|
171
203
|
|
|
172
204
|
**Module Bookmark Changes:**
|
|
173
|
-
|
|
174
205
|
- Refactored `Bookmark` type in `packages/modules/bookmark/src/types.ts`
|
|
175
206
|
- Added export for `BookmarkProviderEvents` type in `packages/modules/bookmark/src/index.ts`
|
|
176
207
|
- Updated JSDoc comment from `@note` to `@remarks` in `packages/modules/bookmark/src/BookmarkClient.ts`
|
|
177
208
|
- Reordered tsconfig references (event before services)
|
|
178
209
|
|
|
179
210
|
**React Changes:**
|
|
180
|
-
|
|
181
211
|
- Updated `packages/react/modules/bookmark/src/portal/useBookmarkNavigate.ts` to use proper TypeScript typing for bookmark provider events
|
|
182
212
|
- Removed React paths configuration from `packages/react/app/tsconfig.json`
|
|
183
213
|
|
|
@@ -224,7 +254,6 @@
|
|
|
224
254
|
### Patch Changes
|
|
225
255
|
|
|
226
256
|
- [#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
|
|
227
|
-
|
|
228
257
|
- Updated package.json typesVersions.
|
|
229
258
|
- Ensures backward compatibility with older node versions.
|
|
230
259
|
- Ensured consistency with workspace and repository configuration.
|
|
@@ -284,7 +313,6 @@
|
|
|
284
313
|
`appKey (string)`: The key of the Fusion app to load and mount.
|
|
285
314
|
|
|
286
315
|
### Returns
|
|
287
|
-
|
|
288
316
|
- **loading** `(boolean)`: true while the app is loading.
|
|
289
317
|
- **error** `(Error | undefined)`: Error object if loading fails, otherwise undefined.
|
|
290
318
|
- **appRef** `(React.RefObject<HTMLDivElement | null>)`: Ref to the DOM element where the child app is mounted.
|
|
@@ -318,7 +346,6 @@
|
|
|
318
346
|
```
|
|
319
347
|
|
|
320
348
|
### Notes
|
|
321
|
-
|
|
322
349
|
- The hook is designed to be used in a parent Fusion app context.
|
|
323
350
|
- The returned appRef should be appended to a container element in your component.
|
|
324
351
|
- Handles subscription and cleanup automatically.
|
|
@@ -602,7 +629,6 @@
|
|
|
602
629
|
### Minor Changes
|
|
603
630
|
|
|
604
631
|
- [#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:
|
|
605
|
-
|
|
606
632
|
1. **AppClient.ts**
|
|
607
633
|
- Added `updateAppSettings` method to set app settings by appKey.
|
|
608
634
|
2. **AppModuleProvider.ts**
|
|
@@ -650,7 +676,6 @@
|
|
|
650
676
|
### Minor Changes
|
|
651
677
|
|
|
652
678
|
- [#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.
|
|
653
|
-
|
|
654
679
|
- Updated `index.ts` to re-export everything from `@equinor/fusion-framework-react-module-bookmark` instead of individual exports.
|
|
655
680
|
- Marked `useBookmark` as deprecated in `useBookmark.ts`.
|
|
656
681
|
- Enhanced `useCurrentBookmark` in `useCurrentBookmark.ts` to accept a `BookmarkPayloadGenerator` and use the `BookmarkModule` from `useAppModule`.
|
|
@@ -692,12 +717,10 @@
|
|
|
692
717
|
> This will introduce breaking changes to the configuration of `AppConfigurator.client`.
|
|
693
718
|
|
|
694
719
|
**Added**
|
|
695
|
-
|
|
696
720
|
- Introduced `AppClient` class to handle application manifest and configuration queries.
|
|
697
721
|
- Added `zod` to validate the application manifest.
|
|
698
722
|
|
|
699
723
|
**Changed**
|
|
700
|
-
|
|
701
724
|
- Updated `AppModuleProvider` to use `AppClient` for fetching application manifests and configurations.
|
|
702
725
|
- Modified `AppConfigurator` to utilize `AppClient` for client configuration.
|
|
703
726
|
- Updated `useApps` hook with new input parameter for `filterByCurrentUser` in `fusion-framework-react`.
|
|
@@ -829,7 +852,6 @@
|
|
|
829
852
|
- [#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.
|
|
830
853
|
|
|
831
854
|
Removing the `removeComments` option allows TypeScript to preserve comments in the compiled JavaScript output. This can be beneficial for several reasons:
|
|
832
|
-
|
|
833
855
|
1. Improved debugging: Preserved comments can help developers understand the code better during debugging sessions.
|
|
834
856
|
2. Documentation: JSDoc comments and other important code documentation will be retained in the compiled output.
|
|
835
857
|
3. Source map accuracy: Keeping comments can lead to more accurate source maps, which is crucial for debugging and error tracking.
|
|
@@ -1198,7 +1220,6 @@
|
|
|
1198
1220
|
### Minor Changes
|
|
1199
1221
|
|
|
1200
1222
|
- [#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:
|
|
1201
|
-
|
|
1202
1223
|
- Created hooks for accessing current authenticated account
|
|
1203
1224
|
- Created hooks for acquiring token
|
|
1204
1225
|
- Created hooks for acquiring access token
|
|
@@ -1425,7 +1446,6 @@
|
|
|
1425
1446
|
### Minor Changes
|
|
1426
1447
|
|
|
1427
1448
|
- [#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**
|
|
1428
|
-
|
|
1429
1449
|
- add hook for using the navigation module
|
|
1430
1450
|
- add hook for creating a react router
|
|
1431
1451
|
|
|
@@ -1456,7 +1476,6 @@
|
|
|
1456
1476
|
### Patch Changes
|
|
1457
1477
|
|
|
1458
1478
|
- [#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**
|
|
1459
|
-
|
|
1460
1479
|
- align all versions of typescript
|
|
1461
1480
|
- update types to build
|
|
1462
1481
|
- 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"}
|