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
@@ -0,0 +1,21 @@
1
+ import { z } from "zod";
2
+ export declare const ColorValueSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
3
+ type: z.ZodLiteral<"semantic">;
4
+ id: z.ZodEnum<{
5
+ contrastNeutral: "contrastNeutral";
6
+ contrastGray: "contrastGray";
7
+ contrastRed: "contrastRed";
8
+ contrastOrange: "contrastOrange";
9
+ contrastYellow: "contrastYellow";
10
+ contrastGreen: "contrastGreen";
11
+ contrastTeal: "contrastTeal";
12
+ contrastBlue: "contrastBlue";
13
+ contrastPurple: "contrastPurple";
14
+ contrastPink: "contrastPink";
15
+ contrastBrown: "contrastBrown";
16
+ }>;
17
+ }, z.core.$strip>, z.ZodObject<{
18
+ type: z.ZodLiteral<"fixed">;
19
+ value: z.ZodString;
20
+ }, z.core.$strip>]>;
21
+ export type ColorValueData = z.infer<typeof ColorValueSchema>;
@@ -1,17 +1,17 @@
1
1
  import type { Board } from "../Board";
2
- import { BaseOperation, Operation } from "./EventsOperations";
2
+ import { Operation } from "./EventsOperations";
3
3
  import { Command } from "./Command";
4
4
  export declare class BaseCommand implements Command {
5
5
  private board;
6
6
  itemIds: string[];
7
- operation: BaseOperation;
7
+ operation: Operation;
8
8
  private reverse;
9
- constructor(board: Board, itemIds: string[], operation: BaseOperation);
9
+ constructor(board: Board, itemIds: string[], operation: Operation);
10
10
  merge(op: Operation): this;
11
11
  apply(): void;
12
12
  revert(): void;
13
13
  getReverse(): {
14
14
  itemId: string;
15
- operation: BaseOperation;
15
+ operation: Operation;
16
16
  }[];
17
17
  }
@@ -31,7 +31,15 @@ export interface BaseOperation<T extends Record<string, unknown> = {}> {
31
31
  newData: T;
32
32
  prevData?: T;
33
33
  }
34
- export type ItemOperation = LinkToOperation | TransformationOperation | ShapeOperation | StickerOperation | RichTextOperation | ConnectorOperation | DrawingOperation | FrameOperation | PlaceholderOperation | GroupOperation | CommentOperation | ImageOperation | VideoOperation | AudioOperation;
34
+ export interface SetPropertyOperation {
35
+ class: "Item";
36
+ item: string[];
37
+ method: "setProperty";
38
+ property: string;
39
+ value: unknown;
40
+ prevValues: unknown[];
41
+ }
42
+ export type ItemOperation = LinkToOperation | TransformationOperation | ShapeOperation | StickerOperation | RichTextOperation | ConnectorOperation | DrawingOperation | FrameOperation | PlaceholderOperation | GroupOperation | CommentOperation | ImageOperation | VideoOperation | AudioOperation | SetPropertyOperation;
35
43
  export type UndoableOperation = BoardOps | ItemOperation;
36
44
  export type Operation = UndoableOperation | EventsOperation;
37
45
  export type MethodType = Operation["method"];
