@tumaet/apollon 4.2.23 → 4.4.0

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.
@@ -18,6 +18,23 @@ export declare class ApollonEditor {
18
18
  private setReactFlowInstance;
19
19
  getNodes(): Node[];
20
20
  getEdges(): Edge[];
21
+ getViewport(): {
22
+ x: number;
23
+ y: number;
24
+ zoom: number;
25
+ } | null;
26
+ screenToFlowPosition(position: {
27
+ x: number;
28
+ y: number;
29
+ }): import('@xyflow/system').XYPosition | null;
30
+ flowToScreenPosition(position: {
31
+ x: number;
32
+ y: number;
33
+ }): import('@xyflow/system').XYPosition | null;
34
+ fitView(options?: {
35
+ padding?: number;
36
+ duration?: number;
37
+ }): void;
21
38
  set diagramType(type: UMLDiagramType);
22
39
  destroy(): void;
23
40
  /**
@@ -36,10 +53,49 @@ export declare class ApollonEditor {
36
53
  subscribeToModelChange(callback: (state: Apollon.UMLModel) => void): number;
37
54
  subscribeToDiagramNameChange(callback: (diagramTitle: string) => void): number;
38
55
  subscribeToAssessmentSelection(callback: (selectedElementIds: string[]) => void): number;
56
+ subscribeToSelectionChange(callback: (selectedElementIds: string[]) => void): number;
57
+ subscribeToAwarenessChanges(callback: (states: Map<number, Apollon.CollaborationState>) => void): number;
58
+ subscribeToCollaboratorChanges(callback: (collaborators: Apollon.CollaboratorInfo[]) => void): number;
39
59
  unsubscribe(subscriberId: number): void;
40
60
  sendBroadcastMessage(sendFn: SendBroadcastMessage): void;
41
61
  receiveBroadcastedMessage(base64Data: string): void;
62
+ /**
63
+ * Push the entire local Yjs document to peers. Hosts should call this on
64
+ * every (re)connect so any edits made while the transport was closed are
65
+ * absorbed by the room. See `YjsSyncClass.broadcastFullState`.
66
+ */
67
+ broadcastFullState(): void;
68
+ setLocalAwarenessUser(user: Apollon.CollaborationUser): void;
69
+ setLocalAwarenessCursor(cursor: Apollon.CollaborationCursor | null): void;
70
+ setLocalAwarenessSelectedElement(selectedElementId: string | null): void;
71
+ setLocalAwarenessState(state: Partial<Apollon.CollaborationState>): void;
72
+ getLocalAwarenessClientId(): number;
73
+ getCollaborators(): Apollon.CollaboratorInfo[];
42
74
  updateDiagramTitle(name: string): void;
75
+ /**
76
+ * Toggles the editor's read-only state at runtime. Used by hosting apps
77
+ * to lock the canvas while previewing an immutable snapshot (e.g. the
78
+ * version-history preview), without tearing down and re-mounting the
79
+ * editor instance.
80
+ */
81
+ setReadonly(readonly: boolean): void;
82
+ /**
83
+ * Toggle preview-overlay mode. When `true`, subsequent `model = …`
84
+ * assignments and other store mutators update the local Zustand caches
85
+ * (so the canvas displays the overlay) WITHOUT writing to the Yjs
86
+ * doc — leaving the collaborative document untouched. Yjs observers
87
+ * also stop propagating peer-driven updates to Zustand, so the overlay
88
+ * doesn't flicker as collaborators edit the live diagram.
89
+ *
90
+ * On flip-off the local Zustand state is rebuilt from the (now
91
+ * peer-augmented) Yjs maps so the canvas catches up to everything
92
+ * collaborators committed during the preview.
93
+ *
94
+ * Hosts should call `setPreviewMode(true)` before applying a preview
95
+ * model and `setPreviewMode(false)` on exit. The Yjs doc never needs
96
+ * to be "restored" from a snapshot because it was never disturbed.
97
+ */
98
+ setPreviewMode(active: boolean): void;
43
99
  toggleInteractiveElementsMode(forceEnabled?: boolean): void;
44
100
  getInteractiveForSerialization(): Apollon.InteractiveElements | undefined;
45
101
  getDiagramMetadata(): {
@@ -53,4 +109,5 @@ export declare class ApollonEditor {
53
109
  set view(view: Apollon.ApollonView);
54
110
  addOrUpdateAssessment(assessment: Apollon.Assessment): void;
55
111
  static generateInitialSyncMessage(): string;
112
+ static generateInitialAwarenessSyncMessage(): string;
56
113
  }
@@ -0,0 +1,4 @@
1
+ import { SVGAttributes } from 'react';
2
+ type Props = SVGAttributes<SVGSVGElement>;
3
+ export declare const DragHandleIcon: ({ width, height, fill, ...props }: Props) => JSX.Element;
4
+ export {};
@@ -11,3 +11,4 @@ export * from './SwapHorizIcon';
11
11
  export * from './UndoIcon';
12
12
  export * from './ArrowBackIcon';
13
13
  export * from './ArrowForwardIcon';
14
+ export * from './DragHandleIcon';
package/dist/index.d.ts CHANGED
@@ -5,3 +5,6 @@ export * from './utils/versionConverter';
5
5
  export * from './utils';
6
6
  export { log, setLogLevel, setLogger } from './logger';
7
7
  export type { LogLevel } from './logger';
8
+ export { YjsSyncClass, MessageType } from './sync/yjsSyncClass';
9
+ export type { SendBroadcastMessage } from './sync/yjsSyncClass';
10
+ export { createHeadlessSync } from './sync/headless';