kitchen-simulator 4.1.0-react-18 → 4.1.1

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/README.md +3 -0
  2. package/es/AppContext.js +1 -1
  3. package/es/LiteKitchenConfigurator.js +162 -111
  4. package/es/LiteRenderer.js +161 -129
  5. package/es/actions/export.js +25 -12
  6. package/es/assets/gltf/door_sliding.bin +0 -0
  7. package/es/assets/img/svg/bottombar/elevation.svg +12 -5
  8. package/es/catalog/catalog.js +21 -5
  9. package/es/catalog/factories/area-factory-3d.js +17 -17
  10. package/es/catalog/factories/wall-factory.js +1 -1
  11. package/es/catalog/holes/window-clear/planner-element.js +2 -2
  12. package/es/catalog/properties/export.js +21 -0
  13. package/es/catalog/properties/property-checkbox.js +68 -0
  14. package/es/catalog/properties/property-color.js +39 -0
  15. package/es/catalog/properties/property-enum.js +50 -0
  16. package/es/catalog/properties/property-hidden.js +19 -0
  17. package/es/catalog/properties/property-lenght-measure.js +100 -0
  18. package/es/catalog/properties/property-length-measure.js +84 -0
  19. package/es/catalog/properties/property-length-measure_hole.js +100 -0
  20. package/es/catalog/properties/property-number.js +48 -0
  21. package/es/catalog/properties/property-read-only.js +26 -0
  22. package/es/catalog/properties/property-string.js +48 -0
  23. package/es/catalog/properties/property-toggle.js +39 -0
  24. package/es/catalog/properties/shared-property-style.js +14 -0
  25. package/es/catalog/utils/exporter.js +24 -11
  26. package/es/catalog/utils/item-loader.js +222 -213
  27. package/es/class/hole.js +0 -2
  28. package/es/class/item.js +89 -70
  29. package/es/class/layer.js +1 -1
  30. package/es/class/line.js +4 -8
  31. package/es/class/project.js +97 -80
  32. package/es/components/content.js +5 -93
  33. package/es/components/export.js +4 -6
  34. package/es/components/style/button.js +106 -0
  35. package/es/components/style/cancel-button.js +21 -0
  36. package/es/components/style/content-container.js +30 -0
  37. package/es/components/style/content-title.js +25 -0
  38. package/es/components/style/delete-button.js +24 -0
  39. package/es/components/style/export.js +28 -2
  40. package/es/components/style/form-block.js +20 -0
  41. package/es/components/style/form-color-input.js +26 -0
  42. package/es/components/style/form-label.js +22 -0
  43. package/es/components/style/form-number-input.js +29 -27
  44. package/es/components/style/form-number-input_2.js +200 -0
  45. package/es/components/style/form-select.js +19 -0
  46. package/es/components/style/form-slider.js +60 -0
  47. package/es/components/style/form-submit-button.js +25 -0
  48. package/es/components/style/form-text-input.js +69 -0
  49. package/es/components/viewer2d/grids/grid-streak.js +1 -1
  50. package/es/components/viewer2d/group.js +5 -4
  51. package/es/components/viewer2d/item.js +155 -359
  52. package/es/components/viewer2d/layer.js +1 -1
  53. package/es/components/viewer2d/line.js +22 -52
  54. package/es/components/viewer2d/ruler.js +16 -11
  55. package/es/components/viewer2d/rulerDist.js +38 -51
  56. package/es/components/viewer2d/rulerX.js +4 -2
  57. package/es/components/viewer2d/rulerY.js +3 -0
  58. package/es/components/viewer2d/scene.js +17 -12
  59. package/es/components/viewer2d/state.js +1 -1
  60. package/es/components/viewer2d/utils.js +2 -2
  61. package/es/components/viewer2d/vertex.js +3 -2
  62. package/es/components/viewer2d/viewer2d.js +56 -87
  63. package/es/components/viewer3d/ruler-utils/scene3D.js +1 -1
  64. package/es/components/viewer3d/scene-creator.js +255 -58
  65. package/es/components/viewer3d/viewer3d-first-person.js +24 -26
  66. package/es/components/viewer3d/viewer3d.js +103 -124
  67. package/es/constants.js +7 -2
  68. package/es/devLiteRenderer.js +491 -150
  69. package/es/index.js +590 -21
  70. package/es/models.js +13 -8
  71. package/es/plugins/SVGLoader.js +1414 -0
  72. package/es/plugins/console-debugger.js +34 -0
  73. package/es/plugins/export.js +7 -0
  74. package/es/plugins/keyboard.js +110 -0
  75. package/es/reducers/project-reducer.js +3 -0
  76. package/es/reducers/viewer2d-reducer.js +3 -1
  77. package/es/reducers/viewer3d-reducer.js +3 -1
  78. package/es/styles/export.js +5 -0
  79. package/es/styles/tabs.css +40 -0
  80. package/es/utils/geometry.js +77 -119
  81. package/es/utils/helper.js +38 -1
  82. package/es/utils/isolate-event-handler.js +827 -607
  83. package/es/utils/molding.js +459 -11
  84. package/es/utils/ruler.js +58 -0
  85. package/lib/AppContext.js +1 -1
  86. package/lib/LiteKitchenConfigurator.js +161 -111
  87. package/lib/LiteRenderer.js +160 -129
  88. package/lib/actions/export.js +35 -39
  89. package/lib/assets/gltf/door_sliding.bin +0 -0
  90. package/lib/assets/img/svg/bottombar/elevation.svg +12 -5
  91. package/lib/catalog/catalog.js +20 -4
  92. package/lib/catalog/factories/area-factory-3d.js +14 -14
  93. package/lib/catalog/factories/wall-factory.js +1 -1
  94. package/lib/catalog/holes/window-clear/planner-element.js +2 -2
  95. package/lib/catalog/properties/export.js +81 -0
  96. package/lib/catalog/properties/property-checkbox.js +76 -0
  97. package/lib/catalog/properties/property-color.js +47 -0
  98. package/lib/catalog/properties/property-enum.js +58 -0
  99. package/lib/catalog/properties/property-hidden.js +27 -0
  100. package/lib/catalog/properties/property-lenght-measure.js +108 -0
  101. package/lib/catalog/properties/property-length-measure.js +92 -0
  102. package/lib/catalog/properties/property-length-measure_hole.js +108 -0
  103. package/lib/catalog/properties/property-number.js +56 -0
  104. package/lib/catalog/properties/property-read-only.js +34 -0
  105. package/lib/catalog/properties/property-string.js +56 -0
  106. package/lib/catalog/properties/property-toggle.js +47 -0
  107. package/lib/catalog/properties/shared-property-style.js +21 -0
  108. package/lib/catalog/utils/exporter.js +24 -11
  109. package/lib/catalog/utils/item-loader.js +219 -210
  110. package/lib/class/hole.js +0 -2
  111. package/lib/class/item.js +87 -68
  112. package/lib/class/layer.js +1 -1
  113. package/lib/class/line.js +3 -7
  114. package/lib/class/project.js +97 -80
  115. package/lib/components/content.js +5 -93
  116. package/lib/components/export.js +6 -26
  117. package/lib/components/style/button.js +115 -0
  118. package/lib/components/style/cancel-button.js +29 -0
  119. package/lib/components/style/content-container.js +38 -0
  120. package/lib/components/style/content-title.js +35 -0
  121. package/lib/components/style/delete-button.js +34 -0
  122. package/lib/components/style/export.js +105 -1
  123. package/lib/components/style/form-block.js +28 -0
  124. package/lib/components/style/form-color-input.js +34 -0
  125. package/lib/components/style/form-label.js +30 -0
  126. package/lib/components/style/form-number-input.js +29 -27
  127. package/lib/components/style/form-number-input_2.js +209 -0
  128. package/lib/components/style/form-select.js +29 -0
  129. package/lib/components/style/form-slider.js +68 -0
  130. package/lib/components/style/form-submit-button.js +35 -0
  131. package/lib/components/style/form-text-input.js +78 -0
  132. package/lib/components/viewer2d/grids/grid-streak.js +1 -1
  133. package/lib/components/viewer2d/group.js +5 -4
  134. package/lib/components/viewer2d/item.js +152 -356
  135. package/lib/components/viewer2d/layer.js +1 -1
  136. package/lib/components/viewer2d/line.js +22 -52
  137. package/lib/components/viewer2d/ruler.js +15 -10
  138. package/lib/components/viewer2d/rulerDist.js +38 -51
  139. package/lib/components/viewer2d/rulerX.js +4 -2
  140. package/lib/components/viewer2d/rulerY.js +3 -0
  141. package/lib/components/viewer2d/scene.js +17 -12
  142. package/lib/components/viewer2d/state.js +1 -1
  143. package/lib/components/viewer2d/utils.js +2 -2
  144. package/lib/components/viewer2d/vertex.js +3 -2
  145. package/lib/components/viewer2d/viewer2d.js +54 -84
  146. package/lib/components/viewer3d/ruler-utils/scene3D.js +1 -1
  147. package/lib/components/viewer3d/scene-creator.js +252 -55
  148. package/lib/components/viewer3d/viewer3d-first-person.js +24 -26
  149. package/lib/components/viewer3d/viewer3d.js +100 -120
  150. package/lib/constants.js +12 -7
  151. package/lib/devLiteRenderer.js +489 -148
  152. package/lib/index.js +592 -21
  153. package/lib/models.js +13 -8
  154. package/lib/plugins/SVGLoader.js +1419 -0
  155. package/lib/plugins/console-debugger.js +42 -0
  156. package/lib/plugins/export.js +25 -0
  157. package/lib/plugins/keyboard.js +117 -0
  158. package/lib/reducers/project-reducer.js +3 -0
  159. package/lib/reducers/viewer2d-reducer.js +3 -1
  160. package/lib/reducers/viewer3d-reducer.js +3 -1
  161. package/lib/styles/export.js +13 -0
  162. package/lib/styles/tabs.css +40 -0
  163. package/lib/utils/geometry.js +77 -119
  164. package/lib/utils/helper.js +40 -1
  165. package/lib/utils/isolate-event-handler.js +827 -606
  166. package/lib/utils/molding.js +460 -9
  167. package/lib/utils/ruler.js +63 -0
  168. package/package.json +20 -15
  169. package/es/mocks/appliancePayload.json +0 -27
  170. package/es/mocks/cabinetPayload.json +0 -1914
  171. package/es/mocks/cabinetPayload2.json +0 -76
  172. package/es/mocks/dataBundle2.json +0 -4
  173. package/es/mocks/distancePayload.json +0 -6
  174. package/es/mocks/doorStylePayload2.json +0 -84
  175. package/es/mocks/furnishingPayload.json +0 -23
  176. package/es/mocks/itemCDSPayload.json +0 -27
  177. package/es/mocks/lightingPayload.json +0 -23
  178. package/es/mocks/mockProps.json +0 -43
  179. package/es/mocks/mockProps2.json +0 -9
  180. package/es/mocks/moldingPayload.json +0 -19
  181. package/es/mocks/projectItemsCatalog.json +0 -133
  182. package/es/mocks/rectangleShape.json +0 -238
  183. package/es/mocks/replaceCabinetPayload.json +0 -81
  184. package/es/mocks/roomShapePayload.json +0 -5
  185. package/es/useAppContext.js +0 -8
  186. package/lib/mocks/appliancePayload.json +0 -27
  187. package/lib/mocks/cabinetPayload.json +0 -1914
  188. package/lib/mocks/cabinetPayload2.json +0 -76
  189. package/lib/mocks/dataBundle2.json +0 -4
  190. package/lib/mocks/distancePayload.json +0 -6
  191. package/lib/mocks/doorStylePayload2.json +0 -84
  192. package/lib/mocks/furnishingPayload.json +0 -23
  193. package/lib/mocks/itemCDSPayload.json +0 -27
  194. package/lib/mocks/lightingPayload.json +0 -23
  195. package/lib/mocks/mockProps.json +0 -43
  196. package/lib/mocks/mockProps2.json +0 -9
  197. package/lib/mocks/moldingPayload.json +0 -19
  198. package/lib/mocks/projectItemsCatalog.json +0 -133
  199. package/lib/mocks/rectangleShape.json +0 -238
  200. package/lib/mocks/replaceCabinetPayload.json +0 -81
  201. package/lib/mocks/roomShapePayload.json +0 -5
  202. package/lib/useAppContext.js +0 -16
