@itwin/presentation-frontend 4.0.0-dev.21 → 4.0.0-dev.23

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 (123) 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/ConnectivityInformationProvider.js.map +1 -1
  4. package/lib/cjs/presentation-frontend/Diagnostics.d.ts +14 -14
  5. package/lib/cjs/presentation-frontend/Diagnostics.js +61 -61
  6. package/lib/cjs/presentation-frontend/Diagnostics.js.map +1 -1
  7. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.d.ts +12 -12
  8. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js +20 -20
  9. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
  10. package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts +10 -10
  11. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js +41 -41
  12. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js.map +1 -1
  13. package/lib/cjs/presentation-frontend/LocalizationHelper.d.ts +10 -10
  14. package/lib/cjs/presentation-frontend/LocalizationHelper.js +31 -31
  15. package/lib/cjs/presentation-frontend/LocalizationHelper.js.map +1 -1
  16. package/lib/cjs/presentation-frontend/Presentation.d.ts +73 -73
  17. package/lib/cjs/presentation-frontend/Presentation.js +160 -160
  18. package/lib/cjs/presentation-frontend/Presentation.js.map +1 -1
  19. package/lib/cjs/presentation-frontend/PresentationManager.d.ts +186 -186
  20. package/lib/cjs/presentation-frontend/PresentationManager.js +436 -436
  21. package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
  22. package/lib/cjs/presentation-frontend/RulesetManager.d.ts +63 -63
  23. package/lib/cjs/presentation-frontend/RulesetManager.js +85 -85
  24. package/lib/cjs/presentation-frontend/RulesetManager.js.map +1 -1
  25. package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts +143 -143
  26. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js +195 -195
  27. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  28. package/lib/cjs/presentation-frontend/StateTracker.d.ts +38 -38
  29. package/lib/cjs/presentation-frontend/StateTracker.js +129 -129
  30. package/lib/cjs/presentation-frontend/StateTracker.js.map +1 -1
  31. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +132 -132
  32. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +525 -525
  33. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  34. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +111 -111
  35. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +293 -293
  36. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  37. package/lib/cjs/presentation-frontend/selection/HiliteRules.json +172 -172
  38. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts +52 -52
  39. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js +97 -97
  40. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
  41. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts +19 -19
  42. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js +9 -9
  43. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  44. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts +52 -52
  45. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js +33 -33
  46. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  47. package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts +103 -103
  48. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js +108 -108
  49. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js.map +1 -1
  50. package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts +17 -17
  51. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js +40 -40
  52. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  53. package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts +139 -139
  54. package/lib/cjs/presentation-frontend/selection/SelectionManager.js +414 -414
  55. package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
  56. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts +59 -59
  57. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js +91 -91
  58. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  59. package/lib/cjs/presentation-frontend.d.ts +34 -34
  60. package/lib/cjs/presentation-frontend.js +50 -50
  61. package/lib/cjs/presentation-frontend.js.map +1 -1
  62. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.d.ts +29 -29
  63. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js +43 -43
  64. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  65. package/lib/esm/presentation-frontend/Diagnostics.d.ts +14 -14
  66. package/lib/esm/presentation-frontend/Diagnostics.js +56 -56
  67. package/lib/esm/presentation-frontend/Diagnostics.js.map +1 -1
  68. package/lib/esm/presentation-frontend/FrontendLoggerCategory.d.ts +12 -12
  69. package/lib/esm/presentation-frontend/FrontendLoggerCategory.js +17 -17
  70. package/lib/esm/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
  71. package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts +10 -10
  72. package/lib/esm/presentation-frontend/IpcRequestsHandler.js +37 -37
  73. package/lib/esm/presentation-frontend/IpcRequestsHandler.js.map +1 -1
  74. package/lib/esm/presentation-frontend/LocalizationHelper.d.ts +10 -10
  75. package/lib/esm/presentation-frontend/LocalizationHelper.js +27 -27
  76. package/lib/esm/presentation-frontend/LocalizationHelper.js.map +1 -1
  77. package/lib/esm/presentation-frontend/Presentation.d.ts +73 -73
  78. package/lib/esm/presentation-frontend/Presentation.js +156 -156
  79. package/lib/esm/presentation-frontend/Presentation.js.map +1 -1
  80. package/lib/esm/presentation-frontend/PresentationManager.d.ts +186 -186
  81. package/lib/esm/presentation-frontend/PresentationManager.js +431 -431
  82. package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
  83. package/lib/esm/presentation-frontend/RulesetManager.d.ts +63 -63
  84. package/lib/esm/presentation-frontend/RulesetManager.js +81 -81
  85. package/lib/esm/presentation-frontend/RulesetManager.js.map +1 -1
  86. package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts +143 -143
  87. package/lib/esm/presentation-frontend/RulesetVariablesManager.js +191 -191
  88. package/lib/esm/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  89. package/lib/esm/presentation-frontend/StateTracker.d.ts +38 -38
  90. package/lib/esm/presentation-frontend/StateTracker.js +125 -125
  91. package/lib/esm/presentation-frontend/StateTracker.js.map +1 -1
  92. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +132 -132
  93. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +519 -519
  94. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  95. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +111 -111
  96. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +285 -285
  97. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  98. package/lib/esm/presentation-frontend/selection/HiliteRules.json +172 -172
  99. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts +52 -52
  100. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js +93 -93
  101. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
  102. package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts +19 -19
  103. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js +8 -8
  104. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  105. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts +52 -52
  106. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js +29 -29
  107. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  108. package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts +103 -103
  109. package/lib/esm/presentation-frontend/selection/SelectionHandler.js +104 -104
  110. package/lib/esm/presentation-frontend/selection/SelectionHandler.js.map +1 -1
  111. package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts +17 -17
  112. package/lib/esm/presentation-frontend/selection/SelectionHelper.js +36 -36
  113. package/lib/esm/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  114. package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts +139 -139
  115. package/lib/esm/presentation-frontend/selection/SelectionManager.js +409 -409
  116. package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
  117. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts +59 -59
  118. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js +85 -85
  119. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  120. package/lib/esm/presentation-frontend.d.ts +34 -34
  121. package/lib/esm/presentation-frontend.js +38 -38
  122. package/lib/esm/presentation-frontend.js.map +1 -1
  123. package/package.json +14 -14
