@likec4/diagram 1.59.3 → 1.59.4

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 (202) hide show
  1. package/dist/LikeC4Diagram.d.ts +1 -1
  2. package/dist/LikeC4Diagram.js +36 -21
  3. package/dist/LikeC4Diagram.props.d.ts +23 -0
  4. package/dist/LikeC4MantineProvider.d.ts +24 -0
  5. package/dist/LikeC4MantineProvider.js +156 -0
  6. package/dist/LikeC4ProjectsOverview.js +1 -1
  7. package/dist/LikeC4ProjectsProvider.d.ts +17 -2
  8. package/dist/LikeC4Styles.d.ts +13 -3
  9. package/dist/LikeC4Styles.js +8 -5
  10. package/dist/LikeC4View.js +2 -2
  11. package/dist/StaticLikeC4Diagram.d.ts +1 -1
  12. package/dist/base/BaseXYFlow.d.ts +1 -1
  13. package/dist/base/BaseXYFlow.js +11 -8
  14. package/dist/base/const.d.ts +1 -0
  15. package/dist/base/const.js +3 -1
  16. package/dist/base-primitives/Markdown.d.ts +3 -3
  17. package/dist/base-primitives/compound/actionbtns.css.d.ts +3 -3
  18. package/dist/base-primitives/compound/actionbtns.css.js +3 -3
  19. package/dist/base-primitives/element/ElementTags.d.ts +2 -2
  20. package/dist/base-primitives/element/ElementTags.js +5 -5
  21. package/dist/components/EmptyBox.d.ts +3 -0
  22. package/dist/components/EmptyBox.js +9 -0
  23. package/dist/components/ErrorFallback.js +7 -6
  24. package/dist/components/FloatingWindow.d.ts +18 -0
  25. package/dist/components/FloatingWindow.js +89 -0
  26. package/dist/components/Link.js +7 -7
  27. package/dist/components/NavigationPanel.d.ts +2 -2
  28. package/dist/components/NavigationPanel.js +5 -6
  29. package/dist/components/SearchControl.css.js +10 -12
  30. package/dist/components/ViewIcon.d.ts +11 -0
  31. package/dist/components/ViewIcon.js +71 -0
  32. package/dist/context/DiagramEventHandlers.js +2 -1
  33. package/dist/context/EnsureMantine.js +3 -3
  34. package/dist/context/IconRenderer.d.ts +2 -1
  35. package/dist/context/IconRenderer.js +38 -2
  36. package/dist/context/LikeC4ProjectsContext.d.ts +3 -2
  37. package/dist/context/TagStylesContext.d.ts +9 -3
  38. package/dist/context/TagStylesContext.js +19 -19
  39. package/dist/custom/index.d.ts +3 -0
  40. package/dist/custom/index.js +6 -3
  41. package/dist/editor/applyChangesToManualLayout.js +4 -1
  42. package/dist/hooks/safeContext.d.ts +12 -4
  43. package/dist/hooks/safeContext.js +2 -2
  44. package/dist/hooks/useCurrentView.js +5 -5
  45. package/dist/hooks/useDiagram.js +1 -23
  46. package/dist/hooks/useDiagramCompareLayout.d.ts +4 -4
  47. package/dist/hooks/useDiagramCompareLayout.js +14 -16
  48. package/dist/hooks/useEditorActor.js +3 -5
  49. package/dist/hooks/useLikeC4Model.js +8 -3
  50. package/dist/hooks/useLikeC4Project.d.ts +4 -3
  51. package/dist/hooks/useOverlaysActor.d.ts +1 -1
  52. package/dist/index.d.ts +4 -3
  53. package/dist/index.js +6 -5
  54. package/dist/likec4diagram/DiagramXYFlow.d.ts +5 -0
  55. package/dist/likec4diagram/DiagramXYFlow.js +20 -13
  56. package/dist/likec4diagram/custom/edges/EdgeDrifts.js +4 -4
  57. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +1 -1
  58. package/dist/likec4diagram/custom/edges/edges.css.js +13 -13
  59. package/dist/likec4diagram/custom/nodes/NodeDrifts.js +2 -2
  60. package/dist/likec4diagram/custom/nodes/NodeNotes.js +4 -4
  61. package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +2 -2
  62. package/dist/likec4diagram/custom/nodes/SequenceSubFlow.js +8 -5
  63. package/dist/likec4diagram/custom/nodes/nodes.js +2 -2
  64. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +2 -2
  65. package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +5 -5
  66. package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +1 -1
  67. package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +2 -0
  68. package/dist/likec4diagram/relationship-popover/components.d.ts +1 -1
  69. package/dist/likec4diagram/relationship-popover/components.js +6 -2
  70. package/dist/likec4diagram/state/DiagramActorProvider.d.ts +7 -2
  71. package/dist/likec4diagram/state/DiagramActorProvider.js +20 -4
  72. package/dist/likec4diagram/state/diagram-api.d.ts +2 -2
  73. package/dist/likec4diagram/state/diagram-api.js +3 -2
  74. package/dist/likec4diagram/state/machine.actions.js +9 -6
  75. package/dist/likec4diagram/state/machine.actions.layout.d.ts +1 -0
  76. package/dist/likec4diagram/state/machine.actions.layout.js +7 -5
  77. package/dist/likec4diagram/state/machine.setup.d.ts +10 -1
  78. package/dist/likec4diagram/state/machine.setup.js +6 -1
  79. package/dist/likec4diagram/state/machine.state.initializing.d.ts +2 -26
  80. package/dist/likec4diagram/state/machine.state.initializing.js +9 -6
  81. package/dist/likec4diagram/state/machine.state.navigating.js +1 -1
  82. package/dist/likec4diagram/state/machine.state.ready.d.ts +134 -3
  83. package/dist/likec4diagram/state/machine.state.ready.js +2 -1
  84. package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +106 -1
  85. package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +39 -6
  86. package/dist/likec4diagram/state/utils.d.ts +1 -1
  87. package/dist/likec4diagram/state/utils.js +1 -2
  88. package/dist/likec4diagram/ui/LayoutDriftFrame.js +16 -10
  89. package/dist/likec4diagram/ui/index.d.ts +1 -1
  90. package/dist/likec4diagram/ui/notation/NotationPanel.css.js +13 -15
  91. package/dist/likec4diagram/ui/notation/NotationPanel.js +9 -9
  92. package/dist/likec4diagram/ui/sequence-outline/ActiveTrail.d.ts +9 -0
  93. package/dist/likec4diagram/ui/sequence-outline/ActiveTrail.js +81 -0
  94. package/dist/likec4diagram/ui/sequence-outline/FlowRow.d.ts +11 -0
  95. package/dist/likec4diagram/ui/sequence-outline/FlowRow.js +70 -0
  96. package/dist/likec4diagram/ui/sequence-outline/OutlineBody.d.ts +2 -0
  97. package/dist/likec4diagram/ui/sequence-outline/OutlineBody.js +106 -0
  98. package/dist/likec4diagram/ui/sequence-outline/OutlineHeader.d.ts +2 -0
  99. package/dist/likec4diagram/ui/sequence-outline/OutlineHeader.js +140 -0
  100. package/dist/likec4diagram/ui/sequence-outline/OutlineNodes.d.ts +17 -0
  101. package/dist/likec4diagram/ui/sequence-outline/OutlineNodes.js +83 -0
  102. package/dist/likec4diagram/ui/sequence-outline/SequenceOutlinePanel.d.ts +4 -0
  103. package/dist/likec4diagram/ui/sequence-outline/SequenceOutlinePanel.js +49 -527
  104. package/dist/likec4diagram/ui/sequence-outline/StepBadge.d.ts +8 -0
  105. package/dist/likec4diagram/ui/sequence-outline/StepBadge.js +52 -0
  106. package/dist/likec4diagram/ui/sequence-outline/StepRow.d.ts +7 -0
  107. package/dist/likec4diagram/ui/sequence-outline/StepRow.js +190 -0
  108. package/dist/likec4diagram/ui/sequence-outline/StoreProvider.d.ts +238 -0
  109. package/dist/likec4diagram/ui/sequence-outline/StoreProvider.js +94 -0
  110. package/dist/likec4diagram/ui/sequence-outline/depth-of-field.d.ts +21 -0
  111. package/dist/likec4diagram/ui/sequence-outline/depth-of-field.js +71 -0
  112. package/dist/likec4diagram/ui/sequence-outline/index.d.ts +2 -0
  113. package/dist/likec4diagram/ui/sequence-outline/motion.d.ts +13 -0
  114. package/dist/likec4diagram/ui/sequence-outline/motion.js +21 -0
  115. package/dist/likec4diagram/ui/sequence-outline/presentation.d.ts +10 -0
  116. package/dist/likec4diagram/ui/sequence-outline/presentation.js +80 -0
  117. package/dist/likec4diagram/ui/sequence-outline/tree.d.ts +9 -0
  118. package/dist/likec4diagram/ui/sequence-outline/tree.js +67 -0
  119. package/dist/likec4diagram/ui/sequence-outline/{state.d.ts → types.d.ts} +4 -2
  120. package/dist/likec4diagram/ui/sequence-outline/types.js +12 -0
  121. package/dist/likec4diagram/useLayoutConstraints.js +9 -12
  122. package/dist/likec4diagram/xyflow-sequence/sequence-view-to-xy.js +1 -0
  123. package/dist/likec4diagram/xyflow-sequence/utils.js +0 -1
  124. package/dist/navigationpanel/NavigationPanel.js +45 -41
  125. package/dist/navigationpanel/NavigationPanelControls.js +102 -63
  126. package/dist/navigationpanel/NavigationPanelDropdown.js +51 -77
  127. package/dist/navigationpanel/_common.d.ts +6 -6
  128. package/dist/navigationpanel/_common.js +31 -42
  129. package/dist/navigationpanel/actor.actions.js +6 -5
  130. package/dist/navigationpanel/actor.js +2 -2
  131. package/dist/navigationpanel/actor.setup.d.ts +6 -6
  132. package/dist/navigationpanel/actor.setup.js +2 -1
  133. package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +2 -4
  134. package/dist/navigationpanel/comparepanel/ComparePanel.js +8 -10
  135. package/dist/navigationpanel/comparepanel/DriftsSummary.d.ts +1 -1
  136. package/dist/navigationpanel/comparepanel/DriftsSummary.js +11 -9
  137. package/dist/navigationpanel/controls/LayoutWarning.js +69 -72
  138. package/dist/navigationpanel/controls/NavigationButtons.d.ts +1 -1
  139. package/dist/navigationpanel/controls/NavigationButtons.js +8 -8
  140. package/dist/navigationpanel/controls/OpenSource.d.ts +1 -1
  141. package/dist/navigationpanel/controls/OpenSource.js +5 -8
  142. package/dist/navigationpanel/controls/SearchControl.js +24 -9
  143. package/dist/navigationpanel/controls/ToggleReadonly.d.ts +4 -1
  144. package/dist/navigationpanel/controls/ToggleReadonly.js +56 -76
  145. package/dist/navigationpanel/controls/ViewDetailsButton.d.ts +5 -0
  146. package/dist/navigationpanel/controls/ViewDetailsButton.js +121 -0
  147. package/dist/navigationpanel/controls/index.d.ts +1 -1
  148. package/dist/navigationpanel/dropdown/ProjectsMenu.js +27 -16
  149. package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +10 -9
  150. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +9 -8
  151. package/dist/navigationpanel/editorpanel/styles.js +8 -15
  152. package/dist/navigationpanel/hooks.d.ts +6 -2
  153. package/dist/navigationpanel/styles.css.d.ts +2 -2
  154. package/dist/navigationpanel/styles.css.js +0 -1
  155. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +3 -2
  156. package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +5 -4
  157. package/dist/navigationpanel/walkthrough/DynamicViewControls.js +9 -36
  158. package/dist/navigationpanel/walkthrough/DynamicViewModeSwitcher.d.ts +1 -0
  159. package/dist/navigationpanel/walkthrough/DynamicViewModeSwitcher.js +49 -0
  160. package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +8 -8
  161. package/dist/navigationpanel/windows/ViewDetailsWindow.d.ts +1 -0
  162. package/dist/navigationpanel/windows/ViewDetailsWindow.js +379 -0
  163. package/dist/overlays/Overlays.js +29 -17
  164. package/dist/overlays/element-details/ElementDetailsCard.css.js +28 -36
  165. package/dist/overlays/element-details/ElementDetailsCard.js +1 -1
  166. package/dist/overlays/element-details/MetadataValue.js +18 -16
  167. package/dist/overlays/element-details/TabPanelDeployments.css.js +6 -14
  168. package/dist/overlays/element-details/TabPanelRelationships.css.js +8 -12
  169. package/dist/overlays/element-details/TabPanelStructure.css.js +4 -8
  170. package/dist/overlays/hooks.d.ts +3 -1
  171. package/dist/overlays/overlay/Overlay.js +8 -7
  172. package/dist/overlays/overlaysActor.js +4 -0
  173. package/dist/overlays/relationship-details/SelectEdge.css.js +14 -9
  174. package/dist/overlays/relationship-details/actor.js +1 -1
  175. package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +6 -0
  176. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +11 -6
  177. package/dist/overlays/relationships-browser/SelectElement.css.js +2 -8
  178. package/dist/overlays/relationships-browser/SelectElement.js +5 -1
  179. package/dist/overlays/relationships-browser/actor.js +1 -1
  180. package/dist/overlays/relationships-browser/custom/EmptyNode.js +7 -9
  181. package/dist/projects-overview/actor.js +1 -1
  182. package/dist/search/Search.js +9 -7
  183. package/dist/search/components/ElementsColumn.css.js +6 -5
  184. package/dist/search/components/ElementsColumn.js +4 -3
  185. package/dist/search/components/SearchByTags.js +3 -3
  186. package/dist/search/components/ViewsColum.js +36 -35
  187. package/dist/search/components/ViewsColumn.css.js +4 -4
  188. package/dist/search/components/_shared.css.d.ts +2 -2
  189. package/dist/search/components/_shared.css.js +31 -46
  190. package/dist/search/components/styles.css.js +4 -4
  191. package/dist/shadowroot/ShadowRoot.js +2 -3
  192. package/dist/styles2.js +1 -1
  193. package/dist/utils/index.js +1 -1
  194. package/package.json +10 -10
  195. package/panda.buildinfo.json +340 -298
  196. package/styles-min.css +1 -1
  197. package/styles.css +1 -1
  198. package/dist/context/DefaultMantineProvider.d.ts +0 -2
  199. package/dist/context/DefaultMantineProvider.js +0 -48
  200. package/dist/likec4diagram/ui/sequence-outline/state.js +0 -55
  201. package/dist/navigationpanel/controls/DetailsControls.d.ts +0 -2
  202. package/dist/navigationpanel/controls/DetailsControls.js +0 -224
