@threekit-tools/treble 0.0.89 → 0.0.90-next-02

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 (158) hide show
  1. package/dist/Treble/Treble.d.ts +1 -1
  2. package/dist/Treble/Treble.js +3 -3
  3. package/dist/components/AttributeValue/index.js +2 -0
  4. package/dist/components/BreatheAnimation/index.js +2 -2
  5. package/dist/components/TurntableAnimation/index.js +2 -2
  6. package/dist/components/Wishlist/index.d.ts +1 -1
  7. package/dist/components/Zoom/index.d.ts +1 -1
  8. package/dist/components/containers/formInputContainer.d.ts +1 -1
  9. package/dist/components/containers/formInputContainer.js +3 -3
  10. package/dist/hooks/useConfigurationChangeStatus/index.d.ts +2 -0
  11. package/dist/hooks/useConfigurationChangeStatus/index.js +8 -0
  12. package/dist/hooks/useNestedConfigurator/index.js +1 -2
  13. package/dist/hooks/usePlayerReady/index.d.ts +2 -0
  14. package/dist/hooks/usePlayerReady/index.js +8 -0
  15. package/dist/hooks/useRoomBuilder/RoomBuilderLayout.d.ts +8 -0
  16. package/dist/hooks/useRoomBuilder/RoomBuilderLayout.js +22 -0
  17. package/dist/hooks/useRoomBuilder/RoomBuilderState.d.ts +132 -0
  18. package/dist/hooks/useRoomBuilder/RoomBuilderState.js +1431 -0
  19. package/dist/hooks/useRoomBuilder/constants.d.ts +56 -0
  20. package/dist/hooks/useRoomBuilder/constants.js +63 -0
  21. package/dist/hooks/useRoomBuilder/dataHandlers.d.ts +18 -0
  22. package/dist/hooks/useRoomBuilder/dataHandlers.js +187 -0
  23. package/dist/hooks/useRoomBuilder/draw.d.ts +55 -0
  24. package/dist/hooks/useRoomBuilder/draw.js +573 -0
  25. package/dist/hooks/useRoomBuilder/findLoops.d.ts +5 -0
  26. package/dist/hooks/useRoomBuilder/findLoops.js +99 -0
  27. package/dist/hooks/useRoomBuilder/geometry.d.ts +33 -0
  28. package/dist/hooks/useRoomBuilder/geometry.js +325 -0
  29. package/dist/hooks/useRoomBuilder/index.d.ts +57 -0
  30. package/dist/hooks/useRoomBuilder/index.js +411 -0
  31. package/dist/hooks/useRoomBuilder/messaging.d.ts +8 -0
  32. package/dist/hooks/useRoomBuilder/messaging.js +18 -0
  33. package/dist/hooks/useRoomBuilder/themes.d.ts +12 -0
  34. package/dist/hooks/useRoomBuilder/themes.js +273 -0
  35. package/dist/hooks/useRoomBuilder/types.d.ts +247 -0
  36. package/dist/hooks/useRoomBuilder/types.js +40 -0
  37. package/dist/hooks/useRoomBuilder/validators.d.ts +36 -0
  38. package/dist/hooks/useRoomBuilder/validators.js +362 -0
  39. package/dist/icons/Add.d.ts +1 -1
  40. package/dist/icons/Add.js +3 -3
  41. package/dist/icons/Angle.d.ts +3 -0
  42. package/dist/icons/Angle.js +21 -0
  43. package/dist/icons/ArrowLeft.d.ts +1 -1
  44. package/dist/icons/ArrowLeft.js +3 -3
  45. package/dist/icons/ArrowRight.d.ts +1 -1
  46. package/dist/icons/ArrowRight.js +3 -3
  47. package/dist/icons/Camera.d.ts +1 -1
  48. package/dist/icons/Camera.js +3 -3
  49. package/dist/icons/CaretDown.d.ts +1 -1
  50. package/dist/icons/CaretDown.js +3 -3
  51. package/dist/icons/CaretLeft.d.ts +1 -1
  52. package/dist/icons/CaretLeft.js +3 -3
  53. package/dist/icons/CaretRight.d.ts +1 -1
  54. package/dist/icons/CaretRight.js +3 -3
  55. package/dist/icons/CaretUp.d.ts +1 -1
  56. package/dist/icons/CaretUp.js +3 -3
  57. package/dist/icons/Cart.d.ts +1 -1
  58. package/dist/icons/Cart.js +3 -3
  59. package/dist/icons/Checkmate.d.ts +1 -1
  60. package/dist/icons/Checkmate.js +3 -3
  61. package/dist/icons/Clipboard.d.ts +1 -1
  62. package/dist/icons/Clipboard.js +3 -3
  63. package/dist/icons/ColorPicker.d.ts +1 -1
  64. package/dist/icons/ColorPicker.js +3 -3
  65. package/dist/icons/Copy.d.ts +1 -1
  66. package/dist/icons/Copy.js +3 -3
  67. package/dist/icons/Cursor.d.ts +3 -0
  68. package/dist/icons/Cursor.js +21 -0
  69. package/dist/icons/Delete.d.ts +1 -1
  70. package/dist/icons/Delete.js +3 -3
  71. package/dist/icons/Door.d.ts +3 -0
  72. package/dist/icons/Door.js +22 -0
  73. package/dist/icons/DoubleCaretLeft.d.ts +1 -1
  74. package/dist/icons/DoubleCaretLeft.js +3 -3
  75. package/dist/icons/DoubleCaretRight.d.ts +1 -1
  76. package/dist/icons/DoubleCaretRight.js +3 -3
  77. package/dist/icons/Download.d.ts +1 -1
  78. package/dist/icons/Download.js +3 -3
  79. package/dist/icons/Drag.d.ts +1 -1
  80. package/dist/icons/Drag.js +3 -3
  81. package/dist/icons/Draggable.d.ts +1 -1
  82. package/dist/icons/Draggable.js +3 -3
  83. package/dist/icons/Draw.d.ts +3 -0
  84. package/dist/icons/Draw.js +21 -0
  85. package/dist/icons/Edit.d.ts +1 -1
  86. package/dist/icons/Edit.js +3 -3
  87. package/dist/icons/Heart.d.ts +1 -1
  88. package/dist/icons/Heart.js +3 -3
  89. package/dist/icons/Image.d.ts +1 -1
  90. package/dist/icons/Image.js +3 -3
  91. package/dist/icons/Info.d.ts +1 -1
  92. package/dist/icons/Info.js +3 -3
  93. package/dist/icons/Layout.d.ts +3 -0
  94. package/dist/icons/Layout.js +21 -0
  95. package/dist/icons/Mail.d.ts +1 -1
  96. package/dist/icons/Mail.js +3 -3
  97. package/dist/icons/Menu.d.ts +1 -1
  98. package/dist/icons/Menu.js +3 -3
  99. package/dist/icons/More.d.ts +1 -1
  100. package/dist/icons/More.js +3 -3
  101. package/dist/icons/NewWindow.d.ts +1 -1
  102. package/dist/icons/NewWindow.js +3 -3
  103. package/dist/icons/Opening.d.ts +3 -0
  104. package/dist/icons/Opening.js +21 -0
  105. package/dist/icons/Pause.d.ts +1 -1
  106. package/dist/icons/Pause.js +3 -3
  107. package/dist/icons/Play.d.ts +1 -1
  108. package/dist/icons/Play.js +3 -3
  109. package/dist/icons/Player3D.d.ts +3 -0
  110. package/dist/icons/Player3D.js +21 -0
  111. package/dist/icons/Redo.d.ts +1 -1
  112. package/dist/icons/Redo.js +3 -3
  113. package/dist/icons/Remove.d.ts +1 -1
  114. package/dist/icons/Remove.js +3 -3
  115. package/dist/icons/Ruler.d.ts +1 -1
  116. package/dist/icons/Ruler.js +3 -3
  117. package/dist/icons/Search.d.ts +1 -1
  118. package/dist/icons/Search.js +3 -3
  119. package/dist/icons/Settings.d.ts +1 -1
  120. package/dist/icons/Settings.js +3 -3
  121. package/dist/icons/Share.d.ts +1 -1
  122. package/dist/icons/Share.js +3 -3
  123. package/dist/icons/Switch.d.ts +1 -1
  124. package/dist/icons/Switch.js +3 -3
  125. package/dist/icons/Tag.d.ts +1 -1
  126. package/dist/icons/Tag.js +3 -3
  127. package/dist/icons/TrashCan.d.ts +3 -0
  128. package/dist/icons/TrashCan.js +21 -0
  129. package/dist/icons/TrashCanAlt.d.ts +3 -0
  130. package/dist/icons/TrashCanAlt.js +21 -0
  131. package/dist/icons/Undo.d.ts +1 -1
  132. package/dist/icons/Undo.js +3 -3
  133. package/dist/icons/Wall.d.ts +3 -0
  134. package/dist/icons/Wall.js +21 -0
  135. package/dist/icons/Window.d.ts +3 -0
  136. package/dist/icons/Window.js +22 -0
  137. package/dist/icons/Wishlist.d.ts +1 -1
  138. package/dist/icons/Wishlist.js +3 -3
  139. package/dist/icons/ZoomIn.d.ts +1 -1
  140. package/dist/icons/ZoomIn.js +3 -3
  141. package/dist/icons/ZoomOut.d.ts +1 -1
  142. package/dist/icons/ZoomOut.js +3 -3
  143. package/dist/icons/index.d.ts +2 -6
  144. package/dist/icons/index.js +22 -0
  145. package/dist/icons/types.d.ts +7 -0
  146. package/dist/icons/types.js +2 -0
  147. package/dist/index.d.ts +17 -2
  148. package/dist/index.js +35 -4
  149. package/dist/store/attributes.d.ts +1 -0
  150. package/dist/store/index.d.ts +39 -8
  151. package/dist/store/index.js +3 -1
  152. package/dist/store/roomBuilder.d.ts +38 -0
  153. package/dist/store/roomBuilder.js +174 -0
  154. package/dist/store/treble.js +16 -9
  155. package/dist/types.d.ts +47 -7
  156. package/dist/types.js +1 -0
  157. package/dist/utils.d.ts +1 -1
  158. package/package.json +1 -1
