@itwin/presentation-frontend 3.4.0-dev.9 → 3.4.1

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 (130) hide show
  1. package/CHANGELOG.md +51 -1
  2. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.d.ts +29 -29
  3. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js +47 -47
  4. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  5. package/lib/cjs/presentation-frontend/Diagnostics.d.ts +14 -12
  6. package/lib/cjs/presentation-frontend/Diagnostics.d.ts.map +1 -1
  7. package/lib/cjs/presentation-frontend/Diagnostics.js +61 -59
  8. package/lib/cjs/presentation-frontend/Diagnostics.js.map +1 -1
  9. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.d.ts +12 -12
  10. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js +20 -20
  11. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
  12. package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts +10 -10
  13. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js +42 -42
  14. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js.map +1 -1
  15. package/lib/cjs/presentation-frontend/LocalizationHelper.d.ts +10 -14
  16. package/lib/cjs/presentation-frontend/LocalizationHelper.d.ts.map +1 -1
  17. package/lib/cjs/presentation-frontend/LocalizationHelper.js +31 -57
  18. package/lib/cjs/presentation-frontend/LocalizationHelper.js.map +1 -1
  19. package/lib/cjs/presentation-frontend/Presentation.d.ts +75 -75
  20. package/lib/cjs/presentation-frontend/Presentation.js +162 -162
  21. package/lib/cjs/presentation-frontend/Presentation.js.map +1 -1
  22. package/lib/cjs/presentation-frontend/PresentationManager.d.ts +180 -179
  23. package/lib/cjs/presentation-frontend/PresentationManager.d.ts.map +1 -1
  24. package/lib/cjs/presentation-frontend/PresentationManager.js +419 -413
  25. package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
  26. package/lib/cjs/presentation-frontend/RulesetManager.d.ts +60 -60
  27. package/lib/cjs/presentation-frontend/RulesetManager.js +85 -85
  28. package/lib/cjs/presentation-frontend/RulesetManager.js.map +1 -1
  29. package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts +143 -143
  30. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js +195 -195
  31. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  32. package/lib/cjs/presentation-frontend/StateTracker.d.ts +23 -23
  33. package/lib/cjs/presentation-frontend/StateTracker.js +74 -74
  34. package/lib/cjs/presentation-frontend/StateTracker.js.map +1 -1
  35. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +132 -132
  36. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +525 -525
  37. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  38. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +111 -111
  39. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +293 -293
  40. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  41. package/lib/cjs/presentation-frontend/selection/HiliteRules.json +172 -172
  42. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts +52 -52
  43. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js +97 -97
  44. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
  45. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts +19 -19
  46. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js +9 -9
  47. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  48. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts +52 -52
  49. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js +33 -33
  50. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  51. package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts +103 -103
  52. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js +108 -108
  53. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js.map +1 -1
  54. package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts +14 -14
  55. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js +37 -37
  56. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  57. package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts +139 -139
  58. package/lib/cjs/presentation-frontend/selection/SelectionManager.js +414 -414
  59. package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
  60. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts +59 -59
  61. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js +91 -91
  62. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  63. package/lib/cjs/presentation-frontend.d.ts +34 -34
  64. package/lib/cjs/presentation-frontend.js +50 -50
  65. package/lib/cjs/presentation-frontend.js.map +1 -1
  66. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.d.ts +29 -29
  67. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js +43 -43
  68. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  69. package/lib/esm/presentation-frontend/Diagnostics.d.ts +14 -12
  70. package/lib/esm/presentation-frontend/Diagnostics.d.ts.map +1 -1
  71. package/lib/esm/presentation-frontend/Diagnostics.js +56 -54
  72. package/lib/esm/presentation-frontend/Diagnostics.js.map +1 -1
  73. package/lib/esm/presentation-frontend/FrontendLoggerCategory.d.ts +12 -12
  74. package/lib/esm/presentation-frontend/FrontendLoggerCategory.js +17 -17
  75. package/lib/esm/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
  76. package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts +10 -10
  77. package/lib/esm/presentation-frontend/IpcRequestsHandler.js +38 -38
  78. package/lib/esm/presentation-frontend/IpcRequestsHandler.js.map +1 -1
  79. package/lib/esm/presentation-frontend/LocalizationHelper.d.ts +10 -14
  80. package/lib/esm/presentation-frontend/LocalizationHelper.d.ts.map +1 -1
  81. package/lib/esm/presentation-frontend/LocalizationHelper.js +27 -53
  82. package/lib/esm/presentation-frontend/LocalizationHelper.js.map +1 -1
  83. package/lib/esm/presentation-frontend/Presentation.d.ts +75 -75
  84. package/lib/esm/presentation-frontend/Presentation.js +158 -158
  85. package/lib/esm/presentation-frontend/Presentation.js.map +1 -1
  86. package/lib/esm/presentation-frontend/PresentationManager.d.ts +180 -179
  87. package/lib/esm/presentation-frontend/PresentationManager.d.ts.map +1 -1
  88. package/lib/esm/presentation-frontend/PresentationManager.js +414 -408
  89. package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
  90. package/lib/esm/presentation-frontend/RulesetManager.d.ts +60 -60
  91. package/lib/esm/presentation-frontend/RulesetManager.js +81 -81
  92. package/lib/esm/presentation-frontend/RulesetManager.js.map +1 -1
  93. package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts +143 -143
  94. package/lib/esm/presentation-frontend/RulesetVariablesManager.js +191 -191
  95. package/lib/esm/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  96. package/lib/esm/presentation-frontend/StateTracker.d.ts +23 -23
  97. package/lib/esm/presentation-frontend/StateTracker.js +70 -70
  98. package/lib/esm/presentation-frontend/StateTracker.js.map +1 -1
  99. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +132 -132
  100. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +519 -519
  101. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  102. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +111 -111
  103. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +285 -285
  104. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  105. package/lib/esm/presentation-frontend/selection/HiliteRules.json +172 -172
  106. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts +52 -52
  107. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js +93 -93
  108. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
  109. package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts +19 -19
  110. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js +8 -8
  111. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  112. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts +52 -52
  113. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js +29 -29
  114. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  115. package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts +103 -103
  116. package/lib/esm/presentation-frontend/selection/SelectionHandler.js +104 -104
  117. package/lib/esm/presentation-frontend/selection/SelectionHandler.js.map +1 -1
  118. package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts +14 -14
  119. package/lib/esm/presentation-frontend/selection/SelectionHelper.js +33 -33
  120. package/lib/esm/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  121. package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts +139 -139
  122. package/lib/esm/presentation-frontend/selection/SelectionManager.js +409 -409
  123. package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
  124. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts +59 -59
  125. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js +85 -85
  126. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  127. package/lib/esm/presentation-frontend.d.ts +34 -34
  128. package/lib/esm/presentation-frontend.js +38 -38
  129. package/lib/esm/presentation-frontend.js.map +1 -1
  130. package/package.json +15 -15
