@likec4/diagram 1.36.1 → 1.38.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/{chunk-DHvr-RGh.js → chunk-BZV0K82k.js} +870 -900
- package/bundle/custom.js +64 -56
- package/bundle/index.js +3565 -3327
- package/dist/LikeC4Diagram.props.d.ts +5 -5
- package/dist/LikeC4Styles.js +17 -15
- package/dist/StaticLikeC4Diagram.d.ts +1 -1
- package/dist/StaticLikeC4Diagram.js +3 -0
- package/dist/base/BaseXYFlow.d.ts +1 -1
- package/dist/base/BaseXYFlow.js +25 -27
- package/dist/base/const.d.ts +4 -4
- package/dist/base/const.js +5 -4
- package/dist/base/primitives/MarkdownBlock.js +4 -1
- package/dist/base/primitives/compound/CompoundActionButton.js +27 -42
- package/dist/base/primitives/compound/CompoundDetailsButton.js +23 -48
- package/dist/base/primitives/compound/CompoundNodeContainer.js +16 -48
- package/dist/base/primitives/compound/CompoundTitle.js +5 -80
- package/dist/base/primitives/compound/actionbtns.css.js +1 -13
- package/dist/base/primitives/customEdge.d.ts +1 -1
- package/dist/base/primitives/customNode.d.ts +4 -4
- package/dist/base/primitives/customNode.js +7 -7
- package/dist/base/primitives/edge/EdgeLabel.d.ts +5 -4
- package/dist/base/primitives/edge/EdgeLabel.js +39 -21
- package/dist/base/primitives/edge/EdgeLabelContainer.js +11 -23
- package/dist/base/primitives/edge/edge.css.js +19 -11
- package/dist/base/primitives/element/ElementShape.js +38 -18
- package/dist/base/primitives/element/ElementTags.js +7 -4
- package/dist/base/primitives/element/ElementTitle.js +10 -2
- package/dist/base/types.d.ts +17 -21
- package/dist/bundle/LikeC4View.d.ts +2 -2
- package/dist/bundle/LikeC4View.js +4 -1
- package/dist/bundle/LikeC4View.props.d.ts +2 -2
- package/dist/bundle/ReactLikeC4.d.ts +3 -3
- package/dist/bundle/custom.js +2 -1
- package/dist/bundle/index.js +2 -1
- package/dist/components/Link.js +3 -2
- package/dist/context/ReduceGraphics.js +2 -5
- package/dist/context/RootContainer.js +1 -5
- package/dist/custom/customNodes.d.ts +32 -26
- package/dist/custom/customNodes.js +12 -8
- package/dist/custom/hooks.d.ts +2 -1
- package/dist/custom/index.js +2 -1
- package/dist/globals.css.js +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/useDiagram.d.ts +18 -1
- package/dist/hooks/useDiagram.js +18 -2
- package/dist/hooks/useXYFlow.d.ts +40 -21
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/likec4diagram/DiagramUI.js +5 -2
- package/dist/likec4diagram/DiagramXYFlow.js +9 -9
- package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +3 -3
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +27 -44
- package/dist/likec4diagram/custom/index.js +3 -3
- package/dist/likec4diagram/custom/nodes/nodes.d.ts +8 -6
- package/dist/likec4diagram/custom/nodes/nodes.js +13 -14
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +3 -2
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +2 -2
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.d.ts +2 -0
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +441 -0
- package/dist/likec4diagram/relationship-popover/actor.d.ts +177 -0
- package/dist/likec4diagram/relationship-popover/actor.js +155 -0
- package/dist/likec4diagram/relationship-popover/styles.css.d.ts +2 -0
- package/dist/likec4diagram/{custom/edges/RelationshipsDropdownMenu.css.js → relationship-popover/styles.css.js} +4 -17
- package/dist/likec4diagram/useLayoutConstraints.js +0 -1
- package/dist/likec4model/useLikeC4ElementsTree.js +1 -1
- package/dist/likec4model/useLikeC4Project.js +15 -1
- package/dist/navigationpanel/NavigationPanelDropdown.js +1 -2
- package/dist/navigationpanel/actor.js +1 -2
- package/dist/navigationpanel/controls/NavigationButtons.js +1 -5
- package/dist/navigationpanel/controls/ViewDetailsCard.js +2 -0
- package/dist/overlays/element-details/actor.d.ts +564 -8
- package/dist/overlays/overlay/Overlay.css.d.ts +1 -1
- package/dist/overlays/relationship-details/actor.d.ts +3 -1
- package/dist/overlays/relationship-details/hooks.d.ts +19 -1
- package/dist/overlays/relationship-details/layout-to-xyflow.js +0 -1
- package/dist/overlays/relationship-details/layout.js +1 -2
- package/dist/overlays/relationships-browser/actor.d.ts +26 -2
- package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +16 -0
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +18 -8
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +0 -1
- package/dist/search/components/_shared.css.d.ts +1 -1
- package/dist/state/DiagramActorProvider.js +2 -19
- package/dist/state/assign.js +24 -10
- package/dist/state/diagram-machine.d.ts +149 -474
- package/dist/state/diagram-machine.js +94 -54
- package/dist/state/types.d.ts +1 -1
- package/dist/styles-min.css +1 -1
- package/dist/styles-xyflow.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css2.js +1 -1
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/roundDpr.d.ts +1 -0
- package/dist/utils/roundDpr.js +20 -0
- package/dist/utils/xyflow.d.ts +0 -1
- package/dist/utils/xyflow.js +1 -7
- package/package.json +16 -15
- package/panda.buildinfo.json +91 -156
- package/src/LikeC4Diagram.props.ts +5 -5
- package/src/LikeC4Styles.tsx +22 -14
- package/src/StaticLikeC4Diagram.tsx +3 -0
- package/src/base/BaseXYFlow.tsx +26 -29
- package/src/base/const.ts +5 -4
- package/src/base/primitives/MarkdownBlock.tsx +6 -1
- package/src/base/primitives/compound/CompoundActionButton.tsx +31 -43
- package/src/base/primitives/compound/CompoundDetailsButton.tsx +26 -48
- package/src/base/primitives/compound/CompoundNodeContainer.tsx +15 -43
- package/src/base/primitives/compound/CompoundTitle.tsx +4 -76
- package/src/base/primitives/compound/actionbtns.css.ts +0 -12
- package/src/base/primitives/customEdge.ts +1 -1
- package/src/base/primitives/customNode.tsx +20 -24
- package/src/base/primitives/edge/EdgeLabel.tsx +23 -8
- package/src/base/primitives/edge/EdgeLabelContainer.tsx +9 -21
- package/src/base/primitives/edge/edge.css.ts +19 -11
- package/src/base/primitives/element/ElementShape.tsx +40 -18
- package/src/base/primitives/element/ElementTags.tsx +7 -4
- package/src/base/primitives/element/ElementTitle.tsx +23 -11
- package/src/base/types.ts +21 -25
- package/src/bundle/LikeC4View.props.ts +2 -2
- package/src/bundle/LikeC4View.tsx +8 -5
- package/src/bundle/ReactLikeC4.tsx +3 -3
- package/src/components/Link.tsx +3 -2
- package/src/context/RootContainer.tsx +1 -5
- package/src/context/TagStylesContext.tsx +2 -0
- package/src/custom/{customNodes.tsx → customNodes.ts} +58 -52
- package/src/custom/hooks.ts +7 -0
- package/src/globals.css +58 -5
- package/src/hooks/index.ts +1 -1
- package/src/hooks/useDiagram.ts +39 -5
- package/src/hooks/useXYFlow.ts +3 -1
- package/src/index.ts +1 -0
- package/src/likec4diagram/DiagramUI.tsx +3 -0
- package/src/likec4diagram/DiagramXYFlow.tsx +9 -11
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +25 -49
- package/src/likec4diagram/custom/index.ts +5 -4
- package/src/likec4diagram/custom/nodes/nodes.tsx +13 -11
- package/src/likec4diagram/custom/nodes/toolbar/CompoundToolbar.tsx +3 -2
- package/src/likec4diagram/relationship-popover/RelationshipPopover.tsx +535 -0
- package/src/likec4diagram/relationship-popover/actor.ts +192 -0
- package/src/likec4diagram/{custom/edges/RelationshipsDropdownMenu.css.ts → relationship-popover/styles.css.ts} +3 -19
- package/src/likec4diagram/useLayoutConstraints.ts +0 -1
- package/src/likec4model/useLikeC4ElementsTree.ts +1 -1
- package/src/navigationpanel/NavigationPanelDropdown.tsx +1 -2
- package/src/navigationpanel/actor.ts +2 -2
- package/src/navigationpanel/controls/NavigationButtons.tsx +1 -5
- package/src/navigationpanel/controls/ViewDetailsCard.tsx +2 -0
- package/src/overlays/relationship-details/layout-to-xyflow.ts +0 -1
- package/src/overlays/relationship-details/layout.ts +4 -3
- package/src/overlays/relationships-browser/custom/nodeTypes.tsx +22 -8
- package/src/overlays/relationships-browser/useViewToNodesEdges.ts +0 -1
- package/src/state/DiagramActorProvider.tsx +2 -20
- package/src/state/assign.ts +24 -10
- package/src/state/diagram-machine.ts +101 -53
- package/src/state/types.ts +4 -1
- package/src/utils/index.ts +2 -1
- package/src/utils/roundDpr.ts +27 -0
- package/src/utils/xyflow.ts +0 -7
- package/dist/base/primitives/compound/CompoundNodeContainer.css.d.ts +0 -35
- package/dist/base/primitives/compound/CompoundNodeContainer.css.js +0 -132
- package/dist/base/primitives/edge/EdgeLabel.css.d.ts +0 -7
- package/dist/base/primitives/edge/EdgeLabel.css.js +0 -57
- package/dist/base/primitives/element/ElementShape.css.d.ts +0 -6
- package/dist/base/primitives/element/ElementShape.css.js +0 -107
- package/dist/likec4diagram/custom/edges/NotePopover.css.js +0 -21
- package/dist/likec4diagram/custom/edges/NotePopover.js +0 -91
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.d.ts +0 -5
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.d.ts +0 -13
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +0 -215
- package/dist/likec4diagram/custom/index.d.ts +0 -62
- package/dist/overlays/relationship-details/custom/nodeTypes.d.ts +0 -10
- package/src/base/primitives/compound/CompoundNodeContainer.css.ts +0 -138
- package/src/base/primitives/edge/EdgeLabel.css.ts +0 -64
- package/src/base/primitives/element/ElementShape.css.ts +0 -112
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +0 -281
|
@@ -6,7 +6,7 @@ import { ControlsCustomLayout } from './context/ControlsCustomLayout';
|
|
|
6
6
|
import { CustomNodes } from './custom/customNodes';
|
|
7
7
|
export type { CustomNodes, WhereOperator };
|
|
8
8
|
export type DiagramNodeWithNavigate<A extends Any> = SetRequired<DiagramNode<A>, 'navigateTo'>;
|
|
9
|
-
type ElementIconRendererProps = {
|
|
9
|
+
export type ElementIconRendererProps = {
|
|
10
10
|
node: {
|
|
11
11
|
id: string;
|
|
12
12
|
title: string;
|
|
@@ -15,9 +15,9 @@ type ElementIconRendererProps = {
|
|
|
15
15
|
className?: string;
|
|
16
16
|
};
|
|
17
17
|
export type ElementIconRenderer = (props: ElementIconRendererProps) => ReactNode;
|
|
18
|
-
export type OnNavigateTo<A extends Any> = (to: aux.ViewId<A>, event?: ReactMouseEvent, element?: DiagramNodeWithNavigate<A>) => void;
|
|
19
|
-
export type OnNodeClick<A extends Any> = (node: DiagramNode<A>, event: ReactMouseEvent) => void;
|
|
20
|
-
export type OnEdgeClick<A extends Any> = (edge: DiagramEdge<A>, event: ReactMouseEvent) => void;
|
|
18
|
+
export type OnNavigateTo<A extends Any = Any> = (to: aux.ViewId<A>, event?: ReactMouseEvent, element?: DiagramNodeWithNavigate<A>) => void;
|
|
19
|
+
export type OnNodeClick<A extends Any = Any> = (node: DiagramNode<A>, event: ReactMouseEvent) => void;
|
|
20
|
+
export type OnEdgeClick<A extends Any = Any> = (edge: DiagramEdge<A>, event: ReactMouseEvent) => void;
|
|
21
21
|
/**
|
|
22
22
|
* On pane/canvas click (not on any node or edge)
|
|
23
23
|
*/
|
|
@@ -49,7 +49,7 @@ export type ViewPadding = PaddingWithUnit | {
|
|
|
49
49
|
x?: PaddingWithUnit;
|
|
50
50
|
y?: PaddingWithUnit;
|
|
51
51
|
};
|
|
52
|
-
export interface LikeC4DiagramProperties<A extends
|
|
52
|
+
export interface LikeC4DiagramProperties<A extends Any = Any> {
|
|
53
53
|
view: LayoutedView<A>;
|
|
54
54
|
className?: string | undefined;
|
|
55
55
|
/**
|
package/dist/LikeC4Styles.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { jsxs, Fragment
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { ThemeColors, defaultTheme } from '@likec4/core';
|
|
3
3
|
import { useMantineStyleNonce } from '@mantine/core';
|
|
4
4
|
import { toRgba, mix, toHex, scale } from 'khroma';
|
|
5
|
+
import { memo } from 'react';
|
|
5
6
|
import { pipe, entries, map, join, range } from 'remeda';
|
|
6
7
|
import globalsCss from './globals.css.js';
|
|
7
8
|
import { useLikeC4Specification } from './likec4model/useLikeC4Model.js';
|
|
@@ -74,21 +75,22 @@ function generateCustomColorStyles(customColors) {
|
|
|
74
75
|
}
|
|
75
76
|
function LikeC4Styles() {
|
|
76
77
|
const nonce = useMantineStyleNonce()?.();
|
|
77
|
-
const customColors = useLikeC4Specification()
|
|
78
|
+
const { customColors } = useLikeC4Specification();
|
|
78
79
|
const customColorsStyles = customColors ? generateCustomColorStyles(customColors) : "";
|
|
79
|
-
return /* @__PURE__ */
|
|
80
|
-
/* @__PURE__ */ jsx("style", { type: "text/css", "data-likec4-global": true, dangerouslySetInnerHTML: { __html: globalsCss }, nonce }),
|
|
81
|
-
/* @__PURE__ */ jsx("style", { type: "text/css", "data-likec4-colors": true, dangerouslySetInnerHTML: { __html: builtInColors }, nonce }),
|
|
82
|
-
customColorsStyles && /* @__PURE__ */ jsx(
|
|
83
|
-
"style",
|
|
84
|
-
{
|
|
85
|
-
type: "text/css",
|
|
86
|
-
"data-likec4-custom-colors": true,
|
|
87
|
-
dangerouslySetInnerHTML: { __html: customColorsStyles },
|
|
88
|
-
nonce
|
|
89
|
-
}
|
|
90
|
-
)
|
|
91
|
-
] });
|
|
80
|
+
return /* @__PURE__ */ jsx(MemoizedStyles, { nonce, customColorsStyles, builtInColors });
|
|
92
81
|
}
|
|
82
|
+
const MemoizedStyles = memo(({ nonce, customColorsStyles, builtInColors: builtInColors2 }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
83
|
+
/* @__PURE__ */ jsx("style", { type: "text/css", "data-likec4-global": true, dangerouslySetInnerHTML: { __html: globalsCss }, nonce }),
|
|
84
|
+
/* @__PURE__ */ jsx("style", { type: "text/css", "data-likec4-colors": true, dangerouslySetInnerHTML: { __html: builtInColors2 }, nonce }),
|
|
85
|
+
customColorsStyles && /* @__PURE__ */ jsx(
|
|
86
|
+
"style",
|
|
87
|
+
{
|
|
88
|
+
type: "text/css",
|
|
89
|
+
"data-likec4-custom-colors": true,
|
|
90
|
+
dangerouslySetInnerHTML: { __html: customColorsStyles },
|
|
91
|
+
nonce
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
] }));
|
|
93
95
|
|
|
94
96
|
export { LikeC4Styles };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Any, UnknownLayouted } from '@likec4/core/types';
|
|
2
2
|
import { LikeC4DiagramProperties } from './LikeC4Diagram.props';
|
|
3
3
|
export type StaticLikeC4DiagramProps<A extends Any> = Pick<LikeC4DiagramProperties<A>, 'view' | 'className' | 'fitView' | 'fitViewPadding' | 'background' | 'enableElementDetails' | 'enableRelationshipDetails' | 'enableRelationshipBrowser' | 'enableElementTags' | 'reduceGraphics' | 'initialWidth' | 'initialHeight' | 'renderIcon' | 'renderNodes' | 'where'>;
|
|
4
|
-
export declare function StaticLikeC4Diagram<A extends Any = UnknownLayouted>({ view, fitView, fitViewPadding, enableRelationshipDetails, enableRelationshipBrowser, background, ...rest }: StaticLikeC4DiagramProps<A>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function StaticLikeC4Diagram<A extends Any = UnknownLayouted>({ view, fitView, fitViewPadding, enableRelationshipDetails, enableRelationshipBrowser, background, className, ...rest }: StaticLikeC4DiagramProps<A>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cx } from '@likec4/styles/css';
|
|
2
3
|
import { LikeC4Diagram } from './LikeC4Diagram.js';
|
|
3
4
|
|
|
4
5
|
function StaticLikeC4Diagram({
|
|
@@ -8,6 +9,7 @@ function StaticLikeC4Diagram({
|
|
|
8
9
|
enableRelationshipDetails = false,
|
|
9
10
|
enableRelationshipBrowser = enableRelationshipDetails,
|
|
10
11
|
background = "transparent",
|
|
12
|
+
className,
|
|
11
13
|
...rest
|
|
12
14
|
}) {
|
|
13
15
|
return /* @__PURE__ */ jsx(
|
|
@@ -15,6 +17,7 @@ function StaticLikeC4Diagram({
|
|
|
15
17
|
{
|
|
16
18
|
view,
|
|
17
19
|
readonly: true,
|
|
20
|
+
className: cx(className, "likec4-static-view"),
|
|
18
21
|
fitView,
|
|
19
22
|
fitViewPadding,
|
|
20
23
|
pannable: false,
|
|
@@ -12,4 +12,4 @@ export type BaseXYFlowProps<NodeType extends Base.Node, EdgeType extends Base.Ed
|
|
|
12
12
|
fitViewPadding?: ViewPadding | undefined;
|
|
13
13
|
onViewportResize?: undefined | (() => void);
|
|
14
14
|
} & SetRequired<Omit<ReactFlowProps<NodeType, EdgeType>, 'defaultNodes' | 'defaultEdges' | 'onNodeDoubleClick' | 'onEdgeDoubleClick' | 'fitViewOptions'>, 'nodes' | 'edges' | 'onNodesChange' | 'onEdgesChange'>>;
|
|
15
|
-
export declare const BaseXYFlow: <NodeType extends Base.Node, EdgeType extends Base.Edge>({ nodes, edges, onEdgesChange, onNodesChange, className, pannable, zoomable, nodesSelectable, nodesDraggable, background, children, colorMode, fitViewPadding, fitView, zoomOnDoubleClick, onViewportResize, onMoveEnd, ...props }: BaseXYFlowProps<NodeType, EdgeType>) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const BaseXYFlow: <NodeType extends Base.Node, EdgeType extends Base.Edge>({ nodes, edges, onEdgesChange, onNodesChange, className, pannable, zoomable, nodesSelectable, nodesDraggable, background, children, colorMode, fitViewPadding, fitView, zoomOnDoubleClick, onViewportResize, onMoveEnd, onNodeMouseEnter, onNodeMouseLeave, onEdgeMouseEnter, onEdgeMouseLeave, ...props }: BaseXYFlowProps<NodeType, EdgeType>) => import("react/jsx-runtime").JSX.Element;
|
package/dist/base/BaseXYFlow.js
CHANGED
|
@@ -1,37 +1,16 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { cx
|
|
2
|
+
import { cx } from '@likec4/styles/css';
|
|
3
3
|
import { useCallbackRef } from '@mantine/hooks';
|
|
4
4
|
import { ReactFlow, useStore } from '@xyflow/react';
|
|
5
5
|
import { Fragment } from 'react';
|
|
6
6
|
import { useUpdateEffect } from '../hooks/useUpdateEffect.js';
|
|
7
7
|
import { useIsZoomTooSmall, useXYStoreApi } from '../hooks/useXYFlow.js';
|
|
8
|
+
import { roundDpr } from '../utils/roundDpr.js';
|
|
8
9
|
import { stopPropagation } from '../utils/xyflow.js';
|
|
9
10
|
import { Background } from './Background.js';
|
|
10
11
|
import { MinZoom, MaxZoom } from './const.js';
|
|
11
12
|
import { setHovered } from './types.Base.js';
|
|
12
13
|
|
|
13
|
-
const cssReactFlow = cva({
|
|
14
|
-
base: {
|
|
15
|
-
"& .react-flow__pane": {
|
|
16
|
-
WebkitUserSelect: "none"
|
|
17
|
-
},
|
|
18
|
-
"& .react-flow__attribution": {
|
|
19
|
-
display: "none"
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
variants: {
|
|
23
|
-
transparent: {
|
|
24
|
-
true: {
|
|
25
|
-
background: "transparent !important",
|
|
26
|
-
["--xy-background-color"]: "transparent !important"
|
|
27
|
-
},
|
|
28
|
-
false: {
|
|
29
|
-
["--xy-background-color"]: "{colors.likec4.background}",
|
|
30
|
-
["--xy-background-pattern-color"]: "{colors.likec4.background.pattern}"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
14
|
const BaseXYFlow = ({
|
|
36
15
|
nodes,
|
|
37
16
|
edges,
|
|
@@ -50,6 +29,10 @@ const BaseXYFlow = ({
|
|
|
50
29
|
zoomOnDoubleClick = false,
|
|
51
30
|
onViewportResize,
|
|
52
31
|
onMoveEnd,
|
|
32
|
+
onNodeMouseEnter,
|
|
33
|
+
onNodeMouseLeave,
|
|
34
|
+
onEdgeMouseEnter,
|
|
35
|
+
onEdgeMouseLeave,
|
|
53
36
|
...props
|
|
54
37
|
}) => {
|
|
55
38
|
const isBgWithPattern = background !== "transparent" && background !== "solid";
|
|
@@ -62,9 +45,7 @@ const BaseXYFlow = ({
|
|
|
62
45
|
nodes,
|
|
63
46
|
edges,
|
|
64
47
|
className: cx(
|
|
65
|
-
|
|
66
|
-
transparent: background === "transparent"
|
|
67
|
-
}),
|
|
48
|
+
background === "transparent" && "bg-transparent",
|
|
68
49
|
className
|
|
69
50
|
),
|
|
70
51
|
...isZoomTooSmall && {
|
|
@@ -89,6 +70,7 @@ const BaseXYFlow = ({
|
|
|
89
70
|
defaultMarkerColor: "var(--xy-edge-stroke)",
|
|
90
71
|
noDragClassName: "nodrag",
|
|
91
72
|
noPanClassName: "nopan",
|
|
73
|
+
noWheelClassName: "nowheel",
|
|
92
74
|
panOnScroll: pannable,
|
|
93
75
|
panOnDrag: pannable,
|
|
94
76
|
...!pannable && {
|
|
@@ -107,13 +89,17 @@ const BaseXYFlow = ({
|
|
|
107
89
|
onNodesChange,
|
|
108
90
|
onEdgesChange,
|
|
109
91
|
onMoveEnd: useCallbackRef((event, { x, y, zoom }) => {
|
|
110
|
-
const roundedX =
|
|
92
|
+
const roundedX = roundDpr(x), roundedY = roundDpr(y);
|
|
111
93
|
if (x !== roundedX || y !== roundedY) {
|
|
112
94
|
xystore.setState({ transform: [roundedX, roundedY, zoom] });
|
|
113
95
|
}
|
|
114
96
|
onMoveEnd?.(event, { x: roundedX, y: roundedY, zoom });
|
|
115
97
|
}),
|
|
116
98
|
onNodeMouseEnter: useCallbackRef((_event, node) => {
|
|
99
|
+
if (onNodeMouseEnter) {
|
|
100
|
+
onNodeMouseEnter(_event, node);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
117
103
|
if (!node.data.hovered) {
|
|
118
104
|
onNodesChange([{
|
|
119
105
|
id: node.id,
|
|
@@ -123,6 +109,10 @@ const BaseXYFlow = ({
|
|
|
123
109
|
}
|
|
124
110
|
}),
|
|
125
111
|
onNodeMouseLeave: useCallbackRef((_event, node) => {
|
|
112
|
+
if (onNodeMouseLeave) {
|
|
113
|
+
onNodeMouseLeave(_event, node);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
126
116
|
if (node.data.hovered) {
|
|
127
117
|
onNodesChange([{
|
|
128
118
|
id: node.id,
|
|
@@ -132,6 +122,10 @@ const BaseXYFlow = ({
|
|
|
132
122
|
}
|
|
133
123
|
}),
|
|
134
124
|
onEdgeMouseEnter: useCallbackRef((_event, edge) => {
|
|
125
|
+
if (onEdgeMouseEnter) {
|
|
126
|
+
onEdgeMouseEnter(_event, edge);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
135
129
|
if (!edge.data.hovered) {
|
|
136
130
|
onEdgesChange([{
|
|
137
131
|
id: edge.id,
|
|
@@ -141,6 +135,10 @@ const BaseXYFlow = ({
|
|
|
141
135
|
}
|
|
142
136
|
}),
|
|
143
137
|
onEdgeMouseLeave: useCallbackRef((_event, edge) => {
|
|
138
|
+
if (onEdgeMouseLeave) {
|
|
139
|
+
onEdgeMouseLeave(_event, edge);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
144
142
|
if (edge.data.hovered) {
|
|
145
143
|
onEdgesChange([{
|
|
146
144
|
id: edge.id,
|
package/dist/base/const.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare const ZIndexes: {
|
|
2
|
-
readonly Compound:
|
|
3
|
-
readonly Edge:
|
|
4
|
-
readonly Element:
|
|
5
|
-
readonly Max:
|
|
2
|
+
readonly Compound: 1;
|
|
3
|
+
readonly Edge: 20;
|
|
4
|
+
readonly Element: 20;
|
|
5
|
+
readonly Max: 30;
|
|
6
6
|
};
|
|
7
7
|
export declare const MinZoom = 0.05;
|
|
8
8
|
export declare const MaxZoom = 3;
|
package/dist/base/const.js
CHANGED
|
@@ -17,7 +17,7 @@ const MarkdownBlock = forwardRef(({
|
|
|
17
17
|
if (value.isEmpty && hideIfEmpty) {
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
|
-
const content = value.nonEmpty ? { dangerouslySetInnerHTML: { __html: value.html } } : { children: /* @__PURE__ */ jsx(Text, { component: "span", fz: "xs", c: "dimmed", style: { userSelect: "none" }, children: emptyText }) };
|
|
20
|
+
const content = value.nonEmpty ? value.isMarkdown ? { dangerouslySetInnerHTML: { __html: value.html } } : { children: /* @__PURE__ */ jsx("p", { children: value.text }) } : { children: /* @__PURE__ */ jsx(Text, { component: "span", fz: "xs", c: "dimmed", style: { userSelect: "none" }, children: emptyText }) };
|
|
21
21
|
return /* @__PURE__ */ jsx(
|
|
22
22
|
Box,
|
|
23
23
|
{
|
|
@@ -30,6 +30,9 @@ const MarkdownBlock = forwardRef(({
|
|
|
30
30
|
className
|
|
31
31
|
),
|
|
32
32
|
style: {
|
|
33
|
+
...props.fontSize && {
|
|
34
|
+
"--text-fz": `var(--font-sizes-${props.fontSize}, var(--font-sizes-md))`
|
|
35
|
+
},
|
|
33
36
|
// @ts-expect-error
|
|
34
37
|
["--mantine-scale"]: textScale
|
|
35
38
|
},
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { cx
|
|
3
|
-
import { Box } from '@likec4/styles/jsx';
|
|
2
|
+
import { cx } from '@likec4/styles/css';
|
|
4
3
|
import { actionBtn } from '@likec4/styles/recipes';
|
|
5
4
|
import { ActionIcon } from '@mantine/core';
|
|
6
5
|
import { useDebouncedValue } from '@mantine/hooks';
|
|
@@ -19,49 +18,35 @@ function CompoundActionButton({
|
|
|
19
18
|
const debounced = useDebouncedValue(isHovered, isHovered ? 130 : 0);
|
|
20
19
|
const isHoverDebounced = debounced[0] && isHovered;
|
|
21
20
|
return /* @__PURE__ */ jsx(
|
|
22
|
-
|
|
21
|
+
m.div,
|
|
23
22
|
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
initial: false,
|
|
24
|
+
animate: {
|
|
25
|
+
scale: isHoverDebounced ? 1.2 : 1,
|
|
26
|
+
x: isHoverDebounced ? -1 : 0,
|
|
27
|
+
y: isHoverDebounced ? -1 : 0
|
|
28
|
+
},
|
|
29
|
+
whileHover: {
|
|
30
|
+
scale: 1.4,
|
|
31
|
+
x: -3,
|
|
32
|
+
y: -1
|
|
33
|
+
},
|
|
34
|
+
className: "likec4-compound-navigation compound-action",
|
|
35
|
+
whileTap: { scale: 1 },
|
|
36
|
+
onClick: stopPropagation,
|
|
35
37
|
children: /* @__PURE__ */ jsx(
|
|
36
|
-
|
|
38
|
+
ActionIcon,
|
|
37
39
|
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
whileTap: { scale: 1 },
|
|
50
|
-
children: /* @__PURE__ */ jsx(
|
|
51
|
-
ActionIcon,
|
|
52
|
-
{
|
|
53
|
-
className: cx(
|
|
54
|
-
"nodrag nopan",
|
|
55
|
-
compoundActionBtn({
|
|
56
|
-
delay: isHovered && !isHoverDebounced
|
|
57
|
-
}),
|
|
58
|
-
actionBtn()
|
|
59
|
-
),
|
|
60
|
-
onClick,
|
|
61
|
-
onDoubleClick: stopPropagation,
|
|
62
|
-
children: icon ?? /* @__PURE__ */ jsx(IconZoomScan, { stroke: 2 })
|
|
63
|
-
}
|
|
64
|
-
)
|
|
40
|
+
className: cx(
|
|
41
|
+
"nodrag nopan",
|
|
42
|
+
compoundActionBtn({
|
|
43
|
+
delay: isHovered && !isHoverDebounced
|
|
44
|
+
}),
|
|
45
|
+
actionBtn({ variant: "transparent" })
|
|
46
|
+
),
|
|
47
|
+
onClick,
|
|
48
|
+
onDoubleClick: stopPropagation,
|
|
49
|
+
children: icon ?? /* @__PURE__ */ jsx(IconZoomScan, { stroke: 2 })
|
|
65
50
|
}
|
|
66
51
|
)
|
|
67
52
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { cx
|
|
3
|
-
import { Box } from '@likec4/styles/jsx';
|
|
2
|
+
import { cx } from '@likec4/styles/css';
|
|
4
3
|
import { actionBtn } from '@likec4/styles/recipes';
|
|
5
4
|
import { ActionIcon } from '@mantine/core';
|
|
6
5
|
import { useDebouncedValue } from '@mantine/hooks';
|
|
@@ -19,55 +18,31 @@ function CompoundDetailsButton({
|
|
|
19
18
|
const debounced = useDebouncedValue(isHovered, isHovered ? 130 : 0);
|
|
20
19
|
const isHoverDebounced = debounced[0] && isHovered;
|
|
21
20
|
return /* @__PURE__ */ jsx(
|
|
22
|
-
|
|
21
|
+
m.div,
|
|
23
22
|
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
),
|
|
35
|
-
onClick: stopPropagation,
|
|
23
|
+
initial: false,
|
|
24
|
+
animate: {
|
|
25
|
+
scale: isHoverDebounced ? 1.2 : 1
|
|
26
|
+
// opacity: isHoverDebounced ? 1 : 0.6,
|
|
27
|
+
},
|
|
28
|
+
whileHover: {
|
|
29
|
+
scale: 1.4
|
|
30
|
+
},
|
|
31
|
+
whileTap: { scale: 1 },
|
|
32
|
+
className: "likec4-compound-details details-button",
|
|
36
33
|
children: /* @__PURE__ */ jsx(
|
|
37
|
-
|
|
34
|
+
ActionIcon,
|
|
38
35
|
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
children: /* @__PURE__ */ jsx(
|
|
49
|
-
ActionIcon,
|
|
50
|
-
{
|
|
51
|
-
className: cx(
|
|
52
|
-
"nodrag nopan",
|
|
53
|
-
compoundActionBtn({
|
|
54
|
-
delay: isHovered && !isHoverDebounced
|
|
55
|
-
}),
|
|
56
|
-
css({
|
|
57
|
-
_whenHovered: {
|
|
58
|
-
opacity: 0.75
|
|
59
|
-
},
|
|
60
|
-
_hover: {
|
|
61
|
-
opacity: 1
|
|
62
|
-
}
|
|
63
|
-
}),
|
|
64
|
-
actionBtn({ variant: "transparent" })
|
|
65
|
-
),
|
|
66
|
-
onClick,
|
|
67
|
-
onDoubleClick: stopPropagation,
|
|
68
|
-
children: icon ?? /* @__PURE__ */ jsx(IconId, { stroke: 1.8, style: { width: "75%" } })
|
|
69
|
-
}
|
|
70
|
-
)
|
|
36
|
+
className: cx(
|
|
37
|
+
"nodrag nopan",
|
|
38
|
+
compoundActionBtn({
|
|
39
|
+
delay: isHovered && !isHoverDebounced
|
|
40
|
+
}),
|
|
41
|
+
actionBtn({ variant: "transparent" })
|
|
42
|
+
),
|
|
43
|
+
onClick,
|
|
44
|
+
onDoubleClick: stopPropagation,
|
|
45
|
+
children: icon ?? /* @__PURE__ */ jsx(IconId, { stroke: 1.8, style: { width: "75%" } })
|
|
71
46
|
}
|
|
72
47
|
)
|
|
73
48
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { cx } from '@likec4/styles/css';
|
|
3
|
+
import { compoundNode } from '@likec4/styles/recipes';
|
|
3
4
|
import { m } from 'motion/react';
|
|
4
|
-
import {
|
|
5
|
-
import { compound, borderOpacityPercent, borderRadius, borderWidth, compoundOpacity } from './CompoundNodeContainer.css.js';
|
|
6
|
-
import { useIsReducedGraphics } from '../../../context/ReduceGraphics.js';
|
|
5
|
+
import { clamp } from 'remeda';
|
|
7
6
|
|
|
8
7
|
function CompoundNodeContainer({
|
|
9
8
|
nodeProps: {
|
|
@@ -19,78 +18,47 @@ function CompoundNodeContainer({
|
|
|
19
18
|
style,
|
|
20
19
|
...rest
|
|
21
20
|
}) {
|
|
22
|
-
|
|
23
|
-
const isTransparent = isNumber(data.style.opacity) && data.style.opacity < 99;
|
|
24
|
-
let opacity = clamp((data.style.opacity ?? 100) / 100, {
|
|
21
|
+
let opacity = clamp(data.style.opacity ?? 100, {
|
|
25
22
|
min: 0,
|
|
26
|
-
max:
|
|
23
|
+
max: 100
|
|
27
24
|
});
|
|
28
|
-
|
|
29
|
-
opacity = Math.min(opacity + 0.08, 1);
|
|
30
|
-
}
|
|
25
|
+
const isTransparent = opacity < 99;
|
|
31
26
|
const MIN_OPACITY = 65;
|
|
32
|
-
const borderOpacity = MIN_OPACITY + clamp((100 - MIN_OPACITY) * opacity, {
|
|
27
|
+
const borderOpacity = MIN_OPACITY + clamp((100 - MIN_OPACITY) * (opacity / 100), {
|
|
33
28
|
min: 0,
|
|
34
29
|
max: 100 - MIN_OPACITY
|
|
35
30
|
});
|
|
36
|
-
const
|
|
37
|
-
isTransparent
|
|
31
|
+
const compoundClass = compoundNode({
|
|
32
|
+
isTransparent,
|
|
33
|
+
inverseColor: opacity < 60,
|
|
34
|
+
borderStyle: data.style.border ?? (isTransparent ? "dashed" : "none")
|
|
38
35
|
});
|
|
39
36
|
const depth = clamp(data.depth ?? 1, {
|
|
40
37
|
min: 1,
|
|
41
38
|
max: 5
|
|
42
39
|
});
|
|
43
|
-
return /* @__PURE__ */
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
44
41
|
m.div,
|
|
45
42
|
{
|
|
46
43
|
className: cx(
|
|
47
|
-
|
|
48
|
-
"likec4-compound-node",
|
|
44
|
+
compoundClass,
|
|
49
45
|
className
|
|
50
46
|
),
|
|
51
47
|
initial: false,
|
|
52
48
|
"data-likec4-hovered": isHovered,
|
|
53
49
|
"data-likec4-color": data.color,
|
|
54
50
|
"data-compound-depth": depth,
|
|
55
|
-
...isTransparent && {
|
|
56
|
-
"data-compound-transparent": true,
|
|
57
|
-
"data-compound-title-inverse": opacity < 0.5
|
|
58
|
-
},
|
|
59
51
|
...isDimmed !== false && {
|
|
60
52
|
"data-likec4-dimmed": isDimmed
|
|
61
53
|
},
|
|
62
54
|
style: {
|
|
63
55
|
...style,
|
|
64
56
|
// @ts-expect-error
|
|
65
|
-
[
|
|
66
|
-
[
|
|
67
|
-
[borderRadius.var]: `6px`,
|
|
68
|
-
[borderOpacityPercent.var]: `${borderOpacity}%`
|
|
57
|
+
["--_border-transparency"]: `${borderOpacity}%`,
|
|
58
|
+
["--_compound-transparency"]: `${opacity}%`
|
|
69
59
|
},
|
|
70
60
|
...rest,
|
|
71
|
-
children
|
|
72
|
-
isTransparent && data.style.border !== "none" && /* @__PURE__ */ jsx(
|
|
73
|
-
"div",
|
|
74
|
-
{
|
|
75
|
-
className: classes.compoundBorder,
|
|
76
|
-
style: {
|
|
77
|
-
borderStyle: data.style.border ?? "dashed"
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
),
|
|
81
|
-
/* @__PURE__ */ jsx("svg", { className: classes.indicatorSvg, children: /* @__PURE__ */ jsx(
|
|
82
|
-
"rect",
|
|
83
|
-
{
|
|
84
|
-
className: classes.indicatorRect,
|
|
85
|
-
x: 0,
|
|
86
|
-
y: 0,
|
|
87
|
-
width: "100%",
|
|
88
|
-
height: "100%",
|
|
89
|
-
rx: 6
|
|
90
|
-
}
|
|
91
|
-
) }),
|
|
92
|
-
children
|
|
93
|
-
]
|
|
61
|
+
children
|
|
94
62
|
}
|
|
95
63
|
);
|
|
96
64
|
}
|
|
@@ -1,73 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { cx, css } from '@likec4/styles/css';
|
|
3
|
-
import { Box } from '@likec4/styles/jsx';
|
|
4
2
|
import { Text } from '@mantine/core';
|
|
5
3
|
import { IconRenderer } from '../../../context/IconRenderer.js';
|
|
6
4
|
|
|
7
|
-
const titleContainer = css({
|
|
8
|
-
position: "absolute",
|
|
9
|
-
display: "flex",
|
|
10
|
-
alignItems: "center",
|
|
11
|
-
gap: "1.5",
|
|
12
|
-
// 6px
|
|
13
|
-
left: "[14px]",
|
|
14
|
-
top: "[4px]",
|
|
15
|
-
right: "[30px]",
|
|
16
|
-
width: "auto",
|
|
17
|
-
minHeight: "30px",
|
|
18
|
-
[`:where(.react-flow__node.draggable) &`]: {
|
|
19
|
-
pointerEvents: "all",
|
|
20
|
-
cursor: "grab"
|
|
21
|
-
},
|
|
22
|
-
[`.likec4-compound-node:has(.compound-action) &`]: {
|
|
23
|
-
paddingLeft: "[22px]"
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
const titleText = css({
|
|
27
|
-
flex: "1",
|
|
28
|
-
fontFamily: "likec4.compound",
|
|
29
|
-
fontWeight: 600,
|
|
30
|
-
fontSize: "15px",
|
|
31
|
-
textTransform: "uppercase",
|
|
32
|
-
letterSpacing: "0.2px",
|
|
33
|
-
color: "var(--likec4-palette-loContrast)",
|
|
34
|
-
"[data-compound-title-inverse] &": {
|
|
35
|
-
color: {
|
|
36
|
-
base: "[color-mix(in srgb, var(--likec4-palette-loContrast) 60%, var(--likec4-palette-fill))]",
|
|
37
|
-
_light: "var(--likec4-palette-stroke)"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
const iconSize = "20px";
|
|
42
|
-
const cssIcon = css({
|
|
43
|
-
flex: `0 0 ${iconSize}`,
|
|
44
|
-
height: `${iconSize}`,
|
|
45
|
-
width: `${iconSize}`,
|
|
46
|
-
display: "flex",
|
|
47
|
-
alignItems: "center",
|
|
48
|
-
justifyContent: "center",
|
|
49
|
-
mixBlendMode: {
|
|
50
|
-
base: "hard-light",
|
|
51
|
-
_reduceGraphicsOnPan: "normal"
|
|
52
|
-
},
|
|
53
|
-
[`& svg, & img`]: {
|
|
54
|
-
width: "100%",
|
|
55
|
-
height: "auto",
|
|
56
|
-
maxHeight: "100%",
|
|
57
|
-
pointerEvents: "none",
|
|
58
|
-
filter: {
|
|
59
|
-
base: [
|
|
60
|
-
"drop-shadow(0 0 3px rgb(0 0 0 / 12%))",
|
|
61
|
-
"drop-shadow(0 1px 8px rgb(0 0 0 / 8%))",
|
|
62
|
-
"drop-shadow(1px 1px 16px rgb(0 0 0 / 3%))"
|
|
63
|
-
],
|
|
64
|
-
_reduceGraphicsOnPan: "none"
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
[`& img`]: {
|
|
68
|
-
objectFit: "contain"
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
5
|
function CompoundTitle({ id, data }) {
|
|
72
6
|
const elementIcon = IconRenderer({
|
|
73
7
|
element: {
|
|
@@ -75,21 +9,12 @@ function CompoundTitle({ id, data }) {
|
|
|
75
9
|
title: data.title,
|
|
76
10
|
icon: data.icon
|
|
77
11
|
},
|
|
78
|
-
className:
|
|
12
|
+
className: "likec4-compound-icon"
|
|
79
13
|
});
|
|
80
|
-
return /* @__PURE__ */ jsxs(
|
|
81
|
-
|
|
82
|
-
{
|
|
83
|
-
|
|
84
|
-
titleContainer,
|
|
85
|
-
"likec4-compound-title"
|
|
86
|
-
),
|
|
87
|
-
children: [
|
|
88
|
-
elementIcon,
|
|
89
|
-
/* @__PURE__ */ jsx(Text, { className: titleText, truncate: "end", children: data.title })
|
|
90
|
-
]
|
|
91
|
-
}
|
|
92
|
-
);
|
|
14
|
+
return /* @__PURE__ */ jsxs("div", { className: "likec4-compound-title-container", children: [
|
|
15
|
+
elementIcon,
|
|
16
|
+
/* @__PURE__ */ jsx(Text, { component: "h3", className: "likec4-compound-title", truncate: "end", children: data.title })
|
|
17
|
+
] });
|
|
93
18
|
}
|
|
94
19
|
|
|
95
20
|
export { CompoundTitle };
|