@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
|
@@ -1,13 +1,54 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { MantineProvider } from '@mantine/core';
|
|
3
|
+
import { useCallbackRef } from '@mantine/hooks';
|
|
3
4
|
import { useRef, useCallback } from 'react';
|
|
4
5
|
import root from 'react-shadow';
|
|
5
6
|
import { isDefined } from 'remeda';
|
|
6
7
|
import { FramerMotionConfig } from '../context/FramerMotionConfig.js';
|
|
7
8
|
import { useId } from '../hooks/useId.js';
|
|
8
|
-
import { useColorScheme,
|
|
9
|
+
import { useColorScheme, useBundledStyleSheet, DefaultTheme } from './styles.css.js';
|
|
9
10
|
|
|
10
11
|
const Root = root["div"];
|
|
12
|
+
function useShadowRootStyle(instanceId, keepAspectRatio = false) {
|
|
13
|
+
if (keepAspectRatio === false) {
|
|
14
|
+
return `
|
|
15
|
+
:where([data-likec4-instance="${instanceId}"]) {
|
|
16
|
+
display: block;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
border: 0 solid transparent;
|
|
19
|
+
background: transparent;
|
|
20
|
+
padding: 0;
|
|
21
|
+
margin: 0;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
min-width: 80px;
|
|
26
|
+
min-height: 80px;
|
|
27
|
+
}
|
|
28
|
+
`.trim();
|
|
29
|
+
}
|
|
30
|
+
const { width, height } = keepAspectRatio;
|
|
31
|
+
const isLandscape = width > height;
|
|
32
|
+
return `
|
|
33
|
+
:where([data-likec4-instance="${instanceId}"]) {
|
|
34
|
+
display: block;
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
border: 0 solid transparent;
|
|
37
|
+
background: transparent;
|
|
38
|
+
padding: 0;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
aspect-ratio: ${Math.ceil(width)} / ${Math.ceil(height)};
|
|
41
|
+
${isLandscape ? "" : `
|
|
42
|
+
max-width: min(100%, var(--likec4-view-max-width, ${Math.ceil(width)}px));
|
|
43
|
+
margin-left: auto;
|
|
44
|
+
margin-right: auto;`}
|
|
45
|
+
width: ${isLandscape ? "100%" : "auto"};
|
|
46
|
+
height: ${isLandscape ? "auto" : "100%"};
|
|
47
|
+
${isLandscape ? `min-width: 80px;` : `min-height: 80px;`}
|
|
48
|
+
max-height: min(100%, var(--likec4-view-max-height, ${Math.ceil(height)}px));
|
|
49
|
+
}
|
|
50
|
+
`.trim();
|
|
51
|
+
}
|
|
11
52
|
function ShadowRoot({
|
|
12
53
|
children,
|
|
13
54
|
theme = DefaultTheme,
|
|
@@ -23,17 +64,17 @@ function ShadowRoot({
|
|
|
23
64
|
const rootRef = useRef(null);
|
|
24
65
|
const styleSheets = useBundledStyleSheet(injectFontCss, styleNonce);
|
|
25
66
|
const getRootElement = useCallback(() => rootRef.current ?? void 0, [rootRef]);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
nonce = styleNonce();
|
|
34
|
-
getStyleNonce = styleNonce;
|
|
67
|
+
const getStyleNonce = useCallbackRef(() => {
|
|
68
|
+
if (isDefined(styleNonce)) {
|
|
69
|
+
if (typeof styleNonce === "string") {
|
|
70
|
+
return styleNonce;
|
|
71
|
+
} else if (typeof styleNonce === "function") {
|
|
72
|
+
return styleNonce();
|
|
73
|
+
}
|
|
35
74
|
}
|
|
36
|
-
|
|
75
|
+
return "";
|
|
76
|
+
});
|
|
77
|
+
let nonce = isDefined(styleNonce) ? getStyleNonce() : void 0;
|
|
37
78
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
38
79
|
/* @__PURE__ */ jsx(
|
|
39
80
|
"style",
|
|
@@ -55,7 +96,7 @@ function ShadowRoot({
|
|
|
55
96
|
...explicitColorScheme && { forceColorScheme: explicitColorScheme },
|
|
56
97
|
defaultColorScheme: colorScheme,
|
|
57
98
|
getRootElement,
|
|
58
|
-
|
|
99
|
+
...!!nonce && { getStyleNonce },
|
|
59
100
|
cssVariablesSelector: ".likec4-shadow-root",
|
|
60
101
|
theme,
|
|
61
102
|
children: /* @__PURE__ */ jsx(FramerMotionConfig, { children })
|
|
@@ -4,7 +4,3 @@ export declare const cssInteractive: string;
|
|
|
4
4
|
export declare function useBundledStyleSheet(injectFontCss: boolean, styleNonce?: string | (() => string) | undefined): CSSStyleSheet[];
|
|
5
5
|
export type ColorScheme = 'light' | 'dark';
|
|
6
6
|
export declare function useColorScheme(explicit?: ColorScheme): ColorScheme;
|
|
7
|
-
export declare function useShadowRootStyle(instanceId: string, keepAspectRatio?: false | {
|
|
8
|
-
width: number;
|
|
9
|
-
height: number;
|
|
10
|
-
}): string;
|
|
@@ -95,45 +95,5 @@ function useColorScheme(explicit) {
|
|
|
95
95
|
);
|
|
96
96
|
return explicit ?? computed ?? preferred;
|
|
97
97
|
}
|
|
98
|
-
function useShadowRootStyle(instanceId, keepAspectRatio = false) {
|
|
99
|
-
if (keepAspectRatio === false) {
|
|
100
|
-
return `
|
|
101
|
-
:where([data-likec4-instance="${instanceId}"]) {
|
|
102
|
-
display: block;
|
|
103
|
-
box-sizing: border-box;
|
|
104
|
-
border: 0 solid transparent;
|
|
105
|
-
background: transparent;
|
|
106
|
-
padding: 0;
|
|
107
|
-
margin: 0;
|
|
108
|
-
overflow: hidden;
|
|
109
|
-
width: 100%;
|
|
110
|
-
height: 100%;
|
|
111
|
-
min-width: 80px;
|
|
112
|
-
min-height: 80px;
|
|
113
|
-
}
|
|
114
|
-
`.trim();
|
|
115
|
-
}
|
|
116
|
-
const { width, height } = keepAspectRatio;
|
|
117
|
-
const isLandscape = width > height;
|
|
118
|
-
return `
|
|
119
|
-
:where([data-likec4-instance="${instanceId}"]) {
|
|
120
|
-
display: block;
|
|
121
|
-
box-sizing: border-box;
|
|
122
|
-
border: 0 solid transparent;
|
|
123
|
-
background: transparent;
|
|
124
|
-
padding: 0;
|
|
125
|
-
overflow: hidden;
|
|
126
|
-
aspect-ratio: ${Math.ceil(width)} / ${Math.ceil(height)};
|
|
127
|
-
${isLandscape ? "" : `
|
|
128
|
-
max-width: min(100%, var(--likec4-view-max-width, ${Math.ceil(width)}px));
|
|
129
|
-
margin-left: auto;
|
|
130
|
-
margin-right: auto;`}
|
|
131
|
-
width: ${isLandscape ? "100%" : "auto"};
|
|
132
|
-
height: ${isLandscape ? "auto" : "100%"};
|
|
133
|
-
${isLandscape ? `min-width: 80px;` : `min-height: 80px;`}
|
|
134
|
-
max-height: min(100%, var(--likec4-view-max-height, ${Math.ceil(height)}px));
|
|
135
|
-
}
|
|
136
|
-
`.trim();
|
|
137
|
-
}
|
|
138
98
|
|
|
139
|
-
export { DefaultTheme, useBundledStyleSheet, useColorScheme
|
|
99
|
+
export { DefaultTheme, useBundledStyleSheet, useColorScheme };
|