@inditextech/weave-renderer-konva-base 3.7.2 → 3.9.0-SNAPSHOT.172.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.
@@ -14659,7 +14659,7 @@ const SIMPLE_RECONCILER = {
14659
14659
  }
14660
14660
  if (parent instanceof Konva.Layer || parent instanceof Konva.Group) child.setZIndex(index);
14661
14661
  },
14662
- removeChild(instance, parent, child) {
14662
+ removeChild(instance, child) {
14663
14663
  const type = child.getAttrs().nodeType;
14664
14664
  const handler = instance.getNodeHandler(type);
14665
14665
  if (!handler) return;
@@ -14825,22 +14825,18 @@ var WeaveKonvaBaseRenderer = class extends WeaveRenderer {
14825
14825
  remove(instruction) {
14826
14826
  if (instruction.kind !== "REMOVE") throw new Error(`Invalid instruction kind for remove: ${instruction.kind}`);
14827
14827
  const stage = this.instance.getStage();
14828
- const parentInstance = stage.findOne(`#${instruction.parentKey}`);
14829
- const childInstance = stage.findOne(`#${instruction.key}`);
14830
- if (!childInstance) {
14831
- console.warn(`Trying to remove non existing node with key ${instruction.key}`);
14832
- return;
14828
+ const childInstances = stage.find(`#${instruction.key}`);
14829
+ for (const childInstance of childInstances) {
14830
+ let parent = childInstance.getParent();
14831
+ if (parent && parent.getAttrs().nodeId) parent = stage.findOne(`#${parent.getAttrs().nodeId}`);
14832
+ if (parent?.id() === instruction.parentKey) this.reconciler.removeChild(this.instance, childInstance);
14833
14833
  }
14834
- this.reconciler.removeChild(this.instance, parentInstance, childInstance);
14835
14834
  }
14836
14835
  updateProps(instruction) {
14837
14836
  if (instruction.kind !== "UPDATE_PROPS") throw new Error(`Invalid instruction kind for updateProps: ${instruction.kind}`);
14838
14837
  const stage = this.instance.getStage();
14839
14838
  const node = stage.findOne(`#${instruction.key}`);
14840
- if (!node) {
14841
- console.warn(`Trying to update non existing node with key ${instruction.key}`);
14842
- return;
14843
- }
14839
+ if (!node) return;
14844
14840
  this.reconciler.commitUpdate(this.instance, node, instruction.type, instruction.prevProps, instruction.nextProps);
14845
14841
  }
14846
14842
  };
@@ -14659,7 +14659,7 @@ const SIMPLE_RECONCILER = {
14659
14659
  }
14660
14660
  if (parent instanceof Konva.Layer || parent instanceof Konva.Group) child.setZIndex(index);
14661
14661
  },
14662
- removeChild(instance, parent, child) {
14662
+ removeChild(instance, child) {
14663
14663
  const type = child.getAttrs().nodeType;
14664
14664
  const handler = instance.getNodeHandler(type);
14665
14665
  if (!handler) return;
@@ -14825,22 +14825,18 @@ var WeaveKonvaBaseRenderer = class extends WeaveRenderer {
14825
14825
  remove(instruction) {
14826
14826
  if (instruction.kind !== "REMOVE") throw new Error(`Invalid instruction kind for remove: ${instruction.kind}`);
14827
14827
  const stage = this.instance.getStage();
14828
- const parentInstance = stage.findOne(`#${instruction.parentKey}`);
14829
- const childInstance = stage.findOne(`#${instruction.key}`);
14830
- if (!childInstance) {
14831
- console.warn(`Trying to remove non existing node with key ${instruction.key}`);
14832
- return;
14828
+ const childInstances = stage.find(`#${instruction.key}`);
14829
+ for (const childInstance of childInstances) {
14830
+ let parent = childInstance.getParent();
14831
+ if (parent && parent.getAttrs().nodeId) parent = stage.findOne(`#${parent.getAttrs().nodeId}`);
14832
+ if (parent?.id() === instruction.parentKey) this.reconciler.removeChild(this.instance, childInstance);
14833
14833
  }
14834
- this.reconciler.removeChild(this.instance, parentInstance, childInstance);
14835
14834
  }
14836
14835
  updateProps(instruction) {
14837
14836
  if (instruction.kind !== "UPDATE_PROPS") throw new Error(`Invalid instruction kind for updateProps: ${instruction.kind}`);
14838
14837
  const stage = this.instance.getStage();
14839
14838
  const node = stage.findOne(`#${instruction.key}`);
14840
- if (!node) {
14841
- console.warn(`Trying to update non existing node with key ${instruction.key}`);
14842
- return;
14843
- }
14839
+ if (!node) return;
14844
14840
  this.reconciler.commitUpdate(this.instance, node, instruction.type, instruction.prevProps, instruction.nextProps);
14845
14841
  }
14846
14842
  };
package/dist/types.d.ts CHANGED
@@ -18,7 +18,7 @@ declare class WeaveKonvaBaseRenderer extends WeaveRenderer {
18
18
  createInstance(instance: _inditextech_weave_sdk0.Weave, type: string, props: WeaveElementAttributes): WeaveElementInstance | undefined;
19
19
  createRoot(instance: _inditextech_weave_sdk1.Weave, child: WeaveElementInstance): void;
20
20
  appendChildToContainer(instance: _inditextech_weave_sdk2.Weave, parent: WeaveElementInstance, child: WeaveElementInstance, index: number): void;
21
- removeChild(instance: _inditextech_weave_sdk3.Weave, parent: WeaveElementInstance | undefined, child: WeaveElementInstance): void;
21
+ removeChild(instance: _inditextech_weave_sdk3.Weave, child: WeaveElementInstance): void;
22
22
  commitUpdate(instance: _inditextech_weave_sdk4.Weave, node: WeaveElementInstance, type: string, prevProps: WeaveElementAttributes, nextProps: WeaveElementAttributes): void;
23
23
  };
24
24
  deriveRendererInstructions(prevState: WeaveState, nextState: WeaveState): void;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../src/renderer.ts","../src/types.ts"],"sourcesContent":null,"mappings":";;;;;;;;;cAoBa,sBAAA,SAA+B,aAAA;;;;;;;EAA/B,aAAA,CAAA,CAAA,EAAA;IAAuB,cAAA,CAAA,QAAA,EAAA,uBAAA,CAAA,KAAA,EAAA,IAAA,EAAA,MAAA,EAAA,KAAA,wBAAA,CAAA,sBAAA,GAAA,SAAA;IAAA,UAAA,CAAA,QAAA,+BAAA,EAAA,KAAA,sBAAA,CAAA,EAAA,IAAA;;;;;wCA0CrB,uBACA;;;0BAgJW,0BAA0B;uBAgB7B;;;;;+BAOH,2CACP;UAzKE,aAAA;EAAU,QACV,MAAA;EAAU,QAgJC,WAAA;;;;;;KCtMd,mBAAA;;WAGG;;;;;;EDQF,GAAA,EAAA,MAAA;CAAuB,GAAA;EAAA,IAAA,EAAA,cAAA;;;aCKnB;aACA"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../src/renderer.ts","../src/types.ts"],"sourcesContent":null,"mappings":";;;;;;;;;cAoBa,sBAAA,SAA+B,aAAA;;;;;;;EAA/B,aAAA,CAAA,CAAA,EAAA;IAAuB,cAAA,CAAA,QAAA,EAAA,uBAAA,CAAA,KAAA,EAAA,IAAA,EAAA,MAAA,EAAA,KAAA,wBAAA,CAAA,sBAAA,GAAA,SAAA;IAAA,UAAA,CAAA,QAAA,+BAAA,EAAA,KAAA,sBAAA,CAAA,EAAA,IAAA;;;;;wCA0CrB,uBACA;;;0BAgJW,0BAA0B;uBAgB7B;;;;;cAjKR,CAAA,cAAA,EAwKK,oBAxKL,GAAA,SAAA,EAAA,OAAA,EAyKF,iBAzKE,EAAA,KAAA,EAAA,MAAA,CAAA,EAAA,IAAA;EAAU,QACV,aAAA;EAAU,QAgJC,MAAA;EAAU,QAAgB,WAAA;;;;;;KCtMxC,mBAAA;;WAGG;;;;;;EDQF,GAAA,EAAA,MAAA;CAAuB,GAAA;EAAA,IAAA,EAAA,cAAA;;;aCKnB;aACA"}
package/dist/types.js CHANGED
@@ -14659,7 +14659,7 @@ const SIMPLE_RECONCILER = {
14659
14659
  }
14660
14660
  if (parent instanceof Konva.Layer || parent instanceof Konva.Group) child.setZIndex(index);
14661
14661
  },
14662
- removeChild(instance, parent, child) {
14662
+ removeChild(instance, child) {
14663
14663
  const type = child.getAttrs().nodeType;
14664
14664
  const handler = instance.getNodeHandler(type);
14665
14665
  if (!handler) return;
@@ -14825,22 +14825,18 @@ var WeaveKonvaBaseRenderer = class extends WeaveRenderer {
14825
14825
  remove(instruction) {
14826
14826
  if (instruction.kind !== "REMOVE") throw new Error(`Invalid instruction kind for remove: ${instruction.kind}`);
14827
14827
  const stage = this.instance.getStage();
14828
- const parentInstance = stage.findOne(`#${instruction.parentKey}`);
14829
- const childInstance = stage.findOne(`#${instruction.key}`);
14830
- if (!childInstance) {
14831
- console.warn(`Trying to remove non existing node with key ${instruction.key}`);
14832
- return;
14828
+ const childInstances = stage.find(`#${instruction.key}`);
14829
+ for (const childInstance of childInstances) {
14830
+ let parent = childInstance.getParent();
14831
+ if (parent && parent.getAttrs().nodeId) parent = stage.findOne(`#${parent.getAttrs().nodeId}`);
14832
+ if (parent?.id() === instruction.parentKey) this.reconciler.removeChild(this.instance, childInstance);
14833
14833
  }
14834
- this.reconciler.removeChild(this.instance, parentInstance, childInstance);
14835
14834
  }
14836
14835
  updateProps(instruction) {
14837
14836
  if (instruction.kind !== "UPDATE_PROPS") throw new Error(`Invalid instruction kind for updateProps: ${instruction.kind}`);
14838
14837
  const stage = this.instance.getStage();
14839
14838
  const node = stage.findOne(`#${instruction.key}`);
14840
- if (!node) {
14841
- console.warn(`Trying to update non existing node with key ${instruction.key}`);
14842
- return;
14843
- }
14839
+ if (!node) return;
14844
14840
  this.reconciler.commitUpdate(this.instance, node, instruction.type, instruction.prevProps, instruction.nextProps);
14845
14841
  }
14846
14842
  };