@@ -1,5 +1,4 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
4
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
@@ -7,74 +6,57 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
7
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
8
7
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
9
8
  import _inherits from "@babel/runtime/helpers/esm/inherits";
10
- var _excluded = ["width", "height", "configData", "options", "user", "auth", "featureFlags", "sentry", "analytics", "externalEvent", "onInternalEvent", "onError"];
11
- import _regeneratorRuntime from "@babel/runtime/regenerator";
9
+ var _excluded = ["width", "height", "configData", "externalEvent", "onInternalEvent", "onError"];
12
10
  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; }
13
11
  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
+ 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
+ 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
+ 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; }
14
15
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
15
16
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
16
- import React, { useCallback, useEffect, useRef } from 'react';
17
+ // LiteRenderer.jsx
18
+ import React, { useCallback, useEffect, useMemo, useRef } from 'react';
17
19
  import PropTypes from 'prop-types';
18
20
  import { Provider } from 'react-redux';
19
21
  import { createStore } from 'redux';
22
+ import { Map } from 'immutable';
23
+ import * as Sentry from '@sentry/react';
24
+ import * as THREE from 'three';
20
25
  import * as Models from "./models";
21
26
  import { State } from "./models";
22
27
  import PlannerReducer from "./reducers/reducer";
28
+ import AppContext from "./AppContext";
23
29
  import Catalog from "./catalog/catalog";
