@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.
Files changed (214) hide show
  1. package/bundle/{chunk-C0Eg81Gj.js → chunk-7MPUJFHj.js} +315 -311
  2. package/bundle/custom.js +52 -52
  3. package/bundle/index.js +1583 -739
  4. package/dist/LikeC4Diagram.js +6 -6
  5. package/dist/LikeC4Diagram.props.d.ts +2 -3
  6. package/dist/LikeC4ModelProvider.d.ts +3 -3
  7. package/dist/LikeC4ProjectsProvider.d.ts +17 -0
  8. package/dist/LikeC4ProjectsProvider.js +22 -0
  9. package/dist/LikeC4Styles.d.ts +1 -0
  10. package/dist/LikeC4Styles.js +94 -0
  11. package/dist/StaticLikeC4Diagram.d.ts +3 -3
  12. package/dist/base/BaseXYFlow.js +23 -26
  13. package/dist/base/primitives/MarkdownBlock.d.ts +7 -1
  14. package/dist/base/primitives/MarkdownBlock.js +1 -1
  15. package/dist/base/primitives/compound/CompoundActionButton.js +2 -2
  16. package/dist/base/primitives/compound/CompoundDetailsButton.js +2 -2
  17. package/dist/base/primitives/compound/CompoundNodeContainer.css.js +4 -4
  18. package/dist/base/primitives/compound/CompoundNodeContainer.js +1 -4
  19. package/dist/base/primitives/compound/CompoundTitle.js +9 -8
  20. package/dist/base/primitives/compound/actionbtns.css.js +6 -6
  21. package/dist/base/primitives/edge/EdgeActionButton.js +2 -2
  22. package/dist/base/primitives/edge/EdgeContainer.js +4 -7
  23. package/dist/base/primitives/edge/EdgeLabel.css.d.ts +0 -22
  24. package/dist/base/primitives/edge/EdgeLabel.css.js +6 -84
  25. package/dist/base/primitives/edge/EdgeLabel.js +16 -6
  26. package/dist/base/primitives/edge/EdgeLabelContainer.js +1 -6
  27. package/dist/base/primitives/edge/EdgeMarkers.js +3 -3
  28. package/dist/base/primitives/edge/edge.css.d.ts +0 -2
  29. package/dist/base/primitives/edge/edge.css.js +1 -55
  30. package/dist/base/primitives/element/ElementActionButtons.js +2 -2
  31. package/dist/base/primitives/element/ElementDetailsButton.js +8 -7
  32. package/dist/base/primitives/element/ElementNodeContainer.css.js +4 -4
  33. package/dist/base/primitives/element/ElementNodeContainer.js +1 -4
  34. package/dist/base/primitives/element/ElementShape.css.js +11 -11
  35. package/dist/base/primitives/element/ElementTags.d.ts +1 -0
  36. package/dist/base/primitives/element/ElementTags.js +17 -14
  37. package/dist/bundle/LikeC4View.d.ts +1 -1
  38. package/dist/bundle/LikeC4View.js +7 -1
  39. package/dist/bundle/LikeC4View.props.d.ts +1 -2
  40. package/dist/bundle/ReactLikeC4.d.ts +1 -1
  41. package/dist/bundle/ViewNotFound.js +1 -1
  42. package/dist/bundle/index.d.ts +2 -1
  43. package/dist/bundle/index.js +1 -0
  44. package/dist/bundle/styles.css.js +1 -1
  45. package/dist/components/ErrorFallback.js +1 -1
  46. package/dist/components/GithubIcon.d.ts +2 -0
  47. package/dist/components/GithubIcon.js +17 -0
  48. package/dist/components/Link.d.ts +4 -3
  49. package/dist/components/Link.js +84 -87
  50. package/dist/components/NavigationLink.d.ts +2 -2
  51. package/dist/components/SearchControl.css.js +6 -5
  52. package/dist/context/DiagramEventHandlers.d.ts +6 -6
  53. package/dist/context/DiagramEventHandlers.js +4 -7
  54. package/dist/globals.css.js +3 -0
  55. package/dist/hooks/useXYFlow.d.ts +10 -10
  56. package/dist/index.d.ts +1 -0
  57. package/dist/index.js +1 -0
  58. package/dist/likec4diagram/custom/edges/NotePopover.css.js +2 -2
  59. package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +2 -2
  60. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +1 -1
  61. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.js +7 -7
  62. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +3 -3
  63. package/dist/likec4diagram/custom/edges/edges.css.js +4 -4
  64. package/dist/likec4diagram/custom/index.d.ts +2 -2
  65. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +2 -2
  66. package/dist/likec4diagram/ui/controls/styles.css.js +5 -5
  67. package/dist/likec4diagram/ui/notation/NotationPanel.css.js +11 -11
  68. package/dist/likec4diagram/ui/notation/NotationPanel.js +2 -5
  69. package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.css.js +10 -10
  70. package/dist/likec4model/LikeC4ProjectsContext.d.ts +7 -0
  71. package/dist/likec4model/LikeC4ProjectsContext.js +5 -0
  72. package/dist/likec4model/index.d.ts +1 -0
  73. package/dist/likec4model/useLikeC4Project.d.ts +22 -0
  74. package/dist/likec4model/useLikeC4Project.js +23 -0
  75. package/dist/navigationpanel/NavigationPanel.js +15 -17
  76. package/dist/navigationpanel/NavigationPanelControls.js +34 -21
  77. package/dist/navigationpanel/NavigationPanelDropdown.js +33 -17
  78. package/dist/navigationpanel/_common.js +4 -1
  79. package/dist/navigationpanel/actor.d.ts +11 -15
  80. package/dist/navigationpanel/actor.js +14 -15
  81. package/dist/navigationpanel/controls/BurgerButton.js +5 -7
  82. package/dist/navigationpanel/controls/NavigationButtons.js +37 -24
  83. package/dist/navigationpanel/controls/OpenSource.js +1 -1
  84. package/dist/navigationpanel/controls/SearchControl.js +6 -4
  85. package/dist/navigationpanel/controls/ToggleReadonly.js +3 -3
  86. package/dist/navigationpanel/controls/ViewDetailsCard.d.ts +2 -0
  87. package/dist/navigationpanel/controls/ViewDetailsCard.js +232 -0
  88. package/dist/navigationpanel/controls/index.d.ts +1 -0
  89. package/dist/navigationpanel/dropdown/ProjectsMenu.d.ts +2 -0
  90. package/dist/navigationpanel/dropdown/ProjectsMenu.js +75 -0
  91. package/dist/navigationpanel/editorpanel/EditorPanel.js +3 -3
  92. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +19 -20
  93. package/dist/navigationpanel/editorpanel/styles.js +5 -5
  94. package/dist/navigationpanel/hooks.d.ts +2 -2
  95. package/dist/navigationpanel/styles.css.js +0 -2
  96. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +12 -7
  97. 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
  98. 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
  99. package/dist/overlays/element-details/ElementDetailsCard.css.js +18 -17
  100. package/dist/overlays/element-details/ElementDetailsCard.js +8 -13
  101. package/dist/overlays/element-details/TabPanelDeployments.css.js +5 -4
  102. package/dist/overlays/element-details/TabPanelRelationships.css.js +7 -7
  103. package/dist/overlays/overlay/Overlay.css.d.ts +3 -3
  104. package/dist/overlays/overlay/Overlay.css.js +8 -7
  105. package/dist/overlays/relationship-details/SelectEdge.css.js +8 -8
  106. package/dist/overlays/relationships-browser/SelectElement.css.js +1 -1
  107. package/dist/search/Search.js +6 -6
  108. package/dist/search/components/ElementsColumn.css.js +5 -5
  109. package/dist/search/components/SearchByTags.js +3 -2
  110. package/dist/search/components/ViewsColum.js +1 -1
  111. package/dist/search/components/ViewsColumn.css.js +1 -1
  112. package/dist/search/components/_shared.css.js +3 -3
  113. package/dist/search/components/styles.css.js +5 -5
  114. package/dist/state/DiagramActorProvider.js +34 -15
  115. package/dist/state/diagram-machine.d.ts +29 -247
  116. package/dist/state/diagram-machine.js +16 -16
  117. package/dist/styles-min.css +1 -1
  118. package/dist/styles.css +1 -1
  119. package/dist/styles.css2.js +1 -1
  120. package/package.json +10 -8
  121. package/panda.buildinfo.json +254 -326
  122. package/src/LikeC4Diagram.props.ts +2 -2
  123. package/src/LikeC4Diagram.tsx +2 -2
  124. package/src/LikeC4ModelProvider.tsx +4 -4
  125. package/src/LikeC4ProjectsProvider.tsx +41 -0
  126. package/src/LikeC4Styles.tsx +107 -0
  127. package/src/StaticLikeC4Diagram.tsx +3 -3
  128. package/src/base/BaseXYFlow.tsx +24 -29
  129. package/src/base/primitives/MarkdownBlock.tsx +11 -3
  130. package/src/base/primitives/compound/CompoundActionButton.tsx +2 -2
  131. package/src/base/primitives/compound/CompoundDetailsButton.tsx +2 -2
  132. package/src/base/primitives/compound/CompoundNodeContainer.css.ts +4 -13
  133. package/src/base/primitives/compound/CompoundNodeContainer.tsx +0 -3
  134. package/src/base/primitives/compound/CompoundTitle.tsx +8 -8
  135. package/src/base/primitives/compound/actionbtns.css.ts +6 -6
  136. package/src/base/primitives/edge/EdgeActionButton.tsx +2 -2
  137. package/src/base/primitives/edge/EdgeContainer.tsx +3 -6
  138. package/src/base/primitives/edge/EdgeLabel.css.ts +4 -83
  139. package/src/base/primitives/edge/EdgeLabel.tsx +16 -10
  140. package/src/base/primitives/edge/EdgeLabelContainer.tsx +1 -6
  141. package/src/base/primitives/edge/EdgeMarkers.tsx +3 -3
  142. package/src/base/primitives/edge/edge.css.ts +0 -60
  143. package/src/base/primitives/element/ElementActionButtons.tsx +2 -2
  144. package/src/base/primitives/element/ElementDetailsButton.tsx +7 -7
  145. package/src/base/primitives/element/ElementNodeContainer.css.ts +4 -4
  146. package/src/base/primitives/element/ElementNodeContainer.tsx +0 -3
  147. package/src/base/primitives/element/ElementShape.css.ts +11 -11
  148. package/src/base/primitives/element/ElementTags.tsx +17 -14
  149. package/src/bundle/LikeC4View.props.ts +1 -2
  150. package/src/bundle/LikeC4View.tsx +10 -3
  151. package/src/bundle/ReactLikeC4.tsx +1 -2
  152. package/src/bundle/ViewNotFound.tsx +1 -1
  153. package/src/bundle/index.ts +2 -1
  154. package/src/bundle/styles.css.ts +1 -1
  155. package/src/components/ErrorFallback.tsx +1 -1
  156. package/src/components/GithubIcon.tsx +16 -0
  157. package/src/components/Link.tsx +102 -113
  158. package/src/components/NavigationLink.tsx +2 -1
  159. package/src/components/SearchControl.css.ts +5 -5
  160. package/src/context/DiagramEventHandlers.tsx +12 -12
  161. package/src/globals.css +71 -0
  162. package/src/index.ts +5 -0
  163. package/src/likec4diagram/custom/edges/NotePopover.css.ts +2 -2
  164. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +1 -1
  165. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.ts +7 -7
  166. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +3 -3
  167. package/src/likec4diagram/custom/edges/edges.css.ts +4 -4
  168. package/src/likec4diagram/custom/nodes/toolbar/CompoundToolbar.tsx +2 -2
  169. package/src/likec4diagram/ui/controls/styles.css.ts +5 -5
  170. package/src/likec4diagram/ui/notation/NotationPanel.css.ts +11 -11
  171. package/src/likec4diagram/ui/notation/NotationPanel.tsx +1 -4
  172. package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.css.ts +10 -10
  173. package/src/likec4model/LikeC4ProjectsContext.ts +9 -0
  174. package/src/likec4model/index.ts +8 -0
  175. package/src/likec4model/useLikeC4Project.ts +61 -0
  176. package/src/navigationpanel/NavigationPanel.tsx +16 -17
  177. package/src/navigationpanel/NavigationPanelControls.tsx +24 -46
  178. package/src/navigationpanel/NavigationPanelDropdown.tsx +32 -16
  179. package/src/navigationpanel/_common.tsx +4 -1
  180. package/src/navigationpanel/actor.ts +14 -15
  181. package/src/navigationpanel/controls/BurgerButton.tsx +5 -7
  182. package/src/navigationpanel/controls/NavigationButtons.tsx +9 -1
  183. package/src/navigationpanel/controls/OpenSource.tsx +1 -1
  184. package/src/navigationpanel/controls/SearchControl.tsx +6 -4
  185. package/src/navigationpanel/controls/ToggleReadonly.tsx +3 -3
  186. package/src/navigationpanel/controls/ViewDetailsCard.tsx +244 -0
  187. package/src/navigationpanel/controls/index.ts +1 -0
  188. package/src/navigationpanel/dropdown/ProjectsMenu.tsx +74 -0
  189. package/src/navigationpanel/editorpanel/EditorPanel.tsx +3 -3
  190. package/src/navigationpanel/editorpanel/ManualLayoutToolsButton.tsx +19 -22
  191. package/src/navigationpanel/editorpanel/styles.ts +5 -5
  192. package/src/navigationpanel/hooks.tsx +2 -2
  193. package/src/navigationpanel/styles.css.ts +0 -2
  194. package/src/navigationpanel/walkthrough/ActiveWalkthroughControls.tsx +9 -4
  195. package/src/overlays/element-details/ElementDetailsCard.css.ts +17 -17
  196. package/src/overlays/element-details/ElementDetailsCard.tsx +8 -13
  197. package/src/overlays/element-details/TabPanelDeployments.css.ts +4 -4
  198. package/src/overlays/element-details/TabPanelRelationships.css.ts +7 -7
  199. package/src/overlays/overlay/Overlay.css.ts +7 -7
  200. package/src/overlays/relationship-details/SelectEdge.css.ts +8 -8
  201. package/src/overlays/relationships-browser/SelectElement.css.ts +1 -1
  202. package/src/search/Search.tsx +6 -6
  203. package/src/search/components/ElementsColumn.css.ts +5 -5
  204. package/src/search/components/SearchByTags.tsx +2 -2
  205. package/src/search/components/ViewsColum.tsx +1 -1
  206. package/src/search/components/ViewsColumn.css.ts +1 -1
  207. package/src/search/components/_shared.css.ts +3 -3
  208. package/src/search/components/styles.css.ts +5 -5
  209. package/src/state/DiagramActorProvider.tsx +45 -20
  210. package/src/state/diagram-machine.ts +22 -16
  211. package/dist/LikeC4CustomColors.d.ts +0 -2
  212. package/dist/LikeC4CustomColors.js +0 -45
  213. package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +0 -45
  214. package/src/LikeC4CustomColors.tsx +0 -85
