microboard-temp 0.14.6 → 0.14.8

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 (78) hide show
  1. package/dist/cjs/browser.js +51730 -55206
  2. package/dist/cjs/index.js +56611 -60082
  3. package/dist/cjs/node.js +69240 -72716
  4. package/dist/esm/browser.js +56097 -59510
  5. package/dist/esm/index.js +46761 -50169
  6. package/dist/esm/node.js +54324 -57731
  7. package/dist/types/Color/Color.schema.d.ts +21 -0
  8. package/dist/types/Events/BaseCommand.d.ts +4 -4
  9. package/dist/types/Events/EventsOperations.d.ts +9 -1
  10. package/dist/types/Events/MessageRouter/socketContract.d.ts +54 -54
  11. package/dist/types/Events/index.d.ts +1 -1
  12. package/dist/types/Items/AINode/AINode.d.ts +7 -1
  13. package/dist/types/Items/AINode/AINode.schema.d.ts +47 -0
  14. package/dist/types/Items/Audio/Audio.d.ts +4 -4
  15. package/dist/types/Items/Audio/Audio.schema.d.ts +15 -0
  16. package/dist/types/Items/BaseItem/BaseItem.d.ts +38 -10
  17. package/dist/types/Items/BaseItem/TransformContext.d.ts +40 -0
  18. package/dist/types/Items/BaseItem/toLocalTransformOp.d.ts +10 -0
  19. package/dist/types/Items/Comment/Comment.d.ts +7 -4
  20. package/dist/types/Items/Comment/Comment.schema.d.ts +51 -0
  21. package/dist/types/Items/Connector/Connector.d.ts +9 -12
  22. package/dist/types/Items/Connector/Connector.schema.d.ts +172 -0
  23. package/dist/types/Items/Connector/connectorOps.d.ts +0 -11
  24. package/dist/types/Items/Drawing/Drawing.d.ts +8 -5
  25. package/dist/types/Items/Drawing/Drawing.schema.d.ts +42 -0
  26. package/dist/types/Items/Drawing/index.d.ts +0 -1
  27. package/dist/types/Items/Examples/CardGame/Card/Card.d.ts +1 -1
  28. package/dist/types/Items/Examples/CardGame/Deck/Deck.d.ts +0 -1
  29. package/dist/types/Items/Examples/CardGame/Dice/Dice.d.ts +1 -1
  30. package/dist/types/Items/Examples/CardGame/Screen/Screen.d.ts +1 -1
  31. package/dist/types/Items/Examples/Star/Star.d.ts +3 -0
  32. package/dist/types/Items/Frame/Frame.d.ts +12 -13
  33. package/dist/types/Items/Frame/Frame.schema.d.ts +84 -0
  34. package/dist/types/Items/Geometry.d.ts +4 -0
  35. package/dist/types/Items/Group/Group.d.ts +4 -4
  36. package/dist/types/Items/Group/Group.schema.d.ts +16 -0
  37. package/dist/types/Items/Image/Image.d.ts +4 -5
  38. package/dist/types/Items/Image/Image.schema.d.ts +23 -0
  39. package/dist/types/Items/Item.d.ts +1 -1
  40. package/dist/types/Items/Mbr/Mbr.d.ts +0 -1
  41. package/dist/types/Items/Placeholder/Placeholder.d.ts +7 -8
  42. package/dist/types/Items/Placeholder/Placeholder.schema.d.ts +16 -0
  43. package/dist/types/Items/Point/Point.schema.d.ts +6 -0
  44. package/dist/types/Items/RegisterItem.d.ts +5 -3
  45. package/dist/types/Items/Renderers/index.d.ts +1 -0
  46. package/dist/types/Items/RichText/RichText.d.ts +13 -12
  47. package/dist/types/Items/RichText/RichText.schema.d.ts +77 -0
  48. package/dist/types/Items/Shape/Shape.d.ts +13 -12
  49. package/dist/types/Items/Shape/Shape.schema.d.ts +81 -0
  50. package/dist/types/Items/Shape/ShapeData.d.ts +1 -1
  51. package/dist/types/Items/Shape/index.d.ts +0 -1
  52. package/dist/types/Items/Sticker/Sticker.d.ts +5 -5
  53. package/dist/types/Items/Sticker/Sticker.schema.d.ts +57 -0
  54. package/dist/types/Items/Sticker/index.d.ts +0 -1
  55. package/dist/types/Items/Transformation/Transformation.schema.d.ts +10 -0
  56. package/dist/types/Items/Video/Video.d.ts +5 -6
  57. package/dist/types/Items/Video/Video.schema.d.ts +25 -0
  58. package/dist/types/Items/index.d.ts +0 -3
  59. package/dist/types/Items/itemSchemas.d.ts +2 -0
  60. package/dist/types/Items/propertyOps.d.ts +9 -0
  61. package/dist/types/RegistryMaps.d.ts +32 -0
  62. package/dist/types/Selection/Transformer/TransformerHelpers/getResizeType.d.ts +2 -1
  63. package/dist/types/Selection/Transformer/TransformerHelpers/handleMultipleItemsResize.d.ts +1 -1
  64. package/dist/types/Selection/Transformer/TransformerHelpers/transformAINode.d.ts +2 -2
  65. package/dist/types/Selection/Transformer/TransformerHelpers/transformItems.d.ts +1 -1
  66. package/dist/types/Selection/Transformer/TransformerHelpers/transformRichText.d.ts +3 -3
  67. package/dist/types/Selection/Transformer/TransformerHelpers/transformShape.d.ts +5 -5
  68. package/dist/types/Tools/Tools.d.ts +2 -3
  69. package/dist/types/Validators/Validators.d.ts +3 -1
  70. package/dist/types/itemFactories.d.ts +21 -34
  71. package/dist/types/parserHTML.d.ts +2 -2
  72. package/package.json +1 -1
  73. package/dist/types/Items/Audio/audioOps.d.ts +0 -5
  74. package/dist/types/Items/Drawing/drawingOps.d.ts +0 -14
  75. package/dist/types/Items/Image/imageOps.d.ts +0 -5
  76. package/dist/types/Items/Shape/shapeOps.d.ts +0 -19
  77. package/dist/types/Items/Sticker/stickerOps.d.ts +0 -9
  78. package/dist/types/Items/Video/videoOps.d.ts +0 -9
