@shopware-ag/dive 1.16.1 → 1.16.2

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 (35) hide show
  1. package/README.md +226 -32
  2. package/build/dive.cjs +14 -6
  3. package/build/dive.cjs.map +1 -1
  4. package/build/dive.d.cts +28 -2
  5. package/build/dive.d.ts +28 -2
  6. package/build/dive.js +14 -6
  7. package/build/dive.js.map +1 -1
  8. package/package.json +14 -6
  9. package/src/com/actions/camera/computeencompassingview.ts +1 -0
  10. package/src/com/actions/camera/getcameratransform.ts +1 -0
  11. package/src/com/actions/camera/movecamera.ts +1 -0
  12. package/src/com/actions/camera/resetcamera.ts +1 -0
  13. package/src/com/actions/camera/setcameralayer.ts +1 -0
  14. package/src/com/actions/camera/setcameratransform.ts +1 -0
  15. package/src/com/actions/camera/zoomcamera.ts +1 -0
  16. package/src/com/actions/index.ts +2 -2
  17. package/src/com/actions/media/generatemedia.ts +1 -0
  18. package/src/com/actions/object/addobject.ts +1 -0
  19. package/src/com/actions/object/deleteobject.ts +1 -0
  20. package/src/com/actions/object/deselectobject.ts +1 -0
  21. package/src/com/actions/object/getallobjects.ts +1 -0
  22. package/src/com/actions/object/getobjects.ts +1 -0
  23. package/src/com/actions/object/model/dropit.ts +1 -0
  24. package/src/com/actions/object/model/modelloaded.ts +1 -0
  25. package/src/com/actions/object/model/placeonfloor.ts +1 -0
  26. package/src/com/actions/object/selectobject.ts +1 -0
  27. package/src/com/actions/object/setparent.ts +1 -0
  28. package/src/com/actions/object/updateobject.ts +1 -0
  29. package/src/com/actions/scene/exportscene.ts +1 -0
  30. package/src/com/actions/scene/getallscenedata.ts +1 -0
  31. package/src/com/actions/scene/setbackground.ts +1 -0
  32. package/src/com/actions/scene/updatescene.ts +1 -0
  33. package/src/com/actions/toolbox/select/setgizmomode.ts +1 -0
  34. package/src/com/actions/toolbox/transform/setgizmovisible.ts +1 -0
  35. package/src/com/actions/toolbox/usetool.ts +1 -0
package/build/dive.d.cts CHANGED
@@ -141,6 +141,7 @@ declare class DIVEOrbitControls extends OrbitControls {
141
141
  }
142
142
 
