@itwin/presentation-frontend 4.5.0-dev.8 → 4.6.0-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/CHANGELOG.md +55 -1
  2. package/LICENSE.md +1 -1
  3. package/README.md +1 -1
  4. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.d.ts.map +1 -1
  5. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js +10 -6
  6. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  7. package/lib/cjs/presentation-frontend/Diagnostics.d.ts.map +1 -1
  8. package/lib/cjs/presentation-frontend/Diagnostics.js +18 -13
  9. package/lib/cjs/presentation-frontend/Diagnostics.js.map +1 -1
  10. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js +3 -3
  11. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
  12. package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
  13. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js +3 -3
  14. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js.map +1 -1
  15. package/lib/cjs/presentation-frontend/LocalizationHelper.js +3 -3
  16. package/lib/cjs/presentation-frontend/LocalizationHelper.js.map +1 -1
  17. package/lib/cjs/presentation-frontend/Presentation.d.ts.map +1 -1
  18. package/lib/cjs/presentation-frontend/Presentation.js +26 -16
  19. package/lib/cjs/presentation-frontend/Presentation.js.map +1 -1
  20. package/lib/cjs/presentation-frontend/PresentationManager.d.ts +84 -21
  21. package/lib/cjs/presentation-frontend/PresentationManager.d.ts.map +1 -1
  22. package/lib/cjs/presentation-frontend/PresentationManager.js +245 -154
  23. package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
  24. package/lib/cjs/presentation-frontend/RulesetManager.d.ts.map +1 -1
  25. package/lib/cjs/presentation-frontend/RulesetManager.js +11 -7
  26. package/lib/cjs/presentation-frontend/RulesetManager.js.map +1 -1
  27. package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts.map +1 -1
  28. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js +53 -31
  29. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  30. package/lib/cjs/presentation-frontend/StreamedResponseGenerator.d.ts +30 -0
  31. package/lib/cjs/presentation-frontend/StreamedResponseGenerator.d.ts.map +1 -0
  32. package/lib/cjs/presentation-frontend/StreamedResponseGenerator.js +117 -0
  33. package/lib/cjs/presentation-frontend/StreamedResponseGenerator.js.map +1 -0
  34. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +33 -4
  35. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
  36. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +172 -67
  37. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  38. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map +1 -1
  39. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +54 -25
  40. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  41. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts.map +1 -1
  42. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js +23 -13
  43. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
  44. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js +3 -3
  45. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  46. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
  47. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js +3 -3
  48. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  49. package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
  50. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js +15 -9
  51. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js.map +1 -1
  52. package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts.map +1 -1
  53. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js +7 -5
  54. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  55. package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
  56. package/lib/cjs/presentation-frontend/selection/SelectionManager.js +31 -16
  57. package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
  58. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
  59. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js +25 -14
  60. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  61. package/lib/cjs/presentation-frontend.js +3 -3
  62. package/lib/cjs/presentation-frontend.js.map +1 -1
  63. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.d.ts.map +1 -1
  64. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js +10 -6
  65. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  66. package/lib/esm/presentation-frontend/Diagnostics.d.ts.map +1 -1
  67. package/lib/esm/presentation-frontend/Diagnostics.js +18 -13
  68. package/lib/esm/presentation-frontend/Diagnostics.js.map +1 -1
  69. package/lib/esm/presentation-frontend/FrontendLoggerCategory.js +3 -3
  70. package/lib/esm/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
  71. package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
  72. package/lib/esm/presentation-frontend/IpcRequestsHandler.js +3 -3
  73. package/lib/esm/presentation-frontend/IpcRequestsHandler.js.map +1 -1
  74. package/lib/esm/presentation-frontend/LocalizationHelper.js +3 -3
  75. package/lib/esm/presentation-frontend/LocalizationHelper.js.map +1 -1
  76. package/lib/esm/presentation-frontend/Presentation.d.ts.map +1 -1
  77. package/lib/esm/presentation-frontend/Presentation.js +26 -16
  78. package/lib/esm/presentation-frontend/Presentation.js.map +1 -1
  79. package/lib/esm/presentation-frontend/PresentationManager.d.ts +84 -21
  80. package/lib/esm/presentation-frontend/PresentationManager.d.ts.map +1 -1
  81. package/lib/esm/presentation-frontend/PresentationManager.js +244 -152
  82. package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
  83. package/lib/esm/presentation-frontend/RulesetManager.d.ts.map +1 -1
  84. package/lib/esm/presentation-frontend/RulesetManager.js +11 -7
  85. package/lib/esm/presentation-frontend/RulesetManager.js.map +1 -1
  86. package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts.map +1 -1
  87. package/lib/esm/presentation-frontend/RulesetVariablesManager.js +53 -31
  88. package/lib/esm/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  89. package/lib/esm/presentation-frontend/StreamedResponseGenerator.d.ts +30 -0
  90. package/lib/esm/presentation-frontend/StreamedResponseGenerator.d.ts.map +1 -0
  91. package/lib/esm/presentation-frontend/StreamedResponseGenerator.js +113 -0
  92. package/lib/esm/presentation-frontend/StreamedResponseGenerator.js.map +1 -0
  93. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +33 -4
  94. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
  95. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +172 -67
  96. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  97. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map +1 -1
  98. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +54 -25
  99. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  100. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts.map +1 -1
  101. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js +24 -14
  102. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
  103. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js +3 -3
  104. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  105. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
  106. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js +3 -3
  107. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  108. package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
  109. package/lib/esm/presentation-frontend/selection/SelectionHandler.js +15 -9
  110. package/lib/esm/presentation-frontend/selection/SelectionHandler.js.map +1 -1
  111. package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts.map +1 -1
  112. package/lib/esm/presentation-frontend/selection/SelectionHelper.js +7 -5
  113. package/lib/esm/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  114. package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
  115. package/lib/esm/presentation-frontend/selection/SelectionManager.js +31 -16
  116. package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
  117. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
  118. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js +25 -14
  119. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  120. package/lib/esm/presentation-frontend.js +3 -3
  121. package/lib/esm/presentation-frontend.js.map +1 -1
  122. package/package.json +19 -16
