@itwin/presentation-frontend 4.0.0-dev.52 → 4.0.0-dev.55

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 (88) hide show
  1. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.d.ts +29 -29
  2. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js +47 -47
  3. package/lib/cjs/presentation-frontend/Diagnostics.d.ts +14 -14
  4. package/lib/cjs/presentation-frontend/Diagnostics.js +61 -61
  5. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.d.ts +12 -12
  6. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js +20 -20
  7. package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts +10 -10
  8. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js +41 -41
  9. package/lib/cjs/presentation-frontend/LocalizationHelper.d.ts +10 -10
  10. package/lib/cjs/presentation-frontend/LocalizationHelper.js +31 -31
  11. package/lib/cjs/presentation-frontend/Presentation.d.ts +73 -73
  12. package/lib/cjs/presentation-frontend/Presentation.js +159 -159
  13. package/lib/cjs/presentation-frontend/PresentationManager.d.ts +205 -205
  14. package/lib/cjs/presentation-frontend/PresentationManager.js +438 -438
  15. package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
  16. package/lib/cjs/presentation-frontend/RulesetManager.d.ts +63 -63
  17. package/lib/cjs/presentation-frontend/RulesetManager.js +85 -85
  18. package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts +143 -143
  19. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js +195 -195
  20. package/lib/cjs/presentation-frontend/StateTracker.d.ts +38 -38
  21. package/lib/cjs/presentation-frontend/StateTracker.js +128 -128
  22. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +132 -132
  23. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
  24. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +519 -519
  25. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  26. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +111 -111
  27. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +290 -290
  28. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts +52 -52
  29. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js +97 -97
  30. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts +19 -19
  31. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js +9 -9
  32. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts +52 -52
  33. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js +33 -33
  34. package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts +103 -103
  35. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js +108 -108
  36. package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts +17 -17
  37. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js +40 -40
  38. package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts +139 -139
  39. package/lib/cjs/presentation-frontend/selection/SelectionManager.js +414 -414
  40. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts +59 -59
  41. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js +91 -91
  42. package/lib/cjs/presentation-frontend.d.ts +34 -34
  43. package/lib/cjs/presentation-frontend.js +54 -50
  44. package/lib/cjs/presentation-frontend.js.map +1 -1
  45. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.d.ts +29 -29
  46. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js +43 -43
  47. package/lib/esm/presentation-frontend/Diagnostics.d.ts +14 -14
  48. package/lib/esm/presentation-frontend/Diagnostics.js +56 -56
  49. package/lib/esm/presentation-frontend/FrontendLoggerCategory.d.ts +12 -12
  50. package/lib/esm/presentation-frontend/FrontendLoggerCategory.js +17 -17
  51. package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts +10 -10
  52. package/lib/esm/presentation-frontend/IpcRequestsHandler.js +37 -37
  53. package/lib/esm/presentation-frontend/LocalizationHelper.d.ts +10 -10
  54. package/lib/esm/presentation-frontend/LocalizationHelper.js +27 -27
  55. package/lib/esm/presentation-frontend/Presentation.d.ts +73 -73
  56. package/lib/esm/presentation-frontend/Presentation.js +155 -155
  57. package/lib/esm/presentation-frontend/PresentationManager.d.ts +205 -205
  58. package/lib/esm/presentation-frontend/PresentationManager.js +433 -433
  59. package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
  60. package/lib/esm/presentation-frontend/RulesetManager.d.ts +63 -63
  61. package/lib/esm/presentation-frontend/RulesetManager.js +81 -81
  62. package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts +143 -143
  63. package/lib/esm/presentation-frontend/RulesetVariablesManager.js +191 -191
  64. package/lib/esm/presentation-frontend/StateTracker.d.ts +38 -38
  65. package/lib/esm/presentation-frontend/StateTracker.js +124 -124
  66. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +132 -132
  67. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
  68. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +514 -513
  69. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  70. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +111 -111
  71. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +282 -282
  72. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts +52 -52
  73. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js +93 -93
  74. package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts +19 -19
  75. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js +8 -8
  76. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts +52 -52
  77. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js +29 -29
  78. package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts +103 -103
  79. package/lib/esm/presentation-frontend/selection/SelectionHandler.js +104 -104
  80. package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts +17 -17
  81. package/lib/esm/presentation-frontend/selection/SelectionHelper.js +36 -36
  82. package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts +139 -139
  83. package/lib/esm/presentation-frontend/selection/SelectionManager.js +409 -409
  84. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts +59 -59
  85. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js +85 -85
  86. package/lib/esm/presentation-frontend.d.ts +34 -34
  87. package/lib/esm/presentation-frontend.js +38 -38
  88. package/package.json +15 -15
