@shopware-ag/dive 1.18.4 → 1.18.5-beta.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.
Files changed (139) hide show
  1. package/build/AR-B6LRgTEL.js +1482 -0
  2. package/build/AR-B6LRgTEL.js.map +1 -0
  3. package/build/AR-YJZL1lm5.cjs +170 -0
  4. package/build/AR-YJZL1lm5.cjs.map +1 -0
  5. package/build/dive-BmDCwQRo.js +24811 -0
  6. package/build/dive-BmDCwQRo.js.map +1 -0
  7. package/build/dive-C-5_QywE.cjs +3857 -0
  8. package/build/dive-C-5_QywE.cjs.map +1 -0
  9. package/build/dive.cjs +2 -4860
  10. package/build/dive.cjs.map +1 -1
  11. package/build/dive.d.ts +6 -1186
  12. package/build/dive.js +7 -4889
  13. package/build/dive.js.map +1 -1
  14. package/build/src/animation/AnimationSystem.d.ts +16 -0
  15. package/build/src/ar/AR.d.ts +21 -0
  16. package/build/src/ar/arquicklook/ARQuickLook.d.ts +8 -0
  17. package/build/src/ar/sceneviewer/SceneViewer.d.ts +7 -0
  18. package/build/src/ar/webxr/WebXR.d.ts +21 -0
  19. package/build/src/ar/webxr/controller/WebXRController.d.ts +46 -0
  20. package/build/src/ar/webxr/crosshair/WebXRCrosshair.d.ts +7 -0
  21. package/build/src/ar/webxr/origin/WebXROrigin.d.ts +31 -0
  22. package/build/src/ar/webxr/overlay/Overlay.d.ts +8 -0
  23. package/build/src/ar/webxr/raycaster/WebXRRaycaster.d.ts +40 -0
  24. package/build/src/ar/webxr/raycaster/ar/WebXRRaycasterAR.d.ts +15 -0
  25. package/build/src/ar/webxr/raycaster/three/WebXRRaycasterTHREE.d.ts +12 -0
  26. package/build/src/ar/webxr/touchscreencontrols/WebXRTouchscreenControls.d.ts +73 -0
  27. package/build/src/axiscamera/AxisCamera.d.ts +18 -0
  28. package/build/src/camera/PerspectiveCamera.d.ts +20 -0
  29. package/build/src/com/Communication.d.ts +77 -0
  30. package/build/src/com/actions/camera/computeencompassingview.d.ts +9 -0
  31. package/build/src/com/actions/camera/getcameratransform.d.ts +9 -0
  32. package/build/src/com/actions/camera/movecamera.d.ts +15 -0
  33. package/build/src/com/actions/camera/resetcamera.d.ts +7 -0
  34. package/build/src/com/actions/camera/setcameralayer.d.ts +7 -0
  35. package/build/src/com/actions/camera/setcameratransform.d.ts +9 -0
  36. package/build/src/com/actions/camera/zoomcamera.d.ts +8 -0
  37. package/build/src/com/actions/index.d.ts +58 -0
  38. package/build/src/com/actions/media/generatemedia.d.ts +15 -0
  39. package/build/src/com/actions/object/addobject.d.ts +6 -0
  40. package/build/src/com/actions/object/deleteobject.d.ts +8 -0
  41. package/build/src/com/actions/object/deselectobject.d.ts +8 -0
  42. package/build/src/com/actions/object/getallobjects.d.ts +6 -0
  43. package/build/src/com/actions/object/getobjects.d.ts +8 -0
  44. package/build/src/com/actions/object/model/dropit.d.ts +7 -0
  45. package/build/src/com/actions/object/model/modelloaded.d.ts +7 -0
  46. package/build/src/com/actions/object/model/placeonfloor.d.ts +7 -0
  47. package/build/src/com/actions/object/selectobject.d.ts +8 -0
  48. package/build/src/com/actions/object/setparent.d.ts +13 -0
  49. package/build/src/com/actions/object/updateobject.d.ts +8 -0
  50. package/build/src/com/actions/scene/exportscene.d.ts +8 -0
  51. package/build/src/com/actions/scene/getallscenedata.d.ts +6 -0
  52. package/build/src/com/actions/scene/launchar.d.ts +6 -0
  53. package/build/src/com/actions/scene/setbackground.d.ts +7 -0
  54. package/build/src/com/actions/scene/updatescene.d.ts +11 -0
  55. package/build/src/com/actions/toolbox/select/setgizmomode.d.ts +7 -0
  56. package/build/src/com/actions/toolbox/transform/setgizmoscalelinked.d.ts +5 -0
  57. package/build/src/com/actions/toolbox/transform/setgizmovisible.d.ts +5 -0
  58. package/build/src/com/actions/toolbox/usetool.d.ts +8 -0
  59. package/build/src/com/types/COMBaseEntity.d.ts +8 -0
  60. package/build/src/com/types/COMEntity.d.ts +6 -0
  61. package/build/src/com/types/COMEntityType.d.ts +1 -0
  62. package/build/src/com/types/COMGeometry.d.ts +7 -0
  63. package/build/src/com/types/COMGeometryType.d.ts +1 -0
  64. package/build/src/com/types/COMGroup.d.ts +8 -0
  65. package/build/src/com/types/COMLight.d.ts +10 -0
  66. package/build/src/com/types/COMMaterial.d.ts +11 -0
  67. package/build/src/com/types/COMModel.d.ts +11 -0
  68. package/build/src/com/types/COMPov.d.ts +7 -0
  69. package/build/src/com/types/COMPrimitive.d.ts +11 -0
  70. package/build/src/com/types/index.d.ts +11 -0
  71. package/build/src/constant/AxisHelperColors.d.ts +6 -0
  72. package/build/src/constant/GridColors.d.ts +2 -0
  73. package/build/src/constant/VisibilityLayerMask.d.ts +5 -0
  74. package/build/src/controls/OrbitControls.d.ts +38 -0
  75. package/build/src/dive.d.ts +64 -0
  76. package/build/src/events/EventExecutor.d.ts +5 -0
  77. package/build/src/exporters/usdz/USDZExporter.d.ts +15 -0
  78. package/build/src/gizmo/Gizmo.d.ts +27 -0
  79. package/build/src/gizmo/handles/AxisHandle.d.ts +30 -0
  80. package/build/src/gizmo/handles/RadialHandle.d.ts +30 -0
  81. package/build/src/gizmo/handles/ScaleHandle.d.ts +33 -0
  82. package/build/src/gizmo/plane/GizmoPlane.d.ts +12 -0
  83. package/build/src/gizmo/rotate/RotateGizmo.d.ts +17 -0
  84. package/build/src/gizmo/scale/ScaleGizmo.d.ts +20 -0
  85. package/build/src/gizmo/translate/TranslateGizmo.d.ts +17 -0
  86. package/build/src/grid/Grid.d.ts +10 -0
  87. package/build/src/group/Group.d.ts +23 -0
  88. package/build/src/helper/applyMixins/applyMixins.d.ts +8 -0
  89. package/build/src/helper/findInterface/findInterface.d.ts +2 -0
  90. package/build/src/helper/findSceneRecursive/findSceneRecursive.d.ts +9 -0
  91. package/build/src/helper/getObjectDelta/getObjectDelta.d.ts +4 -0
  92. package/build/src/helper/isInterface/implementsInterface.d.ts +2 -0
  93. package/build/src/info/Info.d.ts +39 -0
  94. package/build/src/interface/Draggable.d.ts +7 -0
  95. package/build/src/interface/Hoverable.d.ts +7 -0
  96. package/build/src/interface/Movable.d.ts +11 -0
  97. package/build/src/interface/Rotatable.d.ts +9 -0
  98. package/build/src/interface/Scalable.d.ts +9 -0
  99. package/build/src/interface/Selectable.d.ts +10 -0
  100. package/build/src/io/IO.d.ts +10 -0
  101. package/build/src/io/gltf/GLTFIO.d.ts +12 -0
  102. package/build/src/light/AmbientLight.d.ts +17 -0
  103. package/build/src/light/PointLight.d.ts +29 -0
  104. package/build/src/light/SceneLight.d.ts +18 -0
  105. package/build/src/loadingmanager/LoadingManager.d.ts +14 -0
  106. package/build/src/math/ceil/ceilExp.d.ts +1 -0
  107. package/build/src/math/degToRad/degToRad.d.ts +1 -0
  108. package/build/src/math/floor/floorExp.d.ts +1 -0
  109. package/build/src/math/helper/shift.d.ts +1 -0
  110. package/build/src/math/index.d.ts +18 -0
  111. package/build/src/math/radToDeg/radToDeg.d.ts +1 -0
  112. package/build/src/math/round/roundExp.d.ts +1 -0
  113. package/build/src/math/signedAngleTo/signedAngleTo.d.ts +9 -0
  114. package/build/src/math/toFixed/toFixedExp.d.ts +1 -0
  115. package/build/src/math/truncate/truncateExp.d.ts +1 -0
  116. package/build/src/mediacreator/MediaCreator.d.ts +17 -0
  117. package/build/src/model/Model.d.ts +21 -0
  118. package/build/src/node/Node.d.ts +24 -0
  119. package/build/src/primitive/Primitive.d.ts +28 -0
  120. package/build/src/primitive/floor/Floor.d.ts +14 -0
  121. package/build/src/renderer/Renderer.d.ts +69 -0
  122. package/build/src/scene/Scene.d.ts +46 -0
  123. package/build/src/scene/root/Root.d.ts +42 -0
  124. package/build/src/scene/xrroot/XRRoot.d.ts +17 -0
  125. package/build/src/scene/xrroot/xrlightroot/XRLightRoot.d.ts +13 -0
  126. package/build/src/toolbox/BaseTool.d.ts +48 -0
  127. package/build/src/toolbox/Toolbox.d.ts +31 -0
  128. package/build/src/toolbox/select/SelectTool.d.ts +26 -0
  129. package/build/src/toolbox/transform/TransformTool.d.ts +27 -0
  130. package/build/src/types/SceneData.d.ts +19 -0
  131. package/build/src/types/SceneObjects.d.ts +7 -0
  132. package/build/src/types/SceneType.d.ts +4 -0
  133. package/build/src/types/index.d.ts +4 -0
  134. package/package.json +9 -8
  135. package/src/camera/PerspectiveCamera.ts +1 -1
  136. package/src/com/Communication.ts +33 -8
  137. package/src/com/__test__/Communication.test.ts +2 -1
  138. package/src/dive.ts +0 -3
  139. package/build/dive.d.cts +0 -1186
