@likec4/diagram 1.59.2 → 1.59.4
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 +53 -0
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +36 -21
- package/dist/LikeC4Diagram.props.d.ts +23 -0
- package/dist/LikeC4MantineProvider.d.ts +24 -0
- package/dist/LikeC4MantineProvider.js +156 -0
- package/dist/LikeC4ProjectsOverview.js +1 -1
- package/dist/LikeC4ProjectsProvider.d.ts +17 -2
- package/dist/LikeC4Styles.d.ts +13 -3
- package/dist/LikeC4Styles.js +10 -6
- package/dist/LikeC4View.js +2 -2
- package/dist/StaticLikeC4Diagram.d.ts +1 -1
- package/dist/base/BaseXYFlow.d.ts +1 -1
- package/dist/base/BaseXYFlow.js +19 -9
- package/dist/base/const.d.ts +1 -0
- package/dist/base/const.js +3 -1
- package/dist/base-primitives/Markdown.d.ts +3 -3
- package/dist/base-primitives/compound/CompoundNodeContainer.js +2 -3
- package/dist/base-primitives/compound/CompoundTitle.js +5 -4
- package/dist/base-primitives/compound/actionbtns.css.d.ts +3 -3
- package/dist/base-primitives/compound/actionbtns.css.js +3 -3
- package/dist/base-primitives/element/ElementData.js +6 -1
- package/dist/base-primitives/element/ElementShape.js +9 -10
- package/dist/base-primitives/element/ElementTags.d.ts +2 -2
- package/dist/base-primitives/element/ElementTags.js +5 -5
- package/dist/components/EmptyBox.d.ts +3 -0
- package/dist/components/EmptyBox.js +9 -0
- package/dist/components/ErrorFallback.js +7 -6
- package/dist/components/FloatingWindow.d.ts +18 -0
- package/dist/components/FloatingWindow.js +89 -0
- package/dist/components/Link.js +7 -7
- package/dist/components/NavigationPanel.d.ts +2 -2
- package/dist/components/NavigationPanel.js +5 -6
- package/dist/components/SearchControl.css.js +10 -12
- package/dist/components/ViewIcon.d.ts +11 -0
- package/dist/components/ViewIcon.js +71 -0
- package/dist/context/CurrentViewModelProvider.js +2 -1
- package/dist/context/DiagramEventHandlers.js +4 -2
- package/dist/context/EnsureMantine.js +3 -3
- package/dist/context/IconRenderer.d.ts +2 -1
- package/dist/context/IconRenderer.js +78 -26
- package/dist/context/LikeC4ProjectsContext.d.ts +3 -2
- package/dist/context/TagStylesContext.d.ts +11 -4
- package/dist/context/TagStylesContext.js +39 -27
- package/dist/custom/index.d.ts +3 -0
- package/dist/custom/index.js +7 -4
- package/dist/editor/LikeC4EditorCallbacks.d.ts +20 -1
- package/dist/editor/LikeC4EditorCallbacks.js +4 -1
- package/dist/editor/actor/setup.d.ts +1 -0
- package/dist/editor/actor/setup.js +17 -12
- package/dist/editor/actor/state.sync-queue.js +1 -0
- package/dist/editor/applyChangesToManualLayout.js +5 -2
- package/dist/editor/index.d.ts +1 -1
- package/dist/editor/useEditorActorLogic.js +10 -3
- package/dist/hooks/safeContext.d.ts +12 -4
- package/dist/hooks/safeContext.js +2 -2
- package/dist/hooks/useCurrentView.js +5 -5
- package/dist/hooks/useDiagram.js +3 -23
- package/dist/hooks/useDiagramCompareLayout.d.ts +16 -6
- package/dist/hooks/useDiagramCompareLayout.js +20 -17
- package/dist/hooks/useEditorActor.js +3 -5
- package/dist/hooks/useLikeC4Model.js +8 -3
- package/dist/hooks/useLikeC4Project.d.ts +4 -3
- package/dist/hooks/useOverlaysActor.d.ts +1 -1
- package/dist/hooks/useUpdateEffect.js +2 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.js +8 -6
- package/dist/likec4diagram/DiagramUI.js +4 -3
- package/dist/likec4diagram/DiagramXYFlow.d.ts +6 -0
- package/dist/likec4diagram/DiagramXYFlow.js +33 -19
- package/dist/likec4diagram/custom/edges/EdgeDrifts.js +4 -4
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +2 -4
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +1 -3
- package/dist/likec4diagram/custom/edges/edges.css.js +13 -13
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +3 -2
- package/dist/likec4diagram/custom/nodes/NodeDrifts.js +2 -2
- package/dist/likec4diagram/custom/nodes/NodeNotes.js +4 -4
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +2 -2
- package/dist/likec4diagram/custom/nodes/SequenceSubFlow.js +8 -5
- package/dist/likec4diagram/custom/nodes/nodes.js +8 -5
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +9 -8
- package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +1 -1
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +3 -2
- package/dist/likec4diagram/relationship-popover/components.d.ts +1 -1
- package/dist/likec4diagram/relationship-popover/components.js +6 -2
- package/dist/likec4diagram/state/DiagramActorProvider.d.ts +7 -2
- package/dist/likec4diagram/state/DiagramActorProvider.js +20 -4
- package/dist/likec4diagram/state/assign.js +1 -1
- package/dist/likec4diagram/state/createViewChange.js +1 -6
- package/dist/likec4diagram/state/diagram-api.d.ts +2 -2
- package/dist/likec4diagram/state/diagram-api.js +3 -2
- package/dist/likec4diagram/state/machine.actions.js +15 -8
- package/dist/likec4diagram/state/machine.actions.layout.d.ts +1 -0
- package/dist/likec4diagram/state/machine.actions.layout.js +7 -5
- package/dist/likec4diagram/state/machine.setup.d.ts +10 -1
- package/dist/likec4diagram/state/machine.setup.js +15 -9
- package/dist/likec4diagram/state/machine.state.initializing.d.ts +2 -26
- package/dist/likec4diagram/state/machine.state.initializing.js +9 -6
- package/dist/likec4diagram/state/machine.state.navigating.js +1 -1
- package/dist/likec4diagram/state/machine.state.ready.d.ts +134 -3
- package/dist/likec4diagram/state/machine.state.ready.js +2 -1
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +106 -1
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +40 -7
- package/dist/likec4diagram/state/utils.d.ts +1 -1
- package/dist/likec4diagram/state/utils.js +7 -4
- package/dist/likec4diagram/ui/FloatingSequenceActors.js +2 -1
- package/dist/likec4diagram/ui/LayoutDriftFrame.js +16 -10
- package/dist/likec4diagram/ui/index.d.ts +1 -1
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +13 -15
- package/dist/likec4diagram/ui/notation/NotationPanel.js +9 -9
- package/dist/likec4diagram/ui/sequence-outline/ActiveTrail.d.ts +9 -0
- package/dist/likec4diagram/ui/sequence-outline/ActiveTrail.js +81 -0
- package/dist/likec4diagram/ui/sequence-outline/FlowRow.d.ts +11 -0
- package/dist/likec4diagram/ui/sequence-outline/FlowRow.js +70 -0
- package/dist/likec4diagram/ui/sequence-outline/OutlineBody.d.ts +2 -0
- package/dist/likec4diagram/ui/sequence-outline/OutlineBody.js +106 -0
- package/dist/likec4diagram/ui/sequence-outline/OutlineHeader.d.ts +2 -0
- package/dist/likec4diagram/ui/sequence-outline/OutlineHeader.js +140 -0
- package/dist/likec4diagram/ui/sequence-outline/OutlineNodes.d.ts +17 -0
- package/dist/likec4diagram/ui/sequence-outline/OutlineNodes.js +83 -0
- package/dist/likec4diagram/ui/sequence-outline/SequenceOutlinePanel.d.ts +4 -0
- package/dist/likec4diagram/ui/sequence-outline/SequenceOutlinePanel.js +49 -525
- package/dist/likec4diagram/ui/sequence-outline/StepBadge.d.ts +8 -0
- package/dist/likec4diagram/ui/sequence-outline/StepBadge.js +52 -0
- package/dist/likec4diagram/ui/sequence-outline/StepRow.d.ts +7 -0
- package/dist/likec4diagram/ui/sequence-outline/StepRow.js +190 -0
- package/dist/likec4diagram/ui/sequence-outline/StoreProvider.d.ts +238 -0
- package/dist/likec4diagram/ui/sequence-outline/StoreProvider.js +94 -0
- package/dist/likec4diagram/ui/sequence-outline/depth-of-field.d.ts +21 -0
- package/dist/likec4diagram/ui/sequence-outline/depth-of-field.js +71 -0
- package/dist/likec4diagram/ui/sequence-outline/index.d.ts +2 -0
- package/dist/likec4diagram/ui/sequence-outline/motion.d.ts +13 -0
- package/dist/likec4diagram/ui/sequence-outline/motion.js +21 -0
- package/dist/likec4diagram/ui/sequence-outline/presentation.d.ts +10 -0
- package/dist/likec4diagram/ui/sequence-outline/presentation.js +80 -0
- package/dist/likec4diagram/ui/sequence-outline/tree.d.ts +9 -0
- package/dist/likec4diagram/ui/sequence-outline/tree.js +67 -0
- package/dist/likec4diagram/ui/sequence-outline/{state.d.ts → types.d.ts} +4 -2
- package/dist/likec4diagram/ui/sequence-outline/types.js +12 -0
- package/dist/likec4diagram/useLayoutConstraints.js +13 -1
- package/dist/likec4diagram/xyflow-sequence/layouter.js +8 -10
- package/dist/likec4diagram/xyflow-sequence/sequence-view-to-xy.js +1 -0
- package/dist/likec4diagram/xyflow-sequence/utils.js +0 -1
- package/dist/navigationpanel/NavigationPanel.js +45 -41
- package/dist/navigationpanel/NavigationPanelControls.js +102 -63
- package/dist/navigationpanel/NavigationPanelDropdown.js +52 -77
- package/dist/navigationpanel/_common.d.ts +6 -6
- package/dist/navigationpanel/_common.js +31 -42
- package/dist/navigationpanel/actor.actions.js +6 -5
- package/dist/navigationpanel/actor.js +2 -2
- package/dist/navigationpanel/actor.setup.d.ts +6 -6
- package/dist/navigationpanel/actor.setup.js +2 -1
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +2 -4
- package/dist/navigationpanel/comparepanel/ComparePanel.js +8 -10
- package/dist/navigationpanel/comparepanel/DriftsSummary.d.ts +1 -1
- package/dist/navigationpanel/comparepanel/DriftsSummary.js +11 -9
- package/dist/navigationpanel/controls/LayoutWarning.js +69 -72
- package/dist/navigationpanel/controls/NavigationButtons.d.ts +1 -1
- package/dist/navigationpanel/controls/NavigationButtons.js +8 -8
- package/dist/navigationpanel/controls/OpenSource.d.ts +1 -1
- package/dist/navigationpanel/controls/OpenSource.js +5 -8
- package/dist/navigationpanel/controls/SearchControl.js +24 -9
- package/dist/navigationpanel/controls/ToggleReadonly.d.ts +4 -1
- package/dist/navigationpanel/controls/ToggleReadonly.js +56 -76
- package/dist/navigationpanel/controls/ViewDetailsButton.d.ts +5 -0
- package/dist/navigationpanel/controls/ViewDetailsButton.js +121 -0
- package/dist/navigationpanel/controls/index.d.ts +1 -1
- package/dist/navigationpanel/dropdown/ProjectsMenu.js +27 -16
- package/dist/navigationpanel/editorpanel/ApplySemanticLayout.js +2 -1
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +12 -10
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.d.ts +2 -0
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +19 -10
- package/dist/navigationpanel/editorpanel/styles.js +8 -15
- package/dist/navigationpanel/hooks.d.ts +6 -2
- package/dist/navigationpanel/styles.css.d.ts +2 -2
- package/dist/navigationpanel/styles.css.js +0 -1
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +3 -2
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +5 -4
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +10 -39
- package/dist/navigationpanel/walkthrough/DynamicViewModeSwitcher.d.ts +1 -0
- package/dist/navigationpanel/walkthrough/DynamicViewModeSwitcher.js +49 -0
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +8 -8
- package/dist/navigationpanel/windows/ViewDetailsWindow.d.ts +1 -0
- package/dist/navigationpanel/windows/ViewDetailsWindow.js +379 -0
- package/dist/overlays/Overlays.js +29 -17
- package/dist/overlays/element-details/ElementDetailsCard.css.js +28 -36
- package/dist/overlays/element-details/ElementDetailsCard.js +3 -3
- package/dist/overlays/element-details/MetadataValue.js +18 -16
- package/dist/overlays/element-details/TabPanelDeployments.css.js +6 -14
- package/dist/overlays/element-details/TabPanelRelationships.css.js +8 -12
- package/dist/overlays/element-details/TabPanelStructure.css.js +4 -8
- package/dist/overlays/hooks.d.ts +3 -1
- package/dist/overlays/overlay/Overlay.js +8 -7
- package/dist/overlays/overlaysActor.js +20 -17
- package/dist/overlays/relationship-details/RelationshipDetails.js +2 -1
- package/dist/overlays/relationship-details/SelectEdge.css.js +14 -9
- package/dist/overlays/relationship-details/actor.js +1 -1
- package/dist/overlays/relationship-details/hooks.js +2 -1
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +6 -0
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +15 -8
- package/dist/overlays/relationships-browser/SelectElement.css.js +2 -8
- package/dist/overlays/relationships-browser/SelectElement.js +5 -1
- package/dist/overlays/relationships-browser/actor.js +3 -2
- package/dist/overlays/relationships-browser/custom/ElementActions.js +39 -38
- package/dist/overlays/relationships-browser/custom/EmptyNode.js +7 -9
- package/dist/overlays/relationships-browser/hooks.js +2 -1
- package/dist/projects-overview/ProjectsOverview.js +8 -7
- package/dist/projects-overview/actor.js +1 -1
- package/dist/projects-overview/hooks.js +2 -1
- package/dist/search/Search.js +9 -7
- package/dist/search/components/ElementsColumn.css.js +6 -5
- package/dist/search/components/ElementsColumn.js +4 -3
- package/dist/search/components/SearchByTags.js +3 -3
- package/dist/search/components/ViewsColum.js +46 -43
- package/dist/search/components/ViewsColumn.css.js +4 -4
- package/dist/search/components/_shared.css.d.ts +2 -2
- package/dist/search/components/_shared.css.js +31 -46
- package/dist/search/components/styles.css.js +4 -4
- package/dist/search/hooks.js +2 -1
- package/dist/shadowroot/ShadowRoot.js +6 -5
- package/dist/styles2.js +1 -1
- package/dist/utils/index.js +3 -3
- package/package.json +29 -29
- package/panda.buildinfo.json +342 -299
- package/styles-min.css +1 -1
- package/styles-xyflow.css +1 -1
- package/styles.css +1 -1
- package/dist/context/DefaultMantineProvider.d.ts +0 -2
- package/dist/context/DefaultMantineProvider.js +0 -48
- package/dist/likec4diagram/ui/sequence-outline/state.js +0 -55
- package/dist/navigationpanel/controls/DetailsControls.d.ts +0 -2
- package/dist/navigationpanel/controls/DetailsControls.js +0 -223
|
@@ -4,7 +4,7 @@ import { useDiagramCompareLayout } from "../../hooks/useDiagramCompareLayout.js"
|
|
|
4
4
|
import { cx } from "@likec4/styles/css";
|
|
5
5
|
import { IconAlertTriangle } from "@tabler/icons-react";
|
|
6
6
|
import { Fragment, memo } from "react";
|
|
7
|
-
import {
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { Button, HoverCard, HoverCardDropdown, HoverCardTarget, Notification, Text, UnstyledButton } from "@mantine/core";
|
|
9
9
|
import { AnimatePresence } from "motion/react";
|
|
10
10
|
import { hstack } from "@likec4/styles/patterns";
|
|
@@ -14,78 +14,75 @@ import { navigationPanelActionIcon } from "@likec4/styles/recipes";
|
|
|
14
14
|
var LayoutWarning = memo(() => {
|
|
15
15
|
const [ctx, { toggleCompare }] = useDiagramCompareLayout();
|
|
16
16
|
const portalProps = useMantinePortalProps();
|
|
17
|
-
const { drifts,
|
|
18
|
-
return /* @__PURE__ */ jsx(AnimatePresence, {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
const { drifts, state, isEnabled } = ctx;
|
|
18
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: isEnabled && state !== "comparing" && /* @__PURE__ */ jsxs(HoverCard, {
|
|
19
|
+
position: "bottom-start",
|
|
20
|
+
openDelay: 600,
|
|
21
|
+
closeDelay: 200,
|
|
22
|
+
floatingStrategy: "absolute",
|
|
23
|
+
offset: {
|
|
24
|
+
mainAxis: 4,
|
|
25
|
+
crossAxis: -22
|
|
26
|
+
},
|
|
27
|
+
...portalProps,
|
|
28
|
+
children: [/* @__PURE__ */ jsx(HoverCardTarget, { children: /* @__PURE__ */ jsx(UnstyledButton, {
|
|
29
|
+
component: m$1.button,
|
|
30
|
+
layout: "position",
|
|
31
|
+
onClick: (e) => {
|
|
32
|
+
e.stopPropagation();
|
|
33
|
+
toggleCompare();
|
|
28
34
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
children:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
toggleCompare();
|
|
81
|
-
},
|
|
82
|
-
children: "Compare with current state"
|
|
83
|
-
})
|
|
84
|
-
]
|
|
85
|
-
})
|
|
86
|
-
})]
|
|
87
|
-
})
|
|
88
|
-
});
|
|
35
|
+
whileTap: {
|
|
36
|
+
scale: .95,
|
|
37
|
+
translateY: 1
|
|
38
|
+
},
|
|
39
|
+
className: cx("group", navigationPanelActionIcon({
|
|
40
|
+
variant: "filled",
|
|
41
|
+
type: "warning"
|
|
42
|
+
}), hstack({
|
|
43
|
+
gap: "xxs",
|
|
44
|
+
padding: "1.5",
|
|
45
|
+
rounded: "sm",
|
|
46
|
+
userSelect: "none",
|
|
47
|
+
cursor: "pointer",
|
|
48
|
+
fontSize: "xs",
|
|
49
|
+
fontWeight: "bold"
|
|
50
|
+
})),
|
|
51
|
+
children: /* @__PURE__ */ jsx(IconAlertTriangle, { size: 18 })
|
|
52
|
+
}) }), /* @__PURE__ */ jsx(HoverCardDropdown, {
|
|
53
|
+
p: "0",
|
|
54
|
+
children: /* @__PURE__ */ jsxs(Notification, {
|
|
55
|
+
color: "orange",
|
|
56
|
+
withBorder: false,
|
|
57
|
+
withCloseButton: false,
|
|
58
|
+
title: "View is out of sync",
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ jsx(Text, {
|
|
61
|
+
mt: 2,
|
|
62
|
+
size: "sm",
|
|
63
|
+
lh: "xs",
|
|
64
|
+
children: "Model has changed since this view was last updated."
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
67
|
+
mt: 4,
|
|
68
|
+
size: "sm",
|
|
69
|
+
lh: "xs",
|
|
70
|
+
children: ["Detected drifts:", drifts.map((drift) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("br", {}), /* @__PURE__ */ jsxs("span", { children: ["- ", drift] })] }, drift))]
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ jsx(Button, {
|
|
73
|
+
mt: "xs",
|
|
74
|
+
size: "compact-sm",
|
|
75
|
+
variant: "default",
|
|
76
|
+
onClick: (e) => {
|
|
77
|
+
e.stopPropagation();
|
|
78
|
+
toggleCompare();
|
|
79
|
+
},
|
|
80
|
+
children: "Compare with current state"
|
|
81
|
+
})
|
|
82
|
+
]
|
|
83
|
+
})
|
|
84
|
+
})]
|
|
85
|
+
}) });
|
|
89
86
|
});
|
|
90
87
|
LayoutWarning.displayName = "ManualLayoutWarning";
|
|
91
88
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function NavigationButtons(): import("react").JSX.Element;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { useDiagram } from "../../hooks/safeContext.js";
|
|
3
|
-
import { useDiagramContext } from "../../hooks/useDiagram.js";
|
|
2
|
+
import { selectDiagramContext, useDiagram, useDiagramSelector } from "../../hooks/safeContext.js";
|
|
4
3
|
import { PanelActionIcon } from "../_common.js";
|
|
5
4
|
import { IconArrowLeft, IconArrowRight } from "@tabler/icons-react";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
6
|
import { hstack } from "@likec4/styles/patterns";
|
|
8
7
|
import * as m from "motion/react-m";
|
|
9
8
|
//#region src/navigationpanel/controls/NavigationButtons.tsx
|
|
10
|
-
var
|
|
9
|
+
var selectNavigationState = selectDiagramContext((s) => ({
|
|
10
|
+
hasStepBack: s.navigationHistory.currentIndex > 0,
|
|
11
|
+
hasStepForward: s.navigationHistory.currentIndex < s.navigationHistory.history.length - 1
|
|
12
|
+
}));
|
|
13
|
+
function NavigationButtons() {
|
|
11
14
|
const diagram = useDiagram();
|
|
12
|
-
const { hasStepBack, hasStepForward } =
|
|
13
|
-
hasStepBack: s.navigationHistory.currentIndex > 0,
|
|
14
|
-
hasStepForward: s.navigationHistory.currentIndex < s.navigationHistory.history.length - 1
|
|
15
|
-
}));
|
|
15
|
+
const { hasStepBack, hasStepForward } = useDiagramSelector(selectNavigationState);
|
|
16
16
|
return /* @__PURE__ */ jsxs(m.div, {
|
|
17
17
|
layout: "position",
|
|
18
18
|
className: hstack({ gap: "0.5" }),
|
|
@@ -32,6 +32,6 @@ var NavigationButtons = () => {
|
|
|
32
32
|
children: /* @__PURE__ */ jsx(IconArrowRight, { size: 14 })
|
|
33
33
|
})]
|
|
34
34
|
});
|
|
35
|
-
}
|
|
35
|
+
}
|
|
36
36
|
//#endregion
|
|
37
37
|
export { NavigationButtons };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const OpenSource: () => import("react").JSX.Element
|
|
1
|
+
export declare const OpenSource: () => import("react").JSX.Element;
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import {
|
|
3
|
-
import { useEnabledFeatures } from "../../context/DiagramFeatures.js";
|
|
4
|
-
import { useCurrentViewId } from "../../hooks/useCurrentView.js";
|
|
2
|
+
import { useDiagram } from "../../hooks/safeContext.js";
|
|
5
3
|
import { PanelActionIcon, Tooltip } from "../_common.js";
|
|
6
4
|
import { IconFileSymlink } from "@tabler/icons-react";
|
|
7
5
|
import { jsx } from "react/jsx-runtime";
|
|
8
6
|
//#region src/navigationpanel/controls/OpenSource.tsx
|
|
9
7
|
var OpenSource = () => {
|
|
10
|
-
const
|
|
11
|
-
const { enableVscode } = useEnabledFeatures();
|
|
12
|
-
const { onOpenSource } = useDiagramEventHandlers();
|
|
13
|
-
if (!enableVscode) return null;
|
|
8
|
+
const diagram = useDiagram();
|
|
14
9
|
return /* @__PURE__ */ jsx(Tooltip, {
|
|
15
10
|
label: "Open View Source",
|
|
16
11
|
children: /* @__PURE__ */ jsx(PanelActionIcon, {
|
|
12
|
+
layout: "position",
|
|
17
13
|
onClick: (e) => {
|
|
18
14
|
e.stopPropagation();
|
|
19
|
-
|
|
15
|
+
const viewId = diagram.currentView.id;
|
|
16
|
+
diagram.openSource({ view: viewId });
|
|
20
17
|
},
|
|
21
18
|
children: /* @__PURE__ */ jsx(IconFileSymlink, { style: {
|
|
22
19
|
width: "60%",
|
|
@@ -2,16 +2,35 @@ import "../../_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import { useDiagram } from "../../hooks/safeContext.js";
|
|
3
3
|
import { cx } from "@likec4/styles/css";
|
|
4
4
|
import { IconSearch } from "@tabler/icons-react";
|
|
5
|
+
import { useRef } from "react";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
import { UnstyledButton } from "@mantine/core";
|
|
7
8
|
import { isMacOs } from "@xyflow/system";
|
|
9
|
+
import { m } from "motion/react";
|
|
8
10
|
import { Box as Box$1 } from "@likec4/styles/jsx";
|
|
9
11
|
import { hstack } from "@likec4/styles/patterns";
|
|
10
|
-
import * as m from "motion/react-m";
|
|
11
12
|
//#region src/navigationpanel/controls/SearchControl.tsx
|
|
12
13
|
function SearchControl() {
|
|
13
14
|
const diagram = useDiagram();
|
|
14
15
|
const isMac = isMacOs();
|
|
16
|
+
const searchControlAnimation = useRef({
|
|
17
|
+
initial: {
|
|
18
|
+
opacity: 0,
|
|
19
|
+
translateX: -10
|
|
20
|
+
},
|
|
21
|
+
animate: {
|
|
22
|
+
opacity: 1,
|
|
23
|
+
translateX: 0
|
|
24
|
+
},
|
|
25
|
+
exit: {
|
|
26
|
+
opacity: 0,
|
|
27
|
+
translateX: -20
|
|
28
|
+
},
|
|
29
|
+
whileTap: {
|
|
30
|
+
scale: .95,
|
|
31
|
+
translateY: 1
|
|
32
|
+
}
|
|
33
|
+
});
|
|
15
34
|
return /* @__PURE__ */ jsxs(UnstyledButton, {
|
|
16
35
|
component: m.button,
|
|
17
36
|
layout: "position",
|
|
@@ -19,14 +38,10 @@ function SearchControl() {
|
|
|
19
38
|
e.stopPropagation();
|
|
20
39
|
diagram.openSearch();
|
|
21
40
|
},
|
|
22
|
-
|
|
23
|
-
scale: .95,
|
|
24
|
-
translateY: 1
|
|
25
|
-
},
|
|
41
|
+
...searchControlAnimation.current,
|
|
26
42
|
className: cx("group", hstack({
|
|
27
43
|
gap: "xxs",
|
|
28
44
|
paddingInline: "sm",
|
|
29
|
-
paddingBlock: "xxs",
|
|
30
45
|
userSelect: "none",
|
|
31
46
|
layerStyle: "likec4.panel.action.filled",
|
|
32
47
|
display: {
|
|
@@ -39,10 +54,10 @@ function SearchControl() {
|
|
|
39
54
|
stroke: 2.5
|
|
40
55
|
}), /* @__PURE__ */ jsx(Box$1, {
|
|
41
56
|
css: {
|
|
42
|
-
fontSize: "
|
|
57
|
+
fontSize: "xs",
|
|
43
58
|
fontWeight: "bold",
|
|
44
|
-
lineHeight: 1,
|
|
45
|
-
opacity: .
|
|
59
|
+
lineHeight: "1",
|
|
60
|
+
opacity: "0.7",
|
|
46
61
|
whiteSpace: "nowrap"
|
|
47
62
|
},
|
|
48
63
|
children: isMac ? "⌘ + K" : "Ctrl + K"
|
|
@@ -1,89 +1,69 @@
|
|
|
1
1
|
import "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { useDiagram } from "../../hooks/safeContext.js";
|
|
3
|
-
import { useDiagramContext } from "../../hooks/useDiagram.js";
|
|
4
|
-
import { deriveToggledFeatures } from "../../likec4diagram/state/machine.setup.js";
|
|
5
3
|
import { css, cx } from "@likec4/styles/css";
|
|
6
4
|
import { IconLock, IconLockOpen2 } from "@tabler/icons-react";
|
|
7
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { isTruthy } from "remeda";
|
|
9
6
|
import { UnstyledButton } from "@mantine/core";
|
|
10
|
-
import {
|
|
7
|
+
import { m } from "motion/react";
|
|
11
8
|
import { hstack } from "@likec4/styles/patterns";
|
|
12
|
-
import * as m$1 from "motion/react-m";
|
|
13
9
|
//#region src/navigationpanel/controls/ToggleReadonly.tsx
|
|
14
|
-
|
|
15
|
-
const comparingLatest = deriveToggledFeatures(ctx).enableCompareWithLatest && !!ctx.view.drifts && ctx.view._layout === "auto";
|
|
16
|
-
const noActiveWalkthrough = !isTruthy(ctx.activeWalkthrough);
|
|
17
|
-
const hasEditor = ctx.features.enableEditor;
|
|
18
|
-
const isReadOnly = ctx.toggledFeatures.enableReadOnly ?? false;
|
|
19
|
-
return {
|
|
20
|
-
visible: hasEditor && noActiveWalkthrough,
|
|
21
|
-
disabled: comparingLatest,
|
|
22
|
-
isReadOnly
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
var ToggleReadonly = () => {
|
|
26
|
-
const { visible, disabled, isReadOnly } = useDiagramContext(selector);
|
|
10
|
+
function ToggleReadonly({ disabled, isReadOnly }) {
|
|
27
11
|
const diagram = useDiagram();
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
12
|
+
return /* @__PURE__ */ jsxs(UnstyledButton, {
|
|
13
|
+
component: m.button,
|
|
14
|
+
layout: "position",
|
|
15
|
+
layoutDependency: isReadOnly,
|
|
16
|
+
disabled,
|
|
17
|
+
onClick: (e) => {
|
|
18
|
+
e.stopPropagation();
|
|
19
|
+
!disabled && diagram.toggleFeature("ReadOnly");
|
|
20
|
+
},
|
|
21
|
+
initial: {
|
|
22
|
+
opacity: 0,
|
|
23
|
+
scale: .9,
|
|
24
|
+
translateX: -10
|
|
25
|
+
},
|
|
26
|
+
animate: {
|
|
27
|
+
opacity: 1,
|
|
28
|
+
scale: disabled ? .95 : 1,
|
|
29
|
+
translateX: 0
|
|
30
|
+
},
|
|
31
|
+
exit: {
|
|
32
|
+
opacity: 0,
|
|
33
|
+
scale: .9,
|
|
34
|
+
translateX: -10
|
|
35
|
+
},
|
|
36
|
+
whileTap: { translateY: 1 },
|
|
37
|
+
className: cx("group", hstack({
|
|
38
|
+
gap: "0.5",
|
|
39
|
+
paddingInline: "xxs",
|
|
40
|
+
paddingBlock: "xxs",
|
|
41
|
+
userSelect: "none",
|
|
42
|
+
layerStyle: "likec4.panel.action"
|
|
43
|
+
})),
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ jsx(IconLockOpen2, {
|
|
46
|
+
size: 14,
|
|
47
|
+
stroke: 2,
|
|
48
|
+
style: { display: isReadOnly ? "none" : void 0 }
|
|
49
|
+
}),
|
|
50
|
+
/* @__PURE__ */ jsx(IconLock, {
|
|
51
|
+
size: 14,
|
|
52
|
+
stroke: 2,
|
|
53
|
+
style: { display: !isReadOnly ? "none" : void 0 }
|
|
54
|
+
}),
|
|
55
|
+
isReadOnly && /* @__PURE__ */ jsx(m.div, {
|
|
56
|
+
layout: true,
|
|
57
|
+
className: css({
|
|
58
|
+
fontSize: "xxs",
|
|
59
|
+
fontWeight: "bold",
|
|
60
|
+
lineHeight: "snug",
|
|
61
|
+
opacity: "0.9"
|
|
68
62
|
}),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
style: { display: !isReadOnly ? "none" : void 0 }
|
|
73
|
-
}),
|
|
74
|
-
/* @__PURE__ */ jsx(m$1.div, {
|
|
75
|
-
className: css({
|
|
76
|
-
fontSize: "11px",
|
|
77
|
-
fontWeight: "bold",
|
|
78
|
-
lineHeight: 1,
|
|
79
|
-
opacity: .8
|
|
80
|
-
}),
|
|
81
|
-
style: { display: isReadOnly ? "block" : "none" },
|
|
82
|
-
children: "Edit"
|
|
83
|
-
})
|
|
84
|
-
]
|
|
85
|
-
})
|
|
63
|
+
children: "Edit"
|
|
64
|
+
})
|
|
65
|
+
]
|
|
86
66
|
});
|
|
87
|
-
}
|
|
67
|
+
}
|
|
88
68
|
//#endregion
|
|
89
69
|
export { ToggleReadonly };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { useRootContainer } from "../../context/RootContainerContext.js";
|
|
3
|
+
import { selectDiagramContext, useDiagramSelector } from "../../hooks/safeContext.js";
|
|
4
|
+
import { FloatingWindow as FloatingWindow$1 } from "../../components/FloatingWindow.js";
|
|
5
|
+
import { ViewDetailsWindow } from "../windows/ViewDetailsWindow.js";
|
|
6
|
+
import { cx } from "@likec4/styles/css";
|
|
7
|
+
import { IconId, IconLink } from "@tabler/icons-react";
|
|
8
|
+
import { useRef } from "react";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { clamp } from "remeda";
|
|
11
|
+
import { UnstyledButton } from "@mantine/core";
|
|
12
|
+
import { useDisclosure } from "@mantine/hooks";
|
|
13
|
+
import { Box as Box$1, HStack } from "@likec4/styles/jsx";
|
|
14
|
+
import { hstack } from "@likec4/styles/patterns";
|
|
15
|
+
import * as m from "motion/react-m";
|
|
16
|
+
//#region src/navigationpanel/controls/ViewDetailsButton.tsx
|
|
17
|
+
var selector = selectDiagramContext(({ view }) => {
|
|
18
|
+
return {
|
|
19
|
+
id: view.id,
|
|
20
|
+
links: view.links?.length ?? 0
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
function ViewDetailsButton({ onOpen }) {
|
|
24
|
+
const { ref: rootRef } = useRootContainer();
|
|
25
|
+
const [opened, handlers] = useDisclosure(false);
|
|
26
|
+
const data = useDiagramSelector(selector);
|
|
27
|
+
const initialsRef = useRef({
|
|
28
|
+
dimensions: {
|
|
29
|
+
initialWidth: 200,
|
|
30
|
+
initialHeight: 200
|
|
31
|
+
},
|
|
32
|
+
initialPosition: {
|
|
33
|
+
top: 65,
|
|
34
|
+
left: 32
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const toggle = () => {
|
|
38
|
+
if (opened) handlers.close();
|
|
39
|
+
else {
|
|
40
|
+
const rootElement = rootRef.current;
|
|
41
|
+
if (rootElement) {
|
|
42
|
+
const viewport = rootElement.getBoundingClientRect();
|
|
43
|
+
const panelRect = rootElement.querySelector("[data-panel=\"navigation\"]")?.getBoundingClientRect();
|
|
44
|
+
let height = viewport.height - 80;
|
|
45
|
+
if (panelRect) {
|
|
46
|
+
initialsRef.current.initialPosition.top = panelRect.bottom + 10;
|
|
47
|
+
initialsRef.current.initialPosition.left = panelRect.left + 55;
|
|
48
|
+
height = viewport.height - (panelRect.top - viewport.top + panelRect.height) - 32;
|
|
49
|
+
}
|
|
50
|
+
initialsRef.current.dimensions.initialHeight = Math.max(100, height);
|
|
51
|
+
initialsRef.current.dimensions.initialWidth = clamp(viewport.width * .3, {
|
|
52
|
+
min: 250,
|
|
53
|
+
max: 500
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
handlers.open();
|
|
57
|
+
onOpen();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ViewDetailsCardTrigger, {
|
|
61
|
+
linksCount: data.links,
|
|
62
|
+
onClick: toggle,
|
|
63
|
+
opened
|
|
64
|
+
}), opened && /* @__PURE__ */ jsx(FloatingWindow$1, {
|
|
65
|
+
windowId: "view-details",
|
|
66
|
+
...initialsRef.current,
|
|
67
|
+
onClose: handlers.close,
|
|
68
|
+
children: /* @__PURE__ */ jsx(ViewDetailsWindow, {})
|
|
69
|
+
})] });
|
|
70
|
+
}
|
|
71
|
+
var ViewDetailsCardTrigger = ({ linksCount, onClick, opened }) => /* @__PURE__ */ jsxs(UnstyledButton, {
|
|
72
|
+
component: m.button,
|
|
73
|
+
layout: "position",
|
|
74
|
+
"aria-selected": opened,
|
|
75
|
+
whileTap: {
|
|
76
|
+
scale: .95,
|
|
77
|
+
translateY: 1
|
|
78
|
+
},
|
|
79
|
+
onClick: (e) => {
|
|
80
|
+
e.stopPropagation();
|
|
81
|
+
onClick();
|
|
82
|
+
},
|
|
83
|
+
className: cx("group", hstack({
|
|
84
|
+
gap: "2",
|
|
85
|
+
layerStyle: "likec4.panel.action",
|
|
86
|
+
display: {
|
|
87
|
+
base: "none",
|
|
88
|
+
"@/xs": "flex"
|
|
89
|
+
},
|
|
90
|
+
_selected: {
|
|
91
|
+
backgroundColor: {
|
|
92
|
+
base: "primary.body",
|
|
93
|
+
_hover: "primary.body.hover"
|
|
94
|
+
},
|
|
95
|
+
color: {
|
|
96
|
+
base: "primary.text",
|
|
97
|
+
_hover: "primary.text"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}), ``),
|
|
101
|
+
children: [/* @__PURE__ */ jsx(IconId, {
|
|
102
|
+
size: 16,
|
|
103
|
+
stroke: 1.8
|
|
104
|
+
}), linksCount > 0 && /* @__PURE__ */ jsxs(HStack, {
|
|
105
|
+
gap: "0.5",
|
|
106
|
+
children: [/* @__PURE__ */ jsx(IconLink, {
|
|
107
|
+
size: 14,
|
|
108
|
+
stroke: 2
|
|
109
|
+
}), /* @__PURE__ */ jsx(Box$1, {
|
|
110
|
+
css: {
|
|
111
|
+
fontSize: "xxs",
|
|
112
|
+
fontWeight: "bold",
|
|
113
|
+
lineHeight: "1",
|
|
114
|
+
opacity: "0.7"
|
|
115
|
+
},
|
|
116
|
+
children: linksCount
|
|
117
|
+
})]
|
|
118
|
+
})]
|
|
119
|
+
});
|
|
120
|
+
//#endregion
|
|
121
|
+
export { ViewDetailsButton };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { DetailsControls } from './DetailsControls';
|
|
2
1
|
export { LayoutWarning } from './LayoutWarning';
|
|
3
2
|
export { LogoButton } from './LogoButton';
|
|
4
3
|
export { NavigationButtons } from './NavigationButtons';
|
|
5
4
|
export { OpenSource } from './OpenSource';
|
|
6
5
|
export { SearchControl } from './SearchControl';
|
|
7
6
|
export { ToggleReadonly } from './ToggleReadonly';
|
|
7
|
+
export { ViewDetailsButton } from './ViewDetailsButton';
|