likec4 1.7.3 → 1.7.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/__app__/src/chunks/{mantine-B6zTvdIg.js → mantine-CIkjlE3R.js} +2 -2
- package/dist/__app__/src/main.js +105 -158
- package/dist/__app__/src/style.css +1 -1
- package/dist/__app__/tsconfig.tsbuildinfo +1 -1
- package/dist/__app__/webcomponent/webcomponent.js +66 -50
- package/dist/cli/index.mjs +1 -1
- package/package.json +12 -9
- package/react/index.mjs +66 -50
|
@@ -12012,8 +12012,8 @@ export {
|
|
|
12012
12012
|
Menu as a8,
|
|
12013
12013
|
MenuTarget as a9,
|
|
12014
12014
|
MenuDropdown as aa,
|
|
12015
|
-
|
|
12016
|
-
|
|
12015
|
+
MenuLabel as ab,
|
|
12016
|
+
MenuItem as ac,
|
|
12017
12017
|
LoadingOverlay as ad,
|
|
12018
12018
|
useCallbackRef as ae,
|
|
12019
12019
|
Burger as af,
|
package/dist/__app__/src/main.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import { createContext as createContext$1, useLayoutEffect as useLayoutEffect$1, useEffect as useEffect$1, useContext as useContext$1, useRef as useRef$1, useInsertionEffect, useCallback as useCallback$1, useMemo as useMemo$1, forwardRef as forwardRef$1, Fragment as Fragment$1, createElement as createElement$1, useId as useId$1, Children, isValidElement, useState as useState$1, memo as memo$1, Component, StrictMode } from "react";
|
|
4
4
|
import { createRoot } from "react-dom/client";
|
|
5
5
|
import { L as Link, c as createRootRouteWithContext, S as ScrollRestoration, O as Outlet, a as createFileRoute, u as useRouter, b as useParams, d as useRouterState, i as isNotFound, n as notFound, R as RouterProvider, e as createRouter$1, f as createHashHistory, g as createBrowserHistory } from "./chunks/tanstack-router-C3bHLsEH.js";
|
|
6
|
-
import { C as Container, T as Title, a as Text$1, G as Group, B as Button, c as createTheme, M as MantineProvider, b as MantineContext, u as useHotkeys, d as clsx, e as Box, A as ActionIcon$2, H as HoverCard, f as HoverCardTarget, U as UnstyledButton, g as HoverCardDropdown, S as Stack, h as Anchor, i as CopyButton$1, j as useLocalStorage, k as Card, l as CardSection, m as Spoiler, n as ButtonGroup, r as rem, D as Divider, o as Space, p as TooltipGroup, F as Flex, q as Tooltip$2, s as ColorSwatch, t as CheckIcon, v as Select, w as Slider, x as SegmentedControl, P as Popover, y as PopoverTarget, z as PopoverDropdown, E as FloatingIndicator, N as Notification, I as Code, J as SimpleGrid, K as useMantineColorScheme, L as useTree, O as useComputedColorScheme, Q as Tree, R as ThemeIcon, V as Drawer, W as ScrollArea, X as Alert, Y as ModalRoot, Z as ModalOverlay, _ as ModalContent, $ as ModalBody, a0 as Tabs, a1 as TabsList, a2 as TabsTab, a3 as TabsPanel, a4 as useMantineTheme, a5 as useMediaQuery, a6 as useDisclosure, a7 as Paper, a8 as Menu, a9 as MenuTarget, aa as MenuDropdown, ab as
|
|
6
|
+
import { C as Container, T as Title, a as Text$1, G as Group, B as Button, c as createTheme, M as MantineProvider, b as MantineContext, u as useHotkeys, d as clsx, e as Box, A as ActionIcon$2, H as HoverCard, f as HoverCardTarget, U as UnstyledButton, g as HoverCardDropdown, S as Stack, h as Anchor, i as CopyButton$1, j as useLocalStorage, k as Card, l as CardSection, m as Spoiler, n as ButtonGroup, r as rem, D as Divider, o as Space, p as TooltipGroup, F as Flex, q as Tooltip$2, s as ColorSwatch, t as CheckIcon, v as Select, w as Slider, x as SegmentedControl, P as Popover, y as PopoverTarget, z as PopoverDropdown, E as FloatingIndicator, N as Notification, I as Code, J as SimpleGrid, K as useMantineColorScheme, L as useTree, O as useComputedColorScheme, Q as Tree, R as ThemeIcon, V as Drawer, W as ScrollArea, X as Alert, Y as ModalRoot, Z as ModalOverlay, _ as ModalContent, $ as ModalBody, a0 as Tabs, a1 as TabsList, a2 as TabsTab, a3 as TabsPanel, a4 as useMantineTheme, a5 as useMediaQuery, a6 as useDisclosure, a7 as Paper, a8 as Menu, a9 as MenuTarget, aa as MenuDropdown, ab as MenuLabel, ac as MenuItem, ad as LoadingOverlay, ae as useCallbackRef, af as Burger, ag as Loader } from "./chunks/mantine-CIkjlE3R.js";
|
|
7
7
|
import { ComponentName, basepath, useHashHistory } from "./const.js";
|
|
8
8
|
import { u as useReactFlow, a as useStoreApi, b as useNodesData, c as useStore, d as createWithEqualityFn, e as applyNodeChanges, f as applyEdgeChanges, g as getViewportForBounds, h as getNodeDimensions, i as getBoundsOfRects, s as shallow$1, j as boxToRect, k as useStoreWithEqualityFn, E as EdgeLabelRenderer, H as Handle, P as Position, l as useOnViewportChange, m as index, n as useOnSelectionChange, B as Background, o as BackgroundVariant, C as Controls, R as ReactFlowProvider } from "./chunks/likec4-DA506XqP.js";
|
|
9
9
|
import { useLikeC4Views, useLikeC4View } from "virtual:likec4/store";
|
|
@@ -3805,7 +3805,7 @@ var u$3 = (e2, a2, n2) => e2.reduce(a2, n2);
|
|
|
3805
3805
|
function n$2(e2) {
|
|
3806
3806
|
return !!e2;
|
|
3807
3807
|
}
|
|
3808
|
-
function t$
|
|
3808
|
+
function t$3(...n2) {
|
|
3809
3809
|
return u$4(Object.keys, n2);
|
|
3810
3810
|
}
|
|
3811
3811
|
function a$1(...e2) {
|
|
@@ -3815,7 +3815,7 @@ var n$1 = (e2) => e2.at(-1);
|
|
|
3815
3815
|
function l(n2) {
|
|
3816
3816
|
return n2 != null;
|
|
3817
3817
|
}
|
|
3818
|
-
function o$
|
|
3818
|
+
function o$1(a2) {
|
|
3819
3819
|
return (t2) => !a2(t2);
|
|
3820
3820
|
}
|
|
3821
3821
|
function e$3(n2) {
|
|
@@ -3832,15 +3832,6 @@ function f(...e2) {
|
|
|
3832
3832
|
return u$4(i$1, e2, e$1(u$2));
|
|
3833
3833
|
}
|
|
3834
3834
|
var i$1 = (e2, n2) => e2.find(n2), u$2 = (e2) => (n2, t2, o2) => e2(n2, t2, o2) ? { done: !0, hasNext: !0, next: n2 } : s;
|
|
3835
|
-
function o$1(...e2) {
|
|
3836
|
-
return u$4(t$3, e2);
|
|
3837
|
-
}
|
|
3838
|
-
var t$3 = (e2, r2) => {
|
|
3839
|
-
for (let n2 = e2.length - 1; n2 >= 0; n2--) {
|
|
3840
|
-
let a2 = e2[n2];
|
|
3841
|
-
if (r2(a2, n2, e2)) return a2;
|
|
3842
|
-
}
|
|
3843
|
-
};
|
|
3844
3835
|
function d(...e2) {
|
|
3845
3836
|
return u$4(r$1, e2, e$1(o));
|
|
3846
3837
|
}
|
|
@@ -3927,7 +3918,7 @@ function whereOperatorAsPredicate(operator) {
|
|
|
3927
3918
|
}
|
|
3928
3919
|
case isNotOperator(operator): {
|
|
3929
3920
|
const predicate = whereOperatorAsPredicate(operator.not);
|
|
3930
|
-
return o$
|
|
3921
|
+
return o$1(predicate);
|
|
3931
3922
|
}
|
|
3932
3923
|
case isAndOperator(operator): {
|
|
3933
3924
|
const predicates = operator.and.map(whereOperatorAsPredicate);
|
|
@@ -4266,7 +4257,7 @@ const trackedConnections = /* @__PURE__ */ new Map(), getTrackedConnectionState
|
|
|
4266
4257
|
Compound: 2,
|
|
4267
4258
|
Edge: 4,
|
|
4268
4259
|
Element: 6
|
|
4269
|
-
}, MinZoom = 0.1, { abs: abs$1, cos: cos$1, sin: sin$1, acos: acos$1, atan2, sqrt: sqrt$1, pow } = Math;
|
|
4260
|
+
}, MinZoom = 0.1, MaxZoom = 2, { abs: abs$1, cos: cos$1, sin: sin$1, acos: acos$1, atan2, sqrt: sqrt$1, pow } = Math;
|
|
4270
4261
|
function crt(v) {
|
|
4271
4262
|
return v < 0 ? -pow(-v, 1 / 3) : pow(v, 1 / 3);
|
|
4272
4263
|
}
|
|
@@ -6905,13 +6896,6 @@ var IconArrowBigDownLines = createReactComponent("outline", "arrow-big-down-line
|
|
|
6905
6896
|
* See the LICENSE file in the root directory of this source tree.
|
|
6906
6897
|
*/
|
|
6907
6898
|
var IconArrowLeft = createReactComponent("outline", "arrow-left", "IconArrowLeft", [["path", { d: "M5 12l14 0", key: "svg-0" }], ["path", { d: "M5 12l6 6", key: "svg-1" }], ["path", { d: "M5 12l6 -6", key: "svg-2" }]]);
|
|
6908
|
-
/**
|
|
6909
|
-
* @license @tabler/icons-react v3.11.0 - MIT
|
|
6910
|
-
*
|
|
6911
|
-
* This source code is licensed under the MIT license.
|
|
6912
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6913
|
-
*/
|
|
6914
|
-
var IconBrandReact = createReactComponent("outline", "brand-react", "IconBrandReact", [["path", { d: "M6.306 8.711c-2.602 .723 -4.306 1.926 -4.306 3.289c0 2.21 4.477 4 10 4c.773 0 1.526 -.035 2.248 -.102", key: "svg-0" }], ["path", { d: "M17.692 15.289c2.603 -.722 4.308 -1.926 4.308 -3.289c0 -2.21 -4.477 -4 -10 -4c-.773 0 -1.526 .035 -2.25 .102", key: "svg-1" }], ["path", { d: "M6.305 15.287c-.676 2.615 -.485 4.693 .695 5.373c1.913 1.105 5.703 -1.877 8.464 -6.66c.387 -.67 .733 -1.339 1.036 -2", key: "svg-2" }], ["path", { d: "M17.694 8.716c.677 -2.616 .487 -4.696 -.694 -5.376c-1.913 -1.105 -5.703 1.877 -8.464 6.66c-.387 .67 -.733 1.34 -1.037 2", key: "svg-3" }], ["path", { d: "M12 5.424c-1.925 -1.892 -3.82 -2.766 -5 -2.084c-1.913 1.104 -1.226 5.877 1.536 10.66c.386 .67 .793 1.304 1.212 1.896", key: "svg-4" }], ["path", { d: "M12 18.574c1.926 1.893 3.821 2.768 5 2.086c1.913 -1.104 1.226 -5.877 -1.536 -10.66c-.375 -.65 -.78 -1.283 -1.212 -1.897", key: "svg-5" }], ["path", { d: "M11.5 12.866a1 1 0 1 0 1 -1.732a1 1 0 0 0 -1 1.732z", key: "svg-6" }]]);
|
|
6915
6899
|
/**
|
|
6916
6900
|
* @license @tabler/icons-react v3.11.0 - MIT
|
|
6917
6901
|
*
|
|
@@ -6968,13 +6952,6 @@ var IconFileCode = createReactComponent("outline", "file-code", "IconFileCode",
|
|
|
6968
6952
|
* See the LICENSE file in the root directory of this source tree.
|
|
6969
6953
|
*/
|
|
6970
6954
|
var IconFileSymlink = createReactComponent("outline", "file-symlink", "IconFileSymlink", [["path", { d: "M4 21v-4a3 3 0 0 1 3 -3h5", key: "svg-0" }], ["path", { d: "M9 17l3 -3l-3 -3", key: "svg-1" }], ["path", { d: "M14 3v4a1 1 0 0 0 1 1h4", key: "svg-2" }], ["path", { d: "M5 11v-6a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-9.5", key: "svg-3" }]]);
|
|
6971
|
-
/**
|
|
6972
|
-
* @license @tabler/icons-react v3.11.0 - MIT
|
|
6973
|
-
*
|
|
6974
|
-
* This source code is licensed under the MIT license.
|
|
6975
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6976
|
-
*/
|
|
6977
|
-
var IconFile = createReactComponent("outline", "file", "IconFile", [["path", { d: "M14 3v4a1 1 0 0 0 1 1h4", key: "svg-0" }], ["path", { d: "M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z", key: "svg-1" }]]);
|
|
6978
6955
|
/**
|
|
6979
6956
|
* @license @tabler/icons-react v3.11.0 - MIT
|
|
6980
6957
|
*
|
|
@@ -8879,10 +8856,13 @@ function useXYFlowEvents() {
|
|
|
8879
8856
|
onDoubleClick: (event) => {
|
|
8880
8857
|
const {
|
|
8881
8858
|
onCanvasDblClick,
|
|
8859
|
+
zoomable,
|
|
8882
8860
|
xystore,
|
|
8861
|
+
viewportChanged,
|
|
8862
|
+
fitDiagram,
|
|
8883
8863
|
resetLastClicked
|
|
8884
8864
|
} = diagramApi.getState();
|
|
8885
|
-
resetLastClicked(), xystore.getState().resetSelectedElements(), onCanvasDblClick || event.stopPropagation(), onCanvasDblClick?.(event);
|
|
8865
|
+
resetLastClicked(), xystore.getState().resetSelectedElements(), onCanvasDblClick || event.stopPropagation(), zoomable && viewportChanged && fitDiagram(), onCanvasDblClick?.(event);
|
|
8886
8866
|
},
|
|
8887
8867
|
onPaneClick: (event) => {
|
|
8888
8868
|
if (dbclickLock())
|
|
@@ -9093,11 +9073,11 @@ function XYFlow({
|
|
|
9093
9073
|
hasOnEdgeContextMenu,
|
|
9094
9074
|
translateX,
|
|
9095
9075
|
translateY
|
|
9096
|
-
} = useDiagramState(selector$1, shallowEqual), layoutConstraints = useLayoutConstraints(), handlers = useXYFlowEvents();
|
|
9076
|
+
} = useDiagramState(selector$1, shallowEqual), [zoomOnDoubleClick, setZoomOnDoubleClick] = useState$1(zoomable), layoutConstraints = useLayoutConstraints(), handlers = useXYFlowEvents();
|
|
9097
9077
|
return useOnViewportChange({
|
|
9098
9078
|
onEnd: ({ x: x2, y: y2, zoom }) => {
|
|
9099
9079
|
const roundedX = Math.round(x2), roundedY = Math.round(y2);
|
|
9100
|
-
(x2 !== roundedX || y2 !== roundedY) && xyflowApi.setState({ transform: [roundedX, roundedY, zoom] });
|
|
9080
|
+
(x2 !== roundedX || y2 !== roundedY) && xyflowApi.setState({ transform: [roundedX, roundedY, zoom] }), setZoomOnDoubleClick(zoomable && zoom < 1.1);
|
|
9101
9081
|
}
|
|
9102
9082
|
}), /* @__PURE__ */ jsx(
|
|
9103
9083
|
index,
|
|
@@ -9114,7 +9094,7 @@ function XYFlow({
|
|
|
9114
9094
|
...!zoomable && {
|
|
9115
9095
|
zoomActivationKeyCode: null
|
|
9116
9096
|
},
|
|
9117
|
-
maxZoom: zoomable ?
|
|
9097
|
+
maxZoom: zoomable ? MaxZoom : 1,
|
|
9118
9098
|
minZoom: zoomable ? MinZoom : 1,
|
|
9119
9099
|
fitView,
|
|
9120
9100
|
fitViewOptions: useMemo$1(() => ({
|
|
@@ -9149,7 +9129,7 @@ function XYFlow({
|
|
|
9149
9129
|
onNodeDragStop: layoutConstraints.onNodeDragStop
|
|
9150
9130
|
},
|
|
9151
9131
|
nodeDragThreshold: 3,
|
|
9152
|
-
zoomOnDoubleClick
|
|
9132
|
+
zoomOnDoubleClick,
|
|
9153
9133
|
elevateNodesOnSelect: !1,
|
|
9154
9134
|
selectNodesOnDrag: !1,
|
|
9155
9135
|
onNodesChange,
|
|
@@ -9210,62 +9190,75 @@ function DiagramTitlePanel() {
|
|
|
9210
9190
|
radius: "sm",
|
|
9211
9191
|
className: card,
|
|
9212
9192
|
withBorder: !0,
|
|
9213
|
-
p: "md",
|
|
9214
|
-
pb: isCollapsed ? "sm" : "md",
|
|
9193
|
+
p: isCollapsed ? "sm" : "md",
|
|
9215
9194
|
onDoubleClick: (e2) => e2.stopPropagation(),
|
|
9216
9195
|
children: [
|
|
9217
|
-
/* @__PURE__ */ jsx(CardSection, {
|
|
9196
|
+
isCollapsed && /* @__PURE__ */ jsx(CardSection, { children: /* @__PURE__ */ jsx(
|
|
9218
9197
|
Button,
|
|
9219
9198
|
{
|
|
9220
9199
|
fullWidth: !0,
|
|
9221
|
-
|
|
9222
|
-
|
|
9200
|
+
justify: "stretch",
|
|
9201
|
+
size: "sm",
|
|
9223
9202
|
py: 2,
|
|
9224
9203
|
radius: "0",
|
|
9225
|
-
variant:
|
|
9226
|
-
color: "
|
|
9204
|
+
variant: "subtle",
|
|
9205
|
+
color: "dark",
|
|
9227
9206
|
onClick: toggle,
|
|
9228
|
-
children: /* @__PURE__ */ jsx(
|
|
9207
|
+
children: /* @__PURE__ */ jsx(Text$1, { inline: !0, fw: 500, fz: "xs", c: "gray", children: title$12 })
|
|
9229
9208
|
}
|
|
9230
9209
|
) }),
|
|
9231
|
-
/* @__PURE__ */ jsxs(
|
|
9232
|
-
/* @__PURE__ */ jsx(
|
|
9233
|
-
|
|
9234
|
-
{
|
|
9235
|
-
component: "div",
|
|
9236
|
-
flex: "1",
|
|
9237
|
-
size: isCollapsed ? "sm" : "lg",
|
|
9238
|
-
fw: 500,
|
|
9239
|
-
lh: 1.1,
|
|
9240
|
-
className: title,
|
|
9241
|
-
children: title$12
|
|
9242
|
-
}
|
|
9243
|
-
),
|
|
9244
|
-
/* @__PURE__ */ jsxs(
|
|
9245
|
-
Text$1,
|
|
9210
|
+
!isCollapsed && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9211
|
+
/* @__PURE__ */ jsx(CardSection, { mb: "sm", children: /* @__PURE__ */ jsx(
|
|
9212
|
+
Button,
|
|
9246
9213
|
{
|
|
9247
|
-
|
|
9248
|
-
component: "div",
|
|
9249
|
-
flex: "0 0 auto",
|
|
9250
|
-
inline: !0,
|
|
9214
|
+
fullWidth: !0,
|
|
9251
9215
|
size: "xs",
|
|
9252
|
-
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
children:
|
|
9259
|
-
/* @__PURE__ */ jsxs("span", { style: { userSelect: "none" }, children: [
|
|
9260
|
-
"id:",
|
|
9261
|
-
" "
|
|
9262
|
-
] }),
|
|
9263
|
-
id2
|
|
9264
|
-
]
|
|
9216
|
+
h: "sm",
|
|
9217
|
+
py: 2,
|
|
9218
|
+
radius: "0",
|
|
9219
|
+
variant: "subtle",
|
|
9220
|
+
color: "gray",
|
|
9221
|
+
onClick: toggle,
|
|
9222
|
+
children: /* @__PURE__ */ jsx(IconMenu, { size: 11, opacity: 0.7 })
|
|
9265
9223
|
}
|
|
9266
|
-
)
|
|
9267
|
-
|
|
9268
|
-
|
|
9224
|
+
) }),
|
|
9225
|
+
/* @__PURE__ */ jsxs(Group, { justify: "stretch", wrap: "nowrap", mb: "sm", children: [
|
|
9226
|
+
/* @__PURE__ */ jsx(
|
|
9227
|
+
Text$1,
|
|
9228
|
+
{
|
|
9229
|
+
component: "div",
|
|
9230
|
+
flex: "1",
|
|
9231
|
+
size: "md",
|
|
9232
|
+
fw: 500,
|
|
9233
|
+
lh: 1.1,
|
|
9234
|
+
className: title,
|
|
9235
|
+
children: title$12
|
|
9236
|
+
}
|
|
9237
|
+
),
|
|
9238
|
+
/* @__PURE__ */ jsxs(
|
|
9239
|
+
Text$1,
|
|
9240
|
+
{
|
|
9241
|
+
hidden: isCollapsed,
|
|
9242
|
+
component: "div",
|
|
9243
|
+
flex: "0 0 auto",
|
|
9244
|
+
inline: !0,
|
|
9245
|
+
size: "xs",
|
|
9246
|
+
fz: 9,
|
|
9247
|
+
fw: 500,
|
|
9248
|
+
c: "dimmed",
|
|
9249
|
+
style: {
|
|
9250
|
+
userSelect: "all"
|
|
9251
|
+
},
|
|
9252
|
+
children: [
|
|
9253
|
+
/* @__PURE__ */ jsxs("span", { style: { userSelect: "none" }, children: [
|
|
9254
|
+
"id:",
|
|
9255
|
+
" "
|
|
9256
|
+
] }),
|
|
9257
|
+
id2
|
|
9258
|
+
]
|
|
9259
|
+
}
|
|
9260
|
+
)
|
|
9261
|
+
] }),
|
|
9269
9262
|
description$12 && /* @__PURE__ */ jsx(
|
|
9270
9263
|
Spoiler,
|
|
9271
9264
|
{
|
|
@@ -9431,7 +9424,7 @@ const {
|
|
|
9431
9424
|
{ key: "primary", value: primary.fill },
|
|
9432
9425
|
{ key: "secondary", value: secondary.fill },
|
|
9433
9426
|
{ key: "muted", value: muted.fill }
|
|
9434
|
-
], colors = t$
|
|
9427
|
+
], colors = t$3(otherColors).map((key) => ({
|
|
9435
9428
|
key,
|
|
9436
9429
|
value: defaultTheme.elements[key].fill
|
|
9437
9430
|
})), NodeOptions = memo$1(({ selectedNodeIds }) => {
|
|
@@ -10244,7 +10237,7 @@ const Route$9 = createFileRoute("/")({
|
|
|
10244
10237
|
component: IndexPage
|
|
10245
10238
|
});
|
|
10246
10239
|
function IndexPage() {
|
|
10247
|
-
const views = t$
|
|
10240
|
+
const views = t$3(useLikeC4Views());
|
|
10248
10241
|
return /* @__PURE__ */ jsx(
|
|
10249
10242
|
SimpleGrid,
|
|
10250
10243
|
{
|
|
@@ -10750,7 +10743,9 @@ function ShareModal({
|
|
|
10750
10743
|
);
|
|
10751
10744
|
}
|
|
10752
10745
|
function Header({ diagram }) {
|
|
10753
|
-
const
|
|
10746
|
+
const isReactDiagramRoute = useRouterState().matches.some(
|
|
10747
|
+
({ routeId }) => routeId === "/view/$viewId/" || routeId === "/view/$viewId/editor"
|
|
10748
|
+
), { breakpoints } = useMantineTheme(), isTablet = useMediaQuery(`(min-width: ${breakpoints.md})`) ?? !1, [opened, { open, close }] = useDisclosure(!1);
|
|
10754
10749
|
return /* @__PURE__ */ jsxs(
|
|
10755
10750
|
Paper,
|
|
10756
10751
|
{
|
|
@@ -10758,17 +10753,28 @@ function Header({ diagram }) {
|
|
|
10758
10753
|
pos: "fixed",
|
|
10759
10754
|
top: "0.5rem",
|
|
10760
10755
|
right: "0.5rem",
|
|
10761
|
-
|
|
10762
|
-
px: "xs",
|
|
10756
|
+
p: 4,
|
|
10763
10757
|
radius: "sm",
|
|
10764
10758
|
shadow: "xl",
|
|
10765
10759
|
children: [
|
|
10766
10760
|
/* @__PURE__ */ jsxs(Group, { gap: isTablet ? 6 : 4, wrap: "nowrap", children: [
|
|
10767
|
-
/* @__PURE__ */
|
|
10768
|
-
|
|
10761
|
+
isReactDiagramRoute ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10762
|
+
/* @__PURE__ */ jsx(Button, { size: isTablet ? "sm" : "xs", leftSection: /* @__PURE__ */ jsx(IconShare, { size: 14 }), onClick: open, children: "Share" }),
|
|
10763
|
+
/* @__PURE__ */ jsx(ExportButton, {})
|
|
10764
|
+
] }) : /* @__PURE__ */ jsx(
|
|
10765
|
+
Button,
|
|
10766
|
+
{
|
|
10767
|
+
component: Link,
|
|
10768
|
+
to: "/view/$viewId/",
|
|
10769
|
+
size: isTablet ? "sm" : "xs",
|
|
10770
|
+
variant: "subtle",
|
|
10771
|
+
color: "gray",
|
|
10772
|
+
children: "Back to diagram"
|
|
10773
|
+
}
|
|
10774
|
+
),
|
|
10769
10775
|
/* @__PURE__ */ jsx(Divider, { orientation: "vertical", mr: isTablet ? 4 : "xs" }),
|
|
10770
|
-
/* @__PURE__ */ jsx(
|
|
10771
|
-
/* @__PURE__ */ jsx(
|
|
10776
|
+
/* @__PURE__ */ jsx(ColorSchemeToggle, {}),
|
|
10777
|
+
/* @__PURE__ */ jsx(Space, {})
|
|
10772
10778
|
] }),
|
|
10773
10779
|
/* @__PURE__ */ jsx(
|
|
10774
10780
|
ShareModal,
|
|
@@ -10782,74 +10788,7 @@ function Header({ diagram }) {
|
|
|
10782
10788
|
}
|
|
10783
10789
|
);
|
|
10784
10790
|
}
|
|
10785
|
-
|
|
10786
|
-
{
|
|
10787
|
-
route: "/view/$viewId",
|
|
10788
|
-
icon: /* @__PURE__ */ jsx(IconBrandReact, { opacity: 0.7, size: 16 }),
|
|
10789
|
-
title: /* @__PURE__ */ jsx(Fragment, { children: "React" })
|
|
10790
|
-
},
|
|
10791
|
-
{
|
|
10792
|
-
route: "/view/$viewId/editor",
|
|
10793
|
-
icon: /* @__PURE__ */ jsx(IconBrandReact, { opacity: 0.7, size: 16 }),
|
|
10794
|
-
title: /* @__PURE__ */ jsx(Text$1, { size: "sm", fw: "500", variant: "gradient", gradient: { from: "pink", to: "violet", deg: 90 }, children: "Editor" })
|
|
10795
|
-
},
|
|
10796
|
-
{
|
|
10797
|
-
route: "/view/$viewId/dot",
|
|
10798
|
-
icon: /* @__PURE__ */ jsx(IconFile, { opacity: 0.7, size: 16 }),
|
|
10799
|
-
title: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10800
|
-
"Graphviz ",
|
|
10801
|
-
/* @__PURE__ */ jsx(Text$1, { component: "span", size: "xs", c: "dimmed", ml: 4, children: ".dot" })
|
|
10802
|
-
] })
|
|
10803
|
-
},
|
|
10804
|
-
{
|
|
10805
|
-
route: "/view/$viewId/d2",
|
|
10806
|
-
icon: /* @__PURE__ */ jsx(IconFile, { opacity: 0.7, size: 16 }),
|
|
10807
|
-
title: /* @__PURE__ */ jsx(Fragment, { children: "D2" })
|
|
10808
|
-
},
|
|
10809
|
-
{
|
|
10810
|
-
route: "/view/$viewId/mmd",
|
|
10811
|
-
icon: /* @__PURE__ */ jsx(IconFile, { opacity: 0.7, size: 16 }),
|
|
10812
|
-
title: /* @__PURE__ */ jsx(Fragment, { children: "Mermaid" })
|
|
10813
|
-
}
|
|
10814
|
-
], routeIds = viewPages.map(({ route }) => route);
|
|
10815
|
-
function ViewPageButton({
|
|
10816
|
-
isTablet
|
|
10817
|
-
}) {
|
|
10818
|
-
const { viewId } = useParams({
|
|
10819
|
-
from: "/view/$viewId"
|
|
10820
|
-
}), routerState = useRouterState(), matchedRoute = o$1(routerState.matches, ({ routeId }) => routeIds.includes(routeId)), matched = (matchedRoute && viewPages.find(({ route }) => route === matchedRoute.routeId)) ?? viewPages[0];
|
|
10821
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Menu, { shadow: "md", width: 200, trigger: "click-hover", openDelay: 100, children: [
|
|
10822
|
-
/* @__PURE__ */ jsx(MenuTarget, { children: /* @__PURE__ */ jsx(
|
|
10823
|
-
Button,
|
|
10824
|
-
{
|
|
10825
|
-
leftSection: matched.icon,
|
|
10826
|
-
variant: "subtle",
|
|
10827
|
-
size: isTablet ? "sm" : "xs",
|
|
10828
|
-
color: "gray",
|
|
10829
|
-
px: "xs",
|
|
10830
|
-
rightSection: /* @__PURE__ */ jsx(IconChevronDown, { opacity: 0.5, size: 14 }),
|
|
10831
|
-
children: matched.title
|
|
10832
|
-
}
|
|
10833
|
-
) }),
|
|
10834
|
-
/* @__PURE__ */ jsx(MenuDropdown, { children: viewPages.map(({ route, icon, title: title2 }) => /* @__PURE__ */ jsx(
|
|
10835
|
-
MenuItem,
|
|
10836
|
-
{
|
|
10837
|
-
component: Link,
|
|
10838
|
-
to: route,
|
|
10839
|
-
search: !0,
|
|
10840
|
-
params: { viewId },
|
|
10841
|
-
leftSection: icon,
|
|
10842
|
-
...route === matched.route ? { bg: "gray" } : {},
|
|
10843
|
-
style: {
|
|
10844
|
-
whiteSpace: "nowrap"
|
|
10845
|
-
},
|
|
10846
|
-
children: title2
|
|
10847
|
-
},
|
|
10848
|
-
route
|
|
10849
|
-
)) })
|
|
10850
|
-
] }) });
|
|
10851
|
-
}
|
|
10852
|
-
function ExportButton({ diagram }) {
|
|
10791
|
+
function ExportButton() {
|
|
10853
10792
|
const params = useParams({
|
|
10854
10793
|
from: "/view/$viewId"
|
|
10855
10794
|
});
|
|
@@ -10971,17 +10910,22 @@ async function downloadAsPng({
|
|
|
10971
10910
|
console.error(err), window.alert("Failed to export to PNG, check the console for more details.");
|
|
10972
10911
|
}
|
|
10973
10912
|
}
|
|
10974
|
-
const
|
|
10913
|
+
const asBoolean = (v) => {
|
|
10914
|
+
if (typeof v == "boolean")
|
|
10915
|
+
return v;
|
|
10916
|
+
if (typeof v == "string")
|
|
10917
|
+
return v === "true";
|
|
10918
|
+
}, Route$6 = createFileRoute("/export/$viewId")({
|
|
10975
10919
|
component: ExportPage,
|
|
10976
10920
|
validateSearch: (search) => ({
|
|
10977
|
-
download:
|
|
10921
|
+
download: asBoolean(search.download)
|
|
10978
10922
|
})
|
|
10979
10923
|
});
|
|
10980
10924
|
function ExportPage() {
|
|
10981
10925
|
const {
|
|
10982
10926
|
padding = 20,
|
|
10983
|
-
download
|
|
10984
|
-
} = Route$6.useSearch(), { viewId } = Route$6.useParams(), diagram = useLikeC4View(viewId), viewportRef = useRef$1(null), loadingOverlayRef = useRef$1(null);
|
|
10927
|
+
download = !1
|
|
10928
|
+
} = Route$6.useSearch(), { viewId } = Route$6.useParams(), diagram = useLikeC4View(viewId), viewportRef = useRef$1(null), loadingOverlayRef = useRef$1(null), downloadedRef = useRef$1(!1);
|
|
10985
10929
|
if (useTransparentBackground(), useEffect$1(() => {
|
|
10986
10930
|
document.querySelectorAll(".react-flow__viewport").forEach((el) => {
|
|
10987
10931
|
el.style.transform = "";
|
|
@@ -10989,7 +10933,10 @@ function ExportPage() {
|
|
|
10989
10933
|
}), useDebouncedEffect(
|
|
10990
10934
|
() => {
|
|
10991
10935
|
const viewport = viewportRef.current;
|
|
10992
|
-
!download || !viewport || !diagram
|
|
10936
|
+
if (!download || !viewport || !diagram)
|
|
10937
|
+
return;
|
|
10938
|
+
const loadingOverlay = loadingOverlayRef.current;
|
|
10939
|
+
loadingOverlay && (loadingOverlay.style.display = "none"), !downloadedRef.current && (downloadedRef.current = !0, downloadAsPng({
|
|
10993
10940
|
pngFilename: viewId,
|
|
10994
10941
|
viewport
|
|
10995
10942
|
}));
|