@@ -5345,9 +5345,9 @@ export declare const AiChatEventSchema: z.ZodUnion<readonly [z.ZodObject<{
5345
5345
  }, z.core.$loose>, z.ZodObject<{
5346
5346
  method: z.ZodLiteral<"GenerateImage">;
5347
5347
  status: z.ZodEnum<{
5348
+ error: "error";
5348
5349
  generating: "generating";
5349
5350
  completed: "completed";
5350
- error: "error";
5351
5351
  }>;
5352
5352
  message: z.ZodOptional<z.ZodString>;
5353
5353
  base64: z.ZodNullable<z.ZodString>;
@@ -5361,9 +5361,9 @@ export declare const AiChatEventSchema: z.ZodUnion<readonly [z.ZodObject<{
5361
5361
  }, z.core.$loose>, z.ZodObject<{
5362
5362
  method: z.ZodLiteral<"GenerateAudio">;
5363
5363
  status: z.ZodEnum<{
5364
+ error: "error";
5364
5365
  generating: "generating";
5365
5366
  completed: "completed";
5366
- error: "error";
5367
5367
  }>;
5368
5368
  message: z.ZodOptional<z.ZodString>;
5369
5369
  base64: z.ZodNullable<z.ZodString>;
@@ -9568,9 +9568,9 @@ export declare const AiChatMsgSchema: z.ZodObject<{
9568
9568
  }, z.core.$loose>, z.ZodObject<{
9569
9569
  method: z.ZodLiteral<"GenerateImage">;
9570
9570
  status: z.ZodEnum<{
9571
+ error: "error";
9571
9572
  generating: "generating";
9572
9573
  completed: "completed";
9573
- error: "error";
9574
9574
  }>;
9575
9575
  message: z.ZodOptional<z.ZodString>;
9576
9576
  base64: z.ZodNullable<z.ZodString>;
@@ -9584,9 +9584,9 @@ export declare const AiChatMsgSchema: z.ZodObject<{
9584
9584
  }, z.core.$loose>, z.ZodObject<{
9585
9585
  method: z.ZodLiteral<"GenerateAudio">;
9586
9586
  status: z.ZodEnum<{
9587
+ error: "error";
9587
9588
  generating: "generating";
9588
9589
  completed: "completed";
9589
- error: "error";
9590
9590
  }>;
9591
9591
  message: z.ZodOptional<z.ZodString>;
9592
9592
  base64: z.ZodNullable<z.ZodString>;
@@ -12161,9 +12161,9 @@ export declare const EventsMsgSchema: z.ZodUnion<readonly [z.ZodObject<{
12161
12161
  }, z.core.$loose>, z.ZodObject<{
12162
12162
  method: z.ZodLiteral<"GenerateImage">;
12163
12163
  status: z.ZodEnum<{
12164
+ error: "error";
12164
12165
  generating: "generating";
12165
12166
  completed: "completed";
12166
- error: "error";
12167
12167
  }>;
12168
12168
  message: z.ZodOptional<z.ZodString>;
12169
12169
  base64: z.ZodNullable<z.ZodString>;
@@ -12177,9 +12177,9 @@ export declare const EventsMsgSchema: z.ZodUnion<readonly [z.ZodObject<{
12177
12177
  }, z.core.$loose>, z.ZodObject<{
12178
12178
  method: z.ZodLiteral<"GenerateAudio">;
12179
12179
  status: z.ZodEnum<{
12180
+ error: "error";
12180
12181
  generating: "generating";
12181
12182
  completed: "completed";
12182
- error: "error";
12183
12183
  }>;
12184
12184
  message: z.ZodOptional<z.ZodString>;
12185
12185
  base64: z.ZodNullable<z.ZodString>;
@@ -13502,9 +13502,9 @@ export declare const SocketMsgSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [
13502
13502
  }, z.core.$loose>, z.ZodObject<{
13503
13503
  method: z.ZodLiteral<"GenerateImage">;
13504
13504
  status: z.ZodEnum<{
13505
+ error: "error";
13505
13506
  generating: "generating";
13506
13507
  completed: "completed";
13507
- error: "error";
13508
13508
  }>;
13509
13509
  message: z.ZodOptional<z.ZodString>;
13510
13510
  base64: z.ZodNullable<z.ZodString>;
@@ -13518,9 +13518,9 @@ export declare const SocketMsgSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [
13518
13518
  }, z.core.$loose>, z.ZodObject<{
13519
13519
  method: z.ZodLiteral<"GenerateAudio">;
13520
13520
  status: z.ZodEnum<{
13521
+ error: "error";
13521
13522
  generating: "generating";
13522
13523
  completed: "completed";
13523
- error: "error";
13524
13524
  }>;
13525
13525
  message: z.ZodOptional<z.ZodString>;
13526
13526
  base64: z.ZodNullable<z.ZodString>;
@@ -13681,7 +13681,7 @@ export declare function safeParseSocketMsg(data: unknown): z.ZodSafeParseResult<
13681
13681
  } | {
13682
13682
  [x: string]: unknown;
13683
13683
  method: "GenerateImage";
13684
- status: "generating" | "completed" | "error";
13684
+ status: "error" | "generating" | "completed";
13685
13685
  base64: string | null;
13686
13686
  imageUrl: string | null;
13687
13687
  itemId: string;
@@ -13695,7 +13695,7 @@ export declare function safeParseSocketMsg(data: unknown): z.ZodSafeParseResult<
13695
13695
  } | {
13696
13696
  [x: string]: unknown;
13697
13697
  method: "GenerateAudio";
13698
- status: "generating" | "completed" | "error";
13698
+ status: "error" | "generating" | "completed";
13699
13699
  base64: string | null;
13700
13700
  audioUrl: string | null;
13701
13701
  message?: string | undefined;
@@ -13774,11 +13774,12 @@ export declare function safeParseSocketMsg(data: unknown): z.ZodSafeParseResult<
13774
13774
  event: {
13775
13775
  [x: string]: unknown;
13776
13776
  order: number;
13777
+ lastKnownOrder: number;
13777
13778
  body: {
13778
13779
  [x: string]: unknown;
13779
13780
  eventId: string;
13780
13781
  boardId: string;
13781
- operations: ({
13782
+ operation: {
13782
13783
  [x: string]: unknown;
13783
13784
  class: "Events";
13784
13785
  method: "undo";
@@ -13944,6 +13945,25 @@ export declare function safeParseSocketMsg(data: unknown): z.ZodSafeParseResult<
13944
13945
  };
13945
13946
  timeStamp?: number | undefined;
13946
13947
  timestamp?: number | undefined;
13948
+ } | {
13949
+ [x: string]: unknown;
13950
+ class: "Transformation";
13951
+ method: "applyMatrix";
13952
+ items: {
13953
+ [x: string]: unknown;
13954
+ id: string;
13955
+ matrix: {
13956
+ [x: string]: unknown;
13957
+ translateX: number;
13958
+ translateY: number;
13959
+ scaleX: number;
13960
+ scaleY: number;
13961
+ shearX: number;
13962
+ shearY: number;
13963
+ };
13964
+ }[];
13965
+ timeStamp?: number | undefined;
13966
+ timestamp?: number | undefined;
13947
13967
  } | {
13948
13968
  [x: string]: unknown;
13949
13969
  class: "Transformation";
@@ -13968,25 +13988,6 @@ export declare function safeParseSocketMsg(data: unknown): z.ZodSafeParseResult<
13968
13988
  locked: boolean;
13969
13989
  timeStamp?: number | undefined;
13970
13990
  timestamp?: number | undefined;
13971
- } | {
13972
- [x: string]: unknown;
13973
- class: "Transformation";
13974
- method: "applyMatrix";
13975
- items: {
13976
- [x: string]: unknown;
13977
- id: string;
13978
- matrix: {
13979
- [x: string]: unknown;
13980
- translateX: number;
13981
- translateY: number;
13982
- scaleX: number;
13983
- scaleY: number;
13984
- shearX: number;
13985
- shearY: number;
13986
- };
13987
- }[];
13988
- timeStamp?: number | undefined;
13989
- timestamp?: number | undefined;
13990
13991
  } | {
13991
13992
  [x: string]: unknown;
13992
13993
  class: "Transformation";
@@ -14423,8 +14424,7 @@ export declare function safeParseSocketMsg(data: unknown): z.ZodSafeParseResult<
14423
14424
  method: "setUrl";
14424
14425
  item: string[];
14425
14426
  url: string;
14426
- })[];
14427
- lastKnownOrder: number;
14427
+ };
14428
14428
  userId?: string | number | undefined;
14429
14429
  authorUserId?: string | undefined;
14430
14430
  sessionId?: string | undefined;
@@ -14432,12 +14432,11 @@ export declare function safeParseSocketMsg(data: unknown): z.ZodSafeParseResult<
14432
14432
  } | {
14433
14433
  [x: string]: unknown;
14434
14434
  order: number;
14435
- lastKnownOrder: number;
14436
14435
  body: {
14437
14436
  [x: string]: unknown;
14438
14437
  eventId: string;
14439
14438
  boardId: string;
14440
- operation: {
14439
+ operations: ({
14441
14440
  [x: string]: unknown;
14442
14441
  class: "Events";
14443
14442
  method: "undo";
@@ -14603,6 +14602,25 @@ export declare function safeParseSocketMsg(data: unknown): z.ZodSafeParseResult<
14603
14602
  };
14604
14603
  timeStamp?: number | undefined;
14605
14604
  timestamp?: number | undefined;
14605
+ } | {
14606
+ [x: string]: unknown;
14607
+ class: "Transformation";
14608
+ method: "applyMatrix";
14609
+ items: {
14610
+ [x: string]: unknown;
14611
+ id: string;
14612
+ matrix: {
14613
+ [x: string]: unknown;
14614
+ translateX: number;
14615
+ translateY: number;
14616
+ scaleX: number;
14617
+ scaleY: number;
14618
+ shearX: number;
14619
+ shearY: number;
14620
+ };
14621
+ }[];
14622
+ timeStamp?: number | undefined;
14623
+ timestamp?: number | undefined;
14606
14624
  } | {
14607
14625
  [x: string]: unknown;
14608
14626
  class: "Transformation";
@@ -14627,25 +14645,6 @@ export declare function safeParseSocketMsg(data: unknown): z.ZodSafeParseResult<
14627
14645
  locked: boolean;
14628
14646
  timeStamp?: number | undefined;
14629
14647
  timestamp?: number | undefined;
14630
- } | {
14631
- [x: string]: unknown;
14632
- class: "Transformation";
14633
- method: "applyMatrix";
14634
- items: {
14635
- [x: string]: unknown;
14636
- id: string;
14637
- matrix: {
14638
- [x: string]: unknown;
14639
- translateX: number;
14640
- translateY: number;
14641
- scaleX: number;
14642
- scaleY: number;
14643
- shearX: number;
14644
- shearY: number;
14645
- };
14646
- }[];
14647
- timeStamp?: number | undefined;
14648
- timestamp?: number | undefined;
14649
14648
  } | {
14650
14649
  [x: string]: unknown;
14651
14650
  class: "Transformation";
@@ -15082,7 +15081,8 @@ export declare function safeParseSocketMsg(data: unknown): z.ZodSafeParseResult<
15082
15081
  method: "setUrl";
15083
15082
  item: string[];
15084
15083
  url: string;
15085
- };
15084
+ })[];
15085
+ lastKnownOrder: number;
15086
15086
  userId?: string | number | undefined;
15087
15087
  authorUserId?: string | undefined;
15088
15088
  sessionId?: string | undefined;
@@ -1,6 +1,6 @@
1
1
  export { Events, createEvents } from "./Events";
2
2
  export type { BoardEventBody, BoardEvent, SyncBoardEvent, SyncEvent, } from "./Events";
3
- export type { ItemOperation, EventsOperation, Operation, BaseOperation, } from "./EventsOperations";
3
+ export type { ItemOperation, EventsOperation, Operation, BaseOperation, SetPropertyOperation, } from "./EventsOperations";
4
4
  export { isTransformation, isBoardOp, isRichTextOp, isShapeOp, isConnectorOp, isDrawingOp, isEventsOp, isItemOp } from "./EventsOperations";
5
5
  export type { Command } from "./Command";
6
6
  export type { SyncLog } from "./SyncLog";
@@ -11,6 +11,7 @@ import { Point } from "../Point/Point";
11
11
  import { RichText } from "../RichText/RichText";
12
12
  import { Subject } from "../../Subject";
13
13
  import { BaseItem, SerializedItemData } from "../BaseItem/BaseItem";
14
+ import { TransformParams, TransformResult } from "../BaseItem/TransformContext";
14
15
  export declare const CONTEXT_NODE_HIGHLIGHT_COLOR = "rgba(183, 138, 240, 1)";
15
16
  export declare const threadDirections: readonly [0, 1, 2, 3];
16
17
  export type ThreadDirection = typeof threadDirections[number];
@@ -29,7 +30,7 @@ export declare class AINode extends BaseItem<AINode> {
29
30
  private buttonMbr;
30
31
  private buttonIcon;
31
32
  prevMbr: Mbr | null;
32
- constructor(board: Board, isUserRequest?: boolean, parentNodeId?: string, contextItems?: string[], threadDirection?: ThreadDirection, id?: string);
33
+ constructor(board: Board, id?: string);
33
34
  transformPath(): void;
34
35
  serialize(): SerializedItemData<AINodeData>;
35
36
  deserialize(data: SerializedItemData<AINodeData> | AINodeData): this;
@@ -61,4 +62,9 @@ export declare class AINode extends BaseItem<AINode> {
61
62
  renderButton(context: DrawingContext): void;
62
63
  render(context: DrawingContext): void;
63
64
  getPrevMbr(): Mbr | null;
65
+ getPointOnEdge(point: Point, edge?: string): Point;
66
+ handleTransform(params: TransformParams): TransformResult;
67
+ isBusy(): boolean;
68
+ canBeInteractedWithWhileLocked(isAiGenerating: boolean): boolean;
64
69
  }
70
+ export declare const DefaultAINodeData: AINodeData;
@@ -0,0 +1,47 @@
1
+ import { z } from "zod";
2
+ export declare const AINodeDataSchema: z.ZodObject<{
3
+ itemType: z.ZodLiteral<"AINode">;
4
+ transformation: z.ZodObject<{
5
+ translateX: z.ZodNumber;
6
+ translateY: z.ZodNumber;
7
+ scaleX: z.ZodNumber;
8
+ scaleY: z.ZodNumber;
9
+ rotate: z.ZodNumber;
10
+ isLocked: z.ZodOptional<z.ZodBoolean>;
11
+ }, z.core.$strip>;
12
+ text: z.ZodObject<{
13
+ itemType: z.ZodOptional<z.ZodLiteral<"RichText">>;
14
+ children: z.ZodArray<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>;
15
+ verticalAlignment: z.ZodOptional<z.ZodEnum<{
16
+ center: "center";
17
+ top: "top";
18
+ bottom: "bottom";
19
+ }>>;
20
+ maxWidth: z.ZodOptional<z.ZodNumber>;
21
+ transformation: z.ZodOptional<z.ZodObject<{
22
+ translateX: z.ZodNumber;
23
+ translateY: z.ZodNumber;
24
+ scaleX: z.ZodNumber;
25
+ scaleY: z.ZodNumber;
26
+ rotate: z.ZodNumber;
27
+ isLocked: z.ZodOptional<z.ZodBoolean>;
28
+ }, z.core.$strip>>;
29
+ containerMaxWidth: z.ZodOptional<z.ZodNumber>;
30
+ insideOf: z.ZodOptional<z.ZodString>;
31
+ color: z.ZodOptional<z.ZodString>;
32
+ placeholderText: z.ZodOptional<z.ZodString>;
33
+ realSize: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodNumber]>>;
34
+ linkTo: z.ZodOptional<z.ZodString>;
35
+ }, z.core.$strip>;
36
+ linkTo: z.ZodOptional<z.ZodString>;
37
+ parentNodeId: z.ZodOptional<z.ZodString>;
38
+ isUserRequest: z.ZodBoolean;
39
+ contextItems: z.ZodArray<z.ZodString>;
40
+ threadDirection: z.ZodEnum<{
41
+ left: "left";
42
+ right: "right";
43
+ up: "up";
44
+ down: "down";
45
+ }>;
46
+ }, z.core.$strip>;
47
+ export type AINodeData = z.infer<typeof AINodeDataSchema>;
@@ -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 { TransformationData } from "../Transformation/TransformationData";
@@ -14,8 +14,6 @@ export interface AudioItemData {
14
14
  [key: string]: unknown;
15
15
  }
16
16
  export declare class AudioItem extends BaseItem<AudioItem> {
17
- private events?;
18
- private extension?;
19
17
  readonly itemType = "Audio";
20
18
  parent: string;
21
19
  readonly subject: Subject<AudioItem>;
@@ -25,7 +23,8 @@ export declare class AudioItem extends BaseItem<AudioItem> {
25
23
  private url;
26
24
  private isPlaying;
27
25
  private currentTime;
28
- constructor(board: Board, url?: string, events?: Events | undefined, id?: string, extension?: string | undefined);
26
+ private extension?;
27
+ constructor(board: Board, id?: string);
29
28
  setCurrentTime(time: number): void;
30
29
  getCurrentTime(): number;
31
30
  doOnceBeforeOnLoad: (callback: (audio: AudioItem) => void) => void;
@@ -55,3 +54,4 @@ export declare class AudioItem extends BaseItem<AudioItem> {
55
54
  download(): void;
56
55
  onRemove(): void;
57
56
  }
57
+ export declare const DefaultAudioItemData: AudioItemData;
@@ -0,0 +1,15 @@
1
+ import { z } from "zod";
2
+ export declare const AudioItemDataSchema: z.ZodObject<{
3
+ itemType: z.ZodLiteral<"Audio">;
4
+ url: z.ZodString;
5
+ transformation: z.ZodObject<{
6
+ translateX: z.ZodNumber;
7
+ translateY: z.ZodNumber;
8
+ scaleX: z.ZodNumber;
9
+ scaleY: z.ZodNumber;
10
+ rotate: z.ZodNumber;
11
+ isLocked: z.ZodOptional<z.ZodBoolean>;
12
+ }, z.core.$strip>;
13
+ extension: z.ZodOptional<z.ZodString>;
14
+ }, z.core.$strip>;
15
+ export type AudioItemData = z.infer<typeof AudioItemDataSchema>;
@@ -1,20 +1,25 @@
1
1
  import { Mbr } from "../Mbr/Mbr";
2
+ import { Line } from "../Line/Line";
3
+ import { Item } from "../Item";
2
4
  import { Geometry } from "../Geometry";
3
5
  import type { RichText } from "../RichText/RichText";
4
6
  import { LinkTo } from "../LinkTo/LinkTo";
5
7
  import { Transformation } from "../Transformation/Transformation";
6
8
  import { Board } from "../../Board";
7
9
  import { DrawingContext } from "../DrawingContext";
8
- import type { Operation } from "../../Events/EventsOperations";
9
- import type { Command } from "../../Events/Command";
10
+ import { BaseOperation, Operation } from "../../Events/EventsOperations";
11
+ import { Command } from "../../Events/Command";
10
12
  import { TransformationData } from "../Transformation/TransformationData";
11
- import { BaseOperation } from "../../Events/EventsOperations";
12
13
  import { Subject } from "../../Subject";
13
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";
19
+ import { TransformParams, TransformResult } from "./TransformContext";
20
+ import { GeometricNormal } from "../GeometricNormal";
21
+ import { ResizeType } from "../../Selection/Transformer/TransformerHelpers/getResizeType";
22
+ import type { ItemType } from "../Item";
18
23
  export interface BaseItemData {
19
24
  itemType: string;
20
25
  transformation?: TransformationData;
@@ -26,15 +31,15 @@ export type SerializedItemData<T extends BaseItemData = BaseItemData> = T & {
26
31
  id: string;
27
32
  transformation: TransformationData;
28
33
  };
29
- export declare class BaseItem<T extends BaseItem<any> = any> extends Mbr implements Geometry {
30
- private defaultItemData?;
34
+ export declare class BaseItem<T extends BaseItem<any> = any> implements Geometry {
31
35
  static createCommand?: (board: Board, operation: Operation) => Command;
32
- readonly transformation: Transformation;
33
- readonly linkTo: LinkTo;
36
+ protected mbr: Mbr;
37
+ transformation: Transformation;
38
+ linkTo: LinkTo;
34
39
  parent: string;
35
40
  canBeNested: boolean;
36
41
  transformationRenderBlock?: boolean;
37
- readonly index: SimpleSpatialIndex | null;
42
+ index: SimpleSpatialIndex | null;
38
43
  board: Board;
39
44
  id: string;
40
45
  subject: Subject<T>;
@@ -44,7 +49,7 @@ export declare class BaseItem<T extends BaseItem<any> = any> extends Mbr impleme
44
49
  shouldUseRelativeAlignment: boolean;
45
50
  resizeEnabled: boolean;
46
51
  onlyProportionalResize: boolean;
47
- itemType: string;
52
+ itemType: ItemType;
48
53
  childIds: string[];
49
54
  isHoverHighlighted: boolean;
50
55
  static readonly HOVER_HIGHLIGHT_COLOR = "rgba(71, 120, 245, 0.7)";
@@ -53,7 +58,7 @@ export declare class BaseItem<T extends BaseItem<any> = any> extends Mbr impleme
53
58
  * entire simulation once computed. Invalidated on resize/scale only. */
54
59
  private _physicsHalfExtent;
55
60
  get physicsHalfExtent(): number;
56
- constructor(board: Board, id?: string, defaultItemData?: BaseItemData | undefined, isGroupItem?: boolean);
61
+ constructor(board: Board, id?: string);
57
62
  updateChildrenIds(): void;
58
63
  /**
59
64
  * Called when this item's parent changes. Subclasses override this to
@@ -89,6 +94,11 @@ export declare class BaseItem<T extends BaseItem<any> = any> extends Mbr impleme
89
94
  cancelIfChild?: boolean;
90
95
  }): boolean;
91
96
  getMbr(): Mbr;
97
+ setMbr(rect: Mbr): void;
98
+ addMbr(rect: Mbr): void;
99
+ getWidth(): number;
100
+ getHeight(): number;
101
+ getCenter(): Point;
92
102
  /**
93
103
  * Returns the world-space axis-aligned bounding box.
94
104
  * For top-level items this is identical to getMbr().
@@ -96,6 +106,10 @@ export declare class BaseItem<T extends BaseItem<any> = any> extends Mbr impleme
96
106
  * through the world matrix to produce the correct world-space bounds.
97
107
  */
98
108
  getWorldMbr(): Mbr;
109
+ getIntersectionPoints(segment: Line): Point[];
110
+ getNearestEdgePointTo(point: Point): Point;
111
+ isInView(rect: Mbr): boolean;
112
+ getNormal(point: Point): GeometricNormal;
99
113
  private hasAncestor;
100
114
  applyAddChildren(childIds: string[]): void;
101
115
  applyRemoveChildren(childIds: string[]): void;
@@ -110,12 +124,15 @@ export declare class BaseItem<T extends BaseItem<any> = any> extends Mbr impleme
110
124
  disableResize(items: BaseItem[]): void;
111
125
  enableResize(items: BaseItem[]): void;
112
126
  apply(op: Operation | BaseItemOperation | BaseOperation): void;
127
+ protected onPropertyUpdated(property: string, value: any, prevValue: any): void;
113
128
  addOnRemoveCallback(cb: () => void): void;
114
129
  onRemove(): void;
115
130
  getPathMbr(): Mbr;
116
131
  isEnclosedBy(rect: Mbr): boolean;
117
132
  isUnderPoint(point: Point): boolean;
118
133
  isNearPoint(point: Point, distance: number): boolean;
134
+ getDistanceToPoint(point: Point): number;
135
+ intersectsWithLines(lines: Line[]): boolean;
119
136
  isEnclosedOrCrossedBy(rect: Mbr): boolean;
120
137
  getMbrWithChildren(): Mbr;
121
138
  getPath(): Path | Paths;
@@ -123,4 +140,15 @@ export declare class BaseItem<T extends BaseItem<any> = any> extends Mbr impleme
123
140
  clearHighlightMbr(): void;
124
141
  renderHoverHighlight(context: DrawingContext): void;
125
142
  render(context: DrawingContext): void;
143
+ getIsScalingContainer(): boolean;
144
+ getSnapAnchorPoints(): Point[];
145
+ getPointOnEdge(point: Point, _edge?: string): Point;
146
+ handleTransform(params: TransformParams): TransformResult;
147
+ getResizeType(point: Point, cameraScale: number, mbr: Mbr, anchorDistance?: number): ResizeType | undefined;
148
+ isBusy(): boolean;
149
+ shouldFollowItems(): boolean;
150
+ isAlignmentSource(): boolean;
151
+ isReady(): boolean;
152
+ onSelectEnd(_topItem?: Item): void;
153
+ canBeInteractedWithWhileLocked(_isAiGenerating: boolean): boolean;
126
154
  }
@@ -0,0 +1,40 @@
1
+ import { Board } from "../../Board";
2
+ import { Mbr, Point } from "../../Items";
3
+ import { ResizeType } from "../../Selection/Transformer/TransformerHelpers/getResizeType";
4
+ import { Comment } from "../Comment/Comment";
5
+ import { ApplyMatrixItem } from "../Transformation/TransformationOperations";
6
+ /** Minimal interface for BoardSelection to avoid circular dependencies */
7
+ export interface ISelection {
8
+ items: {
9
+ list(): any[];
10
+ };
11
+ transformMany(translations: ApplyMatrixItem[], timeStamp: number): void;
12
+ shouldRenderItemsMbr: boolean;
13
+ }
14
+ /** Minimal interface for tools used during transformation */
15
+ export interface ITransformTools {
16
+ canvasDrawer: any;
17
+ alignmentHelper: any;
18
+ debounceUpd: any;
19
+ }
20
+ export type TransformParams = {
21
+ board: Board;
22
+ selection: ISelection;
23
+ tools: ITransformTools;
24
+ resizeType: ResizeType;
25
+ mbr: Mbr;
26
+ oppositePoint: Point;
27
+ isWidth: boolean;
28
+ isHeight: boolean;
29
+ isShiftPressed: boolean;
30
+ beginTimeStamp: number;
31
+ followingComments?: Comment[];
32
+ startMbr?: Mbr;
33
+ snapCursorPos: Point | null;
34
+ setSnapCursorPos: (pos: Point | null) => void;
35
+ };
36
+ export type TransformResult = {
37
+ resizedMbr: Mbr | null;
38
+ translation?: ApplyMatrixItem[] | null;
39
+ onPointerUpCb?: () => void;
40
+ };
@@ -0,0 +1,10 @@
1
+ import { TransformationOperation, Matrix } from "../../browser";
2
+ /**
3
+ * Converts a world-space Transformation operation into an equivalent local-space
4
+ * operation relative to `containerMatrix`. Used when replaying ops (including old
5
+ * log events) against items that now store local transforms.
6
+ *
7
+ * Scale ratios in `applyMatrix` are coordinate-space invariant — only translation
8
+ * deltas need to be rotated/scaled by the inverse of the container's linear transform.
9
+ */
10
+ export declare function toLocalTransformOp(op: TransformationOperation, containerMatrix: Matrix, itemId?: string): TransformationOperation;
@@ -1,5 +1,5 @@
1
1
  import { Subject } from "../../Subject";
2
- import { Events, Operation } from "../../Events";
2
+ import type { Operation } from "../../Events";
3
3
  import { Point } from "../Point";
4
4
  import { TransformationData } from "../Transformation";
5
5
  import { CommentOperation } from "./CommentOperation";
@@ -11,6 +11,7 @@ import { SerializedItemData } from "../BaseItem";
11
11
  import { Line } from "../Line";
12
12
  import { BaseItem } from "../BaseItem/BaseItem";
13
13
  import { Board } from "../../Board";
14
+ import { Item } from "../Item";
14
15
  export interface Commentator {
15
16
  username: string;
16
17
  id: number;
@@ -35,18 +36,17 @@ export interface CommentData {
35
36
  [key: string]: unknown;
36
37
  }
37
38
  export declare class Comment extends BaseItem<Comment> {
38
- private anchor;
39
- private events?;
40
39
  parent: string;
41
40
  private commentators;
42
41
  private thread;
43
42
  private usersUnreadMarks;
44
43
  private resolved;
45
44
  private itemToFollow?;
45
+ private anchor;
46
46
  readonly subject: Subject<Comment>;
47
47
  transformationRenderBlock?: boolean;
48
48
  resizeEnabled: boolean;
49
- constructor(board: Board, anchor?: Point, events?: Events | undefined, id?: string);
49
+ constructor(board: Board, id?: string);
50
50
  serialize(): SerializedItemData<CommentData>;
51
51
  deserialize(data: SerializedItemData<CommentData> | CommentData): this;
52
52
  emit(operation: CommentOperation): void;
@@ -99,5 +99,8 @@ export declare class Comment extends BaseItem<Comment> {
99
99
  highlightMbr(): void;
100
100
  clearHighlightMbr(): void;
101
101
  renderHoverHighlight(_context: DrawingContext): void;
102
+ shouldFollowItems(): boolean;
103
+ onSelectEnd(topItem?: Item): void;
102
104
  render(context: DrawingContext): void;
103
105
  }
106
+ export declare const DefaultCommentData: CommentData;