@babylonjs/viewer 5.0.0-rc.4 → 5.0.2

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 (192) hide show
  1. package/configuration/configuration.d.ts +107 -107
  2. package/configuration/configuration.js +15 -15
  3. package/configuration/configuration.js.map +1 -1
  4. package/configuration/configurationCompatibility.d.ts +8 -8
  5. package/configuration/configurationCompatibility.js +65 -65
  6. package/configuration/configurationCompatibility.js.map +1 -1
  7. package/configuration/configurationContainer.d.ts +10 -10
  8. package/configuration/configurationContainer.js +9 -9
  9. package/configuration/configurationContainer.js.map +1 -1
  10. package/configuration/globals.d.ts +6 -6
  11. package/configuration/globals.js +17 -17
  12. package/configuration/globals.js.map +1 -1
  13. package/configuration/index.d.ts +2 -2
  14. package/configuration/index.js +3 -2
  15. package/configuration/index.js.map +1 -1
  16. package/configuration/interfaces/cameraConfiguration.d.ts +31 -31
  17. package/configuration/interfaces/cameraConfiguration.js +1 -1
  18. package/configuration/interfaces/cameraConfiguration.js.map +1 -1
  19. package/configuration/interfaces/colorGradingConfiguration.d.ts +81 -81
  20. package/configuration/interfaces/colorGradingConfiguration.js +1 -1
  21. package/configuration/interfaces/colorGradingConfiguration.js.map +1 -1
  22. package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +20 -20
  23. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +1 -1
  24. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js.map +1 -1
  25. package/configuration/interfaces/environmentMapConfiguration.d.ts +22 -22
  26. package/configuration/interfaces/environmentMapConfiguration.js +1 -1
  27. package/configuration/interfaces/environmentMapConfiguration.js.map +1 -1
  28. package/configuration/interfaces/groundConfiguration.d.ts +24 -24
  29. package/configuration/interfaces/groundConfiguration.js +1 -1
  30. package/configuration/interfaces/groundConfiguration.js.map +1 -1
  31. package/configuration/interfaces/imageProcessingConfiguration.d.ts +43 -43
  32. package/configuration/interfaces/imageProcessingConfiguration.js +1 -1
  33. package/configuration/interfaces/imageProcessingConfiguration.js.map +1 -1
  34. package/configuration/interfaces/index.d.ts +15 -15
  35. package/configuration/interfaces/index.js +15 -15
  36. package/configuration/interfaces/index.js.map +1 -1
  37. package/configuration/interfaces/lightConfiguration.d.ts +60 -60
  38. package/configuration/interfaces/lightConfiguration.js +1 -1
  39. package/configuration/interfaces/lightConfiguration.js.map +1 -1
  40. package/configuration/interfaces/modelAnimationConfiguration.d.ts +26 -26
  41. package/configuration/interfaces/modelAnimationConfiguration.js +1 -1
  42. package/configuration/interfaces/modelAnimationConfiguration.js.map +1 -1
  43. package/configuration/interfaces/modelConfiguration.d.ts +65 -65
  44. package/configuration/interfaces/modelConfiguration.js +1 -1
  45. package/configuration/interfaces/modelConfiguration.js.map +1 -1
  46. package/configuration/interfaces/observersConfiguration.d.ts +5 -5
  47. package/configuration/interfaces/observersConfiguration.js +1 -1
  48. package/configuration/interfaces/observersConfiguration.js.map +1 -1
  49. package/configuration/interfaces/sceneConfiguration.d.ts +48 -48
  50. package/configuration/interfaces/sceneConfiguration.js +1 -1
  51. package/configuration/interfaces/sceneConfiguration.js.map +1 -1
  52. package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +23 -23
  53. package/configuration/interfaces/sceneOptimizerConfiguration.js +1 -1
  54. package/configuration/interfaces/sceneOptimizerConfiguration.js.map +1 -1
  55. package/configuration/interfaces/skyboxConfiguration.d.ts +21 -21
  56. package/configuration/interfaces/skyboxConfiguration.js +1 -1
  57. package/configuration/interfaces/skyboxConfiguration.js.map +1 -1
  58. package/configuration/interfaces/templateConfiguration.d.ts +67 -67
  59. package/configuration/interfaces/templateConfiguration.js +1 -1
  60. package/configuration/interfaces/templateConfiguration.js.map +1 -1
  61. package/configuration/interfaces/vrConfiguration.d.ts +16 -16
  62. package/configuration/interfaces/vrConfiguration.js +1 -1
  63. package/configuration/interfaces/vrConfiguration.js.map +1 -1
  64. package/configuration/loader.d.ts +4 -4
  65. package/configuration/loader.js +16 -28
  66. package/configuration/loader.js.map +1 -1
  67. package/configuration/mappers.d.ts +42 -42
  68. package/configuration/mappers.js +190 -189
  69. package/configuration/mappers.js.map +1 -1
  70. package/configuration/renderOnlyLoader.d.ts +33 -33
  71. package/configuration/renderOnlyLoader.js +161 -158
  72. package/configuration/renderOnlyLoader.js.map +1 -1
  73. package/configuration/types/default.d.ts +6 -6
  74. package/configuration/types/default.js +120 -119
  75. package/configuration/types/default.js.map +1 -1
  76. package/configuration/types/environmentMap.d.ts +5 -5
  77. package/configuration/types/environmentMap.js +13 -13
  78. package/configuration/types/environmentMap.js.map +1 -1
  79. package/configuration/types/extended.d.ts +6 -6
  80. package/configuration/types/extended.js +316 -316
  81. package/configuration/types/extended.js.map +1 -1
  82. package/configuration/types/index.d.ts +13 -13
  83. package/configuration/types/index.js +49 -48
  84. package/configuration/types/index.js.map +1 -1
  85. package/configuration/types/minimal.d.ts +6 -6
  86. package/configuration/types/minimal.js +42 -42
  87. package/configuration/types/minimal.js.map +1 -1
  88. package/configuration/types/renderOnlyDefault.d.ts +30 -30
  89. package/configuration/types/renderOnlyDefault.js +30 -30
  90. package/configuration/types/renderOnlyDefault.js.map +1 -1
  91. package/configuration/types/shadowLight.d.ts +9 -9
  92. package/configuration/types/shadowLight.js +63 -63
  93. package/configuration/types/shadowLight.js.map +1 -1
  94. package/helper/index.d.ts +26 -26
  95. package/helper/index.js +62 -56
  96. package/helper/index.js.map +1 -1
  97. package/index.d.ts +30 -30
  98. package/index.js +45 -41
  99. package/index.js.map +1 -1
  100. package/initializer.d.ts +11 -11
  101. package/initializer.js +34 -33
  102. package/initializer.js.map +1 -1
  103. package/interfaces.d.ts +5 -5
  104. package/interfaces.js +1 -1
  105. package/interfaces.js.map +1 -1
  106. package/labs/environmentSerializer.d.ts +126 -126
  107. package/labs/environmentSerializer.js +190 -186
  108. package/labs/environmentSerializer.js.map +1 -1
  109. package/labs/texture.d.ts +183 -184
  110. package/labs/texture.js +300 -297
  111. package/labs/texture.js.map +1 -1
  112. package/labs/viewerLabs.d.ts +51 -51
  113. package/labs/viewerLabs.js +133 -131
  114. package/labs/viewerLabs.js.map +1 -1
  115. package/license.md +71 -0
  116. package/loader/modelLoader.d.ts +47 -44
  117. package/loader/modelLoader.js +189 -182
  118. package/loader/modelLoader.js.map +1 -1
  119. package/loader/plugins/applyMaterialConfig.d.ts +12 -12
  120. package/loader/plugins/applyMaterialConfig.js +15 -15
  121. package/loader/plugins/applyMaterialConfig.js.map +1 -1
  122. package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +9 -9
  123. package/loader/plugins/extendedMaterialLoaderPlugin.js +15 -15
  124. package/loader/plugins/extendedMaterialLoaderPlugin.js.map +1 -1
  125. package/loader/plugins/index.d.ts +18 -17
  126. package/loader/plugins/index.js +42 -41
  127. package/loader/plugins/index.js.map +1 -1
  128. package/loader/plugins/loaderPlugin.d.ts +24 -24
  129. package/loader/plugins/loaderPlugin.js +1 -1
  130. package/loader/plugins/loaderPlugin.js.map +1 -1
  131. package/loader/plugins/msftLodLoaderPlugin.d.ts +12 -12
  132. package/loader/plugins/msftLodLoaderPlugin.js +20 -19
  133. package/loader/plugins/msftLodLoaderPlugin.js.map +1 -1
  134. package/loader/plugins/telemetryLoaderPlugin.d.ts +12 -12
  135. package/loader/plugins/telemetryLoaderPlugin.js +35 -35
  136. package/loader/plugins/telemetryLoaderPlugin.js.map +1 -1
  137. package/managers/observablesManager.d.ts +66 -66
  138. package/managers/observablesManager.js +34 -34
  139. package/managers/observablesManager.js.map +1 -1
  140. package/managers/sceneManager.d.ts +243 -245
  141. package/managers/sceneManager.js +1388 -1387
  142. package/managers/sceneManager.js.map +1 -1
  143. package/managers/telemetryManager.d.ts +57 -57
  144. package/managers/telemetryManager.js +113 -113
  145. package/managers/telemetryManager.js.map +1 -1
  146. package/model/modelAnimation.d.ts +215 -215
  147. package/model/modelAnimation.js +232 -232
  148. package/model/modelAnimation.js.map +1 -1
  149. package/model/viewerModel.d.ts +228 -236
  150. package/model/viewerModel.js +669 -664
  151. package/model/viewerModel.js.map +1 -1
  152. package/optimizer/custom/extended.d.ts +11 -13
  153. package/optimizer/custom/extended.js +98 -100
  154. package/optimizer/custom/extended.js.map +1 -1
  155. package/optimizer/custom/index.d.ts +8 -8
  156. package/optimizer/custom/index.js +24 -24
  157. package/optimizer/custom/index.js.map +1 -1
  158. package/package.json +41 -215
  159. package/readme.md +12 -8
  160. package/renderOnlyIndex.d.ts +11 -11
  161. package/renderOnlyIndex.js +17 -15
  162. package/renderOnlyIndex.js.map +1 -1
  163. package/templating/eventManager.d.ts +35 -35
  164. package/templating/eventManager.js +65 -63
  165. package/templating/eventManager.js.map +1 -1
  166. package/templating/plugins/hdButtonPlugin.d.ts +9 -9
  167. package/templating/plugins/hdButtonPlugin.js +21 -34
  168. package/templating/plugins/hdButtonPlugin.js.map +1 -1
  169. package/templating/plugins/printButton.d.ts +9 -10
  170. package/templating/plugins/printButton.js +40 -53
  171. package/templating/plugins/printButton.js.map +1 -1
  172. package/templating/templateManager.d.ts +190 -189
  173. package/templating/templateManager.js +553 -543
  174. package/templating/templateManager.js.map +1 -1
  175. package/templating/viewerTemplatePlugin.d.ts +21 -21
  176. package/templating/viewerTemplatePlugin.js +68 -68
  177. package/templating/viewerTemplatePlugin.js.map +1 -1
  178. package/viewer/defaultViewer.d.ts +122 -116
  179. package/viewer/defaultViewer.js +665 -670
  180. package/viewer/defaultViewer.js.map +1 -1
  181. package/viewer/renderOnlyViewer.d.ts +8 -8
  182. package/viewer/renderOnlyViewer.js +43 -50
  183. package/viewer/renderOnlyViewer.js.map +1 -1
  184. package/viewer/viewer.d.ts +254 -253
  185. package/viewer/viewer.js +777 -763
  186. package/viewer/viewer.js.map +1 -1
  187. package/viewer/viewerManager.d.ts +55 -55
  188. package/viewer/viewerManager.js +87 -86
  189. package/viewer/viewerManager.js.map +1 -1
  190. package/viewer/viewerWithTemplate.d.ts +9 -9
  191. package/viewer/viewerWithTemplate.js +19 -32
  192. package/viewer/viewerWithTemplate.js.map +1 -1
