@likec4/diagram 1.38.1 → 1.39.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 (86) hide show
  1. package/bundle/{chunk-BZV0K82k.js → chunk-Bg7UjtMS.js} +332 -326
  2. package/bundle/custom.js +59 -59
  3. package/bundle/index.js +244 -170
  4. package/dist/LikeC4Diagram.props.d.ts +15 -8
  5. package/dist/base/BaseXYFlow.js +5 -5
  6. package/dist/base/index.d.ts +1 -2
  7. package/dist/base/primitives/MarkdownBlock.js +2 -1
  8. package/dist/base/primitives/customEdge.d.ts +3 -3
  9. package/dist/base/primitives/element/ElementTitle.js +2 -10
  10. package/dist/base/types.d.ts +62 -5
  11. package/dist/base/types.js +54 -0
  12. package/dist/bundle/LikeC4View.d.ts +2 -2
  13. package/dist/bundle/LikeC4View.props.d.ts +4 -3
  14. package/dist/bundle/ReactLikeC4.d.ts +4 -4
  15. package/dist/custom/customNodes.d.ts +2 -1
  16. package/dist/hooks/useXYFlow.d.ts +28 -29
  17. package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +4 -5
  18. package/dist/likec4diagram/custom/nodes/ElementActions.js +1 -1
  19. package/dist/likec4diagram/types.d.ts +2 -1
  20. package/dist/likec4diagram/useViewToNodesEdges.js +1 -1
  21. package/dist/likec4model/LikeC4ModelContext.d.ts +5 -2
  22. package/dist/likec4model/useLikeC4ElementsTree.js +1 -1
  23. package/dist/likec4model/useLikeC4Model.d.ts +7 -20
  24. package/dist/navigationpanel/NavigationPanel.js +3 -1
  25. package/dist/navigationpanel/NavigationPanelDropdown.js +1 -1
  26. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +6 -4
  27. package/dist/navigationpanel/walkthrough/WalkthroughPanel.d.ts +1 -0
  28. package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +83 -0
  29. package/dist/overlays/element-details/actor.d.ts +556 -557
  30. package/dist/overlays/relationship-details/RelationshipDetails.d.ts +2 -3
  31. package/dist/overlays/relationship-details/actor.d.ts +1 -1
  32. package/dist/overlays/relationship-details/actor.js +7 -7
  33. package/dist/overlays/relationship-details/compute.js +2 -1
  34. package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +2 -3
  35. package/dist/overlays/relationship-details/hooks.d.ts +18 -19
  36. package/dist/overlays/relationship-details/layout.js +2 -1
  37. package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +2 -3
  38. package/dist/overlays/relationships-browser/actor.d.ts +12 -12
  39. package/dist/overlays/relationships-browser/actor.js +8 -8
  40. package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +2 -3
  41. package/dist/overlays/relationships-browser/layout.js +2 -1
  42. package/dist/search/components/ElementsColumn.js +1 -1
  43. package/dist/state/DiagramActorProvider.js +2 -2
  44. package/dist/state/assign.js +6 -6
  45. package/dist/state/diagram-machine.js +14 -14
  46. package/dist/styles-min.css +1 -1
  47. package/dist/styles-xyflow.css +1 -1
  48. package/dist/styles.css +1 -1
  49. package/dist/styles.css2.js +1 -1
  50. package/dist/utils/xyflow.js +2 -2
  51. package/package.json +16 -16
  52. package/panda.buildinfo.json +14 -11
  53. package/src/LikeC4Diagram.props.ts +16 -16
  54. package/src/base/index.ts +1 -2
  55. package/src/base/primitives/MarkdownBlock.tsx +1 -0
  56. package/src/base/primitives/customEdge.ts +5 -5
  57. package/src/base/primitives/element/ElementTitle.tsx +10 -22
  58. package/src/base/types.ts +122 -13
  59. package/src/bundle/LikeC4View.props.ts +4 -3
  60. package/src/bundle/LikeC4View.tsx +6 -6
  61. package/src/bundle/ReactLikeC4.tsx +7 -6
  62. package/src/custom/customNodes.ts +3 -1
  63. package/src/hooks/useSetState.ts +2 -2
  64. package/src/likec4diagram/custom/nodes/ElementActions.tsx +2 -1
  65. package/src/likec4diagram/types.ts +1 -1
  66. package/src/likec4diagram/useViewToNodesEdges.ts +1 -1
  67. package/src/likec4model/LikeC4ModelContext.tsx +5 -2
  68. package/src/likec4model/useLikeC4ElementsTree.ts +3 -3
  69. package/src/likec4model/useLikeC4Model.ts +8 -5
  70. package/src/navigationpanel/NavigationPanel.tsx +2 -0
  71. package/src/navigationpanel/NavigationPanelDropdown.tsx +1 -1
  72. package/src/navigationpanel/walkthrough/ActiveWalkthroughControls.tsx +3 -1
  73. package/src/navigationpanel/walkthrough/WalkthroughPanel.tsx +88 -0
  74. package/src/overlays/relationship-details/compute.ts +3 -12
  75. package/src/overlays/relationship-details/layout.ts +3 -3
  76. package/src/overlays/relationships-browser/actor.ts +2 -1
  77. package/src/overlays/relationships-browser/layout.ts +3 -3
  78. package/src/search/components/ElementsColumn.tsx +3 -3
  79. package/src/utils/xyflow.ts +2 -2
  80. package/dist/base/types.Base.d.ts +0 -54
  81. package/dist/base/types.Base.js +0 -48
  82. package/dist/likec4diagram/custom/edges/NotePopover.d.ts +0 -4
  83. package/src/base/types.Base.ts +0 -104
  84. package/src/likec4diagram/custom/edges/NotePopover.tsx +0 -95
  85. /package/dist/{likec4diagram/custom/edges/NotePopover.css.d.ts → navigationpanel/walkthrough/WalkthroughPanel.css.d.ts} +0 -0
  86. /package/src/{likec4diagram/custom/edges/NotePopover.css.ts → navigationpanel/walkthrough/WalkthroughPanel.css.ts} +0 -0
