@likec4/diagram 1.36.0 → 1.37.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 (183) hide show
  1. package/bundle/{chunk-7MPUJFHj.js → chunk-DSORWspW.js} +1011 -983
  2. package/bundle/custom.js +64 -56
  3. package/bundle/index.js +3546 -3321
  4. package/dist/LikeC4Diagram.props.d.ts +5 -5
  5. package/dist/LikeC4Styles.js +17 -15
  6. package/dist/StaticLikeC4Diagram.d.ts +1 -1
  7. package/dist/StaticLikeC4Diagram.js +3 -0
  8. package/dist/base/BaseXYFlow.d.ts +1 -1
  9. package/dist/base/BaseXYFlow.js +25 -27
  10. package/dist/base/const.d.ts +4 -4
  11. package/dist/base/const.js +5 -4
  12. package/dist/base/primitives/MarkdownBlock.js +4 -1
  13. package/dist/base/primitives/compound/CompoundActionButton.js +27 -42
  14. package/dist/base/primitives/compound/CompoundDetailsButton.js +23 -48
  15. package/dist/base/primitives/compound/CompoundNodeContainer.js +16 -48
  16. package/dist/base/primitives/compound/CompoundTitle.js +5 -80
  17. package/dist/base/primitives/compound/actionbtns.css.js +1 -13
  18. package/dist/base/primitives/customEdge.d.ts +1 -1
  19. package/dist/base/primitives/customNode.d.ts +4 -4
  20. package/dist/base/primitives/customNode.js +7 -7
  21. package/dist/base/primitives/edge/EdgeLabel.d.ts +5 -4
  22. package/dist/base/primitives/edge/EdgeLabel.js +39 -21
  23. package/dist/base/primitives/edge/EdgeLabelContainer.js +11 -23
  24. package/dist/base/primitives/edge/edge.css.js +19 -11
  25. package/dist/base/primitives/element/ElementShape.js +38 -18
  26. package/dist/base/primitives/element/ElementTags.js +7 -4
  27. package/dist/base/primitives/element/ElementTitle.js +10 -2
  28. package/dist/base/types.d.ts +17 -21
  29. package/dist/bundle/LikeC4View.d.ts +2 -2
  30. package/dist/bundle/LikeC4View.js +4 -1
  31. package/dist/bundle/LikeC4View.props.d.ts +2 -2
  32. package/dist/bundle/ReactLikeC4.d.ts +3 -3
  33. package/dist/bundle/custom.js +2 -1
  34. package/dist/bundle/index.js +2 -1
  35. package/dist/components/Link.js +3 -2
  36. package/dist/context/ReduceGraphics.js +2 -5
  37. package/dist/context/RootContainer.js +1 -5
  38. package/dist/custom/customNodes.d.ts +32 -26
  39. package/dist/custom/customNodes.js +12 -8
  40. package/dist/custom/hooks.d.ts +2 -1
  41. package/dist/custom/index.js +2 -1
  42. package/dist/globals.css.js +1 -1
  43. package/dist/hooks/index.d.ts +1 -1
  44. package/dist/hooks/useDiagram.d.ts +18 -1
  45. package/dist/hooks/useDiagram.js +18 -2
  46. package/dist/hooks/useXYFlow.d.ts +40 -21
  47. package/dist/index.d.ts +1 -1
  48. package/dist/index.js +2 -1
  49. package/dist/likec4diagram/DiagramUI.js +7 -3
  50. package/dist/likec4diagram/DiagramXYFlow.js +9 -9
  51. package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +3 -3
  52. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +27 -44
  53. package/dist/likec4diagram/custom/index.js +3 -3
  54. package/dist/likec4diagram/custom/nodes/nodes.d.ts +8 -6
  55. package/dist/likec4diagram/custom/nodes/nodes.js +13 -14
  56. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +3 -2
  57. package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +2 -2
  58. package/dist/likec4diagram/relationship-popover/RelationshipPopover.d.ts +2 -0
  59. package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +441 -0
  60. package/dist/likec4diagram/relationship-popover/actor.d.ts +177 -0
  61. package/dist/likec4diagram/relationship-popover/actor.js +155 -0
  62. package/dist/likec4diagram/relationship-popover/styles.css.d.ts +2 -0
  63. package/dist/likec4diagram/{custom/edges/RelationshipsDropdownMenu.css.js → relationship-popover/styles.css.js} +4 -17
  64. package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +4 -4
  65. package/dist/likec4diagram/useLayoutConstraints.js +0 -1
  66. package/dist/likec4model/LikeC4ModelContext.d.ts +2 -1
  67. package/dist/likec4model/LikeC4ModelContext.js +10 -2
  68. package/dist/likec4model/useCurrentViewModel.d.ts +1 -0
  69. package/dist/likec4model/useCurrentViewModel.js +4 -1
  70. package/dist/likec4model/useLikeC4ElementsTree.js +1 -1
  71. package/dist/likec4model/useLikeC4Project.js +15 -1
  72. package/dist/navigationpanel/NavigationPanelDropdown.js +1 -2
  73. package/dist/navigationpanel/actor.js +1 -2
  74. package/dist/navigationpanel/controls/NavigationButtons.js +1 -5
  75. package/dist/navigationpanel/controls/OpenSource.js +1 -1
  76. package/dist/navigationpanel/controls/ViewDetailsCard.js +2 -0
  77. package/dist/overlays/element-details/actor.d.ts +564 -8
  78. package/dist/overlays/overlay/Overlay.css.d.ts +1 -1
  79. package/dist/overlays/relationship-details/actor.d.ts +3 -1
  80. package/dist/overlays/relationship-details/hooks.d.ts +19 -1
  81. package/dist/overlays/relationship-details/layout-to-xyflow.js +0 -1
  82. package/dist/overlays/relationship-details/layout.js +1 -2
  83. package/dist/overlays/relationships-browser/actor.d.ts +26 -2
  84. package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +16 -0
  85. package/dist/overlays/relationships-browser/custom/nodeTypes.js +18 -8
  86. package/dist/overlays/relationships-browser/useViewToNodesEdges.js +0 -1
  87. package/dist/search/components/_shared.css.d.ts +1 -1
  88. package/dist/state/DiagramActorProvider.js +5 -23
  89. package/dist/state/assign.js +24 -10
  90. package/dist/state/diagram-machine.d.ts +149 -474
  91. package/dist/state/diagram-machine.js +94 -54
  92. package/dist/state/types.d.ts +1 -1
  93. package/dist/styles-min.css +1 -1
  94. package/dist/styles-xyflow.css +1 -1
  95. package/dist/styles.css +1 -1
  96. package/dist/styles.css2.js +1 -1
  97. package/dist/utils/index.d.ts +2 -1
  98. package/dist/utils/roundDpr.d.ts +1 -0
  99. package/dist/utils/roundDpr.js +20 -0
  100. package/dist/utils/xyflow.d.ts +0 -1
  101. package/dist/utils/xyflow.js +1 -7
  102. package/package.json +11 -10
  103. package/panda.buildinfo.json +90 -155
  104. package/src/LikeC4Diagram.props.ts +5 -5
  105. package/src/LikeC4Styles.tsx +22 -14
  106. package/src/StaticLikeC4Diagram.tsx +3 -0
  107. package/src/base/BaseXYFlow.tsx +26 -29
  108. package/src/base/const.ts +5 -4
  109. package/src/base/primitives/MarkdownBlock.tsx +6 -1
  110. package/src/base/primitives/compound/CompoundActionButton.tsx +31 -43
  111. package/src/base/primitives/compound/CompoundDetailsButton.tsx +26 -48
  112. package/src/base/primitives/compound/CompoundNodeContainer.tsx +15 -43
  113. package/src/base/primitives/compound/CompoundTitle.tsx +4 -76
  114. package/src/base/primitives/compound/actionbtns.css.ts +0 -12
  115. package/src/base/primitives/customEdge.ts +1 -1
  116. package/src/base/primitives/customNode.tsx +20 -24
  117. package/src/base/primitives/edge/EdgeLabel.tsx +23 -8
  118. package/src/base/primitives/edge/EdgeLabelContainer.tsx +9 -21
  119. package/src/base/primitives/edge/edge.css.ts +19 -11
  120. package/src/base/primitives/element/ElementShape.tsx +40 -18
  121. package/src/base/primitives/element/ElementTags.tsx +7 -4
  122. package/src/base/primitives/element/ElementTitle.tsx +23 -11
  123. package/src/base/types.ts +21 -25
  124. package/src/bundle/LikeC4View.props.ts +2 -2
  125. package/src/bundle/LikeC4View.tsx +8 -5
  126. package/src/bundle/ReactLikeC4.tsx +3 -3
  127. package/src/components/Link.tsx +3 -2
  128. package/src/context/RootContainer.tsx +1 -5
  129. package/src/context/TagStylesContext.tsx +2 -0
  130. package/src/custom/{customNodes.tsx → customNodes.ts} +58 -52
  131. package/src/custom/hooks.ts +7 -0
  132. package/src/globals.css +58 -5
  133. package/src/hooks/index.ts +1 -1
  134. package/src/hooks/useDiagram.ts +39 -5
  135. package/src/hooks/useXYFlow.ts +3 -1
  136. package/src/index.ts +1 -0
  137. package/src/likec4diagram/DiagramUI.tsx +11 -2
  138. package/src/likec4diagram/DiagramXYFlow.tsx +9 -11
  139. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +25 -49
  140. package/src/likec4diagram/custom/index.ts +5 -4
  141. package/src/likec4diagram/custom/nodes/nodes.tsx +13 -11
  142. package/src/likec4diagram/custom/nodes/toolbar/CompoundToolbar.tsx +3 -2
  143. package/src/likec4diagram/relationship-popover/RelationshipPopover.tsx +535 -0
  144. package/src/likec4diagram/relationship-popover/actor.ts +192 -0
  145. package/src/likec4diagram/{custom/edges/RelationshipsDropdownMenu.css.ts → relationship-popover/styles.css.ts} +3 -19
  146. package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +4 -5
  147. package/src/likec4diagram/useLayoutConstraints.ts +0 -1
  148. package/src/likec4model/{LikeC4ModelContext.ts → LikeC4ModelContext.tsx} +9 -1
  149. package/src/likec4model/useCurrentViewModel.ts +4 -0
  150. package/src/likec4model/useLikeC4ElementsTree.ts +1 -1
  151. package/src/navigationpanel/NavigationPanelDropdown.tsx +1 -2
  152. package/src/navigationpanel/actor.ts +2 -2
  153. package/src/navigationpanel/controls/NavigationButtons.tsx +1 -5
  154. package/src/navigationpanel/controls/OpenSource.tsx +1 -1
  155. package/src/navigationpanel/controls/ViewDetailsCard.tsx +2 -0
  156. package/src/overlays/relationship-details/layout-to-xyflow.ts +0 -1
  157. package/src/overlays/relationship-details/layout.ts +4 -3
  158. package/src/overlays/relationships-browser/custom/nodeTypes.tsx +22 -8
  159. package/src/overlays/relationships-browser/useViewToNodesEdges.ts +0 -1
  160. package/src/state/DiagramActorProvider.tsx +8 -25
  161. package/src/state/assign.ts +24 -10
  162. package/src/state/diagram-machine.ts +101 -53
  163. package/src/state/types.ts +4 -1
  164. package/src/utils/index.ts +2 -1
  165. package/src/utils/roundDpr.ts +27 -0
  166. package/src/utils/xyflow.ts +0 -7
  167. package/dist/base/primitives/compound/CompoundNodeContainer.css.d.ts +0 -35
  168. package/dist/base/primitives/compound/CompoundNodeContainer.css.js +0 -132
  169. package/dist/base/primitives/edge/EdgeLabel.css.d.ts +0 -7
  170. package/dist/base/primitives/edge/EdgeLabel.css.js +0 -57
  171. package/dist/base/primitives/element/ElementShape.css.d.ts +0 -6
  172. package/dist/base/primitives/element/ElementShape.css.js +0 -107
  173. package/dist/likec4diagram/custom/edges/NotePopover.css.js +0 -21
  174. package/dist/likec4diagram/custom/edges/NotePopover.js +0 -91
  175. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.d.ts +0 -5
  176. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.d.ts +0 -13
  177. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +0 -215
  178. package/dist/likec4diagram/custom/index.d.ts +0 -62
  179. package/dist/overlays/relationship-details/custom/nodeTypes.d.ts +0 -10
  180. package/src/base/primitives/compound/CompoundNodeContainer.css.ts +0 -138
  181. package/src/base/primitives/edge/EdgeLabel.css.ts +0 -64
  182. package/src/base/primitives/element/ElementShape.css.ts +0 -112
  183. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +0 -281
