@threekit-tools/treble 0.0.92 → 0.0.94-next-01
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Treble/Treble.d.ts +2 -2
- package/dist/Treble/Treble.js +2 -2
- package/dist/Treble/index.d.ts +1 -1
- package/dist/Treble/index.js +1 -1
- package/dist/Treble/snapshot.d.ts +2 -2
- package/dist/Treble/snapshot.js +1 -1
- package/dist/hooks/useNestedConfigurator/index.js +1 -2
- package/dist/hooks/useSnapshot/index.d.ts +1 -1
- package/dist/hooks/useSpaces/SpacesState.d.ts +15 -2
- package/dist/hooks/useSpaces/SpacesState.js +85 -22
- package/dist/hooks/useSpaces/constants.d.ts +17 -2
- package/dist/hooks/useSpaces/constants.js +58 -37
- package/dist/hooks/useSpaces/dataHandlers.d.ts +22 -4
- package/dist/hooks/useSpaces/dataHandlers.js +197 -40
- package/dist/hooks/useSpaces/draw/drawDoors.js +1 -1
- package/dist/hooks/useSpaces/draw/drawGrid.d.ts +1 -1
- package/dist/hooks/useSpaces/draw/drawGrid.js +4 -1
- package/dist/hooks/useSpaces/draw/drawWalls.d.ts +3 -2
- package/dist/hooks/useSpaces/draw/drawWalls.js +6 -4
- package/dist/hooks/useSpaces/index.d.ts +13 -0
- package/dist/hooks/useSpaces/index.js +269 -126
- package/dist/hooks/useSpaces/types.d.ts +52 -13
- package/dist/icons/Boundary.d.ts +3 -0
- package/dist/icons/{Ruler copy.js → Boundary.js} +7 -8
- package/dist/icons/Draw.js +3 -3
- package/dist/icons/RulerBlank.js +2 -2
- package/dist/icons/RulerDetailed.js +2 -2
- package/dist/icons/Window.js +4 -4
- package/dist/icons/index.js +28 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.js +35 -5
- package/dist/store/attributes.d.ts +2 -1
- package/dist/store/index.d.ts +41 -10
- package/dist/store/index.js +3 -1
- package/dist/store/product.js +4 -7
- package/dist/store/spaces.d.ts +32 -5
- package/dist/store/spaces.js +164 -7
- package/dist/store/treble.d.ts +1 -1
- package/dist/store/treble.js +14 -21
- package/dist/store/wishlist.d.ts +2 -20
- package/dist/types.d.ts +3 -1
- package/package.json +1 -2
- package/dist/Treble/snapshots.d.ts +0 -22
- package/dist/Treble/snapshots.js +0 -247
- package/dist/hooks/useRoomBuilder/RoomBuilderState.d.ts +0 -95
- package/dist/hooks/useRoomBuilder/RoomBuilderState.js +0 -1237
- package/dist/hooks/useRoomBuilder/constants.d.ts +0 -41
- package/dist/hooks/useRoomBuilder/constants.js +0 -48
- package/dist/hooks/useRoomBuilder/dataHandlers.d.ts +0 -18
- package/dist/hooks/useRoomBuilder/dataHandlers.js +0 -187
- package/dist/hooks/useRoomBuilder/draw.d.ts +0 -55
- package/dist/hooks/useRoomBuilder/draw.js +0 -573
- package/dist/hooks/useRoomBuilder/findLoops.d.ts +0 -5
- package/dist/hooks/useRoomBuilder/findLoops.js +0 -99
- package/dist/hooks/useRoomBuilder/geometry.d.ts +0 -33
- package/dist/hooks/useRoomBuilder/geometry.js +0 -325
- package/dist/hooks/useRoomBuilder/index.d.ts +0 -40
- package/dist/hooks/useRoomBuilder/index.js +0 -303
- package/dist/hooks/useRoomBuilder/messaging.d.ts +0 -8
- package/dist/hooks/useRoomBuilder/messaging.js +0 -18
- package/dist/hooks/useRoomBuilder/themes.d.ts +0 -12
- package/dist/hooks/useRoomBuilder/themes.js +0 -273
- package/dist/hooks/useRoomBuilder/types.d.ts +0 -238
- package/dist/hooks/useRoomBuilder/types.js +0 -36
- package/dist/hooks/useRoomBuilder/validators.d.ts +0 -36
- package/dist/hooks/useRoomBuilder/validators.js +0 -362
- package/dist/icons/Ruler copy.d.ts +0 -3
- package/dist/icons/RulerDetailed copy.d.ts +0 -3
- package/dist/icons/RulerDetailed copy.js +0 -27
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
-
if (mod && mod.__esModule) return mod;
|
|
31
|
-
var result = {};
|
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
-
__setModuleDefault(result, mod);
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
var react_1 = require("react");
|
|
41
|
-
var types_1 = require("./types");
|
|
42
|
-
var useConfigurator_1 = __importDefault(require("../useConfigurator"));
|
|
43
|
-
var RoomBuilderState_1 = __importDefault(require("./RoomBuilderState"));
|
|
44
|
-
var constants_1 = require("./constants");
|
|
45
|
-
var themes_1 = __importStar(require("./themes"));
|
|
46
|
-
var useRoomBuilder = function (props) {
|
|
47
|
-
var _a;
|
|
48
|
-
var attributesState = (0, useConfigurator_1.default)()[0];
|
|
49
|
-
var _b = (0, react_1.useState)(types_1.IModes.DRAW), modeValue = _b[0], setMode = _b[1];
|
|
50
|
-
var _c = (0, react_1.useState)(true), showDimensions = _c[0], setShowDimensions = _c[1];
|
|
51
|
-
var _d = (0, react_1.useState)(true), angleSnappingEnabled = _d[0], setAngleSnappingEnabled = _d[1];
|
|
52
|
-
var _e = (0, react_1.useState)(null), selectedElement = _e[0], setSelectedElement = _e[1];
|
|
53
|
-
var _f = (0, react_1.useState)(null), selectedWallAsset = _f[0], setSelectedWallAsset = _f[1];
|
|
54
|
-
var canvasRef = (0, react_1.useRef)(null);
|
|
55
|
-
var selectElementPending = (0, react_1.useRef)(null);
|
|
56
|
-
var preppedConfig = Object.assign({
|
|
57
|
-
scale: constants_1.SCALE,
|
|
58
|
-
unit: types_1.IUnits.FEET,
|
|
59
|
-
snapProximity: constants_1.SNAP_PROXIMITY,
|
|
60
|
-
styles: ((_a = props.config) === null || _a === void 0 ? void 0 : _a.theme) && themes_1.default[props.config.theme]
|
|
61
|
-
? themes_1.default[props.config.theme]
|
|
62
|
-
: themes_1.default[themes_1.IThemes.DEFAULT],
|
|
63
|
-
}, props.config);
|
|
64
|
-
var roomBuilderRef = (0, react_1.useRef)(new RoomBuilderState_1.default(__assign(__assign({}, props), { config: preppedConfig })));
|
|
65
|
-
var drawRoom = function () { return roomBuilderRef.current.drawRoom(canvasRef.current); };
|
|
66
|
-
(0, react_1.useEffect)(function () {
|
|
67
|
-
var _a;
|
|
68
|
-
if (!selectedWallAsset &&
|
|
69
|
-
(attributesState === null || attributesState === void 0 ? void 0 : attributesState[props.attributes[types_1.IElements.WALL]]))
|
|
70
|
-
setSelectedWallAsset(((_a = attributesState === null || attributesState === void 0 ? void 0 : attributesState[props.attributes[types_1.IElements.WALL]]) === null || _a === void 0 ? void 0 : _a.values[0].assetId) || null);
|
|
71
|
-
var attributesDelinked = JSON.parse(JSON.stringify(attributesState));
|
|
72
|
-
roomBuilderRef.current.setAttributesToState(attributesDelinked);
|
|
73
|
-
drawRoom();
|
|
74
|
-
}, [attributesState]);
|
|
75
|
-
(0, react_1.useEffect)(function () {
|
|
76
|
-
if (canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current) {
|
|
77
|
-
canvasRef.current.addEventListener('mousedown', handleDrawWallStart);
|
|
78
|
-
canvasRef.current.addEventListener('mousemove', handleDrawWallMouseMove);
|
|
79
|
-
document.addEventListener('mouseup', handleDrawWallFinish);
|
|
80
|
-
canvasRef.current.addEventListener('mousemove', handleSelectModeHover);
|
|
81
|
-
canvasRef.current.addEventListener('mousedown', handleSelectElement);
|
|
82
|
-
canvasRef.current.addEventListener('mousemove', handleMoveSelectedElement);
|
|
83
|
-
document.addEventListener('mouseup', handleSetSelectedElement);
|
|
84
|
-
}
|
|
85
|
-
return function () {
|
|
86
|
-
if (canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current) {
|
|
87
|
-
canvasRef.current.removeEventListener('mousedown', handleDrawWallStart);
|
|
88
|
-
canvasRef.current.removeEventListener('mousemove', handleDrawWallMouseMove);
|
|
89
|
-
document.removeEventListener('mouseup', handleDrawWallFinish);
|
|
90
|
-
canvasRef.current.removeEventListener('mousemove', handleSelectModeHover);
|
|
91
|
-
canvasRef.current.removeEventListener('mousedown', handleSelectElement);
|
|
92
|
-
canvasRef.current.removeEventListener('mousemove', handleMoveSelectedElement);
|
|
93
|
-
document.removeEventListener('mouseup', handleSetSelectedElement);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
});
|
|
97
|
-
(0, react_1.useEffect)(function () {
|
|
98
|
-
roomBuilderRef.current.showDimensions = showDimensions;
|
|
99
|
-
roomBuilderRef.current.angleSnappingEnabled = angleSnappingEnabled;
|
|
100
|
-
roomBuilderRef.current.selectedElement = selectedElement
|
|
101
|
-
? {
|
|
102
|
-
type: selectedElement.path[0],
|
|
103
|
-
index: selectedElement.path[1],
|
|
104
|
-
}
|
|
105
|
-
: null;
|
|
106
|
-
drawRoom();
|
|
107
|
-
}, [selectedElement, showDimensions, angleSnappingEnabled]);
|
|
108
|
-
var handleSelectModeHover = function (e) {
|
|
109
|
-
if (!canvasRef.current)
|
|
110
|
-
return;
|
|
111
|
-
if (modeValue !== types_1.IModes.SELECT)
|
|
112
|
-
return;
|
|
113
|
-
if (roomBuilderRef.current.activeElement !== null)
|
|
114
|
-
return;
|
|
115
|
-
var cursorPoint = [e.offsetX, e.offsetY];
|
|
116
|
-
roomBuilderRef.current.highlightElementIfInProximity(canvasRef.current, cursorPoint);
|
|
117
|
-
};
|
|
118
|
-
var handleSelectElement = function (e) {
|
|
119
|
-
if (!canvasRef.current)
|
|
120
|
-
return;
|
|
121
|
-
if (modeValue !== types_1.IModes.SELECT)
|
|
122
|
-
return;
|
|
123
|
-
var cursorPoint = [e.offsetX, e.offsetY];
|
|
124
|
-
roomBuilderRef.current.selectElementIfInProximity(canvasRef.current, cursorPoint);
|
|
125
|
-
var element = roomBuilderRef.current.getClickedElement(cursorPoint);
|
|
126
|
-
if (!element) {
|
|
127
|
-
if (selectedElement !== null)
|
|
128
|
-
setSelectedElement(null);
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
if (roomBuilderRef.current.activeElement ||
|
|
132
|
-
(selectedElement &&
|
|
133
|
-
JSON.stringify(element.path) !== JSON.stringify(selectedElement.path)))
|
|
134
|
-
setSelectedElement(null);
|
|
135
|
-
selectElementPending.current = element;
|
|
136
|
-
};
|
|
137
|
-
var handleMoveSelectedElement = function (e) {
|
|
138
|
-
if (modeValue !== types_1.IModes.SELECT)
|
|
139
|
-
return;
|
|
140
|
-
if (!canvasRef.current)
|
|
141
|
-
return;
|
|
142
|
-
var point = [e.offsetX, e.offsetY];
|
|
143
|
-
roomBuilderRef.current.moveActiveElement(canvasRef.current, point);
|
|
144
|
-
selectElementPending.current = null;
|
|
145
|
-
};
|
|
146
|
-
var handleSetSelectedElement = function (e) {
|
|
147
|
-
var _a;
|
|
148
|
-
if (modeValue !== types_1.IModes.SELECT)
|
|
149
|
-
return;
|
|
150
|
-
if (!canvasRef.current)
|
|
151
|
-
return;
|
|
152
|
-
if (!((_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
153
|
-
roomBuilderRef.current.cancelMoveActiveElement(canvasRef.current);
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
roomBuilderRef.current.finishMoveActiveElement(canvasRef.current);
|
|
157
|
-
if (selectElementPending.current) {
|
|
158
|
-
setSelectedElement(selectElementPending.current);
|
|
159
|
-
selectElementPending.current = null;
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
var handleDrawWallStart = function (e) {
|
|
163
|
-
if (modeValue !== types_1.IModes.DRAW)
|
|
164
|
-
return;
|
|
165
|
-
var cursorPoint = [e.offsetX, e.offsetY];
|
|
166
|
-
roomBuilderRef.current.startDrawNewWall(cursorPoint);
|
|
167
|
-
};
|
|
168
|
-
var handleDrawWallMouseMove = function (e) {
|
|
169
|
-
if (modeValue !== types_1.IModes.DRAW)
|
|
170
|
-
return;
|
|
171
|
-
if (!canvasRef.current)
|
|
172
|
-
return;
|
|
173
|
-
var cursorPoint = [e.offsetX, e.offsetY];
|
|
174
|
-
roomBuilderRef.current.drawNewWall(canvasRef.current, cursorPoint);
|
|
175
|
-
};
|
|
176
|
-
var handleDrawWallFinish = function (e) {
|
|
177
|
-
var _a;
|
|
178
|
-
if (modeValue !== types_1.IModes.DRAW)
|
|
179
|
-
return;
|
|
180
|
-
if (!canvasRef.current)
|
|
181
|
-
return;
|
|
182
|
-
if (!selectedWallAsset)
|
|
183
|
-
return;
|
|
184
|
-
if (!((_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
185
|
-
roomBuilderRef.current.cancelDrawNewWall(canvasRef.current);
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
roomBuilderRef.current.finishDrawNewWall(canvasRef.current, selectedWallAsset);
|
|
189
|
-
};
|
|
190
|
-
var prepFeatureAttributeForOutput = function (type, attribute) {
|
|
191
|
-
if (!attribute)
|
|
192
|
-
return undefined;
|
|
193
|
-
var values = attribute.values.map(function (val) { return (__assign(__assign({}, val), { add: function (addToWallIndex, offset) {
|
|
194
|
-
return roomBuilderRef.current.addFeature(type, {
|
|
195
|
-
assetId: val.assetId,
|
|
196
|
-
length: constants_1.FEATURE_LENGTH,
|
|
197
|
-
offset: offset,
|
|
198
|
-
}, addToWallIndex);
|
|
199
|
-
} })); });
|
|
200
|
-
var value = attribute.value.map(function (val, i) { return (__assign(__assign({}, val), { delete: function () { return roomBuilderRef.current.deleteFeature(type, i); } })); });
|
|
201
|
-
return __assign(__assign({}, attribute), { values: values, value: value });
|
|
202
|
-
};
|
|
203
|
-
var prepWallAttributeForOutput = function (attribute) {
|
|
204
|
-
if (!attribute)
|
|
205
|
-
return undefined;
|
|
206
|
-
var values = attribute.values.map(function (val) { return (__assign(__assign({}, val), { selected: val.assetId === selectedWallAsset, selectToDraw: function () {
|
|
207
|
-
setMode(types_1.IModes.DRAW);
|
|
208
|
-
setSelectedWallAsset(val.assetId);
|
|
209
|
-
} })); });
|
|
210
|
-
var value = attribute.value.map(function (val, i) { return (__assign(__assign({}, val), { delete: function () { var _a; return (_a = roomBuilderRef.current) === null || _a === void 0 ? void 0 : _a.deleteWall(i); } })); });
|
|
211
|
-
return __assign(__assign({}, attribute), { values: values, value: value });
|
|
212
|
-
};
|
|
213
|
-
var getElementFromAttributeName = function (attributeName) {
|
|
214
|
-
var elementAttr = Object.entries(props.attributes).find(function (_a) {
|
|
215
|
-
var _ = _a[0], attrName = _a[1];
|
|
216
|
-
return attrName === attributeName;
|
|
217
|
-
});
|
|
218
|
-
if (!elementAttr)
|
|
219
|
-
return;
|
|
220
|
-
return elementAttr[0];
|
|
221
|
-
};
|
|
222
|
-
var handleSetMode = function (mode) {
|
|
223
|
-
if (mode === modeValue)
|
|
224
|
-
return;
|
|
225
|
-
drawRoom();
|
|
226
|
-
setMode(mode);
|
|
227
|
-
setSelectedElement(null);
|
|
228
|
-
};
|
|
229
|
-
var handleReset = function () {
|
|
230
|
-
var _a;
|
|
231
|
-
(_a = roomBuilderRef.current) === null || _a === void 0 ? void 0 : _a.deleteAll();
|
|
232
|
-
setSelectedElement(null);
|
|
233
|
-
};
|
|
234
|
-
var handleDeleteElement = function (type, index) {
|
|
235
|
-
var _a;
|
|
236
|
-
var elementType = type;
|
|
237
|
-
if (Object.values(props.attributes).includes(type)) {
|
|
238
|
-
var updatedType = getElementFromAttributeName(type);
|
|
239
|
-
if (!updatedType)
|
|
240
|
-
return;
|
|
241
|
-
elementType = updatedType;
|
|
242
|
-
}
|
|
243
|
-
(_a = roomBuilderRef.current) === null || _a === void 0 ? void 0 : _a.deleteElement(elementType, index);
|
|
244
|
-
setSelectedElement(null);
|
|
245
|
-
};
|
|
246
|
-
var handleToggleDimensions = function (val) {
|
|
247
|
-
if (val === undefined)
|
|
248
|
-
setShowDimensions(!showDimensions);
|
|
249
|
-
else
|
|
250
|
-
setShowDimensions(val);
|
|
251
|
-
setSelectedElement(null);
|
|
252
|
-
};
|
|
253
|
-
var handleToggleAngleSnapping = function (val) {
|
|
254
|
-
if (val === undefined)
|
|
255
|
-
setAngleSnappingEnabled(!angleSnappingEnabled);
|
|
256
|
-
else
|
|
257
|
-
setAngleSnappingEnabled(val);
|
|
258
|
-
setSelectedElement(null);
|
|
259
|
-
};
|
|
260
|
-
return {
|
|
261
|
-
canvasRef: canvasRef,
|
|
262
|
-
selectedElement: selectedElement === null
|
|
263
|
-
? selectedElement
|
|
264
|
-
: __assign(__assign({}, selectedElement), { path: [
|
|
265
|
-
props.attributes[selectedElement.path[0]],
|
|
266
|
-
selectedElement.path[1],
|
|
267
|
-
] }),
|
|
268
|
-
mode: {
|
|
269
|
-
value: modeValue,
|
|
270
|
-
options: [types_1.IModes.DRAW, types_1.IModes.SELECT].map(function (el) { return ({
|
|
271
|
-
value: el,
|
|
272
|
-
label: el,
|
|
273
|
-
selected: modeValue === el,
|
|
274
|
-
handleSelect: function () { return handleSetMode(el); },
|
|
275
|
-
}); }),
|
|
276
|
-
handleChange: handleSetMode,
|
|
277
|
-
},
|
|
278
|
-
dimensions: {
|
|
279
|
-
enabled: showDimensions,
|
|
280
|
-
handleToggle: handleToggleDimensions,
|
|
281
|
-
},
|
|
282
|
-
angleSnapping: {
|
|
283
|
-
enabled: angleSnappingEnabled,
|
|
284
|
-
handleToggle: handleToggleAngleSnapping,
|
|
285
|
-
},
|
|
286
|
-
reset: handleReset,
|
|
287
|
-
deleteElement: handleDeleteElement,
|
|
288
|
-
walls: prepWallAttributeForOutput(attributesState === null || attributesState === void 0 ? void 0 : attributesState[props.attributes[types_1.IElements.WALL]]),
|
|
289
|
-
windows: props.attributes[types_1.IElements.WINDOW]
|
|
290
|
-
? prepFeatureAttributeForOutput(types_1.IElements.WINDOW, attributesState === null || attributesState === void 0 ? void 0 : attributesState[props.attributes[types_1.IElements.WINDOW]])
|
|
291
|
-
: undefined,
|
|
292
|
-
doors: props.attributes[types_1.IElements.DOOR]
|
|
293
|
-
? prepFeatureAttributeForOutput(types_1.IElements.DOOR, attributesState === null || attributesState === void 0 ? void 0 : attributesState[props.attributes[types_1.IElements.DOOR]])
|
|
294
|
-
: undefined,
|
|
295
|
-
openings: props.attributes[types_1.IElements.OPENING]
|
|
296
|
-
? prepFeatureAttributeForOutput(types_1.IElements.OPENING, attributesState === null || attributesState === void 0 ? void 0 : attributesState[props.attributes[types_1.IElements.OPENING]])
|
|
297
|
-
: undefined,
|
|
298
|
-
};
|
|
299
|
-
};
|
|
300
|
-
useRoomBuilder.themes = themes_1.IThemes;
|
|
301
|
-
useRoomBuilder.units = types_1.IUnits;
|
|
302
|
-
useRoomBuilder.modes = types_1.IModes;
|
|
303
|
-
exports.default = useRoomBuilder;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const errorMessages: {
|
|
2
|
-
addWallCollidingWithWall: () => string;
|
|
3
|
-
addWallCollidingWithFeature: (feature: string) => string;
|
|
4
|
-
featuresColliding: (feature: string) => string;
|
|
5
|
-
featureOutsideWallBounds: () => string;
|
|
6
|
-
wallsNotUnique: () => string;
|
|
7
|
-
wallTooShort: () => string;
|
|
8
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.errorMessages = void 0;
|
|
4
|
-
var constants_1 = require("./constants");
|
|
5
|
-
exports.errorMessages = {
|
|
6
|
-
addWallCollidingWithWall: function () { return 'Wall cannot collide with another wall.'; },
|
|
7
|
-
addWallCollidingWithFeature: function (feature) {
|
|
8
|
-
return "Wall cannot collide with a ".concat(constants_1.FEATURE_LABELS[feature]);
|
|
9
|
-
},
|
|
10
|
-
featuresColliding: function (feature) {
|
|
11
|
-
return "There is already a ".concat(constants_1.FEATURE_LABELS[feature], " in that space.");
|
|
12
|
-
},
|
|
13
|
-
featureOutsideWallBounds: function () {
|
|
14
|
-
return 'Feature is too close to the end of the wall.';
|
|
15
|
-
},
|
|
16
|
-
wallsNotUnique: function () { return 'Cannot place a wall over an existing wall.'; },
|
|
17
|
-
wallTooShort: function () { return 'Wall is too short.'; },
|
|
18
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { IRoomBuilderStyles } from './types';
|
|
2
|
-
export declare enum IThemes {
|
|
3
|
-
DEFAULT = "default",
|
|
4
|
-
BLUEPRINT = "blueprint",
|
|
5
|
-
LIGHT = "light"
|
|
6
|
-
}
|
|
7
|
-
declare const _default: {
|
|
8
|
-
default: IRoomBuilderStyles;
|
|
9
|
-
blueprint: IRoomBuilderStyles;
|
|
10
|
-
light: IRoomBuilderStyles;
|
|
11
|
-
};
|
|
12
|
-
export default _default;
|
|
@@ -1,273 +0,0 @@
|
|
|
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);
|