@likec4/diagram 1.46.3 → 1.47.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.
Files changed (68) hide show
  1. package/bundle/index.js +1548 -595
  2. package/dist/LikeC4Diagram.d.ts +1 -1
  3. package/dist/LikeC4Diagram.js +2 -2
  4. package/dist/LikeC4Diagram.props.d.ts +1 -1
  5. package/dist/LikeC4ProjectsOverview.d.ts +7 -0
  6. package/dist/LikeC4ProjectsOverview.js +32 -0
  7. package/dist/base-primitives/Markdown.d.ts +1 -1
  8. package/dist/base-primitives/compound/CompoundNodeContainer.d.ts +4 -3
  9. package/dist/base-primitives/compound/actionbtns.css.d.ts +1 -1
  10. package/dist/base-primitives/element/ElementNodeContainer.js +2 -3
  11. package/dist/base-primitives/element/ElementShape.js +109 -20
  12. package/dist/components/NavigationPanel.d.ts +11 -0
  13. package/dist/components/NavigationPanel.js +69 -0
  14. package/dist/context/DiagramEventHandlers.js +1 -1
  15. package/dist/context/IconRenderer.js +4 -1
  16. package/dist/hooks/useLikeC4Project.js +10 -2
  17. package/dist/hooks/useLikeC4Styles.js +0 -3
  18. package/dist/index.d.ts +2 -1
  19. package/dist/index.js +2 -1
  20. package/dist/likec4diagram/DiagramXYFlow.js +1 -0
  21. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +3 -3
  22. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +1 -38
  23. package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +29 -14
  24. package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +9 -5
  25. package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +6 -1
  26. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +44 -8
  27. package/dist/likec4diagram/xyflow-sequence/utils.d.ts +1 -1
  28. package/dist/navigationpanel/NavigationPanelControls.js +2 -2
  29. package/dist/navigationpanel/_common.d.ts +1 -1
  30. package/dist/navigationpanel/controls/LogoButton.d.ts +1 -0
  31. package/dist/navigationpanel/controls/{BurgerButton.js → LogoButton.js} +5 -5
  32. package/dist/navigationpanel/controls/index.d.ts +1 -1
  33. package/dist/navigationpanel/styles.css.d.ts +1 -1
  34. package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.3/node_modules/@tabler/icons-react/dist/esm/icons/IconFileText.js +14 -0
  35. package/dist/overlays/relationships-browser/custom/edgeTypes.js +0 -1
  36. package/dist/projects-overview/ProjectsOverview.d.ts +13 -0
  37. package/dist/projects-overview/ProjectsOverview.js +57 -0
  38. package/dist/projects-overview/ProjectsOverviewXY.d.ts +17 -0
  39. package/dist/projects-overview/ProjectsOverviewXY.js +98 -0
  40. package/dist/projects-overview/_types.d.ts +34 -0
  41. package/dist/projects-overview/actor.d.ts +121 -0
  42. package/dist/projects-overview/actor.js +382 -0
  43. package/dist/projects-overview/context.d.ts +4 -0
  44. package/dist/projects-overview/context.js +9 -0
  45. package/dist/projects-overview/custom/edgeTypes.d.ts +3 -0
  46. package/dist/projects-overview/custom/edgeTypes.js +23 -0
  47. package/dist/projects-overview/custom/index.d.ts +2 -0
  48. package/dist/projects-overview/custom/nodeTypes.d.ts +2 -0
  49. package/dist/projects-overview/custom/nodeTypes.js +45 -0
  50. package/dist/projects-overview/custom/styles.css.d.ts +1 -0
  51. package/dist/projects-overview/hooks.d.ts +5 -0
  52. package/dist/projects-overview/hooks.js +14 -0
  53. package/dist/projects-overview/index.d.ts +1 -0
  54. package/dist/projects-overview/layouted-to-xyflow.d.ts +6 -0
  55. package/dist/projects-overview/layouted-to-xyflow.js +49 -0
  56. package/dist/projects-overview/panel/ProjectsOverviewPanel.d.ts +1 -0
  57. package/dist/projects-overview/panel/ProjectsOverviewPanel.js +11 -0
  58. package/dist/projects-overview/persistence.d.ts +5 -0
  59. package/dist/projects-overview/persistence.js +24 -0
  60. package/dist/search/components/_shared.css.d.ts +1 -1
  61. package/dist/styles.css2.js +1 -1
  62. package/package.json +10 -10
  63. package/panda.buildinfo.json +62 -29
  64. package/styles-min.css +1 -1
  65. package/styles.css +1 -1
  66. package/dist/base-primitives/element/ElementNodeContainer.css.d.ts +0 -1
  67. package/dist/base-primitives/element/ElementNodeContainer.css.js +0 -39
  68. package/dist/navigationpanel/controls/BurgerButton.d.ts +0 -1
