@threekit-tools/treble 0.0.92 → 0.0.93

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 (282) hide show
  1. package/dist/Treble/Treble.d.ts +1 -1
  2. package/dist/Treble/Treble.js +4 -3
  3. package/dist/Treble/snapshots.d.ts +2 -2
  4. package/dist/Treble/snapshots.js +1 -1
  5. package/dist/Treble/wishlist.d.ts +1 -1
  6. package/dist/Treble/wishlist.js +1 -1
  7. package/dist/api/assets.d.ts +1 -0
  8. package/dist/api/{products.js → assets.js} +12 -33
  9. package/dist/api/catalog.js +1 -1
  10. package/dist/api/configurations.d.ts +1 -0
  11. package/dist/api/configurations.js +10 -3
  12. package/dist/api/datatables.js +1 -1
  13. package/dist/api/index.d.ts +2 -2
  14. package/dist/api/index.js +2 -2
  15. package/dist/api/orders.js +1 -1
  16. package/dist/api/price.js +1 -1
  17. package/dist/components/AttributeTitle/index.d.ts +2 -2
  18. package/dist/components/AttributeValue/index.d.ts +2 -2
  19. package/dist/components/BreatheAnimation/index.js +1 -1
  20. package/dist/components/Button/index.d.ts +3 -3
  21. package/dist/components/Cards/index.d.ts +3 -3
  22. package/dist/components/DevTools/index.d.ts +2 -2
  23. package/dist/components/DraggableHint/draggableIndicator.styles.d.ts +1 -1
  24. package/dist/components/DraggableHint/index.d.ts +2 -2
  25. package/dist/components/Dropdown/index.d.ts +3 -3
  26. package/dist/components/FlatForm/index.d.ts +2 -2
  27. package/dist/components/FormComponentDescription/index.d.ts +1 -1
  28. package/dist/components/FormComponentTitle/index.d.ts +1 -1
  29. package/dist/components/Player/index.d.ts +9 -9
  30. package/dist/components/PlayerLoadingCircular/index.d.ts +2 -2
  31. package/dist/components/PlayerLoadingSpinner/index.d.ts +2 -2
  32. package/dist/components/PlayerLoadingSpinner/playerLoadingSpinner.styles.d.ts +1 -1
  33. package/dist/components/ProductDescription/index.d.ts +3 -3
  34. package/dist/components/ProductName/index.d.ts +3 -3
  35. package/dist/components/Share/index.d.ts +2 -2
  36. package/dist/components/Share/index.js +1 -1
  37. package/dist/components/Share/share.styles.d.ts +1 -1
  38. package/dist/components/Snapshots/index.d.ts +2 -2
  39. package/dist/components/Strips/index.d.ts +3 -3
  40. package/dist/components/Swatch/index.d.ts +3 -3
  41. package/dist/components/Switch/index.d.ts +3 -3
  42. package/dist/components/TextInput/index.d.ts +3 -3
  43. package/dist/components/ThreekitProvider/index.d.ts +6 -3
  44. package/dist/components/ThreekitProvider/index.js +27 -2
  45. package/dist/components/Tiles/index.d.ts +3 -3
  46. package/dist/components/TilesGroup/index.d.ts +3 -3
  47. package/dist/components/TotalPrice/index.d.ts +3 -3
  48. package/dist/components/TrebleApp/index.d.ts +3 -3
  49. package/dist/components/TurntableAnimation/index.js +1 -1
  50. package/dist/components/Upload/index.d.ts +3 -3
  51. package/dist/components/Upload/index.js +1 -1
  52. package/dist/components/UploadArea/index.d.ts +3 -3
  53. package/dist/components/UploadArea/index.js +1 -1
  54. package/dist/components/Wishlist/WishlistItem.d.ts +2 -2
  55. package/dist/components/Wishlist/index.d.ts +4 -4
  56. package/dist/components/Wishlist/index.js +1 -1
  57. package/dist/components/Zoom/index.d.ts +6 -6
  58. package/dist/components/containers/formInputContainer.d.ts +2 -2
  59. package/dist/components/formComponents.d.ts +6 -6
  60. package/dist/components/message/index.d.ts +1 -1
  61. package/dist/constants.d.ts +6 -6
  62. package/dist/hooks/useAttribute/index.d.ts +4 -4
  63. package/dist/hooks/useAttribute/index.js +3 -3
  64. package/dist/hooks/useConfigurationLoader/index.js +1 -1
  65. package/dist/hooks/useConfigurator/index.d.ts +3 -3
  66. package/dist/hooks/useConfigurator/index.js +3 -5
  67. package/dist/hooks/useDevTools/index.d.ts +1 -1
  68. package/dist/hooks/useNestedConfigurator/index.d.ts +2 -2
  69. package/dist/hooks/useNestedConfigurator/index.js +3 -3
  70. package/dist/hooks/usePlayer/index.d.ts +1 -1
  71. package/dist/hooks/usePlayerPortal/index.d.ts +1 -1
  72. package/dist/hooks/useProductCache/index.js +1 -1
  73. package/dist/hooks/useResetProduct/index.d.ts +1 -1
  74. package/dist/hooks/useResetProduct/index.js +1 -1
  75. package/dist/hooks/useRoomBuilder/RoomBuilderState.js +1 -1
  76. package/dist/hooks/useRoomBuilder/constants.js +2 -2
  77. package/dist/hooks/useRoomBuilder/themes.js +1 -1
  78. package/dist/hooks/useRoomBuilder/types.d.ts +7 -7
  79. package/dist/hooks/useRoomBuilder/types.js +5 -5
  80. package/dist/hooks/useRoomBuilder/validators.d.ts +1 -1
  81. package/dist/hooks/useShare/index.d.ts +1 -1
  82. package/dist/hooks/useShare/index.js +4 -2
  83. package/dist/hooks/useSingleAnimation/index.js +1 -1
  84. package/dist/hooks/useSnapshot/index.d.ts +1 -1
  85. package/dist/hooks/useWishlist/index.d.ts +1 -1
  86. package/dist/hooks/useZoom/index.d.ts +1 -1
  87. package/dist/http/assets.d.ts +2 -0
  88. package/dist/http/assets.js +16 -0
  89. package/dist/http/index.d.ts +2 -2
  90. package/dist/http/index.js +2 -2
  91. package/dist/http/orders.d.ts +1 -1
  92. package/dist/icons/Spinner.d.ts +2 -2
  93. package/dist/icons/types.d.ts +1 -1
  94. package/dist/store/attributes.d.ts +4 -4
  95. package/dist/store/attributes.js +2 -4
  96. package/dist/store/index.d.ts +6 -6
  97. package/dist/store/price.d.ts +1 -1
  98. package/dist/store/price.js +1 -1
  99. package/dist/store/product.d.ts +2 -2
  100. package/dist/store/product.js +1 -1
  101. package/dist/store/translations.d.ts +10 -8
  102. package/dist/store/translations.js +39 -19
  103. package/dist/store/treble.d.ts +1 -1
  104. package/dist/store/treble.js +1 -1
  105. package/dist/store/wishlist.d.ts +2 -2
  106. package/dist/store/wishlist.js +1 -1
  107. package/dist/types.d.ts +18 -17
  108. package/dist/types.js +9 -9
  109. package/dist/utils.d.ts +2 -6
  110. package/dist/utils.js +5 -12
  111. package/package.json +1 -2
  112. package/dist/Treble/snapshot.d.ts +0 -22
  113. package/dist/Treble/snapshot.js +0 -247
  114. package/dist/api/products.d.ts +0 -4
  115. package/dist/hooks/useSpaces/SpacesLayout.d.ts +0 -11
  116. package/dist/hooks/useSpaces/SpacesLayout.js +0 -74
  117. package/dist/hooks/useSpaces/SpacesState.d.ts +0 -164
  118. package/dist/hooks/useSpaces/SpacesState.js +0 -1751
  119. package/dist/hooks/useSpaces/constants.d.ts +0 -64
  120. package/dist/hooks/useSpaces/constants.js +0 -109
  121. package/dist/hooks/useSpaces/dataHandlers.d.ts +0 -20
  122. package/dist/hooks/useSpaces/dataHandlers.js +0 -254
  123. package/dist/hooks/useSpaces/draw/clearCanvas.d.ts +0 -2
  124. package/dist/hooks/useSpaces/draw/clearCanvas.js +0 -9
  125. package/dist/hooks/useSpaces/draw/drawBackground.d.ts +0 -2
  126. package/dist/hooks/useSpaces/draw/drawBackground.js +0 -12
  127. package/dist/hooks/useSpaces/draw/drawDimensions.d.ts +0 -3
  128. package/dist/hooks/useSpaces/draw/drawDimensions.js +0 -53
  129. package/dist/hooks/useSpaces/draw/drawDoors.d.ts +0 -9
  130. package/dist/hooks/useSpaces/draw/drawDoors.js +0 -99
  131. package/dist/hooks/useSpaces/draw/drawFloor.d.ts +0 -3
  132. package/dist/hooks/useSpaces/draw/drawFloor.js +0 -36
  133. package/dist/hooks/useSpaces/draw/drawGrid.d.ts +0 -3
  134. package/dist/hooks/useSpaces/draw/drawGrid.js +0 -33
  135. package/dist/hooks/useSpaces/draw/drawGuides.d.ts +0 -3
  136. package/dist/hooks/useSpaces/draw/drawGuides.js +0 -23
  137. package/dist/hooks/useSpaces/draw/drawOpenings.d.ts +0 -9
  138. package/dist/hooks/useSpaces/draw/drawOpenings.js +0 -72
  139. package/dist/hooks/useSpaces/draw/drawVertices.d.ts +0 -8
  140. package/dist/hooks/useSpaces/draw/drawVertices.js +0 -61
  141. package/dist/hooks/useSpaces/draw/drawWalls.d.ts +0 -10
  142. package/dist/hooks/useSpaces/draw/drawWalls.js +0 -88
  143. package/dist/hooks/useSpaces/draw/drawWindows.d.ts +0 -9
  144. package/dist/hooks/useSpaces/draw/drawWindows.js +0 -82
  145. package/dist/hooks/useSpaces/draw/index.d.ts +0 -11
  146. package/dist/hooks/useSpaces/draw/index.js +0 -129
  147. package/dist/hooks/useSpaces/geometry/addThicknessToLine.d.ts +0 -3
  148. package/dist/hooks/useSpaces/geometry/addThicknessToLine.js +0 -13
  149. package/dist/hooks/useSpaces/geometry/areLinesEqual.d.ts +0 -3
  150. package/dist/hooks/useSpaces/geometry/areLinesEqual.js +0 -17
  151. package/dist/hooks/useSpaces/geometry/arePointsEqual.d.ts +0 -3
  152. package/dist/hooks/useSpaces/geometry/arePointsEqual.js +0 -8
  153. package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.d.ts +0 -3
  154. package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.js +0 -11
  155. package/dist/hooks/useSpaces/geometry/closestPointOnLine.d.ts +0 -3
  156. package/dist/hooks/useSpaces/geometry/closestPointOnLine.js +0 -13
  157. package/dist/hooks/useSpaces/geometry/doLinesOverlap.d.ts +0 -2
  158. package/dist/hooks/useSpaces/geometry/doLinesOverlap.js +0 -16
  159. package/dist/hooks/useSpaces/geometry/euclideanMod.d.ts +0 -2
  160. package/dist/hooks/useSpaces/geometry/euclideanMod.js +0 -6
  161. package/dist/hooks/useSpaces/geometry/findLoops.d.ts +0 -6
  162. package/dist/hooks/useSpaces/geometry/findLoops.js +0 -117
  163. package/dist/hooks/useSpaces/geometry/getAllLineIntersections.d.ts +0 -6
  164. package/dist/hooks/useSpaces/geometry/getAllLineIntersections.js +0 -23
  165. package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.d.ts +0 -3
  166. package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.js +0 -7
  167. package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.d.ts +0 -3
  168. package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.js +0 -17
  169. package/dist/hooks/useSpaces/geometry/getDistanceToLine.d.ts +0 -3
  170. package/dist/hooks/useSpaces/geometry/getDistanceToLine.js +0 -10
  171. package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.d.ts +0 -3
  172. package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.js +0 -7
  173. package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.d.ts +0 -3
  174. package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.js +0 -17
  175. package/dist/hooks/useSpaces/geometry/getLineOtherPoint.d.ts +0 -3
  176. package/dist/hooks/useSpaces/geometry/getLineOtherPoint.js +0 -11
  177. package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.d.ts +0 -3
  178. package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.js +0 -43
  179. package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.d.ts +0 -3
  180. package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.js +0 -9
  181. package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.d.ts +0 -3
  182. package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.js +0 -20
  183. package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.d.ts +0 -3
  184. package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.js +0 -11
  185. package/dist/hooks/useSpaces/geometry/getPolygonArea.d.ts +0 -3
  186. package/dist/hooks/useSpaces/geometry/getPolygonArea.js +0 -15
  187. package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.d.ts +0 -3
  188. package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.js +0 -16
  189. package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.d.ts +0 -6
  190. package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.js +0 -17
  191. package/dist/hooks/useSpaces/geometry/getTriangleArea.d.ts +0 -3
  192. package/dist/hooks/useSpaces/geometry/getTriangleArea.js +0 -9
  193. package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.d.ts +0 -3
  194. package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.js +0 -12
  195. package/dist/hooks/useSpaces/geometry/index.d.ts +0 -30
  196. package/dist/hooks/useSpaces/geometry/index.js +0 -64
  197. package/dist/hooks/useSpaces/geometry/isPointInPolygon.d.ts +0 -3
  198. package/dist/hooks/useSpaces/geometry/isPointInPolygon.js +0 -21
  199. package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.d.ts +0 -3
  200. package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.js +0 -25
  201. package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.d.ts +0 -3
  202. package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.js +0 -11
  203. package/dist/hooks/useSpaces/geometry/splitLineAtOffset.d.ts +0 -3
  204. package/dist/hooks/useSpaces/geometry/splitLineAtOffset.js +0 -12
  205. package/dist/hooks/useSpaces/geometry/splitLineAtPoint.d.ts +0 -3
  206. package/dist/hooks/useSpaces/geometry/splitLineAtPoint.js +0 -9
  207. package/dist/hooks/useSpaces/geometry/splitLineAtPoints.d.ts +0 -3
  208. package/dist/hooks/useSpaces/geometry/splitLineAtPoints.js +0 -28
  209. package/dist/hooks/useSpaces/index.d.ts +0 -82
  210. package/dist/hooks/useSpaces/index.js +0 -482
  211. package/dist/hooks/useSpaces/themes/blueprint.d.ts +0 -3
  212. package/dist/hooks/useSpaces/themes/blueprint.js +0 -96
  213. package/dist/hooks/useSpaces/themes/default.d.ts +0 -3
  214. package/dist/hooks/useSpaces/themes/default.js +0 -96
  215. package/dist/hooks/useSpaces/themes/index.d.ts +0 -11
  216. package/dist/hooks/useSpaces/themes/index.js +0 -21
  217. package/dist/hooks/useSpaces/themes/light.d.ts +0 -3
  218. package/dist/hooks/useSpaces/themes/light.js +0 -96
  219. package/dist/hooks/useSpaces/types.d.ts +0 -339
  220. package/dist/hooks/useSpaces/types.js +0 -54
  221. package/dist/hooks/useSpaces/validators/areWallsDuplicated.d.ts +0 -3
  222. package/dist/hooks/useSpaces/validators/areWallsDuplicated.js +0 -61
  223. package/dist/hooks/useSpaces/validators/areWallsIntersecting.d.ts +0 -3
  224. package/dist/hooks/useSpaces/validators/areWallsIntersecting.js +0 -42
  225. package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.d.ts +0 -3
  226. package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.js +0 -52
  227. package/dist/hooks/useSpaces/validators/areWallsTooShort.d.ts +0 -3
  228. package/dist/hooks/useSpaces/validators/areWallsTooShort.js +0 -37
  229. package/dist/hooks/useSpaces/validators/index.d.ts +0 -15
  230. package/dist/hooks/useSpaces/validators/index.js +0 -40
  231. package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.d.ts +0 -3
  232. package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.js +0 -31
  233. package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.d.ts +0 -3
  234. package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.js +0 -19
  235. package/dist/hooks/useSpaces/validators/isLineTooShort.d.ts +0 -3
  236. package/dist/hooks/useSpaces/validators/isLineTooShort.js +0 -26
  237. package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.d.ts +0 -4
  238. package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.js +0 -19
  239. package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.d.ts +0 -3
  240. package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.js +0 -19
  241. package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.d.ts +0 -3
  242. package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.js +0 -41
  243. package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.d.ts +0 -3
  244. package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.js +0 -54
  245. package/dist/hooks/useSpaces/validators/isWallTooShort.d.ts +0 -3
  246. package/dist/hooks/useSpaces/validators/isWallTooShort.js +0 -10
  247. package/dist/hooks/useSpaces/validators/messaging.d.ts +0 -8
  248. package/dist/hooks/useSpaces/validators/messaging.js +0 -18
  249. package/dist/http/products.d.ts +0 -1
  250. package/dist/http/products.js +0 -12
  251. package/dist/icons/AngleSnapping.d.ts +0 -3
  252. package/dist/icons/AngleSnapping.js +0 -28
  253. package/dist/icons/Center.d.ts +0 -3
  254. package/dist/icons/Center.js +0 -24
  255. package/dist/icons/GridSnapping.d.ts +0 -3
  256. package/dist/icons/GridSnapping.js +0 -28
  257. package/dist/icons/LayoutAlt.d.ts +0 -3
  258. package/dist/icons/LayoutAlt.js +0 -21
  259. package/dist/icons/Magnet.d.ts +0 -3
  260. package/dist/icons/Magnet.js +0 -27
  261. package/dist/icons/Player3D.d.ts +0 -3
  262. package/dist/icons/Player3D.js +0 -21
  263. package/dist/icons/Ruler copy.d.ts +0 -3
  264. package/dist/icons/Ruler copy.js +0 -22
  265. package/dist/icons/RulerBlank.d.ts +0 -3
  266. package/dist/icons/RulerBlank.js +0 -25
  267. package/dist/icons/RulerDetailed copy.d.ts +0 -3
  268. package/dist/icons/RulerDetailed copy.js +0 -27
  269. package/dist/icons/RulerDetailed.d.ts +0 -3
  270. package/dist/icons/RulerDetailed.js +0 -27
  271. package/dist/icons/Save.d.ts +0 -3
  272. package/dist/icons/Save.js +0 -21
  273. package/dist/icons/UnitCm.d.ts +0 -3
  274. package/dist/icons/UnitCm.js +0 -22
  275. package/dist/icons/UnitFeet.d.ts +0 -3
  276. package/dist/icons/UnitFeet.js +0 -22
  277. package/dist/icons/UnitInch.d.ts +0 -3
  278. package/dist/icons/UnitInch.js +0 -22
  279. package/dist/icons/UnitMeter.d.ts +0 -3
  280. package/dist/icons/UnitMeter.js +0 -21
  281. package/dist/store/spaces.d.ts +0 -47
  282. package/dist/store/spaces.js +0 -197