24
30
  import * as Areas from "./catalog/areas/area/planner-element";
25
31
  import * as Lines from "./catalog/lines/wall/planner-element";
26
32
  import * as Holes from "./catalog/holes/export";
27
- import { Map } from 'immutable';
28
- import * as Sentry from '@sentry/react';
29
- import * as THREE from 'three';
33
+ import { ConsoleDebugger, Keyboard } from "./plugins/export";
30
34
  import LiteKitchenConfigurator from "./LiteKitchenConfigurator";
31
- if (typeof window !== 'undefined') window.THREE = THREE;
35
+ var isBrowser = typeof window !== 'undefined';
36
+ if (isBrowser) window.THREE = THREE;
32
37
 
33
- /* ============================== component ============================= */
34
- var MyCatalog = new Catalog();
35
- var AppState = Map({
36
- KitchenConfigurator: new State()
37
- });
38
- console.log('Version: 378.45-202509_DIY-364-mbox-crash');
39
- isProduction && Sentry.init({
40
- dsn: process.env.SENTRY_DSN,
41
- environment: process.env.SENTRY_ENVIRONMENT
42
- });
43
-
44
- //define reducer
45
- var reducer = function reducer(state, action) {
46
- state = state || AppState;
47
- state = state.update('KitchenConfigurator', function (plannerState) {
48
- return PlannerReducer(plannerState, action);
38
+ // ---- Keep prior Sentry behavior but ensure it only initializes once ----
39
+ var __sentryInited = false;
40
+ function ensureSentryInit() {
41
+ if (!isBrowser) return;
42
+ // assumes isProduction exists in your build just like today
43
+ if (!isProduction) return;
44
+ if (__sentryInited) return;
45
+ __sentryInited = true;
46
+ Sentry.init({
47
+ dsn: process.env.SENTRY_DSN,
48
+ environment: process.env.SENTRY_ENVIRONMENT
49
49
  });
50
- return state;
51
- };
52
- var store = createStore(reducer, null, !isProduction && window.devToolsExtension ? window.devToolsExtension({
53
- features: {
54
- pause: true,
55
- // start/pause recording of dispatched actions
56
- lock: true,
57
- // lock/unlock dispatching actions and side effects
58
- persist: true,
59
- // persist states on page reloading
60
- "export": true,
61
- // export history of actions in a file
62
- "import": 'custom',
63
- // import history of actions from a file
64
- jump: true,
65
- // jump back and forth (time travelling)
66
- skip: true,
67
- // skip (cancel) actions
68
- reorder: true,
69
- // drag and drop actions in the history list
70
- dispatch: true,
71
- // dispatch custom actions or action creators
72
- test: true // generate tests for the selected actions
73
- },
74
- maxAge: 999999
75
- }) : function (f) {
76
- return f;
77
- });
50
+ }
51
+
52
+ // ---------------- error helpers ----------------
53
+ function safeJson(v) {
54
+ try {
55
+ return JSON.parse(JSON.stringify(v));
56
+ } catch (_unused) {
57
+ return undefined;
58
+ }
59
+ }
78
60
  function serializeError(err) {
79
61
  try {
80
62
  if (!err) return {
@@ -91,19 +73,12 @@ function serializeError(err) {
91
73
  message: String(err),
92
74
  raw: safeJson(err)
93
75
  };
94
- } catch (_unused) {
76
+ } catch (_unused2) {
95
77
  return {
96
78
  message: 'Error serializing error'
97
79
  };
98
80
  }
99
81
  }
100
- function safeJson(v) {
101
- try {
102
- return JSON.parse(JSON.stringify(v));
103
- } catch (_unused2) {
104
- return undefined;
105
- }
106
- }
107
82
 
108
83
  /* ---------- Error Boundary that pushes into buffer ---------- */
109
84
  var ToolErrorBoundary = /*#__PURE__*/function (_React$Component) {
@@ -131,35 +106,139 @@ var ToolErrorBoundary = /*#__PURE__*/function (_React$Component) {
131
106
  }
132
107
  }]);
133
108
  }(React.Component);
