@likec4/diagram 1.30.0 → 1.31.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 (266) hide show
  1. package/README.md +324 -5
  2. package/bundle/chunk-BBzMXzCg.js +21383 -0
  3. package/bundle/custom.js +62 -0
  4. package/bundle/index.js +17459 -38163
  5. package/dist/LikeC4CustomColors.js +2 -2
  6. package/dist/LikeC4Diagram.d.ts +1 -1
  7. package/dist/LikeC4Diagram.js +4 -2
  8. package/dist/LikeC4Diagram.props.d.ts +6 -1
  9. package/dist/LikeC4ModelProvider.d.ts +3 -3
  10. package/dist/LikeC4ModelProvider.js +0 -1
  11. package/dist/StaticLikeC4Diagram.d.ts +1 -1
  12. package/dist/base/BaseXYFlow.js +3 -3
  13. package/dist/base/primitives/compound/CompoundActionButton.d.ts +3 -2
  14. package/dist/base/primitives/compound/CompoundDetailsButton.d.ts +3 -2
  15. package/dist/base/primitives/compound/CompoundNodeContainer.d.ts +7 -3
  16. package/dist/base/primitives/compound/CompoundNodeContainer.js +3 -2
  17. package/dist/base/primitives/customEdge.d.ts +2 -35
  18. package/dist/base/primitives/customEdge.js +2 -2
  19. package/dist/base/primitives/customNode.d.ts +2 -2
  20. package/dist/base/primitives/customNode.js +9 -2
  21. package/dist/base/primitives/edge/EdgeContainer.js +0 -1
  22. package/dist/base/primitives/edge/EdgeLabel.js +0 -1
  23. package/dist/base/primitives/edge/EdgeLabelContainer.js +0 -2
  24. package/dist/base/primitives/edge/EdgePath.js +2 -2
  25. package/dist/base/primitives/element/ElementNodeContainer.d.ts +24 -22
  26. package/dist/base/primitives/element/ElementNodeContainer.js +66 -68
  27. package/dist/base/primitives/element/ElementShape.d.ts +8 -4
  28. package/dist/base/primitives/element/ElementShape.js +4 -3
  29. package/dist/base/primitives/element/ElementTitle.css.d.ts +1 -1
  30. package/dist/base/primitives/element/ElementTitle.js +0 -1
  31. package/dist/base/types.d.ts +5 -5
  32. package/dist/bundle/LikeC4View.js +6 -3
  33. package/dist/bundle/LikeC4View.props.d.ts +5 -1
  34. package/dist/bundle/ReactLikeC4.js +1 -2
  35. package/dist/bundle/ShadowRoot.js +3 -3
  36. package/dist/bundle/custom.d.ts +1 -0
  37. package/dist/bundle/index.d.ts +3 -1
  38. package/dist/bundle/index.js +9 -0
  39. package/dist/bundle/styles.css.js +5 -5
  40. package/dist/components/SearchControl.js +2 -2
  41. package/dist/context/ControlsCustomLayout.js +0 -1
  42. package/dist/context/DiagramEventHandlers.js +5 -5
  43. package/dist/context/DiagramFeatures.d.ts +2 -4
  44. package/dist/context/DiagramFeatures.js +15 -16
  45. package/dist/context/EnsureMantine.js +9 -4
  46. package/dist/context/FramerMotionConfig.js +0 -1
  47. package/dist/context/IconRenderer.js +7 -7
  48. package/dist/context/ReduceGraphics.js +6 -6
  49. package/dist/context/RootContainer.js +5 -5
  50. package/dist/context/index.d.ts +1 -1
  51. package/dist/custom/components.d.ts +5 -0
  52. package/dist/custom/customNodes.d.ts +218 -0
  53. package/dist/custom/hooks.d.ts +10 -0
  54. package/dist/custom/index.d.ts +4 -0
  55. package/dist/hooks/safeContext.js +3 -3
  56. package/dist/hooks/useCurrentViewId.d.ts +5 -1
  57. package/dist/hooks/useCurrentViewId.js +1 -2
  58. package/dist/hooks/useDiagram.d.ts +14 -12544
  59. package/dist/hooks/useDiagram.js +3 -5
  60. package/dist/hooks/useMantinePortalProps.js +2 -2
  61. package/dist/hooks/useSetState.js +3 -3
  62. package/dist/hooks/useUpdateEffect.js +0 -1
  63. package/dist/hooks/useXYFlow.d.ts +64 -64
  64. package/dist/hooks/useXYFlow.js +2 -2
  65. package/dist/index.d.ts +2 -4
  66. package/dist/index.js +8 -3
  67. package/dist/likec4diagram/DiagramUI.js +2 -2
  68. package/dist/likec4diagram/DiagramXYFlow.d.ts +1 -1
  69. package/dist/likec4diagram/DiagramXYFlow.js +25 -7
  70. package/dist/likec4diagram/custom/edges/NotePopover.js +2 -2
  71. package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +9 -13
  72. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +8 -8
  73. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +14 -12
  74. package/dist/likec4diagram/custom/index.d.ts +15 -19
  75. package/dist/likec4diagram/custom/index.js +3 -3
  76. package/dist/likec4diagram/custom/nodes/CompoundActions.js +2 -2
  77. package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +27 -4
  78. package/dist/likec4diagram/custom/nodes/ElementActions.js +67 -53
  79. package/dist/likec4diagram/custom/nodes/index.d.ts +8 -0
  80. package/dist/likec4diagram/custom/nodes/nodes.d.ts +10 -0
  81. package/dist/likec4diagram/custom/nodes/{nodeTypes.js → nodes.js} +39 -39
  82. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +2 -2
  83. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +6 -7
  84. package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +3 -3
  85. package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.d.ts +3 -2
  86. package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +2 -2
  87. package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +2 -2
  88. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
  89. package/dist/likec4diagram/types.d.ts +15 -7
  90. package/dist/likec4diagram/ui/controls/ChangeAutoLayoutButton.js +4 -4
  91. package/dist/likec4diagram/ui/controls/Controls.js +2 -2
  92. package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +2 -2
  93. package/dist/likec4diagram/ui/notation/NotationPanel.js +6 -8
  94. package/dist/likec4diagram/ui/search/ElementsColumn.js +6 -7
  95. package/dist/likec4diagram/ui/search/LikeC4Search.js +3 -3
  96. package/dist/likec4diagram/ui/search/SearchInput.js +0 -1
  97. package/dist/likec4diagram/ui/search/_shared.css.d.ts +1 -1
  98. package/dist/likec4diagram/ui/search/state.js +3 -4
  99. package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +4 -4
  100. package/dist/likec4diagram/useLayoutConstraints.js +3 -4
  101. package/dist/likec4diagram/useViewToNodesEdges.js +2 -0
  102. package/dist/likec4model/LikeC4ModelContext.d.ts +2 -2
  103. package/dist/likec4model/LikeC4ModelContext.js +2 -2
  104. package/dist/likec4model/useLikeC4ElementsTree.d.ts +1 -1
  105. package/dist/likec4model/useLikeC4ElementsTree.js +3 -3
  106. package/dist/likec4model/useLikeC4Model.d.ts +1 -1
  107. package/dist/likec4model/useLikeC4Model.js +2 -2
  108. package/dist/overlays/Overlays.d.ts +2 -3
  109. package/dist/overlays/Overlays.js +5 -6
  110. package/dist/overlays/element-details/ElementDetailsCard.css.js +13 -9
  111. package/dist/overlays/element-details/ElementDetailsCard.js +98 -105
  112. package/dist/overlays/element-details/TabPanelDeployments.js +4 -4
  113. package/dist/overlays/element-details/TabPanelRelationships.js +2 -2
  114. package/dist/overlays/element-details/TabPanelStructure.js +3 -3
  115. package/dist/overlays/element-details/actor.d.ts +6905 -19690
  116. package/dist/overlays/element-details/actor.js +0 -2
  117. package/dist/overlays/element-details/actorContext.js +3 -3
  118. package/dist/overlays/overlay/Overlay.d.ts +11 -1
  119. package/dist/overlays/overlay/Overlay.js +8 -8
  120. package/dist/overlays/overlaysActor.d.ts +4 -2
  121. package/dist/overlays/overlaysActor.js +2 -1
  122. package/dist/overlays/relationship-details/RelationshipDetails.d.ts +4 -8
  123. package/dist/overlays/relationship-details/RelationshipDetails.js +12 -12
  124. package/dist/overlays/relationship-details/SelectEdge.js +2 -3
  125. package/dist/overlays/relationship-details/_types.d.ts +6 -5
  126. package/dist/overlays/relationship-details/actor.d.ts +3 -3
  127. package/dist/overlays/relationship-details/compute.js +3 -3
  128. package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +4 -8
  129. package/dist/overlays/relationship-details/custom/edgeTypes.js +2 -2
  130. package/dist/overlays/relationship-details/custom/nodeTypes.d.ts +3 -31
  131. package/dist/overlays/relationship-details/hooks.d.ts +27 -27
  132. package/dist/overlays/relationship-details/hooks.js +4 -4
  133. package/dist/overlays/relationship-details/layout.js +2 -3
  134. package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +4 -8
  135. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +8 -8
  136. package/dist/overlays/relationships-browser/SelectElement.js +5 -5
  137. package/dist/overlays/relationships-browser/_types.d.ts +6 -5
  138. package/dist/overlays/relationships-browser/actor.d.ts +63 -428
  139. package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +4 -8
  140. package/dist/overlays/relationships-browser/custom/edgeTypes.js +2 -2
  141. package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +10 -14
  142. package/dist/overlays/relationships-browser/custom/nodeTypes.js +1 -2
  143. package/dist/overlays/relationships-browser/hooks.d.ts +4 -61
  144. package/dist/overlays/relationships-browser/hooks.js +4 -4
  145. package/dist/overlays/relationships-browser/layout.js +3 -4
  146. package/dist/state/DiagramActorProvider.js +3 -3
  147. package/dist/state/diagram-machine.d.ts +186 -10369
  148. package/dist/state/diagram-machine.js +2 -1
  149. package/dist/state/hotkeyActor.d.ts +4 -2
  150. package/dist/state/syncManualLayoutActor.d.ts +14 -3
  151. package/dist/state/syncManualLayoutActor.js +2 -1
  152. package/dist/state/types.d.ts +5 -4
  153. package/dist/state/utils.d.ts +1 -1
  154. package/dist/styles-font.css +1 -0
  155. package/dist/styles-min.css +1 -0
  156. package/dist/styles-xyflow.css +1 -0
  157. package/dist/styles.css +1 -0
  158. package/dist/styles.css2.js +3 -0
  159. package/package.json +46 -21
  160. package/panda.buildinfo.json +979 -0
  161. package/src/LikeC4Diagram.props.ts +7 -1
  162. package/src/LikeC4Diagram.tsx +2 -0
  163. package/src/LikeC4ModelProvider.tsx +3 -3
  164. package/src/StaticLikeC4Diagram.tsx +1 -0
  165. package/src/base/Background.tsx +0 -4
  166. package/src/base/primitives/compound/CompoundActionButton.tsx +7 -4
  167. package/src/base/primitives/compound/CompoundDetailsButton.tsx +7 -4
  168. package/src/base/primitives/compound/CompoundNodeContainer.tsx +8 -7
  169. package/src/base/primitives/customEdge.ts +1 -1
  170. package/src/base/primitives/{customNode.ts → customNode.tsx} +11 -3
  171. package/src/base/primitives/element/ElementNodeContainer.tsx +87 -80
  172. package/src/base/primitives/element/ElementShape.tsx +11 -10
  173. package/src/base/types.ts +28 -33
  174. package/src/bundle/LikeC4View.props.ts +6 -1
  175. package/src/bundle/LikeC4View.tsx +3 -0
  176. package/src/bundle/ReactLikeC4.tsx +1 -1
  177. package/src/bundle/custom.ts +1 -0
  178. package/src/bundle/index.ts +20 -1
  179. package/src/bundle/styles.css.ts +1 -1
  180. package/src/components/SearchControl.tsx +1 -1
  181. package/src/context/DiagramFeatures.tsx +12 -8
  182. package/src/context/EnsureMantine.tsx +13 -3
  183. package/src/context/IconRenderer.tsx +1 -1
  184. package/src/context/ReduceGraphics.tsx +6 -6
  185. package/src/context/index.ts +0 -1
  186. package/src/custom/components.ts +47 -0
  187. package/src/custom/customNodes.tsx +244 -0
  188. package/src/custom/hooks.ts +35 -0
  189. package/src/custom/index.ts +5 -0
  190. package/src/hooks/useCurrentViewId.ts +9 -1
  191. package/src/hooks/useDiagram.ts +30 -9
  192. package/src/index.ts +4 -8
  193. package/src/likec4diagram/DiagramXYFlow.tsx +28 -5
  194. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +1 -1
  195. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +9 -7
  196. package/src/likec4diagram/custom/{index.tsx → index.ts} +2 -2
  197. package/src/likec4diagram/custom/nodes/CompoundActions.tsx +2 -2
  198. package/src/likec4diagram/custom/nodes/ElementActions.tsx +100 -57
  199. package/src/likec4diagram/custom/nodes/index.ts +17 -0
  200. package/src/likec4diagram/custom/nodes/{nodeTypes.tsx → nodes.tsx} +52 -36
  201. package/src/likec4diagram/custom/nodes/toolbar/CompoundToolbar.tsx +3 -4
  202. package/src/likec4diagram/custom/nodes/toolbar/ElementToolbar.tsx +3 -3
  203. package/src/likec4diagram/custom/nodes/toolbar/Toolbar.tsx +5 -4
  204. package/src/likec4diagram/types.ts +19 -9
  205. package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +1 -1
  206. package/src/likec4diagram/ui/notation/NotationPanel.tsx +1 -2
  207. package/src/likec4diagram/ui/search/ElementsColumn.tsx +2 -4
  208. package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.tsx +1 -1
  209. package/src/likec4diagram/useViewToNodesEdges.ts +2 -0
  210. package/src/likec4model/LikeC4ModelContext.ts +2 -2
  211. package/src/likec4model/useLikeC4ElementsTree.ts +3 -1
  212. package/src/likec4model/useLikeC4Model.ts +1 -1
  213. package/src/overlays/Overlays.tsx +2 -3
  214. package/src/overlays/element-details/ElementDetailsCard.css.ts +14 -22
  215. package/src/overlays/element-details/ElementDetailsCard.tsx +18 -16
  216. package/src/overlays/overlay/Overlay.tsx +3 -4
  217. package/src/overlays/overlaysActor.ts +4 -3
  218. package/src/overlays/relationship-details/RelationshipDetails.tsx +1 -1
  219. package/src/overlays/relationship-details/SelectEdge.tsx +0 -2
  220. package/src/overlays/relationship-details/_types.ts +16 -13
  221. package/src/overlays/relationship-details/custom/edgeTypes.tsx +2 -2
  222. package/src/overlays/relationships-browser/_types.ts +18 -15
  223. package/src/overlays/relationships-browser/actor.ts +2 -2
  224. package/src/overlays/relationships-browser/custom/edgeTypes.tsx +2 -2
  225. package/src/overlays/relationships-browser/custom/nodeTypes.tsx +1 -2
  226. package/src/state/DiagramActorProvider.tsx +2 -2
  227. package/src/state/diagram-machine.ts +13 -8
  228. package/src/state/hotkeyActor.ts +4 -2
  229. package/src/state/syncManualLayoutActor.ts +9 -3
  230. package/src/state/types.ts +9 -3
  231. package/src/state/utils.ts +3 -3
  232. package/src/styles-min.css +2 -0
  233. package/src/styles-xyflow.css +1 -0
  234. package/dist/_virtual/_commonjsHelpers.js +0 -5
  235. package/dist/_virtual/default-map.js +0 -7
  236. package/dist/_virtual/index.js +0 -5
  237. package/dist/_virtual/index2.js +0 -3
  238. package/dist/_virtual/react.production.js +0 -3
  239. package/dist/_virtual/set.js +0 -5
  240. package/dist/_virtual/set2.js +0 -3
  241. package/dist/base/xyflowMachine.d.ts +0 -212
  242. package/dist/likec4diagram/custom/nodes/nodeTypes.d.ts +0 -8
  243. package/dist/node_modules/.pnpm/mnemonist@0.40.3_patch_hash_5c12abb43fcff6fd81e53021b89075d53249640d165a2556cc1e58d71201a13a/node_modules/mnemonist/default-map.js +0 -172
  244. package/dist/node_modules/.pnpm/mnemonist@0.40.3_patch_hash_5c12abb43fcff6fd81e53021b89075d53249640d165a2556cc1e58d71201a13a/node_modules/mnemonist/set.js +0 -369
  245. package/dist/node_modules/.pnpm/react@19.1.0/node_modules/react/cjs/react.production.js +0 -556
  246. package/dist/node_modules/.pnpm/react@19.1.0/node_modules/react/index.js +0 -15
  247. package/dist/packages/core/src/compute-view/relationships-view/compute.js +0 -123
  248. package/dist/packages/core/src/compute-view/relationships-view/utils.js +0 -68
  249. package/dist/packages/core/src/errors/index.js +0 -15
  250. package/dist/packages/core/src/model/connection/model/ConnectionModel.js +0 -121
  251. package/dist/packages/core/src/model/connection/model/find.js +0 -39
  252. package/dist/packages/core/src/model/connection/ops.js +0 -7
  253. package/dist/packages/core/src/utils/const.js +0 -3
  254. package/dist/packages/core/src/utils/fqn.js +0 -51
  255. package/dist/packages/core/src/utils/guards.js +0 -7
  256. package/dist/packages/core/src/utils/iterable/filter.js +0 -21
  257. package/dist/packages/core/src/utils/iterable/find.js +0 -21
  258. package/dist/packages/core/src/utils/iterable/map.js +0 -18
  259. package/dist/packages/core/src/utils/iterable/some.js +0 -21
  260. package/dist/packages/core/src/utils/iterable/to.js +0 -14
  261. package/dist/packages/core/src/utils/set.js +0 -48
  262. package/dist/packages/core/src/utils/string-hash.js +0 -13
  263. package/dist/styles.css.js +0 -3
  264. package/src/base/xyflowMachine.ts +0 -75
  265. /package/dist/{bundle/font.css.js → styles-font.css2.js} +0 -0
  266. /package/src/{bundle/font.css → styles-font.css} +0 -0
