@likec4/diagram 1.21.0 → 1.22.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 (129) hide show
  1. package/dist/LikeC4Diagram.js +9 -13
  2. package/dist/base/BaseXYFlow.js +0 -1
  3. package/dist/base/index.d.ts +0 -1
  4. package/dist/base/primitives/compound/CompoundNodeContainer.js +2 -2
  5. package/dist/base/primitives/edge/EdgeLabel.js +2 -2
  6. package/dist/base/primitives/element/ElementNodeContainer.d.ts +6 -1
  7. package/dist/base/primitives/element/ElementNodeContainer.js +31 -13
  8. package/dist/base/primitives/element/ElementTitle.js +7 -3
  9. package/dist/base/primitives/element/styles.css.js +1 -1
  10. package/dist/{base → components}/Link.css.js +3 -3
  11. package/dist/components/SearchControl.css.d.ts +2 -0
  12. package/dist/components/SearchControl.css.js +7 -0
  13. package/dist/components/SearchControl.d.ts +5 -0
  14. package/dist/components/SearchControl.js +17 -0
  15. package/dist/context/IconRenderer.d.ts +10 -0
  16. package/dist/context/IconRenderer.js +34 -0
  17. package/dist/hooks/index.d.ts +0 -1
  18. package/dist/hooks/useDiagram.d.ts +4 -4
  19. package/dist/index.d.ts +1 -1
  20. package/dist/likec4diagram/DiagramUI.js +1 -4
  21. package/dist/likec4diagram/XYFlow.d.ts +6 -1
  22. package/dist/likec4diagram/XYFlow.js +28 -29
  23. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +3 -1
  24. package/dist/likec4diagram/state/actorContext.d.ts +16 -16
  25. package/dist/likec4diagram/state/assign.js +1 -1
  26. package/dist/likec4diagram/state/machine.d.ts +7 -7
  27. package/dist/likec4diagram/state/machine.js +10 -7
  28. package/dist/likec4diagram/ui/controls/Controls.js +63 -48
  29. package/dist/likec4diagram/ui/controls/NavigationButtons.js +44 -69
  30. package/dist/likec4diagram/ui/controls/_shared.js +1 -1
  31. package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +5 -4
  32. package/dist/likec4diagram/ui/index.d.ts +2 -0
  33. package/dist/likec4diagram/ui/search/ElementsColumn.css.d.ts +15 -0
  34. package/dist/likec4diagram/ui/search/ElementsColumn.css.js +30 -0
  35. package/dist/likec4diagram/ui/search/ElementsColumn.d.ts +1 -0
  36. package/dist/likec4diagram/ui/search/ElementsColumn.js +243 -0
  37. package/dist/likec4diagram/ui/search/LikeC4Search.css.d.ts +8 -0
  38. package/dist/likec4diagram/ui/search/LikeC4Search.css.js +20 -0
  39. package/dist/likec4diagram/ui/search/LikeC4Search.d.ts +1 -0
  40. package/dist/likec4diagram/ui/search/LikeC4Search.js +265 -0
  41. package/dist/likec4diagram/ui/search/SearchInput.d.ts +1 -0
  42. package/dist/likec4diagram/ui/search/SearchInput.js +196 -0
  43. package/dist/likec4diagram/ui/search/ViewsColum.d.ts +9 -0
  44. package/dist/likec4diagram/ui/search/ViewsColum.js +130 -0
  45. package/dist/likec4diagram/ui/search/ViewsColumn.css.d.ts +5 -0
  46. package/dist/likec4diagram/ui/search/ViewsColumn.css.js +12 -0
  47. package/dist/likec4diagram/ui/search/_shared.css.d.ts +16 -0
  48. package/dist/likec4diagram/ui/search/_shared.css.js +5 -0
  49. package/dist/likec4diagram/ui/search/state.d.ts +19 -0
  50. package/dist/likec4diagram/ui/search/state.js +72 -0
  51. package/dist/likec4diagram/ui/search/utils.d.ts +3 -0
  52. package/dist/likec4diagram/ui/search/utils.js +23 -0
  53. package/dist/likec4diagram/useLayoutConstraints.js +4 -5
  54. package/dist/likec4model/useLikeC4ElementsTree.d.ts +1 -0
  55. package/dist/likec4model/useLikeC4ElementsTree.js +1 -0
  56. package/dist/overlays/Overlays.js +10 -10
  57. package/dist/overlays/element-details/ElementDetailsCard.js +20 -13
  58. package/dist/overlays/element-details/TabPanelDeployments.js +4 -2
  59. package/dist/overlays/overlay/Overlay.d.ts +6 -2
  60. package/dist/overlays/overlay/Overlay.js +18 -29
  61. package/dist/overlays/relationship-details/SelectEdge.js +1 -3
  62. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +6 -5
  63. package/dist/overlays/relationships-browser/SelectElement.js +10 -6
  64. package/dist/overlays/relationships-browser/actor.d.ts +2 -2
  65. package/dist/overlays/relationships-browser/actor.js +8 -8
  66. package/dist/overlays/relationships-browser/custom/nodeTypes.js +2 -2
  67. package/dist/style.css +1 -1
  68. package/package.json +15 -14
  69. package/src/LikeC4Diagram.tsx +0 -1
  70. package/src/base/BaseXYFlow.tsx +0 -1
  71. package/src/base/index.ts +0 -2
  72. package/src/base/primitives/element/ElementNodeContainer.css.ts +4 -7
  73. package/src/base/primitives/element/ElementNodeContainer.tsx +36 -16
  74. package/src/base/primitives/element/ElementTitle.css.ts +12 -9
  75. package/src/base/primitives/element/ElementTitle.tsx +6 -2
  76. package/src/base/primitives/element/styles.css.ts +18 -40
  77. package/src/{base → components}/Link.css.ts +3 -3
  78. package/src/components/SearchControl.css.ts +69 -0
  79. package/src/components/SearchControl.tsx +33 -0
  80. package/src/context/IconRenderer.tsx +54 -1
  81. package/src/hooks/index.ts +0 -1
  82. package/src/index.ts +15 -1
  83. package/src/likec4diagram/DiagramUI.tsx +1 -8
  84. package/src/likec4diagram/XYFlow.tsx +30 -30
  85. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +0 -1
  86. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.ts +1 -0
  87. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +3 -1
  88. package/src/likec4diagram/state/assign.ts +1 -1
  89. package/src/likec4diagram/state/machine.ts +12 -10
  90. package/src/likec4diagram/ui/controls/Controls.tsx +35 -25
  91. package/src/likec4diagram/ui/controls/NavigationButtons.tsx +36 -58
  92. package/src/likec4diagram/ui/controls/styles.css.ts +3 -1
  93. package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +111 -108
  94. package/src/likec4diagram/ui/index.ts +2 -0
  95. package/src/likec4diagram/ui/notation/NotationPanel.tsx +2 -3
  96. package/src/likec4diagram/ui/search/ElementsColumn.css.ts +119 -0
  97. package/src/likec4diagram/ui/search/ElementsColumn.tsx +291 -0
  98. package/src/likec4diagram/ui/search/LikeC4Search.css.ts +117 -0
  99. package/src/likec4diagram/ui/search/LikeC4Search.tsx +312 -0
  100. package/src/likec4diagram/ui/search/SearchInput.tsx +235 -0
  101. package/src/likec4diagram/ui/search/ViewsColum.tsx +158 -0
  102. package/src/likec4diagram/ui/search/ViewsColumn.css.ts +37 -0
  103. package/src/likec4diagram/ui/search/_shared.css.ts +104 -0
  104. package/src/likec4diagram/ui/search/state.ts +76 -0
  105. package/src/likec4diagram/ui/search/utils.ts +20 -0
  106. package/src/likec4diagram/useLayoutConstraints.ts +4 -5
  107. package/src/likec4model/useLikeC4ElementsTree.ts +4 -4
  108. package/src/overlays/Overlays.tsx +32 -26
  109. package/src/overlays/element-details/ElementDetailsCard.css.ts +4 -4
  110. package/src/overlays/element-details/ElementDetailsCard.tsx +246 -244
  111. package/src/overlays/element-details/TabPanelDeployments.tsx +4 -4
  112. package/src/overlays/overlay/Overlay.css.ts +10 -9
  113. package/src/overlays/overlay/Overlay.tsx +38 -26
  114. package/src/overlays/relationship-details/SelectEdge.css.ts +1 -0
  115. package/src/overlays/relationship-details/SelectEdge.tsx +2 -4
  116. package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +10 -5
  117. package/src/overlays/relationships-browser/SelectElement.tsx +88 -82
  118. package/src/overlays/relationships-browser/actor.ts +10 -10
  119. package/src/overlays/relationships-browser/custom/nodeTypes.tsx +2 -2
  120. package/dist/LikeC4Search.css.d.ts +0 -1
  121. package/dist/LikeC4Search.css.js +0 -5
  122. package/dist/LikeC4Search.d.ts +0 -2
  123. package/dist/LikeC4Search.js +0 -88
  124. package/src/LikeC4Search.css.ts +0 -12
  125. package/src/LikeC4Search.tsx +0 -91
  126. /package/dist/{base → components}/Link.css.d.ts +0 -0
  127. /package/dist/{base → components}/Link.d.ts +0 -0
  128. /package/dist/{base → components}/Link.js +0 -0
  129. /package/src/{base → components}/Link.tsx +0 -0
