@threekit-tools/treble 0.0.90 → 0.0.91-next-01

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 (205) hide show
  1. package/dist/Treble/Treble.d.ts +2 -2
  2. package/dist/Treble/Treble.js +2 -2
  3. package/dist/Treble/index.d.ts +1 -1
  4. package/dist/Treble/index.js +1 -1
  5. package/dist/components/BreatheAnimation/index.js +2 -2
  6. package/dist/components/TurntableAnimation/index.js +2 -2
  7. package/dist/components/containers/formInputContainer.js +3 -3
  8. package/dist/hooks/useAttribute/index.js +1 -5
  9. package/dist/hooks/useConfigurationChangeStatus/index.d.ts +2 -0
  10. package/dist/hooks/{usePlayerLoadingStatus → useConfigurationChangeStatus}/index.js +2 -2
  11. package/dist/hooks/useNestedConfigurator/index.js +1 -2
  12. package/dist/hooks/usePlayerReady/index.d.ts +2 -0
  13. package/dist/hooks/{useAnimationStart → usePlayerReady}/index.js +2 -2
  14. package/dist/hooks/useSpaces/Canvas.d.ts +37 -0
  15. package/dist/hooks/useSpaces/Canvas.js +199 -0
  16. package/dist/hooks/useSpaces/SpacesLayout.d.ts +11 -0
  17. package/dist/hooks/useSpaces/SpacesLayout.js +74 -0
  18. package/dist/hooks/useSpaces/SpacesState.d.ts +162 -0
  19. package/dist/hooks/useSpaces/SpacesState.js +1791 -0
  20. package/dist/hooks/useSpaces/constants.d.ts +44 -0
  21. package/dist/hooks/useSpaces/constants.js +105 -0
  22. package/dist/hooks/{useRoomBuilder → useSpaces}/dataHandlers.d.ts +6 -4
  23. package/dist/hooks/{useRoomBuilder → useSpaces}/dataHandlers.js +104 -42
  24. package/dist/hooks/useSpaces/draw/clearCanvas.d.ts +2 -0
  25. package/dist/hooks/useSpaces/draw/clearCanvas.js +9 -0
  26. package/dist/hooks/useSpaces/draw/drawBackground.d.ts +2 -0
  27. package/dist/hooks/useSpaces/draw/drawBackground.js +12 -0
  28. package/dist/hooks/useSpaces/draw/drawDimensions.d.ts +3 -0
  29. package/dist/hooks/useSpaces/draw/drawDimensions.js +53 -0
  30. package/dist/hooks/useSpaces/draw/drawDoors.d.ts +9 -0
  31. package/dist/hooks/useSpaces/draw/drawDoors.js +93 -0
  32. package/dist/hooks/useSpaces/draw/drawFloor.d.ts +3 -0
  33. package/dist/hooks/useSpaces/draw/drawFloor.js +36 -0
  34. package/dist/hooks/useSpaces/draw/drawGrid.d.ts +3 -0
  35. package/dist/hooks/useSpaces/draw/drawGrid.js +31 -0
  36. package/dist/hooks/useSpaces/draw/drawGuides.d.ts +3 -0
  37. package/dist/hooks/useSpaces/draw/drawGuides.js +23 -0
  38. package/dist/hooks/useSpaces/draw/drawOpenings.d.ts +9 -0
  39. package/dist/hooks/useSpaces/draw/drawOpenings.js +72 -0
  40. package/dist/hooks/useSpaces/draw/drawVertices.d.ts +8 -0
  41. package/dist/hooks/useSpaces/draw/drawVertices.js +61 -0
  42. package/dist/hooks/useSpaces/draw/drawWalls.d.ts +10 -0
  43. package/dist/hooks/useSpaces/draw/drawWalls.js +64 -0
  44. package/dist/hooks/useSpaces/draw/drawWindows.d.ts +9 -0
  45. package/dist/hooks/useSpaces/draw/drawWindows.js +82 -0
  46. package/dist/hooks/useSpaces/draw/index.d.ts +11 -0
  47. package/dist/hooks/useSpaces/draw/index.js +129 -0
  48. package/dist/hooks/useSpaces/geometry/addThicknessToLine.d.ts +3 -0
  49. package/dist/hooks/useSpaces/geometry/addThicknessToLine.js +13 -0
  50. package/dist/hooks/useSpaces/geometry/areLinesEqual.d.ts +3 -0
  51. package/dist/hooks/useSpaces/geometry/areLinesEqual.js +17 -0
  52. package/dist/hooks/useSpaces/geometry/arePointsEqual.d.ts +3 -0
  53. package/dist/hooks/useSpaces/geometry/arePointsEqual.js +8 -0
  54. package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.d.ts +3 -0
  55. package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.js +11 -0
  56. package/dist/hooks/useSpaces/geometry/closestPointOnLine.d.ts +3 -0
  57. package/dist/hooks/useSpaces/geometry/closestPointOnLine.js +13 -0
  58. package/dist/hooks/useSpaces/geometry/doLinesOverlap.d.ts +2 -0
  59. package/dist/hooks/useSpaces/geometry/doLinesOverlap.js +16 -0
  60. package/dist/hooks/useSpaces/geometry/euclideanMod.d.ts +2 -0
  61. package/dist/hooks/useSpaces/geometry/euclideanMod.js +6 -0
  62. package/dist/hooks/useSpaces/geometry/findLoops.d.ts +6 -0
  63. package/dist/hooks/{useRoomBuilder → useSpaces/geometry}/findLoops.js +14 -9
  64. package/dist/hooks/useSpaces/geometry/getAllLineIntersections.d.ts +6 -0
  65. package/dist/hooks/useSpaces/geometry/getAllLineIntersections.js +23 -0
  66. package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.d.ts +3 -0
  67. package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.js +7 -0
  68. package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.d.ts +3 -0
  69. package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.js +17 -0
  70. package/dist/hooks/useSpaces/geometry/getDistanceToLine.d.ts +3 -0
  71. package/dist/hooks/useSpaces/geometry/getDistanceToLine.js +10 -0
  72. package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.d.ts +3 -0
  73. package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.js +7 -0
  74. package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.d.ts +3 -0
  75. package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.js +17 -0
  76. package/dist/hooks/useSpaces/geometry/getLineOtherPoint.d.ts +3 -0
  77. package/dist/hooks/useSpaces/geometry/getLineOtherPoint.js +11 -0
  78. package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.d.ts +3 -0
  79. package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.js +43 -0
  80. package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.d.ts +3 -0
  81. package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.js +9 -0
  82. package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.d.ts +3 -0
  83. package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.js +20 -0
  84. package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.d.ts +3 -0
  85. package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.js +11 -0
  86. package/dist/hooks/useSpaces/geometry/getPolygonArea.d.ts +3 -0
  87. package/dist/hooks/useSpaces/geometry/getPolygonArea.js +15 -0
  88. package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.d.ts +3 -0
  89. package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.js +16 -0
  90. package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.d.ts +6 -0
  91. package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.js +17 -0
  92. package/dist/hooks/useSpaces/geometry/getTriangleArea.d.ts +3 -0
  93. package/dist/hooks/useSpaces/geometry/getTriangleArea.js +9 -0
  94. package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.d.ts +3 -0
  95. package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.js +12 -0
  96. package/dist/hooks/useSpaces/geometry/index.d.ts +30 -0
  97. package/dist/hooks/useSpaces/geometry/index.js +64 -0
  98. package/dist/hooks/useSpaces/geometry/isPointInPolygon.d.ts +3 -0
  99. package/dist/hooks/useSpaces/geometry/isPointInPolygon.js +21 -0
  100. package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.d.ts +3 -0
  101. package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.js +25 -0
  102. package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.d.ts +3 -0
  103. package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.js +11 -0
  104. package/dist/hooks/useSpaces/geometry/splitLineAtOffset.d.ts +3 -0
  105. package/dist/hooks/useSpaces/geometry/splitLineAtOffset.js +12 -0
  106. package/dist/hooks/useSpaces/geometry/splitLineAtPoint.d.ts +3 -0
  107. package/dist/hooks/useSpaces/geometry/splitLineAtPoint.js +9 -0
  108. package/dist/hooks/useSpaces/geometry/splitLineAtPoints.d.ts +3 -0
  109. package/dist/hooks/useSpaces/geometry/splitLineAtPoints.js +28 -0
  110. package/dist/hooks/useSpaces/index.d.ts +76 -0
  111. package/dist/hooks/useSpaces/index.js +475 -0
  112. package/dist/hooks/useSpaces/themes/blueprint.d.ts +3 -0
  113. package/dist/hooks/useSpaces/themes/blueprint.js +96 -0
  114. package/dist/hooks/useSpaces/themes/default.d.ts +3 -0
  115. package/dist/hooks/useSpaces/themes/default.js +96 -0
  116. package/dist/hooks/{useRoomBuilder/themes.d.ts → useSpaces/themes/index.d.ts} +3 -4
  117. package/dist/hooks/useSpaces/themes/index.js +21 -0
  118. package/dist/hooks/useSpaces/themes/light.d.ts +3 -0
  119. package/dist/hooks/useSpaces/themes/light.js +96 -0
  120. package/dist/hooks/{useRoomBuilder → useSpaces}/types.d.ts +131 -35
  121. package/dist/hooks/{useRoomBuilder → useSpaces}/types.js +13 -1
  122. package/dist/hooks/useSpaces/validators/areWallsDuplicated.d.ts +3 -0
  123. package/dist/hooks/useSpaces/validators/areWallsDuplicated.js +61 -0
  124. package/dist/hooks/useSpaces/validators/areWallsIntersecting.d.ts +3 -0
  125. package/dist/hooks/useSpaces/validators/areWallsIntersecting.js +42 -0
  126. package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.d.ts +3 -0
  127. package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.js +52 -0
  128. package/dist/hooks/useSpaces/validators/areWallsTooShort.d.ts +3 -0
  129. package/dist/hooks/useSpaces/validators/areWallsTooShort.js +37 -0
  130. package/dist/hooks/useSpaces/validators/index.d.ts +15 -0
  131. package/dist/hooks/useSpaces/validators/index.js +40 -0
  132. package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.d.ts +3 -0
  133. package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.js +31 -0
  134. package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.d.ts +3 -0
  135. package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.js +19 -0
  136. package/dist/hooks/useSpaces/validators/isLineTooShort.d.ts +3 -0
  137. package/dist/hooks/useSpaces/validators/isLineTooShort.js +26 -0
  138. package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.d.ts +4 -0
  139. package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.js +19 -0
  140. package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.d.ts +3 -0
  141. package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.js +19 -0
  142. package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.d.ts +3 -0
  143. package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.js +41 -0
  144. package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.d.ts +3 -0
  145. package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.js +54 -0
  146. package/dist/hooks/useSpaces/validators/isWallTooShort.d.ts +3 -0
  147. package/dist/hooks/useSpaces/validators/isWallTooShort.js +10 -0
  148. package/dist/hooks/{useRoomBuilder → useSpaces/validators}/messaging.js +1 -1
  149. package/dist/icons/AngleSnapping.d.ts +3 -0
  150. package/dist/icons/AngleSnapping.js +28 -0
  151. package/dist/icons/Center.d.ts +3 -0
  152. package/dist/icons/Center.js +24 -0
  153. package/dist/icons/Draw.js +3 -3
  154. package/dist/icons/GridSnapping.d.ts +3 -0
  155. package/dist/icons/GridSnapping.js +28 -0
  156. package/dist/icons/LayoutAlt.d.ts +3 -0
  157. package/dist/icons/LayoutAlt.js +21 -0
  158. package/dist/icons/Magnet.d.ts +3 -0
  159. package/dist/icons/Magnet.js +27 -0
  160. package/dist/icons/Player3D.d.ts +3 -0
  161. package/dist/icons/Player3D.js +21 -0
  162. package/dist/icons/Save.d.ts +3 -0
  163. package/dist/icons/Save.js +21 -0
  164. package/dist/icons/UnitCm.d.ts +3 -0
  165. package/dist/icons/UnitCm.js +22 -0
  166. package/dist/icons/UnitFeet.d.ts +3 -0
  167. package/dist/icons/UnitFeet.js +22 -0
  168. package/dist/icons/UnitInch.d.ts +3 -0
  169. package/dist/icons/UnitInch.js +22 -0
  170. package/dist/icons/UnitMeter.d.ts +3 -0
  171. package/dist/icons/UnitMeter.js +21 -0
  172. package/dist/icons/Window.js +4 -4
  173. package/dist/icons/index.js +22 -0
  174. package/dist/icons/types.d.ts +1 -1
  175. package/dist/index.d.ts +17 -3
  176. package/dist/index.js +35 -7
  177. package/dist/store/attributes.d.ts +1 -0
  178. package/dist/store/index.d.ts +39 -8
  179. package/dist/store/index.js +3 -1
  180. package/dist/store/product.js +4 -7
  181. package/dist/store/spaces.d.ts +47 -0
  182. package/dist/store/spaces.js +197 -0
  183. package/dist/store/treble.d.ts +1 -1
  184. package/dist/store/treble.js +24 -26
  185. package/dist/types.d.ts +6 -0
  186. package/package.json +1 -1
  187. package/dist/hooks/useAnimationStart/index.d.ts +0 -2
  188. package/dist/hooks/usePlayerLoadingStatus/index.d.ts +0 -2
  189. package/dist/hooks/useRoomBuilder/RoomBuilderState.d.ts +0 -95
  190. package/dist/hooks/useRoomBuilder/RoomBuilderState.js +0 -1237
  191. package/dist/hooks/useRoomBuilder/constants.d.ts +0 -41
  192. package/dist/hooks/useRoomBuilder/constants.js +0 -48
  193. package/dist/hooks/useRoomBuilder/draw.d.ts +0 -55
  194. package/dist/hooks/useRoomBuilder/draw.js +0 -573
  195. package/dist/hooks/useRoomBuilder/findLoops.d.ts +0 -5
  196. package/dist/hooks/useRoomBuilder/geometry.d.ts +0 -33
  197. package/dist/hooks/useRoomBuilder/geometry.js +0 -325
  198. package/dist/hooks/useRoomBuilder/index.d.ts +0 -40
  199. package/dist/hooks/useRoomBuilder/index.js +0 -303
  200. package/dist/hooks/useRoomBuilder/themes.js +0 -273
  201. package/dist/hooks/useRoomBuilder/validators.d.ts +0 -36
  202. package/dist/hooks/useRoomBuilder/validators.js +0 -362
  203. /package/dist/Treble/{snapshots.d.ts → snapshot.d.ts} +0 -0
  204. /package/dist/Treble/{snapshots.js → snapshot.js} +0 -0
  205. /package/dist/hooks/{useRoomBuilder → useSpaces/validators}/messaging.d.ts +0 -0
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var HIGHLIGHT_COLOR = '#36738E';
4
+ var ACTIVE_COLOR = 'green';
5
+ var ERROR_COLOR = 'red';
6
+ var WALL_THICKNESS = 18;
7
+ var VERTEX_RADIUS = (WALL_THICKNESS - 6) / 2;
8
+ var FEATURE_THICKNESS = WALL_THICKNESS + 6;
9
+ var theme = {
10
+ grid: {
11
+ lineThickness: 2,
12
+ lineColor: '#ddd',
13
+ showSubdivisions: true,
14
+ subdivisionLineThickness: 1,
15
+ subdivisionLineColor: '#ddd',
16
+ subdivisionThreshold: 20,
17
+ backgroundColor: '#fff',
18
+ },
19
+ guides: {
20
+ color: '#00F8FB',
21
+ thickness: 1,
22
+ },
23
+ floor: {
24
+ color: '#eee',
25
+ textColor: '#666',
26
+ },
27
+ dimensions: {
28
+ padding: WALL_THICKNESS / 2 + 12,
29
+ lineThickness: 1,
30
+ lineColor: '#444',
31
+ fontSize: 14,
32
+ font: 'Helvetica',
33
+ textColor: '#444',
34
+ textBackgroundColor: 'white',
35
+ },
36
+ wall: {
37
+ fill: '#d9d9d9',
38
+ stroke: '#d9d9d9',
39
+ strokeWidth: 0,
40
+ thickness: WALL_THICKNESS,
41
+ highlight: {
42
+ fill: HIGHLIGHT_COLOR,
43
+ stroke: HIGHLIGHT_COLOR,
44
+ },
45
+ active: {
46
+ fill: ACTIVE_COLOR,
47
+ stroke: ACTIVE_COLOR,
48
+ },
49
+ error: {
50
+ fill: ERROR_COLOR,
51
+ stroke: ERROR_COLOR,
52
+ },
53
+ },
54
+ vertex: {
55
+ innerFill: '#36738E',
56
+ outerFill: 'white',
57
+ stroke: '#36738E',
58
+ strokeWidth: 2,
59
+ outerRadius: VERTEX_RADIUS,
60
+ innerRadius: VERTEX_RADIUS / 2,
61
+ highlight: {
62
+ innerFill: HIGHLIGHT_COLOR,
63
+ outerFill: HIGHLIGHT_COLOR,
64
+ stroke: HIGHLIGHT_COLOR,
65
+ },
66
+ active: {
67
+ innerFill: ACTIVE_COLOR,
68
+ outerFill: ACTIVE_COLOR,
69
+ stroke: ACTIVE_COLOR,
70
+ },
71
+ error: {
72
+ innerFill: ERROR_COLOR,
73
+ outerFill: ERROR_COLOR,
74
+ stroke: ERROR_COLOR,
75
+ },
76
+ },
77
+ feature: {
78
+ fill: '#888',
79
+ stroke: '#888',
80
+ strokeWidth: 0,
81
+ thickness: FEATURE_THICKNESS,
82
+ highlight: {
83
+ fill: HIGHLIGHT_COLOR,
84
+ stroke: HIGHLIGHT_COLOR,
85
+ },
86
+ active: {
87
+ fill: ACTIVE_COLOR,
88
+ stroke: ACTIVE_COLOR,
89
+ },
90
+ error: {
91
+ fill: ERROR_COLOR,
92
+ stroke: ERROR_COLOR,
93
+ },
94
+ },
95
+ };
96
+ exports.default = theme;
@@ -1,12 +1,11 @@
1
- import type { IRoomBuilderStyles } from './types';
2
1
  export declare enum IThemes {
3
2
  DEFAULT = "default",
4
3
  BLUEPRINT = "blueprint",
5
4
  LIGHT = "light"
6
5
  }