@@ -1,9 +1,16 @@
1
- import { Any, aux, DiagramEdge, DiagramNode, LayoutedView, ViewChange, WhereOperator } from '@likec4/core/types';
1
+ import { DiagramEdge, DiagramNode, LayoutedView, ViewChange, WhereOperator } from '@likec4/core/types';
2
2
  import { ReactFlowProps as XYFlowProps } from '@xyflow/react';
3
3
  import { MouseEvent as ReactMouseEvent, ReactNode } from 'react';
4
4
  import { SetRequired } from 'type-fest';
5
5
  import { ControlsCustomLayout } from './context/ControlsCustomLayout';
6
6
  import { CustomNodes } from './custom/customNodes';
7
+ import type * as t from '@likec4/core/types';
8
+ type Any = t.aux.Any;
9
+ type ViewId<A> = t.aux.ViewId<A>;
10
+ type Fqn<A> = t.aux.Fqn<A>;
11
+ type RelationId = t.aux.RelationId;
12
+ type DeploymentFqn<A> = t.aux.DeploymentFqn<A>;
13
+ type StrictViewId<A> = t.aux.StrictViewId<A>;
7
14
  export type { CustomNodes, WhereOperator };
8
15
  export type DiagramNodeWithNavigate<A extends Any> = SetRequired<DiagramNode<A>, 'navigateTo'>;
9
16
  export type ElementIconRendererProps = {
@@ -15,7 +22,7 @@ export type ElementIconRendererProps = {
15
22
  className?: string;
16
23
  };
17
24
  export type ElementIconRenderer = (props: ElementIconRendererProps) => ReactNode;
18
- export type OnNavigateTo<A extends Any = Any> = (to: aux.ViewId<A>, event?: ReactMouseEvent, element?: DiagramNodeWithNavigate<A>) => void;
25
+ export type OnNavigateTo<A extends Any = Any> = (to: ViewId<A>, event?: ReactMouseEvent, element?: DiagramNodeWithNavigate<A>) => void;
19
26
  export type OnNodeClick<A extends Any = Any> = (node: DiagramNode<A>, event: ReactMouseEvent) => void;
20
27
  export type OnEdgeClick<A extends Any = Any> = (edge: DiagramEdge<A>, event: ReactMouseEvent) => void;
21
28
  /**
@@ -221,18 +228,18 @@ export interface LikeC4DiagramProperties<A extends Any = Any> {
221
228
  */
222
229
  reactFlowProps?: OverrideReactFlowProps | undefined;
223
230
  }