package/CHANGELOG.md CHANGED
@@ -1,6 +1,60 @@
1
1
  # Change Log - @itwin/presentation-frontend
2
2
 
3
- This log was last generated on Wed, 03 Jan 2024 19:29:41 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 25 Mar 2024 16:58:09 GMT and should not be manually modified.
4
+
5
+ ## 4.4.7
6
+ Fri, 15 Mar 2024 19:15:14 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 4.4.6
11
+ Fri, 08 Mar 2024 15:57:12 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 4.4.5
16
+ Tue, 05 Mar 2024 20:37:18 GMT
17
+
18
+ _Version update only_
19
+
20
+ ## 4.4.4
21
+ Fri, 01 Mar 2024 18:21:01 GMT
22
+
23
+ _Version update only_
24
+
25
+ ## 4.4.3
26
+ Fri, 23 Feb 2024 21:26:07 GMT
27
+
28
+ _Version update only_
29
+
30
+ ## 4.4.2
31
+ Fri, 16 Feb 2024 14:22:01 GMT
32
+
33
+ _Version update only_
34
+
35
+ ## 4.4.1
36
+ Fri, 16 Feb 2024 14:17:48 GMT
37
+
38
+ _Version update only_
39
+
40
+ ## 4.4.0
41
+ Mon, 12 Feb 2024 18:15:58 GMT
42
+
43
+ ### Updates
44
+
45
+ - Fix descriptor, node path and distinct value responses not being localized
46
+ - Added 'getHiliteSetIterator' method to `HiliteSetProvider`. It allows to handle hilite set in batches instead of waiting for whole set to be loaded.
47
+ - Add support for default formats when formatting values on the frontend (when `Presentation` is initialized with `schemaContextProvider`).
48
+
49
+ ## 4.3.5
50
+ Mon, 25 Mar 2024 16:54:37 GMT
51
+
52
+ _Version update only_
53
+
54
+ ## 4.3.4
55
+ Fri, 22 Mar 2024 13:30:31 GMT
56
+
57
+ _Version update only_
4
58
 
5
59
  ## 4.3.3
6
60
  Wed, 03 Jan 2024 19:28:38 GMT
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright © 2017-2023 Bentley Systems, Incorporated. All rights reserved.
3
+ Copyright © 2017-2024 Bentley Systems, Incorporated. All rights reserved.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
package/README.md CHANGED
@@ -4,7 +4,7 @@ Copyright © Bentley Systems, Incorporated. All rights reserved. See LICENSE.md
4
4
 
5
5
  ## Description
6
6
 
