@threekit-tools/treble 0.0.95-next-01 → 0.0.96

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 (202) 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/useRoomBuilder/dataHandlers.d.ts +18 -0
  11. package/dist/hooks/useRoomBuilder/dataHandlers.js +187 -0
  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 +13 -31
  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/useRoomBuilder/types.d.ts +238 -0
  24. package/dist/hooks/{useSpaces → useRoomBuilder}/types.js +1 -19
  25. package/dist/hooks/useRoomBuilder/validators.d.ts +36 -0
  26. package/dist/hooks/useRoomBuilder/validators.js +362 -0
  27. package/dist/icons/Draw.js +3 -3
  28. package/dist/icons/Window.js +4 -4
  29. package/dist/icons/index.js +0 -28
  30. package/dist/icons/types.d.ts +1 -1
  31. package/dist/index.d.ts +2 -17
  32. package/dist/index.js +5 -35
  33. package/dist/store/attributes.d.ts +0 -1
  34. package/dist/store/index.d.ts +0 -10
  35. package/dist/store/index.js +1 -3
  36. package/dist/store/product.js +7 -4
  37. package/dist/store/treble.d.ts +1 -1
  38. package/dist/store/treble.js +21 -14
  39. package/dist/types.d.ts +1 -3
  40. package/package.json +1 -1
  41. package/dist/hooks/useSpaces/SpacesLayout.d.ts +0 -11
  42. package/dist/hooks/useSpaces/SpacesLayout.js +0 -74
  43. package/dist/hooks/useSpaces/SpacesState.d.ts +0 -177
  44. package/dist/hooks/useSpaces/SpacesState.js +0 -1816
  45. package/dist/hooks/useSpaces/constants.d.ts +0 -79
  46. package/dist/hooks/useSpaces/constants.js +0 -130
  47. package/dist/hooks/useSpaces/dataHandlers.d.ts +0 -38
  48. package/dist/hooks/useSpaces/dataHandlers.js +0 -411
  49. package/dist/hooks/useSpaces/draw/clearCanvas.d.ts +0 -2
  50. package/dist/hooks/useSpaces/draw/clearCanvas.js +0 -9
  51. package/dist/hooks/useSpaces/draw/drawBackground.d.ts +0 -2
  52. package/dist/hooks/useSpaces/draw/drawBackground.js +0 -12
  53. package/dist/hooks/useSpaces/draw/drawDimensions.d.ts +0 -3
  54. package/dist/hooks/useSpaces/draw/drawDimensions.js +0 -53
  55. package/dist/hooks/useSpaces/draw/drawDoors.d.ts +0 -9
  56. package/dist/hooks/useSpaces/draw/drawDoors.js +0 -99
  57. package/dist/hooks/useSpaces/draw/drawFloor.d.ts +0 -3
  58. package/dist/hooks/useSpaces/draw/drawFloor.js +0 -36
  59. package/dist/hooks/useSpaces/draw/drawGrid.d.ts +0 -3
  60. package/dist/hooks/useSpaces/draw/drawGrid.js +0 -36
  61. package/dist/hooks/useSpaces/draw/drawGuides.d.ts +0 -3
  62. package/dist/hooks/useSpaces/draw/drawGuides.js +0 -23
  63. package/dist/hooks/useSpaces/draw/drawOpenings.d.ts +0 -9
  64. package/dist/hooks/useSpaces/draw/drawOpenings.js +0 -72
  65. package/dist/hooks/useSpaces/draw/drawVertices.d.ts +0 -8
  66. package/dist/hooks/useSpaces/draw/drawVertices.js +0 -61
  67. package/dist/hooks/useSpaces/draw/drawWalls.d.ts +0 -11
  68. package/dist/hooks/useSpaces/draw/drawWalls.js +0 -90
  69. package/dist/hooks/useSpaces/draw/drawWindows.d.ts +0 -9
  70. package/dist/hooks/useSpaces/draw/drawWindows.js +0 -82
  71. package/dist/hooks/useSpaces/draw/index.d.ts +0 -11
  72. package/dist/hooks/useSpaces/draw/index.js +0 -129
  73. package/dist/hooks/useSpaces/geometry/addThicknessToLine.d.ts +0 -3
  74. package/dist/hooks/useSpaces/geometry/addThicknessToLine.js +0 -13
  75. package/dist/hooks/useSpaces/geometry/areLinesEqual.d.ts +0 -3
  76. package/dist/hooks/useSpaces/geometry/areLinesEqual.js +0 -17
  77. package/dist/hooks/useSpaces/geometry/arePointsEqual.d.ts +0 -3
  78. package/dist/hooks/useSpaces/geometry/arePointsEqual.js +0 -8
  79. package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.d.ts +0 -3
  80. package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.js +0 -11
  81. package/dist/hooks/useSpaces/geometry/closestPointOnLine.d.ts +0 -3
  82. package/dist/hooks/useSpaces/geometry/closestPointOnLine.js +0 -13
  83. package/dist/hooks/useSpaces/geometry/doLinesOverlap.d.ts +0 -2
  84. package/dist/hooks/useSpaces/geometry/doLinesOverlap.js +0 -16
  85. package/dist/hooks/useSpaces/geometry/euclideanMod.d.ts +0 -2
  86. package/dist/hooks/useSpaces/geometry/euclideanMod.js +0 -6
  87. package/dist/hooks/useSpaces/geometry/findLoops.d.ts +0 -6
  88. package/dist/hooks/useSpaces/geometry/getAllLineIntersections.d.ts +0 -6
  89. package/dist/hooks/useSpaces/geometry/getAllLineIntersections.js +0 -23
  90. package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.d.ts +0 -3
  91. package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.js +0 -7
  92. package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.d.ts +0 -3
  93. package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.js +0 -17
  94. package/dist/hooks/useSpaces/geometry/getDistanceToLine.d.ts +0 -3
  95. package/dist/hooks/useSpaces/geometry/getDistanceToLine.js +0 -10
  96. package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.d.ts +0 -3
  97. package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.js +0 -7
  98. package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.d.ts +0 -3
  99. package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.js +0 -17
  100. package/dist/hooks/useSpaces/geometry/getLineOtherPoint.d.ts +0 -3
  101. package/dist/hooks/useSpaces/geometry/getLineOtherPoint.js +0 -11
  102. package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.d.ts +0 -3
  103. package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.js +0 -43
  104. package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.d.ts +0 -3
  105. package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.js +0 -9
  106. package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.d.ts +0 -3
  107. package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.js +0 -20
  108. package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.d.ts +0 -3
  109. package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.js +0 -11
  110. package/dist/hooks/useSpaces/geometry/getPolygonArea.d.ts +0 -3
  111. package/dist/hooks/useSpaces/geometry/getPolygonArea.js +0 -15
  112. package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.d.ts +0 -3
  113. package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.js +0 -16
  114. package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.d.ts +0 -6
  115. package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.js +0 -17
  116. package/dist/hooks/useSpaces/geometry/getTriangleArea.d.ts +0 -3
  117. package/dist/hooks/useSpaces/geometry/getTriangleArea.js +0 -9
  118. package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.d.ts +0 -3
  119. package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.js +0 -12
  120. package/dist/hooks/useSpaces/geometry/index.d.ts +0 -30
  121. package/dist/hooks/useSpaces/geometry/index.js +0 -64
  122. package/dist/hooks/useSpaces/geometry/isPointInPolygon.d.ts +0 -3
  123. package/dist/hooks/useSpaces/geometry/isPointInPolygon.js +0 -21
  124. package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.d.ts +0 -3
  125. package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.js +0 -25
  126. package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.d.ts +0 -3
  127. package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.js +0 -11
  128. package/dist/hooks/useSpaces/geometry/splitLineAtOffset.d.ts +0 -3
  129. package/dist/hooks/useSpaces/geometry/splitLineAtOffset.js +0 -12
  130. package/dist/hooks/useSpaces/geometry/splitLineAtPoint.d.ts +0 -3
  131. package/dist/hooks/useSpaces/geometry/splitLineAtPoint.js +0 -9
  132. package/dist/hooks/useSpaces/geometry/splitLineAtPoints.d.ts +0 -3
  133. package/dist/hooks/useSpaces/geometry/splitLineAtPoints.js +0 -28
  134. package/dist/hooks/useSpaces/index.d.ts +0 -95
  135. package/dist/hooks/useSpaces/index.js +0 -625
  136. package/dist/hooks/useSpaces/themes/blueprint.d.ts +0 -3
  137. package/dist/hooks/useSpaces/themes/blueprint.js +0 -96
  138. package/dist/hooks/useSpaces/themes/default.d.ts +0 -3
  139. package/dist/hooks/useSpaces/themes/default.js +0 -96
  140. package/dist/hooks/useSpaces/themes/index.js +0 -21
  141. package/dist/hooks/useSpaces/themes/light.d.ts +0 -3
  142. package/dist/hooks/useSpaces/themes/light.js +0 -96
  143. package/dist/hooks/useSpaces/types.d.ts +0 -378
  144. package/dist/hooks/useSpaces/validators/areWallsDuplicated.d.ts +0 -3
  145. package/dist/hooks/useSpaces/validators/areWallsDuplicated.js +0 -61
  146. package/dist/hooks/useSpaces/validators/areWallsIntersecting.d.ts +0 -3
  147. package/dist/hooks/useSpaces/validators/areWallsIntersecting.js +0 -42
  148. package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.d.ts +0 -3
  149. package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.js +0 -52
  150. package/dist/hooks/useSpaces/validators/areWallsTooShort.d.ts +0 -3
  151. package/dist/hooks/useSpaces/validators/areWallsTooShort.js +0 -37
  152. package/dist/hooks/useSpaces/validators/index.d.ts +0 -15
  153. package/dist/hooks/useSpaces/validators/index.js +0 -40
  154. package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.d.ts +0 -3
  155. package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.js +0 -31
  156. package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.d.ts +0 -3
  157. package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.js +0 -19
  158. package/dist/hooks/useSpaces/validators/isLineTooShort.d.ts +0 -3
  159. package/dist/hooks/useSpaces/validators/isLineTooShort.js +0 -26
  160. package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.d.ts +0 -4
  161. package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.js +0 -19
  162. package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.d.ts +0 -3
  163. package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.js +0 -19
  164. package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.d.ts +0 -3
  165. package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.js +0 -41
  166. package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.d.ts +0 -3
  167. package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.js +0 -54
  168. package/dist/hooks/useSpaces/validators/isWallTooShort.d.ts +0 -3
  169. package/dist/hooks/useSpaces/validators/isWallTooShort.js +0 -10
  170. package/dist/icons/AngleSnapping.d.ts +0 -3
  171. package/dist/icons/AngleSnapping.js +0 -28
  172. package/dist/icons/Boundary.d.ts +0 -3
  173. package/dist/icons/Boundary.js +0 -21
  174. package/dist/icons/Center.d.ts +0 -3
  175. package/dist/icons/Center.js +0 -24
  176. package/dist/icons/GridSnapping.d.ts +0 -3
  177. package/dist/icons/GridSnapping.js +0 -28
  178. package/dist/icons/LayoutAlt.d.ts +0 -3
  179. package/dist/icons/LayoutAlt.js +0 -21
  180. package/dist/icons/Magnet.d.ts +0 -3
  181. package/dist/icons/Magnet.js +0 -27
  182. package/dist/icons/Player3D.d.ts +0 -3
  183. package/dist/icons/Player3D.js +0 -21
  184. package/dist/icons/RulerBlank.d.ts +0 -3
  185. package/dist/icons/RulerBlank.js +0 -25
  186. package/dist/icons/RulerDetailed.d.ts +0 -3
  187. package/dist/icons/RulerDetailed.js +0 -27
  188. package/dist/icons/Save.d.ts +0 -3
  189. package/dist/icons/Save.js +0 -21
  190. package/dist/icons/UnitCm.d.ts +0 -3
  191. package/dist/icons/UnitCm.js +0 -22
  192. package/dist/icons/UnitFeet.d.ts +0 -3
  193. package/dist/icons/UnitFeet.js +0 -22
  194. package/dist/icons/UnitInch.d.ts +0 -3
  195. package/dist/icons/UnitInch.js +0 -22
  196. package/dist/icons/UnitMeter.d.ts +0 -3
  197. package/dist/icons/UnitMeter.js +0 -21
  198. package/dist/store/spaces.d.ts +0 -74
  199. package/dist/store/spaces.js +0 -354
  200. /package/dist/Treble/{snapshot.d.ts → snapshots.d.ts} +0 -0
  201. /package/dist/Treble/{snapshot.js → snapshots.js} +0 -0
  202. /package/dist/hooks/{useSpaces/validators → useRoomBuilder}/messaging.d.ts +0 -0
