@likec4/diagram 1.35.0 → 1.36.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.
- package/bundle/{chunk-C0Eg81Gj.js → chunk-7MPUJFHj.js} +315 -311
- package/bundle/custom.js +52 -52
- package/bundle/index.js +1583 -739
- package/dist/LikeC4Diagram.js +6 -6
- package/dist/LikeC4Diagram.props.d.ts +2 -3
- package/dist/LikeC4ModelProvider.d.ts +3 -3
- package/dist/LikeC4ProjectsProvider.d.ts +17 -0
- package/dist/LikeC4ProjectsProvider.js +22 -0
- package/dist/LikeC4Styles.d.ts +1 -0
- package/dist/LikeC4Styles.js +94 -0
- package/dist/StaticLikeC4Diagram.d.ts +3 -3
- package/dist/base/BaseXYFlow.js +23 -26
- package/dist/base/primitives/MarkdownBlock.d.ts +7 -1
- package/dist/base/primitives/MarkdownBlock.js +1 -1
- package/dist/base/primitives/compound/CompoundActionButton.js +2 -2
- package/dist/base/primitives/compound/CompoundDetailsButton.js +2 -2
- package/dist/base/primitives/compound/CompoundNodeContainer.css.js +4 -4
- package/dist/base/primitives/compound/CompoundNodeContainer.js +1 -4
- package/dist/base/primitives/compound/CompoundTitle.js +9 -8
- package/dist/base/primitives/compound/actionbtns.css.js +6 -6
- package/dist/base/primitives/edge/EdgeActionButton.js +2 -2
- package/dist/base/primitives/edge/EdgeContainer.js +4 -7
- package/dist/base/primitives/edge/EdgeLabel.css.d.ts +0 -22
- package/dist/base/primitives/edge/EdgeLabel.css.js +6 -84
- package/dist/base/primitives/edge/EdgeLabel.js +16 -6
- package/dist/base/primitives/edge/EdgeLabelContainer.js +1 -6
- package/dist/base/primitives/edge/EdgeMarkers.js +3 -3
- package/dist/base/primitives/edge/edge.css.d.ts +0 -2
- package/dist/base/primitives/edge/edge.css.js +1 -55
- package/dist/base/primitives/element/ElementActionButtons.js +2 -2
- package/dist/base/primitives/element/ElementDetailsButton.js +8 -7
- package/dist/base/primitives/element/ElementNodeContainer.css.js +4 -4
- package/dist/base/primitives/element/ElementNodeContainer.js +1 -4
- package/dist/base/primitives/element/ElementShape.css.js +11 -11
- package/dist/base/primitives/element/ElementTags.d.ts +1 -0
- package/dist/base/primitives/element/ElementTags.js +17 -14
- package/dist/bundle/LikeC4View.d.ts +1 -1
- package/dist/bundle/LikeC4View.js +7 -1
- package/dist/bundle/LikeC4View.props.d.ts +1 -2
- package/dist/bundle/ReactLikeC4.d.ts +1 -1
- package/dist/bundle/ViewNotFound.js +1 -1
- package/dist/bundle/index.d.ts +2 -1
- package/dist/bundle/index.js +1 -0
- package/dist/bundle/styles.css.js +1 -1
- package/dist/components/ErrorFallback.js +1 -1
- package/dist/components/GithubIcon.d.ts +2 -0
- package/dist/components/GithubIcon.js +17 -0
- package/dist/components/Link.d.ts +4 -3
- package/dist/components/Link.js +84 -87
- package/dist/components/NavigationLink.d.ts +2 -2
- package/dist/components/SearchControl.css.js +6 -5
- package/dist/context/DiagramEventHandlers.d.ts +6 -6
- package/dist/context/DiagramEventHandlers.js +4 -7
- package/dist/globals.css.js +3 -0
- package/dist/hooks/useXYFlow.d.ts +10 -10
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/likec4diagram/custom/edges/NotePopover.css.js +2 -2
- package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +2 -2
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +1 -1
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.js +7 -7
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +3 -3
- package/dist/likec4diagram/custom/edges/edges.css.js +4 -4
- package/dist/likec4diagram/custom/index.d.ts +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +2 -2
- package/dist/likec4diagram/ui/controls/styles.css.js +5 -5
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +11 -11
- package/dist/likec4diagram/ui/notation/NotationPanel.js +2 -5
- package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.css.js +10 -10
- package/dist/likec4model/LikeC4ProjectsContext.d.ts +7 -0
- package/dist/likec4model/LikeC4ProjectsContext.js +5 -0
- package/dist/likec4model/index.d.ts +1 -0
- package/dist/likec4model/useLikeC4Project.d.ts +22 -0
- package/dist/likec4model/useLikeC4Project.js +23 -0
- package/dist/navigationpanel/NavigationPanel.js +15 -17
- package/dist/navigationpanel/NavigationPanelControls.js +34 -21
- package/dist/navigationpanel/NavigationPanelDropdown.js +33 -17
- package/dist/navigationpanel/_common.js +4 -1
- package/dist/navigationpanel/actor.d.ts +11 -15
- package/dist/navigationpanel/actor.js +14 -15
- package/dist/navigationpanel/controls/BurgerButton.js +5 -7
- package/dist/navigationpanel/controls/NavigationButtons.js +37 -24
- package/dist/navigationpanel/controls/OpenSource.js +1 -1
- package/dist/navigationpanel/controls/SearchControl.js +6 -4
- package/dist/navigationpanel/controls/ToggleReadonly.js +3 -3
- package/dist/navigationpanel/controls/ViewDetailsCard.d.ts +2 -0
- package/dist/navigationpanel/controls/ViewDetailsCard.js +232 -0
- package/dist/navigationpanel/controls/index.d.ts +1 -0
- package/dist/navigationpanel/dropdown/ProjectsMenu.d.ts +2 -0
- package/dist/navigationpanel/dropdown/ProjectsMenu.js +75 -0
- package/dist/navigationpanel/editorpanel/EditorPanel.js +3 -3
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +19 -20
- package/dist/navigationpanel/editorpanel/styles.js +5 -5
- package/dist/navigationpanel/hooks.d.ts +2 -2
- package/dist/navigationpanel/styles.css.js +0 -2
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +12 -7
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +14 -0
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +14 -0
- package/dist/overlays/element-details/ElementDetailsCard.css.js +18 -17
- package/dist/overlays/element-details/ElementDetailsCard.js +8 -13
- package/dist/overlays/element-details/TabPanelDeployments.css.js +5 -4
- package/dist/overlays/element-details/TabPanelRelationships.css.js +7 -7
- package/dist/overlays/overlay/Overlay.css.d.ts +3 -3
- package/dist/overlays/overlay/Overlay.css.js +8 -7
- package/dist/overlays/relationship-details/SelectEdge.css.js +8 -8
- package/dist/overlays/relationships-browser/SelectElement.css.js +1 -1
- package/dist/search/Search.js +6 -6
- package/dist/search/components/ElementsColumn.css.js +5 -5
- package/dist/search/components/SearchByTags.js +3 -2
- package/dist/search/components/ViewsColum.js +1 -1
- package/dist/search/components/ViewsColumn.css.js +1 -1
- package/dist/search/components/_shared.css.js +3 -3
- package/dist/search/components/styles.css.js +5 -5
- package/dist/state/DiagramActorProvider.js +34 -15
- package/dist/state/diagram-machine.d.ts +29 -247
- package/dist/state/diagram-machine.js +16 -16
- package/dist/styles-min.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css2.js +1 -1
- package/package.json +10 -8
- package/panda.buildinfo.json +254 -326
- package/src/LikeC4Diagram.props.ts +2 -2
- package/src/LikeC4Diagram.tsx +2 -2
- package/src/LikeC4ModelProvider.tsx +4 -4
- package/src/LikeC4ProjectsProvider.tsx +41 -0
- package/src/LikeC4Styles.tsx +107 -0
- package/src/StaticLikeC4Diagram.tsx +3 -3
- package/src/base/BaseXYFlow.tsx +24 -29
- package/src/base/primitives/MarkdownBlock.tsx +11 -3
- package/src/base/primitives/compound/CompoundActionButton.tsx +2 -2
- package/src/base/primitives/compound/CompoundDetailsButton.tsx +2 -2
- package/src/base/primitives/compound/CompoundNodeContainer.css.ts +4 -13
- package/src/base/primitives/compound/CompoundNodeContainer.tsx +0 -3
- package/src/base/primitives/compound/CompoundTitle.tsx +8 -8
- package/src/base/primitives/compound/actionbtns.css.ts +6 -6
- package/src/base/primitives/edge/EdgeActionButton.tsx +2 -2
- package/src/base/primitives/edge/EdgeContainer.tsx +3 -6
- package/src/base/primitives/edge/EdgeLabel.css.ts +4 -83
- package/src/base/primitives/edge/EdgeLabel.tsx +16 -10
- package/src/base/primitives/edge/EdgeLabelContainer.tsx +1 -6
- package/src/base/primitives/edge/EdgeMarkers.tsx +3 -3
- package/src/base/primitives/edge/edge.css.ts +0 -60
- package/src/base/primitives/element/ElementActionButtons.tsx +2 -2
- package/src/base/primitives/element/ElementDetailsButton.tsx +7 -7
- package/src/base/primitives/element/ElementNodeContainer.css.ts +4 -4
- package/src/base/primitives/element/ElementNodeContainer.tsx +0 -3
- package/src/base/primitives/element/ElementShape.css.ts +11 -11
- package/src/base/primitives/element/ElementTags.tsx +17 -14
- package/src/bundle/LikeC4View.props.ts +1 -2
- package/src/bundle/LikeC4View.tsx +10 -3
- package/src/bundle/ReactLikeC4.tsx +1 -2
- package/src/bundle/ViewNotFound.tsx +1 -1
- package/src/bundle/index.ts +2 -1
- package/src/bundle/styles.css.ts +1 -1
- package/src/components/ErrorFallback.tsx +1 -1
- package/src/components/GithubIcon.tsx +16 -0
- package/src/components/Link.tsx +102 -113
- package/src/components/NavigationLink.tsx +2 -1
- package/src/components/SearchControl.css.ts +5 -5
- package/src/context/DiagramEventHandlers.tsx +12 -12
- package/src/globals.css +71 -0
- package/src/index.ts +5 -0
- package/src/likec4diagram/custom/edges/NotePopover.css.ts +2 -2
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +1 -1
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.ts +7 -7
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +3 -3
- package/src/likec4diagram/custom/edges/edges.css.ts +4 -4
- package/src/likec4diagram/custom/nodes/toolbar/CompoundToolbar.tsx +2 -2
- package/src/likec4diagram/ui/controls/styles.css.ts +5 -5
- package/src/likec4diagram/ui/notation/NotationPanel.css.ts +11 -11
- package/src/likec4diagram/ui/notation/NotationPanel.tsx +1 -4
- package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.css.ts +10 -10
- package/src/likec4model/LikeC4ProjectsContext.ts +9 -0
- package/src/likec4model/index.ts +8 -0
- package/src/likec4model/useLikeC4Project.ts +61 -0
- package/src/navigationpanel/NavigationPanel.tsx +16 -17
- package/src/navigationpanel/NavigationPanelControls.tsx +24 -46
- package/src/navigationpanel/NavigationPanelDropdown.tsx +32 -16
- package/src/navigationpanel/_common.tsx +4 -1
- package/src/navigationpanel/actor.ts +14 -15
- package/src/navigationpanel/controls/BurgerButton.tsx +5 -7
- package/src/navigationpanel/controls/NavigationButtons.tsx +9 -1
- package/src/navigationpanel/controls/OpenSource.tsx +1 -1
- package/src/navigationpanel/controls/SearchControl.tsx +6 -4
- package/src/navigationpanel/controls/ToggleReadonly.tsx +3 -3
- package/src/navigationpanel/controls/ViewDetailsCard.tsx +244 -0
- package/src/navigationpanel/controls/index.ts +1 -0
- package/src/navigationpanel/dropdown/ProjectsMenu.tsx +74 -0
- package/src/navigationpanel/editorpanel/EditorPanel.tsx +3 -3
- package/src/navigationpanel/editorpanel/ManualLayoutToolsButton.tsx +19 -22
- package/src/navigationpanel/editorpanel/styles.ts +5 -5
- package/src/navigationpanel/hooks.tsx +2 -2
- package/src/navigationpanel/styles.css.ts +0 -2
- package/src/navigationpanel/walkthrough/ActiveWalkthroughControls.tsx +9 -4
- package/src/overlays/element-details/ElementDetailsCard.css.ts +17 -17
- package/src/overlays/element-details/ElementDetailsCard.tsx +8 -13
- package/src/overlays/element-details/TabPanelDeployments.css.ts +4 -4
- package/src/overlays/element-details/TabPanelRelationships.css.ts +7 -7
- package/src/overlays/overlay/Overlay.css.ts +7 -7
- package/src/overlays/relationship-details/SelectEdge.css.ts +8 -8
- package/src/overlays/relationships-browser/SelectElement.css.ts +1 -1
- package/src/search/Search.tsx +6 -6
- package/src/search/components/ElementsColumn.css.ts +5 -5
- package/src/search/components/SearchByTags.tsx +2 -2
- package/src/search/components/ViewsColum.tsx +1 -1
- package/src/search/components/ViewsColumn.css.ts +1 -1
- package/src/search/components/_shared.css.ts +3 -3
- package/src/search/components/styles.css.ts +5 -5
- package/src/state/DiagramActorProvider.tsx +45 -20
- package/src/state/diagram-machine.ts +22 -16
- package/dist/LikeC4CustomColors.d.ts +0 -2
- package/dist/LikeC4CustomColors.js +0 -45
- package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +0 -45
- package/src/LikeC4CustomColors.tsx +0 -85
package/src/components/Link.tsx
CHANGED
|
@@ -1,119 +1,108 @@
|
|
|
1
1
|
import type { Link as LinkData } from '@likec4/core'
|
|
2
|
-
import { css,
|
|
3
|
-
import {
|
|
2
|
+
import { css, cx } from '@likec4/styles/css'
|
|
3
|
+
import { type BadgeProps, ActionIcon, Badge, CopyButton } from '@mantine/core'
|
|
4
4
|
import { IconCheck, IconCopy } from '@tabler/icons-react'
|
|
5
|
-
import {
|
|
5
|
+
import { forwardRef } from 'react'
|
|
6
|
+
import { GithubIcon } from './GithubIcon'
|
|
6
7
|
|
|
7
|
-
const
|
|
8
|
-
base: {
|
|
9
|
-
display: 'flex',
|
|
10
|
-
overflow: 'hidden',
|
|
11
|
-
alignItems: 'center',
|
|
12
|
-
gap: 'micro',
|
|
13
|
-
justifyContent: 'stretch',
|
|
14
|
-
transitionProperty: 'all',
|
|
15
|
-
transitionDuration: 'fast',
|
|
16
|
-
transitionTimingFunction: 'inOut',
|
|
17
|
-
border: `1px dashed {colors.mantine.colors.defaultBorder}`,
|
|
18
|
-
rounded: 'sm',
|
|
19
|
-
cursor: 'pointer',
|
|
20
|
-
color: 'mantine.colors.gray[7]',
|
|
21
|
-
_dark: {
|
|
22
|
-
color: 'mantine.colors.dark[1]',
|
|
23
|
-
},
|
|
24
|
-
_hover: {
|
|
25
|
-
transitionTimingFunction: 'out',
|
|
26
|
-
color: 'mantine.colors.defaultColor',
|
|
27
|
-
background: 'mantine.colors.defaultHover',
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
variants: {
|
|
31
|
-
size: {
|
|
32
|
-
sm: {
|
|
33
|
-
minHeight: '22px',
|
|
34
|
-
padding: '2px 8px 2px 2px',
|
|
35
|
-
},
|
|
36
|
-
md: {
|
|
37
|
-
minHeight: '30px',
|
|
38
|
-
padding: '3px 16px 3px 3px',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
})
|
|
8
|
+
const GITHUB_PREFIX = 'https://github.com/'
|
|
43
9
|
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
transform: 'translateX(1px)',
|
|
51
|
-
},
|
|
52
|
-
})
|
|
10
|
+
export const Link = forwardRef<HTMLDivElement, Omit<BadgeProps, 'children' | 'classNames'> & { value: LinkData }>(
|
|
11
|
+
({ value, className, ...props }, ref) => {
|
|
12
|
+
// If the url is already a full url, use it as is.
|
|
13
|
+
// Otherwise, it's a relative url and we need to make it absolute.
|
|
14
|
+
const url = value.url.includes('://') ? value.url : new window.URL(value.url, window.location.href).toString()
|
|
15
|
+
let isGithub = url.startsWith(GITHUB_PREFIX)
|
|
53
16
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
e.stopPropagation()
|
|
87
|
-
e.preventDefault()
|
|
88
|
-
copy()
|
|
89
|
-
}}
|
|
90
|
-
>
|
|
91
|
-
{copied ? <IconCheck /> : <IconCopy style={{ width: '65%', opacity: 0.65 }} />}
|
|
92
|
-
</ActionIcon>
|
|
93
|
-
<Box className={titleBox}>
|
|
94
|
-
<Text
|
|
95
|
-
component="div"
|
|
96
|
-
fz={isNormalSize ? 'xs' : 11}
|
|
97
|
-
truncate
|
|
98
|
-
lh={isNormalSize ? 1.3 : 1.2}
|
|
99
|
-
fw={value.title ? 500 : 400}>
|
|
100
|
-
{value.title || url}
|
|
101
|
-
</Text>
|
|
102
|
-
{value.title && (
|
|
103
|
-
<Text component="div" fz={isNormalSize ? 10 : 9} c={'dimmed'} lh={isNormalSize ? 1.2 : 1.1} truncate>
|
|
104
|
-
{url}
|
|
105
|
-
</Text>
|
|
17
|
+
return (
|
|
18
|
+
<Badge
|
|
19
|
+
ref={ref}
|
|
20
|
+
variant="default"
|
|
21
|
+
radius="sm"
|
|
22
|
+
size="sm"
|
|
23
|
+
tt="none"
|
|
24
|
+
leftSection={value.title ? <>{value.title}</> : null}
|
|
25
|
+
rightSection={
|
|
26
|
+
<CopyButton value={url} timeout={1500}>
|
|
27
|
+
{({ copy, copied }) => (
|
|
28
|
+
<ActionIcon
|
|
29
|
+
className={css({
|
|
30
|
+
opacity: copied ? 1 : 0.45,
|
|
31
|
+
transition: 'fast',
|
|
32
|
+
_hover: {
|
|
33
|
+
opacity: 1,
|
|
34
|
+
},
|
|
35
|
+
})}
|
|
36
|
+
tabIndex={-1}
|
|
37
|
+
size={'20'}
|
|
38
|
+
variant={copied ? 'light' : 'transparent'}
|
|
39
|
+
color={copied ? 'teal' : 'gray'}
|
|
40
|
+
data-active={copied}
|
|
41
|
+
onClick={e => {
|
|
42
|
+
e.stopPropagation()
|
|
43
|
+
e.preventDefault()
|
|
44
|
+
copy()
|
|
45
|
+
}}
|
|
46
|
+
>
|
|
47
|
+
{copied ? <IconCheck /> : <IconCopy stroke={2.5} />}
|
|
48
|
+
</ActionIcon>
|
|
106
49
|
)}
|
|
107
|
-
</
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
50
|
+
</CopyButton>
|
|
51
|
+
}
|
|
52
|
+
{...props}
|
|
53
|
+
className={cx(className, 'group')}
|
|
54
|
+
classNames={{
|
|
55
|
+
root: css({
|
|
56
|
+
flexWrap: 'nowrap',
|
|
57
|
+
minHeight: 24,
|
|
58
|
+
maxWidth: 500,
|
|
59
|
+
userSelect: 'all',
|
|
60
|
+
pr: '0',
|
|
61
|
+
_hover: {
|
|
62
|
+
backgroundColor: {
|
|
63
|
+
base: 'mantine.colors.gray[1]',
|
|
64
|
+
_dark: 'mantine.colors.dark[5]',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
}),
|
|
68
|
+
section: css({
|
|
69
|
+
'&:is([data-position="left"])': {
|
|
70
|
+
color: 'mantine.colors.dimmed',
|
|
71
|
+
userSelect: 'none',
|
|
72
|
+
pointerEvents: 'none',
|
|
73
|
+
_groupHover: {
|
|
74
|
+
color: '[inherit]',
|
|
75
|
+
opacity: .7,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
}),
|
|
79
|
+
label: css({
|
|
80
|
+
'& > a': {
|
|
81
|
+
color: '[inherit]',
|
|
82
|
+
cursor: 'pointer',
|
|
83
|
+
transition: 'fast',
|
|
84
|
+
opacity: {
|
|
85
|
+
base: 0.7,
|
|
86
|
+
_hover: 1,
|
|
87
|
+
},
|
|
88
|
+
textDecoration: {
|
|
89
|
+
base: 'none',
|
|
90
|
+
_hover: 'underline',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
}),
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
<a href={url} target="_blank">
|
|
97
|
+
{isGithub && (
|
|
98
|
+
<GithubIcon
|
|
99
|
+
height="12"
|
|
100
|
+
width="12"
|
|
101
|
+
style={{ verticalAlign: 'middle', marginRight: '4px' }} />
|
|
102
|
+
)}
|
|
103
|
+
{isGithub ? url.replace(GITHUB_PREFIX, '') : url}
|
|
104
|
+
</a>
|
|
105
|
+
</Badge>
|
|
106
|
+
)
|
|
107
|
+
},
|
|
108
|
+
)
|
|
@@ -2,9 +2,10 @@ import { cx } from '@likec4/styles/css'
|
|
|
2
2
|
import { navigationLink } from '@likec4/styles/recipes'
|
|
3
3
|
import { type NavLinkProps, NavLink } from '@mantine/core'
|
|
4
4
|
import { forwardRef } from 'react'
|
|
5
|
+
import { type ComponentPropsWithoutRef } from 'react'
|
|
5
6
|
|
|
6
7
|
export interface NavigationLinkProps
|
|
7
|
-
extends NavLinkProps, Omit<
|
|
8
|
+
extends Omit<NavLinkProps, 'classNames'>, Omit<ComponentPropsWithoutRef<'button'>, keyof NavLinkProps>
|
|
8
9
|
{
|
|
9
10
|
truncateLabel?: boolean
|
|
10
11
|
}
|
|
@@ -3,7 +3,7 @@ import { css } from '@likec4/styles/css'
|
|
|
3
3
|
export const root = css({
|
|
4
4
|
height: '30px',
|
|
5
5
|
paddingLeft: 'sm',
|
|
6
|
-
paddingRight: '
|
|
6
|
+
paddingRight: '1',
|
|
7
7
|
borderRadius: 'sm',
|
|
8
8
|
// TODO
|
|
9
9
|
// color: fallbackVar('var(--search-color)', 'mantine.colors.placeholder)',
|
|
@@ -41,14 +41,14 @@ export const root = css({
|
|
|
41
41
|
export const placeholder = css({
|
|
42
42
|
fontSize: 'sm', // mantine.fontSizes.sm,
|
|
43
43
|
fontWeight: 500,
|
|
44
|
-
paddingRight: '
|
|
44
|
+
paddingRight: '2.5', // 10px
|
|
45
45
|
color: 'mantine.colors.placeholder',
|
|
46
46
|
flex: '1',
|
|
47
47
|
sm: {
|
|
48
|
-
paddingRight: '30px',
|
|
48
|
+
paddingRight: '[30px]',
|
|
49
49
|
},
|
|
50
50
|
md: {
|
|
51
|
-
paddingRight: '50px',
|
|
51
|
+
paddingRight: '[50px]',
|
|
52
52
|
},
|
|
53
53
|
})
|
|
54
54
|
|
|
@@ -56,7 +56,7 @@ export const shortcut = css({
|
|
|
56
56
|
fontSize: '11px',
|
|
57
57
|
fontWeight: 600,
|
|
58
58
|
lineHeight: 1,
|
|
59
|
-
padding: '4px 7px',
|
|
59
|
+
padding: '[4px 7px]',
|
|
60
60
|
borderRadius: 'sm',
|
|
61
61
|
border: '1px solid',
|
|
62
62
|
transition: 'fast',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { aux } from '@likec4/core/types'
|
|
2
2
|
import { useSyncedRef } from '@react-hookz/web'
|
|
3
3
|
import { type PropsWithChildren, type RefObject, createContext, useContext, useMemo } from 'react'
|
|
4
4
|
import { isFunction, mapToObj } from 'remeda'
|
|
@@ -22,18 +22,18 @@ const HandlerNames = [
|
|
|
22
22
|
'onCanvasDblClick',
|
|
23
23
|
] as const
|
|
24
24
|
|
|
25
|
-
type
|
|
26
|
-
handlersRef: RefObject<LikeC4DiagramEventHandlers<Any>>
|
|
25
|
+
export type DiagramEventHandlersContext = RequiredOrNull<LikeC4DiagramEventHandlers<aux.Any>> & {
|
|
26
|
+
handlersRef: RefObject<LikeC4DiagramEventHandlers<aux.Any>>
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
const
|
|
29
|
+
const DiagramEventHandlersReactContext = createContext<DiagramEventHandlersContext>({
|
|
30
30
|
...mapToObj(HandlerNames, (name) => [name, null]),
|
|
31
31
|
handlersRef: {
|
|
32
32
|
current: {},
|
|
33
33
|
},
|
|
34
34
|
})
|
|
35
35
|
|
|
36
|
-
export function DiagramEventHandlers<A extends Any>({
|
|
36
|
+
export function DiagramEventHandlers<A extends aux.Any>({
|
|
37
37
|
handlers,
|
|
38
38
|
children,
|
|
39
39
|
}: PropsWithChildren<{ handlers: LikeC4DiagramEventHandlers<A> }>) {
|
|
@@ -41,7 +41,7 @@ export function DiagramEventHandlers<A extends Any>({
|
|
|
41
41
|
|
|
42
42
|
const deps = HandlerNames.map((name) => isFunction(handlers[name]))
|
|
43
43
|
|
|
44
|
-
const value = useMemo(():
|
|
44
|
+
const value = useMemo((): DiagramEventHandlersContext => ({
|
|
45
45
|
...mapToObj(HandlerNames, (name) => {
|
|
46
46
|
if (handlersRef.current[name]) {
|
|
47
47
|
// @ts-expect-error TODO: fix this
|
|
@@ -53,16 +53,16 @@ export function DiagramEventHandlers<A extends Any>({
|
|
|
53
53
|
}), [handlersRef, ...deps])
|
|
54
54
|
|
|
55
55
|
return (
|
|
56
|
-
<
|
|
56
|
+
<DiagramEventHandlersReactContext.Provider value={value}>
|
|
57
57
|
{children}
|
|
58
|
-
</
|
|
58
|
+
</DiagramEventHandlersReactContext.Provider>
|
|
59
59
|
)
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
export function useDiagramEventHandlers() {
|
|
63
|
-
return useContext(
|
|
62
|
+
export function useDiagramEventHandlers(): DiagramEventHandlersContext {
|
|
63
|
+
return useContext(DiagramEventHandlersReactContext)
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
export function useDiagramEventHandlersRef() {
|
|
67
|
-
return useContext(
|
|
66
|
+
export function useDiagramEventHandlersRef<A extends aux.Any = aux.Any>(): RefObject<LikeC4DiagramEventHandlers<A>> {
|
|
67
|
+
return useContext(DiagramEventHandlersReactContext).handlersRef
|
|
68
68
|
}
|
package/src/globals.css
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
.likec4-root {
|
|
2
|
+
overflow: hidden;
|
|
3
|
+
position: relative;
|
|
4
|
+
padding: 0;
|
|
5
|
+
margin: 0;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
border: 0px solid transparent;
|
|
9
|
+
container-name: likec4-root;
|
|
10
|
+
container-type: size;
|
|
11
|
+
}
|
|
12
|
+
.likec4-root .react-flow:is(.not-initialized) {
|
|
13
|
+
opacity: 0;
|
|
14
|
+
}
|
|
15
|
+
:where(.likec4-root .mantine-ActionIcon-icon) .tabler-icon {
|
|
16
|
+
width: 75%;
|
|
17
|
+
height: 75%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.likec4-root :where(.react-flow__node, .react-flow__edge, .likec4-edge-label-container):has([data-likec4-dimmed]) {
|
|
21
|
+
opacity: 0.25;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.likec4-root:not([data-likec4-reduced-graphics])
|
|
25
|
+
:where(.react-flow__node, .react-flow__edge, .likec4-edge-label-container):has([data-likec4-dimmed]) {
|
|
26
|
+
filter: grayscale(85%) blur(3px);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.likec4-root:not([data-likec4-reduced-graphics])
|
|
30
|
+
:where(.react-flow__node, .react-flow__edge, .likec4-edge-label-container):has([data-likec4-dimmed="true"]) {
|
|
31
|
+
transition-property: opacity, filter;
|
|
32
|
+
transition-timing-function: cubic-bezier(0.50, 0, 0.2, 1);
|
|
33
|
+
transition-duration: 600ms;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
[data-mantine-color-scheme="dark"]
|
|
37
|
+
.likec4-root:not([data-likec4-reduced-graphics])
|
|
38
|
+
:where(.react-flow__edges, .react-flow__edgelabel-renderer)
|
|
39
|
+
> svg {
|
|
40
|
+
mix-blend-mode: plus-lighter;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[data-mantine-color-scheme="light"]
|
|
44
|
+
.likec4-root:not([data-likec4-reduced-graphics])
|
|
45
|
+
:where(.react-flow__edges, .react-flow__edgelabel-renderer)
|
|
46
|
+
> svg {
|
|
47
|
+
mix-blend-mode: screen;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.likec4-root :where(.likec4-edge-container, .likec4-edge-label-container) {
|
|
51
|
+
--xy-edge-stroke-width: 3;
|
|
52
|
+
--xy-edge-stroke: var(--likec4-palette-relation-stroke);
|
|
53
|
+
--xy-edge-stroke-selected: var(--likec4-palette-relation-stroke-selected);
|
|
54
|
+
--xy-edge-label-color: var(--likec4-palette-relation-label);
|
|
55
|
+
--xy-edge-label-background-color: var(--likec4-palette-relation-label-bg);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.likec4-root
|
|
59
|
+
:where(.likec4-edge-container, .likec4-edge-label-container):is([data-likec4-hovered="true"], [data-edge-active="true"]) {
|
|
60
|
+
--xy-edge-stroke-width: 4;
|
|
61
|
+
--xy-edge-stroke: var(--likec4-palette-relation-stroke-selected);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
[data-mantine-color-scheme="dark"] .likec4-root :where(.likec4-edge-container, .likec4-edge-label-container) {
|
|
65
|
+
--xy-edge-label-background-color: color-mix(in srgb, var(--likec4-palette-relation-label-bg) 50%, transparent);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
[data-mantine-color-scheme="light"] .likec4-root :where(.likec4-edge-container, .likec4-edge-label-container) {
|
|
69
|
+
--xy-edge-label-color: color-mix(in srgb, var(--likec4-palette-relation-label), rgba(255 255 255 / 0.85) 40%);
|
|
70
|
+
--xy-edge-label-background-color: color-mix(in srgb, var(--likec4-palette-relation-label-bg) 60%, transparent);
|
|
71
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -324,7 +324,7 @@ export const RelationshipEdge = customEdge<Types.RelationshipEdgeData>((props) =
|
|
|
324
324
|
const notes = props.data.notes
|
|
325
325
|
if (notes && activeWalkthroughStep === props.id) {
|
|
326
326
|
edgeLabel = (
|
|
327
|
-
<NotePopover notes={notes}>
|
|
327
|
+
<NotePopover notes={notes.txt ?? notes.md}>
|
|
328
328
|
{edgeLabel}
|
|
329
329
|
</NotePopover>
|
|
330
330
|
)
|
|
@@ -7,7 +7,7 @@ export const menuDropdown = css({
|
|
|
7
7
|
})
|
|
8
8
|
|
|
9
9
|
export const menuItemRelationship = css({
|
|
10
|
-
gap:
|
|
10
|
+
gap: '1',
|
|
11
11
|
})
|
|
12
12
|
|
|
13
13
|
export const endpoint = css({
|
|
@@ -15,17 +15,17 @@ export const endpoint = css({
|
|
|
15
15
|
fontSize: 'xxs',
|
|
16
16
|
fontWeight: 500,
|
|
17
17
|
whiteSpace: 'nowrap',
|
|
18
|
-
padding: '2px 4px',
|
|
19
|
-
borderRadius:
|
|
20
|
-
background: `likec4
|
|
18
|
+
padding: '[2px 4px]',
|
|
19
|
+
borderRadius: '[2px]',
|
|
20
|
+
background: `var(--likec4-palette-fill)/30`,
|
|
21
21
|
lineHeight: '[1.11]',
|
|
22
22
|
mixBlendMode: 'hard-light',
|
|
23
23
|
color: {
|
|
24
|
-
_light: `[color-mix(in srgb,
|
|
25
|
-
_dark: 'likec4
|
|
24
|
+
_light: `[color-mix(in srgb, var(--likec4-palette-stroke), {colors.likec4.mixColor} 60%)]`,
|
|
25
|
+
_dark: 'var(--likec4-palette-loContrast)',
|
|
26
26
|
},
|
|
27
27
|
// _dark: {
|
|
28
|
-
// background: `likec4
|
|
28
|
+
// background: `var(--likec4-palette-fill)/60`,
|
|
29
29
|
// },
|
|
30
30
|
})
|
|
31
31
|
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
nameFromFqn,
|
|
6
6
|
} from '@likec4/core'
|
|
7
7
|
import type { LikeC4Model } from '@likec4/core/model'
|
|
8
|
-
import {
|
|
8
|
+
import { cx } from '@likec4/styles/css'
|
|
9
9
|
import {
|
|
10
10
|
type StackProps,
|
|
11
11
|
ActionIcon,
|
|
@@ -203,11 +203,11 @@ const Relationship = forwardRef<
|
|
|
203
203
|
return (
|
|
204
204
|
<Stack ref={ref} className={cx(styles.menuItemRelationship, className)} {...props}>
|
|
205
205
|
<Group gap={4}>
|
|
206
|
-
<Text component="div"
|
|
206
|
+
<Text component="div" data-likec4-color={sourceNode.color} className={styles.endpoint}>
|
|
207
207
|
{sourceId}
|
|
208
208
|
</Text>
|
|
209
209
|
<IconArrowRight stroke={2.5} size={'11px'} opacity={0.65} />
|
|
210
|
-
<Text component="div"
|
|
210
|
+
<Text component="div" data-likec4-color={targetNode.color} className={styles.endpoint}>
|
|
211
211
|
{targetId}
|
|
212
212
|
</Text>
|
|
213
213
|
{(navigateTo || !!onOpenSource) && (
|
|
@@ -6,14 +6,14 @@ export const controlPointsContainer = css({
|
|
|
6
6
|
overflow: 'visible',
|
|
7
7
|
position: 'absolute',
|
|
8
8
|
pointerEvents: 'none',
|
|
9
|
-
top: 0,
|
|
10
|
-
left: 0,
|
|
9
|
+
top: '0',
|
|
10
|
+
left: '0',
|
|
11
11
|
mixBlendMode: 'normal',
|
|
12
12
|
})
|
|
13
13
|
|
|
14
14
|
export const controlPoint = css({
|
|
15
|
-
fill: `likec4
|
|
16
|
-
stroke: `likec4
|
|
15
|
+
fill: `var(--likec4-palette-relation-stroke)`,
|
|
16
|
+
stroke: `var(--likec4-palette-relation-stroke)`,
|
|
17
17
|
fillOpacity: 0.75,
|
|
18
18
|
strokeWidth: 1,
|
|
19
19
|
cursor: 'grab',
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { css } from '@likec4/styles/css'
|
|
2
2
|
|
|
3
3
|
export const navigationButtons = css({
|
|
4
|
-
gap: '
|
|
4
|
+
gap: 'xxs',
|
|
5
5
|
_empty: {
|
|
6
6
|
display: 'none',
|
|
7
7
|
},
|
|
8
8
|
})
|
|
9
9
|
|
|
10
10
|
export const panel = css({
|
|
11
|
-
top: '
|
|
12
|
-
left: '
|
|
13
|
-
margin: 0,
|
|
11
|
+
top: 'md',
|
|
12
|
+
left: 'md',
|
|
13
|
+
margin: '0',
|
|
14
14
|
pointerEvents: 'none',
|
|
15
15
|
'& :where(button, .action-icon, [role=\'dialog\'])': {
|
|
16
16
|
pointerEvents: 'all',
|
|
@@ -47,7 +47,7 @@ export const autolayoutButton = css({
|
|
|
47
47
|
flex: '1 1 40%',
|
|
48
48
|
textAlign: 'center',
|
|
49
49
|
fontWeight: 500,
|
|
50
|
-
padding: '4px 6px',
|
|
50
|
+
padding: '[4px 6px]',
|
|
51
51
|
fontSize: '11px',
|
|
52
52
|
zIndex: 1,
|
|
53
53
|
})
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { css } from '@likec4/styles/css'
|
|
2
2
|
|
|
3
3
|
export const container = css({
|
|
4
|
-
bottom: 0,
|
|
5
|
-
right: 0,
|
|
6
|
-
padding:
|
|
7
|
-
margin: 0,
|
|
4
|
+
bottom: '0',
|
|
5
|
+
right: '0',
|
|
6
|
+
padding: '2',
|
|
7
|
+
margin: '0',
|
|
8
8
|
})
|
|
9
9
|
|
|
10
10
|
export const icon = css({
|
|
@@ -35,7 +35,7 @@ export const card = css({
|
|
|
35
35
|
})
|
|
36
36
|
|
|
37
37
|
export const tabPanel = css({
|
|
38
|
-
padding: '
|
|
38
|
+
padding: 'xxs',
|
|
39
39
|
})
|
|
40
40
|
|
|
41
41
|
// export const description = css({
|
|
@@ -69,8 +69,8 @@ export const elementNotation = css({
|
|
|
69
69
|
})
|
|
70
70
|
|
|
71
71
|
export const shapeSvg = css({
|
|
72
|
-
fill: 'likec4
|
|
73
|
-
stroke: 'likec4
|
|
72
|
+
fill: 'var(--likec4-palette-fill)',
|
|
73
|
+
stroke: 'var(--likec4-palette-stroke)',
|
|
74
74
|
strokeWidth: 1,
|
|
75
75
|
overflow: 'visible',
|
|
76
76
|
width: '100%',
|
|
@@ -84,8 +84,8 @@ export const shapeSvg = css({
|
|
|
84
84
|
export const shapeBadge = css({
|
|
85
85
|
fontWeight: 500,
|
|
86
86
|
letterSpacing: '0.2px',
|
|
87
|
-
paddingTop: 0,
|
|
88
|
-
paddingBottom: 0,
|
|
87
|
+
paddingTop: '0',
|
|
88
|
+
paddingBottom: '0',
|
|
89
89
|
textTransform: 'lowercase',
|
|
90
90
|
transition: 'all 150ms ease-in-out',
|
|
91
91
|
cursor: 'pointer',
|
|
@@ -94,6 +94,6 @@ export const shapeBadge = css({
|
|
|
94
94
|
['--badge-padding-x']: '3px',
|
|
95
95
|
['--badge-height']: '13.5px',
|
|
96
96
|
['--badge-lh']: '1',
|
|
97
|
-
['--badge-bg']: '
|
|
98
|
-
['--badge-color']: '
|
|
97
|
+
['--badge-bg']: 'var(--likec4-palette-fill)',
|
|
98
|
+
['--badge-color']: 'var(--likec4-palette-hiContrast)',
|
|
99
99
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ComputedNode, type NodeNotation as ElementNotationData } from '@likec4/core'
|
|
2
|
-
import {
|
|
2
|
+
import { cx, cx as clsx } from '@likec4/styles/css'
|
|
3
3
|
import {
|
|
4
4
|
ActionIcon,
|
|
5
5
|
Badge,
|
|
@@ -48,9 +48,6 @@ const ElementNotation = ({ value }: { value: ElementNotationData }) => {
|
|
|
48
48
|
py={'sm'}
|
|
49
49
|
className={cx(
|
|
50
50
|
styles.elementNotation,
|
|
51
|
-
css({
|
|
52
|
-
likec4Palette: color,
|
|
53
|
-
}),
|
|
54
51
|
)}
|
|
55
52
|
data-likec4-color={color}
|
|
56
53
|
onMouseEnter={() => {
|
|
@@ -3,17 +3,17 @@ import type { SystemStyleObject } from '@likec4/styles/types'
|
|
|
3
3
|
|
|
4
4
|
export const container = css({
|
|
5
5
|
position: 'absolute',
|
|
6
|
-
bottom: '
|
|
7
|
-
left: '50%',
|
|
6
|
+
bottom: 'xxs',
|
|
7
|
+
left: '[50%]',
|
|
8
8
|
transform: 'translateX(-50%)',
|
|
9
|
-
padding:
|
|
10
|
-
margin:
|
|
9
|
+
padding: '[0px]',
|
|
10
|
+
margin: '[0px]',
|
|
11
11
|
display: 'flex',
|
|
12
12
|
flexDirection: 'column',
|
|
13
|
-
gap: '0.4rem',
|
|
13
|
+
gap: '[0.4rem]',
|
|
14
14
|
alignItems: 'center',
|
|
15
15
|
md: {
|
|
16
|
-
gap: '0.6rem',
|
|
16
|
+
gap: '[0.6rem]',
|
|
17
17
|
},
|
|
18
18
|
})
|
|
19
19
|
|
|
@@ -55,10 +55,10 @@ export const btn = css({
|
|
|
55
55
|
|
|
56
56
|
export const parallelStateFrame = css({
|
|
57
57
|
position: 'absolute',
|
|
58
|
-
margin: 0,
|
|
59
|
-
padding: 0,
|
|
60
|
-
top: 0,
|
|
61
|
-
left: 0,
|
|
58
|
+
margin: '0',
|
|
59
|
+
padding: '0',
|
|
60
|
+
top: '0',
|
|
61
|
+
left: '0',
|
|
62
62
|
width: '100%',
|
|
63
63
|
height: '100%',
|
|
64
64
|
border: `2px solid`,
|