109
+ ToolErrorBoundary.propTypes = {
110
+ pushError: PropTypes.func.isRequired,
111
+ children: PropTypes.any
112
+ };
113
+
114
+ // ----------------- catalog init -----------------
115
+ function initCatalogOnce(catalog) {
116
+ 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;
124
+ }
125
+
126
+ // ----------------- store factory -----------------
127
+ function createInstanceStore() {
128
+ var AppState = Map({
129
+ KitchenConfigurator: new State()
130
+ });
131
+ var reducer = function reducer(state, action) {
132
+ state = state || AppState;
133
+ return state.update('KitchenConfigurator', function (plannerState) {
134
+ return PlannerReducer(plannerState, action);
135
+ });
136
+ };
137
+ var enhancer = !isProduction && isBrowser && window.devToolsExtension ? window.devToolsExtension({
138
+ features: {
139
+ pause: true,
140
+ lock: true,
141
+ persist: true,
142
+ "export": true,
143
+ "import": 'custom',
144
+ jump: true,
145
+ skip: true,
146
+ reorder: true,
147
+ dispatch: true,
148
+ test: true
149
+ },
150
+ maxAge: 999999
151
+ }) : function (f) {
152
+ return f;
153
+ };
154
+ return createStore(reducer, null, enhancer);
155
+ }
156
+ function createPlugins() {
157
+ return [Keyboard(), ConsoleDebugger()];
158
+ }
134
159
  export default function LiteRenderer(props) {
160
+ ensureSentryInit();
135
161
  var width = props.width,
136
162
  height = props.height,
137
163
  configData = props.configData,
138
- options = props.options,
139
- user = props.user,
140
- auth = props.auth,
141
- featureFlags = props.featureFlags,
142
- sentry = props.sentry,
143
- analytics = props.analytics,
144
164
  externalEvent = props.externalEvent,
145
165
  onInternalEvent = props.onInternalEvent,
146
166
  onError = props.onError,
147
167
  passThrough = _objectWithoutProperties(props, _excluded);
148
168
 
169
+ // ✅ instance-scoped store (no module singleton)
170
+ var storeRef = useRef(null);
171
+ if (!storeRef.current) storeRef.current = createInstanceStore();
172
+
173
+ // ✅ instance-scoped catalog (no module singleton)
174
+ var catalogRef = useRef(null);
175
+ if (!catalogRef.current) {
176
+ catalogRef.current = new Catalog();
177
+ initCatalogOnce(catalogRef.current);
178
+ }
179
+
180
+ // ✅ stable plugins array
181
+ var plugins = useMemo(function () {
182
+ return createPlugins();
183
+ }, []);
184
+
185
+ // ✅ plugin lifecycle: supports cleanup if plugin returns function
186
+ var pluginCleanupsRef = useRef([]);
187
+ useEffect(function () {
188
+ var store = storeRef.current;
189
+ var stateExtractor = function stateExtractor(state) {
190
+ return state.get('KitchenConfigurator');
191
+ };
192
+ var cleanups = [];
193
+ var _iterator = _createForOfIteratorHelper(plugins),
194
+ _step;
195
+ try {
196
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
197
+ var p = _step.value;
198
+ try {
199
+ var maybeCleanup = p === null || p === void 0 ? void 0 : p(store, stateExtractor);
200
+ if (typeof maybeCleanup === 'function') cleanups.push(maybeCleanup);
201
+ } catch (_unused4) {
202
+ // keep prior behavior: do not crash
203
+ }
204
+ }
205
+ } catch (err) {
206
+ _iterator.e(err);
207
+ } finally {
208
+ _iterator.f();
209
+ }
210
+ pluginCleanupsRef.current = cleanups;
211
+ return function () {
212
+ var _iterator2 = _createForOfIteratorHelper(pluginCleanupsRef.current),
213
+ _step2;
214
+ try {
215
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
216
+ var fn = _step2.value;
217
+ try {
218
+ fn();
219
+ } catch (_unused3) {}
220
+ }
221
+ } catch (err) {
222
+ _iterator2.e(err);
223
+ } finally {
224
+ _iterator2.f();
225
+ }
226
+ pluginCleanupsRef.current = [];
227
+ };
228
+ }, [plugins]);
229
+
149
230
  /* ---------- track last external event ---------- */
