@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
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
import { DiagramActorSnapshot } from '../likec4diagram/state/types';
|
|
2
2
|
import type * as t from '@likec4/core/types';
|
|
3
|
-
declare
|
|
3
|
+
export declare function selectCompareLayoutState({ context }: DiagramActorSnapshot): {
|
|
4
4
|
isEnabled: false;
|
|
5
|
-
hasEditor:
|
|
5
|
+
hasEditor: boolean;
|
|
6
6
|
isEditable: false;
|
|
7
|
-
|
|
8
|
-
drifts:
|
|
7
|
+
state: 'inactive';
|
|
8
|
+
drifts: null;
|
|
9
9
|
canApplyLatest: boolean;
|
|
10
10
|
layout: t.LayoutType;
|
|
11
11
|
} | {
|
|
12
12
|
isEnabled: true;
|
|
13
13
|
hasEditor: boolean;
|
|
14
14
|
isEditable: boolean;
|
|
15
|
-
|
|
15
|
+
state: 'comparing' | 'inactive';
|
|
16
16
|
drifts: readonly [t.LayoutedViewDriftReason, ...t.LayoutedViewDriftReason[]];
|
|
17
17
|
canApplyLatest: boolean;
|
|
18
18
|
layout: t.LayoutType;
|
|
19
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Current manual-layout comparison state exposed by {@link useDiagramCompareLayout}.
|
|
22
|
+
*/
|
|
20
23
|
export type DiagramCompareLayoutState = ReturnType<typeof selectCompareLayoutState>;
|
|
24
|
+
/**
|
|
25
|
+
* Manual-layout actions exposed by {@link useDiagramCompareLayout}.
|
|
26
|
+
*/
|
|
21
27
|
export type DiagramCompareLayoutOps = {
|
|
22
28
|
/**
|
|
23
29
|
* Toggles the compare mode on or off.
|
|
@@ -36,8 +42,12 @@ export type DiagramCompareLayoutOps = {
|
|
|
36
42
|
*/
|
|
37
43
|
resetManualLayout: () => void;
|
|
38
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* Controls LikeC4's manual-layout comparison from custom diagram children.
|
|
47
|
+
*
|
|
48
|
+
* The hook must be called by a component rendered inside {@link LikeC4Diagram}.
|
|
49
|
+
*/
|
|
39
50
|
export declare function useDiagramCompareLayout(): [
|
|
40
51
|
DiagramCompareLayoutState,
|
|
41
52
|
DiagramCompareLayoutOps
|
|
42
53
|
];
|
|
43
|
-
export {};
|
|
@@ -1,33 +1,40 @@
|
|
|
1
1
|
import "../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { useCallbackRef } from "./useCallbackRef.js";
|
|
3
3
|
import { useDiagramActorRef } from "./safeContext.js";
|
|
4
|
+
import { typedSystem } from "../likec4diagram/state/utils.js";
|
|
4
5
|
import { deriveToggledFeatures } from "../likec4diagram/state/machine.setup.js";
|
|
5
6
|
import { shallowEqual } from "fast-equals";
|
|
6
7
|
import { nonNullable } from "@likec4/core";
|
|
7
8
|
import { useSelector } from "@xstate/react";
|
|
8
9
|
//#region src/hooks/useDiagramCompareLayout.ts
|
|
9
|
-
|
|
10
|
+
function selectCompareLayoutState({ context }) {
|
|
11
|
+
const hasEditor = context.features.enableEditor;
|
|
10
12
|
const drifts = context.view.drifts ?? null;
|
|
11
13
|
if (!context.features.enableCompareWithLatest || !drifts || drifts.length === 0) return {
|
|
12
|
-
hasEditor
|
|
14
|
+
hasEditor,
|
|
13
15
|
isEnabled: false,
|
|
14
16
|
isEditable: false,
|
|
15
|
-
|
|
17
|
+
state: "inactive",
|
|
16
18
|
drifts: null,
|
|
17
19
|
canApplyLatest: false,
|
|
18
20
|
layout: context.view._layout ?? "auto"
|
|
19
21
|
};
|
|
20
22
|
const { enableCompareWithLatest, enableReadOnly } = deriveToggledFeatures(context);
|
|
21
23
|
return {
|
|
22
|
-
hasEditor
|
|
24
|
+
hasEditor,
|
|
23
25
|
isEnabled: true,
|
|
24
|
-
isEditable: !enableReadOnly,
|
|
25
|
-
|
|
26
|
+
isEditable: !enableReadOnly && hasEditor,
|
|
27
|
+
state: enableCompareWithLatest === true ? "comparing" : "inactive",
|
|
26
28
|
drifts,
|
|
27
|
-
canApplyLatest: !drifts.includes("type-changed"),
|
|
29
|
+
canApplyLatest: hasEditor && !drifts.includes("type-changed"),
|
|
28
30
|
layout: context.view._layout ?? "auto"
|
|
29
31
|
};
|
|
30
|
-
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Controls LikeC4's manual-layout comparison from custom diagram children.
|
|
35
|
+
*
|
|
36
|
+
* The hook must be called by a component rendered inside {@link LikeC4Diagram}.
|
|
37
|
+
*/
|
|
31
38
|
function useDiagramCompareLayout() {
|
|
32
39
|
const actorRef = useDiagramActorRef();
|
|
33
40
|
const state = useSelector(actorRef, selectCompareLayoutState, shallowEqual);
|
|
@@ -47,8 +54,8 @@ function useDiagramCompareLayout() {
|
|
|
47
54
|
console.warn("Compare with latest feature is not enabled");
|
|
48
55
|
return;
|
|
49
56
|
}
|
|
50
|
-
const nextIsActive = force ? force === "on" :
|
|
51
|
-
if (state.
|
|
57
|
+
const nextIsActive = force ? force === "on" : state.state === "inactive";
|
|
58
|
+
if (state.state === "comparing" && !nextIsActive && state.layout === "auto") switchLayout("manual");
|
|
52
59
|
actorRef.send({
|
|
53
60
|
type: "toggle.feature",
|
|
54
61
|
feature: "CompareWithLatest",
|
|
@@ -57,10 +64,6 @@ function useDiagramCompareLayout() {
|
|
|
57
64
|
}),
|
|
58
65
|
switchLayout,
|
|
59
66
|
resetManualLayout: useCallbackRef(() => {
|
|
60
|
-
if (!state.isEnabled) {
|
|
61
|
-
console.warn("Compare with latest feature is not enabled");
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
67
|
actorRef.send({ type: "layout.resetManualLayout" });
|
|
65
68
|
}),
|
|
66
69
|
applyLatestToManual: useCallbackRef(() => {
|
|
@@ -68,8 +71,8 @@ function useDiagramCompareLayout() {
|
|
|
68
71
|
console.warn("Compare with latest feature is not enabled");
|
|
69
72
|
return;
|
|
70
73
|
}
|
|
71
|
-
nonNullable(actorRef.system
|
|
72
|
-
if (state.
|
|
74
|
+
nonNullable(typedSystem(actorRef.system).editorActorRef, "editor actor not found").send({ type: "change.latest-to-manual" });
|
|
75
|
+
if (state.state === "comparing") actorRef.send({
|
|
73
76
|
type: "toggle.feature",
|
|
74
77
|
feature: "CompareWithLatest",
|
|
75
78
|
forceValue: false
|
|
@@ -78,4 +81,4 @@ function useDiagramCompareLayout() {
|
|
|
78
81
|
}];
|
|
79
82
|
}
|
|
80
83
|
//#endregion
|
|
81
|
-
export { useDiagramCompareLayout };
|
|
84
|
+
export { selectCompareLayoutState, useDiagramCompareLayout };
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import "../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import {
|
|
2
|
+
import { selectDiagramSnapshot, useDiagramSelector } from "./safeContext.js";
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
4
|
import "@mantine/hooks";
|
|
5
5
|
//#region src/hooks/useEditorActor.ts
|
|
6
|
-
var select =
|
|
7
|
-
return s.children.editor ?? null;
|
|
8
|
-
});
|
|
6
|
+
var select = selectDiagramSnapshot((s) => s.children.editor ?? null, Object.is);
|
|
9
7
|
function useEditorActorRef() {
|
|
10
|
-
return
|
|
8
|
+
return useDiagramSelector(select);
|
|
11
9
|
}
|
|
12
10
|
function useEditorActorStateHasTag(tag) {
|
|
13
11
|
const editorActor = useEditorActorRef();
|
|
@@ -16,10 +16,15 @@ function useLikeC4ViewModel(viewId) {
|
|
|
16
16
|
return useLikeC4Model().view(viewId);
|
|
17
17
|
}
|
|
18
18
|
function useLikeC4Specification() {
|
|
19
|
-
const _specification =
|
|
20
|
-
const [specification, setSpecification] = useState(_specification
|
|
19
|
+
const _specification = useOptionalLikeC4Model()?.specification ?? null;
|
|
20
|
+
const [specification, setSpecification] = useState(() => _specification ?? {
|
|
21
|
+
elements: {},
|
|
22
|
+
deployments: {},
|
|
23
|
+
relationships: {},
|
|
24
|
+
tags: {}
|
|
25
|
+
});
|
|
21
26
|
useEffect(() => {
|
|
22
|
-
setSpecification((current) => deepEqual(current, _specification) ? current : _specification);
|
|
27
|
+
if (_specification) setSpecification((current) => deepEqual(current, _specification) ? current : _specification);
|
|
23
28
|
}, [_specification]);
|
|
24
29
|
return specification;
|
|
25
30
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProjectId } from '@likec4/core/types';
|
|
2
2
|
import { LikeC4ProjectsContext } from '../context/LikeC4ProjectsContext';
|
|
3
|
+
import { LikeC4ProjectData } from '../LikeC4ProjectsProvider';
|
|
3
4
|
export declare function useLikeC4ProjectsContext(): LikeC4ProjectsContext;
|
|
4
5
|
/**
|
|
5
6
|
* @returns The list of available projects, or empty array if no projects are available.
|
|
6
7
|
*/
|
|
7
|
-
export declare function useLikeC4Projects(): ReadonlyArray<
|
|
8
|
+
export declare function useLikeC4Projects(): ReadonlyArray<LikeC4ProjectData>;
|
|
8
9
|
/**
|
|
9
10
|
* @returns The callback to change current project, or a no-op if no LikeC4ProjectsProvider is found.
|
|
10
11
|
*/
|
|
@@ -22,4 +23,4 @@ export declare function useLikeC4ProjectId(): ProjectId;
|
|
|
22
23
|
* Requires LikeC4ModelProvider in the tree.
|
|
23
24
|
* Falls back to model's project if LikeC4ProjectsProvider is not available.
|
|
24
25
|
*/
|
|
25
|
-
export declare function useLikeC4Project():
|
|
26
|
+
export declare function useLikeC4Project(): LikeC4ProjectData;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { OverlaysActorRef } from '../overlays/overlaysActor';
|
|
2
|
-
export declare function useOverlaysActorRef(): OverlaysActorRef;
|
|
2
|
+
export declare function useOverlaysActorRef(): OverlaysActorRef | null;
|
|
@@ -13,7 +13,8 @@ var depsShallowEqual = (d1, d2) => {
|
|
|
13
13
|
return true;
|
|
14
14
|
};
|
|
15
15
|
function useUpdateEffect$1(callback, deps, equalityFn, effectHook) {
|
|
16
|
-
|
|
16
|
+
const isFirstMount = useFirstMountState();
|
|
17
|
+
useCustomCompareEffect(isFirstMount ? noop : callback, deps, equalityFn ?? depsShallowEqual, effectHook);
|
|
17
18
|
}
|
|
18
19
|
__name(useUpdateEffect$1, "useUpdateEffect");
|
|
19
20
|
//#endregion
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
export { IconRendererProvider } from './context/IconRenderer';
|
|
1
|
+
export { DefaultIconRenderer, IconRendererProvider } from './context/IconRenderer';
|
|
2
|
+
export { MaxZoom, MinZoom } from './base/const';
|
|
2
3
|
export { LikeC4Diagram, type LikeC4DiagramProps, } from './LikeC4Diagram';
|
|
3
4
|
export type { ElementIconRenderer, ElementIconRendererProps, LikeC4ColorScheme, NodeRenderers, OnCanvasClick, OnEdgeClick, OnInitialized, OnNavigateTo, OnNodeClick, OnOpenSource, PaddingWithUnit, ViewPadding, ViewPaddings, WhereOperator, } from './LikeC4Diagram.props';
|
|
4
5
|
export { LikeC4ModelProvider, type LikeC4ModelProviderProps, } from './LikeC4ModelProvider';
|
|
5
6
|
export { LikeC4EditorProvider, type LikeC4EditorProviderProps, } from './editor/LikeC4EditorProvider';
|
|
6
|
-
export { createLikeC4Editor, type LikeC4EditorCallbacks, } from './editor/LikeC4EditorCallbacks';
|
|
7
|
+
export { createLikeC4Editor, type LikeC4EditorCallbacks, type LikeC4EditorChangeResult, } from './editor/LikeC4EditorCallbacks';
|
|
7
8
|
export { LikeC4ProjectsProvider, type LikeC4ProjectsProviderProps, } from './LikeC4ProjectsProvider';
|
|
8
9
|
export { type DiagramApi, type DiagramContext, selectDiagramContext, selectDiagramSnapshot, useDiagram, useDiagramContext, useDiagramSelector, useOnDiagramEvent, } from './hooks/useDiagram';
|
|
9
|
-
export {
|
|
10
|
+
export { type DiagramCompareLayoutOps, type DiagramCompareLayoutState, useDiagramCompareLayout, } from './hooks/useDiagramCompareLayout';
|
|
11
|
+
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel, useOptionalLikeC4Model, } from './hooks/useLikeC4Model';
|
|
10
12
|
export { type CurrentViewModel, useCurrentViewModel, useOptionalCurrentViewModel, } from './hooks/useCurrentViewModel';
|
|
11
13
|
export { useChangeLikeC4Project, useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext, } from './hooks/useLikeC4Project';
|
|
12
14
|
export { useLikeC4Styles } from './hooks/useLikeC4Styles';
|
|
@@ -22,5 +24,5 @@ export { LikeC4ProjectsOverview, type LikeC4ProjectsOverviewProps, } from './Lik
|
|
|
22
24
|
export { normalizeSearch, SearchContext, type SearchContextValue, useSearchContext, } from './search/SearchContext';
|
|
23
25
|
export { bodyCss as searchBodyCss, dialogCss as searchDialogCss, SearchPanelContent, } from './search/Search';
|
|
24
26
|
export { SearchControl } from './components/SearchControl';
|
|
25
|
-
export { DefaultMantineProvider } from './
|
|
27
|
+
export { DefaultMantineProvider, LikeC4MantineProvider } from './LikeC4MantineProvider';
|
|
26
28
|
export { FramerMotionConfig } from './context/FramerMotionConfig';
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { IconRendererProvider } from "./context/IconRenderer.js";
|
|
1
|
+
import { DefaultIconRenderer, IconRendererProvider } from "./context/IconRenderer.js";
|
|
2
|
+
import { MaxZoom, MinZoom } from "./base/const.js";
|
|
2
3
|
import { useUpdateEffect } from "./hooks/useUpdateEffect.js";
|
|
3
|
-
import { DefaultMantineProvider } from "./
|
|
4
|
+
import { DefaultMantineProvider, LikeC4MantineProvider } from "./LikeC4MantineProvider.js";
|
|
4
5
|
import { FramerMotionConfig } from "./context/FramerMotionConfig.js";
|
|
5
6
|
import { selectDiagramContext, selectDiagramSnapshot, useDiagram, useDiagramSelector } from "./hooks/safeContext.js";
|
|
6
7
|
import { useDiagramContext, useOnDiagramEvent } from "./hooks/useDiagram.js";
|
|
7
8
|
import { useCurrentView, useCurrentViewId } from "./hooks/useCurrentView.js";
|
|
8
|
-
import { useOptionalCurrentViewModel } from "./context/LikeC4ModelContext.js";
|
|
9
|
+
import { useOptionalCurrentViewModel, useOptionalLikeC4Model } from "./context/LikeC4ModelContext.js";
|
|
9
10
|
import { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel } from "./hooks/useLikeC4Model.js";
|
|
11
|
+
import { useLikeC4Styles } from "./hooks/useLikeC4Styles.js";
|
|
10
12
|
import { createLikeC4Editor } from "./editor/LikeC4EditorCallbacks.js";
|
|
11
13
|
import { LikeC4EditorProvider } from "./editor/LikeC4EditorProvider.js";
|
|
14
|
+
import { pickViewBounds } from "./utils/view-bounds.js";
|
|
12
15
|
import { useCurrentViewModel } from "./hooks/useCurrentViewModel.js";
|
|
13
16
|
import { useChangeLikeC4Project, useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext } from "./hooks/useLikeC4Project.js";
|
|
14
|
-
import {
|
|
15
|
-
import { pickViewBounds } from "./utils/view-bounds.js";
|
|
17
|
+
import { useDiagramCompareLayout } from "./hooks/useDiagramCompareLayout.js";
|
|
16
18
|
import { SearchContext, normalizeSearch, useSearchContext } from "./search/SearchContext.js";
|
|
17
19
|
import { SearchPanelContent, bodyCss, dialogCss } from "./search/Search.js";
|
|
18
20
|
import { LikeC4Diagram } from "./LikeC4Diagram.js";
|
|
@@ -23,4 +25,4 @@ import { LikeC4View } from "./LikeC4View.js";
|
|
|
23
25
|
import { ReactLikeC4 } from "./ReactLikeC4.js";
|
|
24
26
|
import { LikeC4ProjectsOverview } from "./LikeC4ProjectsOverview.js";
|
|
25
27
|
import { SearchControl } from "./components/SearchControl.js";
|
|
26
|
-
export { DefaultMantineProvider, FramerMotionConfig, IconRendererProvider, LikeC4Diagram, LikeC4EditorProvider, LikeC4ModelProvider, LikeC4ProjectsOverview, LikeC4ProjectsProvider, LikeC4View, ReactLikeC4, SearchContext, SearchControl, SearchPanelContent, StaticLikeC4Diagram, createLikeC4Editor, normalizeSearch, pickViewBounds, bodyCss as searchBodyCss, dialogCss as searchDialogCss, selectDiagramContext, selectDiagramSnapshot, useChangeLikeC4Project, useCurrentView, useCurrentViewId, useCurrentViewModel, useDiagram, useDiagramContext, useDiagramSelector, useHasProjects, useLikeC4Model, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext, useLikeC4Specification, useLikeC4Styles, useLikeC4ViewModel, useOnDiagramEvent, useOptionalCurrentViewModel, useSearchContext, useUpdateEffect };
|
|
28
|
+
export { DefaultIconRenderer, DefaultMantineProvider, FramerMotionConfig, IconRendererProvider, LikeC4Diagram, LikeC4EditorProvider, LikeC4MantineProvider, LikeC4ModelProvider, LikeC4ProjectsOverview, LikeC4ProjectsProvider, LikeC4View, MaxZoom, MinZoom, ReactLikeC4, SearchContext, SearchControl, SearchPanelContent, StaticLikeC4Diagram, createLikeC4Editor, normalizeSearch, pickViewBounds, bodyCss as searchBodyCss, dialogCss as searchDialogCss, selectDiagramContext, selectDiagramSnapshot, useChangeLikeC4Project, useCurrentView, useCurrentViewId, useCurrentViewModel, useDiagram, useDiagramCompareLayout, useDiagramContext, useDiagramSelector, useHasProjects, useLikeC4Model, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext, useLikeC4Specification, useLikeC4Styles, useLikeC4ViewModel, useOnDiagramEvent, useOptionalCurrentViewModel, useOptionalLikeC4Model, useSearchContext, useUpdateEffect };
|
|
@@ -32,10 +32,11 @@ var LikeC4DiagramUI = memo(() => {
|
|
|
32
32
|
const { enableControls, enableNotations, enableSearch, enableRelationshipDetails, enableReadOnly, enableCompareWithLatest } = useEnabledFeatures();
|
|
33
33
|
const rerender = useRerender();
|
|
34
34
|
const { isSequenceView, isActiveWalkthrough, ...actors } = useDiagramSelector(selectChildren);
|
|
35
|
+
const handleReset = useCallback(() => {
|
|
36
|
+
rerender();
|
|
37
|
+
}, []);
|
|
35
38
|
return /* @__PURE__ */ jsxs(ErrorBoundary, {
|
|
36
|
-
onReset:
|
|
37
|
-
rerender();
|
|
38
|
-
}, []),
|
|
39
|
+
onReset: handleReset,
|
|
39
40
|
children: [
|
|
40
41
|
isSequenceView && /* @__PURE__ */ jsx(FloatingSequenceActors, { isActiveWalkthrough }),
|
|
41
42
|
isActiveWalkthrough && /* @__PURE__ */ jsx(SequenceOutlinePanel, {}),
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import { Viewport } from '@xyflow/system';
|
|
1
2
|
import { PropsWithChildren } from 'react';
|
|
2
3
|
import { JSX } from 'react/jsx-runtime';
|
|
3
4
|
import { Simplify } from 'type-fest';
|
|
4
5
|
import { LikeC4DiagramProperties } from '../LikeC4Diagram.props';
|
|
6
|
+
export declare function resolveControlledViewport(enableFitView: boolean, initialZoom: number | undefined, bounds: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}): Viewport | undefined;
|
|
10
|
+
export declare function resolveInteractionEnabled(enabled: boolean, override: boolean | undefined, isEditorBusy: boolean): boolean;
|
|
5
11
|
export type LikeC4DiagramXYFlowProps = PropsWithChildren<Simplify<Pick<LikeC4DiagramProperties<any>, 'background' | 'reactFlowProps' | 'renderNodes'>>>;
|
|
6
12
|
export declare function LikeC4DiagramXYFlow({ background, reactFlowProps, children, renderNodes, }: LikeC4DiagramXYFlowProps): JSX.Element;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { __name } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { IS_SERVER } from "../base/const.js";
|
|
2
3
|
import { useCallbackRef as useCallbackRef$1 } from "../hooks/useCallbackRef.js";
|
|
3
4
|
import { depsShallowEqual, useUpdateEffect as useUpdateEffect$1 } from "../hooks/useUpdateEffect.js";
|
|
4
|
-
import { MinZoom } from "../base/const.js";
|
|
5
5
|
import { BaseXYFlow } from "../base/BaseXYFlow.js";
|
|
6
6
|
import { useRootContainer } from "../context/RootContainerContext.js";
|
|
7
7
|
import { useDiagramEventHandlers } from "../context/DiagramEventHandlers.js";
|
|
8
8
|
import { selectDiagramSnapshot, useDiagram, useDiagramSelector } from "../hooks/safeContext.js";
|
|
9
9
|
import { viewBounds } from "./state/utils.js";
|
|
10
10
|
import { deriveToggledFeatures } from "./state/machine.setup.js";
|
|
11
|
+
import { useEditorActorStateHasTag } from "../hooks/useEditorActor.js";
|
|
11
12
|
import { BuiltinEdges, BuiltinNodes } from "./custom/index.js";
|
|
12
13
|
import { useLayoutConstraints } from "./useLayoutConstraints.js";
|
|
13
14
|
import { cx } from "@likec4/styles/css";
|
|
@@ -46,41 +47,50 @@ function prepareNodeTypes(nodeTypes) {
|
|
|
46
47
|
"seq-subflow": nodeTypes.seqSubflow ?? builtinNodes["seq-subflow"]
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
function resolveControlledViewport(enableFitView, initialZoom, bounds) {
|
|
51
|
+
if (enableFitView || initialZoom !== void 0) return;
|
|
51
52
|
return {
|
|
52
53
|
x: -bounds.x,
|
|
53
54
|
y: -bounds.y,
|
|
54
55
|
zoom: 1
|
|
55
56
|
};
|
|
56
|
-
}
|
|
57
|
+
}
|
|
58
|
+
function resolveInteractionEnabled(enabled, override, isEditorBusy) {
|
|
59
|
+
return (override ?? enabled) && !isEditorBusy;
|
|
60
|
+
}
|
|
57
61
|
var selectXYProps = selectDiagramSnapshot(({ context: ctx, children }) => {
|
|
58
62
|
const { enableReadOnly } = deriveToggledFeatures(ctx);
|
|
63
|
+
const controlledViewport = resolveControlledViewport(ctx.features.enableFitView, ctx.initialZoom, viewBounds(ctx));
|
|
59
64
|
const editorSnapshot = enableReadOnly ? null : children.editor?.getSnapshot();
|
|
60
65
|
const isNotEditingEdge = enableReadOnly || editorSnapshot?.context.editing?.subject !== "edge";
|
|
61
|
-
|
|
62
|
-
let nodesDraggable = !enableReadOnly && ctx.nodesDraggable && !isEditorBusy;
|
|
66
|
+
let nodesDraggable = !enableReadOnly && ctx.nodesDraggable;
|
|
63
67
|
if (ctx.dynamicViewVariant === "sequence" && ctx.view._type === "dynamic") nodesDraggable = false;
|
|
64
68
|
return {
|
|
65
69
|
enableReadOnly,
|
|
66
|
-
initialized: ctx.initialized.xydata && ctx.initialized.xyflow,
|
|
70
|
+
initialized: IS_SERVER || ctx.initialized.xydata && ctx.initialized.xyflow,
|
|
67
71
|
nodes: ctx.xynodes,
|
|
68
72
|
edges: ctx.xyedges,
|
|
69
73
|
pannable: ctx.pannable,
|
|
70
74
|
zoomable: ctx.zoomable,
|
|
75
|
+
minZoom: ctx.minZoom,
|
|
76
|
+
maxZoom: ctx.maxZoom,
|
|
71
77
|
nodesDraggable,
|
|
72
|
-
nodesSelectable: ctx.nodesSelectable && isNotEditingEdge
|
|
78
|
+
nodesSelectable: ctx.nodesSelectable && isNotEditingEdge,
|
|
73
79
|
fitViewPadding: ctx.fitViewPadding,
|
|
74
80
|
enableFitView: ctx.features.enableFitView,
|
|
75
|
-
enableControls: ctx.features.enableControls
|
|
76
|
-
|
|
81
|
+
enableControls: ctx.features.enableControls,
|
|
82
|
+
...controlledViewport && { viewport: controlledViewport }
|
|
77
83
|
};
|
|
78
84
|
}, ({ nodes: aNodes, edges: aEdges, ...a }, { nodes: bNodes, edges: bEdges, ...b }) => {
|
|
79
85
|
return shallowEqual(a, b) && shallowEqual(aNodes, bNodes) && shallowEqual(aEdges, bEdges);
|
|
80
86
|
});
|
|
81
87
|
function LikeC4DiagramXYFlow({ background = "dots", reactFlowProps = {}, children, renderNodes }) {
|
|
88
|
+
const { nodesDraggable: nodesDraggableOverride, elementsSelectable: nodesSelectableOverride, ...safeReactFlowProps } = reactFlowProps;
|
|
82
89
|
const diagram = useDiagram();
|
|
83
90
|
let { enableReadOnly, initialized, nodes, edges, enableFitView, nodesDraggable, nodesSelectable, enableControls, ...props } = useDiagramSelector(selectXYProps);
|
|
91
|
+
const isEditorBusy = useEditorActorStateHasTag("busy");
|
|
92
|
+
nodesDraggable = resolveInteractionEnabled(nodesDraggable, nodesDraggableOverride, isEditorBusy);
|
|
93
|
+
nodesSelectable = resolveInteractionEnabled(nodesSelectable, nodesSelectableOverride, isEditorBusy);
|
|
84
94
|
const { onNodeContextMenu, onCanvasContextMenu, onEdgeContextMenu, onNodeClick, onEdgeClick, onCanvasClick, onCanvasDblClick } = useDiagramEventHandlers();
|
|
85
95
|
const { reducedGraphics, $panning } = useRootContainer();
|
|
86
96
|
const isReducedGraphics = reducedGraphics;
|
|
@@ -234,27 +244,31 @@ function LikeC4DiagramXYFlow({ background = "dots", reactFlowProps = {}, childre
|
|
|
234
244
|
}),
|
|
235
245
|
...onCanvasContextMenu && { onPaneContextMenu: onCanvasContextMenu },
|
|
236
246
|
...enableFitView && { onViewportResize },
|
|
237
|
-
nodesDraggable,
|
|
238
|
-
nodesSelectable,
|
|
239
247
|
nodesFocusable: true,
|
|
240
248
|
edgesFocusable: true,
|
|
241
249
|
elevateEdgesOnSelect: !enableReadOnly,
|
|
242
250
|
zIndexMode: "manual",
|
|
243
251
|
...nodesDraggable && layoutConstraints,
|
|
244
252
|
...props,
|
|
245
|
-
...
|
|
246
|
-
|
|
253
|
+
...safeReactFlowProps,
|
|
254
|
+
nodesDraggable,
|
|
255
|
+
nodesSelectable,
|
|
256
|
+
children: [enableControls && /* @__PURE__ */ jsx(Controls$1, {
|
|
257
|
+
fitViewPadding: props.fitViewPadding,
|
|
258
|
+
minZoom: props.minZoom,
|
|
259
|
+
maxZoom: props.maxZoom
|
|
260
|
+
}), children]
|
|
247
261
|
});
|
|
248
262
|
}
|
|
249
|
-
var Controls$1 = /* @__PURE__ */ __name(({
|
|
263
|
+
var Controls$1 = /* @__PURE__ */ __name(({ fitViewPadding, minZoom, maxZoom }) => /* @__PURE__ */ jsx(Controls, {
|
|
250
264
|
showInteractive: false,
|
|
251
265
|
fitViewOptions: {
|
|
252
|
-
padding,
|
|
253
|
-
minZoom
|
|
254
|
-
maxZoom: 1,
|
|
266
|
+
padding: fitViewPadding,
|
|
267
|
+
minZoom,
|
|
268
|
+
maxZoom: Math.min(maxZoom, 1),
|
|
255
269
|
duration: 350
|
|
256
270
|
},
|
|
257
271
|
position: "bottom-left"
|
|
258
272
|
}), "Controls");
|
|
259
273
|
//#endregion
|
|
260
|
-
export { LikeC4DiagramXYFlow };
|
|
274
|
+
export { LikeC4DiagramXYFlow, resolveControlledViewport, resolveInteractionEnabled };
|
|
@@ -8,13 +8,13 @@ function EdgeDrifts({ edgeProps: { data }, svgPath }) {
|
|
|
8
8
|
return /* @__PURE__ */ jsx("path", {
|
|
9
9
|
className: cx("react-flow__edge-path", css({
|
|
10
10
|
pointerEvents: "none",
|
|
11
|
-
stroke: "likec4.compare.
|
|
11
|
+
stroke: "likec4.compare.outline",
|
|
12
12
|
fill: "none",
|
|
13
13
|
strokeWidth: {
|
|
14
|
-
base: "8px",
|
|
15
|
-
_whenHovered: "12px"
|
|
14
|
+
base: "[8px]",
|
|
15
|
+
_whenHovered: "[12px]"
|
|
16
16
|
},
|
|
17
|
-
strokeOpacity: .5
|
|
17
|
+
strokeOpacity: "0.5"
|
|
18
18
|
})),
|
|
19
19
|
d: svgPath,
|
|
20
20
|
strokeLinecap: "round"
|
|
@@ -240,7 +240,7 @@ var RelationshipEdge = memoEdge((props) => {
|
|
|
240
240
|
} : void 0;
|
|
241
241
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(EdgeContainer, {
|
|
242
242
|
...props,
|
|
243
|
-
className: css({ "& .react-flow__edge-interaction": { cursor: enabledEditing && selected ? "copy" :
|
|
243
|
+
className: css({ "& .react-flow__edge-interaction": { cursor: enabledEditing && selected ? "[copy]" : "inherit" } }),
|
|
244
244
|
children: [
|
|
245
245
|
/* @__PURE__ */ jsx(EdgePath, {
|
|
246
246
|
edgeProps: props,
|
|
@@ -362,9 +362,7 @@ function ControlPoints({ isControlPointDragging, edgeProps, controlPoints, onMov
|
|
|
362
362
|
addSelectedEdges([edgeId]);
|
|
363
363
|
onLmbControlPointerDown(index, e, domNode);
|
|
364
364
|
break;
|
|
365
|
-
case 2:
|
|
366
|
-
onRmbControlPointerDown(index, e);
|
|
367
|
-
break;
|
|
365
|
+
case 2: onRmbControlPointerDown(index, e);
|
|
368
366
|
}
|
|
369
367
|
});
|
|
370
368
|
const onControlPointerDblClick = useCallbackRef((e) => {
|
|
@@ -37,9 +37,7 @@ function SequenceStepEdge(props) {
|
|
|
37
37
|
case isBack:
|
|
38
38
|
labelX = props.sourceX - LABEL_OFFSET;
|
|
39
39
|
break;
|
|
40
|
-
default:
|
|
41
|
-
labelX = props.sourceX + LABEL_OFFSET;
|
|
42
|
-
break;
|
|
40
|
+
default: labelX = props.sourceX + LABEL_OFFSET;
|
|
43
41
|
}
|
|
44
42
|
const { state, stepnum } = props.data;
|
|
45
43
|
return /* @__PURE__ */ jsxs(EdgeContainer, {
|
|
@@ -19,28 +19,28 @@ var labelDraggable = css({
|
|
|
19
19
|
var controlPoint = css({
|
|
20
20
|
fill: `[var(--xy-edge-stroke)]`,
|
|
21
21
|
stroke: `transparent`,
|
|
22
|
-
fillOpacity: .5,
|
|
23
|
-
strokeWidth: 10,
|
|
24
|
-
r: 4,
|
|
22
|
+
fillOpacity: "0.5",
|
|
23
|
+
strokeWidth: "[10]",
|
|
24
|
+
r: "[4]",
|
|
25
25
|
cursor: "grab",
|
|
26
26
|
pointerEvents: "all",
|
|
27
27
|
visibility: "hidden",
|
|
28
|
-
transitionDuration: "
|
|
29
|
-
transitionProperty: "visibility, fill, fill-opacity, r",
|
|
28
|
+
transitionDuration: "fast",
|
|
29
|
+
transitionProperty: "[visibility, fill, fill-opacity, r]",
|
|
30
30
|
transitionTimingFunction: "inOut",
|
|
31
|
-
transitionDelay: "20ms",
|
|
31
|
+
transitionDelay: "[20ms]",
|
|
32
32
|
[`:where([data-likec4-selected='true'], [data-likec4-hovered='true']) &`]: {
|
|
33
33
|
visibility: "visible",
|
|
34
|
-
fillOpacity: 1,
|
|
34
|
+
fillOpacity: "1",
|
|
35
35
|
transitionTimingFunction: "out",
|
|
36
|
-
transitionDelay: "
|
|
36
|
+
transitionDelay: "0"
|
|
37
37
|
},
|
|
38
|
-
[`:where([data-likec4-selected='true']) &`]: { r: 6 },
|
|
39
|
-
[`:is([data-likec4-hovered='true']) &`]: { r: 8 },
|
|
38
|
+
[`:where([data-likec4-selected='true']) &`]: { r: "[6]" },
|
|
39
|
+
[`:is([data-likec4-hovered='true']) &`]: { r: "[8]" },
|
|
40
40
|
_hover: {
|
|
41
|
-
fill: "
|
|
42
|
-
r: 10,
|
|
43
|
-
transitionDuration: "
|
|
41
|
+
fill: "primary.body.hover",
|
|
42
|
+
r: "[10]",
|
|
43
|
+
transitionDuration: "fastest"
|
|
44
44
|
},
|
|
45
45
|
_groupActive: { cursor: "grabbing" }
|
|
46
46
|
});
|
|
@@ -38,7 +38,7 @@ function useRelationshipEdgePath({ props: { sourceX, sourceY, source, target, ta
|
|
|
38
38
|
height: targetNodeHeight
|
|
39
39
|
};
|
|
40
40
|
const nodeMargin = 6;
|
|
41
|
-
|
|
41
|
+
const points = data.dir === "back" ? [
|
|
42
42
|
targetCenterPos,
|
|
43
43
|
getNodeIntersectionFromCenterToPoint(targetNd, first(controlPoints) ?? sourceCenterPos, nodeMargin),
|
|
44
44
|
...controlPoints,
|
|
@@ -50,7 +50,8 @@ function useRelationshipEdgePath({ props: { sourceX, sourceY, source, target, ta
|
|
|
50
50
|
...controlPoints,
|
|
51
51
|
getNodeIntersectionFromCenterToPoint(targetNd, last(controlPoints) ?? sourceCenterPos, nodeMargin),
|
|
52
52
|
targetCenterPos
|
|
53
|
-
]
|
|
53
|
+
];
|
|
54
|
+
return nonNullable(curve(points));
|
|
54
55
|
}
|
|
55
56
|
//#endregion
|
|
56
57
|
export { useRelationshipEdgePath };
|
|
@@ -10,8 +10,8 @@ function NodeDrifts({ nodeProps: { data } }) {
|
|
|
10
10
|
css: {
|
|
11
11
|
display: "contents",
|
|
12
12
|
"& + .likec4-element-shape": {
|
|
13
|
-
outlineColor: "likec4.compare.
|
|
14
|
-
outlineWidth: "4px",
|
|
13
|
+
outlineColor: "likec4.compare.outline",
|
|
14
|
+
outlineWidth: "[4px]",
|
|
15
15
|
outlineStyle: "dashed",
|
|
16
16
|
outlineOffset: "1.5"
|
|
17
17
|
}
|
|
@@ -71,7 +71,7 @@ function NodeNotesInternal({ data }) {
|
|
|
71
71
|
layoutId: id,
|
|
72
72
|
className: css({
|
|
73
73
|
position: "absolute",
|
|
74
|
-
zIndex: 300,
|
|
74
|
+
zIndex: "[300]",
|
|
75
75
|
top: "0",
|
|
76
76
|
left: "0",
|
|
77
77
|
display: "flex",
|
|
@@ -84,8 +84,8 @@ function NodeNotesInternal({ data }) {
|
|
|
84
84
|
overflow: "hidden",
|
|
85
85
|
width: "fit-content",
|
|
86
86
|
height: "fit-content",
|
|
87
|
-
maxHeight: "70cqh",
|
|
88
|
-
maxWidth: "50cqw"
|
|
87
|
+
maxHeight: "[70cqh]",
|
|
88
|
+
maxWidth: "[50cqw]"
|
|
89
89
|
}),
|
|
90
90
|
"data-likec4-notes": id,
|
|
91
91
|
style: {
|
|
@@ -204,7 +204,7 @@ function Catch({ data, onCatchClick }) {
|
|
|
204
204
|
css: {
|
|
205
205
|
display: "block",
|
|
206
206
|
position: "absolute",
|
|
207
|
-
zIndex: 200,
|
|
207
|
+
zIndex: "[200]",
|
|
208
208
|
pointerEvents: "all",
|
|
209
209
|
left: "0",
|
|
210
210
|
top: "0",
|
|
@@ -86,7 +86,7 @@ function SequenceActorNode(props) {
|
|
|
86
86
|
transition: "fast",
|
|
87
87
|
translateX: "-1/2",
|
|
88
88
|
translate: "auto",
|
|
89
|
-
zIndex: "
|
|
89
|
+
zIndex: "base"
|
|
90
90
|
}),
|
|
91
91
|
style: {
|
|
92
92
|
backgroundColor: "var(--likec4-palette-stroke)",
|
|
@@ -141,7 +141,7 @@ function SequenceParallelArea(props) {
|
|
|
141
141
|
paddingTop: "0.5",
|
|
142
142
|
fontSize: "xs",
|
|
143
143
|
fontWeight: "bold",
|
|
144
|
-
letterSpacing: ".75px",
|
|
144
|
+
letterSpacing: "[0.75px]",
|
|
145
145
|
color: "[var(--_color)/75]"
|
|
146
146
|
},
|
|
147
147
|
children: "PARALLEL"
|
|
@@ -2,7 +2,6 @@ import "../../../_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import { useDiagram } from "../../../hooks/safeContext.js";
|
|
3
3
|
import { css, cx, sva } from "@likec4/styles/css";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import "@likec4/core";
|
|
6
5
|
import { hstack } from "@likec4/styles/patterns";
|
|
7
6
|
//#region src/likec4diagram/custom/nodes/SequenceSubFlow.tsx
|
|
8
7
|
var labelStyle = css.raw({
|
|
@@ -13,13 +12,17 @@ var labelStyle = css.raw({
|
|
|
13
12
|
letterSpacing: "tight",
|
|
14
13
|
textTransform: "uppercase"
|
|
15
14
|
});
|
|
16
|
-
var withBorder = css.raw({
|
|
15
|
+
var withBorder = css.raw({
|
|
16
|
+
borderWidth: "strong",
|
|
17
|
+
borderStyle: "solid",
|
|
18
|
+
borderColor: "colorPalette.border"
|
|
19
|
+
});
|
|
17
20
|
var withBackground = css.raw({
|
|
18
21
|
background: "colorPalette",
|
|
19
22
|
["&[data-state=\"hovered\"]"]: {
|
|
20
23
|
background: "colorPalette.hovered",
|
|
21
|
-
transition: "
|
|
22
|
-
transitionDelay: "
|
|
24
|
+
transition: "fastest",
|
|
25
|
+
transitionDelay: "fastest",
|
|
23
26
|
transitionTimingFunction: "out",
|
|
24
27
|
transitionProperty: "background"
|
|
25
28
|
},
|
|
@@ -48,7 +51,7 @@ var recipe = sva({
|
|
|
48
51
|
flex: "1",
|
|
49
52
|
color: `[oklch(from {colors.colorPalette.text} l calc(c - 0.15) h)]`,
|
|
50
53
|
fontSize: "xs",
|
|
51
|
-
lineHeight: "
|
|
54
|
+
lineHeight: "xs",
|
|
52
55
|
fontWeight: "medium",
|
|
53
56
|
truncate: true
|
|
54
57
|
})
|