@threekit-tools/treble 0.0.88 → 0.0.89-next-002
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.
- package/dist/components/AttributeValue/index.js +2 -0
- package/dist/components/Wishlist/index.d.ts +1 -1
- package/dist/components/Zoom/index.d.ts +1 -1
- package/dist/components/containers/formInputContainer.d.ts +1 -1
- package/dist/connection.d.ts +4 -0
- package/dist/connection.js +3 -0
- package/dist/hooks/useProductCache/index.d.ts +1 -1
- package/dist/hooks/useRoomBuilder/RoomBuilderState.d.ts +95 -0
- package/dist/hooks/useRoomBuilder/RoomBuilderState.js +1237 -0
- package/dist/hooks/useRoomBuilder/constants.d.ts +41 -0
- package/dist/hooks/useRoomBuilder/constants.js +48 -0
- package/dist/hooks/useRoomBuilder/dataHandlers.d.ts +18 -0
- package/dist/hooks/useRoomBuilder/dataHandlers.js +187 -0
- package/dist/hooks/useRoomBuilder/draw.d.ts +55 -0
- package/dist/hooks/useRoomBuilder/draw.js +573 -0
- package/dist/hooks/useRoomBuilder/findLoops.d.ts +5 -0
- package/dist/hooks/useRoomBuilder/findLoops.js +99 -0
- package/dist/hooks/useRoomBuilder/geometry.d.ts +33 -0
- package/dist/hooks/useRoomBuilder/geometry.js +325 -0
- package/dist/hooks/useRoomBuilder/index.d.ts +40 -0
- package/dist/hooks/useRoomBuilder/index.js +303 -0
- package/dist/hooks/useRoomBuilder/messaging.d.ts +8 -0
- package/dist/hooks/useRoomBuilder/messaging.js +18 -0
- package/dist/hooks/useRoomBuilder/themes.d.ts +12 -0
- package/dist/hooks/useRoomBuilder/themes.js +273 -0
- package/dist/hooks/useRoomBuilder/types.d.ts +238 -0
- package/dist/hooks/useRoomBuilder/types.js +36 -0
- package/dist/hooks/useRoomBuilder/validators.d.ts +36 -0
- package/dist/hooks/useRoomBuilder/validators.js +362 -0
- package/dist/http/request.js +4 -1
- package/dist/icons/Add.d.ts +1 -1
- package/dist/icons/Add.js +3 -3
- package/dist/icons/Angle.d.ts +3 -0
- package/dist/icons/Angle.js +21 -0
- package/dist/icons/ArrowLeft.d.ts +1 -1
- package/dist/icons/ArrowLeft.js +3 -3
- package/dist/icons/ArrowRight.d.ts +1 -1
- package/dist/icons/ArrowRight.js +3 -3
- package/dist/icons/Camera.d.ts +1 -1
- package/dist/icons/Camera.js +3 -3
- package/dist/icons/CaretDown.d.ts +1 -1
- package/dist/icons/CaretDown.js +3 -3
- package/dist/icons/CaretLeft.d.ts +1 -1
- package/dist/icons/CaretLeft.js +3 -3
- package/dist/icons/CaretRight.d.ts +1 -1
- package/dist/icons/CaretRight.js +3 -3
- package/dist/icons/CaretUp.d.ts +1 -1
- package/dist/icons/CaretUp.js +3 -3
- package/dist/icons/Cart.d.ts +1 -1
- package/dist/icons/Cart.js +3 -3
- package/dist/icons/Checkmate.d.ts +1 -1
- package/dist/icons/Checkmate.js +3 -3
- package/dist/icons/Clipboard.d.ts +1 -1
- package/dist/icons/Clipboard.js +3 -3
- package/dist/icons/ColorPicker.d.ts +1 -1
- package/dist/icons/ColorPicker.js +3 -3
- package/dist/icons/Copy.d.ts +1 -1
- package/dist/icons/Copy.js +3 -3
- package/dist/icons/Cursor.d.ts +3 -0
- package/dist/icons/Cursor.js +21 -0
- package/dist/icons/Delete.d.ts +1 -1
- package/dist/icons/Delete.js +3 -3
- package/dist/icons/Door.d.ts +3 -0
- package/dist/icons/Door.js +22 -0
- package/dist/icons/DoubleCaretLeft.d.ts +1 -1
- package/dist/icons/DoubleCaretLeft.js +3 -3
- package/dist/icons/DoubleCaretRight.d.ts +1 -1
- package/dist/icons/DoubleCaretRight.js +3 -3
- package/dist/icons/Download.d.ts +1 -1
- package/dist/icons/Download.js +3 -3
- package/dist/icons/Drag.d.ts +1 -1
- package/dist/icons/Drag.js +3 -3
- package/dist/icons/Draggable.d.ts +1 -1
- package/dist/icons/Draggable.js +3 -3
- package/dist/icons/Draw.d.ts +3 -0
- package/dist/icons/Draw.js +21 -0
- package/dist/icons/Edit.d.ts +1 -1
- package/dist/icons/Edit.js +3 -3
- package/dist/icons/Heart.d.ts +1 -1
- package/dist/icons/Heart.js +3 -3
- package/dist/icons/Image.d.ts +1 -1
- package/dist/icons/Image.js +3 -3
- package/dist/icons/Info.d.ts +1 -1
- package/dist/icons/Info.js +3 -3
- package/dist/icons/Layout.d.ts +3 -0
- package/dist/icons/Layout.js +21 -0
- package/dist/icons/Mail.d.ts +1 -1
- package/dist/icons/Mail.js +3 -3
- package/dist/icons/Menu.d.ts +1 -1
- package/dist/icons/Menu.js +3 -3
- package/dist/icons/More.d.ts +1 -1
- package/dist/icons/More.js +3 -3
- package/dist/icons/NewWindow.d.ts +1 -1
- package/dist/icons/NewWindow.js +3 -3
- package/dist/icons/Opening.d.ts +3 -0
- package/dist/icons/Opening.js +21 -0
- package/dist/icons/Pause.d.ts +1 -1
- package/dist/icons/Pause.js +3 -3
- package/dist/icons/Play.d.ts +1 -1
- package/dist/icons/Play.js +3 -3
- package/dist/icons/Redo.d.ts +1 -1
- package/dist/icons/Redo.js +3 -3
- package/dist/icons/Remove.d.ts +1 -1
- package/dist/icons/Remove.js +3 -3
- package/dist/icons/Ruler.d.ts +1 -1
- package/dist/icons/Ruler.js +3 -3
- package/dist/icons/Search.d.ts +1 -1
- package/dist/icons/Search.js +3 -3
- package/dist/icons/Settings.d.ts +1 -1
- package/dist/icons/Settings.js +3 -3
- package/dist/icons/Share.d.ts +1 -1
- package/dist/icons/Share.js +3 -3
- package/dist/icons/Switch.d.ts +1 -1
- package/dist/icons/Switch.js +3 -3
- package/dist/icons/Tag.d.ts +1 -1
- package/dist/icons/Tag.js +3 -3
- package/dist/icons/TrashCan.d.ts +3 -0
- package/dist/icons/TrashCan.js +21 -0
- package/dist/icons/TrashCanAlt.d.ts +3 -0
- package/dist/icons/TrashCanAlt.js +21 -0
- package/dist/icons/Undo.d.ts +1 -1
- package/dist/icons/Undo.js +3 -3
- package/dist/icons/Wall.d.ts +3 -0
- package/dist/icons/Wall.js +21 -0
- package/dist/icons/Window.d.ts +3 -0
- package/dist/icons/Window.js +22 -0
- package/dist/icons/Wishlist.d.ts +1 -1
- package/dist/icons/Wishlist.js +3 -3
- package/dist/icons/ZoomIn.d.ts +1 -1
- package/dist/icons/ZoomIn.js +3 -3
- package/dist/icons/ZoomOut.d.ts +1 -1
- package/dist/icons/ZoomOut.js +3 -3
- package/dist/icons/index.d.ts +2 -6
- package/dist/icons/index.js +20 -0
- package/dist/icons/types.d.ts +7 -0
- package/dist/icons/types.js +2 -0
- package/dist/index.d.ts +12 -1
- package/dist/index.js +25 -2
- package/dist/store/index.d.ts +8 -29
- package/dist/store/product.d.ts +1 -1
- package/dist/store/product.js +6 -7
- package/dist/store/treble.js +6 -1
- package/dist/types.d.ts +47 -7
- package/dist/types.js +1 -0
- package/package.json +1 -1
|
@@ -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 {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IUnits = exports.IModes = exports.IErrorTypes = 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 IErrorTypes;
|
|
20
|
+
(function (IErrorTypes) {
|
|
21
|
+
IErrorTypes["HARD"] = "hard";
|
|
22
|
+
IErrorTypes["SOFT"] = "soft";
|
|
23
|
+
IErrorTypes["WARN"] = "warning";
|
|
24
|
+
})(IErrorTypes = exports.IErrorTypes || (exports.IErrorTypes = {}));
|
|
25
|
+
var IModes;
|
|
26
|
+
(function (IModes) {
|
|
27
|
+
IModes["SELECT"] = "select";
|
|
28
|
+
IModes["DRAW"] = "draw";
|
|
29
|
+
})(IModes = exports.IModes || (exports.IModes = {}));
|
|
30
|
+
var IUnits;
|
|
31
|
+
(function (IUnits) {
|
|
32
|
+
IUnits["FEET"] = "feet";
|
|
33
|
+
IUnits["METER"] = "meter";
|
|
34
|
+
IUnits["INCH"] = "inch";
|
|
35
|
+
IUnits["CM"] = "cm";
|
|
36
|
+
})(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 {};
|
|
@@ -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;
|
package/dist/http/request.js
CHANGED
|
@@ -14,11 +14,14 @@ var prepRequest = function (request, connection) {
|
|
|
14
14
|
formData: undefined,
|
|
15
15
|
config: undefined,
|
|
16
16
|
}, request), url = _a.url, data = _a.data, formData = _a.formData, params = _a.params, config = _a.config, includeOrgId = _a.includeOrgId;
|
|
17
|
-
var _b = connection.getConnection(), authToken = _b.authToken, orgId = _b.orgId, threekitDomain = _b.threekitDomain;
|
|
17
|
+
var _b = connection.getConnection(), authToken = _b.authToken, orgId = _b.orgId, threekitDomain = _b.threekitDomain, cacheParameters = _b.cacheParameters;
|
|
18
18
|
var urlRaw = "".concat(threekitDomain).concat(url);
|
|
19
19
|
var query = (0, utils_1.objectToQueryStr)(Object.assign({}, includeOrgId ? { orgId: orgId } : {}, params));
|
|
20
20
|
var urlPrepped = "".concat(urlRaw).concat(query);
|
|
21
21
|
urlPrepped += "".concat(query.length ? "&" : "?", "bearer_token=").concat(authToken);
|
|
22
|
+
if (cacheParameters) {
|
|
23
|
+
urlPrepped += "&cacheMaxAge=".concat(cacheParameters.maxAge, "&cacheScope=").concat(cacheParameters.scope);
|
|
24
|
+
}
|
|
22
25
|
return { url: urlPrepped, data: formData || data, config: config };
|
|
23
26
|
};
|
|
24
27
|
var get = function (request) {
|
package/dist/icons/Add.d.ts
CHANGED