@@ -1,35 +1,22 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- import { AbstractViewerNavbarButton } from "../viewerTemplatePlugin.js";
17
- var HDButtonPlugin = /** @class */ (function (_super) {
18
- __extends(HDButtonPlugin, _super);
19
- function HDButtonPlugin(_viewer) {
20
- var _this = _super.call(this, "hd", "hd-button", HDButtonPlugin.HtmlTemplate) || this;
21
- _this._viewer = _viewer;
22
- return _this;
23
- }
24
- HDButtonPlugin.prototype.onEvent = function (event) {
25
- var button = event.template.parent.querySelector(".hd-button");
26
- if (button) {
27
- button.classList.contains("hd-toggled") ? button.classList.remove("hd-toggled") : button.classList.add("hd-toggled");
28
- }
29
- this._viewer.toggleHD();
30
- };
31
- HDButtonPlugin.HtmlTemplate = "\n{{#unless hideHd}}\n<style>\n.hd-icon:after {\n font-size: 16px;\n content: \"\\F765\";\n}\n\n.hd-toggled span.hd-icon:after {\n content: \"\\F766\";\n}\n</style>\n<button class=\"hd-button\" title=\"{{text.hdButton}}\">\n <span class=\"icon hd-icon\"></span>\n </button>\n {{/unless}}\n";
32
- return HDButtonPlugin;
33
- }(AbstractViewerNavbarButton));
34
- export { HDButtonPlugin };
1
+ import { __extends } from "tslib";
2
+ import { AbstractViewerNavbarButton } from "../viewerTemplatePlugin.js";
3
+ var HDButtonPlugin = /** @class */ (function (_super) {
4
+ __extends(HDButtonPlugin, _super);
5
+ function HDButtonPlugin(_viewer) {
6
+ var _this = _super.call(this, "hd", "hd-button", HDButtonPlugin.HtmlTemplate) || this;
7
+ _this._viewer = _viewer;
8
+ return _this;
9
+ }
10
+ HDButtonPlugin.prototype.onEvent = function (event) {
11
+ var button = event.template.parent.querySelector(".hd-button");
12
+ if (button) {
13
+ button.classList.contains("hd-toggled") ? button.classList.remove("hd-toggled") : button.classList.add("hd-toggled");
14
+ }
15
+ this._viewer.toggleHD();
16
+ };
17
+ // eslint-disable-next-line @typescript-eslint/naming-convention
18
+ HDButtonPlugin.HtmlTemplate = "\n{{#unless hideHd}}\n<style>\n.hd-icon:after {\n font-size: 16px;\n content: \"\\F765\";\n}\n\n.hd-toggled span.hd-icon:after {\n content: \"\\F766\";\n}\n</style>\n<button class=\"hd-button\" title=\"{{text.hdButton}}\">\n <span class=\"icon hd-icon\"></span>\n </button>\n {{/unless}}\n";
19
+ return HDButtonPlugin;
20
+ }(AbstractViewerNavbarButton));
21
+ export { HDButtonPlugin };
35
22
  //# sourceMappingURL=hdButtonPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hdButtonPlugin.js","sourceRoot":"","sources":["../../../../../sourceES6/viewer/src/templating/plugins/hdButtonPlugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAIrE;IAAoC,kCAA0B;IAE1D,wBAAoB,OAAsB;QAA1C,YACI,kBAAM,IAAI,EAAE,WAAW,EAAE,cAAc,CAAC,YAAY,CAAC,SACxD;QAFmB,aAAO,GAAP,OAAO,CAAe;;IAE1C,CAAC;IAED,gCAAO,GAAP,UAAQ,KAAoB;QACxB,IAAI,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QAC/D,IAAI,MAAM,EAAE;YACR,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;SACxH;QACD,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC5B,CAAC;IAEgB,2BAAY,GAAW,gTAgB3C,CAAC;IACF,qBAAC;CAAA,AA/BD,CAAoC,0BAA0B,GA+B7D;SA/BY,cAAc","sourcesContent":["import { AbstractViewerNavbarButton } from \"../viewerTemplatePlugin\";\r\nimport { DefaultViewer } from \"../../viewer/defaultViewer\";\r\nimport { EventCallback, Template } from \"../templateManager\";\r\n\r\nexport class HDButtonPlugin extends AbstractViewerNavbarButton {\r\n\r\n constructor(private _viewer: DefaultViewer) {\r\n super(\"hd\", \"hd-button\", HDButtonPlugin.HtmlTemplate);\r\n }\r\n\r\n onEvent(event: EventCallback): void {\r\n let button = event.template.parent.querySelector(\".hd-button\");\r\n if (button) {\r\n button.classList.contains(\"hd-toggled\") ? button.classList.remove(\"hd-toggled\") : button.classList.add(\"hd-toggled\");\r\n }\r\n this._viewer.toggleHD();\r\n }\r\n\r\n protected static HtmlTemplate: string = `\r\n{{#unless hideHd}}\r\n<style>\r\n.hd-icon:after {\r\n font-size: 16px;\r\n content: \"\\\\F765\";\r\n}\r\n\r\n.hd-toggled span.hd-icon:after {\r\n content: \"\\\\F766\";\r\n}\r\n</style>\r\n<button class=\"hd-button\" title=\"{{text.hdButton}}\">\r\n <span class=\"icon hd-icon\"></span>\r\n </button>\r\n {{/unless}}\r\n`;\r\n}"]}