7
6
  declare const _default: {
8
- default: IRoomBuilderStyles;
9
- blueprint: IRoomBuilderStyles;
10
- light: IRoomBuilderStyles;
7
+ default: import("../types").ISpacesStyles;
8
+ blueprint: import("../types").ISpacesStyles;
9
+ light: import("../types").ISpacesStyles;
11
10
  };
12
11
  export default _default;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ var _a;
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.IThemes = void 0;
8
+ var default_1 = __importDefault(require("./default"));
9
+ var blueprint_1 = __importDefault(require("./blueprint"));
10
+ var light_1 = __importDefault(require("./light"));
11
+ var IThemes;
12
+ (function (IThemes) {
13
+ IThemes["DEFAULT"] = "default";
14
+ IThemes["BLUEPRINT"] = "blueprint";
15
+ IThemes["LIGHT"] = "light";
16
+ })(IThemes = exports.IThemes || (exports.IThemes = {}));
17
+ exports.default = (_a = {},
18
+ _a[IThemes.DEFAULT] = default_1.default,
19
+ _a[IThemes.BLUEPRINT] = blueprint_1.default,
20
+ _a[IThemes.LIGHT] = light_1.default,
21
+ _a);
@@ -0,0 +1,3 @@
1
+ import type { ISpacesStyles } from '../types';
2
+ declare const theme: ISpacesStyles;
3
+ export default theme;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var HIGHCOLOR = '#36738E';
4
+ var ACTIVE_COLOR = 'green';
5
+ var ERROR_COLOR = 'red';
6
+ var WALL_THICKNESS = 8;
7
+ var VERTEX_RADIUS = (WALL_THICKNESS + 8) / 2;
8
+ var FEATURE_THICKNESS = WALL_THICKNESS + 4;
9
+ var theme = {
10
+ grid: {
11
+ lineThickness: 2,
12
+ lineColor: '#ddd',
13
+ showSubdivisions: true,
14
+ subdivisionLineThickness: 1,
15
+ subdivisionLineColor: '#ddd',
16
+ subdivisionThreshold: 20,
17
+ backgroundColor: '#fff',
18
+ },
19
+ guides: {
20
+ color: '#00F8FB',
21
+ thickness: 1,
22
+ },
23
+ floor: {
24
+ color: '#eee',
25
+ textColor: '#666',
26
+ },
27
+ dimensions: {
28
+ padding: WALL_THICKNESS / 2 + 12,
29
+ lineThickness: 1,
30
+ lineColor: '#444',
31
+ fontSize: 14,
32
+ font: 'Helvetica',
33
+ textColor: '#444',
34
+ textBackgroundColor: '#fff',
35
+ },
36
+ wall: {
37
+ fill: '#000',
38
+ stroke: '#000',
39
+ strokeWidth: 0,
40
+ thickness: WALL_THICKNESS,
41
+ highlight: {
42
+ fill: HIGHCOLOR,
43
+ stroke: HIGHCOLOR,
44
+ },
45
+ active: {
46
+ fill: ACTIVE_COLOR,
47
+ stroke: ACTIVE_COLOR,
48
+ },
49
+ error: {
50
+ fill: ERROR_COLOR,
51
+ stroke: ERROR_COLOR,
52
+ },
53
+ },
54
+ vertex: {
55
+ innerFill: '#aaa',
56
+ outerFill: '#fff',
57
+ stroke: '#000',
58
+ strokeWidth: 1,
59
+ outerRadius: VERTEX_RADIUS,
60
+ innerRadius: (VERTEX_RADIUS / 5) * 3,
61
+ highlight: {
62
+ innerFill: HIGHCOLOR,
63
+ outerFill: '#fff',
64
+ stroke: '#000',
65
+ },
66
+ active: {
67
+ innerFill: ACTIVE_COLOR,
68
+ outerFill: '#fff',
69
+ stroke: '#000',
70
+ },
71
+ error: {
72
+ innerFill: ERROR_COLOR,
73
+ outerFill: ERROR_COLOR,
74
+ stroke: ERROR_COLOR,
75
+ },
76
+ },
77
+ feature: {
78
+ fill: '#888',
79
+ stroke: '#888',
80
+ strokeWidth: 0,
81
+ thickness: FEATURE_THICKNESS,
82
+ highlight: {
83
+ fill: HIGHCOLOR,
84
+ stroke: HIGHCOLOR,
85
+ },
86
+ active: {
87
+ fill: ACTIVE_COLOR,
88
+ stroke: ACTIVE_COLOR,
89
+ },
90
+ error: {
91
+ fill: ERROR_COLOR,
92
+ stroke: ERROR_COLOR,
93
+ },
94
+ },
95
+ };
96
+ exports.default = theme;
@@ -24,17 +24,14 @@ export interface IWall {
24
24
  assetId: string;
25
25
  line: ICoordinatesLine;
26
26
  path?: ICoordinatesQuadrilateral;
27
- height?: number;
28
- thickness?: number;
29
27
  connections: Array<[elementType: IFeatureName, index: number]>;
28
+ restConfiguration: string;
30
29
  }
