@likec4/diagram 1.42.0 → 1.43.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/bundle/index.js +3768 -3370
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +40 -14
- package/dist/LikeC4Diagram.props.d.ts +12 -17
- package/dist/LikeC4View.d.ts +23 -4
- package/dist/LikeC4View.js +6 -6
- package/dist/ReactLikeC4.d.ts +1 -1
- package/dist/ReactLikeC4.js +3 -5
- package/dist/StaticLikeC4Diagram.js +1 -1
- package/dist/base/const.d.ts +1 -1
- package/dist/base/const.js +1 -1
- package/dist/components/Logo.js +42 -0
- package/dist/components/RootContainer.js +10 -7
- package/dist/context/RootContainerContext.d.ts +11 -0
- package/dist/context/RootContainerContext.js +14 -1
- package/dist/hooks/useReducedGraphics.d.ts +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/likec4diagram/DiagramXYFlow.js +2 -4
- package/dist/likec4diagram/state/DiagramActorProvider.js +3 -4
- package/dist/likec4diagram/ui/notation/NotationPanel.js +5 -8
- package/dist/navigationpanel/NavigationPanelControls.js +2 -2
- package/dist/navigationpanel/NavigationPanelDropdown.js +30 -6
- package/dist/navigationpanel/controls/BurgerButton.js +46 -8
- package/dist/navigationpanel/styles.css.js +1 -1
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +14 -0
- package/dist/overlays/element-details/ElementDetailsCard.js +11 -83
- package/dist/overlays/element-details/MetadataValue.d.ts +9 -0
- package/dist/overlays/element-details/MetadataValue.js +261 -0
- package/dist/overlays/relationship-details/actor.js +6 -2
- package/dist/overlays/relationships-browser/const.d.ts +3 -3
- package/dist/overlays/relationships-browser/const.js +3 -3
- package/dist/shadowroot/ShadowRoot.js +53 -12
- package/dist/shadowroot/styles.css.d.ts +0 -4
- package/dist/shadowroot/styles.css.js +1 -41
- package/dist/styles.css2.js +1 -1
- package/package.json +20 -20
- package/panda.buildinfo.json +42 -22
- package/styles-min.css +1 -1
- package/styles.css +1 -1
- package/dist/context/ControlsCustomLayout.d.ts +0 -12
- package/dist/context/ControlsCustomLayout.js +0 -8
- package/dist/context/ReduceGraphics.d.ts +0 -12
- package/dist/context/ReduceGraphics.js +0 -26
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconMenu2.js +0 -14
|
@@ -6,8 +6,10 @@ import { HStack, VStack, Box } from '@likec4/styles/jsx';
|
|
|
6
6
|
import { vstack, hstack } from '@likec4/styles/patterns';
|
|
7
7
|
import { PopoverDropdown, createScopedKeydownHandler, ScrollAreaAutosize, Input, rem, Button, Divider, Highlight, UnstyledButton, Breadcrumbs } from '@mantine/core';
|
|
8
8
|
import { useThrottledCallback, useUncontrolled } from '@mantine/hooks';
|
|
9
|
+
import { useMountEffect } from '@react-hookz/web';
|
|
9
10
|
import { useSelector } from '@xstate/react';
|
|
10
11
|
import { deepEqual } from 'fast-equals';
|
|
12
|
+
import { useRef } from 'react';
|
|
11
13
|
import { isEmpty, pipe, sort, isArray } from 'remeda';
|
|
12
14
|
import { NavigationLink } from '../components/NavigationLink.js';
|
|
13
15
|
import { useLikeC4Model } from '../hooks/useLikeC4Model.js';
|
|
@@ -17,6 +19,7 @@ import { breadcrumbTitle } from './styles.css.js';
|
|
|
17
19
|
import { useOnDiagramEvent } from '../hooks/useDiagram.js';
|
|
18
20
|
import IconSearch from '../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js';
|
|
19
21
|
import IconChevronRight from '../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js';
|
|
22
|
+
import IconDirectionSignFilled from '../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js';
|
|
20
23
|
import IconStack2 from '../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js';
|
|
21
24
|
import IconZoomScan from '../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js';
|
|
22
25
|
import IconStarFilled from '../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js';
|
|
@@ -70,7 +73,7 @@ function NavigationPanelDropdown() {
|
|
|
70
73
|
/* @__PURE__ */ jsx(
|
|
71
74
|
ScrollAreaAutosize,
|
|
72
75
|
{
|
|
73
|
-
scrollbars: "
|
|
76
|
+
scrollbars: "x",
|
|
74
77
|
type: "auto",
|
|
75
78
|
offsetScrollbars: "present",
|
|
76
79
|
classNames: {
|
|
@@ -81,6 +84,11 @@ function NavigationPanelDropdown() {
|
|
|
81
84
|
]
|
|
82
85
|
})
|
|
83
86
|
},
|
|
87
|
+
styles: {
|
|
88
|
+
viewport: {
|
|
89
|
+
overscrollBehavior: "none"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
84
92
|
children: hasSearchQuery ? /* @__PURE__ */ jsx(SearchResults, { searchQuery: normalizeViewPath(searchQuery).toLowerCase() }) : /* @__PURE__ */ jsx(FolderColumns, {})
|
|
85
93
|
}
|
|
86
94
|
)
|
|
@@ -123,7 +131,7 @@ function SearchResults({ searchQuery }) {
|
|
|
123
131
|
"calc(100cqh - 200px)"
|
|
124
132
|
]
|
|
125
133
|
}),
|
|
126
|
-
children: /* @__PURE__ */ jsx(VStack, { gap: "
|
|
134
|
+
children: /* @__PURE__ */ jsx(VStack, { gap: "0.5", children: found.map((v) => /* @__PURE__ */ jsx(
|
|
127
135
|
FoundedView,
|
|
128
136
|
{
|
|
129
137
|
view: v,
|
|
@@ -282,7 +290,7 @@ const ViewTypeIcon = {
|
|
|
282
290
|
}
|
|
283
291
|
),
|
|
284
292
|
deployment: /* @__PURE__ */ jsx(IconStack2, { size: 16, stroke: 1.5, className: viewTypeIconCss }),
|
|
285
|
-
dynamic: /* @__PURE__ */ jsx(
|
|
293
|
+
dynamic: /* @__PURE__ */ jsx(IconDirectionSignFilled, { size: 18, className: viewTypeIconCss })
|
|
286
294
|
};
|
|
287
295
|
const ColumnScrollArea = ScrollAreaAutosize.withProps({
|
|
288
296
|
scrollbars: "y",
|
|
@@ -332,10 +340,18 @@ function FolderColumns() {
|
|
|
332
340
|
const columns = useNavigationActorContext(selectColumns, deepEqual);
|
|
333
341
|
return /* @__PURE__ */ jsx(HStack, { gap: "xs", alignItems: "stretch", children: columns.flatMap((column, i) => [
|
|
334
342
|
i > 0 && /* @__PURE__ */ jsx(Divider, { orientation: "vertical" }, "divider" + i),
|
|
335
|
-
/* @__PURE__ */ jsx(
|
|
343
|
+
/* @__PURE__ */ jsx(
|
|
344
|
+
FolderColumn,
|
|
345
|
+
{
|
|
346
|
+
data: column,
|
|
347
|
+
isLast: i == columns.length - 1
|
|
348
|
+
},
|
|
349
|
+
column.folderPath
|
|
350
|
+
)
|
|
336
351
|
]) });
|
|
337
352
|
}
|
|
338
|
-
function FolderColumn({ data }) {
|
|
353
|
+
function FolderColumn({ data, isLast }) {
|
|
354
|
+
const ref = useRef(null);
|
|
339
355
|
const actor = useNavigationActorRef();
|
|
340
356
|
const onItemClicked = (item) => (e) => {
|
|
341
357
|
e.stopPropagation();
|
|
@@ -345,7 +361,15 @@ function FolderColumn({ data }) {
|
|
|
345
361
|
actor.send({ type: "select.view", viewId: item.viewId });
|
|
346
362
|
}
|
|
347
363
|
};
|
|
348
|
-
|
|
364
|
+
useMountEffect(() => {
|
|
365
|
+
if (isLast && ref.current) {
|
|
366
|
+
ref.current.scrollIntoView({
|
|
367
|
+
inline: "nearest",
|
|
368
|
+
behavior: "smooth"
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
return /* @__PURE__ */ jsx(Box, { mb: "1", ref, children: /* @__PURE__ */ jsx(ColumnScrollArea, { children: /* @__PURE__ */ jsx(VStack, { gap: "0.5", children: data.items.map((item, i) => /* @__PURE__ */ jsx(
|
|
349
373
|
FolderColumnItem,
|
|
350
374
|
{
|
|
351
375
|
columnItem: item,
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { cx, css } from '@likec4/styles/css';
|
|
3
|
+
import { hstack } from '@likec4/styles/patterns';
|
|
4
|
+
import { UnstyledButton } from '@mantine/core';
|
|
5
|
+
import * as m from 'motion/react-m';
|
|
6
|
+
import { Logo, LogoIcon } from '../../components/Logo.js';
|
|
2
7
|
import { useDiagramEventHandlers } from '../../context/DiagramEventHandlers.js';
|
|
3
|
-
import { PanelActionIcon } from '../_common.js';
|
|
4
8
|
import { useNavigationActor } from '../hooks.js';
|
|
5
|
-
import IconMenu2 from '../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconMenu2.js';
|
|
6
9
|
|
|
7
10
|
const BurgerButton = () => {
|
|
8
11
|
const actor = useNavigationActor();
|
|
9
12
|
const { onBurgerMenuClick } = useDiagramEventHandlers();
|
|
10
|
-
return /* @__PURE__ */ jsx(
|
|
11
|
-
|
|
13
|
+
return /* @__PURE__ */ jsx(m.div, { layout: "position", children: /* @__PURE__ */ jsxs(
|
|
14
|
+
UnstyledButton,
|
|
12
15
|
{
|
|
13
|
-
layout: "position",
|
|
14
16
|
onMouseEnter: () => {
|
|
15
17
|
actor.send({ type: "breadcrumbs.mouseEnter.root" });
|
|
16
18
|
},
|
|
@@ -26,9 +28,45 @@ const BurgerButton = () => {
|
|
|
26
28
|
}
|
|
27
29
|
actor.send({ type: "breadcrumbs.click.root" });
|
|
28
30
|
},
|
|
29
|
-
|
|
31
|
+
className: cx(
|
|
32
|
+
"mantine-active",
|
|
33
|
+
hstack({
|
|
34
|
+
padding: "0.5",
|
|
35
|
+
// _active: {
|
|
36
|
+
// transform: 'translateY(1px)',
|
|
37
|
+
// },
|
|
38
|
+
width: {
|
|
39
|
+
base: "[20px]",
|
|
40
|
+
"@/md": "[64px]"
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
),
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
Logo,
|
|
47
|
+
{
|
|
48
|
+
className: css({
|
|
49
|
+
display: {
|
|
50
|
+
base: "none",
|
|
51
|
+
"@/md": "block"
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
LogoIcon,
|
|
58
|
+
{
|
|
59
|
+
className: css({
|
|
60
|
+
display: {
|
|
61
|
+
base: "block",
|
|
62
|
+
"@/md": "none"
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
]
|
|
30
68
|
}
|
|
31
|
-
);
|
|
69
|
+
) });
|
|
32
70
|
};
|
|
33
71
|
|
|
34
72
|
export { BurgerButton };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import createReactComponent from '../createReactComponent.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @license @tabler/icons-react v3.35.0 - MIT
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license.
|
|
7
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const __iconNode = [["path", { "d": "M10.52 2.614a2.095 2.095 0 0 1 2.835 -.117l.126 .117l7.905 7.905c.777 .777 .816 2.013 .117 2.836l-.117 .126l-7.905 7.905a2.094 2.094 0 0 1 -2.836 .117l-.126 -.117l-7.907 -7.906a2.096 2.096 0 0 1 -.115 -2.835l.117 -.126l7.905 -7.905zm5.969 9.535l.01 -.116l-.003 -.12l-.016 -.114l-.03 -.11l-.044 -.112l-.052 -.098l-.076 -.105l-.07 -.081l-3.5 -3.5l-.095 -.083a1 1 0 0 0 -1.226 0l-.094 .083l-.083 .094a1 1 0 0 0 0 1.226l.083 .094l1.792 1.793h-5.085l-.117 .007a1 1 0 0 0 0 1.986l.117 .007h5.085l-1.792 1.793l-.083 .094a1 1 0 0 0 1.403 1.403l.094 -.083l3.5 -3.5l.097 -.112l.05 -.074l.037 -.067l.05 -.112l.023 -.076l.025 -.117z", "key": "svg-0" }]];
|
|
12
|
+
const IconDirectionSignFilled = createReactComponent("filled", "direction-sign-filled", "DirectionSignFilled", __iconNode);
|
|
13
|
+
|
|
14
|
+
export { __iconNode, IconDirectionSignFilled as default };
|
|
@@ -12,6 +12,7 @@ import { Link } from '../../components/Link.js';
|
|
|
12
12
|
import { useCurrentViewModel } from '../../hooks/useCurrentViewModel.js';
|
|
13
13
|
import { useDiagram } from '../../hooks/useDiagram.js';
|
|
14
14
|
import { elementIcon, card, cardHeader, title, tabsPanel, tabsTab, tabsList, tabsRoot, propertiesGrid, resizeHandle, backdropOpacity, backdropBlur, dialog, propertyLabel, viewButton, viewButtonTitle } from './ElementDetailsCard.css.js';
|
|
15
|
+
import { MetadataProvider, MetadataValue } from './MetadataValue.js';
|
|
15
16
|
import { TabPanelDeployments } from './TabPanelDeployments.js';
|
|
16
17
|
import { TabPanelRelationships } from './TabPanelRelationships.js';
|
|
17
18
|
import { TabPanelStructure } from './TabPanelStructure.js';
|
|
@@ -340,7 +341,7 @@ function ElementDetailsCard({
|
|
|
340
341
|
)
|
|
341
342
|
] })
|
|
342
343
|
] }),
|
|
343
|
-
/* @__PURE__ */ jsxs(
|
|
344
|
+
/* @__PURE__ */ jsx(MetadataProvider, { children: /* @__PURE__ */ jsxs(
|
|
344
345
|
Tabs,
|
|
345
346
|
{
|
|
346
347
|
value: activeTab,
|
|
@@ -420,7 +421,7 @@ function ElementDetailsCard({
|
|
|
420
421
|
/* @__PURE__ */ jsx(TabsPanel, { value: "Deployments", children: /* @__PURE__ */ jsx(ScrollArea, { scrollbars: "y", type: "auto", children: /* @__PURE__ */ jsx(TabPanelDeployments, { elementFqn: elementModel.id }) }) })
|
|
421
422
|
]
|
|
422
423
|
}
|
|
423
|
-
),
|
|
424
|
+
) }),
|
|
424
425
|
/* @__PURE__ */ jsx(
|
|
425
426
|
m.div,
|
|
426
427
|
{
|
|
@@ -476,97 +477,24 @@ function ElementProperty({
|
|
|
476
477
|
function ElementMetata({
|
|
477
478
|
value: metadata
|
|
478
479
|
}) {
|
|
479
|
-
|
|
480
|
-
|
|
480
|
+
const metadataEntries = entries(metadata).sort(([a], [b]) => a.localeCompare(b));
|
|
481
|
+
return /* @__PURE__ */ jsx(MetadataProvider, { children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
482
|
+
/* @__PURE__ */ jsx(PropertyLabel, { style: { justifySelf: "end", textAlign: "right" }, children: "metadata" }),
|
|
481
483
|
/* @__PURE__ */ jsx(
|
|
482
484
|
Box,
|
|
483
485
|
{
|
|
484
486
|
className: css({
|
|
485
|
-
flex: 1,
|
|
486
487
|
display: "grid",
|
|
487
488
|
gridTemplateColumns: "min-content 1fr",
|
|
488
|
-
gridAutoRows: "min-content
|
|
489
|
-
gap: `[
|
|
489
|
+
gridAutoRows: "min-content",
|
|
490
|
+
gap: `[12px 16px]`,
|
|
490
491
|
alignItems: "baseline",
|
|
491
|
-
justifyItems: "stretch"
|
|
492
|
-
paddingRight: "xxs"
|
|
492
|
+
justifyItems: "stretch"
|
|
493
493
|
}),
|
|
494
|
-
children:
|
|
495
|
-
"div",
|
|
496
|
-
{
|
|
497
|
-
style: {
|
|
498
|
-
display: "contents"
|
|
499
|
-
},
|
|
500
|
-
className: "group",
|
|
501
|
-
children: [
|
|
502
|
-
/* @__PURE__ */ jsxs(
|
|
503
|
-
"div",
|
|
504
|
-
{
|
|
505
|
-
className: css({
|
|
506
|
-
fontSize: "sm",
|
|
507
|
-
fontWeight: 500,
|
|
508
|
-
justifySelf: "end",
|
|
509
|
-
whiteSpace: "nowrap"
|
|
510
|
-
}),
|
|
511
|
-
children: [
|
|
512
|
-
key,
|
|
513
|
-
":"
|
|
514
|
-
]
|
|
515
|
-
}
|
|
516
|
-
),
|
|
517
|
-
/* @__PURE__ */ jsx(
|
|
518
|
-
"div",
|
|
519
|
-
{
|
|
520
|
-
className: css({}),
|
|
521
|
-
children: /* @__PURE__ */ jsx(
|
|
522
|
-
ScrollArea.Autosize,
|
|
523
|
-
{
|
|
524
|
-
type: "auto",
|
|
525
|
-
mah: 200,
|
|
526
|
-
classNames: {
|
|
527
|
-
root: css({
|
|
528
|
-
transitionProperty: "all",
|
|
529
|
-
transitionDuration: "fast",
|
|
530
|
-
transitionTimingFunction: "inOut",
|
|
531
|
-
rounded: "sm",
|
|
532
|
-
color: "mantine.colors.gray[8]",
|
|
533
|
-
_dark: {
|
|
534
|
-
color: "mantine.colors.dark[1]"
|
|
535
|
-
},
|
|
536
|
-
_groupHover: {
|
|
537
|
-
transitionTimingFunction: "out",
|
|
538
|
-
color: "mantine.colors.defaultColor",
|
|
539
|
-
background: "mantine.colors.defaultHover"
|
|
540
|
-
}
|
|
541
|
-
}),
|
|
542
|
-
viewport: css({
|
|
543
|
-
overscrollBehavior: "none"
|
|
544
|
-
})
|
|
545
|
-
},
|
|
546
|
-
children: /* @__PURE__ */ jsx(
|
|
547
|
-
"div",
|
|
548
|
-
{
|
|
549
|
-
className: css({
|
|
550
|
-
fontSize: "sm",
|
|
551
|
-
padding: "xxs",
|
|
552
|
-
whiteSpace: "pre",
|
|
553
|
-
fontFamily: "mono",
|
|
554
|
-
userSelect: "all"
|
|
555
|
-
}),
|
|
556
|
-
children: value
|
|
557
|
-
}
|
|
558
|
-
)
|
|
559
|
-
}
|
|
560
|
-
)
|
|
561
|
-
}
|
|
562
|
-
)
|
|
563
|
-
]
|
|
564
|
-
},
|
|
565
|
-
key
|
|
566
|
-
))
|
|
494
|
+
children: metadataEntries.map(([key, value]) => /* @__PURE__ */ jsx(MetadataValue, { label: key, value }, key))
|
|
567
495
|
}
|
|
568
496
|
)
|
|
569
|
-
] });
|
|
497
|
+
] }) });
|
|
570
498
|
}
|
|
571
499
|
|
|
572
500
|
export { ElementDetailsCard };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function MetadataProvider({ children }: {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
interface MetadataValueProps {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string | string[];
|
|
7
|
+
}
|
|
8
|
+
export declare function MetadataValue({ label, value }: MetadataValueProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { css } from '@likec4/styles/css';
|
|
3
|
+
import { UnstyledButton, Flex, Text, Box, Stack, Tooltip } from '@mantine/core';
|
|
4
|
+
import { useState, useRef, useEffect } from 'react';
|
|
5
|
+
import IconChevronDown from '../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js';
|
|
6
|
+
import IconChevronRight from '../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js';
|
|
7
|
+
|
|
8
|
+
function MetadataProvider({ children }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
10
|
+
}
|
|
11
|
+
function TruncatedValue({ value, isExpanded }) {
|
|
12
|
+
const [isTruncated, setIsTruncated] = useState(false);
|
|
13
|
+
const textRef = useRef(null);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (textRef.current) {
|
|
16
|
+
setIsTruncated(textRef.current.scrollWidth > textRef.current.clientWidth);
|
|
17
|
+
}
|
|
18
|
+
}, [value]);
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
Tooltip,
|
|
21
|
+
{
|
|
22
|
+
label: isTruncated && !isExpanded ? value : null,
|
|
23
|
+
multiline: true,
|
|
24
|
+
w: 300,
|
|
25
|
+
withinPortal: true,
|
|
26
|
+
children: /* @__PURE__ */ jsx(
|
|
27
|
+
Text,
|
|
28
|
+
{
|
|
29
|
+
ref: textRef,
|
|
30
|
+
component: "div",
|
|
31
|
+
className: css({
|
|
32
|
+
fontSize: "sm",
|
|
33
|
+
padding: "xs",
|
|
34
|
+
userSelect: "all",
|
|
35
|
+
color: "mantine.colors.text",
|
|
36
|
+
lineHeight: 1.4,
|
|
37
|
+
whiteSpace: isExpanded ? "pre-wrap" : "nowrap",
|
|
38
|
+
overflow: isExpanded ? "visible" : "hidden",
|
|
39
|
+
textOverflow: isExpanded ? "unset" : "ellipsis",
|
|
40
|
+
wordBreak: isExpanded ? "break-word" : "normal",
|
|
41
|
+
minWidth: 0,
|
|
42
|
+
width: "100%"
|
|
43
|
+
}),
|
|
44
|
+
children: value
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
function MultiValueDisplay({
|
|
51
|
+
values,
|
|
52
|
+
isExpanded,
|
|
53
|
+
onToggle
|
|
54
|
+
}) {
|
|
55
|
+
if (isExpanded) {
|
|
56
|
+
return /* @__PURE__ */ jsx(Stack, { gap: "xs", children: values.map((value, index) => /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "xs", children: [
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
Text,
|
|
59
|
+
{
|
|
60
|
+
className: css({
|
|
61
|
+
fontSize: "xs",
|
|
62
|
+
color: "mantine.colors.gray[5]",
|
|
63
|
+
fontWeight: 500,
|
|
64
|
+
flexShrink: 0,
|
|
65
|
+
_dark: {
|
|
66
|
+
color: "mantine.colors.dark[3]"
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
69
|
+
children: "•"
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ jsx(
|
|
73
|
+
Box,
|
|
74
|
+
{
|
|
75
|
+
className: css({
|
|
76
|
+
minHeight: "32px",
|
|
77
|
+
display: "flex",
|
|
78
|
+
alignItems: "center",
|
|
79
|
+
flex: 1
|
|
80
|
+
}),
|
|
81
|
+
children: /* @__PURE__ */ jsx(TruncatedValue, { value, isExpanded: true })
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
] }, index)) });
|
|
85
|
+
}
|
|
86
|
+
return /* @__PURE__ */ jsx(
|
|
87
|
+
Box,
|
|
88
|
+
{
|
|
89
|
+
className: css({
|
|
90
|
+
minHeight: "32px",
|
|
91
|
+
display: "flex",
|
|
92
|
+
alignItems: "center",
|
|
93
|
+
padding: "xs",
|
|
94
|
+
gap: "xs",
|
|
95
|
+
flexWrap: "wrap",
|
|
96
|
+
minWidth: 0,
|
|
97
|
+
// Allow shrinking
|
|
98
|
+
overflow: "hidden"
|
|
99
|
+
// Prevent overflow
|
|
100
|
+
}),
|
|
101
|
+
children: values.map((value, index) => /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "xs", style: { minWidth: 0 }, children: [
|
|
102
|
+
/* @__PURE__ */ jsx(
|
|
103
|
+
Text,
|
|
104
|
+
{
|
|
105
|
+
className: css({
|
|
106
|
+
fontSize: "sm",
|
|
107
|
+
padding: "[4px 8px]",
|
|
108
|
+
backgroundColor: "mantine.colors.white",
|
|
109
|
+
color: "mantine.colors.text",
|
|
110
|
+
borderRadius: "sm",
|
|
111
|
+
border: "1px solid",
|
|
112
|
+
borderColor: "mantine.colors.gray[3]",
|
|
113
|
+
whiteSpace: "nowrap",
|
|
114
|
+
overflow: "hidden",
|
|
115
|
+
textOverflow: "ellipsis",
|
|
116
|
+
maxWidth: "min(200px, 100%)",
|
|
117
|
+
minWidth: "60px",
|
|
118
|
+
flex: "0 1 auto",
|
|
119
|
+
userSelect: "all",
|
|
120
|
+
_dark: {
|
|
121
|
+
backgroundColor: "mantine.colors.dark[9]",
|
|
122
|
+
color: "mantine.colors.text",
|
|
123
|
+
borderColor: "mantine.colors.dark[4]"
|
|
124
|
+
}
|
|
125
|
+
}),
|
|
126
|
+
title: value,
|
|
127
|
+
children: value
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
index < values.length - 1 && /* @__PURE__ */ jsx(
|
|
131
|
+
Text,
|
|
132
|
+
{
|
|
133
|
+
className: css({
|
|
134
|
+
fontSize: "xs",
|
|
135
|
+
color: "mantine.colors.gray[5]",
|
|
136
|
+
fontWeight: 500,
|
|
137
|
+
flexShrink: 0,
|
|
138
|
+
_dark: {
|
|
139
|
+
color: "mantine.colors.dark[3]"
|
|
140
|
+
}
|
|
141
|
+
}),
|
|
142
|
+
children: "•"
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
] }, index))
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
function MetadataValue({ label, value }) {
|
|
150
|
+
const elements = Array.isArray(value) ? value : typeof value === "string" && value.includes("\n") ? value.split("\n").map((s) => s.trim()).filter(Boolean) : [value];
|
|
151
|
+
const hasMultipleElements = elements.length > 1;
|
|
152
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
153
|
+
const handleToggle = () => {
|
|
154
|
+
setIsExpanded(!isExpanded);
|
|
155
|
+
};
|
|
156
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
157
|
+
hasMultipleElements ? /* @__PURE__ */ jsx(
|
|
158
|
+
UnstyledButton,
|
|
159
|
+
{
|
|
160
|
+
onClick: handleToggle,
|
|
161
|
+
className: css({
|
|
162
|
+
fontSize: "xs",
|
|
163
|
+
color: "mantine.colors.dimmed",
|
|
164
|
+
justifySelf: "end",
|
|
165
|
+
textAlign: "right",
|
|
166
|
+
userSelect: "none",
|
|
167
|
+
display: "flex",
|
|
168
|
+
alignItems: "center",
|
|
169
|
+
justifyContent: "flex-end",
|
|
170
|
+
gap: "xs",
|
|
171
|
+
padding: "[4px 8px]",
|
|
172
|
+
borderRadius: "sm",
|
|
173
|
+
whiteSpace: "nowrap",
|
|
174
|
+
transition: "all 150ms ease",
|
|
175
|
+
_hover: {
|
|
176
|
+
backgroundColor: "mantine.colors.gray[1]",
|
|
177
|
+
color: "mantine.colors.primary[6]",
|
|
178
|
+
_dark: {
|
|
179
|
+
backgroundColor: "mantine.colors.dark[7]",
|
|
180
|
+
color: "mantine.colors.primary[4]"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}),
|
|
184
|
+
children: /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "xs", children: [
|
|
185
|
+
/* @__PURE__ */ jsxs(Text, { component: "span", size: "xs", fw: 700, children: [
|
|
186
|
+
label,
|
|
187
|
+
":"
|
|
188
|
+
] }),
|
|
189
|
+
/* @__PURE__ */ jsx(
|
|
190
|
+
Text,
|
|
191
|
+
{
|
|
192
|
+
component: "span",
|
|
193
|
+
className: css({
|
|
194
|
+
fontSize: "xs",
|
|
195
|
+
fontWeight: 500,
|
|
196
|
+
color: "mantine.colors.gray[6]",
|
|
197
|
+
backgroundColor: "mantine.colors.gray[1]",
|
|
198
|
+
padding: "[1px 4px]",
|
|
199
|
+
borderRadius: "xs",
|
|
200
|
+
_dark: {
|
|
201
|
+
color: "mantine.colors.dark[2]",
|
|
202
|
+
backgroundColor: "mantine.colors.dark[6]"
|
|
203
|
+
}
|
|
204
|
+
}),
|
|
205
|
+
children: elements.length
|
|
206
|
+
}
|
|
207
|
+
),
|
|
208
|
+
isExpanded ? /* @__PURE__ */ jsx(IconChevronDown, { size: 12 }) : /* @__PURE__ */ jsx(IconChevronRight, { size: 12 })
|
|
209
|
+
] })
|
|
210
|
+
}
|
|
211
|
+
) : /* @__PURE__ */ jsxs(
|
|
212
|
+
Text,
|
|
213
|
+
{
|
|
214
|
+
component: "div",
|
|
215
|
+
className: css({
|
|
216
|
+
fontSize: "xs",
|
|
217
|
+
color: "mantine.colors.dimmed",
|
|
218
|
+
justifySelf: "end",
|
|
219
|
+
textAlign: "right",
|
|
220
|
+
userSelect: "none",
|
|
221
|
+
whiteSpace: "nowrap",
|
|
222
|
+
padding: "[4px 8px]",
|
|
223
|
+
fontWeight: 700
|
|
224
|
+
}),
|
|
225
|
+
children: [
|
|
226
|
+
label,
|
|
227
|
+
":"
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
),
|
|
231
|
+
/* @__PURE__ */ jsx(
|
|
232
|
+
Box,
|
|
233
|
+
{
|
|
234
|
+
className: css({
|
|
235
|
+
justifySelf: "stretch",
|
|
236
|
+
alignSelf: "start"
|
|
237
|
+
}),
|
|
238
|
+
children: hasMultipleElements ? /* @__PURE__ */ jsx(
|
|
239
|
+
MultiValueDisplay,
|
|
240
|
+
{
|
|
241
|
+
values: elements,
|
|
242
|
+
isExpanded,
|
|
243
|
+
onToggle: handleToggle
|
|
244
|
+
}
|
|
245
|
+
) : /* @__PURE__ */ jsx(
|
|
246
|
+
Box,
|
|
247
|
+
{
|
|
248
|
+
className: css({
|
|
249
|
+
minHeight: "32px",
|
|
250
|
+
display: "flex",
|
|
251
|
+
alignItems: "center"
|
|
252
|
+
}),
|
|
253
|
+
children: /* @__PURE__ */ jsx(TruncatedValue, { value: elements[0] || "", isExpanded })
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
] });
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export { MetadataProvider, MetadataValue };
|
|
@@ -21,6 +21,10 @@ function inputToSubject(input) {
|
|
|
21
21
|
target: input.target
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
+
const ViewPadding = {
|
|
25
|
+
x: "22px",
|
|
26
|
+
y: "22px"
|
|
27
|
+
};
|
|
24
28
|
const _relationshipDetailsLogic = setup({
|
|
25
29
|
types: {
|
|
26
30
|
context: {},
|
|
@@ -38,13 +42,13 @@ const _relationshipDetailsLogic = setup({
|
|
|
38
42
|
const maxZoom = Math.max(xyflow.getZoom(), 1);
|
|
39
43
|
if (bounds) {
|
|
40
44
|
const { width, height } = xystore.getState();
|
|
41
|
-
const viewport = getViewportForBounds(bounds, width, height, MinZoom, maxZoom,
|
|
45
|
+
const viewport = getViewportForBounds(bounds, width, height, MinZoom, maxZoom, ViewPadding);
|
|
42
46
|
xyflow.setViewport(viewport, duration > 0 ? { duration } : void 0).catch(console.error);
|
|
43
47
|
} else {
|
|
44
48
|
xyflow.fitView({
|
|
45
49
|
minZoom: MinZoom,
|
|
46
50
|
maxZoom,
|
|
47
|
-
padding:
|
|
51
|
+
padding: ViewPadding,
|
|
48
52
|
...duration > 0 && { duration }
|
|
49
53
|
}).catch(console.error);
|
|
50
54
|
}
|