@likec4/diagram 1.18.0 → 1.19.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 (277) hide show
  1. package/LICENSE +1 -1
  2. package/dist/LikeC4CustomColors.d.ts +7 -0
  3. package/dist/LikeC4CustomColors.js +30 -0
  4. package/dist/LikeC4Diagram.css.d.ts +5 -0
  5. package/dist/LikeC4Diagram.css.js +13 -0
  6. package/dist/LikeC4Diagram.d.ts +6 -0
  7. package/dist/LikeC4Diagram.js +194 -0
  8. package/dist/LikeC4Diagram.props.d.ts +166 -0
  9. package/dist/LikeC4ModelProvider.d.ts +9 -0
  10. package/dist/LikeC4ModelProvider.js +12 -0
  11. package/dist/LikeC4Search.css.d.ts +1 -0
  12. package/dist/LikeC4Search.css.js +5 -0
  13. package/dist/LikeC4Search.d.ts +2 -0
  14. package/dist/LikeC4Search.js +96 -0
  15. package/dist/StaticLikeC4Diagram.d.ts +3 -0
  16. package/dist/StaticLikeC4Diagram.js +41 -0
  17. package/dist/_virtual/_commonjsHelpers.js +6 -0
  18. package/dist/controls/Text.d.ts +2 -0
  19. package/dist/controls/Text.js +7 -0
  20. package/dist/controls/action-button-bar/ActionButtonBar.css.d.ts +1 -0
  21. package/dist/controls/action-button-bar/ActionButtonBar.css.js +5 -0
  22. package/dist/controls/action-button-bar/ActionButtonBar.d.ts +9 -0
  23. package/dist/controls/action-button-bar/ActionButtonBar.js +100 -0
  24. package/dist/controls/action-button-bar/useActionButtonBarCtx.d.ts +10 -0
  25. package/dist/controls/action-button-bar/useActionButtonBarCtx.js +9 -0
  26. package/dist/controls/action-buttons/ActionButton.css.d.ts +1 -0
  27. package/dist/controls/action-buttons/ActionButton.css.js +5 -0
  28. package/dist/controls/action-buttons/ActionButton.d.ts +9 -0
  29. package/dist/controls/action-buttons/ActionButton.js +66 -0
  30. package/dist/controls/action-buttons/ActionButtons.d.ts +12 -0
  31. package/dist/controls/action-buttons/ActionButtons.js +99 -0
  32. package/dist/globals.css.d.ts +1 -0
  33. package/dist/globals.css.js +92 -0
  34. package/dist/hooks/index.d.ts +5 -0
  35. package/dist/hooks/useDiagramState.d.ts +6 -0
  36. package/dist/hooks/useDiagramState.js +27 -0
  37. package/dist/hooks/useMantinePortalProps.d.ts +9 -0
  38. package/dist/hooks/useMantinePortalProps.js +9 -0
  39. package/dist/hooks/useSetState.d.ts +2 -0
  40. package/dist/hooks/useSetState.js +19 -0
  41. package/dist/hooks/useUpdateEffect.d.ts +4 -0
  42. package/dist/hooks/useUpdateEffect.js +32 -0
  43. package/dist/hooks/useXYFlow.d.ts +270 -0
  44. package/dist/hooks/useXYFlow.js +20 -0
  45. package/dist/index.d.ts +11 -0
  46. package/dist/index.js +25 -0
  47. package/dist/likec4model/LikeC4ModelContext.d.ts +3 -0
  48. package/dist/likec4model/LikeC4ModelContext.js +5 -0
  49. package/dist/likec4model/index.d.ts +2 -0
  50. package/dist/likec4model/useLikeC4ElementsTree.d.ts +12 -0
  51. package/dist/likec4model/useLikeC4ElementsTree.js +25 -0
  52. package/dist/likec4model/useLikeC4Model.d.ts +20 -0
  53. package/dist/likec4model/useLikeC4Model.js +55 -0
  54. package/dist/overlays/OverlayContext.d.ts +10 -0
  55. package/dist/overlays/OverlayContext.js +9 -0
  56. package/dist/overlays/Overlays.css.d.ts +3 -0
  57. package/dist/overlays/Overlays.css.js +7 -0
  58. package/dist/overlays/Overlays.d.ts +2 -0
  59. package/dist/overlays/Overlays.js +137 -0
  60. package/dist/overlays/edge-details/EdgeDetailsXYFlow.d.ts +5 -0
  61. package/dist/overlays/edge-details/EdgeDetailsXYFlow.js +185 -0
  62. package/dist/overlays/edge-details/SelectEdge.css.d.ts +7 -0
  63. package/dist/overlays/edge-details/SelectEdge.css.js +17 -0
  64. package/dist/overlays/edge-details/SelectEdge.d.ts +5 -0
  65. package/dist/overlays/edge-details/SelectEdge.js +129 -0
  66. package/dist/overlays/edge-details/_types.d.ts +14 -0
  67. package/dist/overlays/edge-details/use-layouted-edge-details.d.ts +21 -0
  68. package/dist/overlays/edge-details/use-layouted-edge-details.js +270 -0
  69. package/dist/overlays/edge-details/xyflow/CompoundNode.d.ts +5 -0
  70. package/dist/overlays/edge-details/xyflow/CompoundNode.js +76 -0
  71. package/dist/overlays/edge-details/xyflow/ElementNode.d.ts +5 -0
  72. package/dist/overlays/edge-details/xyflow/ElementNode.js +159 -0
  73. package/dist/overlays/edge-details/xyflow/RelationshipEdge.d.ts +3 -0
  74. package/dist/overlays/edge-details/xyflow/RelationshipEdge.js +84 -0
  75. package/dist/overlays/edge-details/xyflow/styles.css.d.ts +9 -0
  76. package/dist/overlays/edge-details/xyflow/styles.css.js +21 -0
  77. package/dist/overlays/element-details/ElementDetailsCard.css.d.ts +16 -0
  78. package/dist/overlays/element-details/ElementDetailsCard.css.js +33 -0
  79. package/dist/overlays/element-details/ElementDetailsCard.d.ts +7 -0
  80. package/dist/overlays/element-details/ElementDetailsCard.js +484 -0
  81. package/dist/overlays/element-details/TabPanelDeployments.css.d.ts +4 -0
  82. package/dist/overlays/element-details/TabPanelDeployments.css.js +11 -0
  83. package/dist/overlays/element-details/TabPanelDeployments.d.ts +7 -0
  84. package/dist/overlays/element-details/TabPanelDeployments.js +173 -0
  85. package/dist/overlays/element-details/TabPanelRelationships.css.d.ts +5 -0
  86. package/dist/overlays/element-details/TabPanelRelationships.css.js +11 -0
  87. package/dist/overlays/element-details/TabPanelRelationships.d.ts +8 -0
  88. package/dist/overlays/element-details/TabPanelRelationships.js +157 -0
  89. package/dist/overlays/element-details/TabPanelStructure.css.d.ts +2 -0
  90. package/dist/overlays/element-details/TabPanelStructure.css.js +7 -0
  91. package/dist/overlays/element-details/TabPanelStructure.d.ts +25 -0
  92. package/dist/overlays/element-details/TabPanelStructure.js +91 -0
  93. package/dist/overlays/index.d.ts +1 -0
  94. package/dist/overlays/relationships-of/RelationshipsOverlay.d.ts +5 -0
  95. package/dist/overlays/relationships-of/RelationshipsOverlay.js +193 -0
  96. package/dist/overlays/relationships-of/RelationshipsXYFlow.d.ts +19 -0
  97. package/dist/overlays/relationships-of/RelationshipsXYFlow.js +290 -0
  98. package/dist/overlays/relationships-of/SelectElement.css.d.ts +2 -0
  99. package/dist/overlays/relationships-of/SelectElement.css.js +7 -0
  100. package/dist/overlays/relationships-of/SelectElement.d.ts +7 -0
  101. package/dist/overlays/relationships-of/SelectElement.js +126 -0
  102. package/dist/overlays/relationships-of/_types.d.ts +28 -0
  103. package/dist/overlays/relationships-of/use-layouted-relationships.d.ts +22 -0
  104. package/dist/overlays/relationships-of/use-layouted-relationships.js +496 -0
  105. package/dist/overlays/relationships-of/xyflow/CompoundNode.d.ts +6 -0
  106. package/dist/overlays/relationships-of/xyflow/CompoundNode.js +120 -0
  107. package/dist/overlays/relationships-of/xyflow/ElementNode.d.ts +6 -0
  108. package/dist/overlays/relationships-of/xyflow/ElementNode.js +194 -0
  109. package/dist/overlays/relationships-of/xyflow/EmptyNode.d.ts +5 -0
  110. package/dist/overlays/relationships-of/xyflow/EmptyNode.js +18 -0
  111. package/dist/overlays/relationships-of/xyflow/RelationshipEdge.d.ts +3 -0
  112. package/dist/overlays/relationships-of/xyflow/RelationshipEdge.js +123 -0
  113. package/dist/overlays/relationships-of/xyflow/styles.css.d.ts +14 -0
  114. package/dist/overlays/relationships-of/xyflow/styles.css.js +24 -0
  115. package/dist/overlays/shared/xyflow/RelationshipEdge.css.d.ts +4 -0
  116. package/dist/overlays/shared/xyflow/RelationshipEdge.css.js +12 -0
  117. package/dist/overlays/shared/xyflow/_types.d.ts +77 -0
  118. package/dist/state/DiagramContext.d.ts +1609 -0
  119. package/dist/state/DiagramContext.js +101 -0
  120. package/dist/state/aligners.d.ts +42 -0
  121. package/dist/state/aligners.js +349 -0
  122. package/dist/state/diagram-to-xyflow.d.ts +11 -0
  123. package/dist/state/diagram-to-xyflow.js +113 -0
  124. package/dist/state/diagramStore.d.ts +1705 -0
  125. package/dist/state/diagramStore.js +808 -0
  126. package/dist/state/diagramStore.layout.d.ts +4 -0
  127. package/dist/state/diagramStore.layout.js +56 -0
  128. package/dist/style.css +1 -0
  129. package/dist/theme-vars.css.d.ts +72 -0
  130. package/dist/theme-vars.css.js +6 -0
  131. package/dist/theme-vars.css.ts.vanilla.css.js +1 -0
  132. package/dist/theme-vars.d.ts +3 -0
  133. package/dist/theme-vars.js +5 -0
  134. package/dist/ui/DiagramTitlePanel.css.d.ts +4 -0
  135. package/dist/ui/DiagramTitlePanel.css.js +11 -0
  136. package/dist/ui/DiagramTitlePanel.d.ts +1 -0
  137. package/dist/ui/DiagramTitlePanel.js +159 -0
  138. package/dist/ui/DynamicViewWalkthrough.css.d.ts +4 -0
  139. package/dist/ui/DynamicViewWalkthrough.css.js +11 -0
  140. package/dist/ui/DynamicViewWalkthrough.d.ts +1 -0
  141. package/dist/ui/DynamicViewWalkthrough.js +156 -0
  142. package/dist/ui/EnsureMantine.d.ts +7 -0
  143. package/dist/ui/EnsureMantine.js +14 -0
  144. package/dist/ui/FramerMotionConfig.d.ts +2 -0
  145. package/dist/ui/FramerMotionConfig.js +14 -0
  146. package/dist/ui/Link.d.ts +4 -0
  147. package/dist/ui/Link.js +36 -0
  148. package/dist/ui/notation/NotationPanel.css.d.ts +6 -0
  149. package/dist/ui/notation/NotationPanel.css.js +16 -0
  150. package/dist/ui/notation/NotationPanel.d.ts +1 -0
  151. package/dist/ui/notation/NotationPanel.js +250 -0
  152. package/dist/ui/notation/index.d.ts +1 -0
  153. package/dist/ui/top-left/ChangeAutoLayoutButton.d.ts +2 -0
  154. package/dist/ui/top-left/ChangeAutoLayoutButton.js +159 -0
  155. package/dist/ui/top-left/ManualLayoutToolsButton.d.ts +2 -0
  156. package/dist/ui/top-left/ManualLayoutToolsButton.js +137 -0
  157. package/dist/ui/top-left/TopLeftPanel.d.ts +4 -0
  158. package/dist/ui/top-left/TopLeftPanel.js +211 -0
  159. package/dist/ui/top-left/_shared.d.ts +7 -0
  160. package/dist/ui/top-left/_shared.js +22 -0
  161. package/dist/ui/top-left/styles.css.d.ts +8 -0
  162. package/dist/ui/top-left/styles.css.js +17 -0
  163. package/dist/utils/types.d.ts +8 -0
  164. package/dist/utils/vector.d.ts +24 -0
  165. package/dist/utils/vector.js +55 -0
  166. package/dist/xyflow/EdgeMarkers.d.ts +12 -0
  167. package/dist/xyflow/EdgeMarkers.js +192 -0
  168. package/dist/xyflow/FitviewOnDiagramChange.d.ts +4 -0
  169. package/dist/xyflow/FitviewOnDiagramChange.js +72 -0
  170. package/dist/xyflow/SelectEdgesOnNodeFocus.d.ts +1 -0
  171. package/dist/xyflow/SelectEdgesOnNodeFocus.js +96 -0
  172. package/dist/xyflow/XYFlow.d.ts +8 -0
  173. package/dist/xyflow/XYFlow.js +145 -0
  174. package/dist/xyflow/XYFlowBackground.d.ts +10 -0
  175. package/dist/xyflow/XYFlowBackground.js +25 -0
  176. package/dist/xyflow/XYFlowInner.d.ts +8 -0
  177. package/dist/xyflow/XYFlowInner.js +41 -0
  178. package/dist/xyflow/const.d.ts +7 -0
  179. package/dist/xyflow/const.js +12 -0
  180. package/dist/xyflow/edges/EdgeLabel.d.ts +7 -0
  181. package/dist/xyflow/edges/EdgeLabel.js +160 -0
  182. package/dist/xyflow/edges/RelationshipEdge.d.ts +6 -0
  183. package/dist/xyflow/edges/RelationshipEdge.js +443 -0
  184. package/dist/xyflow/edges/RelationshipsDropdownMenu.css.d.ts +4 -0
  185. package/dist/xyflow/edges/RelationshipsDropdownMenu.css.js +11 -0
  186. package/dist/xyflow/edges/RelationshipsDropdownMenu.d.ts +13 -0
  187. package/dist/xyflow/edges/RelationshipsDropdownMenu.js +211 -0
  188. package/dist/xyflow/edges/edges.css.d.ts +17 -0
  189. package/dist/xyflow/edges/edges.css.js +37 -0
  190. package/dist/xyflow/edges/utils.d.ts +16 -0
  191. package/dist/xyflow/edges/utils.js +24 -0
  192. package/dist/xyflow/nodes/AnimateVariants.d.ts +1313 -0
  193. package/dist/xyflow/nodes/AnimateVariants.js +123 -0
  194. package/dist/xyflow/nodes/Node.css.d.ts +3 -0
  195. package/dist/xyflow/nodes/Node.css.js +9 -0
  196. package/dist/xyflow/nodes/compound/CompoundNode.css.d.ts +14 -0
  197. package/dist/xyflow/nodes/compound/CompoundNode.css.js +27 -0
  198. package/dist/xyflow/nodes/compound/CompoundNode.d.ts +6 -0
  199. package/dist/xyflow/nodes/compound/CompoundNode.js +216 -0
  200. package/dist/xyflow/nodes/compound/index.d.ts +1 -0
  201. package/dist/xyflow/nodes/element/ElementLink.css.d.ts +3 -0
  202. package/dist/xyflow/nodes/element/ElementLink.d.ts +6 -0
  203. package/dist/xyflow/nodes/element/ElementNode.d.ts +6 -0
  204. package/dist/xyflow/nodes/element/ElementNode.js +190 -0
  205. package/dist/xyflow/nodes/element/ElementShapeSvg.d.ts +17 -0
  206. package/dist/xyflow/nodes/element/ElementShapeSvg.js +175 -0
  207. package/dist/xyflow/nodes/element/element.css.d.ts +18 -0
  208. package/dist/xyflow/nodes/element/element.css.js +31 -0
  209. package/dist/xyflow/nodes/element/index.d.ts +1 -0
  210. package/dist/xyflow/nodes/shared/ElementIcon.d.ts +8 -0
  211. package/dist/xyflow/nodes/shared/ElementIcon.js +38 -0
  212. package/dist/xyflow/nodes/shared/Toolbar.d.ts +9 -0
  213. package/dist/xyflow/nodes/shared/Toolbar.js +436 -0
  214. package/dist/xyflow/types.d.ts +36 -0
  215. package/dist/xyflow/useLayoutConstraints.d.ts +42 -0
  216. package/dist/xyflow/useLayoutConstraints.js +226 -0
  217. package/dist/xyflow/useXYFlowEvents.d.ts +160 -0
  218. package/dist/xyflow/useXYFlowEvents.js +275 -0
  219. package/dist/xyflow/utils.d.ts +22 -0
  220. package/dist/xyflow/utils.js +72 -0
  221. package/package.json +34 -27
  222. package/src/LikeC4Diagram.tsx +4 -4
  223. package/src/LikeC4Search.css.ts +12 -0
  224. package/src/LikeC4Search.tsx +39 -90
  225. package/src/controls/Text.ts +5 -0
  226. package/src/controls/action-button-bar/ActionButtonBar.css.ts +13 -0
  227. package/src/controls/action-button-bar/ActionButtonBar.tsx +138 -0
  228. package/src/controls/action-button-bar/useActionButtonBarCtx.ts +13 -0
  229. package/src/controls/action-buttons/ActionButton.css.ts +29 -0
  230. package/src/controls/action-buttons/ActionButton.tsx +66 -0
  231. package/src/controls/action-buttons/ActionButtons.tsx +138 -0
  232. package/src/hooks/useXYFlow.ts +8 -8
  233. package/src/index.ts +12 -6
  234. package/src/likec4model/index.ts +12 -2
  235. package/src/overlays/edge-details/EdgeDetailsXYFlow.tsx +18 -12
  236. package/src/overlays/edge-details/_types.ts +13 -37
  237. package/src/overlays/edge-details/use-layouted-edge-details.ts +16 -14
  238. package/src/overlays/edge-details/xyflow/CompoundNode.tsx +3 -11
  239. package/src/overlays/edge-details/xyflow/ElementNode.tsx +4 -11
  240. package/src/overlays/edge-details/xyflow/RelationshipEdge.tsx +3 -3
  241. package/src/overlays/edge-details/xyflow/styles.css.ts +1 -59
  242. package/src/overlays/relationships-of/RelationshipsXYFlow.tsx +23 -23
  243. package/src/overlays/relationships-of/_types.ts +20 -58
  244. package/src/overlays/relationships-of/use-layouted-relationships.ts +36 -40
  245. package/src/overlays/relationships-of/xyflow/CompoundNode.tsx +9 -13
  246. package/src/overlays/relationships-of/xyflow/ElementNode.tsx +12 -15
  247. package/src/overlays/relationships-of/xyflow/EmptyNode.tsx +4 -7
  248. package/src/overlays/relationships-of/xyflow/RelationshipEdge.tsx +16 -14
  249. package/src/overlays/shared/xyflow/RelationshipEdge.css.ts +60 -0
  250. package/src/overlays/shared/xyflow/_types.ts +87 -0
  251. package/src/state/diagram-to-xyflow.ts +6 -7
  252. package/src/state/diagramStore.layout.ts +3 -4
  253. package/src/state/diagramStore.ts +35 -37
  254. package/src/theme-vars.css.ts +81 -0
  255. package/src/theme-vars.ts +8 -81
  256. package/src/ui/DiagramTitlePanel.tsx +6 -6
  257. package/src/utils/types.ts +6 -0
  258. package/src/xyflow/SelectEdgesOnNodeFocus.tsx +3 -3
  259. package/src/xyflow/XYFlow.tsx +2 -2
  260. package/src/xyflow/edges/EdgeLabel.tsx +25 -18
  261. package/src/xyflow/edges/RelationshipEdge.tsx +5 -3
  262. package/src/xyflow/edges/RelationshipsDropdownMenu.tsx +3 -3
  263. package/src/xyflow/edges/edges.css.ts +68 -74
  264. package/src/xyflow/edges/utils.ts +6 -6
  265. package/src/xyflow/nodes/AnimateVariants.ts +143 -0
  266. package/src/xyflow/nodes/Node.css.ts +44 -0
  267. package/src/xyflow/nodes/compound/CompoundNode.css.ts +1 -64
  268. package/src/xyflow/nodes/compound/CompoundNode.tsx +69 -182
  269. package/src/xyflow/nodes/element/ElementLink.tsx +2 -3
  270. package/src/xyflow/nodes/element/ElementNode.tsx +64 -266
  271. package/src/xyflow/nodes/element/element.css.ts +0 -57
  272. package/src/xyflow/nodes/shared/Toolbar.tsx +30 -30
  273. package/src/xyflow/types.ts +48 -51
  274. package/src/xyflow/useLayoutConstraints.ts +9 -9
  275. package/src/xyflow/useXYFlowEvents.ts +13 -30
  276. package/src/xyflow/utils.ts +2 -2
  277. package/src/xyflow/nodes/use-animate-variants.tsx +0 -64