@@ -1,14 +1,15 @@
1
- import { ActionIconGroup, Badge, Loader, Stack } from '@mantine/core'
2
- import { openSpotlight } from '@mantine/spotlight'
3
- import { IconFileSymlink, IconFocusCentered, IconSearch } from '@tabler/icons-react'
1
+ import { ActionIconGroup, Badge, Group, Loader, Stack } from '@mantine/core'
2
+ import { IconFileSymlink, IconFocusCentered, IconMenu2 } from '@tabler/icons-react'
4
3
  import { clsx } from 'clsx'
4
+ import { LayoutGroup } from 'framer-motion'
5
5
  import { memo } from 'react'
6
- import { IfNotEnabled, useDiagramEventHandlers, useEnabledFeatures } from '../../../context'
6
+ import { useDiagramEventHandlers, useEnabledFeatures } from '../../../context'
7
7
  import { useMantinePortalProps } from '../../../hooks'
8
8
  import { useDiagram } from '../../../hooks/useDiagram'
9
9
  import { useDiagramSyncLayoutState } from '../../../hooks/useDiagramActor'
10
10
  import { useDiagramContext } from '../../../hooks/useDiagramContext'
11
11
  import { stopPropagation } from '../../../utils'
12
+ import { LikeC4Search } from '../search/LikeC4Search'
12
13
  import { ActionIcon, Tooltip } from './_shared'
