@tumaet/apollon 4.6.0 → 4.8.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.
Files changed (174) hide show
  1. package/README.md +2 -2
  2. package/dist/LICENSE-InterFont +92 -0
  3. package/dist/assets/style.css +1 -1
  4. package/dist/export.d.ts +73 -0
  5. package/dist/export.js +219 -0
  6. package/dist/exportFonts-DxO9jrR1.js +19 -0
  7. package/dist/exportStyles-Wcc8N8Xj.js +5 -0
  8. package/dist/fontStack-DOtVH2j8.js +5 -0
  9. package/dist/index.d.ts +151 -92
  10. package/dist/index.js +34925 -8009
  11. package/dist/internals.d.ts +136 -93
  12. package/dist/internals.js +16 -10
  13. package/dist/react/App.d.ts +1 -1
  14. package/dist/react/LICENSE-InterFont +92 -0
  15. package/dist/react/apollon-editor.d.ts +19 -0
  16. package/dist/react/components/AlignmentGuides.d.ts +1 -1
  17. package/dist/react/components/AssessmentSelectionDebug.d.ts +1 -1
  18. package/dist/react/components/CustomBackground.d.ts +1 -1
  19. package/dist/react/components/CustomControls.d.ts +1 -1
  20. package/dist/react/components/CustomMiniMap.d.ts +1 -1
  21. package/dist/react/components/DraggableGhost.d.ts +5 -0
  22. package/dist/react/components/Icon/ArrowBackIcon.d.ts +1 -1
  23. package/dist/react/components/Icon/ArrowForwardIcon.d.ts +1 -1
  24. package/dist/react/components/Icon/CheckIcon.d.ts +1 -1
  25. package/dist/react/components/Icon/CrossIcon.d.ts +1 -1
  26. package/dist/react/components/Icon/DeleteIcon.d.ts +1 -1
  27. package/dist/react/components/Icon/DragHandleIcon.d.ts +1 -1
  28. package/dist/react/components/Icon/EditIcon.d.ts +1 -1
  29. package/dist/react/components/Icon/ExclamationIcon.d.ts +1 -1
  30. package/dist/react/components/Icon/InfiniteIcon.d.ts +1 -1
  31. package/dist/react/components/Icon/MapIcon.d.ts +1 -1
  32. package/dist/react/components/Icon/PaintRollerIcon.d.ts +1 -1
  33. package/dist/react/components/Icon/RedoIcon.d.ts +1 -1
  34. package/dist/react/components/Icon/SouthEastArrowIcon.d.ts +1 -1
  35. package/dist/react/components/Icon/SwapHorizIcon.d.ts +1 -1
  36. package/dist/react/components/Icon/UndoIcon.d.ts +1 -1
  37. package/dist/react/components/ReconnectConnectionLine.d.ts +1 -1
  38. package/dist/react/components/Sidebar.d.ts +2 -1
  39. package/dist/react/components/collaboration/CollaborationLayer.d.ts +1 -1
  40. package/dist/react/components/popovers/DefaultNodeGiveFeedbackPopover.d.ts +1 -1
  41. package/dist/react/components/popovers/DefaultNodeSeeFeedbackPopover.d.ts +1 -1
  42. package/dist/react/components/popovers/GenericPopover.d.ts +1 -1
  43. package/dist/react/components/popovers/GiveFeedbackAssessmentBox.d.ts +1 -1
  44. package/dist/react/components/popovers/PopoverManager.d.ts +2 -2
  45. package/dist/react/components/popovers/SeeFeedbackAssessmentBox.d.ts +1 -1
  46. package/dist/react/components/popovers/bpmnDiagram/BPMNPoolEditPopover.d.ts +1 -1
  47. package/dist/react/components/popovers/classDiagram/ClassGiveFeedbackPopover.d.ts +1 -1
  48. package/dist/react/components/popovers/classDiagram/ClassSeeFeedbackPopover.d.ts +1 -1
  49. package/dist/react/components/popovers/communicationDiagram/CommunicationObjectNameGiveFeedbackPopover.d.ts +1 -1
  50. package/dist/react/components/popovers/communicationDiagram/CommunicationObjectNameSeeFeedbackPopover.d.ts +1 -1
  51. package/dist/react/components/popovers/edgePopovers/EdgeGiveFeedbackPopover.d.ts +1 -1
  52. package/dist/react/components/popovers/edgePopovers/EdgeSeeFeedbackPopover.d.ts +1 -1
  53. package/dist/react/components/popovers/edgePopovers/EdgeTypePreviewIcon.d.ts +1 -1
  54. package/dist/react/components/popovers/edgePopovers/EdgeTypeSelect.d.ts +1 -1
  55. package/dist/react/components/popovers/edgePopovers/SwapEndsButton.d.ts +9 -0
  56. package/dist/react/components/popovers/objectDiagram/ObjectGiveFeedbackPopover.d.ts +1 -1
  57. package/dist/react/components/popovers/objectDiagram/ObjectSeeFeedbackPopover.d.ts +1 -1
  58. package/dist/react/components/react/Apollon.d.ts +7 -2
  59. package/dist/react/components/react/context.d.ts +1 -1
  60. package/dist/react/components/svgs/edges/InlineMarker.d.ts +2 -2
  61. package/dist/react/components/svgs/nodes/classDiagram/ClassSVG.d.ts +1 -1
  62. package/dist/react/components/svgs/nodes/classDiagram/ColorDescriptionSVG.d.ts +1 -1
  63. package/dist/react/components/svgs/nodes/communicationDiagram/CommunicationObjectNameSVG.d.ts +1 -1
  64. package/dist/react/components/svgs/nodes/objectDiagram/ObjectNameSVG.d.ts +1 -1
  65. package/dist/react/components/toolbars/edgeToolBar/CustomEdgeToolBar.d.ts +1 -1
  66. package/dist/react/components/ui/StyleEditor/ColorButtons.d.ts +1 -1
  67. package/dist/react/constants.d.ts +17 -6
  68. package/dist/react/edges/GenericEdge.d.ts +5 -6
  69. package/dist/react/edges/edgeTypes/ActivityDiagramEdge.d.ts +1 -1
  70. package/dist/react/edges/edgeTypes/BPMNDiagramEdge.d.ts +1 -1
  71. package/dist/react/edges/edgeTypes/ClassDiagramEdge.d.ts +1 -1
  72. package/dist/react/edges/edgeTypes/CommunicationDiagramEdge.d.ts +1 -1
  73. package/dist/react/edges/edgeTypes/ComponentDiagramEdge.d.ts +1 -1
  74. package/dist/react/edges/edgeTypes/DeploymentDiagramEdge.d.ts +1 -1
  75. package/dist/react/edges/edgeTypes/FlowChartEdge.d.ts +1 -1
  76. package/dist/react/edges/edgeTypes/ObjectDiagramEdge.d.ts +1 -1
  77. package/dist/react/edges/edgeTypes/PetriNetEdge.d.ts +1 -1
  78. package/dist/react/edges/edgeTypes/ReachabilityGraphArc.d.ts +1 -1
  79. package/dist/react/edges/edgeTypes/SfcDiagramEdge.d.ts +1 -1
  80. package/dist/react/edges/edgeTypes/SyntaxTreeEdge.d.ts +1 -1
  81. package/dist/react/edges/edgeTypes/UseCaseDiagramEdge.d.ts +1 -1
  82. package/dist/react/edges/labelTypes/EdgeEndLabels.d.ts +1 -1
  83. package/dist/react/edges/labelTypes/EdgeIncludeExtendLabel.d.ts +1 -1
  84. package/dist/react/edges/labelTypes/EdgeMiddleLabels.d.ts +1 -1
  85. package/dist/react/edges/labelTypes/EdgeMultipleLabels.d.ts +1 -1
  86. package/dist/react/edges/types.d.ts +34 -34
  87. package/dist/react/export/exportErrors.d.ts +10 -0
  88. package/dist/react/export/index.d.ts +13 -0
  89. package/dist/react/export/normalizeExportSvg.d.ts +16 -0
  90. package/dist/react/export/preProcessSvgForPdf.d.ts +20 -0
  91. package/dist/react/export/svgToPdf.d.ts +17 -0
  92. package/dist/react/export/svgToPng.d.ts +38 -0
  93. package/dist/react/exportFonts-DSRUaduf.js +20 -0
  94. package/dist/react/exportStyles-CH2hautV.js +6 -0
  95. package/dist/react/fontStack.d.ts +14 -0
  96. package/dist/react/hooks/index.d.ts +1 -0
  97. package/dist/react/hooks/useEdgeLineJumps.d.ts +3 -1
  98. package/dist/react/hooks/useEdgeToolbar.d.ts +1 -1
  99. package/dist/react/hooks/usePopoverAnchor.d.ts +26 -0
  100. package/dist/react/hooks/useReactiveElement.d.ts +10 -0
  101. package/dist/react/hooks/useRemoteDraggingNodes.d.ts +20 -0
  102. package/dist/react/hooks/useStepPathEdge.d.ts +1 -1
  103. package/dist/react/hooks/useStraightPathEdge.d.ts +1 -1
  104. package/dist/react/index.d.ts +1 -0
  105. package/dist/react/nodes/TitleAndDescriptionNode.d.ts +1 -1
  106. package/dist/react/nodes/activityDiagram/Activity.d.ts +1 -1
  107. package/dist/react/nodes/activityDiagram/ActivityActionNode.d.ts +1 -1
  108. package/dist/react/nodes/activityDiagram/ActivityFinalNode.d.ts +1 -1
  109. package/dist/react/nodes/activityDiagram/ActivityForkNode.d.ts +1 -1
  110. package/dist/react/nodes/activityDiagram/ActivityForkNodeHorizontal.d.ts +1 -1
  111. package/dist/react/nodes/activityDiagram/ActivityInitialNode.d.ts +1 -1
  112. package/dist/react/nodes/activityDiagram/ActivityMergeNode.d.ts +1 -1
  113. package/dist/react/nodes/activityDiagram/ActivityObjectNode.d.ts +1 -1
  114. package/dist/react/nodes/bpmn/BPMNAnnotation.d.ts +1 -1
  115. package/dist/react/nodes/bpmn/BPMNCallActivity.d.ts +1 -1
  116. package/dist/react/nodes/bpmn/BPMNDataObject.d.ts +1 -1
  117. package/dist/react/nodes/bpmn/BPMNDataStore.d.ts +1 -1
  118. package/dist/react/nodes/bpmn/BPMNEndEvent.d.ts +1 -1
  119. package/dist/react/nodes/bpmn/BPMNGateway.d.ts +1 -1
  120. package/dist/react/nodes/bpmn/BPMNGroup.d.ts +1 -1
  121. package/dist/react/nodes/bpmn/BPMNIntermediateEvent.d.ts +1 -1
  122. package/dist/react/nodes/bpmn/BPMNPool.d.ts +1 -1
  123. package/dist/react/nodes/bpmn/BPMNStartEvent.d.ts +1 -1
  124. package/dist/react/nodes/bpmn/BPMNSubprocess.d.ts +1 -1
  125. package/dist/react/nodes/bpmn/BPMNTask.d.ts +1 -1
  126. package/dist/react/nodes/bpmn/BPMNTransaction.d.ts +1 -1
  127. package/dist/react/nodes/classDiagram/Class.d.ts +1 -1
  128. package/dist/react/nodes/classDiagram/ColorDescription.d.ts +1 -1
  129. package/dist/react/nodes/classDiagram/Package.d.ts +1 -1
  130. package/dist/react/nodes/communicationDiagram/CommunicationObjectName.d.ts +1 -1
  131. package/dist/react/nodes/componentDiagram/Component.d.ts +1 -1
  132. package/dist/react/nodes/componentDiagram/ComponentInterface.d.ts +1 -1
  133. package/dist/react/nodes/componentDiagram/ComponentSubsystem.d.ts +1 -1
  134. package/dist/react/nodes/deploymentDiagram/DeploymentArtifact.d.ts +1 -1
  135. package/dist/react/nodes/deploymentDiagram/DeploymentComponent.d.ts +1 -1
  136. package/dist/react/nodes/deploymentDiagram/DeploymentInterface.d.ts +1 -1
  137. package/dist/react/nodes/deploymentDiagram/DeploymentNode.d.ts +1 -1
  138. package/dist/react/nodes/flowchart/FlowchartDecision.d.ts +1 -1
  139. package/dist/react/nodes/flowchart/FlowchartFunctionCall.d.ts +1 -1
  140. package/dist/react/nodes/flowchart/FlowchartInputOutput.d.ts +1 -1
  141. package/dist/react/nodes/flowchart/FlowchartProcess.d.ts +1 -1
  142. package/dist/react/nodes/flowchart/FlowchartTerminal.d.ts +1 -1
  143. package/dist/react/nodes/objectDiagram/ObjectName.d.ts +1 -1
  144. package/dist/react/nodes/petriNetDiagram/PetriNetPlace.d.ts +1 -1
  145. package/dist/react/nodes/petriNetDiagram/PetriNetTransition.d.ts +1 -1
  146. package/dist/react/nodes/reachabilityGraphDiagram/ReachabilityGraphMarking.d.ts +1 -1
  147. package/dist/react/nodes/sfcDiagram/SfcActionTable.d.ts +1 -1
  148. package/dist/react/nodes/sfcDiagram/SfcJump.d.ts +1 -1
  149. package/dist/react/nodes/sfcDiagram/SfcStart.d.ts +1 -1
  150. package/dist/react/nodes/sfcDiagram/SfcStep.d.ts +1 -1
  151. package/dist/react/nodes/sfcDiagram/SfcTransitionBranch.d.ts +1 -1
  152. package/dist/react/nodes/syntaxTreeDiagram/SyntaxTreeNonterminal.d.ts +1 -1
  153. package/dist/react/nodes/syntaxTreeDiagram/SyntaxTreeTerminal.d.ts +1 -1
  154. package/dist/react/nodes/useCaseDiagram/UseCase.d.ts +1 -1
  155. package/dist/react/nodes/useCaseDiagram/UseCaseActor.d.ts +1 -1
  156. package/dist/react/nodes/useCaseDiagram/UseCaseSystem.d.ts +1 -1
  157. package/dist/react/nodes/wrappers/DefaultNodeWrapper.d.ts +1 -1
  158. package/dist/react/react.js +23599 -24829
  159. package/dist/react/store/assessmentSelectionStore.d.ts +2 -0
  160. package/dist/react/store/diagramStore.d.ts +17 -1
  161. package/dist/react/sync/perfCounters.d.ts +6 -0
  162. package/dist/react/sync/ydoc.d.ts +2 -0
  163. package/dist/react/sync/yjsSync.d.ts +3 -2
  164. package/dist/react/types/nodes/NodeProps.d.ts +3 -3
  165. package/dist/react/typings.d.ts +23 -2
  166. package/dist/react/utils/collaboration.d.ts +10 -1
  167. package/dist/react/utils/exportFonts.d.ts +11 -0
  168. package/dist/react/utils/exportStyles.d.ts +30 -0
  169. package/dist/react/utils/exportUtils.d.ts +1 -101
  170. package/dist/react/utils/paletteLayout.d.ts +66 -0
  171. package/dist/yjsSync-CqmgRwRE.js +51038 -0
  172. package/package.json +38 -16
  173. package/schema/uml-model-4.schema.json +363 -0
  174. package/dist/yjsSync-CK5cmd5z.js +0 -71308
