@likec4/diagram 1.35.0 → 1.36.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.
Files changed (224) hide show
  1. package/bundle/{chunk-C0Eg81Gj.js → chunk-DHvr-RGh.js} +323 -311
  2. package/bundle/custom.js +52 -52
  3. package/bundle/index.js +1594 -749
  4. package/dist/LikeC4Diagram.js +6 -6
  5. package/dist/LikeC4Diagram.props.d.ts +2 -3
  6. package/dist/LikeC4ModelProvider.d.ts +3 -3
  7. package/dist/LikeC4ProjectsProvider.d.ts +17 -0
  8. package/dist/LikeC4ProjectsProvider.js +22 -0
  9. package/dist/LikeC4Styles.d.ts +1 -0
  10. package/dist/LikeC4Styles.js +94 -0
  11. package/dist/StaticLikeC4Diagram.d.ts +3 -3
  12. package/dist/base/BaseXYFlow.js +23 -26
  13. package/dist/base/primitives/MarkdownBlock.d.ts +7 -1
  14. package/dist/base/primitives/MarkdownBlock.js +1 -1
  15. package/dist/base/primitives/compound/CompoundActionButton.js +2 -2
  16. package/dist/base/primitives/compound/CompoundDetailsButton.js +2 -2
  17. package/dist/base/primitives/compound/CompoundNodeContainer.css.js +4 -4
  18. package/dist/base/primitives/compound/CompoundNodeContainer.js +1 -4
  19. package/dist/base/primitives/compound/CompoundTitle.js +9 -8
  20. package/dist/base/primitives/compound/actionbtns.css.js +6 -6
  21. package/dist/base/primitives/edge/EdgeActionButton.js +2 -2
  22. package/dist/base/primitives/edge/EdgeContainer.js +4 -7
  23. package/dist/base/primitives/edge/EdgeLabel.css.d.ts +0 -22
  24. package/dist/base/primitives/edge/EdgeLabel.css.js +6 -84
  25. package/dist/base/primitives/edge/EdgeLabel.js +16 -6
  26. package/dist/base/primitives/edge/EdgeLabelContainer.js +1 -6
  27. package/dist/base/primitives/edge/EdgeMarkers.js +3 -3
  28. package/dist/base/primitives/edge/edge.css.d.ts +0 -2
  29. package/dist/base/primitives/edge/edge.css.js +1 -55
  30. package/dist/base/primitives/element/ElementActionButtons.js +2 -2
  31. package/dist/base/primitives/element/ElementDetailsButton.js +8 -7
  32. package/dist/base/primitives/element/ElementNodeContainer.css.js +4 -4
  33. package/dist/base/primitives/element/ElementNodeContainer.js +1 -4
  34. package/dist/base/primitives/element/ElementShape.css.js +11 -11
  35. package/dist/base/primitives/element/ElementTags.d.ts +1 -0
  36. package/dist/base/primitives/element/ElementTags.js +17 -14
  37. package/dist/bundle/LikeC4View.d.ts +1 -1
  38. package/dist/bundle/LikeC4View.js +7 -1
  39. package/dist/bundle/LikeC4View.props.d.ts +1 -2
  40. package/dist/bundle/ReactLikeC4.d.ts +1 -1
  41. package/dist/bundle/ViewNotFound.js +1 -1
  42. package/dist/bundle/index.d.ts +2 -1
  43. package/dist/bundle/index.js +1 -0
  44. package/dist/bundle/styles.css.js +1 -1
  45. package/dist/components/ErrorFallback.js +1 -1
  46. package/dist/components/GithubIcon.d.ts +2 -0
  47. package/dist/components/GithubIcon.js +17 -0
  48. package/dist/components/Link.d.ts +4 -3
  49. package/dist/components/Link.js +84 -87
  50. package/dist/components/NavigationLink.d.ts +2 -2
  51. package/dist/components/SearchControl.css.js +6 -5
  52. package/dist/context/DiagramEventHandlers.d.ts +6 -6
  53. package/dist/context/DiagramEventHandlers.js +4 -7
  54. package/dist/globals.css.js +3 -0
  55. package/dist/hooks/useXYFlow.d.ts +10 -10
  56. package/dist/index.d.ts +1 -0
  57. package/dist/index.js +1 -0
  58. package/dist/likec4diagram/DiagramUI.js +2 -1
  59. package/dist/likec4diagram/custom/edges/NotePopover.css.js +2 -2
  60. package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +2 -2
  61. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +1 -1
  62. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.js +7 -7
  63. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +3 -3
  64. package/dist/likec4diagram/custom/edges/edges.css.js +4 -4
  65. package/dist/likec4diagram/custom/index.d.ts +2 -2
  66. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +2 -2
  67. package/dist/likec4diagram/ui/controls/styles.css.js +5 -5
  68. package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +4 -4
  69. package/dist/likec4diagram/ui/notation/NotationPanel.css.js +11 -11
  70. package/dist/likec4diagram/ui/notation/NotationPanel.js +2 -5
  71. package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.css.js +10 -10
  72. package/dist/likec4model/LikeC4ModelContext.d.ts +2 -1
  73. package/dist/likec4model/LikeC4ModelContext.js +10 -2
  74. package/dist/likec4model/LikeC4ProjectsContext.d.ts +7 -0
  75. package/dist/likec4model/LikeC4ProjectsContext.js +5 -0
  76. package/dist/likec4model/index.d.ts +1 -0
  77. package/dist/likec4model/useCurrentViewModel.d.ts +1 -0
  78. package/dist/likec4model/useCurrentViewModel.js +4 -1
  79. package/dist/likec4model/useLikeC4Project.d.ts +22 -0
  80. package/dist/likec4model/useLikeC4Project.js +23 -0
  81. package/dist/navigationpanel/NavigationPanel.js +15 -17
  82. package/dist/navigationpanel/NavigationPanelControls.js +34 -21
  83. package/dist/navigationpanel/NavigationPanelDropdown.js +33 -17
  84. package/dist/navigationpanel/_common.js +4 -1
  85. package/dist/navigationpanel/actor.d.ts +11 -15
  86. package/dist/navigationpanel/actor.js +14 -15
  87. package/dist/navigationpanel/controls/BurgerButton.js +5 -7
  88. package/dist/navigationpanel/controls/NavigationButtons.js +37 -24
  89. package/dist/navigationpanel/controls/OpenSource.js +1 -1
  90. package/dist/navigationpanel/controls/SearchControl.js +6 -4
  91. package/dist/navigationpanel/controls/ToggleReadonly.js +3 -3
  92. package/dist/navigationpanel/controls/ViewDetailsCard.d.ts +2 -0
  93. package/dist/navigationpanel/controls/ViewDetailsCard.js +232 -0
  94. package/dist/navigationpanel/controls/index.d.ts +1 -0
  95. package/dist/navigationpanel/dropdown/ProjectsMenu.d.ts +2 -0
  96. package/dist/navigationpanel/dropdown/ProjectsMenu.js +75 -0
  97. package/dist/navigationpanel/editorpanel/EditorPanel.js +3 -3
  98. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +19 -20
  99. package/dist/navigationpanel/editorpanel/styles.js +5 -5
  100. package/dist/navigationpanel/hooks.d.ts +2 -2
  101. package/dist/navigationpanel/styles.css.js +0 -2
  102. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +12 -7
  103. package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +14 -0
  104. package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +14 -0
  105. package/dist/overlays/element-details/ElementDetailsCard.css.js +18 -17
  106. package/dist/overlays/element-details/ElementDetailsCard.js +8 -13
  107. package/dist/overlays/element-details/TabPanelDeployments.css.js +5 -4
  108. package/dist/overlays/element-details/TabPanelRelationships.css.js +7 -7
  109. package/dist/overlays/overlay/Overlay.css.d.ts +3 -3
  110. package/dist/overlays/overlay/Overlay.css.js +8 -7
  111. package/dist/overlays/relationship-details/SelectEdge.css.js +8 -8
  112. package/dist/overlays/relationships-browser/SelectElement.css.js +1 -1
  113. package/dist/search/Search.js +6 -6
  114. package/dist/search/components/ElementsColumn.css.js +5 -5
  115. package/dist/search/components/SearchByTags.js +3 -2
  116. package/dist/search/components/ViewsColum.js +1 -1
  117. package/dist/search/components/ViewsColumn.css.js +1 -1
  118. package/dist/search/components/_shared.css.js +3 -3
  119. package/dist/search/components/styles.css.js +5 -5
  120. package/dist/state/DiagramActorProvider.js +43 -25
  121. package/dist/state/diagram-machine.d.ts +29 -247
  122. package/dist/state/diagram-machine.js +16 -16
  123. package/dist/styles-min.css +1 -1
  124. package/dist/styles.css +1 -1
  125. package/dist/styles.css2.js +1 -1
  126. package/package.json +10 -8
  127. package/panda.buildinfo.json +254 -326
  128. package/src/LikeC4Diagram.props.ts +2 -2
  129. package/src/LikeC4Diagram.tsx +2 -2
  130. package/src/LikeC4ModelProvider.tsx +4 -4
  131. package/src/LikeC4ProjectsProvider.tsx +41 -0
  132. package/src/LikeC4Styles.tsx +107 -0
  133. package/src/StaticLikeC4Diagram.tsx +3 -3
  134. package/src/base/BaseXYFlow.tsx +24 -29
  135. package/src/base/primitives/MarkdownBlock.tsx +11 -3
  136. package/src/base/primitives/compound/CompoundActionButton.tsx +2 -2
  137. package/src/base/primitives/compound/CompoundDetailsButton.tsx +2 -2
  138. package/src/base/primitives/compound/CompoundNodeContainer.css.ts +4 -13
  139. package/src/base/primitives/compound/CompoundNodeContainer.tsx +0 -3
  140. package/src/base/primitives/compound/CompoundTitle.tsx +8 -8
  141. package/src/base/primitives/compound/actionbtns.css.ts +6 -6
  142. package/src/base/primitives/edge/EdgeActionButton.tsx +2 -2
  143. package/src/base/primitives/edge/EdgeContainer.tsx +3 -6
  144. package/src/base/primitives/edge/EdgeLabel.css.ts +4 -83
  145. package/src/base/primitives/edge/EdgeLabel.tsx +16 -10
  146. package/src/base/primitives/edge/EdgeLabelContainer.tsx +1 -6
  147. package/src/base/primitives/edge/EdgeMarkers.tsx +3 -3
  148. package/src/base/primitives/edge/edge.css.ts +0 -60
  149. package/src/base/primitives/element/ElementActionButtons.tsx +2 -2
  150. package/src/base/primitives/element/ElementDetailsButton.tsx +7 -7
  151. package/src/base/primitives/element/ElementNodeContainer.css.ts +4 -4
  152. package/src/base/primitives/element/ElementNodeContainer.tsx +0 -3
  153. package/src/base/primitives/element/ElementShape.css.ts +11 -11
  154. package/src/base/primitives/element/ElementTags.tsx +17 -14
  155. package/src/bundle/LikeC4View.props.ts +1 -2
  156. package/src/bundle/LikeC4View.tsx +10 -3
  157. package/src/bundle/ReactLikeC4.tsx +1 -2
  158. package/src/bundle/ViewNotFound.tsx +1 -1
  159. package/src/bundle/index.ts +2 -1
  160. package/src/bundle/styles.css.ts +1 -1
  161. package/src/components/ErrorFallback.tsx +1 -1
  162. package/src/components/GithubIcon.tsx +16 -0
  163. package/src/components/Link.tsx +102 -113
  164. package/src/components/NavigationLink.tsx +2 -1
  165. package/src/components/SearchControl.css.ts +5 -5
  166. package/src/context/DiagramEventHandlers.tsx +12 -12
  167. package/src/globals.css +71 -0
  168. package/src/index.ts +5 -0
  169. package/src/likec4diagram/DiagramUI.tsx +8 -2
  170. package/src/likec4diagram/custom/edges/NotePopover.css.ts +2 -2
  171. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +1 -1
  172. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.ts +7 -7
  173. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +3 -3
  174. package/src/likec4diagram/custom/edges/edges.css.ts +4 -4
  175. package/src/likec4diagram/custom/nodes/toolbar/CompoundToolbar.tsx +2 -2
  176. package/src/likec4diagram/ui/controls/styles.css.ts +5 -5
  177. package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +4 -5
  178. package/src/likec4diagram/ui/notation/NotationPanel.css.ts +11 -11
  179. package/src/likec4diagram/ui/notation/NotationPanel.tsx +1 -4
  180. package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.css.ts +10 -10
  181. package/src/likec4model/{LikeC4ModelContext.ts → LikeC4ModelContext.tsx} +9 -1
  182. package/src/likec4model/LikeC4ProjectsContext.ts +9 -0
  183. package/src/likec4model/index.ts +8 -0
  184. package/src/likec4model/useCurrentViewModel.ts +4 -0
  185. package/src/likec4model/useLikeC4Project.ts +61 -0
  186. package/src/navigationpanel/NavigationPanel.tsx +16 -17
  187. package/src/navigationpanel/NavigationPanelControls.tsx +24 -46
  188. package/src/navigationpanel/NavigationPanelDropdown.tsx +32 -16
  189. package/src/navigationpanel/_common.tsx +4 -1
  190. package/src/navigationpanel/actor.ts +14 -15
  191. package/src/navigationpanel/controls/BurgerButton.tsx +5 -7
  192. package/src/navigationpanel/controls/NavigationButtons.tsx +9 -1
  193. package/src/navigationpanel/controls/OpenSource.tsx +1 -1
  194. package/src/navigationpanel/controls/SearchControl.tsx +6 -4
  195. package/src/navigationpanel/controls/ToggleReadonly.tsx +3 -3
  196. package/src/navigationpanel/controls/ViewDetailsCard.tsx +244 -0
  197. package/src/navigationpanel/controls/index.ts +1 -0
  198. package/src/navigationpanel/dropdown/ProjectsMenu.tsx +74 -0
  199. package/src/navigationpanel/editorpanel/EditorPanel.tsx +3 -3
  200. package/src/navigationpanel/editorpanel/ManualLayoutToolsButton.tsx +19 -22
  201. package/src/navigationpanel/editorpanel/styles.ts +5 -5
  202. package/src/navigationpanel/hooks.tsx +2 -2
  203. package/src/navigationpanel/styles.css.ts +0 -2
  204. package/src/navigationpanel/walkthrough/ActiveWalkthroughControls.tsx +9 -4
  205. package/src/overlays/element-details/ElementDetailsCard.css.ts +17 -17
  206. package/src/overlays/element-details/ElementDetailsCard.tsx +8 -13
  207. package/src/overlays/element-details/TabPanelDeployments.css.ts +4 -4
  208. package/src/overlays/element-details/TabPanelRelationships.css.ts +7 -7
  209. package/src/overlays/overlay/Overlay.css.ts +7 -7
  210. package/src/overlays/relationship-details/SelectEdge.css.ts +8 -8
  211. package/src/overlays/relationships-browser/SelectElement.css.ts +1 -1
  212. package/src/search/Search.tsx +6 -6
  213. package/src/search/components/ElementsColumn.css.ts +5 -5
  214. package/src/search/components/SearchByTags.tsx +2 -2
  215. package/src/search/components/ViewsColum.tsx +1 -1
  216. package/src/search/components/ViewsColumn.css.ts +1 -1
  217. package/src/search/components/_shared.css.ts +3 -3
  218. package/src/search/components/styles.css.ts +5 -5
  219. package/src/state/DiagramActorProvider.tsx +56 -30
  220. package/src/state/diagram-machine.ts +22 -16
  221. package/dist/LikeC4CustomColors.d.ts +0 -2
  222. package/dist/LikeC4CustomColors.js +0 -45
  223. package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +0 -45
  224. package/src/LikeC4CustomColors.tsx +0 -85