224
- export type OpenSourceParams<A extends aux.Any = aux.Any> = {
225
- element: aux.Fqn<A>;
231
+ export type OpenSourceParams<A extends Any = Any> = {
232
+ element: Fqn<A>;
226
233
  property?: string;
227
234
  } | {
228
- relation: aux.RelationId;
235
+ relation: RelationId;
229
236
  } | {
230
- deployment: aux.DeploymentFqn<A>;
237
+ deployment: DeploymentFqn<A>;
231
238
  property?: string;
232
239
  } | {
233
- view: aux.StrictViewId<A>;
240
+ view: StrictViewId<A>;
234
241
  };
235
- export interface LikeC4DiagramEventHandlers<A extends aux.Any = aux.Any> {
242
+ export interface LikeC4DiagramEventHandlers<A extends Any = Any> {
236
243
  onChange?: OnChange | null | undefined;
237
244
  onNavigateTo?: OnNavigateTo<A> | null | undefined;
238
245
  onNodeClick?: OnNodeClick<A> | null | undefined;
@@ -9,7 +9,7 @@ import { roundDpr } from '../utils/roundDpr.js';
9
9
  import { stopPropagation } from '../utils/xyflow.js';
10
10
  import { Background } from './Background.js';
11
11
  import { MinZoom, MaxZoom } from './const.js';
12
- import { setHovered } from './types.Base.js';
12
+ import { Base } from './types.js';
13
13
 
14
14
  const BaseXYFlow = ({
15
15
  nodes,
@@ -104,7 +104,7 @@ const BaseXYFlow = ({
104
104
  onNodesChange([{
105
105
  id: node.id,
106
106
  type: "replace",
107
- item: setHovered(node, true)
107
+ item: Base.setHovered(node, true)
108
108
  }]);
109
109
  }
110
110
  }),
@@ -117,7 +117,7 @@ const BaseXYFlow = ({
117
117
  onNodesChange([{
118
118
  id: node.id,
119
119
  type: "replace",
120
- item: setHovered(node, false)
120
+ item: Base.setHovered(node, false)
121
121
  }]);
122
122
  }
123
123
  }),
@@ -130,7 +130,7 @@ const BaseXYFlow = ({
130
130
  onEdgesChange([{
131
131
  id: edge.id,
132
132
  type: "replace",
133
- item: setHovered(edge, true)
133
+ item: Base.setHovered(edge, true)
134
134
  }]);
135
135
  }
136
136
  }),
@@ -143,7 +143,7 @@ const BaseXYFlow = ({
143
143
  onEdgesChange([{
144
144
  id: edge.id,
145
145
  type: "replace",
146
- item: setHovered(edge, false)
146
+ item: Base.setHovered(edge, false)
147
147
  }]);
148
148
  }
149
149
  }),
@@ -1,3 +1,2 @@
1
1
  export { BaseXYFlow, type BaseXYFlowProps } from './BaseXYFlow';
2
- export { type EdgeProps, type NodeProps, type NonOptional, type ReactFlowEdge, type ReactFlowNode, } from './types';
3
- export * as Base from './types.Base';
2
+ export { Base, type EdgeProps, type NodeProps, type NonOptional, type ReactFlowEdge, type ReactFlowNode, } from './types';
@@ -25,7 +25,8 @@ const MarkdownBlock = forwardRef(({
25
25
  ...props,
26
26
  className: cx(
27
27
  markdownBlock({
28
- uselikec4palette
28
+ uselikec4palette,
29
+ value: value.isMarkdown ? "markdown" : "plaintext"
29
30
  }),
30
31
  className
31
32
  ),
@@ -1,4 +1,4 @@
1
1
  import { FunctionComponent } from 'react';
2
- import { Base, EdgeProps } from '../types';
3
- export declare const edgePropsEqual: <P extends Record<string, unknown> = Base.EdgeData>(prev: EdgeProps<P>, next: EdgeProps<P>) => boolean;
4
- export declare function customEdge<P extends Record<string, unknown> = Base.EdgeData>(Edge: FunctionComponent<EdgeProps<P>>): FunctionComponent<EdgeProps<P>>;
2
+ import { EdgeProps } from '../types';
3
+ export declare const edgePropsEqual: <P extends EdgeProps<any>>(prev: P, next: P) => boolean;
4
+ export declare function customEdge<P extends Record<string, unknown> = {}>(Edge: FunctionComponent<EdgeProps<P>>): FunctionComponent<EdgeProps<P>>;
@@ -56,7 +56,7 @@ function ElementTitle({ id, data, iconSize }) {
56
56
  children: data.technology
57
57
  }
58
58
  ),
59
- data.description?.nonEmpty && (data.description.isMarkdown ? /* @__PURE__ */ jsx(
59
+ data.description?.nonEmpty && /* @__PURE__ */ jsx(
60
60
  MarkdownBlock,
61
61
  {
62
62
  className: cx(classes.description, "likec4-element-description"),
@@ -66,15 +66,7 @@ function ElementTitle({ id, data, iconSize }) {
66
66
  maxHeight: data.description.isMarkdown ? "8rem" : void 0,
67
67
  lineClamp: isSmOrXs ? 3 : 5
68
68
  }
69
- ) : /* @__PURE__ */ jsx(
70
- Text,
71
- {
72
- component: "div",
73
- className: cx(classes.description, "likec4-element-description"),
74
- lineClamp: isSmOrXs ? 3 : 5,
75
- children: data.description.text
76
- }
77
- ))
69
+ )
78
70
  ] })
79
71
  ]
80
72
  }
@@ -1,6 +1,63 @@
1
- import { Edge as RFEdge, EdgeProps as ReactFlowEdgeProps, Node as RFNode, NodeProps as ReactFlowNodeProps } from '@xyflow/react';
2
1
  import { OptionalKeysOf, SetRequired, Simplify } from 'type-fest';