@@ -0,0 +1,155 @@
1
+ import { setup, assign, assertEvent } from 'xstate';
2
+
3
+ const _actorLogic = setup({
4
+ types: {
5
+ context: {},
6
+ events: {},
7
+ tags: "opened"
8
+ },
9
+ delays: {
10
+ "open timeout": ({ context }) => context.openTimeout,
11
+ "close timeout": 600,
12
+ "long idle": 1500
13
+ },
14
+ actions: {
15
+ "update edgeId": assign(({ context, event }) => {
16
+ assertEvent(event, ["xyedge.select", "xyedge.mouseEnter"]);
17
+ return {
18
+ edgeId: event.edgeId,
19
+ edgeSelected: context.edgeSelected || event.type === "xyedge.select"
20
+ };
21
+ }),
22
+ "increase open timeout": assign(() => ({
23
+ openTimeout: 800
24
+ })),
25
+ "decrease open timeout": assign(() => ({
26
+ openTimeout: 300
27
+ })),
28
+ "reset edgeId": assign({
29
+ edgeId: null,
30
+ edgeSelected: false
31
+ })
32
+ },
33
+ guards: {
34
+ "edge was selected": ({ context }) => context.edgeSelected,
35
+ "edge was hovered": ({ context }) => !context.edgeSelected
36
+ }
37
+ }).createMachine({
38
+ id: "breadcrumbs",
39
+ context: () => ({
40
+ edgeId: null,
41
+ edgeSelected: false,
42
+ openTimeout: 800
43
+ }),
44
+ initial: "idle",
45
+ on: {
46
+ "close": {
47
+ target: "#idle",
48
+ actions: [
49
+ "reset edgeId",
50
+ "increase open timeout"
51
+ ]
52
+ }
53
+ },
54
+ states: {
55
+ idle: {
56
+ id: "idle",
57
+ on: {
58
+ "xyedge.mouseEnter": {
59
+ target: "opening",
60
+ actions: "update edgeId"
61
+ },
62
+ "xyedge.select": {
63
+ target: "active",
64
+ actions: "update edgeId"
65
+ }
66
+ },
67
+ after: {
68
+ "long idle": {
69
+ actions: "increase open timeout"
70
+ }
71
+ }
72
+ },
73
+ opening: {
74
+ on: {
75
+ "xyedge.mouseLeave": {
76
+ target: "idle"
77
+ },
78
+ "xyedge.select": {
79
+ target: "active",
80
+ actions: "update edgeId"
81
+ }
82
+ },
83
+ after: {
84
+ "open timeout": {
85
+ actions: "decrease open timeout",
86
+ target: "active"
87
+ }
88
+ }
89
+ },
90
+ active: {
91
+ tags: ["opened"],
92
+ initial: "opened",
93
+ exit: "reset edgeId",
94
+ on: {
95
+ "xyedge.unselect": {
96
+ target: "idle",
97
+ actions: "increase open timeout"
98
+ },
99
+ "xyedge.select": {
100
+ actions: "update edgeId"
101
+ }
102
+ },
103
+ states: {
104
+ opened: {
105
+ on: {
106
+ "dropdown.mouseEnter": {
107
+ target: "hovered"
108
+ },
109
+ "xyedge.mouseLeave": {
110
+ guard: "edge was hovered",
111
+ target: "closing"
112
+ }
113
+ }
114
+ },
115
+ hovered: {
116
+ on: {
117
+ "dropdown.mouseLeave": [
118
+ {
119
+ guard: "edge was selected",
120
+ target: "opened"
121
+ },
122
+ {
123
+ target: "closing"
124
+ }
125
+ ]
126
+ }
127
+ },
128
+ closing: {
129
+ on: {
130
+ "xyedge.mouseEnter": {
131
+ guard: "edge was hovered",
132
+ target: "opened",
133
+ actions: "update edgeId"
134
+ },
135
+ "xyedge.select": {
136
+ target: "opened",
137
+ actions: "update edgeId"
138
+ },
139
+ "dropdown.mouseEnter": {
140
+ target: "hovered"
141
+ }
142
+ },
143
+ after: {
144
+ "close timeout": {
145
+ target: "#idle"
146
+ }
147
+ }
148
+ }
149
+ }
150
+ }
151
+ }
152
+ });
153
+ const RelationshipPopoverActorLogic = _actorLogic;
154
+
155
+ export { RelationshipPopoverActorLogic };
@@ -0,0 +1,2 @@
1
+ export declare const endpoint: string;
2
+ export declare const title: string;
@@ -1,13 +1,5 @@
1
1
  import { css } from '@likec4/styles/css';