@@ -3,7 +3,7 @@ import { DiagramNode, nameFromFqn } from '@likec4/core';
3
3
  import { cx, css } 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 { IconInfoCircle, IconArrowRight, IconZoomScan, IconFileSymlink } from '@tabler/icons-react';
6
- import { r as reactExports } from '../../../_virtual/index.js';
6
+ import { memo, useCallback, Fragment as Fragment$1, forwardRef } from 'react';
7
7
  import { pipe, map, filter, isTruthy, partition } from 'remeda';
8
8
  import { Link } from '../../../components/Link.js';
9
9
  import { useDiagramContext, useDiagram } from '../../../hooks/useDiagram.js';
@@ -11,7 +11,7 @@ import { findDiagramNode, findDiagramEdge } from '../../../state/utils.js';
11
11
  import { menuDropdown, endpoint, title, menuItemRelationship } from './RelationshipsDropdownMenu.css.js';
12
12
  import { useLikeC4Model } from '../../../likec4model/useLikeC4Model.js';
13
13
  import { useMantinePortalProps } from '../../../hooks/useMantinePortalProps.js';
14
- import { useEnabledFeature, IfEnabled } from '../../../context/DiagramFeatures.js';
14
+ import { useEnabledFeatures, IfEnabled } from '../../../context/DiagramFeatures.js';
15
15
  import { useDiagramEventHandlers } from '../../../context/DiagramEventHandlers.js';
