microboard-temp 0.13.40 → 0.13.42

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 (140) hide show
  1. package/dist/cjs/browser.js +55017 -51755
  2. package/dist/cjs/index.js +55012 -51755
  3. package/dist/cjs/node.js +56725 -53463
  4. package/dist/esm/browser.js +55493 -52294
  5. package/dist/esm/index.js +55462 -52268
  6. package/dist/esm/node.js +57248 -54055
  7. package/dist/types/Board.d.ts +14 -8
  8. package/dist/types/BoardCommand.d.ts +2 -2
  9. package/dist/types/Camera/Camera.d.ts +4 -1
  10. package/dist/types/Events/BaseCommand.d.ts +17 -0
  11. package/dist/types/Events/Command.d.ts +11 -20
  12. package/dist/types/Events/CreateCommand.d.ts +5 -0
  13. package/dist/types/Events/Events.d.ts +2 -1
  14. package/dist/types/Events/EventsOperations.d.ts +23 -15
  15. package/dist/types/Events/Log/EventsLog.d.ts +4 -3
  16. package/dist/types/Events/Log/createEventsList.d.ts +3 -1
  17. package/dist/types/Events/Log/getSnapshotFromList.d.ts +5 -2
  18. package/dist/types/Events/index.d.ts +2 -1
  19. package/dist/types/Items/AINode/AINode.d.ts +4 -5
  20. package/dist/types/Items/AINode/AINodeData.d.ts +1 -0
  21. package/dist/types/Items/Anchor/Anchor.d.ts +2 -1
  22. package/dist/types/Items/Arc/Arc.d.ts +4 -1
  23. package/dist/types/Items/Audio/Audio.d.ts +6 -5
  24. package/dist/types/Items/BaseItem/BaseItem.d.ts +16 -12
  25. package/dist/types/Items/BaseItem/index.d.ts +1 -0
  26. package/dist/types/Items/Comment/Comment.d.ts +11 -15
  27. package/dist/types/Items/Connector/Connector.d.ts +14 -19
  28. package/dist/types/Items/Connector/ConnectorCommand.d.ts +2 -2
  29. package/dist/types/Items/Connector/ConnectorOperations.d.ts +3 -3
  30. package/dist/types/Items/Connector/ConnectorTypes.d.ts +10 -0
  31. package/dist/types/Items/Connector/Pointers/Pointers.d.ts +21 -4
  32. package/dist/types/Items/Connector/Pointers/index.d.ts +1 -1
  33. package/dist/types/Items/Connector/getLine/getLine.d.ts +1 -1
  34. package/dist/types/Items/Connector/index.d.ts +3 -2
  35. package/dist/types/Items/Curve/Curve.d.ts +9 -10
  36. package/dist/types/Items/Drawing/Drawing.d.ts +10 -8
  37. package/dist/types/Items/Drawing/DrawingCommand.d.ts +2 -2
  38. package/dist/types/Items/Examples/CardGame/Card/Card.d.ts +11 -8
  39. package/dist/types/Items/Examples/CardGame/Dice/Dice.d.ts +16 -8
  40. package/dist/types/Items/Examples/CardGame/Screen/Screen.d.ts +10 -4
  41. package/dist/types/Items/Frame/Frame.d.ts +12 -4
  42. package/dist/types/Items/Frame/FrameData.d.ts +5 -3
  43. package/dist/types/Items/Frame/FrameOperation.d.ts +13 -1
  44. package/dist/types/Items/Geometry.d.ts +1 -1
  45. package/dist/types/Items/Group/Group.d.ts +11 -6
  46. package/dist/types/Items/Image/Image.d.ts +8 -6
  47. package/dist/types/Items/Item.d.ts +15 -15
  48. package/dist/types/Items/Line/Line.d.ts +1 -1
  49. package/dist/types/Items/Mbr/Mbr.d.ts +5 -5
  50. package/dist/types/Items/Mbr/updateRects.d.ts +1 -2
  51. package/dist/types/Items/Path/Path.d.ts +1 -0
  52. package/dist/types/Items/Path/Paths.d.ts +2 -0
  53. package/dist/types/Items/Placeholder/Placeholder.d.ts +16 -10
  54. package/dist/types/Items/Point/Point.d.ts +1 -1
  55. package/dist/types/Items/RegisterItem.d.ts +4 -2
  56. package/dist/types/Items/RichText/CanvasText/Render.d.ts +1 -1
  57. package/dist/types/Items/RichText/Editor/BlockNode.d.ts +10 -3
  58. package/dist/types/Items/RichText/EditorContainer.d.ts +5 -6
  59. package/dist/types/Items/RichText/RichText.d.ts +13 -7
  60. package/dist/types/Items/RichText/RichTextCommand.d.ts +2 -2
  61. package/dist/types/Items/RichText/RichTextData.d.ts +2 -0
  62. package/dist/types/Items/RichText/RichTextOperations.d.ts +4 -3
  63. package/dist/types/Items/RichText/editorHelpers/common/getAreAllChildrenEmpty.d.ts +1 -1
  64. package/dist/types/Items/RichText/editorHelpers/lists/getBlockParentList.d.ts +2 -2
  65. package/dist/types/Items/RichText/setNodeStyles.d.ts +2 -5
  66. package/dist/types/Items/Shape/BPMN/BPMN_Annotation/index.d.ts +2 -1
  67. package/dist/types/Items/Shape/BPMN/BPMN_DataObject/index.d.ts +3 -1
  68. package/dist/types/Items/Shape/BPMN/BPMN_DataStore/index.d.ts +3 -1
  69. package/dist/types/Items/Shape/BPMN/BPMN_EndEvent/index.d.ts +3 -1
  70. package/dist/types/Items/Shape/BPMN/BPMN_EventSubprocess/index.d.ts +3 -1
  71. package/dist/types/Items/Shape/BPMN/BPMN_Gateway/index.d.ts +3 -1
  72. package/dist/types/Items/Shape/BPMN/BPMN_GatewayParallel/index.d.ts +3 -1
  73. package/dist/types/Items/Shape/BPMN/BPMN_GatewayXOR/index.d.ts +3 -1
  74. package/dist/types/Items/Shape/BPMN/BPMN_Group/index.d.ts +3 -1
  75. package/dist/types/Items/Shape/BPMN/BPMN_IntermediateEvent/index.d.ts +3 -1
  76. package/dist/types/Items/Shape/BPMN/BPMN_IntermediateEventNoneInterrupting/index.d.ts +3 -1
  77. package/dist/types/Items/Shape/BPMN/BPMN_Participant/index.d.ts +3 -1
  78. package/dist/types/Items/Shape/BPMN/BPMN_StartEvent/index.d.ts +3 -1
  79. package/dist/types/Items/Shape/BPMN/BPMN_StartEventNoneInterrupting/index.d.ts +3 -1
  80. package/dist/types/Items/Shape/BPMN/BPMN_Task/index.d.ts +3 -1
  81. package/dist/types/Items/Shape/BPMN/BPMN_Transaction/index.d.ts +3 -1
  82. package/dist/types/Items/Shape/Basic/ArrowBlockLeft/index.d.ts +3 -1
  83. package/dist/types/Items/Shape/Basic/ArrowBlockRigth/index.d.ts +3 -1
  84. package/dist/types/Items/Shape/Basic/ArrowLeft/index.d.ts +3 -1
  85. package/dist/types/Items/Shape/Basic/ArrowLeftRight/index.d.ts +3 -1
  86. package/dist/types/Items/Shape/Basic/ArrowRight/index.d.ts +3 -1
  87. package/dist/types/Items/Shape/Basic/BracesLeft/index.d.ts +2 -1
  88. package/dist/types/Items/Shape/Basic/BracesRight/index.d.ts +2 -1
  89. package/dist/types/Items/Shape/Basic/Circle/index.d.ts +3 -1
  90. package/dist/types/Items/Shape/Basic/Cloud/index.d.ts +3 -1
  91. package/dist/types/Items/Shape/Basic/Cross/index.d.ts +3 -1
  92. package/dist/types/Items/Shape/Basic/Cylinder/index.d.ts +3 -1
  93. package/dist/types/Items/Shape/Basic/Hexagon/index.d.ts +3 -1
  94. package/dist/types/Items/Shape/Basic/Octagon/index.d.ts +3 -1
  95. package/dist/types/Items/Shape/Basic/Parallelogram/index.d.ts +3 -1
  96. package/dist/types/Items/Shape/Basic/Pentagon/index.d.ts +3 -1
  97. package/dist/types/Items/Shape/Basic/PredefinedProcess/index.d.ts +3 -1
  98. package/dist/types/Items/Shape/Basic/Rectangle/index.d.ts +3 -1
  99. package/dist/types/Items/Shape/Basic/ReversedParallelogram/index.d.ts +3 -1
  100. package/dist/types/Items/Shape/Basic/ReversedTriangle/index.d.ts +3 -1
  101. package/dist/types/Items/Shape/Basic/Rhombus/index.d.ts +3 -1
  102. package/dist/types/Items/Shape/Basic/RoundedRectangle/index.d.ts +3 -1
  103. package/dist/types/Items/Shape/Basic/SpeachBubble/index.d.ts +3 -1
  104. package/dist/types/Items/Shape/Basic/Star/index.d.ts +3 -1
  105. package/dist/types/Items/Shape/Basic/Trapezoid/index.d.ts +3 -1
  106. package/dist/types/Items/Shape/Basic/Triangle/index.d.ts +3 -1
  107. package/dist/types/Items/Shape/Shape.d.ts +9 -3
  108. package/dist/types/Items/Shape/ShapeCommand.d.ts +2 -2
  109. package/dist/types/Items/Shape/ShapeData.d.ts +2 -0
  110. package/dist/types/Items/Shape/ShapeOperation.d.ts +1 -1
  111. package/dist/types/Items/Shape/ShapeType.d.ts +3 -0
  112. package/dist/types/Items/Shape/index.d.ts +1 -3
  113. package/dist/types/Items/Sticker/Sticker.d.ts +8 -6
  114. package/dist/types/Items/Sticker/StickerOperation.d.ts +3 -3
  115. package/dist/types/Items/Transformation/Matrix.d.ts +1 -1
  116. package/dist/types/Items/Transformation/TransformationCommand.d.ts +1 -1
  117. package/dist/types/Items/Video/Video.d.ts +8 -7
  118. package/dist/types/Items/index.d.ts +2 -1
  119. package/dist/types/Keyboard/types.d.ts +2 -1
  120. package/dist/types/Selection/Selection.d.ts +15 -12
  121. package/dist/types/Selection/Transformer/TextTransformer/getTextResizeType.d.ts +1 -1
  122. package/dist/types/Selection/Transformer/TransformerHelpers/AnchorType.d.ts +1 -1
  123. package/dist/types/Selection/Transformer/TransformerHelpers/getOppositePoint.d.ts +1 -1
  124. package/dist/types/Selection/Transformer/TransformerHelpers/getResizeMatrix.d.ts +1 -1
  125. package/dist/types/Selection/Transformer/TransformerHelpers/getResizedMbr.d.ts +1 -1
  126. package/dist/types/SessionStorage.d.ts +1 -1
  127. package/dist/types/Settings.d.ts +15 -10
  128. package/dist/types/SpatialIndex/SimpleSpatialIndex.d.ts +5 -3
  129. package/dist/types/SpatialIndex/SpacialIndex.d.ts +8 -1
  130. package/dist/types/Tools/AddConnector/AddConnector.d.ts +1 -1
  131. package/dist/types/Tools/AddDrawing/AddDrawing.d.ts +1 -1
  132. package/dist/types/Tools/AddDrawing/AddHighlighter.d.ts +1 -1
  133. package/dist/types/Tools/Tools.d.ts +3 -2
  134. package/dist/types/Validators/Validators.d.ts +4 -3
  135. package/dist/types/api/MockPath2D.d.ts +3 -3
  136. package/dist/types/api/Path2DFactory.d.ts +1 -1
  137. package/dist/types/itemFactories.d.ts +27 -1
  138. package/dist/types/parserHTML.d.ts +10 -3
  139. package/dist/types/sha256.d.ts +1 -1
  140. package/package.json +1 -1
