@threekit-tools/treble 0.0.95-next-01 → 0.0.96

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 (202) hide show
  1. package/dist/Treble/Treble.d.ts +2 -2
  2. package/dist/Treble/Treble.js +2 -2
  3. package/dist/Treble/index.d.ts +1 -1
  4. package/dist/Treble/index.js +1 -1
  5. package/dist/hooks/useNestedConfigurator/index.js +2 -1
  6. package/dist/hooks/useRoomBuilder/RoomBuilderState.d.ts +95 -0
  7. package/dist/hooks/useRoomBuilder/RoomBuilderState.js +1237 -0
  8. package/dist/hooks/useRoomBuilder/constants.d.ts +41 -0
  9. package/dist/hooks/useRoomBuilder/constants.js +48 -0
  10. package/dist/hooks/useRoomBuilder/dataHandlers.d.ts +18 -0
  11. package/dist/hooks/useRoomBuilder/dataHandlers.js +187 -0
  12. package/dist/hooks/useRoomBuilder/draw.d.ts +55 -0
  13. package/dist/hooks/useRoomBuilder/draw.js +573 -0
  14. package/dist/hooks/useRoomBuilder/findLoops.d.ts +5 -0
  15. package/dist/hooks/{useSpaces/geometry → useRoomBuilder}/findLoops.js +13 -31
  16. package/dist/hooks/useRoomBuilder/geometry.d.ts +33 -0
  17. package/dist/hooks/useRoomBuilder/geometry.js +325 -0
  18. package/dist/hooks/useRoomBuilder/index.d.ts +40 -0
  19. package/dist/hooks/useRoomBuilder/index.js +303 -0
  20. package/dist/hooks/{useSpaces/validators → useRoomBuilder}/messaging.js +1 -1
  21. package/dist/hooks/{useSpaces/themes/index.d.ts → useRoomBuilder/themes.d.ts} +4 -3
  22. package/dist/hooks/useRoomBuilder/themes.js +273 -0
  23. package/dist/hooks/useRoomBuilder/types.d.ts +238 -0
  24. package/dist/hooks/{useSpaces → useRoomBuilder}/types.js +1 -19
  25. package/dist/hooks/useRoomBuilder/validators.d.ts +36 -0
  26. package/dist/hooks/useRoomBuilder/validators.js +362 -0
  27. package/dist/icons/Draw.js +3 -3
  28. package/dist/icons/Window.js +4 -4
  29. package/dist/icons/index.js +0 -28
  30. package/dist/icons/types.d.ts +1 -1
  31. package/dist/index.d.ts +2 -17
  32. package/dist/index.js +5 -35
  33. package/dist/store/attributes.d.ts +0 -1
  34. package/dist/store/index.d.ts +0 -10
  35. package/dist/store/index.js +1 -3
  36. package/dist/store/product.js +7 -4
  37. package/dist/store/treble.d.ts +1 -1
  38. package/dist/store/treble.js +21 -14
  39. package/dist/types.d.ts +1 -3
  40. package/package.json +1 -1
  41. package/dist/hooks/useSpaces/SpacesLayout.d.ts +0 -11
  42. package/dist/hooks/useSpaces/SpacesLayout.js +0 -74
  43. package/dist/hooks/useSpaces/SpacesState.d.ts +0 -177
  44. package/dist/hooks/useSpaces/SpacesState.js +0 -1816
  45. package/dist/hooks/useSpaces/constants.d.ts +0 -79
  46. package/dist/hooks/useSpaces/constants.js +0 -130
  47. package/dist/hooks/useSpaces/dataHandlers.d.ts +0 -38
  48. package/dist/hooks/useSpaces/dataHandlers.js +0 -411
  49. package/dist/hooks/useSpaces/draw/clearCanvas.d.ts +0 -2
  50. package/dist/hooks/useSpaces/draw/clearCanvas.js +0 -9
  51. package/dist/hooks/useSpaces/draw/drawBackground.d.ts +0 -2
  52. package/dist/hooks/useSpaces/draw/drawBackground.js +0 -12
  53. package/dist/hooks/useSpaces/draw/drawDimensions.d.ts +0 -3
  54. package/dist/hooks/useSpaces/draw/drawDimensions.js +0 -53
  55. package/dist/hooks/useSpaces/draw/drawDoors.d.ts +0 -9
  56. package/dist/hooks/useSpaces/draw/drawDoors.js +0 -99
  57. package/dist/hooks/useSpaces/draw/drawFloor.d.ts +0 -3
  58. package/dist/hooks/useSpaces/draw/drawFloor.js +0 -36
  59. package/dist/hooks/useSpaces/draw/drawGrid.d.ts +0 -3
  60. package/dist/hooks/useSpaces/draw/drawGrid.js +0 -36
  61. package/dist/hooks/useSpaces/draw/drawGuides.d.ts +0 -3
  62. package/dist/hooks/useSpaces/draw/drawGuides.js +0 -23
  63. package/dist/hooks/useSpaces/draw/drawOpenings.d.ts +0 -9
  64. package/dist/hooks/useSpaces/draw/drawOpenings.js +0 -72
  65. package/dist/hooks/useSpaces/draw/drawVertices.d.ts +0 -8
  66. package/dist/hooks/useSpaces/draw/drawVertices.js +0 -61
  67. package/dist/hooks/useSpaces/draw/drawWalls.d.ts +0 -11
  68. package/dist/hooks/useSpaces/draw/drawWalls.js +0 -90
  69. package/dist/hooks/useSpaces/draw/drawWindows.d.ts +0 -9
  70. package/dist/hooks/useSpaces/draw/drawWindows.js +0 -82
  71. package/dist/hooks/useSpaces/draw/index.d.ts +0 -11
  72. package/dist/hooks/useSpaces/draw/index.js +0 -129
  73. package/dist/hooks/useSpaces/geometry/addThicknessToLine.d.ts +0 -3
  74. package/dist/hooks/useSpaces/geometry/addThicknessToLine.js +0 -13
  75. package/dist/hooks/useSpaces/geometry/areLinesEqual.d.ts +0 -3
  76. package/dist/hooks/useSpaces/geometry/areLinesEqual.js +0 -17
  77. package/dist/hooks/useSpaces/geometry/arePointsEqual.d.ts +0 -3
  78. package/dist/hooks/useSpaces/geometry/arePointsEqual.js +0 -8
  79. package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.d.ts +0 -3
  80. package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.js +0 -11
  81. package/dist/hooks/useSpaces/geometry/closestPointOnLine.d.ts +0 -3
  82. package/dist/hooks/useSpaces/geometry/closestPointOnLine.js +0 -13
  83. package/dist/hooks/useSpaces/geometry/doLinesOverlap.d.ts +0 -2
  84. package/dist/hooks/useSpaces/geometry/doLinesOverlap.js +0 -16
  85. package/dist/hooks/useSpaces/geometry/euclideanMod.d.ts +0 -2
  86. package/dist/hooks/useSpaces/geometry/euclideanMod.js +0 -6
  87. package/dist/hooks/useSpaces/geometry/findLoops.d.ts +0 -6
  88. package/dist/hooks/useSpaces/geometry/getAllLineIntersections.d.ts +0 -6
  89. package/dist/hooks/useSpaces/geometry/getAllLineIntersections.js +0 -23
  90. package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.d.ts +0 -3
  91. package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.js +0 -7
  92. package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.d.ts +0 -3
  93. package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.js +0 -17
  94. package/dist/hooks/useSpaces/geometry/getDistanceToLine.d.ts +0 -3
  95. package/dist/hooks/useSpaces/geometry/getDistanceToLine.js +0 -10
  96. package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.d.ts +0 -3
  97. package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.js +0 -7
  98. package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.d.ts +0 -3
  99. package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.js +0 -17
  100. package/dist/hooks/useSpaces/geometry/getLineOtherPoint.d.ts +0 -3
  101. package/dist/hooks/useSpaces/geometry/getLineOtherPoint.js +0 -11
  102. package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.d.ts +0 -3
  103. package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.js +0 -43
  104. package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.d.ts +0 -3
  105. package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.js +0 -9
  106. package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.d.ts +0 -3
  107. package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.js +0 -20
  108. package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.d.ts +0 -3
  109. package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.js +0 -11
  110. package/dist/hooks/useSpaces/geometry/getPolygonArea.d.ts +0 -3
  111. package/dist/hooks/useSpaces/geometry/getPolygonArea.js +0 -15
  112. package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.d.ts +0 -3
  113. package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.js +0 -16
  114. package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.d.ts +0 -6
  115. package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.js +0 -17
  116. package/dist/hooks/useSpaces/geometry/getTriangleArea.d.ts +0 -3
  117. package/dist/hooks/useSpaces/geometry/getTriangleArea.js +0 -9
  118. package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.d.ts +0 -3
  119. package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.js +0 -12
  120. package/dist/hooks/useSpaces/geometry/index.d.ts +0 -30
  121. package/dist/hooks/useSpaces/geometry/index.js +0 -64
  122. package/dist/hooks/useSpaces/geometry/isPointInPolygon.d.ts +0 -3
  123. package/dist/hooks/useSpaces/geometry/isPointInPolygon.js +0 -21
  124. package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.d.ts +0 -3
  125. package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.js +0 -25
  126. package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.d.ts +0 -3
  127. package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.js +0 -11
  128. package/dist/hooks/useSpaces/geometry/splitLineAtOffset.d.ts +0 -3
  129. package/dist/hooks/useSpaces/geometry/splitLineAtOffset.js +0 -12
  130. package/dist/hooks/useSpaces/geometry/splitLineAtPoint.d.ts +0 -3
  131. package/dist/hooks/useSpaces/geometry/splitLineAtPoint.js +0 -9
  132. package/dist/hooks/useSpaces/geometry/splitLineAtPoints.d.ts +0 -3
  133. package/dist/hooks/useSpaces/geometry/splitLineAtPoints.js +0 -28
  134. package/dist/hooks/useSpaces/index.d.ts +0 -95
  135. package/dist/hooks/useSpaces/index.js +0 -625
  136. package/dist/hooks/useSpaces/themes/blueprint.d.ts +0 -3
  137. package/dist/hooks/useSpaces/themes/blueprint.js +0 -96
  138. package/dist/hooks/useSpaces/themes/default.d.ts +0 -3
  139. package/dist/hooks/useSpaces/themes/default.js +0 -96
  140. package/dist/hooks/useSpaces/themes/index.js +0 -21
  141. package/dist/hooks/useSpaces/themes/light.d.ts +0 -3
  142. package/dist/hooks/useSpaces/themes/light.js +0 -96
  143. package/dist/hooks/useSpaces/types.d.ts +0 -378
  144. package/dist/hooks/useSpaces/validators/areWallsDuplicated.d.ts +0 -3
  145. package/dist/hooks/useSpaces/validators/areWallsDuplicated.js +0 -61
  146. package/dist/hooks/useSpaces/validators/areWallsIntersecting.d.ts +0 -3
  147. package/dist/hooks/useSpaces/validators/areWallsIntersecting.js +0 -42
  148. package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.d.ts +0 -3
  149. package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.js +0 -52
  150. package/dist/hooks/useSpaces/validators/areWallsTooShort.d.ts +0 -3
  151. package/dist/hooks/useSpaces/validators/areWallsTooShort.js +0 -37
  152. package/dist/hooks/useSpaces/validators/index.d.ts +0 -15
  153. package/dist/hooks/useSpaces/validators/index.js +0 -40
  154. package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.d.ts +0 -3
  155. package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.js +0 -31
  156. package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.d.ts +0 -3
  157. package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.js +0 -19
  158. package/dist/hooks/useSpaces/validators/isLineTooShort.d.ts +0 -3
  159. package/dist/hooks/useSpaces/validators/isLineTooShort.js +0 -26
  160. package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.d.ts +0 -4
  161. package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.js +0 -19
  162. package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.d.ts +0 -3
  163. package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.js +0 -19
  164. package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.d.ts +0 -3
  165. package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.js +0 -41
  166. package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.d.ts +0 -3
  167. package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.js +0 -54
  168. package/dist/hooks/useSpaces/validators/isWallTooShort.d.ts +0 -3
  169. package/dist/hooks/useSpaces/validators/isWallTooShort.js +0 -10
  170. package/dist/icons/AngleSnapping.d.ts +0 -3
  171. package/dist/icons/AngleSnapping.js +0 -28
  172. package/dist/icons/Boundary.d.ts +0 -3
  173. package/dist/icons/Boundary.js +0 -21
  174. package/dist/icons/Center.d.ts +0 -3
  175. package/dist/icons/Center.js +0 -24
  176. package/dist/icons/GridSnapping.d.ts +0 -3
  177. package/dist/icons/GridSnapping.js +0 -28
  178. package/dist/icons/LayoutAlt.d.ts +0 -3
  179. package/dist/icons/LayoutAlt.js +0 -21
  180. package/dist/icons/Magnet.d.ts +0 -3
  181. package/dist/icons/Magnet.js +0 -27
  182. package/dist/icons/Player3D.d.ts +0 -3
  183. package/dist/icons/Player3D.js +0 -21
  184. package/dist/icons/RulerBlank.d.ts +0 -3
  185. package/dist/icons/RulerBlank.js +0 -25
  186. package/dist/icons/RulerDetailed.d.ts +0 -3
  187. package/dist/icons/RulerDetailed.js +0 -27
  188. package/dist/icons/Save.d.ts +0 -3
  189. package/dist/icons/Save.js +0 -21
  190. package/dist/icons/UnitCm.d.ts +0 -3
  191. package/dist/icons/UnitCm.js +0 -22
  192. package/dist/icons/UnitFeet.d.ts +0 -3
  193. package/dist/icons/UnitFeet.js +0 -22
  194. package/dist/icons/UnitInch.d.ts +0 -3
  195. package/dist/icons/UnitInch.js +0 -22
  196. package/dist/icons/UnitMeter.d.ts +0 -3
  197. package/dist/icons/UnitMeter.js +0 -21
  198. package/dist/store/spaces.d.ts +0 -74
  199. package/dist/store/spaces.js +0 -354
  200. /package/dist/Treble/{snapshot.d.ts → snapshots.d.ts} +0 -0
  201. /package/dist/Treble/{snapshot.js → snapshots.js} +0 -0
  202. /package/dist/hooks/{useSpaces/validators → useRoomBuilder}/messaging.d.ts +0 -0