package/dist/types.js CHANGED
@@ -6,17 +6,17 @@ var SCENE_PHASES;
6
6
  SCENE_PHASES["LOADED"] = "loaded";
7
7
  SCENE_PHASES["PRELOADED"] = "preloaded";
8
8
  SCENE_PHASES["RENDERED"] = "rendered";
9
- })(SCENE_PHASES = exports.SCENE_PHASES || (exports.SCENE_PHASES = {}));
9
+ })(SCENE_PHASES || (exports.SCENE_PHASES = SCENE_PHASES = {}));
10
10
  var PRIVATE_APIS;
11
11
  (function (PRIVATE_APIS) {
12
12
  PRIVATE_APIS["SCENE"] = "scene";
13
13
  PRIVATE_APIS["PLAYER"] = "player";
14
- })(PRIVATE_APIS = exports.PRIVATE_APIS || (exports.PRIVATE_APIS = {}));
14
+ })(PRIVATE_APIS || (exports.PRIVATE_APIS = PRIVATE_APIS = {}));
15
15
  var DISPLAY_OPTIONS;
16
16
  (function (DISPLAY_OPTIONS) {
17
17
  DISPLAY_OPTIONS["WEBGL"] = "webgl";
18
18
  DISPLAY_OPTIONS["IMAGE"] = "image";
19
- })(DISPLAY_OPTIONS = exports.DISPLAY_OPTIONS || (exports.DISPLAY_OPTIONS = {}));
19
+ })(DISPLAY_OPTIONS || (exports.DISPLAY_OPTIONS = DISPLAY_OPTIONS = {}));
20
20
  var ATTRIBUTE_TYPES;