@@ -2,20 +2,24 @@ import { BoardOps, ItemsIndexRecord } from "./BoardOperations";
2
2
  import { Camera } from "./Camera";
3
3
  import { Events, Operation } from "./Events";
4
4
  import { SyncBoardEvent } from "./Events/Events";
5
- import { FrameData, Item, ItemData, Matrix, Mbr } from "./Items";
6
- import { AINode } from "./Items/AINode";
5
+ import { Matrix } from "./Items/Transformation/Matrix";
6
+ import { Mbr } from "./Items/Mbr/Mbr";
7
+ import type { Item, ItemData } from "./Items/Item";
8
+ import type { AINode } from "./Items/AINode";
7
9
  import { DrawingContext } from "./Items/DrawingContext";
8
- import { Group } from "./Items/Group";
9
- import { ImageItem } from "./Items/Image";
10
+ import type { Group } from "./Items/Group";
11
+ import type { ImageItem } from "./Items/Image";
10
12
  import { Keyboard } from "./Keyboard";
11
13
  import { Pointer } from "./Pointer";
12
14
  import { Presence } from "./Presence/Presence";
13
15
  import { BoardSelection } from "./Selection";
16
+ import { Theme } from "./Settings";
14
17
  import { SpatialIndex } from "./SpatialIndex";
