@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,193 @@
1
+ export interface TechnologyConnector {
2
+ type: 'catalog' | 'custom';
3
+ slug?: string;
4
+ label: string;
5
+ is_primary_icon?: boolean;
6
+ }
7
+ export interface TechnologyCatalogItem {
8
+ iconUrl: string;
9
+ name: string;
10
+ provider: string;
11
+ docsUrl: string;
12
+ description: string;
13
+ websiteUrl: string;
14
+ nameShort: string;
15
+ defaultSlug: string;
16
+ }
17
+ export interface Tag {
18
+ name: string;
19
+ color: string;
20
+ description: string | null;
21
+ }
22
+ export interface LibraryElement {
23
+ id: number;
24
+ name: string;
25
+ kind: string | null;
26
+ description: string | null;
27
+ technology: string | null;
28
+ url: string | null;
29
+ logo_url: string | null;
30
+ technology_connectors: TechnologyConnector[];
31
+ tags: string[];
32
+ repo?: string | null;
33
+ branch?: string | null;
34
+ file_path?: string | null;
35
+ language?: string | null;
36
+ created_at: string;
37
+ updated_at: string;
38
+ has_view: boolean;
39
+ view_label: string | null;
40
+ }
41
+ export interface View {
42
+ id: number;
43
+ owner_element_id: number | null;
44
+ name: string;
45
+ label: string | null;
46
+ is_root: boolean;
47
+ created_at: string;
48
+ updated_at: string;
49
+ }
50
+ export interface ElementPlacement {
51
+ id: number;
52
+ view_id: number;
53
+ element_id: number;
54
+ position_x: number;
55
+ position_y: number;
56
+ }
57
+ export interface PlacedElement {
58
+ id: number;
59
+ view_id: number;
60
+ element_id: number;
61
+ position_x: number;
62
+ position_y: number;
63
+ name: string;
64
+ description: string | null;
65
+ kind: string | null;
66
+ technology: string | null;
67
+ url: string | null;
68
+ logo_url: string | null;
69
+ technology_connectors: TechnologyConnector[];
70
+ tags: string[];
71
+ repo?: string | null;
72
+ branch?: string | null;
73
+ file_path?: string | null;
74
+ language?: string | null;
75
+ has_view: boolean;
76
+ view_label: string | null;
77
+ }
78
+ export interface NavigationConnector {
79
+ id: number;
80
+ element_id: number | null;
81
+ from_view_id: number;
82
+ to_view_id: number;
83
+ to_view_name: string;
84
+ relation_type: string;
85
+ }
86
+ export interface Connector {
87
+ id: number;
88
+ view_id: number;
89
+ source_element_id: number;
90
+ target_element_id: number;
91
+ label: string | null;
92
+ description: string | null;
93
+ relationship: string | null;
94
+ direction: string;
95
+ style: string;
96
+ url: string | null;
97
+ source_handle: string | null;
98
+ target_handle: string | null;
99
+ created_at: string;
100
+ updated_at: string;
101
+ }
102
+ export interface ViewTreeNode {
103
+ id: number;
104
+ owner_element_id?: number | null;
105
+ name: string;
106
+ description: string | null;
107
+ level_label: string | null;
108
+ level: number;
109
+ depth: number;
110
+ created_at: string;
111
+ updated_at: string;
112
+ parent_view_id: number | null;
113
+ children: ViewTreeNode[];
114
+ }
115
+ export interface ViewLayer {
116
+ id: number;
117
+ diagram_id: number;
118
+ name: string;
119
+ tags: string[];
120
+ color?: string;
121
+ created_at?: string;
122
+ updated_at?: string;
123
+ }
124
+ export interface DependencyElement {
125
+ id: string;
126
+ name: string;
127
+ description?: string | null;
128
+ type?: string | null;
129
+ technology?: string | null;
130
+ url?: string | null;
131
+ logo_url?: string | null;
132
+ technology_connectors: TechnologyConnector[];
133
+ tags: string[];
134
+ repo?: string | null;
135
+ branch?: string | null;
136
+ language?: string | null;
137
+ file_path?: string | null;
138
+ created_at: string;
139
+ updated_at: string;
140
+ }
141
+ export interface DependencyConnector {
142
+ id: string;
143
+ view_id: string;
144
+ source_element_id: string;
145
+ target_element_id: string;
146
+ label?: string | null;
147
+ description?: string | null;
148
+ relationship_type?: string | null;
149
+ direction: string;
150
+ connector_type: string;
151
+ url?: string | null;
152
+ source_handle?: string | null;
153
+ target_handle?: string | null;
154
+ created_at: string;
155
+ updated_at: string;
156
+ }
157
+ export interface ViewConnector {
158
+ id: number;
159
+ element_id: number | null;
160
+ from_view_id: number;
161
+ to_view_id: number;
162
+ to_view_name: string;
163
+ relation_type: string;
164
+ }
165
+ export interface ViewConnectorsResult {
166
+ child_links: ViewConnector[];
167
+ parent_links: ViewConnector[];
168
+ }
169
+ export interface IncomingViewConnector {
170
+ id: number;
171
+ element_id: number;
172
+ element_name: string;
173
+ from_view_id: number;
174
+ from_view_name: string;
175
+ to_view_id: number;
176
+ }
177
+ export interface ViewPlacement {
178
+ view_id: number;
179
+ view_name: string;
180
+ }
181
+ export interface ExploreViewData {
182
+ placements: PlacedElement[];
183
+ connectors: Connector[];
184
+ }
185
+ export interface ExploreData {
186
+ tree: ViewTreeNode[];
187
+ views: Record<string, ExploreViewData>;
188
+ navigations: ViewConnector[];
189
+ password_required?: boolean;
190
+ }
191
+ export declare const ELEMENT_TYPES: readonly ["person", "system", "container", "component", "database", "queue", "api", "service", "external"];
192
+ export type ElementType = (typeof ELEMENT_TYPES)[number];
193
+ export declare const TYPE_COLORS: Record<string, string>;
@@ -0,0 +1,60 @@
1
+ import type { LibraryElement } from './index';
2
+ export interface WorkspaceSymbol {
3
+ name: string;
4
+ kind: string;
5
+ filePath: string;
6
+ startLine: number;
7
+ }
8
+ export type ExtensionToWebviewMessage = {
9
+ type: 'workspace-symbols';
10
+ requestId: string;
11
+ symbols: WorkspaceSymbol[];
12
+ } | {
13
+ type: 'workspace-files';
14
+ requestId: string;
15
+ files: string[];
16
+ } | {
17
+ type: 'element-placed';
18
+ elementId: number;
19
+ x: number;
20
+ y: number;
21
+ } | {
22
+ type: 'focus-element';
23
+ elementId: number;
24
+ } | {
25
+ type: 'diagnostics-update';
26
+ elementId: number;
27
+ severity: string;
28
+ message: string;
29
+ } | {
30
+ type: 'file-content';
31
+ requestId: string;
32
+ content: string;
33
+ startLineOffset: number;
34
+ };
35
+ export type WebviewToExtensionMessage = {
36
+ type: 'ready';
37
+ } | {
38
+ type: 'open-file';
39
+ filePath: string;
40
+ startLine?: number;
41
+ symbolName?: string;
42
+ symbolKind?: string;
43
+ } | {
44
+ type: 'request-workspace-files';
45
+ requestId: string;
46
+ pattern: string;
47
+ } | {
48
+ type: 'request-symbol-list-for-file';
49
+ requestId: string;
50
+ filePath: string;
51
+ } | {
52
+ type: 'diagram-loaded';
53
+ diagramId: number;
54
+ elements: LibraryElement[];
55
+ } | {
56
+ type: 'request-file-content';
57
+ requestId: string;
58
+ filePath: string;
59
+ startLine: number;
60
+ };
@@ -0,0 +1,34 @@
1
+ import type { CSSProperties } from 'react';
2
+ import { Position } from 'reactflow';
3
+ export declare const HANDLE_SLOT_COUNT = 5;
4
+ export declare const HANDLE_SLOT_GAP = 12;
5
+ export declare const HANDLE_SLOT_CENTER_INDEX: number;
6
+ export type LogicalHandleSide = 'top' | 'bottom' | 'left' | 'right';
7
+ export declare const DEFAULT_SOURCE_HANDLE_SIDE: LogicalHandleSide;
8
+ export declare const DEFAULT_TARGET_HANDLE_SIDE: LogicalHandleSide;
9
+ export declare function getLogicalHandleId(handleId: string | null | undefined, fallback?: LogicalHandleSide | null): LogicalHandleSide | null;
10
+ export declare function getVisualHandleSlot(groupIndex: number, groupCount: number): number;
11
+ export declare function getVisualHandleSlotFromId(handleId: string | null | undefined): number | null;
12
+ export declare function getVisualHandleId(side: LogicalHandleSide, slot: number): string;
13
+ export declare function getVisualHandleIdForGroup(side: LogicalHandleSide, groupIndex: number, groupCount: number): string;
14
+ export declare function ensureVisualHandleId(handleId: string | null | undefined, fallback: LogicalHandleSide): string | null;
15
+ export declare function getHandleSlotOffset(slot: number): number;
16
+ export declare function getHandleSlotOffsetFromId(handleId: string | null | undefined): number;
17
+ export declare function getVisualHandleStyle(position: Position, slot: number): CSSProperties;
18
+ export declare function getHandleFlowPosition(nodeX: number, nodeY: number, width: number, height: number, handleId: string | null | undefined, fallback: LogicalHandleSide): {
19
+ x: number;
20
+ y: number;
21
+ side: "top";
22
+ } | {
23
+ x: number;
24
+ y: number;
25
+ side: "bottom";
26
+ } | {
27
+ x: number;
28
+ y: number;
29
+ side: "left";
30
+ } | {
31
+ x: number;
32
+ y: number;
33
+ side: "right";
34
+ };
@@ -0,0 +1,4 @@
1
+ type RepoVisibility = 'public' | 'private' | 'unknown';
2
+ export declare function githubRequest(path: string): Promise<Response>;
3
+ export declare function getGithubRepoVisibility(repoSlug: string): Promise<RepoVisibility>;
4
+ export {};
@@ -0,0 +1,17 @@
1
+ declare class GithubCache {
2
+ private cache;
3
+ constructor();
4
+ private load;
5
+ private save;
6
+ private cleanup;
7
+ getBranches(repo: string): string[] | null;
8
+ setBranches(repo: string, data: string[]): void;
9
+ getTree(repo: string, branch: string): string[] | null;
10
+ setTree(repo: string, branch: string, data: string[]): void;
11
+ getContent(rawUrl: string): string | null;
12
+ setContent(rawUrl: string, data: string): void;
13
+ getRepoPublic(slug: string): boolean | null;
14
+ setRepoPublic(slug: string, isPublic: boolean): void;
15
+ }
16
+ export declare const githubCache: GithubCache;
17
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare function parseNumericId(value: string | null | undefined): number | null;
2
+ export declare function idToString(value: number | null | undefined): string;
@@ -0,0 +1,15 @@
1
+ import type { TechnologyCatalogItem } from '../types';
2
+ interface SearchableCatalogItem {
3
+ item: TechnologyCatalogItem;
4
+ haystack: string;
5
+ }
6
+ interface TechnologyCatalogIndex {
7
+ items: TechnologyCatalogItem[];
8
+ searchable: SearchableCatalogItem[];
9
+ bySlug: Map<string, TechnologyCatalogItem>;
10
+ }
11
+ export declare function resolveWithBase(urlOrPath: string): string;
12
+ export declare function getTechnologyCatalogIndex(): Promise<TechnologyCatalogIndex>;
13
+ export declare function searchTechnologyCatalog(query: string, maxResults?: number): Promise<TechnologyCatalogItem[]>;
14
+ export declare function getTechnologyCatalogItemBySlug(slug: string): Promise<TechnologyCatalogItem | null>;
15
+ export {};
@@ -0,0 +1,15 @@
1
+ import { UseToastOptions, ToastId } from '@chakra-ui/react';
2
+ declare const chakraToast: any, ToastContainer: any;
3
+ /**
4
+ * Global toast utility that intercepts 'error' status toasts to combine multiple
5
+ * backend errors into a single notification with a counter.
6
+ */
7
+ interface CustomToast {
8
+ (options: UseToastOptions): ToastId | undefined;
9
+ close: typeof chakraToast.close;
10
+ closeAll: typeof chakraToast.closeAll;
11
+ update: typeof chakraToast.update;
12
+ isActive: typeof chakraToast.isActive;
13
+ }
14
+ declare const toast: CustomToast;
15
+ export { toast, ToastContainer };
@@ -0,0 +1,13 @@
1
+ import Parser from 'web-tree-sitter';
2
+ export declare function initTreeSitter(): Promise<void>;
3
+ export type SupportedLanguage = 'javascript' | 'typescript' | 'python' | 'java' | 'cpp' | 'go' | 'rust';
4
+ export declare function detectLanguage(path: string): SupportedLanguage | null;
5
+ export declare function getParser(language: SupportedLanguage): Promise<Parser>;
6
+ export interface ParsedSymbol {
7
+ name: string;
8
+ type: string;
9
+ startLine: number;
10
+ endLine: number;
11
+ }
12
+ export declare function extractSymbols(tree: Parser.Tree, language: SupportedLanguage): ParsedSymbol[];
13
+ export declare function findSymbolByName(tree: Parser.Tree, language: SupportedLanguage, name: string, type: string): ParsedSymbol | null;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Resolves a static asset path (like a logo or icon) taking into account
3
+ * the environment (dev vs production, web vs native Capacitor).
4
+ */
5
+ export declare function resolveIconPath(path: string | null | undefined): string;
6
+ /**
7
+ * Normalizes any git repository reference to an "owner/repo" slug:
8
+ * - SSH: git@github.com:owner/repo.git → owner/repo
9
+ * - HTTPS: https://github.com/owner/repo.git → owner/repo
10
+ * - Plain: owner/repo → owner/repo
11
+ */
12
+ export declare function parseRepoSlug(repo: string): string;
package/package.json ADDED
@@ -0,0 +1,159 @@
1
+ {
2
+ "name": "@tldiagram/core-ui",
3
+ "version": "1.87.0",
4
+ "type": "module",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/Mertcikla/tld"
8
+ },
9
+ "main": "./dist/index.js",
10
+ "module": "./dist/index.js",
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/index.js",
15
+ "types": "./dist/index.d.ts"
16
+ },
17
+ "./styles": "./dist/index.css"
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "src"
22
+ ],
23
+ "scripts": {
24
+ "prepare:icons": "go run ../scripts/extract_icons.go ./public",
25
+ "strip:icons": "rm -rf dist/icons dist/icons.json",
26
+ "dev": "vite --config vite.config.ts",
27
+ "predev": "npm run prepare:icons",
28
+ "dev:lib": "vite build --config vite.lib.config.ts --watch",
29
+ "build": "npm run build:lib && npm run strip:icons",
30
+ "build:lib": "vite build --config vite.lib.config.ts && tsc -p tsconfig.lib.json",
31
+ "prebuild:app": "npm run prepare:icons",
32
+ "build:app": "tsc && vite build --config vite.config.ts",
33
+ "lint": "eslint .",
34
+ "lint:fix": "eslint . --fix",
35
+ "preview": "vite preview",
36
+ "test": "vitest run"
37
+ },
38
+ "dependencies": {
39
+ "@buf/tldiagramcom_diagram.bufbuild_es": "^2.11.0-20260419172603-8192c519478e.1",
40
+ "@bufbuild/protobuf": "^2.11.0",
41
+ "esbuild": "^0.25.12"
42
+ },
43
+ "peerDependencies": {
44
+ "@chakra-ui/icons": "^2.2.4",
45
+ "@chakra-ui/react": "^2.10.4",
46
+ "@codemirror/commands": "^6.10.3",
47
+ "@codemirror/lang-cpp": "^6.0.3",
48
+ "@codemirror/lang-java": "^6.0.2",
49
+ "@codemirror/lang-javascript": "^6.2.5",
50
+ "@codemirror/lang-python": "^6.2.1",
51
+ "@codemirror/lang-rust": "^6.0.2",
52
+ "@codemirror/language": "^6.12.2",
53
+ "@codemirror/state": "^6.6.0",
54
+ "@codemirror/theme-one-dark": "^6.1.3",
55
+ "@codemirror/view": "^6.40.0",
56
+ "@connectrpc/connect": "^2.1.1",
57
+ "@connectrpc/connect-web": "^2.1.1",
58
+ "@emotion/react": "^11.14.0",
59
+ "@emotion/styled": "^11.14.0",
60
+ "@uiw/react-codemirror": "^4.25.8",
61
+ "d3-force": "^3.0.0",
62
+ "elkjs": "^0.11.1",
63
+ "framer-motion": "^11.18.2",
64
+ "html-to-image": "^1.11.13",
65
+ "mermaid-ast": "^0.8.2",
66
+ "react": "^18.3.1",
67
+ "react-dom": "^18.3.1",
68
+ "react-router-dom": "^6.28.1",
69
+ "reactflow": "^11.11.4",
70
+ "web-tree-sitter": "0.21.0"
71
+ },
72
+ "peerDependenciesMeta": {
73
+ "@codemirror/commands": {
74
+ "optional": true
75
+ },
76
+ "@codemirror/lang-cpp": {
77
+ "optional": true
78
+ },
79
+ "@codemirror/lang-java": {
80
+ "optional": true
81
+ },
82
+ "@codemirror/lang-javascript": {
83
+ "optional": true
84
+ },
85
+ "@codemirror/lang-python": {
86
+ "optional": true
87
+ },
88
+ "@codemirror/lang-rust": {
89
+ "optional": true
90
+ },
91
+ "@codemirror/language": {
92
+ "optional": true
93
+ },
94
+ "@codemirror/state": {
95
+ "optional": true
96
+ },
97
+ "@codemirror/theme-one-dark": {
98
+ "optional": true
99
+ },
100
+ "@codemirror/view": {
101
+ "optional": true
102
+ },
103
+ "@uiw/react-codemirror": {
104
+ "optional": true
105
+ },
106
+ "web-tree-sitter": {
107
+ "optional": true
108
+ }
109
+ },
110
+ "devDependencies": {
111
+ "@chakra-ui/icons": "^2.2.4",
112
+ "@chakra-ui/react": "^2.10.4",
113
+ "@codemirror/commands": "^6.10.3",
114
+ "@codemirror/lang-cpp": "^6.0.3",
115
+ "@codemirror/lang-java": "^6.0.2",
116
+ "@codemirror/lang-javascript": "^6.2.5",
117
+ "@codemirror/lang-python": "^6.2.1",
118
+ "@codemirror/lang-rust": "^6.0.2",
119
+ "@codemirror/language": "^6.12.2",
120
+ "@codemirror/state": "^6.6.0",
121
+ "@codemirror/theme-one-dark": "^6.1.3",
122
+ "@codemirror/view": "^6.40.0",
123
+ "@connectrpc/connect": "^2.1.1",
124
+ "@connectrpc/connect-web": "^2.1.1",
125
+ "@emotion/react": "^11.14.0",
126
+ "@emotion/styled": "^11.14.0",
127
+ "@eslint/js": "^9.0.0",
128
+ "@types/react": "^18.3.12",
129
+ "@types/react-dom": "^18.3.1",
130
+ "@uiw/react-codemirror": "^4.25.8",
131
+ "@vitejs/plugin-react": "^4.3.4",
132
+ "d3-force": "^3.0.0",
133
+ "elkjs": "^0.11.1",
134
+ "eslint": "^9.0.0",
135
+ "eslint-plugin-react-hooks": "^5.0.0",
136
+ "eslint-plugin-react-refresh": "^0.4.0",
137
+ "framer-motion": "^11.18.2",
138
+ "globals": "^15.0.0",
139
+ "html-to-image": "^1.11.13",
140
+ "mermaid-ast": "^0.8.2",
141
+ "react": "^18.3.1",
142
+ "react-dom": "^18.3.1",
143
+ "react-router-dom": "^6.28.1",
144
+ "reactflow": "^11.11.4",
145
+ "typescript": "^5.6.3",
146
+ "typescript-eslint": "^8.0.0",
147
+ "vite": "^6.0.3",
148
+ "vite-tsconfig-paths": "^6.1.1",
149
+ "vitest": "^4.1.2",
150
+ "web-tree-sitter": "^0.21.0"
151
+ },
152
+ "optionalDependencies": {
153
+ "@rollup/rollup-linux-arm64-gnu": "^4.59.0",
154
+ "@rollup/rollup-linux-arm64-musl": "^4.59.0"
155
+ },
156
+ "lint-staged": {
157
+ "*.{js,jsx,ts,tsx}": "eslint --fix"
158
+ }
159
+ }
package/src/App.tsx ADDED
@@ -0,0 +1,141 @@
1
+ import { useEffect, useState } from 'react'
2
+ import { Routes, Route, Navigate, Outlet } from 'react-router-dom'
3
+ import { Box, Spinner, Center } from '@chakra-ui/react'
4
+ import { api } from './api/client'
5
+ import ViewEditor from './pages/ViewEditor'
6
+ import ViewsPage from './pages/Views'
7
+ import Dependencies from './pages/Dependencies'
8
+ import { SharedInfiniteZoom } from './pages/InfiniteZoom'
9
+ import Settings from './pages/Settings'
10
+ import AppearanceSettings from './pages/AppearanceSettings'
11
+ import { HeaderProvider, useHeader } from './components/HeaderContext'
12
+ import TopMenuBar from './components/TopMenuBar'
13
+ import DemoPage, { DemoNavigator } from './demo/DemoPage'
14
+ import { ThemeProvider } from './context/ThemeContext'
15
+ import { ACCENT_DEFAULT, BACKGROUND_DEFAULT, ELEMENT_DEFAULT, hexToRgba } from './constants/colors'
16
+ import { platform } from './platform/local'
17
+
18
+ function AppLayout() {
19
+ const header = useHeader()
20
+ const node = header && typeof header === 'object' && 'node' in header ? (header as { node: React.ReactNode }).node : header
21
+ const hideMobileBar = header && typeof header === 'object' && 'hideMobileBar' in header ? !!(header as { hideMobileBar?: boolean }).hideMobileBar : false
22
+
23
+ return (
24
+ <Box h="100vh" display="flex" flexDirection="column" bg="var(--bg-canvas)" overflow="hidden">
25
+ <TopMenuBar hideMobileBar={hideMobileBar}>
26
+ {node}
27
+ </TopMenuBar>
28
+ <Box
29
+ h={{ base: 'var(--topbar-h-mobile-total)', sm: 'var(--topbar-h-total)' }}
30
+ mb={{ base: 'var(--topbar-content-gap)', sm: '0px' }}
31
+ flexShrink={0}
32
+ />
33
+ <Box flex="1" overflow="hidden" position="relative">
34
+ <Outlet />
35
+ </Box>
36
+ </Box>
37
+ )
38
+ }
39
+
40
+ ;(() => {
41
+ const accent = localStorage.getItem('diag:accent-color') ?? ACCENT_DEFAULT
42
+ document.documentElement.style.setProperty('--accent', accent)
43
+ const rgba = hexToRgba(accent, 1)
44
+ document.documentElement.style.setProperty('--accent-rgb', rgba.slice(5, -3))
45
+
46
+ const background = localStorage.getItem('diag:background-color') ?? BACKGROUND_DEFAULT
47
+ document.documentElement.style.setProperty('--bg-main', background)
48
+ const bgRgba = hexToRgba(background, 1)
49
+ document.documentElement.style.setProperty('--bg-main-rgb', bgRgba.slice(5, -3))
50
+
51
+ const elementColor = localStorage.getItem('diag:element-color') ?? ELEMENT_DEFAULT
52
+ document.documentElement.style.setProperty('--bg-element', elementColor)
53
+ const objRgba = hexToRgba(elementColor, 1)
54
+ document.documentElement.style.setProperty('--bg-element-rgb', objRgba.slice(5, -3))
55
+ })()
56
+
57
+ function HomeRedirect() {
58
+ const [loading, setLoading] = useState(true)
59
+ const [target, setTarget] = useState<string | null>(null)
60
+
61
+ useEffect(() => {
62
+ let mounted = true
63
+ api.workspace.views
64
+ .tree()
65
+ .then((tree) => {
66
+ if (!mounted) return
67
+ const roots = (tree || []).filter((view) => view.parent_view_id === null)
68
+ if (roots.length > 0) setTarget(`/views/${roots[0].id}`)
69
+ else setTarget('/views')
70
+ })
71
+ .catch(() => mounted && setTarget('/views'))
72
+ .finally(() => mounted && setLoading(false))
73
+
74
+ return () => {
75
+ mounted = false
76
+ }
77
+ }, [])
78
+
79
+ if (loading) {
80
+ return (
81
+ <Center h="100vh">
82
+ <Spinner size="xl" />
83
+ </Center>
84
+ )
85
+ }
86
+
87
+ return <Navigate to={target || '/views'} replace />
88
+ }
89
+
90
+ export default function App() {
91
+ const [ready, setReady] = useState(false)
92
+
93
+ useEffect(() => {
94
+ api.system.ready()
95
+ .then(() => platform.initPlatform())
96
+ .finally(() => setReady(true))
97
+ }, [])
98
+
99
+ if (!ready) {
100
+ return (
101
+ <Center h="100vh">
102
+ <Spinner size="xl" />
103
+ </Center>
104
+ )
105
+ }
106
+
107
+ return (
108
+ <ThemeProvider>
109
+ <Box minH="100vh" bg="var(--bg-canvas)">
110
+ <Routes>
111
+ {platform.getRoutes({ user: null })}
112
+
113
+ <Route path="/explore/shared/:token" element={<Box h="100vh" overflow="hidden"><HeaderProvider><SharedInfiniteZoom /></HeaderProvider></Box>} />
114
+ <Route path="/demo" element={<DemoNavigator />} />
115
+ <Route path="/demo/:id" element={<DemoPage />} />
116
+
117
+ <Route
118
+ element={
119
+ <HeaderProvider>
120
+ <AppLayout />
121
+ </HeaderProvider>
122
+ }
123
+ >
124
+ <Route index element={<HomeRedirect />} />
125
+ <Route path="views" element={<ViewsPage />} />
126
+ <Route path="views/:id" element={<ViewEditor />} />
127
+ <Route path="dependencies" element={<Dependencies />} />
128
+ <Route path="explore" element={<Navigate to="/views" replace />} />
129
+ <Route path="settings" element={<Settings />}>
130
+ <Route index element={<Navigate to="appearance" replace />} />
131
+ {platform.getSettingsRoutes({ user: null })}
132
+ <Route path="appearance" element={<AppearanceSettings />} />
133
+ </Route>
134
+ </Route>
135
+
136
+ <Route path="*" element={<Navigate to="/" replace />} />
137
+ </Routes>
138
+ </Box>
139
+ </ThemeProvider>
140
+ )
141
+ }