21
21
  (function (ATTRIBUTE_TYPES) {
22
22
  ATTRIBUTE_TYPES["STRING"] = "String";
@@ -25,28 +25,28 @@ var ATTRIBUTE_TYPES;
25
25
  ATTRIBUTE_TYPES["NUMBER"] = "Number";
26
26
  ATTRIBUTE_TYPES["BOOLEAN"] = "Boolean";
27
27
  ATTRIBUTE_TYPES["ARRAY"] = "Array";
28
- })(ATTRIBUTE_TYPES = exports.ATTRIBUTE_TYPES || (exports.ATTRIBUTE_TYPES = {}));
28
+ })(ATTRIBUTE_TYPES || (exports.ATTRIBUTE_TYPES = ATTRIBUTE_TYPES = {}));
29
29
  var ASSET_TYPES;
30
30
  (function (ASSET_TYPES) {
31
31
  ASSET_TYPES["UPLOAD"] = "upload";
32
32
  ASSET_TYPES["ITEM"] = "item";
33
- })(ASSET_TYPES = exports.ASSET_TYPES || (exports.ASSET_TYPES = {}));
33
+ })(ASSET_TYPES || (exports.ASSET_TYPES = ASSET_TYPES = {}));
34
34
  var PLUG_TYPES;
35
35
  (function (PLUG_TYPES) {
36
36
  PLUG_TYPES["PROXY"] = "Proxy";
37
37
  PLUG_TYPES["TRANSFORM"] = "Transform";
38
- })(PLUG_TYPES = exports.PLUG_TYPES || (exports.PLUG_TYPES = {}));
38
+ })(PLUG_TYPES || (exports.PLUG_TYPES = PLUG_TYPES = {}));
39
39
  var TRANSFORM_PROPERTY_TYPES;
