@shopware-ag/dive 3.0.11 → 3.1.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 (69) hide show
  1. package/build/chunks/{AssetCache-DOB996Vk.mjs → AssetCache-C3YXhbaX.mjs} +1 -1
  2. package/build/chunks/{AssetCache-MtISiPD2.cjs → AssetCache-xpY_N7Yp.cjs} +1 -1
  3. package/build/chunks/{AssetExporter-DLL_vJae.mjs → AssetExporter-C5MScs9S.mjs} +4 -1
  4. package/build/chunks/{AssetLoader-B1n3KGOu.cjs → AssetLoader-CRxLq0AL.cjs} +1 -1
  5. package/build/chunks/{AssetLoader-BY5D3Cvc.mjs → AssetLoader-MfH5d_Rr.mjs} +6 -15
  6. package/build/chunks/{PovSchema-DWWvr_ED.mjs → CameraSchema-cgY5WBGW.mjs} +4 -4
  7. package/build/chunks/CameraSchema-twxH-72N.cjs +1 -0
  8. package/build/chunks/{FileTypes-DMTSUCcK.cjs → FileTypes-Cgyf8ocm.cjs} +2 -2
  9. package/build/chunks/{FileTypes-DYtXCJQV.mjs → FileTypes-DiYB3WBp.mjs} +208 -183
  10. package/build/chunks/SpriteText-2lCRglsw.cjs +1 -0
  11. package/build/chunks/SpriteText-C_CQPvUn.mjs +50 -0
  12. package/build/chunks/{isFileTypeSupported-C-hfGk-7.mjs → isFileTypeSupported-9h8lrIuG.mjs} +1 -1
  13. package/build/chunks/{isFileTypeSupported-xoGjHFuz.cjs → isFileTypeSupported-BBU39V4u.cjs} +1 -1
  14. package/build/components/boundingbox/BoundingBox.d.ts +9 -5
  15. package/build/components/index.d.ts +1 -0
  16. package/build/components/root/Root.d.ts +2 -2
  17. package/build/components/spritetext/SpriteText.d.ts +27 -0
  18. package/build/dive.cjs +1 -1
  19. package/build/dive.mjs +36 -37
  20. package/build/engine/Dive.d.ts +6 -0
  21. package/build/engine/environment/Environment.d.ts +8 -0
  22. package/build/plugins/ar/index.cjs +1 -1
  23. package/build/plugins/ar/index.mjs +2 -2
  24. package/build/plugins/assetcache/index.cjs +1 -1
  25. package/build/plugins/assetcache/index.mjs +1 -1
  26. package/build/plugins/assetexporter/index.mjs +1 -1
  27. package/build/plugins/assetloader/index.cjs +1 -1
  28. package/build/plugins/assetloader/index.mjs +2 -2
  29. package/build/plugins/orbitcontroller/index.cjs +1 -1
  30. package/build/plugins/orbitcontroller/index.mjs +1 -1
  31. package/build/plugins/orbitcontroller/src/OrbitController.d.ts +1 -1
  32. package/build/plugins/orientationdisplay/index.cjs +1 -1
  33. package/build/plugins/orientationdisplay/index.mjs +4 -4
  34. package/build/plugins/quickview/index.cjs +1 -1
  35. package/build/plugins/quickview/index.mjs +49 -19
  36. package/build/plugins/quickview/src/QuickView.d.ts +12 -8
  37. package/build/plugins/quickview/src/state/QuickViewState.d.ts +4 -0
  38. package/build/plugins/quickview/src/uri/QuickViewUri.d.ts +3 -0
  39. package/build/plugins/quickview/types/index.d.ts +18 -0
  40. package/build/plugins/state/index.cjs +13 -13
  41. package/build/plugins/state/index.mjs +2343 -2168
  42. package/build/plugins/state/src/actions/index.d.ts +1 -0
  43. package/build/plugins/state/src/actions/object/addobject.d.ts +1 -1
  44. package/build/plugins/state/src/actions/object/updateobject.d.ts +1 -1
  45. package/build/plugins/state/src/actions/renderer/startrender.d.ts +1 -1
  46. package/build/plugins/state/src/actions/scene/getallscenedata.d.ts +5 -2
  47. package/build/plugins/state/src/actions/state/getstate.d.ts +8 -0
  48. package/build/plugins/state/src/actions/state/index.d.ts +2 -0
  49. package/build/plugins/state/src/actions/state/setstate.d.ts +8 -0
  50. package/build/plugins/state/types/StateData.d.ts +18 -0
  51. package/build/plugins/state/types/StateSceneData.d.ts +5 -19
  52. package/build/plugins/state/types/index.d.ts +1 -0
  53. package/build/plugins/toolbox/index.cjs +1 -1
  54. package/build/plugins/toolbox/index.mjs +4 -13
  55. package/build/types/schema/BaseEntitySchema.d.ts +17 -0
  56. package/build/types/schema/CameraSchema.d.ts +18 -0
  57. package/build/types/schema/EntitySchema.d.ts +13 -3
  58. package/build/types/schema/EntityTypeSchema.d.ts +9 -1
  59. package/build/types/schema/GeometrySchema.d.ts +9 -0
  60. package/build/types/schema/GeometryTypeSchema.d.ts +6 -0
  61. package/build/types/schema/GroupSchema.d.ts +7 -0
  62. package/build/types/schema/LightSchema.d.ts +16 -0
  63. package/build/types/schema/MaterialSchema.d.ts +10 -0
  64. package/build/types/schema/ModelSchema.d.ts +16 -0
  65. package/build/types/schema/PrimitiveSchema.d.ts +5 -0
  66. package/build/types/schema/index.d.ts +1 -1
  67. package/package.json +8 -9
  68. package/build/chunks/PovSchema-Co9FznEz.cjs +0 -1
  69. package/build/types/schema/PovSchema.d.ts +0 -10
