@threekit-tools/treble 0.0.94 → 0.0.95-next-01
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Treble/Treble.d.ts +2 -2
- package/dist/Treble/Treble.js +3 -3
- package/dist/Treble/index.d.ts +1 -1
- package/dist/Treble/index.js +1 -1
- package/dist/Treble/{snapshots.d.ts → snapshot.d.ts} +1 -1
- package/dist/Treble/{snapshots.js → snapshot.js} +1 -1
- package/dist/Treble/wishlist.d.ts +1 -1
- package/dist/Treble/wishlist.js +1 -1
- package/dist/api/assets.js +1 -1
- package/dist/api/catalog.js +1 -1
- package/dist/api/configurations.js +1 -1
- package/dist/api/datatables.js +1 -1
- package/dist/api/orders.js +1 -1
- package/dist/api/price.js +1 -1
- package/dist/components/AttributeTitle/index.d.ts +2 -2
- package/dist/components/AttributeValue/index.d.ts +2 -2
- package/dist/components/BreatheAnimation/index.js +1 -1
- package/dist/components/Button/index.d.ts +3 -3
- package/dist/components/Cards/index.d.ts +3 -3
- package/dist/components/DevTools/index.d.ts +2 -2
- package/dist/components/DraggableHint/draggableIndicator.styles.d.ts +1 -1
- package/dist/components/DraggableHint/index.d.ts +2 -2
- package/dist/components/Dropdown/index.d.ts +3 -3
- package/dist/components/FlatForm/index.d.ts +2 -2
- package/dist/components/FormComponentDescription/index.d.ts +1 -1
- package/dist/components/FormComponentTitle/index.d.ts +1 -1
- package/dist/components/Player/index.d.ts +9 -9
- package/dist/components/PlayerLoadingCircular/index.d.ts +2 -2
- package/dist/components/PlayerLoadingSpinner/index.d.ts +2 -2
- package/dist/components/PlayerLoadingSpinner/playerLoadingSpinner.styles.d.ts +1 -1
- package/dist/components/ProductDescription/index.d.ts +3 -3
- package/dist/components/ProductName/index.d.ts +3 -3
- package/dist/components/Share/index.d.ts +2 -2
- package/dist/components/Share/index.js +1 -1
- package/dist/components/Share/share.styles.d.ts +1 -1
- package/dist/components/Snapshots/index.d.ts +2 -2
- package/dist/components/Strips/index.d.ts +3 -3
- package/dist/components/Swatch/index.d.ts +3 -3
- package/dist/components/Switch/index.d.ts +3 -3
- package/dist/components/TextInput/index.d.ts +3 -3
- package/dist/components/ThreekitProvider/index.d.ts +1 -1
- package/dist/components/Tiles/index.d.ts +3 -3
- package/dist/components/TilesGroup/index.d.ts +3 -3
- package/dist/components/TotalPrice/index.d.ts +3 -3
- package/dist/components/TrebleApp/index.d.ts +3 -3
- package/dist/components/TurntableAnimation/index.js +1 -1
- package/dist/components/Upload/index.d.ts +3 -3
- package/dist/components/Upload/index.js +1 -1
- package/dist/components/UploadArea/index.d.ts +3 -3
- package/dist/components/UploadArea/index.js +1 -1
- package/dist/components/Wishlist/WishlistItem.d.ts +2 -2
- package/dist/components/Wishlist/index.d.ts +4 -4
- package/dist/components/Wishlist/index.js +1 -1
- package/dist/components/Zoom/index.d.ts +6 -6
- package/dist/components/containers/formInputContainer.d.ts +2 -2
- package/dist/components/formComponents.d.ts +6 -6
- package/dist/components/message/index.d.ts +1 -1
- package/dist/constants.d.ts +6 -6
- package/dist/hooks/useAttribute/index.d.ts +4 -4
- package/dist/hooks/useAttribute/index.js +1 -1
- package/dist/hooks/useConfigurationLoader/index.js +1 -1
- package/dist/hooks/useConfigurator/index.d.ts +3 -3
- package/dist/hooks/useDevTools/index.d.ts +1 -1
- package/dist/hooks/useNestedConfigurator/index.d.ts +2 -2
- package/dist/hooks/useNestedConfigurator/index.js +3 -4
- package/dist/hooks/usePlayer/index.d.ts +1 -1
- package/dist/hooks/usePlayerPortal/index.d.ts +1 -1
- package/dist/hooks/useProductCache/index.js +1 -1
- package/dist/hooks/useResetProduct/index.d.ts +1 -1
- package/dist/hooks/useResetProduct/index.js +1 -1
- package/dist/hooks/useShare/index.d.ts +1 -1
- package/dist/hooks/useShare/index.js +1 -1
- package/dist/hooks/useSingleAnimation/index.js +1 -1
- package/dist/hooks/useSpaces/SpacesLayout.d.ts +11 -0
- package/dist/hooks/useSpaces/SpacesLayout.js +74 -0
- package/dist/hooks/useSpaces/SpacesState.d.ts +177 -0
- package/dist/hooks/useSpaces/SpacesState.js +1816 -0
- package/dist/hooks/useSpaces/constants.d.ts +79 -0
- package/dist/hooks/useSpaces/constants.js +130 -0
- package/dist/hooks/useSpaces/dataHandlers.d.ts +38 -0
- package/dist/hooks/useSpaces/dataHandlers.js +411 -0
- package/dist/hooks/useSpaces/draw/clearCanvas.d.ts +2 -0
- package/dist/hooks/useSpaces/draw/clearCanvas.js +9 -0
- package/dist/hooks/useSpaces/draw/drawBackground.d.ts +2 -0
- package/dist/hooks/useSpaces/draw/drawBackground.js +12 -0
- package/dist/hooks/useSpaces/draw/drawDimensions.d.ts +3 -0
- package/dist/hooks/useSpaces/draw/drawDimensions.js +53 -0
- package/dist/hooks/useSpaces/draw/drawDoors.d.ts +9 -0
- package/dist/hooks/useSpaces/draw/drawDoors.js +99 -0
- package/dist/hooks/useSpaces/draw/drawFloor.d.ts +3 -0
- package/dist/hooks/useSpaces/draw/drawFloor.js +36 -0
- package/dist/hooks/useSpaces/draw/drawGrid.d.ts +3 -0
- package/dist/hooks/useSpaces/draw/drawGrid.js +36 -0
- package/dist/hooks/useSpaces/draw/drawGuides.d.ts +3 -0
- package/dist/hooks/useSpaces/draw/drawGuides.js +23 -0
- package/dist/hooks/useSpaces/draw/drawOpenings.d.ts +9 -0
- package/dist/hooks/useSpaces/draw/drawOpenings.js +72 -0
- package/dist/hooks/useSpaces/draw/drawVertices.d.ts +8 -0
- package/dist/hooks/useSpaces/draw/drawVertices.js +61 -0
- package/dist/hooks/useSpaces/draw/drawWalls.d.ts +11 -0
- package/dist/hooks/useSpaces/draw/drawWalls.js +90 -0
- package/dist/hooks/useSpaces/draw/drawWindows.d.ts +9 -0
- package/dist/hooks/useSpaces/draw/drawWindows.js +82 -0
- package/dist/hooks/useSpaces/draw/index.d.ts +11 -0
- package/dist/hooks/useSpaces/draw/index.js +129 -0
- package/dist/hooks/useSpaces/geometry/addThicknessToLine.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/addThicknessToLine.js +13 -0
- package/dist/hooks/useSpaces/geometry/areLinesEqual.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/areLinesEqual.js +17 -0
- package/dist/hooks/useSpaces/geometry/arePointsEqual.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/arePointsEqual.js +8 -0
- package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.js +11 -0
- package/dist/hooks/useSpaces/geometry/closestPointOnLine.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/closestPointOnLine.js +13 -0
- package/dist/hooks/useSpaces/geometry/doLinesOverlap.d.ts +2 -0
- package/dist/hooks/useSpaces/geometry/doLinesOverlap.js +16 -0
- package/dist/hooks/useSpaces/geometry/euclideanMod.d.ts +2 -0
- package/dist/hooks/useSpaces/geometry/euclideanMod.js +6 -0
- package/dist/hooks/useSpaces/geometry/findLoops.d.ts +6 -0
- package/dist/hooks/{useRoomBuilder → useSpaces/geometry}/findLoops.js +31 -13
- package/dist/hooks/useSpaces/geometry/getAllLineIntersections.d.ts +6 -0
- package/dist/hooks/useSpaces/geometry/getAllLineIntersections.js +23 -0
- package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.js +7 -0
- package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.js +17 -0
- package/dist/hooks/useSpaces/geometry/getDistanceToLine.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getDistanceToLine.js +10 -0
- package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.js +7 -0
- package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.js +17 -0
- package/dist/hooks/useSpaces/geometry/getLineOtherPoint.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getLineOtherPoint.js +11 -0
- package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.js +43 -0
- package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.js +9 -0
- package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.js +20 -0
- package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.js +11 -0
- package/dist/hooks/useSpaces/geometry/getPolygonArea.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getPolygonArea.js +15 -0
- package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.js +16 -0
- package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.d.ts +6 -0
- package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.js +17 -0
- package/dist/hooks/useSpaces/geometry/getTriangleArea.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getTriangleArea.js +9 -0
- package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.js +12 -0
- package/dist/hooks/useSpaces/geometry/index.d.ts +30 -0
- package/dist/hooks/useSpaces/geometry/index.js +64 -0
- package/dist/hooks/useSpaces/geometry/isPointInPolygon.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/isPointInPolygon.js +21 -0
- package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.js +25 -0
- package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.js +11 -0
- package/dist/hooks/useSpaces/geometry/splitLineAtOffset.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/splitLineAtOffset.js +12 -0
- package/dist/hooks/useSpaces/geometry/splitLineAtPoint.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/splitLineAtPoint.js +9 -0
- package/dist/hooks/useSpaces/geometry/splitLineAtPoints.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/splitLineAtPoints.js +28 -0
- package/dist/hooks/useSpaces/index.d.ts +95 -0
- package/dist/hooks/useSpaces/index.js +625 -0
- package/dist/hooks/useSpaces/themes/blueprint.d.ts +3 -0
- package/dist/hooks/useSpaces/themes/blueprint.js +96 -0
- package/dist/hooks/useSpaces/themes/default.d.ts +3 -0
- package/dist/hooks/useSpaces/themes/default.js +96 -0
- package/dist/hooks/{useRoomBuilder/themes.d.ts → useSpaces/themes/index.d.ts} +3 -4
- package/dist/hooks/useSpaces/themes/index.js +21 -0
- package/dist/hooks/useSpaces/themes/light.d.ts +3 -0
- package/dist/hooks/useSpaces/themes/light.js +96 -0
- package/dist/hooks/useSpaces/types.d.ts +378 -0
- package/dist/hooks/useSpaces/types.js +54 -0
- package/dist/hooks/useSpaces/validators/areWallsDuplicated.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/areWallsDuplicated.js +61 -0
- package/dist/hooks/useSpaces/validators/areWallsIntersecting.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/areWallsIntersecting.js +42 -0
- package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.js +52 -0
- package/dist/hooks/useSpaces/validators/areWallsTooShort.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/areWallsTooShort.js +37 -0
- package/dist/hooks/useSpaces/validators/index.d.ts +15 -0
- package/dist/hooks/useSpaces/validators/index.js +40 -0
- package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.js +31 -0
- package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.js +19 -0
- package/dist/hooks/useSpaces/validators/isLineTooShort.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/isLineTooShort.js +26 -0
- package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.d.ts +4 -0
- package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.js +19 -0
- package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.js +19 -0
- package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.js +41 -0
- package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.js +54 -0
- package/dist/hooks/useSpaces/validators/isWallTooShort.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/isWallTooShort.js +10 -0
- package/dist/hooks/{useRoomBuilder → useSpaces/validators}/messaging.js +1 -1
- package/dist/hooks/useWishlist/index.d.ts +1 -1
- package/dist/hooks/useZoom/index.d.ts +1 -1
- package/dist/http/assets.d.ts +1 -1
- package/dist/http/orders.d.ts +1 -1
- package/dist/icons/AngleSnapping.d.ts +3 -0
- package/dist/icons/AngleSnapping.js +28 -0
- package/dist/icons/Boundary.d.ts +3 -0
- package/dist/icons/Boundary.js +21 -0
- package/dist/icons/Center.d.ts +3 -0
- package/dist/icons/Center.js +24 -0
- package/dist/icons/Draw.js +3 -3
- package/dist/icons/GridSnapping.d.ts +3 -0
- package/dist/icons/GridSnapping.js +28 -0
- package/dist/icons/LayoutAlt.d.ts +3 -0
- package/dist/icons/LayoutAlt.js +21 -0
- package/dist/icons/Magnet.d.ts +3 -0
- package/dist/icons/Magnet.js +27 -0
- package/dist/icons/Player3D.d.ts +3 -0
- package/dist/icons/Player3D.js +21 -0
- package/dist/icons/RulerBlank.d.ts +3 -0
- package/dist/icons/RulerBlank.js +25 -0
- package/dist/icons/RulerDetailed.d.ts +3 -0
- package/dist/icons/RulerDetailed.js +27 -0
- package/dist/icons/Save.d.ts +3 -0
- package/dist/icons/Save.js +21 -0
- package/dist/icons/Spinner.d.ts +2 -2
- package/dist/icons/UnitCm.d.ts +3 -0
- package/dist/icons/UnitCm.js +22 -0
- package/dist/icons/UnitFeet.d.ts +3 -0
- package/dist/icons/UnitFeet.js +22 -0
- package/dist/icons/UnitInch.d.ts +3 -0
- package/dist/icons/UnitInch.js +22 -0
- package/dist/icons/UnitMeter.d.ts +3 -0
- package/dist/icons/UnitMeter.js +21 -0
- package/dist/icons/Window.js +4 -4
- package/dist/icons/index.js +28 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.js +35 -5
- package/dist/store/attributes.d.ts +4 -3
- package/dist/store/attributes.js +1 -1
- package/dist/store/index.d.ts +43 -12
- package/dist/store/index.js +3 -1
- package/dist/store/price.d.ts +1 -1
- package/dist/store/price.js +1 -1
- package/dist/store/product.d.ts +2 -2
- package/dist/store/product.js +5 -8
- package/dist/store/spaces.d.ts +74 -0
- package/dist/store/spaces.js +354 -0
- package/dist/store/translations.d.ts +1 -1
- package/dist/store/translations.js +1 -1
- package/dist/store/treble.d.ts +2 -2
- package/dist/store/treble.js +15 -22
- package/dist/store/wishlist.d.ts +4 -22
- package/dist/store/wishlist.js +1 -1
- package/dist/types.d.ts +20 -18
- package/dist/types.js +9 -9
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +3 -3
- package/package.json +1 -1
- package/dist/hooks/useRoomBuilder/RoomBuilderState.d.ts +0 -95
- package/dist/hooks/useRoomBuilder/RoomBuilderState.js +0 -1237
- package/dist/hooks/useRoomBuilder/constants.d.ts +0 -41
- package/dist/hooks/useRoomBuilder/constants.js +0 -48
- package/dist/hooks/useRoomBuilder/dataHandlers.d.ts +0 -18
- package/dist/hooks/useRoomBuilder/dataHandlers.js +0 -187
- package/dist/hooks/useRoomBuilder/draw.d.ts +0 -55
- package/dist/hooks/useRoomBuilder/draw.js +0 -573
- package/dist/hooks/useRoomBuilder/findLoops.d.ts +0 -5
- package/dist/hooks/useRoomBuilder/geometry.d.ts +0 -33
- package/dist/hooks/useRoomBuilder/geometry.js +0 -325
- package/dist/hooks/useRoomBuilder/index.d.ts +0 -40
- package/dist/hooks/useRoomBuilder/index.js +0 -303
- package/dist/hooks/useRoomBuilder/themes.js +0 -273
- package/dist/hooks/useRoomBuilder/types.d.ts +0 -238
- package/dist/hooks/useRoomBuilder/types.js +0 -36
- package/dist/hooks/useRoomBuilder/validators.d.ts +0 -36
- package/dist/hooks/useRoomBuilder/validators.js +0 -362
- /package/dist/hooks/{useRoomBuilder → useSpaces/validators}/messaging.d.ts +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IDimensionOptions = exports.IUnits = exports.IModes = exports.IErrorTypes = exports.GUIDE_ORIENTATIONS = exports.SNAPPING_TYPES = exports.IElementStyleModes = exports.IElements = void 0;
|
|
4
|
+
var IElements;
|
|
5
|
+
(function (IElements) {
|
|
6
|
+
IElements["WALL"] = "walls";
|
|
7
|
+
IElements["VERTEX"] = "vertex";
|
|
8
|
+
IElements["FEATURE"] = "features";
|
|
9
|
+
IElements["WINDOW"] = "windows";
|
|
10
|
+
IElements["DOOR"] = "doors";
|
|
11
|
+
IElements["OPENING"] = "openings";
|
|
12
|
+
})(IElements = exports.IElements || (exports.IElements = {}));
|
|
13
|
+
var IElementStyleModes;
|
|
14
|
+
(function (IElementStyleModes) {
|
|
15
|
+
IElementStyleModes["HIGHLIGHT"] = "highlight";
|
|
16
|
+
IElementStyleModes["ACTIVE"] = "active";
|
|
17
|
+
IElementStyleModes["ERROR"] = "error";
|
|
18
|
+
})(IElementStyleModes = exports.IElementStyleModes || (exports.IElementStyleModes = {}));
|
|
19
|
+
var SNAPPING_TYPES;
|
|
20
|
+
(function (SNAPPING_TYPES) {
|
|
21
|
+
SNAPPING_TYPES["NONE"] = "none";
|
|
22
|
+
SNAPPING_TYPES["ANGLE"] = "angle";
|
|
23
|
+
SNAPPING_TYPES["GUIDE"] = "guide";
|
|
24
|
+
SNAPPING_TYPES["GRID"] = "grid";
|
|
25
|
+
})(SNAPPING_TYPES = exports.SNAPPING_TYPES || (exports.SNAPPING_TYPES = {}));
|
|
26
|
+
var GUIDE_ORIENTATIONS;
|
|
27
|
+
(function (GUIDE_ORIENTATIONS) {
|
|
28
|
+
GUIDE_ORIENTATIONS["HORIZONTAL"] = "horizontal";
|
|
29
|
+
GUIDE_ORIENTATIONS["VERTICAL"] = "vertical";
|
|
30
|
+
})(GUIDE_ORIENTATIONS = exports.GUIDE_ORIENTATIONS || (exports.GUIDE_ORIENTATIONS = {}));
|
|
31
|
+
var IErrorTypes;
|
|
32
|
+
(function (IErrorTypes) {
|
|
33
|
+
IErrorTypes["HARD"] = "hard";
|
|
34
|
+
IErrorTypes["SOFT"] = "soft";
|
|
35
|
+
IErrorTypes["WARN"] = "warning";
|
|
36
|
+
})(IErrorTypes = exports.IErrorTypes || (exports.IErrorTypes = {}));
|
|
37
|
+
var IModes;
|
|
38
|
+
(function (IModes) {
|
|
39
|
+
IModes["SELECT"] = "select";
|
|
40
|
+
IModes["DRAW"] = "draw";
|
|
41
|
+
})(IModes = exports.IModes || (exports.IModes = {}));
|
|
42
|
+
var IUnits;
|
|
43
|
+
(function (IUnits) {
|
|
44
|
+
IUnits["FEET"] = "feet";
|
|
45
|
+
IUnits["METER"] = "meter";
|
|
46
|
+
IUnits["INCH"] = "inch";
|
|
47
|
+
IUnits["CM"] = "cm";
|
|
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,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var geometry_1 = require("../geometry");
|
|
4
|
+
var messaging_1 = require("./messaging");
|
|
5
|
+
var types_1 = require("../types");
|
|
6
|
+
function areWallsDuplicated(input, wallAndFeatures) {
|
|
7
|
+
var vertex = input.vertex, updatedPosition = input.updatedPosition;
|
|
8
|
+
var walls = wallAndFeatures.walls;
|
|
9
|
+
var point = updatedPosition.point;
|
|
10
|
+
var _a = vertex.connections.reduce(function (output, connection) {
|
|
11
|
+
var _a;
|
|
12
|
+
var wallIndex = connection[0], vertexIndex = connection[1];
|
|
13
|
+
output.wallIndexes.add(wallIndex);
|
|
14
|
+
output.updatedVerticesMap = Object.assign(output.updatedVerticesMap, (_a = {},
|
|
15
|
+
_a[wallIndex] = vertexIndex,
|
|
16
|
+
_a));
|
|
17
|
+
return output;
|
|
18
|
+
}, {
|
|
19
|
+
wallIndexes: new Set([]),
|
|
20
|
+
updatedVerticesMap: {},
|
|
21
|
+
}), wallIndexes = _a.wallIndexes, updatedVerticesMap = _a.updatedVerticesMap;
|
|
22
|
+
for (var _i = 0, _b = Array.from(wallIndexes); _i < _b.length; _i++) {
|
|
23
|
+
var wallIdx = _b[_i];
|
|
24
|
+
var wall = walls[wallIdx];
|
|
25
|
+
var updatedLine = JSON.parse(JSON.stringify(wall.line));
|
|
26
|
+
updatedLine[updatedVerticesMap[wallIdx]] = point;
|
|
27
|
+
if ((updatedPosition === null || updatedPosition === void 0 ? void 0 : updatedPosition.type) === types_1.IElements.WALL &&
|
|
28
|
+
updatedPosition.index !== wallIdx) {
|
|
29
|
+
var _c = walls[updatedPosition.index].line, xTest = _c[0], yTest = _c[1];
|
|
30
|
+
var unmovedPoint = updatedLine[updatedVerticesMap[wallIdx] === 1 ? 0 : 1];
|
|
31
|
+
if ((0, geometry_1.arePointsEqual)(unmovedPoint, xTest) ||
|
|
32
|
+
(0, geometry_1.arePointsEqual)(unmovedPoint, yTest))
|
|
33
|
+
return {
|
|
34
|
+
address: {
|
|
35
|
+
type: types_1.IElements.WALL,
|
|
36
|
+
index: updatedPosition.index,
|
|
37
|
+
},
|
|
38
|
+
type: types_1.IErrorTypes.SOFT,
|
|
39
|
+
message: messaging_1.errorMessages.wallsNotUnique(),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
for (var i = 0; i < walls.length; i++) {
|
|
43
|
+
if (wallIdx === i)
|
|
44
|
+
continue;
|
|
45
|
+
var existingWall = walls[i];
|
|
46
|
+
var error = {
|
|
47
|
+
address: { type: types_1.IElements.WALL, index: i },
|
|
48
|
+
type: types_1.IErrorTypes.SOFT,
|
|
49
|
+
message: messaging_1.errorMessages.wallsNotUnique(),
|
|
50
|
+
};
|
|
51
|
+
if (((0, geometry_1.arePointsEqual)(existingWall[0], wall.line[0]) &&
|
|
52
|
+
(0, geometry_1.arePointsEqual)(existingWall[1], wall.line[1])) ||
|
|
53
|
+
((0, geometry_1.arePointsEqual)(existingWall[0], wall.line[1]) &&
|
|
54
|
+
(0, geometry_1.arePointsEqual)(existingWall[1], wall.line[0]))) {
|
|
55
|
+
return error;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
exports.default = areWallsDuplicated;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var geometry_1 = require("../geometry");
|
|
4
|
+
var messaging_1 = require("./messaging");
|
|
5
|
+
var types_1 = require("../types");
|
|
6
|
+
function areWallsIntersecting(input, wallAndFeatures) {
|
|
7
|
+
var vertex = input.vertex, updatedPosition = input.updatedPosition;
|
|
8
|
+
var walls = wallAndFeatures.walls;
|
|
9
|
+
var _a = vertex.connections.reduce(function (output, connection) {
|
|
10
|
+
var _a;
|
|
11
|
+
var wallIndex = connection[0], vertexIndex = connection[1];
|
|
12
|
+
output.wallIndexes.add(wallIndex);
|
|
13
|
+
output.updatedVerticesMap = Object.assign(output.updatedVerticesMap, (_a = {},
|
|
14
|
+
_a[wallIndex] = vertexIndex,
|
|
15
|
+
_a));
|
|
16
|
+
return output;
|
|
17
|
+
}, {
|
|
18
|
+
wallIndexes: new Set([]),
|
|
19
|
+
updatedVerticesMap: {},
|
|
20
|
+
}), wallIndexes = _a.wallIndexes, updatedVerticesMap = _a.updatedVerticesMap;
|
|
21
|
+
for (var _i = 0, _b = Array.from(wallIndexes); _i < _b.length; _i++) {
|
|
22
|
+
var validateWallIndex = _b[_i];
|
|
23
|
+
var line = walls[validateWallIndex].line;
|
|
24
|
+
line[updatedVerticesMap[validateWallIndex]] = updatedPosition.point;
|
|
25
|
+
for (var i = 0; i < walls.length; i++) {
|
|
26
|
+
if (wallIndexes.has(i))
|
|
27
|
+
continue;
|
|
28
|
+
var wall = walls[i];
|
|
29
|
+
if (!wall)
|
|
30
|
+
continue;
|
|
31
|
+
var intersectionPoint = (0, geometry_1.getLineSegmentsIntersection)(line, wall.line);
|
|
32
|
+
if (intersectionPoint)
|
|
33
|
+
return {
|
|
34
|
+
address: { type: types_1.IElements.WALL, index: i },
|
|
35
|
+
message: messaging_1.errorMessages.addWallCollidingWithWall(),
|
|
36
|
+
type: types_1.IErrorTypes.SOFT,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
exports.default = areWallsIntersecting;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IErrorElement, IMoveVertexValidatorInput, ISharedValidatorInput, IWallsValidationConfig } from '../types';
|
|
2
|
+
declare function areWallsOrphaningFeatures(input: IMoveVertexValidatorInput, wallAndFeatures: ISharedValidatorInput, validationConfig: IWallsValidationConfig): false | IErrorElement;
|
|
3
|
+
export default areWallsOrphaningFeatures;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var geometry_1 = require("../geometry");
|
|
4
|
+
var types_1 = require("../types");
|
|
5
|
+
function areWallsOrphaningFeatures(input, wallAndFeatures, validationConfig) {
|
|
6
|
+
var _a;
|
|
7
|
+
var vertex = input.vertex, updatedPosition = input.updatedPosition;
|
|
8
|
+
var walls = wallAndFeatures.walls, features = wallAndFeatures.features;
|
|
9
|
+
var padding = validationConfig.padding;
|
|
10
|
+
var _b = vertex.connections.reduce(function (output, connection) {
|
|
11
|
+
var _a;
|
|
12
|
+
var wallIndex = connection[0], vertexIndex = connection[1];
|
|
13
|
+
output.wallIndexes.add(wallIndex);
|
|
14
|
+
output.updatedVerticesMap = Object.assign(output.updatedVerticesMap, (_a = {},
|
|
15
|
+
_a[wallIndex] = vertexIndex,
|
|
16
|
+
_a));
|
|
17
|
+
return output;
|
|
18
|
+
}, {
|
|
19
|
+
wallIndexes: new Set([]),
|
|
20
|
+
updatedVerticesMap: {},
|
|
21
|
+
}), wallIndexes = _b.wallIndexes, updatedVerticesMap = _b.updatedVerticesMap;
|
|
22
|
+
for (var _i = 0, _c = Array.from(wallIndexes); _i < _c.length; _i++) {
|
|
23
|
+
var wallIdx = _c[_i];
|
|
24
|
+
var wall = walls[wallIdx];
|
|
25
|
+
if (!wall.connections.length)
|
|
26
|
+
continue;
|
|
27
|
+
var updatedLine = JSON.parse(JSON.stringify(wall.line));
|
|
28
|
+
updatedLine[updatedVerticesMap[wallIdx]] = updatedPosition.point;
|
|
29
|
+
var currentWallLength = (0, geometry_1.getLengthOfLineSegment)(wall.line);
|
|
30
|
+
var updatedWallLength = (0, geometry_1.getLengthOfLineSegment)(updatedLine);
|
|
31
|
+
var wallLengthDelta = updatedWallLength - currentWallLength;
|
|
32
|
+
for (var i = 0; i < wall.connections.length; i++) {
|
|
33
|
+
var _d = wall.connections[i], type = _d[0], index = _d[1];
|
|
34
|
+
var feat = (_a = features[type]) === null || _a === void 0 ? void 0 : _a[index];
|
|
35
|
+
if (!feat)
|
|
36
|
+
continue;
|
|
37
|
+
var error = {
|
|
38
|
+
address: { type: type, index: index },
|
|
39
|
+
message: 'feature collision',
|
|
40
|
+
type: types_1.IErrorTypes.HARD,
|
|
41
|
+
};
|
|
42
|
+
if (updatedVerticesMap[wallIdx] === 0 &&
|
|
43
|
+
feat.offset - wallLengthDelta < padding)
|
|
44
|
+
return error;
|
|
45
|
+
else if (feat.offset + feat.length > updatedWallLength - padding) {
|
|
46
|
+
return error;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
exports.default = areWallsOrphaningFeatures;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IErrorElement, IWallsValidationConfig, IMoveVertexValidatorInput, ISharedValidatorInput } from '../types';
|
|
2
|
+
declare function areWallsTooShort(input: IMoveVertexValidatorInput, wallAndFeatures: ISharedValidatorInput, validationConfig: IWallsValidationConfig): false | IErrorElement;
|
|
3
|
+
export default areWallsTooShort;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var messaging_1 = require("./messaging");
|
|
7
|
+
var types_1 = require("../types");
|
|
8
|
+
var isLineTooShort_1 = __importDefault(require("./isLineTooShort"));
|
|
9
|
+
function areWallsTooShort(input, wallAndFeatures, validationConfig) {
|
|
10
|
+
var vertex = input.vertex, updatedPosition = input.updatedPosition;
|
|
11
|
+
var walls = wallAndFeatures.walls;
|
|
12
|
+
var _a = vertex.connections.reduce(function (output, connection) {
|
|
13
|
+
var _a;
|
|
14
|
+
var wallIndex = connection[0], vertexIndex = connection[1];
|
|
15
|
+
output.wallIndexes.push(wallIndex);
|
|
16
|
+
output.updatedVerticesMap = Object.assign(output.updatedVerticesMap, (_a = {},
|
|
17
|
+
_a[wallIndex] = vertexIndex,
|
|
18
|
+
_a));
|
|
19
|
+
return output;
|
|
20
|
+
}, {
|
|
21
|
+
wallIndexes: [],
|
|
22
|
+
updatedVerticesMap: {},
|
|
23
|
+
}), wallIndexes = _a.wallIndexes, updatedVerticesMap = _a.updatedVerticesMap;
|
|
24
|
+
for (var _i = 0, wallIndexes_1 = wallIndexes; _i < wallIndexes_1.length; _i++) {
|
|
25
|
+
var index = wallIndexes_1[_i];
|
|
26
|
+
var line = walls[index].line;
|
|
27
|
+
line[updatedVerticesMap[index]] = updatedPosition.point;
|
|
28
|
+
if ((0, isLineTooShort_1.default)(line, validationConfig))
|
|
29
|
+
return {
|
|
30
|
+
address: { type: types_1.IElements.WALL, index: index },
|
|
31
|
+
message: messaging_1.errorMessages.wallTooShort(),
|
|
32
|
+
type: types_1.IErrorTypes.HARD,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
exports.default = areWallsTooShort;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IErrorElement, IWallsValidationConfig } from '../types';
|
|
2
|
+
import { ISharedValidatorInput, IValidatorFunction } from '../types';
|
|
3
|
+
import isFeatureOutsideWallBounds from './isFeatureOutsideWallBounds';
|
|
4
|
+
import isFeatureCollidingWithExistingFeature from './isFeatureCollidingWithExistingFeature';
|
|
5
|
+
import isWallIntersectingFeature from './isWallIntersectingFeature';
|
|
6
|
+
import isWallOverlappingExisitingWalls from './isWallOverlappingExisitingWalls';
|
|
7
|
+
import isWallTooShort from './isWallTooShort';
|
|
8
|
+
import areWallsTooShort from './areWallsTooShort';
|
|
9
|
+
import areWallsIntersecting from './areWallsIntersecting';
|
|
10
|
+
import areWallsOrphaningFeatures from './areWallsOrphaningFeatures';
|
|
11
|
+
import areWallsDuplicated from './areWallsDuplicated';
|
|
12
|
+
import isWallEndingOnFeature from './isWallEndingOnFeature';
|
|
13
|
+
import isVertexLandingOnFeature from './isVertexLandingOnFeature';
|
|
14
|
+
export { isFeatureOutsideWallBounds, isFeatureCollidingWithExistingFeature, isWallIntersectingFeature, isWallOverlappingExisitingWalls, isWallTooShort, areWallsTooShort, areWallsIntersecting, areWallsOrphaningFeatures, areWallsDuplicated, isWallEndingOnFeature, isVertexLandingOnFeature, };
|
|
15
|
+
export declare function runValidators<T>(validators: Array<IValidatorFunction<T>>, input: T, wallAndFeatures: ISharedValidatorInput, validationConfig: IWallsValidationConfig): IErrorElement[] | null;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.runValidators = exports.isVertexLandingOnFeature = exports.isWallEndingOnFeature = exports.areWallsDuplicated = exports.areWallsOrphaningFeatures = exports.areWallsIntersecting = exports.areWallsTooShort = exports.isWallTooShort = exports.isWallOverlappingExisitingWalls = exports.isWallIntersectingFeature = exports.isFeatureCollidingWithExistingFeature = exports.isFeatureOutsideWallBounds = void 0;
|
|
7
|
+
var isFeatureOutsideWallBounds_1 = __importDefault(require("./isFeatureOutsideWallBounds"));
|
|
8
|
+
exports.isFeatureOutsideWallBounds = isFeatureOutsideWallBounds_1.default;
|
|
9
|
+
var isFeatureCollidingWithExistingFeature_1 = __importDefault(require("./isFeatureCollidingWithExistingFeature"));
|
|
10
|
+
exports.isFeatureCollidingWithExistingFeature = isFeatureCollidingWithExistingFeature_1.default;
|
|
11
|
+
var isWallIntersectingFeature_1 = __importDefault(require("./isWallIntersectingFeature"));
|
|
12
|
+
exports.isWallIntersectingFeature = isWallIntersectingFeature_1.default;
|
|
13
|
+
var isWallOverlappingExisitingWalls_1 = __importDefault(require("./isWallOverlappingExisitingWalls"));
|
|
14
|
+
exports.isWallOverlappingExisitingWalls = isWallOverlappingExisitingWalls_1.default;
|
|
15
|
+
var isWallTooShort_1 = __importDefault(require("./isWallTooShort"));
|
|
16
|
+
exports.isWallTooShort = isWallTooShort_1.default;
|
|
17
|
+
var areWallsTooShort_1 = __importDefault(require("./areWallsTooShort"));
|
|
18
|
+
exports.areWallsTooShort = areWallsTooShort_1.default;
|
|
19
|
+
var areWallsIntersecting_1 = __importDefault(require("./areWallsIntersecting"));
|
|
20
|
+
exports.areWallsIntersecting = areWallsIntersecting_1.default;
|
|
21
|
+
var areWallsOrphaningFeatures_1 = __importDefault(require("./areWallsOrphaningFeatures"));
|
|
22
|
+
exports.areWallsOrphaningFeatures = areWallsOrphaningFeatures_1.default;
|
|
23
|
+
var areWallsDuplicated_1 = __importDefault(require("./areWallsDuplicated"));
|
|
24
|
+
exports.areWallsDuplicated = areWallsDuplicated_1.default;
|
|
25
|
+
var isWallEndingOnFeature_1 = __importDefault(require("./isWallEndingOnFeature"));
|
|
26
|
+
exports.isWallEndingOnFeature = isWallEndingOnFeature_1.default;
|
|
27
|
+
var isVertexLandingOnFeature_1 = __importDefault(require("./isVertexLandingOnFeature"));
|
|
28
|
+
exports.isVertexLandingOnFeature = isVertexLandingOnFeature_1.default;
|
|
29
|
+
function runValidators(validators, input, wallAndFeatures, validationConfig) {
|
|
30
|
+
var errors = validators.reduce(function (output, validate) {
|
|
31
|
+
var error = validate(input, wallAndFeatures, validationConfig);
|
|
32
|
+
if (error)
|
|
33
|
+
output.push(error);
|
|
34
|
+
return output;
|
|
35
|
+
}, []);
|
|
36
|
+
if (errors.length)
|
|
37
|
+
return errors;
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
exports.runValidators = runValidators;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IFeatureValidatorInput, ISharedValidatorInput, IErrorElement } from '../types';
|
|
2
|
+
declare function isFeatureCollidingWithExistingFeature(input: IFeatureValidatorInput, wallAndFeatures: ISharedValidatorInput): false | IErrorElement;
|
|
3
|
+
export default isFeatureCollidingWithExistingFeature;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var geometry_1 = require("../geometry");
|
|
4
|
+
var messaging_1 = require("./messaging");
|
|
5
|
+
var types_1 = require("../types");
|
|
6
|
+
function isFeatureCollidingWithExistingFeature(input, wallAndFeatures) {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
var wall = input.wall, updatedFeature = input.updatedFeature;
|
|
9
|
+
var features = wallAndFeatures.features;
|
|
10
|
+
if (!features || !((_a = wall.connections) === null || _a === void 0 ? void 0 : _a.length))
|
|
11
|
+
return false;
|
|
12
|
+
if (!Object.values(updatedFeature).flat().length)
|
|
13
|
+
return false;
|
|
14
|
+
for (var i = 0; i < wall.connections.length; i++) {
|
|
15
|
+
var _c = wall.connections[i], type = _c[0], index = _c[1];
|
|
16
|
+
if (updatedFeature.address.type === type &&
|
|
17
|
+
updatedFeature.address.index === index)
|
|
18
|
+
continue;
|
|
19
|
+
var existingFeature = (_b = features[type]) === null || _b === void 0 ? void 0 : _b[index];
|
|
20
|
+
if (!existingFeature)
|
|
21
|
+
continue;
|
|
22
|
+
if ((0, geometry_1.doLinesOverlap)([updatedFeature.offset, updatedFeature.length], [existingFeature.offset, existingFeature.length]))
|
|
23
|
+
return {
|
|
24
|
+
address: { type: type, index: index },
|
|
25
|
+
type: types_1.IErrorTypes.SOFT,
|
|
26
|
+
message: messaging_1.errorMessages.featuresColliding(type),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
exports.default = isFeatureCollidingWithExistingFeature;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IErrorElement, IWallsValidationConfig, IFeatureValidatorInput, ISharedValidatorInput } from '../types';
|
|
2
|
+
declare function isFeatureOutsideWallBounds(input: IFeatureValidatorInput, _: ISharedValidatorInput, validationConfig: IWallsValidationConfig): false | IErrorElement;
|
|
3
|
+
export default isFeatureOutsideWallBounds;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var geometry_1 = require("../geometry");
|
|
4
|
+
var messaging_1 = require("./messaging");
|
|
5
|
+
var types_1 = require("../types");
|
|
6
|
+
function isFeatureOutsideWallBounds(input, _, validationConfig) {
|
|
7
|
+
var wall = input.wall, updatedFeature = input.updatedFeature;
|
|
8
|
+
var padding = validationConfig.padding;
|
|
9
|
+
var wallLength = (0, geometry_1.getLengthOfLineSegment)(wall.line);
|
|
10
|
+
if (updatedFeature.offset < padding ||
|
|
11
|
+
updatedFeature.offset + updatedFeature.length > wallLength - padding)
|
|
12
|
+
return {
|
|
13
|
+
address: updatedFeature.address,
|
|
14
|
+
type: types_1.IErrorTypes.HARD,
|
|
15
|
+
message: messaging_1.errorMessages.featureOutsideWallBounds(),
|
|
16
|
+
};
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
exports.default = isFeatureOutsideWallBounds;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
var geometry_1 = require("../geometry");
|
|
13
|
+
var messaging_1 = require("./messaging");
|
|
14
|
+
var types_1 = require("../types");
|
|
15
|
+
function isLineTooShort(wallOrLine, validationConfig) {
|
|
16
|
+
var minLength = validationConfig.minLength;
|
|
17
|
+
var line = Array.isArray(wallOrLine) ? wallOrLine : wallOrLine.line;
|
|
18
|
+
var tooClose = geometry_1.arePointsWithinProximity.apply(void 0, __spreadArray(__spreadArray([], line, false), [minLength], false));
|
|
19
|
+
if (tooClose)
|
|
20
|
+
return {
|
|
21
|
+
message: messaging_1.errorMessages.wallTooShort(),
|
|
22
|
+
type: types_1.IErrorTypes.HARD,
|
|
23
|
+
};
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
exports.default = isLineTooShort;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var messaging_1 = require("./messaging");
|
|
4
|
+
var types_1 = require("../types");
|
|
5
|
+
function isVertexLandingOnFeature(input) {
|
|
6
|
+
var snapPoint = input.updatedPosition;
|
|
7
|
+
if (!snapPoint)
|
|
8
|
+
return false;
|
|
9
|
+
if (snapPoint.type === types_1.IElements.WINDOW ||
|
|
10
|
+
snapPoint.type === types_1.IElements.DOOR ||
|
|
11
|
+
snapPoint.type === types_1.IElements.OPENING)
|
|
12
|
+
return {
|
|
13
|
+
address: snapPoint,
|
|
14
|
+
message: messaging_1.errorMessages.addWallCollidingWithFeature(snapPoint.type),
|
|
15
|
+
type: types_1.IErrorTypes.SOFT,
|
|
16
|
+
};
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
exports.default = isVertexLandingOnFeature;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var messaging_1 = require("./messaging");
|
|
4
|
+
var types_1 = require("../types");
|
|
5
|
+
function isWallEndingOnFeature(input) {
|
|
6
|
+
var snapPoint = input.newWall.end;
|
|
7
|
+
if (!snapPoint)
|
|
8
|
+
return false;
|
|
9
|
+
if (snapPoint.type === types_1.IElements.WINDOW ||
|
|
10
|
+
snapPoint.type === types_1.IElements.DOOR ||
|
|
11
|
+
snapPoint.type === types_1.IElements.OPENING)
|
|
12
|
+
return {
|
|
13
|
+
address: snapPoint,
|
|
14
|
+
message: messaging_1.errorMessages.addWallCollidingWithFeature(snapPoint.type),
|
|
15
|
+
type: types_1.IErrorTypes.SOFT,
|
|
16
|
+
};
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
exports.default = isWallEndingOnFeature;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IAddWallValidatorInput, ISharedValidatorInput, IErrorElement } from '../types';
|
|
2
|
+
declare function isWallIntersectingFeature(input: IAddWallValidatorInput, wallAndFeatures: ISharedValidatorInput): false | IErrorElement;
|
|
3
|
+
export default isWallIntersectingFeature;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var geometry_1 = require("../geometry");
|
|
4
|
+
var messaging_1 = require("./messaging");
|
|
5
|
+
var types_1 = require("../types");
|
|
6
|
+
function isWallIntersectingFeature(input, wallAndFeatures) {
|
|
7
|
+
var _a;
|
|
8
|
+
var newWall = input.newWall;
|
|
9
|
+
var walls = wallAndFeatures.walls, features = wallAndFeatures.features;
|
|
10
|
+
if (!walls.length || !Object.values(features).flat().length)
|
|
11
|
+
return false;
|
|
12
|
+
var intersectingFeature;
|
|
13
|
+
for (var i = 0; i < walls.length && !intersectingFeature; i++) {
|
|
14
|
+
if (!walls[i].connections)
|
|
15
|
+
continue;
|
|
16
|
+
var intersectionPoint = (0, geometry_1.getLineSegmentsIntersection)(newWall.line, walls[i].line);
|
|
17
|
+
if (!intersectionPoint)
|
|
18
|
+
continue;
|
|
19
|
+
var intersectionOffset = (0, geometry_1.getLengthOfLineSegment)([
|
|
20
|
+
walls[i].line[0],
|
|
21
|
+
intersectionPoint,
|
|
22
|
+
]);
|
|
23
|
+
for (var j = 0; j < walls[i].connections.length && !intersectingFeature; j++) {
|
|
24
|
+
var _b = walls[i].connections[j], type = _b[0], index = _b[1];
|
|
25
|
+
var feature = (_a = features[type]) === null || _a === void 0 ? void 0 : _a[index];
|
|
26
|
+
if (!feature)
|
|
27
|
+
continue;
|
|
28
|
+
if (feature.offset < intersectionOffset &&
|
|
29
|
+
intersectionOffset < feature.offset + feature.length)
|
|
30
|
+
intersectingFeature = { type: type, index: index };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (!intersectingFeature)
|
|
34
|
+
return false;
|
|
35
|
+
return ({
|
|
36
|
+
address: intersectingFeature,
|
|
37
|
+
message: messaging_1.errorMessages.addWallCollidingWithFeature(intersectingFeature.type),
|
|
38
|
+
type: types_1.IErrorTypes.SOFT,
|
|
39
|
+
} || false);
|
|
40
|
+
}
|
|
41
|
+
exports.default = isWallIntersectingFeature;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IErrorElement, IAddWallValidatorInput, ISharedValidatorInput } from '../types';
|
|
2
|
+
declare function isWallOverlappingExisitingWalls(input: IAddWallValidatorInput, wallAndFeatures: ISharedValidatorInput): false | IErrorElement;
|
|
3
|
+
export default isWallOverlappingExisitingWalls;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var geometry_1 = require("../geometry");
|
|
4
|
+
var messaging_1 = require("./messaging");
|
|
5
|
+
var types_1 = require("../types");
|
|
6
|
+
function isWallOverlappingExisitingWalls(input, wallAndFeatures) {
|
|
7
|
+
var newWall = input.newWall;
|
|
8
|
+
var walls = wallAndFeatures.walls;
|
|
9
|
+
var start = newWall.start, end = newWall.end;
|
|
10
|
+
if (start.type === types_1.IElements.WALL &&
|
|
11
|
+
(end === null || end === void 0 ? void 0 : end.type) === types_1.IElements.WALL &&
|
|
12
|
+
start.index === end.index) {
|
|
13
|
+
return {
|
|
14
|
+
address: {
|
|
15
|
+
type: types_1.IElements.WALL,
|
|
16
|
+
index: start.index,
|
|
17
|
+
},
|
|
18
|
+
type: types_1.IErrorTypes.SOFT,
|
|
19
|
+
message: messaging_1.errorMessages.wallsNotUnique(),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
var overlappingIndex = walls.findIndex(function (wall, i) {
|
|
23
|
+
var line = wall.line;
|
|
24
|
+
if ((0, geometry_1.areLinesEqual)(line, newWall.line))
|
|
25
|
+
return true;
|
|
26
|
+
if (start.type === types_1.IElements.VERTEX &&
|
|
27
|
+
((0, geometry_1.arePointsEqual)(start.point, line[0]) ||
|
|
28
|
+
(0, geometry_1.arePointsEqual)(start.point, line[1])) &&
|
|
29
|
+
(end === null || end === void 0 ? void 0 : end.type) === types_1.IElements.WALL &&
|
|
30
|
+
end.index === i) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
if ((end === null || end === void 0 ? void 0 : end.type) === types_1.IElements.VERTEX &&
|
|
34
|
+
((0, geometry_1.arePointsEqual)(end.point, line[0]) ||
|
|
35
|
+
(0, geometry_1.arePointsEqual)(end.point, line[1])) &&
|
|
36
|
+
start.type === types_1.IElements.WALL &&
|
|
37
|
+
start.index === i) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
});
|
|
42
|
+
if (overlappingIndex !== -1) {
|
|
43
|
+
return {
|
|
44
|
+
address: {
|
|
45
|
+
type: types_1.IElements.WALL,
|
|
46
|
+
index: overlappingIndex,
|
|
47
|
+
},
|
|
48
|
+
type: types_1.IErrorTypes.SOFT,
|
|
49
|
+
message: messaging_1.errorMessages.wallsNotUnique(),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
exports.default = isWallOverlappingExisitingWalls;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IAddWallValidatorInput, ISharedValidatorInput, IErrorElement, IWallsValidationConfig } from '../types';
|
|
2
|
+
declare function isWallTooShort(input: IAddWallValidatorInput, _: ISharedValidatorInput, validationConfig: IWallsValidationConfig): false | IErrorElement;
|
|
3
|
+
export default isWallTooShort;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var isLineTooShort_1 = __importDefault(require("./isLineTooShort"));
|
|
7
|
+
function isWallTooShort(input, _, validationConfig) {
|
|
8
|
+
return (0, isLineTooShort_1.default)(input.newWall.line, validationConfig);
|
|
9
|
+
}
|
|
10
|
+
exports.default = isWallTooShort;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.errorMessages = void 0;
|
|
4
|
-
var constants_1 = require("
|
|
4
|
+
var constants_1 = require("../constants");
|
|
5
5
|
exports.errorMessages = {
|
|
6
6
|
addWallCollidingWithWall: function () { return 'Wall cannot collide with another wall.'; },
|
|
7
7
|
addWallCollidingWithFeature: function (feature) {
|
|
@@ -5,7 +5,7 @@ interface HydratedWishlistItem extends IConfigurationResponse {
|
|
|
5
5
|
handleRemove: () => void;
|
|
6
6
|
handleShare: () => void;
|
|
7
7
|
}
|
|
8
|
-
type UseWishlistHook = [
|
|
8
|
+
declare type UseWishlistHook = [
|
|
9
9
|
Array<HydratedWishlistItem>,
|
|
10
10
|
(config?: Omit<ISaveConfiguration, 'configuration'>) => void,
|
|
11
11
|
() => void
|
package/dist/http/assets.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type ITranslationsMap = Record<string, string>;
|
|
1
|
+
export declare type ITranslationsMap = Record<string, string>;
|
|
2
2
|
export declare const getTranslationsForLocale: (locale: string) => Promise<import("axios").AxiosResponse<ITranslationsMap>>;
|
package/dist/http/orders.d.ts
CHANGED