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

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