@@ -0,0 +1,238 @@
1
+ export declare type ICoordinate2D = [x: number, y: number];
2
+ export declare type ICoordinate3D = [x: number, y: number, z: number];
3
+ export declare type ICoordinatesLine = [
4
+ startPoint: ICoordinate2D,
5
+ endPoint: ICoordinate2D
6
+ ];
7
+ export declare type ICoordinatesQuadrilateral = [
8
+ point1: ICoordinate2D,
9
+ point2: ICoordinate2D,
10
+ point3: ICoordinate2D,
11
+ point4: ICoordinate2D
12
+ ];
13
+ export declare enum IElements {
14
+ WALL = "walls",
15
+ VERTEX = "vertex",
16
+ FEATURE = "features",
17
+ WINDOW = "windows",
18
+ DOOR = "doors",
19
+ OPENING = "openings"
20
+ }
21
+ export declare type IFeatureName = IElements.WINDOW | IElements.DOOR | IElements.OPENING;
22
+ export declare type IElementName = IElements.WALL | IElements.VERTEX | IFeatureName;
23
+ export interface IWall {
24
+ assetId: string;
25
+ line: ICoordinatesLine;
26
+ path?: ICoordinatesQuadrilateral;
27
+ height?: number;
28
+ thickness?: number;
29
+ connections: Array<[elementType: IFeatureName, index: number]>;
30
+ }
31
+ export interface IWalls extends Array<IWall> {
32
+ }
33
+ export interface INewWall {
34
+ start: ICoordinate2D;
35
+ end?: ICoordinate2D;
36
+ snapStartTo?: ISnapPoint;
37
+ snapEndTo?: ISnapPoint;
38
+ }
39
+ export interface IVertexConnections extends Array<[wallIndex: number, anchorIndex: number]> {
40
+ }
41
+ export interface IVerticesState extends Record<string, IVertexConnections> {
42
+ }
43
+ export interface IVertex {
44
+ point: ICoordinate2D;
45
+ connections: IVertexConnections;
46
+ }
47
+ export interface ILineDimensions {
48
+ label: string;
49
+ line: ICoordinatesLine;
50
+ }
51
+ export interface IEnclosedSpace {
52
+ area: string;
53
+ center: ICoordinate2D;
54
+ loop: Array<ICoordinate2D>;
55
+ }
56
+ export interface IFeature {
57
+ assetId: string;
58
+ offset: number;
59
+ length: number;
60
+ path?: ICoordinatesQuadrilateral;
61
+ connectedTo: [elementType: IElements.WALL, index: number];
62
+ }
63
+ export interface IFeatureHydrated extends IFeature {
64
+ line: ICoordinatesLine;
65
+ }
66
+ export interface IFeaturesShared<T> {
67
+ [IElements.WINDOW]?: Array<T>;
68
+ [IElements.DOOR]?: Array<T>;
69
+ [IElements.OPENING]?: Array<T>;
70
+ }
71
+ export interface IFeatures extends IFeaturesShared<IFeature> {
72
+ }
73
+ export interface IFeaturesHydrated extends IFeaturesShared<IFeatureHydrated> {
74
+ }
75
+ export declare enum IElementStyleModes {
76
+ HIGHLIGHT = "highlight",
77
+ ACTIVE = "active",
78
+ ERROR = "error"
79
+ }
80
+ export interface IRoomBuilderStylesShared {
81
+ fill: string;
82
+ stroke?: string;
83
+ strokeWidth?: number;
84
+ [IElementStyleModes.HIGHLIGHT]: {
85
+ fill: string;
86
+ stroke: string;
87
+ };
88
+ [IElementStyleModes.ACTIVE]: {
89
+ fill: string;
90
+ stroke: string;
91
+ };
92
+ [IElementStyleModes.ERROR]: {
93
+ fill: string;
94
+ stroke: string;
95
+ };
96
+ }
97
+ export interface IStylesGrid {
98
+ gridStepGap: number;
99
+ lineThickness: number;
100
+ secondaryLineThickness: number;
101
+ lineColor: string;
102
+ backgroundColor?: string;
103
+ secondaryLineIncrement?: number;
104
+ }
105
+ export interface IStylesFloor {
106
+ color: string;
107
+ textColor: string;
108
+ }
109
+ export interface IStylesDimension {
110
+ padding: number;
111
+ lineThickness: number;
112
+ lineColor: string;
113
+ fontSize: number;
114
+ font: string;
115
+ textColor: string;
116
+ textBackgroundColor: string;
117
+ }
118
+ export interface IStylesWall extends IRoomBuilderStylesShared {
119
+ thickness: number;
120
+ }
121
+ export interface IStylesVertex extends Omit<IRoomBuilderStylesShared, 'fill' | IElementStyleModes.HIGHLIGHT | IElementStyleModes.ACTIVE | IElementStyleModes.ERROR> {
122
+ innerFill: string;
123
+ outerFill: string;
124
+ innerRadius: number;
125
+ outerRadius?: number;
126
+ [IElementStyleModes.HIGHLIGHT]: {
127
+ innerFill: string;
128
+ outerFill: string;
129
+ stroke?: string;
130
+ };
131
+ [IElementStyleModes.ACTIVE]: {
132
+ innerFill: string;
133
+ outerFill: string;
134
+ stroke?: string;
135
+ };
136
+ [IElementStyleModes.ERROR]: {
137
+ innerFill: string;
138
+ outerFill: string;
139
+ stroke?: string;
140
+ };
141
+ }
142
+ export interface IStylesFeature extends IStylesWall {
143
+ }
144
+ export interface IRoomBuilderStyles {
145
+ grid: IStylesGrid;
146
+ floor: IStylesFloor;
147
+ dimensions: IStylesDimension;
148
+ wall: IStylesWall;
149
+ vertex: IStylesVertex;
150
+ feature: IStylesFeature;
151
+ }
152
+ export interface IRoomBuilderThemePartial {
153
+ grid: Partial<IStylesGrid>;
154
+ floor: Partial<IStylesFloor>;
155
+ dimensions: Partial<IStylesDimension>;
156
+ wall: Partial<IStylesWall>;
157
+ vertex: Partial<IStylesVertex>;
158
+ feature: Partial<IStylesFeature>;
159
+ }
160
+ export interface IElementAddress {
161
+ type: IElementName;
162
+ index: number;
163
+ }
164
+ export interface IFeatureAddress {
165
+ type: IFeatureName;
166
+ index: number;
167
+ }
168
+ export interface ISnapPointShared<T> {
169
+ type: T;
170
+ index: number;
171
+ point: ICoordinate2D;
172
+ }
173
+ export interface ISnapPointVertex extends ISnapPointShared<IElements.VERTEX> {
174
+ }
175
+ export interface ISnapPointWall extends ISnapPointShared<IElements.WALL> {
176
+ offset: number;
177
+ }
178
+ export interface ISnapPointFeature extends ISnapPointShared<IFeatureName> {
179
+ }
180
+ export interface ISnapPointAngle extends Omit<ISnapPointShared<'Angle'>, 'index'> {
181
+ }
182
+ export declare type ISnapPoint = ISnapPointVertex | ISnapPointWall | ISnapPointFeature | ISnapPointAngle;
183
+ export interface IActiveElement extends IElementAddress {
184
+ snapPoint?: ISnapPoint;
185
+ }
186
+ export declare enum IErrorTypes {
187
+ HARD = "hard",
188
+ SOFT = "soft",
189
+ WARN = "warning"
190
+ }
191
+ export interface IErrorElement {
192
+ address?: IElementAddress;
193
+ message: string;
194
+ type: IErrorTypes;
195
+ }
196
+ export interface IElementUi {
197
+ path: [type: IFeatureName | IElements.WALL, index: number];
198
+ uiAnchor: ICoordinate2D;
199
+ }
200
+ export interface IElementPublic extends Pick<IElementUi, 'uiAnchor'> {
201
+ path: [attribute: string, index: number];
202
+ }
203
+ export declare enum IModes {
204
+ SELECT = "select",
205
+ DRAW = "draw"
206
+ }
207
+ export declare enum IUnits {
208
+ FEET = "feet",
209
+ METER = "meter",
210
+ INCH = "inch",
211
+ CM = "cm"
212
+ }
213
+ export interface IRoomBuilderConfigShared<T> {
214
+ scale: number;
215
+ unit: IUnits;
216
+ snapProximity: number;
217
+ styles: T;
218
+ }
219
+ export interface IRoomBuilderConfigInternal extends IRoomBuilderConfigShared<IRoomBuilderStyles> {
220
+ }
221
+ export interface IRoomBuilderConfigUser extends IRoomBuilderConfigShared<Partial<IRoomBuilderStyles>> {
222
+ theme?: string;
223
+ }
224
+ export interface IRoomBuilderAttributes {
225
+ [IElements.WALL]: string;
226
+ [IElements.WINDOW]?: string;
227
+ [IElements.DOOR]?: string;
228
+ [IElements.OPENING]?: string;
229
+ }
230
+ interface IRoomBuilderPropsShared<T> {
231
+ config: T;
232
+ attributes: IRoomBuilderAttributes;
233
+ }
234
+ export interface IRoomBuilderHookProps extends IRoomBuilderPropsShared<undefined | Partial<IRoomBuilderConfigUser>> {
235
+ }
236
+ export interface IRoomBuilderStateProps extends IRoomBuilderPropsShared<IRoomBuilderConfigInternal> {
237
+ }
238
+ export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IDimensionOptions = 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";
@@ -46,9 +34,3 @@ var IUnits;
46
34
  IUnits["INCH"] = "inch";