@@ -31,6 +31,9 @@ const _actorLogic = setup({
31
31
  activatedBy: "click"
32
32
  }),
33
33
  "update selected folder": assign(({ event }) => {
34
+ if (event.type === "breadcrumbs.click.root") {
35
+ return { selectedFolder: "" };
36
+ }
34
37
  assertEvent(event, ["breadcrumbs.click.folder", "select.folder"]);
35
38
  return { selectedFolder: event.folderPath };
36
39
  }),
@@ -58,10 +61,10 @@ const _actorLogic = setup({
58
61
  assertEvent(event, "searchQuery.change");
59
62
  return { searchQuery: event.value ?? "" };
60
63
  }),
61
- "emit trigger.navigateTo": emit(({ event }) => {
64
+ "emit navigateTo": emit(({ event }) => {
62
65
  assertEvent(event, "select.view");
63
66
  return {
64
- type: "trigger.navigateTo",
67
+ type: "navigateTo",
65
68
  viewId: ViewId(event.viewId)
66
69
  };
67
70
  })
@@ -170,15 +173,11 @@ const _actorLogic = setup({
170
173
  actions: "keep dropdown open",
171
174
  target: "search"
172
175
  },
173
- "breadcrumbs.click.folder": {
174
- actions: "update selected folder",
175
- target: "opened",
176
- reenter: true
177
- },
178
176
  "breadcrumbs.click.viewtitle": {
179
- actions: "reset selected folder",
180
- reenter: true,
181
- target: "opened"
177
+ actions: "reset selected folder"
178
+ },
179
+ "breadcrumbs.click.*": {
180
+ actions: "update selected folder"
182
181
  },
183
182
  "select.folder": {
184
183
  actions: [
@@ -188,30 +187,30 @@ const _actorLogic = setup({
188
187
  },
189
188
  "select.view": {
190
189
  actions: [
191
- "emit trigger.navigateTo"
190
+ "emit navigateTo"
192
191
  ]
193
192
  }
194
193
  }
195
194
  },
196
195
  search: {
197
196
  on: {
198
- "breadcrumbs.click.folder": {
197
+ "breadcrumbs.click.viewtitle": {
199
198
  actions: [
200
199
  "reset search query",
201
- "update selected folder"
200
+ "reset selected folder"
202
201
  ],
203
202
  target: "opened"
204
203
  },
205
204
  "breadcrumbs.click.*": {
206
205
  actions: [
207
206
  "reset search query",
208
- "reset selected folder"
207
+ "update selected folder"
209
208
  ],
210
209
  target: "opened"
211
210
  },
212
211
  "select.view": {
213
212
  actions: [
214
- "emit trigger.navigateTo"
213
+ "emit navigateTo"
215
214
  ]
216
215
  }
217
216
  }
@@ -1,11 +1,11 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { PanelActionIcon } from '../_common.js';
3
- import { useNavigationActorRef } from '../hooks.js';
4
2
  import { useDiagramEventHandlers } from '../../context/DiagramEventHandlers.js';
3
+ import { PanelActionIcon } from '../_common.js';
4
+ import { useNavigationActor } from '../hooks.js';
5
5
  import IconMenu2 from '../../node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconMenu2.js';
6
6
 
7
7
  const BurgerButton = () => {
8
- const actor = useNavigationActorRef();
8
+ const actor = useNavigationActor();
9
9
  const { onBurgerMenuClick } = useDiagramEventHandlers();
10
10
  return /* @__PURE__ */ jsx(
11
11
  PanelActionIcon,
@@ -19,14 +19,12 @@ const BurgerButton = () => {
19
19
  },
20
20
  onClick: (e) => {
21
21
  e.stopPropagation();
22
- if (onBurgerMenuClick) {
23
- actor.send({ type: "breadcrumbs.mouseLeave.root" });
22
+ if (onBurgerMenuClick && actor.isOpened()) {
24
23
  setTimeout(() => {
25
24
  onBurgerMenuClick();
26
25
  }, 100);
27
- } else {
28
- actor.send({ type: "breadcrumbs.click.root" });
29
26
  }
27
+ actor.send({ type: "breadcrumbs.click.root" });
30
28
  },
31
29
  children: /* @__PURE__ */ jsx(IconMenu2, { style: { width: "80%", height: "80%" } })
32
30
  }
@@ -15,30 +15,43 @@ const NavigationButtons = () => {
15
15
  hasStepBack: s.navigationHistory.currentIndex > 0,
16
16
  hasStepForward: s.navigationHistory.currentIndex < s.navigationHistory.history.length - 1
17
17
  }));
18
- return /* @__PURE__ */ jsxs(m.div, { layout: "position", className: hstack({ gap: 1, mdDown: { display: "none" } }), children: [
19
- /* @__PURE__ */ jsx(
20
- PanelActionIcon,
21
- {
22
- disabled: !hasStepBack,
23
- onClick: (e) => {
24
- e.stopPropagation();
25
- diagram.navigate("back");
26
- },
27
- children: /* @__PURE__ */ jsx(IconArrowLeft, { size: 14 })
28
- }
29
- ),
30
- /* @__PURE__ */ jsx(
31
- PanelActionIcon,
32
- {
33
- disabled: !hasStepForward,
34
- onClick: (e) => {
35
- e.stopPropagation();
36
- diagram.navigate("forward");
37
- },
38
- children: /* @__PURE__ */ jsx(IconArrowRight, { size: 14 })
39
- }
40
- )
41
- ] });
18
+ return /* @__PURE__ */ jsxs(
19
+ m.div,
20
+ {
21
+ layout: "position",
22
+ className: hstack({
23
+ gap: "[1px]",
24
+ display: {
25
+ base: "none",
26
+ "@likec4-root/sm": "flex"
27
+ }
28
+ }),
29
+ children: [
30
+ /* @__PURE__ */ jsx(
31
+ PanelActionIcon,
32
+ {
33
+ disabled: !hasStepBack,
34
+ onClick: (e) => {
35
+ e.stopPropagation();
36
+ diagram.navigate("back");
37
+ },
38
+ children: /* @__PURE__ */ jsx(IconArrowLeft, { size: 14 })
39
+ }
40
+ ),
41
+ /* @__PURE__ */ jsx(
42
+ PanelActionIcon,
43
+ {
44
+ disabled: !hasStepForward,
45
+ onClick: (e) => {
46
+ e.stopPropagation();
47
+ diagram.navigate("forward");
48
+ },
49
+ children: /* @__PURE__ */ jsx(IconArrowRight, { size: 14 })
50
+ }
51
+ )
52
+ ]
53
+ }
54
+ );
42
55
  };
43
56
 
44
57
  export { NavigationButtons };
@@ -19,7 +19,7 @@ const OpenSource = () => {
19
19
  e.stopPropagation();
20
20
  onOpenSource?.({ view: viewId });
21
21
  },
22
- children: /* @__PURE__ */ jsx(IconFileSymlink, { size: 12, stroke: 1.5, style: { width: "65%" } })
22
+ children: /* @__PURE__ */ jsx(IconFileSymlink, { style: { width: "60%", height: "60%" } })
23
23
  }
24
24
  ) });
25
25
  };
