kitchen-simulator 4.4.1 → 4.4.2-new-json

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 (51) hide show
  1. package/es/LiteRenderer.js +15 -53
  2. package/es/catalog/factories/area-factory-3d.js +0 -4
  3. package/es/catalog/holes/door-double/door_double.png +0 -0
  4. package/es/catalog/holes/door-panic/panicDoor.png +0 -0
  5. package/es/catalog/holes/door-panic-double/panicDoorDouble.png +0 -0
  6. package/es/catalog/holes/gate/gate.jpg +0 -0
  7. package/es/catalog/holes/window-clear/texture.png +0 -0
  8. package/es/catalog/holes/window-cross/texture.png +0 -0
  9. package/es/catalog/holes/window-double-hung/texture.png +0 -0
  10. package/es/catalog/holes/window-vertical/texture.png +0 -0
  11. package/es/catalog/utils/item-loader.js +3 -22
  12. package/es/class/item.js +1 -1
  13. package/es/constants/catalog/skinPanel.js +9 -0
  14. package/es/constants.js +11 -13
  15. package/es/devLiteRenderer.js +91 -109
  16. package/es/mappings/external-events/mapExternalEventPayload.js +21 -0
  17. package/es/mappings/external-events/mappers/addItemMapper.js +86 -0
  18. package/es/mappings/external-events/mappers/ccdfMapper.js +101 -0
  19. package/es/mappings/external-events/mappers/changeDoorStyleMapper.js +65 -0
  20. package/es/mappings/holesToCatalog.js +139 -0
  21. package/es/models.js +3 -1
  22. package/es/utils/helper.js +18 -9
  23. package/es/utils/isolate-event-handler.js +621 -173
  24. package/es/utils/molding.js +20 -236
  25. package/es/utils/skinPanelEngine.js +230 -26
  26. package/lib/LiteRenderer.js +17 -55
  27. package/lib/catalog/factories/area-factory-3d.js +0 -4
  28. package/lib/catalog/holes/door-double/door_double.png +0 -0
  29. package/lib/catalog/holes/door-panic/panicDoor.png +0 -0
  30. package/lib/catalog/holes/door-panic-double/panicDoorDouble.png +0 -0
  31. package/lib/catalog/holes/gate/gate.jpg +0 -0
  32. package/lib/catalog/holes/window-clear/texture.png +0 -0
  33. package/lib/catalog/holes/window-cross/texture.png +0 -0
  34. package/lib/catalog/holes/window-double-hung/texture.png +0 -0
  35. package/lib/catalog/holes/window-vertical/texture.png +0 -0
  36. package/lib/catalog/utils/item-loader.js +2 -21
  37. package/lib/class/item.js +1 -1
  38. package/lib/constants/catalog/skinPanel.js +15 -0
  39. package/lib/constants.js +16 -18
  40. package/lib/devLiteRenderer.js +93 -111
  41. package/lib/mappings/external-events/mapExternalEventPayload.js +26 -0
  42. package/lib/mappings/external-events/mappers/addItemMapper.js +92 -0
  43. package/lib/mappings/external-events/mappers/ccdfMapper.js +108 -0
  44. package/lib/mappings/external-events/mappers/changeDoorStyleMapper.js +72 -0
  45. package/lib/mappings/holesToCatalog.js +148 -0
  46. package/lib/models.js +3 -1
  47. package/lib/utils/helper.js +20 -9
  48. package/lib/utils/isolate-event-handler.js +620 -172
  49. package/lib/utils/molding.js +20 -237
  50. package/lib/utils/skinPanelEngine.js +232 -28
  51. package/package.json +1 -1
@@ -1,19 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
5
- import _createClass from "@babel/runtime/helpers/esm/createClass";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
- import _inherits from "@babel/runtime/helpers/esm/inherits";
9
- var _excluded = ["width", "height", "configData", "externalEvent", "onInternalEvent", "onError"];
4
+ var _excluded = ["width", "height", "configData", "externalEvent", "onInternalEvent", "onError", "holes"];
10
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
7
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
13
8
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
14
9
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
15
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
16
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
17
10
  // LiteRenderer.jsx
