microboard-temp 0.13.40 → 0.13.41

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 (59) hide show
  1. package/dist/cjs/browser.js +8242 -8155
  2. package/dist/cjs/index.js +8242 -8155
  3. package/dist/cjs/node.js +3833 -3746
  4. package/dist/esm/browser.js +3822 -3735
  5. package/dist/esm/index.js +3822 -3735
  6. package/dist/esm/node.js +3822 -3735
  7. package/dist/types/Board.d.ts +7 -3
  8. package/dist/types/Events/BaseCommand.d.ts +16 -0
  9. package/dist/types/Events/Command.d.ts +2 -15
  10. package/dist/types/Events/Events.d.ts +1 -1
  11. package/dist/types/Events/Log/getSnapshotFromList.d.ts +5 -2
  12. package/dist/types/Items/AINode/AINode.d.ts +3 -4
  13. package/dist/types/Items/AINode/AINodeData.d.ts +1 -0
  14. package/dist/types/Items/Audio/Audio.d.ts +4 -3
  15. package/dist/types/Items/BaseItem/BaseItem.d.ts +11 -8
  16. package/dist/types/Items/BaseItem/index.d.ts +1 -0
  17. package/dist/types/Items/Comment/Comment.d.ts +11 -15
  18. package/dist/types/Items/Connector/Connector.d.ts +3 -3
  19. package/dist/types/Items/Connector/ConnectorOperations.d.ts +2 -2
  20. package/dist/types/Items/Connector/Pointers/Pointers.d.ts +18 -2
  21. package/dist/types/Items/Curve/Curve.d.ts +5 -6
  22. package/dist/types/Items/Drawing/Drawing.d.ts +4 -3
  23. package/dist/types/Items/Examples/CardGame/Dice/Dice.d.ts +6 -7
  24. package/dist/types/Items/Examples/CardGame/Screen/Screen.d.ts +4 -3
  25. package/dist/types/Items/Frame/Frame.d.ts +2 -3
  26. package/dist/types/Items/Frame/FrameData.d.ts +2 -0
  27. package/dist/types/Items/Frame/FrameOperation.d.ts +13 -1
  28. package/dist/types/Items/Group/Group.d.ts +4 -3
  29. package/dist/types/Items/Image/Image.d.ts +4 -3
  30. package/dist/types/Items/Mbr/updateRects.d.ts +1 -2
  31. package/dist/types/Items/Path/Path.d.ts +1 -0
  32. package/dist/types/Items/Path/Paths.d.ts +2 -0
  33. package/dist/types/Items/Placeholder/Placeholder.d.ts +5 -4
  34. package/dist/types/Items/RichText/CanvasText/Render.d.ts +1 -1
  35. package/dist/types/Items/RichText/Editor/BlockNode.d.ts +10 -3
  36. package/dist/types/Items/RichText/EditorContainer.d.ts +5 -6
  37. package/dist/types/Items/RichText/RichText.d.ts +3 -3
  38. package/dist/types/Items/RichText/RichTextData.d.ts +2 -0
  39. package/dist/types/Items/RichText/RichTextOperations.d.ts +3 -2
  40. package/dist/types/Items/RichText/setNodeStyles.d.ts +2 -5
  41. package/dist/types/Items/Shape/Shape.d.ts +2 -2
  42. package/dist/types/Items/Shape/ShapeData.d.ts +2 -0
  43. package/dist/types/Items/Sticker/Sticker.d.ts +3 -3
  44. package/dist/types/Items/Sticker/StickerOperation.d.ts +3 -3
  45. package/dist/types/Items/Video/Video.d.ts +7 -6
  46. package/dist/types/Items/index.d.ts +2 -0
  47. package/dist/types/Keyboard/types.d.ts +2 -1
  48. package/dist/types/Selection/Selection.d.ts +7 -7
  49. package/dist/types/Selection/Transformer/TextTransformer/getTextResizeType.d.ts +1 -1
  50. package/dist/types/Selection/Transformer/TransformerHelpers/AnchorType.d.ts +1 -1
  51. package/dist/types/Selection/Transformer/TransformerHelpers/getOppositePoint.d.ts +1 -1
  52. package/dist/types/Selection/Transformer/TransformerHelpers/getResizeMatrix.d.ts +1 -1
  53. package/dist/types/Selection/Transformer/TransformerHelpers/getResizedMbr.d.ts +1 -1
  54. package/dist/types/Settings.d.ts +1 -1
  55. package/dist/types/Tools/AddDrawing/AddDrawing.d.ts +1 -1
  56. package/dist/types/Tools/AddDrawing/AddHighlighter.d.ts +1 -1
  57. package/dist/types/Tools/Tools.d.ts +1 -1
  58. package/dist/types/parserHTML.d.ts +9 -1
  59. package/package.json +1 -1