@@ -21,14 +21,15 @@ function SearchControl() {
21
21
  diagram.openSearch();
22
22
  },
23
23
  whileTap: {
24
+ scale: 0.95,
24
25
  translateY: 1
25
26
  },
26
27
  className: cx(
27
28
  "group",
28
29
  hstack({
29
- gap: "2xs",
30
+ gap: "xxs",
30
31
  paddingInline: "sm",
31
- paddingBlock: "2xs",
32
+ paddingBlock: "xxs",
32
33
  rounded: "sm",
33
34
  userSelect: "none",
34
35
  cursor: "pointer",
@@ -40,8 +41,9 @@ function SearchControl() {
40
41
  base: "likec4.panel.action-icon.bg",
41
42
  _hover: "likec4.panel.action-icon.bg.hover"
42
43
  },
43
- smDown: {
44
- display: "none"
44
+ display: {
45
+ base: "none",
46
+ "@/md": "flex"
45
47
  }
46
48
  })
47
49
  ),
@@ -32,9 +32,9 @@ const ToggleReadonly = () => {
32
32
  className: cx(
33
33
  "group",
34
34
  hstack({
35
- gap: "2",
36
- paddingInline: "2xs",
37
- paddingBlock: "2xs",
35
+ gap: "0.5",
36
+ paddingInline: "xxs",
37
+ paddingBlock: "xxs",
38
38
  rounded: "sm",
39
39
  userSelect: "none",
40
40
  cursor: "pointer",
@@ -0,0 +1,2 @@
1
+ import { PopoverProps } from '@mantine/core';
2
+ export declare const ViewDetailsCard: (props: PopoverProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,232 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { cx, css } from '@likec4/styles/css';
3
+ import { HStack, Box, styled } from '@likec4/styles/jsx';
4
+ import { hstack, vstack } from '@likec4/styles/patterns';
5
+ import { Popover, UnstyledButton, Text, Badge } from '@mantine/core';
6
+ import * as m from 'motion/react-m';
7
+ import { Link } from '../../components/Link.js';
8
+ import { useDiagram } from '../../hooks/useDiagram.js';
9
+ import { useMantinePortalProps } from '../../hooks/useMantinePortalProps.js';
10
+ import { useNavigationActorSnapshot } from '../hooks.js';
11
+ import IconId from '../../node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js';
12
+ import IconLink from '../../node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js';
13
+ import { ElementTag } from '../../base/primitives/element/ElementTags.js';
14
+ import { MarkdownBlock } from '../../base/primitives/MarkdownBlock.js';
15
+
16
+ const selector = ({ context }) => {
17
+ const view = context.viewModel;
18
+ return {
19
+ id: view.id,
20
+ title: view.titleOrUntitled,
21
+ description: view.description,
22
+ tags: view.tags,
23
+ links: view.links,
24
+ relativePath: view.$view.relativePath
25
+ };
26
+ };
27
+ const ViewDetailsCard = (props) => {
28
+ const data = useNavigationActorSnapshot(selector);
29
+ const portalProps = useMantinePortalProps();
30
+ return /* @__PURE__ */ jsxs(
31
+ Popover,
32
+ {
33
+ position: "bottom-end",
34
+ shadow: "xl",
35
+ clickOutsideEvents: ["pointerdown", "mousedown", "click"],
36
+ trapFocus: true,
37
+ ...portalProps,
38
+ ...props,
39
+ children: [
40
+ /* @__PURE__ */ jsx(ViewDetailsCardTrigger, { linksCount: data.links.length }),
41
+ /* @__PURE__ */ jsx(ViewDetailsCardDropdown, { data })
42
+ ]
43
+ }
44
+ );
45
+ };
46
+ const ViewDetailsCardTrigger = ({ linksCount }) => /* @__PURE__ */ jsx(Popover.Target, { children: /* @__PURE__ */ jsxs(
47
+ UnstyledButton,
48
+ {
49
+ component: m.button,
50
+ layout: "position",
51
+ whileTap: {
52
+ scale: 0.95,
53
+ translateY: 1
54
+ },
55
+ className: cx(
56
+ "group",
57
+ hstack({
58
+ gap: "2",
59
+ paddingInline: "xxs",
60
+ paddingBlock: "xxs",
61
+ rounded: "sm",
62
+ userSelect: "none",
63
+ cursor: "pointer",
64
+ color: {
65
+ base: "likec4.panel.action-icon.text",
66
+ _hover: "likec4.panel.action-icon.text.hover"
67
+ },
68
+ backgroundColor: {
69
+ _hover: "likec4.panel.action-icon.bg.hover"
70
+ },
71
+ display: {
72
+ base: "none",
73
+ "@/xs": "flex"
74
+ }
75
+ }),
76
+ ``
77
+ ),
78
+ children: [
79
+ /* @__PURE__ */ jsx(IconId, { size: 16, stroke: 1.8 }),
80
+ linksCount > 0 && /* @__PURE__ */ jsxs(HStack, { gap: "[1px]", children: [
81
+ /* @__PURE__ */ jsx(IconLink, { size: 14, stroke: 2 }),
82
+ /* @__PURE__ */ jsx(
83
+ Box,
84
+ {
85
+ css: {
86
+ fontSize: "11px",
87
+ fontWeight: 600,
88
+ lineHeight: 1,
89
+ opacity: 0.8
90
+ },
91
+ children: linksCount
92
+ }
93
+ )
94
+ ] })
95
+ ]
96
+ }
97
+ ) });
98
+ const SectionHeader = styled("div", {
99
+ base: {
100
+ fontSize: "xs",
101
+ color: "mantine.colors.dimmed",
102
+ fontWeight: 500,
103
+ userSelect: "none",
104
+ mb: "xxs"
105
+ }
106
+ });
107
+ const ViewDetailsCardDropdown = ({
108
+ data: {
109
+ id,
110
+ title,
111
+ description,
112
+ tags,
113
+ links,
114
+ relativePath
115
+ }
116
+ }) => {
117
+ const diagram = useDiagram();
118
+ return /* @__PURE__ */ jsxs(
119
+ Popover.Dropdown,
120
+ {
121
+ className: cx(
122
+ "nowheel nopan nodrag",
123
+ vstack({
124
+ margin: "xs",
125
+ layerStyle: "likec4.dropdown",
126
+ gap: "md",
127
+ padding: "md",
128
+ pointerEvents: "all",
129
+ maxWidth: "calc(100cqw - 32px)",
130
+ minWidth: "calc(100cqw - 50px)",
131
+ maxHeight: "calc(100cqh - 100px)",
132
+ width: "max-content",
133
+ cursor: "default",
134
+ "@/sm": {
135
+ minWidth: 400,
136
+ maxWidth: 550
137
+ },
138
+ "@/lg": {
139
+ maxWidth: 700
140
+ }
141
+ })
142
+ ),
143
+ children: [
144
+ /* @__PURE__ */ jsxs("section", { children: [
145
+ /* @__PURE__ */ jsx(Text, { component: "div", fw: 500, size: "xl", children: title }),
146
+ /* @__PURE__ */ jsxs(HStack, { alignItems: "flex-start", mt: "1", children: [
147
+ /* @__PURE__ */ jsx(ViewBadge, { label: "id", value: id }),
148
+ /* @__PURE__ */ jsx(HStack, { gap: "xs", flexWrap: "wrap", children: tags.map((tag, i) => /* @__PURE__ */ jsx(
149
+ ElementTag,
150
+ {
151
+ tag,
152
+ cursor: "pointer",
153
+ onClick: (e) => {
154
+ e.stopPropagation();
155
+ diagram.openSearch(`#${tag}`);
156
+ }
157
+ },
158
+ tag
159
+ )) })
160
+ ] })
161
+ ] }),
162
+ links.length > 0 && /* @__PURE__ */ jsxs("section", { className: hstack({ alignItems: "baseline" }), children: [
163
+ /* @__PURE__ */ jsx(SectionHeader, { children: "Links" }),
164
+ /* @__PURE__ */ jsx(HStack, { gap: "xs", flexWrap: "wrap", children: links.map((link, i) => /* @__PURE__ */ jsx(Link, { value: link }, `${i}-${link.url}`)) })
165
+ ] }),
166
+ description.isEmpty && /* @__PURE__ */ jsx(Text, { component: "div", fw: 500, size: "xs", c: "dimmed", my: "md", style: { userSelect: "none" }, children: "No description" }),
167
+ description.nonEmpty && /* @__PURE__ */ jsxs("section", { children: [
168
+ /* @__PURE__ */ jsx(SectionHeader, { children: "Description" }),
169
+ /* @__PURE__ */ jsx(
170
+ MarkdownBlock,
171
+ {
172
+ value: description,
173
+ fontSize: "sm",
174
+ emptyText: "No description",
175
+ className: css({
176
+ userSelect: "all"
177
+ })
178
+ }
179
+ )
180
+ ] })
181
+ ]
182
+ }
183
+ );
184
+ };
185
+ const ViewBadge = ({
186
+ label,
187
+ value
188
+ }) => {
189
+ return /* @__PURE__ */ jsxs(HStack, { gap: "0.5", children: [
190
+ /* @__PURE__ */ jsx(ViewBadgeLabel, { children: label }),
191
+ /* @__PURE__ */ jsx(
192
+ Badge,
193
+ {
194
+ size: "sm",
195
+ radius: "sm",
196
+ variant: "light",
197
+ color: "gray",
198
+ tt: "none",
199
+ fw: 500,
200
+ classNames: {
201
+ root: css({
202
+ width: "max-content",
203
+ overflow: "visible",
204
+ px: "1",
205
+ color: {
206
+ _light: "mantine.colors.gray[8]"
207
+ }
208
+ }),
209
+ label: css({
210
+ overflow: "visible"
211
+ }),
212
+ section: css({
213
+ opacity: 0.5,
214
+ userSelect: "none",
215
+ marginInlineEnd: "0.5"
216
+ })
217
+ },
218
+ children: value
219
+ }
220
+ )
221
+ ] });
222
+ };
223
+ const ViewBadgeLabel = styled("div", {
224
+ base: {
225
+ color: "mantine.colors.dimmed",
226
+ fontWeight: 500,
227
+ fontSize: "xxs",
228
+ userSelect: "none"
229
+ }
230
+ });
231
+
232
+ export { ViewDetailsCard };
@@ -3,3 +3,4 @@ export { NavigationButtons } from './NavigationButtons';
3
3
  export { OpenSource } from './OpenSource';
4
4
  export { SearchControl } from './SearchControl';
5
5
  export { ToggleReadonly } from './ToggleReadonly';
6
+ export { ViewDetailsCard } from './ViewDetailsCard';
@@ -0,0 +1,2 @@
1
+ import { ButtonProps } from '@mantine/core';
2
+ export declare function ProjectsMenu(props: ButtonProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,75 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { css } from '@likec4/styles/css';
3
+ import { HStack, Box } from '@likec4/styles/jsx';
4
+ import { Menu, MenuTarget, Button, MenuDropdown, MenuItem } from '@mantine/core';
5
+ import { useLikeC4ProjectsContext, useLikeC4ProjectId } from '../../likec4model/useLikeC4Project.js';
6
+ import IconChevronDown from '../../node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js';
7
+
8
+ function ProjectsMenu(props) {
9
+ const { projects, onProjectChange } = useLikeC4ProjectsContext();
10
+ const projectId = useLikeC4ProjectId();
11
+ if (projects.length <= 1) {
12
+ return null;
13
+ }
14
+ return /* @__PURE__ */ jsxs(HStack, { gap: "0.5", alignItems: "baseline", children: [
15
+ /* @__PURE__ */ jsx(
16
+ Box,
17
+ {
18
+ css: {
19
+ fontWeight: "400",
20
+ fontSize: "xxs",
21
+ color: "mantine.colors.dimmed",
22
+ userSelect: "none"
23
+ },
24
+ children: "Project"
25
+ }
26
+ ),
27
+ /* @__PURE__ */ jsxs(Menu, { shadow: "md", position: "bottom-start", offset: { mainAxis: 2 }, closeOnItemClick: true, children: [
28
+ /* @__PURE__ */ jsx(MenuTarget, { children: /* @__PURE__ */ jsx(
29
+ Button,
30
+ {
31
+ tabIndex: -1,
32
+ autoFocus: false,
33
+ variant: "subtle",
34
+ size: "compact-xs",
35
+ color: "gray",
36
+ classNames: {
37
+ root: css({
38
+ fontWeight: "400",
39
+ fontSize: "xxs",
40
+ height: "auto",
41
+ lineHeight: 1.1,
42
+ color: {
43
+ _light: "mantine.colors.gray[9]"
44
+ }
45
+ }),
46
+ section: css({
47
+ '&:is([data-position="right"])': {
48
+ marginInlineStart: "1"
49
+ }
50
+ })
51
+ },
52
+ rightSection: /* @__PURE__ */ jsx(IconChevronDown, { opacity: 0.5, size: 12, stroke: 1.5 }),
53
+ ...props,
54
+ children: projectId
55
+ }
56
+ ) }),
57
+ /* @__PURE__ */ jsx(MenuDropdown, { children: projects.map(({ id, title }) => /* @__PURE__ */ jsx(
58
+ MenuItem,
59
+ {
60
+ onClick: (e) => {
61
+ if (projectId === id) {
62
+ e.stopPropagation();
63
+ return;
64
+ }
65
+ onProjectChange(id);
66
+ },
67
+ children: title ?? id
68
+ },
69
+ id
70
+ )) })
71
+ ] })
72
+ ] });
73
+ }
74
+
75
+ export { ProjectsMenu };
@@ -16,11 +16,11 @@ function EditorPanel() {
16
16
  {
17
17
  layout: "position",
18
18
  className: vstack({
19
- gap: "sm",
19
+ gap: "xs",
20
20
  layerStyle: "likec4.panel",
21
21
  position: "relative",
22
22
  cursor: "pointer",
23
- padding: "4",
23
+ padding: "xxs",
24
24
  pointerEvents: "all"
25
25
  }),
26
26
  initial: {
@@ -35,7 +35,7 @@ function EditorPanel() {
35
35
  opacity: 0,
36
36
  translateX: -20
37
37
  },
38
- children: /* @__PURE__ */ jsxs(TooltipGroup, { children: [
38
+ children: /* @__PURE__ */ jsxs(TooltipGroup, { openDelay: 600, closeDelay: 120, children: [
39
39
  /* @__PURE__ */ jsx(ChangeAutoLayoutButton, {}),
40
40
  /* @__PURE__ */ jsx(ManualLayoutToolsButton, {}),
41
41
  /* @__PURE__ */ jsx(LayoutDriftNotification, {}),