47
35
  IUnits["CM"] = "cm";
48
36
  })(IUnits = exports.IUnits || (exports.IUnits = {}));
49
- var IDimensionOptions;
50
- (function (IDimensionOptions) {
51
- IDimensionOptions["NONE"] = "none";
52
- IDimensionOptions["DEFAULT"] = "default";
53
- IDimensionOptions["DETAILED"] = "detailed";
54
- })(IDimensionOptions = exports.IDimensionOptions || (exports.IDimensionOptions = {}));
@@ -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 {};
@@ -0,0 +1,362 @@
1
+ "use strict";
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.runValidators = exports.isVertexLandingOnFeature = exports.areWallsDuplicated = exports.areWallsOrphaningFeatures = exports.areWallsIntersecting = exports.areWallsTooShort = exports.isFeatureCollidingWithExistingFeature = exports.isFeatureOutsideWallBounds = exports.isWallEndingOnFeature = exports.isWallOverlappingExisitingWalls = exports.isWallIntersectingFeature = exports.isWallTooShort = void 0;
13
+ var types_1 = require("./types");
14
+ var geometry_1 = require("./geometry");
15
+ var messaging_1 = require("./messaging");
16
+ var constants_1 = require("./constants");
17
+ function isLineTooShort(wallOrLine) {
18
+ var minLength = constants_1.MIN_WALL_LENGTH;
19
+ var line = Array.isArray(wallOrLine) ? wallOrLine : wallOrLine.line;
20
+ var tooClose = geometry_1.arePointsWithinProximity.apply(void 0, __spreadArray(__spreadArray([], line, false), [minLength], false));
21
+ if (tooClose)
22
+ return {
23
+ message: messaging_1.errorMessages.wallTooShort(),
24
+ type: types_1.IErrorTypes.HARD,
25
+ };
26
+ return false;
27
+ }
28
+ function isWallTooShort(input) {
29
+ return isLineTooShort(input.newWall.line);
30
+ }
31
+ exports.isWallTooShort = isWallTooShort;
32
+ function isWallIntersectingFeature(input) {
33
+ var _a;
34
+ var newWall = input.newWall, walls = input.walls, features = input.features;
35
+ if (!walls.length || !Object.values(features).flat().length)
36
+ return false;
37
+ var intersectingFeature;
38
+ for (var i = 0; i < walls.length && !intersectingFeature; i++) {
39
+ if (!walls[i].connections)
40
+ continue;
41
+ var intersectionPoint = (0, geometry_1.getLineSegmentsIntersection)(newWall.line, walls[i].line);
42
+ if (!intersectionPoint)
43
+ continue;
44
+ var intersectionOffset = (0, geometry_1.getLengthOfLineSegment)([
45
+ walls[i].line[0],
46
+ intersectionPoint,
47
+ ]);
48
+ for (var j = 0; j < walls[i].connections.length && !intersectingFeature; j++) {
49
+ var _b = walls[i].connections[j], type = _b[0], index = _b[1];
50
+ var feature = (_a = features[type]) === null || _a === void 0 ? void 0 : _a[index];
51
+ if (!feature)
52
+ continue;
53
+ if (feature.offset < intersectionOffset &&
54
+ intersectionOffset < feature.offset + feature.length)
55
+ intersectingFeature = { type: type, index: index };
56
+ }
57
+ }
58
+ if (!intersectingFeature)
59
+ return false;
60
+ return ({
61
+ address: intersectingFeature,
62
+ message: messaging_1.errorMessages.addWallCollidingWithFeature(intersectingFeature.type),
63
+ type: types_1.IErrorTypes.SOFT,
64
+ } || false);
65
+ }
66
+ exports.isWallIntersectingFeature = isWallIntersectingFeature;
67
+ function isWallOverlappingExisitingWalls(input) {
68
+ var newWall = input.newWall, walls = input.walls;
69
+ var snapStartTo = newWall.snapStartTo, snapEndTo = newWall.snapEndTo;
70
+ if ((snapStartTo === null || snapStartTo === void 0 ? void 0 : snapStartTo.type) === types_1.IElements.WALL &&
71
+ (snapEndTo === null || snapEndTo === void 0 ? void 0 : snapEndTo.type) === types_1.IElements.WALL &&
72
+ snapStartTo.index === snapEndTo.index) {
73
+ return {
74
+ address: {
75
+ type: types_1.IElements.WALL,
76
+ index: snapStartTo.index,
77
+ },
78
+ type: types_1.IErrorTypes.SOFT,
79
+ message: messaging_1.errorMessages.wallsNotUnique(),
80
+ };
81
+ }
82
+ var overlappingIndex = walls.findIndex(function (wall, i) {
83
+ var line = wall.line;
84
+ if ((0, geometry_1.areLinesEqual)(line, newWall.line))
85
+ return true;
86
+ if ((snapStartTo === null || snapStartTo === void 0 ? void 0 : snapStartTo.type) === types_1.IElements.VERTEX &&
87
+ ((0, geometry_1.arePointsEqual)(snapStartTo.point, line[0]) ||
88
+ (0, geometry_1.arePointsEqual)(snapStartTo.point, line[1])) &&
89
+ (snapEndTo === null || snapEndTo === void 0 ? void 0 : snapEndTo.type) === types_1.IElements.WALL &&
90
+ snapEndTo.index === i) {
91
+ return true;
92
+ }
93
+ if ((snapEndTo === null || snapEndTo === void 0 ? void 0 : snapEndTo.type) === types_1.IElements.VERTEX &&
94
+ ((0, geometry_1.arePointsEqual)(snapEndTo.point, line[0]) ||
95
+ (0, geometry_1.arePointsEqual)(snapEndTo.point, line[1])) &&
96
+ (snapStartTo === null || snapStartTo === void 0 ? void 0 : snapStartTo.type) === types_1.IElements.WALL &&
97
+ snapStartTo.index === i) {
98
+ return true;
99
+ }
100
+ return false;
101
+ });
102
+ if (overlappingIndex !== -1) {
103
+ return {
104
+ address: {
105
+ type: types_1.IElements.WALL,
106
+ index: overlappingIndex,
107
+ },
108
+ type: types_1.IErrorTypes.SOFT,
109
+ message: messaging_1.errorMessages.wallsNotUnique(),
110
+ };
111
+ }
112
+ return false;
113
+ }
114
+ exports.isWallOverlappingExisitingWalls = isWallOverlappingExisitingWalls;
115
+ function isWallEndingOnFeature(input) {
116
+ var snapPoint = input.newWall.snapEndTo;
117
+ if (!snapPoint)
118
+ return false;
119
+ if (snapPoint.type === types_1.IElements.WINDOW ||
120
+ snapPoint.type === types_1.IElements.DOOR ||
121
+ snapPoint.type === types_1.IElements.OPENING)
122
+ return {
123
+ address: snapPoint,
124
+ message: messaging_1.errorMessages.addWallCollidingWithFeature(snapPoint.type),
125
+ type: types_1.IErrorTypes.SOFT,
126
+ };
127
+ return false;
128
+ }
129
+ exports.isWallEndingOnFeature = isWallEndingOnFeature;
130
+ function isFeatureOutsideWallBounds(input) {
131
+ var wall = input.wall, updatedFeature = input.updatedFeature;
132
+ var padding = constants_1.WALL_PADDING_FOR_FEATURE;
133
+ var wallLength = (0, geometry_1.getLengthOfLineSegment)(wall.line);
134
+ if (updatedFeature.offset < padding ||
135
+ updatedFeature.offset + updatedFeature.length > wallLength - padding)
136
+ return {
137
+ address: updatedFeature.address,
138
+ type: types_1.IErrorTypes.HARD,
139
+ message: messaging_1.errorMessages.featureOutsideWallBounds(),
140
+ };
141
+ return false;
142
+ }
143
+ exports.isFeatureOutsideWallBounds = isFeatureOutsideWallBounds;
144
+ function isFeatureCollidingWithExistingFeature(input) {
145
+ var _a, _b;
146
+ var features = input.features, wall = input.wall, updatedFeature = input.updatedFeature;
147
+ if (!features || !((_a = wall.connections) === null || _a === void 0 ? void 0 : _a.length))
148
+ return false;
149
+ if (!Object.values(updatedFeature).flat().length)
150
+ return false;
151
+ for (var i = 0; i < wall.connections.length; i++) {
152
+ var _c = wall.connections[i], type = _c[0], index = _c[1];
153
+ if (updatedFeature.address.type === type &&
154
+ updatedFeature.address.index === index)
155
+ continue;
156
+ var existingFeature = (_b = features[type]) === null || _b === void 0 ? void 0 : _b[index];
157
+ if (!existingFeature)
158
+ continue;
159
+ if ((0, geometry_1.doLinesOverlap)([updatedFeature.offset, updatedFeature.length], [existingFeature.offset, existingFeature.length]))
160
+ return {
161
+ address: { type: type, index: index },
162
+ type: types_1.IErrorTypes.SOFT,
163
+ message: messaging_1.errorMessages.featuresColliding(type),
164
+ };
165
+ }
166
+ return false;
167
+ }
168
+ exports.isFeatureCollidingWithExistingFeature = isFeatureCollidingWithExistingFeature;
169
+ function areWallsTooShort(input) {
170
+ var walls = input.walls, vertex = input.vertex, updatedPosition = input.updatedPosition;
171
+ var _a = vertex.connections.reduce(function (output, connection) {
172
+ var _a;
173
+ var wallIndex = connection[0], vertexIndex = connection[1];
174
+ output.wallIndexes.push(wallIndex);
175
+ output.updatedVerticesMap = Object.assign(output.updatedVerticesMap, (_a = {},
176
+ _a[wallIndex] = vertexIndex,
177
+ _a));
178
+ return output;
179
+ }, {
180
+ wallIndexes: [],
181
+ updatedVerticesMap: {},
182
+ }), wallIndexes = _a.wallIndexes, updatedVerticesMap = _a.updatedVerticesMap;
183
+ for (var _i = 0, wallIndexes_1 = wallIndexes; _i < wallIndexes_1.length; _i++) {
184
+ var index = wallIndexes_1[_i];
185
+ var line = walls[index].line;
186
+ line[updatedVerticesMap[index]] = updatedPosition.point;
187
+ if (isLineTooShort(line))
188
+ return {
189
+ address: { type: types_1.IElements.WALL, index: index },
190
+ message: messaging_1.errorMessages.wallTooShort(),
191
+ type: types_1.IErrorTypes.HARD,
192
+ };
193
+ }
194
+ return false;
195
+ }
196
+ exports.areWallsTooShort = areWallsTooShort;
197
+ function areWallsIntersecting(input) {
198
+ var walls = input.walls, vertex = input.vertex, updatedPosition = input.updatedPosition;
199
+ var _a = vertex.connections.reduce(function (output, connection) {
200
+ var _a;
201
+ var wallIndex = connection[0], vertexIndex = connection[1];
202
+ output.wallIndexes.add(wallIndex);
203
+ output.updatedVerticesMap = Object.assign(output.updatedVerticesMap, (_a = {},
204
+ _a[wallIndex] = vertexIndex,
205
+ _a));
206
+ return output;
207
+ }, {
208
+ wallIndexes: new Set([]),
209
+ updatedVerticesMap: {},
210
+ }), wallIndexes = _a.wallIndexes, updatedVerticesMap = _a.updatedVerticesMap;
211
+ for (var _i = 0, _b = Array.from(wallIndexes); _i < _b.length; _i++) {
212
+ var validateWallIndex = _b[_i];
213
+ var line = walls[validateWallIndex].line;
214
+ line[updatedVerticesMap[validateWallIndex]] = updatedPosition.point;
215
+ for (var i = 0; i < walls.length; i++) {
216
+ if (wallIndexes.has(i))
217
+ continue;
218
+ var wall = walls[i];
219
+ if (!wall)
220
+ continue;
221
+ var intersectionPoint = (0, geometry_1.getLineSegmentsIntersection)(line, wall.line);
222
+ if (intersectionPoint)
223
+ return {
224
+ address: { type: types_1.IElements.WALL, index: i },
225
+ message: messaging_1.errorMessages.addWallCollidingWithWall(),
226
+ type: types_1.IErrorTypes.SOFT,
227
+ };
228
+ }
229
+ }
230
+ return false;
231
+ }
232
+ exports.areWallsIntersecting = areWallsIntersecting;
233
+ function areWallsOrphaningFeatures(input) {
234
+ var _a;
235
+ var walls = input.walls, vertex = input.vertex, features = input.features, updatedPosition = input.updatedPosition;
236
+ var _b = vertex.connections.reduce(function (output, connection) {
237
+ var _a;
238
+ var wallIndex = connection[0], vertexIndex = connection[1];
239
+ output.wallIndexes.add(wallIndex);
240
+ output.updatedVerticesMap = Object.assign(output.updatedVerticesMap, (_a = {},
241
+ _a[wallIndex] = vertexIndex,
242
+ _a));
243
+ return output;
244
+ }, {
245
+ wallIndexes: new Set([]),
246
+ updatedVerticesMap: {},
247
+ }), wallIndexes = _b.wallIndexes, updatedVerticesMap = _b.updatedVerticesMap;
248
+ for (var _i = 0, _c = Array.from(wallIndexes); _i < _c.length; _i++) {
249
+ var wallIdx = _c[_i];
250
+ var wall = walls[wallIdx];
251
+ if (!wall.connections.length)
252
+ continue;
253
+ var updatedLine = JSON.parse(JSON.stringify(wall.line));
254
+ updatedLine[updatedVerticesMap[wallIdx]] = updatedPosition.point;
255
+ var currentWallLength = (0, geometry_1.getLengthOfLineSegment)(wall.line);
256
+ var updatedWallLength = (0, geometry_1.getLengthOfLineSegment)(updatedLine);
257
+ var wallLengthDelta = updatedWallLength - currentWallLength;
258
+ for (var i = 0; i < wall.connections.length; i++) {
259
+ var _d = wall.connections[i], type = _d[0], index = _d[1];
260
+ var feat = (_a = features[type]) === null || _a === void 0 ? void 0 : _a[index];
261
+ if (!feat)
262
+ continue;
263
+ var error = {
264
+ address: { type: type, index: index },
265
+ message: 'feature collision',
266
+ type: types_1.IErrorTypes.HARD,
267
+ };
268
+ if (updatedVerticesMap[wallIdx] === 0 &&
269
+ feat.offset - wallLengthDelta < constants_1.WALL_PADDING_FOR_FEATURE)
270
+ return error;
271
+ else if (feat.offset + feat.length >
272
+ updatedWallLength - constants_1.WALL_PADDING_FOR_FEATURE) {
273
+ return error;
274
+ }
275
+ }
276
+ }
277
+ return false;
278
+ }
279
+ exports.areWallsOrphaningFeatures = areWallsOrphaningFeatures;
280
+ function areWallsDuplicated(input) {
281
+ var _a, _b, _c;
282
+ var walls = input.walls, vertex = input.vertex, updatedPosition = input.updatedPosition;
283
+ var point = (_b = (_a = updatedPosition.snapTo) === null || _a === void 0 ? void 0 : _a.point) !== null && _b !== void 0 ? _b : updatedPosition.point;
284
+ var _d = vertex.connections.reduce(function (output, connection) {
285
+ var _a;
286
+ var wallIndex = connection[0], vertexIndex = connection[1];
287
+ output.wallIndexes.add(wallIndex);
288
+ output.updatedVerticesMap = Object.assign(output.updatedVerticesMap, (_a = {},
289
+ _a[wallIndex] = vertexIndex,
290
+ _a));
291
+ return output;
292
+ }, {
293
+ wallIndexes: new Set([]),
294
+ updatedVerticesMap: {},
295
+ }), wallIndexes = _d.wallIndexes, updatedVerticesMap = _d.updatedVerticesMap;
296
+ for (var _i = 0, _e = Array.from(wallIndexes); _i < _e.length; _i++) {
297
+ var wallIdx = _e[_i];
298
+ var wall = walls[wallIdx];
299
+ var updatedLine = JSON.parse(JSON.stringify(wall.line));
300
+ updatedLine[updatedVerticesMap[wallIdx]] = point;
301
+ if (((_c = updatedPosition.snapTo) === null || _c === void 0 ? void 0 : _c.type) === types_1.IElements.WALL &&
302
+ updatedPosition.snapTo.index !== wallIdx) {
303
+ var _f = walls[updatedPosition.snapTo.index].line, xTest = _f[0], yTest = _f[1];
304
+ var unmovedPoint = updatedLine[updatedVerticesMap[wallIdx] === 1 ? 0 : 1];
305
+ if ((0, geometry_1.arePointsEqual)(unmovedPoint, xTest) ||
306
+ (0, geometry_1.arePointsEqual)(unmovedPoint, yTest))
307
+ return {
308
+ address: {
309
+ type: types_1.IElements.WALL,
310
+ index: updatedPosition.snapTo.index,
311
+ },
312
+ type: types_1.IErrorTypes.SOFT,
313
+ message: messaging_1.errorMessages.wallsNotUnique(),
314
+ };
315
+ }
316
+ for (var i = 0; i < walls.length; i++) {
317
+ if (wallIdx === i)
318
+ continue;
319
+ var existingWall = walls[i];
320
+ var error = {
321
+ address: { type: types_1.IElements.WALL, index: i },
322
+ type: types_1.IErrorTypes.SOFT,
323
+ message: messaging_1.errorMessages.wallsNotUnique(),
324
+ };
325
+ if (((0, geometry_1.arePointsEqual)(existingWall[0], wall.line[0]) &&
326
+ (0, geometry_1.arePointsEqual)(existingWall[1], wall.line[1])) ||
327
+ ((0, geometry_1.arePointsEqual)(existingWall[0], wall.line[1]) &&
328
+ (0, geometry_1.arePointsEqual)(existingWall[1], wall.line[0]))) {
329
+ return error;
330
+ }
331
+ }
332
+ }
333
+ return false;
334
+ }
335
+ exports.areWallsDuplicated = areWallsDuplicated;
336
+ function isVertexLandingOnFeature(input) {
337
+ var snapPoint = input.updatedPosition.snapTo;
338
+ if (!snapPoint)
339
+ return false;
340
+ if (snapPoint.type === types_1.IElements.WINDOW ||
341
+ snapPoint.type === types_1.IElements.DOOR ||
342
+ snapPoint.type === types_1.IElements.OPENING)
343
+ return {
344
+ address: snapPoint,
345
+ message: messaging_1.errorMessages.addWallCollidingWithFeature(snapPoint.type),
346
+ type: types_1.IErrorTypes.SOFT,
347
+ };
348
+ return false;
349
+ }
350
+ exports.isVertexLandingOnFeature = isVertexLandingOnFeature;
351
+ function runValidators(validators, input) {
352
+ var errors = validators.reduce(function (output, validate) {
353
+ var error = validate(input);
354
+ if (error)
355
+ output.push(error);
356
+ return output;
357
+ }, []);
358
+ if (errors.length)
359
+ return errors;
360
+ return null;
361
+ }
362
+ exports.runValidators = runValidators;
@@ -10,10 +10,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.Draw = void 0;
11
11
  var react_1 = __importDefault(require("react"));