@@ -0,0 +1,26 @@
1
+ import { DIVEScene } from '../../scene/Scene.ts';
2
+ import { default as DIVETransformTool } from '../transform/TransformTool.ts';
3
+ import { default as DIVEOrbitControls } from '../../controls/OrbitControls.ts';
4
+ import { DIVESelectable } from '../../interface/Selectable.ts';
5
+ import { DIVEBaseTool } from '../BaseTool.ts';
6
+ export declare const isSelectTool: (tool: DIVEBaseTool) => tool is DIVESelectTool;
7
+ export interface DIVEObjectEventMap {
8
+ select: object;
9
+ }
10
+ /**
11
+ * A Tool to select and move objects in the scene.
12
+ *
13
+ * Objects have to implement the DIVESelectable interface to be selectable and DIVEMovable to be movable.
14
+ *
15
+ * @module
16
+ */
17
+ export declare class DIVESelectTool extends DIVETransformTool {
18
+ readonly isSelectTool: boolean;
19
+ constructor(scene: DIVEScene, controller: DIVEOrbitControls);
20
+ Activate(): void;
21
+ Select(selectable: DIVESelectable): void;
22
+ Deselect(selectable: DIVESelectable): void;
23
+ AttachGizmo(selectable: DIVESelectable): void;
24
+ DetachGizmo(): void;
25
+ onClick(e: PointerEvent): void;
26
+ }
@@ -0,0 +1,27 @@
1
+ import { DIVEBaseTool } from '../BaseTool.ts';
2
+ import { DIVEScene } from '../../scene/Scene.ts';
3
+ import { default as DIVEOrbitControls } from '../../controls/OrbitControls.ts';
4
+ import { TransformControls } from 'three/examples/jsm/controls/TransformControls';
5
+ import { DIVEGizmo } from '../../gizmo/Gizmo.ts';
6
+ export declare const isTransformTool: (tool: DIVEBaseTool) => tool is DIVETransformTool;
7
+ export interface DIVEObjectEventMap {
8
+ select: object;
9
+ }
10
+ /**
11
+ * A Tool to select and move objects in the scene.
12
+ *
13
+ * Objects have to implement the DIVESelectable interface to be selectable and DIVEMovable to be movable.
14
+ *
15
+ * @module
16
+ */
17
+ export default class DIVETransformTool extends DIVEBaseTool {
18
+ readonly isTransformTool: boolean;
19
+ private _scaleLinked;
20
+ protected _gizmo: TransformControls | DIVEGizmo;
21
+ constructor(scene: DIVEScene, controller: DIVEOrbitControls);
22
+ Activate(): void;
23
+ SetGizmoMode(mode: 'translate' | 'rotate' | 'scale'): void;
24
+ SetGizmoVisibility(active: boolean): void;
25
+ SetGizmoScaleLinked(linked: boolean): void;
26
+ private initGizmo;
27
+ }
@@ -0,0 +1,19 @@
1
+ import { Vector3Like } from 'three';
2
+ import { COMGroup, COMLight, COMModel, COMPov, COMPrimitive } from '../dive';
3
+ export type DIVESceneData = {
4
+ name: string;
5
+ mediaItem: null;
6
+ backgroundColor: string;
7
+ floorEnabled: boolean;
8
+ floorColor: string;
9
+ userCamera: {
10
+ position: Vector3Like;
11
+ target: Vector3Like;
12
+ };
13
+ spotmarks: object[];
14
+ lights: COMLight[];
15
+ objects: COMModel[];
16
+ cameras: COMPov[];
17
+ primitives: COMPrimitive[];
18
+ groups: COMGroup[];
19
+ };
@@ -0,0 +1,7 @@
1
+ import { DIVEGroup } from '../group/Group';
2
+ import { default as DIVEAmbientLight } from '../light/AmbientLight';
3
+ import { default as DIVEPointLight } from '../light/PointLight';
4
+ import { default as DIVESceneLight } from '../light/SceneLight';
5
+ import { DIVEModel } from '../model/Model';
6
+ import { DIVEPrimitive } from '../primitive/Primitive';
7
+ export type DIVESceneObject = DIVEModel | DIVEGroup | DIVEPrimitive | DIVEAmbientLight | DIVEPointLight | DIVESceneLight;
@@ -0,0 +1,4 @@
1
+ import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader';
2
+ export type DIVESceneFileType = {
3
+ glb: GLTF;
4
+ };
@@ -0,0 +1,4 @@
1
+ import { DIVESceneObject } from './SceneObjects';
2
+ import { DIVESceneFileType } from './SceneType';
3
+ import { DIVESceneData } from './SceneData';
4
+ export { type DIVESceneObject, type DIVESceneFileType, type DIVESceneData };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@shopware-ag/dive",
3
- "version": "1.18.4",
3
+ "version": "1.18.5-beta.1",
4
4
  "description": "Shopware Spatial Framework",
