@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
@@ -0,0 +1,379 @@
1
+ import "../../_virtual/_rolldown/runtime.js";
2
+ import { useCallbackRef as useCallbackRef$1 } from "../../hooks/useCallbackRef.js";
3
+ import { useUpdateEffect as useUpdateEffect$1 } from "../../hooks/useUpdateEffect.js";
4
+ import { stopPropagation } from "../../utils/xyflow.js";
5
+ import { IfEnabled, useEnabledFeatures } from "../../context/DiagramFeatures.js";
6
+ import { useDiagram } from "../../hooks/safeContext.js";
7
+ import { useCurrentViewModel } from "../../hooks/useCurrentViewModel.js";
8
+ import { useDiagramCompareLayout } from "../../hooks/useDiagramCompareLayout.js";
9
+ import { PanelActionIcon } from "../_common.js";
10
+ import { Markdown } from "../../base-primitives/Markdown.js";
11
+ import { EmptyBox } from "../../components/EmptyBox.js";
12
+ import { Link } from "../../components/Link.js";
13
+ import { ViewIcon } from "../../components/ViewIcon.js";
14
+ import { css, cx } from "@likec4/styles/css";
15
+ import { IconChevronDown, IconFileSymlink, IconInfoCircle } from "@tabler/icons-react";
16
+ import { useEffect, useEffectEvent, useRef } from "react";
17
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
18
+ import { useIsMounted } from "@react-hookz/web";
19
+ import { Button, DataList, Divider, Loader, Menu, Pill, ScrollArea, TagsInput, Textarea, Tooltip } from "@mantine/core";
20
+ import { useToggle, useUncontrolled } from "@mantine/hooks";
21
+ import "@likec4/core/types";
22
+ import { Box as Box$1, HStack, Txt, VStack, styled } from "@likec4/styles/jsx";
23
+ //#region src/navigationpanel/windows/ViewDetailsWindow.tsx
24
+ var SectionHeader = styled("div", { base: {
25
+ fontSize: "xs",
26
+ color: "text.non-essential",
27
+ fontWeight: "medium",
28
+ userSelect: "none",
29
+ lineHeight: "snug"
30
+ } });
31
+ function ViewDetailsWindow() {
32
+ const viewModel = useCurrentViewModel();
33
+ const diagram = useDiagram();
34
+ const { enableReadOnly } = useEnabledFeatures();
35
+ const title = viewModel.titleOrUntitled;
36
+ const description = viewModel.description;
37
+ const tags = viewModel.tags;
38
+ const alltags = viewModel.$model.tagsFromSpecification;
39
+ const links = viewModel.links;
40
+ const changeTitle = (title) => {
41
+ if (viewModel.folder && !viewModel.folder.isRoot) title = viewModel.folder.path + " / " + title;
42
+ diagram.triggerChange({
43
+ op: "change-property",
44
+ title
45
+ });
46
+ };
47
+ const changeTags = (nextTags) => {
48
+ if (nextTags.length === tags.length && nextTags.every((t) => tags.includes(t))) return;
49
+ diagram.triggerChange({
50
+ op: "change-property",
51
+ tags: nextTags
52
+ });
53
+ };
54
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
55
+ /* @__PURE__ */ jsxs(VStack, {
56
+ style: { flex: "0" },
57
+ p: "1",
58
+ gap: "sm",
59
+ className: "drag-handle",
60
+ children: [
61
+ /* @__PURE__ */ jsxs(HStack, {
62
+ gap: "2",
63
+ alignItems: "baseline",
64
+ children: [
65
+ /* @__PURE__ */ jsx(Box$1, {
66
+ style: {
67
+ flex: "0",
68
+ fontSize: 24,
69
+ lineHeight: 1
70
+ },
71
+ children: /* @__PURE__ */ jsx(ViewIcon, {
72
+ type: viewModel._type,
73
+ size: 22
74
+ })
75
+ }),
76
+ /* @__PURE__ */ jsx(Box$1, {
77
+ style: { flex: "1" },
78
+ children: /* @__PURE__ */ jsx(EditableTitle, {
79
+ viewTitle: title,
80
+ readOnly: enableReadOnly,
81
+ onChange: changeTitle
82
+ })
83
+ }),
84
+ /* @__PURE__ */ jsx(HStack, {
85
+ gap: "1",
86
+ flexWrap: "nowrap",
87
+ style: {
88
+ fontSize: 24,
89
+ lineHeight: 1
90
+ },
91
+ alignItems: "baseline",
92
+ children: /* @__PURE__ */ jsx(IfEnabled, {
93
+ feature: "Vscode",
94
+ children: /* @__PURE__ */ jsx(PanelActionIcon, {
95
+ variant: "filled",
96
+ size: "sm",
97
+ onClick: (e) => {
98
+ e.stopPropagation();
99
+ const viewId = diagram.currentView.id;
100
+ diagram.openSource({ view: viewId });
101
+ },
102
+ children: /* @__PURE__ */ jsx(IconFileSymlink, { style: {
103
+ width: "70%",
104
+ height: "70%"
105
+ } })
106
+ })
107
+ })
108
+ })
109
+ ]
110
+ }),
111
+ /* @__PURE__ */ jsxs(DataList, {
112
+ size: "xs",
113
+ gap: "sm",
114
+ orientation: "horizontal",
115
+ labelWidth: 50,
116
+ children: [
117
+ viewModel.hasManualLayout && /* @__PURE__ */ jsxs(DataList.Item, { children: [/* @__PURE__ */ jsx(DataList.ItemLabel, { children: "Layout" }), /* @__PURE__ */ jsx(DataList.ItemValue, { children: /* @__PURE__ */ jsx(ManualLayoutState, {}) })] }),
118
+ alltags.length > 0 && /* @__PURE__ */ jsxs(DataList.Item, { children: [/* @__PURE__ */ jsx(DataList.ItemLabel, { children: "Tags" }), /* @__PURE__ */ jsxs(DataList.ItemValue, { children: [(tags.length > 0 || !enableReadOnly) && /* @__PURE__ */ jsx(EditableTags, {
119
+ alltags,
120
+ tags,
121
+ readOnly: enableReadOnly,
122
+ onChange: changeTags
123
+ }), tags.length === 0 && enableReadOnly && /* @__PURE__ */ jsx(Txt, {
124
+ size: "xs",
125
+ color: "text.non-essential",
126
+ children: "No tags"
127
+ })] })] }),
128
+ /* @__PURE__ */ jsxs(DataList.Item, { children: [/* @__PURE__ */ jsx(DataList.ItemLabel, { children: "Links" }), /* @__PURE__ */ jsx(DataList.ItemValue, {
129
+ className: "nodrag",
130
+ children: /* @__PURE__ */ jsxs(HStack, {
131
+ gap: "xxs",
132
+ flexWrap: "wrap",
133
+ children: [links.map((link, i) => /* @__PURE__ */ jsx(Link, { value: link }, `${i}-${link.url}`)), links.length === 0 && /* @__PURE__ */ jsx(Txt, {
134
+ size: "xs",
135
+ color: "text.non-essential",
136
+ children: "No links"
137
+ })]
138
+ })
139
+ })] })
140
+ ]
141
+ }),
142
+ /* @__PURE__ */ jsx(Divider, {
143
+ label: /* @__PURE__ */ jsx(SectionHeader, { children: "Description" }),
144
+ labelPosition: "left",
145
+ mt: "xxs",
146
+ mb: "xs"
147
+ })
148
+ ]
149
+ }),
150
+ description.isEmpty && /* @__PURE__ */ jsx(EmptyBox, {
151
+ flex: "1",
152
+ m: "1",
153
+ children: "No description"
154
+ }),
155
+ description.nonEmpty && /* @__PURE__ */ jsx(ScrollArea, {
156
+ style: { flex: 1 },
157
+ scrollbars: "y",
158
+ overscrollBehavior: "contain",
159
+ children: /* @__PURE__ */ jsx(Box$1, {
160
+ px: "1",
161
+ children: /* @__PURE__ */ jsx(Markdown, { value: description })
162
+ })
163
+ })
164
+ ] });
165
+ }
166
+ function EditableTitle({ viewTitle, readOnly, onChange }) {
167
+ const [isEditing, toggle] = useToggle();
168
+ const initialValue = useRef(viewTitle);
169
+ const [_value, handleChange] = useUncontrolled({ defaultValue: viewTitle });
170
+ useEffect(() => {
171
+ initialValue.current = viewTitle;
172
+ handleChange(viewTitle);
173
+ }, [viewTitle]);
174
+ return /* @__PURE__ */ jsx(Textarea, {
175
+ size: "xs",
176
+ radius: "xs",
177
+ autosize: true,
178
+ minRows: 1,
179
+ wrap: "soft",
180
+ maxRows: 5,
181
+ variant: "unstyled",
182
+ value: _value,
183
+ onChange: (e) => handleChange(e.target.value),
184
+ readOnly,
185
+ tabIndex: readOnly ? -1 : void 0,
186
+ onFocus: (e) => {
187
+ toggle(true);
188
+ const length = _value.length;
189
+ e.currentTarget.setSelectionRange(length, null);
190
+ },
191
+ onBlur: () => {
192
+ toggle(false);
193
+ handleChange(initialValue.current);
194
+ },
195
+ onKeyDownCapture: (e) => {
196
+ if (e.key === "Escape") {
197
+ e.preventDefault();
198
+ e.currentTarget.blur();
199
+ return;
200
+ }
201
+ if (e.key === "Enter" && !(e.getModifierState("Shift") || e.getModifierState("Meta") || e.getModifierState("Control"))) {
202
+ e.preventDefault();
203
+ initialValue.current = _value;
204
+ onChange(_value);
205
+ e.currentTarget.blur();
206
+ return;
207
+ }
208
+ },
209
+ className: !readOnly ? "nodrag" : void 0,
210
+ classNames: { input: cx(css({
211
+ textStyle: "h5",
212
+ color: "text.bright",
213
+ padding: "1",
214
+ border: "default",
215
+ borderColor: "transparent"
216
+ }), readOnly && css({ cursor: "inherit" }), !readOnly && !isEditing && css({ cursor: "pointer" }), !readOnly && css({
217
+ _hover: { backgroundColor: "surface.field.hover" },
218
+ _focus: {
219
+ outline: "outline",
220
+ backgroundColor: "surface.field"
221
+ }
222
+ })) }
223
+ });
224
+ }
225
+ function EditableTags({ alltags, tags, readOnly, onChange }) {
226
+ const [isApplying, toggleApplying] = useToggle();
227
+ const [value, handleChange] = useUncontrolled({ defaultValue: [...tags] });
228
+ const hasChanges = value.length !== tags.length || value.some((v) => !tags.includes(v));
229
+ const revert = useEffectEvent(() => {
230
+ handleChange([...tags]);
231
+ toggleApplying(false);
232
+ });
233
+ useUpdateEffect$1(() => {
234
+ revert();
235
+ }, [tags]);
236
+ useUpdateEffect$1(() => {
237
+ if (isApplying && !hasChanges) toggleApplying(false);
238
+ }, [hasChanges, isApplying]);
239
+ useEffect(() => {
240
+ if (readOnly) revert();
241
+ }, [readOnly]);
242
+ const commitChanges = useEffectEvent(() => {
243
+ toggleApplying(true);
244
+ onChange(value);
245
+ });
246
+ const canAdd = !readOnly && value.length < alltags.length;
247
+ const notCommitted = !readOnly && hasChanges;
248
+ return /* @__PURE__ */ jsxs(VStack, {
249
+ gap: "2",
250
+ children: [/* @__PURE__ */ jsx(TagsInput, {
251
+ variant: "unstyled",
252
+ size: "xs",
253
+ acceptValueOnBlur: false,
254
+ readOnly,
255
+ data: alltags,
256
+ value,
257
+ onChange: (value) => {
258
+ handleChange(value.filter((v) => alltags.includes(v)));
259
+ },
260
+ classNames: {
261
+ wrapper: "nodrag",
262
+ input: cx(!readOnly && css({
263
+ py: "1",
264
+ _hover: { backgroundColor: "surface.field.hover" },
265
+ _focus: {
266
+ outline: "outline",
267
+ backgroundColor: "surface.field"
268
+ }
269
+ })),
270
+ inputField: css({
271
+ py: "1",
272
+ minWidth: "[40px]"
273
+ })
274
+ },
275
+ comboboxProps: {
276
+ withinPortal: false,
277
+ offset: 2
278
+ },
279
+ placeholder: canAdd ? "Add tag..." : "",
280
+ renderPill: ({ value, onRemove }) => /* @__PURE__ */ jsx(Pill, {
281
+ size: "xs",
282
+ withRemoveButton: !readOnly,
283
+ onRemove,
284
+ radius: "xs",
285
+ "data-likec4-tag": value,
286
+ classNames: {
287
+ root: css({ layerStyle: "likec4.tag" }),
288
+ label: css({ fontWeight: "semibold" })
289
+ },
290
+ children: value
291
+ })
292
+ }), notCommitted && /* @__PURE__ */ jsxs(HStack, {
293
+ gap: "2",
294
+ children: [/* @__PURE__ */ jsx(Button, {
295
+ loading: isApplying,
296
+ miw: "min-content",
297
+ variant: "default",
298
+ size: "compact-xs",
299
+ onClick: commitChanges,
300
+ children: "Apply"
301
+ }), /* @__PURE__ */ jsx(Button, {
302
+ disabled: isApplying,
303
+ miw: "min-content",
304
+ variant: "default",
305
+ size: "compact-xs",
306
+ onClick: revert,
307
+ children: "Revert"
308
+ })]
309
+ })]
310
+ });
311
+ }
312
+ function ManualLayoutState() {
313
+ const isMounted = useIsMounted();
314
+ const [ctx, ops] = useDiagramCompareLayout();
315
+ const [isProcessing, setIsProcessing] = useToggle();
316
+ const resetProcessing = () => {
317
+ setTimeout(() => {
318
+ if (isMounted()) setIsProcessing(false);
319
+ }, 500);
320
+ };
321
+ const onResetManualLayout = useCallbackRef$1((e) => {
322
+ e.stopPropagation();
323
+ if (isProcessing) return;
324
+ setIsProcessing(true);
325
+ setTimeout(() => {
326
+ ops.resetManualLayout();
327
+ resetProcessing();
328
+ }, 100);
329
+ });
330
+ return /* @__PURE__ */ jsxs(Menu, {
331
+ withinPortal: false,
332
+ floatingStrategy: "absolute",
333
+ position: "bottom-start",
334
+ classNames: { item: css({
335
+ fontSize: "sm",
336
+ py: "1"
337
+ }) },
338
+ closeOnItemClick: false,
339
+ disabled: !ctx.hasEditor,
340
+ offset: { mainAxis: 4 },
341
+ children: [/* @__PURE__ */ jsx(Menu.Target, { children: /* @__PURE__ */ jsx(Button, {
342
+ size: "compact-xs",
343
+ className: css({
344
+ layerStyle: ctx.isEnabled ? "surface.warning" : "likec4.panel.action.filled",
345
+ fontSize: "xxs",
346
+ gap: "4"
347
+ }),
348
+ styles: { section: { marginInlineStart: 4 } },
349
+ disabled: !ctx.hasEditor,
350
+ rightSection: ctx.hasEditor ? /* @__PURE__ */ jsx(IconChevronDown, {
351
+ size: 12,
352
+ stroke: 3,
353
+ opacity: .7
354
+ }) : void 0,
355
+ children: ctx.isEnabled ? "out of sync" : "manual"
356
+ }) }), /* @__PURE__ */ jsx(Menu.Dropdown, { children: /* @__PURE__ */ jsx(Menu.Item, {
357
+ leftSection: isProcessing ? /* @__PURE__ */ jsx(Loader, { size: 14 }) : void 0,
358
+ disabled: isProcessing,
359
+ onClick: onResetManualLayout,
360
+ rightSection: !isProcessing && /* @__PURE__ */ jsx(Tooltip, {
361
+ onClick: stopPropagation,
362
+ position: "right-start",
363
+ label: /* @__PURE__ */ jsxs(Fragment$1, { children: [
364
+ "Reset manual layout adjustments and delete snapshot.",
365
+ /* @__PURE__ */ jsx("br", {}),
366
+ "You can undo this action."
367
+ ] }),
368
+ children: /* @__PURE__ */ jsx(IconInfoCircle, {
369
+ size: 14,
370
+ stroke: 1.7,
371
+ opacity: .5
372
+ })
373
+ }),
374
+ children: "Reset layout"
375
+ }) })]
376
+ });
377
+ }
378
+ //#endregion
379
+ export { ViewDetailsWindow };
@@ -2,10 +2,10 @@ import "../_virtual/_rolldown/runtime.js";
2
2
  import { DiagramFeatures } from "../context/DiagramFeatures.js";