@@ -1,15 +1,11 @@
1
- import { Content, LabelDefinition, Node } from "@itwin/presentation-common";
2
- /** @internal */
3
- export declare class LocalizationHelper {
4
- static registerNamespaces(): Promise<void>;
5
- static unregisterNamespaces(): void;
6
- getLocalizedString(text: string): string;
7
- getLocalizedNodes(nodes: Node[]): Node[];
8
- getLocalizedLabelDefinition(labelDefinition: LabelDefinition): LabelDefinition;
9
- getLocalizedLabelDefinitions(labelDefinitions: LabelDefinition[]): LabelDefinition[];
10
- getLocalizedContent(content: Content): Content;
11
- private translateContentItem;
12
- private translateNode;
13
- private translateLabelDefinition;
14
- }
1
+ import { LocalizationHelper } from "@itwin/presentation-common";
2
+ /** @internal */
3
+ export declare class FrontendLocalizationHelper extends LocalizationHelper {
4
+ private _lang;
5
+ constructor(lang?: string);
6
+ get locale(): string | undefined;
7
+ set locale(locale: string | undefined);
8
+ static registerNamespaces(): Promise<void>;
9
+ static unregisterNamespaces(): void;
10
+ }
15
11
  //# sourceMappingURL=LocalizationHelper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LocalizationHelper.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/LocalizationHelper.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAA6B,eAAe,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAOvG,gBAAgB;AAChB,qBAAa,kBAAkB;WACT,kBAAkB;WAKxB,oBAAoB;IAI3B,kBAAkB,CAAC,IAAI,EAAE,MAAM;IAI/B,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE;IAMxC,2BAA2B,CAAC,eAAe,EAAE,eAAe,GAAG,eAAe;IAK9E,4BAA4B,CAAC,gBAAgB,EAAE,eAAe,EAAE;IAKhE,mBAAmB,CAAC,OAAO,EAAE,OAAO;IAK3C,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,wBAAwB;CAWjC"}
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,58 +1,32 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LocalizationHelper = void 0;
4
- /*---------------------------------------------------------------------------------------------
5
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
- * See LICENSE.md in the project root for license terms and full copyright notice.
7
- *--------------------------------------------------------------------------------------------*/
8
- const presentation_common_1 = require("@itwin/presentation-common");
9
- const Presentation_1 = require("./Presentation");
10
- const NAMESPACES = ["BisCore", "ECPresentation", "RulesEngine"];
11
- const KEY_PATTERN = /@[\w\d\-_]+:[\w\d\-\._]+?@/g;
12
- /** @internal */
13
- class LocalizationHelper {
14
- static async registerNamespaces() {
15
- const localizationPromises = NAMESPACES.map(async (namespace) => Presentation_1.Presentation.localization.registerNamespace(namespace));
16
- await Promise.all(localizationPromises);
17
- }
18
- static unregisterNamespaces() {
19
- NAMESPACES.map((namespace) => Presentation_1.Presentation.localization.unregisterNamespace(namespace));
20
- }
21
- getLocalizedString(text) {
22
- return text.replace(KEY_PATTERN, (key) => Presentation_1.Presentation.localization.getLocalizedString(key.replace(/^@|@$/g, ""), { defaultValue: key }));
23
- }
24
- getLocalizedNodes(nodes) {
25
- for (const node of nodes)
26
- this.translateNode(node);
27
- return nodes;
28
- }
29
- getLocalizedLabelDefinition(labelDefinition) {
30
- this.translateLabelDefinition(labelDefinition);
31
- return labelDefinition;
32
- }
33
- getLocalizedLabelDefinitions(labelDefinitions) {
34
- labelDefinitions.forEach((labelDefinition) => this.translateLabelDefinition(labelDefinition));
35
- return labelDefinitions;
36
- }
37
- getLocalizedContent(content) {
38
- content.contentSet.forEach((item) => this.translateContentItem(item));
39
- return content;
40
- }
41
- translateContentItem(item) {
42
- this.translateLabelDefinition(item.label);
43
- }
44
- translateNode(node) {
45
- this.translateLabelDefinition(node.label);
46
- }
47
- translateLabelDefinition(labelDefinition) {
48
- const translateComposite = (compositeValue) => {
49
- compositeValue.values.map((value) => this.translateLabelDefinition(value));
50
- };
51
- if (labelDefinition.typeName === presentation_common_1.LabelDefinition.COMPOSITE_DEFINITION_TYPENAME)
52
- translateComposite(labelDefinition.rawValue);
53
- else if (labelDefinition.typeName === "string")
54
- labelDefinition.rawValue = this.getLocalizedString(labelDefinition.rawValue);
55
- }
56
- }
57
- exports.LocalizationHelper = LocalizationHelper;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FrontendLocalizationHelper = void 0;
4
+ /*---------------------------------------------------------------------------------------------
5
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
+ * See LICENSE.md in the project root for license terms and full copyright notice.
7
+ *--------------------------------------------------------------------------------------------*/
8
+ const presentation_common_1 = require("@itwin/presentation-common");
9
+ const Presentation_1 = require("./Presentation");
10
+ const NAMESPACES = ["BisCore", "ECPresentation", "RulesEngine"];
11
+ /** @internal */
12
+ class FrontendLocalizationHelper extends presentation_common_1.LocalizationHelper {
13
+ constructor(lang) {
14
+ super({ getLocalizedString: (key) => Presentation_1.Presentation.localization.getLocalizedString(key, { defaultValue: key, lng: this._lang }) });
15
+ this._lang = lang;
16
+ }
17
+ get locale() {
18
+ return this._lang;
19
+ }
20
+ set locale(locale) {
21
+ this._lang = locale;
22
+ }
23
+ static async registerNamespaces() {
24
+ const localizationPromises = NAMESPACES.map(async (namespace) => Presentation_1.Presentation.localization.registerNamespace(namespace));
25
+ await Promise.all(localizationPromises);
26
+ }
27
+ static unregisterNamespaces() {
28
+ NAMESPACES.map((namespace) => Presentation_1.Presentation.localization.unregisterNamespace(namespace));
29
+ }
30
+ }
31
+ exports.FrontendLocalizationHelper = FrontendLocalizationHelper;
58
32
  //# sourceMappingURL=LocalizationHelper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LocalizationHelper.js","sourceRoot":"","sources":["../../../src/presentation-frontend/LocalizationHelper.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,oEAAuG;AACvG,iDAA8C;AAE9C,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAC;AAEhE,MAAM,WAAW,GAAG,6BAA6B,CAAC;AAElD,gBAAgB;AAChB,MAAa,kBAAkB;IACtB,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;IAEM,kBAAkB,CAAC,IAAY;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,2BAAY,CAAC,YAAY,CAAC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;IAC5I,CAAC;IAEM,iBAAiB,CAAC,KAAa;QACpC,KAAK,MAAM,IAAI,IAAI,KAAK;YACtB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IAEM,2BAA2B,CAAC,eAAgC;QACjE,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,CAAC;QAC/C,OAAO,eAAe,CAAC;IACzB,CAAC;IAEM,4BAA4B,CAAC,gBAAmC;QACrE,gBAAgB,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,EAAE,CAAC,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,CAAC,CAAC;QAC9F,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAEM,mBAAmB,CAAC,OAAgB;QACzC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;QACtE,OAAO,OAAO,CAAC;IACjB,CAAC;IAEO,oBAAoB,CAAC,IAAU;QACrC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IAEO,aAAa,CAAC,IAAU;QAC9B,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IAEO,wBAAwB,CAAC,eAAgC;QAC/D,MAAM,kBAAkB,GAAG,CAAC,cAAmC,EAAE,EAAE;YACjE,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAC;QAC7E,CAAC,CAAC;QAEF,IAAI,eAAe,CAAC,QAAQ,KAAK,qCAAe,CAAC,6BAA6B;YAC5E,kBAAkB,CAAC,eAAe,CAAC,QAA+B,CAAC,CAAC;aACjE,IAAI,eAAe,CAAC,QAAQ,KAAK,QAAQ;YAC5C,eAAe,CAAC,QAAQ,GAAG,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,QAAkB,CAAC,CAAC;IAC3F,CAAC;CAEF;AAtDD,gDAsDC","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 { Content, Item, LabelCompositeValue, LabelDefinition, Node } from \"@itwin/presentation-common\";\r\nimport { Presentation } from \"./Presentation\";\r\n\r\nconst NAMESPACES = [\"BisCore\", \"ECPresentation\", \"RulesEngine\"];\r\n\r\nconst KEY_PATTERN = /@[\\w\\d\\-_]+:[\\w\\d\\-\\._]+?@/g;\r\n\r\n/** @internal */\r\nexport class LocalizationHelper {\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 public getLocalizedString(text: string) {\r\n return text.replace(KEY_PATTERN, (key) => Presentation.localization.getLocalizedString(key.replace(/^@|@$/g, \"\"), { defaultValue: key }));\r\n }\r\n\r\n public getLocalizedNodes(nodes: Node[]): Node[] {\r\n for (const node of nodes)\r\n this.translateNode(node);\r\n return nodes;\r\n }\r\n\r\n public getLocalizedLabelDefinition(labelDefinition: LabelDefinition): LabelDefinition {\r\n this.translateLabelDefinition(labelDefinition);\r\n return labelDefinition;\r\n }\r\n\r\n public getLocalizedLabelDefinitions(labelDefinitions: LabelDefinition[]) {\r\n labelDefinitions.forEach((labelDefinition) => this.translateLabelDefinition(labelDefinition));\r\n return labelDefinitions;\r\n }\r\n\r\n public getLocalizedContent(content: Content) {\r\n content.contentSet.forEach((item) => this.translateContentItem(item));\r\n return content;\r\n }\r\n\r\n private translateContentItem(item: Item) {\r\n this.translateLabelDefinition(item.label);\r\n }\r\n\r\n private translateNode(node: Node) {\r\n this.translateLabelDefinition(node.label);\r\n }\r\n\r\n private translateLabelDefinition(labelDefinition: LabelDefinition) {\r\n const translateComposite = (compositeValue: LabelCompositeValue) => {\r\n compositeValue.values.map((value) => this.translateLabelDefinition(value));\r\n };\r\n\r\n if (labelDefinition.typeName === LabelDefinition.COMPOSITE_DEFINITION_TYPENAME)\r\n translateComposite(labelDefinition.rawValue as LabelCompositeValue);\r\n else if (labelDefinition.typeName === \"string\")\r\n labelDefinition.rawValue = this.getLocalizedString(labelDefinition.rawValue as string);\r\n }\r\n\r\n}\r\n"]}