@@ -1,25 +1,55 @@
1
- import { D as n, b as r, c as l, O as m } from "../../chunks/FileTypes-DYtXCJQV.mjs";
1
+ import { D as l, b as u, O as w, c as d } from "../../chunks/FileTypes-DiYB3WBp.mjs";
2
2
  import "three/webgpu";
3
3
  import "three/examples/jsm/loaders/HDRLoader.js";
4
4
  import "three/tsl";
5
- const V = {
6
- ...n
7
- }, D = async (c, a) => {
8
- const o = new r({ ...a, autoStart: !1 });
9
- o.mainView.camera.position.set(0, 1, 2);
10
- const e = await new l().setFromURL(c);
11
- o.scene.root.add(e), e.placeOnFloor();
12
- const i = new m(
13
- o.mainView.camera,
14
- o.mainView.canvas
15
- );
16
- o.clock.addTicker(i);
17
- const t = Object.assign(o, { orbitController: i, model: e }), s = o.disposeAsync.bind(o);
18
- return t.disposeAsync = async () => {
19
- i.dispose(), await s();
20
- }, ((a == null ? void 0 : a.autoStart) ?? !0) && (await o.startAsync(), i.focusObject(e)), t;
5
+ const m = async (a, e) => {
6
+ try {
7
+ const i = new l({ ...e, autoStart: !1 });
8
+ i.mainView.camera.position.set(0, 1, 2);
9
+ const o = await new u().setFromURL(a);
10
+ i.scene.root.add(o), o.placeOnFloor();
11
+ const t = new w(
12
+ i.mainView.camera,
13
+ i.mainView.canvas
14
+ );
15
+ i.clock.addTicker(t);
16
+ const r = Object.assign(i, { orbitController: t, model: o }), c = i.disposeAsync.bind(i);
17
+ return r.disposeAsync = async () => {
18
+ t.dispose(), await c();
19
+ }, ((e == null ? void 0 : e.autoStart) ?? !0) && (await i.startAsync(), t.focusObject(o)), r;
20
+ } catch (i) {
21
+ return console.error("Failed to initialize QuickView:", i), Promise.reject(i);
22
+ }
23
+ }, p = async (a, e) => {
24
+ try {
25
+ const i = new l({ ...e, autoStart: !1 });
26
+ i.mainView.camera.position.set(0, 1, 2);
27
+ const o = new w(
28
+ i.mainView.camera,
29
+ i.mainView.canvas
30
+ );
31
+ i.clock.addTicker(o);
32
+ const t = new (await import("../state/index.mjs")).State(
33
+ i,
34
+ o
35
+ ), r = Object.assign(i, { orbitController: o, state: t }), c = i.disposeAsync.bind(i);
36
+ r.disposeAsync = async () => {
37
+ o.dispose(), t.destroyInstance(), await c();
38
+ };
39
+ const n = (await t.performAction("SET_STATE", a)).filter(
40
+ (s) => "isDIVEModel" in s || "isDIVEPrimitive" in s
41
+ );
42
+ return n.length > 0 && o.focusObject(n), ((e == null ? void 0 : e.autoStart) ?? !0) && await i.startAsync(), r;
43
+ } catch (i) {
44
+ return console.error("Failed to initialize QuickView:", i), Promise.reject(i);
45
+ }
46
+ }, D = {
47
+ ...d
21
48
  };
49
+ function S(a, e) {
50
+ return typeof a == "string" ? m(a, e) : p(a, e);
51
+ }
22
52
  export {
23
- D as QuickView,
24
- V as QuickViewDefaultSettings
53
+ S as QuickView,
54
+ D as QuickViewDefaultSettings
25
55
  };
@@ -1,15 +1,19 @@
1
- import { DIVE, DIVEModel } from '../../../index.ts';
2
- import { OrbitController } from '../../orbitcontroller/index.ts';
3
- import { QuickViewSettings } from '../types/index.ts';
1
+ import { StateData } from '../../state/index.ts';
2
+ import { QuickViewWithModel, QuickViewWithState, QuickViewSettings } from '../types/index.ts';
4
3
  export declare const QuickViewDefaultSettings: Omit<Required<QuickViewSettings>, 'hdr'>;
5
- export type QuickView = DIVE & {
6
- orbitController: OrbitController;
7
- model: DIVEModel;
8
- };
9
4
  /**
5
+ * Creates a QuickView from a model URI.
10
6
  *
11
7
  * @param uri - The URI of the 3D model to display in QuickView
12
8
  * @param settings - The settings for the QuickView
13
9
  * @returns The DIVE instance with the orbit controller and hdr environment - { ...DIVE, orbitController: OrbitController, hdr: HDREnvironment }
14
10
  */
15
- export declare const QuickView: (uri: string, settings?: Partial<QuickViewSettings>) => Promise<QuickView>;
11
+ export declare function QuickView(uri: string, settings?: Partial<QuickViewSettings>): Promise<QuickViewWithModel>;
12
+ /**
13
+ * Creates a QuickView from scene state.
14
+ *
15
+ * @param state - The scene data to display in QuickView
16
+ * @param settings - The settings for the QuickView
17
+ * @returns The DIVE instance with the orbit controller and hdr environment - { ...DIVE, orbitController: OrbitController, hdr: HDREnvironment }
18
+ */
19
+ export declare function QuickView(state: StateData, settings?: Partial<QuickViewSettings>): Promise<QuickViewWithState>;
@@ -0,0 +1,4 @@
1
+ import { StateData } from '../../../state/index.ts';
2
+ import { QuickViewSettings } from '../../types/QuickViewSettings.ts';
3
+ import { QuickViewWithState } from '../../types/index.ts';
4
+ export declare const QuickViewState: (sceneData: StateData, settings?: Partial<QuickViewSettings>) => Promise<QuickViewWithState>;
@@ -0,0 +1,3 @@
1
+ import { QuickViewSettings } from '../../types/QuickViewSettings.ts';
2
+ import { QuickViewWithModel } from '../../types/index.ts';
3
+ export declare const QuickViewUri: (uri: string, settings?: Partial<QuickViewSettings>) => Promise<QuickViewWithModel>;
@@ -1 +1,19 @@
1
+ import { DIVE, DIVEModel } from '../../../index.ts';
2
+ import { OrbitController } from '../../orbitcontroller/index.ts';
3
+ import { State } from '../../state/index.ts';
1
4
  export * from './QuickViewSettings.ts';
5
+ /** A QuickView built from a single model URI. */
6
+ export type QuickViewWithModel = DIVE & {
7
+ orbitController: OrbitController;
8
+ model: DIVEModel;
9
+ };
10
+ /**
11
+ * A QuickView built from scene state.
12
+ *
13
+ * Carries no single `model`, because a scene state describes any number of
14
+ * objects. The State instance is exposed so the scene can be driven further.
15
+ */
16
+ export type QuickViewWithState = DIVE & {
17
+ orbitController: OrbitController;
18
+ state: State;
19
+ };