@@ -0,0 +1,2 @@
1
+ import { PopoverProps } from '@mantine/core';
2
+ export declare const ManualLayoutToolsButton: (props: PopoverProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,137 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Popover, PopoverTarget, PopoverDropdown, Group, ActionIconGroup } from "@mantine/core";
3
+ import { IconLayoutCollage, IconLayoutBoardSplit, IconLayoutAlignLeft, IconLayoutAlignCenter, IconLayoutAlignRight, IconLayoutAlignTop, IconLayoutAlignMiddle, IconLayoutAlignBottom, IconRouteOff } from "@tabler/icons-react";
4
+ import { useDiagramStoreApi } from "../../hooks/useDiagramState.js";
5
+ import { Tooltip, ActionIcon } from "./_shared.js";
6
+ const Action = ({
7
+ label,
8
+ icon,
9
+ onClick
10
+ }) => /* @__PURE__ */ jsx(Tooltip, { label, withinPortal: false, position: "top", children: /* @__PURE__ */ jsx(ActionIcon, { onClick, children: icon }) });
11
+ const ManualLayoutToolsButton = (props) => {
12
+ const store = useDiagramStoreApi();
13
+ return /* @__PURE__ */ jsxs(
14
+ Popover,
15
+ {
16
+ position: "right-start",
17
+ clickOutsideEvents: [
18
+ "pointerdown"
19
+ ],
20
+ radius: "xs",
21
+ shadow: "lg",
22
+ offset: {
23
+ mainAxis: 10
24
+ },
25
+ ...props,
26
+ children: [
27
+ /* @__PURE__ */ jsx(PopoverTarget, { children: /* @__PURE__ */ jsx(Tooltip, { label: "Manual layouting tools", withinPortal: false, position: "top-end", children: /* @__PURE__ */ jsx(ActionIcon, { children: /* @__PURE__ */ jsx(IconLayoutCollage, {}) }) }) }),
28
+ /* @__PURE__ */ jsx(PopoverDropdown, { p: 0, children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
29
+ /* @__PURE__ */ jsxs(ActionIconGroup, { pos: "relative", children: [
30
+ /* @__PURE__ */ jsx(
31
+ Action,
32
+ {
33
+ label: "Align in columns",
34
+ icon: /* @__PURE__ */ jsx(IconLayoutBoardSplit, {}),
35
+ onClick: (e) => {
36
+ e.stopPropagation();
37
+ store.getState().align("Column");
38
+ }
39
+ }
40
+ ),
41
+ /* @__PURE__ */ jsx(
42
+ Action,
43
+ {
44
+ label: "Align left",
45
+ icon: /* @__PURE__ */ jsx(IconLayoutAlignLeft, {}),
46
+ onClick: (e) => {
47
+ e.stopPropagation();
48
+ store.getState().align("Left");
49
+ }
50
+ }
51
+ ),
52
+ /* @__PURE__ */ jsx(
53
+ Action,
54
+ {
55
+ label: "Align center",
56
+ icon: /* @__PURE__ */ jsx(IconLayoutAlignCenter, {}),
57
+ onClick: (e) => {
58
+ e.stopPropagation();
59
+ store.getState().align("Center");
60
+ }
61
+ }
62
+ ),
63
+ /* @__PURE__ */ jsx(
64
+ Action,
65
+ {
66
+ label: "Align right",
67
+ icon: /* @__PURE__ */ jsx(IconLayoutAlignRight, {}),
68
+ onClick: (e) => {
69
+ e.stopPropagation();
70
+ store.getState().align("Right");
71
+ }
72
+ }
73
+ ),
74
+ /* @__PURE__ */ jsx(
75
+ Action,
76
+ {
77
+ label: "Align in rows",
78
+ icon: /* @__PURE__ */ jsx(IconLayoutBoardSplit, { style: { transform: "rotate(90deg)" } }),
79
+ onClick: (e) => {
80
+ e.stopPropagation();
81
+ store.getState().align("Row");
82
+ }
83
+ }
84
+ ),
85
+ /* @__PURE__ */ jsx(
86
+ Action,
87
+ {
88
+ label: "Align top",
89
+ icon: /* @__PURE__ */ jsx(IconLayoutAlignTop, {}),
90
+ onClick: (e) => {
91
+ e.stopPropagation();
92
+ store.getState().align("Top");
93
+ }
94
+ }
95
+ ),
96
+ /* @__PURE__ */ jsx(
97
+ Action,
98
+ {
99
+ label: "Align middle",
100
+ icon: /* @__PURE__ */ jsx(IconLayoutAlignMiddle, {}),
101
+ onClick: (e) => {
102
+ e.stopPropagation();
103
+ store.getState().align("Middle");
104
+ }
105
+ }
106
+ ),
107
+ /* @__PURE__ */ jsx(
108
+ Action,
109
+ {
110
+ label: "Align bottom",
111
+ icon: /* @__PURE__ */ jsx(IconLayoutAlignBottom, {}),
112
+ onClick: (e) => {
113
+ e.stopPropagation();
114
+ store.getState().align("Bottom");
115
+ }
116
+ }
117
+ )
118
+ ] }),
119
+ /* @__PURE__ */ jsx(
120
+ Action,
121
+ {
122
+ label: "Reset all control points",
123
+ icon: /* @__PURE__ */ jsx(IconRouteOff, {}),
124
+ onClick: (e) => {
125
+ e.stopPropagation();
126
+ store.getState().resetEdgeControlPoints();
127
+ }
128
+ }
129
+ )
130
+ ] }) })
131
+ ]
132
+ }
133
+ );
134
+ };
135
+ export {
136
+ ManualLayoutToolsButton
137
+ };
@@ -0,0 +1,4 @@
1
+ export declare const TopLeftPanel: {
2
+ (): import("react/jsx-runtime").JSX.Element;
3
+ displayName: string;
4
+ };
@@ -0,0 +1,211 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { TooltipGroup, Stack, ActionIconGroup, Group, HoverCard, HoverCardTarget, Overlay, HoverCardDropdown, Notification, Text, Code } from "@mantine/core";
3
+ import { openSpotlight } from "@mantine/spotlight";
4
+ import { IconSearch, IconFileSymlink, IconFocusCentered, IconMenu2, IconChevronLeft, IconChevronRight, IconAlertTriangle } from "@tabler/icons-react";
5
+ import clsx from "clsx";
6
+ import { LayoutGroup, AnimatePresence, m } from "framer-motion";
7
+ import { isNullish } from "remeda";
8
+ import { useDiagramStoreApi, useDiagramState } from "../../hooks/useDiagramState.js";
9
+ import { useMantinePortalProps } from "../../hooks/useMantinePortalProps.js";
10
+ import { mantine } from "../../theme-vars.js";
11
+ import { Tooltip, ActionIcon } from "./_shared.js";
12
+ import { ChangeAutoLayoutButton } from "./ChangeAutoLayoutButton.js";
13
+ import { ManualLayoutToolsButton } from "./ManualLayoutToolsButton.js";
14
+ import { panel, actionIconGroup, backwardForwardButtons } from "./styles.css.js";
15
+ const historySelector = (s) => ({
16
+ showBurgerMenu: !!s.onBurgerMenuClick,
17
+ hasStepBack: s.showNavigationButtons && !!s.onNavigateTo && s.navigationHistoryIndex > 0,
18
+ hasStepForward: s.showNavigationButtons && !!s.onNavigateTo && s.navigationHistoryIndex < s.navigationHistory.length - 1
19
+ });
20
+ const BackwardForwardButtons = () => {
21
+ const store = useDiagramStoreApi();
22
+ const {
23
+ showBurgerMenu,
24
+ hasStepBack,
25
+ hasStepForward
26
+ } = useDiagramState(historySelector);
27
+ return /* @__PURE__ */ jsx(LayoutGroup, { children: /* @__PURE__ */ jsxs(
28
+ Group,
29
+ {
30
+ className: clsx(backwardForwardButtons, "likec4-navigation-webview"),
31
+ align: "flex-start",
32
+ gap: "xs",
33
+ children: [
34
+ showBurgerMenu && /* @__PURE__ */ jsx(
35
+ ActionIcon,
36
+ {
37
+ onClick: (e) => {
38
+ var _a, _b;
39
+ e.stopPropagation();
40
+ (_b = (_a = store.getState()).onBurgerMenuClick) == null ? void 0 : _b.call(_a);
41
+ },
42
+ children: /* @__PURE__ */ jsx(IconMenu2, {})
43
+ }
44
+ ),
45
+ /* @__PURE__ */ jsxs(AnimatePresence, { children: [
46
+ hasStepBack && /* @__PURE__ */ jsx(
47
+ m.div,
48
+ {
49
+ layout: true,
50
+ initial: { opacity: 0.05, transform: "translateX(-10px)" },
51
+ animate: { opacity: 1, transform: "translateX(0)" },
52
+ exit: {
53
+ opacity: 0.05,
54
+ transform: "translateX(-10px)"
55
+ },
56
+ children: /* @__PURE__ */ jsx(
57
+ ActionIcon,
58
+ {
59
+ onClick: (e) => {
60
+ e.stopPropagation();
61
+ store.getState().goBack();
62
+ },
63
+ children: /* @__PURE__ */ jsx(IconChevronLeft, {})
64
+ }
65
+ )
66
+ },
67
+ "back"
68
+ ),
69
+ hasStepForward && /* @__PURE__ */ jsx(
70
+ m.div,
71
+ {
72
+ layout: true,
73
+ initial: { opacity: 0.05, transform: "translateX(10px)" },
74
+ animate: { opacity: 1, transform: "translateX(0)" },
75
+ exit: {
76
+ opacity: 0,
77
+ transform: "translateX(10px)"
78
+ },
79
+ children: /* @__PURE__ */ jsx(
80
+ ActionIcon,
81
+ {
82
+ onClick: (e) => {
83
+ e.stopPropagation();
84
+ store.getState().goForward();
85
+ },
86
+ children: /* @__PURE__ */ jsx(IconChevronRight, {})
87
+ }
88
+ )
89
+ },
90
+ "forward"
91
+ )
92
+ ] })
93
+ ]
94
+ }
95
+ ) });
96
+ };
97
+ const LayoutDriftNotification = (props) => /* @__PURE__ */ jsxs(
98
+ HoverCard,
99
+ {
100
+ position: "right-start",
101
+ openDelay: 200,
102
+ closeDelay: 100,
103
+ ...props,
104
+ children: [
105
+ /* @__PURE__ */ jsx(HoverCardTarget, { children: /* @__PURE__ */ jsxs(ActionIcon, { c: "orange", children: [
106
+ /* @__PURE__ */ jsx(Overlay, { color: mantine.colors.orange.lightHover, backgroundOpacity: 1 }),
107
+ /* @__PURE__ */ jsx(IconAlertTriangle, {})
108
+ ] }) }),
109
+ /* @__PURE__ */ jsx(HoverCardDropdown, { p: "0", children: /* @__PURE__ */ jsxs(
110
+ Notification,
111
+ {
112
+ color: "orange",
113
+ withBorder: false,
114
+ withCloseButton: false,
115
+ title: "Manual layout issues",
116
+ children: [
117
+ /* @__PURE__ */ jsxs(Text, { mt: 2, size: "sm", lh: "xs", children: [
118
+ "View contains new elements or their sizes have changed,",
119
+ /* @__PURE__ */ jsx("br", {}),
120
+ "last manual layout can not be applied."
121
+ ] }),
122
+ /* @__PURE__ */ jsxs(Text, { mt: "xs", size: "sm", lh: "xs", children: [
123
+ "Update view predicates or remove ",
124
+ /* @__PURE__ */ jsx(Code, { children: "@likec4-generated" })
125
+ ] })
126
+ ]
127
+ }
128
+ ) })
129
+ ]
130
+ }
131
+ );
132
+ const TopLeftPanel = () => {
133
+ const store = useDiagramStoreApi();
134
+ const {
135
+ enableSearch,
136
+ showNavigationButtons,
137
+ showFitDiagram,
138
+ showLayoutDriftWarning,
139
+ showChangeAutoLayout,
140
+ showGoToSource,
141
+ viewportChanged,
142
+ showManualLayoutTools
143
+ } = useDiagramState((s) => {
144
+ const isNotWalkthrough = isNullish(s.activeWalkthrough);
145
+ const isNotFocused = isNullish(s.focusedNodeId);
146
+ const isNotActive = isNotWalkthrough && isNotFocused;
147
+ return {
148
+ enableSearch: s.enableSearch,
149
+ showNavigationButtons: !!s.onBurgerMenuClick || s.showNavigationButtons && !!s.onNavigateTo,
150
+ showFitDiagram: s.controls && s.fitViewEnabled && s.zoomable && isNotWalkthrough,
151
+ showLayoutDriftWarning: s.controls && !s.readonly && s.view.hasLayoutDrift === true && isNotActive,
152
+ showChangeAutoLayout: s.controls && s.isEditable() && isNotActive,
153
+ showGoToSource: s.controls && !!s.onOpenSource && isNotWalkthrough,
154
+ viewportChanged: s.viewportChanged,
155
+ showManualLayoutTools: s.controls && s.readonly !== true && s.experimentalEdgeEditing === true
156
+ };
157
+ });
158
+ const portalProps = useMantinePortalProps();
159
+ return /* @__PURE__ */ jsx(TooltipGroup, { openDelay: 600, closeDelay: 150, children: /* @__PURE__ */ jsxs(
160
+ Stack,
161
+ {
162
+ className: clsx(
163
+ "react-flow__panel",
164
+ panel,
165
+ "likec4-top-left-panel"
166
+ ),
167
+ align: "flex-start",
168
+ onClick: (e) => e.stopPropagation(),
169
+ gap: "xs",
170
+ children: [
171
+ showNavigationButtons && /* @__PURE__ */ jsx(BackwardForwardButtons, {}),
172
+ /* @__PURE__ */ jsxs(ActionIconGroup, { className: actionIconGroup, orientation: "vertical", children: [
173
+ enableSearch && /* @__PURE__ */ jsx(Tooltip, { label: "Search (Ctrl+F or ⌘+F)", children: /* @__PURE__ */ jsx(
174
+ ActionIcon,
175
+ {
176
+ onClick: () => openSpotlight(),
177
+ children: /* @__PURE__ */ jsx(IconSearch, {})
178
+ }
179
+ ) }),
180
+ showGoToSource && /* @__PURE__ */ jsx(Tooltip, { label: "Open source", ...portalProps, children: /* @__PURE__ */ jsx(
181
+ ActionIcon,
182
+ {
183
+ onClick: (e) => {
184
+ e.stopPropagation();
185
+ store.getState().onOpenSourceView();
186
+ },
187
+ children: /* @__PURE__ */ jsx(IconFileSymlink, { stroke: 1.5 })
188
+ }
189
+ ) }),
190
+ showChangeAutoLayout && /* @__PURE__ */ jsx(ChangeAutoLayoutButton, { ...portalProps }),
191
+ showLayoutDriftWarning && /* @__PURE__ */ jsx(LayoutDriftNotification, { ...portalProps }),
192
+ showManualLayoutTools && /* @__PURE__ */ jsx(ManualLayoutToolsButton, { ...portalProps }),
193
+ showFitDiagram && /* @__PURE__ */ jsx(Tooltip, { label: viewportChanged ? "Center camera" : "Camera is centered", ...portalProps, children: /* @__PURE__ */ jsx(
194
+ ActionIcon,
195
+ {
196
+ onClick: (e) => {
197
+ e.stopPropagation();
198
+ store.getState().fitDiagram();
199
+ },
200
+ children: /* @__PURE__ */ jsx(IconFocusCentered, {})
201
+ }
202
+ ) })
203
+ ] })
204
+ ]
205
+ }
206
+ ) });
207
+ };
208
+ TopLeftPanel.displayName = "TopLeftPanel";
209
+ export {
210
+ TopLeftPanel
211
+ };
@@ -0,0 +1,7 @@
1
+ import { ForwardRefExoticComponent, RefAttributes } from 'react';
2
+ import { TooltipProps, PolymorphicComponentProps, ActionIconProps } from '@mantine/core';
3
+ export declare const Tooltip: ForwardRefExoticComponent< TooltipProps & RefAttributes<HTMLDivElement> & {
4
+ component?: any;
5
+ renderRoot?: (props: Record<string, any>) => React.ReactNode;
6
+ }>;
7
+ export declare const ActionIcon: <L = "button">(props: PolymorphicComponentProps<L, ActionIconProps>) => React.ReactElement;
@@ -0,0 +1,22 @@
1
+ import { Tooltip as Tooltip$1, ActionIcon as ActionIcon$1 } from "@mantine/core";
2
+ const Tooltip = Tooltip$1.withProps({
3
+ color: "dark",
4
+ fz: "xs",
5
+ position: "right",
6
+ openDelay: 600,
7
+ closeDelay: 120,
8
+ label: "",
9
+ children: null,
10
+ offset: 8
11
+ });
12
+ const ActionIcon = ActionIcon$1.withProps({
13
+ classNames: {
14
+ root: "action-icon"
15
+ },
16
+ variant: "default",
17
+ color: "gray"
18
+ });
19
+ export {
20
+ ActionIcon,
21
+ Tooltip
22
+ };
@@ -0,0 +1,8 @@
1
+ export declare const backwardForwardButtons: string;
2
+ export declare const panel: string;
3
+ export declare const actionIconGroup: string;
4
+ export declare const autolayoutIcon: string;
5
+ export declare const autolayoutButton: string;
6
+ export declare const autolayoutIndicator: string;
7
+ export declare const spacingSliderBody: string;
8
+ export declare const spacingSliderThumb: string;
@@ -0,0 +1,17 @@
1
+ /* empty css */
2
+ var backwardForwardButtons = "_1snasyb0";
3
+ var panel = "_1snasyb1";
4
+ var actionIconGroup = "_1snasyb2";
5
+ var autolayoutButton = "_1snasyb4";
6
+ var autolayoutIndicator = "_1snasyb5";
7
+ var spacingSliderBody = "_1snasyb6";
8
+ var spacingSliderThumb = "_1snasyb7";
9
+ export {
10
+ actionIconGroup,
11
+ autolayoutButton,
12
+ autolayoutIndicator,
13
+ backwardForwardButtons,
14
+ panel,
15
+ spacingSliderBody,
16
+ spacingSliderThumb
17
+ };
@@ -0,0 +1,8 @@
1
+ import { Edge, Node } from '@xyflow/react';
2
+ import { Merge } from 'type-fest';
3
+ export type AddNodeData<T extends Node, Data> = Omit<T, 'data'> & {
4
+ data: Merge<T['data'], Data>;
5
+ };
6
+ export type AddEdgeData<T extends Edge, Data> = Omit<T, 'data'> & {
7
+ data: Merge<T['data'], Data>;
8
+ };
@@ -0,0 +1,24 @@
1
+ export interface Vector {
2
+ x: number;
3
+ y: number;
4
+ }
5
+ export declare class VectorImpl implements Vector {
6
+ x: number;
7
+ y: number;
8
+ constructor(x: number, y: number);
9
+ static create(position: Vector): VectorImpl;
10
+ static add(a: Vector, b: Vector): Vector;
11
+ static sub(a: Vector, b: Vector): Vector;
12
+ static mul(a: Vector, b: number): Vector;
13
+ static dot(a: Vector, b: Vector): number;
14
+ static cross(a: Vector, b: Vector): VectorImpl;
15
+ static setLength(a: Vector, length: number): Vector;
16
+ add(b: Vector): VectorImpl;
17
+ sub(b: Vector): VectorImpl;
18
+ mul(b: number): VectorImpl;
19
+ dot(b: Vector): number;
20
+ cross(b: Vector): VectorImpl;
21
+ abs(): number;
22
+ setLength(length: number): VectorImpl;
23
+ }
24
+ export declare function vector(source: Vector): VectorImpl;
@@ -0,0 +1,55 @@
1
+ class VectorImpl {
2
+ constructor(x, y) {
3
+ this.x = x;
4
+ this.y = y;
5
+ }
6
+ static create(position) {
7
+ return new VectorImpl(position.x, position.y);
8
+ }
9
+ static add(a, b) {
10
+ return { x: a.x + b.x, y: a.y + b.y };
11
+ }
12
+ static sub(a, b) {
13
+ return { x: a.x - b.x, y: a.y - b.y };
14
+ }
15
+ static mul(a, b) {
16
+ return { x: a.x * b, y: a.y * b };
17
+ }
18
+ static dot(a, b) {
19
+ return a.x * b.x + a.y * b.y;
20
+ }
21
+ static cross(a, b) {
22
+ return new VectorImpl(a.y * b.x - a.x * b.y, a.x * b.y - a.y * b.x);
23
+ }
24
+ static setLength(a, length) {
25
+ return vector(a).setLength(length);
26
+ }
27
+ add(b) {
28
+ return new VectorImpl(this.x + b.x, this.y + b.y);
29
+ }
30
+ sub(b) {
31
+ return new VectorImpl(this.x - b.x, this.y - b.y);
32
+ }
33
+ mul(b) {
34
+ return new VectorImpl(this.x * b, this.y * b);
35
+ }
36
+ dot(b) {
37
+ return this.x * b.x + this.y * b.y;
38
+ }
39
+ cross(b) {
40
+ return new VectorImpl(this.y * b.x - this.x * b.y, this.x * b.y - this.y * b.x);
41
+ }
42
+ abs() {
43
+ return Math.sqrt(this.x * this.x + this.y * this.y);
44
+ }
45
+ setLength(length) {
46
+ return this.mul(length / this.abs());
47
+ }
48
+ }
49
+ function vector(source) {
50
+ return VectorImpl.create(source);
51
+ }
52
+ export {
53
+ VectorImpl,
54
+ vector
55
+ };
@@ -0,0 +1,12 @@
1
+ import { SVGProps } from 'react';
2
+ export declare const EdgeMarkers: {
3
+ Arrow: (props: SVGProps<SVGMarkerElement>) => import("react/jsx-runtime").JSX.Element;
4
+ Crow: (props: SVGProps<SVGMarkerElement>) => import("react/jsx-runtime").JSX.Element;
5
+ OArrow: (props: SVGProps<SVGMarkerElement>) => import("react/jsx-runtime").JSX.Element;
6
+ Open: (props: SVGProps<SVGMarkerElement>) => import("react/jsx-runtime").JSX.Element;
7
+ Diamond: (props: SVGProps<SVGMarkerElement>) => import("react/jsx-runtime").JSX.Element;
8
+ ODiamond: (props: SVGProps<SVGMarkerElement>) => import("react/jsx-runtime").JSX.Element;
9
+ Dot: (props: SVGProps<SVGMarkerElement>) => import("react/jsx-runtime").JSX.Element;
10
+ ODot: (props: SVGProps<SVGMarkerElement>) => import("react/jsx-runtime").JSX.Element;
11
+ };
12
+ export type EdgeMarkerType = keyof typeof EdgeMarkers;