13
14
  import { ChangeAutoLayoutButton } from './ChangeAutoLayoutButton'
14
15
  import { LayoutDriftNotification } from './LayoutDriftNotification'
@@ -25,41 +26,47 @@ export const Controls = memo(() => {
25
26
  const diagram = useDiagram()
26
27
  const {
27
28
  onOpenSource,
29
+ onBurgerMenuClick,
28
30
  } = useDiagramEventHandlers()
29
31
  const {
30
32
  enableControls,
31
33
  enableSearch,
32
34
  enableNavigationButtons,
33
35
  enableReadOnly,
34
- enableEdgeEditing,
35
36
  enableVscode,
36
37
  } = useEnabledFeatures()
37
38
  const notReadOnly = !enableReadOnly
38
39
  const portalProps = useMantinePortalProps()
40
+
39
41
  return (
40
- <>
41
- <Stack
42
- className={clsx(
43
- 'react-flow__panel',
44
- css.panel,
45
- 'likec4-top-left-panel',
46
- )}
47
- align="flex-start"
48
- onClick={stopPropagation}
49
- gap={'xs'}>
50
- {enableNavigationButtons && <NavigationButtons />}
51
- <ActionIconGroup className={css.actionIconGroup} orientation="vertical">
52
- {enableControls && enableSearch && (
53
- <Tooltip label="Search (Ctrl+F or ⌘+F)" {...portalProps}>
42
+ <Group
43
+ align="flex-start"
44
+ className={clsx(
45
+ 'react-flow__panel',
46
+ css.panel,
47
+ 'likec4-top-left-panel',
48
+ )}
49
+ gap="xs"
50
+ onClick={stopPropagation}
51
+ >
52
+ <Stack align="flex-start" gap="xs">
53
+ <LayoutGroup>
54
+ <Group
55
+ className={clsx(css.navigationButtons, 'likec4-navigation-webview')}
56
+ gap={'xs'}>
57
+ {onBurgerMenuClick && (
54
58
  <ActionIcon
55
59
  onClick={e => {
56
60
  e.stopPropagation()
57
- openSpotlight()
61
+ onBurgerMenuClick()
58
62
  }}>
59
- <IconSearch />
63
+ <IconMenu2 />
60
64
  </ActionIcon>
61
- </Tooltip>
62
- )}
65
+ )}
66
+ {enableNavigationButtons && <NavigationButtons />}
67
+ </Group>
68
+ </LayoutGroup>
69
+ <ActionIconGroup className={css.actionIconGroup} orientation="vertical">
63
70
  {enableVscode && (
64
71
  <Tooltip label="Open source" {...portalProps}>
65
72
  <ActionIcon
@@ -90,9 +97,12 @@ export const Controls = memo(() => {
90
97
  </Tooltip>
91
98
  )}
92
99
  </ActionIconGroup>
93
- {notReadOnly && <SyncLayoutBadge />}
94
100
  </Stack>
95
- </>
101
+ <Group>
102
+ {enableSearch && <LikeC4Search />}
103
+ {notReadOnly && <SyncLayoutBadge />}
104
+ </Group>
105
+ </Group>
96
106
  )
97
107
  })
98
108
 
@@ -2,19 +2,13 @@ import { IconChevronRight } from '@tabler/icons-react'
2
2
 
3
3
  import { AnimatePresence, m } from 'framer-motion'
4
4
 
5
- import { Group } from '@mantine/core'
6
- import { IconChevronLeft, IconMenu2 } from '@tabler/icons-react'
7
- import clsx from 'clsx'
8
- import { LayoutGroup } from 'framer-motion'
9
- import { useDiagramEventHandlers } from '../../../context'
5
+ import { IconChevronLeft } from '@tabler/icons-react'
10
6
  import { useDiagram } from '../../../hooks/useDiagram'
11
7
  import { useDiagramContext } from '../../../hooks/useDiagramContext'
12
8
  import { ActionIcon } from './_shared'
13
- import * as css from './styles.css'
14
9
 
15
10
  export const NavigationButtons = () => {
16
11
  const diagram = useDiagram()
17
- const { onBurgerMenuClick } = useDiagramEventHandlers()
18
12
  const {
19
13
  hasStepBack,
20
14
  hasStepForward,
@@ -23,61 +17,45 @@ export const NavigationButtons = () => {
23
17
  hasStepForward: s.navigationHistory.currentIndex < s.navigationHistory.history.length - 1,
24
18
  }))
25
19
  return (
26
- <LayoutGroup>
27
- <Group
28
- className={clsx(css.navigationButtons, 'likec4-navigation-webview')}
29
- align="flex-start"
30
- gap={'xs'}>
31
- {onBurgerMenuClick && (
20
+ <AnimatePresence>
21
+ {hasStepBack && (
22
+ <m.div
23
+ layout
24
+ initial={{ opacity: 0.05, transform: 'translateX(-10px)' }}
25
+ animate={{ opacity: 1, transform: 'translateX(0)' }}
26
+ exit={{
27
+ opacity: 0.05,
28
+ transform: 'translateX(-10px)',
29
+ }}
30
+ key={'back'}>
32
31
  <ActionIcon
33
32
  onClick={e => {
34
33
  e.stopPropagation()
35
- onBurgerMenuClick()
34
+ diagram.navigate('back')
36
35
  }}>
37
- <IconMenu2 />
36
+ <IconChevronLeft />
38
37
  </ActionIcon>
39
- )}
40
- <AnimatePresence>
41
- {hasStepBack && (
42
- <m.div
43
- layout
44
- initial={{ opacity: 0.05, transform: 'translateX(-10px)' }}
45
- animate={{ opacity: 1, transform: 'translateX(0)' }}
46
- exit={{
47
- opacity: 0.05,
48
- transform: 'translateX(-10px)',
49
- }}
50
- key={'back'}>
51
- <ActionIcon
52
- onClick={e => {
53
- e.stopPropagation()
54
- diagram.navigate('back')
55
- }}>
56
- <IconChevronLeft />
57
- </ActionIcon>
58
- </m.div>
59
- )}
60
- {hasStepForward && (
61
- <m.div
62
- layout
63
- initial={{ opacity: 0.05, transform: 'translateX(10px)' }}
64
- animate={{ opacity: 1, transform: 'translateX(0)' }}
65
- exit={{
66
- opacity: 0,
67
- transform: 'translateX(10px)',
68
- }}
69
- key={'forward'}>
70
- <ActionIcon
71
- onClick={e => {
72
- e.stopPropagation()
73
- diagram.navigate('forward')
74
- }}>
75
- <IconChevronRight />
76
- </ActionIcon>
77
- </m.div>
78
- )}
79
- </AnimatePresence>
80
- </Group>
81
- </LayoutGroup>
38
+ </m.div>
39
+ )}
40
+ {hasStepForward && (
41
+ <m.div
42
+ layout
43
+ initial={{ opacity: 0.05, transform: 'translateX(10px)' }}
44
+ animate={{ opacity: 1, transform: 'translateX(0)' }}
45
+ exit={{
46
+ opacity: 0,
47
+ transform: 'translateX(10px)',
48
+ }}
49
+ key={'forward'}>
50
+ <ActionIcon
51
+ onClick={e => {
52
+ e.stopPropagation()
53
+ diagram.navigate('forward')
54
+ }}>
55
+ <IconChevronRight />
56
+ </ActionIcon>
57
+ </m.div>
58
+ )}
59
+ </AnimatePresence>
82
60
  )
83
61
  }
@@ -5,12 +5,14 @@ import { mantine, vars } from '../../../theme-vars'
5
5
 
6
6
  export const navigationButtons = style({
7
7
  gap: calc(mantine.spacing.xs).divide(1.5).toString(),
8
+ ':empty': {
9
+ display: 'none',
10
+ },
8
11
  })
9
12
 
10
13
  export const panel = style({
11
14
  top: fallbackVar(vars.navigationPanel.top, '1rem'),
12
15
  left: fallbackVar(vars.navigationPanel.left, '1rem'),
13
- gap: calc(mantine.spacing.xs).divide(1.5).toString(),
14
16
  margin: 0,
15
17
  })
16
18
 
@@ -3,7 +3,7 @@ import { useLocalStorage } from '@mantine/hooks'
3
3
  import { IconMenu } from '@tabler/icons-react'
4
4
  import clsx from 'clsx'
5
5
  import { AnimatePresence, m } from 'framer-motion'
6
- import { Link } from '../../../base'
6
+ import { Link } from '../../../components/Link'
7
7
  import { useDiagramContext } from '../../../hooks/useDiagramContext'
8
8
  import type { DiagramContext } from '../../state/machine'
9
9
  import * as css from './DiagramTitlePanel.css'
@@ -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
- <m.div
45
- key={id}
46
- initial={{ opacity: 0.05, scale: 0.7 }}
47
- animate={{ opacity: 1, scale: 1 }}
48
- exit={{
49
- opacity: 0.05,
50
- scale: 0.6,
51
- }}
52
- className={clsx('react-flow__panel', css.container)}
53
- style={{
54
- transformOrigin: 'left center',
55
- }}
56
- >
57
- <Card
58
- radius="sm"
59
- className={css.card}
60
- withBorder={!isCollapsed}
61
- p={isCollapsed ? 'sm' : 'md'}
62
- onDoubleClick={e => e.stopPropagation()}>
63
- {isCollapsed && (
64
- <CardSection>
65
- <Button
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
- size="xs"
87
- h={'sm'}
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
- <IconMenu size={11} opacity={0.7} />
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
- <Group justify="stretch" wrap="nowrap" mb={'sm'}>
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
- size="sm"
138
- className={css.description}>
139
- {description || 'no description'}
104
+ flex={'1'}
105
+ size={'md'}
106
+ fw={500}
107
+ lh={1.1}
108
+ className={css.title}
109
+ >
110
+ {title}
140
111
  </Text>
141
- </Spoiler>
142
- )}
143
- {!description && (
144
- <Text
145
- component={'div'}
146
- size="xs"
147
- c={'dimmed'}>
148
- no description
149
- </Text>
150
- )}
151
- {links && (
152
- <Stack
153
- mt={'xs'}
154
- gap={4}
155
- justify="stretch"
156
- align="stretch">
157
- {links.map((link) => <Link value={link} key={link.url} />)}
158
- </Stack>
159
- )}
160
- </>
161
- )}
162
- </Card>
163
- </m.div>
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,2 +1,4 @@
1
1
  export { Controls } from './controls/Controls'