1
+ {"version":3,"file":"LocalizationHelper.js","sourceRoot":"","sources":["../../../src/presentation-frontend/LocalizationHelper.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,oEAAgE;AAChE,iDAA8C;AAE9C,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAC;AAEhE,gBAAgB;AAChB,MAAa,0BAA2B,SAAQ,wCAAkB;IAEhE,YAAY,IAAa;QACvB,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,2BAAY,CAAC,YAAY,CAAC,kBAAkB,CAAC,GAAG,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;QAClI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IACD,IAAW,MAAM,CAAC,MAA0B;QAC1C,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;IACtB,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,kBAAkB;QACpC,MAAM,oBAAoB,GAAG,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,2BAAY,CAAC,YAAY,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC;QACzH,MAAM,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAC1C,CAAC;IAEM,MAAM,CAAC,oBAAoB;QAChC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,2BAAY,CAAC,YAAY,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1F,CAAC;CACF;AAtBD,gEAsBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { LocalizationHelper } from \"@itwin/presentation-common\";\nimport { Presentation } from \"./Presentation\";\n\nconst NAMESPACES = [\"BisCore\", \"ECPresentation\", \"RulesEngine\"];\n\n/** @internal */\nexport class FrontendLocalizationHelper extends LocalizationHelper {\n private _lang: string | undefined;\n constructor(lang?: string) {\n super({ getLocalizedString: (key) => Presentation.localization.getLocalizedString(key, { defaultValue: key, lng: this._lang }) });\n this._lang = lang;\n }\n\n public get locale() {\n return this._lang;\n }\n public set locale(locale: string | undefined) {\n this._lang = locale;\n }\n\n public static async registerNamespaces() {\n const localizationPromises = NAMESPACES.map(async (namespace) => Presentation.localization.registerNamespace(namespace));\n await Promise.all(localizationPromises);\n }\n\n public static unregisterNamespaces() {\n NAMESPACES.map((namespace) => Presentation.localization.unregisterNamespace(namespace));\n }\n}\n"]}
@@ -1,76 +1,76 @@
1
- /** @packageDocumentation
2
- * @module Core
3
- */
4
- import { Localization } from "@itwin/core-common";
5
- import { FavoritePropertiesManager, FavoritePropertiesManagerProps } from "./favorite-properties/FavoritePropertiesManager";
6
- import { PresentationManager, PresentationManagerProps } from "./PresentationManager";
7
- import { SelectionManager, SelectionManagerProps } from "./selection/SelectionManager";
8
- /**
9
- * Props for initializing [[Presentation]].
10
- * @public
11
- */
12
- export interface PresentationProps {
13
- /** Props for [[PresentationManager]]. */
14
- presentation?: PresentationManagerProps;
15
- /** Props for [[SelectionManager]]. */
16
- selection?: SelectionManagerProps;
17
- /** Props for [[FavoritePropertiesManager]]. */
18
- favorites?: FavoritePropertiesManagerProps;
19
- }
20
- /**
21
- * Static class used to statically set up Presentation library for the frontend.
22
- * Basically what it does is:
23
- * - Create a singleton [[PresentationManager]] instance
24
- * - Create a singleton [[SelectionManager]] instance
25
- * - Create a singleton [[FavoritePropertiesManager]]] instance
26
- *
27
- * @public
28
- */
29
- export declare class Presentation {
30
- private constructor();
31
- /**
32
- * Initializes Presentation library for the frontend.
33
- *
34
- * Example:
35
- * ``` ts
36
- * [[include:Presentation.Frontend.Initialization]]
37
- * ```
38
- *
39
- * The method should be called after a call to [IModelApp.startup]($core-frontend).
40
- */
41
- static initialize(props?: PresentationProps): Promise<void>;
42
- /**
43
- * Terminates Presentation library frontend. This method should be called
44
- * before a call to [IModelApp.shutdown]($core-frontend)
45
- */
46
- static terminate(): void;
47
- /**
48
- * Registers an additional handler which will be invoked during Presentation library frontend
49
- * initialization.
50
- *
51
- * @internal
52
- */
53
- static registerInitializationHandler(handler: () => Promise<() => void>): void;
54
- /** The singleton [[PresentationManager]] */
55
- static get presentation(): PresentationManager;
56
- /** @internal */
57
- static setPresentationManager(value: PresentationManager): void;
58
- /** The singleton [[SelectionManager]] */
59
- static get selection(): SelectionManager;
60
- /** @internal */
61
- static setSelectionManager(value: SelectionManager): void;
62
- /**
63
- * The singleton [[FavoritePropertiesManager]]
64
- * @public
65
- */
66
- static get favoriteProperties(): FavoritePropertiesManager;
67
- /** @internal */
68
- static setFavoritePropertiesManager(value: FavoritePropertiesManager): void;
69
- /**
70
- * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.
71
- */
72
- static get localization(): Localization;
73
- /** @internal */
74
- static setLocalization(value: Localization): void;
75
- }
1
+ /** @packageDocumentation
2
+ * @module Core
3
+ */
4
+ import { Localization } from "@itwin/core-common";
5
+ import { FavoritePropertiesManager, FavoritePropertiesManagerProps } from "./favorite-properties/FavoritePropertiesManager";
6
+ import { PresentationManager, PresentationManagerProps } from "./PresentationManager";
7
+ import { SelectionManager, SelectionManagerProps } from "./selection/SelectionManager";
8
+ /**
9
+ * Props for initializing [[Presentation]].
10
+ * @public
11
+ */
12
+ export interface PresentationProps {
13
+ /** Props for [[PresentationManager]]. */
14
+ presentation?: PresentationManagerProps;
15
+ /** Props for [[SelectionManager]]. */
16
+ selection?: SelectionManagerProps;
17
+ /** Props for [[FavoritePropertiesManager]]. */
18
+ favorites?: FavoritePropertiesManagerProps;
19
+ }
20
+ /**
21
+ * Static class used to statically set up Presentation library for the frontend.
22
+ * Basically what it does is:
23
+ * - Create a singleton [[PresentationManager]] instance
24
+ * - Create a singleton [[SelectionManager]] instance
25
+ * - Create a singleton [[FavoritePropertiesManager]]] instance
26
+ *
27
+ * @public
28
+ */
29
+ export declare class Presentation {
30
+ private constructor();
31
+ /**
32
+ * Initializes Presentation library for the frontend.
33
+ *
34
+ * Example:
35
+ * ``` ts
36
+ * [[include:Presentation.Frontend.Initialization]]
37
+ * ```
38
+ *
39
+ * The method should be called after a call to [IModelApp.startup]($core-frontend).
40
+ */
41
+ static initialize(props?: PresentationProps): Promise<void>;
42
+ /**
43
+ * Terminates Presentation library frontend. This method should be called
44
+ * before a call to [IModelApp.shutdown]($core-frontend)
45
+ */
46
+ static terminate(): void;
47
+ /**
48
+ * Registers an additional handler which will be invoked during Presentation library frontend
49
+ * initialization.
50
+ *
51
+ * @internal
52
+ */
53
+ static registerInitializationHandler(handler: () => Promise<() => void>): void;
54
+ /** The singleton [[PresentationManager]] */
55
+ static get presentation(): PresentationManager;
56
+ /** @internal */
57
+ static setPresentationManager(value: PresentationManager): void;
58
+ /** The singleton [[SelectionManager]] */
59
+ static get selection(): SelectionManager;
60
+ /** @internal */
61
+ static setSelectionManager(value: SelectionManager): void;
62
+ /**
63
+ * The singleton [[FavoritePropertiesManager]]
64
+ * @public
65
+ */
66
+ static get favoriteProperties(): FavoritePropertiesManager;
67
+ /** @internal */
68
+ static setFavoritePropertiesManager(value: FavoritePropertiesManager): void;
69
+ /**
70
+ * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.
71
+ */
72
+ static get localization(): Localization;
73
+ /** @internal */
74
+ static setLocalization(value: Localization): void;
75
+ }
76
76
  //# sourceMappingURL=Presentation.d.ts.map