1
+ {"version":3,"file":"hdButtonPlugin.js","sourceRoot":"","sources":["../../../../../../tools/viewer/src/templating/plugins/hdButtonPlugin.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAIrE;IAAoC,kCAA0B;IAC1D,wBAAoB,OAAsB;QAA1C,YACI,kBAAM,IAAI,EAAE,WAAW,EAAE,cAAc,CAAC,YAAY,CAAC,SACxD;QAFmB,aAAO,GAAP,OAAO,CAAe;;IAE1C,CAAC;IAED,gCAAO,GAAP,UAAQ,KAAoB;QACxB,IAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QACjE,IAAI,MAAM,EAAE;YACR,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;SACxH;QACD,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC5B,CAAC;IAED,gEAAgE;IAC/C,2BAAY,GAAW,gTAgB3C,CAAC;IACF,qBAAC;CAAA,AA/BD,CAAoC,0BAA0B,GA+B7D;SA/BY,cAAc","sourcesContent":["import { AbstractViewerNavbarButton } from \"../viewerTemplatePlugin\";\r\nimport type { DefaultViewer } from \"../../viewer/defaultViewer\";\r\nimport type { EventCallback } from \"../templateManager\";\r\n\r\nexport class HDButtonPlugin extends AbstractViewerNavbarButton {\r\n constructor(private _viewer: DefaultViewer) {\r\n super(\"hd\", \"hd-button\", HDButtonPlugin.HtmlTemplate);\r\n }\r\n\r\n onEvent(event: EventCallback): void {\r\n const button = event.template.parent.querySelector(\".hd-button\");\r\n if (button) {\r\n button.classList.contains(\"hd-toggled\") ? button.classList.remove(\"hd-toggled\") : button.classList.add(\"hd-toggled\");\r\n }\r\n this._viewer.toggleHD();\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected static HtmlTemplate: string = `\r\n{{#unless hideHd}}\r\n<style>\r\n.hd-icon:after {\r\n font-size: 16px;\r\n content: \"\\\\F765\";\r\n}\r\n\r\n.hd-toggled span.hd-icon:after {\r\n content: \"\\\\F766\";\r\n}\r\n</style>\r\n<button class=\"hd-button\" title=\"{{text.hdButton}}\">\r\n <span class=\"icon hd-icon\"></span>\r\n </button>\r\n {{/unless}}\r\n`;\r\n}\r\n"]}
@@ -1,10 +1,9 @@
1
- import { AbstractViewerNavbarButton } from "../viewerTemplatePlugin";
2
- import { DefaultViewer } from "../../viewer/defaultViewer";
3
- import { EventCallback } from "../templateManager";
4
- export declare class PrintButtonPlugin extends AbstractViewerNavbarButton {
5
- private _viewer;
6
- private _currentModelUrl;
7
- constructor(_viewer: DefaultViewer);
8
- onEvent(event: EventCallback): void;
9
- protected static HtmlTemplate: string;
10
- }
1
+ import { AbstractViewerNavbarButton } from "../viewerTemplatePlugin";
2
+ import type { DefaultViewer } from "../../viewer/defaultViewer";
3
+ export declare class PrintButtonPlugin extends AbstractViewerNavbarButton {
4
+ private _viewer;
5
+ private _currentModelUrl;
6
+ constructor(_viewer: DefaultViewer);
7
+ onEvent(): void;
8
+ protected static HtmlTemplate: string;
9
+ }
@@ -1,54 +1,41 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- import { AbstractViewerNavbarButton } from "../viewerTemplatePlugin.js";
17
- import { Tools } from "@babylonjs/core/Misc/tools.js";
18
- var PrintButtonPlugin = /** @class */ (function (_super) {
19
- __extends(PrintButtonPlugin, _super);
20
- function PrintButtonPlugin(_viewer) {
21
- var _this = _super.call(this, "print", "print-button", PrintButtonPlugin.HtmlTemplate) || this;
22
- _this._viewer = _viewer;
23
- _this._viewer.onModelLoadedObservable.add(function (model) {
24
- _this._currentModelUrl = "";
25
- if (model.configuration.url) {
26
- var filename = Tools.GetFilename(model.configuration.url) || model.configuration.url;
27
- var baseUrl = model.configuration.root || Tools.GetFolderPath(model.configuration.url);
28
- //gltf, obj, stl
29
- var extension_1 = model.configuration.loader || filename.split(".").pop() || "";
30
- var printable_1 = false;
31
- // not using .some sue to IE11
32
- ["gltf", "glb", "obj", "stl"].forEach(function (ext) {
33
- if (extension_1.indexOf(ext) !== -1) {
34
- printable_1 = true;
35
- }
36
- });
37
- if (printable_1) {
38
- _this._currentModelUrl = baseUrl + filename;
39
- }
40
- }
41
- });
42
- return _this;
43
- }
44
- PrintButtonPlugin.prototype.onEvent = function (event) {
45
- if (this._currentModelUrl) {
46
- var printUrl = this._currentModelUrl.replace(/https?:\/\//, "com.microsoft.builder3d://");
47
- window.open(printUrl, "_self");
48
- }
49
- };
50
- PrintButtonPlugin.HtmlTemplate = "\n{{#unless hidePrint}}\n<style>\n\n/* Show only if it's a windows 10 printer */\n.print-icon.not-win-10 {\n display: none;\n}\n\n.print-icon:after {\n font-size: 16px;\n content: \"\\E914\";\n}\n\n</style>\n<button class=\"print-button ".concat(window.navigator.userAgent.indexOf("Windows NT 10.0") === -1 ? "no-win-10" : "", "\" title=\"{{text.printButton}}\">\n <span class=\"icon print-icon\"></span>\n </button>\n {{/unless}}\n");
51
- return PrintButtonPlugin;
52
- }(AbstractViewerNavbarButton));
53
- export { PrintButtonPlugin };
1
+ import { __extends } from "tslib";
2
+ import { AbstractViewerNavbarButton } from "../viewerTemplatePlugin.js";
3
+ import { Tools } from "@babylonjs/core/Misc/tools.js";
4
+ var PrintButtonPlugin = /** @class */ (function (_super) {
5
+ __extends(PrintButtonPlugin, _super);
6
+ function PrintButtonPlugin(_viewer) {
7
+ var _this = _super.call(this, "print", "print-button", PrintButtonPlugin.HtmlTemplate) || this;
8
+ _this._viewer = _viewer;
9
+ _this._viewer.onModelLoadedObservable.add(function (model) {
10
+ _this._currentModelUrl = "";
11
+ if (model.configuration.url) {
12
+ var filename = Tools.GetFilename(model.configuration.url) || model.configuration.url;
13
+ var baseUrl = model.configuration.root || Tools.GetFolderPath(model.configuration.url);
14
+ //gltf, obj, stl
15
+ var extension_1 = model.configuration.loader || filename.split(".").pop() || "";
16
+ var printable_1 = false;
17
+ // not using .some sue to IE11
18
+ ["gltf", "glb", "obj", "stl"].forEach(function (ext) {
19
+ if (extension_1.indexOf(ext) !== -1) {
20
+ printable_1 = true;
21
+ }
22
+ });
23
+ if (printable_1) {
24
+ _this._currentModelUrl = baseUrl + filename;
25
+ }
26
+ }
27
+ });
28
+ return _this;
29
+ }
30
+ PrintButtonPlugin.prototype.onEvent = function () {
31
+ if (this._currentModelUrl) {
32
+ var printUrl = this._currentModelUrl.replace(/https?:\/\//, "com.microsoft.builder3d://");
33
+ window.open(printUrl, "_self");
34
+ }
35
+ };
36
+ // eslint-disable-next-line @typescript-eslint/naming-convention
37
+ PrintButtonPlugin.HtmlTemplate = "\n{{#unless hidePrint}}\n<style>\n\n/* Show only if it's a windows 10 printer */\n.print-icon.not-win-10 {\n display: none;\n}\n\n.print-icon:after {\n font-size: 16px;\n content: \"\\E914\";\n}\n\n</style>\n<button class=\"print-button ".concat(window.navigator.userAgent.indexOf("Windows NT 10.0") === -1 ? "no-win-10" : "", "\" title=\"{{text.printButton}}\">\n <span class=\"icon print-icon\"></span>\n </button>\n {{/unless}}\n");
38
+ return PrintButtonPlugin;
39
+ }(AbstractViewerNavbarButton));
40
+ export { PrintButtonPlugin };
54
41
  //# sourceMappingURL=printButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"printButton.js","sourceRoot":"","sources":["../../../../../sourceES6/viewer/src/templating/plugins/printButton.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAGrE,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAEnD;IAAuC,qCAA0B;IAI7D,2BAAoB,OAAsB;QAA1C,YACI,kBAAM,OAAO,EAAE,cAAc,EAAE,iBAAiB,CAAC,YAAY,CAAC,SAsBjE;QAvBmB,aAAO,GAAP,OAAO,CAAe;QAGtC,KAAI,CAAC,OAAO,CAAC,uBAAuB,CAAC,GAAG,CAAC,UAAC,KAAK;YAC3C,KAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;YAC3B,IAAI,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE;gBACzB,IAAI,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC;gBACrF,IAAI,OAAO,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,IAAI,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;gBAEvF,gBAAgB;gBAChB,IAAI,WAAS,GAAG,KAAK,CAAC,aAAa,CAAC,MAAM,IAAI,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;gBAC9E,IAAI,WAAS,GAAG,KAAK,CAAC;gBACtB,8BAA8B;gBAC9B,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;oBACtC,IAAI,WAAS,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;wBAC/B,WAAS,GAAG,IAAI,CAAC;qBACpB;gBACL,CAAC,CAAC,CAAC;gBACH,IAAI,WAAS,EAAE;oBACX,KAAI,CAAC,gBAAgB,GAAG,OAAO,GAAG,QAAQ,CAAC;iBAC9C;aACJ;QACL,CAAC,CAAC,CAAC;;IACP,CAAC;IAED,mCAAO,GAAP,UAAQ,KAAoB;QACxB,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,IAAI,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,aAAa,EAAE,4BAA4B,CAAC,CAAC;YAC1F,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;SAClC;IACL,CAAC;IAEgB,8BAAY,GAAW,iQAed,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,iHAI5G,CAAC;IACF,wBAAC;CAAA,AAxDD,CAAuC,0BAA0B,GAwDhE;SAxDY,iBAAiB","sourcesContent":["import { AbstractViewerNavbarButton } from \"../viewerTemplatePlugin\";\r\nimport { DefaultViewer } from \"../../viewer/defaultViewer\";\r\nimport { EventCallback } from \"../templateManager\";\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\n\r\nexport class PrintButtonPlugin extends AbstractViewerNavbarButton {\r\n\r\n private _currentModelUrl: string;\r\n\r\n constructor(private _viewer: DefaultViewer) {\r\n super(\"print\", \"print-button\", PrintButtonPlugin.HtmlTemplate);\r\n\r\n this._viewer.onModelLoadedObservable.add((model) => {\r\n this._currentModelUrl = \"\";\r\n if (model.configuration.url) {\r\n let filename = Tools.GetFilename(model.configuration.url) || model.configuration.url;\r\n let baseUrl = model.configuration.root || Tools.GetFolderPath(model.configuration.url);\r\n\r\n //gltf, obj, stl\r\n let extension = model.configuration.loader || filename.split(\".\").pop() || \"\";\r\n let printable = false;\r\n // not using .some sue to IE11\r\n [\"gltf\", \"glb\", \"obj\", \"stl\"].forEach((ext) => {\r\n if (extension.indexOf(ext) !== -1) {\r\n printable = true;\r\n }\r\n });\r\n if (printable) {\r\n this._currentModelUrl = baseUrl + filename;\r\n }\r\n }\r\n });\r\n }\r\n\r\n onEvent(event: EventCallback): void {\r\n if (this._currentModelUrl) {\r\n let printUrl = this._currentModelUrl.replace(/https?:\\/\\//, \"com.microsoft.builder3d://\");\r\n window.open(printUrl, \"_self\");\r\n }\r\n }\r\n\r\n protected static HtmlTemplate: string = `\r\n{{#unless hidePrint}}\r\n<style>\r\n\r\n/* Show only if it's a windows 10 printer */\r\n.print-icon.not-win-10 {\r\n display: none;\r\n}\r\n\r\n.print-icon:after {\r\n font-size: 16px;\r\n content: \"\\\\E914\";\r\n}\r\n\r\n</style>\r\n<button class=\"print-button ${window.navigator.userAgent.indexOf(\"Windows NT 10.0\") === -1 ? \"no-win-10\" : \"\"}\" title=\"{{text.printButton}}\">\r\n <span class=\"icon print-icon\"></span>\r\n </button>\r\n {{/unless}}\r\n`;\r\n}\r\n"]}
1
+ {"version":3,"file":"printButton.js","sourceRoot":"","sources":["../../../../../../tools/viewer/src/templating/plugins/printButton.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,EAAE,KAAK,EAAE,sCAAwB;AAExC;IAAuC,qCAA0B;IAG7D,2BAAoB,OAAsB;QAA1C,YACI,kBAAM,OAAO,EAAE,cAAc,EAAE,iBAAiB,CAAC,YAAY,CAAC,SAsBjE;QAvBmB,aAAO,GAAP,OAAO,CAAe;QAGtC,KAAI,CAAC,OAAO,CAAC,uBAAuB,CAAC,GAAG,CAAC,UAAC,KAAK;YAC3C,KAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;YAC3B,IAAI,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE;gBACzB,IAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC;gBACvF,IAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,IAAI,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;gBAEzF,gBAAgB;gBAChB,IAAM,WAAS,GAAG,KAAK,CAAC,aAAa,CAAC,MAAM,IAAI,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;gBAChF,IAAI,WAAS,GAAG,KAAK,CAAC;gBACtB,8BAA8B;gBAC9B,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;oBACtC,IAAI,WAAS,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;wBAC/B,WAAS,GAAG,IAAI,CAAC;qBACpB;gBACL,CAAC,CAAC,CAAC;gBACH,IAAI,WAAS,EAAE;oBACX,KAAI,CAAC,gBAAgB,GAAG,OAAO,GAAG,QAAQ,CAAC;iBAC9C;aACJ;QACL,CAAC,CAAC,CAAC;;IACP,CAAC;IAED,mCAAO,GAAP;QACI,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,IAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,aAAa,EAAE,4BAA4B,CAAC,CAAC;YAC5F,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;SAClC;IACL,CAAC;IAED,gEAAgE;IAC/C,8BAAY,GAAW,iQAed,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,iHAI5G,CAAC;IACF,wBAAC;CAAA,AAxDD,CAAuC,0BAA0B,GAwDhE;SAxDY,iBAAiB","sourcesContent":["import { AbstractViewerNavbarButton } from \"../viewerTemplatePlugin\";\r\nimport type { DefaultViewer } from \"../../viewer/defaultViewer\";\r\nimport { Tools } from \"core/Misc/tools\";\r\n\r\nexport class PrintButtonPlugin extends AbstractViewerNavbarButton {\r\n private _currentModelUrl: string;\r\n\r\n constructor(private _viewer: DefaultViewer) {\r\n super(\"print\", \"print-button\", PrintButtonPlugin.HtmlTemplate);\r\n\r\n this._viewer.onModelLoadedObservable.add((model) => {\r\n this._currentModelUrl = \"\";\r\n if (model.configuration.url) {\r\n const filename = Tools.GetFilename(model.configuration.url) || model.configuration.url;\r\n const baseUrl = model.configuration.root || Tools.GetFolderPath(model.configuration.url);\r\n\r\n //gltf, obj, stl\r\n const extension = model.configuration.loader || filename.split(\".\").pop() || \"\";\r\n let printable = false;\r\n // not using .some sue to IE11\r\n [\"gltf\", \"glb\", \"obj\", \"stl\"].forEach((ext) => {\r\n if (extension.indexOf(ext) !== -1) {\r\n printable = true;\r\n }\r\n });\r\n if (printable) {\r\n this._currentModelUrl = baseUrl + filename;\r\n }\r\n }\r\n });\r\n }\r\n\r\n onEvent(): void {\r\n if (this._currentModelUrl) {\r\n const printUrl = this._currentModelUrl.replace(/https?:\\/\\//, \"com.microsoft.builder3d://\");\r\n window.open(printUrl, \"_self\");\r\n }\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected static HtmlTemplate: string = `\r\n{{#unless hidePrint}}\r\n<style>\r\n\r\n/* Show only if it's a windows 10 printer */\r\n.print-icon.not-win-10 {\r\n display: none;\r\n}\r\n\r\n.print-icon:after {\r\n font-size: 16px;\r\n content: \"\\\\E914\";\r\n}\r\n\r\n</style>\r\n<button class=\"print-button ${window.navigator.userAgent.indexOf(\"Windows NT 10.0\") === -1 ? \"no-win-10\" : \"\"}\" title=\"{{text.printButton}}\">\r\n <span class=\"icon print-icon\"></span>\r\n </button>\r\n {{/unless}}\r\n`;\r\n}\r\n"]}
@@ -1,189 +1,190 @@
1
- import { Observable } from '@babylonjs/core/Misc/observable';
2
- import { EventManager } from './eventManager';
3
- import { ITemplateConfiguration } from '../configuration/interfaces/templateConfiguration';
4
- /**
5
- * The object sent when an event is triggered
6
- */
7
- export interface EventCallback {
8
- event: Event;
9
- template: Template;
10
- selector: string;
11
- payload?: any;
12
- }
13
- /**
14
- * The template manager, a member of the viewer class, will manage the viewer's templates and generate the HTML.
15
- * The template manager managers a single viewer and can be seen as the collection of all sub-templates of the viewer.
16
- */
17
- export declare class TemplateManager {
18
- containerElement: Element;
19
- /**
20
- * Will be triggered when any template is initialized
21
- */
22
- onTemplateInit: Observable<Template>;
23
- /**
24
- * Will be triggered when any template is fully loaded
25
- */
26
- onTemplateLoaded: Observable<Template>;
27
- /**
28
- * Will be triggered when a template state changes
29
- */
30
- onTemplateStateChange: Observable<Template>;
31
- /**
32
- * Will be triggered when all templates finished loading
33
- */
34
- onAllLoaded: Observable<TemplateManager>;
35
- /**
36
- * Will be triggered when any event on any template is triggered.
37
- */
38
- onEventTriggered: Observable<EventCallback>;
39
- /**
40
- * This template manager's event manager. In charge of callback registrations to native event types
41
- */
42
- eventManager: EventManager;
43
- private templates;
44
- constructor(containerElement: Element);
45
- /**
46
- * Initialize the template(s) for the viewer. Called bay the Viewer class
47
- * @param templates the templates to be used to initialize the main template
48
- */
49
- initTemplate(templates: {
50
- [key: string]: ITemplateConfiguration;
51
- }): Promise<void>;
52
- /**
53
- *
54
- * This function will create a simple map with child-dependencies of the template html tree.
55
- * It will compile each template, check if its children exist in the configuration and will add them if they do.
56
- * It is expected that the main template will be called main!
57
- *
58
- * @param templates
59
- */
60
- private _buildHTMLTree;
61
- /**
62
- * Get the canvas in the template tree.
63
- * There must be one and only one canvas inthe template.
64
- */
65
- getCanvas(): HTMLCanvasElement | null;
66
- /**
67
- * Get a specific template from the template tree
68
- * @param name the name of the template to load
69
- */
70
- getTemplate(name: string): Template | undefined;
71
- private _checkLoadedState;
72
- /**
73
- * Dispose the template manager
74
- */
75
- dispose(): void;
76
- }
77
- /**
78
- * This class represents a single template in the viewer's template tree.
79
- * An example for a template is a single canvas, an overlay (containing sub-templates) or the navigation bar.
80
- * A template is injected using the template manager in the correct position.
81
- * The template is rendered using Handlebars and can use Handlebars' features (such as parameter injection)
82
- *
83
- * For further information please refer to the documentation page, https://doc.babylonjs.com
84
- */
85
- export declare class Template {
86
- name: string;
87
- private _configuration;
88
- /**
89
- * Will be triggered when the template is loaded
90
- */
91
- onLoaded: Observable<Template>;
92
- /**
93
- * will be triggered when the template is appended to the tree
94
- */
95
- onAppended: Observable<Template>;
96
- /**
97
- * Will be triggered when the template's state changed (shown, hidden)
98
- */
99
- onStateChange: Observable<Template>;
100
- /**
101
- * Will be triggered when an event is triggered on ths template.
102
- * The event is a native browser event (like mouse or pointer events)
103
- */
104
- onEventTriggered: Observable<EventCallback>;
105
- onParamsUpdated: Observable<Template>;
106
- onHTMLRendered: Observable<Template>;
107
- /**
108
- * is the template loaded?
109
- */
110
- isLoaded: boolean;
111
- /**
112
- * This is meant to be used to track the show and hide functions.
113
- * This is NOT (!!) a flag to check if the element is actually visible to the user.
114
- */
115
- isShown: boolean;
116
- /**
117
- * Is this template a part of the HTML tree (the template manager injected it)
118
- */
119
- isInHtmlTree: boolean;
120
- /**
121
- * The HTML element containing this template
122
- */
123
- parent: HTMLElement;
124
- /**
125
- * A promise that is fulfilled when the template finished loading.
126
- */
127
- initPromise: Promise<Template>;
128
- private _fragment;
129
- private _addedFragment;
130
- private _htmlTemplate;
131
- private _rawHtml;
132
- private loadRequests;
133
- constructor(name: string, _configuration: ITemplateConfiguration);
134
- /**
135
- * Some templates have parameters (like background color for example).
136
- * The parameters are provided to Handlebars which in turn generates the template.
137
- * This function will update the template with the new parameters
138
- *
139
- * Note that when updating parameters the events will be registered again (after being cleared).
140
- *
141
- * @param params the new template parameters
142
- */
143
- updateParams(params: {
144
- [key: string]: string | number | boolean | object;
145
- }, append?: boolean): void;
146
- redraw(): void;
147
- /**
148
- * Get the template'S configuration
149
- */
150
- get configuration(): ITemplateConfiguration;
151
- /**
152
- * A template can be a parent element for other templates or HTML elements.
153
- * This function will deliver all child HTML elements of this template.
154
- */
155
- getChildElements(): Array<string>;
156
- /**
157
- * Appending the template to a parent HTML element.
158
- * If a parent is already set and you wish to replace the old HTML with new one, forceRemove should be true.
159
- * @param parent the parent to which the template is added
160
- * @param forceRemove if the parent already exists, shoud the template be removed from it?
161
- */
162
- appendTo(parent: HTMLElement, forceRemove?: boolean): void;
163
- private _isShowing;
164
- private _isHiding;
165
- /**
166
- * Show the template using the provided visibilityFunction, or natively using display: flex.
167
- * The provided function returns a promise that should be fullfilled when the element is shown.
168
- * Since it is a promise async operations are more than possible.
169
- * See the default viewer for an opacity example.
170
- * @param visibilityFunction The function to execute to show the template.
171
- */
172
- show(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
173
- /**
174
- * Hide the template using the provided visibilityFunction, or natively using display: none.
175
- * The provided function returns a promise that should be fullfilled when the element is hidden.
176
- * Since it is a promise async operations are more than possible.
177
- * See the default viewer for an opacity example.
178
- * @param visibilityFunction The function to execute to show the template.
179
- */
180
- hide(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
181
- /**
182
- * Dispose this template
183
- */
184
- dispose(): void;
185
- private _getTemplateAsHtml;
186
- private _registeredEvents;
187
- private _registerEvents;
188
- private _getTemplateLocation;
189
- }
1
+ import { Observable } from "@babylonjs/core/Misc/observable.js";
2
+ import { EventManager } from "./eventManager";
3
+ import type { ITemplateConfiguration } from "../configuration/interfaces/templateConfiguration";
4
+ /**
5
+ * The object sent when an event is triggered
6
+ */
7
+ export interface EventCallback {
8
+ event: Event;
9
+ template: Template;
10
+ selector: string;
11
+ payload?: any;
12
+ }
13
+ /**
14
+ * The template manager, a member of the viewer class, will manage the viewer's templates and generate the HTML.
15
+ * The template manager managers a single viewer and can be seen as the collection of all sub-templates of the viewer.
16
+ */
17
+ export declare class TemplateManager {
18
+ containerElement: Element;
19
+ /**
20
+ * Will be triggered when any template is initialized
21
+ */
22
+ onTemplateInit: Observable<Template>;
23
+ /**
24
+ * Will be triggered when any template is fully loaded
25
+ */
26
+ onTemplateLoaded: Observable<Template>;
27
+ /**
28
+ * Will be triggered when a template state changes
29
+ */
30
+ onTemplateStateChange: Observable<Template>;
31
+ /**
32
+ * Will be triggered when all templates finished loading
33
+ */
34
+ onAllLoaded: Observable<TemplateManager>;
35
+ /**
36
+ * Will be triggered when any event on any template is triggered.
37
+ */
38
+ onEventTriggered: Observable<EventCallback>;
39
+ /**
40
+ * This template manager's event manager. In charge of callback registrations to native event types
41
+ */
42
+ eventManager: EventManager;
43
+ private _templates;
44
+ constructor(containerElement: Element);
45
+ /**
46
+ * Initialize the template(s) for the viewer. Called bay the Viewer class
47
+ * @param templates the templates to be used to initialize the main template
48
+ */
49
+ initTemplate(templates: {
50
+ [key: string]: ITemplateConfiguration;
51
+ }): Promise<void>;
52
+ /**
53
+ *
54
+ * This function will create a simple map with child-dependencies of the template html tree.
55
+ * It will compile each template, check if its children exist in the configuration and will add them if they do.
56
+ * It is expected that the main template will be called main!
57
+ *
58
+ * @param templates
59
+ */
60
+ private _buildHTMLTree;
61
+ /**
62
+ * Get the canvas in the template tree.
63
+ * There must be one and only one canvas inthe template.
64
+ */
65
+ getCanvas(): HTMLCanvasElement | null;
66
+ /**
67
+ * Get a specific template from the template tree
68
+ * @param name the name of the template to load
69
+ */
70
+ getTemplate(name: string): Template | undefined;
71
+ private _checkLoadedState;
72
+ /**
73
+ * Dispose the template manager
74
+ */
75
+ dispose(): void;
76
+ }
77
+ /**
78
+ * This class represents a single template in the viewer's template tree.
79
+ * An example for a template is a single canvas, an overlay (containing sub-templates) or the navigation bar.
80
+ * A template is injected using the template manager in the correct position.
81
+ * The template is rendered using Handlebars and can use Handlebars' features (such as parameter injection)
82
+ *
83
+ * For further information please refer to the documentation page, https://doc.babylonjs.com
84
+ */
85
+ export declare class Template {
86
+ name: string;
87
+ private _configuration;
88
+ /**
89
+ * Will be triggered when the template is loaded
90
+ */
91
+ onLoaded: Observable<Template>;
92
+ /**
93
+ * will be triggered when the template is appended to the tree
94
+ */
95
+ onAppended: Observable<Template>;
96
+ /**
97
+ * Will be triggered when the template's state changed (shown, hidden)
98
+ */
99
+ onStateChange: Observable<Template>;
100
+ /**
101
+ * Will be triggered when an event is triggered on ths template.
102
+ * The event is a native browser event (like mouse or pointer events)
103
+ */
104
+ onEventTriggered: Observable<EventCallback>;
105
+ onParamsUpdated: Observable<Template>;
106
+ onHTMLRendered: Observable<Template>;
107
+ /**
108
+ * is the template loaded?
109
+ */
110
+ isLoaded: boolean;
111
+ /**
112
+ * This is meant to be used to track the show and hide functions.
113
+ * This is NOT (!!) a flag to check if the element is actually visible to the user.
114
+ */
115
+ isShown: boolean;
116
+ /**
117
+ * Is this template a part of the HTML tree (the template manager injected it)
118
+ */
119
+ isInHtmlTree: boolean;
120
+ /**
121
+ * The HTML element containing this template
122
+ */
123
+ parent: HTMLElement;
124
+ /**
125
+ * A promise that is fulfilled when the template finished loading.
126
+ */
127
+ initPromise: Promise<Template>;
128
+ private _fragment;
129
+ private _addedFragment;
130
+ private _htmlTemplate;
131
+ private _rawHtml;
132
+ private _loadRequests;
133
+ constructor(name: string, _configuration: ITemplateConfiguration);
134
+ /**
135
+ * Some templates have parameters (like background color for example).
136
+ * The parameters are provided to Handlebars which in turn generates the template.
137
+ * This function will update the template with the new parameters
138
+ *
139
+ * Note that when updating parameters the events will be registered again (after being cleared).
140
+ *
141
+ * @param params the new template parameters
142
+ * @param append
143
+ */
144
+ updateParams(params: {
145
+ [key: string]: string | number | boolean | object;
146
+ }, append?: boolean): void;
147
+ redraw(): void;
148
+ /**
149
+ * Get the template'S configuration
150
+ */
151
+ get configuration(): ITemplateConfiguration;
152
+ /**
153
+ * A template can be a parent element for other templates or HTML elements.
154
+ * This function will deliver all child HTML elements of this template.
155
+ */
156
+ getChildElements(): Array<string>;
157
+ /**
158
+ * Appending the template to a parent HTML element.
159
+ * If a parent is already set and you wish to replace the old HTML with new one, forceRemove should be true.
160
+ * @param parent the parent to which the template is added
161
+ * @param forceRemove if the parent already exists, shoud the template be removed from it?
162
+ */
163
+ appendTo(parent: HTMLElement, forceRemove?: boolean): void;
164
+ private _isShowing;
165
+ private _isHiding;
166
+ /**
167
+ * Show the template using the provided visibilityFunction, or natively using display: flex.
168
+ * The provided function returns a promise that should be fulfilled when the element is shown.
169
+ * Since it is a promise async operations are more than possible.
170
+ * See the default viewer for an opacity example.
171
+ * @param visibilityFunction The function to execute to show the template.
172
+ */
173
+ show(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
174
+ /**
175
+ * Hide the template using the provided visibilityFunction, or natively using display: none.
176
+ * The provided function returns a promise that should be fulfilled when the element is hidden.
177
+ * Since it is a promise async operations are more than possible.
178
+ * See the default viewer for an opacity example.
179
+ * @param visibilityFunction The function to execute to show the template.
180
+ */
181
+ hide(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
182
+ /**
183
+ * Dispose this template
184
+ */
185
+ dispose(): void;
186
+ private _getTemplateAsHtml;
187
+ private _registeredEvents;
188
+ private _registerEvents;
189
+ private _getTemplateLocation;
190
+ }