@shopware-ag/dive 1.16.11 → 1.16.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware-ag/dive",
3
- "version": "1.16.11",
3
+ "version": "1.16.13",
4
4
  "description": "Shopware Spatial Framework",
5
5
  "type": "module",
6
6
  "main": "./build/dive.cjs",
@@ -55,8 +55,8 @@
55
55
  "typescript-eslint": "^7.7.1"
56
56
  },
57
57
  "scripts": {
58
- "build": "tsup",
59
- "dev": "tsup --watch",
58
+ "build": "tsup --env.DIVE_NODE_ENV production",
59
+ "dev": "tsup --watch --env.DIVE_NODE_ENV development",
60
60
  "lint": "eslint",
61
61
  "lint:actions": "yarn lint:actions:transpile && yarn lint:actions:check && yarn lint:actions:cleanup",
62
62
  "lint:actions:transpile": "yarn tsc --resolveJsonModule --esModuleInterop ci/lint/lint-actions.ts && mv ci/lint/lint-actions.js ci/lint/lint-actions.cjs",
@@ -444,6 +444,13 @@ export class DIVECommunication {
444
444
 
445
445
  this.registered.delete(payload.id);
446
446
 
447
+ // detach from parent
448
+ Array.from(this.registered.values()).forEach((object) => {
449
+ if (!object.parentId) return;
450
+ if (object.parentId !== payload.id) return;
451
+ object.parentId = null;
452
+ });
453
+
447
454
  this.scene.DeleteSceneObject(deletedObject);
448
455
 
449
456
  return true;
package/src/dive.ts CHANGED
@@ -278,7 +278,7 @@ export default class DIVE {
278
278
  };
279
279
 
280
280
  console.log(
281
- `DIVE ${pkgjson.version} initialized ${process.env.NODE_ENV === 'development' ? 'in development mode' : ''}`,
281
+ `DIVE ${pkgjson.version} initialized ${process.env.DIVE_NODE_ENV === 'development' ? 'in development mode' : ''}`,
282
282
  );
283
283
  }
284
284
 
@@ -12,7 +12,11 @@ import { type DIVESceneObject } from '../types';
12
12
  export class DIVEGroup extends DIVENode {
13
13
  readonly isDIVEGroup: true = true;
14
14
 
15
- private _members: Object3D[]; // lines to children
15
+ private _members: Object3D[]; // children objects
16
+
17
+ public get members(): Object3D[] {
18
+ return this._members;
19
+ }
16
20
 
17
21
  private _lines: Line[]; // lines to children
18
22
 
@@ -363,7 +363,7 @@ export class DIVERoot extends Object3D {
363
363
  }
364
364
 
365
365
  private deleteGroup(group: Partial<COMGroup> & { id: string }): void {
366
- const sceneObject = this.GetSceneObject(group);
366
+ const sceneObject = this.GetSceneObject<DIVEGroup>(group);
367
367
  if (!sceneObject) {
368
368
  console.warn(
369
369
  `DIVERoot.deleteGroup: Group with id ${group.id} not found`,
@@ -373,8 +373,8 @@ export class DIVERoot extends Object3D {
373
373
 
374
374
  this.detachTransformControls(sceneObject);
375
375
 
376
- for (let i = sceneObject.children.length - 1; i >= 0; i--) {
377
- this.attach(sceneObject.children[i]);
376
+ for (let i = sceneObject.members.length - 1; i >= 0; i--) {
377
+ this.attach(sceneObject.members[i]);
378
378
  }
379
379
 
380
380
  sceneObject.parent!.remove(sceneObject);
@@ -870,6 +870,13 @@ describe('DIVE/scene/root/DIVERoot', () => {
870
870
  expect(spyConsoleWarn).toHaveBeenCalled();
871
871
 
872
872
  spyConsoleWarn.mockClear();
873
+ root['detachTransformControls'] = jest.fn();
874
+ jest.spyOn(root, 'GetSceneObject').mockReturnValueOnce({
875
+ members: [new Object3D()],
876
+ parent: {
877
+ remove: jest.fn(),
878
+ },
879
+ } as unknown as DIVESceneObject);
873
880
  expect(() =>
874
881
  root.DeleteSceneObject({
875
882
  id: 'id',
@@ -883,6 +890,7 @@ describe('DIVE/scene/root/DIVERoot', () => {
883
890
  const firstFind = root.GetSceneObject({ id: 'id' });
884
891
  jest.spyOn(root, 'GetSceneObject').mockReturnValueOnce({
885
892
  ...firstFind,
893
+ members: [new Object3D()],
886
894
  parent: sceneParent,
887
895
  children: [
888
896
  {