@@ -1,32 +1,32 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FrontendLocalizationHelper = void 0;
4
- /*---------------------------------------------------------------------------------------------
5
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
- * See LICENSE.md in the project root for license terms and full copyright notice.
7
- *--------------------------------------------------------------------------------------------*/
8
- const presentation_common_1 = require("@itwin/presentation-common");
9
- const Presentation_1 = require("./Presentation");
10
- const NAMESPACES = ["BisCore", "ECPresentation", "RulesEngine"];
11
- /** @internal */
12
- class FrontendLocalizationHelper extends presentation_common_1.LocalizationHelper {
13
- constructor(lang) {
14
- super({ getLocalizedString: (key) => Presentation_1.Presentation.localization.getLocalizedString(key, { defaultValue: key, lng: this._lang }) });
15
- this._lang = lang;
16
- }
17
- get locale() {
18
- return this._lang;
19
- }
20
- set locale(locale) {
21
- this._lang = locale;
22
- }
23
- static async registerNamespaces() {
24
- const localizationPromises = NAMESPACES.map(async (namespace) => Presentation_1.Presentation.localization.registerNamespace(namespace));
25
- await Promise.all(localizationPromises);
26
- }
27
- static unregisterNamespaces() {
28
- NAMESPACES.map((namespace) => Presentation_1.Presentation.localization.unregisterNamespace(namespace));
29
- }
30
- }
31
- exports.FrontendLocalizationHelper = FrontendLocalizationHelper;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FrontendLocalizationHelper = void 0;
4
+ /*---------------------------------------------------------------------------------------------
5
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
+ * See LICENSE.md in the project root for license terms and full copyright notice.
7
+ *--------------------------------------------------------------------------------------------*/
8
+ const presentation_common_1 = require("@itwin/presentation-common");
9
+ const Presentation_1 = require("./Presentation");
10
+ const NAMESPACES = ["BisCore", "ECPresentation", "RulesEngine"];
11
+ /** @internal */
12
+ class FrontendLocalizationHelper extends presentation_common_1.LocalizationHelper {
13
+ constructor(lang) {
14
+ super({ getLocalizedString: (key) => Presentation_1.Presentation.localization.getLocalizedString(key, { defaultValue: key, lng: this._lang }) });
15
+ this._lang = lang;
16
+ }
17
+ get locale() {
18
+ return this._lang;
19
+ }
20
+ set locale(locale) {
21
+ this._lang = locale;
22
+ }
23
+ static async registerNamespaces() {
24
+ const localizationPromises = NAMESPACES.map(async (namespace) => Presentation_1.Presentation.localization.registerNamespace(namespace));
25
+ await Promise.all(localizationPromises);
26
+ }
27
+ static unregisterNamespaces() {
28
+ NAMESPACES.map((namespace) => Presentation_1.Presentation.localization.unregisterNamespace(namespace));
29
+ }
30
+ }
31
+ exports.FrontendLocalizationHelper = FrontendLocalizationHelper;
32
32
  //# sourceMappingURL=LocalizationHelper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LocalizationHelper.js","sourceRoot":"","sources":["../../../src/presentation-frontend/LocalizationHelper.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,oEAAgE;AAChE,iDAA8C;AAE9C,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAC;AAEhE,gBAAgB;AAChB,MAAa,0BAA2B,SAAQ,wCAAkB;IAEhE,YAAY,IAAa;QACvB,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,2BAAY,CAAC,YAAY,CAAC,kBAAkB,CAAC,GAAG,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;QAClI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IACD,IAAW,MAAM,CAAC,MAA0B;QAC1C,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;IACtB,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,kBAAkB;QACpC,MAAM,oBAAoB,GAAG,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,2BAAY,CAAC,YAAY,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC;QACzH,MAAM,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAC1C,CAAC;IAEM,MAAM,CAAC,oBAAoB;QAChC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,2BAAY,CAAC,YAAY,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1F,CAAC;CACF;AAtBD,gEAsBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { LocalizationHelper } from \"@itwin/presentation-common\";\r\nimport { Presentation } from \"./Presentation\";\r\n\r\nconst NAMESPACES = [\"BisCore\", \"ECPresentation\", \"RulesEngine\"];\r\n\r\n/** @internal */\r\nexport class FrontendLocalizationHelper extends LocalizationHelper {\r\n private _lang: string | undefined;\r\n constructor(lang?: string) {\r\n super({ getLocalizedString: (key) => Presentation.localization.getLocalizedString(key, { defaultValue: key, lng: this._lang }) });\r\n this._lang = lang;\r\n }\r\n\r\n public get locale() {\r\n return this._lang;\r\n }\r\n public set locale(locale: string | undefined) {\r\n this._lang = locale;\r\n }\r\n\r\n public static async registerNamespaces() {\r\n const localizationPromises = NAMESPACES.map(async (namespace) => Presentation.localization.registerNamespace(namespace));\r\n await Promise.all(localizationPromises);\r\n }\r\n\r\n public static unregisterNamespaces() {\r\n NAMESPACES.map((namespace) => Presentation.localization.unregisterNamespace(namespace));\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"LocalizationHelper.js","sourceRoot":"","sources":["../../../src/presentation-frontend/LocalizationHelper.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,oEAAgE;AAChE,iDAA8C;AAE9C,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAC;AAEhE,gBAAgB;AAChB,MAAa,0BAA2B,SAAQ,wCAAkB;IAEhE,YAAY,IAAa;QACvB,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,2BAAY,CAAC,YAAY,CAAC,kBAAkB,CAAC,GAAG,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;QAClI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IACD,IAAW,MAAM,CAAC,MAA0B;QAC1C,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;IACtB,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,kBAAkB;QACpC,MAAM,oBAAoB,GAAG,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,2BAAY,CAAC,YAAY,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC;QACzH,MAAM,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAC1C,CAAC;IAEM,MAAM,CAAC,oBAAoB;QAChC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,2BAAY,CAAC,YAAY,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1F,CAAC;CACF;AAtBD,gEAsBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { LocalizationHelper } from \"@itwin/presentation-common\";\nimport { Presentation } from \"./Presentation\";\n\nconst NAMESPACES = [\"BisCore\", \"ECPresentation\", \"RulesEngine\"];\n\n/** @internal */\nexport class FrontendLocalizationHelper extends LocalizationHelper {\n private _lang: string | undefined;\n constructor(lang?: string) {\n super({ getLocalizedString: (key) => Presentation.localization.getLocalizedString(key, { defaultValue: key, lng: this._lang }) });\n this._lang = lang;\n }\n\n public get locale() {\n return this._lang;\n }\n public set locale(locale: string | undefined) {\n this._lang = locale;\n }\n\n public static async registerNamespaces() {\n const localizationPromises = NAMESPACES.map(async (namespace) => Presentation.localization.registerNamespace(namespace));\n await Promise.all(localizationPromises);\n }\n\n public static unregisterNamespaces() {\n NAMESPACES.map((namespace) => Presentation.localization.unregisterNamespace(namespace));\n }\n}\n"]}
