@likec4/diagram 1.28.0 → 1.28.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 (151) hide show
  1. package/bundle/index.js +967 -1150
  2. package/dist/LikeC4CustomColors.js +2 -2
  3. package/dist/LikeC4Diagram.js +2 -2
  4. package/dist/LikeC4ModelProvider.js +1 -1
  5. package/dist/_virtual/index.js +5 -0
  6. package/dist/_virtual/index2.js +3 -0
  7. package/dist/_virtual/react.production.js +3 -0
  8. package/dist/base/BaseXYFlow.js +5 -5
  9. package/dist/base/primitives/compound/CompoundActionButton.js +1 -1
  10. package/dist/base/primitives/compound/CompoundDetailsButton.js +1 -1
  11. package/dist/base/primitives/compound/CompoundNodeContainer.d.ts +1 -1
  12. package/dist/base/primitives/compound/CompoundNodeContainer.js +2 -2
  13. package/dist/base/primitives/customEdge.d.ts +1 -1
  14. package/dist/base/primitives/customEdge.js +2 -2
  15. package/dist/base/primitives/customNode.js +2 -2
  16. package/dist/base/primitives/edge/EdgeContainer.js +1 -1
  17. package/dist/base/primitives/edge/EdgeLabel.js +1 -1
  18. package/dist/base/primitives/edge/EdgeLabelContainer.js +1 -1
  19. package/dist/base/primitives/edge/EdgePath.d.ts +10 -42
  20. package/dist/base/primitives/edge/EdgePath.js +23 -16
  21. package/dist/base/primitives/edge/edge.css.js +1 -1
  22. package/dist/base/primitives/element/ElementActionButtons.js +1 -2
  23. package/dist/base/primitives/element/ElementDetailsButton.js +1 -2
  24. package/dist/base/primitives/element/ElementNodeContainer.js +3 -3
  25. package/dist/base/updateEdges.js +7 -2
  26. package/dist/base/updateNodes.js +11 -3
  27. package/dist/bundle/LikeC4View.js +3 -3
  28. package/dist/bundle/ReactLikeC4.js +1 -1
  29. package/dist/bundle/ShadowRoot.js +3 -3
  30. package/dist/bundle/styles.css.js +3 -3
  31. package/dist/context/ControlsCustomLayout.js +1 -1
  32. package/dist/context/DiagramEventHandlers.js +5 -5
  33. package/dist/context/DiagramFeatures.js +7 -7
  34. package/dist/context/EnsureMantine.js +2 -2
  35. package/dist/context/FramerMotionConfig.js +2 -2
  36. package/dist/context/IconRenderer.js +4 -4
  37. package/dist/context/ReduceGraphics.js +2 -2
  38. package/dist/context/RootContainer.js +5 -9
  39. package/dist/hooks/safeContext.js +3 -3
  40. package/dist/hooks/useCurrentViewId.js +1 -1
  41. package/dist/hooks/useDiagram.d.ts +4 -4
  42. package/dist/hooks/useDiagram.js +2 -2
  43. package/dist/hooks/useMantinePortalProps.js +2 -2
  44. package/dist/hooks/useSetState.js +3 -3
  45. package/dist/hooks/useUpdateEffect.js +1 -1
  46. package/dist/hooks/useXYFlow.d.ts +2 -2
  47. package/dist/likec4diagram/DiagramUI.js +2 -2
  48. package/dist/likec4diagram/DiagramXYFlow.js +2 -2
  49. package/dist/likec4diagram/custom/edges/NotePopover.js +2 -2
  50. package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +2 -2
  51. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +7 -7
  52. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +6 -6
  53. package/dist/likec4diagram/custom/index.d.ts +1 -2
  54. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +2 -2
  55. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +3 -3
  56. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
  57. package/dist/likec4diagram/ui/controls/ChangeAutoLayoutButton.js +4 -4
  58. package/dist/likec4diagram/ui/controls/Controls.js +6 -6
  59. package/dist/likec4diagram/ui/controls/NavigationButtons.js +1 -1
  60. package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +1 -1
  61. package/dist/likec4diagram/ui/notation/NotationPanel.js +4 -4
  62. package/dist/likec4diagram/ui/search/ElementsColumn.js +88 -77
  63. package/dist/likec4diagram/ui/search/LikeC4Search.d.ts +2 -1
  64. package/dist/likec4diagram/ui/search/LikeC4Search.js +27 -24
  65. package/dist/likec4diagram/ui/search/SearchInput.js +1 -1
  66. package/dist/likec4diagram/ui/search/ViewsColum.js +3 -2
  67. package/dist/likec4diagram/ui/search/state.js +11 -9
  68. package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +1 -1
  69. package/dist/likec4diagram/useLayoutConstraints.js +3 -3
  70. package/dist/likec4model/LikeC4ModelContext.js +2 -2
  71. package/dist/likec4model/useLikeC4ElementsTree.js +2 -2
  72. package/dist/likec4model/useLikeC4Model.js +2 -2
  73. package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/cjs/react.production.js +548 -0
  74. package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/index.js +15 -0
  75. package/dist/overlays/Overlays.js +6 -6
  76. package/dist/overlays/element-details/ElementDetailsCard.js +5 -5
  77. package/dist/overlays/element-details/TabPanelDeployments.js +7 -4
  78. package/dist/overlays/element-details/TabPanelRelationships.js +2 -2
  79. package/dist/overlays/element-details/TabPanelStructure.js +6 -3
  80. package/dist/overlays/element-details/actor.d.ts +2 -2
  81. package/dist/overlays/element-details/actorContext.js +3 -3
  82. package/dist/overlays/overlay/Overlay.js +8 -7
  83. package/dist/overlays/relationship-details/RelationshipDetails.d.ts +1 -1
  84. package/dist/overlays/relationship-details/RelationshipDetails.js +28 -23
  85. package/dist/overlays/relationship-details/SelectEdge.js +3 -6
  86. package/dist/overlays/relationship-details/actor.d.ts +4 -1
  87. package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +1 -1
  88. package/dist/overlays/relationship-details/custom/edgeTypes.js +1 -1
  89. package/dist/overlays/relationship-details/hooks.d.ts +4 -1
  90. package/dist/overlays/relationship-details/hooks.js +4 -4
  91. package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +1 -1
  92. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +9 -11
  93. package/dist/overlays/relationships-browser/SelectElement.js +8 -5
  94. package/dist/overlays/relationships-browser/actor.d.ts +2 -1
  95. package/dist/overlays/relationships-browser/actor.js +6 -12
  96. package/dist/overlays/relationships-browser/const.d.ts +2 -1
  97. package/dist/overlays/relationships-browser/const.js +6 -1
  98. package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +1 -1
  99. package/dist/overlays/relationships-browser/custom/edgeTypes.js +3 -4
  100. package/dist/overlays/relationships-browser/custom/nodeTypes.js +1 -1
  101. package/dist/overlays/relationships-browser/hooks.d.ts +2 -1
  102. package/dist/overlays/relationships-browser/hooks.js +4 -4
  103. package/dist/overlays/relationships-browser/layout.js +2 -2
  104. package/dist/overlays/relationships-browser/useViewToNodesEdges.js +1 -2
  105. package/dist/state/DiagramActorProvider.js +5 -3
  106. package/dist/state/diagram-machine.d.ts +4 -4
  107. package/dist/state/diagram-machine.js +3 -4
  108. package/dist/styles.css.js +1 -1
  109. package/package.json +17 -13
  110. package/src/base/BaseXYFlow.tsx +2 -2
  111. package/src/base/primitives/compound/CompoundActionButton.tsx +1 -1
  112. package/src/base/primitives/compound/CompoundDetailsButton.tsx +1 -1
  113. package/src/base/primitives/compound/CompoundNodeContainer.tsx +1 -1
  114. package/src/base/primitives/edge/EdgePath.tsx +22 -14
  115. package/src/base/primitives/edge/edge.css.ts +1 -1
  116. package/src/base/primitives/element/ElementActionButtons.tsx +2 -2
  117. package/src/base/primitives/element/ElementDetailsButton.tsx +2 -2
  118. package/src/base/primitives/element/ElementNodeContainer.tsx +1 -1
  119. package/src/base/updateEdges.ts +6 -9
  120. package/src/base/updateNodes.ts +10 -14
  121. package/src/context/FramerMotionConfig.tsx +1 -1
  122. package/src/context/RootContainer.tsx +0 -4
  123. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +2 -2
  124. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +1 -1
  125. package/src/likec4diagram/ui/controls/Controls.tsx +53 -55
  126. package/src/likec4diagram/ui/controls/NavigationButtons.tsx +1 -1
  127. package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +1 -1
  128. package/src/likec4diagram/ui/notation/NotationPanel.tsx +1 -1
  129. package/src/likec4diagram/ui/search/ElementsColumn.tsx +94 -71
  130. package/src/likec4diagram/ui/search/LikeC4Search.tsx +48 -55
  131. package/src/likec4diagram/ui/search/ViewsColum.tsx +2 -2
  132. package/src/likec4diagram/ui/search/state.ts +8 -6
  133. package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.tsx +1 -1
  134. package/src/overlays/Overlays.tsx +2 -2
  135. package/src/overlays/element-details/ElementDetailsCard.tsx +1 -1
  136. package/src/overlays/element-details/TabPanelDeployments.tsx +2 -0
  137. package/src/overlays/element-details/TabPanelStructure.tsx +2 -1
  138. package/src/overlays/overlay/Overlay.tsx +2 -1
  139. package/src/overlays/relationship-details/RelationshipDetails.tsx +25 -16
  140. package/src/overlays/relationship-details/SelectEdge.tsx +0 -14
  141. package/src/overlays/relationship-details/actor.ts +2 -1
  142. package/src/overlays/relationship-details/custom/edgeTypes.tsx +1 -1
  143. package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +1 -3
  144. package/src/overlays/relationships-browser/SelectElement.tsx +2 -0
  145. package/src/overlays/relationships-browser/actor.ts +8 -13
  146. package/src/overlays/relationships-browser/const.ts +8 -1
  147. package/src/overlays/relationships-browser/custom/edgeTypes.tsx +2 -3
  148. package/src/overlays/relationships-browser/custom/nodeTypes.tsx +1 -1
  149. package/src/overlays/relationships-browser/useViewToNodesEdges.ts +1 -2
  150. package/src/state/DiagramActorProvider.tsx +4 -1
  151. package/src/state/diagram-machine.ts +2 -3
