@tldiagram/core-ui 1.87.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 (272) hide show
  1. package/dist/App.d.ts +1 -0
  2. package/dist/api/client.d.ts +143 -0
  3. package/dist/api/transport-vscode.d.ts +8 -0
  4. package/dist/api/transport.d.ts +1 -0
  5. package/dist/components/CodePreviewPanel-vscode.d.ts +7 -0
  6. package/dist/components/CodePreviewPanel.d.ts +9 -0
  7. package/dist/components/ConfirmDialog.d.ts +12 -0
  8. package/dist/components/ConnectorPanel.d.ts +21 -0
  9. package/dist/components/ContextBoundaryElement.d.ts +11 -0
  10. package/dist/components/ContextNeighborElement.d.ts +29 -0
  11. package/dist/components/ContextStraightConnector.d.ts +4 -0
  12. package/dist/components/CrossBranchControls.d.ts +9 -0
  13. package/dist/components/DependenciesOnboarding.d.ts +5 -0
  14. package/dist/components/DrawingCanvas.d.ts +39 -0
  15. package/dist/components/ElementLibrary-vscode.d.ts +7 -0
  16. package/dist/components/ElementLibrary.d.ts +22 -0
  17. package/dist/components/ElementNode.d.ts +36 -0
  18. package/dist/components/ElementPanel.d.ts +25 -0
  19. package/dist/components/ExploreOnboarding.d.ts +5 -0
  20. package/dist/components/ExplorePageOnboarding.d.ts +5 -0
  21. package/dist/components/ExportModal.d.ts +16 -0
  22. package/dist/components/FloatingEdge.d.ts +9 -0
  23. package/dist/components/GitSourceLinker.d.ts +8 -0
  24. package/dist/components/HeaderContext.d.ts +16 -0
  25. package/dist/components/Icons.d.ts +95 -0
  26. package/dist/components/ImportModal.d.ts +10 -0
  27. package/dist/components/InlineElementAdder.d.ts +17 -0
  28. package/dist/components/LayoutSection.d.ts +7 -0
  29. package/dist/components/LocalSourceLinker.d.ts +8 -0
  30. package/dist/components/MiniZoomOnboarding.d.ts +5 -0
  31. package/dist/components/NavBreadcrumb.d.ts +6 -0
  32. package/dist/components/NodeBody.d.ts +12 -0
  33. package/dist/components/NodeContainer.d.ts +8 -0
  34. package/dist/components/NodeHoverCard.d.ts +10 -0
  35. package/dist/components/PanelHeader.d.ts +8 -0
  36. package/dist/components/PanelUI.d.ts +3 -0
  37. package/dist/components/ProxyConnectorEdge.d.ts +4 -0
  38. package/dist/components/ProxyConnectorPanel.d.ts +9 -0
  39. package/dist/components/SafeBackground.d.ts +13 -0
  40. package/dist/components/ScrollIndicatorWrapper.d.ts +8 -0
  41. package/dist/components/SetChildModal.d.ts +10 -0
  42. package/dist/components/SetParentModal.d.ts +10 -0
  43. package/dist/components/SlidingPanel.d.ts +16 -0
  44. package/dist/components/TagUpsert.d.ts +8 -0
  45. package/dist/components/TopMenuBar.d.ts +8 -0
  46. package/dist/components/ViewBezierConnector.d.ts +4 -0
  47. package/dist/components/ViewDrawMenu.d.ts +22 -0
  48. package/dist/components/ViewEditorEdgeLabelLayout.d.ts +16 -0
  49. package/dist/components/ViewEditorOnboarding.d.ts +5 -0
  50. package/dist/components/ViewExplorer/TagManager/ColorPicker.d.ts +7 -0
  51. package/dist/components/ViewExplorer/TagManager/GroupNamingPopover.d.ts +10 -0
  52. package/dist/components/ViewExplorer/TagManager/LayerItem.d.ts +27 -0
  53. package/dist/components/ViewExplorer/TagManager/TagItem.d.ts +25 -0
  54. package/dist/components/ViewExplorer/TagManager/index.d.ts +21 -0
  55. package/dist/components/ViewExplorer/ViewNavigator.d.ts +11 -0
  56. package/dist/components/ViewExplorer/ViewSearch.d.ts +8 -0
  57. package/dist/components/ViewExplorer/ViewTree.d.ts +18 -0
  58. package/dist/components/ViewExplorer/index.d.ts +31 -0
  59. package/dist/components/ViewExplorer/types.d.ts +11 -0
  60. package/dist/components/ViewExplorer/utils.d.ts +6 -0
  61. package/dist/components/ViewExplorer-vscode.d.ts +6 -0
  62. package/dist/components/ViewFloatingMenu-vscode.d.ts +27 -0
  63. package/dist/components/ViewFloatingMenu.d.ts +39 -0
  64. package/dist/components/ViewGridNode.d.ts +29 -0
  65. package/dist/components/ViewHeaderButton.d.ts +11 -0
  66. package/dist/components/ViewPanel.d.ts +18 -0
  67. package/dist/components/ViewsGridOnboarding.d.ts +5 -0
  68. package/dist/components/ZUI/ZUICanvas.d.ts +18 -0
  69. package/dist/components/ZUI/index.d.ts +2 -0
  70. package/dist/components/ZUI/layout.d.ts +18 -0
  71. package/dist/components/ZUI/proxy.d.ts +25 -0
  72. package/dist/components/ZUI/renderer.d.ts +30 -0
  73. package/dist/components/ZUI/types.d.ts +140 -0
  74. package/dist/components/ZUI/useZUIInteraction.d.ts +21 -0
  75. package/dist/config/runtime-vscode.d.ts +22 -0
  76. package/dist/config/runtime.d.ts +5 -0
  77. package/dist/constants/colors.d.ts +27 -0
  78. package/dist/constants/diagramColors.d.ts +1 -0
  79. package/dist/context/ThemeContext.d.ts +27 -0
  80. package/dist/crossBranch/graph.d.ts +13 -0
  81. package/dist/crossBranch/resolve.d.ts +22 -0
  82. package/dist/crossBranch/settings.d.ts +6 -0
  83. package/dist/crossBranch/store.d.ts +11 -0
  84. package/dist/crossBranch/types.d.ts +96 -0
  85. package/dist/demo/DemoPage.d.ts +9 -0
  86. package/dist/demo/seed.d.ts +9 -0
  87. package/dist/demo/store.d.ts +137 -0
  88. package/dist/demo/viewEditor.d.ts +26 -0
  89. package/dist/favicon.svg +35 -0
  90. package/dist/hooks/useSafeFitView.d.ts +16 -0
  91. package/dist/index.css +1 -0
  92. package/dist/index.d.ts +115 -0
  93. package/dist/index.js +19966 -0
  94. package/dist/lib/vscodeBridge-vscode.d.ts +13 -0
  95. package/dist/lib/vscodeBridge.d.ts +5 -0
  96. package/dist/logo-120.png +0 -0
  97. package/dist/logo-bw.png +0 -0
  98. package/dist/logo-bw.svg +15 -0
  99. package/dist/logo-text.svg +51 -0
  100. package/dist/logo.svg +35 -0
  101. package/dist/pages/AppearanceSettings.d.ts +3 -0
  102. package/dist/pages/Dependencies.d.ts +1 -0
  103. package/dist/pages/InfiniteZoom.d.ts +7 -0
  104. package/dist/pages/Settings.d.ts +7 -0
  105. package/dist/pages/ViewEditor/components/EditorMenus.d.ts +24 -0
  106. package/dist/pages/ViewEditor/components/EditorOverlays.d.ts +30 -0
  107. package/dist/pages/ViewEditor/components/EmptyCanvasState.d.ts +7 -0
  108. package/dist/pages/ViewEditor/context.d.ts +13 -0
  109. package/dist/pages/ViewEditor/hooks/useCanvasInteractions.d.ts +201 -0
  110. package/dist/pages/ViewEditor/hooks/useDrawingEngine.d.ts +40 -0
  111. package/dist/pages/ViewEditor/hooks/useViewContextNeighbours.d.ts +20 -0
  112. package/dist/pages/ViewEditor/hooks/useViewData.d.ts +74 -0
  113. package/dist/pages/ViewEditor/index.d.ts +8 -0
  114. package/dist/pages/ViewEditor/utils.d.ts +14 -0
  115. package/dist/pages/Views.d.ts +6 -0
  116. package/dist/pages/ViewsGrid.d.ts +6 -0
  117. package/dist/pkg/importer/mermaid.d.ts +7 -0
  118. package/dist/pkg/importer/mermaid.test.d.ts +1 -0
  119. package/dist/platform/PlatformContext.d.ts +6 -0
  120. package/dist/platform/context.d.ts +3 -0
  121. package/dist/platform/local.d.ts +2 -0
  122. package/dist/platform/types.d.ts +17 -0
  123. package/dist/slots.d.ts +67 -0
  124. package/dist/theme.d.ts +2 -0
  125. package/dist/types/index.d.ts +193 -0
  126. package/dist/types/vscode-messages.d.ts +60 -0
  127. package/dist/utils/edgeDistribution.d.ts +34 -0
  128. package/dist/utils/githubApi.d.ts +4 -0
  129. package/dist/utils/githubCache.d.ts +17 -0
  130. package/dist/utils/ids.d.ts +2 -0
  131. package/dist/utils/technologyCatalog.d.ts +15 -0
  132. package/dist/utils/toast.d.ts +15 -0
  133. package/dist/utils/treesitter.d.ts +13 -0
  134. package/dist/utils/url.d.ts +12 -0
  135. package/package.json +159 -0
  136. package/src/App.tsx +141 -0
  137. package/src/api/client.ts +618 -0
  138. package/src/api/transport-vscode.ts +28 -0
  139. package/src/api/transport.ts +7 -0
  140. package/src/assets/logo-mark.svg +31 -0
  141. package/src/assets/logo-wordmark.svg +22 -0
  142. package/src/assets/logo.svg +35 -0
  143. package/src/components/CodePreviewPanel-vscode.tsx +85 -0
  144. package/src/components/CodePreviewPanel.tsx +384 -0
  145. package/src/components/ConfirmDialog.tsx +66 -0
  146. package/src/components/ConnectorPanel.tsx +403 -0
  147. package/src/components/ContextBoundaryElement.tsx +35 -0
  148. package/src/components/ContextNeighborElement.tsx +282 -0
  149. package/src/components/ContextStraightConnector.tsx +144 -0
  150. package/src/components/CrossBranchControls.tsx +105 -0
  151. package/src/components/DependenciesOnboarding.tsx +427 -0
  152. package/src/components/DrawingCanvas.tsx +391 -0
  153. package/src/components/ElementLibrary-vscode.tsx +9 -0
  154. package/src/components/ElementLibrary.tsx +512 -0
  155. package/src/components/ElementNode.tsx +1033 -0
  156. package/src/components/ElementPanel.tsx +928 -0
  157. package/src/components/ExploreOnboarding.tsx +347 -0
  158. package/src/components/ExplorePageOnboarding.tsx +383 -0
  159. package/src/components/ExportModal.tsx +132 -0
  160. package/src/components/FloatingEdge.tsx +115 -0
  161. package/src/components/GitSourceLinker.tsx +1053 -0
  162. package/src/components/HeaderContext.tsx +30 -0
  163. package/src/components/Icons.tsx +245 -0
  164. package/src/components/ImportModal.tsx +219 -0
  165. package/src/components/InlineElementAdder.tsx +216 -0
  166. package/src/components/LayoutSection.tsx +624 -0
  167. package/src/components/LocalSourceLinker.tsx +330 -0
  168. package/src/components/MiniZoomOnboarding.tsx +78 -0
  169. package/src/components/NavBreadcrumb.tsx +24 -0
  170. package/src/components/NodeBody.tsx +89 -0
  171. package/src/components/NodeContainer.tsx +58 -0
  172. package/src/components/NodeHoverCard.tsx +135 -0
  173. package/src/components/PanelHeader.tsx +36 -0
  174. package/src/components/PanelUI.tsx +24 -0
  175. package/src/components/ProxyConnectorEdge.tsx +169 -0
  176. package/src/components/ProxyConnectorPanel.tsx +130 -0
  177. package/src/components/SafeBackground.tsx +19 -0
  178. package/src/components/ScrollIndicatorWrapper.tsx +117 -0
  179. package/src/components/SetChildModal.tsx +191 -0
  180. package/src/components/SetParentModal.tsx +187 -0
  181. package/src/components/SlidingPanel.tsx +114 -0
  182. package/src/components/TagUpsert.tsx +142 -0
  183. package/src/components/TopMenuBar.tsx +380 -0
  184. package/src/components/ViewBezierConnector.tsx +143 -0
  185. package/src/components/ViewDrawMenu.tsx +270 -0
  186. package/src/components/ViewEditorEdgeLabelLayout.ts +189 -0
  187. package/src/components/ViewEditorOnboarding.tsx +445 -0
  188. package/src/components/ViewExplorer/TagManager/ColorPicker.tsx +49 -0
  189. package/src/components/ViewExplorer/TagManager/GroupNamingPopover.tsx +96 -0
  190. package/src/components/ViewExplorer/TagManager/LayerItem.tsx +228 -0
  191. package/src/components/ViewExplorer/TagManager/TagItem.tsx +242 -0
  192. package/src/components/ViewExplorer/TagManager/index.tsx +418 -0
  193. package/src/components/ViewExplorer/ViewNavigator.tsx +121 -0
  194. package/src/components/ViewExplorer/ViewSearch.tsx +33 -0
  195. package/src/components/ViewExplorer/ViewTree.tsx +98 -0
  196. package/src/components/ViewExplorer/index.tsx +384 -0
  197. package/src/components/ViewExplorer/types.ts +13 -0
  198. package/src/components/ViewExplorer/utils.ts +56 -0
  199. package/src/components/ViewExplorer-vscode.tsx +8 -0
  200. package/src/components/ViewFloatingMenu-vscode.tsx +248 -0
  201. package/src/components/ViewFloatingMenu.tsx +379 -0
  202. package/src/components/ViewGridNode.tsx +451 -0
  203. package/src/components/ViewHeaderButton.tsx +60 -0
  204. package/src/components/ViewPanel.tsx +162 -0
  205. package/src/components/ViewsGridOnboarding.tsx +400 -0
  206. package/src/components/ZUI/ZUICanvas.tsx +853 -0
  207. package/src/components/ZUI/index.ts +3 -0
  208. package/src/components/ZUI/layout.ts +323 -0
  209. package/src/components/ZUI/proxy.ts +278 -0
  210. package/src/components/ZUI/renderer.ts +1189 -0
  211. package/src/components/ZUI/types.ts +150 -0
  212. package/src/components/ZUI/useZUIInteraction.ts +720 -0
  213. package/src/config/runtime-vscode.ts +46 -0
  214. package/src/config/runtime.ts +30 -0
  215. package/src/constants/colors.ts +80 -0
  216. package/src/constants/diagramColors.ts +9 -0
  217. package/src/context/ThemeContext.tsx +158 -0
  218. package/src/crossBranch/graph.ts +207 -0
  219. package/src/crossBranch/resolve.ts +643 -0
  220. package/src/crossBranch/settings.ts +59 -0
  221. package/src/crossBranch/store.ts +71 -0
  222. package/src/crossBranch/types.ts +102 -0
  223. package/src/demo/DemoPage.tsx +184 -0
  224. package/src/demo/seed.ts +67 -0
  225. package/src/demo/store.ts +536 -0
  226. package/src/demo/viewEditor.ts +110 -0
  227. package/src/hooks/useSafeFitView.ts +60 -0
  228. package/src/index.css +309 -0
  229. package/src/index.ts +184 -0
  230. package/src/kafka-ss.png +0 -0
  231. package/src/lib/vscodeBridge-vscode.ts +27 -0
  232. package/src/lib/vscodeBridge.ts +7 -0
  233. package/src/main.tsx +46 -0
  234. package/src/pages/AppearanceSettings.tsx +135 -0
  235. package/src/pages/Dependencies.tsx +926 -0
  236. package/src/pages/InfiniteZoom.tsx +404 -0
  237. package/src/pages/Settings.tsx +91 -0
  238. package/src/pages/ViewEditor/EDGE_DISTRIBUTION.md +64 -0
  239. package/src/pages/ViewEditor/components/EditorMenus.tsx +112 -0
  240. package/src/pages/ViewEditor/components/EditorOverlays.tsx +172 -0
  241. package/src/pages/ViewEditor/components/EmptyCanvasState.tsx +42 -0
  242. package/src/pages/ViewEditor/context.tsx +21 -0
  243. package/src/pages/ViewEditor/hooks/useCanvasInteractions.ts +1349 -0
  244. package/src/pages/ViewEditor/hooks/useDrawingEngine.ts +127 -0
  245. package/src/pages/ViewEditor/hooks/useViewContextNeighbours.ts +501 -0
  246. package/src/pages/ViewEditor/hooks/useViewData.ts +491 -0
  247. package/src/pages/ViewEditor/index.tsx +1366 -0
  248. package/src/pages/ViewEditor/utils.ts +88 -0
  249. package/src/pages/Views.tsx +171 -0
  250. package/src/pages/ViewsGrid.tsx +1310 -0
  251. package/src/pkg/importer/mermaid.test.ts +141 -0
  252. package/src/pkg/importer/mermaid.ts +76 -0
  253. package/src/platform/PlatformContext.tsx +17 -0
  254. package/src/platform/context.ts +9 -0
  255. package/src/platform/local.tsx +15 -0
  256. package/src/platform/types.ts +19 -0
  257. package/src/slots.ts +92 -0
  258. package/src/styles/editor-panels.css +66 -0
  259. package/src/styles/theme.css +56 -0
  260. package/src/theme.ts +336 -0
  261. package/src/types/index.ts +234 -0
  262. package/src/types/offline-ambient.d.ts +14 -0
  263. package/src/types/vscode-messages.ts +32 -0
  264. package/src/utils/edgeDistribution.ts +103 -0
  265. package/src/utils/githubApi.ts +121 -0
  266. package/src/utils/githubCache.ts +108 -0
  267. package/src/utils/ids.ts +9 -0
  268. package/src/utils/technologyCatalog.ts +143 -0
  269. package/src/utils/toast.ts +100 -0
  270. package/src/utils/treesitter.ts +147 -0
  271. package/src/utils/url.ts +72 -0
  272. package/src/vite-env.d.ts +1 -0