31
30
  export interface IWalls extends Array<IWall> {
32
31
  }
33
32
  export interface INewWall {
34
- start: ICoordinate2D;
35
- end?: ICoordinate2D;
36
- snapStartTo?: ISnapPoint;
37
- snapEndTo?: ISnapPoint;
33
+ start: ISnapPoint;
34
+ end?: ISnapPoint;
38
35
  }
39
36
  export interface IVertexConnections extends Array<[wallIndex: number, anchorIndex: number]> {
40
37
  }
@@ -57,27 +54,38 @@ export interface IFeature {
57
54
  assetId: string;
58
55
  offset: number;
59
56
  length: number;
57
+ height: number;
58
+ altitude: number;
60
59
  path?: ICoordinatesQuadrilateral;
61
60
  connectedTo: [elementType: IElements.WALL, index: number];
61
+ restConfiguration: string;
62
62
  }
63
- export interface IFeatureHydrated extends IFeature {
63
+ export interface IFeatureDoor extends IFeature {
64
+ orientation: string;
65
+ openingDirection: string;
66
+ }
67
+ interface IFeatureHydratedShared {
64
68
  line: ICoordinatesLine;
65
69
  }
66
- export interface IFeaturesShared<T> {
70
+ export interface IFeatureHydrated extends IFeature, IFeatureHydratedShared {
71
+ }
72
+ export interface IFeatureDoorHydrated extends IFeatureDoor, IFeatureHydratedShared {
73
+ }
74
+ export interface IFeaturesShared<T, D> {
67
75
  [IElements.WINDOW]?: Array<T>;
68
- [IElements.DOOR]?: Array<T>;
76
+ [IElements.DOOR]?: Array<D>;
69
77
  [IElements.OPENING]?: Array<T>;
70
78
  }
71
- export interface IFeatures extends IFeaturesShared<IFeature> {
79
+ export interface IFeatures extends IFeaturesShared<IFeature, IFeatureDoor> {
72
80
  }
73
- export interface IFeaturesHydrated extends IFeaturesShared<IFeatureHydrated> {
81
+ export interface IFeaturesHydrated extends IFeaturesShared<IFeatureHydrated, IFeatureDoorHydrated> {
74
82
  }
75
83
  export declare enum IElementStyleModes {
76
84
  HIGHLIGHT = "highlight",
77
85
  ACTIVE = "active",
78
86
  ERROR = "error"
79
87
  }
80
- export interface IRoomBuilderStylesShared {
88
+ export interface ISpacesStylesShared {
81
89
  fill: string;
82
90
  stroke?: string;
83
91
  strokeWidth?: number;
@@ -95,12 +103,17 @@ export interface IRoomBuilderStylesShared {
95
103
  };
96
104
  }
97
105
  export interface IStylesGrid {
98
- gridStepGap: number;
99
106
  lineThickness: number;
100
- secondaryLineThickness: number;
101
107
  lineColor: string;
108
+ showSubdivisions: boolean;
109
+ subdivisionLineThickness: number;
110
+ subdivisionLineColor: string;
111
+ subdivisionThreshold: number;
102
112
  backgroundColor?: string;
103
- secondaryLineIncrement?: number;
113
+ }
114
+ export interface IStylesGuides {
115
+ color: string;
116
+ thickness: number;
104
117
  }
105
118
  export interface IStylesFloor {
106
119
  color: string;
@@ -115,10 +128,10 @@ export interface IStylesDimension {
115
128
  textColor: string;
116
129
  textBackgroundColor: string;
117
130
  }
118
- export interface IStylesWall extends IRoomBuilderStylesShared {
131
+ export interface IStylesWall extends ISpacesStylesShared {
119
132
  thickness: number;
120
133
  }
121
- export interface IStylesVertex extends Omit<IRoomBuilderStylesShared, 'fill' | IElementStyleModes.HIGHLIGHT | IElementStyleModes.ACTIVE | IElementStyleModes.ERROR> {
134
+ export interface IStylesVertex extends Omit<ISpacesStylesShared, 'fill' | IElementStyleModes.HIGHLIGHT | IElementStyleModes.ACTIVE | IElementStyleModes.ERROR> {
122
135
  innerFill: string;
123
136
  outerFill: string;
124
137
  innerRadius: number;
@@ -141,22 +154,66 @@ export interface IStylesVertex extends Omit<IRoomBuilderStylesShared, 'fill' | I
141
154
  }
142
155
  export interface IStylesFeature extends IStylesWall {
143
156
  }
144
- export interface IRoomBuilderStyles {
157
+ export interface ISpacesStyles {
145
158
  grid: IStylesGrid;
159
+ guides: IStylesGuides;
146
160
  floor: IStylesFloor;
147
161
  dimensions: IStylesDimension;
148
162
  wall: IStylesWall;
149
163
  vertex: IStylesVertex;
150
164
  feature: IStylesFeature;
151
165
  }
152
- export interface IRoomBuilderThemePartial {
166
+ export interface ISpacesThemePartial {
153
167
  grid: Partial<IStylesGrid>;
168
+ guides: Partial<IStylesGuides>;
154
169
  floor: Partial<IStylesFloor>;
155
170
  dimensions: Partial<IStylesDimension>;
156
171
  wall: Partial<IStylesWall>;
157
172
  vertex: Partial<IStylesVertex>;
158
173
  feature: Partial<IStylesFeature>;
159
174
  }
175
+ export interface IGridToDraw {
176
+ unitLength: number;
177
+ offset: ICoordinate2D;
178
+ subdivisions: number;
179
+ showSubdivisions: boolean;
180
+ }
181
+ export interface IWallsValidationConfig {
182
+ minLength: number;
183
+ padding: number;
184
+ }
185
+ export interface ISharedValidatorInput {
186
+ walls: IWalls;
187
+ features: IFeatures;
188
+ }
189
+ export interface IFeatureValidatorInput {
190
+ wall: IWall;
191
+ updatedFeature: Pick<IFeature, 'length' | 'offset'> & {
192
+ address: IElementAddress;
193
+ };
194
+ }
195
+ export interface IAddWallValidatorInput {
196
+ newWall: Pick<IWall, 'line'> & Pick<INewWall, 'start' | 'end'>;
197
+ }
198
+ export interface IMoveVertexValidatorInput {
199
+ updatedPosition: ISnapPoint;
200
+ vertex: IVertex;
201
+ }
202
+ export declare type IValidatorFunction<T> = (input: T, wallsAndFeatures: ISharedValidatorInput, validationConfig: IWallsValidationConfig) => false | IErrorElement;
203
+ export declare enum SNAPPING_TYPES {
204
+ NONE = "none",
205
+ ANGLE = "angle",
206
+ GUIDE = "guide",
207
+ GRID = "grid"
208
+ }
209
+ export declare enum GUIDE_ORIENTATIONS {
210
+ HORIZONTAL = "horizontal",
211
+ VERTICAL = "vertical"
212
+ }
213
+ export interface IGuides {
214
+ point: ICoordinate2D;
215
+ orientations: Array<GUIDE_ORIENTATIONS>;
216
+ }
160
217
  export interface IElementAddress {
161
218
  type: IElementName;
162
219
  index: number;
@@ -167,19 +224,31 @@ export interface IFeatureAddress {
167
224
  }
168
225
  export interface ISnapPointShared<T> {
169
226
  type: T;
170
- index: number;
171
227
  point: ICoordinate2D;
228
+ locked: [boolean, boolean];
229
+ }
230
+ export interface ISnapPointNone extends ISnapPointShared<SNAPPING_TYPES.NONE> {
231
+ locked: [false, false];
172
232
  }
173
233
  export interface ISnapPointVertex extends ISnapPointShared<IElements.VERTEX> {
234
+ index: number;
235
+ locked: [true, true];
174
236
  }
175
237
  export interface ISnapPointWall extends ISnapPointShared<IElements.WALL> {
176
238
  offset: number;
239
+ index: number;
177
240
  }
178
241
  export interface ISnapPointFeature extends ISnapPointShared<IFeatureName> {
242
+ index: number;
179
243
  }
180
- export interface ISnapPointAngle extends Omit<ISnapPointShared<'Angle'>, 'index'> {
244
+ export interface ISnapPointAngle extends ISnapPointShared<SNAPPING_TYPES.ANGLE>, Pick<IGuides, 'orientations'> {
181
245
  }
182
- export declare type ISnapPoint = ISnapPointVertex | ISnapPointWall | ISnapPointFeature | ISnapPointAngle;
246
+ export interface ISnapPointGuide extends ISnapPointShared<SNAPPING_TYPES.GUIDE>, Pick<IGuides, 'orientations'> {
247
+ }
248
+ export interface ISnapPointGrid extends ISnapPointShared<SNAPPING_TYPES.GRID>, Pick<IGuides, 'orientations'> {
249
+ locked: [true, true];
250
+ }
251
+ export declare type ISnapPoint = ISnapPointNone | ISnapPointVertex | ISnapPointWall | ISnapPointFeature | ISnapPointAngle | ISnapPointGuide | ISnapPointGrid;
183
252
  export interface IActiveElement extends IElementAddress {
184
253
  snapPoint?: ISnapPoint;
185
254
  }
@@ -199,6 +268,10 @@ export interface IElementUi {
199
268
  }
200
269
  export interface IElementPublic extends Pick<IElementUi, 'uiAnchor'> {
201
270
  path: [attribute: string, index: number];
271
+ type: IFeatureName | IElements.WALL;
272
+ deleteElement: () => void;
273
+ splitWall?: (offset?: number) => void;
274
+ addFeature?: (type: IFeatureName, feature?: Partial<IFeature>) => void;
202
275
  }
203
276
  export declare enum IModes {
204
277
  SELECT = "select",
@@ -210,29 +283,52 @@ export declare enum IUnits {
210
283
  INCH = "inch",
211
284
  CM = "cm"
212
285
  }
213
- export interface IRoomBuilderConfigShared<T> {
286
+ export interface ISpacesConfigShared<T> {
214
287
  scale: number;
215
288
  unit: IUnits;
216
289
  snapProximity: number;
217
290
  styles: T;
291
+ zoomDefault: number;
292
+ translateDefault: ICoordinate2D;
293
+ disableGuides: boolean;
218
294
  }
219
- export interface IRoomBuilderConfigInternal extends IRoomBuilderConfigShared<IRoomBuilderStyles> {
295
+ export interface ISpacesConfigInternal extends ISpacesConfigShared<ISpacesStyles> {
220
296
  }
221
- export interface IRoomBuilderConfigUser extends IRoomBuilderConfigShared<Partial<IRoomBuilderStyles>> {
222
- theme?: string;
297
+ export interface ISpacesConfigUser extends ISpacesConfigShared<Partial<ISpacesStyles>> {
298
+ theme: string;
299
+ zoomDisabled: boolean;
300
+ translateDisabled: boolean;
301
+ zoomSensitivity: number;
223
302
  }
224
- export interface IRoomBuilderAttributes {
303
+ export interface ISpacesAttributes {
225
304
  [IElements.WALL]: string;
226
- [IElements.WINDOW]?: string;
227
- [IElements.DOOR]?: string;
228
- [IElements.OPENING]?: string;
229
- }
230
- interface IRoomBuilderPropsShared<T> {
305
+ [IElements.WINDOW]: string;
306
+ [IElements.DOOR]: string;
307
+ [IElements.OPENING]: string;
308
+ featurePositionX: string;
309
+ featurePositionY: string;
310
+ featureConnectedTo: string;
311
+ featureHeight: string;
312
+ featureLength: string;
313
+ wallStartX: string;
314
+ wallStartY: string;
315
+ wallStartZ: string;
316
+ wallEndX: string;
317
+ wallEndY: string;
318
+ wallEndZ: string;
319
+ wallConnections: string;
320
+ doorOrientation: string;
321
+ doorOpeningDirection: string;
322
+ }
323
+ export interface IAttributeDefaults extends Partial<Record<IElements.WALL | IElements.WINDOW | IElements.DOOR | IElements.OPENING, string>> {
324
+ }
325
+ interface ISpacesPropsShared<T, U> {
231
326
  config: T;
232
- attributes: IRoomBuilderAttributes;
327
+ attributes: U;
328
+ layouts?: Array<string>;
233
329
  }
234
- export interface IRoomBuilderHookProps extends IRoomBuilderPropsShared<undefined | Partial<IRoomBuilderConfigUser>> {
330
+ export interface ISpacesHookProps extends ISpacesPropsShared<undefined | Partial<ISpacesConfigUser>, undefined | Partial<ISpacesAttributes>> {
235
331
  }
236
- export interface IRoomBuilderStateProps extends IRoomBuilderPropsShared<IRoomBuilderConfigInternal> {
332
+ export interface ISpacesStateProps extends ISpacesPropsShared<ISpacesConfigInternal, ISpacesAttributes> {
237
333
  }
238
334
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IUnits = exports.IModes = exports.IErrorTypes = exports.IElementStyleModes = exports.IElements = void 0;
3
+ exports.IUnits = exports.IModes = exports.IErrorTypes = exports.GUIDE_ORIENTATIONS = exports.SNAPPING_TYPES = exports.IElementStyleModes = exports.IElements = void 0;
4
4
  var IElements;
5
5
  (function (IElements) {
6
6
  IElements["WALL"] = "walls";
@@ -16,6 +16,18 @@ var IElementStyleModes;
16
16
  IElementStyleModes["ACTIVE"] = "active";
17
17
  IElementStyleModes["ERROR"] = "error";
18
18
  })(IElementStyleModes = exports.IElementStyleModes || (exports.IElementStyleModes = {}));
19
+ var SNAPPING_TYPES;
20
+ (function (SNAPPING_TYPES) {
21
+ SNAPPING_TYPES["NONE"] = "none";
22
+ SNAPPING_TYPES["ANGLE"] = "angle";
23
+ SNAPPING_TYPES["GUIDE"] = "guide";
24
+ SNAPPING_TYPES["GRID"] = "grid";
25
+ })(SNAPPING_TYPES = exports.SNAPPING_TYPES || (exports.SNAPPING_TYPES = {}));
26
+ var GUIDE_ORIENTATIONS;
27
+ (function (GUIDE_ORIENTATIONS) {
28
+ GUIDE_ORIENTATIONS["HORIZONTAL"] = "horizontal";
29
+ GUIDE_ORIENTATIONS["VERTICAL"] = "vertical";
30
+ })(GUIDE_ORIENTATIONS = exports.GUIDE_ORIENTATIONS || (exports.GUIDE_ORIENTATIONS = {}));
19
31
  var IErrorTypes;
20
32
  (function (IErrorTypes) {
21
33
  IErrorTypes["HARD"] = "hard";
@@ -0,0 +1,3 @@
1
+ import type { IErrorElement, IMoveVertexValidatorInput, ISharedValidatorInput } from '../types';
2
+ declare function areWallsDuplicated(input: IMoveVertexValidatorInput, wallAndFeatures: ISharedValidatorInput): false | IErrorElement;
3
+ export default areWallsDuplicated;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var geometry_1 = require("../geometry");
4
+ var messaging_1 = require("./messaging");
5
+ var types_1 = require("../types");
6
+ function areWallsDuplicated(input, wallAndFeatures) {
7
+ var vertex = input.vertex, updatedPosition = input.updatedPosition;
8
+ var walls = wallAndFeatures.walls;
9
+ var point = updatedPosition.point;
10
+ var _a = vertex.connections.reduce(function (output, connection) {
11
+ var _a;
12
+ var wallIndex = connection[0], vertexIndex = connection[1];
13
+ output.wallIndexes.add(wallIndex);
14
+ output.updatedVerticesMap = Object.assign(output.updatedVerticesMap, (_a = {},
15
+ _a[wallIndex] = vertexIndex,
16
+ _a));
17
+ return output;
18
+ }, {
19
+ wallIndexes: new Set([]),
20
+ updatedVerticesMap: {},
21
+ }), wallIndexes = _a.wallIndexes, updatedVerticesMap = _a.updatedVerticesMap;
22
+ for (var _i = 0, _b = Array.from(wallIndexes); _i < _b.length; _i++) {
23
+ var wallIdx = _b[_i];
24
+ var wall = walls[wallIdx];
25
+ var updatedLine = JSON.parse(JSON.stringify(wall.line));
26
+ updatedLine[updatedVerticesMap[wallIdx]] = point;
27
+ if ((updatedPosition === null || updatedPosition === void 0 ? void 0 : updatedPosition.type) === types_1.IElements.WALL &&
28
+ updatedPosition.index !== wallIdx) {
29
+ var _c = walls[updatedPosition.index].line, xTest = _c[0], yTest = _c[1];
30
+ var unmovedPoint = updatedLine[updatedVerticesMap[wallIdx] === 1 ? 0 : 1];
31
+ if ((0, geometry_1.arePointsEqual)(unmovedPoint, xTest) ||
32
+ (0, geometry_1.arePointsEqual)(unmovedPoint, yTest))
33
+ return {
34
+ address: {
35
+ type: types_1.IElements.WALL,
36
+ index: updatedPosition.index,
37
+ },
38
+ type: types_1.IErrorTypes.SOFT,
39
+ message: messaging_1.errorMessages.wallsNotUnique(),
40
+ };
41
+ }
42
+ for (var i = 0; i < walls.length; i++) {
43
+ if (wallIdx === i)
44
+ continue;
45
+ var existingWall = walls[i];
46
+ var error = {
47
+ address: { type: types_1.IElements.WALL, index: i },
48
+ type: types_1.IErrorTypes.SOFT,
49
+ message: messaging_1.errorMessages.wallsNotUnique(),
50
+ };
51
+ if (((0, geometry_1.arePointsEqual)(existingWall[0], wall.line[0]) &&
52
+ (0, geometry_1.arePointsEqual)(existingWall[1], wall.line[1])) ||
53
+ ((0, geometry_1.arePointsEqual)(existingWall[0], wall.line[1]) &&
54
+ (0, geometry_1.arePointsEqual)(existingWall[1], wall.line[0]))) {
55
+ return error;
56
+ }
57
+ }
58
+ }
59
+ return false;
60
+ }
61
+ exports.default = areWallsDuplicated;
@@ -0,0 +1,3 @@
1
+ import type { IErrorElement, IMoveVertexValidatorInput, ISharedValidatorInput } from '../types';
2
+ declare function areWallsIntersecting(input: IMoveVertexValidatorInput, wallAndFeatures: ISharedValidatorInput): false | IErrorElement;
3
+ export default areWallsIntersecting;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var geometry_1 = require("../geometry");
4
+ var messaging_1 = require("./messaging");
5
+ var types_1 = require("../types");
6
+ function areWallsIntersecting(input, wallAndFeatures) {
7
+ var vertex = input.vertex, updatedPosition = input.updatedPosition;
8
+ var walls = wallAndFeatures.walls;
9
+ var _a = vertex.connections.reduce(function (output, connection) {
10
+ var _a;
11
+ var wallIndex = connection[0], vertexIndex = connection[1];
12
+ output.wallIndexes.add(wallIndex);
13
+ output.updatedVerticesMap = Object.assign(output.updatedVerticesMap, (_a = {},
14
+ _a[wallIndex] = vertexIndex,
15
+ _a));
16
+ return output;
17
+ }, {
18
+ wallIndexes: new Set([]),
19
+ updatedVerticesMap: {},
20
+ }), wallIndexes = _a.wallIndexes, updatedVerticesMap = _a.updatedVerticesMap;
21
+ for (var _i = 0, _b = Array.from(wallIndexes); _i < _b.length; _i++) {
22
+ var validateWallIndex = _b[_i];
23
+ var line = walls[validateWallIndex].line;
24
+ line[updatedVerticesMap[validateWallIndex]] = updatedPosition.point;
25
+ for (var i = 0; i < walls.length; i++) {
26
+ if (wallIndexes.has(i))
27
+ continue;
28
+ var wall = walls[i];
29
+ if (!wall)
30
+ continue;
31
+ var intersectionPoint = (0, geometry_1.getLineSegmentsIntersection)(line, wall.line);
32
+ if (intersectionPoint)
33
+ return {
34
+ address: { type: types_1.IElements.WALL, index: i },
35
+ message: messaging_1.errorMessages.addWallCollidingWithWall(),
36
+ type: types_1.IErrorTypes.SOFT,
37
+ };
38
+ }
39
+ }
40
+ return false;
41
+ }
42
+ exports.default = areWallsIntersecting;
@@ -0,0 +1,3 @@
1
+ import type { IErrorElement, IMoveVertexValidatorInput, ISharedValidatorInput, IWallsValidationConfig } from '../types';
2
+ declare function areWallsOrphaningFeatures(input: IMoveVertexValidatorInput, wallAndFeatures: ISharedValidatorInput, validationConfig: IWallsValidationConfig): false | IErrorElement;
3
+ export default areWallsOrphaningFeatures;