@likec4/diagram 1.20.3 → 1.21.1
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.
- package/README.md +2 -2
- package/dist/base/BaseXYFlow.js +1 -2
- package/dist/base/example/_types.d.ts +3 -3
- package/dist/base/example/custom.d.ts +3 -2
- package/dist/base/primitives/compound/CompoundActionButton.js +1 -1
- package/dist/base/primitives/compound/CompoundDetailsButton.js +1 -1
- package/dist/base/primitives/compound/CompoundNodeContainer.js +2 -2
- package/dist/base/primitives/compound/CompoundTitle.css.d.ts +1 -0
- package/dist/base/primitives/compound/CompoundTitle.css.js +2 -0
- package/dist/base/primitives/compound/CompoundTitle.d.ts +2 -2
- package/dist/base/primitives/compound/CompoundTitle.js +17 -6
- package/dist/base/primitives/edge/EdgeLabel.js +2 -2
- package/dist/base/primitives/element/ElementActionButtons.js +1 -1
- package/dist/base/primitives/element/ElementDetailsButton.js +1 -1
- package/dist/base/primitives/element/ElementNodeContainer.d.ts +7 -2
- package/dist/base/primitives/element/ElementNodeContainer.js +34 -1
- package/dist/base/primitives/element/ElementShape.js +1 -1
- package/dist/base/primitives/element/ElementTitle.css.d.ts +0 -1
- package/dist/base/primitives/element/ElementTitle.css.js +8 -8
- package/dist/base/primitives/element/ElementTitle.d.ts +1 -1
- package/dist/base/primitives/element/ElementTitle.js +11 -5
- package/dist/base/primitives/element/styles.css.d.ts +3 -0
- package/dist/base/primitives/element/styles.css.js +6 -0
- package/dist/context/DiagramEventHandlers.js +1 -1
- package/dist/context/DiagramFeatures.js +1 -1
- package/dist/context/RootContainer.js +1 -1
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/useDiagram.d.ts +1 -2
- package/dist/hooks/useXYFlow.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/likec4diagram/DiagramUI.d.ts +1 -2
- package/dist/likec4diagram/DiagramUI.js +3 -4
- package/dist/likec4diagram/XYFlow.js +1 -1
- package/dist/likec4diagram/custom/edges/NotePopover.js +1 -1
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +1 -1
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +5 -4
- package/dist/likec4diagram/custom/nodes/nodeTypes.js +8 -8
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
- package/dist/likec4diagram/state/assign.js +1 -1
- package/dist/likec4diagram/state/machine.js +5 -5
- package/dist/likec4diagram/types.d.ts +2 -2
- package/dist/likec4diagram/ui/controls/Controls.js +1 -1
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +5 -4
- package/dist/likec4diagram/ui/index.d.ts +2 -0
- package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +2 -2
- package/dist/likec4diagram/useViewToNodesEdges.js +1 -1
- package/dist/overlays/Overlays.js +43 -22
- package/dist/overlays/element-details/ElementDetailsCard.d.ts +7 -3
- package/dist/overlays/element-details/ElementDetailsCard.js +38 -39
- package/dist/overlays/element-details/TabPanelDeployments.js +5 -3
- package/dist/overlays/element-details/TabPanelRelationships.js +14 -30
- package/dist/overlays/overlay/Overlay.css.js +2 -1
- package/dist/overlays/overlay/Overlay.js +2 -2
- package/dist/overlays/relationship-details/SelectEdge.js +1 -1
- package/dist/overlays/relationship-details/_types.d.ts +3 -3
- package/dist/overlays/relationship-details/actor.js +1 -1
- package/dist/overlays/relationship-details/custom/nodeTypes.d.ts +3 -3
- package/dist/overlays/relationship-details/custom/nodeTypes.js +2 -2
- package/dist/overlays/relationship-details/useLayoutedDetails.js +1 -4
- package/dist/overlays/relationships-browser/-useRelationshipsView.js +0 -3
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +3 -3
- package/dist/overlays/relationships-browser/_types.d.ts +3 -3
- package/dist/overlays/relationships-browser/actor.js +16 -16
- package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +3 -2
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +3 -3
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +3 -2
- package/dist/style.css +1 -1
- package/package.json +14 -14
- package/src/base/BaseXYFlow.tsx +0 -1
- package/src/base/example/_types.ts +3 -2
- package/src/base/example/useViewToNodesEdges.ts +2 -1
- package/src/base/primitives/compound/CompoundTitle.css.ts +27 -1
- package/src/base/primitives/compound/CompoundTitle.tsx +12 -2
- package/src/base/primitives/element/ElementNodeContainer.css.ts +4 -7
- package/src/base/primitives/element/ElementNodeContainer.tsx +41 -1
- package/src/base/primitives/element/ElementShape.css.ts +5 -0
- package/src/base/primitives/element/ElementTitle.css.ts +25 -29
- package/src/base/primitives/element/ElementTitle.tsx +10 -4
- package/src/base/primitives/element/styles.css.ts +52 -0
- package/src/globals.css.ts +2 -0
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useDiagram.ts +1 -1
- package/src/index.ts +15 -1
- package/src/likec4diagram/DiagramUI.tsx +3 -6
- package/src/likec4diagram/XYFlow.tsx +2 -2
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +0 -1
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.ts +1 -0
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +4 -2
- package/src/likec4diagram/types.ts +2 -2
- package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +110 -107
- package/src/likec4diagram/ui/index.ts +2 -0
- package/src/likec4diagram/ui/notation/NotationPanel.tsx +2 -3
- package/src/likec4diagram/useViewToNodesEdges.ts +1 -1
- package/src/overlays/Overlays.tsx +62 -282
- package/src/overlays/element-details/ElementDetailsCard.tsx +214 -261
- package/src/overlays/element-details/TabPanelDeployments.tsx +4 -4
- package/src/overlays/element-details/TabPanelRelationships.tsx +13 -75
- package/src/overlays/overlay/Overlay.tsx +1 -1
- package/src/overlays/relationship-details/_types.ts +3 -3
- package/src/overlays/relationship-details/useLayoutedDetails.ts +1 -1
- package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +44 -55
- package/src/overlays/relationships-browser/_types.ts +12 -2
- package/src/overlays/relationships-browser/actor.ts +11 -10
- package/src/overlays/relationships-browser/useViewToNodesEdges.ts +2 -1
- package/dist/hooks/useCurrentViewId.js +0 -8
|
@@ -27,12 +27,13 @@ import { IconArrowRight, IconFileSymlink, IconInfoCircle, IconZoomScan } from '@
|
|
|
27
27
|
import clsx from 'clsx'
|
|
28
28
|
import { type MouseEventHandler, type PropsWithChildren, forwardRef, Fragment, useCallback } from 'react'
|
|
29
29
|
import { filter, isTruthy, map, partition, pipe } from 'remeda'
|
|
30
|
-
import { Link } from '../../../base'
|
|
30
|
+
import { Link } from '../../../base/Link'
|
|
31
31
|
import { IfEnabled, useDiagramEventHandlers, useEnabledFeature } from '../../../context'
|
|
32
32
|
import { useMantinePortalProps } from '../../../hooks'
|
|
33
33
|
import { useDiagram } from '../../../hooks/useDiagram'
|
|
34
|
-
import {
|
|
34
|
+
import { useDiagramContext } from '../../../hooks/useDiagramContext'
|
|
35
35
|
import { useLikeC4Model } from '../../../likec4model'
|
|
36
|
+
import { DiagramContext } from '../../state/machine'
|
|
36
37
|
import * as css from './RelationshipsDropdownMenu.css'
|
|
37
38
|
|
|
38
39
|
const stopPropagation: MouseEventHandler = (e) => e.stopPropagation()
|
|
@@ -129,6 +130,7 @@ export function RelationshipsDropdownMenu({
|
|
|
129
130
|
closeOnItemClick={false}
|
|
130
131
|
disabled={disabled}
|
|
131
132
|
position="bottom-start"
|
|
133
|
+
middlewares={{ size: { padding: 8 } }}
|
|
132
134
|
{...portalProps}
|
|
133
135
|
>
|
|
134
136
|
<MenuTarget>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DiagramEdge, DiagramNode, Fqn, ViewId } from '@likec4/core'
|
|
1
|
+
import type { DiagramEdge, DiagramNode, Fqn, IconUrl, ViewId } from '@likec4/core'
|
|
2
2
|
import type { XYPosition } from '@xyflow/system'
|
|
3
3
|
import type { OptionalKeysOf, Simplify } from 'type-fest'
|
|
4
4
|
import type { Base } from '../base'
|
|
@@ -75,7 +75,7 @@ export namespace Types {
|
|
|
75
75
|
>
|
|
76
76
|
& {
|
|
77
77
|
depth: number
|
|
78
|
-
icon
|
|
78
|
+
icon?: IconUrl
|
|
79
79
|
}
|
|
80
80
|
>
|
|
81
81
|
|
|
@@ -13,10 +13,11 @@ const selector = (s: DiagramContext) => ({
|
|
|
13
13
|
title: s.view.title ?? 'untitled',
|
|
14
14
|
description: s.view.description,
|
|
15
15
|
links: s.view.links,
|
|
16
|
+
isNotActiveWalkthrough: s.activeWalkthrough === null,
|
|
16
17
|
})
|
|
17
18
|
|
|
18
19
|
export function DiagramTitlePanel() {
|
|
19
|
-
const { id, title, description, links } = useDiagramContext(selector)
|
|
20
|
+
const { id, title, description, links, isNotActiveWalkthrough } = useDiagramContext(selector)
|
|
20
21
|
const [isCollapsed, setCollapsed] = useLocalStorage({
|
|
21
22
|
key: 'diagram-title-webview-collapsed',
|
|
22
23
|
defaultValue: false,
|
|
@@ -41,126 +42,128 @@ export function DiagramTitlePanel() {
|
|
|
41
42
|
</div>
|
|
42
43
|
</ViewportPortal> */
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
<
|
|
66
|
-
fullWidth
|
|
67
|
-
justify="stretch"
|
|
68
|
-
size="md"
|
|
69
|
-
radius={'0'}
|
|
70
|
-
variant={'subtle'}
|
|
71
|
-
color="gray"
|
|
72
|
-
onClick={toggle}
|
|
73
|
-
fw={500}
|
|
74
|
-
fz={'sm'}
|
|
75
|
-
tabIndex={-1}
|
|
76
|
-
>
|
|
77
|
-
{title}
|
|
78
|
-
</Button>
|
|
79
|
-
</CardSection>
|
|
80
|
-
)}
|
|
81
|
-
{!isCollapsed && (
|
|
82
|
-
<>
|
|
83
|
-
<CardSection mb={'xs'}>
|
|
45
|
+
{isNotActiveWalkthrough && (
|
|
46
|
+
<m.div
|
|
47
|
+
key={id}
|
|
48
|
+
initial={{ opacity: 0.05, scale: 0.7 }}
|
|
49
|
+
animate={{ opacity: 1, scale: 1 }}
|
|
50
|
+
exit={{
|
|
51
|
+
opacity: 0.05,
|
|
52
|
+
scale: 0.6,
|
|
53
|
+
}}
|
|
54
|
+
className={clsx('react-flow__panel', css.container)}
|
|
55
|
+
style={{
|
|
56
|
+
transformOrigin: 'left center',
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
<Card
|
|
60
|
+
radius="sm"
|
|
61
|
+
className={css.card}
|
|
62
|
+
withBorder={!isCollapsed}
|
|
63
|
+
p={isCollapsed ? 'sm' : 'md'}
|
|
64
|
+
onDoubleClick={e => e.stopPropagation()}>
|
|
65
|
+
{isCollapsed && (
|
|
66
|
+
<CardSection>
|
|
84
67
|
<Button
|
|
85
68
|
fullWidth
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
py={2}
|
|
69
|
+
justify="stretch"
|
|
70
|
+
size="md"
|
|
89
71
|
radius={'0'}
|
|
90
72
|
variant={'subtle'}
|
|
91
73
|
color="gray"
|
|
92
74
|
onClick={toggle}
|
|
75
|
+
fw={500}
|
|
76
|
+
fz={'sm'}
|
|
93
77
|
tabIndex={-1}
|
|
94
78
|
>
|
|
95
|
-
|
|
79
|
+
{title}
|
|
96
80
|
</Button>
|
|
97
81
|
</CardSection>
|
|
82
|
+
)}
|
|
83
|
+
{!isCollapsed && (
|
|
84
|
+
<>
|
|
85
|
+
<CardSection mb={'xs'}>
|
|
86
|
+
<Button
|
|
87
|
+
fullWidth
|
|
88
|
+
size="xs"
|
|
89
|
+
h={'sm'}
|
|
90
|
+
py={2}
|
|
91
|
+
radius={'0'}
|
|
92
|
+
variant={'subtle'}
|
|
93
|
+
color="gray"
|
|
94
|
+
onClick={toggle}
|
|
95
|
+
tabIndex={-1}
|
|
96
|
+
>
|
|
97
|
+
<IconMenu size={11} opacity={0.7} />
|
|
98
|
+
</Button>
|
|
99
|
+
</CardSection>
|
|
98
100
|
|
|
99
|
-
|
|
100
|
-
<Text
|
|
101
|
-
component={'div'}
|
|
102
|
-
flex={'1'}
|
|
103
|
-
size={'md'}
|
|
104
|
-
fw={500}
|
|
105
|
-
lh={1.1}
|
|
106
|
-
className={css.title}
|
|
107
|
-
>
|
|
108
|
-
{title}
|
|
109
|
-
</Text>
|
|
110
|
-
<Text
|
|
111
|
-
hidden={isCollapsed}
|
|
112
|
-
component={'div'}
|
|
113
|
-
flex={'0 0 auto'}
|
|
114
|
-
inline
|
|
115
|
-
size="xs"
|
|
116
|
-
fz={9}
|
|
117
|
-
fw={500}
|
|
118
|
-
c={'dimmed'}
|
|
119
|
-
style={{
|
|
120
|
-
userSelect: 'all',
|
|
121
|
-
}}>
|
|
122
|
-
<span style={{ userSelect: 'none' }}>id:{' '}</span>
|
|
123
|
-
{id}
|
|
124
|
-
</Text>
|
|
125
|
-
</Group>
|
|
126
|
-
{description && (
|
|
127
|
-
<Spoiler
|
|
128
|
-
maxHeight={42}
|
|
129
|
-
showLabel={
|
|
130
|
-
<Button color="gray" variant="light" fz={'10'} size="compact-xs" tabIndex={-1}>show more</Button>
|
|
131
|
-
}
|
|
132
|
-
hideLabel={
|
|
133
|
-
<Button color="gray" variant="light" fz={'10'} size="compact-xs" tabIndex={-1}>hide</Button>
|
|
134
|
-
}>
|
|
101
|
+
<Group justify="stretch" wrap="nowrap" mb={'sm'}>
|
|
135
102
|
<Text
|
|
136
103
|
component={'div'}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
{
|
|
104
|
+
flex={'1'}
|
|
105
|
+
size={'md'}
|
|
106
|
+
fw={500}
|
|
107
|
+
lh={1.1}
|
|
108
|
+
className={css.title}
|
|
109
|
+
>
|
|
110
|
+
{title}
|
|
140
111
|
</Text>
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
112
|
+
<Text
|
|
113
|
+
hidden={isCollapsed}
|
|
114
|
+
component={'div'}
|
|
115
|
+
flex={'0 0 auto'}
|
|
116
|
+
inline
|
|
117
|
+
size="xs"
|
|
118
|
+
fz={9}
|
|
119
|
+
fw={500}
|
|
120
|
+
c={'dimmed'}
|
|
121
|
+
style={{
|
|
122
|
+
userSelect: 'all',
|
|
123
|
+
}}>
|
|
124
|
+
<span style={{ userSelect: 'none' }}>id:{' '}</span>
|
|
125
|
+
{id}
|
|
126
|
+
</Text>
|
|
127
|
+
</Group>
|
|
128
|
+
{description && (
|
|
129
|
+
<Spoiler
|
|
130
|
+
maxHeight={42}
|
|
131
|
+
showLabel={
|
|
132
|
+
<Button color="gray" variant="light" fz={'10'} size="compact-xs" tabIndex={-1}>show more</Button>
|
|
133
|
+
}
|
|
134
|
+
hideLabel={
|
|
135
|
+
<Button color="gray" variant="light" fz={'10'} size="compact-xs" tabIndex={-1}>hide</Button>
|
|
136
|
+
}>
|
|
137
|
+
<Text
|
|
138
|
+
component={'div'}
|
|
139
|
+
size="sm"
|
|
140
|
+
className={css.description}>
|
|
141
|
+
{description || 'no description'}
|
|
142
|
+
</Text>
|
|
143
|
+
</Spoiler>
|
|
144
|
+
)}
|
|
145
|
+
{!description && (
|
|
146
|
+
<Text
|
|
147
|
+
component={'div'}
|
|
148
|
+
size="xs"
|
|
149
|
+
c={'dimmed'}>
|
|
150
|
+
no description
|
|
151
|
+
</Text>
|
|
152
|
+
)}
|
|
153
|
+
{links && (
|
|
154
|
+
<Stack
|
|
155
|
+
mt={'xs'}
|
|
156
|
+
gap={4}
|
|
157
|
+
justify="stretch"
|
|
158
|
+
align="stretch">
|
|
159
|
+
{links.map((link) => <Link value={link} key={link.url} />)}
|
|
160
|
+
</Stack>
|
|
161
|
+
)}
|
|
162
|
+
</>
|
|
163
|
+
)}
|
|
164
|
+
</Card>
|
|
165
|
+
</m.div>
|
|
166
|
+
)}
|
|
164
167
|
</AnimatePresence>
|
|
165
168
|
)
|
|
166
169
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
1
|
import { type ComputedNode, type ElementNotation as ElementNotationData } from '@likec4/core'
|
|
3
2
|
import {
|
|
4
3
|
ActionIcon,
|
|
@@ -23,12 +22,12 @@ import clsx from 'clsx'
|
|
|
23
22
|
import { AnimatePresence, m } from 'framer-motion'
|
|
24
23
|
import { memo, useState } from 'react'
|
|
25
24
|
import { ceil, isNonNullish } from 'remeda'
|
|
26
|
-
// import { ElementShapeSvg } from '../../xyflow/nodes/element/ElementShapeSvg'
|
|
27
25
|
import { ElementShape } from '../../../base/primitives'
|
|
28
|
-
import {
|
|
26
|
+
import { useMantinePortalProps } from '../../../hooks'
|
|
29
27
|
import { useDiagram } from '../../../hooks/useDiagram'
|
|
30
28
|
import { useDiagramContext } from '../../../hooks/useDiagramContext'
|
|
31
29
|
import { useXYStore } from '../../../hooks/useXYFlow'
|
|
30
|
+
import { DiagramContext } from '../../../likec4diagram/state/machine'
|
|
32
31
|
import { vars } from '../../../theme-vars'
|
|
33
32
|
import * as css from './NotationPanel.css'
|
|
34
33
|
|