@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
package/dist/LikeC4Diagram.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export type LikeC4DiagramProps<A extends Any = Any> = PropsWithChildren<LikeC4Di
|
|
|
9
9
|
*
|
|
10
10
|
* Use {@link ReactLikeC4} or {@link LikeC4View} for ready-to-use component
|
|
11
11
|
*/
|
|
12
|
-
export declare function LikeC4Diagram<A extends Any = Any>({ onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu, onOpenSource, onLogoClick, onLayoutTypeChange, onInitialized, view, className, controls, fitView, fitViewPadding: _fitViewPadding, pannable, zoomable, background, enableElementTags, enableFocusMode, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, enableCompareWithLatest, nodesSelectable, enableNotations, showNavigationButtons, enableDynamicViewWalkthrough, dynamicViewVariant, enableSearch, enableNotes, initialWidth, initialHeight, reduceGraphics, renderIcon, where, reactFlowProps, renderNodes, children, }: LikeC4DiagramProps<A>): JSX.Element;
|
|
12
|
+
export declare function LikeC4Diagram<A extends Any = Any>({ onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu, onOpenSource, onLogoClick, onLayoutTypeChange, onRelationshipBrowserScopeChange, onInitialized, view, className, controls, fitView, initialZoom, fitViewPadding: _fitViewPadding, pannable, zoomable, background, enableElementTags, enableFocusMode, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, relationshipBrowserScope, enableCompareWithLatest, nodesSelectable, enableNotations, showNavigationButtons, enableDynamicViewWalkthrough, dynamicViewVariant, enableSearch, enableNotes, initialWidth, initialHeight, reduceGraphics, renderIcon, where, reactFlowProps, renderNodes, minZoom, maxZoom, children, }: LikeC4DiagramProps<A>): JSX.Element;
|
package/dist/LikeC4Diagram.js
CHANGED
|
@@ -12,10 +12,11 @@ import { TagStylesProvider } from "./context/TagStylesContext.js";
|
|
|
12
12
|
import { useOptionalLikeC4Editor } from "./editor/LikeC4EditorProvider.js";
|
|
13
13
|
import { useId } from "./hooks/useId.js";
|
|
14
14
|
import { pickViewBounds } from "./utils/view-bounds.js";
|
|
15
|
+
import { convertToXYFlow } from "./likec4diagram/convert-to-xyflow.js";
|
|
16
|
+
import { LikeC4Styles } from "./LikeC4Styles.js";
|
|
15
17
|
import { LikeC4DiagramUI } from "./likec4diagram/DiagramUI.js";
|
|
16
18
|
import { LikeC4DiagramXYFlow } from "./likec4diagram/DiagramXYFlow.js";
|
|
17
19
|
import { DiagramActorProvider } from "./likec4diagram/state/DiagramActorProvider.js";
|
|
18
|
-
import { LikeC4Styles } from "./LikeC4Styles.js";
|
|
19
20
|
import { Profiler, useRef } from "react";
|
|
20
21
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
22
|
import { useCustomCompareMemo } from "@react-hookz/web";
|
|
@@ -30,7 +31,7 @@ var noop = () => {};
|
|
|
30
31
|
*
|
|
31
32
|
* Use {@link ReactLikeC4} or {@link LikeC4View} for ready-to-use component
|
|
32
33
|
*/
|
|
33
|
-
function LikeC4Diagram({ onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu, onOpenSource, onLogoClick, onLayoutTypeChange, onInitialized, view, className, controls = true, fitView = true, fitViewPadding: _fitViewPadding = controls ? FitViewPaddings.withControls : FitViewPaddings.default, pannable = true, zoomable = true, background = "dots", enableElementTags = false, enableFocusMode = false, enableElementDetails = false, enableRelationshipDetails = false, enableRelationshipBrowser = false, enableCompareWithLatest = !!onLayoutTypeChange, nodesSelectable, enableNotations = false, showNavigationButtons = !!onNavigateTo, enableDynamicViewWalkthrough = false, dynamicViewVariant, enableSearch = false, enableNotes = true, initialWidth, initialHeight, reduceGraphics = "auto", renderIcon, where, reactFlowProps, renderNodes, children }) {
|
|
34
|
+
function LikeC4Diagram({ onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu, onOpenSource, onLogoClick, onLayoutTypeChange, onRelationshipBrowserScopeChange, onInitialized, view, className, controls = true, fitView = true, initialZoom, fitViewPadding: _fitViewPadding = controls ? FitViewPaddings.withControls : FitViewPaddings.default, pannable = true, zoomable = true, background = "dots", enableElementTags = false, enableFocusMode = false, enableElementDetails = false, enableRelationshipDetails = false, enableRelationshipBrowser = false, relationshipBrowserScope = "view", enableCompareWithLatest = !!onLayoutTypeChange, nodesSelectable, enableNotations = false, showNavigationButtons = !!onNavigateTo, enableDynamicViewWalkthrough = false, dynamicViewVariant, enableSearch = false, enableNotes = true, initialWidth, initialHeight, reduceGraphics = "auto", renderIcon, where, reactFlowProps, renderNodes, minZoom = MinZoom, maxZoom = 3, children }) {
|
|
34
35
|
const id = useId();
|
|
35
36
|
const initialRef = useRef(null);
|
|
36
37
|
const optionalLikeC4Model = useOptionalLikeC4Model();
|
|
@@ -42,19 +43,29 @@ function LikeC4Diagram({ onCanvasClick, onCanvasContextMenu, onCanvasDblClick, o
|
|
|
42
43
|
nodesSelectable ??= hasEditor || enableFocusMode || !!onNavigateTo || !!onNodeClick;
|
|
43
44
|
const bounds = pickViewBounds(view, dynamicViewVariant);
|
|
44
45
|
const fitViewPadding = useNormalizedViewPadding(_fitViewPadding);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
const initialFitView = initialZoom === void 0 && fitView;
|
|
47
|
+
if (initialRef.current == null) {
|
|
48
|
+
const { xynodes, xyedges } = convertToXYFlow({
|
|
49
|
+
view,
|
|
50
|
+
dynamicViewVariant: dynamicViewVariant ?? "diagram",
|
|
51
|
+
where: where ?? null,
|
|
52
|
+
currentViewId: view.id,
|
|
53
|
+
collapsedSequenceFlows: {}
|
|
54
|
+
});
|
|
55
|
+
initialRef.current = {
|
|
56
|
+
initialNodes: xynodes,
|
|
57
|
+
initialEdges: xyedges,
|
|
58
|
+
initialWidth: initialWidth ?? bounds.width,
|
|
59
|
+
initialHeight: initialHeight ?? bounds.height,
|
|
60
|
+
initialFitViewOptions: {
|
|
61
|
+
maxZoom,
|
|
62
|
+
minZoom,
|
|
63
|
+
padding: fitViewPadding
|
|
64
|
+
},
|
|
65
|
+
initialMaxZoom: initialZoom ?? maxZoom,
|
|
66
|
+
initialMinZoom: initialZoom ?? minZoom
|
|
67
|
+
};
|
|
68
|
+
}
|
|
58
69
|
const isReducedGraphicsMode = reduceGraphics === "auto" ? pannable && view.bounds.width * view.bounds.height > 16e6 && view.nodes.some((n) => n.children?.length > 0) : reduceGraphics;
|
|
59
70
|
return /* @__PURE__ */ jsx(Profiler, {
|
|
60
71
|
id: "LikeC4Diagram",
|
|
@@ -76,11 +87,11 @@ function LikeC4Diagram({ onCanvasClick, onCanvasContextMenu, onCanvasDblClick, o
|
|
|
76
87
|
enableRelationshipBrowser: enableRelationshipBrowser && hasLikeC4Model,
|
|
77
88
|
enableSearch: enableSearch && hasLikeC4Model,
|
|
78
89
|
enableNavigationButtons: showNavigationButtons && !!onNavigateTo,
|
|
79
|
-
enableDynamicViewWalkthrough: view._type === "dynamic" && enableDynamicViewWalkthrough,
|
|
90
|
+
enableDynamicViewWalkthrough: view._type === "dynamic" && enableDynamicViewWalkthrough && hasLikeC4Model,
|
|
80
91
|
enableNotations,
|
|
81
92
|
enableVscode: !!onOpenSource,
|
|
82
93
|
enableControls: controls,
|
|
83
|
-
enableElementTags,
|
|
94
|
+
enableElementTags: enableElementTags && hasLikeC4Model,
|
|
84
95
|
enableCompareWithLatest,
|
|
85
96
|
enableNotes
|
|
86
97
|
},
|
|
@@ -97,27 +108,31 @@ function LikeC4Diagram({ onCanvasClick, onCanvasContextMenu, onCanvasDblClick, o
|
|
|
97
108
|
onOpenSource,
|
|
98
109
|
onLogoClick,
|
|
99
110
|
onInitialized,
|
|
100
|
-
onLayoutTypeChange
|
|
111
|
+
onLayoutTypeChange,
|
|
112
|
+
onRelationshipBrowserScopeChange
|
|
101
113
|
},
|
|
102
|
-
children: [/* @__PURE__ */ jsx(LikeC4Styles, { id }), /* @__PURE__ */ jsx(TagStylesProvider, {
|
|
103
|
-
id
|
|
114
|
+
children: [/* @__PURE__ */ jsx(LikeC4Styles, { rootSelector: `#${id}` }), /* @__PURE__ */ jsx(TagStylesProvider, {
|
|
115
|
+
rootSelector: `#${id}`,
|
|
104
116
|
children: /* @__PURE__ */ jsx(RootContainer, {
|
|
105
117
|
id,
|
|
106
118
|
className,
|
|
107
119
|
reduceGraphics: isReducedGraphicsMode,
|
|
108
120
|
children: /* @__PURE__ */ jsx(ReactFlowProvider, {
|
|
109
|
-
fitView,
|
|
121
|
+
fitView: initialFitView,
|
|
110
122
|
...initialRef.current,
|
|
111
123
|
children: /* @__PURE__ */ jsx(DiagramActorProvider, {
|
|
112
124
|
id,
|
|
113
125
|
view,
|
|
114
126
|
zoomable,
|
|
115
127
|
pannable,
|
|
128
|
+
fitView,
|
|
129
|
+
initialZoom,
|
|
116
130
|
fitViewPadding,
|
|
117
131
|
nodesDraggable: hasEditor,
|
|
118
132
|
nodesSelectable,
|
|
119
133
|
where: where ?? null,
|
|
120
134
|
dynamicViewVariant,
|
|
135
|
+
relationshipBrowserScope,
|
|
121
136
|
children: /* @__PURE__ */ jsxs(CurrentViewModelProvider, { children: [/* @__PURE__ */ jsx(LikeC4DiagramXYFlow, {
|
|
122
137
|
background,
|
|
123
138
|
reactFlowProps,
|
|
@@ -26,6 +26,7 @@ export type ElementIconRendererProps = {
|
|
|
26
26
|
};
|
|
27
27
|
export type ElementIconRenderer = (props: ElementIconRendererProps) => ReactNode;
|
|
28
28
|
export type LikeC4ColorScheme = 'light' | 'dark';
|
|
29
|
+
export type RelationshipBrowserScope = 'global' | 'view';
|
|
29
30
|
export type OverrideReactFlowProps = Pick<ReactFlowProps<Types.AnyNode, Types.AnyEdge>, 'paneClickDistance' | 'nodeClickDistance' | 'selectionKeyCode' | 'panActivationKeyCode' | 'multiSelectionKeyCode' | 'zoomActivationKeyCode' | 'snapToGrid' | 'snapGrid' | 'onlyRenderVisibleElements' | 'nodesDraggable' | 'nodesFocusable' | 'elementsSelectable' | 'selectNodesOnDrag' | 'panOnDrag' | 'preventScrolling' | 'zoomOnScroll' | 'zoomOnPinch' | 'panOnScroll' | 'panOnScrollSpeed' | 'panOnScrollMode' | 'zoomOnDoubleClick' | 'nodeDragThreshold' | 'edgesFocusable'>;
|
|
30
31
|
export type PaddingUnit = 'px' | '%';
|
|
31
32
|
export type PaddingWithUnit = `${number}${PaddingUnit}` | number;
|
|
@@ -78,6 +79,10 @@ export interface LikeC4DiagramProperties<A extends Any = Unknown> {
|
|
|
78
79
|
* @default true
|
|
79
80
|
*/
|
|
80
81
|
fitView?: boolean | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Initial centered zoom level. When set, it overrides automatic fit-to-view.
|
|
84
|
+
*/
|
|
85
|
+
initialZoom?: number | undefined;
|
|
81
86
|
/**
|
|
82
87
|
* Padding around the diagram (number - pixels)
|
|
83
88
|
* @default 16 - 16px
|
|
@@ -163,6 +168,12 @@ export interface LikeC4DiagramProperties<A extends Any = Unknown> {
|
|
|
163
168
|
* @default false
|
|
164
169
|
*/
|
|
165
170
|
enableRelationshipBrowser?: boolean | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* Initial scope for the relationship browser
|
|
173
|
+
*
|
|
174
|
+
* @default 'view'
|
|
175
|
+
*/
|
|
176
|
+
relationshipBrowserScope?: RelationshipBrowserScope | undefined;
|
|
166
177
|
/**
|
|
167
178
|
* If Walkthrough for dynamic views should be enabled
|
|
168
179
|
* @default false
|
|
@@ -216,6 +227,16 @@ export interface LikeC4DiagramProperties<A extends Any = Unknown> {
|
|
|
216
227
|
* Override ReactFlow props
|
|
217
228
|
*/
|
|
218
229
|
reactFlowProps?: OverrideReactFlowProps | undefined;
|
|
230
|
+
/**
|
|
231
|
+
* Minimum zoom level
|
|
232
|
+
* @default 0.05
|
|
233
|
+
*/
|
|
234
|
+
minZoom?: number | undefined;
|
|
235
|
+
/**
|
|
236
|
+
* Maximum zoom level
|
|
237
|
+
* @default 3
|
|
238
|
+
*/
|
|
239
|
+
maxZoom?: number | undefined;
|
|
219
240
|
}
|
|
220
241
|
export type OpenSourceParams<A extends Any = Unknown> = {
|
|
221
242
|
element: Fqn<A>;
|
|
@@ -248,6 +269,7 @@ export type OnInitialized = (params: {
|
|
|
248
269
|
xyflow: XYFlowInstance;
|
|
249
270
|
}) => void;
|
|
250
271
|
export type OnLayoutTypeChange = (layoutType: LayoutType) => void;
|
|
272
|
+
export type OnRelationshipBrowserScopeChange = (scope: RelationshipBrowserScope) => void;
|
|
251
273
|
export interface LikeC4DiagramEventHandlers<A extends Any = Unknown> {
|
|
252
274
|
onNavigateTo?: OnNavigateTo<A> | null | undefined;
|
|
253
275
|
onNodeClick?: OnNodeClick<A> | null | undefined;
|
|
@@ -267,4 +289,5 @@ export interface LikeC4DiagramEventHandlers<A extends Any = Unknown> {
|
|
|
267
289
|
* @param layoutType new layout type
|
|
268
290
|
*/
|
|
269
291
|
onLayoutTypeChange?: OnLayoutTypeChange | null | undefined;
|
|
292
|
+
onRelationshipBrowserScopeChange?: OnRelationshipBrowserScopeChange | null | undefined;
|
|
270
293
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DefaultMantineColor, MantineColorsTuple, MantineProviderProps } from '@mantine/core';
|
|
2
|
+
import { JSX } from 'react';
|
|
3
|
+
type LikeC4MantineProviderProps = MantineProviderProps;
|
|
4
|
+
/**
|
|
5
|
+
* LikeC4 Mantine provider with custom theme and CSS variables resolver
|
|
6
|
+
*/
|
|
7
|
+
export declare function LikeC4MantineProvider({ children, defaultColorScheme, theme, ...props }: LikeC4MantineProviderProps): JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* This is a deprecated alias for LikeC4MantineProvider.
|
|
10
|
+
* @deprecated Use LikeC4MantineProvider instead
|
|
11
|
+
*/
|
|
12
|
+
export declare const DefaultMantineProvider: typeof LikeC4MantineProvider;
|
|
13
|
+
type ExtendedCustomColors = 'likec4' | DefaultMantineColor;
|
|
14
|
+
type ExtendedSizes = 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
15
|
+
declare module '@mantine/core' {
|
|
16
|
+
interface MantineThemeSizesOverride {
|
|
17
|
+
fontSizes: Record<ExtendedSizes, string>;
|
|
18
|
+
spacing: Record<ExtendedSizes, string>;
|
|
19
|
+
}
|
|
20
|
+
interface MantineThemeColorsOverride {
|
|
21
|
+
colors: Record<ExtendedCustomColors, MantineColorsTuple>;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import "./_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { css } from "@likec4/styles/css";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { map } from "remeda";
|
|
6
|
+
import { Card, Code, MantineProvider, Menu, Paper, Popover, SegmentedControl, Table, Title, Tooltip, createTheme, mergeThemeOverrides } from "@mantine/core";
|
|
7
|
+
import { token } from "@likec4/styles/tokens";
|
|
8
|
+
//#region src/LikeC4MantineProvider.tsx
|
|
9
|
+
function t(name) {
|
|
10
|
+
return token.var(name);
|
|
11
|
+
}
|
|
12
|
+
var tshirts = [
|
|
13
|
+
"xs",
|
|
14
|
+
"sm",
|
|
15
|
+
"md",
|
|
16
|
+
"lg",
|
|
17
|
+
"xl"
|
|
18
|
+
];
|
|
19
|
+
var sizes = (tokenCategory) => {
|
|
20
|
+
return Object.fromEntries(tshirts.map((size) => [size, t(`${tokenCategory}.${size}`)]));
|
|
21
|
+
};
|
|
22
|
+
var shades = [
|
|
23
|
+
0,
|
|
24
|
+
1,
|
|
25
|
+
2,
|
|
26
|
+
3,
|
|
27
|
+
4,
|
|
28
|
+
5,
|
|
29
|
+
6,
|
|
30
|
+
7,
|
|
31
|
+
8,
|
|
32
|
+
9
|
|
33
|
+
];
|
|
34
|
+
var mapColor = (color) => {
|
|
35
|
+
return map(shades, (shade) => t(`colors.${color}.${shade}`));
|
|
36
|
+
};
|
|
37
|
+
var titles = [
|
|
38
|
+
css({ textStyle: "h1" }),
|
|
39
|
+
css({ textStyle: "h2" }),
|
|
40
|
+
css({ textStyle: "h3" }),
|
|
41
|
+
css({ textStyle: "h4" }),
|
|
42
|
+
css({ textStyle: "h5" }),
|
|
43
|
+
css({ textStyle: "h6" })
|
|
44
|
+
];
|
|
45
|
+
var likec4Theme = createTheme({
|
|
46
|
+
primaryColor: "likec4",
|
|
47
|
+
cursorType: "pointer",
|
|
48
|
+
autoContrast: true,
|
|
49
|
+
primaryShade: {
|
|
50
|
+
light: 5,
|
|
51
|
+
dark: 6
|
|
52
|
+
},
|
|
53
|
+
colors: { likec4: mapColor("likec4.accent") },
|
|
54
|
+
fontFamily: t("fonts.body"),
|
|
55
|
+
fontFamilyMonospace: t("fonts.mono"),
|
|
56
|
+
headings: {
|
|
57
|
+
fontFamily: t("fonts.display"),
|
|
58
|
+
fontWeight: t("fontWeights.bold")
|
|
59
|
+
},
|
|
60
|
+
defaultRadius: "sm",
|
|
61
|
+
fontWeights: {
|
|
62
|
+
regular: t("fontWeights.normal"),
|
|
63
|
+
medium: t("fontWeights.medium"),
|
|
64
|
+
semibold: t("fontWeights.semibold"),
|
|
65
|
+
bold: t("fontWeights.bold")
|
|
66
|
+
},
|
|
67
|
+
fontSizes: {
|
|
68
|
+
...sizes("fontSizes"),
|
|
69
|
+
xxs: t("fontSizes.xxs")
|
|
70
|
+
},
|
|
71
|
+
spacing: {
|
|
72
|
+
...sizes("spacing"),
|
|
73
|
+
xxs: t("spacing.xxs")
|
|
74
|
+
},
|
|
75
|
+
radius: sizes("radii"),
|
|
76
|
+
shadows: sizes("shadows"),
|
|
77
|
+
lineHeights: sizes("lineHeights"),
|
|
78
|
+
components: {
|
|
79
|
+
Card: Card.extend({
|
|
80
|
+
defaultProps: { radius: "md" },
|
|
81
|
+
classNames: { root: css({ bg: "surface.default" }) }
|
|
82
|
+
}),
|
|
83
|
+
Paper: Paper.extend({
|
|
84
|
+
defaultProps: { radius: "md" },
|
|
85
|
+
classNames: { root: css({ bg: "surface.default" }) }
|
|
86
|
+
}),
|
|
87
|
+
Title: Title.extend({ classNames: (_theme, props) => ({ root: titles[(props.order ?? 1) - 1] }) }),
|
|
88
|
+
Code: Code.extend({ classNames: { root: css({ bg: "surface.code" }) } }),
|
|
89
|
+
Table: Table.extend({ classNames: { th: css({
|
|
90
|
+
fontSize: "xxs",
|
|
91
|
+
fontWeight: "bold",
|
|
92
|
+
color: "text.dimmed",
|
|
93
|
+
textTransform: "uppercase",
|
|
94
|
+
letterSpacing: "caps.sm"
|
|
95
|
+
}) } }),
|
|
96
|
+
Tooltip: Tooltip.extend({ defaultProps: {
|
|
97
|
+
color: "dark",
|
|
98
|
+
fz: "xs",
|
|
99
|
+
withArrow: false,
|
|
100
|
+
openDelay: 600,
|
|
101
|
+
closeDelay: 120,
|
|
102
|
+
offset: 8
|
|
103
|
+
} }),
|
|
104
|
+
SegmentedControl: SegmentedControl.extend({ vars: (theme, props) => ({ root: { "--sc-font-size": theme.fontSizes[props.fz ?? props.size] } }) }),
|
|
105
|
+
Popover: Popover.extend({ defaultProps: {
|
|
106
|
+
withArrow: false,
|
|
107
|
+
radius: "sm",
|
|
108
|
+
shadow: "lg"
|
|
109
|
+
} }),
|
|
110
|
+
Menu: Menu.extend({ defaultProps: {
|
|
111
|
+
radius: "sm",
|
|
112
|
+
shadow: "lg"
|
|
113
|
+
} })
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
var semantic = (variables) => ({
|
|
117
|
+
dark: variables,
|
|
118
|
+
light: variables
|
|
119
|
+
});
|
|
120
|
+
var resolver = (_) => ({
|
|
121
|
+
variables: { "--mantine-radius-default": t("radii.sm") },
|
|
122
|
+
...semantic({
|
|
123
|
+
"--mantine-color-text": t("colors.text"),
|
|
124
|
+
"--mantine-color-body": t("colors.surface.default"),
|
|
125
|
+
"--mantine-color-placeholder": t("colors.text.non-essential"),
|
|
126
|
+
"--mantine-color-anchor": t("colors.text.link"),
|
|
127
|
+
"--mantine-color-disabled": t("colors.disabled.body"),
|
|
128
|
+
"--mantine-color-disabled-color": t("colors.disabled.text"),
|
|
129
|
+
"--mantine-color-disabled-hover": t("colors.disabled.body"),
|
|
130
|
+
"--mantine-color-disabled-border": t("colors.disabled.border"),
|
|
131
|
+
"--mantine-color-default": t("colors.surface.default"),
|
|
132
|
+
"--mantine-color-default-color": t("colors.text"),
|
|
133
|
+
"--mantine-color-default-border": t("colors.border.default"),
|
|
134
|
+
"--mantine-color-default-hover": t("colors.surface.hover")
|
|
135
|
+
})
|
|
136
|
+
});
|
|
137
|
+
/**
|
|
138
|
+
* LikeC4 Mantine provider with custom theme and CSS variables resolver
|
|
139
|
+
*/
|
|
140
|
+
function LikeC4MantineProvider({ children, defaultColorScheme = "auto", theme, ...props }) {
|
|
141
|
+
const mergedTheme = useMemo(() => theme ? mergeThemeOverrides(likec4Theme, theme) : likec4Theme, [theme]);
|
|
142
|
+
return /* @__PURE__ */ jsx(MantineProvider, {
|
|
143
|
+
defaultColorScheme,
|
|
144
|
+
theme: mergedTheme,
|
|
145
|
+
cssVariablesResolver: resolver,
|
|
146
|
+
...props,
|
|
147
|
+
children
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* This is a deprecated alias for LikeC4MantineProvider.
|
|
152
|
+
* @deprecated Use LikeC4MantineProvider instead
|
|
153
|
+
*/
|
|
154
|
+
var DefaultMantineProvider = LikeC4MantineProvider;
|
|
155
|
+
//#endregion
|
|
156
|
+
export { DefaultMantineProvider, LikeC4MantineProvider };
|
|
@@ -12,7 +12,7 @@ function LikeC4ProjectsOverview({ view, className, onNavigateToProject, ...props
|
|
|
12
12
|
const onChangeLikeC4Project = useChangeLikeC4Project();
|
|
13
13
|
const id = useId();
|
|
14
14
|
onNavigateToProject ??= onChangeLikeC4Project;
|
|
15
|
-
return /* @__PURE__ */ jsx(EnsureMantine, { children: /* @__PURE__ */ jsxs(FramerMotionConfig, { children: [/* @__PURE__ */ jsx(LikeC4Styles, { id }), /* @__PURE__ */ jsx(RootContainer, {
|
|
15
|
+
return /* @__PURE__ */ jsx(EnsureMantine, { children: /* @__PURE__ */ jsxs(FramerMotionConfig, { children: [/* @__PURE__ */ jsx(LikeC4Styles, { rootSelector: `#${id}` }), /* @__PURE__ */ jsx(RootContainer, {
|
|
16
16
|
id,
|
|
17
17
|
className,
|
|
18
18
|
children: /* @__PURE__ */ jsx(ProjectsOverview, {
|
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProjectId } from '@likec4/core/types';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
3
|
import { JSX } from 'react/jsx-runtime';
|
|
4
|
+
type LandingPageConfig = {
|
|
5
|
+
redirect: true;
|
|
6
|
+
} | {
|
|
7
|
+
include: string[];
|
|
8
|
+
} | {
|
|
9
|
+
exclude: string[];
|
|
10
|
+
};
|
|
11
|
+
export interface LikeC4ProjectData {
|
|
12
|
+
readonly id: ProjectId;
|
|
13
|
+
readonly title?: string | undefined;
|
|
14
|
+
readonly path?: string | undefined;
|
|
15
|
+
readonly landingPage?: LandingPageConfig | undefined;
|
|
16
|
+
readonly exportFormats?: readonly string[] | undefined;
|
|
17
|
+
}
|
|
4
18
|
export interface LikeC4ProjectsProviderProps {
|
|
5
19
|
/**
|
|
6
20
|
* Projects to be used in the navigation panel.
|
|
7
21
|
* Current project is taken from the LikeC4Model
|
|
8
22
|
*/
|
|
9
|
-
projects: ReadonlyArray<
|
|
23
|
+
projects: ReadonlyArray<LikeC4ProjectData>;
|
|
10
24
|
/**
|
|
11
25
|
* Optional callback when another project is selected.
|
|
12
26
|
*/
|
|
@@ -16,3 +30,4 @@ export interface LikeC4ProjectsProviderProps {
|
|
|
16
30
|
* Ensures LikeC4Projects context
|
|
17
31
|
*/
|
|
18
32
|
export declare function LikeC4ProjectsProvider({ children, projects, onProjectChange: _onProjectChange, }: PropsWithChildren<LikeC4ProjectsProviderProps>): JSX.Element;
|
|
33
|
+
export {};
|
package/dist/LikeC4Styles.d.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { JSX } from 'react/jsx-runtime';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
interface LikeC4StylesProps {
|
|
3
|
+
/**
|
|
4
|
+
* Root element selector to scope the styles to (e.g., "#diagram-root")
|
|
5
|
+
* Must be a valid CSS selector
|
|
6
|
+
*/
|
|
7
|
+
rootSelector: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Component that renders LikeC4 theme colors as CSS variables
|
|
11
|
+
* scoped to the provided root selector
|
|
12
|
+
*/
|
|
13
|
+
export declare function LikeC4Styles({ rootSelector }: LikeC4StylesProps): JSX.Element;
|
|
14
|
+
export {};
|
package/dist/LikeC4Styles.js
CHANGED
|
@@ -43,13 +43,16 @@ function generateBuiltInColorStyles(styles, rootSelector) {
|
|
|
43
43
|
colors
|
|
44
44
|
})), join("\n"));
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Component that renders LikeC4 theme colors as CSS variables
|
|
48
|
+
* scoped to the provided root selector
|
|
49
|
+
*/
|
|
50
|
+
function LikeC4Styles({ rootSelector }) {
|
|
48
51
|
const nonce = useMantineStyleNonce()?.();
|
|
49
52
|
const $styles = useLikeC4Styles();
|
|
50
53
|
const colorsStyles = useMemo(() => generateBuiltInColorStyles($styles, rootSelector), [rootSelector, $styles.fingerprint]);
|
|
51
54
|
return /* @__PURE__ */ jsx(MemoizedStyle, {
|
|
52
|
-
id,
|
|
55
|
+
id: $styles.fingerprint,
|
|
53
56
|
nonce,
|
|
54
57
|
colorsStyles
|
|
55
58
|
});
|
|
@@ -60,8 +63,8 @@ function LikeC4Styles({ id }) {
|
|
|
60
63
|
var MemoizedStyle = memo(({ id, nonce, colorsStyles }) => /* @__PURE__ */ jsx("style", {
|
|
61
64
|
type: "text/css",
|
|
62
65
|
"data-likec4-colors": id,
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
nonce: nonce || void 0,
|
|
67
|
+
children: colorsStyles
|
|
65
68
|
}));
|
|
66
69
|
MemoizedStyle.displayName = "MemoizedStyle";
|
|
67
70
|
//#endregion
|
package/dist/LikeC4View.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { stopPropagation } from "./utils/xyflow.js";
|
|
3
2
|
import { FitViewPaddings } from "./base/const.js";
|
|
3
|
+
import { stopPropagation } from "./utils/xyflow.js";
|
|
4
4
|
import { useOptionalLikeC4Model } from "./context/LikeC4ModelContext.js";
|
|
5
5
|
import { pickViewBounds } from "./utils/view-bounds.js";
|
|
6
6
|
import { Overlay } from "./overlays/overlay/Overlay.js";
|
|
@@ -135,7 +135,7 @@ function LikeC4View({ viewId, className, pannable = false, zoomable = false, kee
|
|
|
135
135
|
pos: "absolute",
|
|
136
136
|
top: "4",
|
|
137
137
|
right: "4",
|
|
138
|
-
zIndex: "
|
|
138
|
+
zIndex: "dropdown",
|
|
139
139
|
onClick: stopPropagation,
|
|
140
140
|
children: /* @__PURE__ */ jsx(ActionIcon, {
|
|
141
141
|
variant: "default",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Any, UnknownLayouted } from '@likec4/core/types';
|
|
2
2
|
import { JSX } from 'react/jsx-runtime';
|
|
3
3
|
import { LikeC4DiagramProperties } from './LikeC4Diagram.props';
|
|
4
|
-
export type StaticLikeC4DiagramProps<A extends Any> = Pick<LikeC4DiagramProperties<A>, 'view' | 'className' | 'fitView' | 'fitViewPadding' | 'background' | 'enableElementDetails' | 'enableRelationshipDetails' | 'enableRelationshipBrowser' | 'enableElementTags' | 'reduceGraphics' | 'initialWidth' | 'initialHeight' | 'renderIcon' | 'renderNodes' | 'dynamicViewVariant' | 'where'>;
|
|
4
|
+
export type StaticLikeC4DiagramProps<A extends Any> = Pick<LikeC4DiagramProperties<A>, 'view' | 'className' | 'fitView' | 'fitViewPadding' | 'background' | 'enableElementDetails' | 'enableRelationshipDetails' | 'enableRelationshipBrowser' | 'relationshipBrowserScope' | 'enableElementTags' | 'reduceGraphics' | 'initialWidth' | 'initialHeight' | 'initialZoom' | 'maxZoom' | 'minZoom' | 'renderIcon' | 'renderNodes' | 'dynamicViewVariant' | 'where'>;
|
|
5
5
|
/**
|
|
6
6
|
* StaticLikeC4Diagram is a component that renders a LikeC4 diagram in a static way.
|
|
7
7
|
* (Export/Embed)
|
|
@@ -13,4 +13,4 @@ export type BaseXYFlowProps<NodeType extends BaseNode, EdgeType extends BaseEdge
|
|
|
13
13
|
fitViewPadding?: ViewPadding | undefined;
|
|
14
14
|
onViewportResize?: undefined | (() => void);
|
|
15
15
|
} & SetRequired<Omit<ReactFlowProps<NodeType, EdgeType>, 'defaultNodes' | 'defaultEdges' | 'fitViewOptions' | 'nodesSelectable' | 'nodesDraggable'>, 'nodes' | 'edges' | 'onNodesChange' | 'onEdgesChange'>>;
|
|
16
|
-
export declare function BaseXYFlow<NodeType extends BaseNode, EdgeType extends BaseEdge>({ nodes, edges, onEdgesChange, onNodesChange, className, pannable, zoomable, nodesSelectable, nodesDraggable, background, children, colorMode, fitViewPadding,
|
|
16
|
+
export declare function BaseXYFlow<NodeType extends BaseNode, EdgeType extends BaseEdge>({ nodes, edges, onEdgesChange, onNodesChange, className, pannable, zoomable, nodesSelectable, nodesDraggable, background, children, colorMode, fitViewPadding, zoomOnDoubleClick, onViewportResize, onMoveEnd, onNodeMouseEnter, onNodeMouseLeave, onEdgeMouseEnter, onEdgeMouseLeave, onKeyDownCapture, ariaLabelConfig, nodesFocusable, edgesFocusable, showControls, minZoom, maxZoom, ...props }: BaseXYFlowProps<NodeType, EdgeType>): import("react").JSX.Element;
|
package/dist/base/BaseXYFlow.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { MinZoom } from "./const.js";
|
|
2
3
|
import { Background as Background$1 } from "./Background.js";
|
|
3
4
|
import { useCallbackRef } from "../hooks/useCallbackRef.js";
|
|
4
5
|
import { useUpdateEffect } from "../hooks/useUpdateEffect.js";
|
|
@@ -6,7 +7,6 @@ import { useIsZoomTooSmall, useXYFlow, useXYStoreApi } from "../hooks/useXYFlow.
|
|
|
6
7
|
import { roundDpr } from "../utils/roundDpr.js";
|
|
7
8
|
import { stopPropagation } from "../utils/xyflow.js";
|
|
8
9
|
import { Base } from "./Base.js";
|
|
9
|
-
import { MinZoom } from "./const.js";
|
|
10
10
|
import { getKeyboardZoomAction } from "./keyboardZoom.js";
|
|
11
11
|
import { cx } from "@likec4/styles/css";
|
|
12
12
|
import { useMemo } from "react";
|
|
@@ -40,13 +40,17 @@ function activateFocusedElement(event) {
|
|
|
40
40
|
view
|
|
41
41
|
}));
|
|
42
42
|
}
|
|
43
|
-
function BaseXYFlow({ nodes, edges, onEdgesChange, onNodesChange, className, pannable = true, zoomable = true, nodesSelectable = true, nodesDraggable = false, background = "dots", children, colorMode, fitViewPadding = 0,
|
|
43
|
+
function BaseXYFlow({ nodes, edges, onEdgesChange, onNodesChange, className, pannable = true, zoomable = true, nodesSelectable = true, nodesDraggable = false, background = "dots", children, colorMode, fitViewPadding = 0, zoomOnDoubleClick = false, onViewportResize, onMoveEnd, onNodeMouseEnter, onNodeMouseLeave, onEdgeMouseEnter, onEdgeMouseLeave, onKeyDownCapture, ariaLabelConfig, nodesFocusable = nodesDraggable || nodesSelectable, edgesFocusable = false, showControls = false, minZoom = MinZoom, maxZoom = 3, ...props }) {
|
|
44
44
|
const fitViewOptions = useMemo(() => ({
|
|
45
|
-
minZoom
|
|
46
|
-
maxZoom: 1,
|
|
45
|
+
minZoom,
|
|
46
|
+
maxZoom: Math.min(maxZoom, 1),
|
|
47
47
|
padding: fitViewPadding,
|
|
48
48
|
includeHiddenNodes: false
|
|
49
|
-
}), [
|
|
49
|
+
}), [
|
|
50
|
+
fitViewPadding,
|
|
51
|
+
minZoom,
|
|
52
|
+
maxZoom
|
|
53
|
+
]);
|
|
50
54
|
const isBgWithPattern = background !== "transparent" && background !== "solid";
|
|
51
55
|
const isZoomTooSmall = useIsZoomTooSmall();
|
|
52
56
|
const xyflow = useXYFlow();
|
|
@@ -83,9 +87,8 @@ function BaseXYFlow({ nodes, edges, onEdgesChange, onNodesChange, className, pan
|
|
|
83
87
|
zoomOnScroll: !pannable && zoomable,
|
|
84
88
|
...!zoomable && { zoomActivationKeyCode: null },
|
|
85
89
|
zoomOnDoubleClick,
|
|
86
|
-
maxZoom: zoomable ?
|
|
87
|
-
minZoom: zoomable ?
|
|
88
|
-
fitView,
|
|
90
|
+
maxZoom: zoomable ? maxZoom : 1,
|
|
91
|
+
minZoom: zoomable ? minZoom : 1,
|
|
89
92
|
fitViewOptions,
|
|
90
93
|
preventScrolling: zoomable || pannable,
|
|
91
94
|
defaultMarkerColor: "var(--xy-edge-stroke)",
|
package/dist/base/const.d.ts
CHANGED
package/dist/base/const.js
CHANGED
|
@@ -7,6 +7,7 @@ var ZIndexes = {
|
|
|
7
7
|
Max: 30
|
|
8
8
|
};
|
|
9
9
|
var MinZoom = .05;
|
|
10
|
+
var MaxZoom = 3;
|
|
10
11
|
var FitViewPaddings = {
|
|
11
12
|
default: "16px",
|
|
12
13
|
withControls: {
|
|
@@ -16,5 +17,6 @@ var FitViewPaddings = {
|
|
|
16
17
|
bottom: "16px"
|
|
17
18
|
}
|
|
18
19
|
};
|
|
20
|
+
var IS_SERVER = typeof window === "undefined";
|
|
19
21
|
//#endregion
|
|
20
|
-
export { FitViewPaddings, MinZoom, ZIndexes };
|
|
22
|
+
export { FitViewPaddings, IS_SERVER, MaxZoom, MinZoom, ZIndexes };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RichTextOrEmpty as RichTextType } from '@likec4/core/types';
|
|
2
|
-
import { JsxStyleProps } from '
|
|
2
|
+
import { JsxStyleProps } from '@likec4/styles/types';
|
|
3
3
|
import { ComponentPropsWithoutRef, ForwardRefExoticComponent, DetailedHTMLProps, HTMLAttributes, RefAttributes } from 'react';
|
|
4
|
-
export type MarkdownProps = Omit<ComponentPropsWithoutRef<'div'>, 'dangerouslySetInnerHTML' | 'children' | 'color'> & {
|
|
4
|
+
export type MarkdownProps = Omit<ComponentPropsWithoutRef<'div'>, 'dangerouslySetInnerHTML' | 'children' | 'color' | 'translate'> & {
|
|
5
5
|
value: RichTextType;
|
|
6
6
|
/**
|
|
7
7
|
* When markdown block is used inside a diagram node, this variant should be used to apply the likec4 palette.
|
|
@@ -29,7 +29,7 @@ export type MarkdownProps = Omit<ComponentPropsWithoutRef<'div'>, 'dangerouslySe
|
|
|
29
29
|
*/
|
|
30
30
|
emptyText?: string;
|
|
31
31
|
};
|
|
32
|
-
export declare const Markdown: ForwardRefExoticComponent<Omit<Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "color" | "children" | "dangerouslySetInnerHTML"> & {
|
|
32
|
+
export declare const Markdown: ForwardRefExoticComponent<Omit<Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "color" | "translate" | "children" | "dangerouslySetInnerHTML"> & {
|
|
33
33
|
value: RichTextType;
|
|
34
34
|
/**
|
|
35
35
|
* When markdown block is used inside a diagram node, this variant should be used to apply the likec4 palette.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { RecipeRuntimeFn } from '
|
|
1
|
+
import { RecipeRuntimeFn } from '@likec4/styles/types';
|
|
2
2
|
export declare const compoundActionBtn: RecipeRuntimeFn<{
|
|
3
3
|
delay: {
|
|
4
4
|
true: {
|
|
5
5
|
transitionDelay: {
|
|
6
|
-
base: "0.2s";
|
|
7
|
-
_hover: "
|
|
6
|
+
base: "[0.2s]";
|
|
7
|
+
_hover: "0";
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
10
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { cva } from "@likec4/styles/css";
|
|
2
2
|
//#region src/base-primitives/compound/actionbtns.css.ts
|
|
3
3
|
var compoundActionBtn = cva({
|
|
4
|
-
base: { transitionDuration: "
|
|
4
|
+
base: { transitionDuration: "medium" },
|
|
5
5
|
variants: { delay: { true: { transitionDelay: {
|
|
6
|
-
base: "0.2s",
|
|
7
|
-
_hover: "
|
|
6
|
+
base: "[0.2s]",
|
|
7
|
+
_hover: "0"
|
|
8
8
|
} } } }
|
|
9
9
|
});
|
|
10
10
|
//#endregion
|
|
@@ -3,11 +3,11 @@ import { BaseNodePropsWithData } from '../../base/types';
|
|
|
3
3
|
export type ElementTagProps = {
|
|
4
4
|
tag: string;
|
|
5
5
|
cursor?: 'pointer' | 'default';
|
|
6
|
-
} & Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'color'>;
|
|
6
|
+
} & Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'color' | 'translate'>;
|
|
7
7
|
export declare const ElementTag: ForwardRefExoticComponent<{
|
|
8
8
|
tag: string;
|
|
9
9
|
cursor?: "pointer" | "default";
|
|
10
|
-
} & Omit<Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "color" | "children"> & RefAttributes<HTMLDivElement>>;
|
|
10
|
+
} & Omit<Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "color" | "translate" | "children"> & RefAttributes<HTMLDivElement>>;
|
|
11
11
|
type Data = {
|
|
12
12
|
tags: readonly string[] | null | undefined;
|
|
13
13
|
width: number;
|