kitchen-simulator 3.16.0-test-renderer-fix → 3.16.1-test-renderer-fix

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.
@@ -8,7 +8,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
8
8
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
9
9
  import _inherits from "@babel/runtime/helpers/esm/inherits";
10
10
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
11
- var _excluded = ["width", "height", "extractedState", "measurementUnit"];
11
+ var _excluded = ["width", "height", "extractedState"];
12
12
  var _templateObject, _templateObject2;
13
13
  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; }
14
14
  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; }
@@ -121,7 +121,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
121
121
  _this.neverShowInput = /*#__PURE__*/React.createRef(null);
122
122
  _this.setShowProperty = _this.setShowProperty.bind(_this);
123
123
 
124
- // cache to avoid immutable merge allocations every render
124
+ // cache for viewer2D init so we don't allocate merges every render
125
125
  _this._cachedViewer2DKey = null;
126
126
  _this._cachedExtractedState = null;
127
127
  return _this;
@@ -214,7 +214,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
214
214
  floorOpened: true
215
215
  });
216
216
  var el = document.getElementById('make_floorplan_inactive');
217
- el && ((_el$parentElement = el.parentElement) === null || _el$parentElement === void 0 ? void 0 : _el$parentElement.parentElement) && (el.parentElement.parentElement.style.zIndex = 999);
217
+ if (el !== null && el !== void 0 && (_el$parentElement = el.parentElement) !== null && _el$parentElement !== void 0 && _el$parentElement.parentElement) el.parentElement.parentElement.style.zIndex = 999;
218
218
  }
219
219
  }, {
220
220
  key: "openCabinet",
@@ -224,7 +224,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
224
224
  cabinetOpened: true
225
225
  });
226
226
  var el = document.getElementById('add_cabinets_inactive');
227
- el && ((_el$parentElement2 = el.parentElement) === null || _el$parentElement2 === void 0 ? void 0 : _el$parentElement2.parentElement) && (el.parentElement.parentElement.style.zIndex = 999);
227
+ if (el !== null && el !== void 0 && (_el$parentElement2 = el.parentElement) !== null && _el$parentElement2 !== void 0 && _el$parentElement2.parentElement) el.parentElement.parentElement.style.zIndex = 999;
228
228
  }
229
229
  }, {
230
230
  key: "toggleDoorStyle",
@@ -234,7 +234,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
234
234
  doorStyleOpen: visible
235
235
  });
236
236
  var el = document.getElementById('select_doorstyle_inactive');
237
- el && ((_el$parentElement3 = el.parentElement) === null || _el$parentElement3 === void 0 ? void 0 : _el$parentElement3.parentElement) && (el.parentElement.parentElement.style.zIndex = visible ? 999 : 6);
237
+ if (el !== null && el !== void 0 && (_el$parentElement3 = el.parentElement) !== null && _el$parentElement3 !== void 0 && _el$parentElement3.parentElement) el.parentElement.parentElement.style.zIndex = visible ? 999 : 6;
238
238
  }
239
239
  }, {
240
240
  key: "replaceCabinet",
@@ -251,7 +251,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
251
251
  applianceOpened: true
252
252
  });
253
253
  var el = document.getElementById('add_appliances_inactive');
254
- el && ((_el$parentElement4 = el.parentElement) === null || _el$parentElement4 === void 0 ? void 0 : _el$parentElement4.parentElement) && (el.parentElement.parentElement.style.zIndex = 999);
254
+ if (el !== null && el !== void 0 && (_el$parentElement4 = el.parentElement) !== null && _el$parentElement4 !== void 0 && _el$parentElement4.parentElement) el.parentElement.parentElement.style.zIndex = 999;
255
255
  }
256
256
  }, {
257
257
  key: "openFinishing",
@@ -261,7 +261,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
261
261
  finishingOpened: true
262
262
  });
263
263
  var el = document.getElementById('finishing_touches_inactive');
264
- el && ((_el$parentElement5 = el.parentElement) === null || _el$parentElement5 === void 0 ? void 0 : _el$parentElement5.parentElement) && (el.parentElement.parentElement.style.zIndex = 999);
264
+ if (el !== null && el !== void 0 && (_el$parentElement5 = el.parentElement) !== null && _el$parentElement5 !== void 0 && _el$parentElement5.parentElement) el.parentElement.parentElement.style.zIndex = 999;
265
265
  }
266
266
  }, {
267
267
  key: "onReviewQuoteClicked",
@@ -271,7 +271,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
271
271
  reviewQuotePopupOpened: visible
272
272
  });
273
273
  var el = document.getElementById('review_quote_inactive');
