@itwin/presentation-frontend 4.0.0-dev.7 → 4.0.0-dev.72

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 (113) hide show
  1. package/CHANGELOG.md +45 -1
  2. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.d.ts +29 -29
  3. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js +47 -47
  4. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  5. package/lib/cjs/presentation-frontend/Diagnostics.d.ts +14 -14
  6. package/lib/cjs/presentation-frontend/Diagnostics.js +61 -61
  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/IpcRequestsHandler.d.ts +10 -10
  10. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js +41 -41
  11. package/lib/cjs/presentation-frontend/LocalizationHelper.d.ts +10 -10
  12. package/lib/cjs/presentation-frontend/LocalizationHelper.js +31 -31
  13. package/lib/cjs/presentation-frontend/LocalizationHelper.js.map +1 -1
  14. package/lib/cjs/presentation-frontend/Presentation.d.ts +73 -75
  15. package/lib/cjs/presentation-frontend/Presentation.d.ts.map +1 -1
  16. package/lib/cjs/presentation-frontend/Presentation.js +159 -162
  17. package/lib/cjs/presentation-frontend/Presentation.js.map +1 -1
  18. package/lib/cjs/presentation-frontend/PresentationManager.d.ts +205 -186
  19. package/lib/cjs/presentation-frontend/PresentationManager.d.ts.map +1 -1
  20. package/lib/cjs/presentation-frontend/PresentationManager.js +438 -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/RulesetVariablesManager.d.ts +143 -143
  25. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js +195 -195
  26. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  27. package/lib/cjs/presentation-frontend/StateTracker.d.ts +38 -38
  28. package/lib/cjs/presentation-frontend/StateTracker.js +128 -129
  29. package/lib/cjs/presentation-frontend/StateTracker.js.map +1 -1
  30. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +132 -132
  31. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
  32. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +519 -518
  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 +290 -293
  36. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  37. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts +52 -52
  38. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js +97 -97
  39. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts +19 -19
  40. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js +9 -9
  41. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts +52 -52
  42. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js +33 -33
  43. package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts +103 -103
  44. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js +108 -108
  45. package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts +17 -14
  46. package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts.map +1 -1
  47. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js +40 -37
  48. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  49. package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts +139 -139
  50. package/lib/cjs/presentation-frontend/selection/SelectionManager.js +414 -414
  51. package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
  52. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts +59 -59
  53. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js +91 -91
  54. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  55. package/lib/cjs/presentation-frontend.d.ts +34 -34
  56. package/lib/cjs/presentation-frontend.js +54 -50
  57. package/lib/cjs/presentation-frontend.js.map +1 -1
  58. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.d.ts +29 -29
  59. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js +43 -43
  60. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  61. package/lib/esm/presentation-frontend/Diagnostics.d.ts +14 -14
  62. package/lib/esm/presentation-frontend/Diagnostics.js +56 -56
  63. package/lib/esm/presentation-frontend/FrontendLoggerCategory.d.ts +12 -12
  64. package/lib/esm/presentation-frontend/FrontendLoggerCategory.js +17 -17
  65. package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts +10 -10
  66. package/lib/esm/presentation-frontend/IpcRequestsHandler.js +37 -37
  67. package/lib/esm/presentation-frontend/LocalizationHelper.d.ts +10 -10
  68. package/lib/esm/presentation-frontend/LocalizationHelper.js +27 -27
  69. package/lib/esm/presentation-frontend/LocalizationHelper.js.map +1 -1
  70. package/lib/esm/presentation-frontend/Presentation.d.ts +73 -75
  71. package/lib/esm/presentation-frontend/Presentation.d.ts.map +1 -1
  72. package/lib/esm/presentation-frontend/Presentation.js +155 -158
  73. package/lib/esm/presentation-frontend/Presentation.js.map +1 -1
  74. package/lib/esm/presentation-frontend/PresentationManager.d.ts +205 -186
  75. package/lib/esm/presentation-frontend/PresentationManager.d.ts.map +1 -1
  76. package/lib/esm/presentation-frontend/PresentationManager.js +433 -431
  77. package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
  78. package/lib/esm/presentation-frontend/RulesetManager.d.ts +63 -63
  79. package/lib/esm/presentation-frontend/RulesetManager.js +81 -81
  80. package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts +143 -143
  81. package/lib/esm/presentation-frontend/RulesetVariablesManager.js +191 -191
  82. package/lib/esm/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  83. package/lib/esm/presentation-frontend/StateTracker.d.ts +38 -38
  84. package/lib/esm/presentation-frontend/StateTracker.js +124 -125
  85. package/lib/esm/presentation-frontend/StateTracker.js.map +1 -1
  86. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +132 -132
  87. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
  88. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +514 -512
  89. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  90. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +111 -111
  91. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +282 -285
  92. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  93. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts +52 -52
  94. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js +93 -93
  95. package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts +19 -19
  96. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js +8 -8
  97. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts +52 -52
  98. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js +29 -29
  99. package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts +103 -103
  100. package/lib/esm/presentation-frontend/selection/SelectionHandler.js +104 -104
  101. package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts +17 -14
  102. package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts.map +1 -1
  103. package/lib/esm/presentation-frontend/selection/SelectionHelper.js +36 -33
  104. package/lib/esm/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  105. package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts +139 -139
  106. package/lib/esm/presentation-frontend/selection/SelectionManager.js +409 -409
  107. package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
  108. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts +59 -59
  109. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js +85 -85
  110. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  111. package/lib/esm/presentation-frontend.d.ts +34 -34
  112. package/lib/esm/presentation-frontend.js +38 -38
  113. package/package.json +20 -20