3
- import * as Base from './types.Base';
2
+ import type * as RF from '@xyflow/react';
3
+ type RFNode<NodeData extends Record<string, unknown> = Record<string, unknown>, NodeType extends string | undefined = string | undefined> = RF.Node<NodeData, NodeType>;
4
+ type RFEdge<EdgeData extends Record<string, unknown> = Record<string, unknown>, EdgeType extends string | undefined = string | undefined> = RF.Edge<EdgeData, EdgeType>;
5
+ type ReactFlowNodeProps<NodeData extends Record<string, unknown> = Record<string, unknown>, NodeType extends string | undefined = string | undefined> = RF.NodeProps<RFNode<NodeData, NodeType>>;
6
+ type ReactFlowEdgeProps<EdgeData extends Record<string, unknown> = Record<string, unknown>, EdgeType extends string | undefined = string | undefined> = RF.EdgeProps<RFEdge<EdgeData, EdgeType>>;
7
+ export declare namespace Base {
8
+ export type Dimmed = 'immediate' | boolean;
9
+ export type NodeData = {
10
+ /**
11
+ * Whether the cursor is hovering over the node
12
+ */
13
+ hovered?: boolean;
14
+ /**
15
+ * Whether the node is dimmed
16
+ * 'immediate' means that the node is dimmed without delay
17
+ */
18
+ dimmed?: Dimmed;
19
+ };
20
+ export type Node = RFNode<NodeData>;
21
+ export type NodeProps = ReactFlowNodeProps<RFNode<NodeData, any>>;
22
+ export type EdgeData = {
23
+ /**
24
+ * Whether the cursor is hovering over the edge
25
+ */
26
+ hovered?: boolean;
27
+ /**
28
+ * Whether the edge is active (animated and highlighted)
29
+ */
30
+ active?: boolean;
31
+ /**
32
+ * Whether the edge is dimmed
33
+ * 'immediate' means that the edge is dimmed without delay
34
+ */
35
+ dimmed?: Dimmed;
36
+ };
37
+ export type Edge = Simplify<Omit<RFEdge, 'data'> & {
38
+ data: EdgeData;
39
+ }>;
40
+ type WithDimmed = {
41
+ data: {
42
+ dimmed?: Dimmed;
43
+ };
44
+ };
45
+ type WithHovered = {
46
+ data: {
47
+ hovered?: boolean;
48
+ };
49
+ };
50
+ export function setDimmed<T extends WithDimmed>(value: T, dimmed: 'immediate' | boolean): T;
51
+ export function setDimmed(dimmed: 'immediate' | boolean): <T extends WithDimmed>(value: T) => T;
52
+ export function setHovered<T extends WithHovered>(value: T, hovered: boolean): T;
53
+ export function setHovered(hovered: boolean): <T extends WithHovered>(value: T) => T;
54
+ type WithData<D> = {
55
+ data: D;
56
+ };
57
+ export function setData<E extends WithData<any>>(value: E, state: Partial<E['data']>): E;
58
+ export function setData<E extends WithData<any>>(state: Partial<E['data']>): (value: E) => E;
59
+ export {};
60
+ }
4
61
  /**
5
62
  * To cooperate with `exactOptionalPropertyTypes` in `tsconfig.json`
6
63
  *
@@ -26,11 +83,11 @@ export type NonOptional<T extends object, Keys extends OptionalKeysOf<T> = Optio
26
83
  /**
27
84
  * ReactFlow Custom Node properties with BaseNodeData at least
28
85
  */
29
- export type NodeProps<T extends Record<string, unknown> = {}, NodeType extends string = string> = Simplify<ReactFlowNodeProps<RFNode<Base.NodeData & T, NodeType>>>;
86
+ export type NodeProps<T extends Record<string, unknown> = {}, NodeType extends string = string> = Simplify<ReactFlowNodeProps<Base.NodeData & T, NodeType>>;
30
87
  /**
31
88
  * ReactFlow Custom Edge properties with BaseEdgeData at least
32
89
  */
33
- export type EdgeProps<T extends Record<string, unknown> = {}, EdgeType extends string = string> = SetRequired<Simplify<ReactFlowEdgeProps<RFEdge<Base.EdgeData & T, EdgeType>>>, 'data'>;
90
+ export type EdgeProps<T extends Record<string, unknown> = {}, EdgeType extends string = string> = SetRequired<Simplify<ReactFlowEdgeProps<Base.EdgeData & T, EdgeType>>, 'data'>;
34
91
  export type ReactFlowNode<Data extends Record<string, unknown>, NodeType extends string> = SetRequired<RFNode<Data, NodeType>, 'type' | 'initialWidth' | 'initialHeight'>;
35
92
  export type ReactFlowEdge<Data extends Record<string, unknown>, EdgeType extends string> = SetRequired<RFEdge<Data, EdgeType>, 'type' | 'data'>;
36
- export * as Base from './types.Base';
93
+ export {};
@@ -0,0 +1,54 @@
1
+ import { hasSubObject } from 'remeda';
2
+
3
+ var Base;
4
+ ((Base2) => {
5
+ const _setDimmed = (v, dimmed) => (v.data.dimmed ?? false) === dimmed ? v : {
6
+ ...v,
7
+ data: {
8
+ ...v.data,
9
+ dimmed
10
+ }
11
+ };
12
+ function setDimmed(arg1, arg2) {
13
+ if (arg2 !== void 0) {
14
+ return _setDimmed(arg1, arg2);
15
+ }
16
+ return (v) => _setDimmed(v, arg1);
17
+ }
18
+ Base2.setDimmed = setDimmed;
19
+ const _setHovered = (v, hovered) => (v.data.hovered ?? false) === hovered ? v : {
20
+ ...v,
21
+ data: {
22
+ ...v.data,
23
+ hovered
24
+ }
25
+ };
26
+ function setHovered(arg1, arg2) {
27
+ if (arg2 !== void 0) {
28
+ return _setHovered(arg1, arg2);
29
+ }
30
+ return (v) => _setHovered(v, arg1);
31
+ }
32
+ Base2.setHovered = setHovered;
33
+ function _setData(value, state) {
34
+ if (hasSubObject(value.data, state)) {
35
+ return value;
36
+ }
37
+ return {
38
+ ...value,
39
+ data: {
40
+ ...value.data,
41
+ ...state
42
+ }
43
+ };
44
+ }
45
+ function setData(arg1, arg2) {
46
+ if (arg2 !== void 0) {
47
+ return _setData(arg1, arg2);
48
+ }
49
+ return (edge) => _setData(edge, arg1);
50
+ }
51
+ Base2.setData = setData;
52
+ })(Base || (Base = {}));
53
+
54
+ export { Base };
@@ -1,3 +1,3 @@
1
- import { Any, UnknownLayouted } from '@likec4/core/types';
2
1
  import { LikeC4ViewProps } from './LikeC4View.props';