40
40
  (function (TRANSFORM_PROPERTY_TYPES) {
41
41
  TRANSFORM_PROPERTY_TYPES["ROTATION"] = "rotation";
42
42
  TRANSFORM_PROPERTY_TYPES["TRANSLATION"] = "translation";
43
43
  TRANSFORM_PROPERTY_TYPES["SCALE"] = "scale";
44
- })(TRANSFORM_PROPERTY_TYPES = exports.TRANSFORM_PROPERTY_TYPES || (exports.TRANSFORM_PROPERTY_TYPES = {}));
44
+ })(TRANSFORM_PROPERTY_TYPES || (exports.TRANSFORM_PROPERTY_TYPES = TRANSFORM_PROPERTY_TYPES = {}));
45
45
  var SNAPSHOT_FORMATS;
46
46
  (function (SNAPSHOT_FORMATS) {
47
47
  SNAPSHOT_FORMATS["JPG"] = "jpg";
48
48
  SNAPSHOT_FORMATS["PNG"] = "png";
49
- })(SNAPSHOT_FORMATS = exports.SNAPSHOT_FORMATS || (exports.SNAPSHOT_FORMATS = {}));
49
+ })(SNAPSHOT_FORMATS || (exports.SNAPSHOT_FORMATS = SNAPSHOT_FORMATS = {}));
50
50
  var SNAPSHOT_OUTPUTS;
