@likec4/diagram 1.28.0 → 1.29.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.
- package/bundle/index.js +1040 -1190
- package/dist/LikeC4CustomColors.js +2 -2
- package/dist/LikeC4Diagram.js +2 -2
- package/dist/LikeC4ModelProvider.js +1 -1
- package/dist/_virtual/index.js +5 -0
- package/dist/_virtual/index2.js +3 -0
- package/dist/_virtual/react.production.js +3 -0
- package/dist/base/BaseXYFlow.js +5 -5
- package/dist/base/primitives/compound/CompoundActionButton.js +1 -1
- package/dist/base/primitives/compound/CompoundDetailsButton.js +1 -1
- package/dist/base/primitives/compound/CompoundNodeContainer.d.ts +1 -1
- package/dist/base/primitives/compound/CompoundNodeContainer.js +2 -2
- package/dist/base/primitives/customEdge.d.ts +1 -1
- package/dist/base/primitives/customEdge.js +3 -3
- package/dist/base/primitives/customNode.js +2 -2
- package/dist/base/primitives/edge/EdgeContainer.js +1 -1
- package/dist/base/primitives/edge/EdgeLabel.css.d.ts +3 -0
- package/dist/base/primitives/edge/EdgeLabel.css.js +3 -0
- package/dist/base/primitives/edge/EdgeLabel.d.ts +1 -1
- package/dist/base/primitives/edge/EdgeLabel.js +3 -2
- package/dist/base/primitives/edge/EdgeLabelContainer.js +1 -1
- package/dist/base/primitives/edge/EdgePath.d.ts +10 -42
- package/dist/base/primitives/edge/EdgePath.js +23 -16
- package/dist/base/primitives/edge/edge.css.js +1 -1
- package/dist/base/primitives/element/ElementActionButtons.js +1 -2
- package/dist/base/primitives/element/ElementDetailsButton.js +1 -2
- package/dist/base/primitives/element/ElementNodeContainer.js +3 -3
- package/dist/base/updateEdges.js +7 -2
- package/dist/base/updateNodes.js +11 -3
- package/dist/bundle/LikeC4View.js +3 -3
- package/dist/bundle/ReactLikeC4.js +1 -1
- package/dist/bundle/ShadowRoot.js +3 -3
- package/dist/bundle/styles.css.js +3 -3
- package/dist/context/ControlsCustomLayout.js +1 -1
- package/dist/context/DiagramEventHandlers.js +5 -5
- package/dist/context/DiagramFeatures.js +7 -7
- package/dist/context/EnsureMantine.js +2 -2
- package/dist/context/FramerMotionConfig.js +2 -2
- package/dist/context/IconRenderer.js +4 -4
- package/dist/context/ReduceGraphics.js +2 -2
- package/dist/context/RootContainer.js +5 -9
- package/dist/hooks/safeContext.d.ts +2 -5
- package/dist/hooks/safeContext.js +5 -4
- package/dist/hooks/useCurrentViewId.js +1 -1
- package/dist/hooks/useDiagram.d.ts +715 -150
- package/dist/hooks/useDiagram.js +2 -2
- package/dist/hooks/useMantinePortalProps.js +2 -2
- package/dist/hooks/useSetState.js +3 -3
- package/dist/hooks/useUpdateEffect.js +1 -1
- package/dist/hooks/useXYFlow.d.ts +2 -2
- package/dist/likec4diagram/DiagramUI.js +2 -2
- package/dist/likec4diagram/DiagramXYFlow.js +2 -2
- package/dist/likec4diagram/custom/edges/NotePopover.js +2 -2
- package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +2 -2
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +7 -7
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +6 -6
- package/dist/likec4diagram/custom/index.d.ts +1 -2
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +3 -3
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
- package/dist/likec4diagram/ui/controls/ChangeAutoLayoutButton.js +4 -4
- package/dist/likec4diagram/ui/controls/Controls.js +9 -9
- package/dist/likec4diagram/ui/controls/NavigationButtons.js +1 -1
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +1 -1
- package/dist/likec4diagram/ui/notation/NotationPanel.js +4 -4
- package/dist/likec4diagram/ui/search/ElementsColumn.js +88 -77
- package/dist/likec4diagram/ui/search/LikeC4Search.d.ts +2 -1
- package/dist/likec4diagram/ui/search/LikeC4Search.js +27 -24
- package/dist/likec4diagram/ui/search/SearchInput.js +1 -1
- package/dist/likec4diagram/ui/search/ViewsColum.js +3 -2
- package/dist/likec4diagram/ui/search/state.js +11 -9
- package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +1 -1
- package/dist/likec4diagram/useLayoutConstraints.js +3 -3
- package/dist/likec4model/LikeC4ModelContext.js +2 -2
- package/dist/likec4model/useLikeC4ElementsTree.js +2 -2
- package/dist/likec4model/useLikeC4Model.js +2 -2
- package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/cjs/react.production.js +548 -0
- package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/index.js +15 -0
- package/dist/overlays/Overlays.js +6 -6
- package/dist/overlays/element-details/ElementDetails.js +1 -1
- package/dist/overlays/element-details/ElementDetailsCard.js +5 -5
- package/dist/overlays/element-details/TabPanelDeployments.js +7 -4
- package/dist/overlays/element-details/TabPanelRelationships.js +2 -2
- package/dist/overlays/element-details/TabPanelStructure.js +6 -3
- package/dist/overlays/element-details/actor.d.ts +2 -2
- package/dist/overlays/element-details/actorContext.js +3 -3
- package/dist/overlays/overlay/Overlay.js +8 -7
- package/dist/overlays/relationship-details/RelationshipDetails.d.ts +1 -1
- package/dist/overlays/relationship-details/RelationshipDetails.js +28 -23
- package/dist/overlays/relationship-details/SelectEdge.js +3 -6
- package/dist/overlays/relationship-details/actor.d.ts +4 -1
- package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +1 -1
- package/dist/overlays/relationship-details/custom/edgeTypes.js +1 -1
- package/dist/overlays/relationship-details/hooks.d.ts +4 -1
- package/dist/overlays/relationship-details/hooks.js +4 -4
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +1 -1
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +9 -11
- package/dist/overlays/relationships-browser/SelectElement.js +8 -5
- package/dist/overlays/relationships-browser/actor.d.ts +2 -1
- package/dist/overlays/relationships-browser/actor.js +6 -12
- package/dist/overlays/relationships-browser/const.d.ts +2 -1
- package/dist/overlays/relationships-browser/const.js +6 -1
- package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +1 -1
- package/dist/overlays/relationships-browser/custom/edgeTypes.js +3 -4
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +1 -1
- package/dist/overlays/relationships-browser/hooks.d.ts +2 -1
- package/dist/overlays/relationships-browser/hooks.js +4 -4
- package/dist/overlays/relationships-browser/layout.js +2 -2
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +1 -2
- package/dist/state/DiagramActorProvider.js +7 -5
- package/dist/state/diagram-machine.d.ts +719 -146
- package/dist/state/diagram-machine.js +51 -10
- package/dist/styles.css.js +1 -1
- package/package.json +20 -16
- package/src/LikeC4Diagram.tsx +0 -1
- package/src/base/BaseXYFlow.tsx +2 -2
- package/src/base/primitives/compound/CompoundActionButton.tsx +1 -1
- package/src/base/primitives/compound/CompoundDetailsButton.tsx +1 -1
- package/src/base/primitives/compound/CompoundNodeContainer.tsx +1 -1
- package/src/base/primitives/customEdge.ts +1 -0
- package/src/base/primitives/edge/EdgeLabel.css.ts +3 -0
- package/src/base/primitives/edge/EdgeLabel.tsx +2 -1
- package/src/base/primitives/edge/EdgePath.tsx +22 -14
- package/src/base/primitives/edge/edge.css.ts +1 -1
- package/src/base/primitives/element/ElementActionButtons.tsx +2 -2
- package/src/base/primitives/element/ElementDetailsButton.tsx +2 -2
- package/src/base/primitives/element/ElementNodeContainer.tsx +1 -1
- package/src/base/updateEdges.ts +6 -9
- package/src/base/updateNodes.ts +10 -14
- package/src/context/FramerMotionConfig.tsx +1 -1
- package/src/context/RootContainer.tsx +0 -4
- package/src/hooks/safeContext.tsx +3 -1
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +2 -2
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +1 -1
- package/src/likec4diagram/ui/controls/Controls.tsx +56 -58
- package/src/likec4diagram/ui/controls/NavigationButtons.tsx +1 -1
- package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +1 -1
- package/src/likec4diagram/ui/notation/NotationPanel.tsx +1 -1
- package/src/likec4diagram/ui/search/ElementsColumn.tsx +94 -71
- package/src/likec4diagram/ui/search/LikeC4Search.tsx +48 -55
- package/src/likec4diagram/ui/search/ViewsColum.tsx +2 -2
- package/src/likec4diagram/ui/search/state.ts +8 -6
- package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.tsx +1 -1
- package/src/overlays/Overlays.tsx +2 -2
- package/src/overlays/element-details/ElementDetails.tsx +2 -2
- package/src/overlays/element-details/ElementDetailsCard.tsx +1 -1
- package/src/overlays/element-details/TabPanelDeployments.tsx +2 -0
- package/src/overlays/element-details/TabPanelStructure.tsx +2 -1
- package/src/overlays/overlay/Overlay.tsx +2 -1
- package/src/overlays/relationship-details/RelationshipDetails.tsx +25 -16
- package/src/overlays/relationship-details/SelectEdge.tsx +0 -14
- package/src/overlays/relationship-details/actor.ts +2 -1
- package/src/overlays/relationship-details/custom/edgeTypes.tsx +1 -1
- package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +1 -3
- package/src/overlays/relationships-browser/SelectElement.tsx +2 -0
- package/src/overlays/relationships-browser/actor.ts +8 -13
- package/src/overlays/relationships-browser/const.ts +8 -1
- package/src/overlays/relationships-browser/custom/edgeTypes.tsx +2 -3
- package/src/overlays/relationships-browser/custom/nodeTypes.tsx +1 -1
- package/src/overlays/relationships-browser/useViewToNodesEdges.ts +1 -2
- package/src/state/DiagramActorProvider.tsx +7 -4
- package/src/state/diagram-machine.ts +50 -8
|
@@ -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 {
|
|
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 }) });
|
package/dist/LikeC4Diagram.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { ReactFlowProvider } from '@xyflow/react';
|
|
3
|
-
import {
|
|
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 = {
|
package/dist/base/BaseXYFlow.js
CHANGED
|
@@ -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 {
|
|
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:
|
|
107
|
-
paneClickDistance:
|
|
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
|
|
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
|
|
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 '
|
|
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 '
|
|
4
|
-
import '
|
|
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/
|
|
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 {
|
|
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
|
-
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);
|
|
7
|
+
const edgePropsEqual = (prev, next) => prev.id === next.id && deepEqual(prev.selected ?? false, next.selected ?? false) && deepEqual(prev.animated ?? false, next.animated ?? 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 {
|
|
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 '
|
|
4
|
+
import '../../../_virtual/index.js';
|
|
5
5
|
import { edgeVars, edgeContainer } from './edge.css.js';
|
|
6
6
|
|
|
7
7
|
function EdgeContainer({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DiagramEdge } from '@likec4/core';
|
|
2
|
-
import { BoxProps } from '@
|
|
2
|
+
import { BoxProps } from '@likec4/styles/jsx';
|
|
3
3
|
import { PropsWithChildren } from 'react';
|
|
4
4
|
import { UndefinedOnPartialDeep } from 'type-fest';
|
|
5
5
|
import { EdgeProps } from '../../types';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { isStepEdgeId, extractStep } from '@likec4/core';
|
|
3
3
|
import { cx } from '@likec4/styles/css';
|
|
4
|
-
import { Box
|
|
5
|
-
import '
|
|
4
|
+
import { Box } from '@likec4/styles/jsx';
|
|
5
|
+
import { Text } from '@mantine/core';
|
|
6
|
+
import '../../../_virtual/index.js';
|
|
6
7
|
import { isTruthy } from 'remeda';
|
|
7
8
|
import { labelsva } from './EdgeLabel.css.js';
|
|
8
9
|
|
|
@@ -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 '
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
}
|
|
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 {
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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(
|
|
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
|
),
|
|
@@ -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
|
|
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
|
|
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
|
|
6
|
-
import {
|
|
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,
|
package/dist/base/updateEdges.js
CHANGED
|
@@ -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
|
|
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
|
});
|
package/dist/base/updateNodes.js
CHANGED
|
@@ -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(
|
|
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 {
|
|
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,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 {
|
|
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 {
|
|
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,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useSyncedRef } from '@react-hookz/web';
|
|
3
|
-
import {
|
|
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 };
|