@babylonjs/viewer 5.0.0-rc.4 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/configuration/configuration.d.ts +13 -13
  2. package/configuration/configuration.js +1 -1
  3. package/configuration/configuration.js.map +1 -1
  4. package/configuration/configurationCompatibility.d.ts +1 -1
  5. package/configuration/configurationCompatibility.js +2 -2
  6. package/configuration/configurationCompatibility.js.map +1 -1
  7. package/configuration/configurationContainer.d.ts +3 -3
  8. package/configuration/configurationContainer.js +1 -1
  9. package/configuration/configurationContainer.js.map +1 -1
  10. package/configuration/globals.d.ts +1 -1
  11. package/configuration/globals.js.map +1 -1
  12. package/configuration/index.d.ts +2 -2
  13. package/configuration/index.js +3 -2
  14. package/configuration/index.js.map +1 -1
  15. package/configuration/interfaces/cameraConfiguration.js.map +1 -1
  16. package/configuration/interfaces/colorGradingConfiguration.js.map +1 -1
  17. package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +1 -1
  18. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js.map +1 -1
  19. package/configuration/interfaces/environmentMapConfiguration.js.map +1 -1
  20. package/configuration/interfaces/groundConfiguration.js.map +1 -1
  21. package/configuration/interfaces/imageProcessingConfiguration.js.map +1 -1
  22. package/configuration/interfaces/index.d.ts +15 -15
  23. package/configuration/interfaces/index.js +15 -15
  24. package/configuration/interfaces/index.js.map +1 -1
  25. package/configuration/interfaces/lightConfiguration.js.map +1 -1
  26. package/configuration/interfaces/modelAnimationConfiguration.js.map +1 -1
  27. package/configuration/interfaces/modelConfiguration.d.ts +1 -1
  28. package/configuration/interfaces/modelConfiguration.js.map +1 -1
  29. package/configuration/interfaces/observersConfiguration.js.map +1 -1
  30. package/configuration/interfaces/sceneConfiguration.d.ts +3 -3
  31. package/configuration/interfaces/sceneConfiguration.js.map +1 -1
  32. package/configuration/interfaces/sceneOptimizerConfiguration.js.map +1 -1
  33. package/configuration/interfaces/skyboxConfiguration.d.ts +1 -1
  34. package/configuration/interfaces/skyboxConfiguration.js.map +1 -1
  35. package/configuration/interfaces/templateConfiguration.js.map +1 -1
  36. package/configuration/interfaces/vrConfiguration.d.ts +1 -1
  37. package/configuration/interfaces/vrConfiguration.js.map +1 -1
  38. package/configuration/loader.js +3 -15
  39. package/configuration/loader.js.map +1 -1
  40. package/configuration/mappers.d.ts +3 -3
  41. package/configuration/mappers.js +13 -12
  42. package/configuration/mappers.js.map +1 -1
  43. package/configuration/renderOnlyLoader.d.ts +1 -1
  44. package/configuration/renderOnlyLoader.js +18 -15
  45. package/configuration/renderOnlyLoader.js.map +1 -1
  46. package/configuration/types/default.d.ts +2 -2
  47. package/configuration/types/default.js +37 -36
  48. package/configuration/types/default.js.map +1 -1
  49. package/configuration/types/environmentMap.d.ts +1 -1
  50. package/configuration/types/environmentMap.js +5 -5
  51. package/configuration/types/environmentMap.js.map +1 -1
  52. package/configuration/types/extended.d.ts +2 -2
  53. package/configuration/types/extended.js +49 -49
  54. package/configuration/types/extended.js.map +1 -1
  55. package/configuration/types/index.d.ts +4 -4
  56. package/configuration/types/index.js +14 -13
  57. package/configuration/types/index.js.map +1 -1
  58. package/configuration/types/minimal.d.ts +2 -2
  59. package/configuration/types/minimal.js +12 -12
  60. package/configuration/types/minimal.js.map +1 -1
  61. package/configuration/types/renderOnlyDefault.d.ts +1 -1
  62. package/configuration/types/renderOnlyDefault.js +8 -8
  63. package/configuration/types/renderOnlyDefault.js.map +1 -1
  64. package/configuration/types/shadowLight.d.ts +1 -1
  65. package/configuration/types/shadowLight.js +12 -12
  66. package/configuration/types/shadowLight.js.map +1 -1
  67. package/helper/index.d.ts +3 -3
  68. package/helper/index.js +14 -8
  69. package/helper/index.js.map +1 -1
  70. package/index.d.ts +20 -20
  71. package/index.js +22 -18
  72. package/index.js.map +1 -1
  73. package/initializer.js +8 -7
  74. package/initializer.js.map +1 -1
  75. package/interfaces.js.map +1 -1
  76. package/labs/environmentSerializer.d.ts +6 -6
  77. package/labs/environmentSerializer.js +18 -14
  78. package/labs/environmentSerializer.js.map +1 -1
  79. package/labs/texture.d.ts +7 -8
  80. package/labs/texture.js +30 -27
  81. package/labs/texture.js.map +1 -1
  82. package/labs/viewerLabs.d.ts +11 -11
  83. package/labs/viewerLabs.js +9 -7
  84. package/labs/viewerLabs.js.map +1 -1
  85. package/license.md +71 -0
  86. package/loader/modelLoader.d.ts +10 -7
  87. package/loader/modelLoader.js +26 -19
  88. package/loader/modelLoader.js.map +1 -1
  89. package/loader/plugins/applyMaterialConfig.d.ts +4 -4
  90. package/loader/plugins/applyMaterialConfig.js.map +1 -1
  91. package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +2 -2
  92. package/loader/plugins/extendedMaterialLoaderPlugin.js +1 -1
  93. package/loader/plugins/extendedMaterialLoaderPlugin.js.map +1 -1
  94. package/loader/plugins/index.d.ts +5 -4
  95. package/loader/plugins/index.js +9 -8
  96. package/loader/plugins/index.js.map +1 -1
  97. package/loader/plugins/loaderPlugin.d.ts +7 -7
  98. package/loader/plugins/loaderPlugin.js.map +1 -1
  99. package/loader/plugins/msftLodLoaderPlugin.d.ts +5 -5
  100. package/loader/plugins/msftLodLoaderPlugin.js +2 -1
  101. package/loader/plugins/msftLodLoaderPlugin.js.map +1 -1
  102. package/loader/plugins/telemetryLoaderPlugin.d.ts +4 -4
  103. package/loader/plugins/telemetryLoaderPlugin.js +4 -4
  104. package/loader/plugins/telemetryLoaderPlugin.js.map +1 -1
  105. package/managers/observablesManager.d.ts +6 -6
  106. package/managers/observablesManager.js +1 -1
  107. package/managers/observablesManager.js.map +1 -1
  108. package/managers/sceneManager.d.ts +28 -30
  109. package/managers/sceneManager.js +96 -95
  110. package/managers/sceneManager.js.map +1 -1
  111. package/managers/telemetryManager.d.ts +6 -6
  112. package/managers/telemetryManager.js +6 -6
  113. package/managers/telemetryManager.js.map +1 -1
  114. package/model/modelAnimation.d.ts +14 -14
  115. package/model/modelAnimation.js +3 -3
  116. package/model/modelAnimation.js.map +1 -1
  117. package/model/viewerModel.d.ts +23 -31
  118. package/model/viewerModel.js +51 -46
  119. package/model/viewerModel.js.map +1 -1
  120. package/optimizer/custom/extended.d.ts +3 -5
  121. package/optimizer/custom/extended.js +3 -5
  122. package/optimizer/custom/extended.js.map +1 -1
  123. package/optimizer/custom/index.d.ts +1 -1
  124. package/optimizer/custom/index.js +1 -1
  125. package/optimizer/custom/index.js.map +1 -1
  126. package/package.json +41 -215
  127. package/readme.md +12 -8
  128. package/renderOnlyIndex.d.ts +10 -10
  129. package/renderOnlyIndex.js +6 -4
  130. package/renderOnlyIndex.js.map +1 -1
  131. package/templating/eventManager.d.ts +1 -1
  132. package/templating/eventManager.js +4 -2
  133. package/templating/eventManager.js.map +1 -1
  134. package/templating/plugins/hdButtonPlugin.d.ts +2 -2
  135. package/templating/plugins/hdButtonPlugin.js +2 -15
  136. package/templating/plugins/hdButtonPlugin.js.map +1 -1
  137. package/templating/plugins/printButton.d.ts +2 -3
  138. package/templating/plugins/printButton.js +3 -16
  139. package/templating/plugins/printButton.js.map +1 -1
  140. package/templating/templateManager.d.ts +8 -7
  141. package/templating/templateManager.js +72 -62
  142. package/templating/templateManager.js.map +1 -1
  143. package/templating/viewerTemplatePlugin.d.ts +1 -1
  144. package/templating/viewerTemplatePlugin.js +4 -4
  145. package/templating/viewerTemplatePlugin.js.map +1 -1
  146. package/viewer/defaultViewer.d.ts +17 -11
  147. package/viewer/defaultViewer.js +116 -121
  148. package/viewer/defaultViewer.js.map +1 -1
  149. package/viewer/renderOnlyViewer.d.ts +2 -2
  150. package/viewer/renderOnlyViewer.js +17 -24
  151. package/viewer/renderOnlyViewer.js.map +1 -1
  152. package/viewer/viewer.d.ts +19 -18
  153. package/viewer/viewer.js +63 -49
  154. package/viewer/viewer.js.map +1 -1
  155. package/viewer/viewerManager.d.ts +5 -5
  156. package/viewer/viewerManager.js +4 -3
  157. package/viewer/viewerManager.js.map +1 -1
  158. package/viewer/viewerWithTemplate.js +2 -15
  159. package/viewer/viewerWithTemplate.js.map +1 -1