@@ -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,cAAc,CAAC,CAAC;AAEpC,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 = [\"Presentation\"];\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,76 +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
- * @internal
52
- */
53
- static registerInitializationHandler(handler: () => Promise<() => void>): void;
54
- /** The singleton [[PresentationManager]] */
55
- static get presentation(): PresentationManager;
56
- /** @internal */
57
- static setPresentationManager(value: PresentationManager): void;
58
- /** The singleton [[SelectionManager]] */
59
- static get selection(): SelectionManager;
60
- /** @internal */
61
- static setSelectionManager(value: SelectionManager): void;
62
- /**
63
- * The singleton [[FavoritePropertiesManager]]
64
- * @public
65
- */
66
- static get favoriteProperties(): FavoritePropertiesManager;
67
- /** @internal */
68
- static setFavoritePropertiesManager(value: FavoritePropertiesManager): void;
69
- /**
70
- * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.
71
- */
72
- static get localization(): Localization;
73
- /** @internal */
74
- static setLocalization(value: Localization): void;
75
- }
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
+ }
76
74
  //# sourceMappingURL=Presentation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Presentation.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/Presentation.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,yBAAyB,EAAE,8BAA8B,EAAE,MAAM,iDAAiD,CAAC;AAG5H,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAUvF;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,yCAAyC;IACzC,YAAY,CAAC,EAAE,wBAAwB,CAAC;IAExC,sCAAsC;IACtC,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAElC,+CAA+C;IAC/C,SAAS,CAAC,EAAE,8BAA8B,CAAC;CAC5C;AAED;;;;;;;;GAQG;AACH,qBAAa,YAAY;IAGvB,OAAO;IAEP;;;;;;;;;OASG;WACiB,UAAU,CAAC,KAAK,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAuCxE;;;OAGG;WACW,SAAS,IAAI,IAAI;IAmB/B;;;;;OAKG;WACW,6BAA6B,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI;IAIrF,4CAA4C;IAC5C,WAAkB,YAAY,IAAI,mBAAmB,CAIpD;IAED,gBAAgB;WACF,sBAAsB,CAAC,KAAK,EAAE,mBAAmB;IAM/D,yCAAyC;IACzC,WAAkB,SAAS,IAAI,gBAAgB,CAI9C;IAED,gBAAgB;WACF,mBAAmB,CAAC,KAAK,EAAE,gBAAgB;IAIzD;;;OAGG;IACH,WAAkB,kBAAkB,IAAI,yBAAyB,CAIhE;IAED,gBAAgB;WACF,4BAA4B,CAAC,KAAK,EAAE,yBAAyB;IAM3E;;OAEG;IACH,WAAkB,YAAY,IAAI,YAAY,CAI7C;IAED,gBAAgB;WACF,eAAe,CAAC,KAAK,EAAE,YAAY;CAGlD"}
