@likec4/diagram 1.35.0 → 1.36.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/bundle/{chunk-C0Eg81Gj.js → chunk-DHvr-RGh.js} +323 -311
  2. package/bundle/custom.js +52 -52
  3. package/bundle/index.js +1594 -749
  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/DiagramUI.js +2 -1
  59. package/dist/likec4diagram/custom/edges/NotePopover.css.js +2 -2
  60. package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +2 -2
  61. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +1 -1
  62. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.js +7 -7
  63. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +3 -3
  64. package/dist/likec4diagram/custom/edges/edges.css.js +4 -4
  65. package/dist/likec4diagram/custom/index.d.ts +2 -2
  66. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +2 -2
  67. package/dist/likec4diagram/ui/controls/styles.css.js +5 -5
  68. package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +4 -4
  69. package/dist/likec4diagram/ui/notation/NotationPanel.css.js +11 -11
  70. package/dist/likec4diagram/ui/notation/NotationPanel.js +2 -5
  71. package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.css.js +10 -10
  72. package/dist/likec4model/LikeC4ModelContext.d.ts +2 -1
  73. package/dist/likec4model/LikeC4ModelContext.js +10 -2
  74. package/dist/likec4model/LikeC4ProjectsContext.d.ts +7 -0
  75. package/dist/likec4model/LikeC4ProjectsContext.js +5 -0
  76. package/dist/likec4model/index.d.ts +1 -0
  77. package/dist/likec4model/useCurrentViewModel.d.ts +1 -0
  78. package/dist/likec4model/useCurrentViewModel.js +4 -1
  79. package/dist/likec4model/useLikeC4Project.d.ts +22 -0
  80. package/dist/likec4model/useLikeC4Project.js +23 -0
  81. package/dist/navigationpanel/NavigationPanel.js +15 -17
  82. package/dist/navigationpanel/NavigationPanelControls.js +34 -21
  83. package/dist/navigationpanel/NavigationPanelDropdown.js +33 -17
  84. package/dist/navigationpanel/_common.js +4 -1
  85. package/dist/navigationpanel/actor.d.ts +11 -15
  86. package/dist/navigationpanel/actor.js +14 -15
  87. package/dist/navigationpanel/controls/BurgerButton.js +5 -7
  88. package/dist/navigationpanel/controls/NavigationButtons.js +37 -24
  89. package/dist/navigationpanel/controls/OpenSource.js +1 -1
  90. package/dist/navigationpanel/controls/SearchControl.js +6 -4
  91. package/dist/navigationpanel/controls/ToggleReadonly.js +3 -3
  92. package/dist/navigationpanel/controls/ViewDetailsCard.d.ts +2 -0
  93. package/dist/navigationpanel/controls/ViewDetailsCard.js +232 -0
  94. package/dist/navigationpanel/controls/index.d.ts +1 -0
  95. package/dist/navigationpanel/dropdown/ProjectsMenu.d.ts +2 -0
  96. package/dist/navigationpanel/dropdown/ProjectsMenu.js +75 -0
  97. package/dist/navigationpanel/editorpanel/EditorPanel.js +3 -3
  98. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +19 -20
  99. package/dist/navigationpanel/editorpanel/styles.js +5 -5
  100. package/dist/navigationpanel/hooks.d.ts +2 -2
  101. package/dist/navigationpanel/styles.css.js +0 -2
  102. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +12 -7
  103. 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
  104. 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
  105. package/dist/overlays/element-details/ElementDetailsCard.css.js +18 -17
  106. package/dist/overlays/element-details/ElementDetailsCard.js +8 -13
  107. package/dist/overlays/element-details/TabPanelDeployments.css.js +5 -4
  108. package/dist/overlays/element-details/TabPanelRelationships.css.js +7 -7
  109. package/dist/overlays/overlay/Overlay.css.d.ts +3 -3
  110. package/dist/overlays/overlay/Overlay.css.js +8 -7
  111. package/dist/overlays/relationship-details/SelectEdge.css.js +8 -8
  112. package/dist/overlays/relationships-browser/SelectElement.css.js +1 -1
  113. package/dist/search/Search.js +6 -6
  114. package/dist/search/components/ElementsColumn.css.js +5 -5
  115. package/dist/search/components/SearchByTags.js +3 -2
  116. package/dist/search/components/ViewsColum.js +1 -1
  117. package/dist/search/components/ViewsColumn.css.js +1 -1
  118. package/dist/search/components/_shared.css.js +3 -3
  119. package/dist/search/components/styles.css.js +5 -5
  120. package/dist/state/DiagramActorProvider.js +43 -25
  121. package/dist/state/diagram-machine.d.ts +29 -247
  122. package/dist/state/diagram-machine.js +16 -16
  123. package/dist/styles-min.css +1 -1
  124. package/dist/styles.css +1 -1
  125. package/dist/styles.css2.js +1 -1
  126. package/package.json +10 -8
  127. package/panda.buildinfo.json +254 -326
  128. package/src/LikeC4Diagram.props.ts +2 -2
  129. package/src/LikeC4Diagram.tsx +2 -2
  130. package/src/LikeC4ModelProvider.tsx +4 -4
  131. package/src/LikeC4ProjectsProvider.tsx +41 -0
  132. package/src/LikeC4Styles.tsx +107 -0
  133. package/src/StaticLikeC4Diagram.tsx +3 -3
  134. package/src/base/BaseXYFlow.tsx +24 -29
  135. package/src/base/primitives/MarkdownBlock.tsx +11 -3
  136. package/src/base/primitives/compound/CompoundActionButton.tsx +2 -2
  137. package/src/base/primitives/compound/CompoundDetailsButton.tsx +2 -2
  138. package/src/base/primitives/compound/CompoundNodeContainer.css.ts +4 -13
  139. package/src/base/primitives/compound/CompoundNodeContainer.tsx +0 -3
  140. package/src/base/primitives/compound/CompoundTitle.tsx +8 -8
  141. package/src/base/primitives/compound/actionbtns.css.ts +6 -6
  142. package/src/base/primitives/edge/EdgeActionButton.tsx +2 -2
  143. package/src/base/primitives/edge/EdgeContainer.tsx +3 -6
  144. package/src/base/primitives/edge/EdgeLabel.css.ts +4 -83
  145. package/src/base/primitives/edge/EdgeLabel.tsx +16 -10
  146. package/src/base/primitives/edge/EdgeLabelContainer.tsx +1 -6
  147. package/src/base/primitives/edge/EdgeMarkers.tsx +3 -3
  148. package/src/base/primitives/edge/edge.css.ts +0 -60
  149. package/src/base/primitives/element/ElementActionButtons.tsx +2 -2
  150. package/src/base/primitives/element/ElementDetailsButton.tsx +7 -7
  151. package/src/base/primitives/element/ElementNodeContainer.css.ts +4 -4
  152. package/src/base/primitives/element/ElementNodeContainer.tsx +0 -3
  153. package/src/base/primitives/element/ElementShape.css.ts +11 -11
  154. package/src/base/primitives/element/ElementTags.tsx +17 -14
  155. package/src/bundle/LikeC4View.props.ts +1 -2
  156. package/src/bundle/LikeC4View.tsx +10 -3
  157. package/src/bundle/ReactLikeC4.tsx +1 -2
  158. package/src/bundle/ViewNotFound.tsx +1 -1
  159. package/src/bundle/index.ts +2 -1
  160. package/src/bundle/styles.css.ts +1 -1
  161. package/src/components/ErrorFallback.tsx +1 -1
  162. package/src/components/GithubIcon.tsx +16 -0
  163. package/src/components/Link.tsx +102 -113
  164. package/src/components/NavigationLink.tsx +2 -1
  165. package/src/components/SearchControl.css.ts +5 -5
  166. package/src/context/DiagramEventHandlers.tsx +12 -12
  167. package/src/globals.css +71 -0
  168. package/src/index.ts +5 -0
  169. package/src/likec4diagram/DiagramUI.tsx +8 -2
  170. package/src/likec4diagram/custom/edges/NotePopover.css.ts +2 -2
  171. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +1 -1
  172. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.ts +7 -7
  173. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +3 -3
  174. package/src/likec4diagram/custom/edges/edges.css.ts +4 -4
  175. package/src/likec4diagram/custom/nodes/toolbar/CompoundToolbar.tsx +2 -2
  176. package/src/likec4diagram/ui/controls/styles.css.ts +5 -5
  177. package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +4 -5
  178. package/src/likec4diagram/ui/notation/NotationPanel.css.ts +11 -11
  179. package/src/likec4diagram/ui/notation/NotationPanel.tsx +1 -4
  180. package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.css.ts +10 -10
  181. package/src/likec4model/{LikeC4ModelContext.ts → LikeC4ModelContext.tsx} +9 -1
  182. package/src/likec4model/LikeC4ProjectsContext.ts +9 -0
  183. package/src/likec4model/index.ts +8 -0
  184. package/src/likec4model/useCurrentViewModel.ts +4 -0
  185. package/src/likec4model/useLikeC4Project.ts +61 -0
  186. package/src/navigationpanel/NavigationPanel.tsx +16 -17
  187. package/src/navigationpanel/NavigationPanelControls.tsx +24 -46
  188. package/src/navigationpanel/NavigationPanelDropdown.tsx +32 -16
  189. package/src/navigationpanel/_common.tsx +4 -1
  190. package/src/navigationpanel/actor.ts +14 -15
  191. package/src/navigationpanel/controls/BurgerButton.tsx +5 -7
  192. package/src/navigationpanel/controls/NavigationButtons.tsx +9 -1
  193. package/src/navigationpanel/controls/OpenSource.tsx +1 -1
  194. package/src/navigationpanel/controls/SearchControl.tsx +6 -4
  195. package/src/navigationpanel/controls/ToggleReadonly.tsx +3 -3
  196. package/src/navigationpanel/controls/ViewDetailsCard.tsx +244 -0
  197. package/src/navigationpanel/controls/index.ts +1 -0
  198. package/src/navigationpanel/dropdown/ProjectsMenu.tsx +74 -0
  199. package/src/navigationpanel/editorpanel/EditorPanel.tsx +3 -3
  200. package/src/navigationpanel/editorpanel/ManualLayoutToolsButton.tsx +19 -22
  201. package/src/navigationpanel/editorpanel/styles.ts +5 -5
  202. package/src/navigationpanel/hooks.tsx +2 -2
  203. package/src/navigationpanel/styles.css.ts +0 -2
  204. package/src/navigationpanel/walkthrough/ActiveWalkthroughControls.tsx +9 -4
  205. package/src/overlays/element-details/ElementDetailsCard.css.ts +17 -17
  206. package/src/overlays/element-details/ElementDetailsCard.tsx +8 -13
  207. package/src/overlays/element-details/TabPanelDeployments.css.ts +4 -4
  208. package/src/overlays/element-details/TabPanelRelationships.css.ts +7 -7
  209. package/src/overlays/overlay/Overlay.css.ts +7 -7
  210. package/src/overlays/relationship-details/SelectEdge.css.ts +8 -8
  211. package/src/overlays/relationships-browser/SelectElement.css.ts +1 -1
  212. package/src/search/Search.tsx +6 -6
  213. package/src/search/components/ElementsColumn.css.ts +5 -5
  214. package/src/search/components/SearchByTags.tsx +2 -2
  215. package/src/search/components/ViewsColum.tsx +1 -1
  216. package/src/search/components/ViewsColumn.css.ts +1 -1
  217. package/src/search/components/_shared.css.ts +3 -3
  218. package/src/search/components/styles.css.ts +5 -5
  219. package/src/state/DiagramActorProvider.tsx +56 -30
  220. package/src/state/diagram-machine.ts +22 -16
  221. package/dist/LikeC4CustomColors.d.ts +0 -2
  222. package/dist/LikeC4CustomColors.js +0 -45
  223. package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +0 -45
  224. package/src/LikeC4CustomColors.tsx +0 -85