15
18
  import { Subject } from "./Subject";
16
19
  import { Tools } from "./Tools";
17
20
  import { ItemsMap } from "./Validators";
18
- import { BaseItem } from "./Items/BaseItem";
21
+ import type { BaseItem } from "./Items/BaseItem";
22
+ import type { BaseItemData } from "./Items/BaseItem/BaseItem";
19
23
  import { ItemDataWithId } from "./Items/Item";
20
24
  import { Account } from "./types/Account";
21
25
  export type InterfaceType = "edit" | "view" | "loading";
@@ -25,7 +29,7 @@ export declare class Board {
25
29
  saveEditingFile?: (() => Promise<void>) | undefined;
26
30
  private account?;
27
31
  events: Events;
28
- private isBoardMenuOpen;
32
+ isBoardMenuOpen: boolean;
29
33
  readonly selection: BoardSelection;
30
34
  readonly tools: Tools;
31
35
  readonly pointer: Pointer;
@@ -50,6 +54,7 @@ export declare class Board {
50
54
  */
51
55
  disconnect(): void;
52
56
  getAccount(): Account | null;
57
+ getTheme(): Theme;
53
58
  getNewItemId(): string;
54
59
  emit(operation: BoardOps): void;
55
60
  getBoardId(): string;
@@ -64,7 +69,6 @@ export declare class Board {
64
69
  private applyAddLockedGroupOperation;
65
70
  private applyAddGroupOperation;
66
71
  private applyRemoveOperation;
67
- private applyRemoveLockedGroupOperation;
68
72
  private applyRemoveGroupOperation;
69
73
  private applyItemOperation;
70
74
  private findItemAndApply;
@@ -73,7 +77,9 @@ export declare class Board {
73
77
  handleNesting(items: Item | Item[]): void;
74
78
  createItem(id: string, data: ItemData): Item;
75
79
  parseHTML(el: HTMLElement): ItemDataWithId | {
76
- data: FrameData;
80
+ data: BaseItemData & {
81
+ id: string;
82
+ };
77
83
  childrenMap: {
78
84
  [id: string]: ItemDataWithId;
79
85
  };
@@ -1,4 +1,4 @@
1
- import { Command } from './Events';
1
+ import { Command, Operation } from './Events';
2
2
  import { BoardOps } from './BoardOperations';
3
3
  import { Board } from './Board';
4
4
  export declare class BoardCommand implements Command {
@@ -9,5 +9,5 @@ export declare class BoardCommand implements Command {
9
9
  apply(): void;
10
10
  revert(): void;
11
11
  getReverse(): BoardOps | BoardOps[];
12
- merge(op: BoardOps): this;
12
+ merge(op: Operation): this;
13
13
  }
@@ -1,4 +1,7 @@
1
- import { Matrix, Point, Mbr, Item } from '../Items';
1
+ import { Matrix } from '../Items/Transformation/Matrix';
2
+ import { Point } from '../Items/Point/Point';
3
+ import { Mbr } from '../Items/Mbr/Mbr';
4
+ import type { Item } from '../Items/Item';
2
5
  import { Keyboard } from '../Keyboard';
3
6
  import { Pointer } from '../Pointer';
4
7
  import { Subject } from '../Subject';
@@ -0,0 +1,17 @@
1
+ import type { Board } from "../Board";
2
+ import { BaseOperation, Operation } from "./EventsOperations";
3
+ import { Command } from "./Command";
4
+ export declare class BaseCommand implements Command {
5
+ private board;
6
+ itemIds: string[];
7
+ operation: BaseOperation;
8
+ private reverse;
9
+ constructor(board: Board, itemIds: string[], operation: BaseOperation);
10
+ merge(op: Operation): this;
11
+ apply(): void;
12
+ revert(): void;
13
+ getReverse(): {
14
+ itemId: string;
15
+ operation: BaseOperation;
16
+ }[];
17
+ }
@@ -1,27 +1,18 @@
1
- import { Board } from '../Board';
2
- import { BaseOperation, ItemOperation, Operation } from './EventsOperations';
3
- import { Item, TransformationOperation } from '../Items';
1
+ import type { Board } from '../Board';
2
+ import { Operation } from './EventsOperations';
4
3
  export interface Command {
5
4
  apply(): void;
6
5
  revert(): void;
7
- merge?: (op: any) => Command;
6
+ merge?: (op: Operation) => Command;
8
7
  }
9
- export declare class BaseCommand {
10
- private board;
11
- itemIds: string[];
12
- operation: BaseOperation;
13
- private reverse;
14
- constructor(board: Board, itemIds: string[], operation: BaseOperation);
15
- merge(op: BaseOperation): this;
8
+ export { BaseCommand } from "./BaseCommand";
9
+ export interface ItemCommandFactory {
10
+ (items: any[], operation: any, board?: Board): Command;
11
+ }
12
+ export declare class NoOpCommand {
13
+ reason: string;
14
+ constructor(reason: string);
15
+ merge(_op: unknown): this;
16
16
  apply(): void;
17
17
  revert(): void;
18
- getReverse(): {
19
- itemId: string;
20
- operation: BaseOperation;
21
- }[];
22
- }
23
- export interface ItemCommandFactory {
24
- (items: Item[], operation: ItemOperation | TransformationOperation, board?: Board): Command;
25
18
  }
26
- export declare const itemCommandFactories: Record<string, ItemCommandFactory>;
27
- export declare function createCommand(board: Board, operation: Operation): Command;
@@ -0,0 +1,5 @@
1
+ import { Board } from '../Board';
2
+ import { Operation } from './EventsOperations';
3
+ import { Command, ItemCommandFactory } from './Command';
4
+ export declare const itemCommandFactories: Record<string, ItemCommandFactory>;
5
+ export declare function createCommand(board: Board, operation: Operation): Command;
@@ -29,7 +29,7 @@ export interface BoardEventPackBody {
29
29
  }
30
30
  export interface SyncBoardEvent extends BoardEvent {
31
31
  lastKnownOrder: number;
32
- userId: string;
32
+ userId: number;
33
33
  }
34
34
  interface SyncBoardEventPackBody extends BoardEventPackBody {
35
35
  lastKnownOrder: number;
@@ -39,6 +39,7 @@ export interface SyncBoardEventPack extends BoardEventPack {
39
39
  }
40
40
  export type SyncEvent = SyncBoardEvent | SyncBoardEventPack;
41
41
  export declare class Events {
42
+ static createCommand: (board: Board, operation: Operation) => Command;
42
43
  subject: Subject<BoardEvent>;
43
44
  log: EventsLog;
44
45
  board: Board;
@@ -1,18 +1,18 @@
1
- import { TransformationOperation } from "../Items";
2
- import { ShapeOperation } from "../Items/Shape";
3
- import { RichTextOperation } from "../Items";
4
- import { BoardOps } from "../BoardOperations";
5
- import { ConnectorOperation } from "../Items/Connector";
6
- import { DrawingOperation } from "../Items/Drawing/DrawingOperation";
7
- import { StickerOperation } from "../Items/Sticker/StickerOperation";
8
- import { FrameOperation } from "../Items/Frame";
9
- import { LinkToOperation } from "../Items/LinkTo/LinkToOperation";
10
- import { PlaceholderOperation } from "../Items/Placeholder/PlaceholderOperation";
11
- import { GroupOperation } from "../Items/Group/GroupOperation";
12
- import { CommentOperation } from "../Items/Comment";
13
- import { ImageOperation } from "../Items/Image";
14
- import { VideoOperation } from "../Items/Video/VideoOperation";
15
- import { AudioOperation } from "../Items/Audio/AudioOperation";
1
+ import type { TransformationOperation } from "../Items/Transformation/TransformationOperations";
2
+ import type { ShapeOperation } from "../Items/Shape/ShapeOperation";
3
+ import type { RichTextOperation } from "../Items/RichText/RichTextOperations";
4
+ import type { BoardOps } from "../BoardOperations";
5
+ import type { ConnectorOperation } from "../Items/Connector/ConnectorOperations";
6
+ import type { DrawingOperation } from "../Items/Drawing/DrawingOperation";
7
+ import type { StickerOperation } from "../Items/Sticker/StickerOperation";
8
+ import type { FrameOperation } from "../Items/Frame/FrameOperation";
9
+ import type { LinkToOperation } from "../Items/LinkTo/LinkToOperation";
10
+ import type { PlaceholderOperation } from "../Items/Placeholder/PlaceholderOperation";
11
+ import type { GroupOperation } from "../Items/Group/GroupOperation";
12
+ import type { CommentOperation } from "../Items/Comment/CommentOperation";
13
+ import type { ImageOperation } from "../Items/Image/ImageOperation";
14
+ import type { VideoOperation } from "../Items/Video/VideoOperation";
15
+ import type { AudioOperation } from "../Items/Audio/AudioOperation";
16
16
  interface Undo {
17
17
  class: "Events";
18
18
  method: "undo";
@@ -35,4 +35,12 @@ export type ItemOperation = LinkToOperation | TransformationOperation | ShapeOpe
35
35
  export type UndoableOperation = BoardOps | ItemOperation;
36
36
  export type Operation = UndoableOperation | EventsOperation;
37
37
  export type MethodType = Operation["method"];
38
+ export declare function isTransformation(op: Operation): op is TransformationOperation;
39
+ export declare function isBoardOp(op: Operation): op is BoardOps;
40
+ export declare function isRichTextOp(op: Operation): op is RichTextOperation;
41
+ export declare function isShapeOp(op: Operation): op is ShapeOperation;
42
+ export declare function isConnectorOp(op: Operation): op is ConnectorOperation;
43
+ export declare function isDrawingOp(op: Operation): op is DrawingOperation;
44
+ export declare function isItemOp(op: Operation): op is ItemOperation;
45
+ export declare function isEventsOp(op: Operation): op is EventsOperation;
38
46
  export {};
@@ -1,5 +1,6 @@
1
1
  import { Board, BoardSnapshot } from '../../Board';
2
2
  import { BoardEvent, BoardEventPack, SyncBoardEvent, SyncEvent } from '../Events';
3
+ import { Operation } from '../EventsOperations';
3
4
  import { EventsList } from './createEventsList';
4
5
  import { Command } from '../Command';
5
6
  export interface HistoryRecord {
@@ -27,7 +28,7 @@ export declare class EventsLog {
27
28
  publishIntervalTimer: NodeJS.Timeout | null;
28
29
  resendIntervalTimer: NodeJS.Timeout | null;
29
30
  saveFileTimeout: NodeJS.Timeout | null;
30
- constructor(board: Board);
31
+ constructor(board: Board, commandFactory: (ops: Operation) => Command);
31
32
  /**
32
33
  * Inserts new events into the events log, handling transformations and merging
33
34
  */
@@ -40,7 +41,7 @@ export declare class EventsLog {
40
41
  * Confirms events that have been sent, updating their status in the log
41
42
  * Note: Implementation treats the parameter as BoardEventPack
42
43
  */
43
- confirmSentLocalEvent(event: BoardEvent | BoardEventPack): void;
44
+ confirmSentLocalEvent(event: SyncEvent): void;
44
45
  /**
45
46
  * Retrieves unordered records (records to send and new records)
46
47
  */
@@ -84,4 +85,4 @@ export declare class EventsLog {
84
85
  */
85
86
  getLastConfirmed(): BoardEvent | null;
86
87
  }
87
- export declare function createEventsLog(board: Board): EventsLog;
88
+ export declare function createEventsLog(board: Board, commandFactory: (ops: Operation) => Command): EventsLog;
@@ -1,9 +1,11 @@
1
1
  import { BoardEvent } from "../Events";
2
2
  import { SyncLog, SyncLogSubject } from "../SyncLog";
3
3
  import { HistoryRecord } from "./EventsLog";
4
+ import { Operation } from "../EventsOperations";
4
5
  import { Command } from "../Command";
5
6
  export type FilterPredicate = (value: HistoryRecord, index: number, array: HistoryRecord[]) => boolean;
6
7
  export interface EventsList {
8
+ commandFactory: (ops: Operation) => Command;
7
9
  addConfirmedRecords(records: HistoryRecord[]): void;
8
10
  addNewRecords(records: HistoryRecord[]): void;
9
11
  confirmSentRecords(records: BoardEvent[]): void;
@@ -33,4 +35,4 @@ export interface EventsList {
33
35
  setSnapshotLastIndex(index: number): void;
34
36
  getSnapshotLastIndex(): number;
35
37
  }
36
- export declare function createEventsList(createCommand: (BoardOps: any) => Command): EventsList;
38
+ export declare function createEventsList(commandFactory: (ops: Operation) => Command): EventsList;
@@ -1,2 +1,5 @@
1
- import { BoardSnapshot } from '../../Board';
2
- export declare function getSnapshotFromList(list: any, board: any): BoardSnapshot;
1
+ export declare function getSnapshotFromList(list: any, board: any): {
2
+ events: any;
3
+ items: any;
4
+ lastIndex: any;
5
+ };
@@ -1,6 +1,7 @@
1
1
  export { Events, createEvents } from "./Events";
2
2
  export type { BoardEventBody, BoardEvent, SyncBoardEvent, SyncEvent, } from "./Events";
3
- export type { ItemOperation, EventsOperation, Operation, } from "./EventsOperations";
3
+ export type { ItemOperation, EventsOperation, Operation, BaseOperation, } from "./EventsOperations";
4
+ export { isTransformation, isBoardOp, isRichTextOp, isShapeOp, isConnectorOp, isDrawingOp, isEventsOp, isItemOp } from "./EventsOperations";
4
5
  export type { Command } from "./Command";
5
6
  export type { SyncLog } from "./SyncLog";
6
7
  export * from "./MessageRouter";
@@ -1,7 +1,7 @@
1
1
  import { Board } from "../../Board";
2
2
  import { DocumentFactory } from "../../api/DocumentFactory";
3
3
  import { Operation } from "../../Events/EventsOperations";
4
- import { AINodeData } from "../AINode/AINodeData";
4
+ import { AINodeData } from "./AINodeData";
5
5
  import { DrawingContext } from "../DrawingContext";
6
6
  import { GeometricNormal } from "../GeometricNormal";
7
7
  import { Line } from "../Line/Line";
@@ -13,12 +13,11 @@ import { Point } from "../Point/Point";
13
13
  import { RichText } from "../RichText/RichText";
14
14
  import { Transformation } from "../Transformation/Transformation";
15
15
  import { Subject } from "../../Subject";
16
- import { BaseItem } from "../BaseItem/BaseItem";
16
+ import { BaseItem, SerializedItemData } from "../BaseItem/BaseItem";
17
17
  export declare const CONTEXT_NODE_HIGHLIGHT_COLOR = "rgba(183, 138, 240, 1)";
18
18
  export declare const threadDirections: readonly [0, 1, 2, 3];
19
19
  export type ThreadDirection = typeof threadDirections[number];
20
20
  export declare class AINode extends BaseItem {
21
- private id;
22
21
  readonly itemType = "AINode";
23
22
  parent: string;
24
23
  readonly transformation: Transformation;
@@ -37,8 +36,8 @@ export declare class AINode extends BaseItem {
37
36
  prevMbr: Mbr | null;
38
37
  constructor(board: Board, isUserRequest?: boolean, parentNodeId?: string, contextItems?: string[], threadDirection?: ThreadDirection, id?: string);
39
38
  transformPath(): void;
40
- serialize(isCopy?: boolean): AINodeData;
41
- deserialize(data: Partial<AINodeData>): this;
39
+ serialize(): SerializedItemData<AINodeData>;
40
+ deserialize(data: SerializedItemData<AINodeData> | AINodeData): this;
42
41
  setId(id: string): this;
43
42
  protected onParentChanged(newParent: string): void;
44
43
  getId(): string;
@@ -13,5 +13,6 @@ export interface AINodeData {
13
13
  isUserRequest: boolean;
14
14
  contextItems: string[];
15
15
  threadDirection: ThreadDirection;
16
+ [key: string]: unknown;
16
17
  }
17
18
  export declare const createNodePath: (mbr: Mbr, matrix: Matrix) => Path;
@@ -1,5 +1,6 @@
1
1
  import { DrawingContext } from '../DrawingContext';
2
- import { Mbr, Point } from '..';
2
+ import { Mbr } from '../Mbr/Mbr';
3
+ import { Point } from '../Point/Point';
3
4
  export declare const ANCHOR_BORDER_COLOR = "rgb(147, 175, 246)";
4
5
  export declare const ANCHOR_BACKGROUND_COLOR = "rgb(255, 255, 255)";
5
6
  export declare const ANCHOR_STROKE_WIDTH = 1;
@@ -1,4 +1,7 @@
1
- import { Point, Line, Mbr, Matrix } from "..";
1
+ import { Point } from "../Point/Point";
2
+ import { Line } from "../Line/Line";
3
+ import { Mbr } from "../Mbr/Mbr";
4
+ import { Matrix } from "../Transformation/Matrix";
2
5
  import { GeometricNormal } from "../GeometricNormal";
3
6
  export declare class ArcData {
4
7
  }
@@ -1,19 +1,20 @@
1
1
  import { Events, Operation } from "../../Events";
2
2
  import { Subject } from "../../Subject";
3
3
  import { DrawingContext } from "../DrawingContext";
4
- import { Transformation } from "../Transformation";
4
+ import { Transformation } from "../Transformation/Transformation";
5
5
  import { TransformationData } from "../Transformation/TransformationData";
6
6
  import { Board } from "../../Board";
7
7
  import { LinkTo } from "../LinkTo/LinkTo";
8
8
  import { DocumentFactory } from "../../api/DocumentFactory";
9
- import { Path } from "../Path";
9
+ import { Path } from "../Path/Path";
10
10
  import { Point } from "../Point/Point";
11
- import { BaseItem } from "../BaseItem/BaseItem";
11
+ import { BaseItem, SerializedItemData } from "../BaseItem/BaseItem";
12
12
  export interface AudioItemData {
13
13
  itemType: "Audio";
14
14
  url: string;
15
15
  transformation: TransformationData;
16
16
  extension?: string;
17
+ [key: string]: unknown;
17
18
  }
18
19
  export declare class AudioItem extends BaseItem {
19
20
  private events?;
@@ -45,8 +46,8 @@ export declare class AudioItem extends BaseItem {
45
46
  updateMbr(): void;
46
47
  render(context: DrawingContext): void;
47
48
  renderHTML(documentFactory: DocumentFactory): HTMLElement;
48
- serialize(): AudioItemData;
49
- deserialize(data: Partial<AudioItemData>): AudioItem;
49
+ serialize(): SerializedItemData<AudioItemData>;
50
+ deserialize(data: SerializedItemData<AudioItemData> | AudioItemData): this;
50
51
  apply(op: Operation): void;
51
52
  emit(operation: Operation): void;
52
53
  setId(id: string): this;
@@ -1,31 +1,35 @@
1
1
  import { Mbr } from "../Mbr/Mbr";
2
2
  import { Geometry } from "../Geometry";
3
- import { RichText } from "../RichText/RichText";
3
+ import type { RichText } from "../RichText/RichText";
4
4
  import { LinkTo } from "../LinkTo/LinkTo";
5
5
  import { Transformation } from "../Transformation/Transformation";
6
6
  import { Board } from "../../Board";
7
7
  import { DrawingContext } from "../DrawingContext";
8
8
  import { DocumentFactory } from "../../api/DocumentFactory";
9
- import { Operation } from "../../Events";
9
+ import type { Operation } from "../../Events/EventsOperations";
10
+ import type { Command } from "../../Events/Command";
10
11
  import { TransformationData } from "../Transformation/TransformationData";
11
12
  import { BaseOperation } from "../../Events/EventsOperations";
12
13
  import { Subject } from "../../Subject";
13
- import { Path, Paths } from "../Path";
14
+ import { Path, Paths } from "../Path/index";
14
15
  import { BaseItemOperation } from "./BaseItemOperation";
15
16
  import { SimpleSpatialIndex } from "../../SpatialIndex/SimpleSpatialIndex";
16
17
  import { Point } from "../Point";
17
18
  import { Matrix } from "../Transformation/Matrix";
18
- export type BaseItemData = {
19
+ export interface BaseItemData {
19
20
  itemType: string;
20
- } & Record<string, any>;
21
- export type SerializedItemData<T extends BaseItemData = BaseItemData> = {
21
+ transformation?: TransformationData;
22
22
  linkTo?: string;
23
+ childIds?: string[];
24
+ [key: string]: unknown;
25
+ }
26
+ export type SerializedItemData<T extends BaseItemData = BaseItemData> = T & {
27
+ id: string;
23
28
  transformation: TransformationData;
24
- children?: string[];
25
- } & T;
29
+ };
26
30
  export declare class BaseItem extends Mbr implements Geometry {
27
31
  private defaultItemData?;
28
- [key: string]: any;
32
+ static createCommand?: (board: Board, operation: Operation) => Command;
29
33
  readonly transformation: Transformation;
30
34
  readonly linkTo: LinkTo;
31
35
  parent: string;
@@ -42,7 +46,7 @@ export declare class BaseItem extends Mbr implements Geometry {
42
46
  resizeEnabled: boolean;
43
47
  onlyProportionalResize: boolean;
44
48
  itemType: string;
45
- children: string[];
49
+ childIds: string[];
46
50
  isHoverHighlighted: boolean;
47
51
  static readonly HOVER_HIGHLIGHT_COLOR = "rgba(71, 120, 245, 0.7)";
48
52
  constructor(board: Board, id?: string, defaultItemData?: BaseItemData | undefined, isGroupItem?: boolean);
@@ -94,8 +98,8 @@ export declare class BaseItem extends Mbr implements Geometry {
94
98
  updateMbr(): void;
95
99
  getLinkTo(): string | undefined;
96
100
  getRichText(): RichText | null;
97
- deserialize(data: SerializedItemData): this;
98
- serialize(): SerializedItemData;
101
+ deserialize(data: SerializedItemData | BaseItemData): this;
102
+ serialize(): SerializedItemData<BaseItemData>;
99
103
  isClosed(): boolean;
100
104
  emit(operation: Operation | BaseOperation): void;
101
105
  emitForManyItems(operation: Operation | BaseOperation): void;
@@ -1 +1,2 @@
1
1
  export { BaseItem } from "./BaseItem";
2
+ export type { BaseItemData, SerializedItemData } from "./BaseItem";
@@ -2,14 +2,17 @@ import { Subject } from "../../Subject";
2
2
  import { Events, Operation } from "../../Events";
3
3
  import { Point } from "../Point";
4
4
  import { Transformation, TransformationData } from "../Transformation";
5
+ import { CommentOperation } from "./CommentOperation";
5
6
  import { Mbr } from "../Mbr";
6
- import { Geometry } from "../Geometry";
7
7
  import { GeometricNormal } from "../GeometricNormal";
8
8
  import { RichText } from "../RichText";
9
9
  import { DrawingContext } from "../DrawingContext";
10
+ import { SerializedItemData } from "../BaseItem";
10
11
  import { Line } from "../Line";
11
12
  import { LinkTo } from "../LinkTo/LinkTo";
12
13
  import { DocumentFactory } from "../../api/DocumentFactory";
14
+ import { BaseItem } from "../BaseItem/BaseItem";
15
+ import { Board } from "../../Board";
13
16
  export interface Commentator {
14
17
  username: string;
15
18
  id: number;
@@ -31,12 +34,11 @@ export interface CommentData {
31
34
  usersUnreadMarks: number[];
32
35
  resolved: boolean;
33
36
  itemToFollow?: string;
37
+ [key: string]: unknown;
34
38
  }
35
- export declare class Comment implements Geometry {
39
+ export declare class Comment extends BaseItem {
36
40
  private anchor;
37
41
  private events?;
38
- private id;
39
- readonly itemType = "Comment";
40
42
  parent: string;
41
43
  readonly transformation: Transformation;
42
44
  private commentators;
@@ -48,14 +50,10 @@ export declare class Comment implements Geometry {
48
50
  readonly linkTo: LinkTo;
49
51
  transformationRenderBlock?: boolean;
50
52
  resizeEnabled: boolean;
51
- readonly index: null;
52
- canBeNested: boolean;
53
- children: string[];
54
- onRemoveCallbacks: (() => void)[];
55
- constructor(anchor?: Point, events?: Events | undefined, id?: string);
56
- serialize(): CommentData;
57
- deserialize(data: CommentData): this;
58
- private emit;
53
+ constructor(board: Board, anchor?: Point, events?: Events | undefined, id?: string);
54
+ serialize(): SerializedItemData<CommentData>;
55
+ deserialize(data: SerializedItemData<CommentData> | CommentData): this;
56
+ emit(operation: CommentOperation): void;
59
57
  getItemToFollow(): string | undefined;
60
58
  getMbrWithChildren(): Mbr;
61
59
  setItemToFollow(itemId: string | undefined): void;
@@ -71,7 +69,7 @@ export declare class Comment implements Geometry {
71
69
  markThreadAsUnread(userId: number): void;
72
70
  markThreadAsRead(userId: number): void;
73
71
  private _syncing;
74
- private transform;
72
+ transform(): void;
75
73
  getUnreadMessages(userId?: number): Message[] | null;
76
74
  getIsThreadMarkedAsUnread(userId: number): boolean;
77
75
  isClosed(): boolean;
@@ -95,8 +93,6 @@ export declare class Comment implements Geometry {
95
93
  isUnderPoint(point: Point): boolean;
96
94
  private generateMessageId;
97
95
  getLinkTo(): string | undefined;
98
- getPath(): null;
99
- getSnapAnchorPoints(): Point[] | null;
100
96
  getChildrenIds(): string[] | null;
101
97
  addChildItems(_children: unknown[]): void;
102
98
  removeChildItems(_children: unknown | unknown[]): void;
@@ -1,31 +1,27 @@
1
- import { RichText } from '../../Items';
1
+ import { RichText } from '../RichText/RichText';
2
2
  import { Subject } from '../../Subject';
3
3
  import { Board } from '../../Board';
4
4
  import { Operation } from '../../Events';
5
5
  import { DrawingContext } from '../DrawingContext';
6
6
  import { GeometricNormal } from '../GeometricNormal';
7
- import { Item } from '../Item';
8
- import { Line } from '../Line';
9
- import { Mbr } from '../Mbr';
10
- import { BorderStyle, Path, Paths } from '../Path';
11
- import { Point } from '../Point';
12
- import { Transformation } from '../Transformation';
7
+ import type { Item } from '../Item';
8
+ import { Line } from '../Line/Line';
9
+ import { Mbr } from '../Mbr/Mbr';
10
+ import { Path } from '../Path/Path';
11
+ import { Paths } from '../Path/Paths';
12
+ import type { BorderStyle } from '../Path/Path';
13
+ import { Point } from '../Point/Point';
14
+ import { Transformation } from '../Transformation/Transformation';
13
15
  import { ConnectorData, ConnectorOperation } from './ConnectorOperations';
14
16
  import { BoardPoint, ControlPoint, ControlPointData, FindItemFn } from './ControlPoint';
15
17
  import { ConnectorPointerStyle, Pointer } from './Pointers/Pointers';
16
18
  import { LinkTo } from '../LinkTo/LinkTo';
17
19
  import { DocumentFactory } from '../../api/DocumentFactory';
18
20
  import { ConnectorAnchorColors } from './types';
19
- import { BaseItem } from "../BaseItem";
21
+ import { BaseItem } from "../BaseItem/BaseItem";
22
+ import type { SerializedItemData } from "../BaseItem/BaseItem";
20
23
  import { ColorValue } from '../../..';
21
- export declare const ConnectorLineStyles: readonly ["straight", "curved", "orthogonal"];
22
- export type ConnectorLineStyle = (typeof ConnectorLineStyles)[number];
23
- export declare const ConnectionLineWidths: readonly [1, 2, 3, 4, 5, 6, 7, 8, 12];
24
- export type ConnectionLineWidth = (typeof ConnectionLineWidths)[number];
25
- export declare const CONNECTOR_COLOR = "rgb(20, 21, 26)";
26
- export declare const CONNECTOR_LINE_WIDTH = 1;
27
- export declare const CONNECTOR_BORDER_STYLE: BorderStyle;
28
- export declare const DEFAULT_END_POINTER = "TriangleFilled";
24
+ import { ConnectionLineWidth, ConnectorLineStyle } from './ConnectorTypes';
29
25
  export declare const DRAW_TEXT_BORDER = false;
30
26
  export declare const TEXT_BORDER_PADDING = 0;
31
27
  export declare const CONNECTOR_ANCHOR_COLOR: ConnectorAnchorColors;
@@ -129,8 +125,8 @@ export declare class Connector extends BaseItem {
129
125
  getPaths(): Path;
130
126
  copyPaths(): Path;
131
127
  isClosed(): boolean;
132
- serialize(): ConnectorData;
133
- deserialize(data: Partial<ConnectorData>): this;
128
+ serialize(): SerializedItemData<ConnectorData>;
129
+ deserialize(data: SerializedItemData<ConnectorData> | ConnectorData): this;
134
130
  getConnectorById(items: Item[], connectorId: string): Connector | undefined;
135
131
  updateTitle(): void;
136
132
  private scalePoints;
@@ -147,4 +143,3 @@ export declare class Connector extends BaseItem {
147
143
  getRichText(): RichText;
148
144
  getLinkTo(): string | undefined;
149
145
  }
150
- export declare const CONNECTOR_POINTER_TYPES: readonly ["None", "ArrowBroad", "ArrowThin", "TriangleFilled", "CircleFilled", "Angle", "TriangleEmpty", "DiamondFilled", "DiamondEmpty", "Zero", "One", "Many", "ManyMandatory", "OneMandatory", "ManyOptional", "OneOptional"];
@@ -1,5 +1,5 @@
1
1
  import { Connector } from ".";
2
- import { Command } from "../../Events";
2
+ import { Command, Operation } from "../../Events";
3
3
  import { ConnectorOperation } from "./ConnectorOperations";
4
4
  type ReverseOperation = {
5
5
  item: Connector;
@@ -10,7 +10,7 @@ export declare class ConnectorCommand implements Command {
10
10
  private operation;
11
11
  reverse: ReverseOperation;
12
12
  constructor(connector: Connector[], operation: ConnectorOperation);
13
- merge(op: ConnectorOperation): this;
13
+ merge(op: Operation): this;
14
14
  apply(): void;
15
15
  revert(): void;
16
16
  getReverse(): ReverseOperation;
@@ -1,9 +1,8 @@
1
1
  import { ControlPointData, FindItemFn } from "./ControlPoint";
2
- import { ConnectionLineWidth, ConnectorLineStyle } from "./Connector";
2
+ import { ConnectionLineWidth, ConnectorLineStyle } from "./ConnectorTypes";
3
3
  import { ConnectorPointerStyle } from "./Pointers/Pointers";
4
4
  import { DefaultRichTextData } from "../RichText/RichTextData";
5
5
  import { DefaultTransformationData } from "../Transformation/TransformationData";
6
- import { LinkTo } from "../LinkTo/LinkTo";
7
6
  import { BorderStyle } from "../Path";
8
7
  import { ColorValue } from "../../..";
9
8
  export declare class ConnectorData {
@@ -15,12 +14,13 @@ export declare class ConnectorData {
15
14
  endPointerStyle: ConnectorPointerStyle;
16
15
  lineStyle: ConnectorLineStyle;
17
16
  lineColor: ColorValue;
18
- linkTo?: string | LinkTo;
17
+ linkTo?: string;
19
18
  lineWidth: ConnectionLineWidth;
20
19
  borderStyle: BorderStyle;
21
20
  transformation: DefaultTransformationData;
22
21
  text: DefaultRichTextData;
23
22
  optionalFindItemFn?: FindItemFn;
23
+ [key: string]: unknown;
24
24
  }
25
25
  interface SetStartPoint {
26
26
  class: "Connector";
@@ -0,0 +1,10 @@
1
+ import { BorderStyle } from "../Path";
2
+ export declare const ConnectorLineStyles: readonly ["straight", "curved", "orthogonal"];
3
+ export type ConnectorLineStyle = (typeof ConnectorLineStyles)[number];
4
+ export declare const ConnectionLineWidths: readonly [1, 2, 3, 4, 5, 6, 7, 8, 12];
5
+ export type ConnectionLineWidth = (typeof ConnectionLineWidths)[number];
6
+ export declare const CONNECTOR_COLOR = "rgb(20, 21, 26)";
7
+ export declare const CONNECTOR_LINE_WIDTH = 1;
8
+ export declare const CONNECTOR_BORDER_STYLE: BorderStyle;
9
+ export declare const DEFAULT_END_POINTER = "TriangleFilled";
10
+ export declare const CONNECTOR_POINTER_TYPES: readonly ["None", "ArrowThin", "ArrowHeavy", "TriangleFilled", "TriangleOutline", "CircleFilled", "CircleOutline", "DiamondFilled", "DiamondOutline"];