@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
@@ -277,7 +277,7 @@ function resetEdgeControlPoints({ context }) {
277
277
  if (!sourceCenter || !targetCenter) {
278
278
  return [];
279
279
  }
280
- if (source == target) {
280
+ if (source === target) {
281
281
  const loopSize = 80;
282
282
  const centerOfTopBoundary = new VectorImpl(0, source.height || 0).mul(-0.5).add(sourceCenter);
283
283
  return [
@@ -1,8 +1,9 @@
1
- import { BBox, DiagramView, EdgeId, Fqn, NodeId, RelationId, StepEdgeId, ViewChange, ViewId, XYPoint, DiagramNode, Color, RelationshipLineType, NonEmptyArray } from '@likec4/core';
1
+ import { BBox, DiagramView, EdgeId, Fqn, NodeId, StepEdgeId, ViewChange, ViewId, XYPoint, DiagramNode, RelationId, Color, RelationshipLineType, NonEmptyArray } from '@likec4/core';
2
2
  import { ReactFlowInstance, useStoreApi, GeneralHelpers, ViewportHelperFunctions } from '@xyflow/react';
3
3
  import { EdgeChange, NodeChange, Rect, Viewport, EdgeMarkerType, HandleType } from '@xyflow/system';
4
4
  import { ActorRefFromLogic, SnapshotFrom, StateMachine, CallbackActorLogic, AnyEventObject, NonReducibleUnknown, EventObject, MetaObject, AnyActorLogic, ConditionalRequired, InputFrom, RequiredLogicInput, IsNotNever, ActorRef, MachineSnapshot, AnyActorRef, StateValue, ActionFunction, ActorLogic, Values, RequiredActorOptions, GetConcreteByKey, StopAction, CancelAction } from 'xstate';
5
5
  import { EnabledFeatures } from '../../context';
6
+ import { FeatureName } from '../../context/DiagramFeatures';
6
7
  import { OpenSourceParams } from '../../LikeC4Diagram.props';
7
8
  import { Types } from '../types';
8
9
  import { AlignmentMode } from './aligners';
@@ -31,8 +32,10 @@ export interface Input {
31
32
  pannable: boolean;
32
33
  fitViewPadding: number;
33
34
  }
35
+ type ToggledFeatures = Partial<EnabledFeatures>;
34
36
  export interface DiagramContext extends Input {
35
37
  features: EnabledFeatures;
38
+ toggledFeatures: ToggledFeatures;
36
39
  initialized: boolean;
37
40
  viewport: Viewport;
38
41
  viewportChangedManually: boolean;
@@ -70,10 +73,10 @@ export type Events = HotKeyEvent | {
70
73
  type: 'xyflow.init';
71
74
  instance: ReactFlowInstance<Types.Node, Types.Edge>;
72
75
  } | {
73
- type: 'xyflow.applyNodeChages';
76
+ type: 'xyflow.applyNodeChanges';
74
77
  changes: NodeChange<Types.Node>[];
75
78
  } | {
76
- type: 'xyflow.applyEdgeChages';
79
+ type: 'xyflow.applyEdgeChanges';
77
80
  changes: EdgeChange<Types.Edge>[];
78
81
  } | {
79
82
  type: 'xyflow.viewportMoved';
@@ -156,6 +159,10 @@ export type Events = HotKeyEvent | {
156
159
  direction: 'next' | 'previous';
157
160
  } | {
158
161
  type: 'walkthrough.end';
162
+ } | {
163
+ type: 'toggle.feature';
164
+ feature: FeatureName;
165
+ forceValue?: boolean;
159
166
  };
160
167
  export type ActionArg = {
161
168
  context: DiagramContext;
@@ -614,6 +621,10 @@ export declare const diagramMachine: StateMachine<DiagramContext, Events, {
614
621
  toPosition: XYPoint;
615
622
  };
616
623
  };
624
+ updateFeatures: {
625
+ type: "updateFeatures";
626
+ params: NonReducibleUnknown;
627
+ };
617
628
  }>, Values<{
618
629
  "enabled: FitView": {
619
630
  type: "enabled: FitView";
@@ -1444,6 +1455,9 @@ export declare const diagramMachine: StateMachine<DiagramContext, Events, {
1444
1455
  enableLikeC4Model: boolean;
1445
1456
  enableVscode: boolean;
1446
1457
  };
1458
+ toggledFeatures: {
1459
+ enableReadOnly: true;
1460
+ };
1447
1461
  initialized: false;
1448
1462
  viewportChangedManually: false;
1449
1463
  lastOnNavigate: null;
@@ -1831,6 +1845,10 @@ export declare const diagramMachine: StateMachine<DiagramContext, Events, {
1831
1845
  toPosition: XYPoint;
1832
1846
  };
1833
1847
  };
1848
+ updateFeatures: {
1849
+ type: "updateFeatures";
1850
+ params: NonReducibleUnknown;
1851
+ };
1834
1852
  }>, Values<{
1835
1853
  "enabled: FitView": {
1836
1854
  type: "enabled: FitView";
@@ -4531,6 +4549,10 @@ export declare const diagramMachine: StateMachine<DiagramContext, Events, {
4531
4549
  toPosition: XYPoint;
4532
4550
  };
4533
4551
  };
4552
+ updateFeatures: {
4553
+ type: "updateFeatures";
4554
+ params: NonReducibleUnknown;
4555
+ };
4534
4556
  }>, Values<{
4535
4557
  "enabled: FitView": {
4536
4558
  type: "enabled: FitView";
@@ -5775,6 +5797,10 @@ export declare const diagramMachine: StateMachine<DiagramContext, Events, {
5775
5797
  toPosition: XYPoint;
5776
5798
  };
5777
5799
  };
5800
+ updateFeatures: {
5801
+ type: "updateFeatures";
5802
+ params: NonReducibleUnknown;
5803
+ };
5778
5804
  }>, Values<{
5779
5805
  "enabled: FitView": {
5780
5806
  type: "enabled: FitView";
@@ -6080,6 +6106,10 @@ export declare const diagramMachine: StateMachine<DiagramContext, Events, {
6080
6106
  toPosition: XYPoint;
6081
6107
  };
6082
6108
  };
6109
+ updateFeatures: {
6110
+ type: "updateFeatures";
6111
+ params: NonReducibleUnknown;
6112
+ };
6083
6113
  }>, Values<{
6084
6114
  "enabled: FitView": {
6085
6115
  type: "enabled: FitView";
@@ -7246,6 +7276,10 @@ export declare const diagramMachine: StateMachine<DiagramContext, Events, {
7246
7276
  toPosition: XYPoint;
7247
7277
  };
7248
7278
  };
7279
+ updateFeatures: {
7280
+ type: "updateFeatures";
7281
+ params: NonReducibleUnknown;
7282
+ };
7249
7283
  }>, Values<{
7250
7284
  "enabled: FitView": {
7251
7285
  type: "enabled: FitView";
@@ -7559,6 +7593,10 @@ export declare const diagramMachine: StateMachine<DiagramContext, Events, {
7559
7593
  toPosition: XYPoint;
7560
7594
  };
7561
7595
  };
7596
+ updateFeatures: {
7597
+ type: "updateFeatures";
7598
+ params: NonReducibleUnknown;
7599
+ };
7562
7600
  }>, Values<{
7563
7601
  "enabled: FitView": {
7564
7602
  type: "enabled: FitView";
@@ -7600,9 +7638,9 @@ export declare const diagramMachine: StateMachine<DiagramContext, Events, {
7600
7638
  };
7601
7639
  };
7602
7640
  readonly on: {
7603
- readonly 'xyflow.applyNodeChages': {
7641
+ readonly 'xyflow.applyNodeChanges': {
7604
7642
  readonly actions: ActionFunction<DiagramContext, {
7605
- type: "xyflow.applyNodeChages";
7643
+ type: "xyflow.applyNodeChanges";
7606
7644
  changes: NodeChange<Types.Node>[];
7607
7645
  }, Events, undefined, Values<{
7608
7646
  hotkeyActor: {
@@ -7815,9 +7853,9 @@ export declare const diagramMachine: StateMachine<DiagramContext, Events, {
7815
7853
  };
7816
7854
  }>, never, never, never, never>;
7817
7855
  };
7818
- readonly 'xyflow.applyEdgeChages': {
7856
+ readonly 'xyflow.applyEdgeChanges': {
7819
7857
  readonly actions: ActionFunction<DiagramContext, {
7820
- type: "xyflow.applyEdgeChages";
7858
+ type: "xyflow.applyEdgeChanges";
7821
7859
  changes: EdgeChange<Types.Edge>[];
7822
7860
  }, Events, undefined, Values<{
7823
7861
  hotkeyActor: {
@@ -9385,6 +9423,10 @@ export declare const diagramMachine: StateMachine<DiagramContext, Events, {
9385
9423
  toPosition: XYPoint;
9386
9424
  };
9387
9425
  };
9426
+ updateFeatures: {
9427
+ type: "updateFeatures";
9428
+ params: NonReducibleUnknown;
9429
+ };
9388
9430
  }>, Values<{
9389
9431
  "enabled: FitView": {
9390
9432
  type: "enabled: FitView";
@@ -9640,10 +9682,10 @@ export declare const diagramMachine: StateMachine<DiagramContext, Events, {
9640
9682
  }>, never, never, never, never>;
9641
9683
  };
9642
9684
  readonly 'update.features': {
9643
- readonly actions: ActionFunction<DiagramContext, {
9644
- type: "update.features";
9645
- features: EnabledFeatures;
9646
- }, Events, undefined, Values<{
9685
+ readonly actions: "updateFeatures";
9686
+ };
9687
+ readonly 'update.nodeData': {
9688
+ readonly actions: ActionFunction<DiagramContext, Events, Events, undefined, Values<{
9647
9689
  hotkeyActor: {
9648
9690
  src: "hotkeyActor";
9649
9691
  logic: CallbackActorLogic<AnyEventObject, NonReducibleUnknown, HotKeyEvent>;
@@ -9854,7 +9896,7 @@ export declare const diagramMachine: StateMachine<DiagramContext, Events, {
9854
9896
  };
9855
9897
  }>, never, never, never, never>;
9856
9898
  };
9857
- readonly 'update.nodeData': {
9899
+ readonly 'update.edgeData': {
9858
9900
  readonly actions: ActionFunction<DiagramContext, Events, Events, undefined, Values<{
9859
9901
  hotkeyActor: {
9860
9902
  src: "hotkeyActor";
@@ -10066,8 +10108,27 @@ export declare const diagramMachine: StateMachine<DiagramContext, Events, {
10066
10108
  };
10067
10109
  }>, never, never, never, never>;
10068
10110
  };
10069
- readonly 'update.edgeData': {
10070
- readonly actions: ActionFunction<DiagramContext, Events, Events, undefined, Values<{
10111
+ readonly 'layout.align': {
10112
+ readonly guard: "not readonly";
10113
+ readonly actions: readonly [{
10114
+ readonly type: "layout.align";
10115
+ readonly params: ({ event }: {
10116
+ context: DiagramContext;
10117
+ event: {
10118
+ type: "layout.align";
10119
+ mode: AlignmentMode;
10120
+ };
10121
+ }) => {
10122
+ mode: AlignmentMode;
10123
+ };
10124
+ }, ActionFunction<DiagramContext, {
10125
+ type: "layout.align";
10126
+ mode: AlignmentMode;
10127
+ }, Events, undefined, never, never, never, never, never>];
10128
+ };
10129
+ readonly 'layout.resetEdgeControlPoints': {
10130
+ readonly guard: "not readonly";
10131
+ readonly actions: readonly [ ActionFunction<DiagramContext, Events, Events, undefined, Values<{
10071
10132
  hotkeyActor: {
10072
10133
  src: "hotkeyActor";
10073
10134
  logic: CallbackActorLogic<AnyEventObject, NonReducibleUnknown, HotKeyEvent>;
@@ -10276,29 +10337,26 @@ export declare const diagramMachine: StateMachine<DiagramContext, Events, {
10276
10337
  }, "active", any, any, any>, Events, Input, any, any>;
10277
10338
  id: "relationshipsBrowser";
10278
10339
  };
10279
- }>, never, never, never, never>;
10340
+ }>, never, never, never, never>, ActionFunction<DiagramContext, {
10341
+ type: "layout.resetEdgeControlPoints";
10342
+ }, Events, undefined, never, never, never, never, never>];
10280
10343
  };
10281
- readonly 'layout.align': {
10282
- readonly guard: "not readonly";
10283
- readonly actions: readonly [{
10284
- readonly type: "layout.align";
10285
- readonly params: ({ event }: {
10286
- context: DiagramContext;
10287
- event: {
10288
- type: "layout.align";
10289
- mode: AlignmentMode;
10290
- };
10291
- }) => {
10292
- mode: AlignmentMode;
10293
- };
10294
- }, ActionFunction<DiagramContext, {
10295
- type: "layout.align";
10296
- mode: AlignmentMode;
10344
+ readonly 'xyflow.resized': {
10345
+ readonly guard: ({ context }: {
10346
+ context: DiagramContext;
10347
+ }) => boolean;
10348
+ readonly actions: readonly [ CancelAction<DiagramContext, {
10349
+ type: "xyflow.resized";
10350
+ }, undefined, Events>, ActionFunction<DiagramContext, {
10351
+ type: "xyflow.resized";
10297
10352
  }, Events, undefined, never, never, never, never, never>];
10298
10353
  };
10299
- readonly 'layout.resetEdgeControlPoints': {
10300
- readonly guard: "not readonly";
10301
- readonly actions: readonly [ ActionFunction<DiagramContext, Events, Events, undefined, Values<{
10354
+ readonly 'open.elementDetails': {
10355
+ readonly actions: ActionFunction<DiagramContext, {
10356
+ type: "open.elementDetails";
10357
+ fqn: Fqn;
10358
+ fromNode?: NodeId | undefined;
10359
+ }, Events, undefined, Values<{
10302
10360
  hotkeyActor: {
10303
10361
  src: "hotkeyActor";
10304
10362
  logic: CallbackActorLogic<AnyEventObject, NonReducibleUnknown, HotKeyEvent>;
@@ -10507,25 +10565,37 @@ export declare const diagramMachine: StateMachine<DiagramContext, Events, {
10507
10565
  }, "active", any, any, any>, Events, Input, any, any>;
10508
10566
  id: "relationshipsBrowser";
10509
10567
  };
10510
- }>, never, never, never, never>, ActionFunction<DiagramContext, {
10511
- type: "layout.resetEdgeControlPoints";
10512
- }, Events, undefined, never, never, never, never, never>];
10568
+ }>, never, never, never, never>;
10569
+ readonly target: ".overlay.elementDetails";
10513
10570
  };
10514
- readonly 'xyflow.resized': {
10515
- readonly guard: ({ context }: {
10516
- context: DiagramContext;
10517
- }) => boolean;
10518
- readonly actions: readonly [ CancelAction<DiagramContext, {
10519
- type: "xyflow.resized";
10520
- }, undefined, Events>, ActionFunction<DiagramContext, {
10521
- type: "xyflow.resized";
10522
- }, Events, undefined, never, never, never, never, never>];
10571
+ readonly 'open.relationshipDetails': {
10572
+ readonly target: ".overlay.relationshipDetails";
10523
10573
  };
10524
- readonly 'open.elementDetails': {
10574
+ readonly 'open.relationshipsBrowser': {
10575
+ readonly target: ".overlay.relationshipsBrowser";
10576
+ };
10577
+ readonly 'open.source': {
10578
+ readonly actions: {
10579
+ readonly type: "trigger:OpenSource";
10580
+ readonly params: (data: {
10581
+ context: DiagramContext;
10582
+ event: {
10583
+ type: "open.source";
10584
+ } & OpenSourceParams;
10585
+ }) => {
10586
+ type: "open.source";
10587
+ } & OpenSourceParams;
10588
+ };
10589
+ };
10590
+ readonly 'walkthrough.start': {
10591
+ readonly guard: "is dynamic view";
10592
+ readonly target: ".walkthrough";
10593
+ };
10594
+ readonly 'toggle.feature': {
10525
10595
  readonly actions: ActionFunction<DiagramContext, {
10526
- type: "open.elementDetails";
10527
- fqn: Fqn;
10528
- fromNode?: NodeId | undefined;
10596
+ type: "toggle.feature";
10597
+ feature: FeatureName;
10598
+ forceValue?: boolean;
10529
10599
  }, Events, undefined, Values<{
10530
10600
  hotkeyActor: {
10531
10601
  src: "hotkeyActor";
@@ -10736,30 +10806,6 @@ export declare const diagramMachine: StateMachine<DiagramContext, Events, {
10736
10806
  id: "relationshipsBrowser";
10737
10807
  };
10738
10808
  }>, never, never, never, never>;
10739
- readonly target: ".overlay.elementDetails";
10740
- };
10741
- readonly 'open.relationshipDetails': {
10742
- readonly target: ".overlay.relationshipDetails";
10743
- };
10744
- readonly 'open.relationshipsBrowser': {
10745
- readonly target: ".overlay.relationshipsBrowser";
10746
- };
10747
- readonly 'open.source': {
10748
- readonly actions: {
10749
- readonly type: "trigger:OpenSource";
10750
- readonly params: (data: {
10751
- context: DiagramContext;
10752
- event: {
10753
- type: "open.source";
10754
- } & OpenSourceParams;
10755
- }) => {
10756
- type: "open.source";
10757
- } & OpenSourceParams;
10758
- };
10759
- };
10760
- readonly 'walkthrough.start': {
10761
- readonly guard: "is dynamic view";
10762
- readonly target: ".walkthrough";
10763
10809
  };
10764
10810
  };
10765
10811
  readonly exit: readonly [ StopAction<DiagramContext, Events, undefined, Events>, StopAction<DiagramContext, Events, undefined, Events>, ActionFunction<DiagramContext, Events, Events, undefined, Values<{
@@ -2,7 +2,7 @@ import { nonNullable, invariant, nonexhaustive, getBBoxCenter, getParallelStepsP
2
2
  import { getViewportForBounds, applyEdgeChanges, applyNodeChanges } from "@xyflow/react";
3
3
  import { nodeToRect } from "@xyflow/system";
4
4
  import { hasAtLeast, prop, clamp, first } from "remeda";
5
- import { setup, assertEvent, stopChild, assign, cancel, raise, enqueueActions, spawnChild, sendTo, and, or } from "xstate";
5
+ import { setup, assign, assertEvent, stopChild, cancel, raise, enqueueActions, spawnChild, sendTo, and, or } from "xstate";
6
6
  import { MinZoom } from "../../base/const.js";
7
7
  import { AllDisabled } from "../../context/DiagramFeatures.js";
8
8
  import { relationshipDetailsActor } from "../../overlays/relationship-details/actor.js";
@@ -143,13 +143,24 @@ const diagramMachine = setup({
143
143
  };
144
144
  });
145
145
  });
146
- }
146
+ },
147
+ "updateFeatures": assign(({ event }) => {
148
+ assertEvent(event, "update.features");
149
+ return {
150
+ features: {
151
+ ...event.features
152
+ }
153
+ };
154
+ })
147
155
  }
148
156
  }).createMachine({
149
157
  initial: "initializing",
150
158
  context: ({ input, self, spawn }) => ({
151
159
  ...input,
152
160
  features: { ...AllDisabled },
161
+ toggledFeatures: {
162
+ enableReadOnly: true
163
+ },
153
164
  initialized: false,
154
165
  viewportChangedManually: false,
155
166
  lastOnNavigate: null,
@@ -472,7 +483,7 @@ const diagramMachine = setup({
472
483
  pending: {
473
484
  entry: enqueueActions(({ enqueue }) => {
474
485
  enqueue.sendTo((c) => c.context.syncLayoutActorRef, { type: "stop" });
475
- enqueue.stopChild("layout");
486
+ enqueue.stopChild("syncLayout");
476
487
  enqueue({
477
488
  type: "trigger:NavigateTo",
478
489
  params: ({ context }) => ({
@@ -495,15 +506,16 @@ const diagramMachine = setup({
495
506
  }
496
507
  }
497
508
  });
509
+ enqueue.raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 80 });
498
510
  } else {
499
511
  enqueue({
500
512
  type: "xyflow:setViewportCenter",
501
513
  params: getBBoxCenter(event.view.bounds)
502
514
  });
515
+ enqueue.raise({ type: "fitDiagram", duration: 200 }, { id: "fitDiagram", delay: 25 });
503
516
  }
504
517
  enqueue.assign(updateNavigationHistory);
505
518
  enqueue.assign(mergeXYNodesEdges);
506
- enqueue.raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 75 });
507
519
  }),
508
520
  target: "done"
509
521
  }
@@ -602,12 +614,12 @@ const diagramMachine = setup({
602
614
  }
603
615
  },
604
616
  on: {
605
- "xyflow.applyNodeChages": {
617
+ "xyflow.applyNodeChanges": {
606
618
  actions: assign({
607
619
  xynodes: ({ context, event }) => applyNodeChanges(event.changes, context.xynodes)
608
620
  })
609
621
  },
610
- "xyflow.applyEdgeChages": {
622
+ "xyflow.applyEdgeChanges": {
611
623
  actions: assign({
612
624
  xyedges: ({ context, event }) => applyEdgeChanges(event.changes, context.xyedges)
613
625
  })
@@ -673,17 +685,19 @@ const diagramMachine = setup({
673
685
  }
674
686
  }
675
687
  });
688
+ enqueue.raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 80 });
676
689
  } else {
677
690
  enqueue({
678
691
  type: "xyflow:setViewportCenter",
679
692
  params: getBBoxCenter(event.view.bounds)
680
693
  });
694
+ enqueue.raise({ type: "fitDiagram", duration: 200 }, { id: "fitDiagram", delay: 25 });
681
695
  }
682
696
  } else {
683
697
  enqueue.sendTo((c) => c.context.syncLayoutActorRef, { type: "synced" });
684
- }
685
- if (isAnotherView || !context.viewportChangedManually) {
686
- enqueue.raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 90 });
698
+ if (!context.viewportChangedManually) {
699
+ enqueue.raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 50 });
700
+ }
687
701
  }
688
702
  enqueue.assign(mergeXYNodesEdges);
689
703
  enqueue.assign({
@@ -696,9 +710,7 @@ const diagramMachine = setup({
696
710
  actions: assign(({ event }) => ({ ...event.inputs }))
697
711
  },
698
712
  "update.features": {
699
- actions: assign({
700
- features: ({ event }) => event.features
701
- })
713
+ actions: "updateFeatures"
702
714
  },
703
715
  "update.nodeData": {
704
716
  actions: assign(updateNodeData)
@@ -755,6 +767,14 @@ const diagramMachine = setup({
755
767
  "walkthrough.start": {
756
768
  guard: "is dynamic view",
757
769
  target: ".walkthrough"
770
+ },
771
+ "toggle.feature": {
772
+ actions: assign({
773
+ toggledFeatures: ({ context, event }) => ({
774
+ ...context.toggledFeatures,
775
+ [`enable${event.feature}`]: event.forceValue ?? !(context.toggledFeatures[`enable${event.feature}`] ?? context.features[`enable${event.feature}`])
776
+ })
777
+ })
758
778
  }
759
779
  },
760
780
  exit: [
@@ -98,12 +98,7 @@ function createViewChange(parentContext) {
98
98
  const { view, xystore, xyflow } = parentContext;
99
99
  const { nodeLookup } = xystore.getState();
100
100
  const movedNodes = /* @__PURE__ */ new Set();
101
- let bounds = {
102
- x: 0,
103
- y: 0,
104
- width: 1,
105
- height: 1
106
- };
101
+ let bounds;
107
102
  const nodes = reduce([...nodeLookup.values()], (acc, node) => {
108
103
  const dimensions = getNodeDimensions(node);
109
104
  if (!isSamePoint(node.internals.positionAbsolute, node.data.position) || node.initialWidth !== dimensions.width || node.initialHeight !== dimensions.height) {
@@ -116,7 +111,7 @@ function createViewChange(parentContext) {
116
111
  width: Math.ceil(dimensions.width),
117
112
  height: Math.ceil(dimensions.height)
118
113
  };
119
- bounds = getBoundsOfRects(bounds, rect);
114
+ bounds = bounds ? getBoundsOfRects(bounds, rect) : rect;
120
115
  return acc;
121
116
  }, {});
122
117
  const edges = reduce((xyflow == null ? void 0 : xyflow.getEdges()) ?? [], (acc, { source, target, data }) => {
@@ -159,9 +154,10 @@ function createViewChange(parentContext) {
159
154
  x2: Math.ceil(Math.max(...allX)),
160
155
  y2: Math.ceil(Math.max(...allY))
161
156
  });
162
- bounds = getBoundsOfRects(bounds, rect);
157
+ bounds = bounds ? getBoundsOfRects(bounds, rect) : rect;
163
158
  return acc;
164
159
  }, {});
160
+ bounds ?? (bounds = view.bounds);
165
161
  return {
166
162
  op: "save-manual-layout",
167
163
  layout: {