@itwin/presentation-frontend 4.4.0 → 4.5.0-dev.10
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.
- package/CHANGELOG.md +1 -1
- package/README.md +1 -1
- package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js +10 -6
- package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/Diagnostics.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/Diagnostics.js +18 -13
- package/lib/cjs/presentation-frontend/Diagnostics.js.map +1 -1
- package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js +3 -3
- package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.js +3 -3
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.js.map +1 -1
- package/lib/cjs/presentation-frontend/LocalizationHelper.js +3 -3
- package/lib/cjs/presentation-frontend/LocalizationHelper.js.map +1 -1
- package/lib/cjs/presentation-frontend/Presentation.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/Presentation.js +24 -14
- package/lib/cjs/presentation-frontend/Presentation.js.map +1 -1
- package/lib/cjs/presentation-frontend/PresentationManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/PresentationManager.js +57 -30
- package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetManager.js +11 -7
- package/lib/cjs/presentation-frontend/RulesetManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetVariablesManager.js +53 -31
- package/lib/cjs/presentation-frontend/RulesetVariablesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +111 -66
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +54 -25
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/HiliteRules.json +172 -172
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js +16 -10
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js +3 -3
- package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js +3 -3
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.js +15 -9
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.js +7 -5
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionManager.js +31 -16
- package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js +25 -14
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend.js +3 -3
- package/lib/cjs/presentation-frontend.js.map +1 -1
- package/lib/esm/presentation-frontend/ConnectivityInformationProvider.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js +10 -6
- package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/Diagnostics.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/Diagnostics.js +18 -13
- package/lib/esm/presentation-frontend/Diagnostics.js.map +1 -1
- package/lib/esm/presentation-frontend/FrontendLoggerCategory.js +3 -3
- package/lib/esm/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
- package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/IpcRequestsHandler.js +3 -3
- package/lib/esm/presentation-frontend/IpcRequestsHandler.js.map +1 -1
- package/lib/esm/presentation-frontend/LocalizationHelper.js +3 -3
- package/lib/esm/presentation-frontend/LocalizationHelper.js.map +1 -1
- package/lib/esm/presentation-frontend/Presentation.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/Presentation.js +24 -14
- package/lib/esm/presentation-frontend/Presentation.js.map +1 -1
- package/lib/esm/presentation-frontend/PresentationManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/PresentationManager.js +57 -30
- package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
- package/lib/esm/presentation-frontend/RulesetManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/RulesetManager.js +11 -7
- package/lib/esm/presentation-frontend/RulesetManager.js.map +1 -1
- package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/RulesetVariablesManager.js +53 -31
- package/lib/esm/presentation-frontend/RulesetVariablesManager.js.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +111 -66
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +54 -25
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/HiliteRules.json +172 -172
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js +17 -11
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/ISelectionProvider.js +3 -3
- package/lib/esm/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js +3 -3
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHandler.js +15 -9
- package/lib/esm/presentation-frontend/selection/SelectionHandler.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHelper.js +7 -5
- package/lib/esm/presentation-frontend/selection/SelectionHelper.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionManager.js +31 -16
- package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js +25 -14
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
- package/lib/esm/presentation-frontend.js +3 -3
- package/lib/esm/presentation-frontend.js.map +1 -1
- package/package.json +19 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log - @itwin/presentation-frontend
|
|
2
2
|
|
|
3
|
-
This log was last generated on Mon, 12 Feb 2024
|
|
3
|
+
This log was last generated on Mon, 12 Feb 2024 19:26:22 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
## 4.4.0
|
|
6
6
|
Mon, 12 Feb 2024 18:15:58 GMT
|
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
|
|
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;
|
|
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() {
|
|
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
|
|
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":["/*---------------------------------------------------------------------------------------------\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 // eslint-disable-next-line @typescript-eslint/naming-convention\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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Diagnostics.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/Diagnostics.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACL,iBAAiB,
|
|
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 &&
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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":
|
|
55
|
-
|
|
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
|
|
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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,CAAC,iCAAiC;QACzD,KAAK,SAAS;YACZ,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,iCAAiC;QACxD,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO,CAAC;QACb,KAAK,OAAO;YACV,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,iCAAiC;KACxD;AACH,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/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport {\r\n ClientDiagnostics,\r\n ClientDiagnosticsHandler,\r\n DiagnosticsLogEntry,\r\n DiagnosticsLoggerSeverity,\r\n DiagnosticsLogMessage,\r\n DiagnosticsScopeLogs,\r\n} from \"@itwin/presentation-common\";\r\n\r\n/**\r\n * A function which logs messages to the console.\r\n * @beta\r\n */\r\nexport function consoleDiagnosticsHandler(diagnostics: ClientDiagnostics) {\r\n // eslint-disable-next-line no-console\r\n diagnostics.backendVersion && console.log(`Backend version: ${diagnostics.backendVersion}`);\r\n diagnostics.logs &&\r\n handleDiagnosticLogs(diagnostics.logs, (msg: DiagnosticsLogMessage, stack: DiagnosticsScopeLogs[]) => {\r\n /* note: we're duplicating the message if it's logged at both editor and dev severity levels */\r\n const str = buildLogMessageString(msg, stack);\r\n if (msg.severity.editor) {\r\n getConsoleLogFunc(msg.severity.editor)(str);\r\n }\r\n if (msg.severity.dev) {\r\n getConsoleLogFunc(msg.severity.dev)(str);\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * A function which calls all diagnostics handlers passed to it.\r\n * @beta\r\n */\r\nexport function createCombinedDiagnosticsHandler(handlers: ClientDiagnosticsHandler[]) {\r\n return (diagnostics: ClientDiagnostics) => {\r\n handlers.forEach((handler) => handler(diagnostics));\r\n };\r\n}\r\n\r\ntype DiagnosticsLogMessageHandler = (msg: DiagnosticsLogMessage, stack: DiagnosticsScopeLogs[]) => void;\r\n\r\nfunction handleDiagnosticLogs(logs: DiagnosticsLogEntry[], messageHandler: DiagnosticsLogMessageHandler, stack: DiagnosticsScopeLogs[] = []) {\r\n logs.forEach((log) => {\r\n if (DiagnosticsLogEntry.isMessage(log)) {\r\n messageHandler(log, stack);\r\n } else if (log.logs) {\r\n handleDiagnosticLogs(log.logs, messageHandler, [...stack, log]);\r\n }\r\n });\r\n}\r\n\r\nfunction buildLogMessageString(msg: DiagnosticsLogMessage, _stack: DiagnosticsScopeLogs[]) {\r\n return msg.message;\r\n}\r\n\r\nfunction getConsoleLogFunc(severity: DiagnosticsLoggerSeverity) {\r\n switch (severity) {\r\n case \"error\":\r\n return console.error; // eslint-disable-line no-console\r\n case \"warning\":\r\n return console.warn; // eslint-disable-line no-console\r\n case \"info\":\r\n case \"debug\":\r\n case \"trace\":\r\n return console.log; // eslint-disable-line no-console\r\n }\r\n}\r\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
|
|
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":["/*---------------------------------------------------------------------------------------------\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 Logging\r\n */\r\n\r\n/**\r\n * Logger categories used by this package\r\n * @note All logger categories in this package start with the `presentation-frontend` prefix.\r\n * @see [Logger]($bentley)\r\n * @public\r\n */\r\nexport enum PresentationFrontendLoggerCategory {\r\n Package = \"presentation-frontend\",\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IpcRequestsHandler.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":"AAMA,OAAO,
|
|
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
|
|
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":["/*---------------------------------------------------------------------------------------------\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"]}
|
|
@@ -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
|
|
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":["/*---------------------------------------------------------------------------------------------\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 +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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C;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 =
|
|
58
|
+
managerProps.activeLocale = languages.length ? languages[0] : undefined;
|
|
59
59
|
}
|
|
60
60
|
presentationManager = PresentationManager_1.PresentationManager.create(managerProps);
|
|
61
61
|
}
|
|
@@ -77,8 +77,9 @@ class Presentation {
|
|
|
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
|
-
|
|
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,mBA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AAsB,CAAC,KAA0B;QAC7D,IAAI,mBAAmB;YACrB,mBAAmB,CAAC,OAAO,EAAE,CAAC;QAChC,mBAAmB,GAAG,KAAK,CAAC;IAC9B,CAAC;IAED,yCAAyC;IAClC,MAAM,KAAK,SAAS;QACzB,IAAI,CAAC,gBAAgB;YACnB,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;QAC/F,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,mBAAmB,CAAC,KAAuB;QACvD,gBAAgB,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACI,MAAM,KAAK,kBAAkB;QAClC,IAAI,CAAC,yBAAyB;YAC5B,MAAM,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAC;QACtG,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,4BAA4B,CAAC,KAAgC;QACzE,IAAI,yBAAyB;YAC3B,yBAAyB,CAAC,OAAO,EAAE,CAAC;QACtC,yBAAyB,GAAG,KAAK,CAAC;IACpC,CAAC;IAED;;OAEG;IACI,MAAM,KAAK,YAAY;QAC5B,IAAI,CAAC,YAAY;YACf,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;QAC/F,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,eAAe,CAAC,KAAmB;QAC/C,YAAY,GAAG,KAAK,CAAC;IACvB,CAAC;CACF;AA7ID,oCA6IC","sourcesContent":["/*---------------------------------------------------------------------------------------------\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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AAC;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;YAC9B,MAAM,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;AAvJD,oCAuJC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { IModelApp } from \"@itwin/core-frontend\";\r\nimport { Localization } from \"@itwin/core-common\";\r\nimport { PresentationError, PresentationStatus } from \"@itwin/presentation-common\";\r\nimport { FavoritePropertiesManager, FavoritePropertiesManagerProps } from \"./favorite-properties/FavoritePropertiesManager\";\r\nimport { createFavoritePropertiesStorage, DefaultFavoritePropertiesStorageTypes } from \"./favorite-properties/FavoritePropertiesStorage\";\r\nimport { FrontendLocalizationHelper } from \"./LocalizationHelper\";\r\nimport { PresentationManager, PresentationManagerProps } from \"./PresentationManager\";\r\nimport { SelectionManager, SelectionManagerProps } from \"./selection/SelectionManager\";\r\nimport { SelectionScopesManager } from \"./selection/SelectionScopesManager\";\r\n\r\nlet localization: Localization | undefined;\r\nlet presentationManager: PresentationManager | undefined;\r\nlet selectionManager: SelectionManager | undefined;\r\nlet favoritePropertiesManager: FavoritePropertiesManager | undefined;\r\nconst initializationHandlers: Array<() => Promise<(() => void) | void>> = [];\r\nconst terminationHandlers: Array<() => void> = [];\r\n\r\n/**\r\n * Props for initializing [[Presentation]].\r\n * @public\r\n */\r\nexport interface PresentationProps {\r\n /** Props for [[PresentationManager]]. */\r\n presentation?: PresentationManagerProps;\r\n\r\n /** Props for [[SelectionManager]]. */\r\n selection?: SelectionManagerProps;\r\n\r\n /** Props for [[FavoritePropertiesManager]]. */\r\n favorites?: FavoritePropertiesManagerProps;\r\n}\r\n\r\n/**\r\n * Static class used to statically set up Presentation library for the frontend.\r\n * Basically what it does is:\r\n * - Create a singleton [[PresentationManager]] instance\r\n * - Create a singleton [[SelectionManager]] instance\r\n * - Create a singleton [[FavoritePropertiesManager]]] instance\r\n *\r\n * @public\r\n */\r\nexport class Presentation {\r\n /* 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: new SelectionScopesManager({\r\n rpcRequestsHandler: presentationManager.rpcRequestsHandler,\r\n localeProvider: () => this.presentation.activeLocale,\r\n }),\r\n },\r\n );\r\n }\r\n if (!favoritePropertiesManager) {\r\n favoritePropertiesManager = new FavoritePropertiesManager({\r\n storage: props?.favorites ? props.favorites.storage : createFavoritePropertiesStorage(DefaultFavoritePropertiesStorageTypes.Noop),\r\n });\r\n }\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n presentationManager.onNewiModelConnection = favoritePropertiesManager.initializeConnection.bind(favoritePropertiesManager);\r\n await FrontendLocalizationHelper.registerNamespaces();\r\n for (const handler of initializationHandlers) {\r\n const cleanup = await handler();\r\n if (cleanup) {\r\n terminationHandlers.push(cleanup);\r\n }\r\n }\r\n }\r\n\r\n /**\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 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/PresentationManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAqB,WAAW,EAAuB,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAa,gBAAgB,EAAU,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EACL,0BAA0B,
|
|
1
|
+
{"version":3,"file":"PresentationManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-front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