274
- el && ((_el$parentElement6 = el.parentElement) === null || _el$parentElement6 === void 0 ? void 0 : _el$parentElement6.parentElement) && (el.parentElement.parentElement.style.zIndex = visible ? 999 : 6);
274
+ if (el !== null && el !== void 0 && (_el$parentElement6 = el.parentElement) !== null && _el$parentElement6 !== void 0 && _el$parentElement6.parentElement) el.parentElement.parentElement.style.zIndex = visible ? 999 : 6;
275
275
  }
276
276
  }, {
277
277
  key: "closeFloorTB",
@@ -281,7 +281,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
281
281
  floorOpened: false
282
282
  });
283
283
  var el = document.getElementById('make_floorplan_inactive');
284
- el && ((_el$parentElement7 = el.parentElement) === null || _el$parentElement7 === void 0 ? void 0 : _el$parentElement7.parentElement) && (el.parentElement.parentElement.style.zIndex = 6);
284
+ if (el !== null && el !== void 0 && (_el$parentElement7 = el.parentElement) !== null && _el$parentElement7 !== void 0 && _el$parentElement7.parentElement) el.parentElement.parentElement.style.zIndex = 6;
285
285
  }
286
286
  }, {
287
287
  key: "closeCabinetTB",
@@ -291,7 +291,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
291
291
  cabinetOpened: false
292
292
  });
293
293
  var el = document.getElementById('add_cabinets_inactive');
294
- el && ((_el$parentElement8 = el.parentElement) === null || _el$parentElement8 === void 0 ? void 0 : _el$parentElement8.parentElement) && (el.parentElement.parentElement.style.zIndex = 6);
294
+ if (el !== null && el !== void 0 && (_el$parentElement8 = el.parentElement) !== null && _el$parentElement8 !== void 0 && _el$parentElement8.parentElement) el.parentElement.parentElement.style.zIndex = 6;
295
295
  }
296
296
  }, {
297
297
  key: "closeFinishingTB",
@@ -301,7 +301,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
301
301
  finishingOpened: false
302
302
  });
303
303
  var el = document.getElementById('finishing_touches_inactive');
304
- el && ((_el$parentElement9 = el.parentElement) === null || _el$parentElement9 === void 0 ? void 0 : _el$parentElement9.parentElement) && (el.parentElement.parentElement.style.zIndex = 6);
304
+ if (el !== null && el !== void 0 && (_el$parentElement9 = el.parentElement) !== null && _el$parentElement9 !== void 0 && _el$parentElement9.parentElement) el.parentElement.parentElement.style.zIndex = 6;
305
305
  }
306
306
  }, {
307
307
  key: "closeApplianceTB",
@@ -311,7 +311,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
311
311
  applianceOpened: false
312
312
  });
313
313
  var el = document.getElementById('add_appliances_inactive');
314
- el && ((_el$parentElement0 = el.parentElement) === null || _el$parentElement0 === void 0 ? void 0 : _el$parentElement0.parentElement) && (el.parentElement.parentElement.style.zIndex = 6);
314
+ if (el !== null && el !== void 0 && (_el$parentElement0 = el.parentElement) !== null && _el$parentElement0 !== void 0 && _el$parentElement0.parentElement) el.parentElement.parentElement.style.zIndex = 6;
315
315
  }
