@shopware-ag/dive 3.0.2 → 3.0.4-beta.0

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.
Files changed (30) hide show
  1. package/build/chunks/{AssetCache-CNPYvpja.mjs → AssetCache-BFmlE2RL.mjs} +1 -1
  2. package/build/chunks/{AssetCache-Jm-ImVg9.cjs → AssetCache-DJljWMMu.cjs} +1 -1
  3. package/build/chunks/AssetLoader-BBYvjZmA.cjs +3 -0
  4. package/build/chunks/AssetLoader-BxeffaLI.mjs +663 -0
  5. package/build/chunks/{FileTypes-DPbl1FRz.mjs → FileTypes-BWLS6Iwg.mjs} +72 -64
  6. package/build/chunks/{FileTypes-BZEGmLId.cjs → FileTypes-Cus1xgpl.cjs} +2 -2
  7. package/build/chunks/{isFileTypeSupported-BoJJ8425.mjs → isFileTypeSupported-BoTjyPbV.mjs} +1 -1
  8. package/build/chunks/{isFileTypeSupported-SVl7gp-l.cjs → isFileTypeSupported-DChhxeep.cjs} +1 -1
  9. package/build/dive.cjs +1 -1
  10. package/build/dive.mjs +2 -2
  11. package/build/plugins/ar/index.cjs +1 -1
  12. package/build/plugins/ar/index.mjs +1 -1
  13. package/build/plugins/assetcache/index.cjs +1 -1
  14. package/build/plugins/assetcache/index.mjs +1 -1
  15. package/build/plugins/assetloader/index.cjs +1 -1
  16. package/build/plugins/assetloader/index.mjs +2 -2
  17. package/build/plugins/assetloader/src/loader/AssetLoader.d.ts +2 -0
  18. package/build/plugins/orbitcontroller/index.cjs +1 -1
  19. package/build/plugins/orbitcontroller/index.mjs +1 -1
  20. package/build/plugins/orientationdisplay/index.cjs +1 -1
  21. package/build/plugins/orientationdisplay/index.mjs +1 -1
  22. package/build/plugins/quickview/index.cjs +1 -1
  23. package/build/plugins/quickview/index.mjs +1 -1
  24. package/build/plugins/state/index.cjs +1 -1
  25. package/build/plugins/state/index.mjs +1 -1
  26. package/build/plugins/toolbox/index.cjs +1 -1
  27. package/build/plugins/toolbox/index.mjs +1 -1
  28. package/package.json +1 -1
  29. package/build/chunks/AssetLoader-BxDpfsV0.mjs +0 -499
  30. package/build/chunks/AssetLoader-Cce1SyuI.cjs +0 -3
@@ -1,6 +1,6 @@
1
1
  var U = Object.defineProperty;
2
- var $ = (n, t, A) => t in n ? U(n, t, { enumerable: !0, configurable: !0, writable: !0, value: A }) : n[t] = A;
3
- var e = (n, t, A) => $(n, typeof t != "symbol" ? t + "" : t, A);
2
+ var $ = (h, t, A) => t in h ? U(h, t, { enumerable: !0, configurable: !0, writable: !0, value: A }) : h[t] = A;
3
+ var e = (h, t, A) => $(h, typeof t != "symbol" ? t + "" : t, A);
4
4
  import { PMREMGenerator as F, Scene as W, SphereGeometry as K, MeshBasicMaterial as Y, BackSide as AA, Mesh as u, NoToneMapping as iA, LinearSRGBColorSpace as eA, CubeRenderTarget as tA, HalfFloatType as gA, CubeCamera as sA, EquirectangularReflectionMapping as oA, WebGPURenderer as nA, PCFSoftShadowMap as hA, PCFShadowMap as fA, BasicShadowMap as aA, SRGBColorSpace as rA, LinearToneMapping as BA, MathUtils as y, Object3D as w, AmbientLight as cA, PointLight as PA, FrontSide as N, HemisphereLight as zA, DirectionalLight as IA, Vector3 as f, Box3 as I, Box3Helper as CA, Sphere as uA, MeshStandardMaterial as b, Raycaster as wA, CylinderGeometry as GA, BufferGeometry as k, BufferAttribute as X, BoxGeometry as d, ConeGeometry as DA, LineDashedMaterial as mA, Line as pA, PlaneGeometry as x, Color as C, MeshBasicNodeMaterial as lA, DoubleSide as KA, TOUCH as c, MOUSE as B, EventDispatcher as vA, Spherical as j, Vector2 as r, Quaternion as Z } from "three/webgpu";
