@equinor/fusion-framework-app 11.0.12 → 13.0.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/README.md +38 -1
  3. package/dist/esm/AppConfigurator.js +28 -3
  4. package/dist/esm/AppConfigurator.js.map +1 -1
  5. package/dist/esm/AppConfiguratorError.js +32 -0
  6. package/dist/esm/AppConfiguratorError.js.map +1 -0
  7. package/dist/esm/AppModulesConfiguredEvent.js +18 -0
  8. package/dist/esm/AppModulesConfiguredEvent.js.map +1 -0
  9. package/dist/esm/AppModulesInitializedEvent.js +23 -0
  10. package/dist/esm/AppModulesInitializedEvent.js.map +1 -0
  11. package/dist/esm/configure-modules.js +6 -0
  12. package/dist/esm/configure-modules.js.map +1 -1
  13. package/dist/esm/enable-state.js +42 -0
  14. package/dist/esm/enable-state.js.map +1 -0
  15. package/dist/esm/index.js +3 -0
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/utils.js +41 -0
  18. package/dist/esm/utils.js.map +1 -0
  19. package/dist/esm/version.js +1 -1
  20. package/dist/esm/version.js.map +1 -1
  21. package/dist/tsconfig.tsbuildinfo +1 -1
  22. package/dist/types/AppConfigurator.d.ts +20 -2
  23. package/dist/types/AppConfiguratorError.d.ts +26 -0
  24. package/dist/types/AppModulesConfiguredEvent.d.ts +37 -0
  25. package/dist/types/AppModulesInitializedEvent.d.ts +34 -0
  26. package/dist/types/configure-modules.d.ts +6 -0
  27. package/dist/types/enable-state.d.ts +39 -0
  28. package/dist/types/index.d.ts +4 -1
  29. package/dist/types/utils.d.ts +22 -0
  30. package/dist/types/version.d.ts +1 -1
  31. package/package.json +20 -6
  32. package/src/AppConfigurator.ts +50 -4
  33. package/src/AppConfiguratorError.ts +34 -0
  34. package/src/AppModulesConfiguredEvent.ts +43 -0
  35. package/src/AppModulesInitializedEvent.ts +40 -0
  36. package/src/configure-modules.ts +8 -0
  37. package/src/enable-state.ts +49 -0
  38. package/src/index.ts +7 -1
  39. package/src/utils.ts +50 -0
  40. package/src/version.ts +1 -1
  41. package/tsconfig.json +3 -0
package/src/utils.ts ADDED
@@ -0,0 +1,50 @@
1
+ export { default as deepClone } from 'lodash.clonedeep';
2
+
3
+ /**
4
+ * Utility type that makes all properties of an object deeply readonly.
5
+ *
6
+ * @typeParam T - The type to make deeply readonly.
7
+ */
8
+ export type DeepImmutable<T> = {
9
+ readonly [P in keyof T]: T[P] extends object ? DeepImmutable<T[P]> : T[P];
10
+ };
11
+
12
+ /**
13
+ * Determines if the provided object is eligible to be frozen.
14
+ *
15
+ * Checks whether the input is a non-null object or array that is not already frozen.
16
+ *
17
+ * @param obj - The value to check for isMutable.
18
+ * @returns True if the object is a non-null object or array and is not already frozen; otherwise, false.
19
+ */
20
+ function isMutable(obj: unknown): obj is Record<string, unknown> | Array<unknown> {
21
+ return typeof obj === 'object' && obj !== null && !Object.isFrozen(obj);
22
+ }
23
+
24
+ /**
25
+ * Recursively applies Object.freeze to an object and all nested properties, making them immutable.
26
+ *
27
+ * @remarks
28
+ * - Plain objects and arrays are deeply frozen.
29
+ * - Does not handle circular references. Use with caution on complex object graphs.
30
+ * - Symbol properties are not frozen.
31
+ *
32
+ * @template T - The type of the object to freeze.
33
+ * @param obj - The object to deeply freeze.
34
+ * @returns The deeply frozen (read-only) object.
35
+ */
36
+ export function deepFreeze<T>(source: T): DeepImmutable<T> {
37
+ // Skip primitives and objects already frozen to avoid unnecessary recursion.
38
+ if (isMutable(source)) {
39
+ // Arrays require traversing their values directly before freezing the container.
40
+ if (Array.isArray(source)) {
41
+ // Freeze every nested array value so the result is immutable at every depth.
42
+ source.forEach(deepFreeze);
43
+ } else {
44
+ // Freeze every nested object value so the result is immutable at every depth.
45
+ Object.values(source).forEach(deepFreeze);
46
+ }
47
+ Object.freeze(source);
48
+ }
49
+ return source;
50
+ }
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '11.0.12';
2
+ export const version = '13.0.0';
package/tsconfig.json CHANGED
@@ -24,6 +24,9 @@
24
24
  {
25
25
  "path": "../modules/bookmark"
26
26
  },
27
+ {
28
+ "path": "../modules/state"
29
+ },
27
30
  {
28
31
  "path": "../modules/app"
29
32
  },