2
2
  export { DiagramTitlePanel } from './diagram-title/DiagramTitlePanel'
3
+ export { NotationPanel } from './notation/NotationPanel'
4
+ export { DynamicViewWalkthrough } from './walkthrough/DynamicViewWalkthrough'
@@ -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 { type DiagramContext, useMantinePortalProps } from '../../../hooks'
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
 
@@ -0,0 +1,119 @@
1
+ import { createContainer, createGlobalVar, fallbackVar, globalStyle, style } from '@vanilla-extract/css'
2
+ import { mantine } from '../../../theme-vars'
3
+ import { whereLight } from '../../../theme-vars.css'
4
+ import { button, buttonFocused, description, descriptionColor, iconColor, title } from './_shared.css'
5
+
6
+ export { focusable } from './_shared.css'
7
+
8
+ export const treeContainer = createContainer('likec4-elements-tree')
9
+
10
+ const whenContainerIsNarrow = `${treeContainer} (width < 450px)`
11
+
12
+ export const treeNode = style({
13
+ outline: 'none',
14
+ marginBottom: 8,
15
+ })
16
+ export const treeRoot = style({
17
+ overflow: 'hidden',
18
+ containerName: treeContainer,
19
+ containerType: 'inline-size',
20
+ height: '100%',
21
+ })
22
+ export const treeLabel = style({
23
+ display: 'flex',
24
+ alignItems: 'baseline',
25
+ outline: 'none !important',
26
+ gap: 4,
27
+ })
28
+ export const treeSubtree = style({
29
+ marginTop: 8,
30
+ })
31
+
32
+ export const iconSize = createGlobalVar('likec4-icon-size')
33
+ export const elementExpandIcon = style({
34
+ color: mantine.colors.dimmed,
35
+ })
36
+
37
+ export const elementButton = style([button, {
38
+ flexGrow: 1,
39
+ vars: {
40
+ [iconSize]: '24px',
41
+ },
42
+ '@container': {
43
+ [`${whenContainerIsNarrow}`]: {
44
+ vars: {
45
+ [iconSize]: '18px',
46
+ },
47
+ },
48
+ },
49
+ }])
50
+
51
+ globalStyle(`${treeNode}:focus > ${treeLabel} ${elementButton}`, buttonFocused)
52
+
53
+ export const elementTitleAndId = style({
54
+ '@container': {
55
+ [`${whenContainerIsNarrow}`]: {
56
+ flexDirection: 'column-reverse',
57
+ alignItems: 'flex-start',
58
+ gap: 2,
59
+ },
60
+ },
61
+ })
62
+
63
+ export const elementTitle = style([title])
64
+ export const elementId = style({
65
+ color: fallbackVar(descriptionColor, mantine.colors.dimmed),
66
+ fontSize: 10,
67
+ lineHeight: 1.3,
68
+ display: 'block',
69
+ fontWeight: 500,
70
+ whiteSpace: 'nowrap',
71
+ padding: '1px 5px',
72
+ borderRadius: 4,
73
+ background: `color-mix(in srgb, ${mantine.colors.dark[9]}, transparent 70%)`,
74
+ selectors: {
75
+ [`${whereLight} &`]: {
76
+ backgroundColor: `color-mix(in srgb, ${mantine.colors.gray[3]}, transparent 80%)`,
77
+ },
78
+ },
79
+ })
80
+ export const elementDescription = style([description])
81
+
82
+ export const elementIcon = style({
83
+ flex: `0 0 ${iconSize}`,
84
+ height: iconSize,
85
+ width: iconSize,
86
+ display: 'flex',
87
+ alignItems: 'center',
88
+ justifyContent: 'center',
89
+ alignSelf: 'flex-start',
90
+ marginTop: 4,
91
+ })
92
+ globalStyle(`${elementIcon} svg, ${elementIcon} img`, {
93
+ width: '100%',
94
+ height: 'auto',
95
+ maxHeight: '100%',
96
+ pointerEvents: 'none',
97
+ })
98
+ globalStyle(`${elementIcon} img`, {
99
+ objectFit: 'contain',
100
+ })
101
+ globalStyle(`${elementIcon}.likec4-shape-icon svg`, {
102
+ color: iconColor,
103
+ width: '90%',
104
+ strokeWidth: 1.5,
105
+ })
106
+
107
+ export const elementViewsCount = style({
108
+ flex: 0,
109
+ color: fallbackVar(descriptionColor, mantine.colors.dimmed),
110
+ fontSize: 10,
111
+ fontWeight: 500,
112
+ whiteSpace: 'nowrap',
113
+ lineHeight: 1.1,
114
+ '@container': {
115
+ [`${whenContainerIsNarrow}`]: {
116
+ display: 'none',
117
+ },
118
+ },
119
+ })