@@ -3,11 +3,13 @@ export type AssessmentSelectionStore = {
3
3
  selectedElementIds: string[];
4
4
  highlightedElementId: string | null;
5
5
  isAssessmentSelectionMode: boolean;
6
+ highlightedElements: Record<string, string>;
6
7
  setAssessmentSelectionMode: (isActive: boolean) => void;
7
8
  selectElement: (elementId: string) => void;
8
9
  selectMultipleElements: (elementIds: string[]) => void;
9
10
  clearSelection: () => void;
10
11
  setHighlightedElement: (elementId: string | null) => void;
12
+ setElementHighlights: (highlights: Record<string, string>) => void;
11
13
  isElementSelected: (elementId: string) => boolean;
12
14
  isElementHighlighted: (elementId: string) => boolean;
13
15
  reset: () => void;
@@ -1,6 +1,6 @@
1
1
  import { StoreApi, UseBoundStore } from 'zustand';
2
2
  import { Node, Edge, OnNodesChange, OnEdgesChange } from '@xyflow/react';
3
- import { Assessment, InteractiveElements } from '../typings';
3
+ import { Assessment, DraggingNode, InteractiveElements } from '../typings';
4
4
  import * as Y from "yjs";
5
5
  export type DiagramStoreData = {
6
6
  nodes: Node[];
@@ -18,8 +18,24 @@ export type DiagramStore = {
18
18
  canUndo: boolean;
19
19
  canRedo: boolean;
20
20
  undoManager: Y.UndoManager | null;
21
+ collaborationEnabled: boolean;
21
22
  previewMode: boolean;
22
23
  setDiagramId: (diagramId: string) => void;
24
+ setCollaborationEnabled: (enabled: boolean) => void;
25
+ /**
26
+ * Inject the sink that forwards transient drag/resize frames onto the
27
+ * ephemeral awareness channel (wired by `YjsSync` for every editor). Kept as
28
+ * runtime wiring rather than diagram state so a `reset()` never clears it.
29
+ * The broadcast itself is gated by `collaborationEnabled`, not by this sink;
30
+ * `null` (headless, where no `YjsSync` runs) just leaves it unwired.
31
+ */
32
+ setDraggingNodesPublisher: (publisher: ((draggingNodes: DraggingNode[] | null) => void) | null) => void;
33
+ /**
34
+ * Clear the peers' live-drag overlay once a gesture's settled value is
35
+ * committed. Called from `onNodeDragStop` (after the doc write) and on
36
+ * collaboration teardown; a no-op when nothing is being broadcast.
37
+ */
38
+ endTransientNodeBroadcast: () => void;
23
39
  setNodes: (payload: Node[] | ((nodes: Node[]) => Node[])) => void;
24
40
  setEdges: (payload: Edge[] | ((edges: Edge[]) => Edge[])) => void;
25
41
  setNodesAndEdges: (nodes: Node[], edges: Edge[]) => void;
@@ -0,0 +1,6 @@
1
+ export type PerfCounters = {
2
+ storeNodeWrites: number;
3
+ };
4
+ export declare const perfCounters: PerfCounters;
5
+ export declare const getPerfCounters: () => PerfCounters | undefined;
6
+ export declare const recordStoreNodeWrite: () => void;
@@ -1,7 +1,9 @@
1
1
  import { Assessment } from '../typings';
2
2
  import { Node, Edge } from '@xyflow/react';
3
3
  import * as Y from "yjs";
4
+ export declare const STORE_ORIGIN = "store";
4
5
  export declare const getNodesMap: (ydoc: Y.Doc) => Y.Map<Node>;
5
6
  export declare const getEdgesMap: (ydoc: Y.Doc) => Y.Map<Edge>;
6
7
  export declare const getAssessments: (ydoc: Y.Doc) => Y.Map<Assessment>;
7
8
  export declare const getDiagramMetadata: (ydoc: Y.Doc) => Y.Map<string>;
9
+ export declare const reconcileYMap: <T>(map: Y.Map<T>, nextEntries: Iterable<readonly [string, T]>) => void;
@@ -1,6 +1,6 @@
1
1
  import { DiagramStore } from '../store/diagramStore';
2
2
  import { MetadataStore } from '../store/metadataStore';
3
- import { CollaborationState, CollaborationUser, CollaborationViewport, CollaboratorInfo } from '../typings';
3
+ import { CollaborationState, CollaborationUser, CollaborationViewport, CollaboratorInfo, DraggingNode } from '../typings';
4
4
  import { StoreApi } from 'zustand';
5
5
  import * as Y from "yjs";
6
6
  export declare enum MessageType {
@@ -37,6 +37,7 @@ export declare class YjsSync {
37
37
  setLocalAwarenessViewport: (viewport: CollaborationViewport | null) => void;
38
38
  setLocalAwarenessFollowing: (followingClientId: number | null) => void;
39
39
  setLocalAwarenessSelectedElement: (selectedElementId: string | null) => void;
40
+ setLocalAwarenessDraggingNodes: (draggingNodes: DraggingNode[] | null) => void;
40
41
  setLocalAwarenessState: (state: Partial<CollaborationState>) => void;
41
42
  subscribeToAwarenessChanges: (callback: (states: Map<number, CollaborationState>) => void) => () => void;
42
43
  getAwarenessStates: () => Map<number, CollaborationState>;
@@ -58,5 +59,5 @@ export declare class YjsSync {
58
59
  /**
59
60
  * Convert Base64 string to Uint8Array
60
61
  */
61
- private base64ToUint8;
62
+ static base64ToUint8(base64: string): Uint8Array;
62
63
  }
@@ -36,7 +36,7 @@ export type DeploymentComponentProps = {
36
36
  } & DefaultNodeProps;
37
37
  export type PetriNetPlaceProps = {
38
38
  tokens: number;
39
- capacity: number | "Infinity";
39
+ capacity: number | string;
40
40
  } & DefaultNodeProps;
41
41
  export type BPMNTaskType = "default" | "user" | "send" | "receive" | "manual" | "business-rule" | "script";
42
42
  export type BPMNMarkerType = "none" | "parallel multi instance" | "sequential multi instance" | "loop";
@@ -48,7 +48,7 @@ export type BPMNStartEventType = "default" | "message" | "timer" | "conditional"
48
48
  export type BPMNIntermediateEventType = "default" | "message-catch" | "message-throw" | "timer-catch" | "escalation-throw" | "conditional-catch" | "link-catch" | "link-throw" | "compensation-throw" | "signal-catch" | "signal-throw";
49
49
  export type BPMNEndEventType = "default" | "message" | "escalation" | "error" | "compensation" | "signal" | "terminate";
50
50
  export type BPMNEventProps = DefaultNodeProps & {
51
- eventType: BPMNStartEventType;
51
+ eventType: BPMNStartEventType | BPMNIntermediateEventType | BPMNEndEventType;
52
52
  };
53
53
  export type BPMNGatewayType = "complex" | "event-based" | "exclusive" | "inclusive" | "parallel";
54
54
  export type BPMNGatewayProps = DefaultNodeProps & {
@@ -73,5 +73,5 @@ export type SfcActionTableProps = DefaultNodeProps & {
73
73
  actionRows: SfcActionRow[];
74
74
  };
75
75
  export type SfcTransitionBranchNodeProps = DefaultNodeProps & {
76
- showHint: boolean;
76
+ showHint?: boolean;
77
77
  };
@@ -24,12 +24,29 @@ export type CollaborationViewport = {
24
24
  y: number;
25
25
  zoom: number;
26
26
  };
27
+ /**
28
+ * One node a peer is actively dragging or resizing. Broadcast over the
29
+ * ephemeral awareness channel — never written to the Yjs document — so peers
30
+ * can render the in-progress gesture live without growing the CRDT or entering
31
+ * anyone's undo history. The settled position/size is committed once on
32
+ * drop/release through the document like any other edit.
33
+ */
34
+ export type DraggingNode = {
35
+ id: string;
36
+ position: {
37
+ x: number;
38
+ y: number;
39
+ };
40
+ width?: number | null;
41
+ height?: number | null;
42
+ };
27
43
  export type CollaborationState = {
28
44
  user?: CollaborationUser;
29
45
  cursor?: CollaborationCursor | null;
30
46
  viewport?: CollaborationViewport | null;
31
47
  followingClientId?: number | null;
32
48
  selectedElementId?: string | null;
49
+ draggingNodes?: DraggingNode[] | null;
33
50
  };
34
51
  export type CollaboratorInfo = {
35
52
  id: string;
@@ -88,8 +105,12 @@ export type ApollonEdge = {
88
105
  data: OrthogonalEdgeData;
89
106
  };
90
107
  export type InteractiveElements = {
91
- elements: Record<string, boolean>;
92
- relationships: Record<string, boolean>;
108
+ elements: {
109
+ [id: string]: boolean;
110
+ };
111
+ relationships: {
112
+ [id: string]: boolean;
113
+ };
93
114
  };
94
115
  export type UMLModel = {
95
116
  version: `4.${number}.${number}`;
@@ -1,4 +1,4 @@
1
- import { CollaborationViewport } from '../typings';
1
+ import { CollaborationViewport, DraggingNode } from '../typings';
2
2
  export declare const randomCollabName: () => string;
3
3
  export declare const collabColorFromName: (name: string) => string;
4
4
  /**
@@ -8,3 +8,12 @@ export declare const collabColorFromName: (name: string) => string;
8
8
  * Returns `null` for anything malformed.
9
9
  */
10
10
  export declare const sanitizeCollaborationViewport: (raw: unknown) => CollaborationViewport | null;
11
+ /**
12
+ * Narrow an untrusted, peer-supplied `draggingNodes` payload before the overlay
13
+ * reader iterates it. A non-array value (or entries missing a string `id` or a
14
+ * finite numeric position) would otherwise throw in the awareness subscription
15
+ * handler and break the live overlay for everyone reading that peer. Returns the
16
+ * well-formed entries only; `null` if the value isn't an array. Per-entry
17
+ * `width`/`height` survive only when finite or explicitly `null`.
18
+ */
19
+ export declare const sanitizeDraggingNodes: (raw: unknown) => DraggingNode[] | null;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Inter `@font-face` (base64 woff2) for self-contained `compat`-mode SVG
3
+ * exports, so the file renders in Inter when opened away from the editor
4
+ * (browser, Inkscape, PowerPoint). The woff2 is the same file `fonts.css`
5
+ * bundles. resvg does not resolve data-URI `@font-face` (resvg#541) — pass the
6
+ * font via its `fontFiles` instead; the embedded face is harmlessly ignored.
7
+ *
8
+ * Data-only and loaded lazily (dynamic `import()` in `exportModelAsSvg`) so the
9
+ * woff2 lands in its own chunk instead of the main bundle.
10
+ */
11
+ export declare const INTER_FONT_FACE_CSS: string;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Layout CSS the off-screen export mount needs to be self-contained, so a
3
+ * consumer rendering headlessly never has to import `@tumaet/apollon/style.css`
4
+ * for the export to be correct.
5
+ *
6
+ * The load-bearing rule is React Flow's `base.css` `.react-flow__node {
7
+ * position: absolute }`: Apollon positions each connection `<Handle>` with an
8
+ * inline `left/top: "X%"` (see `DefaultNodeWrapper`), and a percentage offset
9
+ * resolves against the nearest *positioned* ancestor. React Flow sets the
10
+ * node's transform/size inline but not `position` — that comes only from
11
+ * `base.css`. Without it `.react-flow__node` is `position: static`, the handle
12
+ * `%` offsets resolve against the wrong box, React Flow's on-mount
13
+ * `getBoundingClientRect` handle measurement is wrong, and edges route through
14
+ * the node boxes (the symptom reported for browser/Playwright exports). The
15
+ * same `base.css` also positions `.react-flow__viewport/.react-flow__edges`,
16
+ * which the `getBoundingClientRect`-based bounds math in `exportUtils` relies on.
17
+ *
18
+ * `app.css` adds `.apollon-canvas { flex: 1; ... }` so the canvas fills the
19
+ * 4000×4000 mount container.
20
+ *
21
+ * WARNING: `app.css` is inlined verbatim into this lazy chunk. It must stay
22
+ * free of `@font-face`, `url(...)`, and `@import`, or those assets leak into
23
+ * this chunk (the Inter font is shipped separately, see `exportFonts.ts`).
24
+ *
25
+ * Reached only via a dynamic `import()` in `exportModelAsSvg`, so Rollup emits
26
+ * it as its own chunk and these ~26 KB of CSS-as-string stay out of the main
27
+ * bundle (mirrors the `exportFonts.ts` pattern). The chunk is emitted per build
28
+ * entry (`dist/` and `dist/react/`).
29
+ */
30
+ export declare const EXPORT_LAYOUT_CSS: string;
@@ -1,5 +1,4 @@
1
1
  import { ReactFlowInstance, Node, Edge, Rect } from '@xyflow/react';
2
- import { Point } from './pathParsing';
3
2
  type SvgExportMode = "web" | "compat";
4
3
  type ExportFilterOptions = {
5
4
  include?: string[];
@@ -7,105 +6,6 @@ type ExportFilterOptions = {
7
6
  svgMode?: SvgExportMode;
8
7
  };
9
8
  export declare function filterRenderedElements(container: HTMLElement, options?: ExportFilterOptions): void;
10
- export declare const getSVG: (container: HTMLElement, clip: Rect, options?: ExportFilterOptions) => string;
11
- /**
12
- * Extract all coordinate points from an SVG path string.
13
- * This includes endpoints AND control points for bezier curves,
14
- * which is important because bezier curves are bounded by the
15
- * convex hull of all their control points.
16
- *
17
- * For S (smooth cubic) and T (smooth quadratic) commands, we also
18
- * include the reflected control point which may extend the bounds.
19
- */
20
- declare function extractPathPoints(pathD: string): Point[];
21
- declare function getNodeBoundsFromDOM(container: HTMLElement, reactFlow?: ReactFlowInstance<Node, Edge>): Rect | undefined;
22
- /**
23
- * Calculate bounds for node SVG overflow content.
24
- *
25
- * Some nodes render elements outside their viewBox (e.g., the initial marking
26
- * arrow in Reachability Graphs extends to negative coordinates). These elements
27
- * are visible because the node SVGs use overflow="visible", but they are NOT
28
- * included in reactFlow.getNodesBounds() which only considers node position
29
- * and dimensions.
30
- *
31
- * This function scans node SVGs for <line>, <path>, and <circle> elements
32
- * that extend outside the node's local coordinate system (viewBox), converts
33
- * them to global coordinates, and returns the bounding box of all such content.
34
- */
35
- declare function getNodeOverflowBoundsFromDOM(container: HTMLElement): Rect | undefined;
36
- declare function mergeBounds(a: Rect, b: Rect): Rect;
9
+ export declare const getSVG: (container: HTMLElement, clip: Rect, options?: ExportFilterOptions, fontFaceCss?: string) => string;
37
10
  export declare function getRenderedDiagramBounds(reactFlow: ReactFlowInstance<Node, Edge>, container: HTMLElement): Rect;
38
- declare function extractStyles(styleString: string): {
39
- transform: {
40
- x: number;
41
- y: number;
42
- };
43
- width: string | null;
44
- height: string | null;
45
- };
46
- type CSSVariableMap = Readonly<Record<string, string>>;
47
- /**
48
- * Resolve a single CSS variable reference to its final value.
49
- * Handles recursive var() resolution and fallback values.
50
- */
51
- declare function resolveCSSVariable(value: string, cssVarMap?: CSSVariableMap): string;
52
- /**
53
- * Replace CSS variables and currentColor in all attributes of an element tree.
54
- *
55
- * @param node - The DOM node to process
56
- * @param inheritedColor - The inherited 'currentColor' value from parent elements
57
- */
58
- declare function replaceCSSVariables(node: Element | ChildNode, inheritedColor?: string, cssVarMap?: CSSVariableMap): void;
59
- /**
60
- * Convert inline style properties to direct SVG attributes for better compatibility.
61
- * PowerPoint and some other applications don't properly parse CSS in style attributes.
62
- */
63
- declare function convertStyleToAttributes(node: Element | ChildNode): void;
64
- /**
65
- * Ensure all <text> elements have explicit font-size, font-weight, and font-family.
66
- *
67
- * In the browser, text inherits these from CSS (:root font-family, default font-size).
68
- * In exported SVGs opened in non-browser renderers, missing attributes cause text to
69
- * render with the renderer's own defaults (often Times New Roman at an arbitrary size).
70
- *
71
- * This pass runs AFTER convertStyleToAttributes so any font props already extracted
72
- * from inline styles are present as attributes.
73
- */
74
- declare function ensureTextFontDefaults(svg: Element): void;
75
- /**
76
- * Replace `text-decoration="underline"` on `<text>` elements with manual
77
- * `<line>` siblings so the underline is visible in non-browser renderers.
78
- *
79
- * resvg 2.6.2 has a rendering bug where 3+ `text-decoration="underline"`
80
- * attributes across nested `<svg>` elements cause unrelated paths (particularly
81
- * vertical lines) to disappear. This workaround removes the problematic
82
- * attribute and draws explicit underline lines using `getBBox()` for accurate
83
- * text measurements.
84
- *
85
- * The SVG must be temporarily attached to the DOM for `getBBox()` to work.
86
- */
87
- declare function replaceTextDecorationWithManualUnderline(svg: SVGSVGElement): void;
88
- /**
89
- * Final safety pass: strip any legacy <marker> references that could sneak in
90
- * from third-party content. Keeps exports clean for PowerPoint/Keynote.
91
- */
92
- declare function removeMarkerElements(svg: Element): void;
93
- /**
94
- * @internal — Exported for unit testing only. Not part of the public API.
95
- */
96
- export declare const __testing: {
97
- readonly filterRenderedElements: typeof filterRenderedElements;
98
- readonly getRenderedDiagramBounds: typeof getRenderedDiagramBounds;
99
- readonly extractPathPoints: typeof extractPathPoints;
100
- readonly extractStyles: typeof extractStyles;
101
- readonly resolveCSSVariable: typeof resolveCSSVariable;
102
- readonly replaceCSSVariables: typeof replaceCSSVariables;
103
- readonly convertStyleToAttributes: typeof convertStyleToAttributes;
104
- readonly ensureTextFontDefaults: typeof ensureTextFontDefaults;
105
- readonly removeMarkerElements: typeof removeMarkerElements;
106
- readonly replaceTextDecorationWithManualUnderline: typeof replaceTextDecorationWithManualUnderline;
107
- readonly mergeBounds: typeof mergeBounds;
108
- readonly getNodeBoundsFromDOM: typeof getNodeBoundsFromDOM;
109
- readonly getNodeOverflowBoundsFromDOM: typeof getNodeOverflowBoundsFromDOM;
110
- };
111
11
  export {};
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Layout math for the floating element palette. The palette is an overlay on
3
+ * the canvas (all viewports — there is no docked variant), so it must lay every
4
+ * element out in a grid that fits the available canvas WITHOUT scrolling.
5
+ *
6
+ * Objective (in priority order):
7
+ * 1. Use the FEWEST columns — a tall, narrow card preserves horizontal canvas
8
+ * space, which is what you actually draw in.
9
+ * 2. Fill the available VERTICAL space — a single column down the side reads
10
+ * like a classic palette and wastes no height.
11
+ * 3. Keep cells comfortably large — never below `COMFORT_MIN_H` just to save a
12
+ * column, and never below the HIG `CELL_MIN_H` touch floor at all.
13
+ *
14
+ * So: walk column counts low→high and take the first one whose cells, sized to
15
+ * fill the height, are still comfortable. Few elements get big capped cells in
16
+ * one column; many elements get a taller single column of moderate cells before
17
+ * a second column is ever added.
18
+ *
19
+ * Cells are rectangular (the dominant elements — class boxes, BPMN tasks — are
20
+ * ~1.6:1 wide); narrower/square elements letterbox centered inside. Sizing the
21
+ * cell, not the SVG, keeps the node components untouched.
22
+ */
23
+ export declare const PALETTE: Readonly<{
24
+ /** HIG/WCAG touch + legibility floor — never shrink a cell past this. */
25
+ readonly CELL_MIN_H: 44;
26
+ /** Bias toward fewer columns: keep a single (or narrower) column as long as
27
+ * its height-filling cells stay at least this big; only add a column when
28
+ * that would drop below it. Just above the touch floor, so the strong
29
+ * preference is fewer columns + filling the height. */
30
+ readonly COMFORT_MIN_H: 48;
31
+ /** Upper bound so few-element palettes don't get absurdly tall cells. */
32
+ readonly CELL_MAX_H: 78;
33
+ /** cellW = round(CELL_RATIO * cellH); ~matches the 160×100 class box. */
34
+ readonly CELL_RATIO: 1.6;
35
+ readonly GAP: 8;
36
+ readonly PAD: 6;
37
+ /** Keep the palette horizontally narrow so the canvas keeps its width … */
38
+ readonly MAX_FRAC_W: 0.5;
39
+ /** … but let it use most of the height. */
40
+ readonly MAX_FRAC_H: 0.9;
41
+ /** Letterbox padding around the preview inside a cell. */
42
+ readonly CONTENT_INSET: 6;
43
+ /** Space kept clear above (top offset) and below (zoom controls) the palette. */
44
+ readonly TOP_RESERVE: 10;
45
+ readonly BOTTOM_RESERVE: 84;
46
+ }>;
47
+ export interface PaletteLayout {
48
+ cols: number;
49
+ cellW: number;
50
+ cellH: number;
51
+ /** True only in the rare case all items can't fit even at the floor size. */
52
+ scroll: boolean;
53
+ }
54
+ /**
55
+ * @param itemCount total grid cells (drag elements + the color-description cell)
56
+ * @param availW measured canvas width
57
+ * @param availH measured canvas height
58
+ * @param chromeH height of non-grid palette chrome (view switch / hint), 0 if none
59
+ */
60
+ export declare function computePaletteLayout(itemCount: number, availW: number, availH: number, chromeH: number): PaletteLayout;
61
+ /**
62
+ * Preview scale that fits an element's natural size into a cell's content box.
63
+ * Elements fill their cell (so they read "big"); wide boxes fit width, tall/
64
+ * square nodes fit height and letterbox.
65
+ */
66
+ export declare function previewScaleForCell(naturalWidth: number, naturalHeight: number, cellW: number, cellH: number): number;