@@ -4,7 +4,7 @@ import { useDiagramCompareLayout } from "../../hooks/useDiagramCompareLayout.js"
4
4
  import { cx } from "@likec4/styles/css";
5
5
  import { IconAlertTriangle } from "@tabler/icons-react";
6
6
  import { Fragment, memo } from "react";
7
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { Button, HoverCard, HoverCardDropdown, HoverCardTarget, Notification, Text, UnstyledButton } from "@mantine/core";
9
9
  import { AnimatePresence } from "motion/react";
10
10
  import { hstack } from "@likec4/styles/patterns";
@@ -14,78 +14,75 @@ import { navigationPanelActionIcon } from "@likec4/styles/recipes";
14
14
  var LayoutWarning = memo(() => {
15
15
  const [ctx, { toggleCompare }] = useDiagramCompareLayout();
16
16
  const portalProps = useMantinePortalProps();
17
- const { drifts, isActive, isEnabled } = ctx;
18
- return /* @__PURE__ */ jsx(AnimatePresence, {
19
- propagate: true,
20
- children: isEnabled && !isActive && /* @__PURE__ */ jsxs(HoverCard, {
21
- position: "bottom-start",
22
- openDelay: 600,
23
- closeDelay: 200,
24
- floatingStrategy: "absolute",
25
- offset: {
26
- mainAxis: 4,
27
- crossAxis: -22
17
+ const { drifts, state, isEnabled } = ctx;
18
+ return /* @__PURE__ */ jsx(AnimatePresence, { children: isEnabled && state !== "comparing" && /* @__PURE__ */ jsxs(HoverCard, {
19
+ position: "bottom-start",
20
+ openDelay: 600,
21
+ closeDelay: 200,
22
+ floatingStrategy: "absolute",
23
+ offset: {
24
+ mainAxis: 4,
25
+ crossAxis: -22
26
+ },
27
+ ...portalProps,
28
+ children: [/* @__PURE__ */ jsx(HoverCardTarget, { children: /* @__PURE__ */ jsx(UnstyledButton, {
29
+ component: m$1.button,
30
+ layout: "position",
31
+ onClick: (e) => {
32
+ e.stopPropagation();
33
+ toggleCompare();
28
34
  },
29
- ...portalProps,
30
- children: [/* @__PURE__ */ jsx(HoverCardTarget, { children: /* @__PURE__ */ jsx(UnstyledButton, {
31
- component: m$1.button,
32
- layout: "position",
33
- onClick: (e) => {
34
- e.stopPropagation();
35
- toggleCompare();
36
- },
37
- whileTap: {
38
- scale: .95,
39
- translateY: 1
40
- },
41
- className: cx("group", navigationPanelActionIcon({
42
- variant: "filled",
43
- type: "warning"
44
- }), hstack({
45
- gap: "xxs",
46
- padding: "1.5",
47
- rounded: "sm",
48
- userSelect: "none",
49
- cursor: "pointer",
50
- fontSize: "xs",
51
- fontWeight: "bold"
52
- })),
53
- children: isActive ? /* @__PURE__ */ jsx(Fragment$1, { children: "Stop Compare" }) : /* @__PURE__ */ jsx(IconAlertTriangle, { size: 18 })
54
- }) }), /* @__PURE__ */ jsx(HoverCardDropdown, {
55
- p: "0",
56
- children: /* @__PURE__ */ jsxs(Notification, {
57
- color: "orange",
58
- withBorder: false,
59
- withCloseButton: false,
60
- title: "View is out of sync",
61
- children: [
62
- /* @__PURE__ */ jsx(Text, {
63
- mt: 2,
64
- size: "sm",
65
- lh: "xs",
66
- children: "Model has changed since this view was last updated."
67
- }),
68
- /* @__PURE__ */ jsxs(Text, {
69
- mt: 4,
70
- size: "sm",
71
- lh: "xs",
72
- children: ["Detected changes:", drifts.map((drift) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("br", {}), /* @__PURE__ */ jsxs("span", { children: ["- ", drift] })] }, drift))]
73
- }),
74
- /* @__PURE__ */ jsx(Button, {
75
- mt: "xs",
76
- size: "compact-sm",
77
- variant: "default",
78
- onClick: (e) => {
79
- e.stopPropagation();
80
- toggleCompare();
81
- },
82
- children: "Compare with current state"
83
- })
84
- ]
85
- })
86
- })]
87
- })
88
- });
35
+ whileTap: {
36
+ scale: .95,
37
+ translateY: 1
38
+ },
39
+ className: cx("group", navigationPanelActionIcon({
40
+ variant: "filled",
41
+ type: "warning"
42
+ }), hstack({
43
+ gap: "xxs",
44
+ padding: "1.5",
45
+ rounded: "sm",
46
+ userSelect: "none",
47
+ cursor: "pointer",
48
+ fontSize: "xs",
49
+ fontWeight: "bold"
50
+ })),
51
+ children: /* @__PURE__ */ jsx(IconAlertTriangle, { size: 18 })
52
+ }) }), /* @__PURE__ */ jsx(HoverCardDropdown, {
53
+ p: "0",
54
+ children: /* @__PURE__ */ jsxs(Notification, {
55
+ color: "orange",
56
+ withBorder: false,
57
+ withCloseButton: false,
58
+ title: "View is out of sync",
59
+ children: [
60
+ /* @__PURE__ */ jsx(Text, {
61
+ mt: 2,
62
+ size: "sm",
63
+ lh: "xs",
64
+ children: "Model has changed since this view was last updated."
65
+ }),
66
+ /* @__PURE__ */ jsxs(Text, {
67
+ mt: 4,
68
+ size: "sm",
69
+ lh: "xs",
70
+ children: ["Detected drifts:", drifts.map((drift) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("br", {}), /* @__PURE__ */ jsxs("span", { children: ["- ", drift] })] }, drift))]
71
+ }),
72
+ /* @__PURE__ */ jsx(Button, {
73
+ mt: "xs",
74
+ size: "compact-sm",
75
+ variant: "default",
76
+ onClick: (e) => {
77
+ e.stopPropagation();
78
+ toggleCompare();
79
+ },
80
+ children: "Compare with current state"
81
+ })
82
+ ]
83
+ })
84
+ })]
85
+ }) });
89
86
  });