@@ -6,13 +6,14 @@ import { Events, Operation } from "../../Events";
6
6
  import { Mbr, Line, Point, Transformation, Item } from "..";
7
7
  import { Board } from "../../Board";
8
8
  import { LinkTo } from "../LinkTo/LinkTo";
9
- import { BaseItem } from "../BaseItem/BaseItem";
9
+ import { BaseItem, SerializedItemData } from "../BaseItem/BaseItem";
10
10
  import { DocumentFactory } from "../../api/DocumentFactory";
11
11
  export interface GroupData {
12
12
  readonly itemType: "Group";
13
13
  children: string[];
14
14
  transformation: TransformationData;
15
15
  isLockedGroup?: boolean;
16
+ [key: string]: any;
16
17
  }
17
18
  export declare class Group extends BaseItem {
18
19
  private events?;
@@ -34,8 +35,8 @@ export declare class Group extends BaseItem {
34
35
  getChildrenIds(): string[];
35
36
  getChildren(): Item[];
36
37
  getLinkTo(): string | undefined;
37
- serialize(): GroupData;
38
- deserialize(data: GroupData): this;
38
+ serialize(): SerializedItemData<GroupData>;
39
+ deserialize(data: SerializedItemData<GroupData>): this;
39
40
  getId(): string;
40
41
  getIntersectionPoints(segment: Line): Point[];
41
42
  render(context: DrawingContext): void;
@@ -9,13 +9,14 @@ import { Board } from "../../Board";
9
9
  import { LinkTo } from "../LinkTo/LinkTo";
10
10
  import { ImageOperation } from "./ImageOperation";
11
11
  import { DocumentFactory } from "../../api/DocumentFactory";
12
- import { BaseItem } from "../BaseItem/BaseItem";
12
+ import { BaseItem, SerializedItemData } from "../BaseItem/BaseItem";
13
13
  export interface ImageItemData {
14
14
  itemType: "Image";
15
15
  storageLink: string;
16
16
  imageDimension: Dimension;
17
17
  transformation: TransformationData;
18
18
  linkTo?: string;
19
+ [key: string]: unknown;
19
20
  }
20
21
  export interface Dimension {
21
22
  height: number;
@@ -55,11 +56,11 @@ export declare class ImageItem extends BaseItem {
55
56
  doOnceOnLoad: (callback: (image: ImageItem) => void) => void;
56
57
  setId(id: string): this;
57
58
  getId(): string;
58
- serialize(): ImageItemData;
59
+ serialize(): SerializedItemData<ImageItemData>;
59
60
  private setCoordinates;
60
61
  private shootBeforeLoadCallbacks;
61
62
  private shootLoadCallbacks;
62
- deserialize(data: Partial<ImageItemData>): ImageItem;
63
+ deserialize(data: SerializedItemData<ImageItemData> | ImageItemData): this;
63
64
  emit(operation: ImageOperation): void;
64
65
  setDimensions(dim: Dimension): void;
65
66
  apply(op: Operation): void;
@@ -1,8 +1,7 @@
1
1
  import { Board } from '../../Board';
2
2
  import { Camera } from '../../Camera';
3
3
  import { Mbr } from './Mbr';
4
- import { RefObject } from 'react';
5
- export declare function updateRects(board: Board, ref: RefObject<HTMLElement>, mbr?: Mbr, verticalOffset?: number, horizontalOffset?: number, fit?: 'hyperLink' | 'boardMenu' | 'contextPanel' | 'linkToBtn' | 'comment' | 'threadPanel'): Mbr | null;
4
+ export declare function updateRects(board: Board, ref: any, mbr?: Mbr, verticalOffset?: number, horizontalOffset?: number, fit?: 'hyperLink' | 'boardMenu' | 'contextPanel' | 'linkToBtn' | 'comment' | 'threadPanel'): Mbr | null;
6
5
  export declare function getContextPanelRect(selectionMbr: Mbr, camera: Camera, panel: HTMLElement, toLeft: boolean, horizontalOffset?: number, verticalOffset?: number): Mbr;
7
6
  export declare function fitContextPanelToLeft(selectionMbr: Mbr, view: Mbr, panel: Mbr, verticalOffset?: number, horizontalOffset?: number): Mbr;
8
7
  export declare function fitContextPanelToCenter(selectionMbr: Mbr, view: Mbr, panel: Mbr, verticalOffset?: number, horizontalOffset?: number): Mbr;
@@ -111,5 +111,6 @@ export declare class Path implements Geometry, PathStylize {
111
111
  getSegments(): Segment[];
112
112
  isClosed(): boolean;
113
113
  addConnectedItemType(name: string): this;
114
+ getRichText(): null;
114
115
  }
115
116
  export {};
@@ -7,6 +7,7 @@ import { BorderStyle, BorderWidth, Path, PathStylize } from './Path';
7
7
  import { Matrix } from '../Transformation';
8
8
  import { GeometricNormal } from '../GeometricNormal';
9
9
  import { DocumentFactory } from '../../api/DocumentFactory';
10
+ import { RichText } from '../RichText/RichText';
10
11
  export declare class Paths implements Geometry {
11
12
  private paths;
12
13
  private backgroundColor;
@@ -55,4 +56,5 @@ export declare class Paths implements Geometry {
55
56
  copy(): Paths;
56
57
  copyPaths(): Path[];
57
58
  isClosed(): boolean;
59
+ getRichText(): RichText | null;
58
60
  }
@@ -9,7 +9,7 @@ import { Path, Paths } from "../Path";
9
9
  import { Point } from "../Point";
10
10
  import { Transformation, Matrix, TransformationData } from "../Transformation";
11
11
  import { PlaceholderOperation } from "./PlaceholderOperation";
12
- import { BaseItem } from "../BaseItem";
12
+ import { BaseItem, SerializedItemData } from "../BaseItem";
13
13
  import { Board } from "../../Board";
14
14
  import { DocumentFactory } from "../../api/DocumentFactory";
15
15
  export interface PlaceholderData {
@@ -18,6 +18,7 @@ export interface PlaceholderData {
18
18
  icon: string;
19
19
  transformation: TransformationData;
20
20
  miroData?: unknown;
21
+ [key: string]: unknown;
21
22
  }
22
23
  export declare class Placeholder extends BaseItem {
23
24
  private events?;
@@ -32,11 +33,11 @@ export declare class Placeholder extends BaseItem {
32
33
  private mbr;
33
34
  readonly subject: Subject<Placeholder>;
34
35
  transformationRenderBlock?: boolean;
35
- iconImage: any;
36
+ iconImage?: HTMLImageElement;
36
37
  constructor(board: Board, events?: Events | undefined, miroData?: unknown | undefined, id?: string, backgroundColor?: string, icon?: string);
37
38
  emit(operation: PlaceholderOperation): void;
38
- serialize(): PlaceholderData;
39
- deserialize(data: Partial<PlaceholderData>): this;
39
+ serialize(): SerializedItemData<PlaceholderData>;
40
+ deserialize(data: SerializedItemData<PlaceholderData> | PlaceholderData): this;
40
41
  setId(id: string): this;
41
42
  getId(): string;
42
43
  apply(op: Operation): void;
@@ -2,7 +2,7 @@ import { BlockNode } from '../Editor/BlockNode';
2
2
  import { LayoutBlockNodes } from './LayoutBlockNodes';
3
3
  export declare function getBlockNodes(data: BlockNode[], maxWidth?: number, shrink?: boolean, isFrame?: boolean): LayoutBlockNodes;
4
4
  export interface LayoutBlockNode {
5
- type: 'paragraph' | 'heading_one' | 'heading_two' | 'heading_three' | 'heading_four' | 'heading_five' | 'code_block' | 'ul_list' | 'ol_list' | 'list_item' | 'text';
5
+ type: 'paragraph' | 'heading_one' | 'heading_two' | 'heading_three' | 'heading_four' | 'heading_five' | 'code_block' | 'ul_list' | 'ol_list' | 'list_item' | 'block-quote' | 'text';
6
6
  lineHeight: number;
7
7
  children: LayoutTextNode[];
8
8
  lines: LayoutTextBlock[][];
@@ -2,7 +2,7 @@ import { HorisontalAlignment } from "../../Alignment";
2
2
  import { TextNode } from "./TextNode";
3
3
  export declare const ListTypes: readonly ["ol_list", "ul_list"];
4
4
  export type ListType = (typeof ListTypes)[number];
5
- export declare const BlockTypes: readonly ["paragraph", "ul_list", "ol_list", "list_item", "code_block", "heading_one", "heading_two", "heading_three", "heading_four", "heading_five"];
5
+ export declare const BlockTypes: readonly ["paragraph", "ul_list", "ol_list", "list_item", "code_block", "heading_one", "heading_two", "heading_three", "heading_four", "heading_five", "block-quote"];
6
6
  export type BlockType = (typeof BlockTypes)[number];
7
7
  export type ParagraphNode = {
8
8
  type: "paragraph";
@@ -55,6 +55,13 @@ export type HeadingFiveNode = {
55
55
  paddingTop?: number;
56
56
  paddingBottom?: number;
57
57
  };
58
+ export type BlockQuoteNode = {
59
+ type: "block-quote";
60
+ children: TextNode[];
61
+ horisontalAlignment?: HorisontalAlignment;
62
+ paddingTop?: number;
63
+ paddingBottom?: number;
64
+ };
58
65
  export type BulletedListNode = {
59
66
  type: "ul_list";
60
67
  children: ListItemNode[];
@@ -80,5 +87,5 @@ export type ListItemNode = {
80
87
  paddingTop?: number;
81
88
  paddingBottom?: number;
82
89
  };
83
- export type BlockNode = ParagraphNode | CodeBlockNode | HeadingOneNode | HeadingTwoNode | HeadingThreeNode | HeadingFourNode | HeadingFiveNode | BulletedListNode | NumberedListNode | ListItemNode;
84
- export type NoneListBlockNode = ParagraphNode | CodeBlockNode | HeadingOneNode | HeadingTwoNode | HeadingThreeNode | HeadingFourNode | HeadingFiveNode;
90
+ export type BlockNode = ParagraphNode | CodeBlockNode | HeadingOneNode | HeadingTwoNode | HeadingThreeNode | HeadingFourNode | HeadingFiveNode | BulletedListNode | NumberedListNode | ListItemNode | BlockQuoteNode;
91
+ export type NoneListBlockNode = ParagraphNode | CodeBlockNode | HeadingOneNode | HeadingTwoNode | HeadingThreeNode | HeadingFourNode | HeadingFiveNode | BlockQuoteNode;
@@ -1,11 +1,10 @@
1
1
  import { DefaultTextStyles } from "../../Settings";
2
2
  import { Subject } from "../../Subject";
3
- import { BaseEditor, BaseSelection, Descendant, Operation as SlateOp, Operation } from "slate";
4
- import { HistoryEditor } from "slate-history";
5
- import { ReactEditor } from "slate-react";
3
+ import { BaseSelection, Descendant, Operation as SlateOp, Operation } from "slate";
6
4
  import { HorisontalAlignment, VerticalAlignment } from "../Alignment";
7
5
  import { BlockNode, ListType, ParagraphNode } from "./Editor/BlockNode";
8
6
  import { TextNode, TextStyle } from "./Editor/TextNode";
7
+ import { ColorValue } from '../../..';
9
8
  import { RichTextOperation } from "./RichTextOperations";
10
9
  import { MarkdownProcessor } from "../RichText/editorHelpers/markdown/markdownProcessor";
11
10
  export declare class EditorContainer {
@@ -24,7 +23,7 @@ export declare class EditorContainer {
24
23
  private calcAutoSize;
25
24
  private applyAutoSizeScale;
26
25
  private updateElement;
27
- readonly editor: BaseEditor & ReactEditor & HistoryEditor;
26
+ readonly editor: any;
28
27
  maxWidth: number | undefined;
29
28
  textScale: number;
30
29
  verticalAlignment: VerticalAlignment;
@@ -50,11 +49,11 @@ export declare class EditorContainer {
50
49
  private applyWholeTextOp;
51
50
  applyMaxWidth(maxWidth: number): void;
52
51
  setMaxWidth(maxWidth: number): void;
53
- setSelectionFontColor(format: string, selectionContext?: string): SlateOp[];
52
+ setSelectionFontColor(format: string | ColorValue, selectionContext?: string): SlateOp[];
54
53
  setSelectionLink(link: string | undefined, selection: BaseSelection): Operation[];
55
54
  setSelectionFontStyle(style: TextStyle | TextStyle[]): SlateOp[];
56
55
  setSelectionFontSize(fontSize: number | "auto", selectionContext?: string): SlateOp[];
57
- setSelectionFontHighlight(format: string, selectionContext?: string): SlateOp[];
56
+ setSelectionFontHighlight(format: string | ColorValue, selectionContext?: string): SlateOp[];
58
57
  setSelectionHorisontalAlignment(horisontalAlignment: HorisontalAlignment, selectionContext?: string): SlateOp[];
59
58
  getSelectionMarks(): Omit<TextNode, "text"> | null;
60
59
  handleListMerge(): boolean;
@@ -15,7 +15,7 @@ import { BlockNode, BlockType } from "./Editor/BlockNode";
15
15
  import { TextStyle } from "./Editor/TextNode";
16
16
  import { EditorContainer } from "./EditorContainer";
17
17
  import { RichTextOperation } from "./RichTextOperations";
18
- import { BaseItem } from "../BaseItem";
18
+ import { BaseItem, SerializedItemData } from "../BaseItem";
19
19
  export declare function isEditInProcess(): boolean;
20
20
  export declare function toggleEdit(value: boolean): void;
21
21
  /**
@@ -134,10 +134,10 @@ export declare class RichText extends BaseItem {
134
134
  setCursorUnderLastClick(ref: HTMLDivElement | null): void;
135
135
  disableRender(): void;
136
136
  enableRender(): void;
137
- serialize(): RichTextData;
137
+ serialize(): SerializedItemData<RichTextData>;
138
138
  getCurrentSelection(): BaseSelection | undefined;
139
139
  restoreSelection(selection?: BaseSelection): void;
140
- deserialize(data: Partial<RichTextData>): this;
140
+ deserialize(data: SerializedItemData<RichTextData> | RichTextData): this;
141
141
  render(context: DrawingContext): void;
142
142
  renderHTML(documentFactory: DocumentFactory, enablePlaceholder?: boolean): HTMLElement;
143
143
  getClipMbr(): Mbr;
@@ -14,6 +14,7 @@ export interface RichTextData {
14
14
  placeholderText: string;
15
15
  realSize: 'auto' | number;
16
16
  linkTo?: string;
17
+ [key: string]: any;
17
18
  }
18
19
  export declare class DefaultRichTextData implements RichTextData {
19
20
  children: Descendant[];
@@ -27,5 +28,6 @@ export declare class DefaultRichTextData implements RichTextData {
27
28
  placeholderText: string;
28
29
  realSize: 'auto' | number;
29
30
  readonly itemType = "RichText";
31
+ [key: string]: unknown;
30
32
  constructor(children?: Descendant[], verticalAlignment?: VerticalAlignment, maxWidth?: number | undefined, transformation?: TransformationData | undefined, linkTo?: string | undefined, containerMaxWidth?: number | undefined, insideOf?: ItemType | undefined, color?: string | undefined, placeholderText?: string, realSize?: 'auto' | number);
31
33
  }
@@ -2,13 +2,14 @@ import { BaseSelection, Operation } from 'slate';
2
2
  import { HorisontalAlignment, VerticalAlignment } from '../Alignment';
3
3
  import { TextStyle } from './Editor/TextNode';
4
4
  import { SelectionContext } from '../../Selection/Selection';
5
+ import { ColorValue } from '../../..';
5
6
  interface RichTextBaseOp {
6
7
  class: 'RichText';
7
8
  item: string[];
8
9
  }
9
10
  interface SetFontColor extends RichTextBaseOp {
10
11
  method: 'setFontColor';
11
- fontColor: string;
12
+ fontColor: string | ColorValue;
12
13
  }
13
14
  interface SetFontStyle extends RichTextBaseOp {
14
15
  method: 'setFontStyle';
@@ -25,7 +26,7 @@ interface SetFontSize extends RichTextBaseOp {
25
26
  }
26
27
  interface SetFontHighlight extends RichTextBaseOp {
27
28
  method: 'setFontHighlight';
28
- fontHighlight: string;
29
+ fontHighlight: string | ColorValue;
29
30
  }
30
31
  interface SetHorisontalAligment extends RichTextBaseOp {
31
32
  method: 'setHorisontalAlignment';
@@ -1,10 +1,7 @@
1
- import { BaseEditor } from 'slate';
2
1
  import { BlockNode, NoneListBlockNode } from '../RichText/Editor/BlockNode';
3
- import { ReactEditor } from 'slate-react';
4
- import { HistoryEditor } from 'slate-history';
5
2
  import { HorisontalAlignment } from '../Alignment';
6
3
  export declare function setNodeChildrenStyles({ editor, horisontalAlignment, node, }: {
7
- editor?: BaseEditor & ReactEditor & HistoryEditor;
4
+ editor?: any;
8
5
  horisontalAlignment?: HorisontalAlignment;
9
6
  node: NoneListBlockNode;
10
7
  }): void;
@@ -12,6 +9,6 @@ export declare function setNodeStyles({ node, isPaddingTopNeeded, listLevel, edi
12
9
  node: BlockNode;
13
10
  isPaddingTopNeeded: boolean;
14
11
  listLevel?: number;
15
- editor?: BaseEditor & ReactEditor & HistoryEditor;
12
+ editor?: any;
16
13
  horisontalAlignment?: HorisontalAlignment;
17
14
  }): void;
@@ -365,8 +365,8 @@ export declare class Shape extends BaseItem {
365
365
  constructor(board: Board, id?: string, shapeType?: ShapeType, backgroundColor?: ColorValue, backgroundOpacity?: number, borderColor?: ColorValue, borderOpacity?: number, borderStyle?: "solid" | "dot" | "dash" | "longDash" | "dotDash" | "tripleDotDash" | "looseDoubleDotDash", borderWidth?: number, mbr?: Mbr);
366
366
  private saveShapeData;
367
367
  emit(operation: ShapeOperation): void;
368
- serialize(): ShapeData;
369
- deserialize(data: SerializedItemData<ShapeData>): this;
368
+ serialize(): SerializedItemData<ShapeData>;
369
+ deserialize(data: SerializedItemData<ShapeData> | ShapeData): this;
370
370
  setId(id: string): this;
371
371
  protected onParentChanged(newParent: string): void;
372
372
  getId(): string;
@@ -16,6 +16,7 @@ export interface ShapeData {
16
16
  transformation: TransformationData;
17
17
  text: RichTextData;
18
18
  linkTo?: string;
19
+ [key: string]: unknown;
19
20
  }
20
21
  export declare class DefaultShapeData implements ShapeData {
21
22
  shapeType: ShapeType;
@@ -29,6 +30,7 @@ export declare class DefaultShapeData implements ShapeData {
29
30
  text: DefaultRichTextData;
30
31
  linkTo?: string | undefined;
31
32
  readonly itemType = "Shape";
33
+ [key: string]: unknown;
32
34
  constructor(shapeType?: ShapeType, backgroundColor?: ColorValue, backgroundOpacity?: number, borderColor?: ColorValue, borderOpacity?: number, borderStyle?: BorderStyle, borderWidth?: BorderWidth, transformation?: DefaultTransformationData, text?: DefaultRichTextData, linkTo?: string | undefined);
33
35
  }
34
36
  export declare const ADD_TO_SELECTION = true;
@@ -14,7 +14,7 @@ import { StickerData, StickerOperation } from "./StickerOperation";
14
14
  import { LinkTo } from "../LinkTo/LinkTo";
15
15
  import { Board } from "../../Board";
16
16
  import { DocumentFactory } from "../../api/DocumentFactory";
17
- import { BaseItem } from "../BaseItem";
17
+ import { BaseItem, SerializedItemData } from "../BaseItem";
18
18
  import { ColorValue } from "../../..";
19
19
  export declare const stickerColors: {
20
20
  [color: string]: string;
@@ -39,8 +39,8 @@ export declare class Sticker extends BaseItem {
39
39
  constructor(board: Board, id?: string, backgroundColor?: ColorValue);
40
40
  emit(operation: StickerOperation): void;
41
41
  saveStickerData(): void;
42
- serialize(): StickerData;
43
- deserialize(data: Partial<StickerData>): this;
42
+ serialize(): SerializedItemData<StickerData>;
43
+ deserialize(data: SerializedItemData<StickerData> | StickerData): this;
44
44
  private transformPath;
45
45
  setId(id: string): this;
46
46
  protected onParentChanged(newParent: string): void;
@@ -1,14 +1,14 @@
1
- import { LinkTo } from '../LinkTo/LinkTo';
2
1
  import { DefaultRichTextData } from '../RichText/RichTextData';
3
2
  import { DefaultTransformationData } from '../Transformation/TransformationData';
4
3
  import { ColorValue } from '../../..';
5
4
  export declare class StickerData {
6
5
  backgroundColor: ColorValue;
7
6
  transformation: DefaultTransformationData;
8
- linkTo?: (string | LinkTo) | undefined;
7
+ linkTo?: string | undefined;
9
8
  text: DefaultRichTextData;
10
9
  readonly itemType = "Sticker";
11
- constructor(backgroundColor?: ColorValue, transformation?: DefaultTransformationData, linkTo?: (string | LinkTo) | undefined, text?: DefaultRichTextData);
10
+ [key: string]: unknown;
11
+ constructor(backgroundColor?: ColorValue, transformation?: DefaultTransformationData, linkTo?: string | undefined, text?: DefaultRichTextData);
12
12
  }
13
13
  interface SetBackgroundColor {
14
14
  class: 'Sticker';
@@ -8,7 +8,7 @@ import { Mbr } from "../Mbr";
8
8
  import { Path, Paths } from "../Path";
9
9
  import { TransformationData, Transformation } from "../Transformation";
10
10
  import { Subject } from "../../Subject";
11
- import { BaseItem } from "../BaseItem/BaseItem";
11
+ import { BaseItem, SerializedItemData } from "../BaseItem/BaseItem";
12
12
  export interface VideoItemData {
13
13
  itemType: "Video";
14
14
  url?: string;
@@ -17,6 +17,7 @@ export interface VideoItemData {
17
17
  isStorageUrl: boolean;
18
18
  previewUrl?: string;
19
19
  extension: string;
20
+ [key: string]: unknown;
20
21
  }
21
22
  export interface Dimension {
22
23
  height: number;
@@ -33,6 +34,9 @@ export declare class VideoItem extends BaseItem {
33
34
  private extension;
34
35
  readonly itemType = "Video";
35
36
  parent: string;
37
+ private url;
38
+ private previewUrl;
39
+ private isStorageUrl;
36
40
  preview: HTMLImageElement;
37
41
  readonly transformation: Transformation;
38
42
  readonly linkTo: LinkTo;
@@ -40,9 +44,6 @@ export declare class VideoItem extends BaseItem {
40
44
  loadCallbacks: ((video: VideoItem) => void)[];
41
45
  beforeLoadCallbacks: ((video: VideoItem) => void)[];
42
46
  transformationRenderBlock?: boolean;
43
- private url;
44
- private previewUrl;
45
- private isStorageUrl;
46
47
  videoDimension: Dimension;
47
48
  board: Board;
48
49
  private isPlaying;
@@ -80,8 +81,8 @@ export declare class VideoItem extends BaseItem {
80
81
  updateMbr(): void;
81
82
  render(context: DrawingContext): void;
82
83
  renderHTML(documentFactory: DocumentFactory): HTMLElement;
83
- serialize(): VideoItemData;
84
- deserialize(data: Partial<VideoItemData>): VideoItem;
84
+ serialize(): SerializedItemData<VideoItemData>;
85
+ deserialize(data: SerializedItemData<VideoItemData> | VideoItemData): this;
85
86
  apply(op: Operation): void;
86
87
  emit(operation: Operation): void;
87
88
  setId(id: string): this;
@@ -20,6 +20,8 @@ export * from "./Image";
20
20
  export * from "./Drawing";
21
21
  export * from "./Placeholder";
22
22
  export * from "./Group";
23
+ export { BaseItem } from "./BaseItem";
24
+ export type { BaseItemData, SerializedItemData } from "./BaseItem";
23
25
  export type { Item, ItemType, ItemData } from "./Item";
24
26
  export { registerItem } from "./RegisterItem";
25
27
  export { Star } from "./Examples/Star";
@@ -1,4 +1,5 @@
1
1
  import type { SelectionContext } from "../Selection/Selection";
2
+ import { Board } from '../Board';
2
3
  import hotkeys from "hotkeys.json";
3
4
  export type Hotkey = {
4
5
  key: {
@@ -13,7 +14,7 @@ export type Hotkey = {
13
14
  };
14
15
  };
15
16
  export type HotkeyName = keyof typeof hotkeys;
16
- export type HotkeyCb = (event?: KeyboardEvent) => void;
17
+ export type HotkeyCb = (event?: KeyboardEvent, board?: Board) => void;
17
18
  export type HotkeyConfig = {
18
19
  cb: HotkeyCb;
19
20
  selectionContext?: SelectionContext[];
@@ -1,7 +1,8 @@
1
1
  import { Board } from "../Board";
2
- import { Item, RichText, Mbr, ItemData } from "../Items";
2
+ import { Item, BaseItem, RichText, Mbr, ItemData } from "../Items";
3
3
  import { AINode } from "../Items/AINode";
4
4
  import { HorisontalAlignment, VerticalAlignment } from "../Items/Alignment";
5
+ import { ColorValue } from "../..";
5
6
  import { ConnectorLineStyle } from "../Items/Connector";
6
7
  import { ConnectorPointerStyle } from "../Items/Connector/Pointers/Pointers";
7
8
  import { DrawingContext } from "../Items/DrawingContext";
@@ -15,7 +16,6 @@ import { Tool } from "../Tools/Tool";
15
16
  import { QuickAddButtons } from "./QuickAddButtons";
16
17
  import { SelectionItems } from "./SelectionItems";
17
18
  import { BaseSelection, BaseRange } from "slate";
18
- import { BaseItem } from "../Items/BaseItem";
19
19
  export type SelectionContext = "SelectUnderPointer" | "HoverUnderPointer" | "EditUnderPointer" | "EditTextUnderPointer" | "SelectByRect" | "None";
20
20
  type SelectionSnapshot = {
21
21
  selectedItems: string;
@@ -106,14 +106,14 @@ export declare class BoardSelection {
106
106
  isTextEmpty(): boolean;
107
107
  getAutosize(): boolean;
108
108
  getFontSize(biggest?: boolean): number;
109
- getFontHighlight(): string;
110
- getFontColor(): string;
111
- getFillColor(): string;
109
+ getFontHighlight(): ColorValue | string;
110
+ getFontColor(): ColorValue | string;
111
+ getFillColor(): ColorValue | string;
112
112
  getBorderStyle(): string;
113
- getStrokeColor(): string;
113
+ getStrokeColor(): ColorValue | string;
114
114
  getStrokeWidth(): number;
115
115
  getConnectorLineWidth(): number;
116
- getConnectorLineColor(): string;
116
+ getConnectorLineColor(): ColorValue | string;
117
117
  getStartPointerStyle(): ConnectorPointerStyle;
118
118
  getEndPointerStyle(): ConnectorPointerStyle;
119
119
  setStartPointerStyle(style: ConnectorPointerStyle): void;
@@ -1,5 +1,5 @@
1
1
  import { Point, Mbr } from "../../../Items";
2
- import { ResizeType } from "../TransformerHelpers/getResizeType.ts";
2
+ import { ResizeType } from "../TransformerHelpers/getResizeType";
3
3
  /**
4
4
  * A funciton to get the resize type of a text item.
5
5
  * A text item does not have top and bottom anchors.
@@ -1,3 +1,3 @@
1
- import { ResizeType } from "./getResizeType.ts";
1
+ import { ResizeType } from "./getResizeType";
2
2
  export type AnchorType = "default" | "nw-resize" | "n-resize" | "ne-resize" | "e-resize" | "se-resize" | "s-resize" | "sw-resize" | "w-resize";
3
3
  export declare function getAnchorFromResizeType(resizeType?: ResizeType): AnchorType;
@@ -1,3 +1,3 @@
1
1
  import { Mbr, Point } from "../../../Items/index";
2
- import { ResizeType } from "./getResizeType.ts";
2
+ import { ResizeType } from "./getResizeType";
3
3
  export declare function getOppositePoint(resizeType: ResizeType, mbr: Mbr): Point;
@@ -1,5 +1,5 @@
1
1
  import { Point, Mbr, Matrix } from "../../../Items/index";
2
- import { ResizeType } from "./getResizeType.ts";
2
+ import { ResizeType } from "./getResizeType";
3
3
  export declare function getResize(resizeType: ResizeType, pointer: Point, mbr: Mbr, opposite: Point): {
4
4
  matrix: Matrix;
5
5
  mbr: Mbr;
@@ -1,3 +1,3 @@
1
1
  import { Point, Mbr } from "../../../Items/index";
2
- import { ResizeType } from "./getResizeType.ts";
2
+ import { ResizeType } from "./getResizeType";
3
3
  export declare function getResizedMbr(resizeType: ResizeType, pointer: Point, mbr: Mbr, opposite: Point): Mbr;
@@ -5,6 +5,7 @@ import { MockDocumentFactory } from "./api/MockDocumentFactory";
5
5
  import { MockPath2D } from "./api/MockPath2D";
6
6
  import type { BorderStyle } from "./Items/Path/Path";
7
7
  import type { Theme, ColorValue } from "./Color/ColorValue";
8
+ export type { Theme, ColorValue };
8
9
  export interface Connection {
9
10
  connectionId: number;
10
11
  getCurrentUser: () => string;
@@ -261,4 +262,3 @@ export declare const conf: {
261
262
  GRAVITY_MAX_DISTANCE: number;
262
263
  };
263
264
  export type Settings = typeof conf;
264
- export {};
@@ -12,7 +12,7 @@ export declare class AddDrawing extends BoardTool {
12
12
  strokeColor: ColorValue | string;
13
13
  strokeStyle: BorderStyle;
14
14
  constructor(board: Board);
15
- private updateSettings;
15
+ protected updateSettings(): void;
16
16
  setStrokeWidth(strokeWidth: number): void;
17
17
  setStrokeColor(strokeColor: ColorValue | string): void;
18
18
  getStrokeWidth(): number;
@@ -10,5 +10,5 @@ export declare class AddHighlighter extends AddDrawing {
10
10
  constructor(board: Board);
11
11
  isHighlighter(): boolean;
12
12
  protected applyDrawingRole(drawing: Drawing): void;
13
- private updateSettings;
13
+ protected updateSettings(): void;
14
14
  }
@@ -26,7 +26,7 @@ export declare class Tools extends ToolContext {
26
26
  addRegisteredTool(toolName: string, clearSelection?: boolean): void;
27
27
  getAddRegisteredTool(toolName: string): Tool | undefined;
28
28
  setTool(tool: BoardTool): void;
29
- setBeforeNavigateMode(mode: any): void;
29
+ switchMode(mode: any): void;
30
30
  navigate(): void;
31
31
  getNavigate(): Navigate | undefined;
32
32
  select(clearSelection?: boolean): void;
@@ -1,9 +1,17 @@
1
1
  import { ItemType } from "./Items";
2
2
  import { ItemDataWithId } from "./Items/Item";
3
+ import { BaseItemData } from "./Items/BaseItem/BaseItem";
3
4
  type MapTagByType = Record<ItemType, string>;
4
5
  export declare const tagByType: MapTagByType;
5
6
  type TagFactories = {
6
- [K in keyof MapTagByType as MapTagByType[K]]: (el: HTMLElement) => ItemDataWithId;
7
+ [K in keyof MapTagByType as MapTagByType[K]]: (el: HTMLElement) => ItemDataWithId | {
8
+ data: BaseItemData & {
9
+ id: string;
10
+ };
11
+ childrenMap: {
12
+ [id: string]: ItemDataWithId;
13
+ };
14
+ };
7
15
  };
8
16
  export declare const parsersHTML: TagFactories;
9
17
  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.13.40",
3
+ "version": "0.13.41",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",