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.
- package/es/LiteKitchenConfigurator.js +23 -37
- package/es/LiteRenderer.js +12 -18
- package/es/utils/isolate-event-handler.js +265 -210
- package/lib/LiteKitchenConfigurator.js +23 -37
- package/lib/LiteRenderer.js +12 -18
- package/lib/utils/isolate-event-handler.js +266 -210
- package/package.json +1 -1
|
@@ -31,7 +31,7 @@ var _translator = _interopRequireDefault(require("./translator/translator"));
|
|
|
31
31
|
var _objectsUtils = require("./utils/objects-utils");
|
|
32
32
|
var _version = require("./version");
|
|
33
33
|
var _isolateEventHandler = require("./utils/isolate-event-handler");
|
|
34
|
-
var _excluded = ["width", "height", "extractedState"
|
|
34
|
+
var _excluded = ["width", "height", "extractedState"];
|
|
35
35
|
var _templateObject, _templateObject2; // LiteKitchenConfigurator.jsx
|
|
36
36
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
37
37
|
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; }
|
|
@@ -129,7 +129,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
129
129
|
_this.neverShowInput = /*#__PURE__*/_react["default"].createRef(null);
|
|
130
130
|
_this.setShowProperty = _this.setShowProperty.bind(_this);
|
|
131
131
|
|
|
132
|
-
// cache
|
|
132
|
+
// cache for viewer2D init so we don't allocate merges every render
|
|
133
133
|
_this._cachedViewer2DKey = null;
|
|
134
134
|
_this._cachedExtractedState = null;
|
|
135
135
|
return _this;
|
|
@@ -222,7 +222,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
222
222
|
floorOpened: true
|
|
223
223
|
});
|
|
224
224
|
var el = document.getElementById('make_floorplan_inactive');
|
|
225
|
-
el && (
|
|
225
|
+
if (el !== null && el !== void 0 && (_el$parentElement = el.parentElement) !== null && _el$parentElement !== void 0 && _el$parentElement.parentElement) el.parentElement.parentElement.style.zIndex = 999;
|
|
226
226
|
}
|
|
227
227
|
}, {
|
|
228
228
|
key: "openCabinet",
|
|
@@ -232,7 +232,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
232
232
|
cabinetOpened: true
|
|
233
233
|
});
|
|
234
234
|
var el = document.getElementById('add_cabinets_inactive');
|
|
235
|
-
el && (
|
|
235
|
+
if (el !== null && el !== void 0 && (_el$parentElement2 = el.parentElement) !== null && _el$parentElement2 !== void 0 && _el$parentElement2.parentElement) el.parentElement.parentElement.style.zIndex = 999;
|
|
236
236
|
}
|
|
237
237
|
}, {
|
|
238
238
|
key: "toggleDoorStyle",
|
|
@@ -242,7 +242,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
242
242
|
doorStyleOpen: visible
|
|
243
243
|
});
|
|
244
244
|
var el = document.getElementById('select_doorstyle_inactive');
|
|
245
|
-
el && (
|
|
245
|
+
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;
|
|
246
246
|
}
|
|
247
247
|
}, {
|
|
248
248
|
key: "replaceCabinet",
|
|
@@ -259,7 +259,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
259
259
|
applianceOpened: true
|
|
260
260
|
});
|
|
261
261
|
var el = document.getElementById('add_appliances_inactive');
|
|
262
|
-
el && (
|
|
262
|
+
if (el !== null && el !== void 0 && (_el$parentElement4 = el.parentElement) !== null && _el$parentElement4 !== void 0 && _el$parentElement4.parentElement) el.parentElement.parentElement.style.zIndex = 999;
|
|
263
263
|
}
|
|
264
264
|
}, {
|
|
265
265
|
key: "openFinishing",
|
|
@@ -269,7 +269,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
269
269
|
finishingOpened: true
|
|
270
270
|
});
|
|
271
271
|
var el = document.getElementById('finishing_touches_inactive');
|
|
272
|
-
el && (
|
|
272
|
+
if (el !== null && el !== void 0 && (_el$parentElement5 = el.parentElement) !== null && _el$parentElement5 !== void 0 && _el$parentElement5.parentElement) el.parentElement.parentElement.style.zIndex = 999;
|
|
273
273
|
}
|
|
274
274
|
}, {
|
|
275
275
|
key: "onReviewQuoteClicked",
|
|
@@ -279,7 +279,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
279
279
|
reviewQuotePopupOpened: visible
|
|
280
280
|
});
|
|
281
281
|
var el = document.getElementById('review_quote_inactive');
|
|
282
|
-
el && (
|
|
282
|
+
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;
|
|
283
283
|
}
|
|
284
284
|
}, {
|
|
285
285
|
key: "closeFloorTB",
|
|
@@ -289,7 +289,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
289
289
|
floorOpened: false
|
|
290
290
|
});
|
|
291
291
|
var el = document.getElementById('make_floorplan_inactive');
|
|
292
|
-
el && (
|
|
292
|
+
if (el !== null && el !== void 0 && (_el$parentElement7 = el.parentElement) !== null && _el$parentElement7 !== void 0 && _el$parentElement7.parentElement) el.parentElement.parentElement.style.zIndex = 6;
|
|
293
293
|
}
|
|
294
294
|
}, {
|
|
295
295
|
key: "closeCabinetTB",
|
|
@@ -299,7 +299,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
299
299
|
cabinetOpened: false
|
|
300
300
|
});
|
|
301
301
|
var el = document.getElementById('add_cabinets_inactive');
|
|
302
|
-
el && (
|
|
302
|
+
if (el !== null && el !== void 0 && (_el$parentElement8 = el.parentElement) !== null && _el$parentElement8 !== void 0 && _el$parentElement8.parentElement) el.parentElement.parentElement.style.zIndex = 6;
|
|
303
303
|
}
|
|
304
304
|
}, {
|
|
305
305
|
key: "closeFinishingTB",
|
|
@@ -309,7 +309,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
309
309
|
finishingOpened: false
|
|
310
310
|
});
|
|
311
311
|
var el = document.getElementById('finishing_touches_inactive');
|
|
312
|
-
el && (
|
|
312
|
+
if (el !== null && el !== void 0 && (_el$parentElement9 = el.parentElement) !== null && _el$parentElement9 !== void 0 && _el$parentElement9.parentElement) el.parentElement.parentElement.style.zIndex = 6;
|
|
313
313
|
}
|
|
314
314
|
}, {
|
|
315
315
|
key: "closeApplianceTB",
|
|
@@ -319,7 +319,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
319
319
|
applianceOpened: false
|
|
320
320
|
});
|
|
321
321
|
var el = document.getElementById('add_appliances_inactive');
|
|
322
|
-
el && (
|
|
322
|
+
if (el !== null && el !== void 0 && (_el$parentElement0 = el.parentElement) !== null && _el$parentElement0 !== void 0 && _el$parentElement0.parentElement) el.parentElement.parentElement.style.zIndex = 6;
|
|
323
323
|
}
|
|
324
324
|
}, {
|
|
325
325
|
key: "getChildContext",
|
|
@@ -340,6 +340,8 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
340
340
|
var _this$props = this.props,
|
|
341
341
|
stateExtractor = _this$props.stateExtractor,
|
|
342
342
|
plugins = _this$props.plugins;
|
|
343
|
+
|
|
344
|
+
// keep old behavior: run plugins once on mount
|
|
343
345
|
var newplugins = (0, _toConsumableArray2["default"])(plugins);
|
|
344
346
|
newplugins.forEach(function (newplugin) {
|
|
345
347
|
return newplugin(store, stateExtractor);
|
|
@@ -351,21 +353,18 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
351
353
|
var _extractedState$getIn;
|
|
352
354
|
var _this$props2 = this.props,
|
|
353
355
|
externalEvent = _this$props2.externalEvent,
|
|
354
|
-
stateExtractor = _this$props2.stateExtractor,
|
|
355
356
|
extractedState = _this$props2.extractedState,
|
|
356
357
|
projectActions = _this$props2.projectActions,
|
|
357
358
|
catalog = _this$props2.catalog;
|
|
358
359
|
|
|
359
|
-
// handle external
|
|
360
|
+
// same behavior: handle external event when it changes
|
|
360
361
|
if (prevProps.externalEvent !== externalEvent) {
|
|
361
362
|
(0, _isolateEventHandler.handleExternalEvent)(this.props);
|
|
362
363
|
}
|
|
363
364
|
|
|
364
|
-
// init catalog
|
|
365
|
+
// same behavior: init catalog until ready
|
|
365
366
|
var catalogReady = extractedState === null || extractedState === void 0 || (_extractedState$getIn = extractedState.getIn) === null || _extractedState$getIn === void 0 ? void 0 : _extractedState$getIn.call(extractedState, ['catalog', 'ready']);
|
|
366
|
-
if (!catalogReady)
|
|
367
|
-
projectActions.initCatalog(catalog);
|
|
368
|
-
}
|
|
367
|
+
if (!catalogReady) projectActions.initCatalog(catalog);
|
|
369
368
|
}
|
|
370
369
|
}, {
|
|
371
370
|
key: "isProjectEmpty",
|
|
@@ -375,9 +374,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
375
374
|
var layer = layers.get(selectedLayer);
|
|
376
375
|
return layer.areas.size + layer.lines.size + layer.holes.size + layer.items.size === 0;
|
|
377
376
|
}
|
|
378
|
-
|
|
379
|
-
// Compute viewer2D transform only when needed, and cache it.
|
|
380
|
-
// This preserves the exact visual result but avoids merge allocations every render.
|
|
381
377
|
}, {
|
|
382
378
|
key: "getExtractedStateWithViewer2DInit",
|
|
383
379
|
value: function getExtractedStateWithViewer2DInit(extractedState, width, height) {
|
|
@@ -386,15 +382,11 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
386
382
|
var len = (0, _convertUnitsLite.convert)(_scene.width).from(_scene.unit).to('cm');
|
|
387
383
|
var _viewer2D = extractedState.getIn(['viewer2D']);
|
|
388
384
|
if (!_viewer2D || _viewer2D.size <= 0) return extractedState;
|
|
389
|
-
|
|
390
|
-
// build a stable cache key based on inputs that affect the result
|
|
391
385
|
var v = _viewer2D.toJS();
|
|
392
|
-
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);
|
|
386
|
+
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);
|
|
393
387
|
if (this._cachedViewer2DKey === cacheKey && this._cachedExtractedState) {
|
|
394
388
|
return this._cachedExtractedState;
|
|
395
389
|
}
|
|
396
|
-
|
|
397
|
-
// your original logic
|
|
398
390
|
if (v.e === 0 && v.f === 0) {
|
|
399
391
|
_viewer2D = _viewer2D.merge({
|
|
400
392
|
e: v.viewerWidth / 2 - v.SVGWidth / 2,
|
|
@@ -409,8 +401,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
409
401
|
this._cachedExtractedState = merged;
|
|
410
402
|
return merged;
|
|
411
403
|
}
|
|
412
|
-
|
|
413
|
-
// no merge needed
|
|
414
404
|
this._cachedViewer2DKey = cacheKey;
|
|
415
405
|
this._cachedExtractedState = extractedState;
|
|
416
406
|
return extractedState;
|
|
@@ -422,7 +412,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
422
412
|
width = _this$props3.width,
|
|
423
413
|
height = _this$props3.height,
|
|
424
414
|
extractedState = _this$props3.extractedState,
|
|
425
|
-
measurementUnit = _this$props3.measurementUnit,
|
|
426
415
|
props = (0, _objectWithoutProperties2["default"])(_this$props3, _excluded);
|
|
427
416
|
var _this$state = this.state,
|
|
428
417
|
savePopupVisible = _this$state.savePopupVisible,
|
|
@@ -432,8 +421,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
432
421
|
myProjectsOpen = _this$state.myProjectsOpen;
|
|
433
422
|
var contentW = width - toolbarW;
|
|
434
423
|
var contentH = height;
|
|
435
|
-
var headerW = width;
|
|
436
|
-
var headerH = 60;
|
|
437
424
|
var extracted = this.getExtractedStateWithViewer2DInit(extractedState, width, height);
|
|
438
425
|
var firstVisit = this.state.wizardStepOpend && this.isProjectEmpty(extracted.scene);
|
|
439
426
|
var allVisible = firstVisit || signOpen || myProjectsOpen;
|
|
@@ -485,13 +472,11 @@ LiteKitchenConfigurator.propTypes = {
|
|
|
485
472
|
width: _propTypes["default"].number.isRequired,
|
|
486
473
|
height: _propTypes["default"].number.isRequired,
|
|
487
474
|
stateExtractor: _propTypes["default"].func.isRequired,
|
|
488
|
-
sidebarComponents: _propTypes["default"].array,
|
|
489
|
-
footerbarComponents: _propTypes["default"].array,
|
|
490
|
-
customContents: _propTypes["default"].object,
|
|
491
|
-
softwareSignature: _propTypes["default"].string,
|
|
492
475
|
configData: _propTypes["default"].object,
|
|
493
476
|
onInternalEvent: _propTypes["default"].func,
|
|
494
|
-
extractedState: _propTypes["default"].object
|
|
477
|
+
extractedState: _propTypes["default"].object,
|
|
478
|
+
// ✅ injected by connect
|
|
479
|
+
externalEvent: _propTypes["default"].object
|
|
495
480
|
};
|
|
496
481
|
LiteKitchenConfigurator.contextTypes = {
|
|
497
482
|
store: _propTypes["default"].object.isRequired
|
|
@@ -514,7 +499,8 @@ LiteKitchenConfigurator.defaultProps = {
|
|
|
514
499
|
configData: {}
|
|
515
500
|
};
|
|
516
501
|
|
|
517
|
-
//
|
|
502
|
+
// ✅ Only select the slice you actually use.
|
|
503
|
+
// This preserves behavior but massively reduces rerenders.
|
|
518
504
|
function mapStateToProps(reduxState, ownProps) {
|
|
519
505
|
var stateExtractor = ownProps.stateExtractor || function (s) {
|
|
520
506
|
return s;
|
package/lib/LiteRenderer.js
CHANGED
|
@@ -43,11 +43,11 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
43
43
|
var isBrowser = typeof window !== 'undefined';
|
|
44
44
|
if (isBrowser) window.THREE = THREE;
|
|
45
45
|
|
|
46
|
-
// ----
|
|
46
|
+
// ---- Keep prior Sentry behavior but ensure it only initializes once ----
|
|
47
47
|
var __sentryInited = false;
|
|
48
48
|
function ensureSentryInit() {
|
|
49
|
-
// assumes isProduction is defined in your build env like before
|
|
50
49
|
if (!isBrowser) return;
|
|
50
|
+
// assumes isProduction exists in your build just like today
|
|
51
51
|
if (!isProduction) return;
|
|
52
52
|
if (__sentryInited) return;
|
|
53
53
|
__sentryInited = true;
|
|
@@ -133,7 +133,6 @@ function initCatalogOnce(catalog) {
|
|
|
133
133
|
|
|
134
134
|
// ----------------- store factory -----------------
|
|
135
135
|
function createInstanceStore() {
|
|
136
|
-
// keep your initial state semantics identical
|
|
137
136
|
var AppState = (0, _immutable.Map)({
|
|
138
137
|
KitchenConfigurator: new _models.State()
|
|
139
138
|
});
|
|
@@ -143,8 +142,6 @@ function createInstanceStore() {
|
|
|
143
142
|
return (0, _reducer["default"])(plannerState, action);
|
|
144
143
|
});
|
|
145
144
|
};
|
|
146
|
-
|
|
147
|
-
// keep devtools behavior identical; guard against missing window
|
|
148
145
|
var enhancer = !isProduction && isBrowser && window.devToolsExtension ? window.devToolsExtension({
|
|
149
146
|
features: {
|
|
150
147
|
pause: true,
|
|
@@ -164,8 +161,6 @@ function createInstanceStore() {
|
|
|
164
161
|
};
|
|
165
162
|
return (0, _redux.createStore)(reducer, null, enhancer);
|
|
166
163
|
}
|
|
167
|
-
|
|
168
|
-
// ----------------- plugins -----------------
|
|
169
164
|
function createPlugins() {
|
|
170
165
|
return [(0, _export2.Keyboard)(), (0, _export2.ConsoleDebugger)()];
|
|
171
166
|
}
|
|
@@ -179,28 +174,29 @@ function LiteRenderer(props) {
|
|
|
179
174
|
onError = props.onError,
|
|
180
175
|
passThrough = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
181
176
|
|
|
182
|
-
//
|
|
177
|
+
// ✅ instance-scoped store (no module singleton)
|
|
183
178
|
var storeRef = (0, _react.useRef)(null);
|
|
184
179
|
if (!storeRef.current) storeRef.current = createInstanceStore();
|
|
180
|
+
|
|
181
|
+
// ✅ instance-scoped catalog (no module singleton)
|
|
185
182
|
var catalogRef = (0, _react.useRef)(null);
|
|
186
183
|
if (!catalogRef.current) {
|
|
187
184
|
catalogRef.current = new _catalog["default"]();
|
|
188
185
|
initCatalogOnce(catalogRef.current);
|
|
189
186
|
}
|
|
190
187
|
|
|
191
|
-
//
|
|
192
|
-
var pluginCleanupsRef = (0, _react.useRef)([]);
|
|
188
|
+
// ✅ stable plugins array
|
|
193
189
|
var plugins = (0, _react.useMemo)(function () {
|
|
194
190
|
return createPlugins();
|
|
195
|
-
}, []);
|
|
191
|
+
}, []);
|
|
196
192
|
|
|
193
|
+
// ✅ plugin lifecycle: supports cleanup if plugin returns function
|
|
194
|
+
var pluginCleanupsRef = (0, _react.useRef)([]);
|
|
197
195
|
(0, _react.useEffect)(function () {
|
|
198
196
|
var store = storeRef.current;
|
|
199
197
|
var stateExtractor = function stateExtractor(state) {
|
|
200
198
|
return state.get('KitchenConfigurator');
|
|
201
199
|
};
|
|
202
|
-
|
|
203
|
-
// plugins may or may not return cleanup; support both
|
|
204
200
|
var cleanups = [];
|
|
205
201
|
var _iterator = _createForOfIteratorHelper(plugins),
|
|
206
202
|
_step;
|
|
@@ -210,9 +206,8 @@ function LiteRenderer(props) {
|
|
|
210
206
|
try {
|
|
211
207
|
var maybeCleanup = p === null || p === void 0 ? void 0 : p(store, stateExtractor);
|
|
212
208
|
if (typeof maybeCleanup === 'function') cleanups.push(maybeCleanup);
|
|
213
|
-
} catch (
|
|
214
|
-
// keep behavior:
|
|
215
|
-
// (actual emitting is handled below)
|
|
209
|
+
} catch (_unused4) {
|
|
210
|
+
// keep prior behavior: do not crash
|
|
216
211
|
}
|
|
217
212
|
}
|
|
218
213
|
} catch (err) {
|
|
@@ -260,8 +255,7 @@ function LiteRenderer(props) {
|
|
|
260
255
|
};
|
|
261
256
|
try {
|
|
262
257
|
onError === null || onError === void 0 || onError(payload);
|
|
263
|
-
} catch (
|
|
264
|
-
// keep your debug
|
|
258
|
+
} catch (_unused5) {}
|
|
265
259
|
// eslint-disable-next-line no-console
|
|
266
260
|
console.debug('[LiteRenderer:onError]', payload);
|
|
267
261
|
lastEmittedRef.current = payload;
|