18
11
  import React, { useCallback, useEffect, useMemo, useRef } from 'react';
19
12
  import PropTypes from 'prop-types';
@@ -29,7 +22,7 @@ import AppContext from "./AppContext";
29
22
  import Catalog from "./catalog/catalog";
30
23
  import * as Areas from "./catalog/areas/area/planner-element";
31
24
  import * as Lines from "./catalog/lines/wall/planner-element";
32
- import * as Holes from "./catalog/holes/export";
25
+ import { buildHoleElements, registerDynamicHoles } from "./mappings/holesToCatalog";
33
26
  import { ConsoleDebugger, Keyboard } from "./plugins/export";
34
27
  import LiteKitchenConfigurator from "./LiteKitchenConfigurator";
35
28
  var isBrowser = typeof window !== 'undefined';
@@ -80,50 +73,15 @@ function serializeError(err) {
80
73
  }
81
74
  }
82
75
 
83
- /* ---------- Error Boundary that pushes into buffer ---------- */
84
- var ToolErrorBoundary = /*#__PURE__*/function (_React$Component) {
85
- function ToolErrorBoundary() {
86
- _classCallCheck(this, ToolErrorBoundary);
87
- return _callSuper(this, ToolErrorBoundary, arguments);
88
- }
89
- _inherits(ToolErrorBoundary, _React$Component);
90
- return _createClass(ToolErrorBoundary, [{
91
- key: "componentDidCatch",
92
- value: function componentDidCatch(error, info) {
93
- var pushError = this.props.pushError;
94
- pushError({
95
- type: 'render-error',
96
- error: serializeError(error),
97
- info: {
98
- componentStack: info === null || info === void 0 ? void 0 : info.componentStack
99
- }
100
- });
101
- }
102
- }, {
103
- key: "render",
104
- value: function render() {
105
- return this.props.children;
106
- }
107
- }]);
108
- }(React.Component);
109
- ToolErrorBoundary.propTypes = {
110
- pushError: PropTypes.func.isRequired,
111
- children: PropTypes.any
112
- };
113
-
114
76
  // ----------------- catalog init -----------------
115
77
  function initCatalogOnce(catalog) {
116
78
  if (!catalog) return;
117
- if (catalog.__ksInitialized) return;
118
- for (var x in Areas) catalog.registerElement(Areas[x]);
119
- for (var _x in Lines) catalog.registerElement(Lines[_x]);
120
- for (var _x2 in Holes) catalog.registerElement(Holes[_x2]);
121
- catalog.registerCategory('Windows', 'Windows', [Holes.windowClear, Holes.windowCross, Holes.windowDoubleHung, Holes.windowVertical]);
122
- catalog.registerCategory('Doors', 'Doors', [Holes.doorInterior, Holes.doorExterior, Holes.doorCloset, Holes.doorSliding, Holes.doorwayFramed, Holes.doorwayFrameless]);
123
- catalog.__ksInitialized = true;
79
+ if (!catalog.__ksInitialized) {
80
+ for (var x in Areas) catalog.registerElement(Areas[x]);
81
+ for (var _x in Lines) catalog.registerElement(Lines[_x]);
82
+ catalog.__ksInitialized = true;
83
+ }
124
84
  }