143
143
  interface SET_BACKGROUND {
144
+ DESCRIPTION: 'Set the background color of the scene.';
144
145
  PAYLOAD: {
145
146
  color: string | number;
146
147
  };
@@ -148,6 +149,7 @@ interface SET_BACKGROUND {
148
149
  }
149
150
 
150
151
  interface RESET_CAMERA {
152
+ DESCRIPTION: 'Reset the camera to its initial position and rotation.';
151
153
  PAYLOAD: {
152
154
  duration: number;
153
155
  };
@@ -155,6 +157,7 @@ interface RESET_CAMERA {
155
157
  }
156
158
 
157
159
  interface SET_CAMERA_LAYER {
160
+ DESCRIPTION: 'Sets the camera layer to a certain layer.';
158
161
  PAYLOAD: {
159
162
  layer: 'LIVE' | 'EDITOR';
160
163
  };
@@ -162,6 +165,7 @@ interface SET_CAMERA_LAYER {
162
165
  }
163
166
 
164
167
  interface ZOOM_CAMERA {
168
+ DESCRIPTION: 'Zooms the camera in or out by a certain amount.';
165
169
  PAYLOAD: {
166
170
  direction: 'IN' | 'OUT';
167
171
  by: number;
@@ -170,6 +174,7 @@ interface ZOOM_CAMERA {
170
174
  }
171
175
 
172
176
  interface SET_GIZMO_MODE {
177
+ DESCRIPTION: "Sets the gizmo's mode.";
173
178
  PAYLOAD: {
174
179
  mode: 'translate' | 'rotate' | 'scale';
175
180
  };
@@ -177,6 +182,7 @@ interface SET_GIZMO_MODE {
177
182
  }
178
183
 
179
184
  interface SET_CAMERA_TRANSFORM {
185
+ DESCRIPTION: 'Sets the camera position and target.';
180
186
  PAYLOAD: {
181
187
  position: Vector3Like;
182
188
  target: Vector3Like;
@@ -185,6 +191,7 @@ interface SET_CAMERA_TRANSFORM {
185
191
  }
186
192
 
187
193
  interface MOVE_CAMERA {
194
+ DESCRIPTION: 'Moves the camera to a new position and target.';
188
195
  PAYLOAD: {
189
196
  position: Vector3Like;
190
197
  target: Vector3Like;
@@ -199,6 +206,7 @@ interface MOVE_CAMERA {
199
206
  }
200
207
 
201
208
  interface PLACE_ON_FLOOR {
209
+ DESCRIPTION: 'Places an object on the floor.';
202
210
  PAYLOAD: {
203
211
  id: string;
204
212
  };
@@ -274,11 +282,13 @@ type COMGroup = COMBaseEntity & {
274
282
  type COMEntity = COMPov | COMLight | COMModel | COMPrimitive | COMGroup;
275
283
 
276
284
  interface GET_ALL_OBJECTS {
285
+ readonly DESCRIPTION: 'Retrieves all objects in the scene.';
277
286
  PAYLOAD: Map<string, COMEntity>;
278
287
  RETURN: Map<string, COMEntity>;
279
288
  }
280
289
 
281
290
  interface GET_OBJECTS {
291
+ DESCRIPTION: 'Returns a list of objects of given IDs.';
282
292
  PAYLOAD: {
283
293
  ids: string[];
284
294
  };
@@ -286,11 +296,13 @@ interface GET_OBJECTS {
286
296
  }
287
297
 
288
298
  interface ADD_OBJECT {
299
+ DESCRIPTION: 'Adds an object to the scene.';
289
300
  PAYLOAD: COMEntity;
290
301
  RETURN: boolean;
291
302
  }
292
303
 
293
304
  interface DELETE_OBJECT {
305
+ DESCRIPTION: 'Deletes an object from the scene.';
294
306
  PAYLOAD: Partial<COMEntity> & {
295
307
  id: string;
296
308
  };
@@ -298,6 +310,7 @@ interface DELETE_OBJECT {
298
310
  }
299
311
 
300
312
  interface UPDATE_OBJECT {
313
+ DESCRIPTION: 'Updates an existing object.';
301
314
  PAYLOAD: Partial<COMEntity> & {
302
315
  id: string;
303
316
  };
@@ -305,6 +318,7 @@ interface UPDATE_OBJECT {
305
318
  }
306
319
 
307
320
  interface MODEL_LOADED {
321
+ DESCRIPTION: 'Is triggered when a model is loaded.';
308
322
  PAYLOAD: {
309
323
  id: string;
310
324
  };
@@ -312,6 +326,7 @@ interface MODEL_LOADED {
312
326
  }
313
327
 
314
328
  interface UPDATE_SCENE {
329
+ DESCRIPTION: 'Updates global scene data.';
315
330
  PAYLOAD: {
316
331
  name?: string;
317
332
  backgroundColor?: string | number;
@@ -323,6 +338,7 @@ interface UPDATE_SCENE {
323
338
  }
324
339
 
325
340
  interface GENERATE_MEDIA {
341
+ DESCRIPTION: 'Generates a screenshot, stores it in a Blob and writes the URL into the payload.';
326
342
  PAYLOAD: ({
327
343
  position: Vector3Like;
328
344
  target: Vector3Like;
@@ -353,11 +369,13 @@ type SceneData = {
353
369
  primitives: COMPrimitive[];
354
370
  };
355
371
  interface GET_ALL_SCENE_DATA {
372
+ DESCRIPTION: 'Retrieves all current scene data.';
356
373
  PAYLOAD: object;
357
374
  RETURN: SceneData;
358
375
  }
359
376
 
360
377
  interface SELECT_OBJECT {
378
+ DESCRIPTION: 'Selects an existing object.';
361
379
  PAYLOAD: Partial<COMEntity> & {
362
380
  id: string;
363
381
  };
@@ -365,6 +383,7 @@ interface SELECT_OBJECT {
365
383
  }
366
384
 
367
385
  interface DESELECT_OBJECT {
386
+ DESCRIPTION: 'Deselects an existing object.';
368
387
  PAYLOAD: Partial<COMEntity> & {
369
388
  id: string;
370
389
  };
@@ -372,6 +391,7 @@ interface DESELECT_OBJECT {
372
391
  }
373
392
 
374
393
  interface GET_CAMERA_TRANSFORM {
394
+ DESCRIPTION: 'Returns the current camera position and target.';
375
395
  PAYLOAD: object;
376
396
  RETURN: {
377
397
  position: Vector3Like;
@@ -380,6 +400,7 @@ interface GET_CAMERA_TRANSFORM {
380
400
  }
381
401
 
382
402
  interface DROP_IT {
403
+ DESCRIPTION: 'Places an object on top of an underlying object or the floor.';
383
404
  PAYLOAD: {
384
405
  id: string;
385
406
  };
@@ -387,11 +408,13 @@ interface DROP_IT {
387
408
  }
388
409
 
389
410
  interface SET_GIZMO_VISIBILITY {
411
+ DESCRIPTION: "Sets the gizmo's visibility.";
390
412
  PAYLOAD: boolean;
391
413
  RETURN: boolean;
392
414
  }
393
415
 
394
416
  interface COMPUTE_ENCOMPASSING_VIEW {
417
+ DESCRIPTION: 'Calculates the camera position and target to view the whole scene. (experimental)';
395
418
  PAYLOAD: object;
396
419
  RETURN: {
397
420
  position: Vector3Like;
@@ -796,6 +819,7 @@ declare class DIVEToolbox {
796
819
  }
797
820
 
798
821
  interface USE_TOOL {
822
+ DESCRIPTION: 'Activates a specific tool from the toolbox.';
799
823
  PAYLOAD: {
800
824
  tool: ToolType;
801
825
  };
@@ -803,6 +827,7 @@ interface USE_TOOL {
803
827
  }
804
828
 
805
829
  interface SET_PARENT {
830
+ DESCRIPTION: 'Attach an object to another object.';
806
831
  PAYLOAD: {
807
832
  object: Partial<COMEntity> & {
808
833
  id: string;
@@ -815,13 +840,14 @@ interface SET_PARENT {
815
840
  }
816
841
 
817
842
  interface EXPORT_SCENE {
843
+ DESCRIPTION: 'Exports the current scene to a blob and returns the URL.';
818
844
  PAYLOAD: {
819
845
  type: keyof DIVESceneFileType;
820
846
  };
821
847
  RETURN: Promise<string | null>;
822
848
  }
823
849
 
824
- type Actions = {
850
+ interface Actions {
825
851
  GET_ALL_SCENE_DATA: GET_ALL_SCENE_DATA;
826
852
  GET_ALL_OBJECTS: GET_ALL_OBJECTS;
827
853
  GET_OBJECTS: GET_OBJECTS;
@@ -848,7 +874,7 @@ type Actions = {
848
874
  GENERATE_MEDIA: GENERATE_MEDIA;
849
875
  SET_PARENT: SET_PARENT;
850
876
  EXPORT_SCENE: EXPORT_SCENE;
851
- };
877
+ }
852
878
 
853
879
  type EventListener<Action extends keyof Actions> = (payload: Actions[Action]['PAYLOAD']) => void;
854
880
  type Unsubscribe = () => boolean;
package/build/dive.d.ts CHANGED
@@ -141,6 +141,7 @@ declare class DIVEOrbitControls extends OrbitControls {
141
141
  }
142
142
 
143
143
  interface SET_BACKGROUND {
144
+ DESCRIPTION: 'Set the background color of the scene.';
144
145
  PAYLOAD: {
145
146
  color: string | number;
146
147
  };
@@ -148,6 +149,7 @@ interface SET_BACKGROUND {
148
149
  }
149
150
 
150
151
  interface RESET_CAMERA {
152
+ DESCRIPTION: 'Reset the camera to its initial position and rotation.';
151
153
  PAYLOAD: {
152
154
  duration: number;
153
155
  };
@@ -155,6 +157,7 @@ interface RESET_CAMERA {
155
157
  }
156
158
 
157
159
  interface SET_CAMERA_LAYER {
160
+ DESCRIPTION: 'Sets the camera layer to a certain layer.';
158
161
  PAYLOAD: {
159
162
  layer: 'LIVE' | 'EDITOR';
160
163
  };
@@ -162,6 +165,7 @@ interface SET_CAMERA_LAYER {
162
165
  }
163
166
 
164
167
  interface ZOOM_CAMERA {
168
+ DESCRIPTION: 'Zooms the camera in or out by a certain amount.';
165
169
  PAYLOAD: {
166
170
  direction: 'IN' | 'OUT';
167
171
  by: number;
@@ -170,6 +174,7 @@ interface ZOOM_CAMERA {
170
174
  }
171
175
 
172
176
  interface SET_GIZMO_MODE {
177
+ DESCRIPTION: "Sets the gizmo's mode.";
173
178
  PAYLOAD: {
174
179
  mode: 'translate' | 'rotate' | 'scale';
175
180
  };
@@ -177,6 +182,7 @@ interface SET_GIZMO_MODE {
177
182
  }
178
183
 
179
184
  interface SET_CAMERA_TRANSFORM {
185
+ DESCRIPTION: 'Sets the camera position and target.';
180
186
  PAYLOAD: {
181
187
  position: Vector3Like;
182
188
  target: Vector3Like;
@@ -185,6 +191,7 @@ interface SET_CAMERA_TRANSFORM {
185
191
  }
186
192
 
187
193
  interface MOVE_CAMERA {
194
+ DESCRIPTION: 'Moves the camera to a new position and target.';
188
195
  PAYLOAD: {
189
196
  position: Vector3Like;
190
197
  target: Vector3Like;
@@ -199,6 +206,7 @@ interface MOVE_CAMERA {
199
206
  }
200
207
 
201
208
  interface PLACE_ON_FLOOR {
209
+ DESCRIPTION: 'Places an object on the floor.';
202
210
  PAYLOAD: {
203
211
  id: string;
204
212
  };
@@ -274,11 +282,13 @@ type COMGroup = COMBaseEntity & {
274
282
  type COMEntity = COMPov | COMLight | COMModel | COMPrimitive | COMGroup;
275
283
 
276
284
  interface GET_ALL_OBJECTS {
285
+ readonly DESCRIPTION: 'Retrieves all objects in the scene.';
277
286
  PAYLOAD: Map<string, COMEntity>;
278
287
  RETURN: Map<string, COMEntity>;
279
288
  }
280
289
 
281
290
  interface GET_OBJECTS {
291
+ DESCRIPTION: 'Returns a list of objects of given IDs.';
282
292
  PAYLOAD: {
283
293
  ids: string[];
284
294
  };
@@ -286,11 +296,13 @@ interface GET_OBJECTS {
286
296
  }
287
297
 
288
298
  interface ADD_OBJECT {
299
+ DESCRIPTION: 'Adds an object to the scene.';
289
300
  PAYLOAD: COMEntity;
290
301
  RETURN: boolean;
291
302
  }
292
303
 
293
304
  interface DELETE_OBJECT {
305
+ DESCRIPTION: 'Deletes an object from the scene.';
294
306
  PAYLOAD: Partial<COMEntity> & {
295
307
  id: string;
296
308
  };
@@ -298,6 +310,7 @@ interface DELETE_OBJECT {
298
310
  }
299
311
 
300
312
  interface UPDATE_OBJECT {
313
+ DESCRIPTION: 'Updates an existing object.';
301
314
  PAYLOAD: Partial<COMEntity> & {
302
315
  id: string;
303
316
  };
@@ -305,6 +318,7 @@ interface UPDATE_OBJECT {
305
318
  }
306
319
 
307
320
  interface MODEL_LOADED {
321
+ DESCRIPTION: 'Is triggered when a model is loaded.';
308
322
  PAYLOAD: {
309
323
  id: string;
310
324
  };
@@ -312,6 +326,7 @@ interface MODEL_LOADED {
312
326
  }
313
327
 
314
328
  interface UPDATE_SCENE {
329
+ DESCRIPTION: 'Updates global scene data.';
315
330
  PAYLOAD: {
316
331
  name?: string;
317
332
  backgroundColor?: string | number;
@@ -323,6 +338,7 @@ interface UPDATE_SCENE {
323
338
  }
324
339
 
325
340
  interface GENERATE_MEDIA {
341
+ DESCRIPTION: 'Generates a screenshot, stores it in a Blob and writes the URL into the payload.';
326
342
  PAYLOAD: ({
327
343
  position: Vector3Like;
328
344
  target: Vector3Like;
@@ -353,11 +369,13 @@ type SceneData = {
353
369
  primitives: COMPrimitive[];
354
370
  };
355
371
  interface GET_ALL_SCENE_DATA {
372
+ DESCRIPTION: 'Retrieves all current scene data.';
356
373
  PAYLOAD: object;
357
374
  RETURN: SceneData;
358
375
  }
359
376
 
360
377
  interface SELECT_OBJECT {
378
+ DESCRIPTION: 'Selects an existing object.';
361
379
  PAYLOAD: Partial<COMEntity> & {
362
380
  id: string;
363
381
  };
@@ -365,6 +383,7 @@ interface SELECT_OBJECT {
365
383
  }
366
384
 
367
385
  interface DESELECT_OBJECT {
386
+ DESCRIPTION: 'Deselects an existing object.';
368
387
  PAYLOAD: Partial<COMEntity> & {
369
388
  id: string;
370
389
  };
@@ -372,6 +391,7 @@ interface DESELECT_OBJECT {
372
391
  }
373
392
 
374
393
  interface GET_CAMERA_TRANSFORM {
394
+ DESCRIPTION: 'Returns the current camera position and target.';
375
395
  PAYLOAD: object;
376
396
  RETURN: {
377
397
  position: Vector3Like;
@@ -380,6 +400,7 @@ interface GET_CAMERA_TRANSFORM {
380
400
  }
381
401
 
382
402
  interface DROP_IT {
403
+ DESCRIPTION: 'Places an object on top of an underlying object or the floor.';
383
404
  PAYLOAD: {
384
405
  id: string;
385
406
  };
@@ -387,11 +408,13 @@ interface DROP_IT {
387
408
  }
388
409
 
389
410
  interface SET_GIZMO_VISIBILITY {
411
+ DESCRIPTION: "Sets the gizmo's visibility.";
390
412
  PAYLOAD: boolean;
391
413
  RETURN: boolean;
392
414
  }
393
415
 
394
416
  interface COMPUTE_ENCOMPASSING_VIEW {
417
+ DESCRIPTION: 'Calculates the camera position and target to view the whole scene. (experimental)';
395
418
  PAYLOAD: object;
396
419
  RETURN: {
397
420
  position: Vector3Like;
@@ -796,6 +819,7 @@ declare class DIVEToolbox {
796
819
  }
797
820
 
798
821
  interface USE_TOOL {
822
+ DESCRIPTION: 'Activates a specific tool from the toolbox.';
799
823
  PAYLOAD: {
800
824
  tool: ToolType;
801
825
  };
@@ -803,6 +827,7 @@ interface USE_TOOL {
803
827
  }
804
828
 
805
829
  interface SET_PARENT {
830
+ DESCRIPTION: 'Attach an object to another object.';
806
831
  PAYLOAD: {
807
832
  object: Partial<COMEntity> & {
808
833
  id: string;
@@ -815,13 +840,14 @@ interface SET_PARENT {
815
840
  }
816
841
 
817
842
  interface EXPORT_SCENE {
843
+ DESCRIPTION: 'Exports the current scene to a blob and returns the URL.';
818
844
  PAYLOAD: {
819
845
  type: keyof DIVESceneFileType;
820
846
  };
821
847
  RETURN: Promise<string | null>;
822
848
  }
823
849
 
824
- type Actions = {
850
+ interface Actions {
825
851
  GET_ALL_SCENE_DATA: GET_ALL_SCENE_DATA;
826
852
  GET_ALL_OBJECTS: GET_ALL_OBJECTS;
827
853
  GET_OBJECTS: GET_OBJECTS;
@@ -848,7 +874,7 @@ type Actions = {
848
874
  GENERATE_MEDIA: GENERATE_MEDIA;
849
875
  SET_PARENT: SET_PARENT;
850
876
  EXPORT_SCENE: EXPORT_SCENE;
851
- };
877
+ }
852
878
 
853
879
  type EventListener<Action extends keyof Actions> = (payload: Actions[Action]['PAYLOAD']) => void;
854
880
  type Unsubscribe = () => boolean;
package/build/dive.js CHANGED
@@ -2863,7 +2863,7 @@ DIVEInfo._supportsWebXR = null;
2863
2863
  // package.json
2864
2864
  var package_default = {
2865
2865
  name: "@shopware-ag/dive",
2866
- version: "1.16.1",
2866
+ version: "1.16.2",
2867
2867
  description: "Shopware Spatial Framework",
2868
2868
  type: "module",
2869
2869
  main: "./build/dive.cjs",
@@ -2912,19 +2912,27 @@ var package_default = {
2912
2912
  "prettier-plugin-multiline-arrays": "^3.0.6",
2913
2913
  "ts-jest": "^29.1.2",
2914
2914
  "ts-node": "^10.9.2",
2915
+ tsc: "^2.0.4",
2915
2916
  tsup: "^8.0.2",
2916
2917
  typescript: "^5.4.5",
2917
2918
  "typescript-eslint": "^7.7.1"
2918
2919
  },
2919
2920
  scripts: {
2920
- build: "tsup && yarn genmd",
2921
- watch: "tsup --watch",
2921
+ build: "tsup",
2922
+ dev: "tsup --watch",
2922
2923
  lint: "eslint",
2923
- "prettier-check": "prettier --check .",
2924
- "prettier-fix": "prettier --write .",
2924
+ "lint:actions": "yarn lint:actions:transpile && yarn lint:actions:check && yarn lint:actions:cleanup",
2925
+ "lint:actions:transpile": "yarn tsc --resolveJsonModule --esModuleInterop ci/lint/lint-actions.ts && mv ci/lint/lint-actions.js ci/lint/lint-actions.cjs",
2926
+ "lint:actions:check": "yarn node ci/lint/lint-actions.cjs",
2927
+ "lint:actions:cleanup": `node -e "require('fs').unlinkSync('ci/lint/lint-actions.cjs')"`,
2928
+ "prettier:check": "prettier --check .",
2929
+ "prettier:fix": "prettier --write .",
2925
2930
  unit: "jest",
2926
2931
  coverage: "jest --coverage",
2927
- genmd: "node ./scripts/genmd.js"
2932
+ "generate-readme": "yarn generate-readme:transpile && yarn generate-readme:write && yarn generate-readme:cleanup",
2933
+ "generate-readme:transpile": "yarn tsc --resolveJsonModule --esModuleInterop ci/readme/generate-readme.ts && mv ci/readme/generate-readme.js ci/readme/generate-readme.cjs",
2934
+ "generate-readme:write": "node ci/readme/generate-readme.cjs",
2935
+ "generate-readme:cleanup": `node -e "require('fs').unlinkSync('ci/readme/generate-readme.cjs')"`
2928
2936
  }
2929
2937
  };
2930
2938