5
5
  "type": "module",
6
- "main": "./build/dive.cjs",
7
- "module": "./build/dive.js",
8
- "types": "./build/dive.d.ts",
6
+ "main": "build/dive.cjs",
7
+ "module": "build/dive.js",
8
+ "types": "build/dive.d.ts",
9
9
  "files": [
10
10
  "build",
11
11
  "LICENSE",
@@ -51,13 +51,14 @@
51
51
  "ts-jest": "^29.1.2",
52
52
  "ts-node": "^10.9.2",
53
53
  "tsc": "^2.0.4",
54
- "tsup": "^8.0.2",
55
54
  "typescript": "^5.4.5",
56
- "typescript-eslint": "^7.7.1"
55
+ "typescript-eslint": "^7.7.1",
56
+ "vite": "^6.2.1",
57
+ "vite-plugin-dts": "^4.5.3"
57
58
  },
58
59
  "scripts": {
59
- "build": "tsup --env.DIVE_NODE_ENV production",
60
- "dev": "tsup --watch --env.DIVE_NODE_ENV development",
60
+ "build": "vite build",
61
+ "dev": "vite build --watch",
61
62
  "lint": "eslint",
62
63
  "lint:actions": "yarn lint:actions:transpile && yarn lint:actions:check && yarn lint:actions:cleanup",
63
64
  "lint:actions:transpile": "yarn tsc --resolveJsonModule --esModuleInterop ci/lint/lint-actions.ts && mv ci/lint/lint-actions.js ci/lint/lint-actions.cjs",
@@ -14,7 +14,7 @@ export type DIVEPerspectiveCameraSettings = {
14
14
 
15
15
  export const DIVEPerspectiveCameraDefaultSettings: DIVEPerspectiveCameraSettings =
16
16
  {
17
- fov: 80,
17
+ fov: 70,
18
18
  near: 0.1,
19
19
  far: 1000,
20
20
  };
@@ -99,13 +99,30 @@ export class DIVECommunication {
99
99
  }
100
100
 
101
101
  private _ar: DIVEAR | null;
102
- private get ar(): DIVEAR {
102
+ private get ar(): Promise<DIVEAR> {
103
103
  if (!this._ar) {
104
- const DIVEAR = require('../ar/AR.ts')
105
- .DIVEAR as typeof import('../ar/AR.ts').DIVEAR;
106
- this._ar = new DIVEAR(this.renderer, this.scene, this.controller);
104
+ return new Promise((resolve, reject) => {
105
+ import('../ar/AR.ts')
106
+ .then((module) => {
107
+ const DIVEAR = module.DIVEAR;
108
+ this._ar = new DIVEAR(
109
+ this.renderer,
110
+ this.scene,
111
+ this.controller,
112
+ );
113
+ resolve(this._ar);
114
+ })
115
+ .catch((error) => {
116
+ console.error(
117
+ 'DIVE: Error while lazy-loading AR module:',
118
+ error,
119
+ );
120
+ reject(error);
121
+ });
122
+ });
107
123
  }
108
- return this._ar;
124
+
125
+ return Promise.resolve(this._ar);
109
126
  }
110
127
 
111
128
  private registered: Map<string, COMEntity> = new Map();
@@ -311,9 +328,17 @@ export class DIVECommunication {
311
328
  break;
312
329
  }
313
330
  case 'LAUNCH_AR': {
314
- returnValue = this.ar.Launch(
315
- payload as Actions['LAUNCH_AR']['PAYLOAD'],
316
- );
331
+ returnValue = new Promise<void>((resolve, reject) => {
332
+ this.ar
333
+ .then((arModule) => {
334
+ resolve(
335
+ arModule.Launch(
336
+ payload as Actions['LAUNCH_AR']['PAYLOAD'],
337
+ ),
338
+ );
339
+ })
340
+ .catch(reject);
341
+ });
317
342
  break;
318
343
  }
319
344
  default: {
@@ -965,8 +965,9 @@ describe('dive/communication/DIVECommunication', () => {
965
965
  });
966
966
 
967
967
  it('should perform action LAUNCH_AR', async () => {
968
+ const arModule = await testCom['ar'];
968
969
  const arLaunchSpy = jest
969
- .spyOn(testCom['ar'], 'Launch')
970
+ .spyOn(arModule, 'Launch')
970
971
  .mockResolvedValueOnce();
971
972
 
972
973
  const result = await testCom.PerformAction('LAUNCH_AR', undefined);
package/src/dive.ts CHANGED
@@ -277,9 +277,6 @@ export default class DIVE {
277
277
  };
278
278
 
279
279
  console.log(`DIVE ${pkgjson.version} initialized successfully!`);
280
- if (process.env.DIVE_NODE_ENV === 'development') {
281
- console.log('DIVE is running in development mode.');
282
- }
283
280
  console.log(`
284
281
  @@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@
285
282
  @@@@+-:::::::---------------------==------------------------------=#@@@@