@likec4/diagram 1.35.0 → 1.36.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 (214) hide show
  1. package/bundle/{chunk-C0Eg81Gj.js → chunk-7MPUJFHj.js} +315 -311
  2. package/bundle/custom.js +52 -52
  3. package/bundle/index.js +1583 -739
  4. package/dist/LikeC4Diagram.js +6 -6
  5. package/dist/LikeC4Diagram.props.d.ts +2 -3
  6. package/dist/LikeC4ModelProvider.d.ts +3 -3
  7. package/dist/LikeC4ProjectsProvider.d.ts +17 -0
  8. package/dist/LikeC4ProjectsProvider.js +22 -0
  9. package/dist/LikeC4Styles.d.ts +1 -0
  10. package/dist/LikeC4Styles.js +94 -0
  11. package/dist/StaticLikeC4Diagram.d.ts +3 -3
  12. package/dist/base/BaseXYFlow.js +23 -26
  13. package/dist/base/primitives/MarkdownBlock.d.ts +7 -1
  14. package/dist/base/primitives/MarkdownBlock.js +1 -1
  15. package/dist/base/primitives/compound/CompoundActionButton.js +2 -2
  16. package/dist/base/primitives/compound/CompoundDetailsButton.js +2 -2
  17. package/dist/base/primitives/compound/CompoundNodeContainer.css.js +4 -4
  18. package/dist/base/primitives/compound/CompoundNodeContainer.js +1 -4
  19. package/dist/base/primitives/compound/CompoundTitle.js +9 -8
  20. package/dist/base/primitives/compound/actionbtns.css.js +6 -6
  21. package/dist/base/primitives/edge/EdgeActionButton.js +2 -2
  22. package/dist/base/primitives/edge/EdgeContainer.js +4 -7
  23. package/dist/base/primitives/edge/EdgeLabel.css.d.ts +0 -22
  24. package/dist/base/primitives/edge/EdgeLabel.css.js +6 -84
  25. package/dist/base/primitives/edge/EdgeLabel.js +16 -6
  26. package/dist/base/primitives/edge/EdgeLabelContainer.js +1 -6
  27. package/dist/base/primitives/edge/EdgeMarkers.js +3 -3
  28. package/dist/base/primitives/edge/edge.css.d.ts +0 -2
  29. package/dist/base/primitives/edge/edge.css.js +1 -55
  30. package/dist/base/primitives/element/ElementActionButtons.js +2 -2
  31. package/dist/base/primitives/element/ElementDetailsButton.js +8 -7
  32. package/dist/base/primitives/element/ElementNodeContainer.css.js +4 -4
  33. package/dist/base/primitives/element/ElementNodeContainer.js +1 -4
  34. package/dist/base/primitives/element/ElementShape.css.js +11 -11
  35. package/dist/base/primitives/element/ElementTags.d.ts +1 -0
  36. package/dist/base/primitives/element/ElementTags.js +17 -14
  37. package/dist/bundle/LikeC4View.d.ts +1 -1
  38. package/dist/bundle/LikeC4View.js +7 -1
  39. package/dist/bundle/LikeC4View.props.d.ts +1 -2
  40. package/dist/bundle/ReactLikeC4.d.ts +1 -1
  41. package/dist/bundle/ViewNotFound.js +1 -1
  42. package/dist/bundle/index.d.ts +2 -1
  43. package/dist/bundle/index.js +1 -0
  44. package/dist/bundle/styles.css.js +1 -1
  45. package/dist/components/ErrorFallback.js +1 -1
  46. package/dist/components/GithubIcon.d.ts +2 -0
  47. package/dist/components/GithubIcon.js +17 -0
  48. package/dist/components/Link.d.ts +4 -3
  49. package/dist/components/Link.js +84 -87
  50. package/dist/components/NavigationLink.d.ts +2 -2
  51. package/dist/components/SearchControl.css.js +6 -5
  52. package/dist/context/DiagramEventHandlers.d.ts +6 -6
  53. package/dist/context/DiagramEventHandlers.js +4 -7
  54. package/dist/globals.css.js +3 -0
  55. package/dist/hooks/useXYFlow.d.ts +10 -10
  56. package/dist/index.d.ts +1 -0
  57. package/dist/index.js +1 -0
  58. package/dist/likec4diagram/custom/edges/NotePopover.css.js +2 -2
  59. package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +2 -2
  60. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +1 -1
  61. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.js +7 -7
  62. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +3 -3
  63. package/dist/likec4diagram/custom/edges/edges.css.js +4 -4
  64. package/dist/likec4diagram/custom/index.d.ts +2 -2
  65. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +2 -2
  66. package/dist/likec4diagram/ui/controls/styles.css.js +5 -5
  67. package/dist/likec4diagram/ui/notation/NotationPanel.css.js +11 -11
  68. package/dist/likec4diagram/ui/notation/NotationPanel.js +2 -5
  69. package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.css.js +10 -10
  70. package/dist/likec4model/LikeC4ProjectsContext.d.ts +7 -0
  71. package/dist/likec4model/LikeC4ProjectsContext.js +5 -0
  72. package/dist/likec4model/index.d.ts +1 -0
  73. package/dist/likec4model/useLikeC4Project.d.ts +22 -0
  74. package/dist/likec4model/useLikeC4Project.js +23 -0
  75. package/dist/navigationpanel/NavigationPanel.js +15 -17
  76. package/dist/navigationpanel/NavigationPanelControls.js +34 -21
  77. package/dist/navigationpanel/NavigationPanelDropdown.js +33 -17
  78. package/dist/navigationpanel/_common.js +4 -1
  79. package/dist/navigationpanel/actor.d.ts +11 -15
  80. package/dist/navigationpanel/actor.js +14 -15
  81. package/dist/navigationpanel/controls/BurgerButton.js +5 -7
  82. package/dist/navigationpanel/controls/NavigationButtons.js +37 -24
  83. package/dist/navigationpanel/controls/OpenSource.js +1 -1
  84. package/dist/navigationpanel/controls/SearchControl.js +6 -4
  85. package/dist/navigationpanel/controls/ToggleReadonly.js +3 -3
  86. package/dist/navigationpanel/controls/ViewDetailsCard.d.ts +2 -0
  87. package/dist/navigationpanel/controls/ViewDetailsCard.js +232 -0
  88. package/dist/navigationpanel/controls/index.d.ts +1 -0
  89. package/dist/navigationpanel/dropdown/ProjectsMenu.d.ts +2 -0
  90. package/dist/navigationpanel/dropdown/ProjectsMenu.js +75 -0
  91. package/dist/navigationpanel/editorpanel/EditorPanel.js +3 -3
  92. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +19 -20
  93. package/dist/navigationpanel/editorpanel/styles.js +5 -5
  94. package/dist/navigationpanel/hooks.d.ts +2 -2
  95. package/dist/navigationpanel/styles.css.js +0 -2
  96. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +12 -7
  97. package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +14 -0
  98. package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +14 -0
  99. package/dist/overlays/element-details/ElementDetailsCard.css.js +18 -17
  100. package/dist/overlays/element-details/ElementDetailsCard.js +8 -13
  101. package/dist/overlays/element-details/TabPanelDeployments.css.js +5 -4
  102. package/dist/overlays/element-details/TabPanelRelationships.css.js +7 -7
  103. package/dist/overlays/overlay/Overlay.css.d.ts +3 -3
  104. package/dist/overlays/overlay/Overlay.css.js +8 -7
  105. package/dist/overlays/relationship-details/SelectEdge.css.js +8 -8
  106. package/dist/overlays/relationships-browser/SelectElement.css.js +1 -1
  107. package/dist/search/Search.js +6 -6
  108. package/dist/search/components/ElementsColumn.css.js +5 -5
  109. package/dist/search/components/SearchByTags.js +3 -2
  110. package/dist/search/components/ViewsColum.js +1 -1
  111. package/dist/search/components/ViewsColumn.css.js +1 -1
  112. package/dist/search/components/_shared.css.js +3 -3
  113. package/dist/search/components/styles.css.js +5 -5
  114. package/dist/state/DiagramActorProvider.js +34 -15
  115. package/dist/state/diagram-machine.d.ts +29 -247
  116. package/dist/state/diagram-machine.js +16 -16
  117. package/dist/styles-min.css +1 -1
  118. package/dist/styles.css +1 -1
  119. package/dist/styles.css2.js +1 -1
  120. package/package.json +10 -8
  121. package/panda.buildinfo.json +254 -326
  122. package/src/LikeC4Diagram.props.ts +2 -2
  123. package/src/LikeC4Diagram.tsx +2 -2
  124. package/src/LikeC4ModelProvider.tsx +4 -4
  125. package/src/LikeC4ProjectsProvider.tsx +41 -0
  126. package/src/LikeC4Styles.tsx +107 -0
  127. package/src/StaticLikeC4Diagram.tsx +3 -3
  128. package/src/base/BaseXYFlow.tsx +24 -29
  129. package/src/base/primitives/MarkdownBlock.tsx +11 -3
  130. package/src/base/primitives/compound/CompoundActionButton.tsx +2 -2
  131. package/src/base/primitives/compound/CompoundDetailsButton.tsx +2 -2
  132. package/src/base/primitives/compound/CompoundNodeContainer.css.ts +4 -13
  133. package/src/base/primitives/compound/CompoundNodeContainer.tsx +0 -3
  134. package/src/base/primitives/compound/CompoundTitle.tsx +8 -8
  135. package/src/base/primitives/compound/actionbtns.css.ts +6 -6
  136. package/src/base/primitives/edge/EdgeActionButton.tsx +2 -2
  137. package/src/base/primitives/edge/EdgeContainer.tsx +3 -6
  138. package/src/base/primitives/edge/EdgeLabel.css.ts +4 -83
  139. package/src/base/primitives/edge/EdgeLabel.tsx +16 -10
  140. package/src/base/primitives/edge/EdgeLabelContainer.tsx +1 -6
  141. package/src/base/primitives/edge/EdgeMarkers.tsx +3 -3
  142. package/src/base/primitives/edge/edge.css.ts +0 -60
  143. package/src/base/primitives/element/ElementActionButtons.tsx +2 -2
  144. package/src/base/primitives/element/ElementDetailsButton.tsx +7 -7
  145. package/src/base/primitives/element/ElementNodeContainer.css.ts +4 -4
  146. package/src/base/primitives/element/ElementNodeContainer.tsx +0 -3
  147. package/src/base/primitives/element/ElementShape.css.ts +11 -11
  148. package/src/base/primitives/element/ElementTags.tsx +17 -14
  149. package/src/bundle/LikeC4View.props.ts +1 -2
  150. package/src/bundle/LikeC4View.tsx +10 -3
  151. package/src/bundle/ReactLikeC4.tsx +1 -2
  152. package/src/bundle/ViewNotFound.tsx +1 -1
  153. package/src/bundle/index.ts +2 -1
  154. package/src/bundle/styles.css.ts +1 -1
  155. package/src/components/ErrorFallback.tsx +1 -1
  156. package/src/components/GithubIcon.tsx +16 -0
  157. package/src/components/Link.tsx +102 -113
  158. package/src/components/NavigationLink.tsx +2 -1
  159. package/src/components/SearchControl.css.ts +5 -5
  160. package/src/context/DiagramEventHandlers.tsx +12 -12
  161. package/src/globals.css +71 -0
  162. package/src/index.ts +5 -0
  163. package/src/likec4diagram/custom/edges/NotePopover.css.ts +2 -2
  164. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +1 -1
  165. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.ts +7 -7
  166. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +3 -3
  167. package/src/likec4diagram/custom/edges/edges.css.ts +4 -4
  168. package/src/likec4diagram/custom/nodes/toolbar/CompoundToolbar.tsx +2 -2
  169. package/src/likec4diagram/ui/controls/styles.css.ts +5 -5
  170. package/src/likec4diagram/ui/notation/NotationPanel.css.ts +11 -11
  171. package/src/likec4diagram/ui/notation/NotationPanel.tsx +1 -4
  172. package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.css.ts +10 -10
  173. package/src/likec4model/LikeC4ProjectsContext.ts +9 -0
  174. package/src/likec4model/index.ts +8 -0
  175. package/src/likec4model/useLikeC4Project.ts +61 -0
  176. package/src/navigationpanel/NavigationPanel.tsx +16 -17
  177. package/src/navigationpanel/NavigationPanelControls.tsx +24 -46
  178. package/src/navigationpanel/NavigationPanelDropdown.tsx +32 -16
  179. package/src/navigationpanel/_common.tsx +4 -1
  180. package/src/navigationpanel/actor.ts +14 -15
  181. package/src/navigationpanel/controls/BurgerButton.tsx +5 -7
  182. package/src/navigationpanel/controls/NavigationButtons.tsx +9 -1
  183. package/src/navigationpanel/controls/OpenSource.tsx +1 -1
  184. package/src/navigationpanel/controls/SearchControl.tsx +6 -4
  185. package/src/navigationpanel/controls/ToggleReadonly.tsx +3 -3
  186. package/src/navigationpanel/controls/ViewDetailsCard.tsx +244 -0
  187. package/src/navigationpanel/controls/index.ts +1 -0
  188. package/src/navigationpanel/dropdown/ProjectsMenu.tsx +74 -0
  189. package/src/navigationpanel/editorpanel/EditorPanel.tsx +3 -3
  190. package/src/navigationpanel/editorpanel/ManualLayoutToolsButton.tsx +19 -22
  191. package/src/navigationpanel/editorpanel/styles.ts +5 -5
  192. package/src/navigationpanel/hooks.tsx +2 -2
  193. package/src/navigationpanel/styles.css.ts +0 -2
  194. package/src/navigationpanel/walkthrough/ActiveWalkthroughControls.tsx +9 -4
  195. package/src/overlays/element-details/ElementDetailsCard.css.ts +17 -17
  196. package/src/overlays/element-details/ElementDetailsCard.tsx +8 -13
  197. package/src/overlays/element-details/TabPanelDeployments.css.ts +4 -4
  198. package/src/overlays/element-details/TabPanelRelationships.css.ts +7 -7
  199. package/src/overlays/overlay/Overlay.css.ts +7 -7
  200. package/src/overlays/relationship-details/SelectEdge.css.ts +8 -8
  201. package/src/overlays/relationships-browser/SelectElement.css.ts +1 -1
  202. package/src/search/Search.tsx +6 -6
  203. package/src/search/components/ElementsColumn.css.ts +5 -5
  204. package/src/search/components/SearchByTags.tsx +2 -2
  205. package/src/search/components/ViewsColum.tsx +1 -1
  206. package/src/search/components/ViewsColumn.css.ts +1 -1
  207. package/src/search/components/_shared.css.ts +3 -3
  208. package/src/search/components/styles.css.ts +5 -5
  209. package/src/state/DiagramActorProvider.tsx +45 -20
  210. package/src/state/diagram-machine.ts +22 -16
  211. package/dist/LikeC4CustomColors.d.ts +0 -2
  212. package/dist/LikeC4CustomColors.js +0 -45
  213. package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +0 -45
  214. package/src/LikeC4CustomColors.tsx +0 -85