12
12
  var styled_components_1 = __importDefault(require("styled-components"));
13
- var Path = styled_components_1.default.path(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n fill: ", ";\n"], ["\n fill: ", ";\n"])), function (props) { return props.color || props.theme.textColor; });
13
+ var SVG = styled_components_1.default.svg(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .tk-icon {\n fill: ", ";\n }\n"], ["\n .tk-icon {\n fill: ", ";\n }\n"])), function (props) { return props.color || props.theme.textColor; });
14
14
  var Draw = function (props) {
15
- return (react_1.default.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
16
- react_1.default.createElement(Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M3.74417 0.637287C4.59388 -0.212428 5.97154 -0.21243 6.82126 0.637287L19.3627 13.1787C19.7708 13.5868 20 14.1402 20 14.7173V20H14.7173C14.1402 20 13.5868 19.7708 13.1787 19.3627L0.637287 6.82126C-0.21243 5.97154 -0.21243 4.59388 0.637286 3.74417L3.74417 0.637287ZM5.50251 1.95604C5.38112 1.83465 5.18431 1.83465 5.06292 1.95604L1.95604 5.06292C1.83465 5.18431 1.83465 5.38112 1.95604 5.50251L4.20155 7.74802L7.74802 4.20155L5.50251 1.95604ZM9.06677 5.52031L18.044 14.4975C18.1023 14.5558 18.135 14.6348 18.135 14.7173V18.135H14.7173C14.6348 18.135 14.5558 18.1023 14.4975 18.044L5.52031 9.06677L9.06677 5.52031Z", color: props.color })));
15
+ return (react_1.default.createElement(SVG, { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", color: props.color },
16
+ react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M3.74417 0.637287C4.59388 -0.212428 5.97154 -0.21243 6.82126 0.637287L19.3627 13.1787C19.7708 13.5868 20 14.1402 20 14.7173V20H14.7173C14.1402 20 13.5868 19.7708 13.1787 19.3627L0.637287 6.82126C-0.21243 5.97154 -0.21243 4.59388 0.637286 3.74417L3.74417 0.637287ZM5.50251 1.95604C5.38112 1.83465 5.18431 1.83465 5.06292 1.95604L1.95604 5.06292C1.83465 5.18431 1.83465 5.38112 1.95604 5.50251L4.20155 7.74802L7.74802 4.20155L5.50251 1.95604ZM9.06677 5.52031L18.044 14.4975C18.1023 14.5558 18.135 14.6348 18.135 14.7173V18.135H14.7173C14.6348 18.135 14.5558 18.1023 14.4975 18.044L5.52031 9.06677L9.06677 5.52031Z", className: "tk-icon" })));
17
17
  };
18
18
  exports.Draw = Draw;
19
19
  exports.Draw.iconName = 'draw';