@@ -1,5 +1,6 @@
1
- import { Tools } from '@babylonjs/core/Misc/tools.js';
2
- import { kebabToCamel } from '../helper/index.js';
1
+ import { Tools } from "@babylonjs/core/Misc/tools.js";
2
+ // eslint-disable-next-line import/no-internal-modules
3
+ import { kebabToCamel } from "../helper/index.js";
3
4
  /**
4
5
  * This is a simple HTML mapper.
5
6
  * This mapper parses a single HTML element and returns the configuration from its attributes.
@@ -32,7 +33,7 @@ var HTMLMapper = /** @class */ (function () {
32
33
  return "continue";
33
34
  }
34
35
  // map "object.property" to the right configuration place.
35
- var split = attr.nodeName.split('.');
36
+ var split = attr.nodeName.split(".");
36
37
  split.reduce(function (currentConfig, key, idx) {
37
38
  //convert html-style to json-style
38
39
  var camelKey = kebabToCamel(key);
@@ -96,7 +97,7 @@ var DOMMapper = /** @class */ (function () {
96
97
  /**
97
98
  * The mapping function that will convert HTML data to a viewer configuration object
98
99
  * @param baseElement the baseElement from which to start traversing
99
- * @returns a ViewerCOnfiguration object from the provided HTML Element
100
+ * @returns a ViewerConfiguration object from the provided HTML Element
100
101
  */
101
102
  DOMMapper.prototype.map = function (baseElement) {
102
103
  var htmlMapper = new HTMLMapper();
@@ -109,16 +110,16 @@ var DOMMapper = /** @class */ (function () {
109
110
  // use the HTML Mapper to read configuration from a single element
110
111
  var configMapped = htmlMapper.map(item);
111
112
  var key = kebabToCamel(item.nodeName.toLowerCase());
112
- if (item.attributes.getNamedItem('array') && item.attributes.getNamedItem('array').nodeValue === 'true') {
113
+ if (item.attributes.getNamedItem("array") && item.attributes.getNamedItem("array").nodeValue === "true") {
113
114
  partConfig[key] = [];
114
115
  }
115
116
  else {
116
- if (element.attributes.getNamedItem('array') && element.attributes.getNamedItem('array').nodeValue === 'true') {
117
+ if (element.attributes.getNamedItem("array") && element.attributes.getNamedItem("array").nodeValue === "true") {
117
118
  partConfig.push(configMapped);
118
119
  }
119
120
  else if (partConfig[key]) {
120
121
  //exists already! probably an array
121
- element.setAttribute('array', 'true');
122
+ element.setAttribute("array", "true");
122
123
  var oldItem = partConfig[key];
123
124
  partConfig = [oldItem, configMapped];
124
125
  }
@@ -143,9 +144,9 @@ var DOMMapper = /** @class */ (function () {
143
144
  var MapperManager = /** @class */ (function () {
144
145
  function MapperManager() {
145
146
  this._mappers = {
146
- "html": new HTMLMapper(),
147
- "json": new JSONMapper(),
148
- "dom": new DOMMapper()
147
+ html: new HTMLMapper(),
148
+ json: new JSONMapper(),
149
+ dom: new DOMMapper(),
149
150
  };
150
151
  }
151
152
  /**
@@ -160,7 +161,7 @@ var MapperManager = /** @class */ (function () {
160
161
  return this._mappers[type];
161
162
  };
162
163
  /**
163
- * Use this functio to register your own configuration mapper.
164
+ * Use this function to register your own configuration mapper.
164
165
  * After a mapper is registered, it can be used to parse the specific type fo configuration to the standard ViewerConfiguration.
165
166
  * @param type the name of the mapper. This will be used to define the configuration type and/or to get the mapper
166
167
  * @param mapper The implemented mapper
@@ -177,7 +178,7 @@ var MapperManager = /** @class */ (function () {
177
178
  /**
178
179
  * The default mapper is the JSON mapper.
179
180
  */
180
- MapperManager.DefaultMapper = 'json';
181
+ MapperManager.DefaultMapper = "json";
181
182
  return MapperManager;
182
183
  }());
183
184
  export { MapperManager };
@@ -1 +1 @@
1
- {"version":3,"file":"mappers.js","sourceRoot":"","sources":["../../../../sourceES6/viewer/src/configuration/mappers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAS/C;;;;;;;;;;;;;;;;GAgBG;AACH;IAAA;IAgDA,CAAC;IA9CG;;;OAGG;IACH,wBAAG,GAAH,UAAI,OAAoB;QAEpB,IAAI,MAAM,GAAG,EAAE,CAAC;gCACP,OAAO;YACZ,IAAI,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC5C,I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,CAAC;IAED;;;;;OAKG;IACI,sCAAc,GAArB,UAAsB,IAAY,EAAE,MAAe;QAC/C,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,+BAAO,GAAd;QACI,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACvB,CAAC;IAxCD;;OAEG;IACW,2BAAa,GAAG,MAAM,CAAC;IAuCzC,oBAAC;CAAA,AA7CD,IA6CC;SA7CY,aAAa;AA+C1B;;;;GAIG;AACH,MAAM,CAAC,IAAI,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC","sourcesContent":["import { Tools } from '@babylonjs/core/Misc/tools';\r\nimport { ViewerConfiguration } from './configuration';\r\n\r\nimport { kebabToCamel } from '../helper/index';\r\n\r\n/**\r\n * This is the mapper's interface. Implement this function to create your own mapper and register it at the mapper manager\r\n */\r\nexport interface IMapper {\r\n map(rawSource: any): ViewerConfiguration;\r\n}\r\n\r\n/**\r\n * This is a simple HTML mapper.\r\n * This mapper parses a single HTML element and returns the configuration from its attributes.\r\n * it parses numbers and boolean values to the corresponding variable types.\r\n * The following HTML element:\r\n * <div test=\"1\" random-flag=\"true\" a.string.object=\"test\"> will result in the following configuration:\r\n *\r\n * {\r\n * test: 1, //a number!\r\n * randomFlag: boolean, //camelCase and boolean\r\n * a: {\r\n * string: {\r\n * object: \"test\" //dot-separated object levels\r\n * }\r\n * }\r\n * }\r\n */\r\nclass HTMLMapper implements IMapper {\r\n\r\n /**\r\n * Map a specific element and get configuration from it\r\n * @param element the HTML element to analyze.\r\n */\r\n map(element: HTMLElement): ViewerConfiguration {\r\n\r\n let config = {};\r\n for (let attrIdx = 0; attrIdx < element.attributes.length; ++attrIdx) {\r\n let attr = element.attributes.item(attrIdx);\r\n if (!attr) {\r\n continue;\r\n }\r\n // map \"object.property\" to the right configuration place.\r\n let split = attr.nodeName.split('.');\r\n split.reduce((currentConfig, key, idx) => {\r\n //convert html-style to json-style\r\n let camelKey = kebabToCamel(key);\r\n if (idx === split.length - 1) {\r\n let val: any = attr!.nodeValue; // firefox warns nodeValue is deprecated, but I found no sign of it anywhere.\r\n if (val === \"true\") {\r\n val = true;\r\n } else if (val === \"false\") {\r\n val = false;\r\n } else if (val === \"undefined\") {\r\n val = undefined;\r\n } else if (val === \"null\") {\r\n val = null;\r\n } else {\r\n var isnum = !isNaN(parseFloat(val)) && isFinite(val); ///^\\d+$/.test(val);\r\n if (isnum) {\r\n let number = parseFloat(val);\r\n if (!isNaN(number)) {\r\n val = number;\r\n }\r\n }\r\n }\r\n currentConfig[camelKey] = val;\r\n } else {\r\n currentConfig[camelKey] = currentConfig[camelKey] || {};\r\n }\r\n return currentConfig[camelKey];\r\n }, config);\r\n }\r\n\r\n return config;\r\n }\r\n}\r\n\r\n/**\r\n * A simple string-to-JSON mapper.\r\n * This is the main mapper, used to analyze downloaded JSON-Configuration or JSON payload\r\n */\r\nclass JSONMapper implements IMapper {\r\n map(rawSource: string) {\r\n return JSON.parse(rawSource);\r\n }\r\n}\r\n\r\n/**\r\n * The DOM Mapper will traverse an entire DOM Tree and will load the configuration from the\r\n * DOM elements and attributes.\r\n */\r\nclass DOMMapper implements IMapper {\r\n\r\n /**\r\n * The mapping function that will convert HTML data to a viewer configuration object\r\n * @param baseElement the baseElement from which to start traversing\r\n * @returns a ViewerCOnfiguration object from the provided HTML Element\r\n */\r\n map(baseElement: HTMLElement): ViewerConfiguration {\r\n let htmlMapper = new HTMLMapper();\r\n let config = htmlMapper.map(baseElement);\r\n\r\n let traverseChildren = function (element: HTMLElement, partConfig) {\r\n let children = element.children;\r\n if (children.length) {\r\n for (let i = 0; i < children.length; ++i) {\r\n let item = <HTMLElement>children.item(i);\r\n // use the HTML Mapper to read configuration from a single element\r\n let configMapped = htmlMapper.map(item);\r\n let key = kebabToCamel(item.nodeName.toLowerCase());\r\n if (item.attributes.getNamedItem('array') && item.attributes.getNamedItem('array')!.nodeValue === 'true') {\r\n partConfig[key] = [];\r\n } else {\r\n if (element.attributes.getNamedItem('array') && element.attributes.getNamedItem('array')!.nodeValue === 'true') {\r\n partConfig.push(configMapped);\r\n } else if (partConfig[key]) {\r\n //exists already! probably an array\r\n element.setAttribute('array', 'true');\r\n let oldItem = partConfig[key];\r\n partConfig = [oldItem, configMapped];\r\n } else {\r\n partConfig[key] = configMapped;\r\n }\r\n }\r\n traverseChildren(item, partConfig[key] || configMapped);\r\n }\r\n }\r\n return partConfig;\r\n };\r\n\r\n traverseChildren(baseElement, config);\r\n\r\n return config;\r\n }\r\n\r\n}\r\n\r\n/**\r\n * The MapperManager manages the different implemented mappers.\r\n * It allows the user to register new mappers as well and use them to parse their own configuration data\r\n */\r\nexport class MapperManager {\r\n\r\n private _mappers: { [key: string]: IMapper };\r\n /**\r\n * The default mapper is the JSON mapper.\r\n */\r\n public static DefaultMapper = 'json';\r\n\r\n constructor() {\r\n this._mappers = {\r\n \"html\": new HTMLMapper(),\r\n \"json\": new JSONMapper(),\r\n \"dom\": new DOMMapper()\r\n };\r\n }\r\n\r\n /**\r\n * Get a specific configuration mapper.\r\n *\r\n * @param type the name of the mapper to load\r\n */\r\n public getMapper(type: string) {\r\n if (!this._mappers[type]) {\r\n Tools.Error(\"No mapper defined for \" + type);\r\n }\r\n return this._mappers[type];\r\n }\r\n\r\n /**\r\n * Use this functio to register your own configuration mapper.\r\n * After a mapper is registered, it can be used to parse the specific type fo configuration to the standard ViewerConfiguration.\r\n * @param type the name of the mapper. This will be used to define the configuration type and/or to get the mapper\r\n * @param mapper The implemented mapper\r\n */\r\n public registerMapper(type: string, mapper: IMapper) {\r\n this._mappers[type] = mapper;\r\n }\r\n\r\n /**\r\n * Dispose the mapper manager and all of its mappers.\r\n */\r\n public dispose() {\r\n this._mappers = {};\r\n }\r\n\r\n}\r\n\r\n/**\r\n * mapperManager is a singleton of the type MapperManager.\r\n * The mapperManager can be disposed directly with calling mapperManager.dispose()\r\n * or indirectly with using BabylonViewer.disposeAll()\r\n */\r\nexport let mapperManager = new MapperManager();"]}
1
+ {"version":3,"file":"mappers.js","sourceRoot":"","sources":["../../../../../tools/viewer/src/configuration/mappers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,sCAAwB;AAGxC,sDAAsD;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAS/C;;;;;;;;;;;;;;;;GAgBG;AACH;IAAA;IA8CA,CAAC;IA7CG;;;OAGG;IACH,wBAAG,GAAH,UAAI,OAAoB;QACpB,IAAM,MAAM,GAAG,EAAE,CAAC;gCACT,OAAO;YACZ,IAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC9C,IAAI,CAAC,IAAI,EAAE;;aAEV;YACD,0DAA0D;YAC1D,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACvC,KAAK,CAAC,MAAM,CAAC,UAAC,aAAqC,EAAE,GAAG,EAAE,GAAG;gBACzD,kCAAkC;gBAClC,IAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;gBACnC,IAAI,GAAG,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;oBAC1B,IAAI,GAAG,GAAQ,IAAK,CAAC,SAAS,CAAC,CAAC,6EAA6E;oBAC7G,IAAI,GAAG,KAAK,MAAM,EAAE;wBAChB,GAAG,GAAG,IAAI,CAAC;qBACd;yBAAM,IAAI,GAAG,KAAK,OAAO,EAAE;wBACxB,GAAG,GAAG,KAAK,CAAC;qBACf;yBAAM,IAAI,GAAG,KAAK,WAAW,EAAE;wBAC5B,GAAG,GAAG,SAAS,CAAC;qBACnB;yBAAM,IAAI,GAAG,KAAK,MAAM,EAAE;wBACvB,GAAG,GAAG,IAAI,CAAC;qBACd;yBAAM;wBACH,IAAM,KAAK,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,QAA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;AAAD,CAAC,AA1CD,IA0CC;AAED;;;GAGG;AACH;IAOI;QACI,IAAI,CAAC,QAAQ,GAAG;YACZ,IAAI,EAAE,IAAI,UAAU,EAAE;YACtB,IAAI,EAAE,IAAI,UAAU,EAAE;YACtB,GAAG,EAAE,IAAI,SAAS,EAAE;SACvB,CAAC;IACN,CAAC;IAED;;;;OAIG;IACI,iCAAS,GAAhB,UAAiB,IAAY;QACzB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YACtB,KAAK,CAAC,KAAK,CAAC,wBAAwB,GAAG,IAAI,CAAC,CAAC;SAChD;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED;;;;;OAKG;IACI,sCAAc,GAArB,UAAsB,IAAY,EAAE,MAAe;QAC/C,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,+BAAO,GAAd;QACI,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACvB,CAAC;IAxCD;;OAEG;IACW,2BAAa,GAAG,MAAM,CAAC;IAsCzC,oBAAC;CAAA,AA3CD,IA2CC;SA3CY,aAAa;AA6C1B;;;;GAIG;AACH,MAAM,CAAC,IAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC","sourcesContent":["import { Tools } from \"core/Misc/tools\";\r\nimport type { ViewerConfiguration } from \"./configuration\";\r\n\r\n// eslint-disable-next-line import/no-internal-modules\r\nimport { kebabToCamel } from \"../helper/index\";\r\n\r\n/**\r\n * This is the mapper's interface. Implement this function to create your own mapper and register it at the mapper manager\r\n */\r\nexport interface IMapper {\r\n map(rawSource: any): ViewerConfiguration;\r\n}\r\n\r\n/**\r\n * This is a simple HTML mapper.\r\n * This mapper parses a single HTML element and returns the configuration from its attributes.\r\n * it parses numbers and boolean values to the corresponding variable types.\r\n * The following HTML element:\r\n * <div test=\"1\" random-flag=\"true\" a.string.object=\"test\"> will result in the following configuration:\r\n *\r\n * {\r\n * test: 1, //a number!\r\n * randomFlag: boolean, //camelCase and boolean\r\n * a: {\r\n * string: {\r\n * object: \"test\" //dot-separated object levels\r\n * }\r\n * }\r\n * }\r\n */\r\nclass HTMLMapper implements IMapper {\r\n /**\r\n * Map a specific element and get configuration from it\r\n * @param element the HTML element to analyze.\r\n */\r\n map(element: HTMLElement): ViewerConfiguration {\r\n const config = {};\r\n for (let attrIdx = 0; attrIdx < element.attributes.length; ++attrIdx) {\r\n const attr = element.attributes.item(attrIdx);\r\n if (!attr) {\r\n continue;\r\n }\r\n // map \"object.property\" to the right configuration place.\r\n const split = attr.nodeName.split(\".\");\r\n split.reduce((currentConfig: { [key: string]: any }, key, idx) => {\r\n //convert html-style to json-style\r\n const camelKey = kebabToCamel(key);\r\n if (idx === split.length - 1) {\r\n let val: any = attr!.nodeValue; // firefox warns nodeValue is deprecated, but I found no sign of it anywhere.\r\n if (val === \"true\") {\r\n val = true;\r\n } else if (val === \"false\") {\r\n val = false;\r\n } else if (val === \"undefined\") {\r\n val = undefined;\r\n } else if (val === \"null\") {\r\n val = null;\r\n } else {\r\n const isnum = !isNaN(parseFloat(val)) && isFinite(val); ///^\\d+$/.test(val);\r\n if (isnum) {\r\n const number = parseFloat(val);\r\n if (!isNaN(number)) {\r\n val = number;\r\n }\r\n }\r\n }\r\n currentConfig[camelKey] = val;\r\n } else {\r\n currentConfig[camelKey] = currentConfig[camelKey] || {};\r\n }\r\n return currentConfig[camelKey];\r\n }, config);\r\n }\r\n\r\n return config;\r\n }\r\n}\r\n\r\n/**\r\n * A simple string-to-JSON mapper.\r\n * This is the main mapper, used to analyze downloaded JSON-Configuration or JSON payload\r\n */\r\nclass JSONMapper implements IMapper {\r\n map(rawSource: string) {\r\n return JSON.parse(rawSource);\r\n }\r\n}\r\n\r\n/**\r\n * The DOM Mapper will traverse an entire DOM Tree and will load the configuration from the\r\n * DOM elements and attributes.\r\n */\r\nclass DOMMapper implements IMapper {\r\n /**\r\n * The mapping function that will convert HTML data to a viewer configuration object\r\n * @param baseElement the baseElement from which to start traversing\r\n * @returns a ViewerConfiguration object from the provided HTML Element\r\n */\r\n map(baseElement: HTMLElement): ViewerConfiguration {\r\n const htmlMapper = new HTMLMapper();\r\n const config = htmlMapper.map(baseElement);\r\n\r\n const traverseChildren = function (element: HTMLElement, partConfig: any) {\r\n const children = element.children;\r\n if (children.length) {\r\n for (let i = 0; i < children.length; ++i) {\r\n const item = <HTMLElement>children.item(i);\r\n // use the HTML Mapper to read configuration from a single element\r\n const configMapped = htmlMapper.map(item);\r\n const key = kebabToCamel(item.nodeName.toLowerCase());\r\n if (item.attributes.getNamedItem(\"array\") && item.attributes.getNamedItem(\"array\")!.nodeValue === \"true\") {\r\n partConfig[key] = [];\r\n } else {\r\n if (element.attributes.getNamedItem(\"array\") && element.attributes.getNamedItem(\"array\")!.nodeValue === \"true\") {\r\n partConfig.push(configMapped);\r\n } else if (partConfig[key]) {\r\n //exists already! probably an array\r\n element.setAttribute(\"array\", \"true\");\r\n const oldItem = partConfig[key];\r\n partConfig = [oldItem, configMapped];\r\n } else {\r\n partConfig[key] = configMapped;\r\n }\r\n }\r\n traverseChildren(item, partConfig[key] || configMapped);\r\n }\r\n }\r\n return partConfig;\r\n };\r\n\r\n traverseChildren(baseElement, config);\r\n\r\n return config;\r\n }\r\n}\r\n\r\n/**\r\n * The MapperManager manages the different implemented mappers.\r\n * It allows the user to register new mappers as well and use them to parse their own configuration data\r\n */\r\nexport class MapperManager {\r\n private _mappers: { [key: string]: IMapper };\r\n /**\r\n * The default mapper is the JSON mapper.\r\n */\r\n public static DefaultMapper = \"json\";\r\n\r\n constructor() {\r\n this._mappers = {\r\n html: new HTMLMapper(),\r\n json: new JSONMapper(),\r\n dom: new DOMMapper(),\r\n };\r\n }\r\n\r\n /**\r\n * Get a specific configuration mapper.\r\n *\r\n * @param type the name of the mapper to load\r\n */\r\n public getMapper(type: string) {\r\n if (!this._mappers[type]) {\r\n Tools.Error(\"No mapper defined for \" + type);\r\n }\r\n return this._mappers[type];\r\n }\r\n\r\n /**\r\n * Use this function to register your own configuration mapper.\r\n * After a mapper is registered, it can be used to parse the specific type fo configuration to the standard ViewerConfiguration.\r\n * @param type the name of the mapper. This will be used to define the configuration type and/or to get the mapper\r\n * @param mapper The implemented mapper\r\n */\r\n public registerMapper(type: string, mapper: IMapper) {\r\n this._mappers[type] = mapper;\r\n }\r\n\r\n /**\r\n * Dispose the mapper manager and all of its mappers.\r\n */\r\n public dispose() {\r\n this._mappers = {};\r\n }\r\n}\r\n\r\n/**\r\n * mapperManager is a singleton of the type MapperManager.\r\n * The mapperManager can be disposed directly with calling mapperManager.dispose()\r\n * or indirectly with using BabylonViewer.disposeAll()\r\n */\r\nexport const mapperManager = new MapperManager();\r\n"]}
@@ -1,4 +1,4 @@
1
- import { ViewerConfiguration } from './configuration';
1
+ import type { ViewerConfiguration } from "./configuration";
2
2
  /**
3
3
  * The configuration loader will load the configuration object from any source and will use the defined mapper to
4
4
  * parse the object and return a conform ViewerConfiguration.
@@ -1,9 +1,10 @@
1
- import { mapperManager } from './mappers.js';
2
- import { processConfigurationCompatibility } from './configurationCompatibility.js';
3
- import { deepmerge } from '../helper/index.js';
4
- import { Tools } from '@babylonjs/core/Misc/tools.js';
5
- import { extendedConfiguration } from './types/extended.js';
6
- import { renderOnlyDefaultConfiguration } from './types/renderOnlyDefault.js';
1
+ import { mapperManager } from "./mappers.js";
2
+ import { processConfigurationCompatibility } from "./configurationCompatibility.js";
3
+ // eslint-disable-next-line import/no-internal-modules
4
+ import { deepmerge } from "../helper/index.js";
5
+ import { Tools } from "@babylonjs/core/Misc/tools.js";
6
+ import { extendedConfiguration } from "./types/extended.js";
7
+ import { renderOnlyDefaultConfiguration } from "./types/renderOnlyDefault.js";
7
8
  /**
8
9
  * The configuration loader will load the configuration object from any source and will use the defined mapper to
9
10
  * parse the object and return a conform ViewerConfiguration.
@@ -22,12 +23,12 @@ var RenderOnlyConfigurationLoader = /** @class */ (function () {
22
23
  var typesSeparated = types.split(",");
23
24
  typesSeparated.forEach(function (type) {
24
25
  switch (type.trim()) {
25
- case 'default':
26
+ case "default":
26
27
  config = deepmerge(config, renderOnlyDefaultConfiguration);
27
28
  break;
28
- case 'none':
29
+ case "none":
29
30
  break;
30
- case 'extended':
31
+ case "extended":
31
32
  default:
32
33
  config = deepmerge(config, extendedConfiguration);
33
34
  break;
@@ -38,7 +39,7 @@ var RenderOnlyConfigurationLoader = /** @class */ (function () {
38
39
  });
39
40
  return config;
40
41
  };
41
- ;
42
+ // eslint-disable-next-line @typescript-eslint/naming-convention
42
43
  RenderOnlyConfigurationLoader.prototype.getExtendedConfig = function (type) {
43
44
  return this._getConfigurationTypeExcludeTemplate(type || "extended");
44
45
  };
@@ -58,10 +59,11 @@ var RenderOnlyConfigurationLoader = /** @class */ (function () {
58
59
  var extendedConfiguration = this.getExtendedConfig(loadedConfig.extends);
59
60
  if (loadedConfig.configuration) {
60
61
  var mapperType_1 = "json";
61
- return Promise.resolve().then(function () {
62
+ return Promise.resolve()
63
+ .then(function () {
62
64
  if (typeof loadedConfig.configuration === "string" || (loadedConfig.configuration && loadedConfig.configuration.url)) {
63
65
  // a file to load
64
- var url = '';
66
+ var url = "";
65
67
  if (typeof loadedConfig.configuration === "string") {
66
68
  url = loadedConfig.configuration;
67
69
  }
@@ -72,7 +74,7 @@ var RenderOnlyConfigurationLoader = /** @class */ (function () {
72
74
  // empty string?
73
75
  if (!type) {
74
76
  // load mapper type from filename / url
75
- type = loadedConfig.configuration.url.split('.').pop();
77
+ type = loadedConfig.configuration.url.split(".").pop();
76
78
  }
77
79
  mapperType_1 = type || mapperType_1;
78
80
  }
@@ -85,7 +87,8 @@ var RenderOnlyConfigurationLoader = /** @class */ (function () {
85
87
  }
86
88
  return {};
87
89
  }
88
- }).then(function (data) {
90
+ })
91
+ .then(function (data) {
89
92
  var mapper = mapperManager.getMapper(mapperType_1);
90
93
  var parsed = deepmerge(mapper.map(data), loadedConfig);
91
94
  var merged = deepmerge(extendedConfiguration, parsed);
@@ -122,7 +125,7 @@ var RenderOnlyConfigurationLoader = /** @class */ (function () {
122
125
  if (config.model) {
123
126
  if (typeof config.model === "string") {
124
127
  config.model = {
125
- url: config.model
128
+ url: config.model,
126
129
  };
127
130
  }
128
131
  }
@@ -1 +1 @@
1
- {"version":3,"file":"renderOnlyLoader.js","sourceRoot":"","sources":["../../../../sourceES6/viewer/src/configuration/renderOnlyLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,iCAAiC,EAAE,MAAM,8BAA8B,CAAC;AAEjF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAG3E;;;;GAIG;AACH;IAMI,uCAAoB,YAA6B;QAA7B,6BAAA,EAAA,oBAA6B;QAA7B,iBAAY,GAAZ,YAAY,CAAiB;QAC7C,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC;QAC9B,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;IAC5B,CAAC;IAEO,4EAAoC,GAA5C,UAA6C,KAAa;QAA1D,iBAoBC;QAnBG,IAAI,MAAM,GAAwB,EAAE,CAAC;QACrC,IAAI,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtC,cAAc,CAAC,OAAO,CAAC,UAAC,IAAI;YACxB,QAAQ,IAAI,CAAC,IAAI,EAAE,EAAE;gBACjB,KAAK,SAAS;oBACV,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAAC;oBAC3D,MAAM;gBACV,KAAK,MAAM;oBACP,MAAM;gBACV,KAAK,UAAU,CAAC;gBA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,CAAC;iBAAE;gBACxD,OAAO,CAAC,MAAM,CAAC,CAAC;YACpB,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,UAAC,OAAO,EAAE,KAAU;gBAChD,IAAI,GAAG,GAAG,KAAI,CAAC,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;gBAClD,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE;oBACZ,KAAI,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;iBACrC;gBACD,MAAM,CAAC,KAAK,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;YACH,KAAI,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACP,CAAC;IAEL,oCAAC;AAAD,CAAC,AArJD,IAqJC","sourcesContent":["import { mapperManager } from './mappers';\r\nimport { ViewerConfiguration } from './configuration';\r\nimport { processConfigurationCompatibility } from './configurationCompatibility';\r\n\r\nimport { deepmerge } from '../helper/index';\r\nimport { Tools } from '@babylonjs/core/Misc/tools';\r\nimport { extendedConfiguration } from './types/extended';\r\nimport { renderOnlyDefaultConfiguration } from './types/renderOnlyDefault';\r\nimport { IFileRequest } from '@babylonjs/core/Misc/fileRequest';\r\n\r\n/**\r\n * The configuration loader will load the configuration object from any source and will use the defined mapper to\r\n * parse the object and return a conform ViewerConfiguration.\r\n * It is a private member of the scene.\r\n */\r\nexport class RenderOnlyConfigurationLoader {\r\n\r\n private _configurationCache: { [url: string]: any };\r\n\r\n private _loadRequests: Array<IFileRequest>;\r\n\r\n constructor(private _enableCache: boolean = false) {\r\n this._configurationCache = {};\r\n this._loadRequests = [];\r\n }\r\n\r\n private _getConfigurationTypeExcludeTemplate(types: string): ViewerConfiguration {\r\n let config: ViewerConfiguration = {};\r\n let typesSeparated = types.split(\",\");\r\n typesSeparated.forEach((type) => {\r\n switch (type.trim()) {\r\n case 'default':\r\n config = deepmerge(config, renderOnlyDefaultConfiguration);\r\n break;\r\n case 'none':\r\n break;\r\n case 'extended':\r\n default:\r\n config = deepmerge(config, extendedConfiguration);\r\n break;\r\n }\r\n if (config.extends) {\r\n config = deepmerge(config, this._getConfigurationTypeExcludeTemplate(config.extends));\r\n }\r\n });\r\n return config;\r\n };\r\n\r\n protected getExtendedConfig(type: string | undefined) {\r\n return this._getConfigurationTypeExcludeTemplate(type || \"extended\");\r\n }\r\n\r\n /**\r\n * load a configuration object that is defined in the initial configuration provided.\r\n * The viewer configuration can extend different types of configuration objects and have an extra configuration defined.\r\n *\r\n * @param initConfig the initial configuration that has the definitions of further configuration to load.\r\n * @param callback an optional callback that will be called sync, if noconfiguration needs to be loaded or configuration is payload-only\r\n * @returns A promise that delivers the extended viewer configuration, when done.\r\n */\r\n public loadConfiguration(initConfig: ViewerConfiguration = {}, callback?: (config: ViewerConfiguration) => void): Promise<ViewerConfiguration> {\r\n\r\n let loadedConfig: ViewerConfiguration = deepmerge({}, initConfig);\r\n this._processInitialConfiguration(loadedConfig);\r\n\r\n let extendedConfiguration = this.getExtendedConfig(loadedConfig.extends);\r\n\r\n if (loadedConfig.configuration) {\r\n\r\n let mapperType = \"json\";\r\n return Promise.resolve().then(() => {\r\n if (typeof loadedConfig.configuration === \"string\" || (loadedConfig.configuration && loadedConfig.configuration.url)) {\r\n // a file to load\r\n\r\n let url: string = '';\r\n if (typeof loadedConfig.configuration === \"string\") {\r\n url = loadedConfig.configuration;\r\n }\r\n\r\n // if configuration is an object\r\n if (typeof loadedConfig.configuration === \"object\" && loadedConfig.configuration.url) {\r\n url = loadedConfig.configuration.url;\r\n let type = loadedConfig.configuration.mapper;\r\n // empty string?\r\n if (!type) {\r\n // load mapper type from filename / url\r\n type = loadedConfig.configuration.url.split('.').pop();\r\n }\r\n mapperType = type || mapperType;\r\n }\r\n return this._loadFile(url);\r\n } else {\r\n if (typeof loadedConfig.configuration === \"object\") {\r\n mapperType = loadedConfig.configuration.mapper || mapperType;\r\n return loadedConfig.configuration.payload || {};\r\n }\r\n return {};\r\n\r\n }\r\n }).then((data: any) => {\r\n let mapper = mapperManager.getMapper(mapperType);\r\n let parsed = deepmerge(mapper.map(data), loadedConfig);\r\n let merged = deepmerge(extendedConfiguration, parsed);\r\n processConfigurationCompatibility(merged);\r\n if (callback) { callback(merged); }\r\n return merged;\r\n });\r\n } else {\r\n loadedConfig = deepmerge(extendedConfiguration, loadedConfig);\r\n processConfigurationCompatibility(loadedConfig);\r\n if (callback) { callback(loadedConfig); }\r\n return Promise.resolve(loadedConfig);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the configuration loader. This will cancel file requests, if active.\r\n */\r\n public dispose() {\r\n this._loadRequests.forEach((request) => {\r\n request.abort();\r\n });\r\n this._loadRequests.length = 0;\r\n }\r\n\r\n /**\r\n * This function will process the initial configuration and make needed changes for the viewer to work.\r\n * @param config the mutable(!) initial configuration to process\r\n */\r\n private _processInitialConfiguration(config: ViewerConfiguration) {\r\n if (config.model) {\r\n if (typeof config.model === \"string\") {\r\n config.model = {\r\n url: config.model\r\n };\r\n }\r\n }\r\n }\r\n\r\n private _loadFile(url: string): Promise<any> {\r\n let cacheReference = this._configurationCache;\r\n if (this._enableCache && cacheReference[url]) {\r\n return Promise.resolve(cacheReference[url]);\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n let fileRequest = Tools.LoadFile(url, (result) => {\r\n let idx = this._loadRequests.indexOf(fileRequest);\r\n if (idx !== -1) {\r\n this._loadRequests.splice(idx, 1);\r\n }\r\n if (this._enableCache) { cacheReference[url] = result; }\r\n resolve(result);\r\n }, undefined, undefined, false, (request, error: any) => {\r\n let idx = this._loadRequests.indexOf(fileRequest);\r\n if (idx !== -1) {\r\n this._loadRequests.splice(idx, 1);\r\n }\r\n reject(error);\r\n });\r\n this._loadRequests.push(fileRequest);\r\n });\r\n }\r\n\r\n}"]}
1
+ {"version":3,"file":"renderOnlyLoader.js","sourceRoot":"","sources":["../../../../../tools/viewer/src/configuration/renderOnlyLoader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CAAC,CAAC,CAAC;iBACrC;gBACD,MAAM,CAAC,KAAK,CAAC,CAAC;YAClB,CAAC,CACJ,CAAC;YACF,KAAI,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACP,CAAC;IACL,oCAAC;AAAD,CAAC,AAhKD,IAgKC","sourcesContent":["import { mapperManager } from \"./mappers\";\r\nimport type { ViewerConfiguration } from \"./configuration\";\r\nimport { processConfigurationCompatibility } from \"./configurationCompatibility\";\r\n\r\n// eslint-disable-next-line import/no-internal-modules\r\nimport { deepmerge } from \"../helper/index\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { extendedConfiguration } from \"./types/extended\";\r\nimport { renderOnlyDefaultConfiguration } from \"./types/renderOnlyDefault\";\r\nimport type { IFileRequest } from \"core/Misc/fileRequest\";\r\n\r\n/**\r\n * The configuration loader will load the configuration object from any source and will use the defined mapper to\r\n * parse the object and return a conform ViewerConfiguration.\r\n * It is a private member of the scene.\r\n */\r\nexport class RenderOnlyConfigurationLoader {\r\n private _configurationCache: { [url: string]: any };\r\n\r\n private _loadRequests: Array<IFileRequest>;\r\n\r\n constructor(private _enableCache: boolean = false) {\r\n this._configurationCache = {};\r\n this._loadRequests = [];\r\n }\r\n\r\n private _getConfigurationTypeExcludeTemplate(types: string): ViewerConfiguration {\r\n let config: ViewerConfiguration = {};\r\n const typesSeparated = types.split(\",\");\r\n typesSeparated.forEach((type) => {\r\n switch (type.trim()) {\r\n case \"default\":\r\n config = deepmerge(config, renderOnlyDefaultConfiguration);\r\n break;\r\n case \"none\":\r\n break;\r\n case \"extended\":\r\n default:\r\n config = deepmerge(config, extendedConfiguration);\r\n break;\r\n }\r\n if (config.extends) {\r\n config = deepmerge(config, this._getConfigurationTypeExcludeTemplate(config.extends));\r\n }\r\n });\r\n return config;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected getExtendedConfig(type: string | undefined) {\r\n return this._getConfigurationTypeExcludeTemplate(type || \"extended\");\r\n }\r\n\r\n /**\r\n * load a configuration object that is defined in the initial configuration provided.\r\n * The viewer configuration can extend different types of configuration objects and have an extra configuration defined.\r\n *\r\n * @param initConfig the initial configuration that has the definitions of further configuration to load.\r\n * @param callback an optional callback that will be called sync, if noconfiguration needs to be loaded or configuration is payload-only\r\n * @returns A promise that delivers the extended viewer configuration, when done.\r\n */\r\n public loadConfiguration(initConfig: ViewerConfiguration = {}, callback?: (config: ViewerConfiguration) => void): Promise<ViewerConfiguration> {\r\n let loadedConfig: ViewerConfiguration = deepmerge({}, initConfig);\r\n this._processInitialConfiguration(loadedConfig);\r\n\r\n const extendedConfiguration = this.getExtendedConfig(loadedConfig.extends);\r\n\r\n if (loadedConfig.configuration) {\r\n let mapperType = \"json\";\r\n return Promise.resolve()\r\n .then(() => {\r\n if (typeof loadedConfig.configuration === \"string\" || (loadedConfig.configuration && loadedConfig.configuration.url)) {\r\n // a file to load\r\n\r\n let url: string = \"\";\r\n if (typeof loadedConfig.configuration === \"string\") {\r\n url = loadedConfig.configuration;\r\n }\r\n\r\n // if configuration is an object\r\n if (typeof loadedConfig.configuration === \"object\" && loadedConfig.configuration.url) {\r\n url = loadedConfig.configuration.url;\r\n let type = loadedConfig.configuration.mapper;\r\n // empty string?\r\n if (!type) {\r\n // load mapper type from filename / url\r\n type = loadedConfig.configuration.url.split(\".\").pop();\r\n }\r\n mapperType = type || mapperType;\r\n }\r\n return this._loadFile(url);\r\n } else {\r\n if (typeof loadedConfig.configuration === \"object\") {\r\n mapperType = loadedConfig.configuration.mapper || mapperType;\r\n return loadedConfig.configuration.payload || {};\r\n }\r\n return {};\r\n }\r\n })\r\n .then((data: any) => {\r\n const mapper = mapperManager.getMapper(mapperType);\r\n const parsed = deepmerge(mapper.map(data), loadedConfig);\r\n const merged = deepmerge(extendedConfiguration, parsed);\r\n processConfigurationCompatibility(merged);\r\n if (callback) {\r\n callback(merged);\r\n }\r\n return merged;\r\n });\r\n } else {\r\n loadedConfig = deepmerge(extendedConfiguration, loadedConfig);\r\n processConfigurationCompatibility(loadedConfig);\r\n if (callback) {\r\n callback(loadedConfig);\r\n }\r\n return Promise.resolve(loadedConfig);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the configuration loader. This will cancel file requests, if active.\r\n */\r\n public dispose() {\r\n this._loadRequests.forEach((request) => {\r\n request.abort();\r\n });\r\n this._loadRequests.length = 0;\r\n }\r\n\r\n /**\r\n * This function will process the initial configuration and make needed changes for the viewer to work.\r\n * @param config the mutable(!) initial configuration to process\r\n */\r\n private _processInitialConfiguration(config: ViewerConfiguration) {\r\n if (config.model) {\r\n if (typeof config.model === \"string\") {\r\n config.model = {\r\n url: config.model,\r\n };\r\n }\r\n }\r\n }\r\n\r\n private _loadFile(url: string): Promise<any> {\r\n const cacheReference = this._configurationCache;\r\n if (this._enableCache && cacheReference[url]) {\r\n return Promise.resolve(cacheReference[url]);\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const fileRequest = Tools.LoadFile(\r\n url,\r\n (result) => {\r\n const idx = this._loadRequests.indexOf(fileRequest);\r\n if (idx !== -1) {\r\n this._loadRequests.splice(idx, 1);\r\n }\r\n if (this._enableCache) {\r\n cacheReference[url] = result;\r\n }\r\n resolve(result);\r\n },\r\n undefined,\r\n undefined,\r\n false,\r\n (request, error: any) => {\r\n const idx = this._loadRequests.indexOf(fileRequest);\r\n if (idx !== -1) {\r\n this._loadRequests.splice(idx, 1);\r\n }\r\n reject(error);\r\n }\r\n );\r\n this._loadRequests.push(fileRequest);\r\n });\r\n }\r\n}\r\n"]}
@@ -1,6 +1,6 @@
1
- import { ViewerConfiguration } from '../configuration';
1
+ import type { ViewerConfiguration } from "../configuration";
2
2
  /**
3
3
  * The default configuration of the viewer, including templates (canvas, overly, loading screen)
4
4
  * This configuration doesn't hold specific parameters, and only defines objects that are needed for the viewer to fully work correctly.
5
5
  */
6
- export declare let defaultConfiguration: ViewerConfiguration;
6
+ export declare const defaultConfiguration: ViewerConfiguration;
@@ -1,7 +1,8 @@
1
- import { babylonFont, defaultTemplate, fillContainer, loadingScreen, defaultViewer, navbar, overlay, help, share, error } from 'babylonjs-viewer-assets';
2
- import * as images from 'babylonjs-viewer-assets';
3
- import { renderOnlyDefaultConfiguration } from './renderOnlyDefault.js';
4
- import { deepmerge } from '../../helper/index.js';
1
+ import { babylonFont, defaultTemplate, fillContainer, loadingScreen, defaultViewer, navbar, overlay, help, share, error } from "babylonjs-viewer-assets";
2
+ import * as images from "babylonjs-viewer-assets";
3
+ import { renderOnlyDefaultConfiguration } from "./renderOnlyDefault.js";
4
+ // eslint-disable-next-line import/no-internal-modules
5
+ import { deepmerge } from "../../helper/index.js";
5
6
  /**
6
7
  * The default configuration of the viewer, including templates (canvas, overly, loading screen)
7
8
  * This configuration doesn't hold specific parameters, and only defines objects that are needed for the viewer to fully work correctly.
@@ -13,28 +14,28 @@ export var defaultConfiguration = deepmerge(renderOnlyDefaultConfiguration, {
13
14
  html: defaultTemplate,
14
15
  params: {
15
16
  babylonFont: babylonFont,
16
- noEscape: true
17
- }
17
+ noEscape: true,
18
+ },
18
19
  },
19
20
  fillContainer: {
20
21
  html: fillContainer,
21
22
  params: {
22
- disable: false
23
- }
23
+ disable: false,
24
+ },
24
25
  },
25
26
  loadingScreen: {
26
27
  html: loadingScreen,
27
28
  params: {
28
29
  backgroundColor: "#000000",
29
30
  loadingImage: images.loading,
30
- staticLoadingImage: images.staticLoading
31
- }
31
+ staticLoadingImage: images.staticLoading,
32
+ },
32
33
  },
33
34
  viewer: {
34
35
  html: defaultViewer,
35
36
  params: {
36
- enableDragAndDrop: false
37
- }
37
+ enableDragAndDrop: false,
38
+ },
38
39
  },
39
40
  navBar: {
40
41
  html: navbar,
@@ -46,8 +47,8 @@ export var defaultConfiguration = deepmerge(renderOnlyDefaultConfiguration, {
46
47
  "2.0x": "2.0",
47
48
  },
48
49
  logoImage: images.babylonLogo,
49
- logoText: 'BabylonJS',
50
- logoLink: 'https://babylonjs.com',
50
+ logoText: "BabylonJS",
51
+ logoLink: "https://babylonjs.com",
51
52
  hideHelp: true,
52
53
  hideHd: true,
53
54
  hideVr: true,
@@ -58,63 +59,63 @@ export var defaultConfiguration = deepmerge(renderOnlyDefaultConfiguration, {
58
59
  fullscreenButton: "Toggle Fullscreen",
59
60
  helpButton: "Help",
60
61
  vrButton: "Toggle VR",
61
- printButton: "3D Print Object"
62
- }
62
+ printButton: "3D Print Object",
63
+ },
63
64
  },
64
65
  events: {
65
66
  click: {
66
- '.navbar-control': true
67
+ ".navbar-control": true,
67
68
  },
68
69
  pointerdown: {
69
- '.help-button': true
70
+ ".help-button": true,
70
71
  },
71
72
  input: {
72
- '.progress-wrapper': true
73
+ ".progress-wrapper": true,
73
74
  },
74
75
  pointerup: {
75
- '.progress-wrapper': true
76
- }
77
- }
76
+ ".progress-wrapper": true,
77
+ },
78
+ },
78
79
  },
79
80
  overlay: {
80
81
  html: overlay,
81
82
  params: {
82
83
  closeImage: images.close,
83
- closeText: 'Close'
84
- }
84
+ closeText: "Close",
85
+ },
85
86
  },
86
87
  help: {
87
- html: help
88
+ html: help,
88
89
  },
89
90
  share: {
90
- html: share
91
+ html: share,
91
92
  },
92
93
  error: {
93
- html: error
94
- }
94
+ html: error,
95
+ },
95
96
  },
96
97
  camera: {
97
98
  behaviors: {
98
99
  autoRotate: {
99
- type: 0
100
+ type: 0,
100
101
  },
101
102
  framing: {
102
103
  type: 2,
103
104
  zoomOnBoundingInfo: true,
104
- zoomStopsAnimation: false
105
+ zoomStopsAnimation: false,
105
106
  },
106
107
  bouncing: {
107
- type: 1
108
- }
109
- }
108
+ type: 1,
109
+ },
110
+ },
110
111
  },
111
112
  skybox: {},
112
113
  ground: {
113
- receiveShadows: true
114
+ receiveShadows: true,
114
115
  },
115
116
  engine: {
116
- antialiasing: true
117
+ antialiasing: true,
117
118
  },
118
- scene: {}
119
+ scene: {},
119
120
  });
120
121
  //# sourceMappingURL=default.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"default.js","sourceRoot":"","sources":["../../../../../sourceES6/viewer/src/configuration/types/default.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACzJ,OAAO,KAAK,MAAM,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;;GAGG;AACH,MAAM,CAAC,IAAI,oBAAoB,GAAwB,SAAS,CAAC,8BAA8B,EAAE;IAC7F,OAAO,EAAE,cAAc;IACvB,SAAS,EAAE;QACP,IAAI,EAAE;YACF,IAAI,EAAE,eAAe;YACrB,MAAM,EAAE;gBACJ,WAAW,EAAE,WAAW;gBACxB,QAAQ,EAAE,IAAI;aACjB;SACJ;QACD,aAAa,EAAE;YACX,IAAI,EAAE,aAAa;YACnB,MAAM,EAAE;gBACJ,OAAO,EAAE,KAAK;aACjB;SACJ;QACD,aAAa,EAAE;YACX,IAAI,EAAE,aAAa;YACnB,MAAM,EAAE;gBACJ,eAAe,EAAE,SAAS;gBAC1B,YAAY,EAAE,MAAM,CAAC,OAAO;gBAC5B,kBAAkB,EAAE,MAAM,CAAC,aAAa;aAC3C;SACJ;QACD,MAAM,EAAE;YACJ,IAAI,EAAE,aAAa;YACnB,MAAM,EAAE;gBACJ,iBAAiB,EAAE,KAAK;aAC3B;SACJ;QACD,MAAM,EAAE;YACJ,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE;gBACJ,SAAS,EAAE;oBACP,MAAM,EAAE,KAAK;oBACb,MAAM,EAAE,KAAK;oBACb,MAAM,EAAE,KAAK;oBACb,MAAM,EAAE,KAAK;iBAChB;gBACD,SAAS,EAAE,MAAM,CAAC,WAAW;gBAC7B,QAAQ,EA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AC,CAAC","sourcesContent":["import { ViewerConfiguration } from '../configuration';\r\nimport { babylonFont, defaultTemplate, fillContainer, loadingScreen, defaultViewer, navbar, overlay, help, share, error } from 'babylonjs-viewer-assets';\r\nimport * as images from 'babylonjs-viewer-assets';\r\nimport { renderOnlyDefaultConfiguration } from './renderOnlyDefault';\r\nimport { deepmerge } from '../../helper/index';\r\n\r\n/**\r\n * The default configuration of the viewer, including templates (canvas, overly, loading screen)\r\n * This configuration doesn't hold specific parameters, and only defines objects that are needed for the viewer to fully work correctly.\r\n */\r\nexport let defaultConfiguration: ViewerConfiguration = deepmerge(renderOnlyDefaultConfiguration, {\r\n version: \"3.2.0-alpha4\",\r\n templates: {\r\n main: {\r\n html: defaultTemplate,\r\n params: {\r\n babylonFont: babylonFont,\r\n noEscape: true\r\n }\r\n },\r\n fillContainer: {\r\n html: fillContainer,\r\n params: {\r\n disable: false\r\n }\r\n },\r\n loadingScreen: {\r\n html: loadingScreen,\r\n params: {\r\n backgroundColor: \"#000000\",\r\n loadingImage: images.loading,\r\n staticLoadingImage: images.staticLoading\r\n }\r\n },\r\n viewer: {\r\n html: defaultViewer,\r\n params: {\r\n enableDragAndDrop: false\r\n }\r\n },\r\n navBar: {\r\n html: navbar,\r\n params: {\r\n speedList: {\r\n \"0.5x\": \"0.5\",\r\n \"1.0x\": \"1.0\",\r\n \"1.5x\": \"1.5\",\r\n \"2.0x\": \"2.0\",\r\n },\r\n logoImage: images.babylonLogo,\r\n logoText: 'BabylonJS',\r\n logoLink: 'https://babylonjs.com',\r\n hideHelp: true,\r\n hideHd: true,\r\n hideVr: true,\r\n hidePrint: true,\r\n disableOnFullscreen: false,\r\n text: {\r\n hdButton: \"Toggle HD\",\r\n fullscreenButton: \"Toggle Fullscreen\",\r\n helpButton: \"Help\",\r\n vrButton: \"Toggle VR\",\r\n printButton: \"3D Print Object\"\r\n }\r\n },\r\n events: {\r\n click: {\r\n '.navbar-control': true\r\n },\r\n pointerdown: {\r\n '.help-button': true\r\n },\r\n input: {\r\n '.progress-wrapper': true\r\n },\r\n pointerup: {\r\n '.progress-wrapper': true\r\n }\r\n }\r\n },\r\n overlay: {\r\n html: overlay,\r\n params: {\r\n closeImage: images.close,\r\n closeText: 'Close'\r\n }\r\n },\r\n help: {\r\n html: help\r\n },\r\n share: {\r\n html: share\r\n },\r\n error: {\r\n html: error\r\n }\r\n\r\n },\r\n camera: {\r\n behaviors: {\r\n autoRotate: {\r\n type: 0\r\n },\r\n framing: {\r\n type: 2,\r\n zoomOnBoundingInfo: true,\r\n zoomStopsAnimation: false\r\n },\r\n bouncing: {\r\n type: 1\r\n }\r\n }\r\n },\r\n skybox: {\r\n },\r\n ground: {\r\n receiveShadows: true\r\n },\r\n engine: {\r\n antialiasing: true\r\n },\r\n scene: {\r\n }\r\n});\r\n"]}
1
+ {"version":3,"file":"default.js","sourceRoot":"","sources":["../../../../../../tools/viewer/src/configuration/types/default.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACzJ,OAAO,KAAK,MAAM,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AACrE,sDAAsD;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;;GAGG;AACH,MAAM,CAAC,IAAM,oBAAoB,GAAwB,SAAS,CAAC,8BAA8B,EAAE;IAC/F,OAAO,EAAE,cAAc;IACvB,SAAS,EAAE;QACP,IAAI,EAAE;YACF,IAAI,EAAE,eAAe;YACrB,MAAM,EAAE;gBACJ,WAAW,EAAE,WAAW;gBACxB,QAAQ,EAAE,IAAI;aACjB;SACJ;QACD,aAAa,EAAE;YACX,IAAI,EAAE,aAAa;YACnB,MAAM,EAAE;gBACJ,OAAO,EAAE,KAA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D,IAAI,EAAE;YACF,IAAI,EAAE,IAAI;SACb;QACD,KAAK,EAAE;YACH,IAAI,EAAE,KAAK;SACd;QACD,KAAK,EAAE;YACH,IAAI,EAAE,KAAK;SACd;KACJ;IACD,MAAM,EAAE;QACJ,SAAS,EAAE;YACP,UAAU,EAAE;gBACR,IAAI,EAAE,CAAC;aACV;YACD,OAAO,EAAE;gBACL,IAAI,EAAE,CAAC;gBACP,kBAAkB,EAAE,IAAI;gBACxB,kBAAkB,EAAE,KAAK;aAC5B;YACD,QAAQ,EAAE;gBACN,IAAI,EAAE,CAAC;aACV;SACJ;KACJ;IACD,MAAM,EAAE,EAAE;IACV,MAAM,EAAE;QACJ,cAAc,EAAE,IAAI;KACvB;IACD,MAAM,EAAE;QACJ,YAAY,EAAE,IAAI;KACrB;IACD,KAAK,EAAE,EAAE;CACZ,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { ViewerConfiguration } from \"../configuration\";\r\nimport { babylonFont, defaultTemplate, fillContainer, loadingScreen, defaultViewer, navbar, overlay, help, share, error } from \"babylonjs-viewer-assets\";\r\nimport * as images from \"babylonjs-viewer-assets\";\r\nimport { renderOnlyDefaultConfiguration } from \"./renderOnlyDefault\";\r\n// eslint-disable-next-line import/no-internal-modules\r\nimport { deepmerge } from \"../../helper/index\";\r\n\r\n/**\r\n * The default configuration of the viewer, including templates (canvas, overly, loading screen)\r\n * This configuration doesn't hold specific parameters, and only defines objects that are needed for the viewer to fully work correctly.\r\n */\r\nexport const defaultConfiguration: ViewerConfiguration = deepmerge(renderOnlyDefaultConfiguration, {\r\n version: \"3.2.0-alpha4\",\r\n templates: {\r\n main: {\r\n html: defaultTemplate,\r\n params: {\r\n babylonFont: babylonFont,\r\n noEscape: true,\r\n },\r\n },\r\n fillContainer: {\r\n html: fillContainer,\r\n params: {\r\n disable: false,\r\n },\r\n },\r\n loadingScreen: {\r\n html: loadingScreen,\r\n params: {\r\n backgroundColor: \"#000000\",\r\n loadingImage: images.loading,\r\n staticLoadingImage: images.staticLoading,\r\n },\r\n },\r\n viewer: {\r\n html: defaultViewer,\r\n params: {\r\n enableDragAndDrop: false,\r\n },\r\n },\r\n navBar: {\r\n html: navbar,\r\n params: {\r\n speedList: {\r\n \"0.5x\": \"0.5\",\r\n \"1.0x\": \"1.0\",\r\n \"1.5x\": \"1.5\",\r\n \"2.0x\": \"2.0\",\r\n },\r\n logoImage: images.babylonLogo,\r\n logoText: \"BabylonJS\",\r\n logoLink: \"https://babylonjs.com\",\r\n hideHelp: true,\r\n hideHd: true,\r\n hideVr: true,\r\n hidePrint: true,\r\n disableOnFullscreen: false,\r\n text: {\r\n hdButton: \"Toggle HD\",\r\n fullscreenButton: \"Toggle Fullscreen\",\r\n helpButton: \"Help\",\r\n vrButton: \"Toggle VR\",\r\n printButton: \"3D Print Object\",\r\n },\r\n },\r\n events: {\r\n click: {\r\n \".navbar-control\": true,\r\n },\r\n pointerdown: {\r\n \".help-button\": true,\r\n },\r\n input: {\r\n \".progress-wrapper\": true,\r\n },\r\n pointerup: {\r\n \".progress-wrapper\": true,\r\n },\r\n },\r\n },\r\n overlay: {\r\n html: overlay,\r\n params: {\r\n closeImage: images.close,\r\n closeText: \"Close\",\r\n },\r\n },\r\n help: {\r\n html: help,\r\n },\r\n share: {\r\n html: share,\r\n },\r\n error: {\r\n html: error,\r\n },\r\n },\r\n camera: {\r\n behaviors: {\r\n autoRotate: {\r\n type: 0,\r\n },\r\n framing: {\r\n type: 2,\r\n zoomOnBoundingInfo: true,\r\n zoomStopsAnimation: false,\r\n },\r\n bouncing: {\r\n type: 1,\r\n },\r\n },\r\n },\r\n skybox: {},\r\n ground: {\r\n receiveShadows: true,\r\n },\r\n engine: {\r\n antialiasing: true,\r\n },\r\n scene: {},\r\n});\r\n"]}
@@ -1,4 +1,4 @@
1
- import { ViewerConfiguration } from './../configuration';
1
+ import type { ViewerConfiguration } from "./../configuration";
2
2
  /**
3
3
  * Lab-oriented default .env support
4
4
  */
@@ -3,12 +3,12 @@
3
3
  */
4
4
  export var environmentMapConfiguration = {
5
5
  lab: {
6
- assetsRootURL: '/assets/environment/',
6
+ assetsRootURL: "/assets/environment/",
7
7
  environmentMap: {
8
- texture: 'EnvMap_3.0-256.env',
8
+ texture: "EnvMap_3.0-256.env",
9
9
  rotationY: 0,
10
- tintLevel: 0.4
11
- }
12
- }
10
+ tintLevel: 0.4,
11
+ },
12
+ },
13
13
  };
14
14
  //# sourceMappingURL=environmentMap.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"environmentMap.js","sourceRoot":"","sources":["../../../../../sourceES6/viewer/src/configuration/types/environmentMap.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,IAAM,2BAA2B,GAAwB;IAC5D,GAAG,EAAE;QACD,aAAa,EAAE,sBAAsB;QACrC,cAAc,EAAE;YACZ,OAAO,EAAE,oBAAoB;YAC7B,SAAS,EAAE,CAAC;YACZ,SAAS,EAAE,GAAG;SACjB;KACJ;CACJ,CAAC","sourcesContent":["import { ViewerConfiguration } from './../configuration';\r\n\r\n/**\r\n * Lab-oriented default .env support\r\n */\r\nexport const environmentMapConfiguration: ViewerConfiguration = {\r\n lab: {\r\n assetsRootURL: '/assets/environment/',\r\n environmentMap: {\r\n texture: 'EnvMap_3.0-256.env',\r\n rotationY: 0,\r\n tintLevel: 0.4\r\n }\r\n }\r\n};"]}
1
+ {"version":3,"file":"environmentMap.js","sourceRoot":"","sources":["../../../../../../tools/viewer/src/configuration/types/environmentMap.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,IAAM,2BAA2B,GAAwB;IAC5D,GAAG,EAAE;QACD,aAAa,EAAE,sBAAsB;QACrC,cAAc,EAAE;YACZ,OAAO,EAAE,oBAAoB;YAC7B,SAAS,EAAE,CAAC;YACZ,SAAS,EAAE,GAAG;SACjB;KACJ;CACJ,CAAC","sourcesContent":["import type { ViewerConfiguration } from \"./../configuration\";\r\n\r\n/**\r\n * Lab-oriented default .env support\r\n */\r\nexport const environmentMapConfiguration: ViewerConfiguration = {\r\n lab: {\r\n assetsRootURL: \"/assets/environment/\",\r\n environmentMap: {\r\n texture: \"EnvMap_3.0-256.env\",\r\n rotationY: 0,\r\n tintLevel: 0.4,\r\n },\r\n },\r\n};\r\n"]}
@@ -1,6 +1,6 @@
1
- import { ViewerConfiguration } from './../configuration';
1
+ import type { ViewerConfiguration } from "./../configuration";
2
2
  /**
3
3
  * The viewer's "extended" configuration.
4
4
  * This configuration defines specific objects and parameters that we think make any model look good.
5
5
  */
6
- export declare let extendedConfiguration: ViewerConfiguration;
6
+ export declare const extendedConfiguration: ViewerConfiguration;