@@ -1,74 +1,74 @@
1
- /** @packageDocumentation
2
- * @module Core
3
- */
4
- import { Localization } from "@itwin/core-common";
5
- import { FavoritePropertiesManager, FavoritePropertiesManagerProps } from "./favorite-properties/FavoritePropertiesManager";
6
- import { PresentationManager, PresentationManagerProps } from "./PresentationManager";
7
- import { SelectionManager, SelectionManagerProps } from "./selection/SelectionManager";
8
- /**
9
- * Props for initializing [[Presentation]].
10
- * @public
11
- */
12
- export interface PresentationProps {
13
- /** Props for [[PresentationManager]]. */
14
- presentation?: PresentationManagerProps;
15
- /** Props for [[SelectionManager]]. */
16
- selection?: SelectionManagerProps;
17
- /** Props for [[FavoritePropertiesManager]]. */
18
- favorites?: FavoritePropertiesManagerProps;
19
- }
20
- /**
21
- * Static class used to statically set up Presentation library for the frontend.
22
- * Basically what it does is:
23
- * - Create a singleton [[PresentationManager]] instance
24
- * - Create a singleton [[SelectionManager]] instance
25
- * - Create a singleton [[FavoritePropertiesManager]]] instance
26
- *
27
- * @public
28
- */
29
- export declare class Presentation {
30
- private constructor();
31
- /**
32
- * Initializes Presentation library for the frontend.
33
- *
34
- * Example:
35
- * ``` ts
36
- * [[include:Presentation.Frontend.Initialization]]
37
- * ```
38
- *
39
- * The method should be called after a call to [IModelApp.startup]($core-frontend).
40
- */
41
- static initialize(props?: PresentationProps): Promise<void>;
42
- /**
43
- * Terminates Presentation library frontend. This method should be called
44
- * before a call to [IModelApp.shutdown]($core-frontend)
45
- */
46
- static terminate(): void;
47
- /**
48
- * Registers an additional handler which will be invoked during Presentation library frontend
49
- * initialization.
50
- */
51
- static registerInitializationHandler(handler: () => Promise<() => void>): void;
52
- /** The singleton [[PresentationManager]] */
53
- static get presentation(): PresentationManager;
54
- /** @internal */
55
- static setPresentationManager(value: PresentationManager): void;
56
- /** The singleton [[SelectionManager]] */
57
- static get selection(): SelectionManager;
58
- /** @internal */
59
- static setSelectionManager(value: SelectionManager): void;
60
- /**
61
- * The singleton [[FavoritePropertiesManager]]
62
- * @public
63
- */
64
- static get favoriteProperties(): FavoritePropertiesManager;
65
- /** @internal */
66
- static setFavoritePropertiesManager(value: FavoritePropertiesManager): void;
67
- /**
68
- * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.
69
- */
70
- static get localization(): Localization;
71
- /** @internal */
72
- static setLocalization(value: Localization): void;
73
- }
1
+ /** @packageDocumentation
2
+ * @module Core
3
+ */
4
+ import { Localization } from "@itwin/core-common";
5
+ import { FavoritePropertiesManager, FavoritePropertiesManagerProps } from "./favorite-properties/FavoritePropertiesManager";
6
+ import { PresentationManager, PresentationManagerProps } from "./PresentationManager";
7
+ import { SelectionManager, SelectionManagerProps } from "./selection/SelectionManager";
8
+ /**
9
+ * Props for initializing [[Presentation]].
10
+ * @public
11
+ */
12
+ export interface PresentationProps {
13
+ /** Props for [[PresentationManager]]. */
14
+ presentation?: PresentationManagerProps;
15
+ /** Props for [[SelectionManager]]. */
16
+ selection?: SelectionManagerProps;
17
+ /** Props for [[FavoritePropertiesManager]]. */
18
+ favorites?: FavoritePropertiesManagerProps;
19
+ }
20
+ /**
21
+ * Static class used to statically set up Presentation library for the frontend.
22
+ * Basically what it does is:
23
+ * - Create a singleton [[PresentationManager]] instance
24
+ * - Create a singleton [[SelectionManager]] instance
25
+ * - Create a singleton [[FavoritePropertiesManager]]] instance
26
+ *
27
+ * @public
28
+ */
29
+ export declare class Presentation {
30
+ private constructor();
31
+ /**
32
+ * Initializes Presentation library for the frontend.
33
+ *
34
+ * Example:
35
+ * ``` ts
36
+ * [[include:Presentation.Frontend.Initialization]]
37
+ * ```
38
+ *
39
+ * The method should be called after a call to [IModelApp.startup]($core-frontend).
40
+ */
41
+ static initialize(props?: PresentationProps): Promise<void>;
42
+ /**
43
+ * Terminates Presentation library frontend. This method should be called
44
+ * before a call to [IModelApp.shutdown]($core-frontend)
45
+ */
46
+ static terminate(): void;
47
+ /**
48
+ * Registers an additional handler which will be invoked during Presentation library frontend
49
+ * initialization.
50
+ */
51
+ static registerInitializationHandler(handler: () => Promise<() => void>): void;
52
+ /** The singleton [[PresentationManager]] */
53
+ static get presentation(): PresentationManager;
54
+ /** @internal */
55
+ static setPresentationManager(value: PresentationManager): void;
56
+ /** The singleton [[SelectionManager]] */
57
+ static get selection(): SelectionManager;
58
+ /** @internal */
59
+ static setSelectionManager(value: SelectionManager): void;
60
+ /**
61
+ * The singleton [[FavoritePropertiesManager]]
62
+ * @public
63
+ */
64
+ static get favoriteProperties(): FavoritePropertiesManager;
65
+ /** @internal */
66
+ static setFavoritePropertiesManager(value: FavoritePropertiesManager): void;
67
+ /**
68
+ * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.
69
+ */
70
+ static get localization(): Localization;
71
+ /** @internal */
72
+ static setLocalization(value: Localization): void;
73
+ }
74
74
  //# sourceMappingURL=Presentation.d.ts.map