150
231
  var lastExternalEventRef = useRef(null);
151
232
  useEffect(function () {
152
- if (externalEvent) {
153
- lastExternalEventRef.current = externalEvent;
154
- }
233
+ if (externalEvent) lastExternalEventRef.current = externalEvent;
155
234
  }, [externalEvent]);
156
235
 
157
236
  /* ---------- error buffer + last emitted bundle ---------- */
158
- var errorsBufferRef = useRef([]); // pending errors (not yet emitted)
237
+ var errorsBufferRef = useRef([]);
159
238
  var lastEmittedRef = useRef({
160
239
  externalEvent: null,
161
240
  errors: []
162
- }); // last bundle we sent
241
+ });
163
242
  var flushTimerRef = useRef(null);
164
243
  var emit = useCallback(function (external, errors) {
165
244
  var payload = {
@@ -168,13 +247,11 @@ export default function LiteRenderer(props) {
168
247
  };
169
248
  try {
170
249
  onError === null || onError === void 0 || onError(payload);
171
- } catch (_unused3) {}
250
+ } catch (_unused5) {}
172
251
  // eslint-disable-next-line no-console
173
252
  console.debug('[LiteRenderer:onError]', payload);
174
253
  lastEmittedRef.current = payload;
175
254
  }, [onError]);
176
-
177
- // batch short bursts (e.g., multiple async errors in same tick)
178
255
  var scheduleFlush = useCallback(function () {
179
256
  if (flushTimerRef.current) return;
180
257
  flushTimerRef.current = setTimeout(function () {
@@ -183,7 +260,7 @@ export default function LiteRenderer(props) {
183
260
  if (!errors.length) return;
184
261
  errorsBufferRef.current = [];
185
262
  emit(lastExternalEventRef.current, errors);
186
- }, 0); // micro-batch; increase (e.g. 50ms) if you want coarser batching
263
+ }, 0);
187
264
  }, [emit]);