7
- The __@itwin/presentation-frontend__ package contains the frontend (specific to running in a
7
+ The **@itwin/presentation-frontend** package contains the frontend (specific to running in a
8
8
  web browser) types and classes for querying presentation data from iModels.
9
9
 
10
10
  ## Documentation
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectivityInformationProvider.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/ConnectivityInformationProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAGhE,gBAAgB;AAChB,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,MAAM,EAAE,0BAA0B,CAAC;IAC5C,QAAQ,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,0BAA0B,CAAA;KAAE,KAAK,IAAI,CAAC,CAAC;CACzG;AAED;;;;;GAKG;AACH,qBAAa,+BAAgC,YAAW,gCAAgC,EAAE,WAAW;IAEnG,OAAO,CAAC,cAAc,CAAC,CAA6B;IACpD,OAAO,CAAC,gDAAgD,CAAC,CAAa;IACtE,SAAgB,6BAA6B,iBAAsB;QAAE,QAAQ,0BAA0B,CAAA;KAAE,KAAK,IAAI,EAAI;;IAe/G,OAAO;IAKd,OAAO,CAAC,sCAAsC,CAM5C;IAEF,IAAW,MAAM,IAAI,0BAA0B,CAAsE;CACtH"}
1
+ {"version":3,"file":"ConnectivityInformationProvider.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/ConnectivityInformationProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAGhE,gBAAgB;AAChB,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,MAAM,EAAE,0BAA0B,CAAC;IAC5C,QAAQ,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,0BAA0B,CAAA;KAAE,KAAK,IAAI,CAAC,CAAC;CACzG;AAED;;;;;GAKG;AACH,qBAAa,+BAAgC,YAAW,gCAAgC,EAAE,WAAW;IACnG,OAAO,CAAC,cAAc,CAAC,CAA6B;IACpD,OAAO,CAAC,gDAAgD,CAAC,CAAa;IACtE,SAAgB,6BAA6B,iBAAsB;QAAE,QAAQ,0BAA0B,CAAA;KAAE,KAAK,IAAI,EAAI;;IAgB/G,OAAO;IAKd,OAAO,CAAC,sCAAsC,CAO5C;IAEF,IAAW,MAAM,IAAI,0BAA0B,CAE9C;CACF"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
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
- *--------------------------------------------------------------------------------------------*/
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
6
  /** @packageDocumentation
7
7
  * @module Core
8
8
  */
@@ -22,8 +22,9 @@ class ConnectivityInformationProvider {
22
22
  this.onInternetConnectivityChanged = new core_bentley_1.BeEvent();
23
23
  // eslint-disable-next-line @typescript-eslint/naming-convention
24
24
  this.onNativeAppInternetConnectivityChanged = (status) => {
25
- if (this._currentStatus === status)
25
+ if (this._currentStatus === status) {
26
26
  return;
27
+ }
27
28
  this._currentStatus = status;
28
29
  this.onInternetConnectivityChanged.raiseEvent({ status });
29
30
  };
@@ -31,8 +32,9 @@ class ConnectivityInformationProvider {
31
32
  this._unsubscribeFromInternetConnectivityChangedEvent = core_frontend_1.NativeApp.onInternetConnectivityChanged.addListener(this.onNativeAppInternetConnectivityChanged);
32
33
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
33
34
  core_frontend_1.NativeApp.checkInternetConnectivity().then((status) => {
34
- if (undefined === this._currentStatus)
35
+ if (undefined === this._currentStatus) {
35
36
  this._currentStatus = status;
37
+ }
36
38
  });
37
39
  }
38
40
  else {
@@ -42,7 +44,9 @@ class ConnectivityInformationProvider {
42
44
  dispose() {
43
45
  this._unsubscribeFromInternetConnectivityChangedEvent && this._unsubscribeFromInternetConnectivityChangedEvent();
44
46
  }
45
- get status() { return this._currentStatus ?? core_common_1.InternetConnectivityStatus.Offline; }
47
+ get status() {
48
+ return this._currentStatus ?? core_common_1.InternetConnectivityStatus.Offline;
49
+ }
46
50
  }
47
51
  exports.ConnectivityInformationProvider = ConnectivityInformationProvider;
48
52
  //# sourceMappingURL=ConnectivityInformationProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectivityInformationProvider.js","sourceRoot":"","sources":["../../../src/presentation-frontend/ConnectivityInformationProvider.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2D;AAC3D,oDAAgE;AAChE,wDAAiD;AAQjD;;;;;GAKG;AACH,MAAa,+BAA+B;IAM1C;QAFgB,kCAA6B,GAAG,IAAI,sBAAO,EAA0D,CAAC;QAmBtH,gEAAgE;QACxD,2CAAsC,GAAG,CAAC,MAAkC,EAAE,EAAE;YACtF,IAAI,IAAI,CAAC,cAAc,KAAK,MAAM;gBAChC,OAAO;YAET,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;YAC7B,IAAI,CAAC,6BAA6B,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QAC5D,CAAC,CAAC;QAvBA,IAAI,yBAAS,CAAC,OAAO,EAAE;YACrB,IAAI,CAAC,gDAAgD,GAAG,yBAAS,CAAC,6BAA6B,CAAC,WAAW,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;YACzJ,mEAAmE;YACnE,yBAAS,CAAC,yBAAyB,EAAE,CAAC,IAAI,CAAC,CAAC,MAAkC,EAAE,EAAE;gBAChF,IAAI,SAAS,KAAK,IAAI,CAAC,cAAc;oBACnC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;YACjC,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,cAAc,GAAG,wCAA0B,CAAC,MAAM,CAAC;SACzD;IACH,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,gDAAgD,IAAI,IAAI,CAAC,gDAAgD,EAAE,CAAC;IACnH,CAAC;IAWD,IAAW,MAAM,KAAiC,OAAO,IAAI,CAAC,cAAc,IAAI,wCAA0B,CAAC,OAAO,CAAC,CAAC,CAAC;CACtH;AAjCD,0EAiCC","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 { BeEvent, IDisposable } from \"@itwin/core-bentley\";\nimport { InternetConnectivityStatus } from \"@itwin/core-common\";\nimport { NativeApp } from \"@itwin/core-frontend\";\n\n/** @internal */\nexport interface IConnectivityInformationProvider {\n readonly status: InternetConnectivityStatus;\n readonly onInternetConnectivityChanged: BeEvent<(args: { status: InternetConnectivityStatus }) => void>;\n}\n\n/**\n * A helper that wraps connectivity-related APIs in NativeApp\n * to give a unified information for interested parties in presentation.\n *\n * @internal\n */\nexport class ConnectivityInformationProvider implements IConnectivityInformationProvider, IDisposable {\n\n private _currentStatus?: InternetConnectivityStatus;\n private _unsubscribeFromInternetConnectivityChangedEvent?: () => void;\n public readonly onInternetConnectivityChanged = new BeEvent<(args: { status: InternetConnectivityStatus }) => void>();\n\n public constructor() {\n if (NativeApp.isValid) {\n this._unsubscribeFromInternetConnectivityChangedEvent = NativeApp.onInternetConnectivityChanged.addListener(this.onNativeAppInternetConnectivityChanged);\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NativeApp.checkInternetConnectivity().then((status: InternetConnectivityStatus) => {\n if (undefined === this._currentStatus)\n this._currentStatus = status;\n });\n } else {\n this._currentStatus = InternetConnectivityStatus.Online;\n }\n }\n\n public dispose() {\n this._unsubscribeFromInternetConnectivityChangedEvent && this._unsubscribeFromInternetConnectivityChangedEvent();\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n private onNativeAppInternetConnectivityChanged = (status: InternetConnectivityStatus) => {\n if (this._currentStatus === status)\n return;\n\n this._currentStatus = status;\n this.onInternetConnectivityChanged.raiseEvent({ status });\n };\n\n public get status(): InternetConnectivityStatus { return this._currentStatus ?? InternetConnectivityStatus.Offline; }\n}\n"]}
1
+ {"version":3,"file":"ConnectivityInformationProvider.js","sourceRoot":"","sources":["../../../src/presentation-frontend/ConnectivityInformationProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAA2D;AAC3D,oDAAgE;AAChE,wDAAiD;AAQjD;;;;;GAKG;AACH,MAAa,+BAA+B;IAK1C;QAFgB,kCAA6B,GAAG,IAAI,sBAAO,EAA0D,CAAC;QAoBtH,gEAAgE;QACxD,2CAAsC,GAAG,CAAC,MAAkC,EAAE,EAAE;YACtF,IAAI,IAAI,CAAC,cAAc,KAAK,MAAM,EAAE;gBAClC,OAAO;aACR;YAED,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;YAC7B,IAAI,CAAC,6BAA6B,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QAC5D,CAAC,CAAC;QAzBA,IAAI,yBAAS,CAAC,OAAO,EAAE;YACrB,IAAI,CAAC,gDAAgD,GAAG,yBAAS,CAAC,6BAA6B,CAAC,WAAW,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;YACzJ,mEAAmE;YACnE,yBAAS,CAAC,yBAAyB,EAAE,CAAC,IAAI,CAAC,CAAC,MAAkC,EAAE,EAAE;gBAChF,IAAI,SAAS,KAAK,IAAI,CAAC,cAAc,EAAE;oBACrC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;iBAC9B;YACH,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,cAAc,GAAG,wCAA0B,CAAC,MAAM,CAAC;SACzD;IACH,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,gDAAgD,IAAI,IAAI,CAAC,gDAAgD,EAAE,CAAC;IACnH,CAAC;IAYD,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,cAAc,IAAI,wCAA0B,CAAC,OAAO,CAAC;IACnE,CAAC;CACF;AApCD,0EAoCC","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 { BeEvent, IDisposable } from \"@itwin/core-bentley\";\nimport { InternetConnectivityStatus } from \"@itwin/core-common\";\nimport { NativeApp } from \"@itwin/core-frontend\";\n\n/** @internal */\nexport interface IConnectivityInformationProvider {\n readonly status: InternetConnectivityStatus;\n readonly onInternetConnectivityChanged: BeEvent<(args: { status: InternetConnectivityStatus }) => void>;\n}\n\n/**\n * A helper that wraps connectivity-related APIs in NativeApp\n * to give a unified information for interested parties in presentation.\n *\n * @internal\n */\nexport class ConnectivityInformationProvider implements IConnectivityInformationProvider, IDisposable {\n private _currentStatus?: InternetConnectivityStatus;\n private _unsubscribeFromInternetConnectivityChangedEvent?: () => void;\n public readonly onInternetConnectivityChanged = new BeEvent<(args: { status: InternetConnectivityStatus }) => void>();\n\n public constructor() {\n if (NativeApp.isValid) {\n this._unsubscribeFromInternetConnectivityChangedEvent = NativeApp.onInternetConnectivityChanged.addListener(this.onNativeAppInternetConnectivityChanged);\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NativeApp.checkInternetConnectivity().then((status: InternetConnectivityStatus) => {\n if (undefined === this._currentStatus) {\n this._currentStatus = status;\n }\n });\n } else {\n this._currentStatus = InternetConnectivityStatus.Online;\n }\n }\n\n public dispose() {\n this._unsubscribeFromInternetConnectivityChangedEvent && this._unsubscribeFromInternetConnectivityChangedEvent();\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n private onNativeAppInternetConnectivityChanged = (status: InternetConnectivityStatus) => {\n if (this._currentStatus === status) {\n return;\n }\n\n this._currentStatus = status;\n this.onInternetConnectivityChanged.raiseEvent({ status });\n };\n\n public get status(): InternetConnectivityStatus {\n return this._currentStatus ?? InternetConnectivityStatus.Offline;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Diagnostics.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/Diagnostics.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACL,iBAAiB,EAAE,wBAAwB,EAC5C,MAAM,4BAA4B,CAAC;AAEpC;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,iBAAiB,QAWvE;AAED;;;GAGG;AACH,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,wBAAwB,EAAE,iBAC9D,iBAAiB,UAGvC"}
1
+ {"version":3,"file":"Diagnostics.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/Diagnostics.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EAKzB,MAAM,4BAA4B,CAAC;AAEpC;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,iBAAiB,QAcvE;AAED;;;GAGG;AACH,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,wBAAwB,EAAE,iBAC9D,iBAAiB,UAGvC"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
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
- *--------------------------------------------------------------------------------------------*/
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
6
  /** @packageDocumentation
7
7
  * @module Core
8
8
  */
@@ -16,14 +16,17 @@ const presentation_common_1 = require("@itwin/presentation-common");
16
16
  function consoleDiagnosticsHandler(diagnostics) {
17
17
  // eslint-disable-next-line no-console
18
18
  diagnostics.backendVersion && console.log(`Backend version: ${diagnostics.backendVersion}`);
19
- diagnostics.logs && handleDiagnosticLogs(diagnostics.logs, (msg, stack) => {
20
- /* note: we're duplicating the message if it's logged at both editor and dev severity levels */
21
- const str = buildLogMessageString(msg, stack);
22
- if (msg.severity.editor)
23
- getConsoleLogFunc(msg.severity.editor)(str);
24
- if (msg.severity.dev)
25
- getConsoleLogFunc(msg.severity.dev)(str);
26
- });
19
+ diagnostics.logs &&
20
+ handleDiagnosticLogs(diagnostics.logs, (msg, stack) => {
21
+ /* note: we're duplicating the message if it's logged at both editor and dev severity levels */
22
+ const str = buildLogMessageString(msg, stack);
23
+ if (msg.severity.editor) {
24
+ getConsoleLogFunc(msg.severity.editor)(str);
25
+ }
26
+ if (msg.severity.dev) {
27
+ getConsoleLogFunc(msg.severity.dev)(str);
28
+ }
29
+ });
27
30
  }
28
31
  exports.consoleDiagnosticsHandler = consoleDiagnosticsHandler;
29
32
  /**
@@ -51,8 +54,10 @@ function buildLogMessageString(msg, _stack) {
51
54
  }
52
55
  function getConsoleLogFunc(severity) {
53
56
  switch (severity) {
54
- case "error": return console.error; // eslint-disable-line no-console
55
- case "warning": return console.warn; // eslint-disable-line no-console
57
+ case "error":
58
+ return console.error; // eslint-disable-line no-console
59
+ case "warning":
60
+ return console.warn; // eslint-disable-line no-console
56
61
  case "info":
57
62
  case "debug":
58
63
  case "trace":
@@ -1 +1 @@
1
- {"version":3,"file":"Diagnostics.js","sourceRoot":"","sources":["../../../src/presentation-frontend/Diagnostics.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oEAEoC;A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G,CAAC,CAAC,CAAC;SACjE;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,qBAAqB,CAAC,GAA0B,EAAE,MAA8B;IACvF,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAmC;IAC5D,QAAQ,QAAQ,EAAE;QAChB,KAAK,OAAO,CAAC,CAAC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,iCAAiC;QACrE,KAAK,SAAS,CAAC,CAAC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,iCAAiC;QACtE,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO,CAAC;QACb,KAAK,OAAO;YACV,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,iCAAiC;KACxD;AACH,CAAC","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 {\n ClientDiagnostics, ClientDiagnosticsHandler, DiagnosticsLogEntry, DiagnosticsLoggerSeverity, DiagnosticsLogMessage, DiagnosticsScopeLogs,\n} from \"@itwin/presentation-common\";\n\n/**\n * A function which logs messages to the console.\n * @beta\n */\nexport function consoleDiagnosticsHandler(diagnostics: ClientDiagnostics) {\n // eslint-disable-next-line no-console\n diagnostics.backendVersion && console.log(`Backend version: ${diagnostics.backendVersion}`);\n diagnostics.logs && handleDiagnosticLogs(diagnostics.logs, (msg: DiagnosticsLogMessage, stack: DiagnosticsScopeLogs[]) => {\n /* note: we're duplicating the message if it's logged at both editor and dev severity levels */\n const str = buildLogMessageString(msg, stack);\n if (msg.severity.editor)\n getConsoleLogFunc(msg.severity.editor)(str);\n if (msg.severity.dev)\n getConsoleLogFunc(msg.severity.dev)(str);\n });\n}\n\n/**\n * A function which calls all diagnostics handlers passed to it.\n * @beta\n */\nexport function createCombinedDiagnosticsHandler(handlers: ClientDiagnosticsHandler[]) {\n return (diagnostics: ClientDiagnostics) => {\n handlers.forEach((handler) => handler(diagnostics));\n };\n}\n\ntype DiagnosticsLogMessageHandler = (msg: DiagnosticsLogMessage, stack: DiagnosticsScopeLogs[]) => void;\n\nfunction handleDiagnosticLogs(logs: DiagnosticsLogEntry[], messageHandler: DiagnosticsLogMessageHandler, stack: DiagnosticsScopeLogs[] = []) {\n logs.forEach((log) => {\n if (DiagnosticsLogEntry.isMessage(log)) {\n messageHandler(log, stack);\n } else if (log.logs) {\n handleDiagnosticLogs(log.logs, messageHandler, [...stack, log]);\n }\n });\n}\n\nfunction buildLogMessageString(msg: DiagnosticsLogMessage, _stack: DiagnosticsScopeLogs[]) {\n return msg.message;\n}\n\nfunction getConsoleLogFunc(severity: DiagnosticsLoggerSeverity) {\n switch (severity) {\n case \"error\": return console.error; // eslint-disable-line no-console\n case \"warning\": return console.warn; // eslint-disable-line no-console\n case \"info\":\n case \"debug\":\n case \"trace\":\n return console.log; // eslint-disable-line no-console\n }\n}\n"]}
1
+ {"version":3,"file":"Diagnostics.js","sourceRoot":"","sources":["../../../src/presentation-frontend/Diagnostics.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,oEAOoC;AAEpC;;;GAGG;AACH,SAAgB,yBAAyB,CAAC,WAA8B;IACtE,sCAAsC;IACtC,WAAW,CAAC,cAAc,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,WAAW,CAAC,cAAc,EAAE,CAAC,CAAC;IAC5F,WAAW,CAAC,IAAI;QACd,oBAAoB,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,GAA0B,EAAE,KAA6B,EAAE,EAAE;YACnG,+FAA+F;YAC/F,MAAM,GAAG,GAAG,qBAAqB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAC9C,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE;gBACvB,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CA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O,OAAO,CAAC,GAAG,CAAC,CAAC,iCAAiC;KACxD;AACH,CAAC","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 {\n ClientDiagnostics,\n ClientDiagnosticsHandler,\n DiagnosticsLogEntry,\n DiagnosticsLoggerSeverity,\n DiagnosticsLogMessage,\n DiagnosticsScopeLogs,\n} from \"@itwin/presentation-common\";\n\n/**\n * A function which logs messages to the console.\n * @beta\n */\nexport function consoleDiagnosticsHandler(diagnostics: ClientDiagnostics) {\n // eslint-disable-next-line no-console\n diagnostics.backendVersion && console.log(`Backend version: ${diagnostics.backendVersion}`);\n diagnostics.logs &&\n handleDiagnosticLogs(diagnostics.logs, (msg: DiagnosticsLogMessage, stack: DiagnosticsScopeLogs[]) => {\n /* note: we're duplicating the message if it's logged at both editor and dev severity levels */\n const str = buildLogMessageString(msg, stack);\n if (msg.severity.editor) {\n getConsoleLogFunc(msg.severity.editor)(str);\n }\n if (msg.severity.dev) {\n getConsoleLogFunc(msg.severity.dev)(str);\n }\n });\n}\n\n/**\n * A function which calls all diagnostics handlers passed to it.\n * @beta\n */\nexport function createCombinedDiagnosticsHandler(handlers: ClientDiagnosticsHandler[]) {\n return (diagnostics: ClientDiagnostics) => {\n handlers.forEach((handler) => handler(diagnostics));\n };\n}\n\ntype DiagnosticsLogMessageHandler = (msg: DiagnosticsLogMessage, stack: DiagnosticsScopeLogs[]) => void;\n\nfunction handleDiagnosticLogs(logs: DiagnosticsLogEntry[], messageHandler: DiagnosticsLogMessageHandler, stack: DiagnosticsScopeLogs[] = []) {\n logs.forEach((log) => {\n if (DiagnosticsLogEntry.isMessage(log)) {\n messageHandler(log, stack);\n } else if (log.logs) {\n handleDiagnosticLogs(log.logs, messageHandler, [...stack, log]);\n }\n });\n}\n\nfunction buildLogMessageString(msg: DiagnosticsLogMessage, _stack: DiagnosticsScopeLogs[]) {\n return msg.message;\n}\n\nfunction getConsoleLogFunc(severity: DiagnosticsLoggerSeverity) {\n switch (severity) {\n case \"error\":\n return console.error; // eslint-disable-line no-console\n case \"warning\":\n return console.warn; // eslint-disable-line no-console\n case \"info\":\n case \"debug\":\n case \"trace\":\n return console.log; // eslint-disable-line no-console\n }\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
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
- *--------------------------------------------------------------------------------------------*/
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
6
  /** @packageDocumentation
7
7
  * @module Logging
8
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"FrontendLoggerCategory.js","sourceRoot":"","sources":["../../../src/presentation-frontend/FrontendLoggerCategory.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;;;GAKG;AACH,IAAY,kCAEX;AAFD,WAAY,kCAAkC;IAC5C,uEAAiC,CAAA;AACnC,CAAC,EAFW,kCAAkC,GAAlC,0CAAkC,KAAlC,0CAAkC,QAE7C","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 Logging\n */\n\n/**\n * Logger categories used by this package\n * @note All logger categories in this package start with the `presentation-frontend` prefix.\n * @see [Logger]($bentley)\n * @public\n */\nexport enum PresentationFrontendLoggerCategory {\n Package = \"presentation-frontend\",\n}\n"]}
1
+ {"version":3,"file":"FrontendLoggerCategory.js","sourceRoot":"","sources":["../../../src/presentation-frontend/FrontendLoggerCategory.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH;;;;;GAKG;AACH,IAAY,kCAEX;AAFD,WAAY,kCAAkC;IAC5C,uEAAiC,CAAA;AACnC,CAAC,EAFW,kCAAkC,GAAlC,0CAAkC,KAAlC,0CAAkC,QAE7C","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 Logging\n */\n\n/**\n * Logger categories used by this package\n * @note All logger categories in this package start with the `presentation-frontend` prefix.\n * @see [Logger]($bentley)\n * @public\n */\nexport enum PresentationFrontendLoggerCategory {\n Package = \"presentation-frontend\",\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IpcRequestsHandler.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":"AAMA,OAAO,EACoD,eAAe,EAAuB,wBAAwB,EAAE,0BAA0B,EACpJ,MAAM,4BAA4B,CAAC;AAEpC,gBAAgB;AAChB,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,SAAS,CAAgF;IACjG,SAAgB,QAAQ,EAAE,MAAM,CAAC;gBAErB,QAAQ,EAAE,MAAM;IAIf,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,EAAE,UAAU,CAAC;IAStF,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,0BAA0B,EAAE,UAAU,CAAC;CAOvF"}
1
+ {"version":3,"file":"IpcRequestsHandler.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":"AAMA,OAAO,EAGL,eAAe,EAEf,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,4BAA4B,CAAC;AAEpC,gBAAgB;AAChB,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,SAAS,CAAgF;IACjG,SAAgB,QAAQ,EAAE,MAAM,CAAC;gBAErB,QAAQ,EAAE,MAAM;IAIf,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,EAAE,UAAU,CAAC;IAStF,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,0BAA0B,EAAE,UAAU,CAAC;CAOvF"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
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
- *--------------------------------------------------------------------------------------------*/
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
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.IpcRequestsHandler = void 0;
8
8
  const core_frontend_1 = require("@itwin/core-frontend");
@@ -1 +1 @@
1
- {"version":3,"file":"IpcRequestsHandler.js","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,wDAA8C;AAC9C,oEAEoC;AAEpC,gBAAgB;AAChB,MAAa,kBAAkB;IAI7B,YAAY,QAAgB;QAHpB,cAAS,GAAG,sBAAM,CAAC,YAAY,CAA2B,mDAA6B,CAAC,CAAC;QAI/F,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAAC,MAAmE;QACjG,MAAM,UAAU,GAAkD;YAChE,GAAG,MAAM;YACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,qCAAe,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;SAClD,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,MAAoD;QACpF,MAAM,UAAU,GAA+B;YAC7C,GAAG,MAAM;YACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;IACzD,CAAC;CACF;AAxBD,gDAwBC","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\nimport { IpcApp } from \"@itwin/core-frontend\";\nimport {\n PRESENTATION_IPC_CHANNEL_NAME, PresentationIpcInterface, RulesetVariable, RulesetVariableJSON, SetRulesetVariableParams, UnsetRulesetVariableParams,\n} from \"@itwin/presentation-common\";\n\n/** @internal */\nexport class IpcRequestsHandler {\n private _ipcProxy = IpcApp.makeIpcProxy<PresentationIpcInterface>(PRESENTATION_IPC_CHANNEL_NAME);\n public readonly clientId: string;\n\n constructor(clientId: string) {\n this.clientId = clientId;\n }\n\n public async setRulesetVariable(params: Omit<SetRulesetVariableParams<RulesetVariable>, \"clientId\">) {\n const jsonParams: SetRulesetVariableParams<RulesetVariableJSON> = {\n ...params,\n clientId: this.clientId,\n variable: RulesetVariable.toJSON(params.variable),\n };\n return this._ipcProxy.setRulesetVariable(jsonParams);\n }\n\n public async unsetRulesetVariable(params: Omit<UnsetRulesetVariableParams, \"clientId\">) {\n const jsonParams: UnsetRulesetVariableParams = {\n ...params,\n clientId: this.clientId,\n };\n return this._ipcProxy.unsetRulesetVariable(jsonParams);\n }\n}\n"]}
1
+ {"version":3,"file":"IpcRequestsHandler.js","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,wDAA8C;AAC9C,oEAOoC;AAEpC,gBAAgB;AAChB,MAAa,kBAAkB;IAI7B,YAAY,QAAgB;QAHpB,cAAS,GAAG,sBAAM,CAAC,YAAY,CAA2B,mDAA6B,CAAC,CAAC;QAI/F,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAAC,MAAmE;QACjG,MAAM,UAAU,GAAkD;YAChE,GAAG,MAAM;YACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,qCAAe,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;SAClD,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,MAAoD;QACpF,MAAM,UAAU,GAA+B;YAC7C,GAAG,MAAM;YACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;IACzD,CAAC;CACF;AAxBD,gDAwBC","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\nimport { IpcApp } from \"@itwin/core-frontend\";\nimport {\n PRESENTATION_IPC_CHANNEL_NAME,\n PresentationIpcInterface,\n RulesetVariable,\n RulesetVariableJSON,\n SetRulesetVariableParams,\n UnsetRulesetVariableParams,\n} from \"@itwin/presentation-common\";\n\n/** @internal */\nexport class IpcRequestsHandler {\n private _ipcProxy = IpcApp.makeIpcProxy<PresentationIpcInterface>(PRESENTATION_IPC_CHANNEL_NAME);\n public readonly clientId: string;\n\n constructor(clientId: string) {\n this.clientId = clientId;\n }\n\n public async setRulesetVariable(params: Omit<SetRulesetVariableParams<RulesetVariable>, \"clientId\">) {\n const jsonParams: SetRulesetVariableParams<RulesetVariableJSON> = {\n ...params,\n clientId: this.clientId,\n variable: RulesetVariable.toJSON(params.variable),\n };\n return this._ipcProxy.setRulesetVariable(jsonParams);\n }\n\n public async unsetRulesetVariable(params: Omit<UnsetRulesetVariableParams, \"clientId\">) {\n const jsonParams: UnsetRulesetVariableParams = {\n ...params,\n clientId: this.clientId,\n };\n return this._ipcProxy.unsetRulesetVariable(jsonParams);\n }\n}\n"]}
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FrontendLocalizationHelper = void 0;
4
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
- *--------------------------------------------------------------------------------------------*/
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
8
  const presentation_common_1 = require("@itwin/presentation-common");
9
9
  const Presentation_1 = require("./Presentation");
10
10
  const NAMESPACES = ["Presentation"];
@@ -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,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":["/*---------------------------------------------------------------------------------------------\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 = [\"Presentation\"];\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
+ {"version":3,"file":"LocalizationHelper.js","sourceRoot":"","sources":["../../../src/presentation-frontend/LocalizationHelper.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG,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":["/*---------------------------------------------------------------------------------------------\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 = [\"Presentation\"];\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 +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;;;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
+ {"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;IAEvB,OAAO;IAEP;;;;;;;;;OASG;WACiB,UAAU,CAAC,KAAK,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IA2CxE;;;OAGG;WACW,SAAS,IAAI,IAAI;IAsB/B;;;OAGG;WACW,6BAA6B,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI;IAIrF,4CAA4C;IAC5C,WAAkB,YAAY,IAAI,mBAAmB,CAKpD;IAED,gBAAgB;WACF,sBAAsB,CAAC,KAAK,EAAE,mBAAmB;IAO/D,yCAAyC;IACzC,WAAkB,SAAS,IAAI,gBAAgB,CAK9C;IAED,gBAAgB;WACF,mBAAmB,CAAC,KAAK,EAAE,gBAAgB;IAIzD;;;OAGG;IACH,WAAkB,kBAAkB,IAAI,yBAAyB,CAKhE;IAED,gBAAgB;WACF,4BAA4B,CAAC,KAAK,EAAE,yBAAyB;IAO3E;;OAEG;IACH,WAAkB,YAAY,IAAI,YAAY,CAK7C;IAED,gBAAgB;WACF,eAAe,CAAC,KAAK,EAAE,YAAY;CAGlD"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
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
- *--------------------------------------------------------------------------------------------*/
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
6
  /** @packageDocumentation
7
7
  * @module Core
8
8
  */
@@ -55,7 +55,7 @@ class Presentation {
55
55
  const managerProps = props?.presentation ?? {};
56
56
  if (!managerProps.activeLocale) {
57
57
  const languages = Presentation.localization.getLanguageList();
58
- managerProps.activeLocale = (languages.length ? languages[0] : undefined);
58
+ managerProps.activeLocale = languages.length ? languages[0] : undefined;
59
59
  }
60
60
  presentationManager = PresentationManager_1.PresentationManager.create(managerProps);
61
61
  }
@@ -72,13 +72,14 @@ class Presentation {
72
72
  storage: props?.favorites ? props.favorites.storage : (0, FavoritePropertiesStorage_1.createFavoritePropertiesStorage)(FavoritePropertiesStorage_1.DefaultFavoritePropertiesStorageTypes.Noop),
73
73
  });
74
74
  }
75
- // eslint-disable-next-line @typescript-eslint/unbound-method
76
- presentationManager.onNewiModelConnection = favoritePropertiesManager.initializeConnection.bind(favoritePropertiesManager);
75
+ presentationManager.startIModelInitialization = (imodel) => favoritePropertiesManager?.startConnectionInitialization(imodel);
76
+ presentationManager.ensureIModelInitialized = async (imodel) => favoritePropertiesManager?.ensureInitialized(imodel);
77
77
  await LocalizationHelper_1.FrontendLocalizationHelper.registerNamespaces();
78
78
  for (const handler of initializationHandlers) {
79
79
  const cleanup = await handler();
80
- if (cleanup)
80
+ if (cleanup) {
81
81
  terminationHandlers.push(cleanup);
82
+ }
82
83
  }
83
84
  }
84
85
  /**
@@ -88,13 +89,16 @@ class Presentation {
88
89
  static terminate() {
89
90
  terminationHandlers.forEach((handler) => handler());
90
91
  terminationHandlers.length = 0;
91
- if (localization)
92
+ if (localization) {
92
93
  LocalizationHelper_1.FrontendLocalizationHelper.unregisterNamespaces();
93
- if (presentationManager)
94
+ }
95
+ if (presentationManager) {
94
96
  presentationManager.dispose();
97
+ }
95
98
  presentationManager = undefined;
96
- if (favoritePropertiesManager)
99
+ if (favoritePropertiesManager) {
97
100
  favoritePropertiesManager.dispose();
101
+ }
98
102
  favoritePropertiesManager = undefined;
99
103
  selectionManager = undefined;
100
104
  localization = undefined;
@@ -108,20 +112,23 @@ class Presentation {
108
112
  }
109
113
  /** The singleton [[PresentationManager]] */
110
114
  static get presentation() {
111
- if (!presentationManager)
115
+ if (!presentationManager) {
112
116
  throw new Error("Presentation must be first initialized by calling Presentation.initialize");
117
+ }
113
118
  return presentationManager;
114
119
  }
115
120
  /** @internal */
116
121
  static setPresentationManager(value) {
117
- if (presentationManager)
122
+ if (presentationManager) {
118
123
  presentationManager.dispose();
124
+ }
119
125
  presentationManager = value;
120
126
  }
121
127
  /** The singleton [[SelectionManager]] */
122
128
  static get selection() {
123
- if (!selectionManager)
129
+ if (!selectionManager) {
124
130
  throw new Error("Presentation must be first initialized by calling Presentation.initialize");
131
+ }
125
132
  return selectionManager;
126
133
  }
127
134
  /** @internal */
@@ -133,22 +140,25 @@ class Presentation {
133
140
  * @public
134
141
  */
135
142
  static get favoriteProperties() {
136
- if (!favoritePropertiesManager)
143
+ if (!favoritePropertiesManager) {
137
144
  throw new Error("Favorite Properties must be first initialized by calling Presentation.initialize");
145
+ }
138
146
  return favoritePropertiesManager;
139
147
  }
140
148
  /** @internal */
141
149
  static setFavoritePropertiesManager(value) {
142
- if (favoritePropertiesManager)
150
+ if (favoritePropertiesManager) {
143
151
  favoritePropertiesManager.dispose();
152
+ }
144
153
  favoritePropertiesManager = value;
145
154
  }
146
155
  /**
147
156
  * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.
148
157
  */
149
158
  static get localization() {
150
- if (!localization)
159
+ if (!localization) {
151
160
  throw new Error("Presentation must be first initialized by calling Presentation.initialize");
161
+ }
152
162
  return localization;
153
163
  }
154
164
  /** @internal */
@@ -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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ACT,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":["/*---------------------------------------------------------------------------------------------\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"]}
1
+ {"version":3,"file":"Presentation.js","sourceRoot":"","sources":["../../../src/presentation-frontend/Presentation.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;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;IACvB,0BAA0B;IAC1B,gBAAuB,CAAC;IAExB;;;;;;;;;OASG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,KAAyB;QACtD,IAAI,CAAC,yBAAS,CAAC,WAAW,EAAE;YAC1B,MAAM,IAAI,uCAAiB,CAAC,wCAAkB,CAAC,cAAc,EAAE,yEAAyE,CAAC,CAAC;SAC3I;QACD,IAAI,CAAC,YAAY,EAAE;YACjB,YAAY,GAAG,yBAAS,CAAC,YAAY,CAAC;SACvC;QACD,IAAI,CAAC,mBAAmB,EAAE;YACxB,MAAM,YAAY,GAAG,KAAK,EAAE,YAAY,IAAI,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,SAAS,CAAC,MAAM,CAA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M,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAC;SACrG;QACD,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,4BAA4B,CAAC,KAAgC;QACzE,IAAI,yBAAyB,EAAE;YAC7B,yBAAyB,CAAC,OAAO,EAAE,CAAC;SACrC;QACD,yBAAyB,GAAG,KAAK,CAAC;IACpC,CAAC;IAED;;OAEG;IACI,MAAM,KAAK,YAAY;QAC5B,IAAI,CAAC,YAAY,EAAE;YACjB,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;SAC9F;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,eAAe,CAAC,KAAmB;QAC/C,YAAY,GAAG,KAAK,CAAC;IACvB,CAAC;CACF;AAzJD,oCAyJC","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 /* 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, \"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(\n props?.selection ?? {\n scopes: new SelectionScopesManager({\n rpcRequestsHandler: presentationManager.rpcRequestsHandler,\n localeProvider: () => this.presentation.activeLocale,\n }),\n },\n );\n }\n if (!favoritePropertiesManager) {\n favoritePropertiesManager = new FavoritePropertiesManager({\n storage: props?.favorites ? props.favorites.storage : createFavoritePropertiesStorage(DefaultFavoritePropertiesStorageTypes.Noop),\n });\n }\n\n presentationManager.startIModelInitialization = (imodel) => favoritePropertiesManager?.startConnectionInitialization(imodel);\n presentationManager.ensureIModelInitialized = async (imodel) => favoritePropertiesManager?.ensureInitialized(imodel);\n\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 /**\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\n if (presentationManager) {\n presentationManager.dispose();\n }\n presentationManager = undefined;\n\n if (favoritePropertiesManager) {\n favoritePropertiesManager.dispose();\n }\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 }\n return presentationManager;\n }\n\n /** @internal */\n public static setPresentationManager(value: PresentationManager) {\n if (presentationManager) {\n presentationManager.dispose();\n }\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 }\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 }\n return favoritePropertiesManager;\n }\n\n /** @internal */\n public static setFavoritePropertiesManager(value: FavoritePropertiesManager) {\n if (favoritePropertiesManager) {\n favoritePropertiesManager.dispose();\n }\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 }\n return localization;\n }\n\n /** @internal */\n public static setLocalization(value: Localization) {\n localization = value;\n }\n}\n"]}