@likec4/diagram 1.59.3 → 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/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 +8 -5
- 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 +11 -8
- 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/actionbtns.css.d.ts +3 -3
- package/dist/base-primitives/compound/actionbtns.css.js +3 -3
- 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/DiagramEventHandlers.js +2 -1
- package/dist/context/EnsureMantine.js +3 -3
- package/dist/context/IconRenderer.d.ts +2 -1
- package/dist/context/IconRenderer.js +38 -2
- package/dist/context/LikeC4ProjectsContext.d.ts +3 -2
- package/dist/context/TagStylesContext.d.ts +9 -3
- package/dist/context/TagStylesContext.js +19 -19
- package/dist/custom/index.d.ts +3 -0
- package/dist/custom/index.js +6 -3
- package/dist/editor/applyChangesToManualLayout.js +4 -1
- 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 +1 -23
- package/dist/hooks/useDiagramCompareLayout.d.ts +4 -4
- package/dist/hooks/useDiagramCompareLayout.js +14 -16
- 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/index.d.ts +4 -3
- package/dist/index.js +6 -5
- package/dist/likec4diagram/DiagramXYFlow.d.ts +5 -0
- package/dist/likec4diagram/DiagramXYFlow.js +20 -13
- package/dist/likec4diagram/custom/edges/EdgeDrifts.js +4 -4
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +1 -1
- package/dist/likec4diagram/custom/edges/edges.css.js +13 -13
- 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 +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +5 -5
- package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +1 -1
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +2 -0
- 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/diagram-api.d.ts +2 -2
- package/dist/likec4diagram/state/diagram-api.js +3 -2
- package/dist/likec4diagram/state/machine.actions.js +9 -6
- 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 +6 -1
- 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 +39 -6
- package/dist/likec4diagram/state/utils.d.ts +1 -1
- package/dist/likec4diagram/state/utils.js +1 -2
- 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 -527
- 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 +9 -12
- 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 +51 -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/ChangeAutoLayoutButton.js +10 -9
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +9 -8
- 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 +9 -36
- 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 +1 -1
- 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 +4 -0
- package/dist/overlays/relationship-details/SelectEdge.css.js +14 -9
- package/dist/overlays/relationship-details/actor.js +1 -1
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +6 -0
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +11 -6
- 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 +1 -1
- package/dist/overlays/relationships-browser/custom/EmptyNode.js +7 -9
- package/dist/projects-overview/actor.js +1 -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 +36 -35
- 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/shadowroot/ShadowRoot.js +2 -3
- package/dist/styles2.js +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +10 -10
- package/panda.buildinfo.json +340 -298
- package/styles-min.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 -224
|
@@ -56,7 +56,7 @@ function _applyChangesToManualLayout(manualView, latestView) {
|
|
|
56
56
|
manual
|
|
57
57
|
});
|
|
58
58
|
if (isBetweenNewLeafNodes(latest)) return removeDrift(latest);
|
|
59
|
-
return makeAsStraightLine(latest, nodesMap.get(latest.source), nodesMap.get(latest.target));
|
|
59
|
+
return makeAsStraightLine(latest, nonNullable(nodesMap.get(latest.source), `Source node ${latest.source} not found in processed nodes`), nonNullable(nodesMap.get(latest.target), `Target node ${latest.target} not found in processed nodes`));
|
|
60
60
|
});
|
|
61
61
|
const bounds = BBox$1.merge(...nodes.filter(isRootNode));
|
|
62
62
|
return produce(latestView, (draft) => {
|
|
@@ -117,6 +117,8 @@ function applyFromManualEdge(edges) {
|
|
|
117
117
|
draft.labelBBox.x = manual.labelBBox.x;
|
|
118
118
|
draft.labelBBox.y = manual.labelBBox.y;
|
|
119
119
|
}
|
|
120
|
+
if (manual.isLabelCustomized === true) draft.isLabelCustomized = true;
|
|
121
|
+
else delete draft.isLabelCustomized;
|
|
120
122
|
draft.drifts = null;
|
|
121
123
|
});
|
|
122
124
|
}
|
|
@@ -137,6 +139,7 @@ function makeAsStraightLine(edge, sourceNode, targetNode) {
|
|
|
137
139
|
if (edge.labelBBox) {
|
|
138
140
|
draft.labelBBox.x = labelPos.x;
|
|
139
141
|
draft.labelBBox.y = labelPos.y;
|
|
142
|
+
if (edge.isLabelCustomized === true) delete draft.isLabelCustomized;
|
|
140
143
|
}
|
|
141
144
|
delete draft.drifts;
|
|
142
145
|
});
|
|
@@ -35,12 +35,16 @@ type SafeContextForActor<A extends AnyActorRef, Snapshot, Context> = {
|
|
|
35
35
|
* and the selected value from the current snapshot. If the comparison returns true,
|
|
36
36
|
* the component will not re-render.
|
|
37
37
|
*/
|
|
38
|
-
selectSnapshot<T>(select: (state: Snapshot) => T, compare?: (old: NoInfer<T>, next: NoInfer<T>) => boolean): SelectAndCompare<Snapshot, T
|
|
38
|
+
selectSnapshot<T>(select: (state: Snapshot) => T, compare?: (old: NoInfer<T>, next: NoInfer<T>) => boolean): SelectAndCompare<Snapshot, T> & {
|
|
39
|
+
Out: T;
|
|
40
|
+
};
|
|
39
41
|
/**
|
|
40
42
|
* @param select - Function to extract a value from the actor's context
|
|
41
43
|
* @param compare - Optional comparison function. If not provided, shallow equality is used.
|
|
42
44
|
*/
|
|
43
|
-
selectContext<T>(select: (state: Context) => T, compare?: (old: NoInfer<T>, next: NoInfer<T>) => boolean): SelectAndCompare<Snapshot, T
|
|
45
|
+
selectContext<T>(select: (state: Context) => T, compare?: (old: NoInfer<T>, next: NoInfer<T>) => boolean): SelectAndCompare<Snapshot, T> & {
|
|
46
|
+
Out: T;
|
|
47
|
+
};
|
|
44
48
|
useActorSelector<T>(select: (state: Snapshot) => T): T;
|
|
45
49
|
useActorSelector<T>(selectorCompare: SelectAndCompare<Snapshot, T>): T;
|
|
46
50
|
useActorSelector<T>(...selectorCompare: SelectAndCompare<Snapshot, T>): T;
|
|
@@ -96,7 +100,9 @@ export declare const DiagramActorContextProvider: Provider<DiagramActorRef>, sel
|
|
|
96
100
|
navigationPanel: ActorRefFromLogic<NavigationPanelActorLogic> | undefined;
|
|
97
101
|
}, "search" | "overlays" | "editor" | "navigationPanel">, "final" | "isReady" | "navigating" | "ready" | "initializing" | {
|
|
98
102
|
ready?: NonNullable<"idle" | "walkthrough" | "focused" | "printing">;
|
|
99
|
-
}, never, never, never, never>, T
|
|
103
|
+
}, never, never, never, never>, T> & {
|
|
104
|
+
Out: T;
|
|
105
|
+
}, selectDiagramContext: <T>(select: (state: DiagramContext) => T, compare?: ((old: NoInfer<T>, next: NoInfer<T>) => boolean) | undefined) => SelectAndCompare< MachineSnapshot<DiagramContext, DiagramEvents, {
|
|
100
106
|
overlays: OverlaysActorRef | undefined;
|
|
101
107
|
search: SearchActorRef | undefined;
|
|
102
108
|
editor: BaseEditorActorRef | undefined;
|
|
@@ -110,7 +116,9 @@ export declare const DiagramActorContextProvider: Provider<DiagramActorRef>, sel
|
|
|
110
116
|
navigationPanel: ActorRefFromLogic<NavigationPanelActorLogic> | undefined;
|
|
111
117
|
}, "search" | "overlays" | "editor" | "navigationPanel">, "final" | "isReady" | "navigating" | "ready" | "initializing" | {
|
|
112
118
|
ready?: NonNullable<"idle" | "walkthrough" | "focused" | "printing">;
|
|
113
|
-
}, never, never, never, never>, T
|
|
119
|
+
}, never, never, never, never>, T> & {
|
|
120
|
+
Out: T;
|
|
121
|
+
}, useDiagramSelector: {
|
|
114
122
|
<T>(select: (state: MachineSnapshot<DiagramContext, DiagramEvents, {
|
|
115
123
|
overlays: OverlaysActorRef | undefined;
|
|
116
124
|
search: SearchActorRef | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { createContext, useContext } from "react";
|
|
2
|
+
import { createContext, use, useContext } from "react";
|
|
3
3
|
import { shallowEqual } from "fast-equals";
|
|
4
4
|
import { isFunction } from "remeda";
|
|
5
5
|
import { useSelector } from "@xstate/react";
|
|
@@ -9,7 +9,7 @@ var DiagramApiSafeContext = createContext(null);
|
|
|
9
9
|
DiagramApiSafeContext.displayName = "DiagramApiSafeContext";
|
|
10
10
|
var DiagramApiContextProvider = DiagramApiSafeContext.Provider;
|
|
11
11
|
function useDiagram() {
|
|
12
|
-
const ctx =
|
|
12
|
+
const ctx = use(DiagramApiSafeContext);
|
|
13
13
|
if (ctx === null) throw new Error("DiagramApi is not provided");
|
|
14
14
|
return ctx;
|
|
15
15
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import "../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import {
|
|
2
|
+
import { selectDiagramContext, useDiagramSelector } from "./safeContext.js";
|
|
3
3
|
//#region src/hooks/useCurrentView.ts
|
|
4
|
-
var selectViewId =
|
|
4
|
+
var selectViewId = selectDiagramContext((s) => s.view.id);
|
|
5
5
|
/**
|
|
6
6
|
* Returns current view id
|
|
7
7
|
* Should be used only inside LikeC4Diagram
|
|
8
8
|
*/
|
|
9
9
|
function useCurrentViewId() {
|
|
10
|
-
return
|
|
10
|
+
return useDiagramSelector(selectViewId);
|
|
11
11
|
}
|
|
12
|
-
var selectView =
|
|
12
|
+
var selectView = selectDiagramContext((s) => s.view);
|
|
13
13
|
/**
|
|
14
14
|
* Returns current view
|
|
15
15
|
* Should be used only inside LikeC4Diagram
|
|
16
16
|
*/
|
|
17
17
|
function useCurrentView() {
|
|
18
|
-
return
|
|
18
|
+
return useDiagramSelector(selectView);
|
|
19
19
|
}
|
|
20
20
|
//#endregion
|
|
21
21
|
export { useCurrentView, useCurrentViewId };
|
package/dist/hooks/useDiagram.js
CHANGED
|
@@ -6,28 +6,6 @@ import { shallowEqual } from "fast-equals";
|
|
|
6
6
|
import { useSelector } from "@xstate/react";
|
|
7
7
|
//#region src/hooks/useDiagram.ts
|
|
8
8
|
/**
|
|
9
|
-
* Helper to create a selector for diagram actor snapshot
|
|
10
|
-
* @deprecated use {@link selectDiagramSnapshot}
|
|
11
|
-
*/
|
|
12
|
-
function selectDiagramActor(selector) {
|
|
13
|
-
return selector;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Read diagram actor snapshot
|
|
17
|
-
* @deprecated use {@link useDiagramSelector}
|
|
18
|
-
*/
|
|
19
|
-
function useDiagramSnapshot(selector, compare = shallowEqual) {
|
|
20
|
-
const actorRef = useDiagramActorRef();
|
|
21
|
-
return useSelector(actorRef, selector, compare);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Helper to create a selector for diagram actor snapshot
|
|
25
|
-
* @deprecated use {@link selectDiagramContext}
|
|
26
|
-
*/
|
|
27
|
-
function selectDiagramActorContext(selector) {
|
|
28
|
-
return (state) => selector(state.context);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
9
|
* Read diagram context
|
|
32
10
|
* @deprecated use {@link useDiagramSelector}
|
|
33
11
|
*/
|
|
@@ -76,4 +54,4 @@ function useOnDiagramEvent(event, callback, options) {
|
|
|
76
54
|
]);
|
|
77
55
|
}
|
|
78
56
|
//#endregion
|
|
79
|
-
export {
|
|
57
|
+
export { selectDiagramContext, selectDiagramSnapshot, useDiagram, useDiagramActorRef, useDiagramContext, useDiagramSelector, useOnDiagramEvent };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DiagramActorSnapshot } from '../likec4diagram/state/types';
|
|
2
2
|
import type * as t from '@likec4/core/types';
|
|
3
|
-
export declare
|
|
3
|
+
export declare function selectCompareLayoutState({ context }: DiagramActorSnapshot): {
|
|
4
4
|
isEnabled: false;
|
|
5
|
-
hasEditor:
|
|
5
|
+
hasEditor: boolean;
|
|
6
6
|
isEditable: false;
|
|
7
|
-
|
|
7
|
+
state: 'inactive';
|
|
8
8
|
drifts: null;
|
|
9
9
|
canApplyLatest: boolean;
|
|
10
10
|
layout: t.LayoutType;
|
|
@@ -12,7 +12,7 @@ export declare const selectCompareLayoutState: ({ context }: DiagramActorSnapsho
|
|
|
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;
|
|
@@ -1,33 +1,35 @@
|
|
|
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
|
+
}
|
|
31
33
|
/**
|
|
32
34
|
* Controls LikeC4's manual-layout comparison from custom diagram children.
|
|
33
35
|
*
|
|
@@ -52,8 +54,8 @@ function useDiagramCompareLayout() {
|
|
|
52
54
|
console.warn("Compare with latest feature is not enabled");
|
|
53
55
|
return;
|
|
54
56
|
}
|
|
55
|
-
const nextIsActive = force ? force === "on" :
|
|
56
|
-
if (state.
|
|
57
|
+
const nextIsActive = force ? force === "on" : state.state === "inactive";
|
|
58
|
+
if (state.state === "comparing" && !nextIsActive && state.layout === "auto") switchLayout("manual");
|
|
57
59
|
actorRef.send({
|
|
58
60
|
type: "toggle.feature",
|
|
59
61
|
feature: "CompareWithLatest",
|
|
@@ -62,10 +64,6 @@ function useDiagramCompareLayout() {
|
|
|
62
64
|
}),
|
|
63
65
|
switchLayout,
|
|
64
66
|
resetManualLayout: useCallbackRef(() => {
|
|
65
|
-
if (!state.isEnabled) {
|
|
66
|
-
console.warn("Compare with latest feature is not enabled");
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
67
|
actorRef.send({ type: "layout.resetManualLayout" });
|
|
70
68
|
}),
|
|
71
69
|
applyLatestToManual: useCallbackRef(() => {
|
|
@@ -73,8 +71,8 @@ function useDiagramCompareLayout() {
|
|
|
73
71
|
console.warn("Compare with latest feature is not enabled");
|
|
74
72
|
return;
|
|
75
73
|
}
|
|
76
|
-
nonNullable(actorRef.system
|
|
77
|
-
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({
|
|
78
76
|
type: "toggle.feature",
|
|
79
77
|
feature: "CompareWithLatest",
|
|
80
78
|
forceValue: false
|
|
@@ -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;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
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';
|
|
@@ -7,7 +8,7 @@ export { createLikeC4Editor, type LikeC4EditorCallbacks, type LikeC4EditorChange
|
|
|
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
10
|
export { type DiagramCompareLayoutOps, type DiagramCompareLayoutState, useDiagramCompareLayout, } from './hooks/useDiagramCompareLayout';
|
|
10
|
-
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel, } from './hooks/useLikeC4Model';
|
|
11
|
+
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel, useOptionalLikeC4Model, } from './hooks/useLikeC4Model';
|
|
11
12
|
export { type CurrentViewModel, useCurrentViewModel, useOptionalCurrentViewModel, } from './hooks/useCurrentViewModel';
|
|
12
13
|
export { useChangeLikeC4Project, useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext, } from './hooks/useLikeC4Project';
|
|
13
14
|
export { useLikeC4Styles } from './hooks/useLikeC4Styles';
|
|
@@ -23,5 +24,5 @@ export { LikeC4ProjectsOverview, type LikeC4ProjectsOverviewProps, } from './Lik
|
|
|
23
24
|
export { normalizeSearch, SearchContext, type SearchContextValue, useSearchContext, } from './search/SearchContext';
|
|
24
25
|
export { bodyCss as searchBodyCss, dialogCss as searchDialogCss, SearchPanelContent, } from './search/Search';
|
|
25
26
|
export { SearchControl } from './components/SearchControl';
|
|
26
|
-
export { DefaultMantineProvider } from './
|
|
27
|
+
export { DefaultMantineProvider, LikeC4MantineProvider } from './LikeC4MantineProvider';
|
|
27
28
|
export { FramerMotionConfig } from './context/FramerMotionConfig';
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
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";
|
|
10
11
|
import { useLikeC4Styles } from "./hooks/useLikeC4Styles.js";
|
|
11
12
|
import { createLikeC4Editor } from "./editor/LikeC4EditorCallbacks.js";
|
|
12
13
|
import { LikeC4EditorProvider } from "./editor/LikeC4EditorProvider.js";
|
|
14
|
+
import { pickViewBounds } from "./utils/view-bounds.js";
|
|
13
15
|
import { useCurrentViewModel } from "./hooks/useCurrentViewModel.js";
|
|
14
16
|
import { useChangeLikeC4Project, useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext } from "./hooks/useLikeC4Project.js";
|
|
15
|
-
import { pickViewBounds } from "./utils/view-bounds.js";
|
|
16
17
|
import { useDiagramCompareLayout } from "./hooks/useDiagramCompareLayout.js";
|
|
17
18
|
import { SearchContext, normalizeSearch, useSearchContext } from "./search/SearchContext.js";
|
|
18
19
|
import { SearchPanelContent, bodyCss, dialogCss } from "./search/Search.js";
|
|
@@ -24,4 +25,4 @@ import { LikeC4View } from "./LikeC4View.js";
|
|
|
24
25
|
import { ReactLikeC4 } from "./ReactLikeC4.js";
|
|
25
26
|
import { LikeC4ProjectsOverview } from "./LikeC4ProjectsOverview.js";
|
|
26
27
|
import { SearchControl } from "./components/SearchControl.js";
|
|
27
|
-
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, useDiagramCompareLayout, 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 };
|
|
@@ -1,7 +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;
|
|
5
10
|
export declare function resolveInteractionEnabled(enabled: boolean, override: boolean | undefined, isEditorBusy: boolean): boolean;
|
|
6
11
|
export type LikeC4DiagramXYFlowProps = PropsWithChildren<Simplify<Pick<LikeC4DiagramProperties<any>, 'background' | 'reactFlowProps' | 'renderNodes'>>>;
|
|
7
12
|
export declare function LikeC4DiagramXYFlow({ background, reactFlowProps, children, renderNodes, }: LikeC4DiagramXYFlowProps): JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
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";
|
|
@@ -47,36 +47,39 @@ function prepareNodeTypes(nodeTypes) {
|
|
|
47
47
|
"seq-subflow": nodeTypes.seqSubflow ?? builtinNodes["seq-subflow"]
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
function resolveControlledViewport(enableFitView, initialZoom, bounds) {
|
|
51
|
+
if (enableFitView || initialZoom !== void 0) return;
|
|
52
52
|
return {
|
|
53
53
|
x: -bounds.x,
|
|
54
54
|
y: -bounds.y,
|
|
55
55
|
zoom: 1
|
|
56
56
|
};
|
|
57
|
-
}
|
|
57
|
+
}
|
|
58
58
|
function resolveInteractionEnabled(enabled, override, isEditorBusy) {
|
|
59
59
|
return (override ?? enabled) && !isEditorBusy;
|
|
60
60
|
}
|
|
61
61
|
var selectXYProps = selectDiagramSnapshot(({ context: ctx, children }) => {
|
|
62
62
|
const { enableReadOnly } = deriveToggledFeatures(ctx);
|
|
63
|
+
const controlledViewport = resolveControlledViewport(ctx.features.enableFitView, ctx.initialZoom, viewBounds(ctx));
|
|
63
64
|
const editorSnapshot = enableReadOnly ? null : children.editor?.getSnapshot();
|
|
64
65
|
const isNotEditingEdge = enableReadOnly || editorSnapshot?.context.editing?.subject !== "edge";
|
|
65
66
|
let nodesDraggable = !enableReadOnly && ctx.nodesDraggable;
|
|
66
67
|
if (ctx.dynamicViewVariant === "sequence" && ctx.view._type === "dynamic") nodesDraggable = false;
|
|
67
68
|
return {
|
|
68
69
|
enableReadOnly,
|
|
69
|
-
initialized: ctx.initialized.xydata && ctx.initialized.xyflow,
|
|
70
|
+
initialized: IS_SERVER || ctx.initialized.xydata && ctx.initialized.xyflow,
|
|
70
71
|
nodes: ctx.xynodes,
|
|
71
72
|
edges: ctx.xyedges,
|
|
72
73
|
pannable: ctx.pannable,
|
|
73
74
|
zoomable: ctx.zoomable,
|
|
75
|
+
minZoom: ctx.minZoom,
|
|
76
|
+
maxZoom: ctx.maxZoom,
|
|
74
77
|
nodesDraggable,
|
|
75
78
|
nodesSelectable: ctx.nodesSelectable && isNotEditingEdge,
|
|
76
79
|
fitViewPadding: ctx.fitViewPadding,
|
|
77
80
|
enableFitView: ctx.features.enableFitView,
|
|
78
|
-
enableControls: ctx.features.enableControls
|
|
79
|
-
|
|
81
|
+
enableControls: ctx.features.enableControls,
|
|
82
|
+
...controlledViewport && { viewport: controlledViewport }
|
|
80
83
|
};
|
|
81
84
|
}, ({ nodes: aNodes, edges: aEdges, ...a }, { nodes: bNodes, edges: bEdges, ...b }) => {
|
|
82
85
|
return shallowEqual(a, b) && shallowEqual(aNodes, bNodes) && shallowEqual(aEdges, bEdges);
|
|
@@ -250,18 +253,22 @@ function LikeC4DiagramXYFlow({ background = "dots", reactFlowProps = {}, childre
|
|
|
250
253
|
...safeReactFlowProps,
|
|
251
254
|
nodesDraggable,
|
|
252
255
|
nodesSelectable,
|
|
253
|
-
children: [enableControls && /* @__PURE__ */ jsx(Controls$1, {
|
|
256
|
+
children: [enableControls && /* @__PURE__ */ jsx(Controls$1, {
|
|
257
|
+
fitViewPadding: props.fitViewPadding,
|
|
258
|
+
minZoom: props.minZoom,
|
|
259
|
+
maxZoom: props.maxZoom
|
|
260
|
+
}), children]
|
|
254
261
|
});
|
|
255
262
|
}
|
|
256
|
-
var Controls$1 = /* @__PURE__ */ __name(({
|
|
263
|
+
var Controls$1 = /* @__PURE__ */ __name(({ fitViewPadding, minZoom, maxZoom }) => /* @__PURE__ */ jsx(Controls, {
|
|
257
264
|
showInteractive: false,
|
|
258
265
|
fitViewOptions: {
|
|
259
|
-
padding,
|
|
260
|
-
minZoom
|
|
261
|
-
maxZoom: 1,
|
|
266
|
+
padding: fitViewPadding,
|
|
267
|
+
minZoom,
|
|
268
|
+
maxZoom: Math.min(maxZoom, 1),
|
|
262
269
|
duration: 350
|
|
263
270
|
},
|
|
264
271
|
position: "bottom-left"
|
|
265
272
|
}), "Controls");
|
|
266
273
|
//#endregion
|
|
267
|
-
export { LikeC4DiagramXYFlow, resolveInteractionEnabled };
|
|
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,
|
|
@@ -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
|
});
|
|
@@ -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
|
})
|