16
16
 
17
17
  const stopPropagation = (e) => e.stopPropagation();
@@ -25,22 +25,24 @@ const Tooltip = Tooltip$1.withProps({
25
25
  offset: 8,
26
26
  withinPortal: false
27
27
  });
28
- const RelationshipsDropdownMenu = reactExports.memo(({
28
+ const RelationshipsDropdownMenu = memo(({
29
29
  edgeId,
30
30
  source,
31
31
  target,
32
32
  disabled = false,
33
33
  children
34
34
  }) => {
35
- const { diagramEdge, sourceNode, targetNode } = useDiagramContext((ctx) => ({
36
- diagramEdge: findDiagramEdge(ctx, edgeId),
37
- sourceNode: findDiagramNode(ctx, source),
38
- targetNode: findDiagramNode(ctx, target)
39
- }));
35
+ const { diagramEdge, sourceNode, targetNode } = useDiagramContext(
36
+ useCallback((ctx) => ({
37
+ diagramEdge: findDiagramEdge(ctx, edgeId),
38
+ sourceNode: findDiagramNode(ctx, source),
39
+ targetNode: findDiagramNode(ctx, target)
40
+ }), [edgeId, source, target])
41
+ );
40
42
  const likec4model = useLikeC4Model(true);
41
43
  const diagram = useDiagram();
42
44
  const portalProps = useMantinePortalProps();
43
- const onClickOpenOverlay = reactExports.useCallback((e) => {
45
+ const onClickOpenOverlay = useCallback((e) => {
44
46
  e.stopPropagation();
45
47
  diagram.openRelationshipDetails(edgeId);
46
48
  }, [edgeId]);
@@ -63,7 +65,7 @@ const RelationshipsDropdownMenu = reactExports.memo(({
63
65
  filter(isTruthy),
64
66
  partition((r) => r.source.id === sourceNode.id && r.target.id === targetNode.id)
65
67
  );
66
- const renderRelationship = (relationship, index) => /* @__PURE__ */ jsxs(reactExports.Fragment, { children: [
68
+ const renderRelationship = (relationship, index) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
67
69
  index > 0 && /* @__PURE__ */ jsx(MenuDivider, { opacity: 0.65 }),
68
70
  /* @__PURE__ */ jsx(
69
71
  MenuItem,
@@ -130,7 +132,7 @@ const RelationshipsDropdownMenu = reactExports.memo(({
130
132
  }
131
133
  );
132
134
  });
133
- const Relationship = reactExports.forwardRef(({
135
+ const Relationship = forwardRef(({
134
136
  className,
135
137
  relationship: r,
136
138
  edge,
@@ -139,7 +141,7 @@ const Relationship = reactExports.forwardRef(({
139
141
  ...props
140
142
  }, ref) => {
141
143
  const diagram = useDiagram();
142
- const { enableNavigateTo } = useEnabledFeature("NavigateTo");
144
+ const { enableNavigateTo } = useEnabledFeatures();
143
145
  const { onOpenSource } = useDiagramEventHandlers();
144
146
  const viewId = diagram.currentView.id;
145
147
  const sourceId = getShortId(r, r.source.id, sourceNode);
@@ -1,25 +1,25 @@
1
1
  import { Types } from '../types';
2
- import { NamedExoticComponent, CSSProperties, ReactNode } from 'react';
2
+ import { MemoExoticComponent, FunctionComponent, CSSProperties, ReactNode } from 'react';
3
3
  import { NodeProps } from '../../base';
4
4
  import { Position, XYPosition } from '@xyflow/system';
5
- import { EdgeId, NonEmptyArray, Point, Color, BBox, RelationshipLineType, RelationshipArrowType, ViewId } from '@likec4/core';
6
- export declare const nodeTypes: {
7
- element: NamedExoticComponent<NodeProps<Types.ElementNodeData>>;
8
- deployment: NamedExoticComponent<NodeProps<Types.DeploymentElementNodeData>>;
9
- 'compound-element': NamedExoticComponent<NodeProps<Types.CompoundElementNodeData>>;
10
- 'compound-deployment': NamedExoticComponent<NodeProps<Types.CompoundDeploymentNodeData>>;
11
- 'view-group': NamedExoticComponent<NodeProps<Types.ViewGroupNodeData>>;
5
+ import { EdgeId, NonEmptyArray, Point, Color, RelationshipLineType, RelationshipArrowType, BBox, ViewId } from '@likec4/core';
6
+ export declare const BuiltinNodes: {
7
+ element: MemoExoticComponent<(props: NodeProps<Types.ElementNodeData, "element">) => import("react/jsx-runtime").JSX.Element>;
8
+ deployment: MemoExoticComponent<(props: NodeProps<Types.DeploymentElementNodeData, "deployment">) => import("react/jsx-runtime").JSX.Element>;
9
+ 'compound-element': MemoExoticComponent<(props: NodeProps<Types.CompoundElementNodeData, "compound-element">) => import("react/jsx-runtime").JSX.Element>;
10
+ 'compound-deployment': MemoExoticComponent<(props: NodeProps<Types.CompoundDeploymentNodeData, "compound-deployment">) => import("react/jsx-runtime").JSX.Element>;
11
+ 'view-group': MemoExoticComponent<(props: NodeProps<Types.ViewGroupNodeData, "view-group">) => import("react/jsx-runtime").JSX.Element>;
12
12
  };
13
13
  export declare const edgeTypes: {
14
- relationship: NamedExoticComponent<{
14
+ relationship: FunctionComponent<{
15
15
  id: string;
16
16
  selected?: boolean;
17
17
  selectable?: boolean;
18
18
  deletable?: boolean;
19
19
  style?: CSSProperties;
20
+ animated?: boolean;
20
21
  source: string;
21
22
  target: string;
22
- animated?: boolean;
23
23
  sourceX: number;
24
24
  sourceY: number;
25
25
  targetX: number;
@@ -38,28 +38,24 @@ export declare const edgeTypes: {
38
38
  markerEnd?: string;
39
39
  pathOptions?: any;
40
40
  interactionWidth?: number;
41
- data: {
41
+ data: import("../../base").Base.EdgeData & {
42
42
  hovered?: boolean;
43
43
  active?: boolean;
44
44
  dimmed?: import("../../base").Base.Dimmed;
45
- } & {
46
45
  id: EdgeId;
47
46
  label: string | null;
48
47
  points: NonEmptyArray<Point>;
49
- technology: string | undefined;
50
48
  color: Color | undefined;
51
- labelBBox: BBox | null | undefined;
52
- dir: "forward" | "back" | "both" | undefined;
53
49
  line: RelationshipLineType | undefined;
54
- head: RelationshipArrowType | undefined;
50
+ dir: "forward" | "back" | "both" | undefined;
55
51
  tail: RelationshipArrowType | undefined;
52
+ head: RelationshipArrowType | undefined;
53
+ technology: string | undefined;
54
+ labelBBox: BBox | null | undefined;
56
55
  navigateTo: ViewId<string> | undefined;
57
56
  notes: string | undefined;
58
57
  labelXY: XYPosition | null;
59
58
  controlPoints: XYPosition[] | undefined | null;
60
- hovered?: boolean;
61
- active?: boolean;
62
- dimmed?: import("../../base").Base.Dimmed;
63
59
  };
64
60
  }>;
65
61
  };
@@ -1,7 +1,7 @@
1
1
  import { RelationshipEdge } from './edges/RelationshipEdge.js';
2
- import { ViewGroupNode, CompoundDeploymentNode, CompoundElementNode, DeploymentNode, ElementNode } from './nodes/nodeTypes.js';
2
+ import { ViewGroupNode, CompoundDeploymentNode, CompoundElementNode, DeploymentNode, ElementNode } from './nodes/nodes.js';
3
3
 
4
- const nodeTypes = {
4
+ const BuiltinNodes = {
5
5
  element: ElementNode,
6
6
  deployment: DeploymentNode,
7
7
  "compound-element": CompoundElementNode,
@@ -12,4 +12,4 @@ const edgeTypes = {
12
12
  relationship: RelationshipEdge
13
13
  };
14
14
 
15
- export { edgeTypes, nodeTypes };
15
+ export { BuiltinNodes, edgeTypes };
@@ -1,10 +1,10 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
+ import { useEnabledFeatures } from '../../../context/DiagramFeatures.js';
2
3
  import { useDiagram } from '../../../hooks/useDiagram.js';
3
- import { useEnabledFeature } from '../../../context/DiagramFeatures.js';
4
4
  import { CompoundActionButton } from '../../../base/primitives/compound/CompoundActionButton.js';
5
5
 
6
6
  const CompoundActions = (props) => {
7
- const { enableNavigateTo } = useEnabledFeature("NavigateTo");
7
+ const { enableNavigateTo } = useEnabledFeatures();
8
8
  const diagram = useDiagram();
9
9
  const { navigateTo } = props.data;
10
10
  if (navigateTo && enableNavigateTo) {
@@ -1,7 +1,30 @@
1
+ import { ElementActionButtons } from '../../../base/primitives';
1
2
  import { NodeProps } from '../../../base/types';
2
3
  import { Types } from '../../types';
3
- type ElementActionsProps = NodeProps<Types.ElementNodeData>;
4
- export declare const ElementActions: (props: ElementActionsProps) => import("react/jsx-runtime").JSX.Element;
5
- type DeploymentElementActionsProps = NodeProps<Types.DeploymentElementNodeData>;
6
- export declare const DeploymentElementActions: (props: DeploymentElementActionsProps) => import("react/jsx-runtime").JSX.Element;
4
+ type WithExtraButtons = {
5
+ /**
6
+ * Add extra action buttons
7
+ * @example
8
+ * ```tsx
9
+ * <ElementActions
10
+ * extraButtons={[
11
+ * {
12
+ * key: 'extra',
13
+ * icon: <IconZoomScan />,
14
+ * onClick: (e) => {
15
+ * e.stopPropagation()
16
+ * console.log('extra action clicked')
17
+ * },
18
+ * },
19
+ * },
20
+ * ]}
21
+ * />
22
+ * ```
23
+ */
24
+ extraButtons?: ElementActionButtons.Item[];
25
+ };
26
+ export type ElementActionsProps = NodeProps<Types.ElementNodeData> & WithExtraButtons;
27
+ export declare const ElementActions: ({ extraButtons, ...props }: ElementActionsProps) => import("react/jsx-runtime").JSX.Element;
28
+ export type DeploymentElementActionsProps = NodeProps<Types.DeploymentElementNodeData> & WithExtraButtons;
29
+ export declare const DeploymentElementActions: ({ extraButtons, ...props }: DeploymentElementActionsProps) => import("react/jsx-runtime").JSX.Element;
7
30
  export {};
@@ -1,68 +1,82 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
+ import { hasAtLeast } from '@likec4/core';
2
3
  import { IconZoomScan, IconTransform } from '@tabler/icons-react';
4
+ import { useMemo } from 'react';
5
+ import { useEnabledFeatures } from '../../../context/DiagramFeatures.js';
3
6
  import { useDiagram } from '../../../hooks/useDiagram.js';
4
- import { useEnabledFeature } from '../../../context/DiagramFeatures.js';
5
7
  import { ElementActionButtons } from '../../../base/primitives/element/ElementActionButtons.js';
6
8
 
7
- const ElementActions = (props) => {
8
- const { enableNavigateTo, enableRelationshipBrowser } = useEnabledFeature("RelationshipBrowser", "NavigateTo");
9
+ const ElementActions = ({
10
+ extraButtons,
11
+ ...props
12
+ }) => {
13
+ const { enableNavigateTo, enableRelationshipBrowser } = useEnabledFeatures();
9
14
  const diagram = useDiagram();
10
- const buttons = [];
11
15
  const { navigateTo, modelFqn } = props.data;
12
- if (navigateTo && enableNavigateTo) {
13
- buttons.push({
14
- key: "navigate",
15
- icon: /* @__PURE__ */ jsx(IconZoomScan, {}),
16
- onClick: (e) => {
17
- e.stopPropagation();
18
- diagram.navigateTo(navigateTo, props.id);
19
- }
20
- });
21
- }
22
- if (enableRelationshipBrowser) {
23
- buttons.push({
24
- key: "relationships",
25
- icon: /* @__PURE__ */ jsx(IconTransform, {}),
26
- onClick: (e) => {
27
- e.stopPropagation();
28
- diagram.openRelationshipsBrowser(modelFqn);
29
- }
30
- });
31
- }
32
- return /* @__PURE__ */ jsx(
33
- ElementActionButtons,
34
- {
35
- buttons,
36
- ...props
16
+ let buttons = useMemo(() => {
17
+ const buttons2 = [];
18
+ if (navigateTo && enableNavigateTo) {
19
+ buttons2.push({
20
+ key: "navigate",
21
+ icon: /* @__PURE__ */ jsx(IconZoomScan, {}),
22
+ onClick: (e) => {
23
+ e.stopPropagation();
24
+ diagram.navigateTo(navigateTo, props.id);
25
+ }
26
+ });
37
27
  }
38
- );
28
+ if (enableRelationshipBrowser) {
29
+ buttons2.push({
30
+ key: "relationships",
31
+ icon: /* @__PURE__ */ jsx(IconTransform, {}),
32
+ onClick: (e) => {
33
+ e.stopPropagation();
34
+ diagram.openRelationshipsBrowser(modelFqn);
35
+ }
36
+ });
37
+ }
38
+ return buttons2;
39
+ }, [enableNavigateTo, enableRelationshipBrowser, diagram, modelFqn, navigateTo, props.id]);
40
+ if (extraButtons && hasAtLeast(extraButtons, 1)) {
41
+ buttons = [...buttons, ...extraButtons];
42
+ }
43
+ return /* @__PURE__ */ jsx(ElementActionButtons, { ...props, buttons });
39
44
  };
40
- const DeploymentElementActions = (props) => {
41
- const { enableNavigateTo, enableRelationshipBrowser } = useEnabledFeature("NavigateTo", "RelationshipBrowser");
45
+ const DeploymentElementActions = ({
46
+ extraButtons,
47
+ ...props
48
+ }) => {
49
+ const { enableNavigateTo, enableRelationshipBrowser } = useEnabledFeatures();
42
50
  const diagram = useDiagram();
43
- const buttons = [];
44
51
  const { navigateTo, modelFqn } = props.data;
45
- if (navigateTo && enableNavigateTo) {
46
- buttons.push({
47
- key: "navigate",
48
- icon: /* @__PURE__ */ jsx(IconZoomScan, {}),
49
- onClick: (e) => {
50
- e.stopPropagation();
51
- diagram.navigateTo(navigateTo, props.id);
52
- }
53
- });
54
- }
55
- if (enableRelationshipBrowser && !!modelFqn) {
56
- buttons.push({
57
- key: "relationships",
58
- icon: /* @__PURE__ */ jsx(IconTransform, {}),
59
- onClick: (e) => {
60
- e.stopPropagation();
61
- diagram.openRelationshipsBrowser(modelFqn);
62
- }
63
- });
52
+ let buttons = useMemo(() => {
53
+ const buttons2 = [];
54
+ if (navigateTo && enableNavigateTo) {
55
+ buttons2.push({
56
+ key: "navigate",
57
+ icon: /* @__PURE__ */ jsx(IconZoomScan, {}),
58
+ onClick: (e) => {
59
+ e.stopPropagation();
60
+ diagram.navigateTo(navigateTo, props.id);
61
+ }
62
+ });
63
+ }
64
+ if (enableRelationshipBrowser && !!modelFqn) {
65
+ buttons2.push({
66
+ key: "relationships",
67
+ icon: /* @__PURE__ */ jsx(IconTransform, {}),
68
+ onClick: (e) => {
69
+ e.stopPropagation();
70
+ diagram.openRelationshipsBrowser(modelFqn);
71
+ }
72
+ });
73
+ }
74
+ return buttons2;
75
+ }, [enableNavigateTo, enableRelationshipBrowser, diagram, modelFqn, navigateTo, props.id]);
76
+ if (extraButtons && hasAtLeast(extraButtons, 1)) {
77
+ buttons = [...buttons, ...extraButtons];
64
78
  }
65
- return /* @__PURE__ */ jsx(ElementActionButtons, { buttons, ...props });
79
+ return /* @__PURE__ */ jsx(ElementActionButtons, { ...props, buttons });
66
80
  };
67
81
 
68
82
  export { DeploymentElementActions, ElementActions };
@@ -0,0 +1,8 @@
1
+ export { CompoundActions } from './CompoundActions';
2
+ export { DeploymentElementActions, ElementActions } from './ElementActions';
3
+ export { CompoundDeploymentNode, CompoundDetailsButtonWithHandler, CompoundElementNode, DeploymentNode, ElementDetailsButtonWithHandler, ElementNode, ViewGroupNode, } from './nodes';
4
+ export * from './CompoundActions';
5
+ export * from './ElementActions';
6
+ export * from './toolbar/CompoundToolbar';
7
+ export * from './toolbar/ElementToolbar';
8
+ export * from './toolbar/Toolbar';
@@ -0,0 +1,10 @@
1
+ import { NodeProps } from '../../../base';
2
+ import { Types } from '../../types';
3
+ import { MemoExoticComponent } from 'react';
4
+ export declare function ElementDetailsButtonWithHandler(props: NodeProps<Types.ElementNodeData | Types.DeploymentElementNodeData>): import("react/jsx-runtime").JSX.Element | null;
5
+ export declare function CompoundDetailsButtonWithHandler(props: NodeProps<Types.CompoundElementNodeData | Types.CompoundDeploymentNodeData>): import("react/jsx-runtime").JSX.Element | null;
6
+ export declare const ElementNode: MemoExoticComponent<(props: NodeProps<Types.ElementNodeData, "element">) => import("react/jsx-runtime").JSX.Element>;
7
+ export declare const DeploymentNode: MemoExoticComponent<(props: NodeProps<Types.DeploymentElementNodeData, "deployment">) => import("react/jsx-runtime").JSX.Element>;
8
+ export declare const CompoundElementNode: MemoExoticComponent<(props: NodeProps<Types.CompoundElementNodeData, "compound-element">) => import("react/jsx-runtime").JSX.Element>;
9
+ export declare const CompoundDeploymentNode: MemoExoticComponent<(props: NodeProps<Types.CompoundDeploymentNodeData, "compound-deployment">) => import("react/jsx-runtime").JSX.Element>;
10
+ export declare const ViewGroupNode: MemoExoticComponent<(props: NodeProps<Types.ViewGroupNodeData, "view-group">) => import("react/jsx-runtime").JSX.Element>;
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import '@likec4/core';
2
+ import { IfNotReadOnly, IfEnabled, useEnabledFeatures } from '../../../context/DiagramFeatures.js';
3
3
  import { useDiagram } from '../../../hooks/useDiagram.js';
4
4
  import { CompoundActions } from './CompoundActions.js';
5
5
  import { DeploymentElementActions, ElementActions } from './ElementActions.js';
@@ -8,18 +8,18 @@ import { DeploymentElementToolbar, ElementToolbar } from './toolbar/ElementToolb
8
8
  import { customNode } from '../../../base/primitives/customNode.js';
9
9
  import { CompoundNodeContainer } from '../../../base/primitives/compound/CompoundNodeContainer.js';
10
10
  import { CompoundTitle } from '../../../base/primitives/compound/CompoundTitle.js';
11
- import { IfNotEnabled, IfEnabled, useEnabledFeature } from '../../../context/DiagramFeatures.js';
12
11
  import { DefaultHandles } from '../../../base/primitives/NodeHandles.js';
13
- import { CompoundDetailsButton } from '../../../base/primitives/compound/CompoundDetailsButton.js';
14
12
  import { ElementNodeContainer } from '../../../base/primitives/element/ElementNodeContainer.js';
15
13
  import { ElementShape } from '../../../base/primitives/element/ElementShape.js';
16
14
  import { ElementTitle } from '../../../base/primitives/element/ElementTitle.js';
15
+ import { CompoundDetailsButton } from '../../../base/primitives/compound/CompoundDetailsButton.js';
17
16
  import { ElementDetailsButton } from '../../../base/primitives/element/ElementDetailsButton.js';
18
17
 
19
- const ElementDetailsButtonWithHandler = ({ fqn, ...props }) => {
20
- const { enableElementDetails } = useEnabledFeature("ElementDetails");
18
+ function ElementDetailsButtonWithHandler(props) {
19
+ const { enableElementDetails } = useEnabledFeatures();
21
20
  const diagram = useDiagram();
22
- if (!enableElementDetails) return null;
21
+ const fqn = props.data.modelFqn;
22
+ if (!enableElementDetails || !fqn) return null;
23
23
  return /* @__PURE__ */ jsx(
24
24
  ElementDetailsButton,
25
25
  {
@@ -30,63 +30,63 @@ const ElementDetailsButtonWithHandler = ({ fqn, ...props }) => {
30
30
  }
31
31
  }
32
32
  );
33
- };
33
+ }
34
+ function CompoundDetailsButtonWithHandler(props) {
35
+ const { enableElementDetails } = useEnabledFeatures();
36
+ const diagram = useDiagram();
37
+ const fqn = props.data.modelFqn;
38
+ if (!enableElementDetails || !fqn) return null;
39
+ return /* @__PURE__ */ jsx(
40
+ CompoundDetailsButton,
41
+ {
42
+ ...props,
43
+ onClick: (e) => {
44
+ e.stopPropagation();
45
+ diagram.openElementDetails(fqn, props.id);
46
+ }
47
+ }
48
+ );
49
+ }
34
50
  const ElementNode = customNode((props) => /* @__PURE__ */ jsxs(ElementNodeContainer, { nodeProps: props, children: [
35
- /* @__PURE__ */ jsx(ElementShape, { ...props, isMultiple: props.data.isMultiple }),
51
+ /* @__PURE__ */ jsx(ElementShape, { ...props }),
36
52
  /* @__PURE__ */ jsx(ElementTitle, { ...props }),
37
53
  /* @__PURE__ */ jsx(ElementActions, { ...props }),
38
- /* @__PURE__ */ jsx(
39
- ElementDetailsButtonWithHandler,
40
- {
41
- fqn: props.data.modelFqn,
42
- ...props
43
- }
44
- ),
45
- /* @__PURE__ */ jsx(IfNotEnabled, { feature: "ReadOnly", children: /* @__PURE__ */ jsx(ElementToolbar, { ...props }) }),
54
+ /* @__PURE__ */ jsx(ElementDetailsButtonWithHandler, { ...props }),
55
+ /* @__PURE__ */ jsx(IfNotReadOnly, { children: /* @__PURE__ */ jsx(ElementToolbar, { ...props }) }),
46
56
  /* @__PURE__ */ jsx(DefaultHandles, {})
47
57
  ] }));
58
+ ElementNode.displayName = "ElementNode";
48
59
  const DeploymentNode = customNode((props) => /* @__PURE__ */ jsxs(ElementNodeContainer, { nodeProps: props, children: [
49
- /* @__PURE__ */ jsx(ElementShape, { ...props, isMultiple: props.data.isMultiple }),
60
+ /* @__PURE__ */ jsx(ElementShape, { ...props }),
50
61
  /* @__PURE__ */ jsx(ElementTitle, { ...props }),
51
62
  /* @__PURE__ */ jsx(DeploymentElementActions, { ...props }),
52
- !!props.data.modelFqn && /* @__PURE__ */ jsx(
53
- ElementDetailsButtonWithHandler,
54
- {
55
- fqn: props.data.modelFqn,
56
- ...props
57
- }
58
- ),
59
- /* @__PURE__ */ jsx(IfNotEnabled, { feature: "ReadOnly", children: /* @__PURE__ */ jsx(DeploymentElementToolbar, { ...props }) }),
63
+ /* @__PURE__ */ jsx(ElementDetailsButtonWithHandler, { ...props }),
64
+ /* @__PURE__ */ jsx(IfNotReadOnly, { children: /* @__PURE__ */ jsx(DeploymentElementToolbar, { ...props }) }),
60
65
  /* @__PURE__ */ jsx(DefaultHandles, {})
61
66
  ] }));
67
+ DeploymentNode.displayName = "DeploymentNode";
62
68
  const CompoundElementNode = customNode((props) => {
63
- const diagram = useDiagram();
69
+ useDiagram();
64
70
  return /* @__PURE__ */ jsxs(CompoundNodeContainer, { nodeProps: props, children: [
65
71
  /* @__PURE__ */ jsx(CompoundTitle, { ...props }),
66
72
  /* @__PURE__ */ jsx(CompoundActions, { ...props }),
67
- /* @__PURE__ */ jsx(IfEnabled, { feature: "ElementDetails", children: /* @__PURE__ */ jsx(
68
- CompoundDetailsButton,
69
- {
70
- ...props,
71
- onClick: (e) => {
72
- e.stopPropagation();
73
- diagram.openElementDetails(props.data.modelFqn, props.id);
74
- }
75
- }
76
- ) }),
77
- /* @__PURE__ */ jsx(IfNotEnabled, { feature: "ReadOnly", children: /* @__PURE__ */ jsx(CompoundElementToolbar, { ...props }) }),
73
+ /* @__PURE__ */ jsx(IfEnabled, { feature: "ElementDetails", children: /* @__PURE__ */ jsx(CompoundDetailsButtonWithHandler, { ...props }) }),
74
+ /* @__PURE__ */ jsx(IfNotReadOnly, { children: /* @__PURE__ */ jsx(CompoundElementToolbar, { ...props }) }),
78
75
  /* @__PURE__ */ jsx(DefaultHandles, {})
79
76
  ] });
80
77
  });
78
+ CompoundElementNode.displayName = "CompoundElementNode";
81
79
  const CompoundDeploymentNode = customNode((props) => /* @__PURE__ */ jsxs(CompoundNodeContainer, { nodeProps: props, children: [
82
80
  /* @__PURE__ */ jsx(CompoundTitle, { ...props }),
83
81
  /* @__PURE__ */ jsx(CompoundActions, { ...props }),
84
- /* @__PURE__ */ jsx(IfNotEnabled, { feature: "ReadOnly", children: /* @__PURE__ */ jsx(CompoundDeploymentToolbar, { ...props }) }),
82
+ /* @__PURE__ */ jsx(IfNotReadOnly, { children: /* @__PURE__ */ jsx(CompoundDeploymentToolbar, { ...props }) }),
85
83
  /* @__PURE__ */ jsx(DefaultHandles, {})
86
84
  ] }));
85
+ CompoundDeploymentNode.displayName = "CompoundDeploymentNode";
87
86
  const ViewGroupNode = customNode((props) => /* @__PURE__ */ jsxs(CompoundNodeContainer, { nodeProps: props, children: [
88
87
  /* @__PURE__ */ jsx(CompoundTitle, { ...props }),
89
88
  /* @__PURE__ */ jsx(DefaultHandles, {})
90
89
  ] }));
90
+ ViewGroupNode.displayName = "ViewGroupNode";
91
91
 
92
- export { CompoundDeploymentNode, CompoundElementNode, DeploymentNode, ElementNode, ViewGroupNode };
92
+ export { CompoundDeploymentNode, CompoundDetailsButtonWithHandler, CompoundElementNode, DeploymentNode, ElementDetailsButtonWithHandler, ElementNode, ViewGroupNode };
@@ -2,7 +2,7 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { defaultTheme } from '@likec4/core';
3
3
  import { Popover, PopoverTarget, Button, ColorSwatch, PopoverDropdown, Space, Divider, Stack, TooltipGroup, Flex, Tooltip, CheckIcon, rem, Slider } from '@mantine/core';
4
4
  import { useUpdateEffect } from '@react-hookz/web';
5
- import { r as reactExports } from '../../../../_virtual/index.js';
5
+ import { useState } from 'react';
6
6
  import { themedColors, colors } from './_shared.js';
7
7
 
8
8
  function ColorButton({
@@ -137,7 +137,7 @@ function OpacityOption({
137
137
  elementOpacity = 100,
138
138
  onOpacityChange
139
139
  }) {
140
- const [value, setValue] = reactExports.useState(elementOpacity);
140
+ const [value, setValue] = useState(elementOpacity);
141
141
  useUpdateEffect(() => {
142
142
  setValue(elementOpacity);
143
143
  }, [elementOpacity]);
@@ -1,14 +1,13 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import '@likec4/core';
3
2
  import { Box, SegmentedControl } from '@mantine/core';
4
- import { r as reactExports } from '../../../../_virtual/index.js';
3
+ import { useState, useEffect } from 'react';
4
+ import { useEnabledFeatures } from '../../../../context/DiagramFeatures.js';
5
5
  import { useHandlers, GoToSourceButton, BrowseRelationshipsButton } from './_shared.js';
6
6
  import { ColorButton } from './ColorButton.js';
7
7
  import { Toolbar } from './Toolbar.js';
8
- import { useEnabledFeature } from '../../../../context/DiagramFeatures.js';
9
8
 
10
9
  function CompoundElementToolbar(props) {
11
- const { enableVscode, enableRelationshipBrowser } = useEnabledFeature("RelationshipBrowser", "Vscode");
10
+ const { enableVscode, enableRelationshipBrowser } = useEnabledFeatures();
12
11
  const {
13
12
  data: {
14
13
  style,
@@ -48,7 +47,7 @@ function CompoundElementToolbar(props) {
48
47
  );
49
48
  }
50
49
  function CompoundDeploymentToolbar(props) {
51
- const { enableVscode, enableRelationshipBrowser } = useEnabledFeature("RelationshipBrowser", "Vscode");
50
+ const { enableVscode, enableRelationshipBrowser } = useEnabledFeatures();
52
51
  const {
53
52
  data: {
54
53
  deploymentFqn,
@@ -92,8 +91,8 @@ function BorderStyleOption({
92
91
  elementBorderStyle = "dashed",
93
92
  onChange
94
93
  }) {
95
- const [value, setValue] = reactExports.useState(elementBorderStyle);
96
- reactExports.useEffect(() => {
94
+ const [value, setValue] = useState(elementBorderStyle);
95
+ useEffect(() => {
97
96
  setValue(elementBorderStyle);
98
97
  }, [elementBorderStyle]);
99
98
  return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
@@ -2,14 +2,14 @@ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { ElementShapes } from '@likec4/core';
3
3
  import { Menu, MenuTarget, Button, MenuDropdown, MenuItem } from '@mantine/core';
4
4
  import { IconSelector, IconCheck } from '@tabler/icons-react';
5
+ import { useEnabledFeatures } from '../../../../context/DiagramFeatures.js';
5
6
  import { stopPropagation } from '../../../../utils/xyflow.js';
6
7
  import { useHandlers, GoToSourceButton, BrowseRelationshipsButton } from './_shared.js';
7
8
  import { ColorButton } from './ColorButton.js';
8
9
  import { Toolbar } from './Toolbar.js';
9
- import { useEnabledFeature } from '../../../../context/DiagramFeatures.js';
10
10
 
11
11
  function ElementToolbar(props) {
12
- const { enableVscode, enableRelationshipBrowser } = useEnabledFeature("RelationshipBrowser", "Vscode");
12
+ const { enableVscode, enableRelationshipBrowser } = useEnabledFeatures();
13
13
  const {
14
14
  data: {
15
15
  shape,
@@ -47,7 +47,7 @@ function ElementToolbar(props) {
47
47
  );
48
48
  }
49
49
  function DeploymentElementToolbar(props) {
50
- const { enableVscode, enableRelationshipBrowser } = useEnabledFeature("RelationshipBrowser", "Vscode");
50
+ const { enableVscode, enableRelationshipBrowser } = useEnabledFeatures();
51
51
  const {
52
52
  data: {
53
53
  shape,
@@ -1,8 +1,9 @@
1
1
  import { NodeToolbarProps } from '@xyflow/react';
2
2
  import { ReactNode } from 'react';
3
- import { Base } from '../../../../base';
3
+ import { NodeProps } from '../../../../base/types';
4
+ import { Types } from '../../../types';
4
5
  export type ToolbarProps = Omit<NodeToolbarProps, 'title'> & {
5
- nodeProps: Base.NodeProps;
6
+ nodeProps: NodeProps<Types.NodeData>;
6
7
  title: ReactNode;
7
8
  };
8
9
  export declare function Toolbar({ title, children, nodeProps, ...props }: ToolbarProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,8 +1,8 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { cx } from '@likec4/styles/css';
2
3
  import { Paper, Stack, Box, Text, Group } from '@mantine/core';
3
4
  import { useDebouncedValue } from '@mantine/hooks';
4
5
  import { NodeToolbar } from '@xyflow/react';
5
- import clsx from 'clsx';
6
6
  import { useDiagramContext } from '../../../../hooks/useDiagram.js';
7
7
  import { stopPropagation } from '../../../../utils/xyflow.js';
8
8
  import { toolbarTitle } from './styles.css.js';
@@ -45,7 +45,7 @@ function Toolbar({ title, children, nodeProps, ...props }) {
45
45
  children: /* @__PURE__ */ jsx(
46
46
  Paper,
47
47
  {
48
- className: clsx("nodrag", "nopan"),
48
+ className: cx("nodrag", "nopan"),
49
49
  px: 5,
50
50
  pb: 8,
51
51
  pt: 4,
@@ -16,7 +16,7 @@ export declare const themedColors: ({
16
16
  value: `#${string}`;
17
17
  })[];
18
18
  export declare const colors: {
19
- key: "amber" | "blue" | "gray" | "slate" | "green" | "indigo" | "red" | "sky";
19
+ key: "blue" | "gray" | "green" | "indigo" | "red" | "amber" | "slate" | "sky";
20
20
  value: `#${string}`;
21
21
  }[];
22
22
  export type ThemeColorKey = typeof themedColors[0]['key'];
@@ -26,7 +26,7 @@ export declare const Tooltip: ForwardRefExoticComponent< TooltipProps & RefAttri
26
26
  renderRoot?: (props: Record<string, any>) => React.ReactNode;
27
27
  }>;
28
28
  export declare function useHandlers(target: Fqn, props: NodeProps<Types.NodeData>): {
29
- elementColor: "amber" | "blue" | "gray" | "slate" | "green" | "indigo" | "muted" | "primary" | "red" | "secondary" | "sky";
29
+ elementColor: "blue" | "gray" | "green" | "indigo" | "red" | "amber" | "slate" | "muted" | "primary" | "secondary" | "sky";
30
30
  onColorPreview: (color: ThemeColor | null) => void;
31
31
  onChange: OnStyleChange;
32
32
  };