125
-
126
- // ----------------- store factory -----------------
127
85
  function createInstanceStore() {
128
86
  var AppState = Map({
129
87
  KitchenConfigurator: new State()
@@ -164,7 +122,11 @@ export default function LiteRenderer(props) {
164
122
  externalEvent = props.externalEvent,
165
123
  onInternalEvent = props.onInternalEvent,
166
124
  onError = props.onError,
125
+ holes = props.holes,
167
126
  passThrough = _objectWithoutProperties(props, _excluded);
127
+ var holePayload = useMemo(function () {
128
+ return buildHoleElements(holes);
129
+ }, [holes]);
168
130
 
169
131
  // ✅ instance-scoped store (no module singleton)
170
132
  var storeRef = useRef(null);
@@ -174,8 +136,9 @@ export default function LiteRenderer(props) {
174
136
  var catalogRef = useRef(null);
175
137
  if (!catalogRef.current) {
176
138
  catalogRef.current = new Catalog();
177
- initCatalogOnce(catalogRef.current);
178
139
  }
140
+ initCatalogOnce(catalogRef.current);
141
+ registerDynamicHoles(catalogRef.current, holePayload);
179
142
 
180
143
  // ✅ stable plugins array
181
144
  var plugins = useMemo(function () {
@@ -313,8 +276,6 @@ export default function LiteRenderer(props) {
313
276
  companyUrl = _ref.companyUrl;
314
277
  return /*#__PURE__*/React.createElement(AppContext.Provider, null, /*#__PURE__*/React.createElement(Provider, {
315
278
  store: storeRef.current
316
- }, /*#__PURE__*/React.createElement(ToolErrorBoundary, {
317
- pushError: pushError
318
279
  }, /*#__PURE__*/React.createElement(LiteKitchenConfigurator, _extends({
319
280
  catalog: catalogRef.current,
320
281
  width: width,
@@ -328,7 +289,7 @@ export default function LiteRenderer(props) {
328
289
  configData: configData,
329
290
  externalEvent: externalEvent,
330
291
  onInternalEvent: onInternalEvent
331
- }, passThrough)))));
292
+ }, passThrough))));
332
293
  }
333
294
  LiteRenderer.propTypes = {
334
295
  width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
@@ -348,5 +309,6 @@ LiteRenderer.propTypes = {
348
309
  externalEvent: PropTypes.object,
349
310
  onInternalEvent: PropTypes.func,
350
311
  onError: PropTypes.func,
312
+ holes: PropTypes.array,
351
313
  store: PropTypes.object
352
314
  };
@@ -75,10 +75,6 @@ export function createArea(element, layer, scene, textures) {
75
75
  } else {
76
76
  color = SharedStyle.AREA_MESH_COLOR.unselected;
77
77
  }
78
- if (texture.uri === undefined || texture.uri == '') {
79
- // @todo THIS IS A TEMPORARY FIX TO HAVE A DEFAULT FLOOR TEXTURE
80
- texture.uri = layer.floorStyle.uri || 'https://media.test.diydesignspace.com/uploads/CountTop/202203162950_2/texture/oak-barcelona-s.jpg';
81
- }
82
78
  var shape = new Shape();
83
79
  shape.moveTo(vertices[0].x, vertices[0].y);
84
80
  for (var i = 1; i < vertices.length; i++) {
Binary file
@@ -12,7 +12,7 @@ import { ARROW_COLOR, BASE_CABINET_LAYOUTPOS, OBJTYPE_GROUP, OBJTYPE_MESH, SHADE
12
12
  import { Item } from "../../models";
13
13
  import * as GeomUtils from "./geom-utils";
14
14
  import { loadGLTF } from "./load-obj";
15
- import { animateDoor, isEmpty, translateDrawer } from "../../utils/helper";
15
+ import { animateDoor, getSkuAliasFromCatalogElement, isEmpty, translateDrawer } from "../../utils/helper";
16
16
  import { isWarningItem } from "../../components/viewer2d/utils";
17
17
  var INITIAL_NORMAL_MAP = '';
18
18
 
@@ -122,23 +122,8 @@ export function render2DItem(element, layer, scene, sizeinfo, layoutpos, is_corn
122
122
  var lineCount = 0; //parseInt(((newWidth) / 8 - 0.51).toFixed(), 10) - 1;
123
123
  var rowCount = 0; //parseInt((element.type.length / lineCount - 0.51).toFixed(), 10);
124
124
 
125
- // Get type
126
- var objSKU = this.obj.sku_number;
127
- if (objSKU.length !== 0) {
128
- var dcId,
129
- doorStyle = element.doorStyle;
130
- if (doorStyle instanceof Map) {
131
- dcId = doorStyle.get('id');
132
- } else {
133
- dcId = doorStyle.id;
134
- }
135
- var skuItem = this.obj.skuArray.find(function (el) {
136
- return el.door_color_id === dcId;
137
- });
138
- if (skuItem !== undefined) {
139
- objSKU = skuItem.sku;
140
- }
141
- }
125
+ // Get SKU Alias
126
+ var objSKU = getSkuAliasFromCatalogElement(this, element);
142
127
  if (rowCount > 0) {
143
128
  for (var _x = 0; _x < rowCount; _x++) {
144
129
  splitStr.push(objSKU.slice(lineCount * _x, lineCount * (_x + 1)));
@@ -1003,10 +988,6 @@ export function render3DItem(element, layer, scene, sizeinfo, structure_json, is
1003
988
  if (isEmpty(counterTop.uri) && !isEmpty(layer === null || layer === void 0 || (_layer$toJS = layer.toJS()) === null || _layer$toJS === void 0 ? void 0 : _layer$toJS.counterTop.uri)) {
1004
989
  counterTop.uri = layer.toJS().counterTop.uri;
1005
990
  }
1006
- if (isEmpty(counterTop.uri)) {
1007
- //@todo THIS IS A TEMPORARY FIX FOR COUNTERTOP TEXTURE UNDEFINED ISSUE
1008
- counterTop.uri = 'https://media.test.diydesignspace.com/uploads/CountTop/202105074107_5/texture/Unique_Calcatta_texture.jpg';
1009
- }
1010
991
  var countTopMap = counterTop.uri;
1011
992
  var interiorMap = doorStyles.get('interior');
1012
993
  var countT = loadTexture(countTopMap);
package/es/class/item.js CHANGED
@@ -552,7 +552,7 @@ var Item = /*#__PURE__*/function () {
552
552
  if (!isEmpty(currentObject === null || currentObject === void 0 || (_currentObject$counte = currentObject.counterTop) === null || _currentObject$counte === void 0 ? void 0 : _currentObject$counte.uri)) {
553
553
  var _currentObject$counte2;
554
554
  counterTopURI = currentObject === null || currentObject === void 0 || (_currentObject$counte2 = currentObject.counterTop) === null || _currentObject$counte2 === void 0 ? void 0 : _currentObject$counte2.uri;
555
- } else if (!isEmpty(state.getIn(['scene', 'layers', 'layer-1', 'counterTop']))) counterTopURI = state.getIn(['scene', 'layers', 'layer-1', 'counterTop']).uri;else counterTopURI = 'https://media.test.diydesignspace.com/uploads/CountTop/202105074107_5/texture/Unique_Calcatta_texture.jpg';
555
+ } else if (!isEmpty(state.getIn(['scene', 'layers', 'layer-1', 'counterTop']))) counterTopURI = state.getIn(['scene', 'layers', 'layer-1', 'counterTop']).uri;
556
556
  state = this.remove(state, state.scene.selectedLayer, selectedPos.selectedItemId).updatedState;
557
557
  state = this.create(state, state.scene.selectedLayer, selectedObject.name, selectedPos.x, selectedPos.y, selectedObject.info.width, selectedObject.info.height, selectedPos.rotation, false, [], false, null, counterTopURI).updatedState;
558
558
  // state = this.select(state, state.scene.selectedLayer, selectedPos.selectedItemId).updatedState;
@@ -0,0 +1,9 @@
1
+ // skin panel SKU
2
+ export var SKIN_SKU_BSV_24 = 'BSV'; // 23.25" x 34.5" : For base cabinets
3
+ export var SKIN_SKU_BSV_48 = 'BSV48'; // 48" x 34.5" : For base cabinets back-to-back or island backs
4
+ export var SKIN_SKU_WSV_1242 = 'WSV1242'; // 11.25" x 42" : For 12" deep wall cabinets
5
+ export var SKIN_SKU_WSV_2442 = 'WSV2442'; // 23.25" x 42" : For 24" deep wall cabinets
6
+ export var SKIN_SKU_WSV_2460 = 'WSV2460'; // Usually used for CT3DR or CT2DR SKUs + stacked wall cabinets
7
+ export var SKIN_SKU_USV245325 = 'USV2453.25'; // 23.25" x 53.25" : For tall cabinets
8
+
9
+ export var SKIN_HEIGHT_53_25 = 53.25; // in inch, height of the skin with SKU USV245325
package/es/constants.js CHANGED
@@ -452,7 +452,7 @@ export var UNIT_FOOT = 'ft';
452
452
  export var UNIT_MILE = 'mi';
453
453
  export var UNITS_LENGTH = [UNIT_MILLIMETER, UNIT_CENTIMETER, UNIT_METER, UNIT_INCH, UNIT_FOOT, UNIT_MILE];
454
454
  export var CEIL_UNITS_LENGTH = [UNIT_CENTIMETER, UNIT_METER, UNIT_INCH, UNIT_FOOT];
455
- export var EPSILON = 1e-2;
455
+ export var EPSILON = 0.5;
456
456
 
457
457
  // distance between item and wall
458
458
  export var DISTANCE_EPSILON = 5.0; //5.08; // 2 inch
@@ -657,16 +657,16 @@ export var PROJECT_SETTING_OPTION = {
657
657
  CHANGE_MEASUREMENT_UNIT: CHANGE_MEASUREMENT_UNIT
658
658
  };
659
659
  export var HOLE_NAMES = {
660
- WINDOW_CLEAR: 'Window',
661
- WINDOW_CROSS: 'Cross Window',
662
- WINDOW_DOUBLE_HUNG: 'Double Hung Window',
663
- WINDOW_VERTICAL: 'window-vertical',
660
+ WINDOW_CLEAR: 'Clear',
661
+ WINDOW_CROSS: 'Cross',
662
+ WINDOW_DOUBLE_HUNG: 'Double Hung',
663
+ WINDOW_VERTICAL: 'Vertical',
664
664
  DOOR_CLOSET: 'Closet',
665
665
  DOOR_EXTERIOR: 'Exterior',
666
666
  DOOR_INTERIOR: 'Interior',
667
667
  DOOR_SLIDING: 'Sliding',
668
668
  DOOR_FRAMED: 'Framed Doorway',
669
- DOOR_FRAMELESS: 'FrameLess Doorway'
669
+ DOOR_FRAMELESS: 'Frameless Doorway'
670
670
  };
671
671
 
672
672
  // direction type
@@ -771,11 +771,9 @@ export var ROOM_SHAPE_TYPE = {
771
771
  export var DOORSTYLE_SCOPE_ALL = 'all';
772
772
  export var DOORSTYLE_SCOPE_SINGLE = 'single';
773
773
  export var DOORSTYLE_SCOPE_MULTIPLE = 'multiple';
774
+ export var DEFAULT_MOLDING_PIECE_LENGTH = 96; // in inch, 8 feet, standard length for molding pieces
774
775
 
775
- // skin panel SKU
776
- export var SKIN_SKU_BSV_24 = 'BSV24'; // 23.25" x 34.5" : For base cabinets
777
- export var SKIN_SKU_BSV_48 = 'BSV48'; // 48" x 34.5" : For base cabinets back-to-back or island backs
778
- export var SKIN_SKU_WSV_1242 = 'WSV1242'; // 11.25" x 42" : For 12" deep wall cabinets
779
- export var SKIN_SKU_WSV_2442 = 'WSV2442'; // 23.25" x 42" : For 24" deep wall cabinets
780
- export var SKIN_SKU_WSV_2460 = 'WSV2460'; // Usually used for CT3DR or CT2DR SKUs + stacked wall cabinets
781
- export var SKIN_SKU_USV245325 = 'USV2453.25'; // 23.25" x 53.25" : For tall cabinets
776
+ // default urls
777
+
778
+ export var DEFAULT_INTERIOR_URL = 'http://localhost:4002/uploads/assets/default/maple.jpg';
779
+ export var DEFAULT_DOOR_HANDLE_TEXTURE_URL = 'http://127.0.0.1:4002/uploads/assets/default/steel.jpg';