@likec4/diagram 1.21.1 → 1.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/dist/LikeC4Diagram.js +9 -13
  2. package/dist/base/index.d.ts +0 -1
  3. package/dist/base/primitives/element/styles.css.js +1 -1
  4. package/dist/{base → components}/Link.css.js +3 -3
  5. package/dist/components/SearchControl.css.d.ts +2 -0
  6. package/dist/components/SearchControl.css.js +7 -0
  7. package/dist/components/SearchControl.d.ts +5 -0
  8. package/dist/components/SearchControl.js +17 -0
  9. package/dist/context/DiagramFeatures.d.ts +1 -1
  10. package/dist/context/IconRenderer.d.ts +10 -0
  11. package/dist/context/IconRenderer.js +34 -0
  12. package/dist/hooks/useCurrentViewId.js +8 -0
  13. package/dist/hooks/useDiagram.d.ts +108 -72
  14. package/dist/hooks/useDiagram.js +3 -0
  15. package/dist/likec4diagram/DiagramActor.js +13 -2
  16. package/dist/likec4diagram/DiagramUI.js +0 -2
  17. package/dist/likec4diagram/XYFlow.d.ts +6 -1
  18. package/dist/likec4diagram/XYFlow.js +37 -31
  19. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +2 -1
  20. package/dist/likec4diagram/state/actorContext.d.ts +620 -468
  21. package/dist/likec4diagram/state/assign.js +1 -1
  22. package/dist/likec4diagram/state/machine.d.ts +120 -74
  23. package/dist/likec4diagram/state/machine.js +32 -12
  24. package/dist/likec4diagram/state/syncManualLayoutActor.js +4 -8
  25. package/dist/likec4diagram/ui/controls/Controls.js +65 -48
  26. package/dist/likec4diagram/ui/controls/NavigationButtons.js +44 -69
  27. package/dist/likec4diagram/ui/controls/ToggleReadonly.d.ts +1 -0
  28. package/dist/likec4diagram/ui/controls/ToggleReadonly.js +29 -0
  29. package/dist/likec4diagram/ui/controls/_shared.js +1 -1
  30. package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +1 -1
  31. package/dist/likec4diagram/ui/search/ElementsColumn.css.d.ts +15 -0
  32. package/dist/likec4diagram/ui/search/ElementsColumn.css.js +30 -0
  33. package/dist/likec4diagram/ui/search/ElementsColumn.d.ts +1 -0
  34. package/dist/likec4diagram/ui/search/ElementsColumn.js +243 -0
  35. package/dist/likec4diagram/ui/search/LikeC4Search.css.d.ts +8 -0
  36. package/dist/likec4diagram/ui/search/LikeC4Search.css.js +20 -0
  37. package/dist/likec4diagram/ui/search/LikeC4Search.d.ts +1 -0
  38. package/dist/likec4diagram/ui/search/LikeC4Search.js +265 -0
  39. package/dist/likec4diagram/ui/search/SearchInput.d.ts +1 -0
  40. package/dist/likec4diagram/ui/search/SearchInput.js +196 -0
  41. package/dist/likec4diagram/ui/search/ViewsColum.d.ts +9 -0
  42. package/dist/likec4diagram/ui/search/ViewsColum.js +130 -0
  43. package/dist/likec4diagram/ui/search/ViewsColumn.css.d.ts +5 -0
  44. package/dist/likec4diagram/ui/search/ViewsColumn.css.js +12 -0
  45. package/dist/likec4diagram/ui/search/_shared.css.d.ts +16 -0
  46. package/dist/likec4diagram/ui/search/_shared.css.js +5 -0
  47. package/dist/likec4diagram/ui/search/state.d.ts +19 -0
  48. package/dist/likec4diagram/ui/search/state.js +72 -0
  49. package/dist/likec4diagram/ui/search/utils.d.ts +3 -0
  50. package/dist/likec4diagram/ui/search/utils.js +23 -0
  51. package/dist/likec4diagram/useLayoutConstraints.js +4 -5
  52. package/dist/likec4model/useLikeC4ElementsTree.d.ts +1 -0
  53. package/dist/likec4model/useLikeC4ElementsTree.js +1 -0
  54. package/dist/overlays/Overlays.js +9 -9
  55. package/dist/overlays/element-details/ElementDetailsCard.js +20 -13
  56. package/dist/overlays/overlay/Overlay.d.ts +6 -2
  57. package/dist/overlays/overlay/Overlay.js +18 -29
  58. package/dist/overlays/relationship-details/SelectEdge.js +1 -3
  59. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +6 -5
  60. package/dist/overlays/relationships-browser/SelectElement.js +10 -6
  61. package/dist/overlays/relationships-browser/actor.d.ts +2 -2
  62. package/dist/overlays/relationships-browser/actor.js +8 -8
  63. package/dist/overlays/relationships-browser/custom/nodeTypes.js +2 -2
  64. package/dist/style.css +1 -1
  65. package/package.json +13 -13
  66. package/src/LikeC4Diagram.tsx +0 -1
  67. package/src/base/index.ts +0 -2
  68. package/src/base/primitives/element/styles.css.ts +2 -2
  69. package/src/{base → components}/Link.css.ts +3 -3
  70. package/src/components/SearchControl.css.ts +69 -0
  71. package/src/components/SearchControl.tsx +33 -0
  72. package/src/context/DiagramFeatures.tsx +1 -1
  73. package/src/context/IconRenderer.tsx +54 -1
  74. package/src/globals.css.ts +0 -2
  75. package/src/hooks/useDiagram.ts +5 -0
  76. package/src/likec4diagram/DiagramActor.tsx +15 -2
  77. package/src/likec4diagram/DiagramUI.tsx +0 -4
  78. package/src/likec4diagram/XYFlow.tsx +39 -31
  79. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +2 -1
  80. package/src/likec4diagram/state/assign.ts +1 -1
  81. package/src/likec4diagram/state/machine.ts +40 -14
  82. package/src/likec4diagram/state/syncManualLayoutActor.ts +6 -9
  83. package/src/likec4diagram/ui/controls/Controls.tsx +37 -25
  84. package/src/likec4diagram/ui/controls/NavigationButtons.tsx +36 -58
  85. package/src/likec4diagram/ui/controls/ToggleReadonly.tsx +31 -0
  86. package/src/likec4diagram/ui/controls/styles.css.ts +3 -1
  87. package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +1 -1
  88. package/src/likec4diagram/ui/search/ElementsColumn.css.ts +119 -0
  89. package/src/likec4diagram/ui/search/ElementsColumn.tsx +291 -0
  90. package/src/likec4diagram/ui/search/LikeC4Search.css.ts +117 -0
  91. package/src/likec4diagram/ui/search/LikeC4Search.tsx +312 -0
  92. package/src/likec4diagram/ui/search/SearchInput.tsx +235 -0
  93. package/src/likec4diagram/ui/search/ViewsColum.tsx +158 -0
  94. package/src/likec4diagram/ui/search/ViewsColumn.css.ts +37 -0
  95. package/src/likec4diagram/ui/search/_shared.css.ts +104 -0
  96. package/src/likec4diagram/ui/search/state.ts +76 -0
  97. package/src/likec4diagram/ui/search/utils.ts +20 -0
  98. package/src/likec4diagram/useLayoutConstraints.ts +4 -5
  99. package/src/likec4model/useLikeC4ElementsTree.ts +4 -4
  100. package/src/overlays/Overlays.tsx +31 -25
  101. package/src/overlays/element-details/ElementDetailsCard.css.ts +4 -4
  102. package/src/overlays/element-details/ElementDetailsCard.tsx +245 -240
  103. package/src/overlays/overlay/Overlay.css.ts +10 -9
  104. package/src/overlays/overlay/Overlay.tsx +38 -26
  105. package/src/overlays/relationship-details/SelectEdge.css.ts +1 -0
  106. package/src/overlays/relationship-details/SelectEdge.tsx +2 -4
  107. package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +10 -5
  108. package/src/overlays/relationships-browser/SelectElement.tsx +88 -82
  109. package/src/overlays/relationships-browser/actor.ts +10 -10
  110. package/src/overlays/relationships-browser/custom/nodeTypes.tsx +2 -2
  111. package/dist/LikeC4Search.css.d.ts +0 -1
  112. package/dist/LikeC4Search.css.js +0 -5
  113. package/dist/LikeC4Search.d.ts +0 -2
  114. package/dist/LikeC4Search.js +0 -88
  115. package/src/LikeC4Search.css.ts +0 -12
  116. package/src/LikeC4Search.tsx +0 -91
  117. /package/dist/{base → components}/Link.css.d.ts +0 -0
  118. /package/dist/{base → components}/Link.d.ts +0 -0
  119. /package/dist/{base → components}/Link.js +0 -0
  120. /package/src/{base → components}/Link.tsx +0 -0
