@likec4/diagram 1.56.0 → 1.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/LikeC4Diagram.js +3 -1
  2. package/dist/LikeC4View.js +47 -55
  3. package/dist/adhoc-editor/ElementsTree.js +2 -6
  4. package/dist/components/RootContainer.js +19 -18
  5. package/dist/context/DiagramFeatures.d.ts +1 -1
  6. package/dist/context/DiagramFeatures.js +5 -0
  7. package/dist/context/RootContainerContext.d.ts +10 -17
  8. package/dist/context/RootContainerContext.js +1 -13
  9. package/dist/custom/index.d.ts +1 -1
  10. package/dist/custom/index.js +1 -2
  11. package/dist/editor/LikeC4EditorCallbacks.d.ts +5 -0
  12. package/dist/editor/actor/actions.d.ts +115 -0
  13. package/dist/editor/actor/actions.js +122 -0
  14. package/dist/editor/{hotkeyActor.d.ts → actor/hotkey.d.ts} +1 -1
  15. package/dist/editor/{hotkeyActor.js → actor/hotkey.js} +4 -4
  16. package/dist/editor/actor/machine.d.ts +11 -0
  17. package/dist/editor/actor/machine.js +22 -0
  18. package/dist/editor/{editorActor.setup.d.ts → actor/setup.d.ts} +13 -49
  19. package/dist/editor/{editorActor.setup.js → actor/setup.js} +13 -10
  20. package/dist/editor/actor/state.editor.d.ts +97 -0
  21. package/dist/editor/actor/state.editor.js +55 -0
  22. package/dist/editor/actor/state.sync-queue.d.ts +420 -0
  23. package/dist/editor/actor/state.sync-queue.js +235 -0
  24. package/dist/editor/actor/types.d.ts +59 -0
  25. package/dist/editor/actor/types.js +5 -0
  26. package/dist/editor/applyChangesToManualLayout.js +1 -1
  27. package/dist/editor/index.d.ts +2 -1
  28. package/dist/editor/useEditorActorLogic.d.ts +8 -2
  29. package/dist/editor/useEditorActorLogic.js +26 -6
  30. package/dist/hooks/useDiagram.js +6 -1
  31. package/dist/hooks/useDiagramCompareLayout.js +1 -1
  32. package/dist/hooks/useEditorActor.d.ts +4 -0
  33. package/dist/hooks/useEditorActor.js +26 -0
  34. package/dist/hooks/useLikeC4ElementsTree.d.ts +3 -2
  35. package/dist/hooks/useLikeC4ElementsTree.js +3 -1
  36. package/dist/likec4diagram/DiagramUI.js +8 -4
  37. package/dist/likec4diagram/DiagramXYFlow.js +12 -12
  38. package/dist/likec4diagram/state/aligners.js +3 -0
  39. package/dist/likec4diagram/state/assign.js +1 -1
  40. package/dist/likec4diagram/state/diagram-api.d.ts +16 -0
  41. package/dist/likec4diagram/state/diagram-api.js +13 -7
  42. package/dist/likec4diagram/state/machine.actions.js +7 -8
  43. package/dist/likec4diagram/state/machine.d.ts +1 -1
  44. package/dist/likec4diagram/state/machine.setup.js +1 -1
  45. package/dist/likec4diagram/state/types.d.ts +1 -1
  46. package/dist/likec4diagram/state/utils.d.ts +1 -1
  47. package/dist/likec4diagram/useLayoutConstraints.js +2 -0
  48. package/dist/navigationpanel/controls/ToggleReadonly.js +4 -2
  49. package/dist/navigationpanel/editorpanel/ApplySemanticLayout.d.ts +4 -0
  50. package/dist/navigationpanel/editorpanel/ApplySemanticLayout.js +36 -0
  51. package/dist/navigationpanel/editorpanel/EditorPanel.js +45 -33
  52. package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +61 -61
  53. package/dist/overlays/overlay/Overlay.d.ts +16 -0
  54. package/dist/overlays/overlay/Overlay.js +50 -52
  55. package/dist/overlays/overlaysActor.js +28 -27
  56. package/dist/overlays/relationship-details/custom/nodeTypes.d.ts +4 -5
  57. package/dist/overlays/relationship-details/custom/nodeTypes.js +25 -24
  58. package/dist/overlays/relationships-browser/SelectElement.js +2 -2
  59. package/dist/search/Search.d.ts +6 -3
  60. package/dist/search/Search.js +60 -71
  61. package/dist/search/components/ElementsColumn.js +12 -8
  62. package/dist/search/searchActor.js +30 -26
  63. package/dist/shadowroot/ShadowRoot.d.ts +7 -6
  64. package/dist/shadowroot/ShadowRoot.js +59 -20
  65. package/dist/shadowroot/styles.css.d.ts +10 -2
  66. package/dist/shadowroot/styles.css.js +33 -36
  67. package/dist/styles2.js +1 -1
  68. package/package.json +17 -23
  69. package/panda.buildinfo.json +15 -15
  70. package/src/styles-font.css +114 -0
  71. package/src/styles-min.css +2 -0
  72. package/src/styles-xyflow.css +1 -0
  73. package/src/styles.css +3 -0
  74. package/styles-min.css +1 -1
  75. package/styles.css +1 -1
  76. package/dist/bundle/index.d.ts +0 -1
  77. package/dist/editor/editorActor.actions.d.ts +0 -153
  78. package/dist/editor/editorActor.actions.js +0 -133
  79. package/dist/editor/editorActor.states.d.ts +0 -9
  80. package/dist/editor/editorActor.states.js +0 -219
  81. package/dist/hooks/useOverlaysActor.js +0 -11
  82. package/dist/hooks/useSearchActor.js +0 -11
