@likec4/diagram 1.0.0-rc.1 → 1.0.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 (38) hide show
  1. package/dist/LikeC4Diagram.d.ts +1 -1
  2. package/dist/LikeC4Diagram.props.d.ts +6 -3
  3. package/dist/StaticLikeC4Diagram.d.ts +1 -1
  4. package/dist/index.d.ts +1 -2
  5. package/dist/index.mjs +124 -221
  6. package/dist/mantine/EnsureMantine.d.ts +2 -3
  7. package/dist/style.css +3 -29
  8. package/dist/xyflow/nodes/element/ElementIcon.d.ts +1 -1
  9. package/dist/xyflow/types.d.ts +1 -1
  10. package/package.json +4 -4
  11. package/src/LikeC4Diagram.props.ts +12 -8
  12. package/src/LikeC4Diagram.tsx +3 -3
  13. package/src/StaticLikeC4Diagram.tsx +0 -1
  14. package/src/globals.css.ts +1 -1
  15. package/src/index.ts +1 -2
  16. package/src/mantine/EnsureMantine.tsx +8 -18
  17. package/src/mantine/theme.ts +1 -0
  18. package/src/ui/KeepAspectRatio.css.ts +2 -2
  19. package/src/ui/OptionsPanel.tsx +1 -1
  20. package/src/ui/options/NodeOptions.tsx +1 -2
  21. package/src/xyflow/FitviewOnDiagramChange.tsx +1 -1
  22. package/src/xyflow/SyncWithDiagram.tsx +23 -81
  23. package/src/xyflow/XYFlowEvents.tsx +1 -2
  24. package/src/xyflow/XYFlowWrapper.tsx +3 -7
  25. package/src/xyflow/edges/RelationshipEdge.tsx +4 -5
  26. package/src/xyflow/edges/edges.css.ts +3 -0
  27. package/src/xyflow/nodes/compound/CompoundNode.css.ts +3 -2
  28. package/src/xyflow/nodes/compound/CompoundNode.tsx +2 -2
  29. package/src/xyflow/nodes/element/ElementIcon.tsx +1 -3
  30. package/src/xyflow/nodes/element/ElementLink.css.ts +2 -2
  31. package/src/xyflow/nodes/element/ElementLink.tsx +3 -3
  32. package/src/xyflow/nodes/element/ElementNode.tsx +0 -2
  33. package/src/xyflow/nodes/element/element.css.ts +4 -4
  34. package/src/xyflow/types.ts +11 -2
  35. package/dist/EmbeddedLikeC4Diagram.css.d.ts +0 -5
  36. package/dist/EmbeddedLikeC4Diagram.d.ts +0 -17
  37. package/src/EmbeddedLikeC4Diagram.css.ts +0 -35
  38. package/src/EmbeddedLikeC4Diagram.tsx +0 -101
@@ -1,4 +1,4 @@
1
1
  import { LikeC4DiagramEventHandlers, LikeC4DiagramProperties } from './LikeC4Diagram.props';
2
2
 
3
3
  export type LikeC4DiagramProps = LikeC4DiagramProperties & LikeC4DiagramEventHandlers;
4
- export declare function LikeC4Diagram({ view, className, fitView, fitViewPadding, colorScheme, readonly, pannable, zoomable, nodesSelectable, nodesDraggable, background, controls, showElementLinks, initialWidth, initialHeight, keepAspectRatio, onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onChange, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu }: LikeC4DiagramProps): JSX.Element;
4
+ export declare function LikeC4Diagram({ view, className, fitView, fitViewPadding, readonly, pannable, zoomable, nodesSelectable, nodesDraggable, background, controls, showElementLinks, initialWidth, initialHeight, keepAspectRatio, onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onChange, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu }: LikeC4DiagramProps): JSX.Element;
@@ -5,7 +5,9 @@ import { MouseEvent as ReactMouseEvent } from 'react';
5
5
  import { DiagramEdge, DiagramNode, DiagramView, ElementShape, Fqn, NonEmptyArray, ThemeColor, ViewID } from '@likec4/core';
6
6
 
7
7
  export type DiagramNodeWithNavigate = Simplify<SetRequired<DiagramNode, 'navigateTo'>>;