188
265
  var pushError = useCallback(function (errPayload) {
189
266
  errorsBufferRef.current.push(_objectSpread({
@@ -194,6 +271,7 @@ export default function LiteRenderer(props) {
194
271
 
195
272
  /* ---------- global runtime + async error capture ---------- */
196
273
  useEffect(function () {
274
+ if (!isBrowser) return;
197
275
  var onWindowError = function onWindowError(event) {
198
276
  pushError({
199
277
  type: 'runtime-error',
@@ -225,79 +303,33 @@ export default function LiteRenderer(props) {
225
303
  var prev = prevExternalEventRef.current;
226
304
  if (prev === externalEvent) return;
227
305
  prevExternalEventRef.current = externalEvent;
228
-
229
- // if we already emitted something before, re-send it with the new event context
230
306
  var last = lastEmittedRef.current;
231
307
  if (last && last.errors && last.errors.length) {
232
308
  emit(lastExternalEventRef.current, last.errors);
233
309
  }
234
310
  }, [externalEvent, emit]);
235
- var id = configData.id,
236
- logoImg = configData.logoImg,
237
- companyUrl = configData.companyUrl;
238
- useEffect(function () {
239
- var initMyCatalog = /*#__PURE__*/function () {
240
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
241
- var x, _x, _x2;
242
- return _regeneratorRuntime.wrap(function (_context) {
243
- while (1) switch (_context.prev = _context.next) {
244
- case 0:
245
- for (x in Areas) MyCatalog.registerElement(Areas[x]);
246
- for (_x in Lines) MyCatalog.registerElement(Lines[_x]);
247
- for (_x2 in Holes) MyCatalog.registerElement(Holes[_x2]);
248
- MyCatalog.registerCategory('Windows', 'Windows', [Holes.windowClear, Holes.windowCross, Holes.windowDoubleHung, Holes.windowVertical]);
249
- MyCatalog.registerCategory('Doors', 'Doors', [Holes.doorInterior, Holes.doorExterior, Holes.doorCloset, Holes.doorSliding, Holes.doorwayFramed, Holes.doorwayFrameless]);
250
- case 1:
251
- case "end":
252
- return _context.stop();
253
- }
254
- }, _callee);
255
- }));
256
- return function initMyCatalog() {
257
- return _ref.apply(this, arguments);
258
- };
259
- }();
260
- var initCatalog = /*#__PURE__*/function () {
261
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
262
- return _regeneratorRuntime.wrap(function (_context2) {
263
- while (1) switch (_context2.prev = _context2.next) {
264
- case 0:
265
- _context2.next = 1;
266
- return initMyCatalog();
267
- case 1:
268
- case "end":
269
- return _context2.stop();
270
- }
271
- }, _callee2);
272
- }));
273
- return function initCatalog() {
274
- return _ref2.apply(this, arguments);
275
- };
276
- }();
277
- initCatalog();
278
- // eslint-disable-next-line react-hooks/exhaustive-deps
279
- }, [id]);
280
- return /*#__PURE__*/React.createElement(Provider, {
281
- store: store
311
+ var _ref = configData || {},
312
+ logoImg = _ref.logoImg,
313
+ companyUrl = _ref.companyUrl;
314
+ return /*#__PURE__*/React.createElement(AppContext.Provider, null, /*#__PURE__*/React.createElement(Provider, {
315
+ store: storeRef.current
282
316
  }, /*#__PURE__*/React.createElement(ToolErrorBoundary, {
283
317
  pushError: pushError
284
318
  }, /*#__PURE__*/React.createElement(LiteKitchenConfigurator, _extends({
285
- catalog: MyCatalog,
319
+ catalog: catalogRef.current,
286
320
  width: width,
287
321
  height: height,
288
322
  logoImage: logoImg,
289
323
  companyURL: companyUrl,
324
+ plugins: plugins,
290
325
  stateExtractor: function stateExtractor(state) {
291
326
  return state.get('KitchenConfigurator');
292
327
  },
293
328
  configData: configData,
294
329
  externalEvent: externalEvent,
295
330
  onInternalEvent: onInternalEvent
296
- }, passThrough))));
331
+ }, passThrough)))));
297
332
  }
298
-
299
- /* ============================== prop types ============================== */
300
-
301
333
  LiteRenderer.propTypes = {
302
334
  width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
303
335
  height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
@@ -8,16 +8,29 @@ import * as verticesActions from "./vertices-actions";
8
8
  import * as itemsActions from "./items-actions";
9
9
  import * as areaActions from "./area-actions";
10
10
  import * as groupsActions from "./groups-actions";
11
- export { projectActions, viewer2DActions, viewer3DActions, linesActions, holesActions, sceneActions, verticesActions, itemsActions, areaActions, groupsActions };
11
+
12
+ export {
13
+ projectActions,
14
+ viewer2DActions,
15
+ viewer3DActions,
16
+ linesActions,
17
+ holesActions,
18
+ sceneActions,
19
+ verticesActions,
20
+ itemsActions,
21
+ areaActions,
22
+ groupsActions
23
+ };
24
+
12
25
  export default {
13
- projectActions: projectActions,
14
- viewer2DActions: viewer2DActions,
15
- viewer3DActions: viewer3DActions,
16
- linesActions: linesActions,
17
- holesActions: holesActions,
18
- sceneActions: sceneActions,
19
- verticesActions: verticesActions,
20
- itemsActions: itemsActions,
21
- areaActions: areaActions,
22
- groupsActions: groupsActions
23
- };
26
+ projectActions,
27
+ viewer2DActions,
28
+ viewer3DActions,
29
+ linesActions,
30
+ holesActions,
31
+ sceneActions,
32
+ verticesActions,
33
+ itemsActions,
34
+ areaActions,
35
+ groupsActions
36
+ };
Binary file
@@ -1,6 +1,13 @@
1
- <svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M14.5566 21L1.90534 17.3692L0.994629 4.08225L14.8953 6.34589L14.5566 21Z" stroke="#4C12A1" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="5 3"/>
3
- <path d="M14.5564 21L20.2416 14.9342L21.0051 2.53974L14.8952 6.34589" stroke="#4C12A1" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="5 3"/>
4
- <path d="M8.91868 1L9.14126 12.3969L1.90534 17.3692L0.994629 4.08224L8.91868 1Z" stroke="#4C12A1" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="5 3"/>
5
- <path d="M8.9187 1L21.0053 2.53972L20.2418 14.9342L9.14128 12.3969L8.9187 1Z" stroke="#4C12A1" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="5 3"/>
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_1516_100789)">
3
+ <path d="M4.25 6L2 7.125L8 10.125L14 7.125L11.75 6" stroke="rgba(58, 11, 128, 1)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
4
+ <path d="M2 10.125L8 13.125L14 10.125" stroke="rgba(58, 11, 128, 1)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
5
+ <path d="M8 7.125V1.875" stroke="rgba(58, 11, 128, 1)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
6
+ <path d="M5.75 4.125L8 1.875L10.25 4.125" stroke="rgba(58, 11, 128, 1)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
7
+ </g>
8
+ <defs>
9
+ <clipPath id="clip0_1516_100789">
10
+ <rect width="16" height="16" fill="white"/>
11
+ </clipPath>
12
+ </defs>
6
13
  </svg>
