@likec4/diagram 1.29.1 → 1.31.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/README.md +324 -5
- package/bundle/chunk-BBzMXzCg.js +21383 -0
- package/bundle/custom.js +62 -0
- package/bundle/index.js +17459 -38163
- package/dist/LikeC4CustomColors.js +2 -2
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +4 -2
- package/dist/LikeC4Diagram.props.d.ts +6 -1
- package/dist/LikeC4ModelProvider.d.ts +3 -3
- package/dist/LikeC4ModelProvider.js +0 -1
- package/dist/StaticLikeC4Diagram.d.ts +1 -1
- package/dist/base/BaseXYFlow.js +3 -3
- package/dist/base/primitives/compound/CompoundActionButton.d.ts +3 -2
- package/dist/base/primitives/compound/CompoundDetailsButton.d.ts +3 -2
- package/dist/base/primitives/compound/CompoundNodeContainer.d.ts +7 -3
- package/dist/base/primitives/compound/CompoundNodeContainer.js +3 -2
- package/dist/base/primitives/customEdge.d.ts +2 -35
- package/dist/base/primitives/customEdge.js +2 -2
- package/dist/base/primitives/customNode.d.ts +2 -2
- package/dist/base/primitives/customNode.js +9 -2
- package/dist/base/primitives/edge/EdgeContainer.js +0 -1
- package/dist/base/primitives/edge/EdgeLabel.js +0 -1
- package/dist/base/primitives/edge/EdgeLabelContainer.js +0 -2
- package/dist/base/primitives/edge/EdgePath.js +2 -2
- package/dist/base/primitives/element/ElementNodeContainer.d.ts +24 -22
- package/dist/base/primitives/element/ElementNodeContainer.js +66 -68
- package/dist/base/primitives/element/ElementShape.d.ts +8 -4
- package/dist/base/primitives/element/ElementShape.js +4 -3
- package/dist/base/primitives/element/ElementTitle.css.d.ts +1 -1
- package/dist/base/primitives/element/ElementTitle.js +0 -1
- package/dist/base/types.d.ts +5 -5
- package/dist/bundle/LikeC4View.js +6 -3
- package/dist/bundle/LikeC4View.props.d.ts +5 -1
- package/dist/bundle/ReactLikeC4.js +1 -2
- package/dist/bundle/ShadowRoot.js +3 -3
- package/dist/bundle/custom.d.ts +1 -0
- package/dist/bundle/index.d.ts +3 -1
- package/dist/bundle/index.js +9 -0
- package/dist/bundle/styles.css.js +5 -5
- package/dist/components/SearchControl.js +2 -2
- package/dist/context/ControlsCustomLayout.js +0 -1
- package/dist/context/DiagramEventHandlers.js +5 -5
- package/dist/context/DiagramFeatures.d.ts +2 -4
- package/dist/context/DiagramFeatures.js +15 -16
- package/dist/context/EnsureMantine.js +9 -4
- package/dist/context/FramerMotionConfig.js +0 -1
- package/dist/context/IconRenderer.js +7 -7
- package/dist/context/ReduceGraphics.js +6 -6
- package/dist/context/RootContainer.js +5 -5
- package/dist/context/index.d.ts +1 -1
- package/dist/custom/components.d.ts +5 -0
- package/dist/custom/customNodes.d.ts +218 -0
- package/dist/custom/hooks.d.ts +10 -0
- package/dist/custom/index.d.ts +4 -0
- package/dist/hooks/safeContext.js +3 -3
- package/dist/hooks/useCurrentViewId.d.ts +5 -1
- package/dist/hooks/useCurrentViewId.js +1 -2
- package/dist/hooks/useDiagram.d.ts +14 -12544
- package/dist/hooks/useDiagram.js +3 -5
- package/dist/hooks/useMantinePortalProps.js +2 -2
- package/dist/hooks/useSetState.js +3 -3
- package/dist/hooks/useUpdateEffect.js +0 -1
- package/dist/hooks/useXYFlow.d.ts +64 -64
- package/dist/hooks/useXYFlow.js +2 -2
- package/dist/index.d.ts +2 -4
- package/dist/index.js +8 -3
- package/dist/likec4diagram/DiagramUI.js +2 -2
- package/dist/likec4diagram/DiagramXYFlow.d.ts +1 -1
- package/dist/likec4diagram/DiagramXYFlow.js +25 -7
- package/dist/likec4diagram/custom/edges/NotePopover.js +2 -2
- package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +9 -13
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +8 -8
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +14 -12
- package/dist/likec4diagram/custom/index.d.ts +15 -19
- package/dist/likec4diagram/custom/index.js +3 -3
- package/dist/likec4diagram/custom/nodes/CompoundActions.js +2 -2
- package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +27 -4
- package/dist/likec4diagram/custom/nodes/ElementActions.js +67 -53
- package/dist/likec4diagram/custom/nodes/index.d.ts +8 -0
- package/dist/likec4diagram/custom/nodes/nodes.d.ts +10 -0
- package/dist/likec4diagram/custom/nodes/{nodeTypes.js → nodes.js} +39 -39
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +6 -7
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +3 -3
- package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.d.ts +3 -2
- package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
- package/dist/likec4diagram/types.d.ts +15 -7
- package/dist/likec4diagram/ui/controls/ChangeAutoLayoutButton.js +4 -4
- package/dist/likec4diagram/ui/controls/Controls.js +2 -2
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +2 -2
- package/dist/likec4diagram/ui/notation/NotationPanel.js +6 -8
- package/dist/likec4diagram/ui/search/ElementsColumn.js +6 -7
- package/dist/likec4diagram/ui/search/LikeC4Search.js +3 -3
- package/dist/likec4diagram/ui/search/SearchInput.js +0 -1
- package/dist/likec4diagram/ui/search/_shared.css.d.ts +1 -1
- package/dist/likec4diagram/ui/search/state.js +3 -4
- package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +4 -4
- package/dist/likec4diagram/useLayoutConstraints.js +3 -4
- package/dist/likec4diagram/useViewToNodesEdges.js +2 -0
- package/dist/likec4model/LikeC4ModelContext.d.ts +2 -2
- package/dist/likec4model/LikeC4ModelContext.js +2 -2
- package/dist/likec4model/useLikeC4ElementsTree.d.ts +1 -1
- package/dist/likec4model/useLikeC4ElementsTree.js +3 -3
- package/dist/likec4model/useLikeC4Model.d.ts +1 -1
- package/dist/likec4model/useLikeC4Model.js +2 -2
- package/dist/overlays/Overlays.d.ts +2 -3
- package/dist/overlays/Overlays.js +5 -6
- package/dist/overlays/element-details/ElementDetailsCard.css.js +13 -9
- package/dist/overlays/element-details/ElementDetailsCard.js +98 -105
- package/dist/overlays/element-details/TabPanelDeployments.js +4 -4
- package/dist/overlays/element-details/TabPanelRelationships.js +2 -2
- package/dist/overlays/element-details/TabPanelStructure.js +3 -3
- package/dist/overlays/element-details/actor.d.ts +6905 -19690
- package/dist/overlays/element-details/actor.js +0 -2
- package/dist/overlays/element-details/actorContext.js +3 -3
- package/dist/overlays/overlay/Overlay.d.ts +11 -1
- package/dist/overlays/overlay/Overlay.js +8 -8
- package/dist/overlays/overlaysActor.d.ts +4 -2
- package/dist/overlays/overlaysActor.js +2 -1
- package/dist/overlays/relationship-details/RelationshipDetails.d.ts +4 -8
- package/dist/overlays/relationship-details/RelationshipDetails.js +12 -12
- package/dist/overlays/relationship-details/SelectEdge.js +2 -3
- package/dist/overlays/relationship-details/_types.d.ts +6 -5
- package/dist/overlays/relationship-details/actor.d.ts +3 -3
- package/dist/overlays/relationship-details/compute.js +3 -3
- package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +4 -8
- package/dist/overlays/relationship-details/custom/edgeTypes.js +2 -2
- package/dist/overlays/relationship-details/custom/nodeTypes.d.ts +3 -31
- package/dist/overlays/relationship-details/hooks.d.ts +27 -27
- package/dist/overlays/relationship-details/hooks.js +4 -4
- package/dist/overlays/relationship-details/layout.js +2 -3
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +4 -8
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +8 -8
- package/dist/overlays/relationships-browser/SelectElement.js +5 -5
- package/dist/overlays/relationships-browser/_types.d.ts +6 -5
- package/dist/overlays/relationships-browser/actor.d.ts +63 -428
- package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +4 -8
- package/dist/overlays/relationships-browser/custom/edgeTypes.js +2 -2
- package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +10 -14
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +1 -2
- package/dist/overlays/relationships-browser/hooks.d.ts +4 -61
- package/dist/overlays/relationships-browser/hooks.js +4 -4
- package/dist/overlays/relationships-browser/layout.js +3 -4
- package/dist/state/DiagramActorProvider.js +3 -3
- package/dist/state/diagram-machine.d.ts +186 -10369
- package/dist/state/diagram-machine.js +2 -1
- package/dist/state/hotkeyActor.d.ts +4 -2
- package/dist/state/syncManualLayoutActor.d.ts +14 -3
- package/dist/state/syncManualLayoutActor.js +2 -1
- package/dist/state/types.d.ts +5 -4
- package/dist/state/utils.d.ts +1 -1
- package/dist/styles-font.css +1 -0
- package/dist/styles-min.css +1 -0
- package/dist/styles-xyflow.css +1 -0
- package/dist/styles.css +1 -0
- package/dist/styles.css2.js +3 -0
- package/package.json +46 -21
- package/panda.buildinfo.json +979 -0
- package/src/LikeC4Diagram.props.ts +7 -1
- package/src/LikeC4Diagram.tsx +2 -0
- package/src/LikeC4ModelProvider.tsx +3 -3
- package/src/StaticLikeC4Diagram.tsx +1 -0
- package/src/base/Background.tsx +0 -4
- package/src/base/primitives/compound/CompoundActionButton.tsx +7 -4
- package/src/base/primitives/compound/CompoundDetailsButton.tsx +7 -4
- package/src/base/primitives/compound/CompoundNodeContainer.tsx +8 -7
- package/src/base/primitives/customEdge.ts +1 -1
- package/src/base/primitives/{customNode.ts → customNode.tsx} +11 -3
- package/src/base/primitives/element/ElementNodeContainer.tsx +87 -80
- package/src/base/primitives/element/ElementShape.tsx +11 -10
- package/src/base/types.ts +28 -33
- package/src/bundle/LikeC4View.props.ts +6 -1
- package/src/bundle/LikeC4View.tsx +3 -0
- package/src/bundle/ReactLikeC4.tsx +1 -1
- package/src/bundle/custom.ts +1 -0
- package/src/bundle/index.ts +20 -1
- package/src/bundle/styles.css.ts +1 -1
- package/src/components/SearchControl.tsx +1 -1
- package/src/context/DiagramFeatures.tsx +12 -8
- package/src/context/EnsureMantine.tsx +13 -3
- package/src/context/IconRenderer.tsx +4 -2
- package/src/context/ReduceGraphics.tsx +6 -6
- package/src/context/index.ts +0 -1
- package/src/custom/components.ts +47 -0
- package/src/custom/customNodes.tsx +244 -0
- package/src/custom/hooks.ts +35 -0
- package/src/custom/index.ts +5 -0
- package/src/hooks/useCurrentViewId.ts +9 -1
- package/src/hooks/useDiagram.ts +30 -9
- package/src/index.ts +4 -8
- package/src/likec4diagram/DiagramXYFlow.tsx +28 -5
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +1 -1
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +9 -7
- package/src/likec4diagram/custom/{index.tsx → index.ts} +2 -2
- package/src/likec4diagram/custom/nodes/CompoundActions.tsx +2 -2
- package/src/likec4diagram/custom/nodes/ElementActions.tsx +100 -57
- package/src/likec4diagram/custom/nodes/index.ts +17 -0
- package/src/likec4diagram/custom/nodes/{nodeTypes.tsx → nodes.tsx} +52 -36
- package/src/likec4diagram/custom/nodes/toolbar/CompoundToolbar.tsx +3 -4
- package/src/likec4diagram/custom/nodes/toolbar/ElementToolbar.tsx +3 -3
- package/src/likec4diagram/custom/nodes/toolbar/Toolbar.tsx +5 -4
- package/src/likec4diagram/types.ts +19 -9
- package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +1 -1
- package/src/likec4diagram/ui/notation/NotationPanel.tsx +1 -2
- package/src/likec4diagram/ui/search/ElementsColumn.tsx +2 -4
- package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.tsx +1 -1
- package/src/likec4diagram/useViewToNodesEdges.ts +2 -0
- package/src/likec4model/LikeC4ModelContext.ts +2 -2
- package/src/likec4model/useLikeC4ElementsTree.ts +3 -1
- package/src/likec4model/useLikeC4Model.ts +1 -1
- package/src/overlays/Overlays.tsx +2 -3
- package/src/overlays/element-details/ElementDetailsCard.css.ts +14 -22
- package/src/overlays/element-details/ElementDetailsCard.tsx +18 -16
- package/src/overlays/overlay/Overlay.tsx +3 -4
- package/src/overlays/overlaysActor.ts +4 -3
- package/src/overlays/relationship-details/RelationshipDetails.tsx +1 -1
- package/src/overlays/relationship-details/SelectEdge.tsx +0 -2
- package/src/overlays/relationship-details/_types.ts +16 -13
- package/src/overlays/relationship-details/custom/edgeTypes.tsx +2 -2
- package/src/overlays/relationships-browser/_types.ts +18 -15
- package/src/overlays/relationships-browser/actor.ts +2 -2
- package/src/overlays/relationships-browser/custom/edgeTypes.tsx +2 -2
- package/src/overlays/relationships-browser/custom/nodeTypes.tsx +1 -2
- package/src/state/DiagramActorProvider.tsx +2 -2
- package/src/state/diagram-machine.ts +13 -8
- package/src/state/hotkeyActor.ts +4 -2
- package/src/state/syncManualLayoutActor.ts +9 -3
- package/src/state/types.ts +9 -3
- package/src/state/utils.ts +3 -3
- package/src/styles-min.css +2 -0
- package/src/styles-xyflow.css +1 -0
- package/dist/_virtual/_commonjsHelpers.js +0 -5
- package/dist/_virtual/default-map.js +0 -7
- package/dist/_virtual/index.js +0 -5
- package/dist/_virtual/index2.js +0 -3
- package/dist/_virtual/react.production.js +0 -3
- package/dist/_virtual/set.js +0 -5
- package/dist/_virtual/set2.js +0 -3
- package/dist/base/xyflowMachine.d.ts +0 -212
- package/dist/likec4diagram/custom/nodes/nodeTypes.d.ts +0 -8
- package/dist/node_modules/.pnpm/mnemonist@0.40.3_patch_hash_5c12abb43fcff6fd81e53021b89075d53249640d165a2556cc1e58d71201a13a/node_modules/mnemonist/default-map.js +0 -172
- package/dist/node_modules/.pnpm/mnemonist@0.40.3_patch_hash_5c12abb43fcff6fd81e53021b89075d53249640d165a2556cc1e58d71201a13a/node_modules/mnemonist/set.js +0 -369
- package/dist/node_modules/.pnpm/react@19.1.0/node_modules/react/cjs/react.production.js +0 -556
- package/dist/node_modules/.pnpm/react@19.1.0/node_modules/react/index.js +0 -15
- package/dist/packages/core/src/compute-view/relationships-view/compute.js +0 -123
- package/dist/packages/core/src/compute-view/relationships-view/utils.js +0 -68
- package/dist/packages/core/src/errors/index.js +0 -15
- package/dist/packages/core/src/model/connection/model/ConnectionModel.js +0 -121
- package/dist/packages/core/src/model/connection/model/find.js +0 -39
- package/dist/packages/core/src/model/connection/ops.js +0 -7
- package/dist/packages/core/src/utils/const.js +0 -3
- package/dist/packages/core/src/utils/fqn.js +0 -51
- package/dist/packages/core/src/utils/guards.js +0 -7
- package/dist/packages/core/src/utils/iterable/filter.js +0 -21
- package/dist/packages/core/src/utils/iterable/find.js +0 -21
- package/dist/packages/core/src/utils/iterable/map.js +0 -18
- package/dist/packages/core/src/utils/iterable/some.js +0 -21
- package/dist/packages/core/src/utils/iterable/to.js +0 -14
- package/dist/packages/core/src/utils/set.js +0 -48
- package/dist/packages/core/src/utils/string-hash.js +0 -13
- package/dist/styles.css.js +0 -3
- package/src/base/xyflowMachine.ts +0 -75
- /package/dist/{bundle/font.css.js → styles-font.css2.js} +0 -0
- /package/src/{bundle/font.css → styles-font.css} +0 -0
|
@@ -3,7 +3,7 @@ import { DiagramNode, nameFromFqn } from '@likec4/core';
|
|
|
3
3
|
import { cx, css } from '@likec4/styles/css';
|
|
4
4
|
import { Menu, MenuTarget, MenuDropdown, MenuLabel, MenuDivider, Box, ActionIcon, MenuItem, Stack, Group, Text, TooltipGroup, Space, Tooltip as Tooltip$1 } from '@mantine/core';
|
|
5
5
|
import { IconInfoCircle, IconArrowRight, IconZoomScan, IconFileSymlink } from '@tabler/icons-react';
|
|
6
|
-
import {
|
|
6
|
+
import { memo, useCallback, Fragment as Fragment$1, forwardRef } from 'react';
|
|
7
7
|
import { pipe, map, filter, isTruthy, partition } from 'remeda';
|
|
8
8
|
import { Link } from '../../../components/Link.js';
|
|
9
9
|
import { useDiagramContext, useDiagram } from '../../../hooks/useDiagram.js';
|
|
@@ -11,7 +11,7 @@ import { findDiagramNode, findDiagramEdge } from '../../../state/utils.js';
|
|
|
11
11
|
import { menuDropdown, endpoint, title, menuItemRelationship } from './RelationshipsDropdownMenu.css.js';
|
|
12
12
|
import { useLikeC4Model } from '../../../likec4model/useLikeC4Model.js';
|
|
13
13
|
import { useMantinePortalProps } from '../../../hooks/useMantinePortalProps.js';
|
|
14
|
-
import {
|
|
14
|
+
import { useEnabledFeatures, IfEnabled } from '../../../context/DiagramFeatures.js';
|
|
15
15
|
import { useDiagramEventHandlers } from '../../../context/DiagramEventHandlers.js';
|
|
16
16
|
|
|
17
17
|
const stopPropagation = (e) => e.stopPropagation();
|
|
@@ -25,22 +25,24 @@ const Tooltip = Tooltip$1.withProps({
|
|
|
25
25
|
offset: 8,
|
|
26
26
|
withinPortal: false
|
|
27
27
|
});
|
|
28
|
-
const RelationshipsDropdownMenu =
|
|
28
|
+
const RelationshipsDropdownMenu = memo(({
|
|
29
29
|
edgeId,
|
|
30
30
|
source,
|
|
31
31
|
target,
|
|
32
32
|
disabled = false,
|
|
33
33
|
children
|
|
34
34
|
}) => {
|
|
35
|
-
const { diagramEdge, sourceNode, targetNode } = useDiagramContext(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
const { diagramEdge, sourceNode, targetNode } = useDiagramContext(
|
|
36
|
+
useCallback((ctx) => ({
|
|
37
|
+
diagramEdge: findDiagramEdge(ctx, edgeId),
|
|
38
|
+
sourceNode: findDiagramNode(ctx, source),
|
|
39
|
+
targetNode: findDiagramNode(ctx, target)
|
|
40
|
+
}), [edgeId, source, target])
|
|
41
|
+
);
|
|
40
42
|
const likec4model = useLikeC4Model(true);
|
|
41
43
|
const diagram = useDiagram();
|
|
42
44
|
const portalProps = useMantinePortalProps();
|
|
43
|
-
const onClickOpenOverlay =
|
|
45
|
+
const onClickOpenOverlay = useCallback((e) => {
|
|
44
46
|
e.stopPropagation();
|
|
45
47
|
diagram.openRelationshipDetails(edgeId);
|
|
46
48
|
}, [edgeId]);
|
|
@@ -63,7 +65,7 @@ const RelationshipsDropdownMenu = reactExports.memo(({
|
|
|
63
65
|
filter(isTruthy),
|
|
64
66
|
partition((r) => r.source.id === sourceNode.id && r.target.id === targetNode.id)
|
|
65
67
|
);
|
|
66
|
-
const renderRelationship = (relationship, index) => /* @__PURE__ */ jsxs(
|
|
68
|
+
const renderRelationship = (relationship, index) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
67
69
|
index > 0 && /* @__PURE__ */ jsx(MenuDivider, { opacity: 0.65 }),
|
|
68
70
|
/* @__PURE__ */ jsx(
|
|
69
71
|
MenuItem,
|
|
@@ -130,7 +132,7 @@ const RelationshipsDropdownMenu = reactExports.memo(({
|
|
|
130
132
|
}
|
|
131
133
|
);
|
|
132
134
|
});
|
|
133
|
-
const Relationship =
|
|
135
|
+
const Relationship = forwardRef(({
|
|
134
136
|
className,
|
|
135
137
|
relationship: r,
|
|
136
138
|
edge,
|
|
@@ -139,7 +141,7 @@ const Relationship = reactExports.forwardRef(({
|
|
|
139
141
|
...props
|
|
140
142
|
}, ref) => {
|
|
141
143
|
const diagram = useDiagram();
|
|
142
|
-
const { enableNavigateTo } =
|
|
144
|
+
const { enableNavigateTo } = useEnabledFeatures();
|
|
143
145
|
const { onOpenSource } = useDiagramEventHandlers();
|
|
144
146
|
const viewId = diagram.currentView.id;
|
|
145
147
|
const sourceId = getShortId(r, r.source.id, sourceNode);
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { Types } from '../types';
|
|
2
|
-
import {
|
|
2
|
+
import { MemoExoticComponent, FunctionComponent, CSSProperties, ReactNode } from 'react';
|
|
3
3
|
import { NodeProps } from '../../base';
|
|
4
4
|
import { Position, XYPosition } from '@xyflow/system';
|
|
5
|
-
import { EdgeId, NonEmptyArray, Point, Color,
|
|
6
|
-
export declare const
|
|
7
|
-
element:
|
|
8
|
-
deployment:
|
|
9
|
-
'compound-element':
|
|
10
|
-
'compound-deployment':
|
|
11
|
-
'view-group':
|
|
5
|
+
import { EdgeId, NonEmptyArray, Point, Color, RelationshipLineType, RelationshipArrowType, BBox, ViewId } from '@likec4/core';
|
|
6
|
+
export declare const BuiltinNodes: {
|
|
7
|
+
element: MemoExoticComponent<(props: NodeProps<Types.ElementNodeData, "element">) => import("react/jsx-runtime").JSX.Element>;
|
|
8
|
+
deployment: MemoExoticComponent<(props: NodeProps<Types.DeploymentElementNodeData, "deployment">) => import("react/jsx-runtime").JSX.Element>;
|
|
9
|
+
'compound-element': MemoExoticComponent<(props: NodeProps<Types.CompoundElementNodeData, "compound-element">) => import("react/jsx-runtime").JSX.Element>;
|
|
10
|
+
'compound-deployment': MemoExoticComponent<(props: NodeProps<Types.CompoundDeploymentNodeData, "compound-deployment">) => import("react/jsx-runtime").JSX.Element>;
|
|
11
|
+
'view-group': MemoExoticComponent<(props: NodeProps<Types.ViewGroupNodeData, "view-group">) => import("react/jsx-runtime").JSX.Element>;
|
|
12
12
|
};
|
|
13
13
|
export declare const edgeTypes: {
|
|
14
|
-
relationship:
|
|
14
|
+
relationship: FunctionComponent<{
|
|
15
15
|
id: string;
|
|
16
16
|
selected?: boolean;
|
|
17
17
|
selectable?: boolean;
|
|
18
18
|
deletable?: boolean;
|
|
19
19
|
style?: CSSProperties;
|
|
20
|
+
animated?: boolean;
|
|
20
21
|
source: string;
|
|
21
22
|
target: string;
|
|
22
|
-
animated?: boolean;
|
|
23
23
|
sourceX: number;
|
|
24
24
|
sourceY: number;
|
|
25
25
|
targetX: number;
|
|
@@ -38,28 +38,24 @@ export declare const edgeTypes: {
|
|
|
38
38
|
markerEnd?: string;
|
|
39
39
|
pathOptions?: any;
|
|
40
40
|
interactionWidth?: number;
|
|
41
|
-
data: {
|
|
41
|
+
data: import("../../base").Base.EdgeData & {
|
|
42
42
|
hovered?: boolean;
|
|
43
43
|
active?: boolean;
|
|
44
44
|
dimmed?: import("../../base").Base.Dimmed;
|
|
45
|
-
} & {
|
|
46
45
|
id: EdgeId;
|
|
47
46
|
label: string | null;
|
|
48
47
|
points: NonEmptyArray<Point>;
|
|
49
|
-
technology: string | undefined;
|
|
50
48
|
color: Color | undefined;
|
|
51
|
-
labelBBox: BBox | null | undefined;
|
|
52
|
-
dir: "forward" | "back" | "both" | undefined;
|
|
53
49
|
line: RelationshipLineType | undefined;
|
|
54
|
-
|
|
50
|
+
dir: "forward" | "back" | "both" | undefined;
|
|
55
51
|
tail: RelationshipArrowType | undefined;
|
|
52
|
+
head: RelationshipArrowType | undefined;
|
|
53
|
+
technology: string | undefined;
|
|
54
|
+
labelBBox: BBox | null | undefined;
|
|
56
55
|
navigateTo: ViewId<string> | undefined;
|
|
57
56
|
notes: string | undefined;
|
|
58
57
|
labelXY: XYPosition | null;
|
|
59
58
|
controlPoints: XYPosition[] | undefined | null;
|
|
60
|
-
hovered?: boolean;
|
|
61
|
-
active?: boolean;
|
|
62
|
-
dimmed?: import("../../base").Base.Dimmed;
|
|
63
59
|
};
|
|
64
60
|
}>;
|
|
65
61
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RelationshipEdge } from './edges/RelationshipEdge.js';
|
|
2
|
-
import { ViewGroupNode, CompoundDeploymentNode, CompoundElementNode, DeploymentNode, ElementNode } from './nodes/
|
|
2
|
+
import { ViewGroupNode, CompoundDeploymentNode, CompoundElementNode, DeploymentNode, ElementNode } from './nodes/nodes.js';
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const BuiltinNodes = {
|
|
5
5
|
element: ElementNode,
|
|
6
6
|
deployment: DeploymentNode,
|
|
7
7
|
"compound-element": CompoundElementNode,
|
|
@@ -12,4 +12,4 @@ const edgeTypes = {
|
|
|
12
12
|
relationship: RelationshipEdge
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
export {
|
|
15
|
+
export { BuiltinNodes, edgeTypes };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useEnabledFeatures } from '../../../context/DiagramFeatures.js';
|
|
2
3
|
import { useDiagram } from '../../../hooks/useDiagram.js';
|
|
3
|
-
import { useEnabledFeature } from '../../../context/DiagramFeatures.js';
|
|
4
4
|
import { CompoundActionButton } from '../../../base/primitives/compound/CompoundActionButton.js';
|
|
5
5
|
|
|
6
6
|
const CompoundActions = (props) => {
|
|
7
|
-
const { enableNavigateTo } =
|
|
7
|
+
const { enableNavigateTo } = useEnabledFeatures();
|
|
8
8
|
const diagram = useDiagram();
|
|
9
9
|
const { navigateTo } = props.data;
|
|
10
10
|
if (navigateTo && enableNavigateTo) {
|
|
@@ -1,7 +1,30 @@
|
|
|
1
|
+
import { ElementActionButtons } from '../../../base/primitives';
|
|
1
2
|
import { NodeProps } from '../../../base/types';
|
|
2
3
|
import { Types } from '../../types';
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
type WithExtraButtons = {
|
|
5
|
+
/**
|
|
6
|
+
* Add extra action buttons
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <ElementActions
|
|
10
|
+
* extraButtons={[
|
|
11
|
+
* {
|
|
12
|
+
* key: 'extra',
|
|
13
|
+
* icon: <IconZoomScan />,
|
|
14
|
+
* onClick: (e) => {
|
|
15
|
+
* e.stopPropagation()
|
|
16
|
+
* console.log('extra action clicked')
|
|
17
|
+
* },
|
|
18
|
+
* },
|
|
19
|
+
* },
|
|
20
|
+
* ]}
|
|
21
|
+
* />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
extraButtons?: ElementActionButtons.Item[];
|
|
25
|
+
};
|
|
26
|
+
export type ElementActionsProps = NodeProps<Types.ElementNodeData> & WithExtraButtons;
|
|
27
|
+
export declare const ElementActions: ({ extraButtons, ...props }: ElementActionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export type DeploymentElementActionsProps = NodeProps<Types.DeploymentElementNodeData> & WithExtraButtons;
|
|
29
|
+
export declare const DeploymentElementActions: ({ extraButtons, ...props }: DeploymentElementActionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
30
|
export {};
|
|
@@ -1,68 +1,82 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { hasAtLeast } from '@likec4/core';
|
|
2
3
|
import { IconZoomScan, IconTransform } from '@tabler/icons-react';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { useEnabledFeatures } from '../../../context/DiagramFeatures.js';
|
|
3
6
|
import { useDiagram } from '../../../hooks/useDiagram.js';
|
|
4
|
-
import { useEnabledFeature } from '../../../context/DiagramFeatures.js';
|
|
5
7
|
import { ElementActionButtons } from '../../../base/primitives/element/ElementActionButtons.js';
|
|
6
8
|
|
|
7
|
-
const ElementActions = (
|
|
8
|
-
|
|
9
|
+
const ElementActions = ({
|
|
10
|
+
extraButtons,
|
|
11
|
+
...props
|
|
12
|
+
}) => {
|
|
13
|
+
const { enableNavigateTo, enableRelationshipBrowser } = useEnabledFeatures();
|
|
9
14
|
const diagram = useDiagram();
|
|
10
|
-
const buttons = [];
|
|
11
15
|
const { navigateTo, modelFqn } = props.data;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
buttons.push({
|
|
24
|
-
key: "relationships",
|
|
25
|
-
icon: /* @__PURE__ */ jsx(IconTransform, {}),
|
|
26
|
-
onClick: (e) => {
|
|
27
|
-
e.stopPropagation();
|
|
28
|
-
diagram.openRelationshipsBrowser(modelFqn);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
return /* @__PURE__ */ jsx(
|
|
33
|
-
ElementActionButtons,
|
|
34
|
-
{
|
|
35
|
-
buttons,
|
|
36
|
-
...props
|
|
16
|
+
let buttons = useMemo(() => {
|
|
17
|
+
const buttons2 = [];
|
|
18
|
+
if (navigateTo && enableNavigateTo) {
|
|
19
|
+
buttons2.push({
|
|
20
|
+
key: "navigate",
|
|
21
|
+
icon: /* @__PURE__ */ jsx(IconZoomScan, {}),
|
|
22
|
+
onClick: (e) => {
|
|
23
|
+
e.stopPropagation();
|
|
24
|
+
diagram.navigateTo(navigateTo, props.id);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
37
27
|
}
|
|
38
|
-
|
|
28
|
+
if (enableRelationshipBrowser) {
|
|
29
|
+
buttons2.push({
|
|
30
|
+
key: "relationships",
|
|
31
|
+
icon: /* @__PURE__ */ jsx(IconTransform, {}),
|
|
32
|
+
onClick: (e) => {
|
|
33
|
+
e.stopPropagation();
|
|
34
|
+
diagram.openRelationshipsBrowser(modelFqn);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return buttons2;
|
|
39
|
+
}, [enableNavigateTo, enableRelationshipBrowser, diagram, modelFqn, navigateTo, props.id]);
|
|
40
|
+
if (extraButtons && hasAtLeast(extraButtons, 1)) {
|
|
41
|
+
buttons = [...buttons, ...extraButtons];
|
|
42
|
+
}
|
|
43
|
+
return /* @__PURE__ */ jsx(ElementActionButtons, { ...props, buttons });
|
|
39
44
|
};
|
|
40
|
-
const DeploymentElementActions = (
|
|
41
|
-
|
|
45
|
+
const DeploymentElementActions = ({
|
|
46
|
+
extraButtons,
|
|
47
|
+
...props
|
|
48
|
+
}) => {
|
|
49
|
+
const { enableNavigateTo, enableRelationshipBrowser } = useEnabledFeatures();
|
|
42
50
|
const diagram = useDiagram();
|
|
43
|
-
const buttons = [];
|
|
44
51
|
const { navigateTo, modelFqn } = props.data;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
let buttons = useMemo(() => {
|
|
53
|
+
const buttons2 = [];
|
|
54
|
+
if (navigateTo && enableNavigateTo) {
|
|
55
|
+
buttons2.push({
|
|
56
|
+
key: "navigate",
|
|
57
|
+
icon: /* @__PURE__ */ jsx(IconZoomScan, {}),
|
|
58
|
+
onClick: (e) => {
|
|
59
|
+
e.stopPropagation();
|
|
60
|
+
diagram.navigateTo(navigateTo, props.id);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (enableRelationshipBrowser && !!modelFqn) {
|
|
65
|
+
buttons2.push({
|
|
66
|
+
key: "relationships",
|
|
67
|
+
icon: /* @__PURE__ */ jsx(IconTransform, {}),
|
|
68
|
+
onClick: (e) => {
|
|
69
|
+
e.stopPropagation();
|
|
70
|
+
diagram.openRelationshipsBrowser(modelFqn);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return buttons2;
|
|
75
|
+
}, [enableNavigateTo, enableRelationshipBrowser, diagram, modelFqn, navigateTo, props.id]);
|
|
76
|
+
if (extraButtons && hasAtLeast(extraButtons, 1)) {
|
|
77
|
+
buttons = [...buttons, ...extraButtons];
|
|
64
78
|
}
|
|
65
|
-
return /* @__PURE__ */ jsx(ElementActionButtons, {
|
|
79
|
+
return /* @__PURE__ */ jsx(ElementActionButtons, { ...props, buttons });
|
|
66
80
|
};
|
|
67
81
|
|
|
68
82
|
export { DeploymentElementActions, ElementActions };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { CompoundActions } from './CompoundActions';
|
|
2
|
+
export { DeploymentElementActions, ElementActions } from './ElementActions';
|
|
3
|
+
export { CompoundDeploymentNode, CompoundDetailsButtonWithHandler, CompoundElementNode, DeploymentNode, ElementDetailsButtonWithHandler, ElementNode, ViewGroupNode, } from './nodes';
|
|
4
|
+
export * from './CompoundActions';
|
|
5
|
+
export * from './ElementActions';
|
|
6
|
+
export * from './toolbar/CompoundToolbar';
|
|
7
|
+
export * from './toolbar/ElementToolbar';
|
|
8
|
+
export * from './toolbar/Toolbar';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NodeProps } from '../../../base';
|
|
2
|
+
import { Types } from '../../types';
|
|
3
|
+
import { MemoExoticComponent } from 'react';
|
|
4
|
+
export declare function ElementDetailsButtonWithHandler(props: NodeProps<Types.ElementNodeData | Types.DeploymentElementNodeData>): import("react/jsx-runtime").JSX.Element | null;
|
|
5
|
+
export declare function CompoundDetailsButtonWithHandler(props: NodeProps<Types.CompoundElementNodeData | Types.CompoundDeploymentNodeData>): import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
export declare const ElementNode: MemoExoticComponent<(props: NodeProps<Types.ElementNodeData, "element">) => import("react/jsx-runtime").JSX.Element>;
|
|
7
|
+
export declare const DeploymentNode: MemoExoticComponent<(props: NodeProps<Types.DeploymentElementNodeData, "deployment">) => import("react/jsx-runtime").JSX.Element>;
|
|
8
|
+
export declare const CompoundElementNode: MemoExoticComponent<(props: NodeProps<Types.CompoundElementNodeData, "compound-element">) => import("react/jsx-runtime").JSX.Element>;
|
|
9
|
+
export declare const CompoundDeploymentNode: MemoExoticComponent<(props: NodeProps<Types.CompoundDeploymentNodeData, "compound-deployment">) => import("react/jsx-runtime").JSX.Element>;
|
|
10
|
+
export declare const ViewGroupNode: MemoExoticComponent<(props: NodeProps<Types.ViewGroupNodeData, "view-group">) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import '
|
|
2
|
+
import { IfNotReadOnly, IfEnabled, useEnabledFeatures } from '../../../context/DiagramFeatures.js';
|
|
3
3
|
import { useDiagram } from '../../../hooks/useDiagram.js';
|
|
4
4
|
import { CompoundActions } from './CompoundActions.js';
|
|
5
5
|
import { DeploymentElementActions, ElementActions } from './ElementActions.js';
|
|
@@ -8,18 +8,18 @@ import { DeploymentElementToolbar, ElementToolbar } from './toolbar/ElementToolb
|
|
|
8
8
|
import { customNode } from '../../../base/primitives/customNode.js';
|
|
9
9
|
import { CompoundNodeContainer } from '../../../base/primitives/compound/CompoundNodeContainer.js';
|
|
10
10
|
import { CompoundTitle } from '../../../base/primitives/compound/CompoundTitle.js';
|
|
11
|
-
import { IfNotEnabled, IfEnabled, useEnabledFeature } from '../../../context/DiagramFeatures.js';
|
|
12
11
|
import { DefaultHandles } from '../../../base/primitives/NodeHandles.js';
|
|
13
|
-
import { CompoundDetailsButton } from '../../../base/primitives/compound/CompoundDetailsButton.js';
|
|
14
12
|
import { ElementNodeContainer } from '../../../base/primitives/element/ElementNodeContainer.js';
|
|
15
13
|
import { ElementShape } from '../../../base/primitives/element/ElementShape.js';
|
|
16
14
|
import { ElementTitle } from '../../../base/primitives/element/ElementTitle.js';
|
|
15
|
+
import { CompoundDetailsButton } from '../../../base/primitives/compound/CompoundDetailsButton.js';
|
|
17
16
|
import { ElementDetailsButton } from '../../../base/primitives/element/ElementDetailsButton.js';
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
const { enableElementDetails } =
|
|
18
|
+
function ElementDetailsButtonWithHandler(props) {
|
|
19
|
+
const { enableElementDetails } = useEnabledFeatures();
|
|
21
20
|
const diagram = useDiagram();
|
|
22
|
-
|
|
21
|
+
const fqn = props.data.modelFqn;
|
|
22
|
+
if (!enableElementDetails || !fqn) return null;
|
|
23
23
|
return /* @__PURE__ */ jsx(
|
|
24
24
|
ElementDetailsButton,
|
|
25
25
|
{
|
|
@@ -30,63 +30,63 @@ const ElementDetailsButtonWithHandler = ({ fqn, ...props }) => {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
|
-
}
|
|
33
|
+
}
|
|
34
|
+
function CompoundDetailsButtonWithHandler(props) {
|
|
35
|
+
const { enableElementDetails } = useEnabledFeatures();
|
|
36
|
+
const diagram = useDiagram();
|
|
37
|
+
const fqn = props.data.modelFqn;
|
|
38
|
+
if (!enableElementDetails || !fqn) return null;
|
|
39
|
+
return /* @__PURE__ */ jsx(
|
|
40
|
+
CompoundDetailsButton,
|
|
41
|
+
{
|
|
42
|
+
...props,
|
|
43
|
+
onClick: (e) => {
|
|
44
|
+
e.stopPropagation();
|
|
45
|
+
diagram.openElementDetails(fqn, props.id);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
34
50
|
const ElementNode = customNode((props) => /* @__PURE__ */ jsxs(ElementNodeContainer, { nodeProps: props, children: [
|
|
35
|
-
/* @__PURE__ */ jsx(ElementShape, { ...props
|
|
51
|
+
/* @__PURE__ */ jsx(ElementShape, { ...props }),
|
|
36
52
|
/* @__PURE__ */ jsx(ElementTitle, { ...props }),
|
|
37
53
|
/* @__PURE__ */ jsx(ElementActions, { ...props }),
|
|
38
|
-
/* @__PURE__ */ jsx(
|
|
39
|
-
|
|
40
|
-
{
|
|
41
|
-
fqn: props.data.modelFqn,
|
|
42
|
-
...props
|
|
43
|
-
}
|
|
44
|
-
),
|
|
45
|
-
/* @__PURE__ */ jsx(IfNotEnabled, { feature: "ReadOnly", children: /* @__PURE__ */ jsx(ElementToolbar, { ...props }) }),
|
|
54
|
+
/* @__PURE__ */ jsx(ElementDetailsButtonWithHandler, { ...props }),
|
|
55
|
+
/* @__PURE__ */ jsx(IfNotReadOnly, { children: /* @__PURE__ */ jsx(ElementToolbar, { ...props }) }),
|
|
46
56
|
/* @__PURE__ */ jsx(DefaultHandles, {})
|
|
47
57
|
] }));
|
|
58
|
+
ElementNode.displayName = "ElementNode";
|
|
48
59
|
const DeploymentNode = customNode((props) => /* @__PURE__ */ jsxs(ElementNodeContainer, { nodeProps: props, children: [
|
|
49
|
-
/* @__PURE__ */ jsx(ElementShape, { ...props
|
|
60
|
+
/* @__PURE__ */ jsx(ElementShape, { ...props }),
|
|
50
61
|
/* @__PURE__ */ jsx(ElementTitle, { ...props }),
|
|
51
62
|
/* @__PURE__ */ jsx(DeploymentElementActions, { ...props }),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
{
|
|
55
|
-
fqn: props.data.modelFqn,
|
|
56
|
-
...props
|
|
57
|
-
}
|
|
58
|
-
),
|
|
59
|
-
/* @__PURE__ */ jsx(IfNotEnabled, { feature: "ReadOnly", children: /* @__PURE__ */ jsx(DeploymentElementToolbar, { ...props }) }),
|
|
63
|
+
/* @__PURE__ */ jsx(ElementDetailsButtonWithHandler, { ...props }),
|
|
64
|
+
/* @__PURE__ */ jsx(IfNotReadOnly, { children: /* @__PURE__ */ jsx(DeploymentElementToolbar, { ...props }) }),
|
|
60
65
|
/* @__PURE__ */ jsx(DefaultHandles, {})
|
|
61
66
|
] }));
|
|
67
|
+
DeploymentNode.displayName = "DeploymentNode";
|
|
62
68
|
const CompoundElementNode = customNode((props) => {
|
|
63
|
-
|
|
69
|
+
useDiagram();
|
|
64
70
|
return /* @__PURE__ */ jsxs(CompoundNodeContainer, { nodeProps: props, children: [
|
|
65
71
|
/* @__PURE__ */ jsx(CompoundTitle, { ...props }),
|
|
66
72
|
/* @__PURE__ */ jsx(CompoundActions, { ...props }),
|
|
67
|
-
/* @__PURE__ */ jsx(IfEnabled, { feature: "ElementDetails", children: /* @__PURE__ */ jsx(
|
|
68
|
-
|
|
69
|
-
{
|
|
70
|
-
...props,
|
|
71
|
-
onClick: (e) => {
|
|
72
|
-
e.stopPropagation();
|
|
73
|
-
diagram.openElementDetails(props.data.modelFqn, props.id);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
) }),
|
|
77
|
-
/* @__PURE__ */ jsx(IfNotEnabled, { feature: "ReadOnly", children: /* @__PURE__ */ jsx(CompoundElementToolbar, { ...props }) }),
|
|
73
|
+
/* @__PURE__ */ jsx(IfEnabled, { feature: "ElementDetails", children: /* @__PURE__ */ jsx(CompoundDetailsButtonWithHandler, { ...props }) }),
|
|
74
|
+
/* @__PURE__ */ jsx(IfNotReadOnly, { children: /* @__PURE__ */ jsx(CompoundElementToolbar, { ...props }) }),
|
|
78
75
|
/* @__PURE__ */ jsx(DefaultHandles, {})
|
|
79
76
|
] });
|
|
80
77
|
});
|
|
78
|
+
CompoundElementNode.displayName = "CompoundElementNode";
|
|
81
79
|
const CompoundDeploymentNode = customNode((props) => /* @__PURE__ */ jsxs(CompoundNodeContainer, { nodeProps: props, children: [
|
|
82
80
|
/* @__PURE__ */ jsx(CompoundTitle, { ...props }),
|
|
83
81
|
/* @__PURE__ */ jsx(CompoundActions, { ...props }),
|
|
84
|
-
/* @__PURE__ */ jsx(
|
|
82
|
+
/* @__PURE__ */ jsx(IfNotReadOnly, { children: /* @__PURE__ */ jsx(CompoundDeploymentToolbar, { ...props }) }),
|
|
85
83
|
/* @__PURE__ */ jsx(DefaultHandles, {})
|
|
86
84
|
] }));
|
|
85
|
+
CompoundDeploymentNode.displayName = "CompoundDeploymentNode";
|
|
87
86
|
const ViewGroupNode = customNode((props) => /* @__PURE__ */ jsxs(CompoundNodeContainer, { nodeProps: props, children: [
|
|
88
87
|
/* @__PURE__ */ jsx(CompoundTitle, { ...props }),
|
|
89
88
|
/* @__PURE__ */ jsx(DefaultHandles, {})
|
|
90
89
|
] }));
|
|
90
|
+
ViewGroupNode.displayName = "ViewGroupNode";
|
|
91
91
|
|
|
92
|
-
export { CompoundDeploymentNode, CompoundElementNode, DeploymentNode, ElementNode, ViewGroupNode };
|
|
92
|
+
export { CompoundDeploymentNode, CompoundDetailsButtonWithHandler, CompoundElementNode, DeploymentNode, ElementDetailsButtonWithHandler, ElementNode, ViewGroupNode };
|
|
@@ -2,7 +2,7 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import { defaultTheme } from '@likec4/core';
|
|
3
3
|
import { Popover, PopoverTarget, Button, ColorSwatch, PopoverDropdown, Space, Divider, Stack, TooltipGroup, Flex, Tooltip, CheckIcon, rem, Slider } from '@mantine/core';
|
|
4
4
|
import { useUpdateEffect } from '@react-hookz/web';
|
|
5
|
-
import {
|
|
5
|
+
import { useState } from 'react';
|
|
6
6
|
import { themedColors, colors } from './_shared.js';
|
|
7
7
|
|
|
8
8
|
function ColorButton({
|
|
@@ -137,7 +137,7 @@ function OpacityOption({
|
|
|
137
137
|
elementOpacity = 100,
|
|
138
138
|
onOpacityChange
|
|
139
139
|
}) {
|
|
140
|
-
const [value, setValue] =
|
|
140
|
+
const [value, setValue] = useState(elementOpacity);
|
|
141
141
|
useUpdateEffect(() => {
|
|
142
142
|
setValue(elementOpacity);
|
|
143
143
|
}, [elementOpacity]);
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import '@likec4/core';
|
|
3
2
|
import { Box, SegmentedControl } from '@mantine/core';
|
|
4
|
-
import {
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
4
|
+
import { useEnabledFeatures } from '../../../../context/DiagramFeatures.js';
|
|
5
5
|
import { useHandlers, GoToSourceButton, BrowseRelationshipsButton } from './_shared.js';
|
|
6
6
|
import { ColorButton } from './ColorButton.js';
|
|
7
7
|
import { Toolbar } from './Toolbar.js';
|
|
8
|
-
import { useEnabledFeature } from '../../../../context/DiagramFeatures.js';
|
|
9
8
|
|
|
10
9
|
function CompoundElementToolbar(props) {
|
|
11
|
-
const { enableVscode, enableRelationshipBrowser } =
|
|
10
|
+
const { enableVscode, enableRelationshipBrowser } = useEnabledFeatures();
|
|
12
11
|
const {
|
|
13
12
|
data: {
|
|
14
13
|
style,
|
|
@@ -48,7 +47,7 @@ function CompoundElementToolbar(props) {
|
|
|
48
47
|
);
|
|
49
48
|
}
|
|
50
49
|
function CompoundDeploymentToolbar(props) {
|
|
51
|
-
const { enableVscode, enableRelationshipBrowser } =
|
|
50
|
+
const { enableVscode, enableRelationshipBrowser } = useEnabledFeatures();
|
|
52
51
|
const {
|
|
53
52
|
data: {
|
|
54
53
|
deploymentFqn,
|
|
@@ -92,8 +91,8 @@ function BorderStyleOption({
|
|
|
92
91
|
elementBorderStyle = "dashed",
|
|
93
92
|
onChange
|
|
94
93
|
}) {
|
|
95
|
-
const [value, setValue] =
|
|
96
|
-
|
|
94
|
+
const [value, setValue] = useState(elementBorderStyle);
|
|
95
|
+
useEffect(() => {
|
|
97
96
|
setValue(elementBorderStyle);
|
|
98
97
|
}, [elementBorderStyle]);
|
|
99
98
|
return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
@@ -2,14 +2,14 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { ElementShapes } from '@likec4/core';
|
|
3
3
|
import { Menu, MenuTarget, Button, MenuDropdown, MenuItem } from '@mantine/core';
|
|
4
4
|
import { IconSelector, IconCheck } from '@tabler/icons-react';
|
|
5
|
+
import { useEnabledFeatures } from '../../../../context/DiagramFeatures.js';
|
|
5
6
|
import { stopPropagation } from '../../../../utils/xyflow.js';
|
|
6
7
|
import { useHandlers, GoToSourceButton, BrowseRelationshipsButton } from './_shared.js';
|
|
7
8
|
import { ColorButton } from './ColorButton.js';
|
|
8
9
|
import { Toolbar } from './Toolbar.js';
|
|
9
|
-
import { useEnabledFeature } from '../../../../context/DiagramFeatures.js';
|
|
10
10
|
|
|
11
11
|
function ElementToolbar(props) {
|
|
12
|
-
const { enableVscode, enableRelationshipBrowser } =
|
|
12
|
+
const { enableVscode, enableRelationshipBrowser } = useEnabledFeatures();
|
|
13
13
|
const {
|
|
14
14
|
data: {
|
|
15
15
|
shape,
|
|
@@ -47,7 +47,7 @@ function ElementToolbar(props) {
|
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
function DeploymentElementToolbar(props) {
|
|
50
|
-
const { enableVscode, enableRelationshipBrowser } =
|
|
50
|
+
const { enableVscode, enableRelationshipBrowser } = useEnabledFeatures();
|
|
51
51
|
const {
|
|
52
52
|
data: {
|
|
53
53
|
shape,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { NodeToolbarProps } from '@xyflow/react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { NodeProps } from '../../../../base/types';
|
|
4
|
+
import { Types } from '../../../types';
|
|
4
5
|
export type ToolbarProps = Omit<NodeToolbarProps, 'title'> & {
|
|
5
|
-
nodeProps:
|
|
6
|
+
nodeProps: NodeProps<Types.NodeData>;
|
|
6
7
|
title: ReactNode;
|
|
7
8
|
};
|
|
8
9
|
export declare function Toolbar({ title, children, nodeProps, ...props }: ToolbarProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { cx } from '@likec4/styles/css';
|
|
2
3
|
import { Paper, Stack, Box, Text, Group } from '@mantine/core';
|
|
3
4
|
import { useDebouncedValue } from '@mantine/hooks';
|
|
4
5
|
import { NodeToolbar } from '@xyflow/react';
|
|
5
|
-
import clsx from 'clsx';
|
|
6
6
|
import { useDiagramContext } from '../../../../hooks/useDiagram.js';
|
|
7
7
|
import { stopPropagation } from '../../../../utils/xyflow.js';
|
|
8
8
|
import { toolbarTitle } from './styles.css.js';
|
|
@@ -45,7 +45,7 @@ function Toolbar({ title, children, nodeProps, ...props }) {
|
|
|
45
45
|
children: /* @__PURE__ */ jsx(
|
|
46
46
|
Paper,
|
|
47
47
|
{
|
|
48
|
-
className:
|
|
48
|
+
className: cx("nodrag", "nopan"),
|
|
49
49
|
px: 5,
|
|
50
50
|
pb: 8,
|
|
51
51
|
pt: 4,
|
|
@@ -16,7 +16,7 @@ export declare const themedColors: ({
|
|
|
16
16
|
value: `#${string}`;
|
|
17
17
|
})[];
|
|
18
18
|
export declare const colors: {
|
|
19
|
-
key: "
|
|
19
|
+
key: "blue" | "gray" | "green" | "indigo" | "red" | "amber" | "slate" | "sky";
|
|
20
20
|
value: `#${string}`;
|
|
21
21
|
}[];
|
|
22
22
|
export type ThemeColorKey = typeof themedColors[0]['key'];
|
|
@@ -26,7 +26,7 @@ export declare const Tooltip: ForwardRefExoticComponent< TooltipProps & RefAttri
|
|
|
26
26
|
renderRoot?: (props: Record<string, any>) => React.ReactNode;
|
|
27
27
|
}>;
|
|
28
28
|
export declare function useHandlers(target: Fqn, props: NodeProps<Types.NodeData>): {
|
|
29
|
-
elementColor: "
|
|
29
|
+
elementColor: "blue" | "gray" | "green" | "indigo" | "red" | "amber" | "slate" | "muted" | "primary" | "secondary" | "sky";
|
|
30
30
|
onColorPreview: (color: ThemeColor | null) => void;
|
|
31
31
|
onChange: OnStyleChange;
|
|
32
32
|
};
|