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