2
2
 
3
- const menuDropdown = css({
4
- overflowY: "scroll",
5
- minWidth: "250px",
6
- maxWidth: "min(90vw, 500px)"
7
- });
8
- const menuItemRelationship = css({
9
- gap: "1"
10
- });
11
3
  const endpoint = css({
12
4
  display: "block",
13
5
  fontSize: "xxs",
@@ -22,17 +14,12 @@ const endpoint = css({
22
14
  _light: `[color-mix(in srgb, var(--likec4-palette-stroke), {colors.likec4.mixColor} 60%)]`,
23
15
  _dark: "var(--likec4-palette-loContrast)"
24
16
  }
25
- // _dark: {
26
- // background: `var(--likec4-palette-fill)/60`,
27
- // },
28
17
  });
29
18
  const title = css({
30
19
  whiteSpaceCollapse: "preserve-breaks",
31
- fontSize: "xs"
32
- });
33
- css({
34
- whiteSpaceCollapse: "preserve-breaks",
35
- fontSize: "xs"
20
+ fontSize: "sm",
21
+ lineHeight: "sm",
22
+ userSelect: "all"
36
23
  });
37
24
 
38
- export { endpoint, menuDropdown, menuItemRelationship, title };
25
+ export { endpoint, title };
@@ -5,8 +5,8 @@ import { useLocalStorage } from '@mantine/hooks';
5
5
  import { AnimatePresence, m } from 'motion/react';
6
6
  import { Link } from '../../../components/Link.js';
7
7
  import { useDiagramContext } from '../../../hooks/useDiagram.js';
8
+ import { useOptionalCurrentViewModel } from '../../../likec4model/useCurrentViewModel.js';
8
9
  import { card, title, description } from './DiagramTitlePanel.css.js';
9
- import { useCurrentViewModel } from '../../../likec4model/useCurrentViewModel.js';
10
10
  import IconMenu from '../../../node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconMenu.js';
11
11
  import { MarkdownBlock } from '../../../base/primitives/MarkdownBlock.js';
12
12
 
@@ -20,15 +20,15 @@ function selector(context) {
20
20
  };
21
21
  }