@@ -4,7 +4,6 @@ import { useRef } from "react";
4
4
  import { isEmpty } from "remeda";
5
5
  import { LikeC4CustomColors } from "./LikeC4CustomColors.js";
6
6
  import { DiagramActor } from "./likec4diagram/DiagramActor.js";
7
- import { DiagramUI } from "./likec4diagram/DiagramUI.js";
8
7
  import { useViewToNodesEdges } from "./likec4diagram/useViewToNodesEdges.js";
9
8
  import { LikeC4DiagramXYFlow } from "./likec4diagram/XYFlow.js";
10
9
  import { useLikeC4Model } from "./likec4model/useLikeC4Model.js";
@@ -113,7 +112,7 @@ function LikeC4Diagram({
113
112
  {
114
113
  fitView,
115
114
  ...initialRef.current,
116
- children: /* @__PURE__ */ jsxs(
115
+ children: /* @__PURE__ */ jsx(
117
116
  DiagramActor,
118
117
  {
119
118
  input: {
@@ -123,17 +122,14 @@ function LikeC4Diagram({
123
122
  fitViewPadding,
124
123
  ...xyNodesEdges
125
124
  },
126
- children: [
127
- /* @__PURE__ */ jsx(
128
- LikeC4DiagramXYFlow,
129
- {
130
- nodesDraggable,
131
- nodesSelectable,
132
- background
133
- }
134
- ),
135
- /* @__PURE__ */ jsx(DiagramUI, {})
136
- ]
125
+ children: /* @__PURE__ */ jsx(
126
+ LikeC4DiagramXYFlow,
127
+ {
128
+ nodesDraggable,
129
+ nodesSelectable,
130
+ background
131
+ }
132
+ )
137
133
  }
138
134
  )
139
135
  }
@@ -1,3 +1,2 @@
1
1
  export { BaseXYFlow, type BaseXYFlowProps } from './BaseXYFlow';
2
2
  export { Base, type EdgeProps, type NodeProps, type NonOptional, type ReactFlowEdge, type ReactFlowNode, } from './types';
3
- export { Link } from './Link';
@@ -1,6 +1,6 @@
1
1
  /* empty css */
2
2
  /* empty css */
3
- var iconSize = "var(--v7x5jk2)";
3
+ var iconSize = "var(--likec4-icon-size)";
4
4
  export {
5
5
  iconSize
6
6
  };
@@ -1,7 +1,7 @@
1
1
  /* empty css */
2
- var elementLink = "_180738q0";
3
- var linkIcon = "_180738q1";
4
- var linkTitleBox = "_180738q2";
2
+ var elementLink = "_1acgss10";
3
+ var linkIcon = "_1acgss11";
4
+ var linkTitleBox = "_1acgss12";
5
5
  export {
6
6
  elementLink,
7
7
  linkIcon,
@@ -0,0 +1,2 @@
1
+ export declare const root: string;
2
+ export declare const shortcut: string;
@@ -0,0 +1,7 @@
1
+ /* empty css */
2
+ var root = "xmhqho2";
3
+ var shortcut = "xmhqho3";
4
+ export {
5
+ root,
6
+ shortcut
7
+ };
@@ -0,0 +1,5 @@
1
+ import { ElementProps, UnstyledButtonProps } from '@mantine/core';
2
+ interface SearchControlProps extends UnstyledButtonProps, ElementProps<'button'> {
3
+ }
4
+ export declare function SearchControl({ className, ...others }: SearchControlProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,17 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { UnstyledButton, Group, rem, Text } from "@mantine/core";
3
+ import { IconSearch } from "@tabler/icons-react";
4
+ import { isMacOs } from "@xyflow/system";
5
+ import clsx from "clsx";
6
+ import { shortcut, root } from "./SearchControl.css.js";
7
+ function SearchControl({ className, ...others }) {
8
+ const isMac = isMacOs();
9
+ return /* @__PURE__ */ jsx(UnstyledButton, { ...others, className: clsx(root, className), children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
10
+ /* @__PURE__ */ jsx(IconSearch, { style: { width: rem(15), height: rem(15) }, stroke: 2 }),
11
+ /* @__PURE__ */ jsx(Text, { fz: "sm", fw: "500", pr: 50, children: "Search" }),
12
+ /* @__PURE__ */ jsx(Text, { fw: 700, className: shortcut, children: isMac ? "⌘ + K" : "Ctrl + K" })
13
+ ] }) });
14
+ }
15
+ export {
16
+ SearchControl
17
+ };
@@ -1,7 +1,7 @@
1
1
  import { ExclusiveUnion, NonEmptyArray } from '@likec4/core';
2
2
  import { PropsWithChildren } from 'react';
3
3
  declare const FeatureNames: readonly ["Controls", "ReadOnly", "FocusMode", "NavigateTo", "ElementDetails", "RelationshipDetails", "RelationshipBrowser", "Search", "NavigationButtons", "Notations", "DynamicViewWalkthrough", "EdgeEditing", "ViewTitle", "FitView", "LikeC4Model", "Vscode"];
4
- type FeatureName = typeof FeatureNames[number];
4
+ export type FeatureName = typeof FeatureNames[number];
5
5
  export type EnabledFeatures = {
6
6
  [P in `enable${FeatureName}`]: boolean;
7
7
  };
@@ -1,3 +1,4 @@
1
+ import { ElementShape } from '@likec4/core';
1
2
  import { ElementIconRenderer } from '../LikeC4Diagram.props';
2
3
  import { Provider } from 'react';
3
4
  export declare const IconRendererProvider: Provider<ElementIconRenderer | null>;
@@ -9,3 +10,12 @@ export declare function IconRenderer({ element, className, }: {
9
10
  };
10
11
  className: string;
11
12
  }): import("react/jsx-runtime").JSX.Element | null;
13
+ export declare function IconOrShapeRenderer({ element, className, }: {
14
+ element: {
15
+ id: string;
16
+ title: string;
17
+ shape: ElementShape;
18
+ icon?: string | null | undefined;
19
+ };
20
+ className: string;
21
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import { IconCylinder, IconRectangularPrism, IconReorder, IconUser, IconDeviceMobile, IconBrowser } from "@tabler/icons-react";
2
3
  import clsx from "clsx";
3
4
  import { createContext, useContext } from "react";
4
5
  const IconRendererContext = createContext(null);
@@ -32,7 +33,40 @@ function IconRenderer({
32
33
  }
33
34
  );
34
35
  }
36
+ const ShapeIcons = {
37
+ browser: IconBrowser,
38
+ cylinder: IconCylinder,
39
+ mobile: IconDeviceMobile,
40
+ person: IconUser,
41
+ queue: IconReorder,
42
+ rectangle: IconRectangularPrism,
43
+ storage: IconCylinder
44
+ };
45
+ function IconOrShapeRenderer({
46
+ element,
47
+ className
48
+ }) {
49
+ const icon = IconRenderer({
50
+ element,
51
+ className
52
+ });
53
+ if (icon) {
54
+ return icon;
55
+ }
56
+ const ShapeIcon = ShapeIcons[element.shape];
57
+ return /* @__PURE__ */ jsx(
58
+ "div",
59
+ {
60
+ className: clsx(
61
+ className,
62
+ "likec4-shape-icon"
63
+ ),
64
+ children: /* @__PURE__ */ jsx(ShapeIcon, {})
65
+ }
66
+ );
67
+ }
35
68
  export {
69
+ IconOrShapeRenderer,
36
70
  IconRenderer,
37
71
  IconRendererProvider
38
72
  };
@@ -0,0 +1,8 @@
1
+ import { useDiagramContext } from "./useDiagramContext.js";
2
+ const selectViewId = (state) => state.view.id;
3
+ function useCurrentViewId() {
4
+ return useDiagramContext(selectViewId);
5
+ }
6
+ export {
7
+ useCurrentViewId
8
+ };
@@ -1,5 +1,6 @@
1
1
  import { EdgeId, Fqn, NodeId, ViewId, DiagramView, ViewChange, RelationId, Color, RelationshipLineType, NonEmptyArray, Point, RelationshipArrowType, BBox, XYPoint, DiagramNode, DiagramEdge } from '@likec4/core';
2
2
  import { PartialDeep } from 'type-fest';
3
+ import { FeatureName } from '../context/DiagramFeatures';
3
4
  import { OpenSourceParams } from '../LikeC4Diagram.props';
4
5
  import { AlignmentMode } from '../likec4diagram/state/aligners';
5
6
  import { DiagramContext, Events, Input, ActionArg } from '../likec4diagram/state/machine';
@@ -14,7 +15,6 @@ import { ReactNode, CSSProperties } from 'react';
14
15
  import { Input, XYStoreApi, Events } from '../overlays/relationships-browser/actor';
15
16
  import { LayoutRelationshipsViewResult } from '../overlays/relationships-browser/-useRelationshipsView';
16
17
  import { focusedBounds } from '../likec4diagram/state/utils';
17
- import { EnabledFeatures } from '../context';
18
18
  export declare function useDiagram(): {
19
19
  send: (event: Events) => void;
20
20
  navigateTo: (viewId: ViewId, fromNode?: NodeId) => void;
@@ -1028,6 +1028,9 @@ export declare function useDiagram(): {
1028
1028
  enableLikeC4Model: boolean;
1029
1029
  enableVscode: boolean;
1030
1030
  };
1031
+ toggledFeatures: {
1032
+ enableReadOnly: true;
1033
+ };
1031
1034
  initialized: false;
1032
1035
  viewportChangedManually: false;
1033
1036
  lastOnNavigate: null;
@@ -1787,6 +1790,10 @@ export declare function useDiagram(): {
1787
1790
  toPosition: XYPoint;
1788
1791
  };
1789
1792
  };
1793
+ updateFeatures: {
1794
+ type: "updateFeatures";
1795
+ params: NonReducibleUnknown;
1796
+ };
1790
1797
  }>, Values<{
1791
1798
  "enabled: FitView": {
1792
1799
  type: "enabled: FitView";
@@ -4487,6 +4494,10 @@ export declare function useDiagram(): {
4487
4494
  toPosition: XYPoint;
4488
4495
  };
4489
4496
  };
4497
+ updateFeatures: {
4498
+ type: "updateFeatures";
4499
+ params: NonReducibleUnknown;
4500
+ };
4490
4501
  }>, Values<{
4491
4502
  "enabled: FitView": {
4492
4503
  type: "enabled: FitView";
@@ -5731,6 +5742,10 @@ export declare function useDiagram(): {
5731
5742
  toPosition: XYPoint;
5732
5743
  };
5733
5744
  };
5745
+ updateFeatures: {
5746
+ type: "updateFeatures";
5747
+ params: NonReducibleUnknown;
5748
+ };
5734
5749
  }>, Values<{
5735
5750
  "enabled: FitView": {
5736
5751
  type: "enabled: FitView";
@@ -6036,6 +6051,10 @@ export declare function useDiagram(): {
6036
6051
  toPosition: XYPoint;
6037
6052
  };
6038
6053
  };
6054
+ updateFeatures: {
6055
+ type: "updateFeatures";
6056
+ params: NonReducibleUnknown;
6057
+ };
6039
6058
  }>, Values<{
6040
6059
  "enabled: FitView": {
6041
6060
  type: "enabled: FitView";
@@ -7202,6 +7221,10 @@ export declare function useDiagram(): {
7202
7221
  toPosition: XYPoint;
7203
7222
  };
7204
7223
  };
7224
+ updateFeatures: {
7225
+ type: "updateFeatures";
7226
+ params: NonReducibleUnknown;
7227
+ };
7205
7228
  }>, Values<{
7206
7229
  "enabled: FitView": {
7207
7230
  type: "enabled: FitView";
@@ -7515,6 +7538,10 @@ export declare function useDiagram(): {
7515
7538
  toPosition: XYPoint;
7516
7539
  };
7517
7540
  };
7541
+ updateFeatures: {
7542
+ type: "updateFeatures";
7543
+ params: NonReducibleUnknown;
7544
+ };
7518
7545
  }>, Values<{
7519
7546
  "enabled: FitView": {
7520
7547
  type: "enabled: FitView";
@@ -7556,9 +7583,9 @@ export declare function useDiagram(): {
7556
7583
  };
7557
7584
  };
7558
7585
  readonly on: {
7559
- readonly 'xyflow.applyNodeChages': {
7586
+ readonly 'xyflow.applyNodeChanges': {
7560
7587
  readonly actions: ActionFunction<DiagramContext, {
7561
- type: "xyflow.applyNodeChages";
7588
+ type: "xyflow.applyNodeChanges";
7562
7589
  changes: NodeChange<Types.Node>[];
7563
7590
  }, Events, undefined, Values<{
7564
7591
  hotkeyActor: {
@@ -7771,9 +7798,9 @@ export declare function useDiagram(): {
7771
7798
  };
7772
7799
  }>, never, never, never, never>;
7773
7800
  };
7774
- readonly 'xyflow.applyEdgeChages': {
7801
+ readonly 'xyflow.applyEdgeChanges': {
7775
7802
  readonly actions: ActionFunction<DiagramContext, {
7776
- type: "xyflow.applyEdgeChages";
7803
+ type: "xyflow.applyEdgeChanges";
7777
7804
  changes: EdgeChange<Types.Edge>[];
7778
7805
  }, Events, undefined, Values<{
7779
7806
  hotkeyActor: {
@@ -9341,6 +9368,10 @@ export declare function useDiagram(): {
9341
9368
  toPosition: XYPoint;
9342
9369
  };
9343
9370
  };
9371
+ updateFeatures: {
9372
+ type: "updateFeatures";
9373
+ params: NonReducibleUnknown;
9374
+ };
9344
9375
  }>, Values<{
9345
9376
  "enabled: FitView": {
9346
9377
  type: "enabled: FitView";
@@ -9596,10 +9627,10 @@ export declare function useDiagram(): {
9596
9627
  }>, never, never, never, never>;
9597
9628
  };
9598
9629
  readonly 'update.features': {
9599
- readonly actions: ActionFunction<DiagramContext, {
9600
- type: "update.features";
9601
- features: EnabledFeatures;
9602
- }, Events, undefined, Values<{
9630
+ readonly actions: "updateFeatures";
9631
+ };
9632
+ readonly 'update.nodeData': {
9633
+ readonly actions: ActionFunction<DiagramContext, Events, Events, undefined, Values<{
9603
9634
  hotkeyActor: {
9604
9635
  src: "hotkeyActor";
9605
9636
  logic: CallbackActorLogic<AnyEventObject, NonReducibleUnknown, HotKeyEvent>;
@@ -9810,7 +9841,7 @@ export declare function useDiagram(): {
9810
9841
  };
9811
9842
  }>, never, never, never, never>;
9812
9843
  };
9813
- readonly 'update.nodeData': {
9844
+ readonly 'update.edgeData': {
9814
9845
  readonly actions: ActionFunction<DiagramContext, Events, Events, undefined, Values<{
9815
9846
  hotkeyActor: {
9816
9847
  src: "hotkeyActor";
@@ -10022,8 +10053,27 @@ export declare function useDiagram(): {
10022
10053
  };
10023
10054
  }>, never, never, never, never>;
10024
10055
  };
10025
- readonly 'update.edgeData': {
10026
- readonly actions: ActionFunction<DiagramContext, Events, Events, undefined, Values<{
10056
+ readonly 'layout.align': {
10057
+ readonly guard: "not readonly";
10058
+ readonly actions: readonly [{
10059
+ readonly type: "layout.align";
10060
+ readonly params: ({ event }: {
10061
+ context: DiagramContext;
10062
+ event: {
10063
+ type: "layout.align";
10064
+ mode: AlignmentMode;
10065
+ };
10066
+ }) => {
10067
+ mode: AlignmentMode;
10068
+ };
10069
+ }, ActionFunction<DiagramContext, {
10070
+ type: "layout.align";
10071
+ mode: AlignmentMode;
10072
+ }, Events, undefined, never, never, never, never, never>];
10073
+ };
10074
+ readonly 'layout.resetEdgeControlPoints': {
10075
+ readonly guard: "not readonly";
10076
+ readonly actions: readonly [ ActionFunction<DiagramContext, Events, Events, undefined, Values<{
10027
10077
  hotkeyActor: {
10028
10078
  src: "hotkeyActor";
10029
10079
  logic: CallbackActorLogic<AnyEventObject, NonReducibleUnknown, HotKeyEvent>;
@@ -10232,29 +10282,26 @@ export declare function useDiagram(): {
10232
10282
  }, "active", any, any, any>, Events, Input, any, any>;
10233
10283
  id: "relationshipsBrowser";
10234
10284
  };
10235
- }>, never, never, never, never>;
10285
+ }>, never, never, never, never>, ActionFunction<DiagramContext, {
10286
+ type: "layout.resetEdgeControlPoints";
10287
+ }, Events, undefined, never, never, never, never, never>];
10236
10288
  };
10237
- readonly 'layout.align': {
10238
- readonly guard: "not readonly";
10239
- readonly actions: readonly [{
10240
- readonly type: "layout.align";
10241
- readonly params: ({ event }: {
10242
- context: DiagramContext;
10243
- event: {
10244
- type: "layout.align";
10245
- mode: AlignmentMode;
10246
- };
10247
- }) => {
10248
- mode: AlignmentMode;
10249
- };
10250
- }, ActionFunction<DiagramContext, {
10251
- type: "layout.align";
10252
- mode: AlignmentMode;
10289
+ readonly 'xyflow.resized': {
10290
+ readonly guard: ({ context }: {
10291
+ context: DiagramContext;
10292
+ }) => boolean;
10293
+ readonly actions: readonly [ CancelAction<DiagramContext, {
10294
+ type: "xyflow.resized";
10295
+ }, undefined, Events>, ActionFunction<DiagramContext, {
10296
+ type: "xyflow.resized";
10253
10297
  }, Events, undefined, never, never, never, never, never>];
10254
10298
  };
10255
- readonly 'layout.resetEdgeControlPoints': {
10256
- readonly guard: "not readonly";
10257
- readonly actions: readonly [ ActionFunction<DiagramContext, Events, Events, undefined, Values<{
10299
+ readonly 'open.elementDetails': {
10300
+ readonly actions: ActionFunction<DiagramContext, {
10301
+ type: "open.elementDetails";
10302
+ fqn: Fqn;
10303
+ fromNode?: NodeId | undefined;
10304
+ }, Events, undefined, Values<{
10258
10305
  hotkeyActor: {
10259
10306
  src: "hotkeyActor";
10260
10307
  logic: CallbackActorLogic<AnyEventObject, NonReducibleUnknown, HotKeyEvent>;
@@ -10463,25 +10510,37 @@ export declare function useDiagram(): {
10463
10510
  }, "active", any, any, any>, Events, Input, any, any>;
10464
10511
  id: "relationshipsBrowser";
10465
10512
  };
10466
- }>, never, never, never, never>, ActionFunction<DiagramContext, {
10467
- type: "layout.resetEdgeControlPoints";
10468
- }, Events, undefined, never, never, never, never, never>];
10513
+ }>, never, never, never, never>;
10514
+ readonly target: ".overlay.elementDetails";
10469
10515
  };
10470
- readonly 'xyflow.resized': {
10471
- readonly guard: ({ context }: {
10472
- context: DiagramContext;
10473
- }) => boolean;
10474
- readonly actions: readonly [ CancelAction<DiagramContext, {
10475
- type: "xyflow.resized";
10476
- }, undefined, Events>, ActionFunction<DiagramContext, {
10477
- type: "xyflow.resized";
10478
- }, Events, undefined, never, never, never, never, never>];
10516
+ readonly 'open.relationshipDetails': {
10517
+ readonly target: ".overlay.relationshipDetails";
10479
10518
  };
10480
- readonly 'open.elementDetails': {
10519
+ readonly 'open.relationshipsBrowser': {
10520
+ readonly target: ".overlay.relationshipsBrowser";
10521
+ };
10522
+ readonly 'open.source': {
10523
+ readonly actions: {
10524
+ readonly type: "trigger:OpenSource";
10525
+ readonly params: (data: {
10526
+ context: DiagramContext;
10527
+ event: {
10528
+ type: "open.source";
10529
+ } & OpenSourceParams;
10530
+ }) => {
10531
+ type: "open.source";
10532
+ } & OpenSourceParams;
10533
+ };
10534
+ };
10535
+ readonly 'walkthrough.start': {
10536
+ readonly guard: "is dynamic view";
10537
+ readonly target: ".walkthrough";
10538
+ };
10539
+ readonly 'toggle.feature': {
10481
10540
  readonly actions: ActionFunction<DiagramContext, {
10482
- type: "open.elementDetails";
10483
- fqn: Fqn;
10484
- fromNode?: NodeId | undefined;
10541
+ type: "toggle.feature";
10542
+ feature: FeatureName;
10543
+ forceValue?: boolean;
10485
10544
  }, Events, undefined, Values<{
10486
10545
  hotkeyActor: {
10487
10546
  src: "hotkeyActor";
@@ -10692,30 +10751,6 @@ export declare function useDiagram(): {
10692
10751
  id: "relationshipsBrowser";
10693
10752
  };
10694
10753
  }>, never, never, never, never>;
10695
- readonly target: ".overlay.elementDetails";
10696
- };
10697
- readonly 'open.relationshipDetails': {
10698
- readonly target: ".overlay.relationshipDetails";
10699
- };
10700
- readonly 'open.relationshipsBrowser': {
10701
- readonly target: ".overlay.relationshipsBrowser";
10702
- };
10703
- readonly 'open.source': {
10704
- readonly actions: {
10705
- readonly type: "trigger:OpenSource";
10706
- readonly params: (data: {
10707
- context: DiagramContext;
10708
- event: {
10709
- type: "open.source";
10710
- } & OpenSourceParams;
10711
- }) => {
10712
- type: "open.source";
10713
- } & OpenSourceParams;
10714
- };
10715
- };
10716
- readonly 'walkthrough.start': {
10717
- readonly guard: "is dynamic view";
10718
- readonly target: ".walkthrough";
10719
10754
  };
10720
10755
  };
10721
10756
  readonly exit: readonly [ StopAction<DiagramContext, Events, undefined, Events>, StopAction<DiagramContext, Events, undefined, Events>, ActionFunction<DiagramContext, Events, Events, undefined, Values<{
@@ -10944,4 +10979,5 @@ export declare function useDiagram(): {
10944
10979
  startWalkthrough: () => void;
10945
10980
  walkthroughStep: (direction?: "next" | "previous") => void;
10946
10981
  stopWalkthrough: () => void;
10982
+ toggleFeature: (feature: FeatureName, forceValue?: boolean) => void;
10947
10983
  };
@@ -111,6 +111,9 @@ function useDiagram() {
111
111
  },
112
112
  stopWalkthrough: () => {
113
113
  actor.send({ type: "walkthrough.end" });
114
+ },
115
+ toggleFeature: (feature, forceValue) => {
116
+ actor.send({ type: "toggle.feature", feature, ...forceValue !== void 0 && { forceValue } });
114
117
  }
115
118
  }), [actor]);
116
119
  }
@@ -5,10 +5,11 @@ import { useEffect } from "react";
5
5
  import { useDiagramActor } from "../hooks/useDiagramActor.js";
6
6
  import { useUpdateEffect } from "../hooks/useUpdateEffect.js";
7
7
  import { LikeC4ViewMachineContextProvider } from "./state/actorContext.js";
8
+ import { useDiagramContext } from "../hooks/useDiagramContext.js";
8
9
  import { diagramMachine } from "./state/machine.js";
9
10
  import { syncManualLayoutActor } from "./state/syncManualLayoutActor.js";
10
11
  import { useDiagramEventHandlers } from "../context/DiagramEventHandlers.js";
11
- import { useEnabledFeatures } from "../context/DiagramFeatures.js";
12
+ import { useEnabledFeatures, DiagramFeatures } from "../context/DiagramFeatures.js";
12
13
  function DiagramActor({ input, children }) {
13
14
  const { onNavigateTo, onOpenSource, onChange } = useDiagramEventHandlers();
14
15
  const xystore = useStoreApi();
@@ -47,7 +48,7 @@ function DiagramActor({ input, children }) {
47
48
  },
48
49
  children: [
49
50
  /* @__PURE__ */ jsx(SyncStore, { input }),
50
- children
51
+ /* @__PURE__ */ jsx(DiagramActorToggledFeatures, { children })
51
52
  ]
52
53
  }
53
54
  );
@@ -66,6 +67,16 @@ const SyncStore = ({ input: { view, xyedges, xynodes, ...inputs } }) => {
66
67
  }, [send, view, xyedges, xynodes]);
67
68
  return null;
68
69
  };
70
+ function DiagramActorToggledFeatures({ children }) {
71
+ const toggledFeatures = useDiagramContext((s) => s.toggledFeatures);
72
+ return /* @__PURE__ */ jsx(
73
+ DiagramFeatures,
74
+ {
75
+ overrides: toggledFeatures,
76
+ children
77
+ }
78
+ );
79
+ }
69
80
  export {
70
81
  DiagramActor
71
82
  };
@@ -1,5 +1,4 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
- import { LikeC4Search } from "../LikeC4Search.js";
3
2
  import { Overlays } from "../overlays/Overlays.js";
4
3
  import { Controls } from "./ui/controls/Controls.js";
5
4
  import { IfEnabled } from "../context/DiagramFeatures.js";
@@ -10,7 +9,6 @@ function DiagramUI() {
10
9
  return /* @__PURE__ */ jsxs(Fragment, { children: [
11
10
  /* @__PURE__ */ jsx(Controls, {}),
12
11
  /* @__PURE__ */ jsx(Overlays, {}),
13
- /* @__PURE__ */ jsx(IfEnabled, { feature: "Search", children: /* @__PURE__ */ jsx(LikeC4Search, {}) }),
14
12
  /* @__PURE__ */ jsx(IfEnabled, { feature: "ViewTitle", children: /* @__PURE__ */ jsx(DiagramTitlePanel, {}) }),
15
13
  /* @__PURE__ */ jsx(IfEnabled, { feature: "Notations", children: /* @__PURE__ */ jsx(NotationPanel, {}) }),
16
14
  /* @__PURE__ */ jsx(IfEnabled, { feature: "DynamicViewWalkthrough", children: /* @__PURE__ */ jsx(DynamicViewWalkthrough, {}) })
@@ -1,6 +1,11 @@
1
1
  import { EnforceOptional } from 'type-fest/source/enforce-optional';
2
2
  import { LikeC4DiagramProperties } from '../LikeC4Diagram.props';
3
+ import { NamedExoticComponent } from 'react';
3
4
  type Picked = EnforceOptional<Pick<LikeC4DiagramProperties, 'background' | 'nodesDraggable' | 'nodesSelectable'>>;
4
5
  export type LikeC4DiagramXYFlowProps = Required<Picked>;
5
- export declare const LikeC4DiagramXYFlow: ({ background, ...rest }: LikeC4DiagramXYFlowProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const LikeC4DiagramXYFlow: NamedExoticComponent<Required<{
7
+ background?: "solid" | "transparent" | "dots" | "lines" | "cross";
8
+ nodesDraggable?: boolean;
9
+ nodesSelectable?: boolean;
10
+ }>>;
6
11
  export {};