@@ -1,79 +0,0 @@
1
- import { ICoordinate2D, ISpacesAttributes, IWallsValidationConfig } from './types';
2
- export declare enum SpacesMetadata {
3
- VALUE = "_tkSpace_value"
4
- }
5
- export declare enum WallAttributes {
6
- START_X = "_tkSpace_startX",
7
- START_Y = "_tkSpace_startY",
8
- START_Z = "_tkSpace_startZ",
9
- END_X = "_tkSpace_endX",
10
- END_Y = "_tkSpace_endY",
11
- END_Z = "_tkSpace_endZ",
12
- CONNECTIONS = "_tkSpace_connections",
13
- WALL_HEIGHT = "_tkSpace_wallHeight",
14
- WALL_THICKNESS = "_tkSpace_wallThickness",
15
- WALL_MODE = "_tkSpace_visibility"
16
- }
17
- export declare enum WallModes {
18
- WALL = "true",
19
- BOUNDARY = "false"
20
- }
21
- export declare const wallModeLabels: {
22
- true: string;
23
- false: string;
24
- };
25
- export declare enum WallMetadata {
26
- MIN_LENGTH = "_tkSpace_minLength",
27
- PADDING = "_tkSpace_padding"
28
- }
29
- export declare enum DoorAttributes {
30
- ORIENTATION = "_tkSpace_doorOrientation",
31
- OPENING_DIRECTION = "_tkSpace_doorOpeningDirection",
32
- SHOW_SWING = "_tkSpace_doorShowSwing"
33
- }
34
- export declare enum DoorOrientations {
35
- LEFT = "left",
36
- RIGHT = "right"
37
- }
38
- export declare enum DoorOpeningDirections {
39
- INSIDE = "inside",
40
- OUTSIDE = "outside"
41
- }
42
- export declare enum DoorShowSwing {
43
- SHOW = "true",
44
- HIDE = "false"
45
- }
46
- export declare const ATTRIBUTE_NAME_DEFAULTS: ISpacesAttributes;
47
- export declare const SCALE = 0.02;
48
- export declare const SNAP_PROXIMITY = 16;
49
- export declare const ZOOM_MAX = 100;
50
- export declare const ZOOM_MIN = 20;
51
- export declare const ZOOM_DEFAULT = 40;
52
- export declare const ZOOM_SENSITIVITY = 0.8;
53
- export declare const TRANSLATE_MAX: ICoordinate2D;
54
- export declare const TRANSLATE_MIN: ICoordinate2D;
55
- export declare const TRANSLATE_DEFAULT: ICoordinate2D;
56
- export declare const GRID_SNAPPING_ENABLED = true;
57
- export declare const ANGLE_SNAPPING_ENABLED = false;
58
- export declare const GUIDE_SNAPPING_ENABLED = true;
59
- export declare const UNIT_LABELS: {
60
- feet: string;
61
- meter: string;
62
- inch: string;
63
- cm: string;
64
- };
65
- export declare const UNIT_FACTORS: {
66
- cm: number;
67
- meter: number;
68
- feet: number;
69
- inch: number;
70
- };
71
- export declare const FEATURE_LABELS: {
72
- windows: string;
73
- doors: string;
74
- openings: string;
75
- };
76
- export declare const VALIDATION_CONFIG_DEFAULT: IWallsValidationConfig;
77
- export declare const FEATURE_LENGTH = 1;
78
- export declare const UI_ANCHOR_DISTANCE = -60;
79
- export declare const WALL_SNAP_DISTANCE = 12;
@@ -1,130 +0,0 @@
1
- "use strict";
2
- var _a, _b, _c, _d, _e;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.WALL_SNAP_DISTANCE = exports.UI_ANCHOR_DISTANCE = exports.FEATURE_LENGTH = exports.VALIDATION_CONFIG_DEFAULT = exports.FEATURE_LABELS = exports.UNIT_FACTORS = exports.UNIT_LABELS = exports.GUIDE_SNAPPING_ENABLED = exports.ANGLE_SNAPPING_ENABLED = exports.GRID_SNAPPING_ENABLED = exports.TRANSLATE_DEFAULT = exports.TRANSLATE_MIN = exports.TRANSLATE_MAX = exports.ZOOM_SENSITIVITY = exports.ZOOM_DEFAULT = exports.ZOOM_MIN = exports.ZOOM_MAX = exports.SNAP_PROXIMITY = exports.SCALE = exports.ATTRIBUTE_NAME_DEFAULTS = exports.DoorShowSwing = exports.DoorOpeningDirections = exports.DoorOrientations = exports.DoorAttributes = exports.WallMetadata = exports.wallModeLabels = exports.WallModes = exports.WallAttributes = exports.SpacesMetadata = void 0;
5
- var types_1 = require("./types");
6
- var SpacesAttributes;
7
- (function (SpacesAttributes) {
8
- SpacesAttributes["WALLS"] = "_tkSpace_walls";
9
- SpacesAttributes["WINDOWS"] = "_tkSpace_windows";
10
- SpacesAttributes["DOORS"] = "_tkSpace_doors";
11
- SpacesAttributes["OPENINGS"] = "_tkSpace_openings";
12
- })(SpacesAttributes || (SpacesAttributes = {}));
13
- var SpacesMetadata;
14
- (function (SpacesMetadata) {
15
- SpacesMetadata["VALUE"] = "_tkSpace_value";
16
- })(SpacesMetadata = exports.SpacesMetadata || (exports.SpacesMetadata = {}));
17
- var WallAttributes;
18
- (function (WallAttributes) {
19
- WallAttributes["START_X"] = "_tkSpace_startX";
20
- WallAttributes["START_Y"] = "_tkSpace_startY";
21
- WallAttributes["START_Z"] = "_tkSpace_startZ";
22
- WallAttributes["END_X"] = "_tkSpace_endX";
23
- WallAttributes["END_Y"] = "_tkSpace_endY";
24
- WallAttributes["END_Z"] = "_tkSpace_endZ";
25
- WallAttributes["CONNECTIONS"] = "_tkSpace_connections";
26
- WallAttributes["WALL_HEIGHT"] = "_tkSpace_wallHeight";
27
- WallAttributes["WALL_THICKNESS"] = "_tkSpace_wallThickness";
28
- WallAttributes["WALL_MODE"] = "_tkSpace_visibility";
29
- })(WallAttributes = exports.WallAttributes || (exports.WallAttributes = {}));
30
- var WallModes;
31
- (function (WallModes) {
32
- WallModes["WALL"] = "true";
33
- WallModes["BOUNDARY"] = "false";
34
- })(WallModes = exports.WallModes || (exports.WallModes = {}));
35
- exports.wallModeLabels = (_a = {},
36
- _a[WallModes.WALL] = 'Wall',
37
- _a[WallModes.BOUNDARY] = 'Boundary',
38
- _a);
39
- var WallMetadata;
40
- (function (WallMetadata) {
41
- WallMetadata["MIN_LENGTH"] = "_tkSpace_minLength";
42
- WallMetadata["PADDING"] = "_tkSpace_padding";
43
- })(WallMetadata = exports.WallMetadata || (exports.WallMetadata = {}));
44
- var FeatureAttributes;
45
- (function (FeatureAttributes) {
46
- FeatureAttributes["POSITION_X"] = "_tkSpace_offsetX";
47
- FeatureAttributes["POSITION_Y"] = "_tkSpace_offsetY";
48
- FeatureAttributes["CONNECTED_TO"] = "_tkSpace_connectedTo";
49
- FeatureAttributes["FEATURE_HEIGHT"] = "_tkSpace_featureHeight";
50
- FeatureAttributes["FEATURE_LENGTH"] = "_tkSpace_featureWidth";
51
- })(FeatureAttributes || (FeatureAttributes = {}));
52
- var DoorAttributes;
53
- (function (DoorAttributes) {
54
- DoorAttributes["ORIENTATION"] = "_tkSpace_doorOrientation";
55
- DoorAttributes["OPENING_DIRECTION"] = "_tkSpace_doorOpeningDirection";
56
- DoorAttributes["SHOW_SWING"] = "_tkSpace_doorShowSwing";
57
- })(DoorAttributes = exports.DoorAttributes || (exports.DoorAttributes = {}));
58
- var DoorOrientations;
59
- (function (DoorOrientations) {
60
- DoorOrientations["LEFT"] = "left";
61
- DoorOrientations["RIGHT"] = "right";
62
- })(DoorOrientations = exports.DoorOrientations || (exports.DoorOrientations = {}));
63
- var DoorOpeningDirections;
64
- (function (DoorOpeningDirections) {
65
- DoorOpeningDirections["INSIDE"] = "inside";
66
- DoorOpeningDirections["OUTSIDE"] = "outside";
67
- })(DoorOpeningDirections = exports.DoorOpeningDirections || (exports.DoorOpeningDirections = {}));
68
- var DoorShowSwing;
69
- (function (DoorShowSwing) {
70
- DoorShowSwing["SHOW"] = "true";
71
- DoorShowSwing["HIDE"] = "false";
72
- })(DoorShowSwing = exports.DoorShowSwing || (exports.DoorShowSwing = {}));
73
- exports.ATTRIBUTE_NAME_DEFAULTS = (_b = {},
74
- _b[types_1.IElements.WALL] = SpacesAttributes.WALLS,
75
- _b[types_1.IElements.WINDOW] = SpacesAttributes.WINDOWS,
76
- _b[types_1.IElements.OPENING] = SpacesAttributes.OPENINGS,
77
- _b[types_1.IElements.DOOR] = SpacesAttributes.DOORS,
78
- _b.featurePositionX = FeatureAttributes.POSITION_X,
79
- _b.featurePositionY = FeatureAttributes.POSITION_Y,
80
- _b.featureConnectedTo = FeatureAttributes.CONNECTED_TO,
81
- _b.featureHeight = FeatureAttributes.FEATURE_HEIGHT,
82
- _b.featureLength = FeatureAttributes.FEATURE_LENGTH,
83
- _b.wallStartX = WallAttributes.START_X,
84
- _b.wallStartY = WallAttributes.START_Y,
85
- _b.wallStartZ = WallAttributes.START_Z,
86
- _b.wallEndX = WallAttributes.END_X,
87
- _b.wallEndY = WallAttributes.END_Y,
88
- _b.wallEndZ = WallAttributes.END_Z,
89
- _b.wallConnections = WallAttributes.CONNECTIONS,
90
- _b.wallMode = WallAttributes.WALL_MODE,
91
- _b.doorOrientation = DoorAttributes.ORIENTATION,
92
- _b.doorOpeningDirection = DoorAttributes.OPENING_DIRECTION,
93
- _b.doorShowSwing = DoorAttributes.SHOW_SWING,
94
- _b);
95
- exports.SCALE = 0.02;
96
- exports.SNAP_PROXIMITY = 16;
97
- exports.ZOOM_MAX = 100;
98
- exports.ZOOM_MIN = 20;
99
- exports.ZOOM_DEFAULT = 40;
100
- exports.ZOOM_SENSITIVITY = 0.8;
101
- exports.TRANSLATE_MAX = [-400, -400];
102
- exports.TRANSLATE_MIN = [400, 400];
103
- exports.TRANSLATE_DEFAULT = [-200, -200];
104
- exports.GRID_SNAPPING_ENABLED = true;
105
- exports.ANGLE_SNAPPING_ENABLED = false;
106
- exports.GUIDE_SNAPPING_ENABLED = true;
107
- exports.UNIT_LABELS = (_c = {},
108
- _c[types_1.IUnits.FEET] = 'ft',
109
- _c[types_1.IUnits.METER] = 'm',
110
- _c[types_1.IUnits.INCH] = 'in',
111
- _c[types_1.IUnits.CM] = 'cm',
112
- _c);
113
- exports.UNIT_FACTORS = (_d = {},
114
- _d[types_1.IUnits.CM] = 100,
115
- _d[types_1.IUnits.METER] = 1,
116
- _d[types_1.IUnits.FEET] = 3.28084,
117
- _d[types_1.IUnits.INCH] = 39.37,
118
- _d);
119
- exports.FEATURE_LABELS = (_e = {},
120
- _e[types_1.IElements.WINDOW] = 'Window',
121
- _e[types_1.IElements.DOOR] = 'Door',
122
- _e[types_1.IElements.OPENING] = 'Opening',
123
- _e);
124
- exports.VALIDATION_CONFIG_DEFAULT = {
125
- padding: 0.2,
126
- minLength: 0.5,
127
- };
128
- exports.FEATURE_LENGTH = 1;
129
- exports.UI_ANCHOR_DISTANCE = -60;
130
- exports.WALL_SNAP_DISTANCE = 12;
@@ -1,38 +0,0 @@
1
- import type { IWalls, ISpacesStateProps, IVerticesState, IFeatures, ISpacesAttributes, IWallsValidationConfig, IAttributeDefaults } from './types';
2
- import { IUnits } from './types';
3
- import { WallModes } from './constants';
4
- import type { IConfiguration, IHydratedAttribute, IThreekitConfigurator } from '../../types';
5
- export declare function prepAttributesIncoming(attributes: Record<string, IHydratedAttribute>, config: ISpacesStateProps, attributeDefaults: IAttributeDefaults & {
6
- wallMode: WallModes;
7
- }): {
8
- validationConfig: IWallsValidationConfig;
9
- features: {};
10
- walls: IWalls;
11
- vertex: IVerticesState;
12
- };
13
- export declare function prepAttributesOutgoing(walls: IWalls, features: IFeatures, config: ISpacesStateProps): {
14
- [x: string]: import("../../types").IConfigurationAttribute | {
15
- assetId: string;
16
- configuration: IConfiguration;
17
- }[];
18
- };
19
- export declare function convertLengthUnit(value: number, from: IUnits, to: IUnits): number;
20
- export declare function convertAreaUnit(value: number, from: IUnits, to: IUnits): number;
21
- export declare function prepLengthForUser(value: number, unit: IUnits): string;
22
- export declare function prepAreaForUser(value: number, unit: IUnits): string;
23
- export declare function getAttributeData(configurator: IThreekitConfigurator, attributeNames: ISpacesAttributes): Promise<{
24
- defaults: {
25
- walls: string;
26
- doors: string;
27
- windows: string;
28
- openings: string;
29
- doorShowSwing: string;
30
- doorOrientation: string;
31
- doorOpeningDirection: string;
32
- };
33
- wallModes: {
34
- options: WallModes[];
35
- assetIds: Record<WallModes, string>;
36
- value: WallModes;
37
- };
38
- }>;
@@ -1,411 +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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (_) try {
29
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.getAttributeData = exports.prepAreaForUser = exports.prepLengthForUser = exports.convertAreaUnit = exports.convertLengthUnit = exports.prepAttributesOutgoing = exports.prepAttributesIncoming = void 0;
51
- var types_1 = require("./types");
52
- var constants_1 = require("./constants");
53
- var geometry_1 = require("./geometry");
54
- function filterRestConfiguration(configuration, attributeNames) {
55
- var attributes = __assign({}, attributeNames);
56
- delete attributes.wallMode;
57
- delete attributes.doorShowSwing;
58
- delete attributes.doorOrientation;
59
- delete attributes.doorOpeningDirection;
60
- var keysToFilter = new Set(Object.values(attributes));
61
- var filteredConfiguration = Object.entries(configuration).reduce(function (output, _a) {
62
- var _b;
63
- var key = _a[0], value = _a[1];
64
- if (keysToFilter.has(key))
65
- return output;
66
- return Object.assign(output, (_b = {}, _b[key] = value, _b));
67
- }, {});
68
- return filteredConfiguration;
69
- }
70
- function prepConnectionOutgoing(connection) {
71
- return "".concat(connection[0], ".").concat(connection[1]);
72
- }
73
- function prepConnectionIncoming(connection) {
74
- var _a = connection.split('.'), attributeName = _a[0], indexStr = _a[1];
75
- return [attributeName, parseInt(indexStr)];
76
- }
77
- function prepWallsAndVerticesIncoming(wallsAttribute, config, attributeDefaults) {
78
- var _a;
79
- var walls = [];
80
- var vertices = {};
81
- var attributeName = config.attributes;
82
- ((wallsAttribute === null || wallsAttribute === void 0 ? void 0 : wallsAttribute.value) || []).forEach(function (_a, i) {
83
- var _b, _c;
84
- var assetId = _a.assetId, configuration = _a.configuration;
85
- var point1 = [
86
- (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.wallStartX]) / config.config.scale,
87
- (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.wallStartZ]) / config.config.scale,
88
- ];
89
- var point2 = [
90
- (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.wallEndX]) / config.config.scale,
91
- (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.wallEndZ]) / config.config.scale,
92
- ];
93
- var point1Str = JSON.stringify(point1);
94
- var point2Str = JSON.stringify(point2);
95
- if (vertices[point1Str])
96
- vertices[point1Str].push([i, 0]);
97
- else
98
- vertices[point1Str] = [[i, 0]];
99
- if (vertices[point2Str])
100
- vertices[point2Str].push([i, 1]);
101
- else
102
- vertices[point2Str] = [[i, 1]];
103
- var connections = [];
104
- var modeValue = (_c = (_b = configuration === null || configuration === void 0 ? void 0 : configuration[constants_1.WallAttributes.WALL_MODE]) === null || _b === void 0 ? void 0 : _b.metadata) === null || _c === void 0 ? void 0 : _c[constants_1.SpacesMetadata.VALUE];
105
- var mode = modeValue !== null && modeValue !== void 0 ? modeValue : attributeDefaults.wallMode;
106
- walls.push({
107
- assetId: assetId,
108
- mode: mode,
109
- line: [point1, point2],
110
- path: (0, geometry_1.addThicknessToLine)([point1, point2], config.config.styles.wall.thickness),
111
- connections: connections,
112
- restConfiguration: JSON.stringify(filterRestConfiguration(configuration, config.attributes)),
113
- });
114
- });
115
- return _a = {}, _a[types_1.IElements.WALL] = walls, _a[types_1.IElements.VERTEX] = vertices, _a;
116
- }
117
- function getWallsVaidationConfig(wallsAttribute, config) {
118
- var _a, _b;
119
- var metadata = (wallsAttribute === null || wallsAttribute === void 0 ? void 0 : wallsAttribute.values[0].metadata) || {};
120
- var validation = {
121
- minLength: ((_a = metadata[constants_1.WallMetadata.MIN_LENGTH]) !== null && _a !== void 0 ? _a : constants_1.VALIDATION_CONFIG_DEFAULT.minLength) / config.config.scale,
122
- padding: ((_b = metadata[constants_1.WallMetadata.PADDING]) !== null && _b !== void 0 ? _b : constants_1.VALIDATION_CONFIG_DEFAULT.padding) / config.config.scale,
123
- };
124
- return validation;
125
- }
126
- function prepFeatureIncoming(type, walls, featureAttribute, config, attributeDefaults) {
127
- var _a;
128
- var attributeName = config.attributes;
129
- var feature = [];
130
- (_a = featureAttribute === null || featureAttribute === void 0 ? void 0 : featureAttribute.value) === null || _a === void 0 ? void 0 : _a.forEach(function (_a) {
131
- var _b, _c, _d, _e, _f, _g, _h, _j, _k;
132
- var assetId = _a.assetId, configuration = _a.configuration;
133
- var offset = (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.featurePositionX]) / config.config.scale;
134
- var length = (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.featureLength]) / config.config.scale;
135
- var height = (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.featureHeight]) / config.config.scale;
136
- var altitude = (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.featurePositionY]) / config.config.scale;
137
- var connectedTo = (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.featureConnectedTo]) || '';
138
- var wallIndex = prepConnectionIncoming(connectedTo)[1];
139
- var featureLine = (0, geometry_1.getLineAtOffsetOnLineSegment)(walls[wallIndex].line, offset, length);
140
- var element = {
141
- assetId: assetId,
142
- offset: offset,
143
- length: length,
144
- height: height,
145
- altitude: altitude,
146
- connectedTo: [types_1.IElements.WALL, wallIndex],
147
- path: (0, geometry_1.addThicknessToLine)(featureLine, config.config.styles.feature.thickness),
148
- restConfiguration: JSON.stringify(filterRestConfiguration(configuration, config.attributes)),
149
- };
150
- if (type === types_1.IElements.DOOR) {
151
- var doorShowSwing = (_d = (_c = (_b = configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.doorShowSwing]) === null || _b === void 0 ? void 0 : _b.metadata) === null || _c === void 0 ? void 0 : _c[constants_1.SpacesMetadata.VALUE]) !== null && _d !== void 0 ? _d : attributeDefaults.doorShowSwing;
152
- var doorOrientation = (_g = (_f = (_e = configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.doorOrientation]) === null || _e === void 0 ? void 0 : _e.metadata) === null || _f === void 0 ? void 0 : _f[constants_1.SpacesMetadata.VALUE]) !== null && _g !== void 0 ? _g : attributeDefaults.doorOrientation;
153
- var doorOpeningDirection = (_k = (_j = (_h = configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.doorOpeningDirection]) === null || _h === void 0 ? void 0 : _h.metadata) === null || _j === void 0 ? void 0 : _j[constants_1.SpacesMetadata.VALUE]) !== null && _k !== void 0 ? _k : attributeDefaults.doorOpeningDirection;
154
- Object.assign(element, {
155
- showSwing: doorShowSwing,
156
- orientation: doorOrientation,
157
- openingDirection: doorOpeningDirection,
158
- });
159
- }
160
- feature.push(element);
161
- });
162
- return feature;
163
- }
164
- function prepAttributesIncoming(attributes, config, attributeDefaults) {
165
- var _a;
166
- var wallsAttribute = attributes[config.attributes[types_1.IElements.WALL]];
167
- var wallsAndVertices = prepWallsAndVerticesIncoming(wallsAttribute, config, attributeDefaults);
168
- var wallsValidation = getWallsVaidationConfig(wallsAttribute, config);
169
- var featuresList = [
170
- types_1.IElements.WINDOW,
171
- types_1.IElements.DOOR,
172
- types_1.IElements.OPENING,
173
- ];
174
- var featuresData = featuresList.reduce(function (output, type) {
175
- output[type] = prepFeatureIncoming(type, wallsAndVertices[types_1.IElements.WALL], attributes[config.attributes[type]], config, attributeDefaults);
176
- return output;
177
- }, {});
178
- return __assign(__assign({}, wallsAndVertices), (_a = { validationConfig: wallsValidation }, _a[types_1.IElements.FEATURE] = featuresData, _a));
179
- }
180
- exports.prepAttributesIncoming = prepAttributesIncoming;
181
- function prepFeaturesOutgoing(features, config) {
182
- var attributeName = config.attributes;
183
- return features.map(function (feature) {
184
- var _a, _b;
185
- var assetId = feature.assetId, offset = feature.offset, length = feature.length, height = feature.height, altitude = feature.altitude, restConfiguration = feature.restConfiguration;
186
- var connectedTo = prepConnectionOutgoing([
187
- config.attributes[feature.connectedTo[0]],
188
- feature.connectedTo[1],
189
- ]);
190
- var configurationToScale = (_a = {},
191
- _a[attributeName.featureLength] = length,
192
- _a[attributeName.featurePositionX] = offset,
193
- _a);
194
- if (altitude)
195
- configurationToScale[attributeName.featurePositionY] = altitude;
196
- if (height)
197
- configurationToScale[attributeName.featureHeight] = height;
198
- var configuration = Object.entries(configurationToScale).reduce(function (output, _a) {
199
- var _b;
200
- var key = _a[0], value = _a[1];
201
- return Object.assign(output, (_b = {},
202
- _b[key] = value ? value * config.config.scale : value,
203
- _b));
204
- }, __assign((_b = {}, _b[attributeName.featureConnectedTo] = connectedTo, _b), JSON.parse(restConfiguration)));
205
- return {
206
- assetId: assetId,
207
- configuration: configuration,
208
- };
209
- });
210
- }
211
- function prepWallsOutgoing(walls, config) {
212
- var attributeName = config.attributes;
213
- return walls.map(function (wall) {
214
- var _a, _b;
215
- var line = wall.line, restConfiguration = wall.restConfiguration;
216
- var connections = wall.connections.map(function (connection) {
217
- var attributeName = config.attributes[connection[0]];
218
- if (!attributeName)
219
- return;
220
- return prepConnectionOutgoing([attributeName, connection[1]]);
221
- });
222
- var _c = line.flat(), x1 = _c[0], y1 = _c[1], x2 = _c[2], y2 = _c[3];
223
- var configuration = Object.entries((_a = {},
224
- _a[attributeName.wallStartX] = x1,
225
- _a[attributeName.wallStartZ] = y1,
226
- _a[attributeName.wallEndX] = x2,
227
- _a[attributeName.wallEndZ] = y2,
228
- _a)).reduce(function (output, _a) {
229
- var _b;
230
- var key = _a[0], value = _a[1];
231
- return Object.assign(output, (_b = {},
232
- _b[key] = value ? value * config.config.scale : value,
233
- _b));
234
- }, __assign((_b = {}, _b[attributeName.wallConnections] = JSON.stringify(connections), _b), JSON.parse(restConfiguration)));
235
- return {
236
- assetId: wall.assetId,
237
- configuration: configuration,
238
- };
239
- });
240
- }
241
- function prepAttributesOutgoing(walls, features, config) {
242
- var _a;
243
- var wallsAttribute = prepWallsOutgoing(walls, config);
244
- var featuresAttributes = Object.entries(features).reduce(function (output, _a) {
245
- var type = _a[0], features = _a[1];
246
- var attributeName = config.attributes[type];
247
- if (!attributeName)
248
- return output;
249
- output[attributeName] = prepFeaturesOutgoing(features, config);
250
- return output;
251
- }, {});
252
- return __assign(__assign({}, featuresAttributes), (_a = {}, _a[config.attributes[types_1.IElements.WALL]] = wallsAttribute, _a));
253
- }
254
- exports.prepAttributesOutgoing = prepAttributesOutgoing;
255
- function convertLengthUnit(value, from, to) {
256
- return (value / constants_1.UNIT_FACTORS[from]) * constants_1.UNIT_FACTORS[to];
257
- }
258
- exports.convertLengthUnit = convertLengthUnit;
259
- function convertAreaUnit(value, from, to) {
260
- return (value / constants_1.UNIT_FACTORS[from]) * Math.pow(constants_1.UNIT_FACTORS[to], 2);
261
- }
262
- exports.convertAreaUnit = convertAreaUnit;
263
- function prepLengthForUser(value, unit) {
264
- if (unit === types_1.IUnits.FEET) {
265
- var feet = Math.floor(value);
266
- var inches = 12 * (value % 1);
267
- if (inches > 11.95) {
268
- feet += 1;
269
- inches = 0;
270
- }
271
- return "".concat(feet).concat(constants_1.UNIT_LABELS[types_1.IUnits.FEET], " ").concat(inches.toFixed(1)).concat(constants_1.UNIT_LABELS[types_1.IUnits.INCH]);
272
- }
273
- return "".concat(value.toFixed(2), " ").concat(constants_1.UNIT_LABELS[unit]);
274
- }
275
- exports.prepLengthForUser = prepLengthForUser;
276
- function prepAreaForUser(value, unit) {
277
- return "".concat(value.toFixed(2), " sq-").concat(constants_1.UNIT_LABELS[unit]);
278
- }
279
- exports.prepAreaForUser = prepAreaForUser;
280
- function getAttributeData(configurator, attributeNames) {
281
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
282
- return __awaiter(this, void 0, void 0, function () {
283
- var attributes, wallAssetId, doorAssetId, windowAssetId, openingAssetId, i, attr, wallConfigurator, doorConfigurator, wallModeAttr, doorOrientationAttr, doorOpeningDirectionAttr, doorShowSwingAttr, doorAttributes, i, attr, options, optionsMap, wallModeOptions, wallModes, defaults;
284
- var _p, _q, _r, _s, _t;
285
- return __generator(this, function (_u) {
286
- switch (_u.label) {
287
- case 0:
288
- attributes = configurator.getDisplayAttributes();
289
- wallAssetId = undefined;
290
- doorAssetId = undefined;
291
- windowAssetId = undefined;
292
- openingAssetId = undefined;
293
- for (i = 0; i < attributes.length &&
294
- (!wallAssetId || !doorAssetId || !windowAssetId || !openingAssetId); i++) {
295
- attr = attributes[i];
296
- switch (attr.name) {
297
- case attributeNames[types_1.IElements.WALL]:
298
- wallAssetId = attr.values[0].assetId;
299
- break;
300
- case attributeNames[types_1.IElements.DOOR]:
301
- doorAssetId = attr.values[0].assetId;
302
- break;
303
- case attributeNames[types_1.IElements.WINDOW]:
304
- windowAssetId = attr.values[0].assetId;
305
- break;
306
- case attributeNames[types_1.IElements.OPENING]:
307
- openingAssetId = attr.values[0].assetId;
308
- break;
309
- }
310
- }
311
- if (!wallAssetId || !doorAssetId || !windowAssetId || !openingAssetId)
312
- throw new Error('Missing assetId: ' +
313
- JSON.stringify({
314
- wallAssetId: wallAssetId,
315
- doorAssetId: doorAssetId,
316
- windowAssetId: windowAssetId,
317
- openingAssetId: openingAssetId,
318
- }));
319
- return [4, configurator.setConfiguration((_p = {},
320
- _p[attributeNames[types_1.IElements.WALL]] = { assetId: wallAssetId },
321
- _p[attributeNames[types_1.IElements.DOOR]] = { assetId: doorAssetId },
322
- _p))];
323
- case 1:
324
- _u.sent();
325
- wallConfigurator = configurator.getNestedConfigurator(attributeNames[types_1.IElements.WALL], 0);
326
- doorConfigurator = configurator.getNestedConfigurator(attributeNames[types_1.IElements.DOOR], 0);
327
- wallModeAttr = wallConfigurator === null || wallConfigurator === void 0 ? void 0 : wallConfigurator.getDisplayAttributes().find(function (attr) { return attr.name === attributeNames.wallMode; });
328
- doorOrientationAttr = undefined;
329
- doorOpeningDirectionAttr = undefined;
330
- doorShowSwingAttr = undefined;
331
- doorAttributes = (_a = doorConfigurator === null || doorConfigurator === void 0 ? void 0 : doorConfigurator.getDisplayAttributes()) !== null && _a !== void 0 ? _a : [];
332
- for (i = 0; i < doorAttributes.length &&
333
- (!doorOrientationAttr || !doorOpeningDirectionAttr || !doorShowSwingAttr); i++) {
334
- attr = doorAttributes[i];
335
- switch (doorAttributes[i].name) {
336
- case attributeNames.doorOrientation:
337
- doorOrientationAttr = attr;
338
- break;
339
- case attributeNames.doorOpeningDirection:
340
- doorOpeningDirectionAttr = attr;
341
- break;
342
- case attributeNames.doorShowSwing:
343
- doorShowSwingAttr = attr;
344
- break;
345
- }
346
- }
347
- options = {
348
- doorShowSwing: (_q = {},
349
- _q[constants_1.DoorShowSwing.SHOW] = (_b = doorShowSwingAttr === null || doorShowSwingAttr === void 0 ? void 0 : doorShowSwingAttr.values.find(function (val) { return val.metadata[constants_1.SpacesMetadata.VALUE] === constants_1.DoorShowSwing.SHOW; })) === null || _b === void 0 ? void 0 : _b.assetId,
350
- _q[constants_1.DoorShowSwing.HIDE] = (_c = doorShowSwingAttr === null || doorShowSwingAttr === void 0 ? void 0 : doorShowSwingAttr.values.find(function (val) { return val.metadata[constants_1.SpacesMetadata.VALUE] === constants_1.DoorShowSwing.HIDE; })) === null || _c === void 0 ? void 0 : _c.assetId,
351
- _q),
352
- doorOrientation: (_r = {},
353
- _r[constants_1.DoorOrientations.LEFT] = (_d = doorOrientationAttr === null || doorOrientationAttr === void 0 ? void 0 : doorOrientationAttr.values.find(function (val) { return val.metadata[constants_1.SpacesMetadata.VALUE] === constants_1.DoorOrientations.LEFT; })) === null || _d === void 0 ? void 0 : _d.assetId,
354
- _r[constants_1.DoorOrientations.RIGHT] = (_e = doorOrientationAttr === null || doorOrientationAttr === void 0 ? void 0 : doorOrientationAttr.values.find(function (val) { return val.metadata[constants_1.SpacesMetadata.VALUE] === constants_1.DoorOrientations.RIGHT; })) === null || _e === void 0 ? void 0 : _e.assetId,
355
- _r),
356
- doorOpeningDirection: (_s = {},
357
- _s[constants_1.DoorOpeningDirections.INSIDE] = (_f = doorOpeningDirectionAttr === null || doorOpeningDirectionAttr === void 0 ? void 0 : doorOpeningDirectionAttr.values.find(function (val) {
358
- return val.metadata[constants_1.SpacesMetadata.VALUE] === constants_1.DoorOpeningDirections.INSIDE;
359
- })) === null || _f === void 0 ? void 0 : _f.assetId,
360
- _s[constants_1.DoorOpeningDirections.OUTSIDE] = (_g = doorOpeningDirectionAttr === null || doorOpeningDirectionAttr === void 0 ? void 0 : doorOpeningDirectionAttr.values.find(function (val) {
361
- return val.metadata[constants_1.SpacesMetadata.VALUE] === constants_1.DoorOpeningDirections.OUTSIDE;
362
- })) === null || _g === void 0 ? void 0 : _g.assetId,
363
- _s),
364
- };
365
- optionsMap = Object.entries(options).reduce(function (output, _a) {
366
- var _b;
367
- var attr = _a[0], valuesObj = _a[1];
368
- return Object.assign(output, (_b = {},
369
- _b[attr] = Object.entries(valuesObj).reduce(function (result, _a) {
370
- var _b;
371
- var val = _a[0], key = _a[1];
372
- return Object.assign(result, (_b = {}, _b[key] = val, _b));
373
- }, {}),
374
- _b));
375
- }, {});
376
- wallModeOptions = [
377
- {
378
- value: constants_1.WallModes.WALL,
379
- assetId: (_h = wallModeAttr === null || wallModeAttr === void 0 ? void 0 : wallModeAttr.values.find(function (val) { return val.metadata[constants_1.SpacesMetadata.VALUE] === constants_1.WallModes.WALL; })) === null || _h === void 0 ? void 0 : _h.assetId,
380
- },
381
- {
382
- value: constants_1.WallModes.BOUNDARY,
383
- assetId: (_j = wallModeAttr === null || wallModeAttr === void 0 ? void 0 : wallModeAttr.values.find(function (val) { return val.metadata[constants_1.SpacesMetadata.VALUE] === constants_1.WallModes.BOUNDARY; })) === null || _j === void 0 ? void 0 : _j.assetId,
384
- },
385
- ];
386
- wallModes = {
387
- options: wallModeOptions.map(function (_a) {
388
- var value = _a.value;
389
- return value;
390
- }),
391
- assetIds: wallModeOptions.reduce(function (output, mode) {
392
- var _a;
393
- return Object.assign(output, (_a = {}, _a[mode.value] = mode.assetId, _a));
394
- }, {}),
395
- value: (_k = wallModeOptions.find(function (mode) { return mode.assetId === (wallModeAttr === null || wallModeAttr === void 0 ? void 0 : wallModeAttr.defaultValue.assetId); })) === null || _k === void 0 ? void 0 : _k.value,
396
- };
397
- defaults = (_t = {},
398
- _t[types_1.IElements.WALL] = wallAssetId,
399
- _t[types_1.IElements.DOOR] = doorAssetId,
400
- _t[types_1.IElements.WINDOW] = windowAssetId,
401
- _t[types_1.IElements.OPENING] = openingAssetId,
402
- _t.doorShowSwing = optionsMap.doorShowSwing[(_l = doorShowSwingAttr === null || doorShowSwingAttr === void 0 ? void 0 : doorShowSwingAttr.values.find(function (val) { return val.assetId === (doorShowSwingAttr === null || doorShowSwingAttr === void 0 ? void 0 : doorShowSwingAttr.defaultValue.assetId); })) === null || _l === void 0 ? void 0 : _l.assetId],
403
- _t.doorOrientation = optionsMap.doorOrientation[(_m = doorOrientationAttr === null || doorOrientationAttr === void 0 ? void 0 : doorOrientationAttr.values.find(function (val) { return val.assetId === (doorOrientationAttr === null || doorOrientationAttr === void 0 ? void 0 : doorOrientationAttr.defaultValue.assetId); })) === null || _m === void 0 ? void 0 : _m.assetId],
404
- _t.doorOpeningDirection = optionsMap.doorOpeningDirection[(_o = doorOpeningDirectionAttr === null || doorOpeningDirectionAttr === void 0 ? void 0 : doorOpeningDirectionAttr.values.find(function (val) { return val.assetId === (doorOpeningDirectionAttr === null || doorOpeningDirectionAttr === void 0 ? void 0 : doorOpeningDirectionAttr.defaultValue.assetId); })) === null || _o === void 0 ? void 0 : _o.assetId],
405
- _t);
406
- return [2, { defaults: defaults, wallModes: wallModes }];
407
- }
408
- });
409
- });
410
- }
411
- exports.getAttributeData = getAttributeData;
@@ -1,2 +0,0 @@
1
- declare function clearCanvas(canvas: HTMLCanvasElement): void;
2
- export default clearCanvas;