@@ -1,156 +1,156 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- /** @packageDocumentation
6
- * @module Core
7
- */
8
- import { IModelApp } from "@itwin/core-frontend";
9
- import { PresentationError, PresentationStatus } from "@itwin/presentation-common";
10
- import { FavoritePropertiesManager } from "./favorite-properties/FavoritePropertiesManager";
11
- import { createFavoritePropertiesStorage, DefaultFavoritePropertiesStorageTypes } from "./favorite-properties/FavoritePropertiesStorage";
12
- import { FrontendLocalizationHelper } from "./LocalizationHelper";
13
- import { PresentationManager } from "./PresentationManager";
14
- import { SelectionManager } from "./selection/SelectionManager";
15
- import { SelectionScopesManager } from "./selection/SelectionScopesManager";
16
- let localization;
17
- let presentationManager;
18
- let selectionManager;
19
- let favoritePropertiesManager;
20
- const initializationHandlers = [];
21
- const terminationHandlers = [];
22
- /**
23
- * Static class used to statically set up Presentation library for the frontend.
24
- * Basically what it does is:
25
- * - Create a singleton [[PresentationManager]] instance
26
- * - Create a singleton [[SelectionManager]] instance
27
- * - Create a singleton [[FavoritePropertiesManager]]] instance
28
- *
29
- * @public
30
- */
31
- export class Presentation {
32
- /* istanbul ignore next */
33
- constructor() { }
34
- /**
35
- * Initializes Presentation library for the frontend.
36
- *
37
- * Example:
38
- * ``` ts
39
- * [[include:Presentation.Frontend.Initialization]]
40
- * ```
41
- *
42
- * The method should be called after a call to [IModelApp.startup]($core-frontend).
43
- */
44
- static async initialize(props) {
45
- if (!IModelApp.initialized) {
46
- throw new PresentationError(PresentationStatus.NotInitialized, "IModelApp.startup must be called before calling Presentation.initialize");
47
- }
48
- if (!localization) {
49
- localization = IModelApp.localization;
50
- }
51
- if (!presentationManager) {
52
- const managerProps = props?.presentation ?? {};
53
- if (!managerProps.activeLocale) {
54
- const languages = Presentation.localization.getLanguageList();
55
- managerProps.activeLocale = (languages.length ? languages[0] : undefined);
56
- }
57
- presentationManager = PresentationManager.create(managerProps);
58
- }
59
- if (!selectionManager) {
60
- selectionManager = new SelectionManager(props?.selection ?? {
61
- scopes: new SelectionScopesManager({
62
- rpcRequestsHandler: presentationManager.rpcRequestsHandler,
63
- localeProvider: () => this.presentation.activeLocale,
64
- }),
65
- });
66
- }
67
- if (!favoritePropertiesManager) {
68
- favoritePropertiesManager = new FavoritePropertiesManager({
69
- storage: props?.favorites ? props.favorites.storage : createFavoritePropertiesStorage(DefaultFavoritePropertiesStorageTypes.Noop),
70
- });
71
- }
72
- // eslint-disable-next-line @typescript-eslint/unbound-method
73
- presentationManager.onNewiModelConnection = favoritePropertiesManager.initializeConnection.bind(favoritePropertiesManager);
74
- await FrontendLocalizationHelper.registerNamespaces();
75
- for (const handler of initializationHandlers) {
76
- const cleanup = await handler();
77
- if (cleanup)
78
- terminationHandlers.push(cleanup);
79
- }
80
- }
81
- /**
82
- * Terminates Presentation library frontend. This method should be called
83
- * before a call to [IModelApp.shutdown]($core-frontend)
84
- */
85
- static terminate() {
86
- terminationHandlers.forEach((handler) => handler());
87
- terminationHandlers.length = 0;
88
- if (localization)
89
- FrontendLocalizationHelper.unregisterNamespaces();
90
- if (presentationManager)
91
- presentationManager.dispose();
92
- presentationManager = undefined;
93
- if (favoritePropertiesManager)
94
- favoritePropertiesManager.dispose();
95
- favoritePropertiesManager = undefined;
96
- selectionManager = undefined;
97
- localization = undefined;
98
- }
99
- /**
100
- * Registers an additional handler which will be invoked during Presentation library frontend
101
- * initialization.
102
- */
103
- static registerInitializationHandler(handler) {
104
- initializationHandlers.push(handler);
105
- }
106
- /** The singleton [[PresentationManager]] */
107
- static get presentation() {
108
- if (!presentationManager)
109
- throw new Error("Presentation must be first initialized by calling Presentation.initialize");
110
- return presentationManager;
111
- }
112
- /** @internal */
113
- static setPresentationManager(value) {
114
- if (presentationManager)
115
- presentationManager.dispose();
116
- presentationManager = value;
117
- }
118
- /** The singleton [[SelectionManager]] */
119
- static get selection() {
120
- if (!selectionManager)
121
- throw new Error("Presentation must be first initialized by calling Presentation.initialize");
122
- return selectionManager;
123
- }
124
- /** @internal */
125
- static setSelectionManager(value) {
126
- selectionManager = value;
127
- }
128
- /**
129
- * The singleton [[FavoritePropertiesManager]]
130
- * @public
131
- */
132
- static get favoriteProperties() {
133
- if (!favoritePropertiesManager)
134
- throw new Error("Favorite Properties must be first initialized by calling Presentation.initialize");
135
- return favoritePropertiesManager;
136
- }
137
- /** @internal */
138
- static setFavoritePropertiesManager(value) {
139
- if (favoritePropertiesManager)
140
- favoritePropertiesManager.dispose();
141
- favoritePropertiesManager = value;
142
- }
143
- /**
144
- * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.
145
- */
146
- static get localization() {
147
- if (!localization)
148
- throw new Error("Presentation must be first initialized by calling Presentation.initialize");
149
- return localization;
150
- }
151
- /** @internal */
152
- static setLocalization(value) {
153
- localization = value;
154
- }
155
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module Core
7
+ */
8
+ import { IModelApp } from "@itwin/core-frontend";
9
+ import { PresentationError, PresentationStatus } from "@itwin/presentation-common";
10
+ import { FavoritePropertiesManager } from "./favorite-properties/FavoritePropertiesManager";
11
+ import { createFavoritePropertiesStorage, DefaultFavoritePropertiesStorageTypes } from "./favorite-properties/FavoritePropertiesStorage";
12
+ import { FrontendLocalizationHelper } from "./LocalizationHelper";
13
+ import { PresentationManager } from "./PresentationManager";
14
+ import { SelectionManager } from "./selection/SelectionManager";
15
+ import { SelectionScopesManager } from "./selection/SelectionScopesManager";
16
+ let localization;
17
+ let presentationManager;
18
+ let selectionManager;
19
+ let favoritePropertiesManager;
20
+ const initializationHandlers = [];
21
+ const terminationHandlers = [];
22
+ /**
23
+ * Static class used to statically set up Presentation library for the frontend.
24
+ * Basically what it does is:
25
+ * - Create a singleton [[PresentationManager]] instance
26
+ * - Create a singleton [[SelectionManager]] instance
27
+ * - Create a singleton [[FavoritePropertiesManager]]] instance
28
+ *
29
+ * @public
30
+ */
31
+ export class Presentation {
32
+ /* istanbul ignore next */
33
+ constructor() { }
34
+ /**
35
+ * Initializes Presentation library for the frontend.
36
+ *
37
+ * Example:
38
+ * ``` ts
39
+ * [[include:Presentation.Frontend.Initialization]]
40
+ * ```
41
+ *
42
+ * The method should be called after a call to [IModelApp.startup]($core-frontend).
43
+ */
44
+ static async initialize(props) {
45
+ if (!IModelApp.initialized) {
46
+ throw new PresentationError(PresentationStatus.NotInitialized, "IModelApp.startup must be called before calling Presentation.initialize");
47
+ }
48
+ if (!localization) {
49
+ localization = IModelApp.localization;
50
+ }
51
+ if (!presentationManager) {
52
+ const managerProps = props?.presentation ?? {};
53
+ if (!managerProps.activeLocale) {
54
+ const languages = Presentation.localization.getLanguageList();
55
+ managerProps.activeLocale = (languages.length ? languages[0] : undefined);
56
+ }
57
+ presentationManager = PresentationManager.create(managerProps);
58
+ }
59
+ if (!selectionManager) {
60
+ selectionManager = new SelectionManager(props?.selection ?? {
61
+ scopes: new SelectionScopesManager({
62
+ rpcRequestsHandler: presentationManager.rpcRequestsHandler,
63
+ localeProvider: () => this.presentation.activeLocale,
64
+ }),
65
+ });
66
+ }
67
+ if (!favoritePropertiesManager) {
68
+ favoritePropertiesManager = new FavoritePropertiesManager({
69
+ storage: props?.favorites ? props.favorites.storage : createFavoritePropertiesStorage(DefaultFavoritePropertiesStorageTypes.Noop),
70
+ });
71
+ }
72
+ // eslint-disable-next-line @typescript-eslint/unbound-method
73
+ presentationManager.onNewiModelConnection = favoritePropertiesManager.initializeConnection.bind(favoritePropertiesManager);
74
+ await FrontendLocalizationHelper.registerNamespaces();
75
+ for (const handler of initializationHandlers) {
76
+ const cleanup = await handler();
77
+ if (cleanup)
78
+ terminationHandlers.push(cleanup);
79
+ }
80
+ }
81
+ /**
82
+ * Terminates Presentation library frontend. This method should be called
83
+ * before a call to [IModelApp.shutdown]($core-frontend)
84
+ */
85
+ static terminate() {
86
+ terminationHandlers.forEach((handler) => handler());
87
+ terminationHandlers.length = 0;
88
+ if (localization)
89
+ FrontendLocalizationHelper.unregisterNamespaces();
90
+ if (presentationManager)
91
+ presentationManager.dispose();
92
+ presentationManager = undefined;
93
+ if (favoritePropertiesManager)
94
+ favoritePropertiesManager.dispose();
95
+ favoritePropertiesManager = undefined;
96
+ selectionManager = undefined;
97
+ localization = undefined;
98
+ }
99
+ /**
100
+ * Registers an additional handler which will be invoked during Presentation library frontend
101
+ * initialization.
102
+ */
103
+ static registerInitializationHandler(handler) {
104
+ initializationHandlers.push(handler);
105
+ }
106
+ /** The singleton [[PresentationManager]] */
107
+ static get presentation() {
108
+ if (!presentationManager)
109
+ throw new Error("Presentation must be first initialized by calling Presentation.initialize");
110
+ return presentationManager;
111
+ }
112
+ /** @internal */
113
+ static setPresentationManager(value) {
114
+ if (presentationManager)
115
+ presentationManager.dispose();
116
+ presentationManager = value;
117
+ }
118
+ /** The singleton [[SelectionManager]] */
119
+ static get selection() {
120
+ if (!selectionManager)
121
+ throw new Error("Presentation must be first initialized by calling Presentation.initialize");
122
+ return selectionManager;
123
+ }
124
+ /** @internal */
125
+ static setSelectionManager(value) {
126
+ selectionManager = value;
127
+ }
128
+ /**
129
+ * The singleton [[FavoritePropertiesManager]]
130
+ * @public
131
+ */
132
+ static get favoriteProperties() {
133
+ if (!favoritePropertiesManager)
134
+ throw new Error("Favorite Properties must be first initialized by calling Presentation.initialize");
135
+ return favoritePropertiesManager;
136
+ }
137
+ /** @internal */
138
+ static setFavoritePropertiesManager(value) {
139
+ if (favoritePropertiesManager)
140
+ favoritePropertiesManager.dispose();
141
+ favoritePropertiesManager = value;
142
+ }
143
+ /**
144
+ * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.
145
+ */
146
+ static get localization() {
147
+ if (!localization)
148
+ throw new Error("Presentation must be first initialized by calling Presentation.initialize");
149
+ return localization;
150
+ }
151
+ /** @internal */
152
+ static setLocalization(value) {
153
+ localization = value;
154
+ }
155
+ }
156
156
  //# sourceMappingURL=Presentation.js.map