@@ -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);
@@ -0,0 +1,247 @@
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 declare enum SNAPPING_TYPES {
161
+ ANGLE = "angle"
162
+ }
163
+ export interface IElementAddress {
164
+ type: IElementName;
165
+ index: number;
166
+ }
167
+ export interface IFeatureAddress {
168
+ type: IFeatureName;
169
+ index: number;
170
+ }
171
+ export interface ISnapPointShared<T> {
172
+ type: T;
173
+ index: number;
174
+ point: ICoordinate2D;
175
+ }
176
+ export interface ISnapPointVertex extends ISnapPointShared<IElements.VERTEX> {
177
+ }
178
+ export interface ISnapPointWall extends ISnapPointShared<IElements.WALL> {
179
+ offset: number;
180
+ }
181
+ export interface ISnapPointFeature extends ISnapPointShared<IFeatureName> {
182
+ }
183
+ export interface ISnapPointAngle extends Omit<ISnapPointShared<SNAPPING_TYPES.ANGLE>, 'index'> {
184
+ }
185
+ export declare type ISnapPoint = ISnapPointVertex | ISnapPointWall | ISnapPointFeature | ISnapPointAngle;
186
+ export interface IActiveElement extends IElementAddress {
187
+ snapPoint?: ISnapPoint;
188
+ }
189
+ export declare enum IErrorTypes {
190
+ HARD = "hard",
191
+ SOFT = "soft",
192
+ WARN = "warning"
193
+ }
194
+ export interface IErrorElement {
195
+ address?: IElementAddress;
196
+ message: string;
197
+ type: IErrorTypes;
198
+ }
199
+ export interface IElementUi {
200
+ path: [type: IFeatureName | IElements.WALL, index: number];
201
+ uiAnchor: ICoordinate2D;
202
+ }
203
+ export interface IElementPublic extends Pick<IElementUi, 'uiAnchor'> {
204
+ path: [attribute: string, index: number];
205
+ type: IFeatureName | IElements.WALL;
206
+ }
207
+ export declare enum IModes {
208
+ SELECT = "select",
209
+ DRAW = "draw"
210
+ }
211
+ export declare enum IUnits {
212
+ FEET = "feet",
213
+ METER = "meter",
214
+ INCH = "inch",
215
+ CM = "cm"
216
+ }
217
+ export interface IRoomBuilderConfigShared<T> {
218
+ scale: number;
219
+ unit: IUnits;
220
+ snapProximity: number;
221
+ styles: T;
222
+ zoomDefault: number;
223
+ translateDefault: ICoordinate2D;
224
+ }
225
+ export interface IRoomBuilderConfigInternal extends IRoomBuilderConfigShared<IRoomBuilderStyles> {
226
+ }
227
+ export interface IRoomBuilderConfigUser extends IRoomBuilderConfigShared<Partial<IRoomBuilderStyles>> {
228
+ theme: string;
229
+ zoomDisabled: boolean;
230
+ translateDisabled: boolean;
231
+ }
232
+ export interface IRoomBuilderAttributes {
233
+ [IElements.WALL]: string;
234
+ [IElements.WINDOW]?: string;
235
+ [IElements.DOOR]?: string;
236
+ [IElements.OPENING]?: string;
237
+ }
238
+ interface IRoomBuilderPropsShared<T> {
239
+ config: T;
240
+ attributes: IRoomBuilderAttributes;
241
+ layouts?: Array<string>;
242
+ }
243
+ export interface IRoomBuilderHookProps extends IRoomBuilderPropsShared<undefined | Partial<IRoomBuilderConfigUser>> {
244
+ }
245
+ export interface IRoomBuilderStateProps extends IRoomBuilderPropsShared<IRoomBuilderConfigInternal> {
246
+ }
247
+ export {};
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IUnits = exports.IModes = exports.IErrorTypes = exports.SNAPPING_TYPES = exports.IElementStyleModes = exports.IElements = void 0;
4
+ var IElements;
5
+ (function (IElements) {
6
+ IElements["WALL"] = "walls";
7
+ IElements["VERTEX"] = "vertex";
8
+ IElements["FEATURE"] = "features";
9
+ IElements["WINDOW"] = "windows";
10
+ IElements["DOOR"] = "doors";
11
+ IElements["OPENING"] = "openings";
12
+ })(IElements = exports.IElements || (exports.IElements = {}));
13
+ var IElementStyleModes;
14
+ (function (IElementStyleModes) {
15
+ IElementStyleModes["HIGHLIGHT"] = "highlight";
16
+ IElementStyleModes["ACTIVE"] = "active";
17
+ IElementStyleModes["ERROR"] = "error";
18
+ })(IElementStyleModes = exports.IElementStyleModes || (exports.IElementStyleModes = {}));
19
+ var SNAPPING_TYPES;
20
+ (function (SNAPPING_TYPES) {
21
+ SNAPPING_TYPES["ANGLE"] = "angle";
22
+ })(SNAPPING_TYPES = exports.SNAPPING_TYPES || (exports.SNAPPING_TYPES = {}));
23
+ var IErrorTypes;
24
+ (function (IErrorTypes) {
25
+ IErrorTypes["HARD"] = "hard";
26
+ IErrorTypes["SOFT"] = "soft";
27
+ IErrorTypes["WARN"] = "warning";
28
+ })(IErrorTypes = exports.IErrorTypes || (exports.IErrorTypes = {}));
29
+ var IModes;
30
+ (function (IModes) {
31
+ IModes["SELECT"] = "select";
32
+ IModes["DRAW"] = "draw";
33
+ })(IModes = exports.IModes || (exports.IModes = {}));
34
+ var IUnits;
35
+ (function (IUnits) {
36
+ IUnits["FEET"] = "feet";
37
+ IUnits["METER"] = "meter";
38
+ IUnits["INCH"] = "inch";
39
+ IUnits["CM"] = "cm";
40
+ })(IUnits = exports.IUnits || (exports.IUnits = {}));
@@ -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 {};