kitchen-simulator 4.0.6 → 4.0.7
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/index.js +26 -5
- package/lib/index.js +28 -5
- package/package.json +1 -1
package/es/index.js
CHANGED
|
@@ -12,6 +12,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
12
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
13
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
14
14
|
import React from 'react';
|
|
15
|
+
import * as Three from 'three';
|
|
15
16
|
import LiteRenderer from "./LiteRenderer";
|
|
16
17
|
import { createRoot } from 'react-dom/client';
|
|
17
18
|
var ROOT_KEY = '__kitchenSimulatorRoot__';
|
|
@@ -22,6 +23,18 @@ function nextFrame() {
|
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
// DIY-714 [Temp Fix] Rewrite API URLs
|
|
27
|
+
var API_HOST_REGEX = /(https?:\/\/)?(api\.diydesignspace\.com|api\.addovisuals\.com)/;
|
|
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
|
+
|
|
25
38
|
/**
|
|
26
39
|
* Track 3D asset network activity (gltf/glb/bin/textures/hdr/etc)
|
|
27
40
|
* Ref-counted global install so multiple instances don't clobber each other.
|
|
@@ -144,7 +157,9 @@ function installGltfTracker() {
|
|
|
144
157
|
var _len3,
|
|
145
158
|
args,
|
|
146
159
|
_key3,
|
|
147
|
-
|
|
160
|
+
input,
|
|
161
|
+
init,
|
|
162
|
+
newUrl,
|
|
148
163
|
track,
|
|
149
164
|
_args2 = arguments;
|
|
150
165
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
@@ -153,19 +168,25 @@ function installGltfTracker() {
|
|
|
153
168
|
for (_len3 = _args2.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
154
169
|
args[_key3] = _args2[_key3];
|
|
155
170
|
}
|
|
156
|
-
|
|
157
|
-
|
|
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);
|
|
158
179
|
if (track) {
|
|
159
180
|
_context2.next = 1;
|
|
160
181
|
break;
|
|
161
182
|
}
|
|
162
|
-
return _context2.abrupt("return", g.originalFetch.
|
|
183
|
+
return _context2.abrupt("return", g.originalFetch.call(this, input, init));
|
|
163
184
|
case 1:
|
|
164
185
|
g.inFlight += 1;
|
|
165
186
|
notify();
|
|
166
187
|
_context2.prev = 2;
|
|
167
188
|
_context2.next = 3;
|
|
168
|
-
return g.originalFetch.
|
|
189
|
+
return g.originalFetch.call(this, input, init);
|
|
169
190
|
case 3:
|
|
170
191
|
return _context2.abrupt("return", _context2.sent);
|
|
171
192
|
case 4:
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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
|
});
|
|
@@ -15,8 +16,10 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
15
16
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
16
17
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
17
18
|
var _react = _interopRequireDefault(require("react"));
|
|
19
|
+
var Three = _interopRequireWildcard(require("three"));
|
|
18
20
|
var _LiteRenderer = _interopRequireDefault(require("./LiteRenderer"));
|
|
19
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); }
|
|
20
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)); }
|
|
21
24
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
22
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; } } }; }
|
|
@@ -30,6 +33,18 @@ function nextFrame() {
|
|
|
30
33
|
});
|
|
31
34
|
}
|
|
32
35
|
|
|
36
|
+
// DIY-714 [Temp Fix] Rewrite API URLs
|
|
37
|
+
var API_HOST_REGEX = /(https?:\/\/)?(api\.diydesignspace\.com|api\.addovisuals\.com)/;
|
|
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
|
+
|
|
33
48
|
/**
|
|
34
49
|
* Track 3D asset network activity (gltf/glb/bin/textures/hdr/etc)
|
|
35
50
|
* Ref-counted global install so multiple instances don't clobber each other.
|
|
@@ -152,7 +167,9 @@ function installGltfTracker() {
|
|
|
152
167
|
var _len3,
|
|
153
168
|
args,
|
|
154
169
|
_key3,
|
|
155
|
-
|
|
170
|
+
input,
|
|
171
|
+
init,
|
|
172
|
+
newUrl,
|
|
156
173
|
track,
|
|
157
174
|
_args2 = arguments;
|
|
158
175
|
return _regenerator["default"].wrap(function (_context2) {
|
|
@@ -161,19 +178,25 @@ function installGltfTracker() {
|
|
|
161
178
|
for (_len3 = _args2.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
162
179
|
args[_key3] = _args2[_key3];
|
|
163
180
|
}
|
|
164
|
-
|
|
165
|
-
|
|
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);
|
|
166
189
|
if (track) {
|
|
167
190
|
_context2.next = 1;
|
|
168
191
|
break;
|
|
169
192
|
}
|
|
170
|
-
return _context2.abrupt("return", g.originalFetch.
|
|
193
|
+
return _context2.abrupt("return", g.originalFetch.call(this, input, init));
|
|
171
194
|
case 1:
|
|
172
195
|
g.inFlight += 1;
|
|
173
196
|
notify();
|
|
174
197
|
_context2.prev = 2;
|
|
175
198
|
_context2.next = 3;
|
|
176
|
-
return g.originalFetch.
|
|
199
|
+
return g.originalFetch.call(this, input, init);
|
|
177
200
|
case 3:
|
|
178
201
|
return _context2.abrupt("return", _context2.sent);
|
|
179
202
|
case 4:
|