@likec4/diagram 1.23.1 → 1.24.1
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.css.d.ts +5 -0
- package/dist/LikeC4Diagram.css.js +1 -0
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +6 -2
- package/dist/LikeC4Diagram.props.d.ts +6 -0
- package/dist/StaticLikeC4Diagram.js +2 -1
- package/dist/base/BaseXYFlow.d.ts +1 -1
- package/dist/base/BaseXYFlow.js +12 -3
- package/dist/base/const.d.ts +1 -1
- package/dist/base/const.js +1 -1
- package/dist/base/primitives/compound/CompoundActionButton.css.js +2 -0
- package/dist/base/primitives/compound/CompoundDetailsButton.css.js +2 -0
- package/dist/base/primitives/compound/CompoundNodeContainer.css.d.ts +0 -1
- package/dist/base/primitives/compound/CompoundNodeContainer.css.js +4 -4
- package/dist/base/primitives/compound/CompoundNodeContainer.js +35 -22
- package/dist/base/primitives/compound/CompoundTitle.css.js +3 -1
- package/dist/base/primitives/customNode.js +1 -1
- package/dist/base/primitives/edge/EdgeContainer.js +5 -4
- package/dist/base/primitives/edge/EdgeLabel.css.d.ts +0 -1
- package/dist/base/primitives/edge/EdgeLabel.css.js +2 -5
- package/dist/base/primitives/edge/EdgeLabel.js +5 -5
- package/dist/base/primitives/edge/edge.css.d.ts +1 -1
- package/dist/base/primitives/edge/edge.css.js +4 -5
- package/dist/base/primitives/element/ElementActionButtons.css.js +2 -0
- package/dist/base/primitives/element/ElementActionButtons.js +4 -3
- package/dist/base/primitives/element/ElementDetailsButton.css.js +2 -0
- package/dist/base/primitives/element/ElementNodeContainer.css.js +2 -0
- package/dist/base/primitives/element/ElementNodeContainer.js +3 -1
- package/dist/base/primitives/element/ElementShape.css.js +4 -2
- package/dist/base/primitives/element/ElementShape.js +2 -3
- package/dist/base/primitives/element/ElementTitle.css.js +2 -0
- package/dist/base/primitives/element/styles.css.js +2 -0
- package/dist/components/SearchControl.css.js +2 -0
- package/dist/context/FramerMotionConfig.d.ts +9 -1
- package/dist/context/FramerMotionConfig.js +5 -2
- package/dist/context/RootContainer.js +13 -1
- package/dist/diagram.css +1 -1
- package/dist/globals.css.d.ts +2 -0
- package/dist/hooks/safeContext.js +1 -0
- package/dist/hooks/useDiagram.d.ts +415 -693
- package/dist/hooks/useDiagram.js +1 -0
- package/dist/hooks/useIsReducedGraphics.d.ts +4 -0
- package/dist/hooks/useIsReducedGraphics.js +8 -0
- package/dist/hooks/useXYFlow.js +1 -1
- package/dist/likec4diagram/DiagramUI.d.ts +2 -1
- package/dist/likec4diagram/DiagramUI.js +5 -3
- package/dist/likec4diagram/custom/nodes/nodeTypes.js +2 -2
- package/dist/likec4diagram/ui/controls/styles.css.js +2 -0
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.css.js +2 -0
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +3 -4
- package/dist/likec4diagram/ui/search/LikeC4Search.css.js +2 -0
- package/dist/overlays/element-details/ElementDetailsCard.js +12 -8
- package/dist/overlays/element-details/actor.d.ts +9084 -2569
- package/dist/overlays/overlay/Overlay.js +6 -3
- package/dist/overlays/relationship-details/RelationshipDetails.js +31 -17
- package/dist/overlays/relationship-details/actor.d.ts +228 -3
- package/dist/overlays/relationship-details/actor.js +86 -14
- package/dist/overlays/relationship-details/hooks.d.ts +3 -0
- package/dist/overlays/relationship-details/hooks.js +6 -2
- package/dist/overlays/relationships-browser/-useRelationshipsView.js +12 -3
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +12 -3
- package/dist/overlays/relationships-browser/actor.d.ts +271 -54
- package/dist/overlays/relationships-browser/actor.js +86 -23
- package/dist/state/DiagramActorProvider.js +12 -2
- package/dist/state/diagram-machine.d.ts +426 -694
- package/dist/state/diagram-machine.js +89 -68
- package/dist/state/persistence.d.ts +5 -0
- package/dist/state/persistence.js +23 -0
- package/package.json +9 -9
- package/src/LikeC4Diagram.css.ts +13 -5
- package/src/LikeC4Diagram.props.ts +7 -0
- package/src/LikeC4Diagram.tsx +33 -24
- package/src/StaticLikeC4Diagram.tsx +2 -1
- package/src/base/BaseXYFlow.tsx +14 -9
- package/src/base/const.ts +1 -1
- package/src/base/primitives/compound/CompoundActionButton.css.ts +6 -0
- package/src/base/primitives/compound/CompoundDetailsButton.css.ts +4 -0
- package/src/base/primitives/compound/CompoundNodeContainer.css.ts +41 -59
- package/src/base/primitives/compound/CompoundNodeContainer.tsx +42 -22
- package/src/base/primitives/compound/CompoundTitle.css.ts +14 -13
- package/src/base/primitives/customNode.ts +3 -2
- package/src/base/primitives/edge/EdgeContainer.tsx +4 -3
- package/src/base/primitives/edge/EdgeLabel.css.ts +17 -11
- package/src/base/primitives/edge/EdgeLabel.tsx +4 -4
- package/src/base/primitives/edge/edge.css.ts +47 -27
- package/src/base/primitives/element/ElementActionButtons.css.ts +4 -0
- package/src/base/primitives/element/ElementActionButtons.tsx +4 -2
- package/src/base/primitives/element/ElementDetailsButton.css.ts +6 -8
- package/src/base/primitives/element/ElementNodeContainer.css.ts +18 -21
- package/src/base/primitives/element/ElementNodeContainer.tsx +3 -1
- package/src/base/primitives/element/ElementShape.css.ts +10 -6
- package/src/base/primitives/element/ElementShape.tsx +2 -2
- package/src/components/SearchControl.css.ts +11 -4
- package/src/context/FramerMotionConfig.tsx +13 -2
- package/src/context/RootContainer.tsx +9 -2
- package/src/globals.css.ts +3 -0
- package/src/hooks/safeContext.tsx +2 -1
- package/src/hooks/useDiagram.ts +1 -0
- package/src/hooks/useIsReducedGraphics.ts +5 -0
- package/src/hooks/useXYFlow.ts +1 -1
- package/src/likec4diagram/DiagramUI.tsx +5 -3
- package/src/likec4diagram/custom/nodes/nodeTypes.tsx +2 -2
- package/src/likec4diagram/ui/controls/styles.css.ts +11 -1
- package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.css.ts +10 -3
- package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +6 -3
- package/src/likec4diagram/ui/search/LikeC4Search.css.ts +1 -0
- package/src/overlays/element-details/ElementDetailsCard.tsx +238 -231
- package/src/overlays/overlay/Overlay.css.ts +1 -9
- package/src/overlays/overlay/Overlay.tsx +6 -3
- package/src/overlays/relationship-details/RelationshipDetails.tsx +83 -66
- package/src/overlays/relationship-details/actor.ts +106 -13
- package/src/overlays/relationship-details/hooks.ts +6 -2
- package/src/overlays/relationships-browser/-useRelationshipsView.ts +10 -0
- package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +16 -8
- package/src/overlays/relationships-browser/actor.ts +92 -22
- package/src/state/DiagramActorProvider.tsx +13 -2
- package/src/state/diagram-machine.ts +88 -65
- package/src/state/persistence.ts +22 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { createVar, fallbackVar,
|
|
1
|
+
import { createVar, fallbackVar, style } from '@vanilla-extract/css'
|
|
2
|
+
import { reactFlowReducedGraphics } from '../../../LikeC4Diagram.css'
|
|
2
3
|
import { easings, vars } from '../../../theme-vars'
|
|
3
4
|
|
|
4
5
|
export const stokeFillMix = createVar('stroke-fill-mix')
|
|
@@ -15,12 +16,6 @@ export const container = style({
|
|
|
15
16
|
vars: {
|
|
16
17
|
[stokeFillMix]: `color-mix(in srgb, ${vars.element.stroke} 90%, ${vars.element.fill})`,
|
|
17
18
|
},
|
|
18
|
-
// selectors: {
|
|
19
|
-
// ':where(.react-flow__node.selected) &': {
|
|
20
|
-
// willChange: 'transform',
|
|
21
|
-
// },
|
|
22
|
-
// },
|
|
23
|
-
// Catch pointer below the element
|
|
24
19
|
':after': {
|
|
25
20
|
content: ' ',
|
|
26
21
|
position: 'absolute',
|
|
@@ -31,19 +26,21 @@ export const container = style({
|
|
|
31
26
|
background: 'transparent',
|
|
32
27
|
pointerEvents: 'all',
|
|
33
28
|
},
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
globalStyle(`.react-flow__node:has(${container}[data-likec4-dimmed="true"])`, {
|
|
37
|
-
opacity: 0.25,
|
|
38
|
-
transition: `opacity 400ms ${easings.inOut}, filter 500ms ${easings.inOut}`,
|
|
39
|
-
transitionDelay: '50ms',
|
|
40
|
-
filter: `grayscale(0.85) ${fallbackVar(vars.safariAnimationHook, 'blur(2px)')}`,
|
|
41
|
-
willChange: 'opacity, filter',
|
|
42
|
-
})
|
|
43
29
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
30
|
+
selectors: {
|
|
31
|
+
[`&:is([data-likec4-dimmed="true"])`]: {
|
|
32
|
+
opacity: 0.25,
|
|
33
|
+
transition: `opacity 400ms ${easings.inOut}, filter 500ms ${easings.inOut}`,
|
|
34
|
+
transitionDelay: '50ms',
|
|
35
|
+
filter: `grayscale(0.85) ${fallbackVar(vars.safariAnimationHook, 'blur(2px)')}`,
|
|
36
|
+
},
|
|
37
|
+
[`&:is([data-likec4-dimmed="immediate"])`]: {
|
|
38
|
+
opacity: 0.25,
|
|
39
|
+
transition: `opacity 100ms ${easings.inOut}, filter 100ms ${easings.inOut}`,
|
|
40
|
+
filter: `grayscale(0.85) ${fallbackVar(vars.safariAnimationHook, 'blur(2px)')}`,
|
|
41
|
+
},
|
|
42
|
+
[`${reactFlowReducedGraphics} &:after`]: {
|
|
43
|
+
display: 'none',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
49
46
|
})
|
|
@@ -9,6 +9,7 @@ import { type BoxProps, Box, createPolymorphicComponent } from '@mantine/core'
|
|
|
9
9
|
import clsx from 'clsx'
|
|
10
10
|
import { m } from 'framer-motion'
|
|
11
11
|
import { type PropsWithChildren, forwardRef } from 'react'
|
|
12
|
+
import { useIsReducedGraphics } from '../../../hooks/useIsReducedGraphics'
|
|
12
13
|
import type { NodeProps } from '../../types'
|
|
13
14
|
import * as css from './ElementNodeContainer.css'
|
|
14
15
|
|
|
@@ -63,6 +64,7 @@ export const ElementNodeContainer = createPolymorphicComponent<'div', ElementNod
|
|
|
63
64
|
children,
|
|
64
65
|
...rest
|
|
65
66
|
}, ref) => {
|
|
67
|
+
const nonReducedGraphics = !useIsReducedGraphics()
|
|
66
68
|
let scale = 1
|
|
67
69
|
switch (true) {
|
|
68
70
|
case isHovered:
|
|
@@ -88,7 +90,7 @@ export const ElementNodeContainer = createPolymorphicComponent<'div', ElementNod
|
|
|
88
90
|
'likec4-element-node',
|
|
89
91
|
])}
|
|
90
92
|
initial={false}
|
|
91
|
-
{...selectable && {
|
|
93
|
+
{...selectable && nonReducedGraphics && {
|
|
92
94
|
animate: {
|
|
93
95
|
scale,
|
|
94
96
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createVar, fallbackVar, globalStyle, keyframes, style } from '@vanilla-extract/css'
|
|
2
|
+
import { hiddenIfZoomTooSmall, reactFlowReducedGraphics, whereNotReducedGraphics } from '../../../LikeC4Diagram.css'
|
|
2
3
|
import { easings, mantine, vars } from '../../../theme-vars'
|
|
3
4
|
import { container, stokeFillMix } from './ElementNodeContainer.css'
|
|
4
5
|
|
|
@@ -19,7 +20,7 @@ const outlineColor = fallbackVar(
|
|
|
19
20
|
|
|
20
21
|
const indicatorStroke = createVar('indicator-stroke')
|
|
21
22
|
|
|
22
|
-
export const indicator = style({
|
|
23
|
+
export const indicator = style([hiddenIfZoomTooSmall, {
|
|
23
24
|
stroke: indicatorStroke,
|
|
24
25
|
fill: 'none',
|
|
25
26
|
transformOrigin: 'center center',
|
|
@@ -36,6 +37,8 @@ export const indicator = style({
|
|
|
36
37
|
selectors: {
|
|
37
38
|
':where(.react-flow__node.selected) &': {
|
|
38
39
|
visibility: 'visible',
|
|
40
|
+
},
|
|
41
|
+
[`${whereNotReducedGraphics} :where(.react-flow__node.selected) &`]: {
|
|
39
42
|
animationName: fallbackVar(vars.safariAnimationHook, indicatorKeyframes),
|
|
40
43
|
},
|
|
41
44
|
[`:where(.react-flow__node:focus-visible, ${container}:focus-visible) &`]: {
|
|
@@ -52,7 +55,7 @@ export const indicator = style({
|
|
|
52
55
|
},
|
|
53
56
|
},
|
|
54
57
|
},
|
|
55
|
-
})
|
|
58
|
+
}])
|
|
56
59
|
|
|
57
60
|
export const fillElementFill = style({
|
|
58
61
|
fill: vars.element.fill,
|
|
@@ -81,7 +84,7 @@ const shapeBase = style({
|
|
|
81
84
|
zIndex: -1,
|
|
82
85
|
})
|
|
83
86
|
|
|
84
|
-
export const shapeSvgMultiple = style([shapeBase, {
|
|
87
|
+
export const shapeSvgMultiple = style([shapeBase, hiddenIfZoomTooSmall, {
|
|
85
88
|
transformOrigin: '50% 25%',
|
|
86
89
|
transform: 'translate(14px, 14px) perspective(300px) translateZ(-8px)',
|
|
87
90
|
filter: ' brightness(0.65) saturate(0.8)',
|
|
@@ -131,9 +134,10 @@ export const shapeSvg = style([shapeBase, {
|
|
|
131
134
|
},
|
|
132
135
|
},
|
|
133
136
|
[`:where([data-likec4-zoom-small="true"]) &`]: {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
filter: 'none',
|
|
138
|
+
},
|
|
139
|
+
[`${reactFlowReducedGraphics} &`]: {
|
|
140
|
+
filter: 'none',
|
|
137
141
|
},
|
|
138
142
|
},
|
|
139
143
|
}])
|
|
@@ -185,7 +185,7 @@ export function ElementShape(
|
|
|
185
185
|
return (
|
|
186
186
|
<>
|
|
187
187
|
{isMultiple && (
|
|
188
|
-
<svg className={clsx(css.shapeSvgMultiple
|
|
188
|
+
<svg className={clsx(css.shapeSvgMultiple)} viewBox={`0 0 ${w} ${h}`}>
|
|
189
189
|
<ElementShapeSvg shape={data.shape} w={w} h={h} />
|
|
190
190
|
</svg>
|
|
191
191
|
)}
|
|
@@ -223,5 +223,5 @@ export function SelectedIndicator({ shape, w, h }: ElementShapeProps) {
|
|
|
223
223
|
break
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
return <g className={
|
|
226
|
+
return <g className={css.indicator}>{svg}</g>
|
|
227
227
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createVar, fallbackVar, globalStyle, style } from '@vanilla-extract/css'
|
|
2
|
+
import { whereNotReducedGraphics } from '../LikeC4Diagram.css'
|
|
2
3
|
import { mantine, transitions, vars, whereDark, whereLight } from '../theme-vars'
|
|
3
4
|
|
|
4
5
|
const transparent = createVar('transparent')
|
|
@@ -9,13 +10,10 @@ export const root = style({
|
|
|
9
10
|
paddingRight: '4px',
|
|
10
11
|
borderRadius: mantine.radius.sm,
|
|
11
12
|
color: mantine.colors.placeholder,
|
|
12
|
-
boxShadow: mantine.shadows.xs,
|
|
13
13
|
border: '1px solid',
|
|
14
14
|
cursor: 'pointer',
|
|
15
15
|
transition: transitions.fast,
|
|
16
|
-
|
|
17
|
-
backdropFilter: fallbackVar(vars.safariAnimationHook, 'blur(8px)'),
|
|
18
|
-
backgroundColor: `color-mix(in srgb, ${bgColor}, transparent ${transparent})`,
|
|
16
|
+
backgroundColor: bgColor,
|
|
19
17
|
vars: {
|
|
20
18
|
[transparent]: '20%',
|
|
21
19
|
[bgColor]: mantine.colors.default,
|
|
@@ -33,6 +31,12 @@ export const root = style({
|
|
|
33
31
|
[bgColor]: mantine.colors.dark[6],
|
|
34
32
|
},
|
|
35
33
|
},
|
|
34
|
+
[`${whereNotReducedGraphics} &`]: {
|
|
35
|
+
backgroundColor: `color-mix(in srgb, ${bgColor}, transparent ${transparent})`,
|
|
36
|
+
boxShadow: mantine.shadows.xs,
|
|
37
|
+
WebkitBackdropFilter: fallbackVar(vars.safariAnimationHook, 'blur(8px)'),
|
|
38
|
+
backdropFilter: fallbackVar(vars.safariAnimationHook, 'blur(8px)'),
|
|
39
|
+
},
|
|
36
40
|
},
|
|
37
41
|
':hover': {
|
|
38
42
|
borderColor: mantine.colors.defaultBorder,
|
|
@@ -58,6 +62,9 @@ export const shortcut = style({
|
|
|
58
62
|
[`${whereLight} &`]: {
|
|
59
63
|
color: mantine.colors.gray[7],
|
|
60
64
|
borderColor: mantine.colors.gray[2],
|
|
65
|
+
backgroundColor: mantine.colors.gray[2],
|
|
66
|
+
},
|
|
67
|
+
[`${whereLight} ${whereNotReducedGraphics} &`]: {
|
|
61
68
|
backgroundColor: `color-mix(in srgb, ${mantine.colors.gray[2]}, transparent 20%)`,
|
|
62
69
|
},
|
|
63
70
|
[`${whereDark} &`]: {
|
|
@@ -2,11 +2,22 @@ import { useMantineStyleNonce } from '@mantine/core'
|
|
|
2
2
|
import { domMax, LazyMotion, MotionConfig } from 'framer-motion'
|
|
3
3
|
import { type PropsWithChildren } from 'react'
|
|
4
4
|
|
|
5
|
-
export const FramerMotionConfig = ({
|
|
5
|
+
export const FramerMotionConfig = ({
|
|
6
|
+
reducedMotion = 'user',
|
|
7
|
+
children,
|
|
8
|
+
}: PropsWithChildren<{
|
|
9
|
+
/**
|
|
10
|
+
* If true, will respect the device prefersReducedMotion setting by switching
|
|
11
|
+
* transform animations off.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
reducedMotion?: 'always' | 'never' | 'user'
|
|
16
|
+
}>) => {
|
|
6
17
|
const nonce = useMantineStyleNonce()?.()
|
|
7
18
|
return (
|
|
8
19
|
<LazyMotion features={domMax} strict>
|
|
9
|
-
<MotionConfig {...nonce && { nonce }}>
|
|
20
|
+
<MotionConfig reducedMotion={reducedMotion} {...nonce && { nonce }}>
|
|
10
21
|
{children}
|
|
11
22
|
</MotionConfig>
|
|
12
23
|
</LazyMotion>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Box } from '@mantine/core'
|
|
2
2
|
import clsx from 'clsx'
|
|
3
|
-
import { type PropsWithChildren,
|
|
3
|
+
import { type PropsWithChildren, createContext, createRef, useContext, useRef } from 'react'
|
|
4
4
|
import { rootClassName } from '../globals.css'
|
|
5
|
+
import { useIsReducedGraphics } from '../hooks/useIsReducedGraphics'
|
|
5
6
|
|
|
6
7
|
const RootContainerContext = createContext(createRef<HTMLDivElement>())
|
|
7
8
|
|
|
@@ -10,8 +11,14 @@ export function RootContainer({
|
|
|
10
11
|
children,
|
|
11
12
|
}: PropsWithChildren<{ className?: string | undefined }>) {
|
|
12
13
|
const ref = useRef<HTMLDivElement>(null)
|
|
14
|
+
const reduceGraphics = useIsReducedGraphics()
|
|
13
15
|
return (
|
|
14
|
-
<Box
|
|
16
|
+
<Box
|
|
17
|
+
className={clsx(rootClassName, className)}
|
|
18
|
+
ref={ref}
|
|
19
|
+
{...reduceGraphics && {
|
|
20
|
+
['data-likec4-reduced-graphics']: true,
|
|
21
|
+
}}>
|
|
15
22
|
<RootContainerContext.Provider value={ref}>
|
|
16
23
|
{children}
|
|
17
24
|
</RootContainerContext.Provider>
|
package/src/globals.css.ts
CHANGED
|
@@ -6,6 +6,9 @@ import { mantine, vars, whereDark } from './theme-vars'
|
|
|
6
6
|
|
|
7
7
|
export const rootClassName = 'likec4-diagram-root'
|
|
8
8
|
|
|
9
|
+
export const whereReducedGraphics = `:where(.${rootClassName}:is([data-likec4-reduced-graphics="true"]))`
|
|
10
|
+
export const whereNotReducedGraphics = `:where(.${rootClassName}:not([data-likec4-reduced-graphics]))`
|
|
11
|
+
|
|
9
12
|
globalStyle(`.${rootClassName}`, {
|
|
10
13
|
overflow: 'hidden',
|
|
11
14
|
position: 'relative',
|
package/src/hooks/useDiagram.ts
CHANGED
package/src/hooks/useXYFlow.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type XYStoreApi = ReturnType<typeof useXYStoreApi>
|
|
|
20
20
|
|
|
21
21
|
export const useXYInternalNode = useInternalNode<Types.Node>
|
|
22
22
|
|
|
23
|
-
const selectZoom = (state: ReactFlowState) => state.transform[2] < 0.
|
|
23
|
+
const selectZoom = (state: ReactFlowState) => state.transform[2] < 0.25
|
|
24
24
|
export function useIsZoomTooSmall() {
|
|
25
25
|
return useStore(selectZoom)
|
|
26
26
|
}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import { memo } from 'react'
|
|
1
2
|
import { useEnabledFeatures } from '../context'
|
|
2
3
|
import { useDiagramActorSnapshot } from '../hooks/useDiagram'
|
|
3
4
|
import { Overlays } from '../overlays/Overlays'
|
|
4
5
|
import { Controls, DiagramTitlePanel, DynamicViewWalkthrough, NotationPanel } from './ui'
|
|
5
6
|
|
|
6
|
-
export
|
|
7
|
+
export const DiagramUI = memo(() => {
|
|
7
8
|
const {
|
|
8
9
|
enableViewTitle,
|
|
9
10
|
enableNotations,
|
|
10
11
|
enableDynamicViewWalkthrough,
|
|
11
12
|
} = useEnabledFeatures()
|
|
12
13
|
|
|
13
|
-
const overlaysActorRef = useDiagramActorSnapshot(s => s.children.overlays)
|
|
14
|
+
const overlaysActorRef = useDiagramActorSnapshot(s => s.children.overlays, Object.is)
|
|
14
15
|
|
|
15
16
|
return (
|
|
16
17
|
<>
|
|
@@ -21,4 +22,5 @@ export function DiagramUI() {
|
|
|
21
22
|
{enableDynamicViewWalkthrough && <DynamicViewWalkthrough />}
|
|
22
23
|
</>
|
|
23
24
|
)
|
|
24
|
-
}
|
|
25
|
+
})
|
|
26
|
+
DiagramUI.displayName = 'DiagramUI'
|
|
@@ -39,7 +39,7 @@ const ElementDetailsButtonWithHandler = ({ fqn, ...props }: NodeProps<Types.Node
|
|
|
39
39
|
export const nodeTypes = {
|
|
40
40
|
element: customNode<Types.ElementNodeData>((props) => (
|
|
41
41
|
<ElementNodeContainer nodeProps={props}>
|
|
42
|
-
<ElementShape {...props} isMultiple={props.data.isMultiple} />
|
|
42
|
+
<ElementShape {...props} isMultiple={props.data.isMultiple} withSelectedIndicator={props.selected} />
|
|
43
43
|
<ElementTitle {...props} />
|
|
44
44
|
<ElementActions {...props} />
|
|
45
45
|
<ElementDetailsButtonWithHandler
|
|
@@ -53,7 +53,7 @@ export const nodeTypes = {
|
|
|
53
53
|
)),
|
|
54
54
|
deployment: customNode<Types.DeploymentElementNodeData>((props) => (
|
|
55
55
|
<ElementNodeContainer nodeProps={props}>
|
|
56
|
-
<ElementShape {...props} isMultiple={props.data.isMultiple} />
|
|
56
|
+
<ElementShape {...props} isMultiple={props.data.isMultiple} withSelectedIndicator={props.selected} />
|
|
57
57
|
<ElementTitle {...props} />
|
|
58
58
|
<DeploymentElementActions {...props} />
|
|
59
59
|
{!!props.data.modelFqn && (
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { rem } from '@mantine/core'
|
|
2
2
|
import { fallbackVar, globalStyle, style } from '@vanilla-extract/css'
|
|
3
3
|
import { calc } from '@vanilla-extract/css-utils'
|
|
4
|
+
import { whereNotReducedGraphics } from '../../../LikeC4Diagram.css'
|
|
4
5
|
import { mantine, vars } from '../../../theme-vars'
|
|
5
6
|
|
|
6
7
|
export const navigationButtons = style({
|
|
@@ -14,6 +15,11 @@ export const panel = style({
|
|
|
14
15
|
top: fallbackVar(vars.navigationPanel.top, '1rem'),
|
|
15
16
|
left: fallbackVar(vars.navigationPanel.left, '1rem'),
|
|
16
17
|
margin: 0,
|
|
18
|
+
pointerEvents: 'none',
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
globalStyle(`${panel} :where(button, .action-icon)`, {
|
|
22
|
+
pointerEvents: 'all',
|
|
17
23
|
})
|
|
18
24
|
|
|
19
25
|
globalStyle(`.likec4-top-left-panel .action-icon`, {
|
|
@@ -27,7 +33,11 @@ globalStyle(`.likec4-top-left-panel .action-icon .tabler-icon`, {
|
|
|
27
33
|
})
|
|
28
34
|
|
|
29
35
|
export const actionIconGroup = style({
|
|
30
|
-
|
|
36
|
+
selectors: {
|
|
37
|
+
[`${whereNotReducedGraphics} &`]: {
|
|
38
|
+
boxShadow: mantine.shadows.md,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
31
41
|
})
|
|
32
42
|
|
|
33
43
|
export const autolayoutIcon = style({})
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { fallbackVar, style } from '@vanilla-extract/css'
|
|
2
|
+
import { whereNotReducedGraphics } from '../../../LikeC4Diagram.css'
|
|
2
3
|
import { mantine, vars, whereDark } from '../../../theme-vars'
|
|
3
4
|
|
|
4
5
|
export const container = style({
|
|
@@ -12,9 +13,7 @@ export const card = style({
|
|
|
12
13
|
cursor: 'default',
|
|
13
14
|
minWidth: 200,
|
|
14
15
|
maxWidth: 'calc(100vw - 16px)',
|
|
15
|
-
backgroundColor:
|
|
16
|
-
WebkitBackdropFilter: fallbackVar(vars.safariAnimationHook, 'blur(8px)'),
|
|
17
|
-
backdropFilter: fallbackVar(vars.safariAnimationHook, 'blur(8px)'),
|
|
16
|
+
backgroundColor: mantine.colors.body,
|
|
18
17
|
'@media': {
|
|
19
18
|
[mantine.largerThan('sm')]: {
|
|
20
19
|
minWidth: 250,
|
|
@@ -27,6 +26,14 @@ export const card = style({
|
|
|
27
26
|
},
|
|
28
27
|
selectors: {
|
|
29
28
|
[`${whereDark} &`]: {
|
|
29
|
+
backgroundColor: mantine.colors.dark[6],
|
|
30
|
+
},
|
|
31
|
+
[`${whereNotReducedGraphics} &`]: {
|
|
32
|
+
backgroundColor: `color-mix(in srgb, ${mantine.colors.body}, transparent 20%)`,
|
|
33
|
+
WebkitBackdropFilter: fallbackVar(vars.safariAnimationHook, 'blur(8px)'),
|
|
34
|
+
backdropFilter: fallbackVar(vars.safariAnimationHook, 'blur(8px)'),
|
|
35
|
+
},
|
|
36
|
+
[`${whereDark} ${whereNotReducedGraphics} &`]: {
|
|
30
37
|
backgroundColor: `color-mix(in srgb, ${mantine.colors.dark[6]}, transparent 20%)`,
|
|
31
38
|
},
|
|
32
39
|
},
|
|
@@ -41,7 +41,6 @@ export function DiagramTitlePanel() {
|
|
|
41
41
|
}
|
|
42
42
|
{isNotActiveWalkthrough && (
|
|
43
43
|
<m.div
|
|
44
|
-
key={id}
|
|
45
44
|
initial={{ opacity: 0.05, scale: 0.7 }}
|
|
46
45
|
animate={{ opacity: 1, scale: 1 }}
|
|
47
46
|
exit={{
|
|
@@ -126,10 +125,14 @@ export function DiagramTitlePanel() {
|
|
|
126
125
|
<Spoiler
|
|
127
126
|
maxHeight={42}
|
|
128
127
|
showLabel={
|
|
129
|
-
<Button color="gray" variant="light" fz={'10'} size="compact-xs" tabIndex={-1}>
|
|
128
|
+
<Button component={'div'} color="gray" variant="light" fz={'10'} size="compact-xs" tabIndex={-1}>
|
|
129
|
+
show more
|
|
130
|
+
</Button>
|
|
130
131
|
}
|
|
131
132
|
hideLabel={
|
|
132
|
-
<Button color="gray" variant="light" fz={'10'} size="compact-xs" tabIndex={-1}>
|
|
133
|
+
<Button component={'div'} color="gray" variant="light" fz={'10'} size="compact-xs" tabIndex={-1}>
|
|
134
|
+
hide
|
|
135
|
+
</Button>
|
|
133
136
|
}>
|
|
134
137
|
<Text
|
|
135
138
|
component={'div'}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { rem } from '@mantine/core'
|
|
2
2
|
import { fallbackVar, globalStyle, style } from '@vanilla-extract/css'
|
|
3
|
+
import { reactFlow } from '../../../LikeC4Diagram.css'
|
|
3
4
|
import { mantine } from '../../../theme-vars'
|
|
4
5
|
import { vars, whereDark, whereLight } from '../../../theme-vars.css'
|
|
5
6
|
import { button, buttonFocused } from './_shared.css'
|