8
- export type OnNavigateTo = (to: ViewID, event: ReactMouseEvent, element: DiagramNodeWithNavigate, xynode: XYFlowNode) => void;
8
+ export type OnNavigateTo = {
9
+ (to: ViewID, event: ReactMouseEvent, element: DiagramNodeWithNavigate, xynode: XYFlowNode): void;
10
+ };
9
11
  export type OnNodeClick = (event: {
10
12
  element: DiagramNode;
11
13
  xynode: XYFlowNode;
@@ -36,7 +38,9 @@ export type Change = Changes.ChangeColor | Changes.ChangeShape;
36
38
  export type ChangeEvent = {
37
39
  changes: NonEmptyArray<Change>;
38
40
  };
39
- export type OnChange = (event: ChangeEvent) => void;
41
+ export type OnChange = {
42
+ (event: ChangeEvent): void;
43
+ };
40
44
  export type LikeC4ColorScheme = 'light' | 'dark';
41
45
  export interface LikeC4DiagramProperties {
42
46
  view: DiagramView;
@@ -47,7 +51,6 @@ export interface LikeC4DiagramProperties {
47
51
  *
48
52
  * @example 'light' | 'dark'
49
53
  */
50
- colorScheme?: LikeC4ColorScheme | undefined;
51
54
  /**
52
55
  * Show/hide controls menu
53
56
  * @default false
@@ -1,4 +1,4 @@
1
1
  import { LikeC4DiagramProperties } from './LikeC4Diagram.props';
2
2
 
3
- export type StaticLikeC4DiagramProps = Pick<LikeC4DiagramProperties, 'view' | 'keepAspectRatio' | 'className' | 'colorScheme' | 'fitView' | 'fitViewPadding' | 'background' | 'initialWidth' | 'initialHeight'>;
3
+ export type StaticLikeC4DiagramProps = Pick<LikeC4DiagramProperties, 'view' | 'keepAspectRatio' | 'className' | 'fitView' | 'fitViewPadding' | 'background' | 'initialWidth' | 'initialHeight'>;
4
4
  export declare function StaticLikeC4Diagram({ view, fitView, fitViewPadding, background, ...rest }: StaticLikeC4DiagramProps): JSX.Element;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
 
2
- export { EmbeddedLikeC4Diagram } from './EmbeddedLikeC4Diagram';
3
2
  export { LikeC4Diagram } from './LikeC4Diagram';
4
3
  export { StaticLikeC4Diagram } from './StaticLikeC4Diagram';
5
- export type * from './EmbeddedLikeC4Diagram';
4
+ export * from './hooks';
6
5
  export type * from './LikeC4Diagram';
7
6
  export type * from './LikeC4Diagram.props';
8
7
  export type * from './StaticLikeC4Diagram';
package/dist/index.mjs CHANGED
@@ -2,30 +2,19 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => (__defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value), value);
4
4
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
5
- import { invariant, isAncestor, nonNullable, nonexhaustive, defaultTheme, ElementShapes } from "@likec4/core";
6
- import { createTheme, MantineContext, MantineProvider, Box, Stack, Text, TooltipGroup, Divider, Flex, Tooltip, ColorSwatch, CheckIcon, rem, Select, Card, ActionIcon, HoverCard, HoverCardTarget, UnstyledButton, HoverCardDropdown, Group, Anchor, CopyButton, Button, useMantineColorScheme, ModalRoot, ModalOverlay, ModalContent, ModalBody, Title, CloseButton } from "@mantine/core";
7
- import { useFirstMountState, useCustomCompareEffect, useDebouncedState, useRafEffect, useDebouncedEffect, useToggle } from "@react-hookz/web";
8
- import { shallowEqual, deepEqual } from "fast-equals";
9
5
  import { createContext, memo, useState, forwardRef, useCallback, useMemo, useEffect, useRef, useContext, useLayoutEffect, useId } from "react";
10
6
  import { createWithEqualityFn, useStoreWithEqualityFn } from "zustand/traditional";
11
7
  import { shallow } from "zustand/shallow";
12
8
  import { createPortal } from "react-dom";
13
- import { AnimatePresence, motion } from "framer-motion";
14
- import { isNullish, keys, hasAtLeast, takeWhile, clamp as clamp$1, isNumber } from "remeda";
9
+ import { MantineContext, Box, Stack, Text, TooltipGroup, Divider, Flex, Tooltip, ColorSwatch, CheckIcon, rem, Select, Card, ActionIcon, HoverCard, HoverCardTarget, UnstyledButton, HoverCardDropdown, Group, Anchor, CopyButton, Button, useMantineColorScheme } from "@mantine/core";
10
+ import { invariant, isAncestor, nonNullable, nonexhaustive, defaultTheme, ElementShapes } from "@likec4/core";
15
11
  import { DEV } from "esm-env";
12
+ import { shallowEqual, deepEqual } from "fast-equals";
16
13
  import { subscribeWithSelector, devtools } from "zustand/middleware";
17
- var rootClassName = "likec4-diagram-root", modalContent = "_1yqpph0", modalBody = "_1yqpph1", modalHeader = "_1yqpph2", modalCloseButtonBox = "_1yqpph3", modalCloseButton = "_1yqpph4";
18
- const noop$1 = () => {
19
- };
20
- function useUpdateEffect(callback, deps, equalityFn, effectHook) {
21
- const isFirstMount = useFirstMountState();
22
- useCustomCompareEffect(
23
- isFirstMount ? noop$1 : callback,
24
- deps,
25
- equalityFn ?? shallowEqual,
26
- effectHook
27
- );
28
- }
14
+ import { useFirstMountState, useCustomCompareEffect, useDebouncedState, useRafEffect, useDebouncedEffect } from "@react-hookz/web";
15
+ import { AnimatePresence, motion } from "framer-motion";
16
+ import { isNullish, keys, hasAtLeast, takeWhile, clamp as clamp$1, isNumber } from "remeda";
17
+ var rootClassName = "likec4-diagram-root";
29
18
  function cc(names) {
30
19
  if (typeof names == "string" || typeof names == "number")
31
20
  return "" + names;
@@ -38,7 +27,7 @@ function cc(names) {
38
27
  names[k] && (out += (out && " ") + k);
39
28
  return out;
40
29
  }
41
- var noop = { value: () => {
30
+ var noop$1 = { value: () => {
42
31
  } };
43
32
  function dispatch() {
44
33
  for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {
@@ -109,7 +98,7 @@ function get$2(type, name) {
109
98
  function set$1(type, name, callback) {
110
99
  for (var i = 0, n = type.length; i < n; ++i)
111
100
  if (type[i].name === name) {
112
- type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));
101
+ type[i] = noop$1, type = type.slice(0, i).concat(type.slice(i + 1));
113
102
  break;
114
103
  }
115
104
  return callback != null && type.push({ name, value: callback }), type;
@@ -2248,7 +2237,8 @@ const errorMessages = {
2248
2237
  error008: (handleType, { id: id2, sourceHandle, targetHandle }) => `Couldn't create edge for ${handleType} handle id: "${sourceHandle && targetHandle}", edge id: ${id2}.`,
2249
2238
  error010: () => "Handle: No node id found. Make sure to only use a Handle inside a custom Node.",
2250
2239
  error011: (edgeType) => `Edge type "${edgeType}" not found. Using fallback type "default".`,
2251
- error012: (id2) => `Node with id "${id2}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`
2240
+ error012: (id2) => `Node with id "${id2}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,
2241
+ error013: (lib = "react") => `It seems that you haven't loaded the styles. Please import '@xyflow/${lib}/dist/style.css' or base.css to make sure everything is working properly.`
2252
2242
  }, infiniteExtent = [
2253
2243
  [Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY],
2254
2244
  [Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY]
@@ -2887,37 +2877,27 @@ function updateNodeInternals(updates, nodeLookup, parentLookup, domNode, nodeOri
2887
2877
  if (updates.forEach((update) => {
2888
2878
  const node = nodeLookup.get(update.id);
2889
2879
  if (node != null && node.hidden)
2890
- nodeLookup.set(node.id, {
2891
- ...node,
2892
- internals: {
2893
- ...node.internals,
2894
- handleBounds: void 0
2895
- }
2896
- }), updatedInternals = !0;
2880
+ node.internals = {
2881
+ ...node.internals,
2882
+ handleBounds: void 0
2883
+ }, updatedInternals = !0;
2897
2884
  else if (node) {
2898
2885
  const dimensions = getDimensions(update.nodeElement), dimensionChanged = node.measured.width !== dimensions.width || node.measured.height !== dimensions.height;
2899
- if (!!(dimensions.width && dimensions.height && (dimensionChanged || !node.internals.handleBounds || update.force))) {
2900
- const newNode = {
2901
- ...node,
2902
- measured: dimensions,
2903
- internals: {
2904
- ...node.internals,
2905
- handleBounds: {
2906
- source: getHandleBounds(".source", update.nodeElement, zoom2, node.origin || nodeOrigin),
2907
- target: getHandleBounds(".target", update.nodeElement, zoom2, node.origin || nodeOrigin)
2908
- }
2909
- }
2910
- };
2911
- nodeLookup.set(node.id, newNode), updatedInternals = !0, dimensionChanged && (changes.push({
2912
- id: newNode.id,
2913
- type: "dimensions",
2914
- dimensions
2915
- }), newNode.expandParent && newNode.parentId && parentExpandChildren.push({
2916
- id: newNode.id,
2917
- parentId: newNode.parentId,
2918
- rect: nodeToRect(newNode, newNode.origin || nodeOrigin)
2919
- }));
2920
- }
2886
+ !!(dimensions.width && dimensions.height && (dimensionChanged || !node.internals.handleBounds || update.force)) && (node.measured = dimensions, node.internals = {
2887
+ ...node.internals,
2888
+ handleBounds: {
2889
+ source: getHandleBounds(".source", update.nodeElement, zoom2, node.origin || nodeOrigin),
2890
+ target: getHandleBounds(".target", update.nodeElement, zoom2, node.origin || nodeOrigin)
2891
+ }
2892
+ }, updatedInternals = !0, dimensionChanged && (changes.push({
2893
+ id: node.id,
2894
+ type: "dimensions",
2895
+ dimensions
2896
+ }), node.expandParent && node.parentId && parentExpandChildren.push({
2897
+ id: node.id,
2898
+ parentId: node.parentId,
2899
+ rect: nodeToRect(node, nodeOrigin)
2900
+ })));
2921
2901
  }
2922
2902
  }), parentExpandChildren.length > 0) {
2923
2903
  const parentExpandChanges = handleExpandParent(parentExpandChildren, nodeLookup, parentLookup, nodeOrigin);
@@ -5218,11 +5198,15 @@ function ConnectionLineWrapper({ containerStyle: containerStyle2, style: style2,
5218
5198
  }
5219
5199
  const emptyTypes = {};
5220
5200
  function useNodeOrEdgeTypesWarning(nodeOrEdgeTypes = emptyTypes) {
5221
- useRef(0), useStoreApi(), useEffect(() => {
5201
+ useRef(nodeOrEdgeTypes), useStoreApi(), useEffect(() => {
5222
5202
  }, [nodeOrEdgeTypes]);
5223
5203
  }
5204
+ function useStylesLoadedWarning() {
5205
+ useStoreApi(), useRef(!1), useEffect(() => {
5206
+ }, []);
5207
+ }
5224
5208
  function GraphViewComponent({ nodeTypes: nodeTypes2, edgeTypes: edgeTypes2, onInit, onNodeClick, onEdgeClick, onNodeDoubleClick, onEdgeDoubleClick, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onSelectionContextMenu, onSelectionStart, onSelectionEnd, connectionLineType, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, selectionKeyCode, selectionOnDrag, selectionMode, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, deleteKeyCode, onlyRenderVisibleElements, elementsSelectable, defaultViewport: defaultViewport2, translateExtent, minZoom, maxZoom, preventScrolling, defaultMarkerColor, zoomOnScroll, zoomOnPinch, panOnScroll, panOnScrollSpeed, panOnScrollMode, zoomOnDoubleClick, panOnDrag, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, onEdgeUpdate, onEdgeContextMenu, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, edgeUpdaterRadius, onEdgeUpdateStart, onEdgeUpdateEnd, noDragClassName, noWheelClassName, noPanClassName, disableKeyboardA11y, nodeOrigin, nodeExtent, rfId, viewport, onViewportChange }) {
5225
- return useNodeOrEdgeTypesWarning(nodeTypes2), useNodeOrEdgeTypesWarning(edgeTypes2), useOnInitHandler(onInit), useViewportSync(viewport), jsx(FlowRenderer, { onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneContextMenu, onPaneScroll, deleteKeyCode, selectionKeyCode, selectionOnDrag, selectionMode, onSelectionStart, onSelectionEnd, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, elementsSelectable, zoomOnScroll, zoomOnPinch, zoomOnDoubleClick, panOnScroll, panOnScrollSpeed, panOnScrollMode, panOnDrag, defaultViewport: defaultViewport2, translateExtent, minZoom, maxZoom, onSelectionContextMenu, preventScrolling, noDragClassName, noWheelClassName, noPanClassName, disableKeyboardA11y, onViewportChange, isControlledViewport: !!viewport, children: jsxs(Viewport, { children: [jsx(EdgeRenderer, { edgeTypes: edgeTypes2, onEdgeClick, onEdgeDoubleClick, onEdgeUpdate, onlyRenderVisibleElements, onEdgeContextMenu, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, onEdgeUpdateStart, onEdgeUpdateEnd, edgeUpdaterRadius, defaultMarkerColor, noPanClassName, disableKeyboardA11y, rfId }), jsx(ConnectionLineWrapper, { style: connectionLineStyle, type: connectionLineType, component: connectionLineComponent, containerStyle: connectionLineContainerStyle }), jsx("div", { className: "react-flow__edgelabel-renderer" }), jsx(NodeRenderer, { nodeTypes: nodeTypes2, onNodeClick, onNodeDoubleClick, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onlyRenderVisibleElements, noPanClassName, noDragClassName, disableKeyboardA11y, nodeOrigin, nodeExtent, rfId }), jsx("div", { className: "react-flow__viewport-portal" })] }) });
5209
+ return useNodeOrEdgeTypesWarning(nodeTypes2), useNodeOrEdgeTypesWarning(edgeTypes2), useStylesLoadedWarning(), useOnInitHandler(onInit), useViewportSync(viewport), jsx(FlowRenderer, { onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneContextMenu, onPaneScroll, deleteKeyCode, selectionKeyCode, selectionOnDrag, selectionMode, onSelectionStart, onSelectionEnd, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, elementsSelectable, zoomOnScroll, zoomOnPinch, zoomOnDoubleClick, panOnScroll, panOnScrollSpeed, panOnScrollMode, panOnDrag, defaultViewport: defaultViewport2, translateExtent, minZoom, maxZoom, onSelectionContextMenu, preventScrolling, noDragClassName, noWheelClassName, noPanClassName, disableKeyboardA11y, onViewportChange, isControlledViewport: !!viewport, children: jsxs(Viewport, { children: [jsx(EdgeRenderer, { edgeTypes: edgeTypes2, onEdgeClick, onEdgeDoubleClick, onEdgeUpdate, onlyRenderVisibleElements, onEdgeContextMenu, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, onEdgeUpdateStart, onEdgeUpdateEnd, edgeUpdaterRadius, defaultMarkerColor, noPanClassName, disableKeyboardA11y, rfId }), jsx(ConnectionLineWrapper, { style: connectionLineStyle, type: connectionLineType, component: connectionLineComponent, containerStyle: connectionLineContainerStyle }), jsx("div", { className: "react-flow__edgelabel-renderer" }), jsx(NodeRenderer, { nodeTypes: nodeTypes2, onNodeClick, onNodeDoubleClick, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onlyRenderVisibleElements, noPanClassName, noDragClassName, disableKeyboardA11y, nodeOrigin, nodeExtent, rfId }), jsx("div", { className: "react-flow__viewport-portal" })] }) });
5226
5210
  }
5227
5211
  GraphViewComponent.displayName = "GraphView";
5228
5212
  const GraphView = memo(GraphViewComponent), getInitialState = ({ nodes, edges, defaultNodes, defaultEdges, width, height, fitView: fitView2 } = {}) => {
@@ -5484,11 +5468,11 @@ const wrapperStyle = {
5484
5468
  position: "relative",
5485
5469
  zIndex: 0
5486
5470
  };
5487
- function ReactFlow$1({ nodes, edges, defaultNodes, defaultEdges, className, nodeTypes: nodeTypes2, edgeTypes: edgeTypes2, onNodeClick, onEdgeClick, onInit, onMove, onMoveStart, onMoveEnd, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, onNodeDragStart, onNodeDrag, onNodeDragStop, onNodesDelete, onEdgesDelete, onDelete, onSelectionChange, onSelectionDragStart, onSelectionDrag, onSelectionDragStop, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onBeforeDelete, connectionMode, connectionLineType = ConnectionLineType.Bezier, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, deleteKeyCode = "Backspace", selectionKeyCode = "Shift", selectionOnDrag = !1, selectionMode = SelectionMode.Full, panActivationKeyCode = "Space", multiSelectionKeyCode = isMacOs() ? "Meta" : "Control", zoomActivationKeyCode = isMacOs() ? "Meta" : "Control", snapToGrid, snapGrid, onlyRenderVisibleElements = !1, selectNodesOnDrag, nodesDraggable, nodesConnectable, nodesFocusable, nodeOrigin = defaultNodeOrigin, edgesFocusable, edgesUpdatable, elementsSelectable = !0, defaultViewport: defaultViewport$1 = defaultViewport, minZoom = 0.5, maxZoom = 2, translateExtent = infiniteExtent, preventScrolling = !0, nodeExtent, defaultMarkerColor = "#b1b1b7", zoomOnScroll = !0, zoomOnPinch = !0, panOnScroll = !1, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = !0, panOnDrag = !0, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, children: children2, onEdgeUpdate, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, onEdgeUpdateStart, onEdgeUpdateEnd, edgeUpdaterRadius = 10, onNodesChange, onEdgesChange, noDragClassName = "nodrag", noWheelClassName = "nowheel", noPanClassName = "nopan", fitView: fitView2, fitViewOptions, connectOnClick, attributionPosition, proOptions, defaultEdgeOptions, elevateNodesOnSelect, elevateEdgesOnSelect, disableKeyboardA11y = !1, autoPanOnConnect, autoPanOnNodeDrag, connectionRadius, isValidConnection, onError, style: style2, id: id2, nodeDragThreshold, viewport, onViewportChange, width, height, colorMode = "light", debug, ...rest }, ref) {
5471
+ function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTypes: nodeTypes2, edgeTypes: edgeTypes2, onNodeClick, onEdgeClick, onInit, onMove, onMoveStart, onMoveEnd, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, onNodeDragStart, onNodeDrag, onNodeDragStop, onNodesDelete, onEdgesDelete, onDelete, onSelectionChange, onSelectionDragStart, onSelectionDrag, onSelectionDragStop, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onBeforeDelete, connectionMode, connectionLineType = ConnectionLineType.Bezier, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, deleteKeyCode = "Backspace", selectionKeyCode = "Shift", selectionOnDrag = !1, selectionMode = SelectionMode.Full, panActivationKeyCode = "Space", multiSelectionKeyCode = isMacOs() ? "Meta" : "Control", zoomActivationKeyCode = isMacOs() ? "Meta" : "Control", snapToGrid, snapGrid, onlyRenderVisibleElements = !1, selectNodesOnDrag, nodesDraggable, nodesConnectable, nodesFocusable, nodeOrigin = defaultNodeOrigin, edgesFocusable, edgesUpdatable, elementsSelectable = !0, defaultViewport: defaultViewport$1 = defaultViewport, minZoom = 0.5, maxZoom = 2, translateExtent = infiniteExtent, preventScrolling = !0, nodeExtent, defaultMarkerColor = "#b1b1b7", zoomOnScroll = !0, zoomOnPinch = !0, panOnScroll = !1, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = !0, panOnDrag = !0, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, children: children2, onEdgeUpdate, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, onEdgeUpdateStart, onEdgeUpdateEnd, edgeUpdaterRadius = 10, onNodesChange, onEdgesChange, noDragClassName = "nodrag", noWheelClassName = "nowheel", noPanClassName = "nopan", fitView: fitView2, fitViewOptions, connectOnClick, attributionPosition, proOptions, defaultEdgeOptions, elevateNodesOnSelect, elevateEdgesOnSelect, disableKeyboardA11y = !1, autoPanOnConnect, autoPanOnNodeDrag, connectionRadius, isValidConnection, onError, style: style2, id: id2, nodeDragThreshold, viewport, onViewportChange, width, height, colorMode = "light", debug, ...rest }, ref) {
5488
5472
  const rfId = id2 || "1", colorModeClassName = useColorModeClass(colorMode);
5489
5473
  return jsx("div", { ...rest, style: { ...style2, ...wrapperStyle }, ref, className: cc(["react-flow", className, colorModeClassName]), "data-testid": "rf__wrapper", id: id2, children: jsxs(Wrapper, { nodes, edges, width, height, fitView: fitView2, children: [jsx(GraphView, { onInit, onNodeClick, onEdgeClick, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, nodeTypes: nodeTypes2, edgeTypes: edgeTypes2, connectionLineType, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, selectionKeyCode, selectionOnDrag, selectionMode, deleteKeyCode, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, onlyRenderVisibleElements, defaultViewport: defaultViewport$1, translateExtent, minZoom, maxZoom, preventScrolling, zoomOnScroll, zoomOnPinch, zoomOnDoubleClick, panOnScroll, panOnScrollSpeed, panOnScrollMode, panOnDrag, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onEdgeUpdate, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, onEdgeUpdateStart, onEdgeUpdateEnd, edgeUpdaterRadius, defaultMarkerColor, noDragClassName, noWheelClassName, noPanClassName, rfId, disableKeyboardA11y, nodeOrigin, nodeExtent, viewport, onViewportChange }), jsx(StoreUpdater, { nodes, edges, defaultNodes, defaultEdges, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, nodesDraggable, nodesConnectable, nodesFocusable, edgesFocusable, edgesUpdatable, elementsSelectable, elevateNodesOnSelect, elevateEdgesOnSelect, minZoom, maxZoom, nodeExtent, onNodesChange, onEdgesChange, snapToGrid, snapGrid, connectionMode, translateExtent, connectOnClick, defaultEdgeOptions, fitView: fitView2, fitViewOptions, onNodesDelete, onEdgesDelete, onDelete, onNodeDragStart, onNodeDrag, onNodeDragStop, onSelectionDrag, onSelectionDragStart, onSelectionDragStop, onMove, onMoveStart, onMoveEnd, noPanClassName, nodeOrigin, rfId, autoPanOnConnect, autoPanOnNodeDrag, onError, connectionRadius, isValidConnection, selectNodesOnDrag, nodeDragThreshold, onBeforeDelete, debug }), jsx(SelectionListener, { onSelectionChange }), children2, jsx(Attribution, { proOptions, position: attributionPosition }), jsx(A11yDescriptions, { rfId, disableKeyboardA11y })] }) });
5490
5474
  }
5491
- var index = fixedForwardRef(ReactFlow$1);
5475
+ var index = fixedForwardRef(ReactFlow);
5492
5476
  const selector$8 = (s) => {
5493
5477
  var _a;
5494
5478
  return (_a = s.domNode) == null ? void 0 : _a.querySelector(".react-flow__edgelabel-renderer");
@@ -5875,33 +5859,33 @@ function clsx() {
5875
5859
  return n;
5876
5860
  }
5877
5861
  var cssReactFlow = "_2h8g8h0", cssDisablePan = "_2h8g8h1", cssTransparentBg = "_2h8g8h2", cssNoControls = "_2h8g8h3";
5878
- const theme = createTheme({
5879
- primaryColor: "indigo",
5880
- cursorType: "pointer",
5881
- headings: {
5882
- fontWeight: "500",
5883
- sizes: {
5884
- h1: {
5885
- // fontSize: '2rem',
5886
- fontWeight: "600"
5887
- },
5888
- h2: {
5889
- // fontSize: '1.85rem',
5890
- }
5891
- }
5892
- }
5893
- });
5894
- function EnsureMantine({ colorScheme, children: children2 }) {
5895
- return useContext(MantineContext) ? /* @__PURE__ */ jsx(Fragment, { children: children2 }) : /* @__PURE__ */ jsx(
5896
- MantineProvider,
5897
- {
5898
- ...colorScheme && {
5899
- forceColorScheme: colorScheme
5900
- },
5901
- theme,
5902
- defaultColorScheme: "auto",
5903
- children: children2
5904
- }
5862
+ function EnsureMantine({ children: children2 }) {
5863
+ if (!useContext(MantineContext))
5864
+ throw new Error("LikeC4Diagram must be a child of MantineProvider");
5865
+ return /* @__PURE__ */ jsx(Fragment, { children: children2 });
5866
+ }
5867
+ function useSetState(initialState) {
5868
+ const [state, _setState] = useState(initialState), setState = useCallback(
5869
+ (statePartial) => _setState((current) => {
5870
+ const next = {
5871
+ ...current,
5872
+ ...typeof statePartial == "function" ? statePartial(current) : statePartial
5873
+ };
5874
+ return shallowEqual(current, next) ? current : next;
5875
+ }),
5876
+ []
5877
+ );
5878
+ return [state, setState];
5879
+ }
5880
+ const noop = () => {
5881
+ };
5882
+ function useUpdateEffect(callback, deps, equalityFn, effectHook) {
5883
+ const isFirstMount = useFirstMountState();
5884
+ useCustomCompareEffect(
5885
+ isFirstMount ? noop : callback,
5886
+ deps,
5887
+ equalityFn ?? shallowEqual,
5888
+ effectHook
5905
5889
  );
5906
5890
  }
5907
5891
  function createMap() {
@@ -7019,6 +7003,35 @@ class Row {
7019
7003
  pair !== void 0 && this.insertRow(row, pair.second);
7020
7004
  }
7021
7005
  }
7006
+ function useDiagramState(selector2, equalityFn) {
7007
+ const store = useContext(DiagramContext);
7008
+ if (store === null)
7009
+ throw new Error("useDiagramStore could be used only inside DiagramContext");
7010
+ return useStoreWithEqualityFn(store, selector2, equalityFn ?? shallowEqual);
7011
+ }
7012
+ function useDiagramStoreApi() {
7013
+ const store = useContext(DiagramContext);
7014
+ if (store === null)
7015
+ throw new Error("useDiagramStoreApi could be used only inside DiagramContext");
7016
+ return useMemo(
7017
+ () => ({
7018
+ getState: store.getState,
7019
+ setState: store.setState,
7020
+ subscribe: store.subscribe
7021
+ }),
7022
+ [store]
7023
+ );
7024
+ }
7025
+ function WhenInitialized({ children: children2 }) {
7026
+ const diagramApi = useDiagramStoreApi(), [isInitialized, setIsInitialized] = useState(diagramApi.getState().initialized);
7027
+ return useEffect(() => {
7028
+ if (!isInitialized)
7029
+ return diagramApi.subscribe(
7030
+ (s) => s.initialized,
7031
+ setIsInitialized
7032
+ );
7033
+ }, [isInitialized]), isInitialized ? /* @__PURE__ */ jsx(Fragment, { children: children2 }) : null;
7034
+ }
7022
7035
  const useXYFlow = useReactFlow, useXYNodesData = useNodesData;
7023
7036
  function useXYStore(selector2, equalityFn) {
7024
7037
  return useStore(
@@ -7380,35 +7393,6 @@ function DiagramContextProvider({ children: children2, view, ...props }) {
7380
7393
  [props]
7381
7394
  ), /* @__PURE__ */ jsx(DiagramContext.Provider, { value: store.current, children: children2 });
7382
7395
  }
7383
- function useDiagramState(selector2, equalityFn) {
7384
- const store = useContext(DiagramContext);
7385
- if (store === null)
7386
- throw new Error("useDiagramStore could be used only inside DiagramContext");
7387
- return useStoreWithEqualityFn(store, selector2, equalityFn ?? shallowEqual);
7388
- }
7389
- function useDiagramStoreApi() {
7390
- const store = useContext(DiagramContext);
7391
- if (store === null)
7392
- throw new Error("useDiagramStoreApi could be used only inside DiagramContext");
7393
- return useMemo(
7394
- () => ({
7395
- getState: store.getState,
7396
- setState: store.setState,
7397
- subscribe: store.subscribe
7398
- }),
7399
- [store]
7400
- );
7401
- }
7402
- function WhenInitialized({ children: children2 }) {
7403
- const diagramApi = useDiagramStoreApi(), [isInitialized, setIsInitialized] = useState(diagramApi.getState().initialized);
7404
- return useEffect(() => {
7405
- if (!isInitialized)
7406
- return diagramApi.subscribe(
7407
- (s) => s.initialized,
7408
- setIsInitialized
7409
- );
7410
- }, [isInitialized]), isInitialized ? /* @__PURE__ */ jsx(Fragment, { children: children2 }) : null;
7411
- }
7412
7396
  var wrapper = "_14qhjro0";
7413
7397
  function KeepAspectRatio({
7414
7398
  children: children2,
@@ -7448,7 +7432,7 @@ const {
7448
7432
  }));
7449
7433
  function NodeOptions({ selectedNodeIds }) {
7450
7434
  const diagramApi = useDiagramStoreApi(), nodes = useXYNodesData(selectedNodeIds);
7451
- if (useXYFlow(), !hasAtLeast(nodes, 1))
7435
+ if (!hasAtLeast(nodes, 1))
7452
7436
  return null;
7453
7437
  const showShapeOption = nodes.some((node) => node.type === "element"), [firstNode, ...rest] = nodes;
7454
7438
  return /* @__PURE__ */ jsxs(Stack, { children: [
@@ -7595,7 +7579,7 @@ var panel = "_1lmzt1h0";
7595
7579
  const OptionsPanelMemo = /* @__PURE__ */ memo(function() {
7596
7580
  const [selectedNodes, setSelectedNodes] = useState([]);
7597
7581
  return useOnSelectionChange({
7598
- onChange: ({ nodes, edges }) => {
7582
+ onChange: ({ nodes }) => {
7599
7583
  const next = nodes.map((n) => n.id).sort();
7600
7584
  setSelectedNodes((prev) => shallowEqual(prev, next) ? prev : next);
7601
7585
  }
@@ -7751,7 +7735,7 @@ function FitViewOnViewportResize({ diagramApi }) {
7751
7735
  }
7752
7736
  const diagramChangeId = (s) => s.view.id + "_" + s.view.autoLayout + "_" + s.fitViewPadding;
7753
7737
  function FitViewOnDiagramChanges() {
7754
- const diagramApi = useDiagramStoreApi(), [viewportMoved, setViewportMoved] = useState(diagramApi.getState().viewportChanged), [processedChangeId, setProcessed] = useState(diagramChangeId(diagramApi.getState())), [pendingChangeId, setPending] = useDebouncedState(processedChangeId, 50), isReady = useNodesInitialized({
7738
+ const diagramApi = useDiagramStoreApi(), [viewportMoved, setViewportMoved] = useState(diagramApi.getState().viewportChanged), [processedChangeId, setProcessed] = useState(diagramChangeId(diagramApi.getState())), [pendingChangeId, setPending] = useDebouncedState(processedChangeId, 100), isReady = useNodesInitialized({
7755
7739
  includeHiddenNodes: !0
7756
7740
  });
7757
7741
  return useEffect(
@@ -7780,33 +7764,7 @@ function toDomPrecision(v) {
7780
7764
  return v === null ? 0.01 : Math.round(v * 100) / 100;
7781
7765
  }
7782
7766
  const isSameNode = (a) => (b) => a.id === b.id && a.type === b.type && Object.is(a.parentId, b.parentId), SyncWithDiagram = memo(() => {
7783
- const xyflow = useXYFlow(), xyflowApi = useXYStoreApi(), diagramStoreApi = useDiagramStoreApi(), correctPosition = useCallback((lastOnNavigate, nodes) => {
7784
- const elFrom = lastOnNavigate.element, elTo = nodes.find((n) => n.id === elFrom.id);
7785
- if (elTo) {
7786
- const centerFrom = lastOnNavigate.elementCenterScreenPosition, centerTo = xyflow.flowToScreenPosition({
7787
- x: elTo.position[0] + elTo.width / 2,
7788
- y: elTo.position[1] + elTo.height / 2
7789
- }), diff = {
7790
- x: toDomPrecision(centerFrom.x - centerTo.x),
7791
- y: toDomPrecision(centerFrom.y - centerTo.y)
7792
- };
7793
- requestAnimationFrame(() => {
7794
- xyflowApi.getState().panBy(diff);
7795
- });
7796
- }
7797
- queueMicrotask(() => {
7798
- diagramStoreApi.setState(
7799
- {
7800
- lastOnNavigate: {
7801
- ...lastOnNavigate,
7802
- positionCorrected: !0
7803
- }
7804
- },
7805
- !1,
7806
- "positionCorrected"
7807
- );
7808
- });
7809
- }, [diagramStoreApi, xyflowApi]);
7767
+ const xyflow = useXYFlow(), xyflowApi = useXYStoreApi(), diagramStoreApi = useDiagramStoreApi();
7810
7768
  return useEffect(() => diagramStoreApi.subscribe(
7811
7769
  // selector
7812
7770
  (state) => ({
@@ -7838,15 +7796,22 @@ const isSameNode = (a) => (b) => a.id === b.id && a.type === b.type && Object.is
7838
7796
  ), (lastOnNavigate == null ? void 0 : lastOnNavigate.toView) === viewId && !lastOnNavigate.positionCorrected) {
7839
7797
  const elFrom = lastOnNavigate.element, elTo = nodes.find((n) => n.id === elFrom.id);
7840
7798
  if (elTo) {
7841
- const centerFrom = lastOnNavigate.elementCenterScreenPosition, centerTo = xyflow.flowToScreenPosition({
7842
- x: elTo.position[0] + elTo.width / 2,
7843
- y: elTo.position[1] + elTo.height / 2
7844
- }), diff = {
7845
- x: toDomPrecision(centerFrom.x - centerTo.x),
7846
- y: toDomPrecision(centerFrom.y - centerTo.y)
7847
- };
7799
+ const centerFrom = lastOnNavigate.elementCenterScreenPosition, nextZoom = Math.min(elFrom.width / elTo.width, elFrom.height / elTo.height);
7848
7800
  requestAnimationFrame(() => {
7849
7801
  requestAnimationFrame(() => {
7802
+ const v = xyflow.getViewport();
7803
+ nextZoom < v.zoom && xyflow.setViewport({
7804
+ x: v.x,
7805
+ y: v.y,
7806
+ zoom: nextZoom
7807
+ });
7808
+ const centerTo = xyflow.flowToScreenPosition({
7809
+ x: elTo.position[0] + elTo.width / 2,
7810
+ y: elTo.position[1] + elTo.height / 2
7811
+ }), diff = {
7812
+ x: toDomPrecision(centerFrom.x - centerTo.x),
7813
+ y: toDomPrecision(centerFrom.y - centerTo.y)
7814
+ };
7850
7815
  xyflowApi.getState().panBy(diff);
7851
7816
  });
7852
7817
  });
@@ -7866,7 +7831,7 @@ const isSameNode = (a) => (b) => a.id === b.id && a.type === b.type && Object.is
7866
7831
  {
7867
7832
  equalityFn: shallowEqual
7868
7833
  }
7869
- ), [xyflow, xyflowApi, diagramStoreApi, correctPosition]), null;
7834
+ ), [xyflow, xyflowApi, diagramStoreApi]), null;
7870
7835
  });
7871
7836
  function getVarName(variable) {
7872
7837
  var matches = variable.match(/^var\((.*)\)$/);
@@ -7978,8 +7943,8 @@ function bezierPath(bezierSpline) {
7978
7943
  const isSamePoint = (a, b) => Math.abs(a - b) < 2.1, isSamePosition = (a, [bx, by]) => isSamePoint(a.x, bx) && isSamePoint(a.y, by), isEqualProps = (prev, next) => prev.id === next.id && prev.source === next.source && prev.target === next.target && isSamePoint(prev.sourceX, next.sourceX) && isSamePoint(prev.sourceY, next.sourceY) && isSamePoint(prev.targetX, next.targetX) && isSamePoint(prev.targetY, next.targetY) && deepEqual(prev.data, next.data), RelationshipEdge = /* @__PURE__ */ memo(function({
7979
7944
  id: id2,
7980
7945
  data,
7981
- selected: selected2,
7982
- markerEnd,
7946
+ selected: _selected,
7947
+ markerEnd: _markerEnd,
7983
7948
  style: style2,
7984
7949
  source,
7985
7950
  target,
@@ -7989,8 +7954,7 @@ const isSamePoint = (a, b) => Math.abs(a - b) < 2.1, isSamePosition = (a, [bx, b
7989
7954
  const { nodeLookup, edgeLookup } = useXYStoreApi().getState(), sourceNode = nonNullable(nodeLookup.get(source), `source node ${source} not found`), targetNode = nonNullable(nodeLookup.get(target), `target node ${target} not found`), isNotModified = isSamePosition(sourceNode.internals.positionAbsolute, sourceNode.data.element.position) && isSamePosition(targetNode.internals.positionAbsolute, targetNode.data.element.position);
7990
7955
  invariant(data, "data is required");
7991
7956
  const {
7992
- edge,
7993
- controlPoints
7957
+ edge
7994
7958
  } = data, color2 = edge.color ?? "gray", isHovered = useDiagramState((s) => s.hoveredEdgeId === id2), line = edge.line ?? "dashed", isDotted = line === "dotted", isDashed = isDotted || line === "dashed";
7995
7959
  let strokeDasharray;
7996
7960
  isDotted ? strokeDasharray = "1,8" : isDashed && (strokeDasharray = "8,10");
@@ -8702,8 +8666,6 @@ const compoundColor = (color2, depth) => toHex(
8702
8666
  var container = "_1b6tkn2", indicator = "_1b6tkn4", fillElementFill = "_1b6tkn5", fillMixStroke = "_1b6tkn7", title = "_1b6tkn8", description = "_1b6tkn9", technology = "_1b6tkna", cssElement = "_1b6tknb", iconMaxH = "var(--_1b6tknc)", elementIcon = "_1b6tknd", cssShapeSvg = "_1b6tkng", cssNavigateBtn = "_1b6tknh";
8703
8667
  function ElementIcon({
8704
8668
  node,
8705
- maxWidth,
8706
- paddingX = 32,
8707
8669
  paddingY = 32
8708
8670
  }) {
8709
8671
  if (!node.icon)
@@ -8712,7 +8674,7 @@ function ElementIcon({
8712
8674
  if (!firstLabel)
8713
8675
  return null;
8714
8676
  const firstLabelY = Math.floor(firstLabel.pt[1] - firstLabel.fontSize * 1.25), maxIconHeight = Math.floor(firstLabelY - paddingY - 16);
8715
- return maxWidth ?? node.width - paddingX * 2, /* @__PURE__ */ jsx(
8677
+ return /* @__PURE__ */ jsx(
8716
8678
  "div",
8717
8679
  {
8718
8680
  className: clsx(elementIcon, "likec4-element-icon"),
@@ -8767,7 +8729,7 @@ function ElementLink({
8767
8729
  ]
8768
8730
  }
8769
8731
  ) }),
8770
- /* @__PURE__ */ jsx(HoverCardDropdown, { p: "xs", children: /* @__PURE__ */ jsx(Stack, { onClick: (e) => e.stopPropagation(), gap: "xs", children: element.links.map((link, i) => /* @__PURE__ */ jsxs(Group, { wrap: "nowrap", gap: "sm", children: [
8732
+ /* @__PURE__ */ jsx(HoverCardDropdown, { onClick: (e) => e.stopPropagation(), p: "xs", children: /* @__PURE__ */ jsx(Stack, { gap: "xs", children: element.links.map((link) => /* @__PURE__ */ jsxs(Group, { wrap: "nowrap", gap: "sm", children: [
8771
8733
  /* @__PURE__ */ jsx(Box, { flex: "1", style: { overflow: "clip", maxWidth: clamp$1(element.width, { min: 200, max: 400 }) }, children: /* @__PURE__ */ jsx(Anchor, { href: link, target: "_blank", fz: "13", truncate: "end", children: link }) }),
8772
8734
  /* @__PURE__ */ jsx(CopyButton, { value: link, children: ({ copied, copy }) => /* @__PURE__ */ jsx(Button, { size: "compact-xs", fz: "12", onClick: copy, color: copied ? "teal" : "gray", children: copied ? "Copied" : "Copy" }) })
8773
8735
  ] }, link)) }) })
@@ -9173,7 +9135,7 @@ function useXYFlowEvents() {
9173
9135
  }
9174
9136
  }), [diagramApi, xyflowApi]);
9175
9137
  }
9176
- const ReactFlow = index, nodeTypes = {
9138
+ const nodeTypes = {
9177
9139
  element: ElementNode,
9178
9140
  compound: CompoundNodeMemo
9179
9141
  }, edgeTypes = {
@@ -9210,7 +9172,7 @@ function XYFlowWrapper({
9210
9172
  ...editor
9211
9173
  } = useDiagramState(selector), layoutConstraints = useLayoutConstraints(), handlers = useXYFlowEvents(), isBgWithPattern = background !== "transparent" && background !== "solid", { colorScheme } = useMantineColorScheme(), colorMode = colorScheme !== "auto" ? colorScheme : void 0;
9212
9174
  return /* @__PURE__ */ jsxs(
9213
- ReactFlow,
9175
+ index,
9214
9176
  {
9215
9177
  className,
9216
9178
  style: style2,
@@ -9296,7 +9258,6 @@ function LikeC4Diagram({
9296
9258
  className,
9297
9259
  fitView: fitView2 = !0,
9298
9260
  fitViewPadding = 0,
9299
- colorScheme,
9300
9261
  readonly = !0,
9301
9262
  pannable = !0,
9302
9263
  zoomable = !0,
@@ -9331,7 +9292,7 @@ function LikeC4Diagram({
9331
9292
  initialHeight: initialHeight ?? view.height
9332
9293
  };
9333
9294
  }
9334
- return /* @__PURE__ */ jsx(EnsureMantine, { colorScheme, children: /* @__PURE__ */ jsx(
9295
+ return /* @__PURE__ */ jsx(EnsureMantine, { children: /* @__PURE__ */ jsx(
9335
9296
  ReactFlowProvider,
9336
9297
  {
9337
9298
  fitView: fitView2,
@@ -9419,67 +9380,9 @@ function StaticLikeC4Diagram({
9419
9380
  }
9420
9381
  );
9421
9382
  }
9422
- function EmbeddedLikeC4DiagramCmp({
9423
- viewId,
9424
- views,
9425
- colorScheme
9426
- }) {
9427
- const [isOpened, toggleOpened] = useToggle(!1), [browserViewId, setBrowserViewId] = useState(viewId), view = views[viewId];
9428
- invariant(view, `View with id ${viewId} not found`);
9429
- const browserView = views[browserViewId];
9430
- invariant(browserView, `View with id ${browserViewId} not found`);
9431
- const closeBrowser = () => {
9432
- toggleOpened(!1), setBrowserViewId(viewId);
9433
- };
9434
- return useUpdateEffect(closeBrowser, [viewId]), /* @__PURE__ */ jsxs(EnsureMantine, { colorScheme, children: [
9435
- /* @__PURE__ */ jsx(
9436
- KeepAspectRatio,
9437
- {
9438
- enabled: !0,
9439
- height: view.height,
9440
- width: view.width,
9441
- onClick: (e) => {
9442
- e.stopPropagation(), toggleOpened(!0);
9443
- },
9444
- children: /* @__PURE__ */ jsx(
9445
- StaticLikeC4Diagram,
9446
- {
9447
- colorScheme,
9448
- view,
9449
- fitView: !0,
9450
- fitViewPadding: 0.01,
9451
- background: "transparent",
9452
- keepAspectRatio: !1
9453
- }
9454
- )
9455
- }
9456
- ),
9457
- /* @__PURE__ */ jsxs(ModalRoot, { opened: isOpened, onClose: closeBrowser, fullScreen: !0, children: [
9458
- /* @__PURE__ */ jsx(ModalOverlay, { blur: 16 }),
9459
- /* @__PURE__ */ jsx(ModalContent, { className: modalContent, children: /* @__PURE__ */ jsxs(ModalBody, { className: modalBody, children: [
9460
- /* @__PURE__ */ jsx(Box, { className: modalHeader, children: /* @__PURE__ */ jsx(Title, { order: 4, children: browserView.title || browserView.id }) }),
9461
- isOpened && /* @__PURE__ */ jsx(
9462
- LikeC4Diagram,
9463
- {
9464
- readonly: !0,
9465
- view: browserView,
9466
- colorScheme,
9467
- background: "transparent",
9468
- fitViewPadding: 0.09,
9469
- onCanvasDblClick: closeBrowser,
9470
- onNavigateTo: (to) => {
9471
- setBrowserViewId(to);
9472
- }
9473
- }
9474
- ),
9475
- /* @__PURE__ */ jsx(Box, { className: modalCloseButtonBox, children: /* @__PURE__ */ jsx(CloseButton, { className: modalCloseButton, onClick: closeBrowser }) })
9476
- ] }) })
9477
- ] })
9478
- ] });
9479
- }
9480
- const EmbeddedLikeC4Diagram = memo(EmbeddedLikeC4DiagramCmp, shallowEqual);
9481
9383
  export {
9482
- EmbeddedLikeC4Diagram,
9483
9384
  LikeC4Diagram,
9484
- StaticLikeC4Diagram
9385
+ StaticLikeC4Diagram,
9386
+ useSetState,
9387
+ useUpdateEffect
9485
9388
  };
@@ -1,6 +1,5 @@
1
- import { LikeC4DiagramProperties } from '../LikeC4Diagram.props';
2
1
  import { PropsWithChildren } from 'react';
3
2
 
4
- type EnsureMantineProps = PropsWithChildren<Pick<LikeC4DiagramProperties, 'colorScheme'>>;
5
- export declare function EnsureMantine({ colorScheme, children }: EnsureMantineProps): JSX.Element;
3
+ type EnsureMantineProps = PropsWithChildren<{}>;
4
+ export declare function EnsureMantine({ children }: EnsureMantineProps): JSX.Element;
6
5
  export {};