@@ -0,0 +1,380 @@
1
+ import React from "react"
2
+ import type { TopMenuBarSlots } from '../slots'
3
+ import { Link as RouterLink, useLocation } from "react-router-dom"
4
+ import {
5
+ Box,
6
+ Flex,
7
+ HStack,
8
+ IconButton,
9
+ Popover,
10
+ PopoverArrow,
11
+ PopoverBody,
12
+ PopoverContent,
13
+ PopoverTrigger,
14
+ Portal,
15
+ Text,
16
+ Tooltip,
17
+ useMediaQuery,
18
+ } from "@chakra-ui/react"
19
+ import { SettingsIcon } from "@chakra-ui/icons"
20
+ import logoMarkUrl from "../assets/logo-mark.svg"
21
+ import { useAccentColor } from "../context/ThemeContext"
22
+ import { hexToRgba } from "../constants/colors"
23
+ import AppearanceSettings from "../pages/AppearanceSettings"
24
+
25
+ const FolderTreeIcon = ({ size = 32 }: { size?: number }) => (
26
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round">
27
+ <rect x="8" y="2" width="8" height="5" rx="1.5" fill="none" />
28
+ <line x1="12" y1="7" x2="12" y2="11.5" />
29
+ <line x1="4.5" y1="11.5" x2="19.5" y2="11.5" />
30
+ <line x1="4.5" y1="11.5" x2="4.5" y2="14" />
31
+ <rect x="1.5" y="14" width="6" height="4.5" rx="1.5" fill="none" />
32
+ <line x1="19.5" y1="11.5" x2="19.5" y2="14" />
33
+ <rect x="16.5" y="14" width="6" height="4.5" rx="1.5" fill="none" />
34
+ </svg>
35
+ )
36
+
37
+ const PencilIcon = ({ size = 24 }: { size?: number }) => (
38
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round">
39
+ <path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" />
40
+ </svg>
41
+ )
42
+
43
+ const GraphNetworkIcon = ({ size = 22 }: { size?: number }) => (
44
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round">
45
+ <circle cx="12" cy="4" r="2.5" fill="currentColor" stroke="none" />
46
+ <circle cx="4" cy="19" r="2.5" fill="currentColor" stroke="none" />
47
+ <circle cx="20" cy="19" r="2.5" fill="currentColor" stroke="none" />
48
+ <line x1="12" y1="6.5" x2="5.2" y2="17" />
49
+ <line x1="12" y1="6.5" x2="18.8" y2="17" />
50
+ <line x1="6.5" y1="19" x2="17.5" y2="19" />
51
+ </svg>
52
+ )
53
+
54
+ interface Props extends TopMenuBarSlots {
55
+ children?: React.ReactNode
56
+ hideMobileBar?: boolean
57
+ }
58
+
59
+ type NavItem = {
60
+ label: string
61
+ path: string
62
+ icon: (props: { size?: number }) => JSX.Element
63
+ }
64
+
65
+ const NAV_ITEMS: NavItem[] = [
66
+ { label: "Editor", path: "/", icon: PencilIcon },
67
+ { label: "Diagrams", path: "/views", icon: FolderTreeIcon },
68
+ { label: "Links", path: "/dependencies", icon: GraphNetworkIcon },
69
+ ]
70
+
71
+ export default function TopMenuBar({ children, hideMobileBar, rightSlot, mobileMenuSlot, userControlsSlot }: Props) {
72
+ const location = useLocation()
73
+ const { accent } = useAccentColor()
74
+ const [isSmallerThan1150] = useMediaQuery("(max-width: 1150px)")
75
+
76
+ const isActive = (path: string) => {
77
+ if (path === "/") {
78
+ return location.pathname === "/" || location.pathname.startsWith("/views/")
79
+ }
80
+ if (path === "/views") {
81
+ return location.pathname === "/views"
82
+ }
83
+ return location.pathname === path || location.pathname.startsWith(`${path}/`)
84
+ }
85
+
86
+ return (
87
+ <>
88
+ <Flex
89
+ py={0}
90
+ className="glass"
91
+ align="center"
92
+ direction="row"
93
+ flexShrink={0}
94
+ position="fixed"
95
+ top={0}
96
+ left={0}
97
+ right={0}
98
+ zIndex={1100}
99
+ minH={{ base: "var(--topbar-h-mobile-total)", sm: "var(--topbar-h-total)" }}
100
+ style={{
101
+ paddingTop: "env(safe-area-inset-top, 0px)",
102
+ paddingLeft: "max(env(safe-area-inset-left, 0px), 8px)",
103
+ paddingRight: "max(env(safe-area-inset-right, 0px), 8px)",
104
+ } as React.CSSProperties}
105
+ sx={{
106
+ containerType: "inline-size",
107
+ containerName: "topbar",
108
+ }}
109
+ >
110
+ <HStack spacing={0} h="full" flexShrink={0} display={{ base: "none", sm: "flex" }}>
111
+ <HStack
112
+ as={RouterLink}
113
+ to="/"
114
+ spacing={2}
115
+ mr={4}
116
+ cursor="pointer"
117
+ px={2}
118
+ py={1}
119
+ borderRadius="xl"
120
+ transition="all 0.2s"
121
+ _hover={{
122
+ bg: "whiteAlpha.100",
123
+ "& .logo-mark": {
124
+ transform: "translateY(-4px) rotateX(10deg) rotateY(-10deg)",
125
+ filter: "drop-shadow(0 8px 8px rgba(0,0,0,0.4))",
126
+ },
127
+ }}
128
+ sx={{ perspective: "1000px" }}
129
+ >
130
+ <Box
131
+ as="img"
132
+ src={logoMarkUrl}
133
+ alt=""
134
+ height="30px"
135
+ display="block"
136
+ className="logo-mark"
137
+ transition="all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1)"
138
+ />
139
+ <Text
140
+ fontFamily="heading"
141
+ fontWeight="700"
142
+ lineHeight="1"
143
+ mt="3px"
144
+ sx={{
145
+ "@container topbar (max-width: 920px)": {
146
+ display: "none !important",
147
+ },
148
+ }}
149
+ >
150
+ tlDiagram
151
+ </Text>
152
+ </HStack>
153
+
154
+ <HStack spacing={2} h="full" align="center">
155
+ {NAV_ITEMS.map((item) => {
156
+ const active = isActive(item.path)
157
+ const Icon = item.icon
158
+ return (
159
+ <Tooltip
160
+ key={item.path}
161
+ label={item.label}
162
+ placement="bottom"
163
+ openDelay={400}
164
+ isDisabled={!isSmallerThan1150}
165
+ >
166
+ <Box
167
+ as={RouterLink}
168
+ to={item.path}
169
+ h="32px"
170
+ display="flex"
171
+ alignItems="center"
172
+ fontSize="13px"
173
+ fontWeight={active ? "700" : "500"}
174
+ color={active ? accent : "whiteAlpha.700"}
175
+ borderRadius="md"
176
+ bg={active ? "whiteAlpha.200" : "whiteAlpha.100"}
177
+ boxShadow={active ? `0 0 15px ${hexToRgba(accent, 0.4)}` : "0 4px 10px rgba(0,0,0,0.3)"}
178
+ border="1px solid"
179
+ borderColor={active ? accent : "whiteAlpha.100"}
180
+ _hover={{
181
+ bg: active ? "whiteAlpha.300" : "whiteAlpha.200",
182
+ transform: "translateY(-1px)",
183
+ boxShadow: active ? `0 0 20px ${hexToRgba(accent, 0.5)}` : "panel-hover",
184
+ color: "white",
185
+ }}
186
+ _active={{ transform: "translateY(0)" }}
187
+ transition="all 0.2s var(--chakra-transitions-easing-pop)"
188
+ position="relative"
189
+ px={4}
190
+ w="auto"
191
+ gap={2}
192
+ sx={{
193
+ "@container topbar (max-width: 1150px)": {
194
+ px: 2,
195
+ w: "36px",
196
+ gap: 0,
197
+ "& .nav-label": { display: "none" },
198
+ },
199
+ }}
200
+ >
201
+ <Icon size={18} />
202
+ <Box as="span" className="nav-label" lineHeight="1">{item.label}</Box>
203
+ </Box>
204
+ </Tooltip>
205
+ )
206
+ })}
207
+ </HStack>
208
+ </HStack>
209
+
210
+ {/* Centered Notch Container */}
211
+ {children && (
212
+ <Flex
213
+ position="absolute"
214
+ left="50%"
215
+ transform="translateX(-50%)"
216
+ h="full"
217
+ align="flex-start"
218
+ justify="center"
219
+ pointerEvents="none"
220
+ zIndex={5}
221
+ display={{ base: "none", sm: "flex" }}
222
+ sx={{
223
+ "@container topbar (max-width: 820px)": {
224
+ display: "none !important",
225
+ },
226
+ }}
227
+ >
228
+ <Box pointerEvents="auto">
229
+ {children}
230
+ </Box>
231
+ </Flex>
232
+ )}
233
+
234
+ {/* Spacer to push right-side content */}
235
+ <Box flex={1} minW={0} display={{ base: "none", sm: "block" }} />
236
+
237
+ <HStack spacing={2} ml="auto" flexShrink={0} display="flex">
238
+ {rightSlot}
239
+ {userControlsSlot}
240
+
241
+ <Popover placement="bottom-end" isLazy>
242
+ <Tooltip label="Appearance" placement="bottom" openDelay={400}>
243
+ <Box>
244
+ <PopoverTrigger>
245
+ <IconButton
246
+ aria-label="Appearance"
247
+ icon={<SettingsIcon boxSize={4} />}
248
+ size="sm"
249
+ borderRadius="full"
250
+ bg="whiteAlpha.100"
251
+ color="whiteAlpha.700"
252
+ border="1px solid"
253
+ borderColor="whiteAlpha.100"
254
+ _hover={{
255
+ bg: "whiteAlpha.200",
256
+ color: "white",
257
+ transform: "translateY(-1px)",
258
+ }}
259
+ />
260
+ </PopoverTrigger>
261
+ </Box>
262
+ </Tooltip>
263
+ <Portal>
264
+ <PopoverContent
265
+ mr={{ base: 2, sm: 0 }}
266
+ mt={2}
267
+ w={{ base: "calc(100vw - 24px)", sm: "360px" }}
268
+ maxW="360px"
269
+ bg="rgba(var(--bg-main-rgb), 0.95)"
270
+ backdropFilter="blur(18px)"
271
+ borderColor="whiteAlpha.200"
272
+ boxShadow="0 18px 48px rgba(0,0,0,0.45)"
273
+ borderRadius="20px"
274
+ overflow="hidden"
275
+ >
276
+ <PopoverArrow bg="rgba(var(--bg-main-rgb), 0.95)" />
277
+ <PopoverBody p={4}>
278
+ <AppearanceSettings compact />
279
+ </PopoverBody>
280
+ </PopoverContent>
281
+ </Portal>
282
+ </Popover>
283
+ </HStack>
284
+ </Flex>
285
+
286
+ {children && !hideMobileBar && (
287
+ <Flex
288
+ display={{ base: "flex", sm: "none" }}
289
+ position="fixed"
290
+ left="50%"
291
+ style={{ top: "calc(env(safe-area-inset-top, 0px) + var(--topbar-float-top))" } as React.CSSProperties}
292
+ transform="translateX(-50%)"
293
+ zIndex={99}
294
+ align="center"
295
+ justify="center"
296
+ px={2}
297
+ py={1}
298
+ maxW="90vw"
299
+ minH="var(--topbar-float-h)"
300
+ sx={{ "& > *": { filter: "drop-shadow(0 6px 18px rgba(0,0,0,0.7)) drop-shadow(0 2px 6px rgba(0,0,0,0.5))" } }}
301
+ >
302
+ {children}
303
+ </Flex>
304
+ )}
305
+
306
+ <Box
307
+ display={{ base: "block", sm: "none" }}
308
+ position="fixed"
309
+ bottom={0}
310
+ left={0}
311
+ right={0}
312
+ zIndex={200}
313
+ pointerEvents="none"
314
+ style={{ height: "calc(var(--bottomnav-container-h) + env(safe-area-inset-bottom, 0px))" } as React.CSSProperties}
315
+ >
316
+ <Box
317
+ position="absolute"
318
+ bottom={0}
319
+ left={0}
320
+ right={0}
321
+ bg="var(--bg-header)"
322
+ backdropFilter="blur(20px)"
323
+ borderTop="1px solid"
324
+ borderColor="whiteAlpha.200"
325
+ boxShadow="0 -4px 32px rgba(0,0,0,0.5)"
326
+ pointerEvents="auto"
327
+ style={{ height: "calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px))" } as React.CSSProperties}
328
+ />
329
+
330
+ <Flex
331
+ position="absolute"
332
+ bottom={0}
333
+ left={0}
334
+ right={0}
335
+ align="center"
336
+ style={{
337
+ height: "var(--bottomnav-h)",
338
+ paddingBottom: "env(safe-area-inset-bottom, 0px)",
339
+ paddingLeft: "max(env(safe-area-inset-left, 0px), 4px)",
340
+ paddingRight: "max(env(safe-area-inset-right, 0px), 4px)",
341
+ } as React.CSSProperties}
342
+ >
343
+ {[
344
+ { label: "Editor", path: "/", icon: PencilIcon },
345
+ { label: "Diagrams", path: "/views", icon: FolderTreeIcon },
346
+ { label: "Links", path: "/dependencies", icon: GraphNetworkIcon },
347
+ ].map((item) => {
348
+ const Icon = item.icon
349
+ const active = isActive(item.path)
350
+ return (
351
+ <Box
352
+ key={item.path}
353
+ as={RouterLink}
354
+ to={item.path}
355
+ flex={1}
356
+ display="flex"
357
+ flexDir="column"
358
+ alignItems="center"
359
+ justifyContent="center"
360
+ gap="3px"
361
+ h="full"
362
+ color={active ? "var(--accent)" : "whiteAlpha.500"}
363
+ transition="color 0.15s"
364
+ pointerEvents="auto"
365
+ _active={{ opacity: 0.6 }}
366
+ style={{ WebkitTapHighlightColor: "transparent" } as React.CSSProperties}
367
+ >
368
+ <Icon size={20} />
369
+ <Text fontSize="9px" fontWeight={active ? "700" : "500"} letterSpacing="wide" textTransform="uppercase">
370
+ {item.label}
371
+ </Text>
372
+ </Box>
373
+ )
374
+ })}
375
+ {mobileMenuSlot}
376
+ </Flex>
377
+ </Box>
378
+ </>
379
+ )
380
+ }
@@ -0,0 +1,143 @@
1
+ import { memo } from 'react'
2
+ import { BaseEdge, EdgeLabelRenderer, Position, useStore, type EdgeProps } from 'reactflow'
3
+ import { measureEdgeLabel, useEdgeLabelLayout } from './ViewEditorEdgeLabelLayout'
4
+
5
+ const CURVATURE = 0.5
6
+
7
+ /**
8
+ * Returns the bezier control point for one end of an connector.
9
+ * The stem extends in the handle's exit direction by at least `minStem`
10
+ * world-units, preventing the curve from turning sharply when dx/dy is small.
11
+ */
12
+ function controlPoint(
13
+ x: number, y: number,
14
+ tx: number, ty: number,
15
+ pos: Position,
16
+ minStem: number,
17
+ ): [number, number] {
18
+ const dx = Math.abs(tx - x)
19
+ const dy = Math.abs(ty - y)
20
+ switch (pos) {
21
+ case Position.Left: return [x - Math.max(dx * CURVATURE, minStem), y]
22
+ case Position.Right: return [x + Math.max(dx * CURVATURE, minStem), y]
23
+ case Position.Top: return [x, y - Math.max(dy * CURVATURE, minStem)]
24
+ case Position.Bottom: return [x, y + Math.max(dy * CURVATURE, minStem)]
25
+ }
26
+ }
27
+
28
+ function ViewBezierConnector({
29
+ id, source, target,
30
+ sourceX, sourceY, sourcePosition,
31
+ targetX, targetY, targetPosition,
32
+ style, label, labelStyle, labelBgStyle, labelShowBg: _labelShowBg, labelBgPadding, labelBgBorderRadius,
33
+ markerStart, markerEnd,
34
+ selected,
35
+ }: EdgeProps) {
36
+ const sourceNode = useStore((s) => s.nodeInternals.get(source))
37
+ const targetNode = useStore((s) => s.nodeInternals.get(target))
38
+
39
+ const finalSourceX = sourceX
40
+ const finalSourceY = sourceY
41
+ const finalTargetX = targetX
42
+ const finalTargetY = targetY
43
+
44
+ const srcW = sourceNode?.width ?? 200
45
+ const srcH = sourceNode?.height ?? 100
46
+ const tgtW = targetNode?.width ?? 200
47
+ const tgtH = targetNode?.height ?? 100
48
+
49
+ const srcMinStem = (sourcePosition === Position.Left || sourcePosition === Position.Right)
50
+ ? srcW * 0.5 : srcH * 0.5
51
+ const tgtMinStem = (targetPosition === Position.Left || targetPosition === Position.Right)
52
+ ? tgtW * 0.5 : tgtH * 0.5
53
+
54
+ const [cp1x, cp1y] = controlPoint(finalSourceX, finalSourceY, finalTargetX, finalTargetY, sourcePosition, srcMinStem)
55
+ // Target control point: extend from target back toward source
56
+ const [cp2x, cp2y] = controlPoint(finalTargetX, finalTargetY, finalSourceX, finalSourceY, targetPosition, tgtMinStem)
57
+
58
+ const path = `M ${finalSourceX},${finalSourceY} C ${cp1x},${cp1y} ${cp2x},${cp2y} ${finalTargetX},${finalTargetY}`
59
+
60
+ const INTERACTION_PADDING = 24
61
+ const lenSource = Math.hypot(cp1x - finalSourceX, cp1y - finalSourceY)
62
+ const lenTarget = Math.hypot(cp2x - finalTargetX, cp2y - finalTargetY)
63
+
64
+ const ix1 = lenSource > INTERACTION_PADDING ? finalSourceX + (cp1x - finalSourceX) * (INTERACTION_PADDING / lenSource) : finalSourceX
65
+ const iy1 = lenSource > INTERACTION_PADDING ? finalSourceY + (cp1y - finalSourceY) * (INTERACTION_PADDING / lenSource) : finalSourceY
66
+ const ix2 = lenTarget > INTERACTION_PADDING ? finalTargetX + (cp2x - finalTargetX) * (INTERACTION_PADDING / lenTarget) : finalTargetX
67
+ const iy2 = lenTarget > INTERACTION_PADDING ? finalTargetY + (cp2y - finalTargetY) * (INTERACTION_PADDING / lenTarget) : finalTargetY
68
+
69
+ const interactionPath = `M ${ix1},${iy1} C ${cp1x},${cp1y} ${cp2x},${cp2y} ${ix2},${iy2}`
70
+
71
+ const fontSize = Number(labelStyle?.fontSize ?? 11)
72
+ const fontWeight = 500
73
+ const fullText = typeof label === 'string' ? label : ''
74
+ const text = (!selected && fullText.length > 30) ? `${fullText.slice(0, 30)}...` : fullText
75
+ const textWidth = text ? measureEdgeLabel(text, `${fontWeight} ${fontSize}px Inter, system-ui, sans-serif`) : 0
76
+ const padding = Array.isArray(labelBgPadding) ? labelBgPadding : [2, 4]
77
+
78
+ // Cubic bezier midpoint at t=0.5
79
+ const labelX = 0.125 * finalSourceX + 0.375 * cp1x + 0.375 * cp2x + 0.125 * finalTargetX
80
+ const labelY = 0.125 * finalSourceY + 0.375 * cp1y + 0.375 * cp2y + 0.125 * finalTargetY
81
+
82
+ const labelLayout = useEdgeLabelLayout({
83
+ id,
84
+ preferredX: labelX,
85
+ preferredY: labelY,
86
+ width: textWidth + padding[1] * 2,
87
+ height: fontSize + padding[0] * 2,
88
+ dx: finalTargetX - finalSourceX,
89
+ dy: finalTargetY - finalSourceY,
90
+ })
91
+
92
+ const labelWidth = textWidth + padding[1] * 2
93
+ const labelPath = text ? ` M ${labelLayout.x - labelWidth / 2},${labelLayout.y} L ${labelLayout.x + labelWidth / 2},${labelLayout.y}` : ''
94
+ const combinedInteractionPath = `${interactionPath}${labelPath}`
95
+
96
+ return (
97
+ <>
98
+ <BaseEdge
99
+ path={path}
100
+ markerStart={markerStart}
101
+ markerEnd={markerEnd}
102
+ style={style}
103
+ interactionWidth={0}
104
+ />
105
+ <BaseEdge
106
+ id={id}
107
+ path={combinedInteractionPath}
108
+ interactionWidth={20}
109
+ style={{ stroke: 'transparent' }}
110
+ />
111
+ {text && (
112
+ <EdgeLabelRenderer>
113
+ <div
114
+ style={{
115
+ position: 'absolute',
116
+ transform: `translate(-50%, -50%) translate(${labelLayout.x}px, ${labelLayout.y}px)`,
117
+ pointerEvents: 'none',
118
+ opacity: Number(labelStyle?.opacity ?? 1),
119
+ zIndex: 2,
120
+ }}
121
+ >
122
+ <div
123
+ style={{
124
+ padding: `${padding[0]}px ${padding[1]}px`,
125
+ borderRadius: Array.isArray(labelBgBorderRadius) ? labelBgBorderRadius[0] : Number(labelBgBorderRadius ?? 4),
126
+ background: String(labelBgStyle?.fill ?? 'var(--chakra-colors-gray-900)'),
127
+ color: String(labelStyle?.fill ?? 'var(--accent)'),
128
+ fontSize,
129
+ fontWeight,
130
+ lineHeight: 1,
131
+ whiteSpace: 'nowrap',
132
+ }}
133
+ >
134
+ {text}
135
+ </div>
136
+ </div>
137
+ </EdgeLabelRenderer>
138
+ )}
139
+ </>
140
+ )
141
+ }
142
+
143
+ export default memo(ViewBezierConnector)