316
316
  }, {
317
317
  key: "getChildContext",
@@ -332,6 +332,8 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
332
332
  var _this$props = this.props,
333
333
  stateExtractor = _this$props.stateExtractor,
334
334
  plugins = _this$props.plugins;
335
+
336
+ // keep old behavior: run plugins once on mount
335
337
  var newplugins = _toConsumableArray(plugins);
336
338
  newplugins.forEach(function (newplugin) {
337
339
  return newplugin(store, stateExtractor);
@@ -343,21 +345,18 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
343
345
  var _extractedState$getIn;
344
346
  var _this$props2 = this.props,
345
347
  externalEvent = _this$props2.externalEvent,
346
- stateExtractor = _this$props2.stateExtractor,
347
348
  extractedState = _this$props2.extractedState,
348
349
  projectActions = _this$props2.projectActions,
349
350
  catalog = _this$props2.catalog;
350
351
 
351
- // handle external events (same behavior as before)
352
+ // same behavior: handle external event when it changes
352
353
  if (prevProps.externalEvent !== externalEvent) {
353
354
  handleExternalEvent(this.props);
354
355
  }
355
356
 
356
- // init catalog once ready flag says not ready (same behavior)
357
+ // same behavior: init catalog until ready
357
358
  var catalogReady = extractedState === null || extractedState === void 0 || (_extractedState$getIn = extractedState.getIn) === null || _extractedState$getIn === void 0 ? void 0 : _extractedState$getIn.call(extractedState, ['catalog', 'ready']);
358
- if (!catalogReady) {
359
- projectActions.initCatalog(catalog);
360
- }
359
+ if (!catalogReady) projectActions.initCatalog(catalog);
361
360
  }
362
361
  }, {
363
362
  key: "isProjectEmpty",
@@ -367,9 +366,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
367
366
  var layer = layers.get(selectedLayer);
368
367
  return layer.areas.size + layer.lines.size + layer.holes.size + layer.items.size === 0;
369
368
  }
370
-
371
- // Compute viewer2D transform only when needed, and cache it.
372
- // This preserves the exact visual result but avoids merge allocations every render.
373
369
  }, {
374
370
  key: "getExtractedStateWithViewer2DInit",
375
371
  value: function getExtractedStateWithViewer2DInit(extractedState, width, height) {
@@ -378,15 +374,11 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
378
374
  var len = convert(_scene.width).from(_scene.unit).to('cm');
379
375
  var _viewer2D = extractedState.getIn(['viewer2D']);
380
376
  if (!_viewer2D || _viewer2D.size <= 0) return extractedState;
381
-
382
- // build a stable cache key based on inputs that affect the result
383
377
  var v = _viewer2D.toJS();
384
- var cacheKey = "".concat(width, ":").concat(height, ":").concat(len, ":").concat(v.e, ":").concat(v.f, ":").concat(v.viewerWidth, ":").concat(v.viewerHeight, ":").concat(v.SVGWidth, ":").concat(v.SVGHeight);
378
+ var cacheKey = "".concat(width, ":").concat(height, ":").concat(len, ":").concat(v.e, ":").concat(v.f, ":").concat(v.viewerWidth, ":").concat(v.viewerHeight, ":").concat(v.SVGWidth, ":").concat(v.SVGHeight, ":").concat(v.a, ":").concat(v.d);
385
379
  if (this._cachedViewer2DKey === cacheKey && this._cachedExtractedState) {
386
380
  return this._cachedExtractedState;
387
381
  }
388
-
389
- // your original logic
390
382
  if (v.e === 0 && v.f === 0) {
391
383
  _viewer2D = _viewer2D.merge({
392
384
  e: v.viewerWidth / 2 - v.SVGWidth / 2,
@@ -401,8 +393,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
401
393
  this._cachedExtractedState = merged;
402
394
  return merged;
403
395
  }
404
-
405
- // no merge needed
406
396
  this._cachedViewer2DKey = cacheKey;
407
397
  this._cachedExtractedState = extractedState;
408
398
  return extractedState;
@@ -414,7 +404,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
414
404
  width = _this$props3.width,
415
405
  height = _this$props3.height,
416
406
  extractedState = _this$props3.extractedState,
417
- measurementUnit = _this$props3.measurementUnit,
418
407
  props = _objectWithoutProperties(_this$props3, _excluded);
419
408
  var _this$state = this.state,
420
409
  savePopupVisible = _this$state.savePopupVisible,
@@ -424,8 +413,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
424
413
  myProjectsOpen = _this$state.myProjectsOpen;
425
414
  var contentW = width - toolbarW;
426
415
  var contentH = height;
427
- var headerW = width;
428
- var headerH = 60;
429
416
  var extracted = this.getExtractedStateWithViewer2DInit(extractedState, width, height);
430
417
  var firstVisit = this.state.wizardStepOpend && this.isProjectEmpty(extracted.scene);
431
418
  var allVisible = firstVisit || signOpen || myProjectsOpen;
@@ -477,13 +464,11 @@ LiteKitchenConfigurator.propTypes = {
477
464
  width: PropTypes.number.isRequired,
478
465
  height: PropTypes.number.isRequired,
479
466
  stateExtractor: PropTypes.func.isRequired,
480
- sidebarComponents: PropTypes.array,
481
- footerbarComponents: PropTypes.array,
482
- customContents: PropTypes.object,
483
- softwareSignature: PropTypes.string,
484
467
  configData: PropTypes.object,
485
468
  onInternalEvent: PropTypes.func,
486
- extractedState: PropTypes.object // <-- new injected prop
469
+ extractedState: PropTypes.object,
470
+ // ✅ injected by connect
471
+ externalEvent: PropTypes.object
487
472
  };
488
473
  LiteKitchenConfigurator.contextTypes = {
489
474
  store: PropTypes.object.isRequired
@@ -506,7 +491,8 @@ LiteKitchenConfigurator.defaultProps = {
506
491
  configData: {}
507
492
  };
508
493
 
509
- // IMPORTANT: select only the extracted slice so top component doesn't rerender on every dispatch
494
+ // Only select the slice you actually use.
495
+ // This preserves behavior but massively reduces rerenders.
510
496
  function mapStateToProps(reduxState, ownProps) {
511
497
  var stateExtractor = ownProps.stateExtractor || function (s) {
512
498
  return s;
@@ -35,11 +35,11 @@ import LiteKitchenConfigurator from "./LiteKitchenConfigurator";
35
35
  var isBrowser = typeof window !== 'undefined';
36
36
  if (isBrowser) window.THREE = THREE;
37
37
 
38
- // ---- Sentry init: keep behavior but avoid re-init on multiple mounts ----
38
+ // ---- Keep prior Sentry behavior but ensure it only initializes once ----
39
39
  var __sentryInited = false;
40
40
  function ensureSentryInit() {
41
- // assumes isProduction is defined in your build env like before
42
41
  if (!isBrowser) return;
42
+ // assumes isProduction exists in your build just like today
43
43
  if (!isProduction) return;
44
44
  if (__sentryInited) return;
45
45
  __sentryInited = true;
@@ -125,7 +125,6 @@ function initCatalogOnce(catalog) {
125
125
 
126
126
  // ----------------- store factory -----------------
127
127
  function createInstanceStore() {
128
- // keep your initial state semantics identical
129
128
  var AppState = Map({
130
129
  KitchenConfigurator: new State()
131
130
  });
@@ -135,8 +134,6 @@ function createInstanceStore() {
135
134
  return PlannerReducer(plannerState, action);
136
135
  });
137
136
  };
138
-
139
- // keep devtools behavior identical; guard against missing window
140
137
  var enhancer = !isProduction && isBrowser && window.devToolsExtension ? window.devToolsExtension({
141
138
  features: {
142
139
  pause: true,
@@ -156,8 +153,6 @@ function createInstanceStore() {
156
153
  };
157
154
  return createStore(reducer, null, enhancer);
158
155
  }
159
-
160
- // ----------------- plugins -----------------
161
156
  function createPlugins() {
162
157
  return [Keyboard(), ConsoleDebugger()];
163
158
  }
@@ -171,28 +166,29 @@ export default function LiteRenderer(props) {
171
166
  onError = props.onError,
172
167
  passThrough = _objectWithoutProperties(props, _excluded);
173
168
 
174
- // ---- instance-scoped store + catalog (no module-level globals) ----
169
+ // instance-scoped store (no module singleton)
175
170
  var storeRef = useRef(null);
176
171
  if (!storeRef.current) storeRef.current = createInstanceStore();
172
+
173
+ // ✅ instance-scoped catalog (no module singleton)
177
174
  var catalogRef = useRef(null);
178
175
  if (!catalogRef.current) {
179
176
  catalogRef.current = new Catalog();
180
177
  initCatalogOnce(catalogRef.current);
181
178
  }
182
179
 
183
- // ---- plugins init once per instance + cleanup support ----
184
- var pluginCleanupsRef = useRef([]);
180
+ // stable plugins array
185
181
  var plugins = useMemo(function () {
186
182
  return createPlugins();
187
- }, []); // stable
183
+ }, []);
188
184
 
185
+ // ✅ plugin lifecycle: supports cleanup if plugin returns function
186
+ var pluginCleanupsRef = useRef([]);
189
187
  useEffect(function () {
190
188
  var store = storeRef.current;
191
189
  var stateExtractor = function stateExtractor(state) {
192
190
  return state.get('KitchenConfigurator');
193
191
  };
194
-
195
- // plugins may or may not return cleanup; support both
196
192
  var cleanups = [];
197
193
  var _iterator = _createForOfIteratorHelper(plugins),
198
194
  _step;
@@ -202,9 +198,8 @@ export default function LiteRenderer(props) {
202
198
  try {
203
199
  var maybeCleanup = p === null || p === void 0 ? void 0 : p(store, stateExtractor);
204
200
  if (typeof maybeCleanup === 'function') cleanups.push(maybeCleanup);
205
- } catch (e) {
206
- // keep behavior: don't crash; send to onError buffer
207
- // (actual emitting is handled below)
201
+ } catch (_unused4) {
202
+ // keep prior behavior: do not crash
208
203
  }
209
204
  }
210
205
  } catch (err) {
@@ -252,8 +247,7 @@ export default function LiteRenderer(props) {
252
247
  };
253
248
  try {
254
249
  onError === null || onError === void 0 || onError(payload);
255
- } catch (_unused4) {}
256
- // keep your debug
250
+ } catch (_unused5) {}
257
251
  // eslint-disable-next-line no-console
258
252
  console.debug('[LiteRenderer:onError]', payload);
259
253
  lastEmittedRef.current = payload;