likec4 0.57.0 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@likec4/core/utils/guards.js +1 -1
- package/dist/@likec4/diagrams/diagram/Diagram.js +22 -6
- package/dist/@likec4/diagrams/diagram/Nodes.js +1 -1
- package/dist/cli/index.js +243 -251
- package/package.json +14 -14
- package/dist/__app__/App.d.ts +0 -3
- package/dist/__app__/components/CopyToClipboard.d.ts +0 -7
- package/dist/__app__/components/DiagramNotFound.d.ts +0 -5
- package/dist/__app__/components/ThemePanelToggle.d.ts +0 -3
- package/dist/__app__/components/index.d.ts +0 -6
- package/dist/__app__/components/sidebar/DiagramsTree.d.ts +0 -3
- package/dist/__app__/components/sidebar/Sidebar.d.ts +0 -3
- package/dist/__app__/components/view-page/DisplayModeSelector.d.ts +0 -3
- package/dist/__app__/components/view-page/ExportDiagram.d.ts +0 -9
- package/dist/__app__/components/view-page/Header.d.ts +0 -8
- package/dist/__app__/components/view-page/ShareDialog.d.ts +0 -6
- package/dist/__app__/components/view-page/ViewActions.d.ts +0 -6
- package/dist/__app__/const.d.ts +0 -2
- package/dist/__app__/data/atoms.d.ts +0 -5
- package/dist/__app__/data/hooks.d.ts +0 -10
- package/dist/__app__/data/index-page.d.ts +0 -17
- package/dist/__app__/data/index.d.ts +0 -2
- package/dist/__app__/data/sidebar-diagram-tree.d.ts +0 -3
- package/dist/__app__/likec4-views.d.ts +0 -5
- package/dist/__app__/main.d.ts +0 -2
- package/dist/__app__/pages/embed.page.d.ts +0 -9
- package/dist/__app__/pages/export.page.d.ts +0 -8
- package/dist/__app__/pages/index-page/index.d.ts +0 -3
- package/dist/__app__/pages/index.d.ts +0 -5
- package/dist/__app__/pages/useTransparentBackground.d.ts +0 -2
- package/dist/__app__/pages/view-page/ViewAsReact.d.ts +0 -8
- package/dist/__app__/pages/view-page/index.d.ts +0 -4
- package/dist/__app__/pages/view-page/other-formats/ViewAsD2.d.ts +0 -7
- package/dist/__app__/pages/view-page/other-formats/ViewAsDot.d.ts +0 -7
- package/dist/__app__/pages/view-page/other-formats/ViewAsMmd.d.ts +0 -7
- package/dist/__app__/pages/view-page/other-formats.d.ts +0 -9
- package/dist/__app__/pages/view.page.d.ts +0 -10
- package/dist/__app__/router.d.ts +0 -69
- package/dist/__app__/utils/index.d.ts +0 -2
- package/dist/__app__/utils/utils.d.ts +0 -3
- /package/dist/__app__/{App.jsx → src/App.jsx} +0 -0
- /package/dist/__app__/{components → src/components}/CopyToClipboard.jsx +0 -0
- /package/dist/__app__/{components → src/components}/DiagramNotFound.jsx +0 -0
- /package/dist/__app__/{components → src/components}/ThemePanelToggle.jsx +0 -0
- /package/dist/__app__/{components → src/components}/index.js +0 -0
- /package/dist/__app__/{components → src/components}/sidebar/DiagramsTree.jsx +0 -0
- /package/dist/__app__/{components → src/components}/sidebar/Sidebar.jsx +0 -0
- /package/dist/__app__/{components → src/components}/view-page/DisplayModeSelector.jsx +0 -0
- /package/dist/__app__/{components → src/components}/view-page/ExportDiagram.jsx +0 -0
- /package/dist/__app__/{components → src/components}/view-page/Header.jsx +0 -0
- /package/dist/__app__/{components → src/components}/view-page/ShareDialog.jsx +0 -0
- /package/dist/__app__/{components → src/components}/view-page/ViewActions.jsx +0 -0
- /package/dist/__app__/{const.js → src/const.js} +0 -0
- /package/dist/__app__/{data → src/data}/atoms.js +0 -0
- /package/dist/__app__/{data → src/data}/hooks.js +0 -0
- /package/dist/__app__/{data → src/data}/index-page.js +0 -0
- /package/dist/__app__/{data → src/data}/index.js +0 -0
- /package/dist/__app__/{data → src/data}/sidebar-diagram-tree.js +0 -0
- /package/dist/__app__/{likec4-views.js → src/likec4-views.js} +0 -0
- /package/dist/__app__/{main.jsx → src/main.jsx} +0 -0
- /package/dist/__app__/{pages → src/pages}/embed.page.jsx +0 -0
- /package/dist/__app__/{pages → src/pages}/export.page.jsx +0 -0
- /package/dist/__app__/{pages → src/pages}/index-page/index.jsx +0 -0
- /package/dist/__app__/{pages → src/pages}/index.js +0 -0
- /package/dist/__app__/{pages → src/pages}/useTransparentBackground.js +0 -0
- /package/dist/__app__/{pages → src/pages}/view-page/ViewAsReact.jsx +0 -0
- /package/dist/__app__/{pages → src/pages}/view-page/index.js +0 -0
- /package/dist/__app__/{pages → src/pages}/view-page/other-formats/ViewAsD2.jsx +0 -0
- /package/dist/__app__/{pages → src/pages}/view-page/other-formats/ViewAsDot.jsx +0 -0
- /package/dist/__app__/{pages → src/pages}/view-page/other-formats/ViewAsMmd.jsx +0 -0
- /package/dist/__app__/{pages → src/pages}/view-page/other-formats.jsx +0 -0
- /package/dist/__app__/{pages → src/pages}/view.page.jsx +0 -0
- /package/dist/__app__/{router.js → src/router.js} +0 -0
- /package/dist/__app__/{utils → src/utils}/index.js +0 -0
- /package/dist/__app__/{utils → src/utils}/utils.js +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { defaultTheme as theme, nonNullable } from "@likec4/core";
|
|
3
3
|
import { useHookableRef, useUpdateEffect } from "@react-hookz/web";
|
|
4
4
|
import { useSpring } from "@react-spring/konva";
|
|
5
5
|
import { clamp, isNil } from "rambdax";
|
|
6
|
-
import { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
|
|
6
|
+
import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef } from "react";
|
|
7
7
|
import { AnimatedStage, Layer } from "../konva.js";
|
|
8
8
|
import { Edges } from "./Edges.js";
|
|
9
9
|
import { createUseGesture, dragAction, pinchAction } from "@use-gesture/react";
|
|
@@ -36,8 +36,8 @@ const DiagramKonva = /* @__PURE__ */ forwardRef(
|
|
|
36
36
|
zoomable = true,
|
|
37
37
|
animate = true,
|
|
38
38
|
initialPosition,
|
|
39
|
-
onEdgeClick,
|
|
40
|
-
onNodeClick,
|
|
39
|
+
onEdgeClick: _onEdgeClick,
|
|
40
|
+
onNodeClick: _onNodeClick,
|
|
41
41
|
onNodeContextMenu,
|
|
42
42
|
onStageClick,
|
|
43
43
|
onStageContextMenu,
|
|
@@ -49,6 +49,10 @@ const DiagramKonva = /* @__PURE__ */ forwardRef(
|
|
|
49
49
|
}, ref) => {
|
|
50
50
|
const immediate = !animate;
|
|
51
51
|
const id = diagram.id;
|
|
52
|
+
const handlersRef = useSyncedRef({
|
|
53
|
+
onEdgeClick: _onEdgeClick,
|
|
54
|
+
onNodeClick: _onNodeClick
|
|
55
|
+
});
|
|
52
56
|
const containerRef = useRef(null);
|
|
53
57
|
const stageRef = useHookableRef(null, (value) => {
|
|
54
58
|
containerRef.current = value?.container() ?? null;
|
|
@@ -60,6 +64,18 @@ const DiagramKonva = /* @__PURE__ */ forwardRef(
|
|
|
60
64
|
const [paddingTop, paddingRight, paddingBottom, paddingLeft] = isNumber(padding) ? [padding, padding, padding, padding] : padding;
|
|
61
65
|
const width = _width ?? diagram.width + paddingLeft + paddingRight;
|
|
62
66
|
const height = _height ?? diagram.height + paddingTop + paddingBottom;
|
|
67
|
+
const onNodeClick = useCallback(
|
|
68
|
+
(node, e) => {
|
|
69
|
+
handlersRef.current.onNodeClick?.(node, e);
|
|
70
|
+
},
|
|
71
|
+
[handlersRef]
|
|
72
|
+
);
|
|
73
|
+
const onEdgeClick = useCallback(
|
|
74
|
+
(edge, e) => {
|
|
75
|
+
handlersRef.current.onEdgeClick?.(edge, e);
|
|
76
|
+
},
|
|
77
|
+
[handlersRef]
|
|
78
|
+
);
|
|
63
79
|
const toCenterOnRect = (centerTo, opts) => {
|
|
64
80
|
const keepZoom = opts?.keepZoom ?? false;
|
|
65
81
|
const container = containerRef.current;
|
|
@@ -341,8 +357,8 @@ const DiagramKonva = /* @__PURE__ */ forwardRef(
|
|
|
341
357
|
scaleX: 1,
|
|
342
358
|
scaleY: 1,
|
|
343
359
|
children: [
|
|
344
|
-
/* @__PURE__ */ jsx(Nodes, { ...sharedProps, onNodeClick }),
|
|
345
|
-
/* @__PURE__ */ jsx(Edges, { ...sharedProps, onEdgeClick })
|
|
360
|
+
/* @__PURE__ */ jsx(Nodes, { ...sharedProps, onNodeClick: _onNodeClick ? onNodeClick : void 0 }),
|
|
361
|
+
/* @__PURE__ */ jsx(Edges, { ...sharedProps, onEdgeClick: _onEdgeClick ? onEdgeClick : void 0 })
|
|
346
362
|
]
|
|
347
363
|
}
|
|
348
364
|
),
|