3
- export declare function LikeC4View<A extends Any = UnknownLayouted>({ viewId, ...props }: LikeC4ViewProps<A>): import("react/jsx-runtime").JSX.Element;
2
+ import type * as t from '@likec4/core/types';
3
+ export declare function LikeC4View<A extends t.aux.Any = t.aux.UnknownLayouted>({ viewId, ...props }: LikeC4ViewProps<A>): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,12 @@
1
- import { Any, aux, WhereOperator } from '@likec4/core/types';
1
+ import { WhereOperator } from '@likec4/core/types';
2
2
  import { CSSProperties } from 'react';
3
3
  import { CustomNodes, ElementIconRenderer, OverrideReactFlowProps, PaddingWithUnit, ViewPadding } from '../LikeC4Diagram.props';
4
- export interface LikeC4ViewProps<A extends Any> {
4
+ import type * as t from '@likec4/core/types';
5
+ export interface LikeC4ViewProps<A extends t.aux.Any = t.aux.UnknownLayouted> {
5
6
  /**
6
7
  * View to display.
7
8
  */
8
- viewId: aux.ViewId<A>;
9
+ viewId: t.aux.ViewId<A>;
9
10
  /**
10
11
  * Enable/disable panning
11
12
  * @default false
@@ -1,8 +1,8 @@
1
- import { Any, aux, UnknownLayouted } from '@likec4/core/types';
2
1
  import { CSSProperties } from 'react';
3
2
  import { LikeC4DiagramProps } from '../LikeC4Diagram';
4
- export type ReactLikeC4Props<A extends Any> = Omit<LikeC4DiagramProps<A>, 'view'> & {
5
- viewId: aux.ViewId<A>;
3
+ import type * as t from '@likec4/core/types';
4
+ export type ReactLikeC4Props<A extends t.aux.Any = t.aux.UnknownLayouted> = Omit<LikeC4DiagramProps<A>, 'view'> & {
5
+ viewId: t.aux.ViewId<A>;
6
6
  /**
7
7
  * Keep aspect ratio of the diagram
8
8
  * Disable if you need to manage the viewport (use className)
@@ -27,7 +27,7 @@ export type ReactLikeC4Props<A extends Any> = Omit<LikeC4DiagramProps<A>, 'view'
27
27
  /** Function to generate nonce attribute added to all generated `<style />` tags */
28
28
  styleNonce?: string | (() => string) | undefined;
29
29
  };
30
- export declare function ReactLikeC4<A extends Any = UnknownLayouted>({ viewId, ...props }: ReactLikeC4Props<A>): import("react/jsx-runtime").JSX.Element;
30
+ export declare function ReactLikeC4<A extends t.aux.Any = t.aux.UnknownLayouted>({ viewId, ...props }: ReactLikeC4Props<A>): import("react/jsx-runtime").JSX.Element;
31
31
  export declare namespace ReactLikeC4 {
32
32
  var displayName: string;
33
33
  }
@@ -1,8 +1,9 @@
1
1
  import { NodeModel } from '@likec4/core/model';
2
- import { Any } from '@likec4/core/types';
2
+ import { aux } from '@likec4/core/types';
3
3
  import { FunctionComponent } from 'react';
4
4
  import { NodeProps } from '../base/types';
5
5
  import { Types } from '../likec4diagram/types';
6
+ type Any = aux.Any;
6
7
  type CustomDiagramNodeProps = {
7
8
  nodeProps: NodeProps<Types.NodeData, string>;
8
9
  nodeModel: NodeModel;
@@ -2,8 +2,7 @@ import { ReactFlowInstance, ReactFlowState, InternalNode } from '@xyflow/react';
2
2
  import { Types } from '../likec4diagram/types';
3
3
  import { EdgeMarkerType, HandleType, XYPosition } from '@xyflow/system';
4
4
  import { ReactNode, CSSProperties, AriaRole, SVGAttributes } from 'react';
5
- import { Dimmed } from '../base/types.Base';
6
- import { EdgeId, NonEmptyArray, Point, Color, RelationshipLineType, RelationshipArrowType, BBox, ViewId, MarkdownOrString } from '@likec4/core';
5
+ import { EdgeId, NonEmptyArray, Point, Color, RelationshipLineType, RelationshipArrowType, BBox, ViewId, RichTextOrEmpty } from '@likec4/core';
7
6
  export declare const useXYFlow: () => ReactFlowInstance<Types.Node, {
8
7
  id: string;
9
8
  source: string;
@@ -31,12 +30,12 @@ export declare const useXYFlow: () => ReactFlowInstance<Types.Node, {
31
30
  reconnectable?: boolean | HandleType;
32
31
  focusable?: boolean;
33
32
  ariaRole?: AriaRole;
34
- domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
33
+ domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
35
34
  type: "relationship";
36
35
  data: {
37
36
  hovered?: boolean;
38
37
  active?: boolean;
39
- dimmed?: Dimmed;
38
+ dimmed?: import("../base").Base.Dimmed;
40
39
  id: EdgeId;
41
40
  label: string | null;
42
41
  points: NonEmptyArray<Point>;
@@ -48,7 +47,7 @@ export declare const useXYFlow: () => ReactFlowInstance<Types.Node, {
48
47
  head: RelationshipArrowType | undefined;
49
48
  labelBBox: BBox | null | undefined;
50
49
  navigateTo: ViewId<string> | null | undefined;
51
- notes: MarkdownOrString | undefined;
50
+ notes: RichTextOrEmpty;
52
51
  labelXY: XYPosition | null;
53
52
  controlPoints: XYPosition[] | undefined | null;
54
53
  };
@@ -84,12 +83,12 @@ export declare const useXYStoreApi: () => {
84
83
  reconnectable?: boolean | HandleType;
85
84
  focusable?: boolean;
86
85
  ariaRole?: AriaRole;
87
- domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
86
+ domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
88
87
  type: "relationship";
89
88
  data: {
90
89
  hovered?: boolean;
91
90
  active?: boolean;
92
- dimmed?: Dimmed;
91
+ dimmed?: import("../base").Base.Dimmed;
93
92
  id: EdgeId;
94
93
  label: string | null;
95
94
  points: NonEmptyArray<Point>;
@@ -101,7 +100,7 @@ export declare const useXYStoreApi: () => {
101
100
  head: RelationshipArrowType | undefined;
102
101
  labelBBox: BBox | null | undefined;
103
102
  navigateTo: ViewId<string> | null | undefined;
104
- notes: MarkdownOrString | undefined;
103
+ notes: RichTextOrEmpty;
105
104
  labelXY: XYPosition | null;
106
105
  controlPoints: XYPosition[] | undefined | null;
107
106
  };
@@ -133,12 +132,12 @@ export declare const useXYStoreApi: () => {
133
132
  reconnectable?: boolean | HandleType;
134
133
  focusable?: boolean;
135
134
  ariaRole?: AriaRole;
136
- domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
135
+ domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
137
136
  type: "relationship";
138
137
  data: {
139
138
  hovered?: boolean;
140
139
  active?: boolean;
141
- dimmed?: Dimmed;
140
+ dimmed?: import("../base").Base.Dimmed;
142
141
  id: EdgeId;
143
142
  label: string | null;
144
143
  points: NonEmptyArray<Point>;
@@ -150,7 +149,7 @@ export declare const useXYStoreApi: () => {
150
149
  head: RelationshipArrowType | undefined;
151
150
  labelBBox: BBox | null | undefined;
152
151
  navigateTo: ViewId<string> | null | undefined;
153
- notes: MarkdownOrString | undefined;
152
+ notes: RichTextOrEmpty;
154
153
  labelXY: XYPosition | null;
155
154
  controlPoints: XYPosition[] | undefined | null;
156
155
  };
@@ -181,12 +180,12 @@ export declare const useXYStoreApi: () => {
181
180
  reconnectable?: boolean | HandleType;
182
181
  focusable?: boolean;
183
182
  ariaRole?: AriaRole;
184
- domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
183
+ domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
185
184
  type: "relationship";
186
185
  data: {
187
186
  hovered?: boolean;
188
187
  active?: boolean;
189
- dimmed?: Dimmed;
188
+ dimmed?: import("../base").Base.Dimmed;
190
189
  id: EdgeId;
191
190
  label: string | null;
192
191
  points: NonEmptyArray<Point>;
@@ -198,7 +197,7 @@ export declare const useXYStoreApi: () => {
198
197
  head: RelationshipArrowType | undefined;
199
198
  labelBBox: BBox | null | undefined;
200
199
  navigateTo: ViewId<string> | null | undefined;
201
- notes: MarkdownOrString | undefined;
200
+ notes: RichTextOrEmpty;
202
201
  labelXY: XYPosition | null;
203
202
  controlPoints: XYPosition[] | undefined | null;
204
203
  };
@@ -229,12 +228,12 @@ export declare const useXYStoreApi: () => {
229
228
  reconnectable?: boolean | HandleType;
230
229
  focusable?: boolean;
231
230
  ariaRole?: AriaRole;
232
- domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
231
+ domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
233
232
  type: "relationship";
234
233
  data: {
235
234
  hovered?: boolean;
236
235
  active?: boolean;
237
- dimmed?: Dimmed;
236
+ dimmed?: import("../base").Base.Dimmed;
238
237
  id: EdgeId;
239
238
  label: string | null;
240
239
  points: NonEmptyArray<Point>;
@@ -246,7 +245,7 @@ export declare const useXYStoreApi: () => {
246
245
  head: RelationshipArrowType | undefined;
247
246
  labelBBox: BBox | null | undefined;
248
247
  navigateTo: ViewId<string> | null | undefined;
249
- notes: MarkdownOrString | undefined;
248
+ notes: RichTextOrEmpty;
250
249
  labelXY: XYPosition | null;
251
250
  controlPoints: XYPosition[] | undefined | null;
252
251
  };
@@ -277,12 +276,12 @@ export declare const useXYStoreApi: () => {
277
276
  reconnectable?: boolean | HandleType;
278
277
  focusable?: boolean;
279
278
  ariaRole?: AriaRole;
280
- domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
279
+ domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
281
280
  type: "relationship";
282
281
  data: {
283
282
  hovered?: boolean;
284
283
  active?: boolean;
285
- dimmed?: Dimmed;
284
+ dimmed?: import("../base").Base.Dimmed;
286
285
  id: EdgeId;
287
286
  label: string | null;
288
287
  points: NonEmptyArray<Point>;
@@ -294,7 +293,7 @@ export declare const useXYStoreApi: () => {
294
293
  head: RelationshipArrowType | undefined;
295
294
  labelBBox: BBox | null | undefined;
296
295
  navigateTo: ViewId<string> | null | undefined;
297
- notes: MarkdownOrString | undefined;
296
+ notes: RichTextOrEmpty;
298
297
  labelXY: XYPosition | null;
299
298
  controlPoints: XYPosition[] | undefined | null;
300
299
  };
@@ -325,12 +324,12 @@ export declare const useXYStoreApi: () => {
325
324
  reconnectable?: boolean | HandleType;
326
325
  focusable?: boolean;
327
326
  ariaRole?: AriaRole;
328
- domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
327
+ domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
329
328
  type: "relationship";
330
329
  data: {
331
330
  hovered?: boolean;
332
331
  active?: boolean;
333
- dimmed?: Dimmed;
332
+ dimmed?: import("../base").Base.Dimmed;
334
333
  id: EdgeId;
335
334
  label: string | null;
336
335
  points: NonEmptyArray<Point>;
@@ -342,7 +341,7 @@ export declare const useXYStoreApi: () => {
342
341
  head: RelationshipArrowType | undefined;
343
342
  labelBBox: BBox | null | undefined;
344
343
  navigateTo: ViewId<string> | null | undefined;
345
- notes: MarkdownOrString | undefined;
344
+ notes: RichTextOrEmpty;
346
345
  labelXY: XYPosition | null;
347
346
  controlPoints: XYPosition[] | undefined | null;
348
347
  };
@@ -374,12 +373,12 @@ export declare const useXYStoreApi: () => {
374
373
  reconnectable?: boolean | HandleType;
375
374
  focusable?: boolean;
376
375
  ariaRole?: AriaRole;
377
- domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
376
+ domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
378
377
  type: "relationship";
379
378
  data: {
380
379
  hovered?: boolean;
381
380
  active?: boolean;
382
- dimmed?: Dimmed;
381
+ dimmed?: import("../base").Base.Dimmed;
383
382
  id: EdgeId;
384
383
  label: string | null;
385
384
  points: NonEmptyArray<Point>;
@@ -391,7 +390,7 @@ export declare const useXYStoreApi: () => {
391
390
  head: RelationshipArrowType | undefined;
392
391
  labelBBox: BBox | null | undefined;
393
392
  navigateTo: ViewId<string> | null | undefined;
394
- notes: MarkdownOrString | undefined;
393
+ notes: RichTextOrEmpty;
395
394
  labelXY: XYPosition | null;
396
395
  controlPoints: XYPosition[] | undefined | null;
397
396
  };
@@ -422,12 +421,12 @@ export declare const useXYStoreApi: () => {
422
421
  reconnectable?: boolean | HandleType;
423
422
  focusable?: boolean;
424
423
  ariaRole?: AriaRole;
425
- domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
424
+ domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
426
425
  type: "relationship";
427
426
  data: {
428
427
  hovered?: boolean;
429
428
  active?: boolean;
430
- dimmed?: Dimmed;
429
+ dimmed?: import("../base").Base.Dimmed;
431
430
  id: EdgeId;
432
431
  label: string | null;
433
432
  points: NonEmptyArray<Point>;
@@ -439,7 +438,7 @@ export declare const useXYStoreApi: () => {
439
438
  head: RelationshipArrowType | undefined;
440
439
  labelBBox: BBox | null | undefined;
441
440
  navigateTo: ViewId<string> | null | undefined;
442
- notes: MarkdownOrString | undefined;
441
+ notes: RichTextOrEmpty;
443
442
  labelXY: XYPosition | null;
444
443
  controlPoints: XYPosition[] | undefined | null;
445
444
  };
@@ -1,8 +1,7 @@
1
- import { EdgeId, NonEmptyArray, Point, Color, RelationshipLineType, RelationshipArrowType, BBox, ViewId, MarkdownOrString } from '@likec4/core';
1
+ import { EdgeId, NonEmptyArray, Point, Color, RelationshipLineType, RelationshipArrowType, BBox, ViewId, RichTextOrEmpty } from '@likec4/core';
2
2
  import { XYPosition } from '@xyflow/react';
3
3
  import { FunctionComponent, CSSProperties, ReactNode } from 'react';
4
4
  import { Position } from '@xyflow/system';
5
- import { EdgeData, Dimmed } from '../../../base/types.Base';
6
5
  export declare const RelationshipEdge: FunctionComponent<{
7
6
  id: string;
8
7
  selected?: boolean;
@@ -30,10 +29,10 @@ export declare const RelationshipEdge: FunctionComponent<{
30
29
  markerEnd?: string;
31
30
  pathOptions?: any;
32
31
  interactionWidth?: number;
33
- data: EdgeData & {
32
+ data: import("../../../base").Base.EdgeData & {
34
33
  hovered?: boolean;
35
34
  active?: boolean;
36
- dimmed?: Dimmed;
35
+ dimmed?: import("../../../base").Base.Dimmed;
37
36
  id: EdgeId;
38
37
  label: string | null;
39
38
  points: NonEmptyArray<Point>;
@@ -45,7 +44,7 @@ export declare const RelationshipEdge: FunctionComponent<{
45
44
  head: RelationshipArrowType | undefined;
46
45
  labelBBox: BBox | null | undefined;
47
46
  navigateTo: ViewId<string> | null | undefined;
48
- notes: MarkdownOrString | undefined;
47
+ notes: RichTextOrEmpty;
49
48
  labelXY: XYPosition | null;
50
49
  controlPoints: XYPosition[] | undefined | null;
51
50
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { hasAtLeast } from '@likec4/core';
3
2
  import { useMemo } from 'react';
3
+ import { hasAtLeast } from 'remeda';
4
4
  import { useEnabledFeatures } from '../../../context/DiagramFeatures.js';
5
5
  import { useDiagram } from '../../../hooks/useDiagram.js';
6
6
  import IconZoomScan from '../../../node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js';
@@ -73,7 +73,8 @@ export declare namespace Types {
73
73
  type ViewGroupNode = ReactFlowNode<ViewGroupNodeData, 'view-group'>;
74
74
  type Node = ElementNode | DeploymentElementNode | CompoundElementNode | CompoundDeploymentNode | ViewGroupNode;
75
75
  type NodeData = Node['data'];
76
- type RelationshipEdgeData = Simplify<Base.EdgeData & NonOptional<Pick<DiagramEdge, 'id' | 'label' | 'labelBBox' | 'technology' | 'points' | 'dir' | 'color' | 'line' | 'head' | 'tail' | 'navigateTo' | 'notes'>> & {
76
+ type RelationshipEdgeData = Simplify<Base.EdgeData & NonOptional<Pick<DiagramEdge, 'id' | 'label' | 'labelBBox' | 'technology' | 'points' | 'dir' | 'color' | 'line' | 'head' | 'tail' | 'navigateTo'>> & {
77
+ notes: RichTextOrEmpty;
77
78
  labelXY: XYPosition | null;
78
79
  controlPoints: XYPosition[] | undefined | null;
79
80
  }>;
@@ -204,7 +204,7 @@ function viewToNodesEdge(opts) {
204
204
  id: edge.id,
205
205
  label: edge.label,
206
206
  technology: edge.technology,
207
- notes: edge.notes,
207
+ notes: RichText.from(edge.notes),
208
208
  navigateTo: edge.navigateTo,
209
209
  controlPoints: edge.controlPoints ?? null,
210
210
  labelBBox: edge.labelBBox ?? null,
@@ -1,7 +1,10 @@
1
1
  import { LikeC4Model, LikeC4ViewModel } from '@likec4/core/model';
2
- import { aux, DiagramView } from '@likec4/core/types';
2
+ import { DiagramView } from '@likec4/core/types';
3
3
  import { PropsWithChildren, Context } from 'react';
4
+ import type * as t from '@likec4/core/types';
5
+ type UnknownLayouted = t.aux.UnknownLayouted;
4
6
  export declare const LikeC4ModelContext: Context<LikeC4Model<any> | null>;
5
- export type CurrentViewModel = LikeC4ViewModel<aux.UnknownLayouted, DiagramView<aux.UnknownLayouted>>;
7
+ export type CurrentViewModel = LikeC4ViewModel<UnknownLayouted, DiagramView<UnknownLayouted>>;
6
8
  export declare const CurrentViewModelContext: Context<CurrentViewModel | null>;
7
9
  export declare function EnsureCurrentViewModel({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element | null;
10
+ export {};
@@ -1,4 +1,4 @@
1
- import { compareNatural } from '@likec4/core';
1
+ import { compareNatural } from '@likec4/core/utils';
2
2
  import { useMemo } from 'react';
3
3
  import { useLikeC4Model } from './useLikeC4Model.js';
4
4