22
22
  function DiagramTitlePanel() {
23
- const view = useCurrentViewModel();
23
+ const view = useOptionalCurrentViewModel();
24
24
  const { isNotActiveWalkthrough } = useDiagramContext(selector);
25
25
  const [isCollapsed, setCollapsed] = useLocalStorage({
26
26
  key: "diagram-title-webview-collapsed",
27
27
  defaultValue: false
28
28
  });
29
- const title$1 = view.title ?? "untitled";
29
+ const title$1 = view?.title ?? "untitled";
30
30
  const toggle = () => setCollapsed((v) => !v);
31
- return /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: isNotActiveWalkthrough && /* @__PURE__ */ jsx(
31
+ return /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: view && isNotActiveWalkthrough && /* @__PURE__ */ jsx(
32
32
  m.div,
33
33
  {
34
34
  initial: { opacity: 0.05, scale: 0.7 },
@@ -211,7 +211,6 @@ function useLayoutConstraints() {
211
211
  },
212
212
  onNodeDragStop: (_event) => {
213
213
  moved = Math.abs(_event.clientX - initial.x) > 4 || Math.abs(_event.clientY - initial.y) > 4;
214
- console.log("moved", moved);
215
214
  if (wasPending || moved) {
216
215
  diagram.scheduleSaveManualLayout();
217
216
  }
@@ -1,6 +1,7 @@
1
1
  import { LikeC4Model, LikeC4ViewModel } from '@likec4/core/model';
2
2
  import { aux, DiagramView } from '@likec4/core/types';
3
- import { Context } from 'react';
3
+ import { PropsWithChildren, Context } from 'react';
4
4
  export declare const LikeC4ModelContext: Context<LikeC4Model<any> | null>;
5
5
  export type CurrentViewModel = LikeC4ViewModel<aux.UnknownLayouted, DiagramView<aux.UnknownLayouted>>;
6
6
  export declare const CurrentViewModelContext: Context<CurrentViewModel | null>;
7
+ export declare function EnsureCurrentViewModel({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element | null;
@@ -1,6 +1,14 @@
1
- import { createContext } from 'react';
1
+ import { jsx, Fragment } from 'react/jsx-runtime';
2
+ import { createContext, useContext } from 'react';
2
3
 
3
4
  const LikeC4ModelContext = createContext(null);
4
5
  const CurrentViewModelContext = createContext(null);
6
+ function EnsureCurrentViewModel({ children }) {
7
+ const viewmodel = useContext(CurrentViewModelContext);
8
+ if (!viewmodel) {
9
+ return null;
10
+ }
11
+ return /* @__PURE__ */ jsx(Fragment, { children });
12
+ }
5
13
 
6
- export { CurrentViewModelContext, LikeC4ModelContext };
14
+ export { CurrentViewModelContext, EnsureCurrentViewModel, LikeC4ModelContext };
@@ -1,2 +1,3 @@
1
1
  import { CurrentViewModel } from './LikeC4ModelContext';
2
+ export declare function useOptionalCurrentViewModel(): CurrentViewModel | null;
2
3
  export declare function useCurrentViewModel(): CurrentViewModel;
@@ -1,6 +1,9 @@
1
1
  import { useContext } from 'react';
2
2
  import { CurrentViewModelContext } from './LikeC4ModelContext.js';
3
3
 
4
+ function useOptionalCurrentViewModel() {
5
+ return useContext(CurrentViewModelContext);
6
+ }
4
7
  function useCurrentViewModel() {
5
8
  const vm = useContext(CurrentViewModelContext);
6
9
  if (!vm) {
@@ -9,4 +12,4 @@ function useCurrentViewModel() {
9
12
  return vm;
10
13
  }
11
14
 
12
- export { useCurrentViewModel };
15
+ export { useCurrentViewModel, useOptionalCurrentViewModel };
@@ -1,4 +1,4 @@
1
- import { compareNatural } from '@likec4/core/utils';
1
+ import { compareNatural } from '@likec4/core';
2
2
  import { useMemo } from 'react';
3
3
  import { useLikeC4Model } from './useLikeC4Model.js';
4
4
 
@@ -3,6 +3,13 @@ import { LikeC4ModelContext } from './LikeC4ModelContext.js';
3
3
  import { LikeC4ProjectsContext } from './LikeC4ProjectsContext.js';
4
4
 
5
5
  const emptyProjects = [];
6
+ function useLikeC4Projects() {
7
+ const ctx = useContext(LikeC4ProjectsContext);
8
+ if (!ctx) {
9
+ return emptyProjects;
10
+ }
11
+ return ctx.projects;
12
+ }
6
13
  const emptyOnProjectChange = () => {
7
14
  };
8
15
  const emptyContext = {
@@ -12,6 +19,13 @@ const emptyContext = {
12
19
  function useLikeC4ProjectsContext() {
13
20
  return useContext(LikeC4ProjectsContext) ?? emptyContext;
14
21
  }
22
+ function useHasProjects() {
23
+ const ctx = useContext(LikeC4ProjectsContext);
24
+ if (!ctx) {
25
+ return false;
26
+ }
27
+ return ctx.projects.length > 1;
28
+ }
15
29
  function useLikeC4ProjectId() {
16
30
  const ctx = useContext(LikeC4ModelContext);
17
31
  if (!ctx) {
@@ -20,4 +34,4 @@ function useLikeC4ProjectId() {
20
34
  return ctx.projectId;
21
35
  }
22
36
 
23
- export { useLikeC4ProjectId, useLikeC4ProjectsContext };
37
+ export { useHasProjects, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext };
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { ifilter, ifirst, toArray, compareNaturalHierarchically, nonexhaustive } from '@likec4/core';
2
3
  import { normalizeViewPath, VIEW_FOLDERS_SEPARATOR } from '@likec4/core/model';
3
- import { ifilter, ifirst, toArray, compareNaturalHierarchically, nonexhaustive } from '@likec4/core/utils';
4
4
  import { cx, css } from '@likec4/styles/css';
5
5
  import { HStack, VStack, Box } from '@likec4/styles/jsx';
6
6
  import { vstack, hstack } from '@likec4/styles/patterns';
@@ -122,7 +122,6 @@ function SearchResults({ searchQuery }) {
122
122
  view: v,
123
123
  highlight,
124
124
  onClick: (e) => {
125
- console.log("click");
126
125
  e.stopPropagation();
127
126
  actor.selectView(v.id);
128
127
  },
@@ -1,4 +1,3 @@
1
- import { ViewId } from '@likec4/core/types';
2
1
  import { isEmpty } from 'remeda';
3
2
  import { setup, emit, assign, assertEvent, raise } from 'xstate';
4
3
 
@@ -65,7 +64,7 @@ const _actorLogic = setup({
65
64
  assertEvent(event, "select.view");
66
65
  return {
67
66
  type: "navigateTo",
68
- viewId: ViewId(event.viewId)
67
+ viewId: event.viewId
69
68
  };
70
69
  })
71
70
  },
@@ -20,11 +20,7 @@ const NavigationButtons = () => {
20
20
  {
21
21
  layout: "position",
22
22
  className: hstack({
23
- gap: "[1px]",
24
- display: {
25
- base: "none",
26
- "@likec4-root/sm": "flex"
27
- }
23
+ gap: "0.5"
28
24
  }),
29
25
  children: [
30
26
  /* @__PURE__ */ jsx(
@@ -19,7 +19,7 @@ const OpenSource = () => {
19
19
  e.stopPropagation();
20
20
  onOpenSource?.({ view: viewId });
21
21
  },
22
- children: /* @__PURE__ */ jsx(IconFileSymlink, { stroke: 1.5, style: { width: "65%" } })
22
+ children: /* @__PURE__ */ jsx(IconFileSymlink, { style: { width: "60%", height: "60%" } })
23
23
  }
24
24
  ) });
25
25
  };
@@ -131,6 +131,8 @@ const ViewDetailsCardDropdown = ({
131
131
  maxHeight: "calc(100cqh - 100px)",
132
132
  width: "max-content",
133
133
  cursor: "default",
134
+ overflow: "auto",
135
+ overscrollBehavior: "contain",
134
136
  "@/sm": {
135
137
  minWidth: 400,
136
138
  maxWidth: 550