@@ -1,7 +1,8 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
4
- import { UNIT_CENTIMETER } from "../constants";
4
+ import { PropertyColor, PropertyEnum, PropertyString, PropertyNumber, PropertyLengthMeasure, PropertyToggle, PropertyCheckbox, PropertyHidden, PropertyReadOnly } from "./properties/export";
5
+ import { UNIT_CENTIMETER, UNIT_INCH } from "../constants";
5
6
  import { returnReplaceableDeepSearchType } from "../components/viewer2d/utils";
6
7
  var Catalog = /*#__PURE__*/function () {
7
8
  function Catalog() {
@@ -18,6 +19,7 @@ var Catalog = /*#__PURE__*/function () {
18
19
  };
19
20
  this.propertyTypes = {};
20
21
  this.unit = unit;
22
+ this.registerMultiplePropertyType([['color', PropertyColor, PropertyColor], ['enum', PropertyEnum, PropertyEnum], ['string', PropertyString, PropertyString], ['number', PropertyNumber, PropertyNumber], ['length-measure', PropertyLengthMeasure, PropertyLengthMeasure], ['toggle', PropertyToggle, PropertyToggle], ['checkbox', PropertyCheckbox, PropertyCheckbox], ['hidden', PropertyHidden, PropertyHidden], ['read-only', PropertyReadOnly, PropertyReadOnly]]);
21
23
  }
22
24
 
23
25
  /**
@@ -83,6 +85,20 @@ var Catalog = /*#__PURE__*/function () {
83
85
  }
84
86
  }
85
87
 