@@ -1,5 +1,6 @@
1
1
  import "../../_virtual/_rolldown/runtime.js";
2
2
  import { useEnabledFeatures } from "../../context/DiagramFeatures.js";
3
+ import { ApplySemanticLayout } from "./ApplySemanticLayout.js";
3
4
  import { CenterCamera } from "./CenterCamera.js";
4
5
  import { ChangeAutoLayoutButton } from "./ChangeAutoLayoutButton.js";
5
6
  import { ManualLayoutToolsButton } from "./ManualLayoutToolsButton.js";
@@ -10,41 +11,52 @@ import { AnimatePresence } from "motion/react";
10
11
  import { vstack } from "@likec4/styles/patterns";
11
12
  import * as m$1 from "motion/react-m";
12
13
  //#region src/navigationpanel/editorpanel/EditorPanel.tsx
14
+ var variants = {
15
+ hidden: {
16
+ opacity: 0,
17
+ translateX: -20
18
+ },
19
+ visible: {
20
+ opacity: 1,
21
+ translateX: 0
22
+ },
23
+ exit: {
24
+ opacity: 0,
25
+ translateX: -20
26
+ }
27
+ };
13
28
  function EditorPanel() {
14
- const { enableReadOnly } = useEnabledFeatures();
15
- return /* @__PURE__ */ jsx(AnimatePresence, { children: !enableReadOnly && /* @__PURE__ */ jsx(m$1.div, {
16
- layout: "position",
17
- className: vstack({
18
- gap: "xs",
19
- layerStyle: "likec4.panel",
20
- position: "relative",
21
- cursor: "pointer",
22
- padding: "xxs",
23
- pointerEvents: "all"
24
- }),
25
- initial: {
26
- opacity: 0,
27
- translateX: -20
28
- },
29
- animate: {
30
- opacity: 1,
31
- translateX: 0
32
- },
33
- exit: {
34
- opacity: 0,
35
- translateX: -20
36
- },
37
- children: /* @__PURE__ */ jsxs(TooltipGroup, {
38
- openDelay: 600,
39
- closeDelay: 120,
40
- children: [
41
- /* @__PURE__ */ jsx(ChangeAutoLayoutButton, {}),
42
- /* @__PURE__ */ jsx(ManualLayoutToolsButton, {}),
43
- /* @__PURE__ */ jsx(CenterCamera, {}),
44
- /* @__PURE__ */ jsx(ToggleReadonly, {})
45
- ]
29
+ const { enableReadOnly, enableCompareWithLatest, enableAISemanticLayout } = useEnabledFeatures();
30
+ const showAiSemanticLayoutButton = !enableCompareWithLatest && !enableReadOnly && enableAISemanticLayout;
31
+ return /* @__PURE__ */ jsx(AnimatePresence, {
32
+ propagate: true,
33
+ children: !enableReadOnly && /* @__PURE__ */ jsx(m$1.div, {
34
+ layout: "position",
35
+ className: vstack({
36
+ gap: "xs",
37
+ layerStyle: "likec4.panel",
38
+ position: "relative",
39
+ cursor: "pointer",
40
+ padding: "xxs",
41
+ pointerEvents: "all"
42
+ }),
43
+ initial: "hidden",
44
+ animate: "visible",
45
+ exit: "exit",
46
+ variants,
47
+ children: /* @__PURE__ */ jsxs(TooltipGroup, {
48
+ openDelay: 600,
49
+ closeDelay: 120,
50
+ children: [
51
+ /* @__PURE__ */ jsx(ChangeAutoLayoutButton, {}),
52
+ /* @__PURE__ */ jsx(ManualLayoutToolsButton, {}),
53
+ /* @__PURE__ */ jsx(CenterCamera, {}),
54
+ /* @__PURE__ */ jsx(ToggleReadonly, {}),
55
+ /* @__PURE__ */ jsx(ApplySemanticLayout, { visible: showAiSemanticLayoutButton })
56
+ ]
57
+ })
46
58
  })
47
- }) });
59
+ });
48
60
  }
49
61
  //#endregion
50
62
  export { EditorPanel };
@@ -5,8 +5,8 @@ export declare const TriggerWalkthroughButton: ForwardRefExoticComponent<Omit<Bu
5
5
  color?: string | undefined;
6
6
  content?: string | undefined;
7
7
  translate?: "yes" | "no" | undefined;
8
+ type?: "button" | "submit" | "reset" | undefined;
8
9
  id?: string | undefined;
9
- type?: "button" | "reset" | "submit" | undefined;
10
10
  form?: string | undefined;
11
11
  hidden?: boolean | undefined;
12
12
  draggable?: (boolean | "true" | "false") | undefined;
@@ -17,68 +17,10 @@ export declare const TriggerWalkthroughButton: ForwardRefExoticComponent<Omit<Bu
17
17
  property?: string | undefined;
18
18
  role?: AriaRole | undefined;
19
19
  "aria-label"?: string | undefined;
20
+ defaultValue?: string | number | readonly string[] | undefined;
20
21
  dangerouslySetInnerHTML?: {
21
22
  __html: string | TrustedHTML;
22
23
  } | undefined;
23
- suppressHydrationWarning?: boolean | undefined;
24
- lang?: string | undefined;
25
- name?: string | undefined;
26
- nonce?: string | undefined;
27
- part?: string | undefined;
28
- slot?: string | undefined;
29
- tabIndex?: number | undefined;
30
- "aria-activedescendant"?: string | undefined;
31
- "aria-atomic"?: (boolean | "true" | "false") | undefined;
32
- "aria-autocomplete"?: "list" | "none" | "both" | "inline" | undefined;
33
- "aria-braillelabel"?: string | undefined;
34
- "aria-brailleroledescription"?: string | undefined;
35
- "aria-busy"?: (boolean | "true" | "false") | undefined;
36
- "aria-checked"?: boolean | "true" | "false" | "mixed" | undefined;
37
- "aria-colcount"?: number | undefined;
38
- "aria-colindex"?: number | undefined;
39
- "aria-colindextext"?: string | undefined;
40
- "aria-colspan"?: number | undefined;
41
- "aria-controls"?: string | undefined;
42
- "aria-current"?: boolean | "page" | "step" | "location" | "date" | "time" | "true" | "false" | undefined;
43
- "aria-describedby"?: string | undefined;
44
- "aria-description"?: string | undefined;
45
- "aria-details"?: string | undefined;
46
- "aria-disabled"?: (boolean | "true" | "false") | undefined;
47
- "aria-dropeffect"?: "link" | "none" | "copy" | "move" | "execute" | "popup" | undefined;
48
- "aria-errormessage"?: string | undefined;
49
- "aria-expanded"?: (boolean | "true" | "false") | undefined;
50
- "aria-flowto"?: string | undefined;
51
- "aria-grabbed"?: (boolean | "true" | "false") | undefined;
52
- "aria-haspopup"?: boolean | "grid" | "true" | "dialog" | "listbox" | "menu" | "tree" | "false" | undefined;
53
- "aria-hidden"?: (boolean | "true" | "false") | undefined;
54
- "aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
55
- "aria-keyshortcuts"?: string | undefined;
56
- "aria-labelledby"?: string | undefined;
57
- "aria-level"?: number | undefined;
58
- "aria-live"?: "off" | "assertive" | "polite" | undefined;
59
- "aria-modal"?: (boolean | "true" | "false") | undefined;
60
- "aria-multiline"?: (boolean | "true" | "false") | undefined;
61
- "aria-multiselectable"?: (boolean | "true" | "false") | undefined;
62
- "aria-orientation"?: "horizontal" | "vertical" | undefined;
63
- "aria-owns"?: string | undefined;
64
- "aria-placeholder"?: string | undefined;
65
- "aria-posinset"?: number | undefined;
66
- "aria-pressed"?: boolean | "true" | "false" | "mixed" | undefined;
67
- "aria-readonly"?: (boolean | "true" | "false") | undefined;
68
- "aria-relevant"?: "all" | "text" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
69
- "aria-required"?: (boolean | "true" | "false") | undefined;
70
- "aria-roledescription"?: string | undefined;
71
- "aria-rowcount"?: number | undefined;
72
- "aria-rowindex"?: number | undefined;
73
- "aria-rowindextext"?: string | undefined;
74
- "aria-rowspan"?: number | undefined;
75
- "aria-selected"?: (boolean | "true" | "false") | undefined;
76
- "aria-setsize"?: number | undefined;
77
- "aria-sort"?: "ascending" | "descending" | "none" | "other" | undefined;
78
- "aria-valuemax"?: number | undefined;
79
- "aria-valuemin"?: number | undefined;
80
- "aria-valuenow"?: number | undefined;
81
- "aria-valuetext"?: string | undefined;
82
24
  onCopy?: ClipboardEventHandler<HTMLButtonElement> | undefined;
83
25
  onCopyCapture?: ClipboardEventHandler<HTMLButtonElement> | undefined;
84
26
  onCut?: ClipboardEventHandler<HTMLButtonElement> | undefined;
@@ -243,16 +185,20 @@ export declare const TriggerWalkthroughButton: ForwardRefExoticComponent<Omit<Bu
243
185
  onTransitionRunCapture?: TransitionEventHandler<HTMLButtonElement> | undefined;
244
186
  onTransitionStart?: TransitionEventHandler<HTMLButtonElement> | undefined;
245
187
  onTransitionStartCapture?: TransitionEventHandler<HTMLButtonElement> | undefined;
246
- defaultValue?: string | number | readonly string[] | undefined;
247
188
  defaultChecked?: boolean | undefined;
248
189
  suppressContentEditableWarning?: boolean | undefined;
190
+ suppressHydrationWarning?: boolean | undefined;
249
191
  accessKey?: string | undefined;
250
192
  autoCapitalize?: (string & {}) | "none" | "on" | "off" | "sentences" | "words" | "characters" | undefined;
251
193
  autoFocus?: boolean | undefined;
252
194
  contentEditable?: "inherit" | (boolean | "true" | "false") | "plaintext-only" | undefined;
253
195
  contextMenu?: string | undefined;
254
196
  enterKeyHint?: "search" | "next" | "previous" | "done" | "send" | "enter" | "go" | undefined;
197
+ lang?: string | undefined;
198
+ nonce?: string | undefined;
199
+ slot?: string | undefined;
255
200
  spellCheck?: (boolean | "true" | "false") | undefined;
201
+ tabIndex?: number | undefined;
256
202
  radioGroup?: string | undefined;
257
203
  about?: string | undefined;
258
204
  datatype?: string | undefined;
@@ -280,6 +226,60 @@ export declare const TriggerWalkthroughButton: ForwardRefExoticComponent<Omit<Bu
280
226
  inputMode?: "search" | "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
281
227
  is?: string | undefined;
282
228
  exportparts?: string | undefined;
229
+ part?: string | undefined;
230
+ "aria-activedescendant"?: string | undefined;
231
+ "aria-atomic"?: (boolean | "true" | "false") | undefined;
232
+ "aria-autocomplete"?: "list" | "none" | "both" | "inline" | undefined;
233
+ "aria-braillelabel"?: string | undefined;
234
+ "aria-brailleroledescription"?: string | undefined;
235
+ "aria-busy"?: (boolean | "true" | "false") | undefined;
236
+ "aria-checked"?: boolean | "true" | "false" | "mixed" | undefined;
237
+ "aria-colcount"?: number | undefined;
238
+ "aria-colindex"?: number | undefined;
239
+ "aria-colindextext"?: string | undefined;
240
+ "aria-colspan"?: number | undefined;
241
+ "aria-controls"?: string | undefined;
242
+ "aria-current"?: boolean | "page" | "step" | "location" | "date" | "time" | "true" | "false" | undefined;
243
+ "aria-describedby"?: string | undefined;
244
+ "aria-description"?: string | undefined;
245
+ "aria-details"?: string | undefined;
246
+ "aria-disabled"?: (boolean | "true" | "false") | undefined;
247
+ "aria-dropeffect"?: "link" | "none" | "move" | "copy" | "execute" | "popup" | undefined;
248
+ "aria-errormessage"?: string | undefined;
249
+ "aria-expanded"?: (boolean | "true" | "false") | undefined;
250
+ "aria-flowto"?: string | undefined;
251
+ "aria-grabbed"?: (boolean | "true" | "false") | undefined;
252
+ "aria-haspopup"?: boolean | "grid" | "true" | "dialog" | "listbox" | "menu" | "tree" | "false" | undefined;
253
+ "aria-hidden"?: (boolean | "true" | "false") | undefined;
254
+ "aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
255
+ "aria-keyshortcuts"?: string | undefined;
256
+ "aria-labelledby"?: string | undefined;
257
+ "aria-level"?: number | undefined;
258
+ "aria-live"?: "off" | "assertive" | "polite" | undefined;
259
+ "aria-modal"?: (boolean | "true" | "false") | undefined;
260
+ "aria-multiline"?: (boolean | "true" | "false") | undefined;
261
+ "aria-multiselectable"?: (boolean | "true" | "false") | undefined;
262
+ "aria-orientation"?: "horizontal" | "vertical" | undefined;
263
+ "aria-owns"?: string | undefined;
264
+ "aria-placeholder"?: string | undefined;
265
+ "aria-posinset"?: number | undefined;
266
+ "aria-pressed"?: boolean | "true" | "false" | "mixed" | undefined;
267
+ "aria-readonly"?: (boolean | "true" | "false") | undefined;
268
+ "aria-relevant"?: "all" | "text" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
269
+ "aria-required"?: (boolean | "true" | "false") | undefined;
270
+ "aria-roledescription"?: string | undefined;
271
+ "aria-rowcount"?: number | undefined;
272
+ "aria-rowindex"?: number | undefined;
273
+ "aria-rowindextext"?: string | undefined;
274
+ "aria-rowspan"?: number | undefined;
275
+ "aria-selected"?: (boolean | "true" | "false") | undefined;
276
+ "aria-setsize"?: number | undefined;
277
+ "aria-sort"?: "ascending" | "descending" | "none" | "other" | undefined;
278
+ "aria-valuemax"?: number | undefined;
279
+ "aria-valuemin"?: number | undefined;
280
+ "aria-valuenow"?: number | undefined;
281
+ "aria-valuetext"?: string | undefined;
282
+ name?: string | undefined;
283
283
  value?: string | number | readonly string[] | undefined;
284
284
  ref?: Ref<HTMLButtonElement> | undefined;
285
285
  disabled?: boolean | undefined;
@@ -11,7 +11,15 @@ export type OverlayProps = PropsWithChildren<{
11
11
  backdrop?: {
12
12
  opacity?: number;
13
13
  };
14
+ /**
15
+ * Delay before showing the overlay content (in milliseconds) - helps to avoid flickering
16
+ * Default: `130ms`
17
+ * If set to `0`, the content will be shown immediately
18
+ */
14
19
  openDelay?: number;
20
+ /**
21
+ * Called when the overlay is closed by outside click or escape key
22
+ */
15
23
  onClose: () => void;
16
24
  onClick?: never;
17
25
  }>;
@@ -27,7 +35,15 @@ export declare const Overlay: ForwardRefExoticComponent<{
27
35
  backdrop?: {
28
36
  opacity?: number;
29
37
  };
38
+ /**
39
+ * Delay before showing the overlay content (in milliseconds) - helps to avoid flickering
40
+ * Default: `130ms`
41
+ * If set to `0`, the content will be shown immediately
42
+ */
30
43
  openDelay?: number;
44
+ /**
45
+ * Called when the overlay is closed by outside click or escape key
46
+ */
31
47
  onClose: () => void;
32
48
  onClick?: never;
33
49
  } & {
@@ -1,11 +1,11 @@
1
1
  import "../../_virtual/_rolldown/runtime.js";
2
2
  import { stopPropagation } from "../../utils/xyflow.js";
3
3
  import { cx } from "@likec4/styles/css";
4
- import { forwardRef, useLayoutEffect, useRef, useState } from "react";
4
+ import { forwardRef, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
5
5
  import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
6
- import { useDebouncedCallback, useTimeoutEffect } from "@react-hookz/web";
6
+ import { useTimeoutEffect } from "@react-hookz/web";
7
7
  import { RemoveScroll } from "@mantine/core";
8
- import { m, useReducedMotionConfig } from "motion/react";
8
+ import { m, useIsPresent, useReducedMotionConfig } from "motion/react";
9
9
  import { useFocusTrap, useMergedRef } from "@mantine/hooks";
10
10
  import { overlay } from "@likec4/styles/recipes";
11
11
  //#region src/overlays/overlay/Overlay.tsx
@@ -13,27 +13,30 @@ var backdropBlur = "--_blur";
13
13
  var backdropOpacity = "--_opacity";
14
14
  var cssVarLevel = "--_level";
15
15
  var Overlay = forwardRef(({ onClose, className, classes, overlayLevel = 0, children, fullscreen = false, withBackdrop = true, backdrop, openDelay = 130, ...rest }, ref) => {
16
- const [opened, setOpened] = useState(openDelay === 0);
16
+ const [opened, setOpened] = useState(false);
17
17
  const focusTrapRef = useFocusTrap(opened);
18
18
  const dialogRef = useRef(null);
19
- const isClosingRef = useRef(false);
19
+ const onCloseRef = useRef(null);
20
20
  const motionNotReduced = useReducedMotionConfig() !== true;
21
- const onCloseRef = useRef(onClose);
22
- onCloseRef.current = onClose;
23
- const close = useDebouncedCallback(() => {
24
- if (isClosingRef.current) return;
25
- isClosingRef.current = true;
26
- onCloseRef.current();
27
- }, [], 50);
21
+ /**
22
+ * Close the overlay and call the onClose callback
23
+ */
24
+ const cancelMe = () => {
25
+ onCloseRef.current = onClose;
26
+ dialogRef.current?.close();
27
+ };
28
+ const isPresent = useIsPresent();
29
+ useEffect(() => {
30
+ if (isPresent) return;
31
+ if (dialogRef.current?.open) {
32
+ onCloseRef.current = null;
33
+ dialogRef.current.close();
34
+ }
35
+ }, [isPresent]);
28
36
  useLayoutEffect(() => {
29
- if (!dialogRef.current?.open) dialogRef.current?.showModal();
30
37
  const dialog = dialogRef.current;
31
- return () => {
32
- if (dialog?.open) {
33
- isClosingRef.current = true;
34
- dialog.close();
35
- }
36
- };
38
+ if (dialog && !dialog.open) dialog.showModal();
39
+ if (openDelay === 0) setOpened(true);
37
40
  }, []);
38
41
  useTimeoutEffect(() => {
39
42
  setOpened(true);
@@ -44,55 +47,50 @@ var Overlay = forwardRef(({ onClose, className, classes, overlayLevel = 0, child
44
47
  });
45
48
  let targetBackdropOpacity = overlayLevel > 0 ? "50%" : "60%";
46
49
  if (backdrop?.opacity !== void 0) targetBackdropOpacity = `${backdrop.opacity * 100}%`;
50
+ const motionProps = useMemo(() => ({
51
+ initial: {
52
+ [backdropBlur]: "1px",
53
+ [backdropOpacity]: "10%",
54
+ scale: .95,
55
+ opacity: 0
56
+ },
57
+ animate: {
58
+ [backdropBlur]: overlayLevel > 0 ? "4px" : "8px",
59
+ [backdropOpacity]: targetBackdropOpacity,
60
+ scale: 1,
61
+ opacity: 1
62
+ },
63
+ exit: {
64
+ opacity: 0,
65
+ scale: .97,
66
+ [backdropBlur]: "0px",
67
+ [backdropOpacity]: "0%"
68
+ }
69
+ }), [overlayLevel, targetBackdropOpacity]);
47
70
  return /* @__PURE__ */ jsx(m.dialog, {
48
71
  ref: useMergedRef(dialogRef, focusTrapRef, ref),
49
72
  className: cx(classes?.dialog, className, overlayRecipe, fullscreen && RemoveScroll.classNames.fullWidth),
50
73
  layout: true,
51
74
  style: { [cssVarLevel]: overlayLevel },
52
- ...motionNotReduced ? {
53
- initial: {
54
- [backdropBlur]: "0px",
55
- [backdropOpacity]: "0%",
56
- scale: .85,
57
- opacity: 0
58
- },
59
- animate: {
60
- [backdropBlur]: overlayLevel > 0 ? "4px" : "8px",
61
- [backdropOpacity]: targetBackdropOpacity,
62
- scale: 1,
63
- opacity: 1,
64
- translateY: 0
65
- },
66
- exit: {
67
- opacity: 0,
68
- scale: .98,
69
- translateY: -20,
70
- [backdropBlur]: "0px",
71
- [backdropOpacity]: "0%"
72
- }
73
- } : { initial: {
75
+ ...motionNotReduced ? motionProps : { initial: {
74
76
  [backdropBlur]: "8px",
75
77
  [backdropOpacity]: targetBackdropOpacity
76
78
  } },
79
+ onDoubleClick: stopPropagation,
80
+ onPointerDown: stopPropagation,
81
+ ...rest,
77
82
  onClick: (e) => {
78
83
  e.stopPropagation();
79
- if (e.target?.nodeName?.toUpperCase() === "DIALOG") {
80
- dialogRef.current?.close();
81
- return;
82
- }
84
+ if (e.target === e.currentTarget) cancelMe();
83
85
  },
84
86
  onCancel: (e) => {
85
87
  e.preventDefault();
86
88
  e.stopPropagation();
87
- close();
89
+ cancelMe();
88
90
  },
89
- onDoubleClick: stopPropagation,
90
- onPointerDown: stopPropagation,
91
- onClose: (e) => {
92
- e.stopPropagation();
93
- close();
91
+ onClose: () => {
92
+ onCloseRef.current?.();
94
93
  },
95
- ...rest,
96
94
  children: /* @__PURE__ */ jsx(RemoveScroll, {
97
95
  forwardProps: true,
98
96
  children: /* @__PURE__ */ jsx("div", {
@@ -5,7 +5,7 @@ import { relationshipDetailsLogic } from "./relationship-details/actor.js";
5
5
  import { isString, last, reverse } from "remeda";
6
6
  import { getHotkeyHandler } from "@mantine/hooks";
7
7
  import { assertEvent, fromCallback, setup } from "xstate";
8
- import { not } from "xstate/guards";
8
+ import "xstate/guards";
9
9
  //#region src/overlays/overlaysActor.ts
10
10
  var machine = setup({
11
11
  types: {
@@ -35,9 +35,8 @@ var machine = setup({
35
35
  },
36
36
  guards: {
37
37
  "has overlays?": ({ context }) => context.overlays.length > 0,
38
- "close specific overlay?": ({ context, event }) => {
39
- assertEvent(event, "close");
40
- return isString(event.actorId) && context.overlays.some((o) => o.id === event.actorId);
38
+ "close specific overlay?": ({ event }) => {
39
+ return event.type === "close" && isString(event.actorId);
41
40
  },
42
41
  "last: is relationshipDetails?": ({ context }) => {
43
42
  return last(context.overlays)?.type === "relationshipDetails";
@@ -176,9 +175,6 @@ var openOverlay = () => machine.enqueueActions(({ enqueue, event }) => {
176
175
  });
177
176
  var listenToEsc = () => machine.spawnChild("hotkey", { id: "hotkey" });
178
177
  var stopListeningToEsc = () => machine.stopChild("hotkey");
179
- var checkState = () => machine.enqueueActions(({ enqueue, context }) => {
180
- if (context.overlays.length === 0) enqueue.raise({ type: "close" });
181
- });
182
178
  var overlaysActorLogic = machine.createMachine({
183
179
  id: "overlays",
184
180
  context: () => ({
@@ -186,34 +182,39 @@ var overlaysActorLogic = machine.createMachine({
186
182
  overlays: []
187
183
  }),
188
184
  initial: "idle",
185
+ on: { "close.all": {
186
+ actions: closeAllOverlays(),
187
+ target: "#idle"
188
+ } },
189
189
  states: {
190
190
  idle: {
191
+ id: "idle",
191
192
  entry: [emitIdle()],
192
193
  on: { "open.*": {
193
194
  actions: openOverlay(),
194
- target: "active"
195
+ target: "opened"
195
196
  } }
196
197
  },
197
- active: {
198
- entry: [listenToEsc()],
199
- exit: [stopListeningToEsc()],
200
- on: {
201
- "open.*": { actions: openOverlay() },
202
- "close": [
203
- {
204
- guard: not("has overlays?"),
205
- target: "idle"
206
- },
207
- {
198
+ opened: {
199
+ entry: listenToEsc(),
200
+ exit: stopListeningToEsc(),
201
+ initial: "hasOverlays",
202
+ states: {
203
+ hasOverlays: { on: {
204
+ "open.*": { actions: openOverlay() },
205
+ "close": [{
208
206
  guard: "close specific overlay?",
209
- actions: [closeSpecificOverlay(), checkState()]
210
- },
211
- { actions: [closeLastOverlay(), checkState()] }
212
- ],
213
- "close.all": {
214
- actions: [closeAllOverlays()],
215
- target: "idle"
216
- }
207
+ actions: closeSpecificOverlay(),
208
+ target: "decide"
209
+ }, {
210
+ actions: closeLastOverlay(),
211
+ target: "decide"
212
+ }]
213
+ } },
214
+ decide: { always: [{
215
+ guard: "has overlays?",
216
+ target: "hasOverlays"
217
+ }, { target: "#idle" }] }
217
218
  }
218
219
  },
219
220
  final: {
@@ -1,10 +1,9 @@
1
1
  import { BaseNodePropsWithData } from '../../../base';
2
2
  import { RelationshipDetailsTypes } from '../_types';
3
- import { FunctionComponent } from 'react';
4
- export declare const ElementNode: FunctionComponent<RelationshipDetailsTypes.NodeProps<"element">>;
5
- export declare const CompoundNode: FunctionComponent<RelationshipDetailsTypes.NodeProps<"compound">>;
3
+ export declare function ElementNode(props: RelationshipDetailsTypes.NodeProps<'element'>): import("react/jsx-runtime").JSX.Element;
4
+ export declare function CompoundNode(props: RelationshipDetailsTypes.NodeProps<'compound'>): import("react/jsx-runtime").JSX.Element;
6
5
  type ElementPortsProps = BaseNodePropsWithData<Pick<RelationshipDetailsTypes.ElementNodeData, 'ports' | 'height'>>;
7
- export declare const ElementPorts: ({ data: { ports, height: h } }: ElementPortsProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare function ElementPorts({ data: { ports, height: h } }: ElementPortsProps): import("react/jsx-runtime").JSX.Element;
8
7
  type CompoundPortsProps = BaseNodePropsWithData<Pick<RelationshipDetailsTypes.CompoundNodeData, 'ports'>>;
9
- export declare const CompoundPorts: ({ data }: CompoundPortsProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare function CompoundPorts({ data }: CompoundPortsProps): import("react/jsx-runtime").JSX.Element;
10
9
  export {};
@@ -9,7 +9,6 @@ import { ElementDetailsButton } from "../../../base-primitives/element/ElementDe
9
9
  import { ElementNodeContainer } from "../../../base-primitives/element/ElementNodeContainer.js";
10
10
  import { ElementShape } from "../../../base-primitives/element/ElementShape.js";
11
11
  import { ElementTags as ElementTags$1 } from "../../../base-primitives/element/ElementTags.js";
12
- import { memoNode } from "../../../base-primitives/memoNode.js";
13
12
  import { ElementActions } from "./ElementActions.js";
14
13
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
14
  import { Handle } from "@xyflow/react";
@@ -34,7 +33,7 @@ var ElementDetailsButtonWithHandler = (props) => {
34
33
  }
35
34
  });
36
35
  };
37
- var ElementNode = memoNode((props) => {
36
+ function ElementNode(props) {
38
37
  const { enableElementTags } = useEnabledFeatures();
39
38
  return /* @__PURE__ */ jsxs(ElementNodeContainer, {
40
39
  nodeProps: props,
@@ -47,8 +46,8 @@ var ElementNode = memoNode((props) => {
47
46
  /* @__PURE__ */ jsx(ElementPorts, { ...props })
48
47
  ]
49
48
  });
50
- });
51
- var CompoundNode = memoNode((props) => {
49
+ }
50
+ function CompoundNode(props) {
52
51
  return /* @__PURE__ */ jsxs(CompoundNodeContainer, {
53
52
  nodeProps: props,
54
53
  children: [
@@ -57,8 +56,8 @@ var CompoundNode = memoNode((props) => {
57
56
  /* @__PURE__ */ jsx(CompoundPorts, { ...props })
58
57
  ]
59
58
  });
60
- });
61
- var ElementPorts = ({ data: { ports, height: h } }) => {
59
+ }
60
+ function ElementPorts({ data: { ports, height: h } }) {
62
61
  return /* @__PURE__ */ jsxs(Fragment, { children: [ports.in.map((id, i) => /* @__PURE__ */ jsx(Handle, {
63
62
  id,
64
63
  type: "target",
@@ -76,23 +75,25 @@ var ElementPorts = ({ data: { ports, height: h } }) => {
76
75
  top: `${15 + (i + 1) * ((h - 30) / (ports.out.length + 1))}px`
77
76
  }
78
77
  }, id))] });
79
- };
80
- var CompoundPorts = ({ data }) => /* @__PURE__ */ jsxs(Fragment, { children: [data.ports.in.map((id, i) => /* @__PURE__ */ jsx(Handle, {
81
- id,
82
- type: "target",
83
- position: Position$1.Left,
84
- style: {
85
- visibility: "hidden",
86
- top: `${20 * (i + 1)}px`
87
- }
88
- }, id)), data.ports.out.map((id, i) => /* @__PURE__ */ jsx(Handle, {
89
- id,
90
- type: "source",
91
- position: Position$1.Right,
92
- style: {
93
- visibility: "hidden",
94
- top: `${20 * (i + 1)}px`
95
- }
96
- }, id))] });
78
+ }
79
+ function CompoundPorts({ data }) {
80
+ return /* @__PURE__ */ jsxs(Fragment, { children: [data.ports.in.map((id, i) => /* @__PURE__ */ jsx(Handle, {
81
+ id,
82
+ type: "target",
83
+ position: Position$1.Left,
84
+ style: {
85
+ visibility: "hidden",
86
+ top: `${20 * (i + 1)}px`
87
+ }
88
+ }, id)), data.ports.out.map((id, i) => /* @__PURE__ */ jsx(Handle, {
89
+ id,
90
+ type: "source",
91
+ position: Position$1.Right,
92
+ style: {
93
+ visibility: "hidden",
94
+ top: `${20 * (i + 1)}px`
95
+ }
96
+ }, id))] });
97
+ }
97
98
  //#endregion
98
99
  export { CompoundNode, ElementNode };
@@ -108,7 +108,7 @@ var SelectElement = memo(() => {
108
108
  paddingBottom: 6
109
109
  }
110
110
  },
111
- renderNode: ({ node, selected, expanded, elementProps, hasChildren }) => /* @__PURE__ */ jsxs(Group, {
111
+ renderNode: ({ node, selected, expanded, elementProps }) => /* @__PURE__ */ jsxs(Group, {
112
112
  gap: 2,
113
113
  wrap: "nowrap",
114
114
  ...elementProps,
@@ -117,7 +117,7 @@ var SelectElement = memo(() => {
117
117
  variant: "subtle",
118
118
  size: 18,
119
119
  c: "dimmed",
120
- style: { visibility: hasChildren ? "visible" : "hidden" },
120
+ style: { visibility: node.hasChildren ? "visible" : "hidden" },
121
121
  children: /* @__PURE__ */ jsx(IconChevronRight, {
122
122
  stroke: 3.5,
123
123
  style: {
@@ -1,10 +1,13 @@
1
- import { MemoExoticComponent } from 'react';
1
+ import { SearchActorRef } from './searchActor';
2
+ import { MemoExoticComponent, ForwardRefExoticComponent, RefAttributes } from 'react';
2
3
  export declare const dialogCss: string;
3
4
  export declare const bodyCss: string;
4
5
  export declare const scrollAreaCss: string;
5
- export declare const Search: MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
6
+ export declare const Search: MemoExoticComponent<({ searchActorRef }: {
7
+ searchActorRef: SearchActorRef;
8
+ }) => import("react/jsx-runtime").JSX.Element>;
6
9
  /**
7
10
  * The shared search panel content used by both diagram and overview search.
8
11
  * Must be rendered inside a SearchContext.Provider.
9
12
  */
10
- export declare const SearchPanelContent: MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
13
+ export declare const SearchPanelContent: ForwardRefExoticComponent<RefAttributes<HTMLDivElement>>;