@likec4/diagram 1.27.3 → 1.28.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 (55) hide show
  1. package/bundle/index.js +564 -443
  2. package/dist/base/primitives/customEdge.d.ts +1 -1
  3. package/dist/base/primitives/edge/EdgeActionButton.d.ts +1 -2
  4. package/dist/base/primitives/edge/EdgePath.d.ts +1 -1
  5. package/dist/base/primitives/element/ElementActionButtons.d.ts +1 -1
  6. package/dist/base/primitives/element/ElementActionButtons.js +5 -3
  7. package/dist/base/primitives/element/ElementDetailsButton.js +5 -1
  8. package/dist/bundle/styles.css.js +2 -2
  9. package/dist/hooks/useDiagram.d.ts +3 -7
  10. package/dist/hooks/useXYFlow.d.ts +2 -2
  11. package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +2 -2
  12. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +11 -1
  13. package/dist/likec4diagram/custom/index.d.ts +2 -1
  14. package/dist/likec4diagram/ui/notation/NotationPanel.js +0 -1
  15. package/dist/overlays/Overlays.js +2 -2
  16. package/dist/overlays/element-details/actor.d.ts +303 -303
  17. package/dist/overlays/overlay/Overlay.css.d.ts +2 -25
  18. package/dist/overlays/overlay/Overlay.css.js +0 -40
  19. package/dist/overlays/overlay/Overlay.d.ts +1 -1
  20. package/dist/overlays/overlay/Overlay.js +97 -88
  21. package/dist/overlays/overlaysActor.js +4 -1
  22. package/dist/overlays/relationship-details/RelationshipDetails.d.ts +1 -1
  23. package/dist/overlays/relationship-details/actor.d.ts +1 -2
  24. package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +1 -1
  25. package/dist/overlays/relationship-details/custom/nodeTypes.js +1 -1
  26. package/dist/overlays/relationship-details/hooks.d.ts +2 -3
  27. package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +1 -1
  28. package/dist/overlays/relationships-browser/actor.d.ts +2 -3
  29. package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +1 -1
  30. package/dist/overlays/relationships-browser/custom/nodeTypes.js +1 -1
  31. package/dist/overlays/relationships-browser/hooks.d.ts +2 -3
  32. package/dist/state/diagram-machine.d.ts +2 -2
  33. package/dist/state/hotkeyActor.js +12 -3
  34. package/dist/styles.css.js +1 -1
  35. package/package.json +10 -10
  36. package/src/base/primitives/compound/CompoundNodeContainer.css.ts +0 -3
  37. package/src/base/primitives/edge/EdgeActionButton.tsx +1 -2
  38. package/src/base/primitives/element/ElementActionButtons.tsx +5 -3
  39. package/src/base/primitives/element/ElementDetailsButton.tsx +4 -0
  40. package/src/base/primitives/element/ElementNodeContainer.css.ts +0 -18
  41. package/src/bundle/styles.css.ts +7 -2
  42. package/src/components/SearchControl.css.ts +4 -8
  43. package/src/hooks/useDiagram.ts +1 -1
  44. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +7 -1
  45. package/src/likec4diagram/custom/edges/edges.css.ts +0 -2
  46. package/src/likec4diagram/ui/notation/NotationPanel.css.ts +0 -4
  47. package/src/likec4diagram/ui/notation/NotationPanel.tsx +0 -1
  48. package/src/likec4diagram/ui/search/ViewsColumn.css.ts +0 -4
  49. package/src/overlays/Overlays.tsx +2 -2
  50. package/src/overlays/overlay/Overlay.css.ts +0 -40
  51. package/src/overlays/overlay/Overlay.tsx +107 -98
  52. package/src/overlays/overlaysActor.ts +5 -1
  53. package/src/overlays/relationship-details/custom/nodeTypes.tsx +1 -1
  54. package/src/overlays/relationships-browser/custom/nodeTypes.tsx +1 -1
  55. package/src/state/hotkeyActor.ts +13 -3
@@ -1,6 +1,6 @@
1
1
  import { FunctionComponent, NamedExoticComponent, CSSProperties, ReactNode } from 'react';