1
+ {"version":3,"file":"Presentation.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/Presentation.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,yBAAyB,EAAE,8BAA8B,EAAE,MAAM,iDAAiD,CAAC;AAG5H,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAUvF;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,yCAAyC;IACzC,YAAY,CAAC,EAAE,wBAAwB,CAAC;IAExC,sCAAsC;IACtC,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAElC,+CAA+C;IAC/C,SAAS,CAAC,EAAE,8BAA8B,CAAC;CAC5C;AAED;;;;;;;;GAQG;AACH,qBAAa,YAAY;IAGvB,OAAO;IAEP;;;;;;;;;OASG;WACiB,UAAU,CAAC,KAAK,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAuCxE;;;OAGG;WACW,SAAS,IAAI,IAAI;IAmB/B;;;OAGG;WACW,6BAA6B,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI;IAIrF,4CAA4C;IAC5C,WAAkB,YAAY,IAAI,mBAAmB,CAIpD;IAED,gBAAgB;WACF,sBAAsB,CAAC,KAAK,EAAE,mBAAmB;IAM/D,yCAAyC;IACzC,WAAkB,SAAS,IAAI,gBAAgB,CAI9C;IAED,gBAAgB;WACF,mBAAmB,CAAC,KAAK,EAAE,gBAAgB;IAIzD;;;OAGG;IACH,WAAkB,kBAAkB,IAAI,yBAAyB,CAIhE;IAED,gBAAgB;WACF,4BAA4B,CAAC,KAAK,EAAE,yBAAyB;IAM3E;;OAEG;IACH,WAAkB,YAAY,IAAI,YAAY,CAI7C;IAED,gBAAgB;WACF,eAAe,CAAC,KAAK,EAAE,YAAY;CAGlD"}
@@ -1,163 +1,160 @@
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
- * @internal
108
- */
109
- static registerInitializationHandler(handler) {
110
- initializationHandlers.push(handler);
111
- }
112
- /** The singleton [[PresentationManager]] */
113
- static get presentation() {
114
- if (!presentationManager)
115
- throw new Error("Presentation must be first initialized by calling Presentation.initialize");
116
- return presentationManager;
117
- }
118
- /** @internal */
119
- static setPresentationManager(value) {
120
- if (presentationManager)
121
- presentationManager.dispose();
122
- presentationManager = value;
123
- }
124
- /** The singleton [[SelectionManager]] */
125
- static get selection() {
126
- if (!selectionManager)
127
- throw new Error("Presentation must be first initialized by calling Presentation.initialize");
128
- return selectionManager;
129
- }
130
- /** @internal */
131
- static setSelectionManager(value) {
132
- selectionManager = value;
133
- }
134
- /**
135
- * The singleton [[FavoritePropertiesManager]]
136
- * @public
137
- */
138
- static get favoriteProperties() {
139
- if (!favoritePropertiesManager)
140
- throw new Error("Favorite Properties must be first initialized by calling Presentation.initialize");
141
- return favoritePropertiesManager;
142
- }
143
- /** @internal */
144
- static setFavoritePropertiesManager(value) {
145
- if (favoritePropertiesManager)
146
- favoritePropertiesManager.dispose();
147
- favoritePropertiesManager = value;
148
- }
149
- /**
150
- * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.
151
- */
152
- static get localization() {
153
- if (!localization)
154
- throw new Error("Presentation must be first initialized by calling Presentation.initialize");
155
- return localization;
156
- }
157
- /** @internal */
158
- static setLocalization(value) {
159
- localization = value;
160
- }
161
- }
162
- 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
+ if (!core_frontend_1.IModelApp.initialized) {
49
+ throw new presentation_common_1.PresentationError(presentation_common_1.PresentationStatus.NotInitialized, "IModelApp.startup must be called before calling Presentation.initialize");
50
+ }
51
+ if (!localization) {
52
+ localization = core_frontend_1.IModelApp.localization;
53
+ }
54
+ if (!presentationManager) {
55
+ const managerProps = props?.presentation ?? {};
56
+ if (!managerProps.activeLocale) {
57
+ const languages = Presentation.localization.getLanguageList();
58
+ managerProps.activeLocale = (languages.length ? languages[0] : undefined);
59
+ }
60
+ presentationManager = PresentationManager_1.PresentationManager.create(managerProps);
61
+ }
62
+ if (!selectionManager) {
63
+ selectionManager = new SelectionManager_1.SelectionManager(props?.selection ?? {
64
+ scopes: new SelectionScopesManager_1.SelectionScopesManager({
65
+ rpcRequestsHandler: presentationManager.rpcRequestsHandler,
66
+ localeProvider: () => this.presentation.activeLocale,
67
+ }),
68
+ });
69
+ }
70
+ if (!favoritePropertiesManager) {
71
+ favoritePropertiesManager = new FavoritePropertiesManager_1.FavoritePropertiesManager({
72
+ storage: props?.favorites ? props.favorites.storage : (0, FavoritePropertiesStorage_1.createFavoritePropertiesStorage)(FavoritePropertiesStorage_1.DefaultFavoritePropertiesStorageTypes.Noop),
73
+ });
74
+ }
75
+ // eslint-disable-next-line @typescript-eslint/unbound-method
76
+ presentationManager.onNewiModelConnection = favoritePropertiesManager.initializeConnection.bind(favoritePropertiesManager);
77
+ await LocalizationHelper_1.FrontendLocalizationHelper.registerNamespaces();
78
+ for (const handler of initializationHandlers) {
79
+ const cleanup = await handler();
80
+ if (cleanup)
81
+ terminationHandlers.push(cleanup);
82
+ }
83
+ }
84
+ /**
85
+ * Terminates Presentation library frontend. This method should be called
86
+ * before a call to [IModelApp.shutdown]($core-frontend)
87
+ */
88
+ static terminate() {
89
+ terminationHandlers.forEach((handler) => handler());
90
+ terminationHandlers.length = 0;
91
+ if (localization)
92
+ LocalizationHelper_1.FrontendLocalizationHelper.unregisterNamespaces();
93
+ if (presentationManager)
94
+ presentationManager.dispose();
95
+ presentationManager = undefined;
96
+ if (favoritePropertiesManager)
97
+ favoritePropertiesManager.dispose();
98
+ favoritePropertiesManager = undefined;
99
+ selectionManager = undefined;
100
+ localization = undefined;
101
+ }
102
+ /**
103
+ * Registers an additional handler which will be invoked during Presentation library frontend
104
+ * initialization.
105
+ */
106
+ static registerInitializationHandler(handler) {
107
+ initializationHandlers.push(handler);
108
+ }
109
+ /** The singleton [[PresentationManager]] */
110
+ static get presentation() {
111
+ if (!presentationManager)
112
+ throw new Error("Presentation must be first initialized by calling Presentation.initialize");
113
+ return presentationManager;
114
+ }
115
+ /** @internal */
116
+ static setPresentationManager(value) {
117
+ if (presentationManager)
118
+ presentationManager.dispose();
119
+ presentationManager = value;
120
+ }
121
+ /** The singleton [[SelectionManager]] */
122
+ static get selection() {
123
+ if (!selectionManager)
124
+ throw new Error("Presentation must be first initialized by calling Presentation.initialize");
125
+ return selectionManager;
126
+ }
127
+ /** @internal */
128
+ static setSelectionManager(value) {
129
+ selectionManager = value;
130
+ }
131
+ /**
132
+ * The singleton [[FavoritePropertiesManager]]
133
+ * @public
134
+ */
135
+ static get favoriteProperties() {
136
+ if (!favoritePropertiesManager)
137
+ throw new Error("Favorite Properties must be first initialized by calling Presentation.initialize");
138
+ return favoritePropertiesManager;
139
+ }
140
+ /** @internal */
141
+ static setFavoritePropertiesManager(value) {
142
+ if (favoritePropertiesManager)
143
+ favoritePropertiesManager.dispose();
144
+ favoritePropertiesManager = value;
145
+ }
146
+ /**
147
+ * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.
148
+ */
149
+ static get localization() {
150
+ if (!localization)
151
+ throw new Error("Presentation must be first initialized by calling Presentation.initialize");
152
+ return localization;
153
+ }
154
+ /** @internal */
155
+ static setLocalization(value) {
156
+ localization = value;
157
+ }
158
+ }
159
+ exports.Presentation = Presentation;
163
160
  //# 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,C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B;YACnB,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;QAC/F,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,mBAAmB,CAAC,KAAuB;QACvD,gBAAgB,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACI,MAAM,KAAK,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;AA/ID,oCA+IC","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 * @internal\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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AmB,CAAC,OAAO,EAAE,CAAC;QAChC,mBAAmB,GAAG,KAAK,CAAC;IAC9B,CAAC;IAED,yCAAyC;IAClC,MAAM,KAAK,SAAS;QACzB,IAAI,CAAC,gBAAgB;YACnB,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;QAC/F,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,mBAAmB,CAAC,KAAuB;QACvD,gBAAgB,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACI,MAAM,KAAK,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":["/*---------------------------------------------------------------------------------------------\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"]}