@itwin/presentation-frontend 5.0.0-dev.10 → 5.0.0-dev.102

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 (159) hide show
  1. package/CHANGELOG.md +58 -1
  2. package/lib/cjs/package.json +1 -0
  3. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.d.ts +3 -3
  4. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.d.ts.map +1 -1
  5. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js +11 -9
  6. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  7. package/lib/cjs/presentation-frontend/IModelConnectionInitialization.d.ts +13 -0
  8. package/lib/cjs/presentation-frontend/IModelConnectionInitialization.d.ts.map +1 -0
  9. package/lib/cjs/presentation-frontend/IModelConnectionInitialization.js +22 -0
  10. package/lib/cjs/presentation-frontend/IModelConnectionInitialization.js.map +1 -0
  11. package/lib/cjs/presentation-frontend/InternalSymbols.d.ts +6 -0
  12. package/lib/cjs/presentation-frontend/InternalSymbols.d.ts.map +1 -0
  13. package/lib/cjs/presentation-frontend/InternalSymbols.js +17 -0
  14. package/lib/cjs/presentation-frontend/InternalSymbols.js.map +1 -0
  15. package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts +12 -3
  16. package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
  17. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js +7 -7
  18. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js.map +1 -1
  19. package/lib/cjs/presentation-frontend/LocalizationHelper.d.ts +1 -1
  20. package/lib/cjs/presentation-frontend/LocalizationHelper.d.ts.map +1 -1
  21. package/lib/cjs/presentation-frontend/LocalizationHelper.js +7 -6
  22. package/lib/cjs/presentation-frontend/LocalizationHelper.js.map +1 -1
  23. package/lib/cjs/presentation-frontend/Presentation.d.ts +15 -14
  24. package/lib/cjs/presentation-frontend/Presentation.d.ts.map +1 -1
  25. package/lib/cjs/presentation-frontend/Presentation.js +31 -45
  26. package/lib/cjs/presentation-frontend/Presentation.js.map +1 -1
  27. package/lib/cjs/presentation-frontend/PresentationManager.d.ts +12 -23
  28. package/lib/cjs/presentation-frontend/PresentationManager.d.ts.map +1 -1
  29. package/lib/cjs/presentation-frontend/PresentationManager.js +77 -74
  30. package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
  31. package/lib/cjs/presentation-frontend/RulesetManager.js +2 -4
  32. package/lib/cjs/presentation-frontend/RulesetManager.js.map +1 -1
  33. package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts +2 -4
  34. package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts.map +1 -1
  35. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js +6 -4
  36. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  37. package/lib/cjs/presentation-frontend/StreamedResponseGenerator.d.ts +1 -1
  38. package/lib/cjs/presentation-frontend/StreamedResponseGenerator.d.ts.map +1 -1
  39. package/lib/cjs/presentation-frontend/StreamedResponseGenerator.js +1 -0
  40. package/lib/cjs/presentation-frontend/StreamedResponseGenerator.js.map +1 -1
  41. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +9 -19
  42. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
  43. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +163 -153
  44. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  45. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +4 -5
  46. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map +1 -1
  47. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +27 -29
  48. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  49. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts +3 -0
  50. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts.map +1 -1
  51. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js +8 -2
  52. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
  53. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts +2 -1
  54. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts.map +1 -1
  55. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js +1 -0
  56. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  57. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts +5 -1
  58. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
  59. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js +3 -0
  60. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  61. package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts +8 -5
  62. package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
  63. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js +35 -13
  64. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js.map +1 -1
  65. package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts +2 -0
  66. package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts.map +1 -1
  67. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js +3 -1
  68. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  69. package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts +31 -13
  70. package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
  71. package/lib/cjs/presentation-frontend/selection/SelectionManager.js +216 -116
  72. package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
  73. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts +11 -9
  74. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
  75. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js +6 -11
  76. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  77. package/lib/cjs/presentation-frontend.d.ts +15 -15
  78. package/lib/cjs/presentation-frontend.d.ts.map +1 -1
  79. package/lib/cjs/presentation-frontend.js +30 -29
  80. package/lib/cjs/presentation-frontend.js.map +1 -1
  81. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.d.ts +3 -3
  82. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.d.ts.map +1 -1
  83. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js +11 -9
  84. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  85. package/lib/esm/presentation-frontend/IModelConnectionInitialization.d.ts +13 -0
  86. package/lib/esm/presentation-frontend/IModelConnectionInitialization.d.ts.map +1 -0
  87. package/lib/esm/presentation-frontend/IModelConnectionInitialization.js +17 -0
  88. package/lib/esm/presentation-frontend/IModelConnectionInitialization.js.map +1 -0
  89. package/lib/esm/presentation-frontend/InternalSymbols.d.ts +6 -0
  90. package/lib/esm/presentation-frontend/InternalSymbols.d.ts.map +1 -0
  91. package/lib/esm/presentation-frontend/InternalSymbols.js +14 -0
  92. package/lib/esm/presentation-frontend/InternalSymbols.js.map +1 -0
  93. package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts +12 -3
  94. package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
  95. package/lib/esm/presentation-frontend/IpcRequestsHandler.js +8 -8
  96. package/lib/esm/presentation-frontend/IpcRequestsHandler.js.map +1 -1
  97. package/lib/esm/presentation-frontend/LocalizationHelper.d.ts +1 -1
  98. package/lib/esm/presentation-frontend/LocalizationHelper.d.ts.map +1 -1
  99. package/lib/esm/presentation-frontend/LocalizationHelper.js +3 -2
  100. package/lib/esm/presentation-frontend/LocalizationHelper.js.map +1 -1
  101. package/lib/esm/presentation-frontend/Presentation.d.ts +15 -14
  102. package/lib/esm/presentation-frontend/Presentation.d.ts.map +1 -1
  103. package/lib/esm/presentation-frontend/Presentation.js +24 -38
  104. package/lib/esm/presentation-frontend/Presentation.js.map +1 -1
  105. package/lib/esm/presentation-frontend/PresentationManager.d.ts +12 -23
  106. package/lib/esm/presentation-frontend/PresentationManager.d.ts.map +1 -1
  107. package/lib/esm/presentation-frontend/PresentationManager.js +66 -63
  108. package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
  109. package/lib/esm/presentation-frontend/RulesetManager.js +2 -4
  110. package/lib/esm/presentation-frontend/RulesetManager.js.map +1 -1
  111. package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts +2 -4
  112. package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts.map +1 -1
  113. package/lib/esm/presentation-frontend/RulesetVariablesManager.js +6 -4
  114. package/lib/esm/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  115. package/lib/esm/presentation-frontend/StreamedResponseGenerator.d.ts +1 -1
  116. package/lib/esm/presentation-frontend/StreamedResponseGenerator.d.ts.map +1 -1
  117. package/lib/esm/presentation-frontend/StreamedResponseGenerator.js +1 -0
  118. package/lib/esm/presentation-frontend/StreamedResponseGenerator.js.map +1 -1
  119. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +9 -19
  120. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
  121. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +164 -154
  122. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  123. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +4 -5
  124. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map +1 -1
  125. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +27 -29
  126. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  127. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts +3 -0
  128. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts.map +1 -1
  129. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js +8 -2
  130. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
  131. package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts +2 -1
  132. package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts.map +1 -1
  133. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js +1 -0
  134. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  135. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts +5 -1
  136. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
  137. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js +3 -0
  138. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  139. package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts +8 -5
  140. package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
  141. package/lib/esm/presentation-frontend/selection/SelectionHandler.js +35 -13
  142. package/lib/esm/presentation-frontend/selection/SelectionHandler.js.map +1 -1
  143. package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts +2 -0
  144. package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts.map +1 -1
  145. package/lib/esm/presentation-frontend/selection/SelectionHelper.js +3 -1
  146. package/lib/esm/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  147. package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts +31 -13
  148. package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
  149. package/lib/esm/presentation-frontend/selection/SelectionManager.js +202 -102
  150. package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
  151. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts +11 -9
  152. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
  153. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js +7 -11
  154. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  155. package/lib/esm/presentation-frontend.d.ts +15 -15
  156. package/lib/esm/presentation-frontend.d.ts.map +1 -1
  157. package/lib/esm/presentation-frontend.js +12 -15
  158. package/lib/esm/presentation-frontend.js.map +1 -1
  159. package/package.json +42 -42