88
+ /**
89
+ * @description Register multiple elements
90
+ * @param {array} [elementArray] Array of elements
91
+ * @return {void}
92
+ */
93
+ }, {
94
+ key: "registerMultipleElements",
95
+ value: function registerMultipleElements(elementArray) {
96
+ var _this = this;
97
+ elementArray.forEach(function (el) {
98
+ return _this.registerElement(el);
99
+ });
100
+ }
101
+
86
102
  /**
87
103
  * @description Register a new property
88
104
  * @param {string} type Type of property
@@ -108,9 +124,9 @@ var Catalog = /*#__PURE__*/function () {
108
124
  }, {
109
125
  key: "registerMultiplePropertyType",
110
126
  value: function registerMultiplePropertyType(propertyTypeArray) {
111
- var _this = this;
127
+ var _this2 = this;
112
128
  propertyTypeArray.forEach(function (el) {
113
- return _this.registerPropertyType.apply(_this, _toConsumableArray(el));
129
+ return _this2.registerPropertyType.apply(_this2, _toConsumableArray(el));
114
130
  });
115
131
  }
116
132
 
@@ -163,7 +179,7 @@ var Catalog = /*#__PURE__*/function () {
163
179
  }, {
164
180
  key: "registerCategory",
165
181
  value: function registerCategory(name, label, childs) {
166
- var _this2 = this;
182
+ var _this3 = this;
167
183
  if (this.validateCategory(name, label)) {
168
184
  this.categories[name] = {
169
185
  name: name,
@@ -174,7 +190,7 @@ var Catalog = /*#__PURE__*/function () {
174
190
  this.categories.root.categories.push(this.categories[name]);
175
191
  if (childs && childs.length) {
176
192
  childs.forEach(function (el) {
177
- return _this2.addToCategory(name, el);
193
+ return _this3.addToCategory(name, el);
178
194
  });
179
195
  }
180
196
  return this.categories[name];
@@ -1,9 +1,9 @@
1
- import * as Three from "three";
2
- import { Box3, Mesh, MeshBasicMaterial, MeshPhysicalMaterial, RepeatWrapping, Shape, TextureLoader, Vector2 } from "three";
1
+ import * as Three from 'three';
2
+ import { Box3, Mesh, MeshBasicMaterial, MeshPhysicalMaterial, RepeatWrapping, Shape, TextureLoader, Vector2 } from 'three';
3
3
  import * as SharedStyle from "../../shared-style";
4
- import { RGBELoader } from "three/examples/jsm/loaders/RGBELoader";
4
+ import { RGBELoader } from 'three/examples/jsm/loaders/RGBELoader';
5
5
  var params = {
6
- envMap: "HDR",
6
+ envMap: 'HDR',
7
7
  roughness: 0.9,
8
8
  metalness: 0.8,
9
9
  exposure: 1.0
@@ -58,7 +58,7 @@ var assignUVs = function assignUVs(geometry) {
58
58
  var y3 = position.getY(i + 2);
59
59
  uvArray.push((x1 + offset.x) / range.x, (y1 + offset.y) / range.y, (x2 + offset.x) / range.x, (y2 + offset.y) / range.y, (x3 + offset.x) / range.x, (y3 + offset.y) / range.y);
60
60
  }
61
- geometry.setAttribute("uv", new Three.BufferAttribute(new Float32Array(uvArray), 2));
61
+ geometry.setAttribute('uv', new Three.BufferAttribute(new Float32Array(uvArray), 2));
62
62
  geometry.needsUpdate = true;
63
63
  };
64
64
  export function createArea(element, layer, scene, textures) {
@@ -69,15 +69,15 @@ export function createArea(element, layer, scene, textures) {
69
69
  var texture = element.texture;
70
70
  texture.lengthRepeatScale = 0.01;
71
71
  texture.heightRepeatScale = 0.01;
72
- var color = element.properties.get("patternColor");
72
+ var color = element.properties.get('patternColor');
73
73
  if (element.selected) {
74
74
  color = SharedStyle.AREA_MESH_COLOR.selected;
75
75
  } else {
76
76
  color = SharedStyle.AREA_MESH_COLOR.unselected;
77
77
  }
78
- if (texture.uri === undefined || texture.uri == "") {
78
+ if (texture.uri === undefined || texture.uri == '') {
79
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";
80
+ texture.uri = layer.floorStyle.uri || 'https://media.test.diydesignspace.com/uploads/CountTop/202203162950_2/texture/oak-barcelona-s.jpg';
81
81
  }
82
82
  var shape = new Shape();
83
83
  shape.moveTo(vertices[0].x, vertices[0].y);
@@ -85,7 +85,7 @@ export function createArea(element, layer, scene, textures) {
85
85
  shape.lineTo(vertices[i].x, vertices[i].y);
86
86
  }
87
87
  function loadFloorENV() {
88
- return new RGBELoader().load("/assets/Window.hdr", function (texture) {
88
+ return new RGBELoader().load('/assets/Window.hdr', function (texture) {
89
89
  texture.mapping = Three.EquirectangularReflectionMapping;
90
90
  return texture;
91
91
  });
@@ -105,8 +105,8 @@ export function createArea(element, layer, scene, textures) {
105
105
  /* Create holes for the area */
106
106
  element.holes.forEach(function (holeID) {
107
107
  var holeCoords = [];
108
- layer.getIn(["areas", holeID, "vertices"]).forEach(function (vertexID) {
109
- var _layer$getIn = layer.getIn(["vertices", vertexID]),
108
+ layer.getIn(['areas', holeID, 'vertices']).forEach(function (vertexID) {
109
+ var _layer$getIn = layer.getIn(['vertices', vertexID]),
110
110
  x = _layer$getIn.x,
111
111
  y = _layer$getIn.y;
112
112
  holeCoords.push([x, y]);
@@ -133,7 +133,7 @@ export function createArea(element, layer, scene, textures) {
133
133
  var area = new Mesh(shapeGeometry, areaMaterial);
134
134
  area.rotation.x -= Math.PI / 2;
135
135
  area.receiveShadow = true;
136
- area.name = "floor";
136
+ area.name = 'floor';
137
137
  // This mesh is use for creating ceiling mesh
138
138
 
139
139
  var shapeGeometry2 = new Three.ShapeGeometry(shape);
@@ -144,7 +144,7 @@ export function createArea(element, layer, scene, textures) {
144
144
  area2.castShadow = true;
145
145
  area2.rotation.x -= Math.PI / 2;
146
146
  area2.receiveShadow = true;
147
- area2.name = "floorSupport";
147
+ area2.name = 'floorSupport';
148
148
  var floorSupport = area2.clone();
149
149
  area.userData.floorSupport = floorSupport;
150
150
  return Promise.resolve(area);
@@ -154,13 +154,13 @@ export function updatedArea(element, layer, scene, textures, mesh, oldElement, d
154
154
  selfDestroy();
155
155
  return selfBuild();
156
156
  };
157
- var floor = mesh.getObjectByName("floor");
157
+ var floor = mesh.getObjectByName('floor');
158
158
  floor.receiveShadow = true;
159
- if (differences[0] == "selected") {
159
+ if (differences[0] == 'selected') {
160
160
  var color = element.selected ? SharedStyle.AREA_MESH_COLOR.selected : SharedStyle.AREA_MESH_COLOR.unselected;
161
161
  floor.material.color.set(color);
162
- } else if (differences[0] == "properties") {
163
- if (differences[1] === "texture") {
162
+ } else if (differences[0] == 'properties') {
163
+ if (differences[1] === 'texture') {
164
164
  return noPerf();
165
165
  }
166
166
  } else return noPerf();
@@ -16,7 +16,7 @@ var STYLE_LINE = {
16
16
  // strokeWidth:1
17
17
  };
18
18
  var STYLE_INTERIOR_LINE = {
19
- strokeWidth: 2,
19
+ strokeWidth: 4,
20
20
  stroke: SharedStyle.INTERIOR_LINE.unselected
21
21
  };
22
22
  var STYLE_INTERIOR_LINE_SELECTED = {
@@ -4,12 +4,12 @@ import { loadGLTF, scaleObject } from "../../utils/load-obj";
4
4
  import { OBJTYPE_MESH } from "../../../constants";
5
5
  var cached3DWindow = null;
6
6
  export default {
7
- name: 'Clear Window',
7
+ name: 'Window',
8
8
  prototype: 'holes',
9
9
  info: {
10
10
  title: 'Clear',
11
11
  tag: ['window'],
12
- description: 'Clear Window',
12
+ description: 'Window',
13
13
  image: '/assets/img/svg/window/Clear.svg',
14
14
  url: '/assets/gltf/window_clear.gltf'
15
15
  },