@@ -1,163 +1,163 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module Core
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.Presentation = void 0;
11
- const core_frontend_1 = require("@itwin/core-frontend");
12
- const presentation_common_1 = require("@itwin/presentation-common");
13
- const FavoritePropertiesManager_1 = require("./favorite-properties/FavoritePropertiesManager");
14
- const FavoritePropertiesStorage_1 = require("./favorite-properties/FavoritePropertiesStorage");
15
- const LocalizationHelper_1 = require("./LocalizationHelper");
16
- const PresentationManager_1 = require("./PresentationManager");
17
- const SelectionManager_1 = require("./selection/SelectionManager");
18
- const SelectionScopesManager_1 = require("./selection/SelectionScopesManager");
19
- let localization;
20
- let presentationManager;
21
- let selectionManager;
22
- let favoritePropertiesManager;
23
- const initializationHandlers = [];
24
- const terminationHandlers = [];
25
- /**
26
- * Static class used to statically set up Presentation library for the frontend.
27
- * Basically what it does is:
28
- * - Create a singleton [[PresentationManager]] instance
29
- * - Create a singleton [[SelectionManager]] instance
30
- * - Create a singleton [[FavoritePropertiesManager]]] instance
31
- *
32
- * @public
33
- */
34
- class Presentation {
35
- /* istanbul ignore next */
36
- constructor() { }
37
- /**
38
- * Initializes Presentation library for the frontend.
39
- *
40
- * Example:
41
- * ``` ts
42
- * [[include:Presentation.Frontend.Initialization]]
43
- * ```
44
- *
45
- * The method should be called after a call to [IModelApp.startup]($core-frontend).
46
- */
47
- static async initialize(props) {
48
- var _a, _b;
49
- if (!core_frontend_1.IModelApp.initialized) {
50
- throw new presentation_common_1.PresentationError(presentation_common_1.PresentationStatus.NotInitialized, "IModelApp.startup must be called before calling Presentation.initialize");
51
- }
52
- if (!localization) {
53
- localization = core_frontend_1.IModelApp.localization;
54
- }
55
- if (!presentationManager) {
56
- const managerProps = (_a = props === null || props === void 0 ? void 0 : props.presentation) !== null && _a !== void 0 ? _a : {};
57
- if (!managerProps.activeLocale) {
58
- const languages = Presentation.localization.getLanguageList();
59
- managerProps.activeLocale = (languages.length ? languages[0] : undefined);
60
- }
61
- presentationManager = PresentationManager_1.PresentationManager.create(managerProps);
62
- }
63
- if (!selectionManager) {
64
- selectionManager = new SelectionManager_1.SelectionManager((_b = props === null || props === void 0 ? void 0 : props.selection) !== null && _b !== void 0 ? _b : {
65
- scopes: new SelectionScopesManager_1.SelectionScopesManager({
66
- rpcRequestsHandler: presentationManager.rpcRequestsHandler,
67
- localeProvider: () => this.presentation.activeLocale,
68
- }),
69
- });
70
- }
71
- if (!favoritePropertiesManager) {
72
- favoritePropertiesManager = new FavoritePropertiesManager_1.FavoritePropertiesManager({
73
- storage: (props === null || props === void 0 ? void 0 : props.favorites) ? props.favorites.storage : (0, FavoritePropertiesStorage_1.createFavoritePropertiesStorage)(FavoritePropertiesStorage_1.DefaultFavoritePropertiesStorageTypes.Noop),
74
- });
75
- }
76
- // eslint-disable-next-line @typescript-eslint/unbound-method
77
- presentationManager.onNewiModelConnection = favoritePropertiesManager.initializeConnection.bind(favoritePropertiesManager);
78
- await LocalizationHelper_1.LocalizationHelper.registerNamespaces();
79
- for (const handler of initializationHandlers) {
80
- const cleanup = await handler();
81
- if (cleanup)
82
- terminationHandlers.push(cleanup);
83
- }
84
- }
85
- /**
86
- * Terminates Presentation library frontend. This method should be called
87
- * before a call to [IModelApp.shutdown]($core-frontend)
88
- */
89
- static terminate() {
90
- terminationHandlers.forEach((handler) => handler());
91
- terminationHandlers.length = 0;
92
- if (localization)
93
- LocalizationHelper_1.LocalizationHelper.unregisterNamespaces();
94
- if (presentationManager)
95
- presentationManager.dispose();
96
- presentationManager = undefined;
97
- if (favoritePropertiesManager)
98
- favoritePropertiesManager.dispose();
99
- favoritePropertiesManager = undefined;
100
- selectionManager = undefined;
101
- localization = undefined;
102
- }
103
- /**
104
- * Registers an additional handler which will be invoked during Presentation library frontend
105
- * initialization.
106
- *
107
- * @internal
108
- */
109
- static registerInitializationHandler(handler) {
110
- initializationHandlers.push(handler);
111
- }
112
- /** The singleton [[PresentationManager]] */
113
- static get presentation() {
114
- if (!presentationManager)
115
- throw new Error("Presentation must be first initialized by calling Presentation.initialize");
116
- return presentationManager;
117
- }
118
- /** @internal */
119
- static setPresentationManager(value) {
120
- if (presentationManager)
121
- presentationManager.dispose();
122
- presentationManager = value;
123
- }
124
- /** The singleton [[SelectionManager]] */
125
- static get selection() {
126
- if (!selectionManager)
127
- throw new Error("Presentation must be first initialized by calling Presentation.initialize");
128
- return selectionManager;
129
- }
130
- /** @internal */
131
- static setSelectionManager(value) {
132
- selectionManager = value;
133
- }
134
- /**
135
- * The singleton [[FavoritePropertiesManager]]
136
- * @public
137
- */
138
- static get favoriteProperties() {
139
- if (!favoritePropertiesManager)
140
- throw new Error("Favorite Properties must be first initialized by calling Presentation.initialize");
141
- return favoritePropertiesManager;
142
- }
143
- /** @internal */
144
- static setFavoritePropertiesManager(value) {
145
- if (favoritePropertiesManager)
146
- favoritePropertiesManager.dispose();
147
- favoritePropertiesManager = value;
148
- }
149
- /**
150
- * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.
151
- */
152
- static get localization() {
153
- if (!localization)
154
- throw new Error("Presentation must be first initialized by calling Presentation.initialize");
155
- return localization;
156
- }
157
- /** @internal */
158
- static setLocalization(value) {
159
- localization = value;
160
- }
161
- }
162
- exports.Presentation = Presentation;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Core
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.Presentation = void 0;
11
+ const core_frontend_1 = require("@itwin/core-frontend");
12
+ const presentation_common_1 = require("@itwin/presentation-common");
13
+ const FavoritePropertiesManager_1 = require("./favorite-properties/FavoritePropertiesManager");
14
+ const FavoritePropertiesStorage_1 = require("./favorite-properties/FavoritePropertiesStorage");
15
+ const LocalizationHelper_1 = require("./LocalizationHelper");
16
+ const PresentationManager_1 = require("./PresentationManager");
17
+ const SelectionManager_1 = require("./selection/SelectionManager");
18
+ const SelectionScopesManager_1 = require("./selection/SelectionScopesManager");
19
+ let localization;
20
+ let presentationManager;
21
+ let selectionManager;
22
+ let favoritePropertiesManager;
23
+ const initializationHandlers = [];
24
+ const terminationHandlers = [];
25
+ /**
26
+ * Static class used to statically set up Presentation library for the frontend.
27
+ * Basically what it does is:
28
+ * - Create a singleton [[PresentationManager]] instance
29
+ * - Create a singleton [[SelectionManager]] instance
30
+ * - Create a singleton [[FavoritePropertiesManager]]] instance
31
+ *
32
+ * @public
33
+ */
34
+ class Presentation {
35
+ /* istanbul ignore next */
36
+ constructor() { }
37
+ /**
38
+ * Initializes Presentation library for the frontend.
39
+ *
40
+ * Example:
41
+ * ``` ts
42
+ * [[include:Presentation.Frontend.Initialization]]
43
+ * ```
44
+ *
45
+ * The method should be called after a call to [IModelApp.startup]($core-frontend).
46
+ */
47
+ static async initialize(props) {
48
+ var _a, _b;
49
+ if (!core_frontend_1.IModelApp.initialized) {
50
+ throw new presentation_common_1.PresentationError(presentation_common_1.PresentationStatus.NotInitialized, "IModelApp.startup must be called before calling Presentation.initialize");
51
+ }
52
+ if (!localization) {
53
+ localization = core_frontend_1.IModelApp.localization;
54
+ }
55
+ if (!presentationManager) {
56
+ const managerProps = (_a = props === null || props === void 0 ? void 0 : props.presentation) !== null && _a !== void 0 ? _a : {};
57
+ if (!managerProps.activeLocale) {
58
+ const languages = Presentation.localization.getLanguageList();
59
+ managerProps.activeLocale = (languages.length ? languages[0] : undefined);
60
+ }
61
+ presentationManager = PresentationManager_1.PresentationManager.create(managerProps);
62
+ }
63
+ if (!selectionManager) {
64
+ selectionManager = new SelectionManager_1.SelectionManager((_b = props === null || props === void 0 ? void 0 : props.selection) !== null && _b !== void 0 ? _b : {
65
+ scopes: new SelectionScopesManager_1.SelectionScopesManager({
66
+ rpcRequestsHandler: presentationManager.rpcRequestsHandler,
67
+ localeProvider: () => this.presentation.activeLocale,
68
+ }),
69
+ });
70
+ }
71
+ if (!favoritePropertiesManager) {
72
+ favoritePropertiesManager = new FavoritePropertiesManager_1.FavoritePropertiesManager({
73
+ storage: (props === null || props === void 0 ? void 0 : props.favorites) ? props.favorites.storage : (0, FavoritePropertiesStorage_1.createFavoritePropertiesStorage)(FavoritePropertiesStorage_1.DefaultFavoritePropertiesStorageTypes.Noop),
74
+ });
75
+ }
76
+ // eslint-disable-next-line @typescript-eslint/unbound-method
77
+ presentationManager.onNewiModelConnection = favoritePropertiesManager.initializeConnection.bind(favoritePropertiesManager);
78
+ await LocalizationHelper_1.FrontendLocalizationHelper.registerNamespaces();
79
+ for (const handler of initializationHandlers) {
80
+ const cleanup = await handler();
81
+ if (cleanup)
82
+ terminationHandlers.push(cleanup);
83
+ }
84
+ }
85
+ /**
86
+ * Terminates Presentation library frontend. This method should be called
87
+ * before a call to [IModelApp.shutdown]($core-frontend)
88
+ */
89
+ static terminate() {
90
+ terminationHandlers.forEach((handler) => handler());
91
+ terminationHandlers.length = 0;
92
+ if (localization)
93
+ LocalizationHelper_1.FrontendLocalizationHelper.unregisterNamespaces();
94
+ if (presentationManager)
95
+ presentationManager.dispose();
96
+ presentationManager = undefined;
97
+ if (favoritePropertiesManager)
98
+ favoritePropertiesManager.dispose();
99
+ favoritePropertiesManager = undefined;
100
+ selectionManager = undefined;
101
+ localization = undefined;
102
+ }
103
+ /**
104
+ * Registers an additional handler which will be invoked during Presentation library frontend
105
+ * initialization.
106
+ *
107
+ * @internal
108
+ */
109
+ static registerInitializationHandler(handler) {
110
+ initializationHandlers.push(handler);
111
+ }
112
+ /** The singleton [[PresentationManager]] */
113
+ static get presentation() {
114
+ if (!presentationManager)
115
+ throw new Error("Presentation must be first initialized by calling Presentation.initialize");
116
+ return presentationManager;
117
+ }
118
+ /** @internal */
119
+ static setPresentationManager(value) {
120
+ if (presentationManager)
121
+ presentationManager.dispose();
122
+ presentationManager = value;
123
+ }
124
+ /** The singleton [[SelectionManager]] */
125
+ static get selection() {
126
+ if (!selectionManager)
127
+ throw new Error("Presentation must be first initialized by calling Presentation.initialize");
128
+ return selectionManager;
129
+ }
130
+ /** @internal */
131
+ static setSelectionManager(value) {
132
+ selectionManager = value;
133
+ }
134
+ /**
135
+ * The singleton [[FavoritePropertiesManager]]
136
+ * @public
137
+ */
138
+ static get favoriteProperties() {
139
+ if (!favoritePropertiesManager)
140
+ throw new Error("Favorite Properties must be first initialized by calling Presentation.initialize");
141
+ return favoritePropertiesManager;
142
+ }
143
+ /** @internal */
144
+ static setFavoritePropertiesManager(value) {
145
+ if (favoritePropertiesManager)
146
+ favoritePropertiesManager.dispose();
147
+ favoritePropertiesManager = value;
148
+ }
149
+ /**
150
+ * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.
151
+ */
152
+ static get localization() {
153
+ if (!localization)
154
+ throw new Error("Presentation must be first initialized by calling Presentation.initialize");
155
+ return localization;
156
+ }
157
+ /** @internal */
158
+ static setLocalization(value) {
159
+ localization = value;
160
+ }
161
+ }
162
+ exports.Presentation = Presentation;
163
163
  //# sourceMappingURL=Presentation.js.map