@tldiagram/core-ui 1.95.0 → 2.0.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 (102) hide show
  1. package/dist/api/client.d.ts +184 -3
  2. package/dist/components/ConnectorPanel.d.ts +5 -1
  3. package/dist/components/CrossBranchControls.d.ts +4 -3
  4. package/dist/components/ElementNode.d.ts +5 -0
  5. package/dist/components/ElementPanel.d.ts +6 -1
  6. package/dist/components/LayoutSection.d.ts +2 -1
  7. package/dist/components/MergeDialog.d.ts +16 -0
  8. package/dist/components/MiniZoomOnboarding.d.ts +2 -1
  9. package/dist/components/NodeContainer.d.ts +2 -0
  10. package/dist/components/ProxyConnectorPanel.d.ts +4 -1
  11. package/dist/components/ViewExplorer/index.d.ts +1 -1
  12. package/dist/components/ViewFloatingMenu-vscode.d.ts +5 -0
  13. package/dist/components/ViewFloatingMenu.d.ts +8 -1
  14. package/dist/components/ViewGridNode.d.ts +3 -0
  15. package/dist/components/ViewPanel.d.ts +2 -1
  16. package/dist/components/WorkspacePanel.d.ts +2 -0
  17. package/dist/components/ZUI/ZUICanvas.d.ts +5 -0
  18. package/dist/components/ZUI/focus.d.ts +32 -0
  19. package/dist/components/ZUI/focus.test.d.ts +1 -0
  20. package/dist/components/ZUI/layout.d.ts +2 -2
  21. package/dist/components/ZUI/proxy.d.ts +20 -4
  22. package/dist/components/ZUI/renderer.d.ts +35 -1
  23. package/dist/components/ZUI/types.d.ts +6 -0
  24. package/dist/components/ZUI/useZUIInteraction.d.ts +1 -0
  25. package/dist/context/WorkspaceVersionContext.d.ts +49 -0
  26. package/dist/crossBranch/resolve.d.ts +39 -2
  27. package/dist/crossBranch/resolve.test.d.ts +1 -0
  28. package/dist/crossBranch/settings.d.ts +6 -1
  29. package/dist/crossBranch/types.d.ts +8 -0
  30. package/dist/hooks/useElementSearch.d.ts +8 -0
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.js +14597 -12083
  33. package/dist/pages/InfiniteZoom.d.ts +1 -0
  34. package/dist/pages/ViewEditor/hooks/useCanvasInteractions.d.ts +6 -1
  35. package/dist/pages/ViewEditor/hooks/useViewContextNeighbours.d.ts +2 -0
  36. package/dist/pages/ViewEditor/hooks/useViewData.d.ts +4 -2
  37. package/dist/pages/ViewEditor/hooks/useViewEditHistory.d.ts +13 -0
  38. package/dist/pages/viewsJumpSearch.d.ts +22 -0
  39. package/dist/pages/viewsJumpSearch.test.d.ts +1 -0
  40. package/dist/store/useStore.d.ts +3 -0
  41. package/dist/types/index.d.ts +9 -0
  42. package/dist/utils/elementIcon.d.ts +2 -0
  43. package/dist/utils/elementIcon.test.d.ts +1 -0
  44. package/dist/utils/sourceEditor.d.ts +7 -0
  45. package/dist/utils/watchDiffSummary.d.ts +34 -0
  46. package/package.json +2 -2
  47. package/src/App.tsx +12 -8
  48. package/src/api/client.ts +488 -26
  49. package/src/components/CodePreviewPanel.tsx +90 -16
  50. package/src/components/ConnectorPanel.tsx +34 -3
  51. package/src/components/ContextNeighborElement.tsx +2 -5
  52. package/src/components/CrossBranchControls.tsx +46 -17
  53. package/src/components/ElementNode.tsx +98 -47
  54. package/src/components/ElementPanel.tsx +62 -25
  55. package/src/components/InlineElementAdder.tsx +8 -3
  56. package/src/components/LayoutSection.tsx +4 -1
  57. package/src/components/MergeDialog.tsx +269 -0
  58. package/src/components/MiniZoomOnboarding.tsx +29 -22
  59. package/src/components/NodeContainer.tsx +55 -17
  60. package/src/components/ProxyConnectorPanel.tsx +58 -16
  61. package/src/components/ViewBezierConnector.tsx +116 -21
  62. package/src/components/ViewExplorer/index.tsx +1 -1
  63. package/src/components/ViewFloatingMenu-vscode.tsx +5 -0
  64. package/src/components/ViewFloatingMenu.tsx +110 -1
  65. package/src/components/ViewGridNode.tsx +59 -8
  66. package/src/components/ViewPanel.tsx +3 -2
  67. package/src/components/WorkspacePanel.tsx +938 -0
  68. package/src/components/ZUI/ZUICanvas.tsx +226 -127
  69. package/src/components/ZUI/focus.test.ts +534 -0
  70. package/src/components/ZUI/focus.ts +293 -0
  71. package/src/components/ZUI/layout.ts +7 -11
  72. package/src/components/ZUI/proxy.ts +470 -114
  73. package/src/components/ZUI/renderer.ts +510 -134
  74. package/src/components/ZUI/types.ts +6 -0
  75. package/src/components/ZUI/useZUIInteraction.ts +66 -29
  76. package/src/context/WorkspaceVersionContext.tsx +126 -0
  77. package/src/crossBranch/resolve.test.ts +342 -0
  78. package/src/crossBranch/resolve.ts +368 -68
  79. package/src/crossBranch/settings.ts +49 -3
  80. package/src/crossBranch/types.ts +9 -0
  81. package/src/hooks/useElementSearch.ts +45 -0
  82. package/src/index.css +11 -0
  83. package/src/index.ts +7 -0
  84. package/src/pages/AppearanceSettings.tsx +24 -1
  85. package/src/pages/Dependencies.tsx +231 -65
  86. package/src/pages/InfiniteZoom.tsx +76 -27
  87. package/src/pages/Settings.tsx +1 -1
  88. package/src/pages/ViewEditor/hooks/useCanvasInteractions.ts +103 -24
  89. package/src/pages/ViewEditor/hooks/useViewContextNeighbours.ts +102 -6
  90. package/src/pages/ViewEditor/hooks/useViewData.ts +42 -26
  91. package/src/pages/ViewEditor/hooks/useViewEditHistory.ts +62 -0
  92. package/src/pages/ViewEditor/index.tsx +549 -59
  93. package/src/pages/Views.tsx +112 -41
  94. package/src/pages/ViewsGrid.tsx +332 -113
  95. package/src/pages/viewsJumpSearch.test.ts +193 -0
  96. package/src/pages/viewsJumpSearch.ts +111 -0
  97. package/src/store/useStore.ts +58 -0
  98. package/src/types/index.ts +10 -0
  99. package/src/utils/elementIcon.test.ts +28 -0
  100. package/src/utils/elementIcon.ts +20 -0
  101. package/src/utils/sourceEditor.ts +46 -0
  102. package/src/utils/watchDiffSummary.ts +159 -0