2
2
  import { Base, EdgeProps } from '../types';
3
- import { Position } from '@xyflow/system';
3
+ import { Position } from '@xyflow/react';
4
4
  export declare const edgePropsEqual: <P extends Record<string, unknown> = Base.EdgeData>(prev: EdgeProps<P>, next: EdgeProps<P>) => boolean;
5
5
  export declare function customEdge<P extends Record<string, unknown> = Base.NodeData>(Edge: FunctionComponent<EdgeProps<P>>): NamedExoticComponent<{
6
6
  id: string;
@@ -1,5 +1,4 @@
1
- import { EdgeProps } from '../../types';
2
- type EdgeActionBtnProps = EdgeProps & {
1
+ type EdgeActionBtnProps = {
3
2
  icon?: React.ReactNode;
4
3
  onClick: (e: React.MouseEvent) => void;
5
4
  };
@@ -1,5 +1,5 @@
1
1
  import { PointerEventHandler, ForwardRefExoticComponent, CSSProperties, ReactNode, RefAttributes } from 'react';
2
- import { Position } from '@xyflow/system';
2
+ import { Position } from '@xyflow/react';
3
3
  import { RelationshipLineType, RelationshipArrowType } from '@likec4/core';
4
4
  export declare const EdgePath: ForwardRefExoticComponent<{
5
5
  id: string;
@@ -2,7 +2,7 @@ import { NodeProps } from '../../types';
2
2
  type ElementActionButtonsProps = NodeProps & {
3
3
  buttons: ElementActionButtons.Item[];
4
4
  };
5
- export declare function ElementActionButtons({ id, selected, data: { hovered: isHovered, }, buttons, }: ElementActionButtonsProps): import("react/jsx-runtime").JSX.Element | null;
5
+ export declare function ElementActionButtons({ selected, data: { hovered: isHovered, }, buttons, }: ElementActionButtonsProps): import("react/jsx-runtime").JSX.Element | null;
6
6
  export declare namespace ElementActionButtons {
7
7
  type Item = {
8
8
  key?: string;
@@ -2,6 +2,7 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import { css, cx } from '@likec4/styles/css';
3
3
  import { actionBtn } from '@likec4/styles/recipes';
4
4
  import { Box, ActionIcon } from '@mantine/core';
5
+ import { useId } from '@mantine/hooks';
5
6
  import { m } from 'framer-motion';
6
7
  import { useIsZoomTooSmall } from '../../../hooks/useXYFlow.js';
7
8
  import { stopPropagation } from '../../../utils/xyflow.js';
@@ -27,13 +28,13 @@ const actionButtons = css({
27
28
  alignItems: "center"
28
29
  });
29
30
  function ElementActionButtons({
30
- id,
31
31
  selected = false,
32
32
  data: {
33
33
  hovered: isHovered = false
34
34
  },
35
35
  buttons
36
36
  }) {
37
+ const id = useId();
37
38
  const zoomTooSmall = useIsZoomTooSmall();
38
39
  if (!buttons.length || zoomTooSmall) {
39
40
  return null;
@@ -70,9 +71,10 @@ function ElementActionButtons({
70
71
  onDoubleClick: stopPropagation,
71
72
  children: button.icon
72
73
  },
73
- `action-button-${id}-${button.key ?? index}`
74
+ `${id}-${button.key ?? index}`
74
75
  ))
75
- }
76
+ },
77
+ `${id}-action-buttons`
76
78
  ) });
77
79
  }
78
80
 
@@ -2,6 +2,7 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import { cx, css } from '@likec4/styles/css';
3
3
  import { actionBtn } from '@likec4/styles/recipes';
4
4
  import { Box, ActionIcon } from '@mantine/core';
5
+ import { useId } from '@mantine/hooks';
5
6
  import { IconId } from '@tabler/icons-react';
6
7
  import { m } from 'framer-motion';
7
8
  import { stopPropagation } from '../../../utils/xyflow.js';