@@ -5,7 +5,7 @@ import { useStoreApi } from '@xyflow/react';
5
5
  import { shallowEqual, deepEqual } from 'fast-equals';
6
6
  import { useRef, useEffect, useState } from 'react';
7
7
  import { ErrorBoundary } from '../components/ErrorFallback.js';
8
- import { useDiagramEventHandlersRef } from '../context/DiagramEventHandlers.js';
8
+ import { useDiagramEventHandlers } from '../context/DiagramEventHandlers.js';
9
9
  import { useEnabledFeatures, DiagramFeatures } from '../context/DiagramFeatures.js';
10
10
  import { DiagramActorContextProvider } from '../hooks/safeContext.js';
11
11
  import { useCurrentViewId } from '../hooks/useCurrentViewId.js';
@@ -33,24 +33,11 @@ function DiagramActorProvider({
33
33
  where,
34
34
  children
35
35
  }) {
36
- const handlersRef = useDiagramEventHandlersRef();
36
+ const { handlersRef } = useDiagramEventHandlers();
37
37
  const xystore = useStoreApi();
38
38
  const machineRef = useRef(null);
39
39
  if (!machineRef.current) {
40
40
  machineRef.current = diagramMachine.provide({
41
- actions: {
42
- "trigger:NavigateTo": (_, { viewId }) => {
43
- setTimeout(() => {
44
- handlersRef.current.onNavigateTo?.(viewId);
45
- }, 40);
46
- },
47
- "trigger:OnChange": (_, params) => {
48
- handlersRef.current.onChange?.(params);
49
- },
50
- "trigger:OpenSource": (_, params) => {
51
- handlersRef.current.onOpenSource?.(params);
52
- }
53
- },
54
41
  actors: {
55
42
  syncManualLayoutActorLogic: syncManualLayoutActorLogic.provide({
56
43
  actions: {
@@ -78,6 +65,7 @@ function DiagramActorProvider({
78
65
  }
79
66
  }
80
67
  );
68
+ useActorEventHandlers(actorRef);
81
69
  const features = useEnabledFeatures();
82
70
  useCustomCompareEffect(
83
71
  () => {
@@ -129,5 +117,36 @@ Make sure you have LikeC4ModelProvider with layouted model.`);
129
117
  }
130
118
  return /* @__PURE__ */ jsx(CurrentViewModelContext.Provider, { value: viewmodel, children });
131
119
  }
120
+ function useActorEventHandlers(actorRef) {
121
+ const {
122
+ onChange,
123
+ onNavigateTo,
124
+ onOpenSource
125
+ } = useDiagramEventHandlers();
126
+ useEffect(() => {
127
+ if (!onChange) return;
128
+ const subscription = actorRef.on("viewChange", ({ change }) => onChange({ change }));
129
+ return () => subscription.unsubscribe();
130
+ }, [actorRef, onChange]);
131
+ useEffect(() => {
132
+ if (!onNavigateTo) return;
133
+ let frame;
134
+ const subscription = actorRef.on("navigateTo", ({ viewId }) => {
135
+ cancelAnimationFrame(frame);
136
+ frame = requestAnimationFrame(() => {
137
+ onNavigateTo(viewId);
138
+ });
139
+ });
140
+ return () => {
141
+ cancelAnimationFrame(frame);
142
+ subscription.unsubscribe();
143
+ };
144
+ }, [actorRef, onNavigateTo]);
145
+ useEffect(() => {
146
+ if (!onOpenSource) return;
147
+ const subscription = actorRef.on("openSource", ({ params }) => onOpenSource(params));
148
+ return () => subscription.unsubscribe();
149
+ }, [actorRef, onOpenSource]);
150
+ }
132
151
 
133
152
  export { DiagramActorProvider };
@@ -1,8 +1,8 @@
1
- import { DiagramView, EdgeId, Fqn, NodeId, NodeNotation as ElementNotation, StepEdgeId, ViewChange, ViewId, XYPoint, BBox, NonEmptyArray, Point, Color, RelationshipArrowType, RelationshipLineType } from '@likec4/core';
1
+ import { DiagramView, EdgeId, Fqn, NodeId, NodeNotation as ElementNotation, StepEdgeId, ViewChange, ViewId, XYPoint, BBox, NonEmptyArray, Point, Color, RelationshipArrowType, RelationshipLineType, MarkdownOrString } from '@likec4/core';
2
2
  import { ReactFlowInstance, useStoreApi } from '@xyflow/react';
3
3
  import { EdgeChange, NodeChange, Rect, Viewport, EdgeMarkerType, HandleType, XYPosition } from '@xyflow/system';
4
4
  import { PartialDeep } from 'type-fest';
5
- import { ActorLogicFrom, ActorRef, AnyEventObject, Snapshot, StateMachine, ActorRefFromLogic, Values, NonReducibleUnknown, EventObject, MetaObject, ConditionalRequired, InputFrom, RequiredActorOptions, IsNotNever, GetConcreteByKey, AnyActorLogic, RequiredLogicInput, MachineSnapshot, AnyActorRef, StateValue, ActionFunction, CancelAction, StopAction } from 'xstate';
5
+ import { ActorLogicFrom, ActorRef, AnyEventObject, Snapshot, StateMachine, ActorRefFromLogic, Values, NonReducibleUnknown, MetaObject, ConditionalRequired, InputFrom, RequiredActorOptions, IsNotNever, GetConcreteByKey, AnyActorLogic, RequiredLogicInput, MachineSnapshot, AnyActorRef, StateValue, ActionFunction, CancelAction, StopAction } from 'xstate';
6
6
  import { Base } from '../base/types';
7
7
  import { EnabledFeatures, FeatureName } from '../context/DiagramFeatures';
8
8
  import { OpenSourceParams, ViewPadding } from '../LikeC4Diagram.props';
@@ -192,6 +192,16 @@ export type Events = HotKeyEvent | {
192
192
  feature: FeatureName;
193
193
  forceValue?: boolean;
194
194
  };
195
+ export type EmittedEvents = {
196
+ type: 'navigateTo';
197
+ viewId: ViewId;
198
+ } | {
199
+ type: 'viewChange';
200
+ change: ViewChange;
201
+ } | {
202
+ type: 'openSource';
203
+ params: OpenSourceParams;
204
+ };
195
205
  export type ActionArg = {
196
206
  context: Context;
197
207
  event: Events;
@@ -283,9 +293,7 @@ declare const _diagramMachine: StateMachine<Context, Events, {
283
293
  };
284
294
  "trigger:NavigateTo": {
285
295
  type: "trigger:NavigateTo";
286
- params: {
287
- viewId: ViewId;
288
- };
296
+ params: NonReducibleUnknown;
289
297
  };
290
298
  "trigger:OpenSource": {
291
299
  type: "trigger:OpenSource";
@@ -419,7 +427,7 @@ declare const _diagramMachine: StateMachine<Context, Events, {
419
427
  };
420
428
  }>, never, "isReady" | "initializing" | "navigating" | {
421
429
  ready: "idle" | "walkthrough" | "focused";
422
- }, string, Input, NonReducibleUnknown, EventObject, MetaObject, {
430
+ }, string, Input, NonReducibleUnknown, EmittedEvents, MetaObject, {
423
431
  readonly initial: "initializing";
424
432
  readonly context: ({ input }: {
425
433
  spawn: {
@@ -901,7 +909,7 @@ declare const _diagramMachine: StateMachine<Context, Events, {
901
909
  tail: RelationshipArrowType | undefined;
902
910
  labelBBox: BBox | null | undefined;
903
911
  navigateTo: ViewId<string> | null | undefined;
904
- notes: string | undefined;
912
+ notes: MarkdownOrString | undefined;
905
913
  labelXY: XYPosition | null;
906
914
  controlPoints: XYPosition[] | undefined | null;
907
915
  };
@@ -951,7 +959,7 @@ declare const _diagramMachine: StateMachine<Context, Events, {
951
959
  tail: RelationshipArrowType | undefined;
952
960
  labelBBox: BBox | null | undefined;
953
961
  navigateTo: ViewId<string> | null | undefined;
954
- notes: string | undefined;
962
+ notes: MarkdownOrString | undefined;
955
963
  labelXY: XYPosition | null;
956
964
  controlPoints: XYPosition[] | undefined | null;
957
965
  };
@@ -1008,7 +1016,7 @@ declare const _diagramMachine: StateMachine<Context, Events, {
1008
1016
  tail: RelationshipArrowType | undefined;
1009
1017
  labelBBox: BBox | null | undefined;
1010
1018
  navigateTo: ViewId<string> | null | undefined;
1011
- notes: string | undefined;
1019
+ notes: MarkdownOrString | undefined;
1012
1020
  labelXY: XYPosition | null;
1013
1021
  controlPoints: XYPosition[] | undefined | null;
1014
1022
  };
@@ -1058,7 +1066,7 @@ declare const _diagramMachine: StateMachine<Context, Events, {
1058
1066
  tail: RelationshipArrowType | undefined;
1059
1067
  labelBBox: BBox | null | undefined;
1060
1068
  navigateTo: ViewId<string> | null | undefined;
1061
- notes: string | undefined;
1069
+ notes: MarkdownOrString | undefined;
1062
1070
  labelXY: XYPosition | null;
1063
1071
  controlPoints: XYPosition[] | undefined | null;
1064
1072
  };
@@ -1355,9 +1363,7 @@ declare const _diagramMachine: StateMachine<Context, Events, {
1355
1363
  };
1356
1364
  "trigger:NavigateTo": {
1357
1365
  type: "trigger:NavigateTo";
1358
- params: {
1359
- viewId: ViewId;
1360
- };
1366
+ params: NonReducibleUnknown;
1361
1367
  };
1362
1368
  "trigger:OpenSource": {
1363
1369
  type: "trigger:OpenSource";
@@ -1489,7 +1495,7 @@ declare const _diagramMachine: StateMachine<Context, Events, {
1489
1495
  type: "click: selected edge";
1490
1496
  params: unknown;
1491
1497
  };
1492
- }>, never, EventObject>;
1498
+ }>, never, EmittedEvents>;
1493
1499
  readonly on: {
1494
1500
  readonly 'xyflow.nodeClick': readonly [{
1495
1501
  readonly guard: "click: focused node";
@@ -1729,9 +1735,7 @@ declare const _diagramMachine: StateMachine<Context, Events, {
1729
1735
  };
1730
1736
  "trigger:NavigateTo": {
1731
1737
  type: "trigger:NavigateTo";
1732
- params: {
1733
- viewId: ViewId;
1734
- };
1738
+ params: NonReducibleUnknown;
1735
1739
  };
1736
1740
  "trigger:OpenSource": {
1737
1741
  type: "trigger:OpenSource";
@@ -1863,7 +1867,7 @@ declare const _diagramMachine: StateMachine<Context, Events, {
1863
1867
  type: "click: selected edge";
1864
1868
  params: unknown;
1865
1869
  };
1866
- }>, never, EventObject>;
1870
+ }>, never, EmittedEvents>;
1867
1871
  };
1868
1872
  readonly 'xyflow.edgeClick': {
1869
1873
  readonly actions: readonly [ ActionFunction<Context, {
@@ -1997,9 +2001,7 @@ declare const _diagramMachine: StateMachine<Context, Events, {
1997
2001
  };
1998
2002
  "trigger:NavigateTo": {
1999
2003
  type: "trigger:NavigateTo";
2000
- params: {
2001
- viewId: ViewId;
2002
- };
2004
+ params: NonReducibleUnknown;
2003
2005
  };
2004
2006
  "trigger:OpenSource": {
2005
2007
  type: "trigger:OpenSource";
@@ -2131,229 +2133,13 @@ declare const _diagramMachine: StateMachine<Context, Events, {
2131
2133
  type: "click: selected edge";
2132
2134
  params: unknown;
2133
2135
  };
2134
- }>, never, EventObject>;
2136
+ }>, never, EmittedEvents>;
2135
2137
  };
2136
2138
  };
2137
2139
  };
2138
2140
  readonly navigating: {
2139
2141
  readonly id: "navigating";
2140
- readonly entry: readonly ["closeAllOverlays", "closeSearch", "stopSyncLayout", ActionFunction<Context, Events, Events, undefined, Values<{
2141
- syncManualLayoutActorLogic: {
2142
- src: "syncManualLayoutActorLogic";
2143
- logic: SyncLayoutActorLogic;
2144
- id: "syncLayout";
2145
- };
2146
- hotkeyActorLogic: {
2147
- src: "hotkeyActorLogic";
2148
- logic: HotkeyActorLogic;
2149
- id: "hotkey";
2150
- };
2151
- overlaysActorLogic: {
2152
- src: "overlaysActorLogic";
2153
- logic: OverlaysActorLogic;
2154
- id: "overlays";
2155
- };
2156
- searchActorLogic: {
2157
- src: "searchActorLogic";
2158
- logic: SearchActorLogic;
2159
- id: "search";
2160
- };
2161
- }>, Values<{
2162
- onNodeMouseEnter: {
2163
- type: "onNodeMouseEnter";
2164
- params: {
2165
- node: Types.Node;
2166
- };
2167
- };
2168
- onNodeMouseLeave: {
2169
- type: "onNodeMouseLeave";
2170
- params: {
2171
- node: Types.Node;
2172
- };
2173
- };
2174
- onEdgeMouseEnter: {
2175
- type: "onEdgeMouseEnter";
2176
- params: {
2177
- edge: Types.Edge;
2178
- };
2179
- };
2180
- onEdgeMouseLeave: {
2181
- type: "onEdgeMouseLeave";
2182
- params: {
2183
- edge: Types.Edge;
2184
- };
2185
- };
2186
- "trigger:OnChange": {
2187
- type: "trigger:OnChange";
2188
- params: {
2189
- change: ViewChange;
2190
- };
2191
- };
2192
- "layout.align": {
2193
- type: "layout.align";
2194
- params: {
2195
- mode: AlignmentMode;
2196
- };
2197
- };
2198
- "notations.highlight": {
2199
- type: "notations.highlight";
2200
- params: {
2201
- notation: ElementNotation;
2202
- kind?: string;
2203
- };
2204
- };
2205
- "tag.highlight": {
2206
- type: "tag.highlight";
2207
- params: NonReducibleUnknown;
2208
- };
2209
- "xyflow:fitDiagram": {
2210
- type: "xyflow:fitDiagram";
2211
- params: {
2212
- duration?: number;
2213
- bounds?: BBox;
2214
- } | undefined;
2215
- };
2216
- closeAllOverlays: {
2217
- type: "closeAllOverlays";
2218
- params: NonReducibleUnknown;
2219
- };
2220
- "trigger:NavigateTo": {
2221
- type: "trigger:NavigateTo";
2222
- params: {
2223
- viewId: ViewId;
2224
- };
2225
- };
2226
- "trigger:OpenSource": {
2227
- type: "trigger:OpenSource";
2228
- params: OpenSourceParams;
2229
- };
2230
- "assign lastClickedNode": {
2231
- type: "assign lastClickedNode";
2232
- params: NonReducibleUnknown;
2233
- };
2234
- "open source of focused or last clicked node": {
2235
- type: "open source of focused or last clicked node";
2236
- params: NonReducibleUnknown;
2237
- };
2238
- "xyflow:fitFocusedBounds": {
2239
- type: "xyflow:fitFocusedBounds";
2240
- params: unknown;
2241
- };
2242
- "xyflow:setViewportCenter": {
2243
- type: "xyflow:setViewportCenter";
2244
- params: {
2245
- x: number;
2246
- y: number;
2247
- };
2248
- };
2249
- "xyflow:setViewport": {
2250
- type: "xyflow:setViewport";
2251
- params: {
2252
- viewport: Viewport;
2253
- duration?: number;
2254
- };
2255
- };
2256
- "xyflow:alignNodeFromToAfterNavigate": {
2257
- type: "xyflow:alignNodeFromToAfterNavigate";
2258
- params: {
2259
- fromNode: NodeId;
2260
- toPosition: XYPoint;
2261
- };
2262
- };
2263
- "ensure overlays actor state": {
2264
- type: "ensure overlays actor state";
2265
- params: NonReducibleUnknown;
2266
- };
2267
- "ensure search actor state": {
2268
- type: "ensure search actor state";
2269
- params: NonReducibleUnknown;
2270
- };
2271
- updateFeatures: {
2272
- type: "updateFeatures";
2273
- params: NonReducibleUnknown;
2274
- };
2275
- closeSearch: {
2276
- type: "closeSearch";
2277
- params: NonReducibleUnknown;
2278
- };
2279
- startSyncLayout: {
2280
- type: "startSyncLayout";
2281
- params: NonReducibleUnknown;
2282
- };
2283
- stopSyncLayout: {
2284
- type: "stopSyncLayout";
2285
- params: NonReducibleUnknown;
2286
- };
2287
- "focus on nodes and edges": {
2288
- type: "focus on nodes and edges";
2289
- params: NonReducibleUnknown;
2290
- };
2291
- "undim everything": {
2292
- type: "undim everything";
2293
- params: NonReducibleUnknown;
2294
- };
2295
- "update active walkthrough": {
2296
- type: "update active walkthrough";
2297
- params: NonReducibleUnknown;
2298
- };
2299
- }>, Values<{
2300
- isReady: {
2301
- type: "isReady";
2302
- params: unknown;
2303
- };
2304
- "enabled: FitView": {
2305
- type: "enabled: FitView";
2306
- params: unknown;
2307
- };
2308
- "enabled: FocusMode": {
2309
- type: "enabled: FocusMode";
2310
- params: unknown;
2311
- };
2312
- "enabled: Readonly": {
2313
- type: "enabled: Readonly";
2314
- params: unknown;
2315
- };
2316
- "enabled: RelationshipDetails": {
2317
- type: "enabled: RelationshipDetails";
2318
- params: unknown;
2319
- };
2320
- "enabled: Search": {
2321
- type: "enabled: Search";
2322
- params: unknown;
2323
- };
2324
- "not readonly": {
2325
- type: "not readonly";
2326
- params: unknown;
2327
- };
2328
- "is dynamic view": {
2329
- type: "is dynamic view";
2330
- params: unknown;
2331
- };
2332
- "is another view": {
2333
- type: "is another view";
2334
- params: unknown;
2335
- };
2336
- "click: selected node": {
2337
- type: "click: selected node";
2338
- params: unknown;
2339
- };
2340
- "click: same node": {
2341
- type: "click: same node";
2342
- params: unknown;
2343
- };
2344
- "click: focused node": {
2345
- type: "click: focused node";
2346
- params: unknown;
2347
- };
2348
- "click: node has connections": {
2349
- type: "click: node has connections";
2350
- params: unknown;
2351
- };
2352
- "click: selected edge": {
2353
- type: "click: selected edge";
2354
- params: unknown;
2355
- };
2356
- }>, never, EventObject>];
2142
+ readonly entry: readonly ["closeAllOverlays", "closeSearch", "stopSyncLayout", "trigger:NavigateTo"];
2357
2143
  readonly on: {
2358
2144
  readonly 'update.view': {
2359
2145
  readonly actions: ActionFunction<Context, {
@@ -2443,9 +2229,7 @@ declare const _diagramMachine: StateMachine<Context, Events, {
2443
2229
  };
2444
2230
  "trigger:NavigateTo": {
2445
2231
  type: "trigger:NavigateTo";
2446
- params: {
2447
- viewId: ViewId;
2448
- };
2232
+ params: NonReducibleUnknown;
2449
2233
  };
2450
2234
  "trigger:OpenSource": {
2451
2235
  type: "trigger:OpenSource";
@@ -2577,7 +2361,7 @@ declare const _diagramMachine: StateMachine<Context, Events, {
2577
2361
  type: "click: selected edge";
2578
2362
  params: unknown;
2579
2363
  };
2580
- }>, never, EventObject>;
2364
+ }>, never, EmittedEvents>;
2581
2365
  readonly target: "#idle";
2582
2366
  };
2583
2367
  };
@@ -2841,9 +2625,7 @@ declare const _diagramMachine: StateMachine<Context, Events, {
2841
2625
  };
2842
2626
  "trigger:NavigateTo": {
2843
2627
  type: "trigger:NavigateTo";
2844
- params: {
2845
- viewId: ViewId;
2846
- };
2628
+ params: NonReducibleUnknown;
2847
2629
  };
2848
2630
  "trigger:OpenSource": {
2849
2631
  type: "trigger:OpenSource";
@@ -2975,7 +2757,7 @@ declare const _diagramMachine: StateMachine<Context, Events, {
2975
2757
  type: "click: selected edge";
2976
2758
  params: unknown;
2977
2759
  };
2978
- }>, never, EventObject>];
2760
+ }>, never, EmittedEvents>];
2979
2761
  };
2980
2762
  readonly 'update.inputs': {
2981
2763
  readonly actions: ActionFunction<Context, {
@@ -2,7 +2,7 @@ import { nonNullable, invariant, nonexhaustive, BBox, isStepEdgeId, getParallelS
2
2
  import { getViewportForBounds, applyEdgeChanges, applyNodeChanges } from '@xyflow/react';
3
3
  import { nodeToRect } from '@xyflow/system';
4
4
  import { hasAtLeast, prop, clamp, first } from 'remeda';
5
- import { setup, assign, enqueueActions, sendTo, assertEvent, cancel, stopChild, raise, spawnChild, and, or } from 'xstate';
5
+ import { setup, assign, enqueueActions, sendTo, emit, assertEvent, cancel, stopChild, raise, spawnChild, and, or } from 'xstate';
6
6
  import { MinZoom } from '../base/const.js';
7
7
  import { AllDisabled } from '../context/DiagramFeatures.js';
8
8
  import { createLayoutConstraints } from '../likec4diagram/useLayoutConstraints.js';
@@ -21,7 +21,8 @@ const _diagramMachine = setup({
21
21
  context: {},
22
22
  input: {},
23
23
  children: {},
24
- events: {}
24
+ events: {},
25
+ emitted: {}
25
26
  },
26
27
  actors: {
27
28
  syncManualLayoutActorLogic,
@@ -70,12 +71,18 @@ const _diagramMachine = setup({
70
71
  }
71
72
  },
72
73
  actions: {
73
- "trigger:NavigateTo": (_, _params) => {
74
- },
75
- "trigger:OnChange": (_, _params) => {
76
- },
77
- "trigger:OpenSource": (_, _params) => {
78
- },
74
+ "trigger:NavigateTo": emit(({ context }) => ({
75
+ type: "navigateTo",
76
+ viewId: nonNullable(context.lastOnNavigate, "Invalid state, lastOnNavigate is null").toView
77
+ })),
78
+ "trigger:OnChange": emit((_, _params) => ({
79
+ type: "viewChange",
80
+ change: _params.change
81
+ })),
82
+ "trigger:OpenSource": emit((_, _params) => ({
83
+ type: "openSource",
84
+ params: _params
85
+ })),
79
86
  "assign lastClickedNode": assign(({ context, event }) => {
80
87
  assertEvent(event, "xyflow.nodeClick");
81
88
  return {
@@ -819,14 +826,7 @@ const _diagramMachine = setup({
819
826
  "closeAllOverlays",
820
827
  "closeSearch",
821
828
  "stopSyncLayout",
822
- enqueueActions(({ enqueue, context }) => {
823
- enqueue({
824
- type: "trigger:NavigateTo",
825
- params: {
826
- viewId: nonNullable(context.lastOnNavigate, "Invalid state, lastOnNavigate is null").toView
827
- }
828
- });
829
- })
829
+ "trigger:NavigateTo"
830
830
  ],
831
831
  on: {
832
832
  "update.view": {