@@ -1,4 +1,4 @@
1
- import { Events, Operation } from "../../Events";
1
+ import type { Operation } from "../../Events";
2
2
  import { Subject } from "../../Subject";
3
3
  import { DrawingContext } from "../DrawingContext";
4
4
  import { Path } from "../Path/Path";
@@ -27,7 +27,6 @@ export interface ImageConstructorData {
27
27
  imageDimension: Dimension;
28
28
  }
29
29
  export declare class ImageItem extends BaseItem<ImageItem> {
30
- private events?;
31
30
  readonly itemType = "Image";
32
31
  parent: string;
33
32
  image: HTMLImageElement;
@@ -35,11 +34,10 @@ export declare class ImageItem extends BaseItem<ImageItem> {
35
34
  loadCallbacks: ((image: ImageItem) => void)[];
36
35
  beforeLoadCallbacks: ((image: ImageItem) => void)[];
37
36
  transformationRenderBlock?: boolean;
37
+ imageDimension: Dimension;
38
38
  private storageLink;
39
39
  private signedUrl;
40
- imageDimension: Dimension;
41
- board: Board;
42
- constructor({ base64, storageLink, imageDimension }: ImageConstructorData, board: Board, events?: Events | undefined, id?: string);
40
+ constructor(board: Board, id?: string);
43
41
  private setImage;
44
42
  private setStorageLink;
45
43
  getStorageId(): string | undefined;
@@ -67,3 +65,4 @@ export declare class ImageItem extends BaseItem<ImageItem> {
67
65
  download(): void;
68
66
  onRemove(): void;
69
67
  }
68
+ export declare const DefaultImageItemData: ImageItemData;
@@ -0,0 +1,23 @@
1
+ import { z } from "zod";
2
+ export declare const DimensionSchema: z.ZodObject<{
3
+ height: z.ZodNumber;
4
+ width: z.ZodNumber;
5
+ }, z.core.$strip>;
6
+ export declare const ImageItemDataSchema: z.ZodObject<{
7
+ itemType: z.ZodLiteral<"Image">;
8
+ storageLink: z.ZodString;
9
+ imageDimension: z.ZodObject<{
10
+ height: z.ZodNumber;
11
+ width: z.ZodNumber;
12
+ }, z.core.$strip>;
13
+ transformation: z.ZodObject<{
14
+ translateX: z.ZodNumber;
15
+ translateY: z.ZodNumber;
16
+ scaleX: z.ZodNumber;
17
+ scaleY: z.ZodNumber;
18
+ rotate: z.ZodNumber;
19
+ isLocked: z.ZodOptional<z.ZodBoolean>;
20
+ }, z.core.$strip>;
21
+ linkTo: z.ZodOptional<z.ZodString>;
22
+ }, z.core.$strip>;
23
+ export type ImageItemData = z.infer<typeof ImageItemDataSchema>;
@@ -14,7 +14,7 @@ import type { StickerData } from "./Sticker/StickerOperation";
14
14
  import type { VideoItem, VideoItemData } from "./Video";
15
15
  import type { BaseItem, SerializedItemData } from "./BaseItem/BaseItem";
16
16
  export type Item = RichText | Shape | Connector | ImageItem | Drawing | Sticker | Frame | Placeholder | Comment | Group | AINode | VideoItem | AudioItem | BaseItem;
17
- export type ItemType = Item["itemType"];
17
+ export type ItemType = "RichText" | "Shape" | "Connector" | "Image" | "ImageItem" | "Drawing" | "Sticker" | "Frame" | "Placeholder" | "Comment" | "Group" | "AINode" | "Video" | "VideoItem" | "Audio" | "AudioItem" | "BaseItem" | "Eraser" | "Card" | "Deck" | "Dice" | "Star" | (string & {});
18
18
  export type ItemData = ShapeData | RichTextData | ConnectorData | ImageItemData | DrawingData | StickerData | FrameData | PlaceholderData | CommentData | GroupData | AINodeData | VideoItemData | AudioItemData | SerializedItemData;
19
19
  export type ItemDataWithId = ItemData & {
20
20
  id: string;
@@ -57,7 +57,6 @@ export declare class Mbr implements Geometry {
57
57
  isUnderPoint(point: Point): boolean;
58
58
  isNearPoint(point: Point, distance: number): boolean;
59
59
  getNormal(point: Point): GeometricNormal;
60
- updatePath(): void;
61
60
  getRichText(): RichText | null;
62
61
  render(context: DrawingContext): void;
63
62
  }
@@ -1,4 +1,4 @@
1
- import { Events, Operation } from "../../Events";
1
+ import type { Operation } from "../../Events";
2
2
  import { DrawingContext } from "../DrawingContext";
3
3
  import { ShapeType } from "../Shape/index";
4
4
  import { ResizeType } from "../../Selection/Transformer/TransformerHelpers/getResizeType";
@@ -24,19 +24,17 @@ export interface PlaceholderData {
24
24
  [key: string]: unknown;
25
25
  }
26
26
  export declare class Placeholder extends BaseItem<Placeholder> {
27
- private events?;
28
- private miroData?;
29
- backgroundColor: string;
30
- private icon;
31
27
  readonly itemType = "Placeholder";
32
28
  shapeType: ShapeType;
33
29
  parent: string;
34
30
  private path;
35
- private mbr;
36
31
  readonly subject: Subject<Placeholder>;
37
32
  transformationRenderBlock?: boolean;
38
33
  iconImage?: HTMLImageElement;
39
- constructor(board: Board, events?: Events | undefined, miroData?: unknown | undefined, id?: string, backgroundColor?: string, icon?: string);
34
+ private miroData?;
35
+ backgroundColor: string;
36
+ private icon;
37
+ constructor(board: Board, id?: string);
40
38
  emit(operation: PlaceholderOperation): void;
41
39
  serialize(): SerializedItemData<PlaceholderData>;
42
40
  deserialize(data: SerializedItemData<PlaceholderData> | PlaceholderData): this;
@@ -55,7 +53,6 @@ export declare class Placeholder extends BaseItem<Placeholder> {
55
53
  setMiroData(miroData: unknown): void;
56
54
  getIntersectionPoints(segment: Line): Point[];
57
55
  updateMbr(): Mbr;
58
- getMbr(): Mbr;
59
56
  getNearestEdgePointTo(point: Point): Point;
60
57
  getDistanceToPoint(point: Point): number;
61
58
  isUnderPoint(point: Point): boolean;
@@ -79,6 +76,8 @@ export declare class Placeholder extends BaseItem<Placeholder> {
79
76
  private renderIcon;
80
77
  private renderShadowShape;
81
78
  render(context: DrawingContext): void;
79
+ isReady(): boolean;
82
80
  getLinkTo(): undefined;
83
81
  getRichText(): null;
84
82
  }
83
+ export declare const DefaultPlaceholderData: PlaceholderData;
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ export declare const PlaceholderDataSchema: z.ZodObject<{
3
+ itemType: z.ZodLiteral<"Placeholder">;
4
+ backgroundColor: z.ZodString;
5
+ icon: z.ZodString;
6
+ transformation: z.ZodObject<{
7
+ translateX: z.ZodNumber;
8
+ translateY: z.ZodNumber;
9
+ scaleX: z.ZodNumber;
10
+ scaleY: z.ZodNumber;
11
+ rotate: z.ZodNumber;
12
+ isLocked: z.ZodOptional<z.ZodBoolean>;
13
+ }, z.core.$strip>;
14
+ miroData: z.ZodOptional<z.ZodUnknown>;
15
+ }, z.core.$strip>;
16
+ export type PlaceholderData = z.infer<typeof PlaceholderDataSchema>;
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ export declare const PointSchema: z.ZodObject<{
3
+ x: z.ZodNumber;
4
+ y: z.ZodNumber;
5
+ }, z.core.$strip>;
6
+ export type PointData = z.infer<typeof PointSchema>;
@@ -1,7 +1,8 @@
1
+ import { z } from "zod";
1
2
  import { Board } from "../Board";
2
3
  import { CustomTool } from "../Tools/CustomTool";
3
- import { BaseItemData } from "./BaseItem/BaseItem";
4
- type ItemConstructor = new (board: Board, id: string, defaultData: BaseItemData) => any;
4
+ import { BaseItem, BaseItemData } from "./BaseItem/BaseItem";
5
+ type ItemConstructor = new (board: Board, id: string) => BaseItem;
5
6
  type RegisterItemArgs = {
6
7
  item: ItemConstructor;
7
8
  defaultData: BaseItemData;
@@ -9,8 +10,9 @@ type RegisterItemArgs = {
9
10
  name: string;
10
11
  tool: typeof CustomTool;
11
12
  };
13
+ schema?: z.ZodType<any>;
12
14
  };
13
- export declare function registerItem({ item, defaultData, toolData, }: RegisterItemArgs): void;
15
+ export declare function registerItem({ item, defaultData, toolData, schema, }: RegisterItemArgs): void;
14
16
  export declare function registerTool(toolData: {
15
17
  name: string;
16
18
  tool: typeof CustomTool;
@@ -11,3 +11,4 @@ export * from "./DrawingHTMLRenderer";
11
11
  export * from "./CommentHTMLRenderer";
12
12
  export * from "./AINodeHTMLRenderer";
13
13
  export * from "./PlaceholderHTMLRenderer";
14
+ export * from "./StickerHTMLRenderer";
@@ -2,7 +2,6 @@ import type { Board } from "../../Board";
2
2
  import { Camera } from "../../Camera";
3
3
  import type { Operation } from "../../Events";
4
4
  import type { SelectionContext } from "../../Selection";
5
- import { DefaultTextStyles } from "../../Settings";
6
5
  import { Subject } from "../../Subject";
7
6
  import { BaseRange, BaseSelection, Descendant, Operation as SlateOp } from "slate";
8
7
  import { ItemType } from "../Item";
@@ -10,10 +9,10 @@ import { Matrix } from "../Transformation/Matrix";
10
9
  import { Mbr } from "../Mbr/Mbr";
11
10
  import { Point } from "../Point/Point";
12
11
  import { RichTextData } from "./RichTextData";
13
- import { Transformation } from "../Transformation/Transformation";
14
12
  import { HorisontalAlignment, VerticalAlignment } from "../Alignment";
15
13
  import { DrawingContext } from "../DrawingContext";
16
- import { LinkTo } from "../LinkTo/LinkTo";
14
+ import { TransformParams, TransformResult } from "../BaseItem/TransformContext";
15
+ import { ResizeType } from "../../Selection/Transformer/TransformerHelpers/getResizeType";
17
16
  import { LayoutBlockNodes } from "./CanvasText/LayoutBlockNodes";
18
17
  import { BlockNode, BlockType } from "./Editor/BlockNode";
19
18
  import { TextStyle } from "./Editor/TextNode";
@@ -26,13 +25,6 @@ import type { SerializedItemData } from "../BaseItem/BaseItem";
26
25
  *
27
26
  */
28
27
  export declare class RichText extends BaseItem<RichText> {
29
- container: Mbr;
30
- readonly transformation: Transformation;
31
- placeholderText: string;
32
- isInShape: boolean;
33
- private autoSize;
34
- insideOf?: ItemType | undefined;
35
- private initialTextStyles;
36
28
  readonly itemType = "RichText";
37
29
  parent: string;
38
30
  readonly subject: Subject<RichText>;
@@ -46,7 +38,6 @@ export declare class RichText extends BaseItem<RichText> {
46
38
  private updateRequired;
47
39
  private autoSizeScale;
48
40
  private containerMaxWidth?;
49
- readonly linkTo: LinkTo;
50
41
  maxHeight: number;
51
42
  private selection?;
52
43
  transformationRenderBlock?: boolean;
@@ -59,7 +50,14 @@ export declare class RichText extends BaseItem<RichText> {
59
50
  customTransformationMatrix?: () => Matrix;
60
51
  renderingScale?: (cameraScale: number) => number;
61
52
  rtCounter: number;
62
- constructor(board: Board, container: Mbr, id?: string, transformation?: Transformation, linkTo?: LinkTo, placeholderText?: string, isInShape?: boolean, autoSize?: boolean, insideOf?: ItemType | undefined, initialTextStyles?: DefaultTextStyles);
53
+ container: Mbr;
54
+ placeholderText: string;
55
+ isInShape: boolean;
56
+ private autoSize;
57
+ insideOf?: ItemType;
58
+ private initialTextStyles;
59
+ constructor(board: Board, id?: string);
60
+ updateShrinkWidth(): void;
63
61
  isClosed(): boolean;
64
62
  private setAINodeShirkWidth;
65
63
  getBlockNodes(): BlockNode[];
@@ -155,4 +153,7 @@ export declare class RichText extends BaseItem<RichText> {
155
153
  getRichText(): RichText;
156
154
  getLinkTo(): string | undefined;
157
155
  getPrevMbr(): Mbr | null;
156
+ getPointOnEdge(point: Point, edge?: string): Point;
157
+ handleTransform(params: TransformParams): TransformResult;
158
+ getResizeType(point: Point, cameraScale: number, mbr: Mbr, anchorDistance?: number): ResizeType | undefined;
158
159
  }
@@ -0,0 +1,77 @@
1
+ import { z } from "zod";
2
+ export declare const TextNodeSchema: z.ZodObject<{
3
+ text: z.ZodString;
4
+ bold: z.ZodOptional<z.ZodBoolean>;
5
+ italic: z.ZodOptional<z.ZodBoolean>;
6
+ underline: z.ZodOptional<z.ZodBoolean>;
7
+ strikethrough: z.ZodOptional<z.ZodBoolean>;
8
+ code: z.ZodOptional<z.ZodBoolean>;
9
+ color: z.ZodOptional<z.ZodString>;
10
+ fontSize: z.ZodOptional<z.ZodNumber>;
11
+ }, z.core.$strip>;
12
+ export declare const ParagraphNodeSchema: z.ZodObject<{
13
+ type: z.ZodLiteral<"paragraph">;
14
+ children: z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
15
+ align: z.ZodOptional<z.ZodEnum<{
16
+ center: "center";
17
+ left: "left";
18
+ right: "right";
19
+ justify: "justify";
20
+ }>>;
21
+ }, z.core.$strip>;
22
+ export declare const CodeBlockNodeSchema: z.ZodObject<{
23
+ type: z.ZodLiteral<"code_block">;
24
+ children: z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
25
+ }, z.core.$strip>;
26
+ export declare const HeadingNodeSchema: z.ZodObject<{
27
+ type: z.ZodEnum<{
28
+ heading_one: "heading_one";
29
+ heading_two: "heading_two";
30
+ heading_three: "heading_three";
31
+ heading_four: "heading_four";
32
+ heading_five: "heading_five";
33
+ }>;
34
+ children: z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
35
+ }, z.core.$strip>;
36
+ export declare const BlockQuoteNodeSchema: z.ZodObject<{
37
+ type: z.ZodLiteral<"block-quote">;
38
+ children: z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
39
+ }, z.core.$strip>;
40
+ export declare const ListItemNodeSchema: z.ZodObject<{
41
+ type: z.ZodLiteral<"list_item">;
42
+ children: z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
43
+ }, z.core.$strip>;
44
+ export declare const BulletedListNodeSchema: z.ZodObject<{
45
+ type: z.ZodLiteral<"ul_list">;
46
+ children: z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
47
+ }, z.core.$strip>;
48
+ export declare const NumberedListNodeSchema: z.ZodObject<{
49
+ type: z.ZodLiteral<"ol_list">;
50
+ children: z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
51
+ }, z.core.$strip>;
52
+ export declare const DescendantSchema: z.ZodType<any>;
53
+ export declare const RichTextDataSchema: z.ZodObject<{
54
+ itemType: z.ZodOptional<z.ZodLiteral<"RichText">>;
55
+ children: z.ZodArray<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>;
56
+ verticalAlignment: z.ZodOptional<z.ZodEnum<{
57
+ center: "center";
58
+ top: "top";
59
+ bottom: "bottom";
60
+ }>>;
61
+ maxWidth: z.ZodOptional<z.ZodNumber>;
62
+ transformation: z.ZodOptional<z.ZodObject<{
63
+ translateX: z.ZodNumber;
64
+ translateY: z.ZodNumber;
65
+ scaleX: z.ZodNumber;
66
+ scaleY: z.ZodNumber;
67
+ rotate: z.ZodNumber;
68
+ isLocked: z.ZodOptional<z.ZodBoolean>;
69
+ }, z.core.$strip>>;
70
+ containerMaxWidth: z.ZodOptional<z.ZodNumber>;
71
+ insideOf: z.ZodOptional<z.ZodString>;
72
+ color: z.ZodOptional<z.ZodString>;
73
+ placeholderText: z.ZodOptional<z.ZodString>;
74
+ realSize: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodNumber]>>;
75
+ linkTo: z.ZodOptional<z.ZodString>;
76
+ }, z.core.$strip>;
77
+ export type RichTextData = z.infer<typeof RichTextDataSchema>;
@@ -8,15 +8,16 @@ import { ShapeType } from "./index";
8
8
  import { BorderStyle, BorderWidth } from "../Path";
9
9
  import { RichText } from "../RichText";
10
10
  import { ShapeOperation } from "./ShapeOperation";
11
- import { ShapeData } from "./ShapeData";
12
11
  import { DrawingContext } from "../DrawingContext";
13
- import { Operation } from "../../Events";
12
+ import { Operation } from "../../Events/EventsOperations";
13
+ import { ShapeData } from "./ShapeData";
14
14
  import { GeometricNormal } from "../GeometricNormal";
15
15
  import { ResizeType } from "../../Selection/Transformer/TransformerHelpers/getResizeType";
16
16
  import { Board } from "../../Board";
17
17
  import { Subject } from "../../Subject";
18
18
  import { BaseItem, SerializedItemData } from "../BaseItem/BaseItem";
19
19
  import { ColorValue } from "../../..";
20
+ import { TransformParams, TransformResult } from "../BaseItem/TransformContext";
20
21
  export declare const Shapes: {
21
22
  BPMN_Gateway: {
22
23
  name: string;
@@ -348,14 +349,6 @@ export declare const Shapes: {
348
349
  };
349
350
  };
350
351
  export declare class Shape extends BaseItem<Shape> {
351
- shapeType: ShapeType;
352
- backgroundColor: ColorValue;
353
- backgroundOpacity: number;
354
- borderColor: ColorValue;
355
- borderOpacity: number;
356
- borderStyle: "solid" | "dot" | "dash" | "longDash" | "dotDash" | "tripleDotDash" | "looseDoubleDotDash";
357
- borderWidth: number;
358
- private mbr;
359
352
  readonly itemType = "Shape";
360
353
  parent: string;
361
354
  private path;
@@ -363,7 +356,14 @@ export declare class Shape extends BaseItem<Shape> {
363
356
  readonly text: RichText;
364
357
  readonly subject: Subject<Shape>;
365
358
  transformationRenderBlock?: boolean;
366
- 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);
359
+ shapeType: ShapeType;
360
+ backgroundColor: ColorValue;
361
+ backgroundOpacity: number;
362
+ borderColor: ColorValue;
363
+ borderOpacity: number;
364
+ borderStyle: "solid" | "dot" | "dash" | "longDash" | "dotDash" | "tripleDotDash" | "looseDoubleDotDash";
365
+ borderWidth: number;
366
+ constructor(board: Board, id?: string);
367
367
  private saveShapeData;
368
368
  emit(operation: ShapeOperation): void;
369
369
  serialize(): SerializedItemData<ShapeData>;
@@ -372,6 +372,7 @@ export declare class Shape extends BaseItem<Shape> {
372
372
  protected onParentChanged(newParent: string): void;
373
373
  getId(): string;
374
374
  apply(op: Operation): void;
375
+ protected onPropertyUpdated(property: string, value: any, prevValue: any): void;
375
376
  private applyShapeOperation;
376
377
  getShapeType(): ShapeType;
377
378
  getLinkTo(): string | undefined;
@@ -392,7 +393,6 @@ export declare class Shape extends BaseItem<Shape> {
392
393
  private applyBorderWidth;
393
394
  getIntersectionPoints(segment: Line): Point[];
394
395
  updateMbr(): Mbr;
395
- getMbr(): Mbr;
396
396
  getPathMbr(): Mbr;
397
397
  getNearestEdgePointTo(point: Point): Point;
398
398
  getDistanceToPoint(point: Point): number;
@@ -417,4 +417,5 @@ export declare class Shape extends BaseItem<Shape> {
417
417
  getRichText(): RichText;
418
418
  getIsShapeWithText(): boolean;
419
419
  getIsBorderStyleEditable(): boolean;
420
+ handleTransform(params: TransformParams): TransformResult;
420
421
  }
@@ -0,0 +1,81 @@
1
+ import { z } from "zod";
2
+ export declare const ShapeDataSchema: z.ZodObject<{
3
+ itemType: z.ZodLiteral<"Shape">;
4
+ shapeType: z.ZodString;
5
+ backgroundColor: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
6
+ type: z.ZodLiteral<"semantic">;
7
+ id: z.ZodEnum<{
8
+ contrastNeutral: "contrastNeutral";
9
+ contrastGray: "contrastGray";
10
+ contrastRed: "contrastRed";
11
+ contrastOrange: "contrastOrange";
12
+ contrastYellow: "contrastYellow";
13
+ contrastGreen: "contrastGreen";
14
+ contrastTeal: "contrastTeal";
15
+ contrastBlue: "contrastBlue";
16
+ contrastPurple: "contrastPurple";
17
+ contrastPink: "contrastPink";
18
+ contrastBrown: "contrastBrown";
19
+ }>;
20
+ }, z.core.$strip>, z.ZodObject<{
21
+ type: z.ZodLiteral<"fixed">;
22
+ value: z.ZodString;
23
+ }, z.core.$strip>]>;
24
+ backgroundOpacity: z.ZodNumber;
25
+ borderColor: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
26
+ type: z.ZodLiteral<"semantic">;
27
+ id: z.ZodEnum<{
28
+ contrastNeutral: "contrastNeutral";
29
+ contrastGray: "contrastGray";
30
+ contrastRed: "contrastRed";
31
+ contrastOrange: "contrastOrange";
32
+ contrastYellow: "contrastYellow";
33
+ contrastGreen: "contrastGreen";
34
+ contrastTeal: "contrastTeal";
35
+ contrastBlue: "contrastBlue";
36
+ contrastPurple: "contrastPurple";
37
+ contrastPink: "contrastPink";
38
+ contrastBrown: "contrastBrown";
39
+ }>;
40
+ }, z.core.$strip>, z.ZodObject<{
41
+ type: z.ZodLiteral<"fixed">;
42
+ value: z.ZodString;
43
+ }, z.core.$strip>]>;
44
+ borderOpacity: z.ZodNumber;
45
+ borderStyle: z.ZodString;
46
+ borderWidth: z.ZodNumber;
47
+ transformation: z.ZodObject<{
48
+ translateX: z.ZodNumber;
49
+ translateY: z.ZodNumber;
50
+ scaleX: z.ZodNumber;
51
+ scaleY: z.ZodNumber;
52
+ rotate: z.ZodNumber;
53
+ isLocked: z.ZodOptional<z.ZodBoolean>;
54
+ }, z.core.$strip>;
55
+ text: z.ZodObject<{
56
+ itemType: z.ZodOptional<z.ZodLiteral<"RichText">>;
57
+ children: z.ZodArray<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>;
58
+ verticalAlignment: z.ZodOptional<z.ZodEnum<{
59
+ center: "center";
60
+ top: "top";
61
+ bottom: "bottom";
62
+ }>>;
63
+ maxWidth: z.ZodOptional<z.ZodNumber>;
64
+ transformation: z.ZodOptional<z.ZodObject<{
65
+ translateX: z.ZodNumber;
66
+ translateY: z.ZodNumber;
67
+ scaleX: z.ZodNumber;
68
+ scaleY: z.ZodNumber;
69
+ rotate: z.ZodNumber;
70
+ isLocked: z.ZodOptional<z.ZodBoolean>;
71
+ }, z.core.$strip>>;
72
+ containerMaxWidth: z.ZodOptional<z.ZodNumber>;
73
+ insideOf: z.ZodOptional<z.ZodString>;
74
+ color: z.ZodOptional<z.ZodString>;
75
+ placeholderText: z.ZodOptional<z.ZodString>;
76
+ realSize: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodNumber]>>;
77
+ linkTo: z.ZodOptional<z.ZodString>;
78
+ }, z.core.$strip>;
79
+ linkTo: z.ZodOptional<z.ZodString>;
80
+ }, z.core.$strip>;
81
+ export type ShapeData = z.infer<typeof ShapeDataSchema>;
@@ -1,9 +1,9 @@
1
+ import { ColorValue } from "../../..";
1
2
  import { BorderStyle, BorderWidth } from "../Path";
2
3
  import { RichTextData } from "../RichText";
3
4
  import { DefaultRichTextData } from "../RichText/RichTextData";
4
5
  import { TransformationData, DefaultTransformationData } from "../Transformation";
5
6
  import { ShapeType } from "./index";
6
- import { ColorValue } from "../../..";
7
7
  export interface ShapeData {
8
8
  readonly itemType: "Shape";
9
9
  shapeType: ShapeType;
@@ -2,6 +2,5 @@ export { Shape, Shapes } from "./Shape";
2
2
  export { ShapeCommand } from "./ShapeCommand";
3
3
  export type { ShapeOperation } from "./ShapeOperation";
4
4
  export * from "./ShapeData";
5
- export { shapeOps } from "./shapeOps";
6
5
  export type { ShapeType } from "./ShapeType";
7
6
  export { DefaultShapeData } from "./ShapeData";
@@ -25,7 +25,6 @@ export declare const StickerShape: {
25
25
  DEFAULTS: number[];
26
26
  };
27
27
  export declare class Sticker extends BaseItem<Sticker> {
28
- backgroundColor: ColorValue;
29
28
  parent: string;
30
29
  readonly itemType = "Sticker";
31
30
  private stickerPath;
@@ -33,7 +32,8 @@ export declare class Sticker extends BaseItem<Sticker> {
33
32
  text: RichText;
34
33
  readonly subject: Subject<Sticker>;
35
34
  transformationRenderBlock?: boolean;
36
- constructor(board: Board, id?: string, backgroundColor?: ColorValue);
35
+ backgroundColor: ColorValue;
36
+ constructor(board: Board, id?: string);
37
37
  emit(operation: StickerOperation): void;
38
38
  saveStickerData(): void;
39
39
  serialize(): SerializedItemData<StickerData>;
@@ -43,12 +43,11 @@ export declare class Sticker extends BaseItem<Sticker> {
43
43
  protected onParentChanged(newParent: string): void;
44
44
  getId(): string;
45
45
  apply(op: Operation): void;
46
- private applyStickerOperation;
46
+ protected onPropertyUpdated(property: string, value: unknown, prevValue: unknown): void;
47
47
  getBackgroundColor(): ColorValue;
48
+ setBackgroundColor(color: ColorValue | string): void;
48
49
  getWidth(): number;
49
- private applyBackgroundColor;
50
50
  getIntersectionPoints(segment: Line): Point[];
51
- getMbr(): Mbr;
52
51
  getNearestEdgePointTo(point: Point): Point;
53
52
  getDistanceToPoint(point: Point): number;
54
53
  isUnderPoint(point: Point): boolean;
@@ -71,6 +70,7 @@ export declare class Sticker extends BaseItem<Sticker> {
71
70
  matrix: Matrix;
72
71
  mbr: Mbr;
73
72
  };
73
+ getResizeType(point: Point, cameraScale: number, mbr: Mbr, anchorDistance?: number): ResizeType | undefined;
74
74
  getRichText(): RichText;
75
75
  getLinkTo(): string | undefined;
76
76
  }
@@ -0,0 +1,57 @@
1
+ import { z } from "zod";
2
+ export declare const StickerDataSchema: z.ZodObject<{
3
+ itemType: z.ZodLiteral<"Sticker">;
4
+ backgroundColor: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
5
+ type: z.ZodLiteral<"semantic">;
6
+ id: z.ZodEnum<{
7
+ contrastNeutral: "contrastNeutral";
8
+ contrastGray: "contrastGray";
9
+ contrastRed: "contrastRed";
10
+ contrastOrange: "contrastOrange";
11
+ contrastYellow: "contrastYellow";
12
+ contrastGreen: "contrastGreen";
13
+ contrastTeal: "contrastTeal";
14
+ contrastBlue: "contrastBlue";
15
+ contrastPurple: "contrastPurple";
16
+ contrastPink: "contrastPink";
17
+ contrastBrown: "contrastBrown";
18
+ }>;
19
+ }, z.core.$strip>, z.ZodObject<{
20
+ type: z.ZodLiteral<"fixed">;
21
+ value: z.ZodString;
22
+ }, z.core.$strip>]>;
23
+ transformation: z.ZodObject<{
24
+ translateX: z.ZodNumber;
25
+ translateY: z.ZodNumber;
26
+ scaleX: z.ZodNumber;
27
+ scaleY: z.ZodNumber;
28
+ rotate: z.ZodNumber;
29
+ isLocked: z.ZodOptional<z.ZodBoolean>;
30
+ }, z.core.$strip>;
31
+ text: z.ZodObject<{
32
+ itemType: z.ZodOptional<z.ZodLiteral<"RichText">>;
33
+ children: z.ZodArray<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>;
34
+ verticalAlignment: z.ZodOptional<z.ZodEnum<{
35
+ center: "center";
36
+ top: "top";
37
+ bottom: "bottom";
38
+ }>>;
39
+ maxWidth: z.ZodOptional<z.ZodNumber>;
40
+ transformation: z.ZodOptional<z.ZodObject<{
41
+ translateX: z.ZodNumber;
42
+ translateY: z.ZodNumber;
43
+ scaleX: z.ZodNumber;
44
+ scaleY: z.ZodNumber;
45
+ rotate: z.ZodNumber;
46
+ isLocked: z.ZodOptional<z.ZodBoolean>;
47
+ }, z.core.$strip>>;
48
+ containerMaxWidth: z.ZodOptional<z.ZodNumber>;
49
+ insideOf: z.ZodOptional<z.ZodString>;
50
+ color: z.ZodOptional<z.ZodString>;
51
+ placeholderText: z.ZodOptional<z.ZodString>;
52
+ realSize: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodNumber]>>;
53
+ linkTo: z.ZodOptional<z.ZodString>;
54
+ }, z.core.$strip>;
55
+ linkTo: z.ZodOptional<z.ZodString>;
56
+ }, z.core.$strip>;
57
+ export type StickerData = z.infer<typeof StickerDataSchema>;
@@ -1,3 +1,2 @@
1
1
  export * from "./Sticker";
2
2
  export * from "./StickerOperation";
3
- export * from "./stickerOps";
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ export declare const TransformationDataSchema: z.ZodObject<{
3
+ translateX: z.ZodNumber;
4
+ translateY: z.ZodNumber;
5
+ scaleX: z.ZodNumber;
6
+ scaleY: z.ZodNumber;
7
+ rotate: z.ZodNumber;
8
+ isLocked: z.ZodOptional<z.ZodBoolean>;
9
+ }, z.core.$strip>;
10
+ export type TransformationData = z.infer<typeof TransformationDataSchema>;
@@ -1,10 +1,10 @@
1
1
  import { Board } from "../../Board";
2
- import { Events, Operation } from "../../Events";
2
+ import type { Operation } from "../../Events";
3
3
  import { Point } from "../Point/Point";
4
4
  import { DrawingContext } from "../DrawingContext";
5
5
  import { Mbr } from "../Mbr";
6
6
  import { Path, Paths } from "../Path";
7
- import { TransformationData } from "../Transformation";
7
+ import { TransformationData } from "../Transformation/TransformationData";
8
8
  import { Subject } from "../../Subject";
9
9
  import { BaseItem, SerializedItemData } from "../BaseItem/BaseItem";
10
10
  export interface VideoItemData {
@@ -28,8 +28,6 @@ export interface VideoConstructorData {
28
28
  }
29
29
  export declare const createPlaceholderImage: (width: number, height: number) => HTMLImageElement;
30
30
  export declare class VideoItem extends BaseItem<VideoItem> {
31
- private events?;
32
- private extension;
33
31
  readonly itemType = "Video";
34
32
  parent: string;
35
33
  private url;
@@ -41,12 +39,12 @@ export declare class VideoItem extends BaseItem<VideoItem> {
41
39
  beforeLoadCallbacks: ((video: VideoItem) => void)[];
42
40
  transformationRenderBlock?: boolean;
43
41
  videoDimension: Dimension;
44
- board: Board;
45
42
  private isPlaying;
46
43
  private shouldShowControls;
47
44
  private playBtnMbr;
48
45
  private currentTime;
49
- constructor({ url, videoDimension, previewUrl }: VideoConstructorData, board: Board, events?: Events | undefined, id?: string, extension?: string);
46
+ private extension;
47
+ constructor(board: Board, id?: string);
50
48
  setCurrentTime(time: number): void;
51
49
  getCurrentTime(): number;
52
50
  doOnceBeforeOnLoad: (callback: (video: VideoItem) => void) => void;
@@ -83,3 +81,4 @@ export declare class VideoItem extends BaseItem<VideoItem> {
83
81
  download(): void;
84
82
  onRemove(): void;
85
83
  }
84
+ export declare const DefaultVideoItemData: VideoItemData;