90
87
  LayoutWarning.displayName = "ManualLayoutWarning";
91
88
  //#endregion
@@ -1 +1 @@
1
- export declare const NavigationButtons: () => import("react").JSX.Element;
1
+ export declare function NavigationButtons(): import("react").JSX.Element;
@@ -1,18 +1,18 @@
1
1
  import "../../_virtual/_rolldown/runtime.js";
2
- import { useDiagram } from "../../hooks/safeContext.js";
3
- import { useDiagramContext } from "../../hooks/useDiagram.js";
2
+ import { selectDiagramContext, useDiagram, useDiagramSelector } from "../../hooks/safeContext.js";
4
3
  import { PanelActionIcon } from "../_common.js";
5
4
  import { IconArrowLeft, IconArrowRight } from "@tabler/icons-react";
6
5
  import { jsx, jsxs } from "react/jsx-runtime";
7
6
  import { hstack } from "@likec4/styles/patterns";
8
7
  import * as m from "motion/react-m";
9
8
  //#region src/navigationpanel/controls/NavigationButtons.tsx
10
- var NavigationButtons = () => {
9
+ var selectNavigationState = selectDiagramContext((s) => ({
10
+ hasStepBack: s.navigationHistory.currentIndex > 0,
11
+ hasStepForward: s.navigationHistory.currentIndex < s.navigationHistory.history.length - 1
12
+ }));
13
+ function NavigationButtons() {
11
14
  const diagram = useDiagram();
12
- const { hasStepBack, hasStepForward } = useDiagramContext((s) => ({
13
- hasStepBack: s.navigationHistory.currentIndex > 0,
14
- hasStepForward: s.navigationHistory.currentIndex < s.navigationHistory.history.length - 1
15
- }));
15
+ const { hasStepBack, hasStepForward } = useDiagramSelector(selectNavigationState);
16
16
  return /* @__PURE__ */ jsxs(m.div, {
17
17
  layout: "position",
18
18
  className: hstack({ gap: "0.5" }),
@@ -32,6 +32,6 @@ var NavigationButtons = () => {
32
32
  children: /* @__PURE__ */ jsx(IconArrowRight, { size: 14 })
33
33
  })]
34
34
  });
