@equinor/fusion-framework-module-navigation 6.0.1-next.1 → 7.0.0-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.
Files changed (158) hide show
  1. package/CHANGELOG.md +63 -13
  2. package/README.md +694 -0
  3. package/dist/esm/NavigationConfigurator.interface.js +2 -0
  4. package/dist/esm/NavigationConfigurator.interface.js.map +1 -0
  5. package/dist/esm/NavigationConfigurator.js +144 -0
  6. package/dist/esm/NavigationConfigurator.js.map +1 -0
  7. package/dist/esm/NavigationProvider.interface.js +2 -0
  8. package/dist/esm/NavigationProvider.interface.js.map +1 -0
  9. package/dist/esm/NavigationProvider.js +256 -0
  10. package/dist/esm/NavigationProvider.js.map +1 -0
  11. package/dist/esm/enable-navigation.js +52 -0
  12. package/dist/esm/enable-navigation.js.map +1 -0
  13. package/dist/esm/events.js +23 -0
  14. package/dist/esm/events.js.map +1 -0
  15. package/dist/esm/index.js +6 -5
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/lib/BaseHistory.js +189 -0
  18. package/dist/esm/lib/BaseHistory.js.map +1 -0
  19. package/dist/esm/lib/BrowserHistory.js +91 -0
  20. package/dist/esm/lib/BrowserHistory.js.map +1 -0
  21. package/dist/esm/lib/BrowserHistoryHashStack.js +53 -0
  22. package/dist/esm/lib/BrowserHistoryHashStack.js.map +1 -0
  23. package/dist/esm/lib/BrowserHistoryStack.js +77 -0
  24. package/dist/esm/lib/BrowserHistoryStack.js.map +1 -0
  25. package/dist/esm/lib/MemoryHistory.js +47 -0
  26. package/dist/esm/lib/MemoryHistory.js.map +1 -0
  27. package/dist/esm/lib/MemoryStack.js +98 -0
  28. package/dist/esm/lib/MemoryStack.js.map +1 -0
  29. package/dist/esm/lib/create-history.js +48 -0
  30. package/dist/esm/lib/create-history.js.map +1 -0
  31. package/dist/esm/lib/index.js +8 -1
  32. package/dist/esm/lib/index.js.map +1 -1
  33. package/dist/esm/lib/state/history.actions.js +71 -0
  34. package/dist/esm/lib/state/history.actions.js.map +1 -0
  35. package/dist/esm/lib/state/history.flows.js +212 -0
  36. package/dist/esm/lib/state/history.flows.js.map +1 -0
  37. package/dist/esm/lib/state/history.reducer.js +59 -0
  38. package/dist/esm/lib/state/history.reducer.js.map +1 -0
  39. package/dist/esm/lib/state/history.state.js +37 -0
  40. package/dist/esm/lib/state/history.state.js.map +1 -0
  41. package/dist/esm/lib/state/index.js +4 -0
  42. package/dist/esm/lib/state/index.js.map +1 -0
  43. package/dist/esm/lib/types.js +25 -0
  44. package/dist/esm/lib/types.js.map +1 -0
  45. package/dist/esm/lib/utils/encode-trailing-whitespace.js +19 -0
  46. package/dist/esm/lib/utils/encode-trailing-whitespace.js.map +1 -0
  47. package/dist/esm/lib/utils/has-protocol.js +22 -0
  48. package/dist/esm/lib/utils/has-protocol.js.map +1 -0
  49. package/dist/esm/lib/utils/index.js +6 -0
  50. package/dist/esm/lib/utils/index.js.map +1 -0
  51. package/dist/esm/lib/utils/path-to-string.js +23 -0
  52. package/dist/esm/lib/utils/path-to-string.js.map +1 -0
  53. package/dist/esm/lib/utils/path-to-url.js +47 -0
  54. package/dist/esm/lib/utils/path-to-url.js.map +1 -0
  55. package/dist/esm/lib/utils/resolve-browser-location.js +53 -0
  56. package/dist/esm/lib/utils/resolve-browser-location.js.map +1 -0
  57. package/dist/esm/lib/utils/resolve-path.js +21 -0
  58. package/dist/esm/lib/utils/resolve-path.js.map +1 -0
  59. package/dist/esm/module.js +34 -25
  60. package/dist/esm/module.js.map +1 -1
  61. package/dist/esm/version.js +1 -1
  62. package/dist/tsconfig.tsbuildinfo +1 -1
  63. package/dist/types/NavigationConfigurator.d.ts +60 -0
  64. package/dist/types/NavigationConfigurator.interface.d.ts +17 -0
  65. package/dist/types/NavigationProvider.d.ts +112 -0
  66. package/dist/types/NavigationProvider.interface.d.ts +75 -0
  67. package/dist/types/enable-navigation.d.ts +40 -0
  68. package/dist/types/events.d.ts +48 -0
  69. package/dist/types/index.d.ts +13 -6
  70. package/dist/types/lib/BaseHistory.d.ts +122 -0
  71. package/dist/types/lib/BrowserHistory.d.ts +53 -0
  72. package/dist/types/lib/BrowserHistoryHashStack.d.ts +41 -0
  73. package/dist/types/lib/BrowserHistoryStack.d.ts +51 -0
  74. package/dist/types/lib/MemoryHistory.d.ts +27 -0
  75. package/dist/types/lib/MemoryStack.d.ts +57 -0
  76. package/dist/types/lib/create-history.d.ts +35 -0
  77. package/dist/types/lib/index.d.ts +7 -1
  78. package/dist/types/lib/state/history.actions.d.ts +61 -0
  79. package/dist/types/lib/state/history.flows.d.ts +102 -0
  80. package/dist/types/lib/state/history.reducer.d.ts +85 -0
  81. package/dist/types/lib/state/history.state.d.ts +27 -0
  82. package/dist/types/lib/state/index.d.ts +3 -0
  83. package/dist/types/lib/types.d.ts +145 -0
  84. package/dist/types/lib/utils/encode-trailing-whitespace.d.ts +16 -0
  85. package/dist/types/lib/utils/has-protocol.d.ts +19 -0
  86. package/dist/types/lib/utils/index.d.ts +5 -0
  87. package/dist/types/lib/utils/path-to-string.d.ts +17 -0
  88. package/dist/types/lib/utils/path-to-url.d.ts +32 -0
  89. package/dist/types/lib/utils/resolve-browser-location.d.ts +42 -0
  90. package/dist/types/lib/utils/resolve-path.d.ts +17 -0
  91. package/dist/types/module.d.ts +33 -5
  92. package/dist/types/version.d.ts +1 -1
  93. package/package.json +25 -7
  94. package/src/NavigationConfigurator.interface.ts +18 -0
  95. package/src/NavigationConfigurator.ts +184 -0
  96. package/src/NavigationProvider.interface.ts +86 -0
  97. package/src/NavigationProvider.ts +313 -0
  98. package/src/__tests__/BrowserHistory.test.ts +151 -0
  99. package/src/__tests__/HashHistory.test.ts +121 -0
  100. package/src/__tests__/MemoryHistory.test.ts +185 -0
  101. package/src/__tests__/NavigationProvider.test.ts +60 -0
  102. package/src/__tests__/setup.ts +8 -0
  103. package/src/enable-navigation.ts +59 -0
  104. package/src/events.ts +65 -0
  105. package/src/index.ts +27 -6
  106. package/src/lib/BaseHistory.ts +229 -0
  107. package/src/lib/BrowserHistory.ts +123 -0
  108. package/src/lib/BrowserHistoryHashStack.ts +56 -0
  109. package/src/lib/BrowserHistoryStack.ts +82 -0
  110. package/src/lib/MemoryHistory.ts +66 -0
  111. package/src/lib/MemoryStack.ts +106 -0
  112. package/src/lib/create-history.ts +63 -0
  113. package/src/lib/index.ts +22 -1
  114. package/src/lib/state/history.actions.ts +108 -0
  115. package/src/lib/state/history.flows.ts +279 -0
  116. package/src/lib/state/history.reducer.ts +70 -0
  117. package/src/lib/state/history.state.ts +62 -0
  118. package/src/lib/state/index.ts +3 -0
  119. package/src/lib/types.ts +159 -0
  120. package/src/lib/utils/encode-trailing-whitespace.ts +18 -0
  121. package/src/lib/utils/has-protocol.ts +21 -0
  122. package/src/lib/utils/index.ts +5 -0
  123. package/src/lib/utils/path-to-string.ts +24 -0
  124. package/src/lib/utils/path-to-url.ts +52 -0
  125. package/src/lib/utils/resolve-browser-location.ts +60 -0
  126. package/src/lib/utils/resolve-path.ts +22 -0
  127. package/src/module.ts +53 -37
  128. package/src/version.ts +1 -1
  129. package/tsconfig.json +10 -1
  130. package/vitest.config.ts +14 -0
  131. package/dist/esm/configurator.js +0 -5
  132. package/dist/esm/configurator.js.map +0 -1
  133. package/dist/esm/createHistory.js +0 -18
  134. package/dist/esm/createHistory.js.map +0 -1
  135. package/dist/esm/lib/provider/INavigationProvider.js +0 -2
  136. package/dist/esm/lib/provider/INavigationProvider.js.map +0 -1
  137. package/dist/esm/lib/provider/NavigationProvider.js +0 -82
  138. package/dist/esm/lib/provider/NavigationProvider.js.map +0 -1
  139. package/dist/esm/lib/provider/index.js +0 -2
  140. package/dist/esm/lib/provider/index.js.map +0 -1
  141. package/dist/esm/navigator.js +0 -158
  142. package/dist/esm/navigator.js.map +0 -1
  143. package/dist/esm/types.js +0 -2
  144. package/dist/esm/types.js.map +0 -1
  145. package/dist/types/configurator.d.ts +0 -9
  146. package/dist/types/createHistory.d.ts +0 -4
  147. package/dist/types/lib/provider/INavigationProvider.d.ts +0 -38
  148. package/dist/types/lib/provider/NavigationProvider.d.ts +0 -22
  149. package/dist/types/lib/provider/index.d.ts +0 -2
  150. package/dist/types/navigator.d.ts +0 -105
  151. package/dist/types/types.d.ts +0 -3
  152. package/src/configurator.ts +0 -11
  153. package/src/createHistory.ts +0 -21
  154. package/src/lib/provider/INavigationProvider.ts +0 -46
  155. package/src/lib/provider/NavigationProvider.ts +0 -117
  156. package/src/lib/provider/index.ts +0 -2
  157. package/src/navigator.ts +0 -204
  158. package/src/types.ts +0 -4