@@ -43,6 +43,9 @@ export interface ViewGridNodeData {
43
43
  name: string
44
44
  level_label: string | null
45
45
  counts?: { nodes: number; edges: number }
46
+ kind?: 'view' | 'cluster'
47
+ collapsedCount?: number
48
+ dimmed?: boolean
46
49
  focused: boolean
47
50
  canEdit: boolean
48
51
  isEditing: boolean
@@ -72,6 +75,7 @@ export default function ViewGridNode({ data }: { data: ViewGridNodeData }) {
72
75
 
73
76
  const { isOpen: isMenuOpen, onOpen: onMenuOpen, onClose: onMenuClose } = useDisclosure()
74
77
  const [isTooltipOpen, setIsTooltipOpen] = useState(false)
78
+ const isCluster = data.kind === 'cluster'
75
79
 
76
80
  useEffect(() => {
77
81
  if (!isMenuOpen && !isTooltipOpen) return
@@ -114,6 +118,7 @@ export default function ViewGridNode({ data }: { data: ViewGridNodeData }) {
114
118
  }, [])
115
119
 
116
120
  useEffect(() => {
121
+ if (isCluster) return
117
122
  if (!hasRequested) return
118
123
 
119
124
  let active = true
@@ -141,13 +146,15 @@ export default function ViewGridNode({ data }: { data: ViewGridNodeData }) {
141
146
  URL.revokeObjectURL(url)
142
147
  }
143
148
  }
144
- }, [hasRequested, data.id])
149
+ }, [hasRequested, data.id, isCluster])
145
150
 
146
151
  const borderColor = data.focused ? accent : 'rgba(255,255,255,0.14)'
147
152
 
148
153
  const boxShadow = data.focused
149
154
  ? `0 0 24px ${hexToRgba(accent, 0.4)}`
150
- : '0 8px 24px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05)'
155
+ : isCluster
156
+ ? '0 14px 34px rgba(0,0,0,0.42), inset 0 1px 0 rgba(255,255,255,0.05)'
157
+ : '0 8px 24px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05)'
151
158
 