35
- };
35
+ }
36
36
  //#endregion
37
37
  export { NavigationButtons };
@@ -1 +1 @@
1
- export declare const OpenSource: () => import("react").JSX.Element | null;
1
+ export declare const OpenSource: () => import("react").JSX.Element;
@@ -1,22 +1,19 @@
1
1
  import "../../_virtual/_rolldown/runtime.js";
2
- import { useDiagramEventHandlers } from "../../context/DiagramEventHandlers.js";
3
- import { useEnabledFeatures } from "../../context/DiagramFeatures.js";
4
- import { useCurrentViewId } from "../../hooks/useCurrentView.js";
2
+ import { useDiagram } from "../../hooks/safeContext.js";
5
3
  import { PanelActionIcon, Tooltip } from "../_common.js";
6
4
  import { IconFileSymlink } from "@tabler/icons-react";
7
5
  import { jsx } from "react/jsx-runtime";
8
6
  //#region src/navigationpanel/controls/OpenSource.tsx
9
7
  var OpenSource = () => {
10
- const viewId = useCurrentViewId();
11
- const { enableVscode } = useEnabledFeatures();
12
- const { onOpenSource } = useDiagramEventHandlers();
13
- if (!enableVscode) return null;
8
+ const diagram = useDiagram();
14
9
  return /* @__PURE__ */ jsx(Tooltip, {
15
10
  label: "Open View Source",
16
11
  children: /* @__PURE__ */ jsx(PanelActionIcon, {
12
+ layout: "position",
17
13
  onClick: (e) => {
18
14
  e.stopPropagation();
19
- onOpenSource?.({ view: viewId });
15
+ const viewId = diagram.currentView.id;
16
+ diagram.openSource({ view: viewId });
20
17
  },
21
18
  children: /* @__PURE__ */ jsx(IconFileSymlink, { style: {
22
19
  width: "60%",
@@ -2,16 +2,35 @@ import "../../_virtual/_rolldown/runtime.js";
2
2
  import { useDiagram } from "../../hooks/safeContext.js";
3
3
  import { cx } from "@likec4/styles/css";
4
4
  import { IconSearch } from "@tabler/icons-react";
5
+ import { useRef } from "react";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
6
7
  import { UnstyledButton } from "@mantine/core";
7
8
  import { isMacOs } from "@xyflow/system";
9
+ import { m } from "motion/react";
8
10
  import { Box as Box$1 } from "@likec4/styles/jsx";
9
11
  import { hstack } from "@likec4/styles/patterns";
10
- import * as m from "motion/react-m";
11
12
  //#region src/navigationpanel/controls/SearchControl.tsx
12
13
  function SearchControl() {
13
14
  const diagram = useDiagram();
14
15
  const isMac = isMacOs();
16
+ const searchControlAnimation = useRef({
17
+ initial: {
18
+ opacity: 0,
19
+ translateX: -10
20
+ },
21
+ animate: {
22
+ opacity: 1,
23
+ translateX: 0
24
+ },
25
+ exit: {
26
+ opacity: 0,
27
+ translateX: -20
28
+ },
29
+ whileTap: {
30
+ scale: .95,
31
+ translateY: 1
32
+ }
33
+ });
15
34
  return /* @__PURE__ */ jsxs(UnstyledButton, {
16
35
  component: m.button,
17
36
  layout: "position",
@@ -19,14 +38,10 @@ function SearchControl() {
19
38
  e.stopPropagation();
20
39
  diagram.openSearch();
21
40
  },
22
- whileTap: {
23
- scale: .95,
24
- translateY: 1
25
- },
41
+ ...searchControlAnimation.current,
26
42
  className: cx("group", hstack({
27
43
  gap: "xxs",
28
44
  paddingInline: "sm",
29
- paddingBlock: "xxs",
30
45
  userSelect: "none",
31
46
  layerStyle: "likec4.panel.action.filled",
32
47
  display: {
@@ -39,10 +54,10 @@ function SearchControl() {
39
54
  stroke: 2.5
40
55
  }), /* @__PURE__ */ jsx(Box$1, {
41
56
  css: {
42
- fontSize: "11px",
57
+ fontSize: "xs",
43
58
  fontWeight: "bold",
44
- lineHeight: 1,
45
- opacity: .8,
59
+ lineHeight: "1",
60
+ opacity: "0.7",
46
61
  whiteSpace: "nowrap"
47
62
  },
48
63
  children: isMac ? "⌘ + K" : "Ctrl + K"
@@ -1 +1,4 @@
1
- export declare const ToggleReadonly: () => import("react").JSX.Element;
1
+ export declare function ToggleReadonly({ disabled, isReadOnly }: {
2
+ disabled: boolean;
3
+ isReadOnly: boolean;
4
+ }): import("react").JSX.Element;
@@ -1,89 +1,69 @@
1
1
  import "../../_virtual/_rolldown/runtime.js";
2
2
  import { useDiagram } from "../../hooks/safeContext.js";
3
- import { useDiagramContext } from "../../hooks/useDiagram.js";
4
- import { deriveToggledFeatures } from "../../likec4diagram/state/machine.setup.js";
5
3
  import { css, cx } from "@likec4/styles/css";
6
4
  import { IconLock, IconLockOpen2 } from "@tabler/icons-react";
7
5
  import { jsx, jsxs } from "react/jsx-runtime";
8
- import { isTruthy } from "remeda";
9
6
  import { UnstyledButton } from "@mantine/core";
10
- import { AnimatePresence } from "motion/react";
7
+ import { m } from "motion/react";
11
8
  import { hstack } from "@likec4/styles/patterns";
12
- import * as m$1 from "motion/react-m";
13
9
  //#region src/navigationpanel/controls/ToggleReadonly.tsx
14
- var selector = (ctx) => {
15
- const comparingLatest = deriveToggledFeatures(ctx).enableCompareWithLatest && !!ctx.view.drifts && ctx.view._layout === "auto";
16
- const noActiveWalkthrough = !isTruthy(ctx.activeWalkthrough);
17
- const hasEditor = ctx.features.enableEditor;
18
- const isReadOnly = ctx.toggledFeatures.enableReadOnly ?? false;
19
- return {
20
- visible: hasEditor && noActiveWalkthrough,
21
- disabled: comparingLatest,
22
- isReadOnly
23
- };
24
- };
25
- var ToggleReadonly = () => {
26
- const { visible, disabled, isReadOnly } = useDiagramContext(selector);
10
+ function ToggleReadonly({ disabled, isReadOnly }) {
27
11
  const diagram = useDiagram();
28
- return /* @__PURE__ */ jsx(AnimatePresence, {
29
- mode: "popLayout",
30
- children: visible && /* @__PURE__ */ jsxs(UnstyledButton, {
31
- component: m$1.button,
32
- layout: "position",
33
- layoutDependency: isReadOnly,
34
- disabled,
35
- onClick: (e) => {
36
- e.stopPropagation();
37
- !disabled && diagram.toggleFeature("ReadOnly");
38
- },
39
- initial: {
40
- opacity: 0,
41
- scale: .6
42
- },
43
- animate: {
44
- opacity: 1,
45
- scale: disabled ? .95 : 1
46
- },
47
- exit: {
48
- opacity: 0,
49
- scale: .6
50
- },
51
- whileTap: { translateY: 1 },
52
- className: cx("group", hstack({
53
- gap: "0.5",
54
- paddingInline: "xxs",
55
- paddingBlock: "xxs",
56
- userSelect: "none",
57
- layerStyle: "likec4.panel.action",
58
- backgroundColor: {
59
- base: "none",
60
- _notDisabled: { _hover: "likec4.panel.action.bg.hover" }
61
- }
62
- })),
63
- children: [
64
- /* @__PURE__ */ jsx(IconLockOpen2, {
65
- size: 14,
66
- stroke: 2,
67
- style: { display: isReadOnly ? "none" : void 0 }
12
+ return /* @__PURE__ */ jsxs(UnstyledButton, {
13
+ component: m.button,
14
+ layout: "position",
15
+ layoutDependency: isReadOnly,
16
+ disabled,
17
+ onClick: (e) => {
18
+ e.stopPropagation();
19
+ !disabled && diagram.toggleFeature("ReadOnly");
20
+ },
21
+ initial: {
22
+ opacity: 0,
23
+ scale: .9,
24
+ translateX: -10
25
+ },
26
+ animate: {
27
+ opacity: 1,
28
+ scale: disabled ? .95 : 1,
29
+ translateX: 0
30
+ },
31
+ exit: {
32
+ opacity: 0,
33
+ scale: .9,
34
+ translateX: -10
35
+ },
36
+ whileTap: { translateY: 1 },
37
+ className: cx("group", hstack({
38
+ gap: "0.5",
39
+ paddingInline: "xxs",
40
+ paddingBlock: "xxs",
41
+ userSelect: "none",
42
+ layerStyle: "likec4.panel.action"
43
+ })),
44
+ children: [
45
+ /* @__PURE__ */ jsx(IconLockOpen2, {
46
+ size: 14,
47
+ stroke: 2,
48
+ style: { display: isReadOnly ? "none" : void 0 }
49
+ }),
50
+ /* @__PURE__ */ jsx(IconLock, {
51
+ size: 14,
52
+ stroke: 2,
53
+ style: { display: !isReadOnly ? "none" : void 0 }
54
+ }),
55
+ isReadOnly && /* @__PURE__ */ jsx(m.div, {
56
+ layout: true,
57
+ className: css({
58
+ fontSize: "xxs",
59
+ fontWeight: "bold",
60
+ lineHeight: "snug",
61
+ opacity: "0.9"
68
62
  }),
69
- /* @__PURE__ */ jsx(IconLock, {
70
- size: 14,
71
- stroke: 2,
72
- style: { display: !isReadOnly ? "none" : void 0 }
73
- }),
74
- /* @__PURE__ */ jsx(m$1.div, {
75
- className: css({
76
- fontSize: "11px",
77
- fontWeight: "bold",
78
- lineHeight: 1,
79
- opacity: .8
80
- }),
81
- style: { display: isReadOnly ? "block" : "none" },
82
- children: "Edit"
83
- })
84
- ]
85
- })
63
+ children: "Edit"
64
+ })
65
+ ]
86
66
  });
87
- };
67
+ }
88
68
  //#endregion
89
69
  export { ToggleReadonly };
@@ -0,0 +1,5 @@
1
+ type ViewDetailsButtonProps = {
2
+ onOpen: () => void;
3
+ };
4
+ export declare function ViewDetailsButton({ onOpen }: ViewDetailsButtonProps): import("react").JSX.Element;
5
+ export {};
@@ -0,0 +1,121 @@
1
+ import "../../_virtual/_rolldown/runtime.js";
2
+ import { useRootContainer } from "../../context/RootContainerContext.js";
3
+ import { selectDiagramContext, useDiagramSelector } from "../../hooks/safeContext.js";
4
+ import { FloatingWindow as FloatingWindow$1 } from "../../components/FloatingWindow.js";
5
+ import { ViewDetailsWindow } from "../windows/ViewDetailsWindow.js";
6
+ import { cx } from "@likec4/styles/css";
7
+ import { IconId, IconLink } from "@tabler/icons-react";
8
+ import { useRef } from "react";
9
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
+ import { clamp } from "remeda";
11
+ import { UnstyledButton } from "@mantine/core";
12
+ import { useDisclosure } from "@mantine/hooks";
13
+ import { Box as Box$1, HStack } from "@likec4/styles/jsx";
14
+ import { hstack } from "@likec4/styles/patterns";
15
+ import * as m from "motion/react-m";
16
+ //#region src/navigationpanel/controls/ViewDetailsButton.tsx
17
+ var selector = selectDiagramContext(({ view }) => {
18
+ return {
19
+ id: view.id,
20
+ links: view.links?.length ?? 0
21
+ };
22
+ });
23
+ function ViewDetailsButton({ onOpen }) {
24
+ const { ref: rootRef } = useRootContainer();
25
+ const [opened, handlers] = useDisclosure(false);
26
+ const data = useDiagramSelector(selector);
27
+ const initialsRef = useRef({
28
+ dimensions: {
29
+ initialWidth: 200,
30
+ initialHeight: 200
31
+ },
32
+ initialPosition: {
33
+ top: 65,
34
+ left: 32
35
+ }
36
+ });
37
+ const toggle = () => {
38
+ if (opened) handlers.close();
39
+ else {
40
+ const rootElement = rootRef.current;
41
+ if (rootElement) {
42
+ const viewport = rootElement.getBoundingClientRect();
43
+ const panelRect = rootElement.querySelector("[data-panel=\"navigation\"]")?.getBoundingClientRect();
44
+ let height = viewport.height - 80;
45
+ if (panelRect) {
46
+ initialsRef.current.initialPosition.top = panelRect.bottom + 10;
47
+ initialsRef.current.initialPosition.left = panelRect.left + 55;
48
+ height = viewport.height - (panelRect.top - viewport.top + panelRect.height) - 32;
49
+ }
50
+ initialsRef.current.dimensions.initialHeight = Math.max(100, height);
51
+ initialsRef.current.dimensions.initialWidth = clamp(viewport.width * .3, {
52
+ min: 250,
53
+ max: 500
54
+ });
55
+ }
56
+ handlers.open();
57
+ onOpen();
58
+ }
59
+ };
60
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ViewDetailsCardTrigger, {
61
+ linksCount: data.links,
62
+ onClick: toggle,
63
+ opened
64
+ }), opened && /* @__PURE__ */ jsx(FloatingWindow$1, {
65
+ windowId: "view-details",
66
+ ...initialsRef.current,
67
+ onClose: handlers.close,
68
+ children: /* @__PURE__ */ jsx(ViewDetailsWindow, {})
69
+ })] });
70
+ }
71
+ var ViewDetailsCardTrigger = ({ linksCount, onClick, opened }) => /* @__PURE__ */ jsxs(UnstyledButton, {
72
+ component: m.button,
73
+ layout: "position",
74
+ "aria-selected": opened,
75
+ whileTap: {
76
+ scale: .95,
77
+ translateY: 1
78
+ },
79
+ onClick: (e) => {
80
+ e.stopPropagation();
81
+ onClick();
82
+ },
83
+ className: cx("group", hstack({
84
+ gap: "2",
85
+ layerStyle: "likec4.panel.action",
86
+ display: {
87
+ base: "none",
88
+ "@/xs": "flex"
89
+ },
90
+ _selected: {
91
+ backgroundColor: {
92
+ base: "primary.body",
93
+ _hover: "primary.body.hover"
94
+ },
95
+ color: {
96
+ base: "primary.text",
97
+ _hover: "primary.text"
98
+ }
99
+ }
100
+ }), ``),
101
+ children: [/* @__PURE__ */ jsx(IconId, {
102
+ size: 16,
103
+ stroke: 1.8
104
+ }), linksCount > 0 && /* @__PURE__ */ jsxs(HStack, {
105
+ gap: "0.5",
106
+ children: [/* @__PURE__ */ jsx(IconLink, {
107
+ size: 14,
108
+ stroke: 2
109
+ }), /* @__PURE__ */ jsx(Box$1, {
110
+ css: {
111
+ fontSize: "xxs",
112
+ fontWeight: "bold",
113
+ lineHeight: "1",
114
+ opacity: "0.7"
115
+ },
116
+ children: linksCount
117
+ })]
118
+ })]
119
+ });
120
+ //#endregion
121
+ export { ViewDetailsButton };
@@ -1,7 +1,7 @@
1
- export { DetailsControls } from './DetailsControls';
2
1
  export { LayoutWarning } from './LayoutWarning';
3
2
  export { LogoButton } from './LogoButton';
4
3
  export { NavigationButtons } from './NavigationButtons';
5
4
  export { OpenSource } from './OpenSource';
6
5
  export { SearchControl } from './SearchControl';
7
6
  export { ToggleReadonly } from './ToggleReadonly';
7
+ export { ViewDetailsButton } from './ViewDetailsButton';