@@ -2,7 +2,7 @@ import { jsx, Fragment } from 'react/jsx-runtime';
2
2
  import '@likec4/core';
3
3
  import { useMantineStyleNonce } from '@mantine/core';
4
4
  import { deepEqual } from 'fast-equals';
5
- import { memo } from 'react';
5
+ import { r as reactExports } from './_virtual/index.js';
6
6
  import { entries } from 'remeda';
7
7
 
8
8
  function toStyle(name, colors) {
@@ -24,7 +24,7 @@ function toStyle(name, colors) {
24
24
  }
25
25
  `;
26
26
  }
27
- const LikeC4CustomColors = memo(({ customColors }) => {
27
+ const LikeC4CustomColors = reactExports.memo(({ customColors }) => {
28
28
  const styles = entries(customColors).map(([name, color]) => toStyle(name, color)).join("\n");
29
29
  const nonce = useMantineStyleNonce()?.();
30
30
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("style", { type: "text/css", dangerouslySetInnerHTML: { __html: styles }, nonce }) });
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { ReactFlowProvider } from '@xyflow/react';
3
- import { useRef } from 'react';
3
+ import { r as reactExports } from './_virtual/index.js';
4
4
  import { isEmpty } from 'remeda';
5
5
  import { ControlsCustomLayoutProvider } from './context/ControlsCustomLayout.js';
6
6
  import { ReduceGraphicsContext } from './context/ReduceGraphics.js';
@@ -58,7 +58,7 @@ function LikeC4Diagram({
58
58
  children
59
59
  }) {
60
60
  const hasLikec4model = !!useLikeC4Model();
61
- const initialRef = useRef(null);
61
+ const initialRef = reactExports.useRef(null);
62
62
  const isDynamicView = view.__ === "dynamic";
63
63
  if (initialRef.current == null) {
64
64
  initialRef.current = {
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import 'react';
2
+ import './_virtual/index.js';
3
3
  import { LikeC4ModelContext } from './likec4model/LikeC4ModelContext.js';
4
4
 
5
5
  function LikeC4ModelProvider({
@@ -0,0 +1,5 @@
1
+ import { __require as requireReact } from '../node_modules/.pnpm/react@19.0.0/node_modules/react/index.js';
2
+
3
+ var reactExports = requireReact();
4
+
5
+ export { reactExports as r };
@@ -0,0 +1,3 @@
1
+ var react = {exports: {}};
2
+
3
+ export { react as __module };
@@ -0,0 +1,3 @@
1
+ var react_production = {};
2
+
3
+ export { react_production as __exports };
@@ -2,7 +2,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { cx, css } from '@likec4/styles/css';
3
3
  import { useCallbackRef } from '@mantine/hooks';
4
4
  import { ReactFlow, useStore } from '@xyflow/react';
5
- import { useMemo, Fragment } from 'react';
5
+ import { r as reactExports } from '../_virtual/index.js';
6
6
  import { useUpdateEffect } from '../hooks/useUpdateEffect.js';
7
7
  import { useIsZoomTooSmall, useXYStoreApi } from '../hooks/useXYFlow.js';
8
8
  import { stopPropagation } from '../utils/xyflow.js';
@@ -82,7 +82,7 @@ const BaseXYFlow = ({
82
82
  maxZoom: zoomable ? MaxZoom : 1,
83
83
  minZoom: zoomable ? MinZoom : 1,
84
84
  fitView,
85
- fitViewOptions: useMemo(() => ({
85
+ fitViewOptions: reactExports.useMemo(() => ({
86
86
  minZoom: MinZoom,
87
87
  maxZoom: 1,
88
88
  padding: fitViewPadding,
@@ -103,8 +103,8 @@ const BaseXYFlow = ({
103
103
  edgesFocusable: false,
104
104
  nodesDraggable,
105
105
  nodeDragThreshold: 4,
106
- nodeClickDistance: 1.9,
107
- paneClickDistance: 1.9,
106
+ nodeClickDistance: 3,
107
+ paneClickDistance: 3,
108
108
  elevateNodesOnSelect: false,
109
109
  selectNodesOnDrag: false,
110
110
  onNodesChange,
@@ -156,7 +156,7 @@ const BaseXYFlow = ({
156
156
  onEdgeDoubleClick: stopPropagation,
157
157
  ...props,
158
158
  children: [
159
- /* @__PURE__ */ jsxs(Fragment, { children: [
159
+ /* @__PURE__ */ jsxs(reactExports.Fragment, { children: [
160
160
  isBgWithPattern && /* @__PURE__ */ jsx(Background, { background }),
161
161
  onViewportResize && /* @__PURE__ */ jsx(ViewportResizeHanlder, { onViewportResize })
162
162
  ] }, "_internals"),
@@ -4,7 +4,7 @@ import { actionBtn } from '@likec4/styles/recipes';
4
4
  import { Box, ActionIcon } from '@mantine/core';
5
5
  import { useDebouncedValue } from '@mantine/hooks';
6
6
  import { IconZoomScan } from '@tabler/icons-react';
7
- import { m } from 'framer-motion';
7
+ import * as m from 'motion/react-m';
8
8
  import { stopPropagation } from '../../../utils/xyflow.js';
9
9
  import { compoundActionBtn } from './actionbtns.css.js';
10
10
 
@@ -4,7 +4,7 @@ import { actionBtn } from '@likec4/styles/recipes';
4
4
  import { Box, ActionIcon } from '@mantine/core';
5
5
  import { useDebouncedValue } from '@mantine/hooks';
6
6
  import { IconId } from '@tabler/icons-react';
7
- import { m } from 'framer-motion';
7
+ import * as m from 'motion/react-m';
8
8
  import { stopPropagation } from '../../../utils/xyflow.js';
9
9
  import { compoundActionBtn } from './actionbtns.css.js';
10
10
 
@@ -1,5 +1,5 @@
1
1
  import { DiagramNode } from '@likec4/core';
2
- import { HTMLMotionProps } from 'framer-motion';
2
+ import { HTMLMotionProps } from 'motion/react';
3
3
  import { PropsWithChildren } from 'react';
4
4
  import { NodeProps } from '../../types';
5
5
  type RequiredData = Pick<DiagramNode, 'color' | 'depth' | 'style'>;
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { cx, css } from '@likec4/styles/css';
3
- import { m } from 'framer-motion';
4
- import 'react';
3
+ import { m } from 'motion/react';
4
+ import '../../../_virtual/index.js';
5
5
  import { isNumber, clamp } from 'remeda';
6
6
  import { compound, borderOpacityPercent, borderRadius, borderWidth, compoundOpacity } from './CompoundNodeContainer.css.js';
7
7
  import { useIsReducedGraphics } from '../../../context/ReduceGraphics.js';
@@ -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/react';
3
+ import { Position } from '@xyflow/system';
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,12 +1,12 @@
1
1
  import { deepEqual } from 'fast-equals';
2
- import { memo } from 'react';
2
+ import { r as reactExports } from '../../_virtual/index.js';
3
3
 
4
4
  const isSame = (a, b) => {
5
5
  return Math.abs(a - b) < 2.5;
6
6
  };
7
7
  const edgePropsEqual = (prev, next) => prev.id === next.id && deepEqual(prev.selected ?? false, next.selected ?? false) && deepEqual(prev.source, next.source) && deepEqual(prev.sourceHandleId ?? null, next.sourceHandleId ?? null) && deepEqual(prev.sourcePosition, next.sourcePosition) && deepEqual(prev.target, next.target) && deepEqual(prev.targetHandleId ?? null, next.targetHandleId ?? null) && deepEqual(prev.targetPosition, next.targetPosition) && isSame(prev.sourceX, next.sourceX) && isSame(prev.sourceY, next.sourceY) && isSame(prev.targetX, next.targetX) && isSame(prev.targetY, next.targetY) && deepEqual(prev.data, next.data);
8
8
  function customEdge(Edge) {
9
- return memo(Edge, edgePropsEqual);
9
+ return reactExports.memo(Edge, edgePropsEqual);
10
10
  }
11
11
 
12
12
  export { customEdge, edgePropsEqual };
@@ -1,9 +1,9 @@
1
1
  import { deepEqual } from 'fast-equals';
2
- import { memo } from 'react';
2
+ import { r as reactExports } from '../../_virtual/index.js';
3
3
 
4
4
  const nodePropsEqual = (prev, next) => prev.id === next.id && deepEqual(prev.selected ?? false, next.selected ?? false) && deepEqual(prev.dragging ?? false, next.dragging ?? false) && deepEqual(prev.width ?? 0, next.width ?? 0) && deepEqual(prev.height ?? 0, next.height ?? 0) && deepEqual(prev.zIndex ?? 0, next.zIndex ?? 0) && deepEqual(prev.data, next.data);
5
5
  function customNode(Node) {
6
- return memo(Node, nodePropsEqual);
6
+ return reactExports.memo(Node, nodePropsEqual);
7
7
  }
8
8
 
9
9
  export { customNode, nodePropsEqual };
@@ -1,7 +1,7 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { invariant } from '@likec4/core';
3
3
  import { cx, css } from '@likec4/styles/css';
4
- import 'react';
4
+ import '../../../_virtual/index.js';
5
5
  import { edgeVars, edgeContainer } from './edge.css.js';
6
6
 
7
7
  function EdgeContainer({
@@ -2,7 +2,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { isStepEdgeId, extractStep } from '@likec4/core';
3
3
  import { cx } from '@likec4/styles/css';
4
4
  import { Box, Text } from '@mantine/core';
5
- import 'react';
5
+ import '../../../_virtual/index.js';
6
6
  import { isTruthy } from 'remeda';
7
7
  import { labelsva } from './EdgeLabel.css.js';
8
8
 
@@ -2,7 +2,7 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import '@likec4/core';
3
3
  import { cx, css } from '@likec4/styles/css';
4
4
  import { EdgeLabelRenderer } from '@xyflow/react';
5
- import 'react';
5
+ import '../../../_virtual/index.js';
6
6
  import { isNumber } from 'remeda';
7
7
  import { ZIndexes } from '../../const.js';
8
8
  import { edgeVars } from './edge.css.js';
@@ -1,45 +1,13 @@
1
- import { PointerEventHandler, ForwardRefExoticComponent, CSSProperties, ReactNode, RefAttributes } from 'react';
2
- import { Position } from '@xyflow/react';
3
- import { RelationshipLineType, RelationshipArrowType } from '@likec4/core';
4
- export declare const EdgePath: ForwardRefExoticComponent<{
5
- id: string;
6
- selected?: boolean;
7
- selectable?: boolean;
8
- deletable?: boolean;
9
- style?: CSSProperties;
10
- source: string;
11
- target: string;
12
- animated?: boolean;
13
- sourceX: number;
14
- sourceY: number;
15
- targetX: number;
16
- targetY: number;
17
- sourcePosition: Position;
18
- targetPosition: Position;
19
- label?: ReactNode;
20
- labelStyle?: CSSProperties;
21
- labelShowBg?: boolean;
22
- labelBgStyle?: CSSProperties;
23
- labelBgPadding?: [number, number];
24
- labelBgBorderRadius?: number;
25
- sourceHandleId?: string | null;
26
- targetHandleId?: string | null;
27
- markerStart?: string;
28
- markerEnd?: string;
29
- pathOptions?: any;
30
- interactionWidth?: number;
31
- data: {
32
- hovered?: boolean;
33
- active?: boolean;
34
- dimmed?: import("../..").Base.Dimmed;
35
- } & {
36
- dir?: "forward" | "back" | "both" | undefined;
37
- line?: RelationshipLineType | undefined;
38
- head?: RelationshipArrowType | undefined;
39
- tail?: RelationshipArrowType | undefined;
40
- };
41
- } & {
1
+ import { DiagramEdge } from '@likec4/core';
2
+ import { PointerEventHandler, ForwardRefExoticComponent, RefAttributes } from 'react';
3
+ import { UndefinedOnPartialDeep } from 'type-fest';
4
+ import { EdgeProps } from '../../types';
5
+ type Data = UndefinedOnPartialDeep<Pick<DiagramEdge, 'line' | 'dir' | 'tail' | 'head'>>;
6
+ type EdgePathProps = {
7
+ edgeProps: EdgeProps<Data>;
42
8
  svgPath: string;
43
9
  strokeWidth?: number;
44
10
  onEdgePointerDown?: PointerEventHandler<SVGGElement> | undefined;
45
- } & RefAttributes<SVGPathElement>>;
11
+ };
12
+ export declare const EdgePath: ForwardRefExoticComponent<EdgePathProps & RefAttributes<SVGPathElement>>;
13
+ export {};
@@ -1,22 +1,24 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { cx } from '@likec4/styles/css';
3
- import { forwardRef } from 'react';
2
+ import { cx, css } from '@likec4/styles/css';
3
+ import { r as reactExports } from '../../../_virtual/index.js';
4
4
  import { hideOnReducedGraphics, markerContext, edgePathBg, cssEdgePath } from './edge.css.js';
5
5
  import { arrowTypeToMarker, EdgeMarkers } from './EdgeMarkers.js';
6
6
 
7
- const EdgePath = forwardRef(({
8
- id,
9
- data: {
10
- line,
11
- dir,
12
- tail,
13
- head
7
+ const EdgePath = reactExports.forwardRef(({
8
+ edgeProps: {
9
+ id,
10
+ data: {
11
+ line,
12
+ dir,
13
+ tail,
14
+ head
15
+ },
16
+ style,
17
+ interactionWidth
14
18
  },
19
+ onEdgePointerDown,
15
20
  strokeWidth,
16
- svgPath,
17
- style,
18
- interactionWidth,
19
- onEdgePointerDown
21
+ svgPath
20
22
  }, svgPathRef) => {
21
23
  let markerStartName = arrowTypeToMarker(tail);
22
24
  let markerEndName = arrowTypeToMarker(head ?? "normal");
@@ -37,10 +39,15 @@ const EdgePath = forwardRef(({
37
39
  /* @__PURE__ */ jsx(
38
40
  "path",
39
41
  {
40
- className: cx("react-flow__edge-interaction", hideOnReducedGraphics),
42
+ className: cx(
43
+ "react-flow__edge-interaction",
44
+ hideOnReducedGraphics,
45
+ css({
46
+ fill: "[none]",
47
+ strokeOpacity: 0
48
+ })
49
+ ),
41
50
  d: svgPath,
42
- fill: "none",
43
- stroke: "transparent",
44
51
  strokeWidth: interactionWidth ?? 10
45
52
  }
46
53
  ),
@@ -63,7 +63,7 @@ const markerContext = css({
63
63
  stroke: "[var(--xy-edge-stroke)]"
64
64
  });
65
65
  const cssEdgePath = css({
66
- fill: "[none]",
66
+ fill: "[none!]",
67
67
  strokeDashoffset: 10,
68
68
  _noReduceGraphics: {
69
69
  transition: "stroke 130ms ease-out,stroke-width 130ms ease-out"
@@ -3,7 +3,7 @@ import { css, cx } from '@likec4/styles/css';
3
3
  import { actionBtn } from '@likec4/styles/recipes';
4
4
  import { Box, ActionIcon } from '@mantine/core';
5
5
  import { useId } from '@mantine/hooks';
6
- import { m } from 'framer-motion';
6
+ import * as m from 'motion/react-m';
7
7
  import { useIsZoomTooSmall } from '../../../hooks/useXYFlow.js';
8
8
  import { stopPropagation } from '../../../utils/xyflow.js';
9
9
 
@@ -60,7 +60,6 @@ function ElementActionButtons({
60
60
  ActionIcon,
61
61
  {
62
62
  component: m.button,
63
- layout: true,
64
63
  className: actionBtn({}),
65
64
  initial: false,
66
65
  whileTap: { scale: 1 },
@@ -4,7 +4,7 @@ import { actionBtn } from '@likec4/styles/recipes';
4
4
  import { Box, ActionIcon } from '@mantine/core';
5
5
  import { useId } from '@mantine/hooks';
6
6
  import { IconId } from '@tabler/icons-react';
7
- import { m } from 'framer-motion';
7
+ import * as m from 'motion/react-m';
8
8
  import { stopPropagation } from '../../../utils/xyflow.js';
9
9
 
10
10
  const container = css({
@@ -42,7 +42,6 @@ function ElementDetailsButton({
42
42
  {
43
43
  className: cx("nodrag nopan", actionBtn({ variant: "transparent" })),
44
44
  component: m.button,
45
- layout: true,
46
45
  initial: false,
47
46
  style: {
48
47
  originX: 0.45,
@@ -2,8 +2,8 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import { DefaultShapeSize, DefaultTextSize, DefaultPaddingSize } from '@likec4/core';
3
3
  import { cx, css } from '@likec4/styles/css';
4
4
  import { createPolymorphicComponent, Box } from '@mantine/core';
5
- import { m } from 'framer-motion';
6
- import { forwardRef } from 'react';
5
+ import * as m from 'motion/react-m';
6
+ import { r as reactExports } from '../../../_virtual/index.js';
7
7
  import { container } from './ElementNodeContainer.css.js';
8
8
 
9
9
  function nodeSizes({
@@ -30,7 +30,7 @@ function nodeSizes({
30
30
  };
31
31
  }
32
32
  const ElementNodeContainer = createPolymorphicComponent(
33
- forwardRef(({
33
+ reactExports.forwardRef(({
34
34
  nodeProps: {
35
35
  selected = false,
36
36
  selectable = false,
@@ -1,13 +1,18 @@
1
1
  import { deepEqual } from 'fast-equals';
2
- import { isDefined } from 'remeda';
2
+ import { isDefined, omit } from 'remeda';
3
3
 
4
4
  function _update(current, update) {
5
5
  return update.map((next) => {
6
6
  const existing = current.find((n) => n.id === next.id);
7
- if (existing && existing.type === next.type) {
7
+ if (existing && deepEqual(existing.type, next.type)) {
8
8
  if (deepEqual(existing.hidden ?? false, next.hidden ?? false) && deepEqual(existing.source, next.source) && deepEqual(existing.sourceHandle ?? null, next.sourceHandle ?? null) && deepEqual(existing.target, next.target) && deepEqual(existing.targetHandle ?? null, next.targetHandle ?? null) && deepEqual(existing.zIndex ?? 0, next.zIndex ?? 0) && deepEqual(existing.data, next.data)) {
9
9
  return existing;
10
10
  }
11
+ return {
12
+ ...omit(existing, ["hidden", "zIndex"]),
13
+ ...next,
14
+ data: next.data
15
+ };
11
16
  }
12
17
  return next;
13
18
  });
@@ -1,15 +1,23 @@
1
1
  import { getNodeDimensions } from '@xyflow/system';
2
2
  import { deepEqual } from 'fast-equals';
3
- import { isDefined } from 'remeda';
3
+ import { isDefined, omit } from 'remeda';
4
4
 
5
5
  function _update(current, updated) {
6
6
  return updated.map((update) => {
7
7
  const existing = current.find((n) => n.id === update.id);
8
- if (existing) {
8
+ if (existing && deepEqual(existing.type, update.type)) {
9
9
  const { width: existingWidth, height: existingHeight } = getNodeDimensions(existing);
10
- if (deepEqual(existing.type, update.type) && deepEqual(existingWidth, update.initialWidth) && deepEqual(existingHeight, update.initialHeight) && deepEqual(existing.parentId ?? null, update.parentId ?? null) && deepEqual(existing.hidden ?? false, update.hidden ?? false) && deepEqual(existing.zIndex ?? 0, update.zIndex ?? 0) && deepEqual(existing.position, update.position) && deepEqual(existing.data, update.data)) {
10
+ if (deepEqual(existingWidth, update.initialWidth) && deepEqual(existingHeight, update.initialHeight) && deepEqual(existing.parentId ?? null, update.parentId ?? null) && deepEqual(existing.hidden ?? false, update.hidden ?? false) && deepEqual(existing.zIndex ?? 0, update.zIndex ?? 0) && deepEqual(existing.position, update.position) && deepEqual(existing.data, update.data)) {
11
11
  return existing;
12
12
  }
13
+ return {
14
+ ...omit(existing, ["measured", "parentId", "hidden", "zIndex"]),
15
+ ...update,
16
+ // Force dimensions from update
17
+ width: update.initialWidth,
18
+ height: update.initialHeight,
19
+ data: update.data
20
+ };
13
21
  }
14
22
  return update;
15
23
  });
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { memo, useState } from 'react';
2
+ import { r as reactExports } from '../_virtual/index.js';
3
3
  import { ShadowRoot } from './ShadowRoot.js';
4
4
  import { cx } from '@likec4/styles/css';
5
5
  import { Box, ActionIcon } from '@mantine/core';
@@ -30,7 +30,7 @@ function LikeC4View({
30
30
  }
31
31
  return /* @__PURE__ */ jsx(LikeC4ViewInner, { view: view.$view, ...props });
32
32
  }
33
- const LikeC4ViewInner = memo(({
33
+ const LikeC4ViewInner = reactExports.memo(({
34
34
  view,
35
35
  className,
36
36
  pannable = false,
@@ -61,7 +61,7 @@ const LikeC4ViewInner = memo(({
61
61
  const likec4model = useLikeC4Model(true, "layouted");
62
62
  const colorScheme = useColorScheme(explicitColorScheme);
63
63
  const [shadowRootProps, cssstyle] = useShadowRootStyle(keepAspectRatio, view);
64
- const [browserViewId, onNavigateTo] = useState(null);
64
+ const [browserViewId, onNavigateTo] = reactExports.useState(null);
65
65
  const browserView = browserViewId ? likec4model.findView(browserViewId)?.$view : null;
66
66
  const notations = view.notation?.elements ?? [];
67
67
  const hasNotations = notations.length > 0;
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import 'react';
2
+ import '../_virtual/index.js';
3
3
  import { ShadowRoot } from './ShadowRoot.js';
4
4
  import { cx } from '@likec4/styles/css';
5
5
  import { isString, isFunction } from 'remeda';
@@ -1,7 +1,7 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { cx, css } from '@likec4/styles/css';
3
3
  import { MantineProvider } from '@mantine/core';
4
- import { useRef, useCallback } from 'react';
4
+ import { r as reactExports } from '../_virtual/index.js';
5
5
  import root from 'react-shadow';
6
6
  import { isDefined } from 'remeda';
7
7
  import { useBundledStyleSheet, DefaultTheme } from './styles.css.js';
@@ -15,9 +15,9 @@ function ShadowRoot({
15
15
  colorScheme,
16
16
  ...props
17
17
  }) {
18
- const rootRef = useRef(null);
18
+ const rootRef = reactExports.useRef(null);
19
19
  const styleSheets = useBundledStyleSheet(injectFontCss, styleNonce);
20
- const getRootElement = useCallback(() => rootRef.current ?? void 0, [rootRef]);
20
+ const getRootElement = reactExports.useCallback(() => rootRef.current ?? void 0, [rootRef]);
21
21
  let getStyleNonce;
22
22
  if (isDefined(styleNonce)) {
23
23
  getStyleNonce = typeof styleNonce === "function" ? styleNonce : () => styleNonce;
@@ -2,7 +2,7 @@ import { css } from '@likec4/styles/css';
2
2
  import { createTheme, Portal } from '@mantine/core';
3
3
  import { useColorScheme as useColorScheme$1, useMutationObserver, useDebouncedCallback, useId } from '@mantine/hooks';
4
4
  import { useIsomorphicLayoutEffect } from '@react-hookz/web';
5
- import { useState } from 'react';
5
+ import { r as reactExports } from '../_virtual/index.js';
6
6
  import { first, isString, isFunction } from 'remeda';
7
7
  import inlinedStyles from '../styles.css.js';
8
8
  import fontsCss from './font.css.js';
@@ -42,7 +42,7 @@ const cssInteractive = css({
42
42
  }
43
43
  });
44
44
  function useBundledStyleSheet(injectFontCss, styleNonce) {
45
- const [styleSheets, setStyleSheets] = useState([]);
45
+ const [styleSheets, setStyleSheets] = reactExports.useState([]);
46
46
  useIsomorphicLayoutEffect(() => {
47
47
  if (injectFontCss && !document.querySelector(`style[data-likec4-font]`)) {
48
48
  const style = document.createElement("style");
@@ -83,7 +83,7 @@ const getComputedColorScheme = () => {
83
83
  };
84
84
  function useColorScheme(explicit) {
85
85
  const preferred = useColorScheme$1();
86
- const [computed, setComputed] = useState(getComputedColorScheme);
86
+ const [computed, setComputed] = reactExports.useState(getComputedColorScheme);
87
87
  useMutationObserver(
88
88
  useDebouncedCallback(() => setComputed(getComputedColorScheme), 100),
89
89
  {
@@ -1,5 +1,5 @@
1
1
  import { createOptionalContext } from '@mantine/core';
2
- import 'react';
2
+ import '../_virtual/index.js';
3
3
 
4
4
  const [
5
5
  ControlsCustomLayoutProvider,
@@ -1,6 +1,6 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { useSyncedRef } from '@react-hookz/web';
3
- import { useMemo, createContext, useContext } from 'react';
3
+ import { r as reactExports } from '../_virtual/index.js';
4
4
  import { isFunction, mapToObj } from 'remeda';
5
5
 
6
6
  const HandlerNames = [
@@ -16,7 +16,7 @@ const HandlerNames = [
16
16
  "onChange",
17
17
  "onCanvasDblClick"
18
18
  ];
19
- const DiagramEventHandlersContext = createContext({
19
+ const DiagramEventHandlersContext = reactExports.createContext({
20
20
  ...mapToObj(HandlerNames, (name) => [name, null]),
21
21
  handlersRef: {
22
22
  current: {}
@@ -28,7 +28,7 @@ function DiagramEventHandlers({
28
28
  }) {
29
29
  const handlersRef = useSyncedRef(handlers);
30
30
  const deps = HandlerNames.map((name) => isFunction(handlers[name]));
31
- const value = useMemo(() => ({
31
+ const value = reactExports.useMemo(() => ({
32
32
  ...mapToObj(HandlerNames, (name) => {
33
33
  if (handlersRef.current[name]) {
34
34
  return [name, (...args) => handlersRef.current[name]?.(...args)];
@@ -40,10 +40,10 @@ function DiagramEventHandlers({
40
40
  return /* @__PURE__ */ jsx(DiagramEventHandlersContext.Provider, { value, children });
41
41
  }
42
42
  function useDiagramEventHandlers() {
43
- return useContext(DiagramEventHandlersContext);
43
+ return reactExports.useContext(DiagramEventHandlersContext);
44
44
  }
45
45
  function useDiagramEventHandlersRef() {
46
- return useContext(DiagramEventHandlersContext).handlersRef;
46
+ return reactExports.useContext(DiagramEventHandlersContext).handlersRef;
47
47
  }
48
48
 
49
49
  export { DiagramEventHandlers, useDiagramEventHandlers, useDiagramEventHandlersRef };
@@ -1,6 +1,6 @@
1
1
  import { jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { shallowEqual } from 'fast-equals';
3
- import { useContext, createContext, useState, useEffect } from 'react';
3
+ import { r as reactExports } from '../_virtual/index.js';
4
4
  import { mapToObj, pick, map } from 'remeda';
5
5
 
6
6
  const FeatureNames = [
@@ -31,7 +31,7 @@ const AllDisabled = mapToObj(
31
31
  FeatureNames,
32
32
  (name) => [`enable${name}`, false]
33
33
  );
34
- const DiagramFeaturesContext = createContext(AllDisabled);
34
+ const DiagramFeaturesContext = reactExports.createContext(AllDisabled);
35
35
  const validate = (features) => {
36
36
  let {
37
37
  enableReadOnly,
@@ -68,9 +68,9 @@ function DiagramFeatures({
68
68
  features,
69
69
  overrides
70
70
  }) {
71
- const outerScope = useContext(DiagramFeaturesContext);
72
- const [scope, setScope] = useState(outerScope);
73
- useEffect(
71
+ const outerScope = reactExports.useContext(DiagramFeaturesContext);
72
+ const [scope, setScope] = reactExports.useState(outerScope);
73
+ reactExports.useEffect(
74
74
  () => {
75
75
  setScope((current) => {
76
76
  const next = validate({
@@ -99,10 +99,10 @@ DiagramFeatures.Overlays = ({ children }) => {
99
99
  );
100
100
  };
101
101
  function useEnabledFeature(...names) {
102
- return pick(useContext(DiagramFeaturesContext), map(names, (name) => `enable${name}`));
102
+ return pick(reactExports.useContext(DiagramFeaturesContext), map(names, (name) => `enable${name}`));
103
103
  }
104
104
  function useEnabledFeatures() {
105
- return useContext(DiagramFeaturesContext);
105
+ return reactExports.useContext(DiagramFeaturesContext);
106
106
  }
107
107
  function IfEnabled({
108
108
  feature,
@@ -1,9 +1,9 @@
1
1
  import { jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { MantineContext } from '@mantine/core';
3
- import { useContext } from 'react';
3
+ import { r as reactExports } from '../_virtual/index.js';
4
4
 
5
5
  function EnsureMantine({ children }) {
6
- const mantineCtx = useContext(MantineContext);
6
+ const mantineCtx = reactExports.useContext(MantineContext);
7
7
  if (!mantineCtx) {
8
8
  throw new Error("LikeC4Diagram must be a child of MantineProvider");
9
9
  }
@@ -1,7 +1,7 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { useMantineStyleNonce } from '@mantine/core';
3
- import { LazyMotion, domMax, MotionConfig } from 'framer-motion';
4
- import 'react';
3
+ import { LazyMotion, domMax, MotionConfig } from 'motion/react';
4
+ import '../_virtual/index.js';
5
5
 
6
6
  const FramerMotionConfig = ({
7
7
  reducedMotion = "user",