microboard-temp 0.3.0 → 0.3.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.
@@ -52474,7 +52474,7 @@ class Board {
52474
52474
  const created = this.createItem(this.getNewItemId(), childData);
52475
52475
  const added = this.add(created);
52476
52476
  idsMap[childData.id] = added.getId();
52477
- if (added.itemType === "Connector") {
52477
+ if (added instanceof Connector2) {
52478
52478
  addedConnectors.push({
52479
52479
  item: added,
52480
52480
  data: childData
@@ -52487,7 +52487,7 @@ class Board {
52487
52487
  idsMap[parsedData.data.id] = addedFrame.getId();
52488
52488
  } else {
52489
52489
  const added = this.add(this.createItem(this.getNewItemId(), parsedData));
52490
- if (added.itemType === "Connector") {
52490
+ if (added instanceof Connector2) {
52491
52491
  addedConnectors.push({
52492
52492
  item: added,
52493
52493
  data: parsedData
@@ -52525,10 +52525,10 @@ class Board {
52525
52525
  const createdFrames = {};
52526
52526
  const addItem = (itemData) => {
52527
52527
  const item = this.createItem(itemData.id, itemData);
52528
- if (item.itemType === "Connector") {
52528
+ if (item instanceof Connector2) {
52529
52529
  createdConnectors[itemData.id] = { item, itemData };
52530
52530
  }
52531
- if (item.itemType === "Frame") {
52531
+ if (item instanceof Frame) {
52532
52532
  createdFrames[item.getId()] = { item, itemData };
52533
52533
  }
52534
52534
  this.index.insert(item);
@@ -52560,10 +52560,10 @@ class Board {
52560
52560
  if (Array.isArray(items)) {
52561
52561
  for (const itemData of items) {
52562
52562
  const item = this.createItem(itemData.id, itemData);
52563
- if (item.itemType === "Connector") {
52563
+ if (item instanceof Connector2) {
52564
52564
  createdConnectors[itemData.id] = { item, itemData };
52565
52565
  }
52566
- if (item.itemType === "Frame") {
52566
+ if (item instanceof Frame) {
52567
52567
  createdFrames[item.getId()] = { item, itemData };
52568
52568
  }
52569
52569
  this.index.insert(item);
@@ -52572,7 +52572,7 @@ class Board {
52572
52572
  for (const key in items) {
52573
52573
  const itemData = items[key];
52574
52574
  const item = this.createItem(key, itemData);
52575
- if (item.itemType === "Connector") {
52575
+ if (item instanceof Connector2) {
52576
52576
  createdConnectors[key] = { item, itemData };
52577
52577
  }
52578
52578
  this.index.insert(item);
package/dist/cjs/index.js CHANGED
@@ -52474,7 +52474,7 @@ class Board {
52474
52474
  const created = this.createItem(this.getNewItemId(), childData);
52475
52475
  const added = this.add(created);
52476
52476
  idsMap[childData.id] = added.getId();
52477
- if (added.itemType === "Connector") {
52477
+ if (added instanceof Connector2) {
52478
52478
  addedConnectors.push({
52479
52479
  item: added,
52480
52480
  data: childData
@@ -52487,7 +52487,7 @@ class Board {
52487
52487
  idsMap[parsedData.data.id] = addedFrame.getId();
52488
52488
  } else {
52489
52489
  const added = this.add(this.createItem(this.getNewItemId(), parsedData));
52490
- if (added.itemType === "Connector") {
52490
+ if (added instanceof Connector2) {
52491
52491
  addedConnectors.push({
52492
52492
  item: added,
52493
52493
  data: parsedData
@@ -52525,10 +52525,10 @@ class Board {
52525
52525
  const createdFrames = {};
52526
52526
  const addItem = (itemData) => {
52527
52527
  const item = this.createItem(itemData.id, itemData);
52528
- if (item.itemType === "Connector") {
52528
+ if (item instanceof Connector2) {
52529
52529
  createdConnectors[itemData.id] = { item, itemData };
52530
52530
  }
52531
- if (item.itemType === "Frame") {
52531
+ if (item instanceof Frame) {
52532
52532
  createdFrames[item.getId()] = { item, itemData };
52533
52533
  }
52534
52534
  this.index.insert(item);
@@ -52560,10 +52560,10 @@ class Board {
52560
52560
  if (Array.isArray(items)) {
52561
52561
  for (const itemData of items) {
52562
52562
  const item = this.createItem(itemData.id, itemData);
52563
- if (item.itemType === "Connector") {
52563
+ if (item instanceof Connector2) {
52564
52564
  createdConnectors[itemData.id] = { item, itemData };
52565
52565
  }
52566
- if (item.itemType === "Frame") {
52566
+ if (item instanceof Frame) {
52567
52567
  createdFrames[item.getId()] = { item, itemData };
52568
52568
  }
52569
52569
  this.index.insert(item);
@@ -52572,7 +52572,7 @@ class Board {
52572
52572
  for (const key in items) {
52573
52573
  const itemData = items[key];
52574
52574
  const item = this.createItem(key, itemData);
52575
- if (item.itemType === "Connector") {
52575
+ if (item instanceof Connector2) {
52576
52576
  createdConnectors[key] = { item, itemData };
52577
52577
  }
52578
52578
  this.index.insert(item);
package/dist/cjs/node.js CHANGED
@@ -54947,7 +54947,7 @@ class Board {
54947
54947
  const created = this.createItem(this.getNewItemId(), childData);
54948
54948
  const added = this.add(created);
54949
54949
  idsMap[childData.id] = added.getId();
54950
- if (added.itemType === "Connector") {
54950
+ if (added instanceof Connector2) {
54951
54951
  addedConnectors.push({
54952
54952
  item: added,
54953
54953
  data: childData
@@ -54960,7 +54960,7 @@ class Board {
54960
54960
  idsMap[parsedData.data.id] = addedFrame.getId();
54961
54961
  } else {
54962
54962
  const added = this.add(this.createItem(this.getNewItemId(), parsedData));
54963
- if (added.itemType === "Connector") {
54963
+ if (added instanceof Connector2) {
54964
54964
  addedConnectors.push({
54965
54965
  item: added,
54966
54966
  data: parsedData
@@ -54998,10 +54998,10 @@ class Board {
54998
54998
  const createdFrames = {};
54999
54999
  const addItem = (itemData) => {
55000
55000
  const item = this.createItem(itemData.id, itemData);
55001
- if (item.itemType === "Connector") {
55001
+ if (item instanceof Connector2) {
55002
55002
  createdConnectors[itemData.id] = { item, itemData };
55003
55003
  }
55004
- if (item.itemType === "Frame") {
55004
+ if (item instanceof Frame) {
55005
55005
  createdFrames[item.getId()] = { item, itemData };
55006
55006
  }
55007
55007
  this.index.insert(item);
@@ -55033,10 +55033,10 @@ class Board {
55033
55033
  if (Array.isArray(items)) {
55034
55034
  for (const itemData of items) {
55035
55035
  const item = this.createItem(itemData.id, itemData);
55036
- if (item.itemType === "Connector") {
55036
+ if (item instanceof Connector2) {
55037
55037
  createdConnectors[itemData.id] = { item, itemData };
55038
55038
  }
55039
- if (item.itemType === "Frame") {
55039
+ if (item instanceof Frame) {
55040
55040
  createdFrames[item.getId()] = { item, itemData };
55041
55041
  }
55042
55042
  this.index.insert(item);
@@ -55045,7 +55045,7 @@ class Board {
55045
55045
  for (const key in items) {
55046
55046
  const itemData = items[key];
55047
55047
  const item = this.createItem(key, itemData);
55048
- if (item.itemType === "Connector") {
55048
+ if (item instanceof Connector2) {
55049
55049
  createdConnectors[key] = { item, itemData };
55050
55050
  }
55051
55051
  this.index.insert(item);
@@ -52322,7 +52322,7 @@ class Board {
52322
52322
  const created = this.createItem(this.getNewItemId(), childData);
52323
52323
  const added = this.add(created);
52324
52324
  idsMap[childData.id] = added.getId();
52325
- if (added.itemType === "Connector") {
52325
+ if (added instanceof Connector2) {
52326
52326
  addedConnectors.push({
52327
52327
  item: added,
52328
52328
  data: childData
@@ -52335,7 +52335,7 @@ class Board {
52335
52335
  idsMap[parsedData.data.id] = addedFrame.getId();
52336
52336
  } else {
52337
52337
  const added = this.add(this.createItem(this.getNewItemId(), parsedData));
52338
- if (added.itemType === "Connector") {
52338
+ if (added instanceof Connector2) {
52339
52339
  addedConnectors.push({
52340
52340
  item: added,
52341
52341
  data: parsedData
@@ -52373,10 +52373,10 @@ class Board {
52373
52373
  const createdFrames = {};
52374
52374
  const addItem = (itemData) => {
52375
52375
  const item = this.createItem(itemData.id, itemData);
52376
- if (item.itemType === "Connector") {
52376
+ if (item instanceof Connector2) {
52377
52377
  createdConnectors[itemData.id] = { item, itemData };
52378
52378
  }
52379
- if (item.itemType === "Frame") {
52379
+ if (item instanceof Frame) {
52380
52380
  createdFrames[item.getId()] = { item, itemData };
52381
52381
  }
52382
52382
  this.index.insert(item);
@@ -52408,10 +52408,10 @@ class Board {
52408
52408
  if (Array.isArray(items)) {
52409
52409
  for (const itemData of items) {
52410
52410
  const item = this.createItem(itemData.id, itemData);
52411
- if (item.itemType === "Connector") {
52411
+ if (item instanceof Connector2) {
52412
52412
  createdConnectors[itemData.id] = { item, itemData };
52413
52413
  }
52414
- if (item.itemType === "Frame") {
52414
+ if (item instanceof Frame) {
52415
52415
  createdFrames[item.getId()] = { item, itemData };
52416
52416
  }
52417
52417
  this.index.insert(item);
@@ -52420,7 +52420,7 @@ class Board {
52420
52420
  for (const key in items) {
52421
52421
  const itemData = items[key];
52422
52422
  const item = this.createItem(key, itemData);
52423
- if (item.itemType === "Connector") {
52423
+ if (item instanceof Connector2) {
52424
52424
  createdConnectors[key] = { item, itemData };
52425
52425
  }
52426
52426
  this.index.insert(item);
package/dist/esm/index.js CHANGED
@@ -52315,7 +52315,7 @@ class Board {
52315
52315
  const created = this.createItem(this.getNewItemId(), childData);
52316
52316
  const added = this.add(created);
52317
52317
  idsMap[childData.id] = added.getId();
52318
- if (added.itemType === "Connector") {
52318
+ if (added instanceof Connector2) {
52319
52319
  addedConnectors.push({
52320
52320
  item: added,
52321
52321
  data: childData
@@ -52328,7 +52328,7 @@ class Board {
52328
52328
  idsMap[parsedData.data.id] = addedFrame.getId();
52329
52329
  } else {
52330
52330
  const added = this.add(this.createItem(this.getNewItemId(), parsedData));
52331
- if (added.itemType === "Connector") {
52331
+ if (added instanceof Connector2) {
52332
52332
  addedConnectors.push({
52333
52333
  item: added,
52334
52334
  data: parsedData
@@ -52366,10 +52366,10 @@ class Board {
52366
52366
  const createdFrames = {};
52367
52367
  const addItem = (itemData) => {
52368
52368
  const item = this.createItem(itemData.id, itemData);
52369
- if (item.itemType === "Connector") {
52369
+ if (item instanceof Connector2) {
52370
52370
  createdConnectors[itemData.id] = { item, itemData };
52371
52371
  }
52372
- if (item.itemType === "Frame") {
52372
+ if (item instanceof Frame) {
52373
52373
  createdFrames[item.getId()] = { item, itemData };
52374
52374
  }
52375
52375
  this.index.insert(item);
@@ -52401,10 +52401,10 @@ class Board {
52401
52401
  if (Array.isArray(items)) {
52402
52402
  for (const itemData of items) {
52403
52403
  const item = this.createItem(itemData.id, itemData);
52404
- if (item.itemType === "Connector") {
52404
+ if (item instanceof Connector2) {
52405
52405
  createdConnectors[itemData.id] = { item, itemData };
52406
52406
  }
52407
- if (item.itemType === "Frame") {
52407
+ if (item instanceof Frame) {
52408
52408
  createdFrames[item.getId()] = { item, itemData };
52409
52409
  }
52410
52410
  this.index.insert(item);
@@ -52413,7 +52413,7 @@ class Board {
52413
52413
  for (const key in items) {
52414
52414
  const itemData = items[key];
52415
52415
  const item = this.createItem(key, itemData);
52416
- if (item.itemType === "Connector") {
52416
+ if (item instanceof Connector2) {
52417
52417
  createdConnectors[key] = { item, itemData };
52418
52418
  }
52419
52419
  this.index.insert(item);
package/dist/esm/node.js CHANGED
@@ -54783,7 +54783,7 @@ class Board {
54783
54783
  const created = this.createItem(this.getNewItemId(), childData);
54784
54784
  const added = this.add(created);
54785
54785
  idsMap[childData.id] = added.getId();
54786
- if (added.itemType === "Connector") {
54786
+ if (added instanceof Connector2) {
54787
54787
  addedConnectors.push({
54788
54788
  item: added,
54789
54789
  data: childData
@@ -54796,7 +54796,7 @@ class Board {
54796
54796
  idsMap[parsedData.data.id] = addedFrame.getId();
54797
54797
  } else {
54798
54798
  const added = this.add(this.createItem(this.getNewItemId(), parsedData));
54799
- if (added.itemType === "Connector") {
54799
+ if (added instanceof Connector2) {
54800
54800
  addedConnectors.push({
54801
54801
  item: added,
54802
54802
  data: parsedData
@@ -54834,10 +54834,10 @@ class Board {
54834
54834
  const createdFrames = {};
54835
54835
  const addItem = (itemData) => {
54836
54836
  const item = this.createItem(itemData.id, itemData);
54837
- if (item.itemType === "Connector") {
54837
+ if (item instanceof Connector2) {
54838
54838
  createdConnectors[itemData.id] = { item, itemData };
54839
54839
  }
54840
- if (item.itemType === "Frame") {
54840
+ if (item instanceof Frame) {
54841
54841
  createdFrames[item.getId()] = { item, itemData };
54842
54842
  }
54843
54843
  this.index.insert(item);
@@ -54869,10 +54869,10 @@ class Board {
54869
54869
  if (Array.isArray(items)) {
54870
54870
  for (const itemData of items) {
54871
54871
  const item = this.createItem(itemData.id, itemData);
54872
- if (item.itemType === "Connector") {
54872
+ if (item instanceof Connector2) {
54873
54873
  createdConnectors[itemData.id] = { item, itemData };
54874
54874
  }
54875
- if (item.itemType === "Frame") {
54875
+ if (item instanceof Frame) {
54876
54876
  createdFrames[item.getId()] = { item, itemData };
54877
54877
  }
54878
54878
  this.index.insert(item);
@@ -54881,7 +54881,7 @@ class Board {
54881
54881
  for (const key in items) {
54882
54882
  const itemData = items[key];
54883
54883
  const item = this.createItem(key, itemData);
54884
- if (item.itemType === "Connector") {
54884
+ if (item instanceof Connector2) {
54885
54885
  createdConnectors[key] = { item, itemData };
54886
54886
  }
54887
54887
  this.index.insert(item);
@@ -15,6 +15,7 @@ import { Subject } from "Subject";
15
15
  import { Tools } from "Tools";
16
16
  import { ItemsMap } from "Validators";
17
17
  import { BoardSelection } from "Selection";
18
+ import { ItemDataWithId } from "./Items/Item";
18
19
  export type InterfaceType = "edit" | "view" | "loading";
19
20
  export declare class Board {
20
21
  private boardId;
@@ -64,10 +65,10 @@ export declare class Board {
64
65
  */
65
66
  handleNesting(items: Item | Item[]): void;
66
67
  createItem(id: string, data: ItemData): Item;
67
- parseHTML(el: HTMLElement): ItemData | {
68
+ parseHTML(el: HTMLElement): ItemDataWithId | {
68
69
  data: FrameData;
69
70
  childrenMap: {
70
- [id: string]: ItemData;
71
+ [id: string]: ItemDataWithId;
71
72
  };
72
73
  };
73
74
  add<T extends Item>(item: T, timeStamp?: number): T;
@@ -83,8 +84,8 @@ export declare class Board {
83
84
  moveSecondAfterFirst(first: Item, second: Item): void;
84
85
  bringToFront(items: Item | Item[]): void;
85
86
  sendToBack(items: Item | Item[]): void;
86
- copy(): ItemData[];
87
- serialize(): ItemData[];
87
+ copy(): ItemDataWithId[];
88
+ serialize(): ItemDataWithId[];
88
89
  serializeHTML(): string;
89
90
  /** @returns ids of added items */
90
91
  deserializeHTMLAndEmit(stringedHTML: string): string[];
@@ -16,3 +16,6 @@ import { BaseItem, SerializedItemData } from "Items/BaseItem/BaseItem";
16
16
  export type Item = RichText | Shape | Connector | ImageItem | Drawing | Sticker | Frame | Placeholder | Comment | Group | AINode | VideoItem | AudioItem | BaseItem;
17
17
  export type ItemType = Item["itemType"];
18
18
  export type ItemData = ShapeData | RichTextData | ConnectorData | ImageItemData | DrawingData | StickerData | FrameData | PlaceholderData | CommentData | GroupData | AINodeData | VideoItemData | AudioItemData | SerializedItemData;
19
+ export type ItemDataWithId = ItemData & {
20
+ id: string;
21
+ };
@@ -1,11 +1,12 @@
1
1
  import { DocumentFactory } from 'api/DocumentFactory';
2
2
  import { ItemsIndexRecord } from 'BoardOperations';
3
3
  import { Camera } from 'Camera';
4
- import { Item, Frame, Mbr, ItemData, Point, Connector } from 'Items';
4
+ import { Item, Frame, Mbr, Point, Connector } from 'Items';
5
5
  import { DrawingContext } from 'Items/DrawingContext';
6
6
  import { Pointer } from 'Pointer';
7
7
  import { Subject } from 'Subject';
8
8
  import { BaseItem } from "../Items/BaseItem";
9
+ import { ItemDataWithId } from "../Items/Item";
9
10
  export type ItemWoFrames = Exclude<Item, Frame>;
10
11
  export declare class SpatialIndex {
11
12
  subject: Subject<Items>;
@@ -20,9 +21,7 @@ export declare class SpatialIndex {
20
21
  insert(item: Item): void;
21
22
  change: (item: Item) => void;
22
23
  remove(item: Item): void;
23
- copy(): (ItemData & {
24
- id: string;
25
- })[];
24
+ copy(): ItemDataWithId[];
26
25
  moveToZIndex(item: Item, zIndex: number): void;
27
26
  moveManyToZIndex(itemsRecord: ItemsIndexRecord): void;
28
27
  sendToBack(item: Item, shouldPublish?: boolean): void;
@@ -1,8 +1,9 @@
1
- import { ItemType, ItemData } from "Items";
1
+ import { ItemType } from "Items";
2
+ import { ItemDataWithId } from "./Items/Item";
2
3
  type MapTagByType = Record<ItemType, string>;
3
4
  export declare const tagByType: MapTagByType;
4
5
  type TagFactories = {
5
- [K in keyof MapTagByType as MapTagByType[K]]: (el: HTMLElement) => ItemData;
6
+ [K in keyof MapTagByType as MapTagByType[K]]: (el: HTMLElement) => ItemDataWithId;
6
7
  };
7
8
  export declare const parsersHTML: TagFactories;
8
9
  export declare const decodeHtml: (htmlString: string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",