@@ -15,15 +15,10 @@ import { NativeApp } from "@itwin/core-frontend";
15
15
  * @internal
16
16
  */
17
17
  export class ConnectivityInformationProvider {
18
+ _currentStatus;
19
+ _unsubscribeFromInternetConnectivityChangedEvent;
20
+ onInternetConnectivityChanged = new BeEvent();
18
21
  constructor() {
19
- this.onInternetConnectivityChanged = new BeEvent();
20
- this.onNativeAppInternetConnectivityChanged = (status) => {
21
- if (this._currentStatus === status) {
22
- return;
23
- }
24
- this._currentStatus = status;
25
- this.onInternetConnectivityChanged.raiseEvent({ status });
26
- };
27
22
  if (NativeApp.isValid) {
28
23
  this._unsubscribeFromInternetConnectivityChangedEvent = NativeApp.onInternetConnectivityChanged.addListener(this.onNativeAppInternetConnectivityChanged);
29
24
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
@@ -37,9 +32,16 @@ export class ConnectivityInformationProvider {
37
32
  this._currentStatus = InternetConnectivityStatus.Online;
38
33
  }
39
34
  }
40
- dispose() {
35
+ [Symbol.dispose]() {
41
36
  this._unsubscribeFromInternetConnectivityChangedEvent && this._unsubscribeFromInternetConnectivityChangedEvent();
42
37
  }
38
+ onNativeAppInternetConnectivityChanged = (status) => {
39
+ if (this._currentStatus === status) {
40
+ return;
41
+ }
42
+ this._currentStatus = status;
43
+ this.onInternetConnectivityChanged.raiseEvent({ status });
44
+ };
43
45
  get status() {
44
46
  return this._currentStatus ?? InternetConnectivityStatus.Offline;
45
47
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectivityInformationProvider.js","sourceRoot":"","sources":["../../../src/presentation-frontend/ConnectivityInformationProvider.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAe,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAQjD;;;;;GAKG;AACH,MAAM,OAAO,+BAA+B;IAK1C;QAFgB,kCAA6B,GAAG,IAAI,OAAO,EAA0D,CAAC;QAoB9G,2CAAsC,GAAG,CAAC,MAAkC,EAAE,EAAE;YACtF,IAAI,IAAI,CAAC,cAAc,KAAK,MAAM,EAAE,CAAC;gBACnC,OAAO;YACT,CAAC;YAED,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;YAC7B,IAAI,CAAC,6BAA6B,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QAC5D,CAAC,CAAC;QAxBA,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;YACtB,IAAI,CAAC,gDAAgD,GAAG,SAAS,CAAC,6BAA6B,CAAC,WAAW,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;YACzJ,mEAAmE;YACnE,SAAS,CAAC,yBAAyB,EAAE,CAAC,IAAI,CAAC,CAAC,MAAkC,EAAE,EAAE;gBAChF,IAAI,SAAS,KAAK,IAAI,CAAC,cAAc,EAAE,CAAC;oBACtC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;gBAC/B,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,cAAc,GAAG,0BAA0B,CAAC,MAAM,CAAC;QAC1D,CAAC;IACH,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,gDAAgD,IAAI,IAAI,CAAC,gDAAgD,EAAE,CAAC;IACnH,CAAC;IAWD,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,cAAc,IAAI,0BAA0B,CAAC,OAAO,CAAC;IACnE,CAAC;CACF","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 { BeEvent, IDisposable } from \"@itwin/core-bentley\";\r\nimport { InternetConnectivityStatus } from \"@itwin/core-common\";\r\nimport { NativeApp } from \"@itwin/core-frontend\";\r\n\r\n/** @internal */\r\nexport interface IConnectivityInformationProvider {\r\n readonly status: InternetConnectivityStatus;\r\n readonly onInternetConnectivityChanged: BeEvent<(args: { status: InternetConnectivityStatus }) => void>;\r\n}\r\n\r\n/**\r\n * A helper that wraps connectivity-related APIs in NativeApp\r\n * to give a unified information for interested parties in presentation.\r\n *\r\n * @internal\r\n */\r\nexport class ConnectivityInformationProvider implements IConnectivityInformationProvider, IDisposable {\r\n private _currentStatus?: InternetConnectivityStatus;\r\n private _unsubscribeFromInternetConnectivityChangedEvent?: () => void;\r\n public readonly onInternetConnectivityChanged = new BeEvent<(args: { status: InternetConnectivityStatus }) => void>();\r\n\r\n public constructor() {\r\n if (NativeApp.isValid) {\r\n this._unsubscribeFromInternetConnectivityChangedEvent = NativeApp.onInternetConnectivityChanged.addListener(this.onNativeAppInternetConnectivityChanged);\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n NativeApp.checkInternetConnectivity().then((status: InternetConnectivityStatus) => {\r\n if (undefined === this._currentStatus) {\r\n this._currentStatus = status;\r\n }\r\n });\r\n } else {\r\n this._currentStatus = InternetConnectivityStatus.Online;\r\n }\r\n }\r\n\r\n public dispose() {\r\n this._unsubscribeFromInternetConnectivityChangedEvent && this._unsubscribeFromInternetConnectivityChangedEvent();\r\n }\r\n\r\n private onNativeAppInternetConnectivityChanged = (status: InternetConnectivityStatus) => {\r\n if (this._currentStatus === status) {\r\n return;\r\n }\r\n\r\n this._currentStatus = status;\r\n this.onInternetConnectivityChanged.raiseEvent({ status });\r\n };\r\n\r\n public get status(): InternetConnectivityStatus {\r\n return this._currentStatus ?? InternetConnectivityStatus.Offline;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ConnectivityInformationProvider.js","sourceRoot":"","sources":["../../../src/presentation-frontend/ConnectivityInformationProvider.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAQjD;;;;;GAKG;AACH,MAAM,OAAO,+BAA+B;IAClC,cAAc,CAA8B;IAC5C,gDAAgD,CAAc;IACtD,6BAA6B,GAAG,IAAI,OAAO,EAA0D,CAAC;IAEtH;QACE,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;YACtB,IAAI,CAAC,gDAAgD,GAAG,SAAS,CAAC,6BAA6B,CAAC,WAAW,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;YACzJ,mEAAmE;YACnE,SAAS,CAAC,yBAAyB,EAAE,CAAC,IAAI,CAAC,CAAC,MAAkC,EAAE,EAAE;gBAChF,IAAI,SAAS,KAAK,IAAI,CAAC,cAAc,EAAE,CAAC;oBACtC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;gBAC/B,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,cAAc,GAAG,0BAA0B,CAAC,MAAM,CAAC;QAC1D,CAAC;IACH,CAAC;IAEM,CAAC,MAAM,CAAC,OAAO,CAAC;QACrB,IAAI,CAAC,gDAAgD,IAAI,IAAI,CAAC,gDAAgD,EAAE,CAAC;IACnH,CAAC;IAEO,sCAAsC,GAAG,CAAC,MAAkC,EAAE,EAAE;QACtF,IAAI,IAAI,CAAC,cAAc,KAAK,MAAM,EAAE,CAAC;YACnC,OAAO;QACT,CAAC;QAED,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;QAC7B,IAAI,CAAC,6BAA6B,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5D,CAAC,CAAC;IAEF,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,cAAc,IAAI,0BAA0B,CAAC,OAAO,CAAC;IACnE,CAAC;CACF","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 { BeEvent } from \"@itwin/core-bentley\";\r\nimport { InternetConnectivityStatus } from \"@itwin/core-common\";\r\nimport { NativeApp } from \"@itwin/core-frontend\";\r\n\r\n/** @internal */\r\nexport interface IConnectivityInformationProvider {\r\n readonly status: InternetConnectivityStatus;\r\n readonly onInternetConnectivityChanged: BeEvent<(args: { status: InternetConnectivityStatus }) => void>;\r\n}\r\n\r\n/**\r\n * A helper that wraps connectivity-related APIs in NativeApp\r\n * to give a unified information for interested parties in presentation.\r\n *\r\n * @internal\r\n */\r\nexport class ConnectivityInformationProvider implements IConnectivityInformationProvider, Disposable {\r\n private _currentStatus?: InternetConnectivityStatus;\r\n private _unsubscribeFromInternetConnectivityChangedEvent?: () => void;\r\n public readonly onInternetConnectivityChanged = new BeEvent<(args: { status: InternetConnectivityStatus }) => void>();\r\n\r\n public constructor() {\r\n if (NativeApp.isValid) {\r\n this._unsubscribeFromInternetConnectivityChangedEvent = NativeApp.onInternetConnectivityChanged.addListener(this.onNativeAppInternetConnectivityChanged);\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n NativeApp.checkInternetConnectivity().then((status: InternetConnectivityStatus) => {\r\n if (undefined === this._currentStatus) {\r\n this._currentStatus = status;\r\n }\r\n });\r\n } else {\r\n this._currentStatus = InternetConnectivityStatus.Online;\r\n }\r\n }\r\n\r\n public [Symbol.dispose]() {\r\n this._unsubscribeFromInternetConnectivityChangedEvent && this._unsubscribeFromInternetConnectivityChangedEvent();\r\n }\r\n\r\n private onNativeAppInternetConnectivityChanged = (status: InternetConnectivityStatus) => {\r\n if (this._currentStatus === status) {\r\n return;\r\n }\r\n\r\n this._currentStatus = status;\r\n this.onInternetConnectivityChanged.raiseEvent({ status });\r\n };\r\n\r\n public get status(): InternetConnectivityStatus {\r\n return this._currentStatus ?? InternetConnectivityStatus.Offline;\r\n }\r\n}\r\n"]}
@@ -0,0 +1,13 @@
1
+ import { IModelConnection } from "@itwin/core-frontend";
2
+ /** @internal */
3
+ export interface IModelConnectionInitializationHandler {
4
+ startInitialization: (imodel: IModelConnection) => void;
5
+ ensureInitialized: (imodel: IModelConnection) => Promise<void>;
6
+ }
7
+ /** @internal */
8
+ export declare const imodelInitializationHandlers: Set<IModelConnectionInitializationHandler>;
9
+ /** @internal */
10
+ export declare function startIModelInitialization(imodel: IModelConnection): void;
11
+ /** @internal */
12
+ export declare function ensureIModelInitialized(imodel: IModelConnection): Promise<void>;
13
+ //# sourceMappingURL=IModelConnectionInitialization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IModelConnectionInitialization.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/IModelConnectionInitialization.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,gBAAgB;AAChB,MAAM,WAAW,qCAAqC;IACpD,mBAAmB,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACxD,iBAAiB,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAChE;AAED,gBAAgB;AAChB,eAAO,MAAM,4BAA4B,4CAAmD,CAAC;AAE7F,gBAAgB;AAChB,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,gBAAgB,QAIjE;AAED,gBAAgB;AAChB,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,gBAAgB,iBAErE"}
@@ -0,0 +1,17 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @internal */
6
+ export const imodelInitializationHandlers = new Set();
7
+ /** @internal */
8
+ export function startIModelInitialization(imodel) {
9
+ for (const { startInitialization } of imodelInitializationHandlers) {
10
+ startInitialization(imodel);
11
+ }
12
+ }
13
+ /** @internal */
14
+ export async function ensureIModelInitialized(imodel) {
15
+ await Promise.all([...imodelInitializationHandlers].map(async ({ ensureInitialized }) => ensureInitialized(imodel)));
16
+ }
17
+ //# sourceMappingURL=IModelConnectionInitialization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IModelConnectionInitialization.js","sourceRoot":"","sources":["../../../src/presentation-frontend/IModelConnectionInitialization.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAUhG,gBAAgB;AAChB,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,GAAG,EAAyC,CAAC;AAE7F,gBAAgB;AAChB,MAAM,UAAU,yBAAyB,CAAC,MAAwB;IAChE,KAAK,MAAM,EAAE,mBAAmB,EAAE,IAAI,4BAA4B,EAAE,CAAC;QACnE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,MAAwB;IACpE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,4BAA4B,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,iBAAiB,EAAE,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACvH,CAAC","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\r\nimport { IModelConnection } from \"@itwin/core-frontend\";\r\n\r\n/** @internal */\r\nexport interface IModelConnectionInitializationHandler {\r\n startInitialization: (imodel: IModelConnection) => void;\r\n ensureInitialized: (imodel: IModelConnection) => Promise<void>;\r\n}\r\n\r\n/** @internal */\r\nexport const imodelInitializationHandlers = new Set<IModelConnectionInitializationHandler>();\r\n\r\n/** @internal */\r\nexport function startIModelInitialization(imodel: IModelConnection) {\r\n for (const { startInitialization } of imodelInitializationHandlers) {\r\n startInitialization(imodel);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport async function ensureIModelInitialized(imodel: IModelConnection) {\r\n await Promise.all([...imodelInitializationHandlers].map(async ({ ensureInitialized }) => ensureInitialized(imodel)));\r\n}\r\n"]}
@@ -0,0 +1,6 @@
1
+ /** @packageDocumentation
2
+ * @module Core
3
+ */
4
+ export declare const _presentation_manager_rpcRequestsHandler: unique symbol;
5
+ export declare const _presentation_manager_ipcRequestsHandler: unique symbol;
6
+ //# sourceMappingURL=InternalSymbols.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InternalSymbols.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/InternalSymbols.ts"],"names":[],"mappings":"AAKA;;GAEG;AAMH,eAAO,MAAM,wCAAwC,eAA6D,CAAC;AACnH,eAAO,MAAM,wCAAwC,eAA6D,CAAC"}
@@ -0,0 +1,14 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /* eslint-disable @typescript-eslint/naming-convention */
6
+ /** @packageDocumentation
7
+ * @module Core
8
+ */
9
+ function sym(name) {
10
+ return `${name}_presentation-frontend_INTERNAL_ONLY_DO_NOT_USE`;
11
+ }
12
+ export const _presentation_manager_rpcRequestsHandler = Symbol.for(sym("presentation_manager_rpcRequestsHandler"));
13
+ export const _presentation_manager_ipcRequestsHandler = Symbol.for(sym("presentation_manager_ipcRequestsHandler"));
14
+ //# sourceMappingURL=InternalSymbols.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InternalSymbols.js","sourceRoot":"","sources":["../../../src/presentation-frontend/InternalSymbols.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,yDAAyD;AACzD;;GAEG;AAEH,SAAS,GAAG,CAAC,IAAY;IACvB,OAAO,GAAG,IAAI,iDAAiD,CAAC;AAClE,CAAC;AAED,MAAM,CAAC,MAAM,wCAAwC,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC,CAAC;AACnH,MAAM,CAAC,MAAM,wCAAwC,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC,CAAC","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/* eslint-disable @typescript-eslint/naming-convention */\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nfunction sym(name: string): string {\r\n return `${name}_presentation-frontend_INTERNAL_ONLY_DO_NOT_USE`;\r\n}\r\n\r\nexport const _presentation_manager_rpcRequestsHandler = Symbol.for(sym(\"presentation_manager_rpcRequestsHandler\"));\r\nexport const _presentation_manager_ipcRequestsHandler = Symbol.for(sym(\"presentation_manager_ipcRequestsHandler\"));\r\n"]}
@@ -1,10 +1,19 @@
1
- import { RulesetVariable, SetRulesetVariableParams, UnsetRulesetVariableParams } from "@itwin/presentation-common";
1
+ import { RulesetVariable } from "@itwin/presentation-common";
2
+ interface SetRulesetVariableParams {
3
+ rulesetId: string;
4
+ variable: RulesetVariable;
5
+ }
6
+ interface UnsetRulesetVariableParams {
7
+ rulesetId: string;
8
+ variableId: string;
9
+ }
2
10
  /** @internal */
3
11
  export declare class IpcRequestsHandler {
4
12
  private _ipcProxy;
5
13
  readonly clientId: string;
6
14
  constructor(clientId: string);
7
- setRulesetVariable(params: Omit<SetRulesetVariableParams<RulesetVariable>, "clientId">): Promise<void>;
8
- unsetRulesetVariable(params: Omit<UnsetRulesetVariableParams, "clientId">): Promise<void>;
15
+ setRulesetVariable(params: SetRulesetVariableParams): Promise<void>;
16
+ unsetRulesetVariable(params: UnsetRulesetVariableParams): Promise<void>;
9
17
  }
18
+ export {};
10
19
  //# sourceMappingURL=IpcRequestsHandler.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"IpcRequestsHandler.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAG7D,UAAU,wBAAwB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED,UAAU,0BAA0B;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,gBAAgB;AAChB,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,SAAS,CAAgF;IACjG,SAAgB,QAAQ,EAAE,MAAM,CAAC;gBAErB,QAAQ,EAAE,MAAM;IAIf,kBAAkB,CAAC,MAAM,EAAE,wBAAwB;IAQnD,oBAAoB,CAAC,MAAM,EAAE,0BAA0B;CAMrE"}
@@ -3,27 +3,27 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import { IpcApp } from "@itwin/core-frontend";
6
- import { PRESENTATION_IPC_CHANNEL_NAME, RulesetVariable, } from "@itwin/presentation-common";
6
+ import { RulesetVariable } from "@itwin/presentation-common";
7
+ import { PRESENTATION_IPC_CHANNEL_NAME } from "@itwin/presentation-common/internal";
7
8
  /** @internal */
8
9
  export class IpcRequestsHandler {
10
+ _ipcProxy = IpcApp.makeIpcProxy(PRESENTATION_IPC_CHANNEL_NAME);
11
+ clientId;
9
12
  constructor(clientId) {
10
- this._ipcProxy = IpcApp.makeIpcProxy(PRESENTATION_IPC_CHANNEL_NAME);
11
13
  this.clientId = clientId;
12
14
  }
13
15
  async setRulesetVariable(params) {
14
- const jsonParams = {
16
+ return this._ipcProxy.setRulesetVariable({
15
17
  ...params,
16
18
  clientId: this.clientId,
17
19
  variable: RulesetVariable.toJSON(params.variable),
18
- };
19
- return this._ipcProxy.setRulesetVariable(jsonParams);
20
+ });
20
21
  }
21
22
  async unsetRulesetVariable(params) {
22
- const jsonParams = {
23
+ return this._ipcProxy.unsetRulesetVariable({
23
24
  ...params,
24
25
  clientId: this.clientId,
25
- };
26
- return this._ipcProxy.unsetRulesetVariable(jsonParams);
26
+ });
27
27
  }
28
28
  }
29
29
  //# sourceMappingURL=IpcRequestsHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IpcRequestsHandler.js","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EACL,6BAA6B,EAE7B,eAAe,GAIhB,MAAM,4BAA4B,CAAC;AAEpC,gBAAgB;AAChB,MAAM,OAAO,kBAAkB;IAI7B,YAAY,QAAgB;QAHpB,cAAS,GAAG,MAAM,CAAC,YAAY,CAA2B,6BAA6B,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,eAAe,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","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\r\nimport { IpcApp } from \"@itwin/core-frontend\";\r\nimport {\r\n PRESENTATION_IPC_CHANNEL_NAME,\r\n PresentationIpcInterface,\r\n RulesetVariable,\r\n RulesetVariableJSON,\r\n SetRulesetVariableParams,\r\n UnsetRulesetVariableParams,\r\n} from \"@itwin/presentation-common\";\r\n\r\n/** @internal */\r\nexport class IpcRequestsHandler {\r\n private _ipcProxy = IpcApp.makeIpcProxy<PresentationIpcInterface>(PRESENTATION_IPC_CHANNEL_NAME);\r\n public readonly clientId: string;\r\n\r\n constructor(clientId: string) {\r\n this.clientId = clientId;\r\n }\r\n\r\n public async setRulesetVariable(params: Omit<SetRulesetVariableParams<RulesetVariable>, \"clientId\">) {\r\n const jsonParams: SetRulesetVariableParams<RulesetVariableJSON> = {\r\n ...params,\r\n clientId: this.clientId,\r\n variable: RulesetVariable.toJSON(params.variable),\r\n };\r\n return this._ipcProxy.setRulesetVariable(jsonParams);\r\n }\r\n\r\n public async unsetRulesetVariable(params: Omit<UnsetRulesetVariableParams, \"clientId\">) {\r\n const jsonParams: UnsetRulesetVariableParams = {\r\n ...params,\r\n clientId: this.clientId,\r\n };\r\n return this._ipcProxy.unsetRulesetVariable(jsonParams);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"IpcRequestsHandler.js","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,6BAA6B,EAA4B,MAAM,qCAAqC,CAAC;AAY9G,gBAAgB;AAChB,MAAM,OAAO,kBAAkB;IACrB,SAAS,GAAG,MAAM,CAAC,YAAY,CAA2B,6BAA6B,CAAC,CAAC;IACjF,QAAQ,CAAS;IAEjC,YAAY,QAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAAC,MAAgC;QAC9D,OAAO,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC;YACvC,GAAG,MAAM;YACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;SAClD,CAAC,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,MAAkC;QAClE,OAAO,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC;YACzC,GAAG,MAAM;YACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;IACL,CAAC;CACF","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\r\nimport { IpcApp } from \"@itwin/core-frontend\";\r\nimport { RulesetVariable } from \"@itwin/presentation-common\";\r\nimport { PRESENTATION_IPC_CHANNEL_NAME, PresentationIpcInterface } from \"@itwin/presentation-common/internal\";\r\n\r\ninterface SetRulesetVariableParams {\r\n rulesetId: string;\r\n variable: RulesetVariable;\r\n}\r\n\r\ninterface UnsetRulesetVariableParams {\r\n rulesetId: string;\r\n variableId: string;\r\n}\r\n\r\n/** @internal */\r\nexport class IpcRequestsHandler {\r\n private _ipcProxy = IpcApp.makeIpcProxy<PresentationIpcInterface>(PRESENTATION_IPC_CHANNEL_NAME);\r\n public readonly clientId: string;\r\n\r\n constructor(clientId: string) {\r\n this.clientId = clientId;\r\n }\r\n\r\n public async setRulesetVariable(params: SetRulesetVariableParams) {\r\n return this._ipcProxy.setRulesetVariable({\r\n ...params,\r\n clientId: this.clientId,\r\n variable: RulesetVariable.toJSON(params.variable),\r\n });\r\n }\r\n\r\n public async unsetRulesetVariable(params: UnsetRulesetVariableParams) {\r\n return this._ipcProxy.unsetRulesetVariable({\r\n ...params,\r\n clientId: this.clientId,\r\n });\r\n }\r\n}\r\n"]}
@@ -1,4 +1,4 @@
1
- import { LocalizationHelper } from "@itwin/presentation-common";
1
+ import { LocalizationHelper } from "@itwin/presentation-common/internal";
2
2
  /** @internal */
3
3
  export declare class FrontendLocalizationHelper extends LocalizationHelper {
4
4
  private _lang;
@@ -1 +1 @@
1
- {"version":3,"file":"LocalizationHelper.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/LocalizationHelper.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAKhE,gBAAgB;AAChB,qBAAa,0BAA2B,SAAQ,kBAAkB;IAChE,OAAO,CAAC,KAAK,CAAqB;gBACtB,IAAI,CAAC,EAAE,MAAM;IAKzB,IAAW,MAAM,IAGS,MAAM,GAAG,SAAS,CAD3C;IACD,IAAW,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAE3C;WAEmB,kBAAkB;WAKxB,oBAAoB;CAGnC"}
1
+ {"version":3,"file":"LocalizationHelper.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/LocalizationHelper.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAKzE,gBAAgB;AAChB,qBAAa,0BAA2B,SAAQ,kBAAkB;IAChE,OAAO,CAAC,KAAK,CAAqB;gBACtB,IAAI,CAAC,EAAE,MAAM;IAKzB,IAAW,MAAM,IAGS,MAAM,GAAG,SAAS,CAD3C;IACD,IAAW,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAE3C;WAEmB,kBAAkB;WAKxB,oBAAoB;CAGnC"}
@@ -2,11 +2,12 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- import { LocalizationHelper } from "@itwin/presentation-common";
6
- import { Presentation } from "./Presentation";
5
+ import { LocalizationHelper } from "@itwin/presentation-common/internal";
6
+ import { Presentation } from "./Presentation.js";
7
7
  const NAMESPACES = ["Presentation"];
8
8
  /** @internal */
9
9
  export class FrontendLocalizationHelper extends LocalizationHelper {
10
+ _lang;
10
11
  constructor(lang) {
11
12
  super({ getLocalizedString: (key) => Presentation.localization.getLocalizedString(key, { defaultValue: key, lng: this._lang }) });
12
13
  this._lang = lang;
@@ -1 +1 @@
1
- {"version":3,"file":"LocalizationHelper.js","sourceRoot":"","sources":["../../../src/presentation-frontend/LocalizationHelper.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,UAAU,GAAG,CAAC,cAAc,CAAC,CAAC;AAEpC,gBAAgB;AAChB,MAAM,OAAO,0BAA2B,SAAQ,kBAAkB;IAEhE,YAAY,IAAa;QACvB,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,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,YAAY,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,YAAY,CAAC,YAAY,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1F,CAAC;CACF","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
+ {"version":3,"file":"LocalizationHelper.js","sourceRoot":"","sources":["../../../src/presentation-frontend/LocalizationHelper.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,UAAU,GAAG,CAAC,cAAc,CAAC,CAAC;AAEpC,gBAAgB;AAChB,MAAM,OAAO,0BAA2B,SAAQ,kBAAkB;IACxD,KAAK,CAAqB;IAClC,YAAY,IAAa;QACvB,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,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,YAAY,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,YAAY,CAAC,YAAY,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1F,CAAC;CACF","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/internal\";\r\nimport { Presentation } from \"./Presentation.js\";\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"]}
@@ -2,9 +2,9 @@
2
2
  * @module Core
3
3
  */
4
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";
5
+ import { FavoritePropertiesManager, FavoritePropertiesManagerProps } from "./favorite-properties/FavoritePropertiesManager.js";
6
+ import { PresentationManager, PresentationManagerProps } from "./PresentationManager.js";
7
+ import { SelectionManager, SelectionManagerProps } from "./selection/SelectionManager.js";
8
8
  /**
9
9
  * Props for initializing [[Presentation]].
10
10
  * @public
@@ -12,7 +12,12 @@ import { SelectionManager, SelectionManagerProps } from "./selection/SelectionMa
12
12
  export interface PresentationProps {
13
13
  /** Props for [[PresentationManager]]. */
14
14
  presentation?: PresentationManagerProps;
15
- /** Props for [[SelectionManager]]. */
15
+ /**
16
+ * Props for [[SelectionManager]].
17
+ *
18
+ * @deprecated in 5.0. The whole unified selection system in this package is deprecated in favor of the new
19
+ * [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md) package.
20
+ */
16
21
  selection?: Partial<SelectionManagerProps>;
17
22
  /** Props for [[FavoritePropertiesManager]]. */
18
23
  favorites?: FavoritePropertiesManagerProps;
@@ -51,24 +56,20 @@ export declare class Presentation {
51
56
  static registerInitializationHandler(handler: () => Promise<() => void>): void;
52
57
  /** The singleton [[PresentationManager]] */
53
58
  static get presentation(): PresentationManager;
54
- /** @internal */
55
- static setPresentationManager(value: PresentationManager): void;
56
- /** The singleton [[SelectionManager]] */
59
+ /**
60
+ * The singleton [[SelectionManager]].
61
+ *
62
+ * @deprecated in 5.0. The whole unified selection system in this package is deprecated in favor of the new
63
+ * [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md) package.
64
+ */
57
65
  static get selection(): SelectionManager;
58
- /** @internal */
59
- static setSelectionManager(value: SelectionManager): void;
60
66
  /**
61
67
  * The singleton [[FavoritePropertiesManager]]
62
- * @public
63
68
  */
64
69
  static get favoriteProperties(): FavoritePropertiesManager;
65
- /** @internal */
66
- static setFavoritePropertiesManager(value: FavoritePropertiesManager): void;
67
70
  /**
68
71
  * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.
69
72
  */
70
73
  static get localization(): Localization;
71
- /** @internal */
72
- static setLocalization(value: Localization): void;
73
74
  }
74
75
  //# 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,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAE3C,+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;IA4CxE;;;OAGG;WACW,SAAS,IAAI,IAAI;IAyB/B;;;OAGG;WACW,6BAA6B,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI;IAIr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CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI;IAIrF,4CAA4C;IAC5C,WAAkB,YAAY,IAAI,mBAAmB,CAKpD;IAED;;;;;OAKG;IAEH,WAAkB,SAAS,IAAI,gBAAgB,CAK9C;IAED;;OAEG;IACH,WAAkB,kBAAkB,IAAI,yBAAyB,CAKhE;IAED;;OAEG;IACH,WAAkB,YAAY,IAAI,YAAY,CAK7C;CACF"}
@@ -7,15 +7,17 @@
7
7
  */
8
8
  import { IModelApp } from "@itwin/core-frontend";
9
9
  import { PresentationError, PresentationStatus } from "@itwin/presentation-common";
10
- import { FavoritePropertiesManager } from "./favorite-properties/FavoritePropertiesManager";
11
- import { createFavoritePropertiesStorage, DefaultFavoritePropertiesStorageTypes } from "./favorite-properties/FavoritePropertiesStorage";
12
- import { FrontendLocalizationHelper } from "./LocalizationHelper";
13
- import { PresentationManager } from "./PresentationManager";
14
- import { SelectionManager } from "./selection/SelectionManager";
15
- import { SelectionScopesManager } from "./selection/SelectionScopesManager";
10
+ import { FavoritePropertiesManager } from "./favorite-properties/FavoritePropertiesManager.js";
11
+ import { createFavoritePropertiesStorage, DefaultFavoritePropertiesStorageTypes } from "./favorite-properties/FavoritePropertiesStorage.js";
12
+ import { FrontendLocalizationHelper } from "./LocalizationHelper.js";
13
+ import { PresentationManager } from "./PresentationManager.js";
14
+ import { SelectionManager } from "./selection/SelectionManager.js";
15
+ import { SelectionScopesManager } from "./selection/SelectionScopesManager.js";
16
+ import { imodelInitializationHandlers } from "./IModelConnectionInitialization.js";
17
+ import { _presentation_manager_rpcRequestsHandler } from "./InternalSymbols.js";
16
18
  let localization;
17
19
  let presentationManager;
18
- let selectionManager;
20
+ let selectionManager; // eslint-disable-line @typescript-eslint/no-deprecated
19
21
  let favoritePropertiesManager;
20
22
  const initializationHandlers = [];
21
23
  const terminationHandlers = [];
@@ -29,7 +31,7 @@ const terminationHandlers = [];
29
31
  * @public
30
32
  */
31
33
  export class Presentation {
32
- /* istanbul ignore next */
34
+ /* c8 ignore next */
33
35
  constructor() { }
34
36
  /**
35
37
  * Initializes Presentation library for the frontend.
@@ -57,22 +59,22 @@ export class Presentation {
57
59
  presentationManager = PresentationManager.create(managerProps);
58
60
  }
59
61
  if (!selectionManager) {
62
+ /* eslint-disable @typescript-eslint/no-deprecated */
60
63
  selectionManager = new SelectionManager({
61
64
  ...props?.selection,
62
65
  scopes: props?.selection?.scopes ??
63
66
  new SelectionScopesManager({
64
- rpcRequestsHandler: presentationManager.rpcRequestsHandler,
67
+ rpcRequestsHandler: presentationManager[_presentation_manager_rpcRequestsHandler],
65
68
  localeProvider: () => this.presentation.activeLocale,
66
69
  }),
67
70
  });
71
+ /* eslint-enable @typescript-eslint/no-deprecated */
68
72
  }
69
73
  if (!favoritePropertiesManager) {
70
74
  favoritePropertiesManager = new FavoritePropertiesManager({
71
75
  storage: props?.favorites ? props.favorites.storage : createFavoritePropertiesStorage(DefaultFavoritePropertiesStorageTypes.Noop),
72
76
  });
73
77
  }
74
- presentationManager.startIModelInitialization = (imodel) => favoritePropertiesManager?.startConnectionInitialization(imodel);
75
- presentationManager.ensureIModelInitialized = async (imodel) => favoritePropertiesManager?.ensureInitialized(imodel);
76
78
  await FrontendLocalizationHelper.registerNamespaces();
77
79
  for (const handler of initializationHandlers) {
78
80
  const cleanup = await handler();
@@ -88,19 +90,20 @@ export class Presentation {
88
90
  static terminate() {
89
91
  terminationHandlers.forEach((handler) => handler());
90
92
  terminationHandlers.length = 0;
93
+ imodelInitializationHandlers.clear();
91
94
  if (localization) {
92
95
  FrontendLocalizationHelper.unregisterNamespaces();
93
96
  }
94
97
  if (presentationManager) {
95
- presentationManager.dispose();
98
+ presentationManager[Symbol.dispose]();
96
99
  }
97
100
  presentationManager = undefined;
98
101
  if (favoritePropertiesManager) {
99
- favoritePropertiesManager.dispose();
102
+ favoritePropertiesManager[Symbol.dispose]();
100
103
  }
101
104
  favoritePropertiesManager = undefined;
102
105
  if (selectionManager) {
103
- selectionManager.dispose();
106
+ selectionManager[Symbol.dispose]();
104
107
  }
105
108
  selectionManager = undefined;
106
109
  localization = undefined;
@@ -119,27 +122,21 @@ export class Presentation {
119
122
  }
120
123
  return presentationManager;
121
124
  }
122
- /** @internal */
123
- static setPresentationManager(value) {
124
- if (presentationManager) {
125
- presentationManager.dispose();
126
- }
127
- presentationManager = value;
128
- }
129
- /** The singleton [[SelectionManager]] */
125
+ /**
126
+ * The singleton [[SelectionManager]].
127
+ *
128
+ * @deprecated in 5.0. The whole unified selection system in this package is deprecated in favor of the new
129
+ * [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md) package.
130
+ */
131
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
130
132
  static get selection() {
131
133
  if (!selectionManager) {
132
134
  throw new Error("Presentation must be first initialized by calling Presentation.initialize");
133
135
  }
134
136
  return selectionManager;
135
137
  }
136
- /** @internal */
137
- static setSelectionManager(value) {
138
- selectionManager = value;
139
- }
140
138
  /**
141
139
  * The singleton [[FavoritePropertiesManager]]
142
- * @public
143
140
  */
144
141
  static get favoriteProperties() {
145
142
  if (!favoritePropertiesManager) {
@@ -147,13 +144,6 @@ export class Presentation {
147
144
  }
148
145
  return favoritePropertiesManager;
149
146
  }
150
- /** @internal */
151
- static setFavoritePropertiesManager(value) {
152
- if (favoritePropertiesManager) {
153
- favoritePropertiesManager.dispose();
154
- }
155
- favoritePropertiesManager = value;
156
- }
157
147
  /**
158
148
  * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.
159
149
  */
@@ -163,9 +153,5 @@ export class Presentation {
163
153
  }
164
154
  return localization;
165
155
  }
166
- /** @internal */
167
- static setLocalization(value) {
168
- localization = value;
169
- }
170
156
  }
171
157
  //# sourceMappingURL=Presentation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Presentation.js","sourceRoot":"","sources":["../../../src/presentation-frontend/Presentation.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;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S;QACzB,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;QAC/F,CAAC;QACD,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,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAC;QACtG,CAAC;QACD,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,4BAA4B,CAAC,KAAgC;QACzE,IAAI,yBAAyB,EAAE,CAAC;YAC9B,yBAAyB,CAAC,OAAO,EAAE,CAAC;QACtC,CAAC;QACD,yBAAyB,GAAG,KAAK,CAAC;IACpC,CAAC;IAED;;OAEG;IACI,MAAM,KAAK,YAAY;QAC5B,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;QAC/F,CAAC;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,eAAe,CAAC,KAAmB;QAC/C,YAAY,GAAG,KAAK,CAAC;IACvB,CAAC;CACF","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?: Partial<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 /* 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, \"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({\r\n ...props?.selection,\r\n scopes:\r\n props?.selection?.scopes ??\r\n 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\r\n presentationManager.startIModelInitialization = (imodel) => favoritePropertiesManager?.startConnectionInitialization(imodel);\r\n presentationManager.ensureIModelInitialized = async (imodel) => favoritePropertiesManager?.ensureInitialized(imodel);\r\n\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 /**\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\r\n if (presentationManager) {\r\n presentationManager.dispose();\r\n }\r\n presentationManager = undefined;\r\n\r\n if (favoritePropertiesManager) {\r\n favoritePropertiesManager.dispose();\r\n }\r\n favoritePropertiesManager = undefined;\r\n\r\n if (selectionManager) {\r\n selectionManager.dispose();\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 }\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 }\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 }\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 }\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 }\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 }\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;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,iBAAiB,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M,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAC;QACtG,CAAC;QACD,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,MAAM,KAAK,YAAY;QAC5B,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;QAC/F,CAAC;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;CACF","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.js\";\r\nimport { createFavoritePropertiesStorage, DefaultFavoritePropertiesStorageTypes } from \"./favorite-properties/FavoritePropertiesStorage.js\";\r\nimport { FrontendLocalizationHelper } from \"./LocalizationHelper.js\";\r\nimport { PresentationManager, PresentationManagerProps } from \"./PresentationManager.js\";\r\nimport { SelectionManager, SelectionManagerProps } from \"./selection/SelectionManager.js\";\r\nimport { SelectionScopesManager } from \"./selection/SelectionScopesManager.js\";\r\nimport { imodelInitializationHandlers } from \"./IModelConnectionInitialization.js\";\r\nimport { _presentation_manager_rpcRequestsHandler } from \"./InternalSymbols.js\";\r\n\r\nlet localization: Localization | undefined;\r\nlet presentationManager: PresentationManager | undefined;\r\nlet selectionManager: SelectionManager | undefined; // eslint-disable-line @typescript-eslint/no-deprecated\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 /**\r\n * Props for [[SelectionManager]].\r\n *\r\n * @deprecated in 5.0. The whole unified selection system in this package is deprecated in favor of the new\r\n * [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md) package.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n selection?: Partial<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 /* c8 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, \"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 /* eslint-disable @typescript-eslint/no-deprecated */\r\n selectionManager = new SelectionManager({\r\n ...props?.selection,\r\n scopes:\r\n props?.selection?.scopes ??\r\n new SelectionScopesManager({\r\n rpcRequestsHandler: presentationManager[_presentation_manager_rpcRequestsHandler],\r\n localeProvider: () => this.presentation.activeLocale,\r\n }),\r\n });\r\n /* eslint-enable @typescript-eslint/no-deprecated */\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\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 /**\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 imodelInitializationHandlers.clear();\r\n\r\n if (localization) {\r\n FrontendLocalizationHelper.unregisterNamespaces();\r\n }\r\n\r\n if (presentationManager) {\r\n presentationManager[Symbol.dispose]();\r\n }\r\n presentationManager = undefined;\r\n\r\n if (favoritePropertiesManager) {\r\n favoritePropertiesManager[Symbol.dispose]();\r\n }\r\n favoritePropertiesManager = undefined;\r\n\r\n if (selectionManager) {\r\n selectionManager[Symbol.dispose]();\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 }\r\n return presentationManager;\r\n }\r\n\r\n /**\r\n * The singleton [[SelectionManager]].\r\n *\r\n * @deprecated in 5.0. The whole unified selection system in this package is deprecated in favor of the new\r\n * [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md) package.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\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 }\r\n return selectionManager;\r\n }\r\n\r\n /**\r\n * The singleton [[FavoritePropertiesManager]]\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 }\r\n return favoritePropertiesManager;\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 }\r\n return localization;\r\n }\r\n}\r\n"]}
@@ -1,14 +1,16 @@
1
1
  /** @packageDocumentation
2
2
  * @module Core
3
3
  */
4
- import { BeEvent, IDisposable } from "@itwin/core-bentley";
4
+ import { BeEvent } from "@itwin/core-bentley";
5
5
  import { IModelConnection } from "@itwin/core-frontend";
6
6
  import { UnitSystemKey } from "@itwin/core-quantity";
7
7
  import { SchemaContext } from "@itwin/ecschema-metadata";
8
- import { ClientDiagnosticsAttribute, Content, ContentDescriptorRequestOptions, ContentInstanceKeysRequestOptions, ContentRequestOptions, ContentSourcesRequestOptions, ContentUpdateInfo, Descriptor, DescriptorOverrides, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, FormatsMap, HierarchyLevelDescriptorRequestOptions, HierarchyRequestOptions, HierarchyUpdateInfo, InstanceKey, Item, KeySet, LabelDefinition, Node, NodeKey, NodePathElement, Paged, PagedResponse, RpcRequestsHandler, RulesetVariable, SelectClassInfo, SingleElementPropertiesRequestOptions } from "@itwin/presentation-common";
9
- import { IpcRequestsHandler } from "./IpcRequestsHandler";
10
- import { RulesetManager } from "./RulesetManager";
11
- import { RulesetVariablesManager } from "./RulesetVariablesManager";
8
+ import { ClientDiagnosticsAttribute, Content, ContentDescriptorRequestOptions, ContentInstanceKeysRequestOptions, ContentRequestOptions, ContentSourcesRequestOptions, ContentUpdateInfo, Descriptor, DescriptorOverrides, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, FormatsMap, HierarchyLevelDescriptorRequestOptions, HierarchyRequestOptions, HierarchyUpdateInfo, InstanceKey, Item, KeySet, LabelDefinition, Node, NodeKey, NodePathElement, Paged, PagedResponse, RulesetVariable, SelectClassInfo, SingleElementPropertiesRequestOptions } from "@itwin/presentation-common";
9
+ import { RpcRequestsHandler } from "@itwin/presentation-common/internal";
10
+ import { IpcRequestsHandler } from "./IpcRequestsHandler.js";
11
+ import { RulesetManager } from "./RulesetManager.js";
12
+ import { RulesetVariablesManager } from "./RulesetVariablesManager.js";
13
+ import { _presentation_manager_ipcRequestsHandler, _presentation_manager_rpcRequestsHandler } from "./InternalSymbols.js";
12
14
  /**
13
15
  * Data structure that describes IModel hierarchy change event arguments.
14
16
  * @public
@@ -111,10 +113,6 @@ export interface PresentationManagerProps {
111
113
  * @note Only has effect when frontend value formatting is enabled by supplying the `schemaContextProvider` prop.
112
114
  */
113
115
  defaultFormats?: FormatsMap;
114
- /** @internal */
115
- rpcRequestsHandler?: RpcRequestsHandler;
116
- /** @internal */
117
- ipcRequestsHandler?: IpcRequestsHandler;
118
116
  }
119
117
  /**
120
118
  * Frontend Presentation manager which basically just forwards all calls to
@@ -122,7 +120,7 @@ export interface PresentationManagerProps {
122
120
  *
123
121
  * @public
124
122
  */
125
- export declare class PresentationManager implements IDisposable {
123
+ export declare class PresentationManager implements Disposable {
126
124
  private _requestsHandler;
127
125
  private _rulesets;
128
126
  private _localizationHelper;
@@ -153,30 +151,21 @@ export declare class PresentationManager implements IDisposable {
153
151
  /** Get / set active locale used for localizing presentation data */
154
152
  get activeLocale(): string | undefined;
155
153
  set activeLocale(locale: string | undefined);
154
+ [Symbol.dispose](): void;
155
+ /** @deprecated in 5.0 Use [Symbol.dispose] instead. */
156
156
  dispose(): void;
157
157
  private onUpdate;
158
158
  /** @note This is only called in native apps after changes in iModels */
159
159
  private handleUpdateAsync;
160
- /**
161
- * Function that is called when a new IModelConnection is used to retrieve data.
162
- * @internal
163
- */
164
- startIModelInitialization(_: IModelConnection): void;
165
- /**
166
- * Function that should be called to finish initialization that was started at [[PresentationManager.startIModelInitialization]].
167
- * Can be removed when [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]] are removed.
168
- * @internal
169
- */
170
- ensureIModelInitialized(_: IModelConnection): Promise<void>;
171
160
  /**
172
161
  * Create a new PresentationManager instance
173
162
  * @param props Optional properties used to configure the manager
174
163
  */
175
164
  static create(props?: PresentationManagerProps): PresentationManager;
176
165
  /** @internal */
177
- get rpcRequestsHandler(): RpcRequestsHandler;
166
+ get [_presentation_manager_rpcRequestsHandler](): RpcRequestsHandler;
178
167
  /** @internal */
179
- get ipcRequestsHandler(): IpcRequestsHandler | undefined;
168
+ get [_presentation_manager_ipcRequestsHandler](): IpcRequestsHandler | undefined;
180
169
  /**
181
170
  * Get rulesets manager
182
171
  */