@@ -1,108 +1,105 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { cx, css, cva } from '@likec4/styles/css';
3
- import { CopyButton, Anchor, ActionIcon, Box, Text } from '@mantine/core';
4
- import { stopPropagation } from '../utils/xyflow.js';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { css, cx } from '@likec4/styles/css';
3
+ import { Badge, CopyButton, ActionIcon } from '@mantine/core';
4
+ import { forwardRef } from 'react';
5
+ import { GithubIcon } from './GithubIcon.js';
5
6
  import IconCheck from '../node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js';
6
7
  import IconCopy from '../node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js';
7
8
 
8
- const link = cva({
9
- base: {
10
- display: "flex",
11
- overflow: "hidden",
12
- alignItems: "center",
13
- gap: "micro",
14
- justifyContent: "stretch",
15
- transitionProperty: "all",
16
- transitionDuration: "fast",
17
- transitionTimingFunction: "inOut",
18
- border: `1px dashed {colors.mantine.colors.defaultBorder}`,
19
- rounded: "sm",
20
- cursor: "pointer",
21
- color: "mantine.colors.gray[7]",
22
- _dark: {
23
- color: "mantine.colors.dark[1]"
24
- },
25
- _hover: {
26
- transitionTimingFunction: "out",
27
- color: "mantine.colors.defaultColor",
28
- background: "mantine.colors.defaultHover"
29
- }
30
- },
31
- variants: {
32
- size: {
33
- sm: {
34
- minHeight: "22px",
35
- padding: "2px 8px 2px 2px"
36
- },
37
- md: {
38
- minHeight: "30px",
39
- padding: "3px 16px 3px 3px"
40
- }
41
- }
42
- }
43
- });
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
- });
53
- function Link({
54
- value,
55
- size = "md"
56
- }) {
57
- const isNormalSize = size === "md";
58
- const url = value.url.includes("://") ? value.url : new window.URL(value.url, window.location.href).toString();
59
- return /* @__PURE__ */ jsx(CopyButton, { value: url, children: ({ copied, copy }) => /* @__PURE__ */ jsxs(
60
- Anchor,
61
- {
62
- href: url,
63
- target: "_blank",
64
- underline: "never",
65
- className: cx(
66
- "group",
67
- link({ size })
68
- ),
69
- onClick: stopPropagation,
70
- children: [
71
- /* @__PURE__ */ jsx(
9
+ const GITHUB_PREFIX = "https://github.com/";
10
+ const Link = forwardRef(
11
+ ({ value, className, ...props }, ref) => {
12
+ const url = value.url.includes("://") ? value.url : new window.URL(value.url, window.location.href).toString();
13
+ let isGithub = url.startsWith(GITHUB_PREFIX);
14
+ return /* @__PURE__ */ jsx(
15
+ Badge,
16
+ {
17
+ ref,
18
+ variant: "default",
19
+ radius: "sm",
20
+ size: "sm",
21
+ tt: "none",
22
+ leftSection: value.title ? /* @__PURE__ */ jsx(Fragment, { children: value.title }) : null,
23
+ rightSection: /* @__PURE__ */ jsx(CopyButton, { value: url, timeout: 1500, children: ({ copy, copied }) => /* @__PURE__ */ jsx(
72
24
  ActionIcon,
73
25
  {
74
26
  className: css({
75
- flex: "0"
27
+ opacity: copied ? 1 : 0.45,
28
+ transition: "fast",
29
+ _hover: {
30
+ opacity: 1
31
+ }
76
32
  }),
77
33
  tabIndex: -1,
78
- size: isNormalSize ? 24 : 20,
79
- variant: copied ? "light" : "subtle",
34
+ size: "20",
35
+ variant: copied ? "light" : "transparent",
80
36
  color: copied ? "teal" : "gray",
37
+ "data-active": copied,
81
38
  onClick: (e) => {
82
39
  e.stopPropagation();
83
40
  e.preventDefault();
84
41
  copy();
85
42
  },
86
- children: copied ? /* @__PURE__ */ jsx(IconCheck, {}) : /* @__PURE__ */ jsx(IconCopy, { style: { width: "65%", opacity: 0.65 } })
43
+ children: copied ? /* @__PURE__ */ jsx(IconCheck, {}) : /* @__PURE__ */ jsx(IconCopy, { stroke: 2.5 })
87
44
  }
88
- ),
89
- /* @__PURE__ */ jsxs(Box, { className: titleBox, children: [
90
- /* @__PURE__ */ jsx(
91
- Text,
45
+ ) }),
46
+ ...props,
47
+ className: cx(className, "group"),
48
+ classNames: {
49
+ root: css({
50
+ flexWrap: "nowrap",
51
+ minHeight: 24,
52
+ maxWidth: 500,
53
+ userSelect: "all",
54
+ pr: "0",
55
+ _hover: {
56
+ backgroundColor: {
57
+ base: "mantine.colors.gray[1]",
58
+ _dark: "mantine.colors.dark[5]"
59
+ }
60
+ }
61
+ }),
62
+ section: css({
63
+ '&:is([data-position="left"])': {
64
+ color: "mantine.colors.dimmed",
65
+ userSelect: "none",
66
+ pointerEvents: "none",
67
+ _groupHover: {
68
+ color: "[inherit]",
69
+ opacity: 0.7
70
+ }
71
+ }
72
+ }),
73
+ label: css({
74
+ "& > a": {
75
+ color: "[inherit]",
76
+ cursor: "pointer",
77
+ transition: "fast",
78
+ opacity: {
79
+ base: 0.7,
80
+ _hover: 1
81
+ },
82
+ textDecoration: {
83
+ base: "none",
84
+ _hover: "underline"
85
+ }
86
+ }
87
+ })
88
+ },
89
+ children: /* @__PURE__ */ jsxs("a", { href: url, target: "_blank", children: [
90
+ isGithub && /* @__PURE__ */ jsx(
91
+ GithubIcon,
92
92
  {
93
- component: "div",
94
- fz: isNormalSize ? "xs" : 11,
95
- truncate: true,
96
- lh: isNormalSize ? 1.3 : 1.2,
97
- fw: value.title ? 500 : 400,
98
- children: value.title || url
93
+ height: "12",
94
+ width: "12",
95
+ style: { verticalAlign: "middle", marginRight: "4px" }
99
96
  }
100
97
  ),
101
- value.title && /* @__PURE__ */ jsx(Text, { component: "div", fz: isNormalSize ? 10 : 9, c: "dimmed", lh: isNormalSize ? 1.2 : 1.1, truncate: true, children: url })
98
+ isGithub ? url.replace(GITHUB_PREFIX, "") : url
102
99
  ] })
103
- ]
104
- }
105
- ) });
106
- }
100
+ }
101
+ );
102
+ }
103
+ );
107
104
 
108
105
  export { Link };
@@ -1,6 +1,6 @@
1
1
  import { NavLinkProps } from '@mantine/core';
2
- import { ForwardRefExoticComponent, RefAttributes } from 'react';
3
- export interface NavigationLinkProps extends NavLinkProps, Omit<React.ComponentPropsWithoutRef<'button'>, keyof NavLinkProps> {
2
+ import { ComponentPropsWithoutRef, ForwardRefExoticComponent, RefAttributes } from 'react';
3
+ export interface NavigationLinkProps extends Omit<NavLinkProps, 'classNames'>, Omit<ComponentPropsWithoutRef<'button'>, keyof NavLinkProps> {
4
4
  truncateLabel?: boolean;
5
5
  }
6
6
  export declare const NavigationLink: ForwardRefExoticComponent<NavigationLinkProps & RefAttributes<HTMLButtonElement>>;
@@ -3,7 +3,7 @@ import { css } from '@likec4/styles/css';
3
3
  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)',
@@ -39,21 +39,22 @@ const placeholder = css({
39
39
  fontSize: "sm",
40
40
  // mantine.fontSizes.sm,
41
41
  fontWeight: 500,
42
- paddingRight: "10px",
42
+ paddingRight: "2.5",
43
+ // 10px
43
44
  color: "mantine.colors.placeholder",
44
45
  flex: "1",
45
46
  sm: {
46
- paddingRight: "30px"
47
+ paddingRight: "[30px]"
47
48
  },
48
49
  md: {
49
- paddingRight: "50px"
50
+ paddingRight: "[50px]"
50
51
  }
51
52
  });
52
53
  const shortcut = css({
53
54
  fontSize: "11px",
54
55
  fontWeight: 600,
55
56
  lineHeight: 1,
56
- padding: "4px 7px",
57
+ padding: "[4px 7px]",
57
58
  borderRadius: "sm",
58
59
  border: "1px solid",
59
60
  transition: "fast",
@@ -1,15 +1,15 @@
1
- import { Any } from '@likec4/core/types';
1
+ import { aux } from '@likec4/core/types';
2
2
  import { PropsWithChildren, RefObject } from 'react';
3
3
  import { LikeC4DiagramEventHandlers } from '../LikeC4Diagram.props';
4
4
  type RequiredOrNull<T> = {
5
5
  [P in keyof T]-?: NonNullable<T[P]> | null;
6
6
  };
7
- type DiagramEventHandlersContextValue = RequiredOrNull<LikeC4DiagramEventHandlers<Any>> & {
8
- handlersRef: RefObject<LikeC4DiagramEventHandlers<Any>>;
7
+ export type DiagramEventHandlersContext = RequiredOrNull<LikeC4DiagramEventHandlers<aux.Any>> & {
8
+ handlersRef: RefObject<LikeC4DiagramEventHandlers<aux.Any>>;
9
9
  };
10
- export declare function DiagramEventHandlers<A extends Any>({ handlers, children, }: PropsWithChildren<{
10
+ export declare function DiagramEventHandlers<A extends aux.Any>({ handlers, children, }: PropsWithChildren<{
11
11
  handlers: LikeC4DiagramEventHandlers<A>;
12
12
  }>): import("react/jsx-runtime").JSX.Element;
13
- export declare function useDiagramEventHandlers(): DiagramEventHandlersContextValue;
14
- export declare function useDiagramEventHandlersRef(): RefObject<LikeC4DiagramEventHandlers<Any>>;
13
+ export declare function useDiagramEventHandlers(): DiagramEventHandlersContext;
14
+ export declare function useDiagramEventHandlersRef<A extends aux.Any = aux.Any>(): RefObject<LikeC4DiagramEventHandlers<A>>;
15
15
  export {};
@@ -16,7 +16,7 @@ const HandlerNames = [
16
16
  "onChange",
17
17
  "onCanvasDblClick"
18
18
  ];
19
- const DiagramEventHandlersContext = createContext({
19
+ const DiagramEventHandlersReactContext = createContext({
20
20
  ...mapToObj(HandlerNames, (name) => [name, null]),
21
21
  handlersRef: {
22
22
  current: {}
@@ -37,13 +37,10 @@ function DiagramEventHandlers({
37
37
  }),
38
38
  handlersRef
39
39
  }), [handlersRef, ...deps]);
40
- return /* @__PURE__ */ jsx(DiagramEventHandlersContext.Provider, { value, children });
40
+ return /* @__PURE__ */ jsx(DiagramEventHandlersReactContext.Provider, { value, children });
41
41
  }
42
42
  function useDiagramEventHandlers() {
43
- return useContext(DiagramEventHandlersContext);
44
- }
45
- function useDiagramEventHandlersRef() {
46
- return useContext(DiagramEventHandlersContext).handlersRef;
43
+ return useContext(DiagramEventHandlersReactContext);
47
44
  }
48
45
 
49
- export { DiagramEventHandlers, useDiagramEventHandlers, useDiagramEventHandlersRef };
46
+ export { DiagramEventHandlers, useDiagramEventHandlers };
@@ -0,0 +1,3 @@
1
+ const globalsCss = ".likec4-root{overflow:hidden;position:relative;padding:0;margin:0;width:100%;height:100%;border:0px solid transparent;container-name:likec4-root;container-type:size}.likec4-root .react-flow:is(.not-initialized){opacity:0}:where(.likec4-root .mantine-ActionIcon-icon) .tabler-icon{width:75%;height:75%}.likec4-root :where(.react-flow__node,.react-flow__edge,.likec4-edge-label-container):has([data-likec4-dimmed]){opacity:.25}.likec4-root:not([data-likec4-reduced-graphics]) :where(.react-flow__node,.react-flow__edge,.likec4-edge-label-container):has([data-likec4-dimmed]){filter:grayscale(85%) blur(3px)}.likec4-root:not([data-likec4-reduced-graphics]) :where(.react-flow__node,.react-flow__edge,.likec4-edge-label-container):has([data-likec4-dimmed=true]){transition-property:opacity,filter;transition-timing-function:cubic-bezier(.5,0,.2,1);transition-duration:.6s}[data-mantine-color-scheme=dark] .likec4-root:not([data-likec4-reduced-graphics]) :where(.react-flow__edges,.react-flow__edgelabel-renderer)>svg{mix-blend-mode:plus-lighter}[data-mantine-color-scheme=light] .likec4-root:not([data-likec4-reduced-graphics]) :where(.react-flow__edges,.react-flow__edgelabel-renderer)>svg{mix-blend-mode:screen}.likec4-root :where(.likec4-edge-container,.likec4-edge-label-container){--xy-edge-stroke-width: 3;--xy-edge-stroke: var(--likec4-palette-relation-stroke);--xy-edge-stroke-selected: var(--likec4-palette-relation-stroke-selected);--xy-edge-label-color: var(--likec4-palette-relation-label);--xy-edge-label-background-color: var(--likec4-palette-relation-label-bg)}.likec4-root :where(.likec4-edge-container,.likec4-edge-label-container):is([data-likec4-hovered=true],[data-edge-active=true]){--xy-edge-stroke-width: 4;--xy-edge-stroke: var(--likec4-palette-relation-stroke-selected)}[data-mantine-color-scheme=dark] .likec4-root :where(.likec4-edge-container,.likec4-edge-label-container){--xy-edge-label-background-color: color-mix(in srgb, var(--likec4-palette-relation-label-bg) 50%, transparent)}[data-mantine-color-scheme=light] .likec4-root :where(.likec4-edge-container,.likec4-edge-label-container){--xy-edge-label-color: color-mix(in srgb, var(--likec4-palette-relation-label), rgba(255 255 255 / .85) 40%);--xy-edge-label-background-color: color-mix(in srgb, var(--likec4-palette-relation-label-bg) 60%, transparent)}";
2
+
3
+ export { globalsCss as default };
@@ -3,7 +3,7 @@ import { Types } from '../likec4diagram/types';
3
3
  import { EdgeMarkerType, HandleType, XYPosition } from '@xyflow/system';
4
4
  import { ReactNode, CSSProperties } from 'react';
5
5
  import { Dimmed } from '../base/types.Base';
6
- import { EdgeId, NonEmptyArray, Point, Color, RelationshipArrowType, RelationshipLineType, BBox, ViewId } from '@likec4/core';
6
+ import { EdgeId, NonEmptyArray, Point, Color, RelationshipArrowType, RelationshipLineType, BBox, ViewId, MarkdownOrString } from '@likec4/core';
7
7
  export declare const useXYFlow: () => ReactFlowInstance<Types.Node, {
8
8
  id: string;
9
9
  source: string;
@@ -46,7 +46,7 @@ export declare const useXYFlow: () => ReactFlowInstance<Types.Node, {
46
46
  tail: RelationshipArrowType | undefined;
47
47
  labelBBox: BBox | null | undefined;
48
48
  navigateTo: ViewId<string> | null | undefined;
49
- notes: string | undefined;
49
+ notes: MarkdownOrString | undefined;
50
50
  labelXY: XYPosition | null;
51
51
  controlPoints: XYPosition[] | undefined | null;
52
52
  };
@@ -96,7 +96,7 @@ export declare const useXYStoreApi: () => {
96
96
  tail: RelationshipArrowType | undefined;
97
97
  labelBBox: BBox | null | undefined;
98
98
  navigateTo: ViewId<string> | null | undefined;
99
- notes: string | undefined;
99
+ notes: MarkdownOrString | undefined;
100
100
  labelXY: XYPosition | null;
101
101
  controlPoints: XYPosition[] | undefined | null;
102
102
  };
@@ -143,7 +143,7 @@ export declare const useXYStoreApi: () => {
143
143
  tail: RelationshipArrowType | undefined;
144
144
  labelBBox: BBox | null | undefined;
145
145
  navigateTo: ViewId<string> | null | undefined;
146
- notes: string | undefined;
146
+ notes: MarkdownOrString | undefined;
147
147
  labelXY: XYPosition | null;
148
148
  controlPoints: XYPosition[] | undefined | null;
149
149
  };
@@ -189,7 +189,7 @@ export declare const useXYStoreApi: () => {
189
189
  tail: RelationshipArrowType | undefined;
190
190
  labelBBox: BBox | null | undefined;
191
191
  navigateTo: ViewId<string> | null | undefined;
192
- notes: string | undefined;
192
+ notes: MarkdownOrString | undefined;
193
193
  labelXY: XYPosition | null;
194
194
  controlPoints: XYPosition[] | undefined | null;
195
195
  };
@@ -235,7 +235,7 @@ export declare const useXYStoreApi: () => {
235
235
  tail: RelationshipArrowType | undefined;
236
236
  labelBBox: BBox | null | undefined;
237
237
  navigateTo: ViewId<string> | null | undefined;
238
- notes: string | undefined;
238
+ notes: MarkdownOrString | undefined;
239
239
  labelXY: XYPosition | null;
240
240
  controlPoints: XYPosition[] | undefined | null;
241
241
  };
@@ -281,7 +281,7 @@ export declare const useXYStoreApi: () => {
281
281
  tail: RelationshipArrowType | undefined;
282
282
  labelBBox: BBox | null | undefined;
283
283
  navigateTo: ViewId<string> | null | undefined;
284
- notes: string | undefined;
284
+ notes: MarkdownOrString | undefined;
285
285
  labelXY: XYPosition | null;
286
286
  controlPoints: XYPosition[] | undefined | null;
287
287
  };
@@ -327,7 +327,7 @@ export declare const useXYStoreApi: () => {
327
327
  tail: RelationshipArrowType | undefined;
328
328
  labelBBox: BBox | null | undefined;
329
329
  navigateTo: ViewId<string> | null | undefined;
330
- notes: string | undefined;
330
+ notes: MarkdownOrString | undefined;
331
331
  labelXY: XYPosition | null;
332
332
  controlPoints: XYPosition[] | undefined | null;
333
333
  };
@@ -374,7 +374,7 @@ export declare const useXYStoreApi: () => {
374
374
  tail: RelationshipArrowType | undefined;
375
375
  labelBBox: BBox | null | undefined;
376
376
  navigateTo: ViewId<string> | null | undefined;
377
- notes: string | undefined;
377
+ notes: MarkdownOrString | undefined;
378
378
  labelXY: XYPosition | null;
379
379
  controlPoints: XYPosition[] | undefined | null;
380
380
  };
@@ -420,7 +420,7 @@ export declare const useXYStoreApi: () => {
420
420
  tail: RelationshipArrowType | undefined;
421
421
  labelBBox: BBox | null | undefined;
422
422
  navigateTo: ViewId<string> | null | undefined;
423
- notes: string | undefined;
423
+ notes: MarkdownOrString | undefined;
424
424
  labelXY: XYPosition | null;
425
425
  controlPoints: XYPosition[] | undefined | null;
426
426
  };
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { IconRendererProvider } from './context/IconRenderer';
4
4
  export { LikeC4Diagram, type LikeC4DiagramProps, } from './LikeC4Diagram';
5
5
  export { Overlay, type OverlayProps, } from './overlays/overlay/Overlay';
6
6
  export { LikeC4ModelProvider, type LikeC4ModelProviderProps, } from './LikeC4ModelProvider';
7
+ export { LikeC4ProjectsProvider, type LikeC4ProjectsProviderProps, } from './LikeC4ProjectsProvider';
7
8
  export * from './custom/hooks';
8
9
  export type { ChangeEvent, CustomNodes, DiagramNodeWithNavigate, ElementIconRenderer, LikeC4ColorScheme, LikeC4DiagramEventHandlers, LikeC4DiagramProperties, OnCanvasClick, OnChange, OnEdgeClick, OnNavigateTo, OnNodeClick, OpenSourceParams, PaddingUnit, PaddingWithUnit, WhereOperator, } from './LikeC4Diagram.props';
9
10
  export { StaticLikeC4Diagram, type StaticLikeC4DiagramProps, } from './StaticLikeC4Diagram';
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ export { IconRendererProvider } from './context/IconRenderer.js';
3
3
  export { LikeC4Diagram } from './LikeC4Diagram.js';
4
4
  export { Overlay } from './overlays/overlay/Overlay.js';
5
5
  export { LikeC4ModelProvider } from './LikeC4ModelProvider.js';
6
+ export { LikeC4ProjectsProvider } from './LikeC4ProjectsProvider.js';
6
7
  export { StaticLikeC4Diagram } from './StaticLikeC4Diagram.js';
7
8
  export { useDiagramEventHandlers } from './context/DiagramEventHandlers.js';
8
9
  export { useEnabledFeatures } from './context/DiagramFeatures.js';
@@ -2,6 +2,7 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import { memo } from 'react';
3
3
  import { useOverlaysActorRef } from '../hooks/useOverlaysActor.js';
4
4
  import { useSearchActorRef } from '../hooks/useSearchActor.js';
5
+ import { EnsureCurrentViewModel } from '../likec4model/LikeC4ModelContext.js';
5
6
  import { Overlays } from '../overlays/Overlays.js';
6
7
  import { Search } from '../search/Search.js';
7
8
  import { useEnabledFeatures } from '../context/DiagramFeatures.js';
@@ -22,7 +23,7 @@ const DiagramUI = memo(() => {
22
23
  const overlaysActorRef = useOverlaysActorRef();
23
24
  const searchActorRef = useSearchActorRef();
24
25
  return /* @__PURE__ */ jsxs(Fragment, { children: [
25
- enableControls === "next" ? /* @__PURE__ */ jsx(NavigationPanel, {}) : /* @__PURE__ */ jsx(Controls, {}),
26
+ enableControls === "next" ? /* @__PURE__ */ jsx(EnsureCurrentViewModel, { children: /* @__PURE__ */ jsx(NavigationPanel, {}) }) : /* @__PURE__ */ jsx(Controls, {}),
26
27
  overlaysActorRef && /* @__PURE__ */ jsx(Overlays, { overlaysActorRef }),
27
28
  enableNotations && /* @__PURE__ */ jsx(NotationPanel, {}),
28
29
  enableControls !== "next" && /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -2,8 +2,8 @@ import { css } from '@likec4/styles/css';
2
2
 
3
3
  const edgeNoteCloseButton = css({
4
4
  position: "absolute",
5
- top: 1,
6
- right: 1,
5
+ top: "[1px]",
6
+ right: "[1px]",
7
7
  zIndex: 9
8
8
  });
9
9
  const edgeNoteText = css({
@@ -1,4 +1,4 @@
1
- import { EdgeId, NonEmptyArray, Point, Color, RelationshipArrowType, RelationshipLineType, BBox, ViewId } from '@likec4/core';
1
+ import { EdgeId, NonEmptyArray, Point, Color, RelationshipArrowType, RelationshipLineType, BBox, ViewId, MarkdownOrString } from '@likec4/core';
2
2
  import { XYPosition } from '@xyflow/react';
3
3
  import { FunctionComponent, CSSProperties, ReactNode } from 'react';
4
4
  import { Position } from '@xyflow/system';
@@ -45,7 +45,7 @@ export declare const RelationshipEdge: FunctionComponent<{
45
45
  tail: RelationshipArrowType | undefined;
46
46
  labelBBox: BBox | null | undefined;
47
47
  navigateTo: ViewId<string> | null | undefined;
48
- notes: string | undefined;
48
+ notes: MarkdownOrString | undefined;
49
49
  labelXY: XYPosition | null;
50
50
  controlPoints: XYPosition[] | undefined | null;
51
51
  };
@@ -257,7 +257,7 @@ const RelationshipEdge = customEdge((props) => {
257
257
  if (!isControlPointDragging && !isPanning) {
258
258
  const notes = props.data.notes;
259
259
  if (notes && activeWalkthroughStep === props.id) {
260
- edgeLabel = /* @__PURE__ */ jsx(NotePopover, { notes, children: edgeLabel });
260
+ edgeLabel = /* @__PURE__ */ jsx(NotePopover, { notes: notes.txt ?? notes.md, children: edgeLabel });
261
261
  } else if (enableRelationshipDetails) {
262
262
  edgeLabel = /* @__PURE__ */ jsx(
263
263
  RelationshipsDropdownMenu,
@@ -6,24 +6,24 @@ const menuDropdown = css({
6
6
  maxWidth: "min(90vw, 500px)"
7
7
  });
8
8
  const menuItemRelationship = css({
9
- gap: 4
9
+ gap: "1"
10
10
  });
11
11
  const endpoint = css({
12
12
  display: "block",
13
13
  fontSize: "xxs",
14
14
  fontWeight: 500,
15
15
  whiteSpace: "nowrap",
16
- padding: "2px 4px",
17
- borderRadius: 2,
18
- background: `likec4.palette.fill/30`,
16
+ padding: "[2px 4px]",
17
+ borderRadius: "[2px]",
18
+ background: `var(--likec4-palette-fill)/30`,
19
19
  lineHeight: "[1.11]",
20
20
  mixBlendMode: "hard-light",
21
21
  color: {
22
- _light: `[color-mix(in srgb, {colors.likec4.palette.stroke}, {colors.likec4.mixColor} 60%)]`,
23
- _dark: "likec4.palette.loContrast"
22
+ _light: `[color-mix(in srgb, var(--likec4-palette-stroke), {colors.likec4.mixColor} 60%)]`,
23
+ _dark: "var(--likec4-palette-loContrast)"
24
24
  }
25
25
  // _dark: {
26
- // background: `likec4.palette.fill/60`,
26
+ // background: `var(--likec4-palette-fill)/60`,
27
27
  // },
28
28
  });
29
29
  const title = css({
@@ -1,6 +1,6 @@
1
1
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
2
  import { nameFromFqn } from '@likec4/core';
3
- import { cx, css } from '@likec4/styles/css';
3
+ import { cx } from '@likec4/styles/css';
4
4
  import { Menu, MenuTarget, MenuDropdown, MenuLabel, MenuDivider, Box, ActionIcon, MenuItem, Stack, Group, Text, TooltipGroup, Space, Tooltip as Tooltip$1 } from '@mantine/core';
5
5
  import { memo, useCallback, Fragment as Fragment$1, forwardRef } from 'react';
6
6
  import { pipe, map, filter, isTruthy, partition } from 'remeda';
@@ -155,9 +155,9 @@ const Relationship = forwardRef(({
155
155
  const links = r.links;
156
156
  return /* @__PURE__ */ jsxs(Stack, { ref, className: cx(menuItemRelationship, className), ...props, children: [
157
157
  /* @__PURE__ */ jsxs(Group, { gap: 4, children: [
158
- /* @__PURE__ */ jsx(Text, { component: "div", className: cx(css({ likec4Palette: sourceNode.color }), endpoint), children: sourceId }),
158
+ /* @__PURE__ */ jsx(Text, { component: "div", "data-likec4-color": sourceNode.color, className: endpoint, children: sourceId }),
159
159
  /* @__PURE__ */ jsx(IconArrowRight, { stroke: 2.5, size: "11px", opacity: 0.65 }),
160
- /* @__PURE__ */ jsx(Text, { component: "div", className: cx(css({ likec4Palette: targetNode.color }), endpoint), children: targetId }),
160
+ /* @__PURE__ */ jsx(Text, { component: "div", "data-likec4-color": targetNode.color, className: endpoint, children: targetId }),
161
161
  (navigateTo || !!onOpenSource) && /* @__PURE__ */ jsxs(TooltipGroup, { openDelay: 100, children: [
162
162
  /* @__PURE__ */ jsx(Space, { w: "xs" }),
163
163
  navigateTo && /* @__PURE__ */ jsx(Tooltip, { label: "Open dynamic view", children: /* @__PURE__ */ jsx(
@@ -5,13 +5,13 @@ const controlPointsContainer = css({
5
5
  overflow: "visible",
6
6
  position: "absolute",
7
7
  pointerEvents: "none",
8
- top: 0,
9
- left: 0,
8
+ top: "0",
9
+ left: "0",
10
10
  mixBlendMode: "normal"
11
11
  });
12
12
  const controlPoint = css({
13
- fill: `likec4.relation.stroke`,
14
- stroke: `likec4.relation.stroke`,
13
+ fill: `var(--likec4-palette-relation-stroke)`,
14
+ stroke: `var(--likec4-palette-relation-stroke)`,
15
15
  fillOpacity: 0.75,
16
16
  strokeWidth: 1,
17
17
  cursor: "grab",
@@ -3,7 +3,7 @@ import { MemoExoticComponent, FunctionComponent, CSSProperties, ReactNode } from
3
3
  import { NodeProps } from '../../base';
4
4
  import { Position, XYPosition } from '@xyflow/system';
5
5
  import { EdgeData, Dimmed } from '../../base/types.Base';
6
- import { EdgeId, NonEmptyArray, Point, Color, RelationshipArrowType, RelationshipLineType, BBox, ViewId } from '@likec4/core';
6
+ import { EdgeId, NonEmptyArray, Point, Color, RelationshipArrowType, RelationshipLineType, BBox, ViewId, MarkdownOrString } from '@likec4/core';
7
7
  export declare const BuiltinNodes: {
8
8
  element: MemoExoticComponent<(props: NodeProps<Types.ElementNodeData, "element">) => import("react/jsx-runtime").JSX.Element>;
9
9
  deployment: MemoExoticComponent<(props: NodeProps<Types.DeploymentElementNodeData, "deployment">) => import("react/jsx-runtime").JSX.Element>;
@@ -54,7 +54,7 @@ export declare const edgeTypes: {
54
54
  tail: RelationshipArrowType | undefined;
55
55
  labelBBox: BBox | null | undefined;
56
56
  navigateTo: ViewId<string> | null | undefined;
57
- notes: string | undefined;
57
+ notes: MarkdownOrString | undefined;
58
58
  labelXY: XYPosition | null;
59
59
  controlPoints: XYPosition[] | undefined | null;
60
60
  };
@@ -109,8 +109,8 @@ function BorderStyleOption({
109
109
  },
110
110
  styles: {
111
111
  label: {
112
- paddingTop: 2,
113
- paddingBottom: 2
112
+ paddingTop: "0.5",
113
+ paddingBottom: "0.5"
114
114
  }
115
115
  },
116
116
  data: [
@@ -1,15 +1,15 @@
1
1
  import { css } from '@likec4/styles/css';
2
2
 
3
3
  const navigationButtons = css({
4
- gap: "micro",
4
+ gap: "xxs",
5
5
  _empty: {
6
6
  display: "none"
7
7
  }
8
8
  });
9
9
  const panel = css({
10
- top: "1rem",
11
- left: "1rem",
12
- margin: 0,
10
+ top: "md",
11
+ left: "md",
12
+ margin: "0",
13
13
  pointerEvents: "none",
14
14
  "& :where(button, .action-icon, [role='dialog'])": {
15
15
  pointerEvents: "all"
@@ -43,7 +43,7 @@ const autolayoutButton = css({
43
43
  flex: "1 1 40%",
44
44
  textAlign: "center",
45
45
  fontWeight: 500,
46
- padding: "4px 6px",
46
+ padding: "[4px 6px]",
47
47
  fontSize: "11px",
48
48
  zIndex: 1
49
49
  });
@@ -5,8 +5,8 @@ import { useLocalStorage } from '@mantine/hooks';
5
5
  import { AnimatePresence, m } from 'motion/react';
6
6
  import { Link } from '../../../components/Link.js';
7
7
  import { useDiagramContext } from '../../../hooks/useDiagram.js';
8
+ import { useOptionalCurrentViewModel } from '../../../likec4model/useCurrentViewModel.js';
8
9
  import { card, title, description } from './DiagramTitlePanel.css.js';
9
- import { useCurrentViewModel } from '../../../likec4model/useCurrentViewModel.js';
10
10
  import IconMenu from '../../../node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconMenu.js';
11
11
  import { MarkdownBlock } from '../../../base/primitives/MarkdownBlock.js';
12
12
 
@@ -20,15 +20,15 @@ function selector(context) {
20
20
  };
21
21
  }
22
22
  function DiagramTitlePanel() {
23
- const view = useCurrentViewModel();
23
+ const view = useOptionalCurrentViewModel();
24
24
  const { isNotActiveWalkthrough } = useDiagramContext(selector);
25
25
  const [isCollapsed, setCollapsed] = useLocalStorage({
26
26
  key: "diagram-title-webview-collapsed",
27
27
  defaultValue: false
28
28
  });
29
- const title$1 = view.title ?? "untitled";
29
+ const title$1 = view?.title ?? "untitled";
30
30
  const toggle = () => setCollapsed((v) => !v);
31
- return /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: isNotActiveWalkthrough && /* @__PURE__ */ jsx(
31
+ return /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: view && isNotActiveWalkthrough && /* @__PURE__ */ jsx(
32
32
  m.div,
33
33
  {
34
34
  initial: { opacity: 0.05, scale: 0.7 },