microboard-temp 0.2.3 → 0.2.5

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.
@@ -52142,14 +52142,15 @@ class Board {
52142
52142
  }
52143
52143
  applyAddItems(op) {
52144
52144
  if (Array.isArray(op.item)) {
52145
+ const data = op.data;
52145
52146
  const items = op.item.map((item2) => {
52146
- const created = this.createItem(item2, op.data[item2]);
52147
+ const created = this.createItem(item2, data[item2]);
52147
52148
  this.index.insert(created);
52148
52149
  return created;
52149
52150
  });
52150
52151
  items.forEach((item2) => {
52151
- if (item2.itemType === "Connector" && op.data[item2.getId()]) {
52152
- const connectorData = op.data[item2.getId()];
52152
+ if (item2 instanceof Connector2 && data[item2.getId()]) {
52153
+ const connectorData = data[item2.getId()];
52153
52154
  item2.applyStartPoint(connectorData.startPoint);
52154
52155
  item2.applyEndPoint(connectorData.endPoint);
52155
52156
  }
@@ -52178,7 +52179,7 @@ class Board {
52178
52179
  this.findItemAndApply(op.item, (item) => {
52179
52180
  this.index.remove(item);
52180
52181
  this.selection.remove(item);
52181
- if (item.itemType === "Connector") {
52182
+ if (item instanceof Connector2) {
52182
52183
  item.clearObservedItems();
52183
52184
  }
52184
52185
  removedItems.push(item);
@@ -52186,7 +52187,7 @@ class Board {
52186
52187
  }
52187
52188
  applyRemoveLockedGroupOperation(op) {
52188
52189
  const item = this.index.getById(op.item[0]);
52189
- if (!item || item.itemType !== "Group") {
52190
+ if (!item || !(item instanceof Group)) {
52190
52191
  return;
52191
52192
  }
52192
52193
  item.getChildren().forEach((item2) => {
@@ -52202,9 +52203,11 @@ class Board {
52202
52203
  });
52203
52204
  }
52204
52205
  applyItemOperation(op) {
52205
- this.findItemAndApply(op.item, (item) => {
52206
- item.apply(op);
52207
- });
52206
+ if ("item" in op) {
52207
+ this.findItemAndApply(op.item, (item) => {
52208
+ item.apply(op);
52209
+ });
52210
+ }
52208
52211
  }
52209
52212
  findItemAndApply(item, apply) {
52210
52213
  if (Array.isArray(item)) {
package/dist/cjs/index.js CHANGED
@@ -52142,14 +52142,15 @@ class Board {
52142
52142
  }
52143
52143
  applyAddItems(op) {
52144
52144
  if (Array.isArray(op.item)) {
52145
+ const data = op.data;
52145
52146
  const items = op.item.map((item2) => {
52146
- const created = this.createItem(item2, op.data[item2]);
52147
+ const created = this.createItem(item2, data[item2]);
52147
52148
  this.index.insert(created);
52148
52149
  return created;
52149
52150
  });
52150
52151
  items.forEach((item2) => {
52151
- if (item2.itemType === "Connector" && op.data[item2.getId()]) {
52152
- const connectorData = op.data[item2.getId()];
52152
+ if (item2 instanceof Connector2 && data[item2.getId()]) {
52153
+ const connectorData = data[item2.getId()];
52153
52154
  item2.applyStartPoint(connectorData.startPoint);
52154
52155
  item2.applyEndPoint(connectorData.endPoint);
52155
52156
  }
@@ -52178,7 +52179,7 @@ class Board {
52178
52179
  this.findItemAndApply(op.item, (item) => {
52179
52180
  this.index.remove(item);
52180
52181
  this.selection.remove(item);
52181
- if (item.itemType === "Connector") {
52182
+ if (item instanceof Connector2) {
52182
52183
  item.clearObservedItems();
52183
52184
  }
52184
52185
  removedItems.push(item);
@@ -52186,7 +52187,7 @@ class Board {
52186
52187
  }
52187
52188
  applyRemoveLockedGroupOperation(op) {
52188
52189
  const item = this.index.getById(op.item[0]);
52189
- if (!item || item.itemType !== "Group") {
52190
+ if (!item || !(item instanceof Group)) {
52190
52191
  return;
52191
52192
  }
52192
52193
  item.getChildren().forEach((item2) => {
@@ -52202,9 +52203,11 @@ class Board {
52202
52203
  });
52203
52204
  }
52204
52205
  applyItemOperation(op) {
52205
- this.findItemAndApply(op.item, (item) => {
52206
- item.apply(op);
52207
- });
52206
+ if ("item" in op) {
52207
+ this.findItemAndApply(op.item, (item) => {
52208
+ item.apply(op);
52209
+ });
52210
+ }
52208
52211
  }
52209
52212
  findItemAndApply(item, apply) {
52210
52213
  if (Array.isArray(item)) {
package/dist/cjs/node.js CHANGED
@@ -54615,14 +54615,15 @@ class Board {
54615
54615
  }
54616
54616
  applyAddItems(op) {
54617
54617
  if (Array.isArray(op.item)) {
54618
+ const data = op.data;
54618
54619
  const items = op.item.map((item2) => {
54619
- const created = this.createItem(item2, op.data[item2]);
54620
+ const created = this.createItem(item2, data[item2]);
54620
54621
  this.index.insert(created);
54621
54622
  return created;
54622
54623
  });
54623
54624
  items.forEach((item2) => {
54624
- if (item2.itemType === "Connector" && op.data[item2.getId()]) {
54625
- const connectorData = op.data[item2.getId()];
54625
+ if (item2 instanceof Connector2 && data[item2.getId()]) {
54626
+ const connectorData = data[item2.getId()];
54626
54627
  item2.applyStartPoint(connectorData.startPoint);
54627
54628
  item2.applyEndPoint(connectorData.endPoint);
54628
54629
  }
@@ -54651,7 +54652,7 @@ class Board {
54651
54652
  this.findItemAndApply(op.item, (item) => {
54652
54653
  this.index.remove(item);
54653
54654
  this.selection.remove(item);
54654
- if (item.itemType === "Connector") {
54655
+ if (item instanceof Connector2) {
54655
54656
  item.clearObservedItems();
54656
54657
  }
54657
54658
  removedItems.push(item);
@@ -54659,7 +54660,7 @@ class Board {
54659
54660
  }
54660
54661
  applyRemoveLockedGroupOperation(op) {
54661
54662
  const item = this.index.getById(op.item[0]);
54662
- if (!item || item.itemType !== "Group") {
54663
+ if (!item || !(item instanceof Group)) {
54663
54664
  return;
54664
54665
  }
54665
54666
  item.getChildren().forEach((item2) => {
@@ -54675,9 +54676,11 @@ class Board {
54675
54676
  });
54676
54677
  }
54677
54678
  applyItemOperation(op) {
54678
- this.findItemAndApply(op.item, (item) => {
54679
- item.apply(op);
54680
- });
54679
+ if ("item" in op) {
54680
+ this.findItemAndApply(op.item, (item) => {
54681
+ item.apply(op);
54682
+ });
54683
+ }
54681
54684
  }
54682
54685
  findItemAndApply(item, apply) {
54683
54686
  if (Array.isArray(item)) {
@@ -57954,7 +57957,19 @@ class Path2DFactory {
57954
57957
 
57955
57958
  // src/api/NodePath2DFactory.ts
57956
57959
  class NodePath2D extends Path2DFactory {
57957
- nativePath = {};
57960
+ nativePath = {
57961
+ addPath: () => {},
57962
+ arc: () => {},
57963
+ arcTo: () => {},
57964
+ bezierCurveTo: () => {},
57965
+ closePath: () => {},
57966
+ ellipse: () => {},
57967
+ lineTo: () => {},
57968
+ moveTo: () => {},
57969
+ quadraticCurveTo: () => {},
57970
+ rect: () => {},
57971
+ roundRect: () => {}
57972
+ };
57958
57973
  constructor(d) {
57959
57974
  super();
57960
57975
  }
@@ -51990,14 +51990,15 @@ class Board {
51990
51990
  }
51991
51991
  applyAddItems(op) {
51992
51992
  if (Array.isArray(op.item)) {
51993
+ const data = op.data;
51993
51994
  const items = op.item.map((item2) => {
51994
- const created = this.createItem(item2, op.data[item2]);
51995
+ const created = this.createItem(item2, data[item2]);
51995
51996
  this.index.insert(created);
51996
51997
  return created;
51997
51998
  });
51998
51999
  items.forEach((item2) => {
51999
- if (item2.itemType === "Connector" && op.data[item2.getId()]) {
52000
- const connectorData = op.data[item2.getId()];
52000
+ if (item2 instanceof Connector2 && data[item2.getId()]) {
52001
+ const connectorData = data[item2.getId()];
52001
52002
  item2.applyStartPoint(connectorData.startPoint);
52002
52003
  item2.applyEndPoint(connectorData.endPoint);
52003
52004
  }
@@ -52026,7 +52027,7 @@ class Board {
52026
52027
  this.findItemAndApply(op.item, (item) => {
52027
52028
  this.index.remove(item);
52028
52029
  this.selection.remove(item);
52029
- if (item.itemType === "Connector") {
52030
+ if (item instanceof Connector2) {
52030
52031
  item.clearObservedItems();
52031
52032
  }
52032
52033
  removedItems.push(item);
@@ -52034,7 +52035,7 @@ class Board {
52034
52035
  }
52035
52036
  applyRemoveLockedGroupOperation(op) {
52036
52037
  const item = this.index.getById(op.item[0]);
52037
- if (!item || item.itemType !== "Group") {
52038
+ if (!item || !(item instanceof Group)) {
52038
52039
  return;
52039
52040
  }
52040
52041
  item.getChildren().forEach((item2) => {
@@ -52050,9 +52051,11 @@ class Board {
52050
52051
  });
52051
52052
  }
52052
52053
  applyItemOperation(op) {
52053
- this.findItemAndApply(op.item, (item) => {
52054
- item.apply(op);
52055
- });
52054
+ if ("item" in op) {
52055
+ this.findItemAndApply(op.item, (item) => {
52056
+ item.apply(op);
52057
+ });
52058
+ }
52056
52059
  }
52057
52060
  findItemAndApply(item, apply) {
52058
52061
  if (Array.isArray(item)) {
package/dist/esm/index.js CHANGED
@@ -51983,14 +51983,15 @@ class Board {
51983
51983
  }
51984
51984
  applyAddItems(op) {
51985
51985
  if (Array.isArray(op.item)) {
51986
+ const data = op.data;
51986
51987
  const items = op.item.map((item2) => {
51987
- const created = this.createItem(item2, op.data[item2]);
51988
+ const created = this.createItem(item2, data[item2]);
51988
51989
  this.index.insert(created);
51989
51990
  return created;
51990
51991
  });
51991
51992
  items.forEach((item2) => {
51992
- if (item2.itemType === "Connector" && op.data[item2.getId()]) {
51993
- const connectorData = op.data[item2.getId()];
51993
+ if (item2 instanceof Connector2 && data[item2.getId()]) {
51994
+ const connectorData = data[item2.getId()];
51994
51995
  item2.applyStartPoint(connectorData.startPoint);
51995
51996
  item2.applyEndPoint(connectorData.endPoint);
51996
51997
  }
@@ -52019,7 +52020,7 @@ class Board {
52019
52020
  this.findItemAndApply(op.item, (item) => {
52020
52021
  this.index.remove(item);
52021
52022
  this.selection.remove(item);
52022
- if (item.itemType === "Connector") {
52023
+ if (item instanceof Connector2) {
52023
52024
  item.clearObservedItems();
52024
52025
  }
52025
52026
  removedItems.push(item);
@@ -52027,7 +52028,7 @@ class Board {
52027
52028
  }
52028
52029
  applyRemoveLockedGroupOperation(op) {
52029
52030
  const item = this.index.getById(op.item[0]);
52030
- if (!item || item.itemType !== "Group") {
52031
+ if (!item || !(item instanceof Group)) {
52031
52032
  return;
52032
52033
  }
52033
52034
  item.getChildren().forEach((item2) => {
@@ -52043,9 +52044,11 @@ class Board {
52043
52044
  });
52044
52045
  }
52045
52046
  applyItemOperation(op) {
52046
- this.findItemAndApply(op.item, (item) => {
52047
- item.apply(op);
52048
- });
52047
+ if ("item" in op) {
52048
+ this.findItemAndApply(op.item, (item) => {
52049
+ item.apply(op);
52050
+ });
52051
+ }
52049
52052
  }
52050
52053
  findItemAndApply(item, apply) {
52051
52054
  if (Array.isArray(item)) {
package/dist/esm/node.js CHANGED
@@ -54451,14 +54451,15 @@ class Board {
54451
54451
  }
54452
54452
  applyAddItems(op) {
54453
54453
  if (Array.isArray(op.item)) {
54454
+ const data = op.data;
54454
54455
  const items = op.item.map((item2) => {
54455
- const created = this.createItem(item2, op.data[item2]);
54456
+ const created = this.createItem(item2, data[item2]);
54456
54457
  this.index.insert(created);
54457
54458
  return created;
54458
54459
  });
54459
54460
  items.forEach((item2) => {
54460
- if (item2.itemType === "Connector" && op.data[item2.getId()]) {
54461
- const connectorData = op.data[item2.getId()];
54461
+ if (item2 instanceof Connector2 && data[item2.getId()]) {
54462
+ const connectorData = data[item2.getId()];
54462
54463
  item2.applyStartPoint(connectorData.startPoint);
54463
54464
  item2.applyEndPoint(connectorData.endPoint);
54464
54465
  }
@@ -54487,7 +54488,7 @@ class Board {
54487
54488
  this.findItemAndApply(op.item, (item) => {
54488
54489
  this.index.remove(item);
54489
54490
  this.selection.remove(item);
54490
- if (item.itemType === "Connector") {
54491
+ if (item instanceof Connector2) {
54491
54492
  item.clearObservedItems();
54492
54493
  }
54493
54494
  removedItems.push(item);
@@ -54495,7 +54496,7 @@ class Board {
54495
54496
  }
54496
54497
  applyRemoveLockedGroupOperation(op) {
54497
54498
  const item = this.index.getById(op.item[0]);
54498
- if (!item || item.itemType !== "Group") {
54499
+ if (!item || !(item instanceof Group)) {
54499
54500
  return;
54500
54501
  }
54501
54502
  item.getChildren().forEach((item2) => {
@@ -54511,9 +54512,11 @@ class Board {
54511
54512
  });
54512
54513
  }
54513
54514
  applyItemOperation(op) {
54514
- this.findItemAndApply(op.item, (item) => {
54515
- item.apply(op);
54516
- });
54515
+ if ("item" in op) {
54516
+ this.findItemAndApply(op.item, (item) => {
54517
+ item.apply(op);
54518
+ });
54519
+ }
54517
54520
  }
54518
54521
  findItemAndApply(item, apply) {
54519
54522
  if (Array.isArray(item)) {
@@ -57790,7 +57793,19 @@ class Path2DFactory {
57790
57793
 
57791
57794
  // src/api/NodePath2DFactory.ts
57792
57795
  class NodePath2D extends Path2DFactory {
57793
- nativePath = {};
57796
+ nativePath = {
57797
+ addPath: () => {},
57798
+ arc: () => {},
57799
+ arcTo: () => {},
57800
+ bezierCurveTo: () => {},
57801
+ closePath: () => {},
57802
+ ellipse: () => {},
57803
+ lineTo: () => {},
57804
+ moveTo: () => {},
57805
+ quadraticCurveTo: () => {},
57806
+ rect: () => {},
57807
+ roundRect: () => {}
57808
+ };
57794
57809
  constructor(d) {
57795
57810
  super();
57796
57811
  }
@@ -10,7 +10,7 @@ interface SingleItemBoardOp extends BoardOp {
10
10
  interface MultiItemBoardOp extends BoardOp {
11
11
  item: string[];
12
12
  }
13
- type DataMap = {
13
+ export type DataMap = {
14
14
  [key: string]: ItemData;
15
15
  };
16
16
  interface ItemMapBoardOp extends BoardOp {
@@ -20,7 +20,7 @@ export declare class BaseItem extends Mbr implements Geometry {
20
20
  private defaultItemData?;
21
21
  readonly transformation: Transformation;
22
22
  readonly linkTo: LinkTo;
23
- readonly parent: string;
23
+ parent: string;
24
24
  transformationRenderBlock?: boolean;
25
25
  board: Board;
26
26
  id: string;
@@ -1,6 +1,18 @@
1
1
  import { Path2DFactory } from './Path2DFactory';
2
2
  export declare class NodePath2D extends Path2DFactory {
3
- nativePath: {};
3
+ nativePath: {
4
+ addPath: () => void;
5
+ arc: () => void;
6
+ arcTo: () => void;
7
+ bezierCurveTo: () => void;
8
+ closePath: () => void;
9
+ ellipse: () => void;
10
+ lineTo: () => void;
11
+ moveTo: () => void;
12
+ quadraticCurveTo: () => void;
13
+ rect: () => void;
14
+ roundRect: () => void;
15
+ };
4
16
  constructor(d?: string);
5
17
  addPath(path: Path2DFactory, transform?: DOMMatrix2DInit): void;
6
18
  arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",