@@ -8,4 +8,4 @@ export type LikeC4DiagramProps<A extends Any = Any> = PropsWithChildren<LikeC4Di
8
8
  *
9
9
  * Use {@link ReactLikeC4} or {@link LikeC4View} for ready-to-use component
10
10
  */
11
- export declare function LikeC4Diagram<A extends Any = Any>({ onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu, onOpenSource, onBurgerMenuClick, onLayoutTypeChange, onInitialized, view, className, controls, fitView, fitViewPadding: _fitViewPadding, pannable, zoomable, background, enableElementTags, enableFocusMode, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, enableCompareWithLatest, nodesSelectable, enableNotations, showNavigationButtons, enableDynamicViewWalkthrough, dynamicViewVariant, enableSearch, initialWidth, initialHeight, reduceGraphics, renderIcon, where, reactFlowProps, renderNodes, children, }: LikeC4DiagramProps<A>): import("react/jsx-runtime").JSX.Element;
11
+ export declare function LikeC4Diagram<A extends Any = Any>({ onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu, onOpenSource, onLogoClick, onLayoutTypeChange, onInitialized, view, className, controls, fitView, fitViewPadding: _fitViewPadding, pannable, zoomable, background, enableElementTags, enableFocusMode, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, enableCompareWithLatest, nodesSelectable, enableNotations, showNavigationButtons, enableDynamicViewWalkthrough, dynamicViewVariant, enableSearch, initialWidth, initialHeight, reduceGraphics, renderIcon, where, reactFlowProps, renderNodes, children, }: LikeC4DiagramProps<A>): import("react/jsx-runtime").JSX.Element;
@@ -30,7 +30,7 @@ function LikeC4Diagram({
30
30
  onNodeClick,
31
31
  onNodeContextMenu,
32
32
  onOpenSource,
33
- onBurgerMenuClick,
33
+ onLogoClick,
34
34
  onLayoutTypeChange,
35
35
  onInitialized,
36
36
  view,
@@ -123,7 +123,7 @@ function LikeC4Diagram({
123
123
  onNodeClick,
124
124
  onNodeContextMenu,
125
125
  onOpenSource,
126
- onBurgerMenuClick,
126
+ onLogoClick,
127
127
  onInitialized,
128
128
  onLayoutTypeChange
129
129
  },
@@ -253,7 +253,7 @@ export interface LikeC4DiagramEventHandlers<A extends Any = Unknown> {
253
253
  onEdgeContextMenu?: OnEdgeClick<A> | null | undefined;
254
254
  onCanvasClick?: OnCanvasClick | null | undefined;
255
255
  onCanvasDblClick?: OnCanvasClick | null | undefined;
256
- onBurgerMenuClick?: null | undefined | (() => void);
256
+ onLogoClick?: null | undefined | (() => void);
257
257
  onOpenSource?: OnOpenSource<A> | null | undefined;
258
258
  onInitialized?: OnInitialized | null | undefined;
259
259
  /**
@@ -0,0 +1,7 @@
1
+ import { Simplify } from 'type-fest';
2
+ import { ProjectsOverviewProps } from './projects-overview';
3
+ export type LikeC4ProjectsOverviewProps = Simplify<Omit<ProjectsOverviewProps, 'id'> & {
4
+ className?: string;
5
+ onSelectProject?: ProjectsOverviewProps['onNavigateToProject'];
6
+ }>;
7
+ export declare function LikeC4ProjectsOverview({ view, className, onNavigateToProject, ...props }: LikeC4ProjectsOverviewProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,32 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { RootContainer } from './components/RootContainer.js';
3
+ import { useId } from './hooks/useId.js';
4
+ import { useChangeLikeC4Project } from './hooks/useLikeC4Project.js';
5
+ import { LikeC4Styles } from './LikeC4Styles.js';
6
+ import { EnsureMantine } from './context/EnsureMantine.js';
7
+ import { FramerMotionConfig } from './context/FramerMotionConfig.js';
8
+ import { ProjectsOverview } from './projects-overview/ProjectsOverview.js';
9
+
10
+ function LikeC4ProjectsOverview({
11
+ view,
12
+ className,
13
+ onNavigateToProject,
14
+ ...props
15
+ }) {
16
+ const onChangeLikeC4Project = useChangeLikeC4Project();
17
+ const id = useId();
18
+ onNavigateToProject ??= onChangeLikeC4Project;
19
+ return /* @__PURE__ */ jsx(EnsureMantine, { children: /* @__PURE__ */ jsxs(FramerMotionConfig, { children: [
20
+ /* @__PURE__ */ jsx(LikeC4Styles, { id }),
21
+ /* @__PURE__ */ jsx(RootContainer, { id, className, children: /* @__PURE__ */ jsx(
22
+ ProjectsOverview,
23
+ {
24
+ view,
25
+ onNavigateToProject,
26
+ ...props
27
+ }
28
+ ) })
29
+ ] }) });
30
+ }
31
+
32
+ export { LikeC4ProjectsOverview };
@@ -1,5 +1,5 @@
1
1
  import { RichTextOrEmpty as RichTextType } from '@likec4/core/types';
2
- import { JsxStyleProps } from '@likec4/styles/types';
2
+ import { JsxStyleProps } from '../../styled-system/types';
3
3
  import { ComponentPropsWithoutRef, ForwardRefExoticComponent, DetailedHTMLProps, HTMLAttributes, RefAttributes } from 'react';
4
4
  export type MarkdownProps = Omit<ComponentPropsWithoutRef<'div'>, 'dangerouslySetInnerHTML' | 'children' | 'color'> & {
5
5
  value: RichTextType;
@@ -1,13 +1,14 @@
1
1
  import { Color, ElementStyle } from '@likec4/core/types';
2
- import { HTMLMotionProps } from 'motion/react';
3
- import { PropsWithChildren } from 'react';
2
+ import { HTMLAttributes, PropsWithChildren } from 'react';
4
3
  import { BaseNode, BaseNodeProps } from '../../base/types';
5
4
  export type RequiredData = {
6
5
  color: Color;
7
6
  depth: number;
8
7
  style: ElementStyle;
9
8
  };
10
- type CompoundNodeContainerProps = Omit<HTMLMotionProps<'div'>, 'children'> & PropsWithChildren<{
9
+ type CompoundNodeContainerProps = PropsWithChildren<HTMLAttributes<HTMLDivElement> & {
10
+ layout?: boolean | 'position' | 'size' | 'preserve-aspect';
11
+ layoutId?: string | undefined;
11
12
  nodeProps: BaseNodeProps<BaseNode<RequiredData>>;
12
13
  }>;
13
14
  export declare function CompoundNodeContainer({ nodeProps: { data: { hovered: isHovered, dimmed: isDimmed, ...data }, }, className, children, style, ...rest }: CompoundNodeContainerProps): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { RecipeRuntimeFn } from '@likec4/styles';
1
+ import { RecipeRuntimeFn } from '../../../styled-system';
2
2
  export declare const compoundActionBtn: RecipeRuntimeFn<{
3
3
  delay: {
4
4
  true: {
@@ -1,9 +1,9 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { ensureSizes } from '@likec4/core/types';
3
3
  import { cx } from '@likec4/styles/css';
4
+ import { elementNode } from '@likec4/styles/recipes';
4
5
  import * as m from 'motion/react-m';
5
6
  import { forwardRef } from 'react';
6
- import { container } from './ElementNodeContainer.css.js';
7
7
 
8
8
  const ElementNodeContainer = forwardRef(({
9
9
  nodeProps: {
@@ -39,9 +39,8 @@ const ElementNodeContainer = forwardRef(({
39
39
  {
40
40
  ref,
41
41
  className: cx(
42
- container,
42
+ elementNode(),
43
43
  "group",
44
- "likec4-element-node",
45
44
  className
46
45
  ),
47
46
  initial: false,
@@ -1,9 +1,9 @@
1
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { nonexhaustive } from '@likec4/core';
3
3
  import { elementShapeRecipe } from '@likec4/styles/recipes';
4
4
  import { roundDpr } from '../../utils/roundDpr.js';
5
5
 
6
- function cylinderSVGPath(diameter, height, tilt = 0.065) {
6
+ function cylinderSVGPath(diameter, height, tilt = 0.07) {
7
7
  const radius = Math.round(diameter / 2);
8
8
  const rx = radius;
9
9
  const ry = roundDpr(tilt * radius);
@@ -21,6 +21,48 @@ function cylinderSVGPath(diameter, height, tilt = 0.065) {
21
21
  rx
22
22
  };
23
23
  }
24
+ function docSVGPath(width, height) {
25
+ const waveHeight = height / 8;
26
+ const baseY = roundDpr(height - waveHeight / 2);
27
+ const amplitude = roundDpr(height / 6);
28
+ const radius = 6;
29
+ const path = `
30
+ M 0 ${baseY}
31
+ V ${radius}
32
+ Q 0 0 ${radius} 0
33
+ H ${width - radius}
34
+ Q ${width} 0 ${width} ${radius}
35
+ V ${baseY}
36
+ C ${roundDpr(width * 0.75)} ${baseY + amplitude}, ${roundDpr(width * 0.5)} ${baseY - amplitude}, 0 ${baseY}
37
+ `.replace(/\s+/g, " ").trim();
38
+ return {
39
+ path
40
+ };
41
+ }
42
+ function bucketSVGPath(width, height) {
43
+ const cx = width / 2;
44
+ const topRx = roundDpr(cx);
45
+ const topRy = roundDpr(Math.min(height / 8, topRx * 0.08));
46
+ const bottomRx = roundDpr(topRx * 0.8);
47
+ const bottomRy = roundDpr(topRy * 1.05);
48
+ const topY = topRy;
49
+ const bottomY = height - bottomRy;
50
+ const leftBottomX = cx - bottomRx;
51
+ const path = `
52
+ M ${width},${topY}
53
+ a ${topRx},${topRy} 0,0,0 ${-width} 0
54
+ L ${leftBottomX},${bottomY}
55
+ a ${bottomRx},${bottomRy} 0,0,0 ${bottomRx * 2} 0
56
+ Z
57
+ `.replace(/\s+/g, " ").trim();
58
+ return {
59
+ path,
60
+ topRx,
61
+ topRy,
62
+ bottomRx,
63
+ bottomRy
64
+ };
65
+ }
24
66
  function queueSVGPath(width, height, tilt = 0.185) {
25
67
  const diameter = height;
26
68
  const radius = Math.round(diameter / 2);
@@ -64,6 +106,17 @@ function ShapeSvg({ shape, w, h }) {
64
106
  ] })
65
107
  ] });
66
108
  }
109
+ case "document": {
110
+ const { path } = docSVGPath(w, h);
111
+ return /* @__PURE__ */ jsx(
112
+ "path",
113
+ {
114
+ d: path,
115
+ "data-likec4-fill": "fill",
116
+ strokeWidth: 2
117
+ }
118
+ );
119
+ }
67
120
  case "browser": {
68
121
  return /* @__PURE__ */ jsxs(Fragment, { children: [
69
122
  /* @__PURE__ */ jsx(
@@ -123,12 +176,39 @@ function ShapeSvg({ shape, w, h }) {
123
176
  /* @__PURE__ */ jsx("ellipse", { cx: rx, cy: ry, ry: ry - 0.75, rx, "data-likec4-fill": "mix-stroke", strokeWidth: 2 })
124
177
  ] });
125
178
  }
179
+ case "bucket": {
180
+ const { path, topRx, topRy } = bucketSVGPath(w, h);
181
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
182
+ /* @__PURE__ */ jsx("path", { d: path, strokeWidth: 2 }),
183
+ /* @__PURE__ */ jsx(
184
+ "ellipse",
185
+ {
186
+ cx: w / 2,
187
+ cy: topRy,
188
+ rx: topRx,
189
+ ry: topRy,
190
+ "data-likec4-fill": "mix-stroke",
191
+ strokeWidth: 2
192
+ }
193
+ )
194
+ ] });
195
+ }
126
196
  case "storage":
127
197
  case "cylinder": {
128
198
  const { path, rx, ry } = cylinderSVGPath(w, h);
129
199
  return /* @__PURE__ */ jsxs(Fragment, { children: [
130
200
  /* @__PURE__ */ jsx("path", { d: path, strokeWidth: 2 }),
131
- /* @__PURE__ */ jsx("ellipse", { cx: rx, cy: ry, ry, rx: rx - 0.75, "data-likec4-fill": "mix-stroke", strokeWidth: 2 })
201
+ /* @__PURE__ */ jsx(
202
+ "ellipse",
203
+ {
204
+ cx: rx,
205
+ cy: ry,
206
+ ry,
207
+ rx: rx - 0.75,
208
+ "data-likec4-fill": "mix-stroke",
209
+ strokeWidth: 2
210
+ }
211
+ )
132
212
  ] });
133
213
  }
134
214
  default: {
@@ -139,12 +219,18 @@ function ShapeSvg({ shape, w, h }) {
139
219
  function ShapeSvgOutline({ shape, w, h }) {
140
220
  let svg;
141
221
  switch (shape) {
222
+ case "bucket":
223
+ svg = /* @__PURE__ */ jsx("g", { transform: "translate(-3 -3)", children: /* @__PURE__ */ jsx("path", { d: bucketSVGPath(w + 6, h + 6).path }) });
224
+ break;
142
225
  case "queue":
143
- svg = /* @__PURE__ */ jsx("path", { d: queueSVGPath(w, h).path });
226
+ svg = /* @__PURE__ */ jsx("g", { transform: "translate(-3 -3)", children: /* @__PURE__ */ jsx("path", { d: queueSVGPath(w + 6, h + 6).path }) });
227
+ break;
228
+ case "document":
229
+ svg = /* @__PURE__ */ jsx("g", { transform: "translate(-3 -3)", children: /* @__PURE__ */ jsx("path", { d: docSVGPath(w + 6, h + 6).path }) });
144
230
  break;
145
231
  case "storage":
146
232
  case "cylinder": {
147
- svg = /* @__PURE__ */ jsx("path", { d: cylinderSVGPath(w, h).path });
233
+ svg = /* @__PURE__ */ jsx("g", { transform: "translate(-3 -3)", children: /* @__PURE__ */ jsx("path", { d: cylinderSVGPath(w + 6, h + 6).path }) });
148
234
  break;
149
235
  }
150
236
  default: {
@@ -163,26 +249,29 @@ function ShapeSvgOutline({ shape, w, h }) {
163
249
  }
164
250
  return /* @__PURE__ */ jsx("g", { className: "likec4-shape-outline", children: svg });
165
251
  }
166
- function ShapeHtml({ multiple, withOutLine }) {
167
- return /* @__PURE__ */ jsxs(
168
- "div",
169
- {
170
- className: elementShapeRecipe({
171
- shapetype: "html"
172
- }),
173
- children: [
174
- multiple && /* @__PURE__ */ jsx("div", { className: "likec4-shape-multiple" }),
175
- withOutLine && /* @__PURE__ */ jsx("div", { className: "likec4-shape-outline" })
176
- ]
177
- }
178
- );
179
- }
180
252
  function ElementShape({ data, width, height, showSeletionOutline = true }) {
181
253
  let w = !!width && width > 10 ? width : data.width;
182
254
  let h = !!height && height > 10 ? height : data.height;
183
255
  const isMultiple = data.style?.multiple ?? false;
256
+ const borderStyle = data.style?.border ?? "none";
257
+ const withBorder = borderStyle !== "none";
184
258
  if (data.shape === "rectangle") {
185
- return /* @__PURE__ */ jsx(ShapeHtml, { multiple: isMultiple, withOutLine: showSeletionOutline });
259
+ return /* @__PURE__ */ jsxs(
260
+ "div",
261
+ {
262
+ style: {
263
+ borderStyle
264
+ },
265
+ className: elementShapeRecipe({
266
+ shapetype: "html",
267
+ withBorder
268
+ }),
269
+ children: [
270
+ isMultiple && /* @__PURE__ */ jsx("div", { className: "likec4-shape-multiple" }),
271
+ showSeletionOutline && /* @__PURE__ */ jsx("div", { className: "likec4-shape-outline" })
272
+ ]
273
+ }
274
+ );
186
275
  }
187
276
  const className = elementShapeRecipe({
188
277
  shapetype: "svg"
@@ -0,0 +1,11 @@
1
+ import { ForwardRefComponent, HTMLMotionProps } from 'motion/react';
2
+ import { HTMLAttributes, ForwardRefExoticComponent, RefAttributes } from 'react';
3
+ import { StyleContextProvider, StyleContextConsumer } from '../../styled-system/jsx';
4
+ import { NavigationPanelRecipe } from '../../styled-system/recipes';
5
+ export declare const NavigationPanel: {
6
+ Root: StyleContextProvider<ForwardRefComponent<"div", HTMLMotionProps<"div">>, NavigationPanelRecipe>;
7
+ Body: StyleContextConsumer<ForwardRefComponent<"div", HTMLMotionProps<"div">>>;
8
+ Logo: StyleContextConsumer<ForwardRefExoticComponent<HTMLAttributes<HTMLButtonElement> & RefAttributes<HTMLButtonElement>>>;
9
+ Label: StyleContextConsumer<ForwardRefComponent<"div", HTMLMotionProps<"div">>>;
10
+ Dropdown: StyleContextConsumer<ForwardRefComponent<"div", HTMLMotionProps<"div">>>;
11
+ };
@@ -0,0 +1,69 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { cx, css } from '@likec4/styles/css';
3
+ import { createStyleContext, isCssProperty } from '@likec4/styles/jsx';
4
+ import { navigationPanel } from '@likec4/styles/recipes';
5
+ import { isValidMotionProp } from 'motion/react';
6
+ import * as m from 'motion/react-m';
7
+ import { forwardRef } from 'react';
8
+ import { Logo as Logo$1 } from './Logo.js';
9
+
10
+ const { withProvider, withContext } = createStyleContext(navigationPanel);
11
+ const shouldForwardProp = (prop, variantKeys) => isValidMotionProp(prop) || !variantKeys.includes(prop) && !isCssProperty(prop);
12
+ const LogoButton = forwardRef(({ className, ...props }, ref) => {
13
+ return /* @__PURE__ */ jsxs(
14
+ "button",
15
+ {
16
+ ...props,
17
+ ref,
18
+ className: cx(
19
+ "mantine-active",
20
+ className
21
+ ),
22
+ children: [
23
+ /* @__PURE__ */ jsx("div", {}),
24
+ /* @__PURE__ */ jsx(
25
+ Logo$1,
26
+ {
27
+ className: css({
28
+ display: {
29
+ base: "none",
30
+ "@/md": "block"
31
+ }
32
+ })
33
+ }
34
+ ),
35
+ /* @__PURE__ */ jsx(
36
+ Logo$1,
37
+ {
38
+ className: css({
39
+ display: {
40
+ base: "block",
41
+ "@/md": "none"
42
+ }
43
+ })
44
+ }
45
+ )
46
+ ]
47
+ }
48
+ );
49
+ });
50
+ const Root = withProvider(m.div, "root", {
51
+ shouldForwardProp
52
+ });
53
+ const Body = withContext(m.div, "body", {
54
+ shouldForwardProp
55
+ });
56
+ const Logo = withContext(LogoButton, "logo");
57
+ const Label = withContext(m.div, "label", {
58
+ shouldForwardProp
59
+ });
60
+ withContext(m.div, "dropdown", {
61
+ shouldForwardProp
62
+ });
63
+ const NavigationPanel = {
64
+ Root,
65
+ Body,
66
+ Logo,
67
+ Label};
68
+
69
+ export { NavigationPanel };
@@ -12,7 +12,7 @@ const defaultHandlers = {
12
12
  onEdgeContextMenu: null,
13
13
  onCanvasClick: null,
14
14
  onCanvasDblClick: null,
15
- onBurgerMenuClick: null,
15
+ onLogoClick: null,
16
16
  onOpenSource: null,
17
17
  onInitialized: null,
18
18
  onLayoutTypeChange: null
@@ -1,6 +1,7 @@
1
1
  import { jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { cx } from '@likec4/styles/css';
3
3
  import { createContext, useContext } from 'react';
4
+ import IconFileText from '../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.3/node_modules/@tabler/icons-react/dist/esm/icons/IconFileText.js';
4
5
  import IconCylinder from '../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.3/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js';
5
6
  import IconRectangularPrism from '../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.3/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js';
6
7
  import IconReorder from '../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.3/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js';
@@ -57,7 +58,9 @@ const ShapeIcons = {
57
58
  person: IconUser,
58
59
  queue: IconReorder,
59
60
  rectangle: IconRectangularPrism,
60
- storage: IconCylinder
61
+ storage: IconCylinder,
62
+ bucket: IconCylinder,
63
+ document: IconFileText
61
64
  };
62
65
  function IconOrShapeRenderer({
63
66
  element,
@@ -10,8 +10,16 @@ function useLikeC4Projects() {
10
10
  }
11
11
  return ctx.projects;
12
12
  }
13
- const emptyOnProjectChange = () => {
13
+ const emptyOnProjectChange = (id) => {
14
+ console.warn(`Triggered callback to change project to ${id}, but no <LikeC4ProjectsProvider/> found`);
14
15
  };
16
+ function useChangeLikeC4Project() {
17
+ const ctx = useContext(LikeC4ProjectsContext);
18
+ if (!ctx) {
19
+ return emptyOnProjectChange;
20
+ }
21
+ return ctx.onProjectChange;
22
+ }
15
23
  const emptyContext = {
16
24
  projects: emptyProjects,
17
25
  onProjectChange: emptyOnProjectChange
@@ -46,4 +54,4 @@ function useLikeC4Project() {
46
54
  return project;
47
55
  }
48
56
 
49
- export { useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext };
57
+ export { useChangeLikeC4Project, useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext };
@@ -4,9 +4,6 @@ import { LikeC4ModelContext } from '../context/LikeC4ModelContext.js';
4
4
 
5
5
  function useLikeC4Styles() {
6
6
  const model = useContext(LikeC4ModelContext);
7
- if (!model) {
8
- console.error("No LikeC4ModelContext found");
9
- }
10
7
  const $styles = model?.$styles ?? LikeC4Styles.DEFAULT;
11
8
  const [styles, setStyles] = useState($styles);
12
9
  useEffect(() => {
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export { LikeC4ProjectsProvider, type LikeC4ProjectsProviderProps, } from './Lik
7
7
  export { type DiagramApi, type DiagramContext, useDiagram, useDiagramContext, useOnDiagramEvent, } from './hooks/useDiagram';
8
8
  export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel, } from './hooks/useLikeC4Model';
9
9
  export { useCurrentViewModel } from './hooks/useCurrentViewModel';
10
- export { useHasProjects, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext, } from './hooks/useLikeC4Project';
10
+ export { useChangeLikeC4Project, useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext, } from './hooks/useLikeC4Project';
11
11
  export { useLikeC4Styles } from './hooks/useLikeC4Styles';
12
12
  export { useUpdateEffect } from './hooks/useUpdateEffect';
13
13
  export type { Types } from './likec4diagram/types';
@@ -17,3 +17,4 @@ export type { LikeC4BrowserProps, LikeC4ViewProps } from './LikeC4View';
17
17
  export { ReactLikeC4, type ReactLikeC4Props } from './ReactLikeC4';
18
18
  export { useCurrentViewId } from './hooks/useCurrentView';
19
19
  export { pickViewBounds } from './utils/view-bounds';
20
+ export { LikeC4ProjectsOverview, type LikeC4ProjectsOverviewProps, } from './LikeC4ProjectsOverview';
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ export { LikeC4ProjectsProvider } from './LikeC4ProjectsProvider.js';
6
6
  export { useDiagramContext, useOnDiagramEvent } from './hooks/useDiagram.js';
7
7
  export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel } from './hooks/useLikeC4Model.js';
8
8
  export { useCurrentViewModel } from './hooks/useCurrentViewModel.js';
9
- export { useHasProjects, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext } from './hooks/useLikeC4Project.js';
9
+ export { useChangeLikeC4Project, useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext } from './hooks/useLikeC4Project.js';
10
10
  export { useLikeC4Styles } from './hooks/useLikeC4Styles.js';
11
11
  export { useUpdateEffect } from './hooks/useUpdateEffect.js';
12
12
  export { StaticLikeC4Diagram } from './StaticLikeC4Diagram.js';
@@ -14,4 +14,5 @@ export { LikeC4View } from './LikeC4View.js';
14
14
  export { ReactLikeC4 } from './ReactLikeC4.js';
15
15
  export { useCurrentViewId } from './hooks/useCurrentView.js';
16
16
  export { pickViewBounds } from './utils/view-bounds.js';
17
+ export { LikeC4ProjectsOverview } from './LikeC4ProjectsOverview.js';
17
18
  export { useDiagram } from './hooks/safeContext.js';
@@ -209,6 +209,7 @@ function LikeC4DiagramXYFlow({
209
209
  nodesDraggable,
210
210
  nodesSelectable,
211
211
  elevateEdgesOnSelect: !enableReadOnly,
212
+ zIndexMode: "manual",
212
213
  ...nodesDraggable && layoutConstraints,
213
214
  ...props,
214
215
  ...reactFlowProps,
@@ -19,16 +19,16 @@ function ColorButton({
19
19
  Popover,
20
20
  {
21
21
  clickOutsideEvents: ["pointerdown", "mousedown", "click"],
22
- position: "right-end",
22
+ position: "top-start",
23
23
  offset: 2,
24
24
  withinPortal: false,
25
25
  ...props,
26
26
  children: [
27
- /* @__PURE__ */ jsx(PopoverTarget, { children: /* @__PURE__ */ jsx(Button, { variant: "subtle", color: "gray", size: "compact-xs", px: 3, children: /* @__PURE__ */ jsx(
27
+ /* @__PURE__ */ jsx(PopoverTarget, { children: /* @__PURE__ */ jsx(Button, { variant: "subtle", color: "gray", size: "xs", px: 6, children: /* @__PURE__ */ jsx(
28
28
  ColorSwatch,
29
29
  {
30
30
  color: theme.colors[elementColor].elements.fill,
31
- size: 14,
31
+ size: 16,
32
32
  withShadow: true,
33
33
  style: { color: "#fff", cursor: "pointer" }
34
34
  }
@@ -1,8 +1,6 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { Box, SegmentedControl } from '@mantine/core';
3
- import { useState, useEffect } from 'react';
4
2
  import { useEnabledFeatures } from '../../../../context/DiagramFeatures.js';
5
- import { GoToSourceButton, BrowseRelationshipsButton } from './_shared.js';
3
+ import { BorderStyleOption, GoToSourceButton, BrowseRelationshipsButton } from './_shared.js';
6
4
  import { ColorButton } from './ColorButton.js';
7
5
  import { Toolbar } from './Toolbar.js';
8
6
  import { useHandlers } from './useHandlers.js';
@@ -89,40 +87,5 @@ function CompoundDeploymentToolbar(props) {
89
87
  }
90
88
  );
91
89
  }
92
- function BorderStyleOption({
93
- elementBorderStyle = "dashed",
94
- onChange
95
- }) {
96
- const [value, setValue] = useState(elementBorderStyle);
97
- useEffect(() => {
98
- setValue(elementBorderStyle);
99
- }, [elementBorderStyle]);
100
- return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
101
- SegmentedControl,
102
- {
103
- size: "xs",
104
- fullWidth: true,
105
- withItemsBorders: false,
106
- value,
107
- onChange: (v) => {
108
- const border = v;
109
- setValue(border);
110
- onChange({ border });
111
- },
112
- styles: {
113
- label: {
114
- paddingTop: "0.5",
115
- paddingBottom: "0.5"
116
- }
117
- },
118
- data: [
119
- { label: "Solid", value: "solid" },
120
- { label: "Dashed", value: "dashed" },
121
- { label: "Dotted", value: "dotted" },
122
- { label: "None", value: "none" }
123
- ]
124
- }
125
- ) });
126
- }
127
90
 
128
91
  export { CompoundDeploymentToolbar, CompoundElementToolbar };