5
5
  import { HDRLoader as dA } from "three/examples/jsm/loaders/HDRLoader.js";
6
6
  import { P, U as HA, H as qA, a as YA, D as yA } from "./PerspectiveCamera-B5TvUzTa.mjs";
@@ -110,12 +110,12 @@ class LA {
110
110
  g.scale.set(1, 1, -1), g.rotation.y = this.options.rotateY ?? 0, t.add(g);
111
111
  const s = this.renderer.toneMapping, o = this.renderer.outputColorSpace;
112
112
  this.renderer.toneMapping = iA, this.renderer.outputColorSpace = eA;
113
- const h = new tA(1024, {
113
+ const n = new tA(1024, {
114
114
  type: gA
115
115
  });
116
- new sA(0.1, 1e3, h).update(this.renderer, t), this.renderer.toneMapping = s, this.renderer.outputColorSpace = o;
117
- const z = this.pmrem.fromCubemap(h.texture);
118
- this.currentEnvRT && (this.currentEnvRT.texture.dispose(), this.currentEnvRT.dispose(), this.currentEnvRT = null), this.currentBackgroundCube && (this.currentBackgroundCube.texture.dispose(), this.currentBackgroundCube.dispose(), this.currentBackgroundCube = null), this.currentEnvRT = z, this.scene.environment = z.texture, this.options.useAsBackground ? (this.scene.background = h.texture, this.currentBackgroundCube = h) : (this.scene.background = this.originalBackground, h.texture.dispose(), h.dispose());
116
+ new sA(0.1, 1e3, n).update(this.renderer, t), this.renderer.toneMapping = s, this.renderer.outputColorSpace = o;
117
+ const z = this.pmrem.fromCubemap(n.texture);
118
+ this.currentEnvRT && (this.currentEnvRT.texture.dispose(), this.currentEnvRT.dispose(), this.currentEnvRT = null), this.currentBackgroundCube && (this.currentBackgroundCube.texture.dispose(), this.currentBackgroundCube.dispose(), this.currentBackgroundCube = null), this.currentEnvRT = z, this.scene.environment = z.texture, this.options.useAsBackground ? (this.scene.background = n.texture, this.currentBackgroundCube = n) : (this.scene.background = this.originalBackground, n.texture.dispose(), n.dispose());
119
119
  }
120
120
  /**
121
121
  * Sets the renderer and rebinds the PMREM generator. Use this only when rebuilding the renderer.
@@ -258,13 +258,13 @@ class XA {
258
258
  e(this, "_pendingStableLayout", null);
259
259
  e(this, "_healthyCanvasPromise", null);
260
260
  e(this, "_resolveHealthyCanvas", null);
261
- this._onResize = A, this._canvas = t, this._resizeObserver = new ResizeObserver((i) => {
262
- const g = i[0], { width: s, height: o } = g.contentRect;
263
- if (!this._hasHealthySize(s, o)) {
264
- this._width = s, this._height = o, this._invalidateCanvasHealth();
261
+ this._onResize = A, this._canvas = t, this._resizeObserver = new ResizeObserver(() => {
262
+ const { width: i, height: g } = this._getCanvasLayout(this._canvas);
263
+ if (!this._hasHealthySize(i, g)) {
264
+ this._width = i, this._height = g, this._invalidateCanvasHealth();
265
265
  return;
266
266
  }
267
- this._applyResize(s, o);
267
+ this._applyResize(i, g);
268
268
  });
269
269
  }
270
270
  tick() {
@@ -276,51 +276,47 @@ class XA {
276
276
  async waitForHealthyCanvas(t = this._canvas, A) {
277
277
  if (this._disposed || A != null && A.aborted || t !== this._canvas)
278
278
  return null;
279
- if (this._isCanvasHealthy && t.parentElement !== null && t.parentElement === this._observedParent && this._hasHealthySize(this._width, this._height))
280
- return {
281
- width: this._width,
282
- height: this._height
283
- };
284
- this._healthyCanvasPromise || (this._healthyCanvasPromise = new Promise((g) => {
285
- this._resolveHealthyCanvas = g;
279
+ const i = this._getCanvasLayout(t);
280
+ if (this._isCanvasHealthy && t.parentElement !== null && t.parentElement === this._observedParent && this._hasHealthySize(i.width, i.height) && i.width === this._width && i.height === this._height)
281
+ return i;
282
+ this._healthyCanvasPromise || (this._healthyCanvasPromise = new Promise((s) => {
283
+ this._resolveHealthyCanvas = s;
286
284
  }));
287
- const i = this._healthyCanvasPromise;
288
- return A ? await new Promise((g) => {
289
- const s = () => {
290
- A.removeEventListener("abort", s), g(null);
285
+ const g = this._healthyCanvasPromise;
286
+ return A ? await new Promise((s) => {
287
+ const o = () => {
288
+ A.removeEventListener("abort", o), s(null);
291
289
  };
292
- A.addEventListener("abort", s, { once: !0 }), i.then((o) => {
293
- if (A.removeEventListener("abort", s), this._disposed || A.aborted || t !== this._canvas) {
294
- g(null);
290
+ A.addEventListener("abort", o, { once: !0 }), g.then((n) => {
291
+ if (A.removeEventListener("abort", o), this._disposed || A.aborted || t !== this._canvas) {
292
+ s(null);
295
293
  return;
296
294
  }
297
- g(o);
295
+ s(n);
298
296
  });
299
- }) : await i;
297
+ }) : await g;
300
298
  }
301
299
  dispose() {
302
300
  this._disposed = !0, this._isCanvasHealthy = !1, this._resolvePendingWaiters(null), this._resizeObserver.disconnect();
303
301
  }
304
302
  _checkCanvasHealth() {
305
- const t = this._canvas, A = t.parentElement;
303
+ const t = this._canvas, A = t.parentElement, i = this._getCanvasLayout(t);
306
304
  if (this._isCanvasHealthy) {
307
- if (A === this._observedParent && this._hasHealthySize(this._width, this._height))
305
+ if (A === this._observedParent && this._hasHealthySize(i.width, i.height) && i.width === this._width && i.height === this._height)
308
306
  return;
309
307
  this._invalidateCanvasHealth();
310
308
  }
311
- if (!A)
312
- return;
313
- A !== this._observedParent && (this._observedParent = A, this._pendingStableLayout = null);
314
- const i = this._getCanvasLayout(t);
315
- if (!this._hasHealthySize(i.width, i.height)) {
316
- this._pendingStableLayout = null;
317
- return;
318
- }
319
- if (this._pendingStableLayout === null || this._pendingStableLayout.width !== i.width || this._pendingStableLayout.height !== i.height) {
320
- this._pendingStableLayout = i;
321
- return;
309
+ if (A) {
310
+ if (A !== this._observedParent && (this._observedParent = A, this._pendingStableLayout = null), !this._hasHealthySize(i.width, i.height)) {
311
+ this._pendingStableLayout = null;
312
+ return;
313
+ }
314
+ if (this._pendingStableLayout === null || this._pendingStableLayout.width !== i.width || this._pendingStableLayout.height !== i.height) {
315
+ this._pendingStableLayout = i;
316
+ return;
317
+ }
318
+ this._resizeObserver.observe(this._observedParent), this._applyResize(i.width, i.height), this._isCanvasHealthy = !0, this._resolvePendingWaiters(i);
322
319
  }
323
- this._resizeObserver.observe(t), this._applyResize(i.width, i.height), this._isCanvasHealthy = !0, this._resolvePendingWaiters(i);
324
320
  }
325
321
  _applyResize(t, A) {
326
322
  t === this._width && A === this._height || (this._width = t, this._height = A, this._onResize(t, A));
@@ -329,14 +325,26 @@ class XA {
329
325
  return t >= 1 && A >= 1;
330
326
  }
331
327
  _getCanvasLayout(t) {
332
- var i;
333
- const A = ((i = t.getBoundingClientRect) == null ? void 0 : i.call(t)) ?? {
328
+ var g, s;
329
+ const A = t.parentElement;
330
+ if (A) {
331
+ const o = ((g = A.getBoundingClientRect) == null ? void 0 : g.call(A)) ?? {
332
+ width: 0,
333
+ height: 0
334
+ }, n = {
335
+ width: Math.max(o.width, A.clientWidth),
336
+ height: Math.max(o.height, A.clientHeight)
337
+ };
338
+ if (this._hasHealthySize(n.width, n.height))
339
+ return n;
340
+ }
341
+ const i = ((s = t.getBoundingClientRect) == null ? void 0 : s.call(t)) ?? {
334
342
  width: 0,
335
343
  height: 0
336
344
  };
337
345
  return {
338
- width: Math.max(A.width, t.clientWidth),
339
- height: Math.max(A.height, t.clientHeight)
346
+ width: Math.max(i.width, t.clientWidth),
347
+ height: Math.max(i.height, t.clientHeight)
340
348
  };
341
349
  }
342
350
  _invalidateCanvasHealth() {
@@ -358,7 +366,7 @@ class jA {
358
366
  e(this, "_initPromise", null);
359
367
  e(this, "_initAbortController", null);
360
368
  e(this, "_handleCanvasResize", (t, A) => {
361
- this.onResize(t, A), this._renderer.render();
369
+ this.onResize(t, A), this._renderer.tick();
362
370
  });
363
371
  this._scene = t, this._camera = A, this._settings = i, this._renderer = new FA(
364
372
  this._scene,
@@ -518,7 +526,7 @@ class QA extends w {
518
526
  this._hemiLight.visible = A, this._dirLight.visible = A;
519
527
  }
520
528
  }
521
- const T = (n) => n.parent ? T(n.parent) : n;
529
+ const T = (h) => h.parent ? T(h.parent) : h;
522
530
  class O extends w {
523
531
  constructor() {
524
532
  super();
@@ -629,9 +637,9 @@ class q extends O {
629
637
  /** The dimensions (width, height, depth) of the bounding box */
630
638
  e(this, "_size");
631
639
  const s = new I();
632
- i ? s.setFromObject(A) : (A.updateWorldMatrix(!0, !0), A.traverse((h) => {
633
- if (!("isMesh" in h) || !h.isMesh) return;
634
- const a = h;
640
+ i ? s.setFromObject(A) : (A.updateWorldMatrix(!0, !0), A.traverse((n) => {
641
+ if (!("isMesh" in n) || !n.isMesh) return;
642
+ const a = n;
635
643
  a.geometry.computeBoundingBox(), a.geometry.boundingBox && s.union(
636
644
  a.geometry.boundingBox.clone().applyMatrix4(a.matrixWorld)
637
645
  );
@@ -756,8 +764,8 @@ class _ extends O {
756
764
  });
757
765
  const s = -g.min.y;
758
766
  Math.abs(s) < 1e-9 || (A.y += s, A.y !== i.y && (this.setPosition(A), import("../plugins/state/index.mjs").then(({ State: o }) => {
759
- var h;
760
- (h = o.get(this.userData.id)) == null || h.performAction("UPDATE_OBJECT", {
767
+ var n;
768
+ (n = o.get(this.userData.id)) == null || n.performAction("UPDATE_OBJECT", {
761
769
  id: this.userData.id,
762
770
  position: A,
763
771
  rotation: this.rotation,
@@ -781,12 +789,12 @@ class _ extends O {
781
789
  s.y = g.min.y;
782
790
  const o = new wA(s, new f(0, -1, 0));
783
791
  o.layers.mask = P;
784
- const h = o.intersectObjects(
792
+ const n = o.intersectObjects(
785
793
  T(this).root.children,
786
794
  !0
787
795
  );
788
- if (h.length > 0) {
789
- const a = h[0].object, m = new I().setFromObject(a).max.y - g.min.y;
796
+ if (n.length > 0) {
797
+ const a = n[0].object, m = new I().setFromObject(a).max.y - g.min.y;
790
798
  if (Math.abs(m) < 1e-9 || (A.y += m, A.y === i.y)) return;
791
799
  this.setPosition(A), import("../plugins/state/index.mjs").then(({ State: v }) => {
792
800
  var p;
@@ -1280,9 +1288,9 @@ class E extends w {
1280
1288
  depthWrite: !1,
1281
1289
  side: KA,
1282
1290
  outputNode: new bA(this._uniforms)
1283
- }), this._mesh = new u(g, this._material), this._mesh.layers.mask = qA, this._mesh.frustumCulled = !1, this._mesh.renderOrder = -1, this._mesh.onBeforeRender = (s, o, h) => {
1291
+ }), this._mesh = new u(g, this._material), this._mesh.layers.mask = qA, this._mesh.frustumCulled = !1, this._mesh.renderOrder = -1, this._mesh.onBeforeRender = (s, o, n) => {
1284
1292
  const a = this._gridSize;
1285
- this._mesh.position.x = Math.round(h.position.x / a) * a, this._mesh.position.z = Math.round(h.position.z / a) * a, this._mesh.updateMatrixWorld(!0);
1293
+ this._mesh.position.x = Math.round(n.position.x / a) * a, this._mesh.position.z = Math.round(n.position.z / a) * a, this._mesh.updateMatrixWorld(!0);
1286
1294
  }, this.add(this._mesh);
1287
1295
  }
1288
1296
  setVisibility(A) {
@@ -1669,7 +1677,7 @@ const RA = {
1669
1677
  this.removeDomElements(...this.domElements), this.domElements = [], this.addDomElements(...A);
1670
1678
  }
1671
1679
  computeEncompassingView(A, i = 0) {
1672
- const g = A.center, o = A.sphere.radius, h = this.object.fov * (Math.PI / 180), a = this.object.aspect, z = h / 2, M = Math.atan(Math.tan(z) * a), m = o / Math.sin(z), v = o / Math.sin(M), p = Math.max(m, v) * (1 + i), L = this.object.position.clone().sub(this.target).normalize(), R = L.length() > 1e-3 ? L : new f(0, 0, 1);
1680
+ const g = A.center, o = A.sphere.radius, n = this.object.fov * (Math.PI / 180), a = this.object.aspect, z = n / 2, M = Math.atan(Math.tan(z) * a), m = o / Math.sin(z), v = o / Math.sin(M), p = Math.max(m, v) * (1 + i), L = this.object.position.clone().sub(this.target).normalize(), R = L.length() > 1e-3 ? L : new f(0, 0, 1);
1673
1681
  return {
1674
1682
  position: g.clone().add(R.multiplyScalar(p)),
1675
1683
  target: g
@@ -1728,14 +1736,14 @@ const RA = {
1728
1736
  if ("isPerspectiveCamera" in this.object) {
1729
1737
  const o = this.object.position;
1730
1738
  s.copy(o).sub(this.target);
1731
- let h = s.length();
1732
- h *= Math.tan(
1739
+ let n = s.length();
1740
+ n *= Math.tan(
1733
1741
  this.object.fov / 2 * Math.PI / 180
1734
1742
  ), this.panLeft(
1735
- 2 * A * h / g.clientHeight,
1743
+ 2 * A * n / g.clientHeight,
1736
1744
  this.object.matrix
1737
1745
  ), this.panUp(
1738
- 2 * i * h / g.clientHeight,
1746
+ 2 * i * n / g.clientHeight,
1739
1747
  this.object.matrix
1740
1748
  );
1741
1749
  } else "isOrthographicCamera" in this.object ? (this.panLeft(
@@ -1971,7 +1979,7 @@ class ni {
1971
1979
  ), this._clock.addTicker(this._orientationDisplay));
1972
1980
  }
1973
1981
  ), this._settings.autoStart && this.start(), console.log(
1974
- "DIVE 3.0.2 initialized successfully!"
1982
+ "DIVE 3.0.4-beta.0 initialized successfully!"
1975
1983
  ), console.log(UA), window.DIVE.instances.push(this);
1976
1984
  }
1977
1985
  get views() {
@@ -2061,7 +2069,7 @@ const $A = {
2061
2069
  extension: "igs"
2062
2070
  }
2063
2071
  }, hi = Object.values($A).map(
2064
- (n) => n.extension
2072
+ (h) => h.extension
2065
2073
  );
2066
2074
  export {
2067
2075
  q as B,