3
3
  import { useDiagram } from "../hooks/safeContext.js";
4
4
  import { ErrorBoundary } from "../components/ErrorFallback.js";
5
+ import { Overlay } from "./overlay/Overlay.js";
5
6
  import { RelationshipsBrowser } from "./relationships-browser/RelationshipsBrowser.js";
6
7
  import { ElementDetails } from "./element-details/ElementDetails.js";
7
8
  import { OverlaysActorContext, selectOverlaysSnapshot, useSelectOverlaysActor } from "./hooks.js";
8
- import { Overlay } from "./overlay/Overlay.js";
9
9
  import { RelationshipDetails } from "./relationship-details/RelationshipDetails.js";
10
10
  import { useEffect } from "react";
11
11
  import { jsx } from "react/jsx-runtime";
@@ -69,30 +69,42 @@ function OverlaysSurface({ overlaysActorRef }) {
69
69
  };
70
70
  const overlaysReact = overlays.map((overlay, index) => {
71
71
  switch (overlay.type) {
72
- case "relationshipsBrowser": return /* @__PURE__ */ jsx(Overlay, {
73
- overlayLevel: index,
74
- onClose: () => close(overlay.actorRef),
75
- children: /* @__PURE__ */ jsx(RelationshipsBrowser, { actorRef: overlay.actorRef })
72
+ case "relationshipsBrowser": return /* @__PURE__ */ jsx(ErrorBoundary, {
73
+ onReset: () => close(overlay.actorRef),
74
+ children: /* @__PURE__ */ jsx(Overlay, {
75
+ overlayLevel: index,
76
+ onClose: () => close(overlay.actorRef),
77
+ children: /* @__PURE__ */ jsx(RelationshipsBrowser, { actorRef: overlay.actorRef })
78
+ })
76
79
  }, overlay.actorRef.sessionId);
77
- case "relationshipDetails": return /* @__PURE__ */ jsx(Overlay, {
78
- overlayLevel: index,
79
- onClose: () => close(overlay.actorRef),
80
- children: /* @__PURE__ */ jsx(RelationshipDetails, { actorRef: overlay.actorRef })
80
+ case "relationshipDetails": return /* @__PURE__ */ jsx(ErrorBoundary, {
81
+ onReset: () => close(overlay.actorRef),
82
+ children: /* @__PURE__ */ jsx(Overlay, {
83
+ overlayLevel: index,
84
+ onClose: () => close(overlay.actorRef),
85
+ children: /* @__PURE__ */ jsx(RelationshipDetails, { actorRef: overlay.actorRef })
86
+ })
81
87
  }, overlay.actorRef.sessionId);
82
- case "elementDetails": return /* @__PURE__ */ jsx(ElementDetails, {
83
- actorRef: overlay.actorRef,
84
- onClose: () => close(overlay.actorRef)
88
+ case "elementDetails": return /* @__PURE__ */ jsx(ErrorBoundary, {
89
+ onReset: () => close(overlay.actorRef),
90
+ children: /* @__PURE__ */ jsx(ElementDetails, {
91
+ actorRef: overlay.actorRef,
92
+ onClose: () => close(overlay.actorRef)
93
+ })
85
94
  }, overlay.actorRef.sessionId);
86
95
  default: nonexhaustive(overlay);
87
96
  }
88
97
  });
89
- return /* @__PURE__ */ jsx(DiagramFeatures.Overlays, { children: /* @__PURE__ */ jsx(ErrorBoundary, {
90
- onReset: () => overlaysActorRef.send({ type: "close.all" }),
91
- children: /* @__PURE__ */ jsx(LayoutGroup, { children: /* @__PURE__ */ jsx(AnimatePresence, {
98
+ return /* @__PURE__ */ jsx(DiagramFeatures.Overlays, { children: /* @__PURE__ */ jsx(LayoutGroup, {
99
+ id: overlaysActorRef.sessionId,
100
+ children: /* @__PURE__ */ jsx(AnimatePresence, {
92
101
  propagate: true,
93
102
  mode: "popLayout",
94
- children: overlaysReact
95
- }) })
103
+ children: /* @__PURE__ */ jsx(ErrorBoundary, {
104
+ onReset: () => overlaysActorRef.send({ type: "close.all" }),
105
+ children: overlaysReact
106
+ })
107
+ })
96
108
  }) });
97
109
  }
98
110
  //#endregion
@@ -1,4 +1,5 @@
1
1
  import { css } from "@likec4/styles/css";
2
+ import { flex } from "@likec4/styles/patterns";
2
3
  //#region src/overlays/element-details/ElementDetailsCard.css.ts
3
4
  var backdropBlur = "--_blur";
4
5
  var backdropOpacity = "--_opacity";
@@ -45,7 +46,7 @@ var card = css({
45
46
  "& .react-flow__attribution": { display: "none" }
46
47
  });
47
48
  var cardHeader = css({
48
- flex: 0,
49
+ flex: "[0]",
49
50
  cursor: "move"
50
51
  });
51
52
  var title = css({
@@ -54,7 +55,7 @@ var title = css({
54
55
  fontOpticalSizing: "auto",
55
56
  fontStyle: "normal",
56
57
  fontWeight: "bold",
57
- fontSize: "24px",
58
+ fontSize: "[24px]",
58
59
  lineHeight: "xs",
59
60
  overflow: "hidden",
60
61
  textOverflow: "ellipsis",
@@ -63,9 +64,8 @@ var title = css({
63
64
  });
64
65
  var iconSize = "40px";
65
66
  var elementIcon = css({
66
- flex: `0 0 ${iconSize}`,
67
- height: iconSize,
68
- width: iconSize,
67
+ flex: `[0 0 ${iconSize}]`,
68
+ boxSize: `[${iconSize}]`,
69
69
  display: "flex",
70
70
  alignItems: "center",
71
71
  justifyContent: "center",
@@ -77,11 +77,11 @@ var elementIcon = css({
77
77
  height: "auto",
78
78
  maxHeight: "100%",
79
79
  pointerEvents: "none",
80
- filter: `
80
+ filter: `[
81
81
  drop-shadow(0 0 3px rgb(0 0 0 / 10%))
82
82
  drop-shadow(0 1px 8px rgb(0 0 0 / 5%))
83
83
  drop-shadow(1px 1px 16px rgb(0 0 0 / 2%))
84
- `
84
+ ]`
85
85
  },
86
86
  "& img": { objectFit: "contain" }
87
87
  });
@@ -89,19 +89,18 @@ var viewTitleColor = "--view-title-color";
89
89
  var iconColor = "--icon-color";
90
90
  var viewButton = css({
91
91
  width: "100%",
92
- background: "body",
92
+ background: "surface.default",
93
93
  borderRadius: "sm",
94
94
  padding: `[10px 8px]`,
95
95
  transition: "fast",
96
- border: `1px dashed`,
97
- borderColor: "default.border",
96
+ border: `default`,
97
+ borderStyle: "dashed",
98
98
  [viewTitleColor]: "{colors.mantine.dark[1]}",
99
99
  _hover: {
100
- background: "default.hover",
100
+ background: "surface.hover",
101
101
  [iconColor]: "{colors.mantine.dark[1]}",
102
- [viewTitleColor]: "{colors.default.color}"
102
+ [viewTitleColor]: "{colors.text}"
103
103
  },
104
- _dark: { background: "mantine.dark[6]" },
105
104
  _light: {
106
105
  [iconColor]: "{colors.mantine.gray[6]}",
107
106
  [viewTitleColor]: "{colors.mantine.gray[7]}",
@@ -111,24 +110,19 @@ var viewButton = css({
111
110
  transition: "fast",
112
111
  color: `[var(${iconColor}, {colors.mantine.dark[2]})]`,
113
112
  "--ti-size": "22px",
114
- _hover: { color: "default.color" }
113
+ _hover: { color: "text" }
115
114
  },
116
- "& > *": { transition: `all 130ms {easings.inOut}` },
117
- "&:hover > *": {
118
- transitionTimingFunction: "out",
119
- transform: "translateX(1.6px)"
120
- }
115
+ "& > *": { transition: `[all 130ms {easings.inOut}]` }
121
116
  });
122
117
  var viewButtonTitle = css({
123
118
  transition: "fast",
124
119
  color: `[var(${viewTitleColor}, {colors.mantine.gray[7]})]`,
125
- fontSize: "15px",
120
+ fontSize: "[15px]",
126
121
  fontWeight: "medium",
127
- lineHeight: "1.4"
122
+ lineHeight: "[1.4]"
128
123
  });
129
- var tabsRoot = css({
130
- flex: 1,
131
- display: "flex",
124
+ var tabsRoot = flex({
125
+ flex: "1",
132
126
  flexDirection: "column",
133
127
  justifyContent: "stretch",
134
128
  overflow: "hidden",
@@ -152,14 +146,14 @@ var tabsTab = css({
152
146
  color: "mantine.gray[7]",
153
147
  _hover: {
154
148
  transitionTimingFunction: "out",
155
- color: "default.color",
149
+ color: "text",
156
150
  background: "mantine.gray[3]"
157
151
  },
158
152
  ["&[data-active]"]: {
159
153
  transition: "none",
160
154
  background: "white",
161
155
  shadow: "xs",
162
- color: "default.color"
156
+ color: "text"
163
157
  },
164
158
  _dark: {
165
159
  color: "mantine.dark[1]",
@@ -174,7 +168,7 @@ var tabsTab = css({
174
168
  }
175
169
  });
176
170
  var tabsPanel = css({
177
- flex: 1,
171
+ flex: "1",
178
172
  overflow: "hidden",
179
173
  position: "relative",
180
174
  "&:not(:has(.mantine-ScrollArea-root))": {
@@ -191,10 +185,10 @@ var tabsPanel = css({
191
185
  }
192
186
  });
193
187
  var propertiesGrid = css({
194
- flex: 1,
188
+ flex: "1",
195
189
  display: "grid",
196
- gridTemplateColumns: "min-content 1fr",
197
- gridAutoRows: "min-content max-content",
190
+ gridTemplateColumns: "[min-content 1fr]",
191
+ gridAutoRows: "[min-content max-content]",
198
192
  gap: `[24px 20px]`,
199
193
  alignItems: "baseline",
200
194
  justifyItems: "stretch"
@@ -206,19 +200,17 @@ var propertyLabel = css({
206
200
  });
207
201
  var resizeHandle = css({
208
202
  position: "absolute",
209
- width: "14px",
210
- height: "14px",
211
- border: `3.5px solid`,
212
- borderColor: "mantine.dark[3]",
203
+ boxSize: "[14px]",
204
+ border: `[3.5px solid {colors.mantine.dark[3]}]`,
213
205
  borderTop: "none",
214
206
  borderLeft: "none",
215
207
  borderRadius: "xs",
216
208
  bottom: "0.5",
217
209
  right: "0.5",
218
210
  transition: "fast",
219
- cursor: "se-resize",
211
+ cursor: "[se-resize]",
220
212
  _hover: {
221
- borderWidth: "4px",
213
+ borderWidth: "[4px]",
222
214
  borderColor: "mantine.dark[1]"
223
215
  }
224
216
  });
@@ -491,7 +491,7 @@ function ElementMetata({ value: metadata }) {
491
491
  className: css({
492
492
  display: "grid",
493
493
  gridTemplateColumns: "min-content 1fr",
494
- gridAutoRows: "min-content",
494
+ gridAutoRows: "[min-content]",
495
495
  gap: `[12px 16px]`,
496
496
  alignItems: "baseline",
497
497
  justifyItems: "stretch"