51
51
  (function (SNAPSHOT_OUTPUTS) {
52
52
  SNAPSHOT_OUTPUTS["URL"] = "url";
@@ -54,4 +54,4 @@ var SNAPSHOT_OUTPUTS;
54
54
  SNAPSHOT_OUTPUTS["DATA_URL"] = "dataUrl";
55
55
  SNAPSHOT_OUTPUTS["BLOB"] = "blob";
56
56
  SNAPSHOT_OUTPUTS["FILE"] = "file";
57
- })(SNAPSHOT_OUTPUTS = exports.SNAPSHOT_OUTPUTS || (exports.SNAPSHOT_OUTPUTS = {}));
57
+ })(SNAPSHOT_OUTPUTS || (exports.SNAPSHOT_OUTPUTS = SNAPSHOT_OUTPUTS = {}));
package/dist/utils.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { IThreekitCamera, IConfigurationColor, ICoordinates, IQuaternion, IThreekitDisplayAttribute, ISetConfiguration, IHydratedAttribute } from './types';
2
2
  import { ITrebleConfig, ATTRIBUTE_TYPES } from './types';
3
3
  import { RawAttributeValue } from './hooks/useAttribute';
4
- import { ITranslationMap } from './api/products';
4
+ import { ITranslationsMap } from './http/assets';
5
5
  interface ICameraPosition {
6
6
  position: ICoordinates;
7
7
  quaternion: IQuaternion;
@@ -48,11 +48,7 @@ export declare const downloadSnapshot: (snapshot: string, filename: string) => P
48
48
  export declare const copyToClipboard: (data: string | Record<string, string | number | boolean>) => void;
49
49
  export declare const easeInOutCubic: (val: number) => number;
50
50
  export declare const metadataValueToObject: (data: string) => Record<string, string | number>;
51
- export declare const hydrateAttribute: (data: [
52
- Record<string, IThreekitDisplayAttribute>,
53
- undefined | ITranslationMap,
54
- undefined | string
55
- ], optionSelectionHandler: (config: ISetConfiguration) => Promise<void>) => Record<string, IHydratedAttribute>;
51
+ export declare const hydrateAttribute: (data: [Record<string, IThreekitDisplayAttribute>, ITranslationsMap], optionSelectionHandler: (config: ISetConfiguration) => Promise<void>) => Record<string, IHydratedAttribute>;
56
52
  export declare const selectionToConfiguration: (value: RawAttributeValue, attributeType: ATTRIBUTE_TYPES) => string | number | boolean | File | IConfigurationColor | {
57
53
  assetId: RawAttributeValue;
58
54
  } | undefined;
package/dist/utils.js CHANGED
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
18
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
19
  if (y = 0, t) op = [op[0] & 2, t.value];
20
20
  switch (op[0]) {
@@ -304,24 +304,19 @@ var metadataValueToObject = function (data) {
304
304
  };
305
305
  exports.metadataValueToObject = metadataValueToObject;
306
306
  var hydrateAttribute = function (data, optionSelectionHandler) {
307
- var attributes = data[0], translations = data[1], language = data[2];
308
- var hasTranslation = !!language && !!translations;
307
+ var attributes = data[0], translations = data[1];
309
308
  return Object.values(attributes).reduce(function (output, attribute) {
310
309
  var _a;
311
310
  var _b;
312
311
  return Object.assign(output, (_a = {},
313
312
  _a[attribute.name] = Object.assign({}, attribute, {
314
- label: hasTranslation
315
- ? ((_b = translations === null || translations === void 0 ? void 0 : translations[attribute.name]) === null || _b === void 0 ? void 0 : _b[language]) || attribute.name
316
- : attribute.name,
313
+ label: (_b = translations[attribute.name]) !== null && _b !== void 0 ? _b : attribute.name,
317
314
  }, attribute.type === 'String'
318
315
  ? {
319
316
  values: attribute.values.map(function (el) {
320
317
  var _a;
321
318
  return Object.assign({}, el, {
322
- label: hasTranslation
323
- ? ((_a = translations === null || translations === void 0 ? void 0 : translations[el.label]) === null || _a === void 0 ? void 0 : _a[language]) || el.label
324
- : el.label,
319
+ label: (_a = translations[el.label]) !== null && _a !== void 0 ? _a : el.label,
325
320
  handleSelect: function () {
326
321
  var _a;
327
322
  return optionSelectionHandler((_a = {},
@@ -337,9 +332,7 @@ var hydrateAttribute = function (data, optionSelectionHandler) {
337
332
  values: attribute.values.map(function (el) {
338
333
  var _a;
339
334
  return Object.assign({}, el, {
340
- label: hasTranslation
341
- ? ((_a = translations === null || translations === void 0 ? void 0 : translations[el.name]) === null || _a === void 0 ? void 0 : _a[language]) || el.name
342
- : el.name,
335
+ label: (_a = translations[el.name]) !== null && _a !== void 0 ? _a : el.name,
343
336
  handleSelect: function () {
344
337
  var _a;
345
338
  return optionSelectionHandler((_a = {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threekit-tools/treble",
3
- "version": "0.0.92",
3
+ "version": "0.0.93",
4
4
  "author": "Amaan Saeed",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -46,7 +46,6 @@
46
46
  "axios": "^0.22.0",
47
47
  "chokidar": "^3.5.3",
48
48
  "live-server": "^1.2.2",
49
- "joi": "^17.10.0",
50
49
  "react-redux": "^7.2.6",
51
50
  "redux": "^4.1.2",
52
51
  "redux-logger": "^3.0.6",
@@ -1,22 +0,0 @@
1
- export type ISnapshotsCameras = undefined | string | Array<string | undefined>;
2
- interface SnapshotSize {
3
- width: number;
4
- height: number;
5
- }
6
- export interface ITakeSnapshotsConfig {
7
- attributeName?: string;
8
- output?: string;
9
- format?: string;
10
- size?: SnapshotSize;
11
- filename?: string;
12
- useStage?: boolean;
13
- }
14
- interface IGetSnapshot {
15
- size: SnapshotSize;
16
- format: string;
17
- }
18
- declare const _default: {
19
- getSnapshot: ({ size, format }: IGetSnapshot) => Promise<string>;
20
- takeSnapshots: (camerasList: ISnapshotsCameras, snapshotsConfig: ITakeSnapshotsConfig) => Promise<void | string[] | Blob[] | File[] | null>;
21
- };
22
- export default _default;
@@ -1,247 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- var api_1 = __importDefault(require("../api"));
43
- var constants_1 = require("../constants");
44
- var types_1 = require("../types");
45
- var utils_1 = require("../utils");
46
- var DEFAULT_CAMERA_CONFIG = {
47
- filename: "snapshot",
48
- size: { width: 1920, height: 1080 },
49
- format: types_1.SNAPSHOT_FORMATS.PNG,
50
- attributeName: constants_1.ATTRIBUTES_RESERVED.camera,
51
- output: types_1.SNAPSHOT_OUTPUTS.BLOB,
52
- useStage: false,
53
- };
54
- var cameraValues;
55
- var getCameraValue = function (configurator, cameraAttrName) {
56
- if (cameraAttrName === void 0) { cameraAttrName = constants_1.ATTRIBUTES_RESERVED.camera; }
57
- var attribute = configurator
58
- .getDisplayAttributes()
59
- .find(function (el) { return el.name === cameraAttrName; });
60
- if (!attribute)
61
- return undefined;
62
- return attribute.value;
63
- };
64
- var getCamerasMap = function (configurator, cameraAttrName) {
65
- if (cameraAttrName === void 0) { cameraAttrName = constants_1.ATTRIBUTES_RESERVED.camera; }
66
- if (cameraValues)
67
- return cameraValues;
68
- var attribute = configurator
69
- .getDisplayAttributes()
70
- .find(function (el) { return el.name === cameraAttrName; });
71
- if (!attribute) {
72
- cameraValues = {};
73
- return cameraValues;
74
- }
75
- var cameraAttribute = attribute;
76
- cameraAttribute.values.forEach(function (el) {
77
- var _a;
78
- var value = cameraAttribute.type === types_1.ATTRIBUTE_TYPES.ASSET
79
- ? { assetId: el.assetId }
80
- : el.value;
81
- cameraValues = Object.assign(cameraValues || {}, (_a = {},
82
- _a[el.label] = value,
83
- _a));
84
- }, {});
85
- return cameraValues;
86
- };
87
- var getSnapshot = function (_a) {
88
- var size = _a.size, format = _a.format;
89
- return window.threekit.player.snapshotAsync({
90
- size: size,
91
- mimeType: "image/".concat(types_1.SNAPSHOT_FORMATS[format]),
92
- });
93
- };
94
- var getSnapshots = function (cameras, snapshotConfig) { return __awaiter(void 0, void 0, void 0, function () {
95
- var attributeName, size, format, configurator, _a, camerasMap, snapshots;
96
- return __generator(this, function (_b) {
97
- switch (_b.label) {
98
- case 0:
99
- attributeName = snapshotConfig.attributeName || DEFAULT_CAMERA_CONFIG.attributeName;
100
- size = snapshotConfig.size || DEFAULT_CAMERA_CONFIG.size;
101
- format = snapshotConfig.format || DEFAULT_CAMERA_CONFIG.format;
102
- if (!(snapshotConfig === null || snapshotConfig === void 0 ? void 0 : snapshotConfig.useStage)) return [3, 2];
103
- return [4, window.threekit.player.getStageConfigurator()];
104
- case 1:
105
- _a = _b.sent();
106
- return [3, 3];
107
- case 2:
108
- _a = window.threekit.configurator;
109
- _b.label = 3;
110
- case 3:
111
- configurator = _a;
112
- camerasMap = getCamerasMap(configurator, attributeName);
113
- if (!camerasMap)
114
- return [2, Promise.resolve([])];
115
- snapshots = [];
116
- return [2, cameras.reduce(function (snapshotPromise, camera) {
117
- return snapshotPromise.then(function () {
118
- return new Promise(function (resolve) { return __awaiter(void 0, void 0, void 0, function () {
119
- var snapshotStr;
120
- var _a;
121
- return __generator(this, function (_b) {
122
- switch (_b.label) {
123
- case 0:
124
- if (!camera) return [3, 2];
125
- return [4, configurator.setConfiguration((_a = {},
126
- _a[attributeName] = camerasMap[camera],
127
- _a))];
128
- case 1:
129
- _b.sent();
130
- _b.label = 2;
131
- case 2: return [4, getSnapshot({ size: size, format: format })];
132
- case 3:
133
- snapshotStr = _b.sent();
134
- snapshots.push(snapshotStr);
135
- resolve(snapshots);
136
- return [2];
137
- }
138
- });
139
- }); });
140
- });
141
- }, Promise.resolve(snapshots))];
142
- }
143
- });
144
- }); };
145
- var takeSnapshots = function (camerasList, snapshotsConfig) { return __awaiter(void 0, void 0, void 0, function () {
146
- var filename, size, format, attributeName, output, configurator, _a, cameras, snapshotsRaw, snapshotData, camerasMap_1, currentCamera, cameraPosition, _b, attachments, response, urlsArray, snapshotBlobs, snapshotFiles;
147
- var _c;
148
- return __generator(this, function (_d) {
149
- switch (_d.label) {
150
- case 0:
151
- filename = (snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.filename) || DEFAULT_CAMERA_CONFIG.filename;
152
- size = (snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.size) || DEFAULT_CAMERA_CONFIG.size;
153
- format = (snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.format) || DEFAULT_CAMERA_CONFIG.format;
154
- attributeName = (snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.attributeName) || DEFAULT_CAMERA_CONFIG.attributeName;
155
- output = (snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.output) || DEFAULT_CAMERA_CONFIG.output;
156
- if (!(snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.useStage)) return [3, 2];
157
- return [4, window.threekit.player.getStageConfigurator()];
158
- case 1:
159
- _a = _d.sent();
160
- return [3, 3];
161
- case 2:
162
- _a = window.threekit.configurator;
163
- _d.label = 3;
164
- case 3:
165
- configurator = _a;
166
- cameras = Array.isArray(camerasList) ? camerasList : [camerasList];
167
- if (!(cameras.length === 1 && cameras[0] === undefined)) return [3, 5];
168
- return [4, getSnapshot({ size: size, format: format })];
169
- case 4:
170
- snapshotData = _d.sent();
171
- snapshotsRaw = [snapshotData];
172
- return [3, 8];
173
- case 5:
174
- camerasMap_1 = getCamerasMap(configurator, attributeName);
175
- if (!camerasMap_1)
176
- return [2, null];
177
- cameras = cameras.filter(function (el) { return el === undefined || Object.keys(camerasMap_1).includes(el); });
178
- currentCamera = getCameraValue(configurator, attributeName);
179
- cameraPosition = (0, utils_1.getCameraPosition)(window.threekit.player.camera);
180
- return [4, getSnapshots(cameras, snapshotsConfig)];
181
- case 6:
182
- snapshotsRaw = _d.sent();
183
- return [4, configurator.setConfiguration((_c = {},
184
- _c[attributeName] = currentCamera,
185
- _c))];
186
- case 7:
187
- _d.sent();
188
- (0, utils_1.setCameraPosition)(window.threekit.player.camera, cameraPosition);
189
- _d.label = 8;
190
- case 8:
191
- _b = output;
192
- switch (_b) {
193
- case types_1.SNAPSHOT_OUTPUTS.URL: return [3, 9];
194
- case types_1.SNAPSHOT_OUTPUTS.DOWNLOAD: return [3, 11];
195
- case types_1.SNAPSHOT_OUTPUTS.BLOB: return [3, 12];
196
- case types_1.SNAPSHOT_OUTPUTS.FILE: return [3, 13];
197
- case types_1.SNAPSHOT_OUTPUTS.DATA_URL: return [3, 14];
198
- }
199
- return [3, 14];
200
- case 9:
201
- attachments = snapshotsRaw.reduce(function (output, el, idx) {
202
- var _a;
203
- var cameraName = (camerasList === null || camerasList === void 0 ? void 0 : camerasList[idx])
204
- ? (0, utils_1.regularToKebabCase)(camerasList[idx] || 'default')
205
- : filename;
206
- var preppedFilename = cameraName === filename
207
- ? "".concat(filename, ".").concat(format)
208
- : "".concat(filename, "-").concat(cameraName, ".").concat(format);
209
- var file = (0, utils_1.dataURItoFile)(el, preppedFilename);
210
- return Object.assign(output, (_a = {}, _a[cameraName] = file, _a));
211
- }, {});
212
- return [4, api_1.default.configurations.save({
213
- assetId: window.threekit.player.assetId,
214
- configuration: window.threekit.configurator.getConfiguration(),
215
- attachments: attachments,
216
- })];
217
- case 10:
218
- response = _d.sent();
219
- urlsArray = Object.values(response.data.attachments);
220
- return [2, Promise.resolve(urlsArray)];
221
- case 11:
222
- snapshotsRaw.forEach(function (snapshotBlob, idx) {
223
- var cameraName = (camerasList === null || camerasList === void 0 ? void 0 : camerasList[idx])
224
- ? "-".concat((0, utils_1.regularToKebabCase)(camerasList[idx] || 'default'))
225
- : '';
226
- (0, utils_1.downloadSnapshot)(snapshotBlob, "".concat(filename).concat(cameraName, ".").concat(format));
227
- });
228
- return [2, Promise.resolve()];
229
- case 12:
230
- snapshotBlobs = snapshotsRaw.map(function (el) { return (0, utils_1.dataURItoBlob)(el); });
231
- return [2, Promise.resolve(snapshotBlobs)];
232
- case 13:
233
- snapshotFiles = snapshotsRaw.map(function (el, idx) {
234
- var cameraName = (camerasList === null || camerasList === void 0 ? void 0 : camerasList[idx])
235
- ? "-".concat((0, utils_1.regularToKebabCase)(camerasList[idx] || 'default'))
236
- : '';
237
- return (0, utils_1.dataURItoFile)(el, "".concat(filename).concat(cameraName, ".").concat(format));
238
- });
239
- return [2, Promise.resolve(snapshotFiles)];
240
- case 14: return [2, Promise.resolve(snapshotsRaw)];
241
- }
242
- });
243
- }); };
244
- exports.default = {
245
- getSnapshot: getSnapshot,
246
- takeSnapshots: takeSnapshots,
247
- };
@@ -1,4 +0,0 @@
1
- declare type ITranslation = Record<string, string | undefined>;
2
- export declare type ITranslationMap = Record<string, ITranslation>;
3
- export declare const fetchTranslations: () => Promise<ITranslationMap>;
4
- export {};
@@ -1,11 +0,0 @@
1
- /// <reference types="react" />
2
- import type { ICoordinate2D } from './types';
3
- interface ISpacesLayout {
4
- loops?: Array<ICoordinate2D[]>;
5
- size?: number;
6
- color?: string;
7
- padding?: number;
8
- strokeWidth?: number;
9
- }
10
- export default function SpacesLayout(props: ISpacesLayout): JSX.Element;
11
- export {};
@@ -1,74 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- var react_1 = __importDefault(require("react"));
18
- function SpacesLayout(props) {
19
- var loops = props.loops;
20
- var size = props.size || 20;
21
- var padding = props.padding || 2;
22
- var strokeWidth = props.strokeWidth || 2;
23
- if (!(loops === null || loops === void 0 ? void 0 : loops.length))
24
- return react_1.default.createElement(react_1.default.Fragment, null);
25
- var _a = loops.reduce(function (output, loop, i) {
26
- loop.forEach(function (_a, j) {
27
- var x = _a[0], y = _a[1];
28
- if (!i && !j) {
29
- output = {
30
- xMin: x,
31
- yMin: y,
32
- xMax: x,
33
- yMax: y,
34
- };
35
- }
36
- else {
37
- if (x < output.xMin)
38
- output.xMin = x;
39
- else if (x > output.xMax)
40
- output.xMax = x;
41
- if (y < output.yMin)
42
- output.yMin = y;
43
- else if (y > output.yMax)
44
- output.yMax = y;
45
- }
46
- });
47
- return output;
48
- }, {
49
- xMin: 0,
50
- yMin: 0,
51
- xMax: 0,
52
- yMax: 0,
53
- }), xMin = _a.xMin, yMin = _a.yMin, xMax = _a.xMax, yMax = _a.yMax;
54
- var xSpan = xMax - xMin;
55
- var ySpan = yMax - yMin;
56
- var xCenter = xMin + xSpan / 2;
57
- var yCenter = yMin + ySpan / 2;
58
- var scaleFactor = (size - 2 * padding) / Math.max(xSpan, ySpan);
59
- var translate = [
60
- xCenter * scaleFactor - size / 2,
61
- yCenter * scaleFactor - size / 2,
62
- ];
63
- return (react_1.default.createElement("svg", __assign({ width: size, height: size, fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props), loops.map(function (loop, i) {
64
- var path = loop
65
- .map(function (point, i) {
66
- var x = point[0] * scaleFactor - translate[0];
67
- var y = point[1] * scaleFactor - translate[1];
68
- return (!i ? 'M ' : 'L ') + x + ' ' + y;
69
- })
70
- .join(' ') + ' Z';
71
- return (react_1.default.createElement("path", { key: "path-".concat(i), d: path, stroke: props.color, strokeWidth: strokeWidth }));
72
- })));
73
- }
74
- exports.default = SpacesLayout;