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

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.
@@ -1,5 +1,5 @@
1
1
  import type { IWalls, IVerticesState, ICoordinate2D, IFeature, IFeatures, ICoordinatesLine, ISpacesStateProps, IElementAddress, IFeatureName, IVertex, IFeaturesHydrated, IElementUi, IElementName, IActiveElement, IEnclosedSpace, IFeatureDoor, IWallsValidationConfig, IGuides, IAttributeDefaults, IGridToDraw } from './types';
2
- import { IUnits } from './types';
2
+ import { IUnits, IDimensionOptions } from './types';
3
3
  import type { IHydratedAttribute } from '../../types';
4
4
  export declare class SpacesState {
5
5
  private _config;
@@ -58,8 +58,8 @@ export declare class SpacesState {
58
58
  get activeElement(): IActiveElement | null;
59
59
  get selectedElement(): null | IElementAddress;
60
60
  set selectedElement(element: null | IElementAddress);
61
- get showDimensions(): boolean;
62
- set showDimensions(val: boolean);
61
+ get showDimensions(): IDimensionOptions;
62
+ set showDimensions(val: IDimensionOptions);
63
63
  get angleSnappingEnabled(): boolean;
64
64
  set angleSnappingEnabled(val: boolean);
65
65
  get guideSnappingEnabled(): boolean;
@@ -103,7 +103,7 @@ export declare class SpacesState {
103
103
  private getWallDimensions;
104
104
  private getWallDimensionsByIndex;
105
105
  private getWallDetailedDimensionsByIndex;
106
- private getAllWallDimensionsToDraw;
106
+ private getDimensionToDraw;
107
107
  private shiftAllFeaturesOnWall;
108
108
  private addFeatureToWall;
109
109
  private removeFeatureFromWall;
@@ -194,7 +194,7 @@ var SpacesState = (function () {
194
194
  _a[types_1.IElements.VERTEX] = {},
195
195
  _a[types_1.IElements.FEATURE] = {},
196
196
  _a);
197
- this._showDimensions = true;
197
+ this._showDimensions = types_1.IDimensionOptions.NONE;
198
198
  this._angleSnappingEnabled = true;
199
199
  this._guideSnappingEnabled = !config.config.disableGuides;
200
200
  this._guides = null;
@@ -765,12 +765,14 @@ var SpacesState = (function () {
765
765
  }, []);
766
766
  return lines;
767
767
  };
768
- SpacesState.prototype.getAllWallDimensionsToDraw = function (detailedWallsIndexes) {
768
+ SpacesState.prototype.getDimensionToDraw = function (detailedWallsIndexes) {
769
769
  var _this = this;
770
770
  if (detailedWallsIndexes === void 0) { detailedWallsIndexes = []; }
771
+ if (this.showDimensions === types_1.IDimensionOptions.NONE)
772
+ return undefined;
771
773
  var indexes = new Set([detailedWallsIndexes].flat());
772
774
  var dimensionsList = this.walls.reduce(function (output, _, i) {
773
- var dimensions = indexes.has(i)
775
+ var dimensions = _this.showDimensions === types_1.IDimensionOptions.DETAILED || indexes.has(i)
774
776
  ? _this.getWallDetailedDimensionsByIndex(i)
775
777
  : _this.getWallDimensionsByIndex(i);
776
778
  if (!dimensions)
@@ -1013,7 +1015,7 @@ var SpacesState = (function () {
1013
1015
  return;
1014
1016
  var offset = undefined;
1015
1017
  var index = undefined;
1016
- var length = (feature === null || feature === void 0 ? void 0 : feature.length) || constants_1.FEATURE_LENGTH;
1018
+ var length = ((feature === null || feature === void 0 ? void 0 : feature.length) || constants_1.FEATURE_LENGTH) / this.scale;
1017
1019
  if (addToWallIndex !== undefined && (feature === null || feature === void 0 ? void 0 : feature.offset) !== undefined) {
1018
1020
  var wall = this.getWall(addToWallIndex);
1019
1021
  if (wall) {
@@ -1043,7 +1045,7 @@ var SpacesState = (function () {
1043
1045
  }
1044
1046
  if (index === undefined || offset === undefined)
1045
1047
  return;
1046
- var newFeature = __assign(__assign({}, feature), { assetId: assetId, offset: offset, length: length, height: (feature === null || feature === void 0 ? void 0 : feature.height) || 0, altitude: (feature === null || feature === void 0 ? void 0 : feature.altitude) || 0, connectedTo: [types_1.IElements.WALL, index], restConfiguration: '{}' });
1048
+ var newFeature = __assign(__assign({}, feature), { assetId: assetId, offset: offset, length: length, height: (feature === null || feature === void 0 ? void 0 : feature.height) ? feature.height / this.scale : 0, altitude: (feature === null || feature === void 0 ? void 0 : feature.altitude) ? feature.altitude / this.scale : 0, connectedTo: [types_1.IElements.WALL, index], restConfiguration: '{}' });
1047
1049
  if (type === types_1.IElements.DOOR) {
1048
1050
  newFeature.orientation = 'left';
1049
1051
  newFeature.openingDirection = 'inside';
@@ -1726,9 +1728,7 @@ var SpacesState = (function () {
1726
1728
  activeWallIndex = (_e = this.getFeature(this._activeElement.type, this._activeElement.index)) === null || _e === void 0 ? void 0 : _e.connectedTo[1];
1727
1729
  var guides = this.guides
1728
1730
  ? __assign(__assign({}, this.guides), { point: this.transformPointToCanvas(this.guides.point) }) : this.guides;
1729
- (0, draw_1.drawSpaces)(canvas, this.gridToDraw, this.enclosedSpacesToDraw, this.wallsToDraw, this.verticesListToDraw, this.featuresToDraw, this._showDimensions
1730
- ? this.getAllWallDimensionsToDraw(activeWallIndex)
1731
- : undefined, guides, selection, this._config.config);
1731
+ (0, draw_1.drawSpaces)(canvas, this.gridToDraw, this.enclosedSpacesToDraw, this.wallsToDraw, this.verticesListToDraw, this.featuresToDraw, this.getDimensionToDraw(activeWallIndex), guides, selection, this._config.config);
1732
1732
  if (((_f = this._newWall) === null || _f === void 0 ? void 0 : _f.start) && ((_g = this._newWall) === null || _g === void 0 ? void 0 : _g.end)) {
1733
1733
  var newWallLine = [
1734
1734
  this._newWall.start.point,
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { IHydratedAttributeArray } from '../../types';
3
- import type { ICoordinate2D, IElementName, IElementPublic, ISpacesHookProps } from './types';
3
+ import { ICoordinate2D, IDimensionOptions, IElementName, IElementPublic, ISpacesHookProps } from './types';
4
4
  import { IModes, IUnits, IElements } from './types';
5
5
  import { IThemes } from './themes';
6
6
  import SpacesLayout from './SpacesLayout';
@@ -16,8 +16,14 @@ interface IUseSpaces {
16
16
  recenter: (zoomToFit?: boolean) => void;
17
17
  deleteElement: (type: IElementName, index: number) => void;
18
18
  dimensions: {
19
- enabled: boolean;
20
- handleToggle: (val?: boolean) => void;
19
+ value: IDimensionOptions;
20
+ options: Array<{
21
+ label: string;
22
+ value: IDimensionOptions;
23
+ selected: boolean;
24
+ handleSelect: () => void;
25
+ }>;
26
+ handleChange: (opt: IDimensionOptions) => void;
21
27
  };
22
28
  angleSnapping: {
23
29
  enabled: boolean;
@@ -39,6 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
39
39
  Object.defineProperty(exports, "__esModule", { value: true });
40
40
  var react_1 = require("react");
41
41
  var types_1 = require("./types");
42
+ var types_2 = require("./types");
42
43
  var useConfigurator_1 = __importDefault(require("../useConfigurator"));
43
44
  var SpacesState_1 = __importDefault(require("./SpacesState"));
44
45
  var constants_1 = require("./constants");
@@ -67,7 +68,7 @@ var useSpaces = function (props) {
67
68
  var translationAnchorRef = (0, react_1.useRef)(null);
68
69
  var preppedConfig = Object.assign({
69
70
  scale: constants_1.SCALE,
70
- unit: types_1.IUnits.FEET,
71
+ unit: types_2.IUnits.FEET,
71
72
  snapProximity: constants_1.SNAP_PROXIMITY,
72
73
  zoomDefault: zoom || constants_1.ZOOM_DEFAULT,
73
74
  translateDefault: translation || constants_1.TRANSLATE_DEFAULT,
@@ -159,7 +160,7 @@ var useSpaces = function (props) {
159
160
  return;
160
161
  var layoutIds = props.layouts || [];
161
162
  dispatch((0, spaces_1.hydrateLayouts)(layoutIds, {
162
- walls: attributeNames[types_1.IElements.WALL],
163
+ walls: attributeNames[types_2.IElements.WALL],
163
164
  startX: attributeNames.wallStartX,
164
165
  startZ: attributeNames.wallStartZ,
165
166
  endX: attributeNames.wallEndX,
@@ -196,7 +197,7 @@ var useSpaces = function (props) {
196
197
  var _a;
197
198
  if (!canvasRef.current)
198
199
  return;
199
- if (modeValue !== types_1.IModes.SELECT)
200
+ if (modeValue !== types_2.IModes.SELECT)
200
201
  return;
201
202
  var cursorPoint = [e.offsetX, e.offsetY];
202
203
  spacesRef.current.selectElementIfInProximity(canvasRef.current, cursorPoint);
@@ -215,7 +216,7 @@ var useSpaces = function (props) {
215
216
  selectElementPending.current = element;
216
217
  };
217
218
  var handleMoveSelectedElement = function (e) {
218
- if (modeValue !== types_1.IModes.SELECT)
219
+ if (modeValue !== types_2.IModes.SELECT)
219
220
  return;
220
221
  if (!canvasRef.current)
221
222
  return;
@@ -224,7 +225,7 @@ var useSpaces = function (props) {
224
225
  selectElementPending.current = null;
225
226
  };
226
227
  var handleMoveCanvas = function (e) {
227
- if (modeValue !== types_1.IModes.SELECT)
228
+ if (modeValue !== types_2.IModes.SELECT)
228
229
  return;
229
230
  if (!canvasRef.current)
230
231
  return;
@@ -239,7 +240,7 @@ var useSpaces = function (props) {
239
240
  };
240
241
  var handleSetSelectedElement = function (e) {
241
242
  var _a;
242
- if (modeValue !== types_1.IModes.SELECT)
243
+ if (modeValue !== types_2.IModes.SELECT)
243
244
  return;
244
245
  if (!canvasRef.current)
245
246
  return;
@@ -262,13 +263,13 @@ var useSpaces = function (props) {
262
263
  spacesRef.current.showGuideAtPoint(canvas, cursorPoint);
263
264
  };
264
265
  var handleDrawWallStart = function (e) {
265
- if (modeValue !== types_1.IModes.DRAW)
266
+ if (modeValue !== types_2.IModes.DRAW)
266
267
  return;
267
268
  var cursorPoint = [e.offsetX, e.offsetY];
268
269
  spacesRef.current.startDrawNewWall(cursorPoint);
269
270
  };
270
271
  var handleDrawWallMouseMove = function (e) {
271
- if (modeValue !== types_1.IModes.DRAW)
272
+ if (modeValue !== types_2.IModes.DRAW)
272
273
  return;
273
274
  if (!canvasRef.current)
274
275
  return;
@@ -278,7 +279,7 @@ var useSpaces = function (props) {
278
279
  };
279
280
  var handleDrawWallFinish = function (e) {
280
281
  var _a;
281
- if (modeValue !== types_1.IModes.DRAW)
282
+ if (modeValue !== types_2.IModes.DRAW)
282
283
  return;
283
284
  if (!canvasRef.current)
284
285
  return;
@@ -300,9 +301,9 @@ var useSpaces = function (props) {
300
301
  if (!canvasRef.current)
301
302
  return;
302
303
  var cursorPoint = [e.offsetX, e.offsetY];
303
- if (modeValue === types_1.IModes.DRAW)
304
+ if (modeValue === types_2.IModes.DRAW)
304
305
  handleDrawModeHover(canvasRef.current, cursorPoint);
305
- else if (modeValue === types_1.IModes.SELECT)
306
+ else if (modeValue === types_2.IModes.SELECT)
306
307
  handleSelectModeHover(canvasRef.current, cursorPoint);
307
308
  };
308
309
  var prepFeatureAttributeForOutput = function (type, attribute) {
@@ -354,12 +355,8 @@ var useSpaces = function (props) {
354
355
  (_a = spacesRef.current) === null || _a === void 0 ? void 0 : _a.deleteElement(elementType, index);
355
356
  setSelectedElement(null);
356
357
  };
357
- var handleToggleDimensions = function (val) {
358
- if (val === undefined)
359
- dispatch((0, spaces_1.setShowDimensions)(!showDimensions));
360
- else
361
- dispatch((0, spaces_1.setShowDimensions)(val));
362
- setSelectedElement(null);
358
+ var handleSetShowDimensions = function (val) {
359
+ dispatch((0, spaces_1.setShowDimensions)(val));
363
360
  };
364
361
  var handleToggleAngleSnapping = function (val) {
365
362
  if (val === undefined)
@@ -398,18 +395,18 @@ var useSpaces = function (props) {
398
395
  : __assign(__assign({}, selectedElement), { path: [
399
396
  attributeNames[selectedElement.path[0]],
400
397
  selectedElement.path[1],
401
- ], type: selectedElement.path[0], deleteElement: function () { return handleDeleteElement.apply(void 0, selectedElement.path); }, splitWall: selectedElement.path[0] !== types_1.IElements.WALL
398
+ ], type: selectedElement.path[0], deleteElement: function () { return handleDeleteElement.apply(void 0, selectedElement.path); }, splitWall: selectedElement.path[0] !== types_2.IElements.WALL
402
399
  ? undefined
403
400
  : function (offset) {
404
401
  return spacesRef.current.splitWallAtOffset(selectedElement.path[1], offset);
405
- }, addFeature: selectedElement.path[0] !== types_1.IElements.WALL
402
+ }, addFeature: selectedElement.path[0] !== types_2.IElements.WALL
406
403
  ? undefined
407
404
  : function (type, feature) {
408
405
  return spacesRef.current.addFeature(type, selectedElement.path[1], feature);
409
406
  } }),
410
407
  mode: {
411
408
  value: modeValue,
412
- options: [types_1.IModes.SELECT, types_1.IModes.DRAW].map(function (el) { return ({
409
+ options: [types_2.IModes.SELECT, types_2.IModes.DRAW].map(function (el) { return ({
413
410
  value: el,
414
411
  label: el,
415
412
  selected: modeValue === el,
@@ -418,8 +415,18 @@ var useSpaces = function (props) {
418
415
  handleChange: handleSetMode,
419
416
  },
420
417
  dimensions: {
421
- enabled: showDimensions,
422
- handleToggle: handleToggleDimensions,
418
+ value: showDimensions,
419
+ options: [
420
+ types_1.IDimensionOptions.NONE,
421
+ types_1.IDimensionOptions.DEFAULT,
422
+ types_1.IDimensionOptions.DETAILED,
423
+ ].map(function (el) { return ({
424
+ value: el,
425
+ label: el,
426
+ selected: showDimensions === el,
427
+ handleSelect: function () { return handleSetShowDimensions(el); },
428
+ }); }),
429
+ handleChange: handleSetShowDimensions,
423
430
  },
424
431
  angleSnapping: {
425
432
  enabled: angleSnappingEnabled,
@@ -441,7 +448,7 @@ var useSpaces = function (props) {
441
448
  },
442
449
  unit: {
443
450
  value: unit,
444
- options: [types_1.IUnits.FEET, types_1.IUnits.METER, types_1.IUnits.INCH, types_1.IUnits.CM].map(function (el) { return ({
451
+ options: [types_2.IUnits.FEET, types_2.IUnits.METER, types_2.IUnits.INCH, types_2.IUnits.CM].map(function (el) { return ({
445
452
  value: el,
446
453
  label: el,
447
454
  selected: unit === el,
@@ -462,14 +469,14 @@ var useSpaces = function (props) {
462
469
  return window.threekit.configurator.setFullConfiguration(layout.configuration);
463
470
  },
464
471
  }); }),
465
- walls: prepWallAttributeForOutput(attributesState === null || attributesState === void 0 ? void 0 : attributesState[attributeNames[types_1.IElements.WALL]]),
466
- windows: prepFeatureAttributeForOutput(types_1.IElements.WINDOW, attributesState === null || attributesState === void 0 ? void 0 : attributesState[attributeNames[types_1.IElements.WINDOW]]),
467
- doors: prepFeatureAttributeForOutput(types_1.IElements.DOOR, attributesState === null || attributesState === void 0 ? void 0 : attributesState[attributeNames[types_1.IElements.DOOR]]),
468
- openings: prepFeatureAttributeForOutput(types_1.IElements.OPENING, attributesState === null || attributesState === void 0 ? void 0 : attributesState[attributeNames[types_1.IElements.OPENING]]),
472
+ walls: prepWallAttributeForOutput(attributesState === null || attributesState === void 0 ? void 0 : attributesState[attributeNames[types_2.IElements.WALL]]),
473
+ windows: prepFeatureAttributeForOutput(types_2.IElements.WINDOW, attributesState === null || attributesState === void 0 ? void 0 : attributesState[attributeNames[types_2.IElements.WINDOW]]),
474
+ doors: prepFeatureAttributeForOutput(types_2.IElements.DOOR, attributesState === null || attributesState === void 0 ? void 0 : attributesState[attributeNames[types_2.IElements.DOOR]]),
475
+ openings: prepFeatureAttributeForOutput(types_2.IElements.OPENING, attributesState === null || attributesState === void 0 ? void 0 : attributesState[attributeNames[types_2.IElements.OPENING]]),
469
476
  };
470
477
  };
471
478
  useSpaces.themes = themes_1.IThemes;
472
- useSpaces.units = types_1.IUnits;
473
- useSpaces.modes = types_1.IModes;
479
+ useSpaces.units = types_2.IUnits;
480
+ useSpaces.modes = types_2.IModes;
474
481
  useSpaces.LayoutIcon = SpacesLayout_1.default;
475
482
  exports.default = useSpaces;
@@ -285,6 +285,11 @@ export declare enum IUnits {
285
285
  INCH = "inch",
286
286
  CM = "cm"
287
287
  }
288
+ export declare enum IDimensionOptions {
289
+ NONE = "none",
290
+ DEFAULT = "default",
291
+ DETAILED = "detailed"
292
+ }
288
293
  export interface ISpacesConfigShared<T> {
289
294
  scale: number;
290
295
  unit: IUnits;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IUnits = exports.IModes = exports.IErrorTypes = exports.GUIDE_ORIENTATIONS = exports.SNAPPING_TYPES = exports.IElementStyleModes = exports.IElements = void 0;
3
+ exports.IDimensionOptions = exports.IUnits = exports.IModes = exports.IErrorTypes = exports.GUIDE_ORIENTATIONS = exports.SNAPPING_TYPES = exports.IElementStyleModes = exports.IElements = void 0;
4
4
  var IElements;
5
5
  (function (IElements) {
6
6
  IElements["WALL"] = "walls";
@@ -46,3 +46,9 @@ var IUnits;
46
46
  IUnits["INCH"] = "inch";
47
47
  IUnits["CM"] = "cm";
48
48
  })(IUnits = exports.IUnits || (exports.IUnits = {}));
49
+ var IDimensionOptions;
50
+ (function (IDimensionOptions) {
51
+ IDimensionOptions["NONE"] = "none";
52
+ IDimensionOptions["DEFAULT"] = "default";
53
+ IDimensionOptions["DETAILED"] = "detailed";
54
+ })(IDimensionOptions = exports.IDimensionOptions || (exports.IDimensionOptions = {}));
@@ -0,0 +1,3 @@
1
+ import { IIcon } from './types';
2
+ export declare const Ruler: IIcon;
3
+ export default Ruler;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.Ruler = void 0;
11
+ var react_1 = __importDefault(require("react"));
12
+ var styled_components_1 = __importDefault(require("styled-components"));
13
+ var SVG = styled_components_1.default.svg(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .tk-icon {\n stroke: ", ";\n }\n"], ["\n .tk-icon {\n stroke: ", ";\n }\n"])), function (props) { return props.color || props.theme.textColor; });
14
+ var Ruler = function (props) {
15
+ return (react_1.default.createElement(SVG, { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", color: props.color },
16
+ react_1.default.createElement("rect", { x: "5.75735", y: "1.51472", width: "18", height: "6", transform: "rotate(45 5.75735 1.51472)", className: "tk-icon", strokeWidth: "2" }),
17
+ react_1.default.createElement("path", { d: "M8.93934 4.6967L6.11091 7.52513M11.0607 6.81802L8.93934 8.93934M13.182 8.93934L11.0607 11.0607M15.3033 11.0607L12.4749 13.8891", className: "tk-icon", strokeWidth: "1" })));
18
+ };
19
+ exports.Ruler = Ruler;
20
+ exports.Ruler.iconName = 'ruler';
21
+ exports.default = exports.Ruler;
22
+ var templateObject_1;
@@ -0,0 +1,3 @@
1
+ import { IIcon } from './types';
2
+ export declare const Ruler: IIcon;
3
+ export default Ruler;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.Ruler = void 0;
11
+ var react_1 = __importDefault(require("react"));
12
+ var styled_components_1 = __importDefault(require("styled-components"));
13
+ var SVG = styled_components_1.default.svg(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .tk-icon {\n stroke: ", ";\n }\n"], ["\n .tk-icon {\n stroke: ", ";\n }\n"])), function (props) { return props.color || props.theme.textColor; });
14
+ var Ruler = function (props) {
15
+ return (react_1.default.createElement(SVG, { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", color: props.color },
16
+ react_1.default.createElement("g", { "clip-path": "url(#clip0_1031_536)" },
17
+ react_1.default.createElement("rect", { x: "5.75732", y: "1.51465", width: "18", height: "6", transform: "rotate(45 5.75732 1.51465)", className: "tk-icon", "stroke-width": "2" })),
18
+ react_1.default.createElement("defs", null,
19
+ react_1.default.createElement("clipPath", { id: "clip0_1031_536" },
20
+ react_1.default.createElement("rect", { width: "20", height: "20", fill: "white" })))));
21
+ };
22
+ exports.Ruler = Ruler;
23
+ exports.Ruler.iconName = 'ruler';
24
+ exports.default = exports.Ruler;
25
+ var templateObject_1;
@@ -0,0 +1,3 @@
1
+ import { IIcon } from './types';
2
+ export declare const Ruler: IIcon;
3
+ export default Ruler;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.Ruler = void 0;
11
+ var react_1 = __importDefault(require("react"));
12
+ var styled_components_1 = __importDefault(require("styled-components"));
13
+ var SVG = styled_components_1.default.svg(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .tk-icon {\n stroke: ", ";\n }\n"], ["\n .tk-icon {\n stroke: ", ";\n }\n"])), function (props) { return props.color || props.theme.textColor; });
14
+ var Ruler = function (props) {
15
+ return (react_1.default.createElement(SVG, { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", color: props.color },
16
+ react_1.default.createElement("g", { "clip-path": "url(#clip0_1031_521)" },
17
+ react_1.default.createElement("rect", { x: "5.75732", y: "1.51465", width: "18", height: "6", transform: "rotate(45 5.75732 1.51465)", className: "tk-icon", "stroke-width": "2" }),
18
+ react_1.default.createElement("path", { d: "M7.82837 4L4.99994 6.82843M9.16899 5.34062L7.04767 7.46194M10.5096 6.68123L8.38828 8.80255M11.8502 8.02185L9.02179 10.8503", className: "tk-icon" }),
19
+ react_1.default.createElement("path", { d: "M11.8284 8L8.99994 10.8284M13.169 9.34062L11.0477 11.4619M14.5096 10.6812L12.3883 12.8026M15.8502 12.0219L13.0218 14.8503", className: "tk-icon" })),
20
+ react_1.default.createElement("defs", null,
21
+ react_1.default.createElement("clipPath", { id: "clip0_1031_521" },
22
+ react_1.default.createElement("rect", { width: "20", height: "20", fill: "white" })))));
23
+ };
24
+ exports.Ruler = Ruler;
25
+ exports.Ruler.iconName = 'ruler';
26
+ exports.default = exports.Ruler;
27
+ var templateObject_1;
@@ -0,0 +1,3 @@
1
+ import { IIcon } from './types';
2
+ export declare const Ruler: IIcon;
3
+ export default Ruler;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.Ruler = void 0;
11
+ var react_1 = __importDefault(require("react"));
12
+ var styled_components_1 = __importDefault(require("styled-components"));
13
+ var SVG = styled_components_1.default.svg(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .tk-icon {\n stroke: ", ";\n }\n"], ["\n .tk-icon {\n stroke: ", ";\n }\n"])), function (props) { return props.color || props.theme.textColor; });
14
+ var Ruler = function (props) {
15
+ return (react_1.default.createElement(SVG, { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", color: props.color },
16
+ react_1.default.createElement("g", { "clip-path": "url(#clip0_1031_521)" },
17
+ react_1.default.createElement("rect", { x: "5.75732", y: "1.51465", width: "18", height: "6", transform: "rotate(45 5.75732 1.51465)", className: "tk-icon", "stroke-width": "2" }),
18
+ react_1.default.createElement("path", { d: "M7.82837 4L4.99994 6.82843M9.16899 5.34062L7.04767 7.46194M10.5096 6.68123L8.38828 8.80255M11.8502 8.02185L9.02179 10.8503", className: "tk-icon" }),
19
+ react_1.default.createElement("path", { d: "M11.8284 8L8.99994 10.8284M13.169 9.34062L11.0477 11.4619M14.5096 10.6812L12.3883 12.8026M15.8502 12.0219L13.0218 14.8503", className: "tk-icon" })),
20
+ react_1.default.createElement("defs", null,
21
+ react_1.default.createElement("clipPath", { id: "clip0_1031_521" },
22
+ react_1.default.createElement("rect", { width: "20", height: "20", fill: "white" })))));
23
+ };
24
+ exports.Ruler = Ruler;
25
+ exports.Ruler.iconName = 'ruler';
26
+ exports.default = exports.Ruler;
27
+ var templateObject_1;
@@ -37,6 +37,8 @@ var Player3D_1 = __importDefault(require("./Player3D"));
37
37
  var Redo_1 = __importDefault(require("./Redo"));
38
38
  var Remove_1 = __importDefault(require("./Remove"));
39
39
  var Ruler_1 = __importDefault(require("./Ruler"));
40
+ var RulerBlank_1 = __importDefault(require("./RulerBlank"));
41
+ var RulerDetailed_1 = __importDefault(require("./RulerDetailed"));
40
42
  var Search_1 = __importDefault(require("./Search"));
41
43
  var Settings_1 = __importDefault(require("./Settings"));
42
44
  var Share_1 = __importDefault(require("./Share"));
@@ -101,6 +103,8 @@ exports.default = (_a = {},
101
103
  _a[Redo_1.default.iconName] = Redo_1.default,
102
104
  _a[Remove_1.default.iconName] = Remove_1.default,
103
105
  _a[Ruler_1.default.iconName] = Ruler_1.default,
106
+ _a[RulerBlank_1.default.iconName] = RulerBlank_1.default,
107
+ _a[RulerDetailed_1.default.iconName] = RulerDetailed_1.default,
104
108
  _a[Search_1.default.iconName] = Search_1.default,
105
109
  _a[Settings_1.default.iconName] = Settings_1.default,
106
110
  _a[Share_1.default.iconName] = Share_1.default,
package/dist/index.d.ts CHANGED
@@ -91,6 +91,8 @@ import Player3DIcon from './icons/Player3D';
91
91
  import RedoIcon from './icons/Redo';
92
92
  import RemoveIcon from './icons/Remove';
93
93
  import RulerIcon from './icons/Ruler';
94
+ import RulerBlankIcon from './icons/RulerBlank';
95
+ import RulerDetailedIcon from './icons/RulerDetailed';
94
96
  import SearchIcon from './icons/Search';
95
97
  import SettingsIcon from './icons/Settings';
96
98
  import ShareIcon from './icons/Share';
@@ -121,4 +123,4 @@ import UnitCmIcon from './icons/UnitCm';
121
123
  import UnitMeterIcon from './icons/UnitMeter';
122
124
  import UnitFeetIcon from './icons/UnitFeet';
123
125
  import UnitInchIcon from './icons/UnitInch';
124
- export { useAttribute, useConfigurator, useConfigurationLoader, useFirstPlayerInteraction, useMetadata, useName, usePlayerLoadingStatus, useConfigurationChangeStatus, usePrice, useThreekitInitStatus, useZoom, useSnapshot, useWishlist, useShare, usePlayerPortal, useProductCache, useNestedConfigurator, useLoadingProgress, usePlayer, useSpaces, usePlayerReady, ThreekitProvider, Player, Button, Cards, Dropdown, Strips, Swatch, TextInput, Tiles, TilesGroup, Upload, Switch, ProductName, ProductDescription, AttributeTitle, AttributeValue, TotalPrice, Skeleton, message, Modal, Drawer, Accordion, Tabs, PortalToArOverlay, PortalToElement, AwaitThreekitLoad, FlatForm, Zoom, Snapshots, Wishlist, Share, TrebleApp, ProductLayout, PlayerLoadingCircular, PlayerLoadingSpinner, DraggableHint, TurntableAnimation, BreatheAnimation, SpacesLayoutIcon, AddIcon, ArrowLeftIcon, ArrowRightIcon, CameraIcon, CaretDownIcon, CaretUpIcon, CaretLeftIcon, CaretRightIcon, CartIcon, CheckmateIcon, ClipboardIcon, ColorPickerIcon, CopyIcon, DeleteIcon, DoubleCaretLeftIcon, DoubleCaretRightIcon, DownloadIcon, DraggableIcon, DragIcon, EditIcon, HeartIcon, ImageIcon, InfoIcon, MailIcon, MenuIcon, MoreIcon, NewWindowIcon, PauseIcon, PlayIcon, Player3DIcon, RedoIcon, RemoveIcon, RulerIcon, SearchIcon, SettingsIcon, ShareIcon, SwitchIcon, TagIcon, UndoIcon, WishlistIcon, ZoomInIcon, ZoomOutIcon, SpinnerIcon, AngleIcon, TrashCanIcon, TrashCanAltIcon, CursorIcon, WindowIcon, DrawIcon, DoorIcon, OpeningIcon, WallIcon, LayoutIcon, GridSnappingIcon, AngleSnappingIcon, CenterIcon, LayoutAltIcon, MagnetIcon, SaveIcon, UnitCmIcon, UnitMeterIcon, UnitFeetIcon, UnitInchIcon, };
126
+ export { useAttribute, useConfigurator, useConfigurationLoader, useFirstPlayerInteraction, useMetadata, useName, usePlayerLoadingStatus, useConfigurationChangeStatus, usePrice, useThreekitInitStatus, useZoom, useSnapshot, useWishlist, useShare, usePlayerPortal, useProductCache, useNestedConfigurator, useLoadingProgress, usePlayer, useSpaces, usePlayerReady, ThreekitProvider, Player, Button, Cards, Dropdown, Strips, Swatch, TextInput, Tiles, TilesGroup, Upload, Switch, ProductName, ProductDescription, AttributeTitle, AttributeValue, TotalPrice, Skeleton, message, Modal, Drawer, Accordion, Tabs, PortalToArOverlay, PortalToElement, AwaitThreekitLoad, FlatForm, Zoom, Snapshots, Wishlist, Share, TrebleApp, ProductLayout, PlayerLoadingCircular, PlayerLoadingSpinner, DraggableHint, TurntableAnimation, BreatheAnimation, SpacesLayoutIcon, AddIcon, ArrowLeftIcon, ArrowRightIcon, CameraIcon, CaretDownIcon, CaretUpIcon, CaretLeftIcon, CaretRightIcon, CartIcon, CheckmateIcon, ClipboardIcon, ColorPickerIcon, CopyIcon, DeleteIcon, DoubleCaretLeftIcon, DoubleCaretRightIcon, DownloadIcon, DraggableIcon, DragIcon, EditIcon, HeartIcon, ImageIcon, InfoIcon, MailIcon, MenuIcon, MoreIcon, NewWindowIcon, PauseIcon, PlayIcon, Player3DIcon, RedoIcon, RemoveIcon, RulerIcon, RulerBlankIcon, RulerDetailedIcon, SearchIcon, SettingsIcon, ShareIcon, SwitchIcon, TagIcon, UndoIcon, WishlistIcon, ZoomInIcon, ZoomOutIcon, SpinnerIcon, AngleIcon, TrashCanIcon, TrashCanAltIcon, CursorIcon, WindowIcon, DrawIcon, DoorIcon, OpeningIcon, WallIcon, LayoutIcon, GridSnappingIcon, AngleSnappingIcon, CenterIcon, LayoutAltIcon, MagnetIcon, SaveIcon, UnitCmIcon, UnitMeterIcon, UnitFeetIcon, UnitInchIcon, };
package/dist/index.js CHANGED
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Snapshots = exports.Zoom = exports.FlatForm = exports.AwaitThreekitLoad = exports.PortalToElement = exports.PortalToArOverlay = exports.Tabs = exports.Accordion = exports.Drawer = exports.Modal = exports.message = exports.Skeleton = exports.TotalPrice = exports.AttributeValue = exports.AttributeTitle = exports.ProductDescription = exports.ProductName = exports.Switch = exports.Upload = exports.TilesGroup = exports.Tiles = exports.TextInput = exports.Swatch = exports.Strips = exports.Dropdown = exports.Cards = exports.Button = exports.Player = exports.ThreekitProvider = exports.usePlayerReady = exports.useSpaces = exports.usePlayer = exports.useLoadingProgress = exports.useNestedConfigurator = exports.useProductCache = exports.usePlayerPortal = exports.useShare = exports.useWishlist = exports.useSnapshot = exports.useZoom = exports.useThreekitInitStatus = exports.usePrice = exports.useConfigurationChangeStatus = exports.usePlayerLoadingStatus = exports.useName = exports.useMetadata = exports.useFirstPlayerInteraction = exports.useConfigurationLoader = exports.useConfigurator = exports.useAttribute = void 0;
7
- exports.WishlistIcon = exports.UndoIcon = exports.TagIcon = exports.SwitchIcon = exports.ShareIcon = exports.SettingsIcon = exports.SearchIcon = exports.RulerIcon = exports.RemoveIcon = exports.RedoIcon = exports.Player3DIcon = exports.PlayIcon = exports.PauseIcon = exports.NewWindowIcon = exports.MoreIcon = exports.MenuIcon = exports.MailIcon = exports.InfoIcon = exports.ImageIcon = exports.HeartIcon = exports.EditIcon = exports.DragIcon = exports.DraggableIcon = exports.DownloadIcon = exports.DoubleCaretRightIcon = exports.DoubleCaretLeftIcon = exports.DeleteIcon = exports.CopyIcon = exports.ColorPickerIcon = exports.ClipboardIcon = exports.CheckmateIcon = exports.CartIcon = exports.CaretRightIcon = exports.CaretLeftIcon = exports.CaretUpIcon = exports.CaretDownIcon = exports.CameraIcon = exports.ArrowRightIcon = exports.ArrowLeftIcon = exports.AddIcon = exports.SpacesLayoutIcon = exports.BreatheAnimation = exports.TurntableAnimation = exports.DraggableHint = exports.PlayerLoadingSpinner = exports.PlayerLoadingCircular = exports.ProductLayout = exports.TrebleApp = exports.Share = exports.Wishlist = void 0;
8
- exports.UnitInchIcon = exports.UnitFeetIcon = exports.UnitMeterIcon = exports.UnitCmIcon = exports.SaveIcon = exports.MagnetIcon = exports.LayoutAltIcon = exports.CenterIcon = exports.AngleSnappingIcon = exports.GridSnappingIcon = exports.LayoutIcon = exports.WallIcon = exports.OpeningIcon = exports.DoorIcon = exports.DrawIcon = exports.WindowIcon = exports.CursorIcon = exports.TrashCanAltIcon = exports.TrashCanIcon = exports.AngleIcon = exports.SpinnerIcon = exports.ZoomOutIcon = exports.ZoomInIcon = void 0;
7
+ exports.TagIcon = exports.SwitchIcon = exports.ShareIcon = exports.SettingsIcon = exports.SearchIcon = exports.RulerDetailedIcon = exports.RulerBlankIcon = exports.RulerIcon = exports.RemoveIcon = exports.RedoIcon = exports.Player3DIcon = exports.PlayIcon = exports.PauseIcon = exports.NewWindowIcon = exports.MoreIcon = exports.MenuIcon = exports.MailIcon = exports.InfoIcon = exports.ImageIcon = exports.HeartIcon = exports.EditIcon = exports.DragIcon = exports.DraggableIcon = exports.DownloadIcon = exports.DoubleCaretRightIcon = exports.DoubleCaretLeftIcon = exports.DeleteIcon = exports.CopyIcon = exports.ColorPickerIcon = exports.ClipboardIcon = exports.CheckmateIcon = exports.CartIcon = exports.CaretRightIcon = exports.CaretLeftIcon = exports.CaretUpIcon = exports.CaretDownIcon = exports.CameraIcon = exports.ArrowRightIcon = exports.ArrowLeftIcon = exports.AddIcon = exports.SpacesLayoutIcon = exports.BreatheAnimation = exports.TurntableAnimation = exports.DraggableHint = exports.PlayerLoadingSpinner = exports.PlayerLoadingCircular = exports.ProductLayout = exports.TrebleApp = exports.Share = exports.Wishlist = void 0;
8
+ exports.UnitInchIcon = exports.UnitFeetIcon = exports.UnitMeterIcon = exports.UnitCmIcon = exports.SaveIcon = exports.MagnetIcon = exports.LayoutAltIcon = exports.CenterIcon = exports.AngleSnappingIcon = exports.GridSnappingIcon = exports.LayoutIcon = exports.WallIcon = exports.OpeningIcon = exports.DoorIcon = exports.DrawIcon = exports.WindowIcon = exports.CursorIcon = exports.TrashCanAltIcon = exports.TrashCanIcon = exports.AngleIcon = exports.SpinnerIcon = exports.ZoomOutIcon = exports.ZoomInIcon = exports.WishlistIcon = exports.UndoIcon = void 0;
9
9
  var useAttribute_1 = __importDefault(require("./hooks/useAttribute"));
10
10
  exports.useAttribute = useAttribute_1.default;
11
11
  var useConfigurator_1 = __importDefault(require("./hooks/useConfigurator"));
@@ -192,6 +192,10 @@ var Remove_1 = __importDefault(require("./icons/Remove"));
192
192
  exports.RemoveIcon = Remove_1.default;
193
193
  var Ruler_1 = __importDefault(require("./icons/Ruler"));
194
194
  exports.RulerIcon = Ruler_1.default;
195
+ var RulerBlank_1 = __importDefault(require("./icons/RulerBlank"));
196
+ exports.RulerBlankIcon = RulerBlank_1.default;
197
+ var RulerDetailed_1 = __importDefault(require("./icons/RulerDetailed"));
198
+ exports.RulerDetailedIcon = RulerDetailed_1.default;
195
199
  var Search_1 = __importDefault(require("./icons/Search"));
196
200
  exports.SearchIcon = Search_1.default;
197
201
  var Settings_1 = __importDefault(require("./icons/Settings"));
@@ -1,6 +1,6 @@
1
1
  import { RootState, ThreekitDispatch } from './index';
2
2
  import { IConfiguration } from '../types';
3
- import { ICoordinate2D, IModes, IUnits } from '../hooks/useSpaces/types';
3
+ import { ICoordinate2D, IDimensionOptions, IModes, IUnits } from '../hooks/useSpaces/types';
4
4
  interface ILayout {
5
5
  label: string;
6
6
  configuration: IConfiguration;
@@ -19,7 +19,7 @@ export interface SpacesState {
19
19
  unit: IUnits;
20
20
  zoom: null | number;
21
21
  translation: null | ICoordinate2D;
22
- showDimensions: boolean;
22
+ showDimensions: IDimensionOptions;
23
23
  angleSnappingEnabled: boolean;
24
24
  guideSnappingEnabled: boolean;
25
25
  gridSnappingEnabled: boolean;
@@ -29,7 +29,7 @@ export declare const setZoom: import("@reduxjs/toolkit").ActionCreatorWithPayloa
29
29
  export declare const setUnit: import("@reduxjs/toolkit").ActionCreatorWithPayload<IUnits, string>;
30
30
  export declare const setTranslation: import("@reduxjs/toolkit").ActionCreatorWithPayload<ICoordinate2D, string>;
31
31
  export declare const setMode: import("@reduxjs/toolkit").ActionCreatorWithPayload<IModes, string>;
32
- export declare const setShowDimensions: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>;
32
+ export declare const setShowDimensions: import("@reduxjs/toolkit").ActionCreatorWithPayload<IDimensionOptions, string>;
33
33
  export declare const setAngleSnappingEnabled: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>;
34
34
  export declare const setGuideSnappingEnabled: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>;
35
35
  export declare const setGridSnappingEnabled: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>;
@@ -39,7 +39,7 @@ export declare const getLayouts: (state: RootState) => Array<ILayout>;
39
39
  export declare const getUnit: (state: RootState) => IUnits;
40
40
  export declare const getZoom: (state: RootState) => number | null;
41
41
  export declare const getTranslation: (state: RootState) => ICoordinate2D | null;
42
- export declare const getShowDimensions: (state: RootState) => boolean;
42
+ export declare const getShowDimensions: (state: RootState) => IDimensionOptions;
43
43
  export declare const getAngleSnappingEnabled: (state: RootState) => boolean;
44
44
  export declare const getGuideSnappingEnabled: (state: RootState) => boolean;
45
45
  export declare const getGridSnappingEnabled: (state: RootState) => boolean;
@@ -79,7 +79,7 @@ var initialState = {
79
79
  unit: types_1.IUnits.FEET,
80
80
  zoom: null,
81
81
  translation: null,
82
- showDimensions: true,
82
+ showDimensions: types_1.IDimensionOptions.DEFAULT,
83
83
  angleSnappingEnabled: true,
84
84
  guideSnappingEnabled: true,
85
85
  gridSnappingEnabled: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threekit-tools/treble",
3
- "version": "0.0.91-next-02",
3
+ "version": "0.0.91-next-03",
4
4
  "author": "Amaan Saeed",
5
5
  "license": "MIT",
6
6
  "files": [