kitchen-simulator 3.16.5 → 3.16.6

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 CHANGED
@@ -49,7 +49,8 @@ function installGltfTracker() {
49
49
  }
50
50
  return waitForIdle;
51
51
  }(),
52
- uninstall: function uninstall() {}
52
+ uninstall: function uninstall() {},
53
+ subscribe: subscribe
53
54
  };
54
55
  }
55
56
  var GLOBAL_KEY = '__kitchenSimulatorGltfTracker__';
@@ -65,12 +66,12 @@ function installGltfTracker() {
65
66
  };
66
67
  }
67
68
  var g = window[GLOBAL_KEY];
68
- var isGltfUrl = function isGltfUrl(url) {
69
+ var is3dAssetUrl = function is3dAssetUrl(url) {
69
70
  try {
70
71
  var _url$toString, _url$toString2;
71
72
  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 : '';
72
- var u = s.toLowerCase();
73
- return u.includes('.gltf') || u.includes('.glb');
73
+ var u = s.toLowerCase().split('?')[0]; // ignore cache params
74
+ return u.endsWith('.gltf') || u.endsWith('.glb') || u.endsWith('.bin') || u.endsWith('.png') || u.endsWith('.jpg') || u.endsWith('.jpeg') || u.endsWith('.webp') || u.endsWith('.ktx2') || u.endsWith('.hdr') || u.endsWith('.exr');
74
75
  } catch (_unused) {
75
76
  return false;
76
77
  }
@@ -336,6 +337,11 @@ export function renderKitchenSimulator(container) {
336
337
  var pendingMarkers = new Set();
337
338
  var MARKER = Symbol('marker');
338
339
  var gltfTracker = installGltfTracker();
340
+ var gltfUnsub = null;
341
+ function subscribeGltfInFlight(cb) {
342
+ if (!(gltfTracker !== null && gltfTracker !== void 0 && gltfTracker.subscribe)) return function () {};
343
+ return gltfTracker.subscribe(cb);
344
+ }
339
345
 
340
346
  // ---- FAST defaults (still safe) ----
341
347
  var defaultFramesPerEvent = (_props$framesPerEvent = props.framesPerEvent) !== null && _props$framesPerEvent !== void 0 ? _props$framesPerEvent : 1; // was 2
@@ -516,11 +522,11 @@ export function renderKitchenSimulator(container) {
516
522
  __render: function __render(nextProps) {
517
523
  root.render(/*#__PURE__*/React.createElement(Wrapper, nextProps));
518
524
  },
519
- /** Number of tracked .gltf/.glb requests currently in flight */getGltfInFlight: function getGltfInFlight() {
525
+ getGltfInFlight: function getGltfInFlight() {
520
526
  return gltfTracker.getInFlight();
521
527
  },
522
- /** Resolves when GLTF becomes idle (stable idle) */waitForGltfIdle: function waitForGltfIdle(opts) {
523
- return gltfTracker.waitForIdle(opts);
528
+ subscribeGltfInFlight: function subscribeGltfInFlight(cb) {
529
+ return gltfTracker.subscribe(cb);
524
530
  },
525
531
  sendExternalEvents: function sendExternalEvents(eventOrEvents) {
526
532
  var events = Array.isArray(eventOrEvents) ? eventOrEvents : [eventOrEvents];
package/lib/index.js CHANGED
@@ -57,7 +57,8 @@ function installGltfTracker() {
57
57
  }
58
58
  return waitForIdle;
59
59
  }(),
60
- uninstall: function uninstall() {}
60
+ uninstall: function uninstall() {},
61
+ subscribe: subscribe
61
62
  };
62
63
  }
63
64
  var GLOBAL_KEY = '__kitchenSimulatorGltfTracker__';
@@ -73,12 +74,12 @@ function installGltfTracker() {
73
74
  };
74
75
  }
75
76
  var g = window[GLOBAL_KEY];
76
- var isGltfUrl = function isGltfUrl(url) {
77
+ var is3dAssetUrl = function is3dAssetUrl(url) {
77
78
  try {
78
79
  var _url$toString, _url$toString2;
79
80
  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 : '';
80
- var u = s.toLowerCase();
81
- return u.includes('.gltf') || u.includes('.glb');
81
+ var u = s.toLowerCase().split('?')[0]; // ignore cache params
82
+ return u.endsWith('.gltf') || u.endsWith('.glb') || u.endsWith('.bin') || u.endsWith('.png') || u.endsWith('.jpg') || u.endsWith('.jpeg') || u.endsWith('.webp') || u.endsWith('.ktx2') || u.endsWith('.hdr') || u.endsWith('.exr');
82
83
  } catch (_unused) {
83
84
  return false;
84
85
  }
@@ -344,6 +345,11 @@ function renderKitchenSimulator(container) {
344
345
  var pendingMarkers = new Set();
345
346
  var MARKER = Symbol('marker');
346
347
  var gltfTracker = installGltfTracker();
348
+ var gltfUnsub = null;
349
+ function subscribeGltfInFlight(cb) {
350
+ if (!(gltfTracker !== null && gltfTracker !== void 0 && gltfTracker.subscribe)) return function () {};
351
+ return gltfTracker.subscribe(cb);
352
+ }
347
353
 
348
354
  // ---- FAST defaults (still safe) ----
349
355
  var defaultFramesPerEvent = (_props$framesPerEvent = props.framesPerEvent) !== null && _props$framesPerEvent !== void 0 ? _props$framesPerEvent : 1; // was 2
@@ -524,11 +530,11 @@ function renderKitchenSimulator(container) {
524
530
  __render: function __render(nextProps) {
525
531
  root.render(/*#__PURE__*/_react["default"].createElement(Wrapper, nextProps));
526
532
  },
527
- /** Number of tracked .gltf/.glb requests currently in flight */getGltfInFlight: function getGltfInFlight() {
533
+ getGltfInFlight: function getGltfInFlight() {
528
534
  return gltfTracker.getInFlight();
529
535
  },
530
- /** Resolves when GLTF becomes idle (stable idle) */waitForGltfIdle: function waitForGltfIdle(opts) {
531
- return gltfTracker.waitForIdle(opts);
536
+ subscribeGltfInFlight: function subscribeGltfInFlight(cb) {
537
+ return gltfTracker.subscribe(cb);
532
538
  },
533
539
  sendExternalEvents: function sendExternalEvents(eventOrEvents) {
534
540
  var events = Array.isArray(eventOrEvents) ? eventOrEvents : [eventOrEvents];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitchen-simulator",
3
- "version": "3.16.5",
3
+ "version": "3.16.6",
4
4
  "description": "It is a kitchen simulator (self-contained micro-frontend).",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",