kitchen-simulator 4.1.7-react-18 → 4.2.2
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/README.md +3 -0
- package/es/AppContext.js +1 -1
- package/es/LiteKitchenConfigurator.js +171 -111
- package/es/LiteRenderer.js +161 -129
- package/es/actions/export.js +25 -12
- package/es/actions/project-actions.js +2 -1
- package/es/assets/gltf/door_sliding.bin +0 -0
- package/es/assets/img/svg/bottombar/elevation.svg +12 -5
- package/es/catalog/catalog.js +21 -5
- package/es/catalog/factories/area-factory-3d.js +17 -17
- package/es/catalog/factories/wall-factory.js +1 -1
- package/es/catalog/holes/window-clear/planner-element.js +2 -2
- package/es/catalog/properties/export.js +21 -0
- package/es/catalog/properties/property-checkbox.js +68 -0
- package/es/catalog/properties/property-color.js +39 -0
- package/es/catalog/properties/property-enum.js +50 -0
- package/es/catalog/properties/property-hidden.js +19 -0
- package/es/catalog/properties/property-lenght-measure.js +100 -0
- package/es/catalog/properties/property-length-measure.js +84 -0
- package/es/catalog/properties/property-length-measure_hole.js +100 -0
- package/es/catalog/properties/property-number.js +48 -0
- package/es/catalog/properties/property-read-only.js +26 -0
- package/es/catalog/properties/property-string.js +48 -0
- package/es/catalog/properties/property-toggle.js +39 -0
- package/es/catalog/properties/shared-property-style.js +14 -0
- package/es/catalog/utils/exporter.js +24 -11
- package/es/catalog/utils/item-loader.js +224 -220
- package/es/class/hole.js +0 -2
- package/es/class/item.js +92 -70
- package/es/class/layer.js +1 -1
- package/es/class/line.js +4 -8
- package/es/class/project.js +96 -81
- package/es/components/content.js +10 -93
- package/es/components/export.js +4 -6
- package/es/components/style/button.js +106 -0
- package/es/components/style/cancel-button.js +21 -0
- package/es/components/style/content-container.js +30 -0
- package/es/components/style/content-title.js +25 -0
- package/es/components/style/delete-button.js +24 -0
- package/es/components/style/export.js +28 -2
- package/es/components/style/form-block.js +20 -0
- package/es/components/style/form-color-input.js +26 -0
- package/es/components/style/form-label.js +22 -0
- package/es/components/style/form-number-input.js +29 -29
- package/es/components/style/form-number-input_2.js +200 -0
- package/es/components/style/form-select.js +19 -0
- package/es/components/style/form-slider.js +60 -0
- package/es/components/style/form-submit-button.js +25 -0
- package/es/components/style/form-text-input.js +69 -0
- package/es/components/viewer2d/grids/grid-streak.js +1 -1
- package/es/components/viewer2d/group.js +5 -4
- package/es/components/viewer2d/item.js +155 -359
- package/es/components/viewer2d/layer.js +1 -1
- package/es/components/viewer2d/line.js +22 -54
- package/es/components/viewer2d/ruler.js +16 -11
- package/es/components/viewer2d/rulerDist.js +38 -51
- package/es/components/viewer2d/rulerX.js +4 -2
- package/es/components/viewer2d/rulerY.js +3 -0
- package/es/components/viewer2d/scene.js +17 -12
- package/es/components/viewer2d/state.js +1 -1
- package/es/components/viewer2d/utils.js +2 -2
- package/es/components/viewer2d/vertex.js +3 -2
- package/es/components/viewer2d/viewer2d.js +81 -118
- package/es/components/viewer3d/front3D.js +13 -1
- package/es/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/es/components/viewer3d/scene-creator.js +270 -69
- package/es/components/viewer3d/viewer3d-first-person.js +26 -32
- package/es/components/viewer3d/viewer3d.js +110 -130
- package/es/constants.js +7 -2
- package/es/devLiteRenderer.js +491 -150
- package/es/index.js +589 -62
- package/es/models.js +13 -8
- package/es/plugins/SVGLoader.js +1414 -0
- package/es/plugins/console-debugger.js +34 -0
- package/es/plugins/export.js +7 -0
- package/es/plugins/keyboard.js +110 -0
- package/es/reducers/project-reducer.js +4 -1
- package/es/reducers/viewer2d-reducer.js +3 -1
- package/es/reducers/viewer3d-reducer.js +3 -1
- package/es/styles/export.js +5 -0
- package/es/styles/tabs.css +40 -0
- package/es/utils/geometry.js +77 -119
- package/es/utils/helper.js +38 -1
- package/es/utils/isolate-event-handler.js +829 -609
- package/es/utils/molding.js +489 -11
- package/es/utils/ruler.js +58 -0
- package/lib/AppContext.js +1 -1
- package/lib/LiteKitchenConfigurator.js +170 -111
- package/lib/LiteRenderer.js +160 -129
- package/lib/actions/export.js +35 -39
- package/lib/actions/project-actions.js +2 -1
- package/lib/assets/gltf/door_sliding.bin +0 -0
- package/lib/assets/img/svg/bottombar/elevation.svg +12 -5
- package/lib/catalog/catalog.js +20 -4
- package/lib/catalog/factories/area-factory-3d.js +14 -14
- package/lib/catalog/factories/wall-factory.js +1 -1
- package/lib/catalog/holes/window-clear/planner-element.js +2 -2
- package/lib/catalog/properties/export.js +81 -0
- package/lib/catalog/properties/property-checkbox.js +76 -0
- package/lib/catalog/properties/property-color.js +47 -0
- package/lib/catalog/properties/property-enum.js +58 -0
- package/lib/catalog/properties/property-hidden.js +27 -0
- package/lib/catalog/properties/property-lenght-measure.js +108 -0
- package/lib/catalog/properties/property-length-measure.js +92 -0
- package/lib/catalog/properties/property-length-measure_hole.js +108 -0
- package/lib/catalog/properties/property-number.js +56 -0
- package/lib/catalog/properties/property-read-only.js +34 -0
- package/lib/catalog/properties/property-string.js +56 -0
- package/lib/catalog/properties/property-toggle.js +47 -0
- package/lib/catalog/properties/shared-property-style.js +21 -0
- package/lib/catalog/utils/exporter.js +24 -11
- package/lib/catalog/utils/item-loader.js +221 -217
- package/lib/class/hole.js +0 -2
- package/lib/class/item.js +90 -68
- package/lib/class/layer.js +1 -1
- package/lib/class/line.js +3 -7
- package/lib/class/project.js +96 -81
- package/lib/components/content.js +10 -93
- package/lib/components/export.js +6 -26
- package/lib/components/style/button.js +115 -0
- package/lib/components/style/cancel-button.js +29 -0
- package/lib/components/style/content-container.js +38 -0
- package/lib/components/style/content-title.js +35 -0
- package/lib/components/style/delete-button.js +34 -0
- package/lib/components/style/export.js +105 -1
- package/lib/components/style/form-block.js +28 -0
- package/lib/components/style/form-color-input.js +34 -0
- package/lib/components/style/form-label.js +30 -0
- package/lib/components/style/form-number-input.js +29 -29
- package/lib/components/style/form-number-input_2.js +209 -0
- package/lib/components/style/form-select.js +29 -0
- package/lib/components/style/form-slider.js +68 -0
- package/lib/components/style/form-submit-button.js +35 -0
- package/lib/components/style/form-text-input.js +78 -0
- package/lib/components/viewer2d/grids/grid-streak.js +1 -1
- package/lib/components/viewer2d/group.js +5 -4
- package/lib/components/viewer2d/item.js +152 -356
- package/lib/components/viewer2d/layer.js +1 -1
- package/lib/components/viewer2d/line.js +22 -54
- package/lib/components/viewer2d/ruler.js +15 -10
- package/lib/components/viewer2d/rulerDist.js +38 -51
- package/lib/components/viewer2d/rulerX.js +4 -2
- package/lib/components/viewer2d/rulerY.js +3 -0
- package/lib/components/viewer2d/scene.js +17 -12
- package/lib/components/viewer2d/state.js +1 -1
- package/lib/components/viewer2d/utils.js +2 -2
- package/lib/components/viewer2d/vertex.js +3 -2
- package/lib/components/viewer2d/viewer2d.js +79 -115
- package/lib/components/viewer3d/front3D.js +13 -1
- package/lib/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/lib/components/viewer3d/scene-creator.js +267 -66
- package/lib/components/viewer3d/viewer3d-first-person.js +26 -32
- package/lib/components/viewer3d/viewer3d.js +107 -126
- package/lib/constants.js +12 -7
- package/lib/devLiteRenderer.js +489 -148
- package/lib/index.js +591 -62
- package/lib/models.js +13 -8
- package/lib/plugins/SVGLoader.js +1419 -0
- package/lib/plugins/console-debugger.js +42 -0
- package/lib/plugins/export.js +25 -0
- package/lib/plugins/keyboard.js +117 -0
- package/lib/reducers/project-reducer.js +4 -1
- package/lib/reducers/viewer2d-reducer.js +3 -1
- package/lib/reducers/viewer3d-reducer.js +3 -1
- package/lib/styles/export.js +13 -0
- package/lib/styles/tabs.css +40 -0
- package/lib/utils/geometry.js +77 -119
- package/lib/utils/helper.js +40 -1
- package/lib/utils/isolate-event-handler.js +829 -608
- package/lib/utils/molding.js +490 -9
- package/lib/utils/ruler.js +63 -0
- package/package.json +21 -20
- package/es/mocks/appliancePayload.json +0 -27
- package/es/mocks/cabinetPayload.json +0 -1914
- package/es/mocks/cabinetPayload2.json +0 -76
- package/es/mocks/dataBundle2.json +0 -4
- package/es/mocks/distancePayload.json +0 -6
- package/es/mocks/doorStylePayload2.json +0 -84
- package/es/mocks/furnishingPayload.json +0 -23
- package/es/mocks/itemCDSPayload.json +0 -27
- package/es/mocks/lightingPayload.json +0 -23
- package/es/mocks/mockProps.json +0 -43
- package/es/mocks/mockProps2.json +0 -9
- package/es/mocks/moldingPayload.json +0 -19
- package/es/mocks/projectItemsCatalog.json +0 -133
- package/es/mocks/rectangleShape.json +0 -238
- package/es/mocks/replaceCabinetPayload.json +0 -81
- package/es/mocks/roomShapePayload.json +0 -5
- package/es/useAppContext.js +0 -8
- package/lib/mocks/appliancePayload.json +0 -27
- package/lib/mocks/cabinetPayload.json +0 -1914
- package/lib/mocks/cabinetPayload2.json +0 -76
- package/lib/mocks/dataBundle2.json +0 -4
- package/lib/mocks/distancePayload.json +0 -6
- package/lib/mocks/doorStylePayload2.json +0 -84
- package/lib/mocks/furnishingPayload.json +0 -23
- package/lib/mocks/itemCDSPayload.json +0 -27
- package/lib/mocks/lightingPayload.json +0 -23
- package/lib/mocks/mockProps.json +0 -43
- package/lib/mocks/mockProps2.json +0 -9
- package/lib/mocks/moldingPayload.json +0 -19
- package/lib/mocks/projectItemsCatalog.json +0 -133
- package/lib/mocks/rectangleShape.json +0 -238
- package/lib/mocks/replaceCabinetPayload.json +0 -81
- package/lib/mocks/roomShapePayload.json +0 -5
- package/lib/useAppContext.js +0 -16
package/es/index.js
CHANGED
|
@@ -4,69 +4,519 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
4
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
6
6
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
7
8
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
9
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
|
+
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; } } }; }
|
|
11
|
+
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; } }
|
|
12
|
+
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; }
|
|
13
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
14
|
import React from 'react';
|
|
10
|
-
import
|
|
15
|
+
import * as Three from 'three';
|
|
11
16
|
import LiteRenderer from "./LiteRenderer";
|
|
17
|
+
import { createRoot } from 'react-dom/client';
|
|
12
18
|
var ROOT_KEY = '__kitchenSimulatorRoot__';
|
|
19
|
+
var API_KEY = '__kitchenSimulatorApi__';
|
|
20
|
+
function nextFrame() {
|
|
21
|
+
return new Promise(function (resolve) {
|
|
22
|
+
return requestAnimationFrame(resolve);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// DIY-714 [Temp Fix] Rewrite API URLs
|
|
27
|
+
var API_HOST_REGEX = /(https?:\/\/)?(api\.diydesignspace\.com|api\.addovisuals\.com|127\.0\.0\.1:4002)/;
|
|
28
|
+
var API_HOST_REPLACEMENT = 'https://api-old.diydesignspace.com';
|
|
29
|
+
function rewriteApiUrl(url) {
|
|
30
|
+
return typeof url === 'string' ? url.replace(API_HOST_REGEX, API_HOST_REPLACEMENT) : url;
|
|
31
|
+
}
|
|
32
|
+
var originalTextureLoad = Three.TextureLoader.prototype.load;
|
|
33
|
+
Three.TextureLoader.prototype.load = function (url, onLoad, onProgress, onError) {
|
|
34
|
+
var newUrl = rewriteApiUrl(url);
|
|
35
|
+
return originalTextureLoad.call(this, newUrl, onLoad, onProgress, onError);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Track 3D asset network activity (gltf/glb/bin/textures/hdr/etc)
|
|
40
|
+
* Ref-counted global install so multiple instances don't clobber each other.
|
|
41
|
+
*/
|
|
42
|
+
function installGltfTracker() {
|
|
43
|
+
if (typeof window === 'undefined') {
|
|
44
|
+
var _subscribe = function _subscribe() {
|
|
45
|
+
return function () {};
|
|
46
|
+
};
|
|
47
|
+
return {
|
|
48
|
+
getInFlight: function getInFlight() {
|
|
49
|
+
return 0;
|
|
50
|
+
},
|
|
51
|
+
waitForIdle: function () {
|
|
52
|
+
var _waitForIdle = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
53
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
54
|
+
while (1) switch (_context.prev = _context.next) {
|
|
55
|
+
case 0:
|
|
56
|
+
return _context.abrupt("return", true);
|
|
57
|
+
case 1:
|
|
58
|
+
case "end":
|
|
59
|
+
return _context.stop();
|
|
60
|
+
}
|
|
61
|
+
}, _callee);
|
|
62
|
+
}));
|
|
63
|
+
function waitForIdle() {
|
|
64
|
+
return _waitForIdle.apply(this, arguments);
|
|
65
|
+
}
|
|
66
|
+
return waitForIdle;
|
|
67
|
+
}(),
|
|
68
|
+
uninstall: function uninstall() {},
|
|
69
|
+
subscribe: _subscribe
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
var GLOBAL_KEY = '__kitchenSimulatorGltfTracker__';
|
|
73
|
+
if (!window[GLOBAL_KEY]) {
|
|
74
|
+
window[GLOBAL_KEY] = {
|
|
75
|
+
refCount: 0,
|
|
76
|
+
inFlight: 0,
|
|
77
|
+
listeners: new Set(),
|
|
78
|
+
installed: false,
|
|
79
|
+
originalFetch: null,
|
|
80
|
+
originalOpen: null,
|
|
81
|
+
originalSend: null
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
var g = window[GLOBAL_KEY];
|
|
85
|
+
var is3dAssetUrl = function is3dAssetUrl(url) {
|
|
86
|
+
try {
|
|
87
|
+
var _url$toString, _url$toString2;
|
|
88
|
+
var s = typeof url === 'string' ? url : (_url$toString = url === null || url === void 0 || (_url$toString2 = url.toString) === null || _url$toString2 === void 0 ? void 0 : _url$toString2.call(url)) !== null && _url$toString !== void 0 ? _url$toString : '';
|
|
89
|
+
var u = s.toLowerCase().split('?')[0]; // ignore cache params
|
|
90
|
+
return u.endsWith('.gltf') || u.endsWith('.glb') || u.endsWith('.bin') || u.endsWith('.ktx2') || u.endsWith('.hdr') || u.endsWith('.exr') || u.endsWith('.png') || u.endsWith('.jpg') || u.endsWith('.jpeg') || u.endsWith('.webp');
|
|
91
|
+
} catch (_unused) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
var notify = function notify() {
|
|
96
|
+
var _iterator = _createForOfIteratorHelper(g.listeners),
|
|
97
|
+
_step;
|
|
98
|
+
try {
|
|
99
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
100
|
+
var fn = _step.value;
|
|
101
|
+
fn(g.inFlight);
|
|
102
|
+
}
|
|
103
|
+
} catch (err) {
|
|
104
|
+
_iterator.e(err);
|
|
105
|
+
} finally {
|
|
106
|
+
_iterator.f();
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
var subscribe = function subscribe(fn) {
|
|
110
|
+
g.listeners.add(fn);
|
|
111
|
+
fn(g.inFlight); // sync emit on subscribe
|
|
112
|
+
return function () {
|
|
113
|
+
return g.listeners["delete"](fn);
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
var installIfNeeded = function installIfNeeded() {
|
|
117
|
+
var _XHR$prototype, _XHR$prototype2;
|
|
118
|
+
if (g.installed) return;
|
|
119
|
+
|
|
120
|
+
// ---- XHR hook ----
|
|
121
|
+
var XHR = window.XMLHttpRequest;
|
|
122
|
+
if (XHR !== null && XHR !== void 0 && (_XHR$prototype = XHR.prototype) !== null && _XHR$prototype !== void 0 && _XHR$prototype.open && XHR !== null && XHR !== void 0 && (_XHR$prototype2 = XHR.prototype) !== null && _XHR$prototype2 !== void 0 && _XHR$prototype2.send) {
|
|
123
|
+
g.originalOpen = XHR.prototype.open;
|
|
124
|
+
g.originalSend = XHR.prototype.send;
|
|
125
|
+
XHR.prototype.open = function (method, url) {
|
|
126
|
+
var _g$originalOpen;
|
|
127
|
+
this.__is3dAssetRequest = is3dAssetUrl(url);
|
|
128
|
+
for (var _len = arguments.length, rest = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
129
|
+
rest[_key - 2] = arguments[_key];
|
|
130
|
+
}
|
|
131
|
+
return (_g$originalOpen = g.originalOpen).call.apply(_g$originalOpen, [this, method, url].concat(rest));
|
|
132
|
+
};
|
|
133
|
+
XHR.prototype.send = function () {
|
|
134
|
+
var _this = this;
|
|
135
|
+
if (this.__is3dAssetRequest) {
|
|
136
|
+
g.inFlight += 1;
|
|
137
|
+
notify();
|
|
138
|
+
var _done = function done() {
|
|
139
|
+
g.inFlight -= 1;
|
|
140
|
+
if (g.inFlight < 0) g.inFlight = 0;
|
|
141
|
+
notify();
|
|
142
|
+
_this.removeEventListener('loadend', _done);
|
|
143
|
+
};
|
|
144
|
+
this.addEventListener('loadend', _done);
|
|
145
|
+
}
|
|
146
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
147
|
+
args[_key2] = arguments[_key2];
|
|
148
|
+
}
|
|
149
|
+
return g.originalSend.apply(this, args);
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// ---- fetch hook ----
|
|
154
|
+
g.originalFetch = window.fetch;
|
|
155
|
+
if (typeof g.originalFetch === 'function') {
|
|
156
|
+
window.fetch = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
157
|
+
var _len3,
|
|
158
|
+
args,
|
|
159
|
+
_key3,
|
|
160
|
+
input,
|
|
161
|
+
init,
|
|
162
|
+
newUrl,
|
|
163
|
+
track,
|
|
164
|
+
_args2 = arguments;
|
|
165
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
166
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
167
|
+
case 0:
|
|
168
|
+
for (_len3 = _args2.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
169
|
+
args[_key3] = _args2[_key3];
|
|
170
|
+
}
|
|
171
|
+
input = args[0], init = args[1]; // DIY-714 [Temp Fix] Rewrite API URLs
|
|
172
|
+
if (typeof input === 'string') {
|
|
173
|
+
input = rewriteApiUrl(input);
|
|
174
|
+
} else if (input instanceof Request) {
|
|
175
|
+
newUrl = rewriteApiUrl(input.url);
|
|
176
|
+
input = new Request(newUrl, input);
|
|
177
|
+
}
|
|
178
|
+
track = is3dAssetUrl(input);
|
|
179
|
+
if (track) {
|
|
180
|
+
_context2.next = 1;
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
return _context2.abrupt("return", g.originalFetch.call(this, input, init));
|
|
184
|
+
case 1:
|
|
185
|
+
g.inFlight += 1;
|
|
186
|
+
notify();
|
|
187
|
+
_context2.prev = 2;
|
|
188
|
+
_context2.next = 3;
|
|
189
|
+
return g.originalFetch.call(this, input, init);
|
|
190
|
+
case 3:
|
|
191
|
+
return _context2.abrupt("return", _context2.sent);
|
|
192
|
+
case 4:
|
|
193
|
+
_context2.prev = 4;
|
|
194
|
+
g.inFlight -= 1;
|
|
195
|
+
if (g.inFlight < 0) g.inFlight = 0;
|
|
196
|
+
notify();
|
|
197
|
+
return _context2.finish(4);
|
|
198
|
+
case 5:
|
|
199
|
+
case "end":
|
|
200
|
+
return _context2.stop();
|
|
201
|
+
}
|
|
202
|
+
}, _callee2, this, [[2,, 4, 5]]);
|
|
203
|
+
}));
|
|
204
|
+
}
|
|
205
|
+
g.installed = true;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
// “No grace” but stable: idle must remain idle for 2 RAF frames
|
|
209
|
+
function waitStableIdle2Frames() {
|
|
210
|
+
return _waitStableIdle2Frames.apply(this, arguments);
|
|
211
|
+
}
|
|
212
|
+
function _waitStableIdle2Frames() {
|
|
213
|
+
_waitStableIdle2Frames = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
214
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
215
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
216
|
+
case 0:
|
|
217
|
+
_context5.next = 1;
|
|
218
|
+
return nextFrame();
|
|
219
|
+
case 1:
|
|
220
|
+
if (!(g.inFlight !== 0)) {
|
|
221
|
+
_context5.next = 2;
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
return _context5.abrupt("return", false);
|
|
225
|
+
case 2:
|
|
226
|
+
_context5.next = 3;
|
|
227
|
+
return nextFrame();
|
|
228
|
+
case 3:
|
|
229
|
+
return _context5.abrupt("return", g.inFlight === 0);
|
|
230
|
+
case 4:
|
|
231
|
+
case "end":
|
|
232
|
+
return _context5.stop();
|
|
233
|
+
}
|
|
234
|
+
}, _callee5);
|
|
235
|
+
}));
|
|
236
|
+
return _waitStableIdle2Frames.apply(this, arguments);
|
|
237
|
+
}
|
|
238
|
+
var waitForIdle = /*#__PURE__*/function () {
|
|
239
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
240
|
+
var _ref3,
|
|
241
|
+
_ref3$timeoutMs,
|
|
242
|
+
timeoutMs,
|
|
243
|
+
start,
|
|
244
|
+
_args4 = arguments;
|
|
245
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
246
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
247
|
+
case 0:
|
|
248
|
+
_ref3 = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, _ref3$timeoutMs = _ref3.timeoutMs, timeoutMs = _ref3$timeoutMs === void 0 ? 30000 : _ref3$timeoutMs;
|
|
249
|
+
start = Date.now();
|
|
250
|
+
_context4.next = 1;
|
|
251
|
+
return waitStableIdle2Frames();
|
|
252
|
+
case 1:
|
|
253
|
+
if (!_context4.sent) {
|
|
254
|
+
_context4.next = 2;
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
return _context4.abrupt("return", true);
|
|
258
|
+
case 2:
|
|
259
|
+
return _context4.abrupt("return", new Promise(function (resolve, reject) {
|
|
260
|
+
var unsub = null;
|
|
261
|
+
var onChange = /*#__PURE__*/function () {
|
|
262
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(count) {
|
|
263
|
+
var stable;
|
|
264
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
265
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
266
|
+
case 0:
|
|
267
|
+
if (!(count !== 0)) {
|
|
268
|
+
_context3.next = 1;
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
if (Date.now() - start > timeoutMs) {
|
|
272
|
+
if (unsub) unsub();
|
|
273
|
+
reject(new Error('3D assets did not become idle within timeout'));
|
|
274
|
+
}
|
|
275
|
+
return _context3.abrupt("return");
|
|
276
|
+
case 1:
|
|
277
|
+
_context3.next = 2;
|
|
278
|
+
return waitStableIdle2Frames();
|
|
279
|
+
case 2:
|
|
280
|
+
stable = _context3.sent;
|
|
281
|
+
if (!stable) {
|
|
282
|
+
_context3.next = 3;
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
if (unsub) unsub();
|
|
286
|
+
resolve(true);
|
|
287
|
+
return _context3.abrupt("return");
|
|
288
|
+
case 3:
|
|
289
|
+
if (Date.now() - start > timeoutMs) {
|
|
290
|
+
if (unsub) unsub();
|
|
291
|
+
reject(new Error('3D assets did not become idle within timeout'));
|
|
292
|
+
}
|
|
293
|
+
case 4:
|
|
294
|
+
case "end":
|
|
295
|
+
return _context3.stop();
|
|
296
|
+
}
|
|
297
|
+
}, _callee3);
|
|
298
|
+
}));
|
|
299
|
+
return function onChange(_x) {
|
|
300
|
+
return _ref4.apply(this, arguments);
|
|
301
|
+
};
|
|
302
|
+
}();
|
|
303
|
+
unsub = subscribe(onChange);
|
|
304
|
+
}));
|
|
305
|
+
case 3:
|
|
306
|
+
case "end":
|
|
307
|
+
return _context4.stop();
|
|
308
|
+
}
|
|
309
|
+
}, _callee4);
|
|
310
|
+
}));
|
|
311
|
+
return function waitForIdle() {
|
|
312
|
+
return _ref2.apply(this, arguments);
|
|
313
|
+
};
|
|
314
|
+
}();
|
|
315
|
+
var uninstall = function uninstall() {
|
|
316
|
+
var _XHR$prototype3, _XHR$prototype4;
|
|
317
|
+
g.refCount -= 1;
|
|
318
|
+
if (g.refCount > 0) return;
|
|
319
|
+
var XHR = window.XMLHttpRequest;
|
|
320
|
+
if (XHR !== null && XHR !== void 0 && (_XHR$prototype3 = XHR.prototype) !== null && _XHR$prototype3 !== void 0 && _XHR$prototype3.open && g.originalOpen) XHR.prototype.open = g.originalOpen;
|
|
321
|
+
if (XHR !== null && XHR !== void 0 && (_XHR$prototype4 = XHR.prototype) !== null && _XHR$prototype4 !== void 0 && _XHR$prototype4.send && g.originalSend) XHR.prototype.send = g.originalSend;
|
|
322
|
+
if (typeof g.originalFetch === 'function') window.fetch = g.originalFetch;
|
|
323
|
+
g.listeners.clear();
|
|
324
|
+
g.inFlight = 0;
|
|
325
|
+
g.installed = false;
|
|
326
|
+
g.originalFetch = null;
|
|
327
|
+
g.originalOpen = null;
|
|
328
|
+
g.originalSend = null;
|
|
329
|
+
};
|
|
330
|
+
g.refCount += 1;
|
|
331
|
+
installIfNeeded();
|
|
332
|
+
return {
|
|
333
|
+
getInFlight: function getInFlight() {
|
|
334
|
+
return g.inFlight;
|
|
335
|
+
},
|
|
336
|
+
waitForIdle: waitForIdle,
|
|
337
|
+
uninstall: uninstall,
|
|
338
|
+
subscribe: subscribe
|
|
339
|
+
};
|
|
340
|
+
}
|
|
13
341
|
export function renderKitchenSimulator(container) {
|
|
342
|
+
var _props$framesPerEvent, _props$waitForGltfIdl, _props$gltfTimeoutMs;
|
|
14
343
|
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
15
|
-
|
|
344
|
+
if (!container) throw new Error('renderKitchenSimulator: container is required');
|
|
345
|
+
|
|
346
|
+
// ✅ Reuse existing API
|
|
347
|
+
if (container[API_KEY]) {
|
|
348
|
+
var _container$API_KEY$__, _container$API_KEY;
|
|
349
|
+
(_container$API_KEY$__ = (_container$API_KEY = container[API_KEY]).__render) === null || _container$API_KEY$__ === void 0 || _container$API_KEY$__.call(_container$API_KEY, props);
|
|
350
|
+
return container[API_KEY];
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// ✅ Reuse root
|
|
354
|
+
var root = container[ROOT_KEY];
|
|
355
|
+
if (!root) {
|
|
356
|
+
root = createRoot(container);
|
|
357
|
+
container[ROOT_KEY] = root;
|
|
358
|
+
}
|
|
359
|
+
var setExternalEventFn = null;
|
|
360
|
+
var destroyed = false;
|
|
361
|
+
var queue = [];
|
|
362
|
+
var pendingMarkers = new Set();
|
|
363
|
+
var MARKER = Symbol('marker');
|
|
364
|
+
var gltfTracker = installGltfTracker();
|
|
365
|
+
|
|
366
|
+
// FAST defaults (safe)
|
|
367
|
+
var defaultFramesPerEvent = (_props$framesPerEvent = props.framesPerEvent) !== null && _props$framesPerEvent !== void 0 ? _props$framesPerEvent : 1;
|
|
368
|
+
var waitForAssets = (_props$waitForGltfIdl = props.waitForGltfIdleAfterEachEvent) !== null && _props$waitForGltfIdl !== void 0 ? _props$waitForGltfIdl : true;
|
|
369
|
+
var defaultTimeout = (_props$gltfTimeoutMs = props.gltfTimeoutMs) !== null && _props$gltfTimeoutMs !== void 0 ? _props$gltfTimeoutMs : 30000;
|
|
370
|
+
|
|
371
|
+
// If you want ultra-fast UI responsiveness, you can disable waiting per-event
|
|
372
|
+
// and only wait on “important” events, see comment in settle() below.
|
|
373
|
+
|
|
374
|
+
var draining = false;
|
|
375
|
+
function isSyncScene(ev) {
|
|
376
|
+
var _ev$payload;
|
|
377
|
+
return (ev === null || ev === void 0 ? void 0 : ev.type) === 'EXTERNAL_EVENT_SYNC_SCENE' || (ev === null || ev === void 0 || (_ev$payload = ev.payload) === null || _ev$payload === void 0 ? void 0 : _ev$payload.mode) === 'sync-scene' || (ev === null || ev === void 0 ? void 0 : ev.__sync) === true;
|
|
378
|
+
}
|
|
379
|
+
function settle(_x2) {
|
|
380
|
+
return _settle.apply(this, arguments);
|
|
381
|
+
}
|
|
382
|
+
function _settle() {
|
|
383
|
+
_settle = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(ev) {
|
|
384
|
+
var _ev$framesPerEvent, _ev$waitForGltfIdleAf;
|
|
385
|
+
var frames, i, shouldWait, _ev$gltfTimeoutMs, timeoutMs;
|
|
386
|
+
return _regeneratorRuntime.wrap(function (_context7) {
|
|
387
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
388
|
+
case 0:
|
|
389
|
+
frames = (_ev$framesPerEvent = ev === null || ev === void 0 ? void 0 : ev.framesPerEvent) !== null && _ev$framesPerEvent !== void 0 ? _ev$framesPerEvent : defaultFramesPerEvent; // (1) allow react/reducers to run (fixes “must zoom to see updates”)
|
|
390
|
+
i = 0;
|
|
391
|
+
case 1:
|
|
392
|
+
if (!(i < frames)) {
|
|
393
|
+
_context7.next = 3;
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
396
|
+
_context7.next = 2;
|
|
397
|
+
return nextFrame();
|
|
398
|
+
case 2:
|
|
399
|
+
i += 1;
|
|
400
|
+
_context7.next = 1;
|
|
401
|
+
break;
|
|
402
|
+
case 3:
|
|
403
|
+
// (2) optionally wait for assets
|
|
404
|
+
// fastest safe approach: keep ON for events that add/replace/load models
|
|
405
|
+
// You can override per-event via ev.waitForGltfIdleAfterEachEvent = false
|
|
406
|
+
shouldWait = (_ev$waitForGltfIdleAf = ev === null || ev === void 0 ? void 0 : ev.waitForGltfIdleAfterEachEvent) !== null && _ev$waitForGltfIdleAf !== void 0 ? _ev$waitForGltfIdleAf : waitForAssets;
|
|
407
|
+
if (!shouldWait) {
|
|
408
|
+
_context7.next = 4;
|
|
409
|
+
break;
|
|
410
|
+
}
|
|
411
|
+
timeoutMs = (_ev$gltfTimeoutMs = ev === null || ev === void 0 ? void 0 : ev.gltfTimeoutMs) !== null && _ev$gltfTimeoutMs !== void 0 ? _ev$gltfTimeoutMs : defaultTimeout;
|
|
412
|
+
_context7.next = 4;
|
|
413
|
+
return gltfTracker.waitForIdle({
|
|
414
|
+
timeoutMs: timeoutMs
|
|
415
|
+
});
|
|
416
|
+
case 4:
|
|
417
|
+
_context7.next = 5;
|
|
418
|
+
return nextFrame();
|
|
419
|
+
case 5:
|
|
420
|
+
if (!isSyncScene(ev)) {
|
|
421
|
+
_context7.next = 6;
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
_context7.next = 6;
|
|
425
|
+
return nextFrame();
|
|
426
|
+
case 6:
|
|
427
|
+
case "end":
|
|
428
|
+
return _context7.stop();
|
|
429
|
+
}
|
|
430
|
+
}, _callee7);
|
|
431
|
+
}));
|
|
432
|
+
return _settle.apply(this, arguments);
|
|
433
|
+
}
|
|
434
|
+
function drain() {
|
|
435
|
+
return _drain.apply(this, arguments);
|
|
436
|
+
}
|
|
437
|
+
function _drain() {
|
|
438
|
+
_drain = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
439
|
+
var item;
|
|
440
|
+
return _regeneratorRuntime.wrap(function (_context8) {
|
|
441
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
442
|
+
case 0:
|
|
443
|
+
if (!(draining || destroyed)) {
|
|
444
|
+
_context8.next = 1;
|
|
445
|
+
break;
|
|
446
|
+
}
|
|
447
|
+
return _context8.abrupt("return");
|
|
448
|
+
case 1:
|
|
449
|
+
draining = true;
|
|
450
|
+
_context8.prev = 2;
|
|
451
|
+
case 3:
|
|
452
|
+
if (!(!destroyed && queue.length)) {
|
|
453
|
+
_context8.next = 8;
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
if (setExternalEventFn) {
|
|
457
|
+
_context8.next = 5;
|
|
458
|
+
break;
|
|
459
|
+
}
|
|
460
|
+
_context8.next = 4;
|
|
461
|
+
return nextFrame();
|
|
462
|
+
case 4:
|
|
463
|
+
return _context8.abrupt("continue", 3);
|
|
464
|
+
case 5:
|
|
465
|
+
item = queue.shift();
|
|
466
|
+
if (!(item && item.__marker === MARKER)) {
|
|
467
|
+
_context8.next = 6;
|
|
468
|
+
break;
|
|
469
|
+
}
|
|
470
|
+
pendingMarkers["delete"](item.token);
|
|
471
|
+
return _context8.abrupt("continue", 3);
|
|
472
|
+
case 6:
|
|
473
|
+
setExternalEventFn(item);
|
|
474
|
+
_context8.next = 7;
|
|
475
|
+
return settle(item);
|
|
476
|
+
case 7:
|
|
477
|
+
_context8.next = 3;
|
|
478
|
+
break;
|
|
479
|
+
case 8:
|
|
480
|
+
_context8.prev = 8;
|
|
481
|
+
draining = false;
|
|
482
|
+
return _context8.finish(8);
|
|
483
|
+
case 9:
|
|
484
|
+
case "end":
|
|
485
|
+
return _context8.stop();
|
|
486
|
+
}
|
|
487
|
+
}, _callee8, null, [[2,, 8, 9]]);
|
|
488
|
+
}));
|
|
489
|
+
return _drain.apply(this, arguments);
|
|
490
|
+
}
|
|
16
491
|
var Wrapper = /*#__PURE__*/function (_React$Component) {
|
|
17
492
|
function Wrapper(p) {
|
|
18
|
-
var
|
|
493
|
+
var _this2;
|
|
19
494
|
_classCallCheck(this, Wrapper);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
externalEvent: null
|
|
23
|
-
};
|
|
24
|
-
_this.queue = [];
|
|
25
|
-
_this.processing = false;
|
|
26
|
-
apiRef = {
|
|
27
|
-
enqueueExternalEvent: function enqueueExternalEvent(ev) {
|
|
28
|
-
return _this.enqueue(ev);
|
|
29
|
-
}
|
|
495
|
+
_this2 = _callSuper(this, Wrapper, [p]);
|
|
496
|
+
_this2.state = {
|
|
497
|
+
externalEvent: p.externalEvent || null
|
|
30
498
|
};
|
|
31
|
-
|
|
499
|
+
_this2._mounted = false;
|
|
500
|
+
return _this2;
|
|
32
501
|
}
|
|
33
502
|
_inherits(Wrapper, _React$Component);
|
|
34
503
|
return _createClass(Wrapper, [{
|
|
35
|
-
key: "
|
|
36
|
-
value: function
|
|
37
|
-
|
|
38
|
-
this.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
value: function processNext() {
|
|
44
|
-
var _this2 = this;
|
|
45
|
-
var next = this.queue.shift();
|
|
46
|
-
if (!next) {
|
|
47
|
-
this.processing = false;
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
this.processing = true;
|
|
51
|
-
setTimeout(function () {
|
|
52
|
-
_this2.setState({
|
|
53
|
-
externalEvent: null
|
|
54
|
-
}, function () {
|
|
55
|
-
_this2.setState({
|
|
56
|
-
externalEvent: next
|
|
57
|
-
});
|
|
504
|
+
key: "componentDidMount",
|
|
505
|
+
value: function componentDidMount() {
|
|
506
|
+
var _this3 = this;
|
|
507
|
+
this._mounted = true;
|
|
508
|
+
setExternalEventFn = function setExternalEventFn(newEvent) {
|
|
509
|
+
if (!_this3._mounted) return;
|
|
510
|
+
_this3.setState({
|
|
511
|
+
externalEvent: newEvent
|
|
58
512
|
});
|
|
59
|
-
}
|
|
513
|
+
};
|
|
60
514
|
}
|
|
61
515
|
}, {
|
|
62
|
-
key: "
|
|
63
|
-
value: function
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
setTimeout(function () {
|
|
67
|
-
return _this3.processNext();
|
|
68
|
-
}, 0);
|
|
69
|
-
}
|
|
516
|
+
key: "componentWillUnmount",
|
|
517
|
+
value: function componentWillUnmount() {
|
|
518
|
+
this._mounted = false;
|
|
519
|
+
setExternalEventFn = null;
|
|
70
520
|
}
|
|
71
521
|
}, {
|
|
72
522
|
key: "render",
|
|
@@ -76,25 +526,102 @@ export function renderKitchenSimulator(container) {
|
|
|
76
526
|
}));
|
|
77
527
|
}
|
|
78
528
|
}]);
|
|
79
|
-
}(React.Component);
|
|
80
|
-
var
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
529
|
+
}(React.Component);
|
|
530
|
+
var api = {
|
|
531
|
+
__render: function __render(nextProps) {
|
|
532
|
+
root.render(/*#__PURE__*/React.createElement(Wrapper, nextProps));
|
|
533
|
+
},
|
|
534
|
+
// ✅ host can query current inFlight
|
|
535
|
+
getGltfInFlight: function getGltfInFlight() {
|
|
536
|
+
return gltfTracker.getInFlight();
|
|
537
|
+
},
|
|
538
|
+
// ✅ host can subscribe to inFlight changes (loader)
|
|
539
|
+
subscribeGltfInFlight: function subscribeGltfInFlight(cb) {
|
|
540
|
+
return gltfTracker.subscribe(cb);
|
|
541
|
+
},
|
|
542
|
+
sendExternalEvents: function sendExternalEvents(eventOrEvents) {
|
|
543
|
+
var events = Array.isArray(eventOrEvents) ? eventOrEvents : [eventOrEvents];
|
|
544
|
+
var _iterator2 = _createForOfIteratorHelper(events),
|
|
545
|
+
_step2;
|
|
546
|
+
try {
|
|
547
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
548
|
+
var e = _step2.value;
|
|
549
|
+
queue.push(e);
|
|
550
|
+
}
|
|
551
|
+
} catch (err) {
|
|
552
|
+
_iterator2.e(err);
|
|
553
|
+
} finally {
|
|
554
|
+
_iterator2.f();
|
|
555
|
+
}
|
|
556
|
+
var token = Symbol('batch');
|
|
557
|
+
pendingMarkers.add(token);
|
|
558
|
+
queue.push({
|
|
559
|
+
__marker: MARKER,
|
|
560
|
+
token: token
|
|
561
|
+
});
|
|
562
|
+
drain();
|
|
563
|
+
|
|
564
|
+
// resolve when marker cleared
|
|
565
|
+
return new Promise(function (resolve) {
|
|
566
|
+
var check = /*#__PURE__*/function () {
|
|
567
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
568
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
569
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
570
|
+
case 0:
|
|
571
|
+
if (destroyed) {
|
|
572
|
+
_context6.next = 3;
|
|
573
|
+
break;
|
|
574
|
+
}
|
|
575
|
+
if (!pendingMarkers.has(token)) {
|
|
576
|
+
_context6.next = 2;
|
|
577
|
+
break;
|
|
578
|
+
}
|
|
579
|
+
_context6.next = 1;
|
|
580
|
+
return nextFrame();
|
|
581
|
+
case 1:
|
|
582
|
+
return _context6.abrupt("continue", 0);
|
|
583
|
+
case 2:
|
|
584
|
+
resolve(true);
|
|
585
|
+
return _context6.abrupt("return");
|
|
586
|
+
case 3:
|
|
587
|
+
resolve(false);
|
|
588
|
+
case 4:
|
|
589
|
+
case "end":
|
|
590
|
+
return _context6.stop();
|
|
591
|
+
}
|
|
592
|
+
}, _callee6);
|
|
593
|
+
}));
|
|
594
|
+
return function check() {
|
|
595
|
+
return _ref5.apply(this, arguments);
|
|
596
|
+
};
|
|
597
|
+
}();
|
|
598
|
+
check();
|
|
599
|
+
});
|
|
600
|
+
},
|
|
601
|
+
updateExternalEvent: function updateExternalEvent(e) {
|
|
602
|
+
return api.sendExternalEvents(e);
|
|
603
|
+
},
|
|
604
|
+
clearQueue: function clearQueue() {
|
|
605
|
+
queue.length = 0;
|
|
606
|
+
pendingMarkers.clear();
|
|
90
607
|
},
|
|
91
608
|
unmount: function unmount() {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
609
|
+
destroyed = true;
|
|
610
|
+
api.clearQueue();
|
|
611
|
+
gltfTracker.uninstall();
|
|
612
|
+
var doUnmount = function doUnmount() {
|
|
613
|
+
try {
|
|
614
|
+
root.unmount();
|
|
615
|
+
} finally {
|
|
616
|
+
container[ROOT_KEY] = null;
|
|
617
|
+
container[API_KEY] = null;
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
if (typeof queueMicrotask === 'function') queueMicrotask(doUnmount);else setTimeout(doUnmount, 0);
|
|
97
621
|
}
|
|
98
622
|
};
|
|
623
|
+
api.__render(props);
|
|
624
|
+
container[API_KEY] = api;
|
|
625
|
+
return api;
|
|
99
626
|
}
|
|
100
627
|
export default renderKitchenSimulator;
|