@@ -1,161 +1,161 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module Core
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.Presentation = void 0;
11
- const core_frontend_1 = require("@itwin/core-frontend");
12
- const presentation_common_1 = require("@itwin/presentation-common");
13
- const FavoritePropertiesManager_1 = require("./favorite-properties/FavoritePropertiesManager");
14
- const FavoritePropertiesStorage_1 = require("./favorite-properties/FavoritePropertiesStorage");
15
- const LocalizationHelper_1 = require("./LocalizationHelper");
16
- const PresentationManager_1 = require("./PresentationManager");
17
- const SelectionManager_1 = require("./selection/SelectionManager");
18
- const SelectionScopesManager_1 = require("./selection/SelectionScopesManager");
19
- let localization;
20
- let presentationManager;
21
- let selectionManager;
22
- let favoritePropertiesManager;
23
- const initializationHandlers = [];
24
- const terminationHandlers = [];
25
- /**
26
- * Static class used to statically set up Presentation library for the frontend.
27
- * Basically what it does is:
28
- * - Create a singleton [[PresentationManager]] instance
29
- * - Create a singleton [[SelectionManager]] instance
30
- * - Create a singleton [[FavoritePropertiesManager]]] instance
31
- *
32
- * @public
33
- */
34
- class Presentation {
35
- /* istanbul ignore next */
36
- constructor() { }
37
- /**
38
- * Initializes Presentation library for the frontend.
39
- *
40
- * Example:
41
- * ``` ts
42
- * [[include:Presentation.Frontend.Initialization]]
43
- * ```
44
- *
45
- * The method should be called after a call to [IModelApp.startup]($core-frontend).
46
- */
47
- static async initialize(props) {
48
- var _a, _b;
49
- if (!core_frontend_1.IModelApp.initialized) {
50
- throw new presentation_common_1.PresentationError(presentation_common_1.PresentationStatus.NotInitialized, "IModelApp.startup must be called before calling Presentation.initialize");
51
- }
52
- if (!localization) {
53
- localization = core_frontend_1.IModelApp.localization;
54
- }
55
- if (!presentationManager) {
56
- const managerProps = (_a = props === null || props === void 0 ? void 0 : props.presentation) !== null && _a !== void 0 ? _a : {};
57
- if (!managerProps.activeLocale) {
58
- const languages = Presentation.localization.getLanguageList();
59
- managerProps.activeLocale = (languages.length ? languages[0] : undefined);
60
- }
61
- presentationManager = PresentationManager_1.PresentationManager.create(managerProps);
62
- }
63
- if (!selectionManager) {
64
- selectionManager = new SelectionManager_1.SelectionManager((_b = props === null || props === void 0 ? void 0 : props.selection) !== null && _b !== void 0 ? _b : {
65
- scopes: new SelectionScopesManager_1.SelectionScopesManager({
66
- rpcRequestsHandler: presentationManager.rpcRequestsHandler,
67
- localeProvider: () => this.presentation.activeLocale,
68
- }),
69
- });
70
- }
71
- if (!favoritePropertiesManager) {
72
- favoritePropertiesManager = new FavoritePropertiesManager_1.FavoritePropertiesManager({
73
- storage: (props === null || props === void 0 ? void 0 : props.favorites) ? props.favorites.storage : (0, FavoritePropertiesStorage_1.createFavoritePropertiesStorage)(FavoritePropertiesStorage_1.DefaultFavoritePropertiesStorageTypes.Noop),
74
- });
75
- }
76
- // eslint-disable-next-line @typescript-eslint/unbound-method
77
- presentationManager.onNewiModelConnection = favoritePropertiesManager.initializeConnection.bind(favoritePropertiesManager);
78
- await LocalizationHelper_1.FrontendLocalizationHelper.registerNamespaces();
79
- for (const handler of initializationHandlers) {
80
- const cleanup = await handler();
81
- if (cleanup)
82
- terminationHandlers.push(cleanup);
83
- }
84
- }
85
- /**
86
- * Terminates Presentation library frontend. This method should be called
87
- * before a call to [IModelApp.shutdown]($core-frontend)
88
- */
89
- static terminate() {
90
- terminationHandlers.forEach((handler) => handler());
91
- terminationHandlers.length = 0;
92
- if (localization)
93
- LocalizationHelper_1.FrontendLocalizationHelper.unregisterNamespaces();
94
- if (presentationManager)
95
- presentationManager.dispose();
96
- presentationManager = undefined;
97
- if (favoritePropertiesManager)
98
- favoritePropertiesManager.dispose();
99
- favoritePropertiesManager = undefined;
100
- selectionManager = undefined;
101
- localization = undefined;
102
- }
103
- /**
104
- * Registers an additional handler which will be invoked during Presentation library frontend
105
- * initialization.
106
- */
107
- static registerInitializationHandler(handler) {
108
- initializationHandlers.push(handler);
109
- }
110
- /** The singleton [[PresentationManager]] */
111
- static get presentation() {
112
- if (!presentationManager)
113
- throw new Error("Presentation must be first initialized by calling Presentation.initialize");
114
- return presentationManager;
115
- }
116
- /** @internal */
117
- static setPresentationManager(value) {
118
- if (presentationManager)
119
- presentationManager.dispose();
120
- presentationManager = value;
121
- }
122
- /** The singleton [[SelectionManager]] */
123
- static get selection() {
124
- if (!selectionManager)
125
- throw new Error("Presentation must be first initialized by calling Presentation.initialize");
126
- return selectionManager;
127
- }
128
- /** @internal */
129
- static setSelectionManager(value) {
130
- selectionManager = value;
131
- }
132
- /**
133
- * The singleton [[FavoritePropertiesManager]]
134
- * @public
135
- */
136
- static get favoriteProperties() {
137
- if (!favoritePropertiesManager)
138
- throw new Error("Favorite Properties must be first initialized by calling Presentation.initialize");
139
- return favoritePropertiesManager;
140
- }
141
- /** @internal */
142
- static setFavoritePropertiesManager(value) {
143
- if (favoritePropertiesManager)
144
- favoritePropertiesManager.dispose();
145
- favoritePropertiesManager = value;
146
- }
147
- /**
148
- * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.
149
- */
150
- static get localization() {
151
- if (!localization)
152
- throw new Error("Presentation must be first initialized by calling Presentation.initialize");
153
- return localization;
154
- }
155
- /** @internal */
156
- static setLocalization(value) {
157
- localization = value;
158
- }
159
- }
160
- exports.Presentation = Presentation;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Core
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.Presentation = void 0;
11
+ const core_frontend_1 = require("@itwin/core-frontend");
12
+ const presentation_common_1 = require("@itwin/presentation-common");
13
+ const FavoritePropertiesManager_1 = require("./favorite-properties/FavoritePropertiesManager");
14
+ const FavoritePropertiesStorage_1 = require("./favorite-properties/FavoritePropertiesStorage");
15
+ const LocalizationHelper_1 = require("./LocalizationHelper");
16
+ const PresentationManager_1 = require("./PresentationManager");
17
+ const SelectionManager_1 = require("./selection/SelectionManager");
18
+ const SelectionScopesManager_1 = require("./selection/SelectionScopesManager");
19
+ let localization;
20
+ let presentationManager;
21
+ let selectionManager;
22
+ let favoritePropertiesManager;
23
+ const initializationHandlers = [];
24
+ const terminationHandlers = [];
25
+ /**
26
+ * Static class used to statically set up Presentation library for the frontend.
27
+ * Basically what it does is:
28
+ * - Create a singleton [[PresentationManager]] instance
29
+ * - Create a singleton [[SelectionManager]] instance
30
+ * - Create a singleton [[FavoritePropertiesManager]]] instance
31
+ *
32
+ * @public
33
+ */
34
+ class Presentation {
35
+ /* istanbul ignore next */
36
+ constructor() { }
37
+ /**
38
+ * Initializes Presentation library for the frontend.
39
+ *
40
+ * Example:
41
+ * ``` ts
42
+ * [[include:Presentation.Frontend.Initialization]]
43
+ * ```
44
+ *
45
+ * The method should be called after a call to [IModelApp.startup]($core-frontend).
46
+ */
47
+ static async initialize(props) {
48
+ var _a, _b;
49
+ if (!core_frontend_1.IModelApp.initialized) {
50
+ throw new presentation_common_1.PresentationError(presentation_common_1.PresentationStatus.NotInitialized, "IModelApp.startup must be called before calling Presentation.initialize");
51
+ }
52
+ if (!localization) {
53
+ localization = core_frontend_1.IModelApp.localization;
54
+ }
55
+ if (!presentationManager) {
56
+ const managerProps = (_a = props === null || props === void 0 ? void 0 : props.presentation) !== null && _a !== void 0 ? _a : {};
57
+ if (!managerProps.activeLocale) {
58
+ const languages = Presentation.localization.getLanguageList();
59
+ managerProps.activeLocale = (languages.length ? languages[0] : undefined);
60
+ }
61
+ presentationManager = PresentationManager_1.PresentationManager.create(managerProps);
62
+ }
63
+ if (!selectionManager) {
64
+ selectionManager = new SelectionManager_1.SelectionManager((_b = props === null || props === void 0 ? void 0 : props.selection) !== null && _b !== void 0 ? _b : {
65
+ scopes: new SelectionScopesManager_1.SelectionScopesManager({
66
+ rpcRequestsHandler: presentationManager.rpcRequestsHandler,
67
+ localeProvider: () => this.presentation.activeLocale,
68
+ }),
69
+ });
70
+ }
71
+ if (!favoritePropertiesManager) {
72
+ favoritePropertiesManager = new FavoritePropertiesManager_1.FavoritePropertiesManager({
73
+ storage: (props === null || props === void 0 ? void 0 : props.favorites) ? props.favorites.storage : (0, FavoritePropertiesStorage_1.createFavoritePropertiesStorage)(FavoritePropertiesStorage_1.DefaultFavoritePropertiesStorageTypes.Noop),
74
+ });
75
+ }
76
+ // eslint-disable-next-line @typescript-eslint/unbound-method
77
+ presentationManager.onNewiModelConnection = favoritePropertiesManager.initializeConnection.bind(favoritePropertiesManager);
78
+ await LocalizationHelper_1.FrontendLocalizationHelper.registerNamespaces();
79
+ for (const handler of initializationHandlers) {
80
+ const cleanup = await handler();
81
+ if (cleanup)
82
+ terminationHandlers.push(cleanup);
83
+ }
84
+ }
85
+ /**
86
+ * Terminates Presentation library frontend. This method should be called
87
+ * before a call to [IModelApp.shutdown]($core-frontend)
88
+ */
89
+ static terminate() {
90
+ terminationHandlers.forEach((handler) => handler());
91
+ terminationHandlers.length = 0;
92
+ if (localization)
93
+ LocalizationHelper_1.FrontendLocalizationHelper.unregisterNamespaces();
94
+ if (presentationManager)
95
+ presentationManager.dispose();
96
+ presentationManager = undefined;
97
+ if (favoritePropertiesManager)
98
+ favoritePropertiesManager.dispose();
99
+ favoritePropertiesManager = undefined;
100
+ selectionManager = undefined;
101
+ localization = undefined;
102
+ }
103
+ /**
104
+ * Registers an additional handler which will be invoked during Presentation library frontend
105
+ * initialization.
106
+ */
107
+ static registerInitializationHandler(handler) {
108
+ initializationHandlers.push(handler);
109
+ }
110
+ /** The singleton [[PresentationManager]] */
111
+ static get presentation() {
112
+ if (!presentationManager)
113
+ throw new Error("Presentation must be first initialized by calling Presentation.initialize");
114
+ return presentationManager;
115
+ }
116
+ /** @internal */
117
+ static setPresentationManager(value) {
118
+ if (presentationManager)
119
+ presentationManager.dispose();
120
+ presentationManager = value;
121
+ }
122
+ /** The singleton [[SelectionManager]] */
123
+ static get selection() {
124
+ if (!selectionManager)
125
+ throw new Error("Presentation must be first initialized by calling Presentation.initialize");
126
+ return selectionManager;
127
+ }
128
+ /** @internal */
129
+ static setSelectionManager(value) {
130
+ selectionManager = value;
131
+ }
132
+ /**
133
+ * The singleton [[FavoritePropertiesManager]]
134
+ * @public
135
+ */
136
+ static get favoriteProperties() {
137
+ if (!favoritePropertiesManager)
138
+ throw new Error("Favorite Properties must be first initialized by calling Presentation.initialize");
139
+ return favoritePropertiesManager;
140
+ }
141
+ /** @internal */
142
+ static setFavoritePropertiesManager(value) {
143
+ if (favoritePropertiesManager)
144
+ favoritePropertiesManager.dispose();
145
+ favoritePropertiesManager = value;
146
+ }
147
+ /**
148
+ * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.
149
+ */
150
+ static get localization() {
151
+ if (!localization)
152
+ throw new Error("Presentation must be first initialized by calling Presentation.initialize");
153
+ return localization;
154
+ }
155
+ /** @internal */
156
+ static setLocalization(value) {
157
+ localization = value;
158
+ }
159
+ }
160
+ exports.Presentation = Presentation;
161
161
  //# sourceMappingURL=Presentation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Presentation.js","sourceRoot":"","sources":["../../../src/presentation-frontend/Presentation.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wDAAiD;AAEjD,oEAAmF;AACnF,+FAA4H;AAC5H,+FAAyI;AACzI,6DAAkE;AAClE,+DAAsF;AACtF,mEAAuF;AACvF,+EAA4E;AAE5E,IAAI,YAAsC,CAAC;AAC3C,IAAI,mBAAoD,CAAC;AACzD,IAAI,gBAA8C,CAAC;AACnD,IAAI,yBAAgE,CAAC;AACrE,MAAM,sBAAsB,GAA8C,EAAE,CAAC;AAC7E,MAAM,mBAAmB,GAAsB,EAAE,CAAC;AAiBlD;;;;;;;;GAQG;AACH,MAAa,YAAY;IAEvB,0BAA0B;IAC1B,gBAAwB,CAAC;IAEzB;;;;;;;;;OASG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,KAAyB;;QACtD,IAAI,CAAC,yBAAS,CAAC,WAAW,EAAE;YAC1B,MAAM,IAAI,uCAAiB,CAAC,wCAAkB,CAAC,cAAc,EAC3D,yEAAyE,CAAC,CAAC;SAC9E;QACD,IAAI,CAAC,YAAY,EAAE;YACjB,YAAY,GAAG,yBAAS,CAAC,YAAY,CAAC;SACvC;QACD,IAAI,CAAC,mBAAmB,EAAE;YACxB,MAAM,YAAY,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,YAAY,mCAAI,EAAE,CAAC;YAC/C,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE;gBAC9B,MAAM,SAAS,GAAG,YAAY,CAAC,YAAY,CAAC,eAAe,EAAE,CAAC;gBAC9D,YAAY,CAAC,YAAY,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,C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CAAC,OAAO,EAAE,CAAC;QACtC,yBAAyB,GAAG,KAAK,CAAC;IACpC,CAAC;IAED;;OAEG;IACI,MAAM,KAAK,YAAY;QAC5B,IAAI,CAAC,YAAY;YACf,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;QAC/F,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,eAAe,CAAC,KAAmB;QAC/C,YAAY,GAAG,KAAK,CAAC;IACvB,CAAC;CACF;AA7ID,oCA6IC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { IModelApp } from \"@itwin/core-frontend\";\r\nimport { Localization } from \"@itwin/core-common\";\r\nimport { PresentationError, PresentationStatus } from \"@itwin/presentation-common\";\r\nimport { FavoritePropertiesManager, FavoritePropertiesManagerProps } from \"./favorite-properties/FavoritePropertiesManager\";\r\nimport { createFavoritePropertiesStorage, DefaultFavoritePropertiesStorageTypes } from \"./favorite-properties/FavoritePropertiesStorage\";\r\nimport { FrontendLocalizationHelper } from \"./LocalizationHelper\";\r\nimport { PresentationManager, PresentationManagerProps } from \"./PresentationManager\";\r\nimport { SelectionManager, SelectionManagerProps } from \"./selection/SelectionManager\";\r\nimport { SelectionScopesManager } from \"./selection/SelectionScopesManager\";\r\n\r\nlet localization: Localization | undefined;\r\nlet presentationManager: PresentationManager | undefined;\r\nlet selectionManager: SelectionManager | undefined;\r\nlet favoritePropertiesManager: FavoritePropertiesManager | undefined;\r\nconst initializationHandlers: Array<() => Promise<(() => void) | void>> = [];\r\nconst terminationHandlers: Array<() => void> = [];\r\n\r\n/**\r\n * Props for initializing [[Presentation]].\r\n * @public\r\n */\r\nexport interface PresentationProps {\r\n /** Props for [[PresentationManager]]. */\r\n presentation?: PresentationManagerProps;\r\n\r\n /** Props for [[SelectionManager]]. */\r\n selection?: SelectionManagerProps;\r\n\r\n /** Props for [[FavoritePropertiesManager]]. */\r\n favorites?: FavoritePropertiesManagerProps;\r\n}\r\n\r\n/**\r\n * Static class used to statically set up Presentation library for the frontend.\r\n * Basically what it does is:\r\n * - Create a singleton [[PresentationManager]] instance\r\n * - Create a singleton [[SelectionManager]] instance\r\n * - Create a singleton [[FavoritePropertiesManager]]] instance\r\n *\r\n * @public\r\n */\r\nexport class Presentation {\r\n\r\n /* istanbul ignore next */\r\n private constructor() { }\r\n\r\n /**\r\n * Initializes Presentation library for the frontend.\r\n *\r\n * Example:\r\n * ``` ts\r\n * [[include:Presentation.Frontend.Initialization]]\r\n * ```\r\n *\r\n * The method should be called after a call to [IModelApp.startup]($core-frontend).\r\n */\r\n public static async initialize(props?: PresentationProps): Promise<void> {\r\n if (!IModelApp.initialized) {\r\n throw new PresentationError(PresentationStatus.NotInitialized,\r\n \"IModelApp.startup must be called before calling Presentation.initialize\");\r\n }\r\n if (!localization) {\r\n localization = IModelApp.localization;\r\n }\r\n if (!presentationManager) {\r\n const managerProps = props?.presentation ?? {};\r\n if (!managerProps.activeLocale) {\r\n const languages = Presentation.localization.getLanguageList();\r\n managerProps.activeLocale = (languages.length ? languages[0] : undefined);\r\n }\r\n presentationManager = PresentationManager.create(managerProps);\r\n }\r\n if (!selectionManager) {\r\n selectionManager = new SelectionManager(props?.selection ?? {\r\n scopes: new SelectionScopesManager({\r\n rpcRequestsHandler: presentationManager.rpcRequestsHandler,\r\n localeProvider: () => this.presentation.activeLocale,\r\n }),\r\n });\r\n }\r\n if (!favoritePropertiesManager) {\r\n favoritePropertiesManager = new FavoritePropertiesManager({\r\n storage: props?.favorites ? props.favorites.storage : createFavoritePropertiesStorage(DefaultFavoritePropertiesStorageTypes.Noop),\r\n });\r\n }\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n presentationManager.onNewiModelConnection = favoritePropertiesManager.initializeConnection.bind(favoritePropertiesManager);\r\n await FrontendLocalizationHelper.registerNamespaces();\r\n for (const handler of initializationHandlers) {\r\n const cleanup = await handler();\r\n if (cleanup)\r\n terminationHandlers.push(cleanup);\r\n }\r\n }\r\n\r\n /**\r\n * Terminates Presentation library frontend. This method should be called\r\n * before a call to [IModelApp.shutdown]($core-frontend)\r\n */\r\n public static terminate(): void {\r\n terminationHandlers.forEach((handler) => handler());\r\n terminationHandlers.length = 0;\r\n\r\n if (localization)\r\n FrontendLocalizationHelper.unregisterNamespaces();\r\n\r\n if (presentationManager)\r\n presentationManager.dispose();\r\n presentationManager = undefined;\r\n\r\n if (favoritePropertiesManager)\r\n favoritePropertiesManager.dispose();\r\n favoritePropertiesManager = undefined;\r\n\r\n selectionManager = undefined;\r\n localization = undefined;\r\n }\r\n\r\n /**\r\n * Registers an additional handler which will be invoked during Presentation library frontend\r\n * initialization.\r\n */\r\n public static registerInitializationHandler(handler: () => Promise<() => void>): void {\r\n initializationHandlers.push(handler);\r\n }\r\n\r\n /** The singleton [[PresentationManager]] */\r\n public static get presentation(): PresentationManager {\r\n if (!presentationManager)\r\n throw new Error(\"Presentation must be first initialized by calling Presentation.initialize\");\r\n return presentationManager;\r\n }\r\n\r\n /** @internal */\r\n public static setPresentationManager(value: PresentationManager) {\r\n if (presentationManager)\r\n presentationManager.dispose();\r\n presentationManager = value;\r\n }\r\n\r\n /** The singleton [[SelectionManager]] */\r\n public static get selection(): SelectionManager {\r\n if (!selectionManager)\r\n throw new Error(\"Presentation must be first initialized by calling Presentation.initialize\");\r\n return selectionManager;\r\n }\r\n\r\n /** @internal */\r\n public static setSelectionManager(value: SelectionManager) {\r\n selectionManager = value;\r\n }\r\n\r\n /**\r\n * The singleton [[FavoritePropertiesManager]]\r\n * @public\r\n */\r\n public static get favoriteProperties(): FavoritePropertiesManager {\r\n if (!favoritePropertiesManager)\r\n throw new Error(\"Favorite Properties must be first initialized by calling Presentation.initialize\");\r\n return favoritePropertiesManager;\r\n }\r\n\r\n /** @internal */\r\n public static setFavoritePropertiesManager(value: FavoritePropertiesManager) {\r\n if (favoritePropertiesManager)\r\n favoritePropertiesManager.dispose();\r\n favoritePropertiesManager = value;\r\n }\r\n\r\n /**\r\n * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.\r\n */\r\n public static get localization(): Localization {\r\n if (!localization)\r\n throw new Error(\"Presentation must be first initialized by calling Presentation.initialize\");\r\n return localization;\r\n }\r\n\r\n /** @internal */\r\n public static setLocalization(value: Localization) {\r\n localization = value;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Presentation.js","sourceRoot":"","sources":["../../../src/presentation-frontend/Presentation.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wDAAiD;AAEjD,oEAAmF;AACnF,+FAA4H;AAC5H,+FAAyI;AACzI,6DAAkE;AAClE,+DAAsF;AACtF,mEAAuF;AACvF,+EAA4E;AAE5E,IAAI,YAAsC,CAAC;AAC3C,IAAI,mBAAoD,CAAC;AACzD,IAAI,gBAA8C,CAAC;AACnD,IAAI,yBAAgE,CAAC;AACrE,MAAM,sBAAsB,GAA8C,EAAE,CAAC;AAC7E,MAAM,mBAAmB,GAAsB,EAAE,CAAC;AAiBlD;;;;;;;;GAQG;AACH,MAAa,YAAY;IAEvB,0BAA0B;IAC1B,gBAAwB,CAAC;IAEzB;;;;;;;;;OASG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,KAAyB;;QACtD,IAAI,CAAC,yBAAS,CAAC,WAAW,EAAE;YAC1B,MAAM,IAAI,uCAAiB,CAAC,wCAAkB,CAAC,cAAc,EAC3D,yEAAyE,CAAC,CAAC;SAC9E;QACD,IAAI,CAAC,YAAY,EAAE;YACjB,YAAY,GAAG,yBAAS,CAAC,YAAY,CAAC;SACvC;QACD,IAAI,CAAC,mBAAmB,EAAE;YACxB,MAAM,YAAY,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,YAAY,mCAAI,EAAE,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AAK,kBAAkB;QAClC,IAAI,CAAC,yBAAyB;YAC5B,MAAM,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAC;QACtG,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,4BAA4B,CAAC,KAAgC;QACzE,IAAI,yBAAyB;YAC3B,yBAAyB,CAAC,OAAO,EAAE,CAAC;QACtC,yBAAyB,GAAG,KAAK,CAAC;IACpC,CAAC;IAED;;OAEG;IACI,MAAM,KAAK,YAAY;QAC5B,IAAI,CAAC,YAAY;YACf,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;QAC/F,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,eAAe,CAAC,KAAmB;QAC/C,YAAY,GAAG,KAAK,CAAC;IACvB,CAAC;CACF;AA7ID,oCA6IC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { Localization } from \"@itwin/core-common\";\nimport { PresentationError, PresentationStatus } from \"@itwin/presentation-common\";\nimport { FavoritePropertiesManager, FavoritePropertiesManagerProps } from \"./favorite-properties/FavoritePropertiesManager\";\nimport { createFavoritePropertiesStorage, DefaultFavoritePropertiesStorageTypes } from \"./favorite-properties/FavoritePropertiesStorage\";\nimport { FrontendLocalizationHelper } from \"./LocalizationHelper\";\nimport { PresentationManager, PresentationManagerProps } from \"./PresentationManager\";\nimport { SelectionManager, SelectionManagerProps } from \"./selection/SelectionManager\";\nimport { SelectionScopesManager } from \"./selection/SelectionScopesManager\";\n\nlet localization: Localization | undefined;\nlet presentationManager: PresentationManager | undefined;\nlet selectionManager: SelectionManager | undefined;\nlet favoritePropertiesManager: FavoritePropertiesManager | undefined;\nconst initializationHandlers: Array<() => Promise<(() => void) | void>> = [];\nconst terminationHandlers: Array<() => void> = [];\n\n/**\n * Props for initializing [[Presentation]].\n * @public\n */\nexport interface PresentationProps {\n /** Props for [[PresentationManager]]. */\n presentation?: PresentationManagerProps;\n\n /** Props for [[SelectionManager]]. */\n selection?: SelectionManagerProps;\n\n /** Props for [[FavoritePropertiesManager]]. */\n favorites?: FavoritePropertiesManagerProps;\n}\n\n/**\n * Static class used to statically set up Presentation library for the frontend.\n * Basically what it does is:\n * - Create a singleton [[PresentationManager]] instance\n * - Create a singleton [[SelectionManager]] instance\n * - Create a singleton [[FavoritePropertiesManager]]] instance\n *\n * @public\n */\nexport class Presentation {\n\n /* istanbul ignore next */\n private constructor() { }\n\n /**\n * Initializes Presentation library for the frontend.\n *\n * Example:\n * ``` ts\n * [[include:Presentation.Frontend.Initialization]]\n * ```\n *\n * The method should be called after a call to [IModelApp.startup]($core-frontend).\n */\n public static async initialize(props?: PresentationProps): Promise<void> {\n if (!IModelApp.initialized) {\n throw new PresentationError(PresentationStatus.NotInitialized,\n \"IModelApp.startup must be called before calling Presentation.initialize\");\n }\n if (!localization) {\n localization = IModelApp.localization;\n }\n if (!presentationManager) {\n const managerProps = props?.presentation ?? {};\n if (!managerProps.activeLocale) {\n const languages = Presentation.localization.getLanguageList();\n managerProps.activeLocale = (languages.length ? languages[0] : undefined);\n }\n presentationManager = PresentationManager.create(managerProps);\n }\n if (!selectionManager) {\n selectionManager = new SelectionManager(props?.selection ?? {\n scopes: new SelectionScopesManager({\n rpcRequestsHandler: presentationManager.rpcRequestsHandler,\n localeProvider: () => this.presentation.activeLocale,\n }),\n });\n }\n if (!favoritePropertiesManager) {\n favoritePropertiesManager = new FavoritePropertiesManager({\n storage: props?.favorites ? props.favorites.storage : createFavoritePropertiesStorage(DefaultFavoritePropertiesStorageTypes.Noop),\n });\n }\n // eslint-disable-next-line @typescript-eslint/unbound-method\n presentationManager.onNewiModelConnection = favoritePropertiesManager.initializeConnection.bind(favoritePropertiesManager);\n await FrontendLocalizationHelper.registerNamespaces();\n for (const handler of initializationHandlers) {\n const cleanup = await handler();\n if (cleanup)\n terminationHandlers.push(cleanup);\n }\n }\n\n /**\n * Terminates Presentation library frontend. This method should be called\n * before a call to [IModelApp.shutdown]($core-frontend)\n */\n public static terminate(): void {\n terminationHandlers.forEach((handler) => handler());\n terminationHandlers.length = 0;\n\n if (localization)\n FrontendLocalizationHelper.unregisterNamespaces();\n\n if (presentationManager)\n presentationManager.dispose();\n presentationManager = undefined;\n\n if (favoritePropertiesManager)\n favoritePropertiesManager.dispose();\n favoritePropertiesManager = undefined;\n\n selectionManager = undefined;\n localization = undefined;\n }\n\n /**\n * Registers an additional handler which will be invoked during Presentation library frontend\n * initialization.\n */\n public static registerInitializationHandler(handler: () => Promise<() => void>): void {\n initializationHandlers.push(handler);\n }\n\n /** The singleton [[PresentationManager]] */\n public static get presentation(): PresentationManager {\n if (!presentationManager)\n throw new Error(\"Presentation must be first initialized by calling Presentation.initialize\");\n return presentationManager;\n }\n\n /** @internal */\n public static setPresentationManager(value: PresentationManager) {\n if (presentationManager)\n presentationManager.dispose();\n presentationManager = value;\n }\n\n /** The singleton [[SelectionManager]] */\n public static get selection(): SelectionManager {\n if (!selectionManager)\n throw new Error(\"Presentation must be first initialized by calling Presentation.initialize\");\n return selectionManager;\n }\n\n /** @internal */\n public static setSelectionManager(value: SelectionManager) {\n selectionManager = value;\n }\n\n /**\n * The singleton [[FavoritePropertiesManager]]\n * @public\n */\n public static get favoriteProperties(): FavoritePropertiesManager {\n if (!favoritePropertiesManager)\n throw new Error(\"Favorite Properties must be first initialized by calling Presentation.initialize\");\n return favoritePropertiesManager;\n }\n\n /** @internal */\n public static setFavoritePropertiesManager(value: FavoritePropertiesManager) {\n if (favoritePropertiesManager)\n favoritePropertiesManager.dispose();\n favoritePropertiesManager = value;\n }\n\n /**\n * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.\n */\n public static get localization(): Localization {\n if (!localization)\n throw new Error(\"Presentation must be first initialized by calling Presentation.initialize\");\n return localization;\n }\n\n /** @internal */\n public static setLocalization(value: Localization) {\n localization = value;\n }\n}\n"]}