152
159
  return (
153
160
  // Outer container: sizing + group context, overflow visible for the "New Child" hover button
@@ -160,7 +167,26 @@ export default function ViewGridNode({ data }: { data: ViewGridNodeData }) {
160
167
  h="150px"
161
168
  position="relative"
162
169
  userSelect="none"
170
+ opacity={data.dimmed ? 0.5 : 1}
163
171
  transition="opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1)"
172
+ _before={isCluster ? {
173
+ content: '""',
174
+ position: 'absolute',
175
+ inset: '8px -9px -8px 9px',
176
+ borderRadius: '12px',
177
+ border: '1px solid rgba(255,255,255,0.08)',
178
+ bg: 'rgba(var(--bg-element-rgb), 0.55)',
179
+ boxShadow: '0 8px 20px rgba(0,0,0,0.28)',
180
+ } : undefined}
181
+ _after={isCluster ? {
182
+ content: '""',
183
+ position: 'absolute',
184
+ inset: '16px -18px -16px 18px',
185
+ borderRadius: '12px',
186
+ border: '1px solid rgba(255,255,255,0.06)',
187
+ bg: 'rgba(var(--bg-element-rgb), 0.35)',
188
+ boxShadow: '0 8px 20px rgba(0,0,0,0.2)',
189
+ } : undefined}
164
190
  >
165
191
  <Handle
166
192
  type="target"
@@ -212,9 +238,32 @@ export default function ViewGridNode({ data }: { data: ViewGridNodeData }) {
212
238
  overflow="hidden"
213
239
  borderRadius="8px 8px 0 0"
214
240
  flexShrink={0}
215
- bg="var(--bg-card-solid)"
241
+ bg={isCluster ? 'rgba(var(--bg-element-rgb), 0.88)' : 'var(--bg-card-solid)'}
216
242
  >
217
- {thumbnailUrl ? (
243
+ {isCluster ? (
244
+ <Flex
245
+ position="absolute"
246
+ inset={0}
247
+ p={3}
248
+ gap={1.5}
249
+ align="flex-start"
250
+ justify="flex-start"
251
+ wrap="wrap"
252
+ bg="radial-gradient(circle at 80% 18%, rgba(var(--accent-rgb), 0.16), transparent 42px), linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01))"
253
+ >
254
+ {Array.from({ length: Math.min(18, Math.max(6, data.collapsedCount ?? 6)) }).map((_, i) => (
255
+ <Box
256
+ key={i}
257
+ w={`${18 + (i % 4) * 6}px`}
258
+ h="14px"
259
+ borderRadius="5px"
260
+ bg={i % 5 === 0 ? hexToRgba(accent, 0.2) : 'rgba(255,255,255,0.06)'}
261
+ border="1px solid"
262
+ borderColor={i % 5 === 0 ? hexToRgba(accent, 0.34) : 'rgba(255,255,255,0.07)'}
263
+ />
264
+ ))}
265
+ </Flex>
266
+ ) : thumbnailUrl ? (
218
267
  <Box
219
268
  as="img"
220
269
  src={thumbnailUrl}
@@ -294,7 +343,7 @@ export default function ViewGridNode({ data }: { data: ViewGridNodeData }) {
294
343
  </Text>
295
344
  )}
296
345
 
297
- {!data.isEditing && (
346
+ {!data.isEditing && !isCluster && (
298
347
  <Flex align="center" gap={1} onClick={(e) => e.stopPropagation()} mt="-2px">
299
348
  <Menu
300
349
  isLazy
@@ -404,9 +453,11 @@ export default function ViewGridNode({ data }: { data: ViewGridNodeData }) {
404
453
  flexShrink={0}
405
454
  textShadow="0 1px 2px rgba(0,0,0,0.5)"
406
455
  >
407
- {data.counts
408
- ? `${data.counts.nodes}n · ${data.counts.edges}e`
409
- : '-'}
456
+ {isCluster && data.collapsedCount
457
+ ? `${data.collapsedCount} views`
458
+ : data.counts
459
+ ? `${data.counts.nodes}n · ${data.counts.edges}e`
460
+ : '-'}
410
461
  </Text>
411
462
  </Flex>
412
463
  </Flex>
@@ -28,6 +28,7 @@ interface Props {
28
28
  view: ViewTreeNode | null
29
29
  canEdit?: boolean
30
30
  onSave: (updated: ViewTreeNode) => void
31
+ onUnsupportedMutation?: () => void
31
32
  hasBackdrop?: boolean
32
33
  }
33
34
 
@@ -37,7 +38,7 @@ interface Props {
37
38
  * Location: Right side of the screen on desktop. Overlays screen on mobile.
38
39
  * Aliases: View Properties, View Settings.
39
40
  */
40
- function ViewPanel({ isOpen, onClose, view, canEdit: canEditProp, onSave, hasBackdrop = true }: Props) {
41
+ function ViewPanel({ isOpen, onClose, view, canEdit: canEditProp, onSave, onUnsupportedMutation, hasBackdrop = true }: Props) {
41
42
  const ctx = useContext(ViewEditorContext)
42
43
  const canEdit = canEditProp ?? ctx?.canEdit ?? true
43
44
  const isReadOnly = !canEdit
@@ -118,7 +119,7 @@ function ViewPanel({ isOpen, onClose, view, canEdit: canEditProp, onSave, hasBac
118
119
  rows={4}
119
120
  />
120
121
  </FormControl>
121
- <LayoutSection view={view} canEdit={canEdit} />
122
+ <LayoutSection view={view} canEdit={canEdit} onUnsupportedMutation={onUnsupportedMutation} />
122
123
 
123
124
  {view && (
124
125
  <Box pt={2} borderTop="1px solid" borderColor="whiteAlpha.50">