@@ -35,11 +36,13 @@ function ElementDetailsButton({
35
36
  icon,
36
37
  onClick
37
38
  }) {
39
+ const id = useId();
38
40
  return /* @__PURE__ */ jsx(Box, { className: cx(container, "details-button"), children: /* @__PURE__ */ jsx(
39
41
  ActionIcon,
40
42
  {
41
43
  className: cx("nodrag nopan", actionBtn({ variant: "transparent" })),
42
44
  component: m.button,
45
+ layout: true,
43
46
  initial: false,
44
47
  style: {
45
48
  originX: 0.45,
@@ -60,7 +63,8 @@ function ElementDetailsButton({
60
63
  onClick,
61
64
  onDoubleClick: stopPropagation,
62
65
  children: icon ?? /* @__PURE__ */ jsx(IconId, { stroke: 1.8, style: { width: "75%" } })
63
- }
66
+ },
67
+ id
64
68
  ) });
65
69
  }
66
70
 
@@ -1,8 +1,8 @@
1
1
  import { css } from '@likec4/styles/css';
2
2
  import { createTheme, Portal } from '@mantine/core';
3
- import { useColorScheme as useColorScheme$1, useMutationObserver, useDebouncedCallback } from '@mantine/hooks';
3
+ import { useColorScheme as useColorScheme$1, useMutationObserver, useDebouncedCallback, useId } from '@mantine/hooks';
4
4
  import { useIsomorphicLayoutEffect } from '@react-hookz/web';
5
- import { useState, useId } from 'react';
5
+ import { useState } from 'react';
6
6
  import { first, isString, isFunction } from 'remeda';
7
7
  import inlinedStyles from '../styles.css.js';
8
8
  import fontsCss from './font.css.js';
@@ -13,9 +13,9 @@ import { HotKeyEvent } from '../state/hotkeyActor';
13
13
  import { OverlaysContext, OverlayActorEvent, OverlayActorEmitedEvent } from '../overlays/overlaysActor';
14
14
  import { ElementDetailsLogic } from '../overlays/element-details/actor';
15
15
  import { EnabledFeatures } from '../context';
16
- import { ReactFlowState, ReactFlowInstance } from '@xyflow/react';
17
- import { EdgeMarkerType, HandleType, XYPosition, Viewport, NodeChange, EdgeChange } from '@xyflow/system';
16
+ import { ReactFlowState, EdgeMarkerType, HandleType, ReactFlowInstance } from '@xyflow/react';
18
17
  import { ReactNode, CSSProperties } from 'react';
18
+ import { XYPosition, Viewport, NodeChange, EdgeChange } from '@xyflow/system';
19
19
  export { useDiagramActorRef };
20
20
  export declare function useDiagram(): {
21
21
  actor: DiagramActorRef;
@@ -9775,11 +9775,7 @@ export declare function useDiagram(): {
9775
9775
  readonly 'xyflow.applyEdgeChanges': {
9776
9776
  readonly actions: ActionFunction<DiagramContext, {
9777
9777
  type: "xyflow.applyEdgeChanges";
9778
- changes: EdgeChange<
9779
- /**
9780
- * @warning Do not use in render phase
9781
- */
9782
- Types.Edge>[];
9778
+ changes: EdgeChange<Types.Edge>[];
9783
9779
  }, Events, undefined, Values<{
9784
9780
  syncManualLayoutActorLogic: {
9785
9781
  src: "syncManualLayoutActorLogic";
@@ -1,8 +1,8 @@
1
- import { ReactFlowState, ReactFlowInstance, InternalNode } from '@xyflow/react';
1
+ import { ReactFlowState, ReactFlowInstance, EdgeMarkerType, HandleType, InternalNode } from '@xyflow/react';
2
2
  import { Types } from '../likec4diagram/types';
3
- import { EdgeMarkerType, HandleType, XYPosition } from '@xyflow/system';
4
3
  import { ReactNode, CSSProperties } from 'react';
5
4
  import { EdgeId, NonEmptyArray, Point, Color, BBox, RelationshipLineType, RelationshipArrowType, ViewId } from '@likec4/core';
5
+ import { XYPosition } from '@xyflow/system';
6
6
  export declare const useXYFlow: () => ReactFlowInstance<Types.Node, {
7
7
  id: string;
8
8
  source: string;
@@ -1,7 +1,7 @@
1
1
  import { EdgeId, NonEmptyArray, Point, Color, BBox, RelationshipLineType, RelationshipArrowType, ViewId } from '@likec4/core';
2
- import { XYPosition } from '@xyflow/react';
3
2
  import { NamedExoticComponent, CSSProperties, ReactNode } from 'react';
4
- import { Position } from '@xyflow/system';
3
+ import { Position } from '@xyflow/react';
4
+ import { XYPosition } from '@xyflow/system';
5
5
  export declare const RelationshipEdge: NamedExoticComponent<{
6
6
  id: string;
7
7
  selected?: boolean;
@@ -265,7 +265,17 @@ const RelationshipEdge = customEdge((props) => {
265
265
  }
266
266
  return /* @__PURE__ */ jsxs(Fragment, { children: [
267
267
  /* @__PURE__ */ jsxs(EdgeContainer, { ...props, className: clsx(isControlPointDragging && controlDragging), children: [
268
- /* @__PURE__ */ jsx(EdgePath, { ...props, svgPath: edgePath, ref: svgPathRef, onEdgePointerDown }),
268
+ /* @__PURE__ */ jsx(
269
+ EdgePath,
270
+ {
271
+ ...props,
272
+ svgPath: edgePath,
273
+ ref: svgPathRef,
274
+ ...enableEdgeEditing && {
275
+ onEdgePointerDown
276
+ }
277
+ }
278
+ ),
269
279
  /* @__PURE__ */ jsx(
270
280
  EdgeLabelContainer,
271
281
  {
@@ -1,8 +1,9 @@
1
1
  import { Types } from '../types';
2
2
  import { NamedExoticComponent, CSSProperties, ReactNode } from 'react';
3
3
  import { NodeProps } from '../../base';
4
- import { Position, XYPosition } from '@xyflow/system';
4
+ import { Position } from '@xyflow/react';
5
5
  import { EdgeId, NonEmptyArray, Point, Color, BBox, RelationshipLineType, RelationshipArrowType, ViewId } from '@likec4/core';
6
+ import { XYPosition } from '@xyflow/system';
6
7
  export declare const nodeTypes: {
7
8
  element: NamedExoticComponent<NodeProps<Types.ElementNodeData>>;
8
9
  deployment: NamedExoticComponent<NodeProps<Types.DeploymentElementNodeData>>;
@@ -1,7 +1,6 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import '@likec4/core';
3
3
  import { cx, css } from '@likec4/styles/css';
4
- import '@likec4/styles/tokens';
5
4
  import { Tooltip, ThemeIcon, ActionIcon, Paper, Tabs, TabsList, TabsTab, TabsPanel, ScrollAreaAutosize, Stack, Card, Group, Box, Badge, Text } from '@mantine/core';
6
5
  import { useLocalStorage } from '@mantine/hooks';
7
6
  import { IconAlertTriangle, IconHelpCircle, IconArrowDownRight } from '@tabler/icons-react';
@@ -92,7 +92,7 @@ const Overlays = memo(({ overlaysActorRef }) => {
92
92
  return /* @__PURE__ */ jsx(
93
93
  Overlay,
94
94
  {
95
- overlayLevel: Math.min(index, 3),
95
+ overlayLevel: index,
96
96
  onClose: () => close(overlay.actorRef),
97
97
  children: /* @__PURE__ */ jsx(RelationshipsBrowser, { actorRef: overlay.actorRef })
98
98
  },
@@ -102,7 +102,7 @@ const Overlays = memo(({ overlaysActorRef }) => {
102
102
  return /* @__PURE__ */ jsx(
103
103
  Overlay,
104
104
  {
105
- overlayLevel: Math.min(index, 3),
105
+ overlayLevel: index,
106
106
  onClose: () => close(overlay.actorRef),
107
107
  children: /* @__PURE__ */ jsx(RelationshipDetails, { actorRef: overlay.actorRef })
108
108
  },