package/CHANGELOG.md CHANGED
@@ -1,21 +1,76 @@
1
1
  # Change Log
2
2
 
3
- ## 6.0.1-next.1
3
+ ## 7.0.0-next.1
4
4
 
5
- ### Patch Changes
5
+ ### Major Changes
6
+
7
+ - [#3820](https://github.com/equinor/fusion-framework/pull/3820) [`d252b0d`](https://github.com/equinor/fusion-framework/commit/d252b0d442b7c8c1b50bf2768cf9ecbbb55a76f8) Thanks [@odinr](https://github.com/odinr)! - Complete refactor of navigation module architecture with React Router v7 upgrade, improved state management, and history implementations.
8
+
9
+ **Breaking Changes:**
10
+ 1. **Upgraded to React Router v7**: `@remix-run/router` upgraded from v1.8.0 to v1.23.0 for React Router v7 compatibility
11
+ - The `createRouter` API remains backward compatible
12
+ - All existing router patterns continue to work
13
+ - **Type compatibility note**: TypeScript types may not fully resolve with React Router v7, requiring type assertions (`as any`) in some cases when using `useRouter` with `RouterProvider`. This is a known limitation and will be addressed in future updates.
14
+
15
+ ```typescript
16
+ // Example: Type assertions required with React Router v7
17
+ import { RouterProvider } from 'react-router-dom';
18
+ import { useRouter } from '@equinor/fusion-framework-react-app/navigation';
19
+
20
+ export default function Router() {
21
+ // biome-ignore lint/suspicious/noExplicitAny: types not fully resolving with React Router v7
22
+ const router = useRouter(routes as any);
23
+ // biome-ignore lint/suspicious/noExplicitAny: types not fully resolving with React Router v7
24
+ return <RouterProvider router={router as any} />;
25
+ }
26
+ ```
27
+
28
+ 2. **Configurator exports restructured**: `NavigationConfigurator` and `INavigationConfigurator` are now exported from separate interface files
29
+ - Public API unchanged, but internal structure changed
30
+ 3. **`createHistory` path changed**: Moved from root to `lib/create-history`
31
+ - Public API unchanged, but internal path changed
32
+ 4. **Types reorganized**: Types moved from `./types` to `./lib/types`
33
+ - Public API unchanged, but internal path changed
34
+ 5. **`navigator` deprecated**: Use `history` instead
35
+
36
+ ```typescript
37
+ // Before
38
+ const nav = navigation.navigator;
39
+
40
+ // After
41
+ const history = navigation.history;
42
+ ```
43
+
44
+ **New Features:**
45
+ - Added `NavigationProvider` and `INavigationProvider` exports
46
+ - Added `enableNavigation` helper function for easier configuration
47
+ - Added navigation events (`NavigateEvent`, `NavigatedEvent`)
48
+ - Improved history implementations with state management
49
+ - Added comprehensive test coverage
50
+ - Added detailed README documentation
51
+
52
+ **Internal Improvements:**
53
+ - Restructured history implementations (BrowserHistory, HashHistory, MemoryHistory)
54
+ - Added state management with reducer pattern
55
+ - Improved type safety and organization
56
+ - Better separation of concerns
57
+
58
+ Closes https://github.com/equinor/fusion-framework/issues/3699
59
+
60
+ ### Minor Changes
6
61
 
7
- - [`2022136`](https://github.com/equinor/fusion-framework/commit/2022136108a49cf2ccd8109e7e720aa2fbc135f1) Thanks [@odinr](https://github.com/odinr)! - relase next of all packages
62
+ - [#3820](https://github.com/equinor/fusion-framework/pull/3820) [`d252b0d`](https://github.com/equinor/fusion-framework/commit/d252b0d442b7c8c1b50bf2768cf9ecbbb55a76f8) Thanks [@odinr](https://github.com/odinr)! - Deprecate `NavigationProvider.createRouter` method in favor of `@equinor/fusion-framework-react-router`.
8
63
 
9
- - Updated dependencies [[`2022136`](https://github.com/equinor/fusion-framework/commit/2022136108a49cf2ccd8109e7e720aa2fbc135f1)]:
10
- - @equinor/fusion-framework-module@5.0.6-next.1
64
+ The `createRouter` method now emits a deprecation warning via telemetry when called. Applications should migrate to using `@equinor/fusion-framework-react-router` for new route definitions.
11
65
 
12
- ## 6.0.1-next.0
66
+ **Migration:** Replace `navigation.createRouter(routes)` with the React Router DSL from `@equinor/fusion-framework-react-router/routes`.
13
67
 
14
68
  ### Patch Changes
15
69
 
16
- - [`895a49a`](https://github.com/equinor/fusion-framework/commit/895a49aaa815a6cd317e60f40875b1763bd6bded) Thanks [@odinr](https://github.com/odinr)! - relase next of all packages
70
+ - [#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
17
71
 
18
- - Updated dependencies [[`895a49a`](https://github.com/equinor/fusion-framework/commit/895a49aaa815a6cd317e60f40875b1763bd6bded)]:
72
+ - Updated dependencies [[`265bb76`](https://github.com/equinor/fusion-framework/commit/265bb767249989eeb1971e83f3fba94879e0813b), [`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)]:
73
+ - @equinor/fusion-observable@9.0.0-next.0
19
74
  - @equinor/fusion-framework-module@5.0.6-next.0
20
75
 
21
76
  ## 6.0.0
@@ -30,7 +85,6 @@
30
85
  ### Patch Changes
31
86
 
32
87
  - [#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
33
-
34
88
  - Updated package.json typesVersions.
35
89
  - Ensures backward compatibility with older node versions.
36
90
  - Ensured consistency with workspace and repository configuration.
@@ -131,7 +185,6 @@
131
185
  - [#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.
132
186
 
133
187
  Removing the `removeComments` option allows TypeScript to preserve comments in the compiled JavaScript output. This can be beneficial for several reasons:
134
-
135
188
  1. Improved debugging: Preserved comments can help developers understand the code better during debugging sessions.
136
189
  2. Documentation: JSDoc comments and other important code documentation will be retained in the compiled output.
137
190
  3. Source map accuracy: Keeping comments can lead to more accurate source maps, which is crucial for debugging and error tracking.
@@ -290,7 +343,6 @@
290
343
  ### Major Changes
291
344
 
292
345
  - [#907](https://github.com/equinor/fusion-framework/pull/907) [`7500ec2c`](https://github.com/equinor/fusion-framework/commit/7500ec2c9ca9b926a19539fc97c61c67f76fc8d9) Thanks [@odinr](https://github.com/odinr)! - extend base module provider
293
-
294
346
  - make `NavigationProvider` extend `BaseModuleProvider`
295
347
  - internal function `_localizeLocation` is renamed to `_localizePath`. _should not cause breaking changes_
296
348
  - expose localized state from `Navigator` _(history)_
@@ -300,7 +352,6 @@
300
352
  ### Minor Changes
301
353
 
302
354
  - [#907](https://github.com/equinor/fusion-framework/pull/907) [`7500ec2c`](https://github.com/equinor/fusion-framework/commit/7500ec2c9ca9b926a19539fc97c61c67f76fc8d9) Thanks [@odinr](https://github.com/odinr)! - add version to module
303
-
304
355
  - add `prebuild` step to generate version
305
356
  - update `.gitignore` to skip `version.ts` since this file is generated during building
306
357
 
@@ -311,7 +362,6 @@
311
362
  moved the init to constructor
312
363
 
313
364
  - [#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**
314
-
315
365
  - align all versions of typescript
316
366
  - update types to build
317
367
  - 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