@threekit-tools/treble 0.0.91-next-03 → 0.0.92

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 (91) hide show
  1. package/dist/Treble/Treble.d.ts +2 -2
  2. package/dist/Treble/Treble.js +3 -3
  3. package/dist/Treble/index.d.ts +1 -1
  4. package/dist/Treble/index.js +1 -1
  5. package/dist/Treble/snapshot.d.ts +1 -1
  6. package/dist/Treble/snapshots.d.ts +22 -0
  7. package/dist/Treble/snapshots.js +247 -0
  8. package/dist/Treble/wishlist.d.ts +1 -1
  9. package/dist/Treble/wishlist.js +1 -1
  10. package/dist/api/catalog.js +1 -1
  11. package/dist/api/configurations.js +1 -1
  12. package/dist/api/datatables.js +1 -1
  13. package/dist/api/orders.js +1 -1
  14. package/dist/api/price.js +1 -1
  15. package/dist/api/products.d.ts +2 -2
  16. package/dist/api/products.js +1 -1
  17. package/dist/components/BreatheAnimation/index.js +1 -1
  18. package/dist/components/Button/index.d.ts +2 -2
  19. package/dist/components/DraggableHint/draggableIndicator.styles.d.ts +1 -1
  20. package/dist/components/PlayerLoadingSpinner/playerLoadingSpinner.styles.d.ts +1 -1
  21. package/dist/components/Share/index.js +1 -1
  22. package/dist/components/Share/share.styles.d.ts +1 -1
  23. package/dist/components/ThreekitProvider/index.js +3 -2
  24. package/dist/components/TurntableAnimation/index.js +1 -1
  25. package/dist/components/Upload/index.js +1 -1
  26. package/dist/components/UploadArea/index.js +1 -1
  27. package/dist/components/Wishlist/index.js +1 -1
  28. package/dist/connection.d.ts +4 -1
  29. package/dist/connection.js +16 -53
  30. package/dist/hooks/useAttribute/index.d.ts +4 -4
  31. package/dist/hooks/useAttribute/index.js +2 -6
  32. package/dist/hooks/useConfigurationLoader/index.js +1 -1
  33. package/dist/hooks/useConfigurator/index.d.ts +3 -3
  34. package/dist/hooks/useDevTools/index.d.ts +1 -1
  35. package/dist/hooks/useNestedConfigurator/index.d.ts +2 -2
  36. package/dist/hooks/useNestedConfigurator/index.js +3 -2
  37. package/dist/hooks/usePlayer/index.d.ts +1 -1
  38. package/dist/hooks/usePlayerPortal/index.d.ts +1 -1
  39. package/dist/hooks/useProductCache/index.js +1 -1
  40. package/dist/hooks/useResetProduct/index.d.ts +1 -1
  41. package/dist/hooks/useResetProduct/index.js +1 -1
  42. package/dist/hooks/useRoomBuilder/RoomBuilderState.d.ts +95 -0
  43. package/dist/hooks/useRoomBuilder/RoomBuilderState.js +1237 -0
  44. package/dist/hooks/useRoomBuilder/constants.d.ts +41 -0
  45. package/dist/hooks/useRoomBuilder/constants.js +48 -0
  46. package/dist/hooks/useRoomBuilder/dataHandlers.d.ts +18 -0
  47. package/dist/hooks/useRoomBuilder/dataHandlers.js +187 -0
  48. package/dist/hooks/useRoomBuilder/draw.d.ts +55 -0
  49. package/dist/hooks/useRoomBuilder/draw.js +573 -0
  50. package/dist/hooks/useRoomBuilder/findLoops.d.ts +5 -0
  51. package/dist/hooks/useRoomBuilder/findLoops.js +99 -0
  52. package/dist/hooks/useRoomBuilder/geometry.d.ts +33 -0
  53. package/dist/hooks/useRoomBuilder/geometry.js +325 -0
  54. package/dist/hooks/useRoomBuilder/index.d.ts +40 -0
  55. package/dist/hooks/useRoomBuilder/index.js +303 -0
  56. package/dist/hooks/useRoomBuilder/messaging.d.ts +8 -0
  57. package/dist/hooks/useRoomBuilder/messaging.js +18 -0
  58. package/dist/hooks/useRoomBuilder/themes.d.ts +12 -0
  59. package/dist/hooks/useRoomBuilder/themes.js +273 -0
  60. package/dist/hooks/useRoomBuilder/types.d.ts +238 -0
  61. package/dist/hooks/useRoomBuilder/types.js +36 -0
  62. package/dist/hooks/useRoomBuilder/validators.d.ts +36 -0
  63. package/dist/hooks/useRoomBuilder/validators.js +362 -0
  64. package/dist/hooks/useShare/index.d.ts +1 -1
  65. package/dist/hooks/useShare/index.js +1 -1
  66. package/dist/hooks/useSingleAnimation/index.js +1 -1
  67. package/dist/hooks/useSnapshot/index.d.ts +1 -1
  68. package/dist/hooks/useWishlist/index.d.ts +1 -1
  69. package/dist/hooks/useZoom/index.d.ts +1 -1
  70. package/dist/http/orders.d.ts +1 -1
  71. package/dist/icons/Draw.js +3 -3
  72. package/dist/icons/Window.js +4 -4
  73. package/dist/icons/index.js +0 -26
  74. package/dist/index.d.ts +2 -16
  75. package/dist/index.js +5 -33
  76. package/dist/store/attributes.d.ts +1 -2
  77. package/dist/store/attributes.js +1 -1
  78. package/dist/store/index.d.ts +2 -9
  79. package/dist/store/index.js +1 -3
  80. package/dist/store/price.js +1 -1
  81. package/dist/store/product.d.ts +1 -1
  82. package/dist/store/product.js +8 -5
  83. package/dist/store/translations.js +1 -1
  84. package/dist/store/treble.d.ts +4 -2
  85. package/dist/store/treble.js +60 -43
  86. package/dist/store/wishlist.d.ts +1 -1
  87. package/dist/store/wishlist.js +1 -1
  88. package/dist/types.d.ts +25 -21
  89. package/dist/utils.d.ts +1 -1
  90. package/dist/utils.js +1 -1
  91. package/package.json +2 -1
@@ -0,0 +1,303 @@
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;
@@ -0,0 +1,8 @@
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
+ };
@@ -0,0 +1,18 @@
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
+ };
@@ -0,0 +1,12 @@
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;
@@ -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);