@@ -1,119 +1,108 @@
1
1
  import type { Link as LinkData } from '@likec4/core'
2
- import { css, cva, cx } from '@likec4/styles/css'
3
- import { ActionIcon, Anchor, Box, CopyButton, Text } from '@mantine/core'
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 { stopPropagation } from '../utils'
5
+ import { forwardRef } from 'react'
6
+ import { GithubIcon } from './GithubIcon'
6
7
 
7
- const link = cva({
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 titleBox = css({
45
- flex: '1 1 100%',
46
- transition: `transform 100ms {easings.inOut}`,
47
- _groupHover: {
48
- transitionTimingFunction: 'out',
49
- transitionDelay: '50ms',
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
- export function Link({
55
- value,
56
- size = 'md',
57
- }: {
58
- size?: 'sm' | 'md'
59
- value: LinkData
60
- }) {
61
- const isNormalSize = size === 'md'
62
- // If the url is already a full url, use it as is.
63
- // Otherwise, it's a relative url and we need to make it absolute.
64
- const url = value.url.includes('://') ? value.url : new window.URL(value.url, window.location.href).toString()
65
- return (
66
- <CopyButton value={url}>
67
- {({ copied, copy }) => (
68
- <Anchor
69
- href={url}
70
- target="_blank"
71
- underline="never"
72
- className={cx(
73
- 'group',
74
- link({ size }),
75
- )}
76
- onClick={stopPropagation}>
77
- <ActionIcon
78
- className={css({
79
- flex: '0',
80
- })}
81
- tabIndex={-1}
82
- size={isNormalSize ? 24 : 20}
83
- variant={copied ? 'light' : 'subtle'}
84
- color={copied ? 'teal' : 'gray'}
85
- onClick={e => {
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
- </Box>
108
- </Anchor>
109
- )}
110
- </CopyButton>
111
- )
112
- // <Anchor href={value.url} fz={'sm'}>
113
- // {value.title || url}
114
- // </Anchor><Button variant='default' size='sm'>
115
- // {value.title || value.url}
116
- // </Button>
117
- // </Box>
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<React.ComponentPropsWithoutRef<'button'>, keyof NavLinkProps>
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: '4px',
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: '10px',
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 { Any } from '@likec4/core/types'
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 DiagramEventHandlersContextValue = RequiredOrNull<LikeC4DiagramEventHandlers<Any>> & {
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 DiagramEventHandlersContext = createContext<DiagramEventHandlersContextValue>({
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((): DiagramEventHandlersContextValue => ({
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
- <DiagramEventHandlersContext.Provider value={value}>
56
+ <DiagramEventHandlersReactContext.Provider value={value}>
57
57
  {children}
58
- </DiagramEventHandlersContext.Provider>
58
+ </DiagramEventHandlersReactContext.Provider>
59
59
  )
60
60
  }
61
61
 
62
- export function useDiagramEventHandlers() {
63
- return useContext(DiagramEventHandlersContext)
62
+ export function useDiagramEventHandlers(): DiagramEventHandlersContext {
63
+ return useContext(DiagramEventHandlersReactContext)
64
64
  }
65
65
 
66
- export function useDiagramEventHandlersRef() {
67
- return useContext(DiagramEventHandlersContext).handlersRef
66
+ export function useDiagramEventHandlersRef<A extends aux.Any = aux.Any>(): RefObject<LikeC4DiagramEventHandlers<A>> {
67
+ return useContext(DiagramEventHandlersReactContext).handlersRef
68
68
  }
@@ -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
@@ -17,6 +17,11 @@ export {
17
17
  type LikeC4ModelProviderProps,
18
18
  } from './LikeC4ModelProvider'
19
19
 
20
+ export {
21
+ LikeC4ProjectsProvider,
22
+ type LikeC4ProjectsProviderProps,
23
+ } from './LikeC4ProjectsProvider'
24
+
20
25
  export * from './custom/hooks'
21
26
 
22
27
  export type {
@@ -3,8 +3,8 @@ import { css } from '@likec4/styles/css'
3
3
 
4
4
  export const edgeNoteCloseButton = css({
5
5
  position: 'absolute',
6
- top: 1,
7
- right: 1,
6
+ top: '[1px]',
7
+ right: '[1px]',
8
8
  zIndex: 9,
9
9
  })
10
10
 
@@ -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: 4,
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: 2,
20
- background: `likec4.palette.fill/30`,
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, {colors.likec4.palette.stroke}, {colors.likec4.mixColor} 60%)]`,
25
- _dark: 'likec4.palette.loContrast',
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.palette.fill/60`,
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 { css, cx } from '@likec4/styles/css'
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" className={cx(css({ likec4Palette: sourceNode.color }), styles.endpoint)}>
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" className={cx(css({ likec4Palette: targetNode.color }), styles.endpoint)}>
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.relation.stroke`,
16
- stroke: `likec4.relation.stroke`,
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',
@@ -105,8 +105,8 @@ function BorderStyleOption({
105
105
  }}
106
106
  styles={{
107
107
  label: {
108
- paddingTop: 2,
109
- paddingBottom: 2,
108
+ paddingTop: '0.5',
109
+ paddingBottom: '0.5',
110
110
  },
111
111
  }}
112
112
  data={[
@@ -1,16 +1,16 @@
1
1
  import { css } from '@likec4/styles/css'
2
2
 
3
3
  export const navigationButtons = css({
4
- gap: 'micro',
4
+ gap: 'xxs',
5
5
  _empty: {
6
6
  display: 'none',
7
7
  },
8
8
  })
9
9
 
10
10
  export const panel = css({
11
- top: '1rem',
12
- left: '1rem',
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: 8,
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: '2xs',
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.palette.fill',
73
- stroke: 'likec4.palette.stroke',
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']: '{colors.likec4.palette.fill}',
98
- ['--badge-color']: '{colors.likec4.palette.hiContrast}',
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 { css, cx, cx as clsx } from '@likec4/styles/css'
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: '0.5rem',
7
- left: '50%',
6
+ bottom: 'xxs',
7
+ left: '[50%]',
8
8
  transform: 'translateX(-50%)',
9
- padding: 0,
10
- margin: 0,
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`,