@eccenca/gui-elements 23.1.0-easynav.1 → 23.1.0-easynav.2

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 (44) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/cjs/components/Depiction/Depiction.js +13 -13
  3. package/dist/cjs/components/Depiction/Depiction.js.map +1 -1
  4. package/dist/cjs/extensions/react-flow/edges/EdgeDefault.js +20 -5
  5. package/dist/cjs/extensions/react-flow/edges/EdgeDefault.js.map +1 -1
  6. package/dist/cjs/extensions/react-flow/edges/EdgeLabel.js +17 -1
  7. package/dist/cjs/extensions/react-flow/edges/EdgeLabel.js.map +1 -1
  8. package/dist/cjs/extensions/react-flow/edges/edgeTypes.js +10 -9
  9. package/dist/cjs/extensions/react-flow/edges/edgeTypes.js.map +1 -1
  10. package/dist/cjs/extensions/react-flow/index.js +2 -3
  11. package/dist/cjs/extensions/react-flow/index.js.map +1 -1
  12. package/dist/cjs/extensions/react-flow/nodes/NodeContent.js +54 -6
  13. package/dist/cjs/extensions/react-flow/nodes/NodeContent.js.map +1 -1
  14. package/dist/esm/components/Depiction/Depiction.js +15 -14
  15. package/dist/esm/components/Depiction/Depiction.js.map +1 -1
  16. package/dist/esm/extensions/react-flow/edges/EdgeDefault.js +20 -4
  17. package/dist/esm/extensions/react-flow/edges/EdgeDefault.js.map +1 -1
  18. package/dist/esm/extensions/react-flow/edges/EdgeLabel.js +17 -1
  19. package/dist/esm/extensions/react-flow/edges/EdgeLabel.js.map +1 -1
  20. package/dist/esm/extensions/react-flow/edges/edgeTypes.js +10 -9
  21. package/dist/esm/extensions/react-flow/edges/edgeTypes.js.map +1 -1
  22. package/dist/esm/extensions/react-flow/index.js +1 -1
  23. package/dist/esm/extensions/react-flow/index.js.map +1 -1
  24. package/dist/esm/extensions/react-flow/nodes/NodeContent.js +54 -5
  25. package/dist/esm/extensions/react-flow/nodes/NodeContent.js.map +1 -1
  26. package/dist/types/extensions/react-flow/edges/EdgeDefault.d.ts +16 -1
  27. package/dist/types/extensions/react-flow/edges/EdgeLabel.d.ts +12 -0
  28. package/dist/types/extensions/react-flow/edges/edgeTypes.d.ts +10 -9
  29. package/dist/types/extensions/react-flow/index.d.ts +1 -2
  30. package/dist/types/extensions/react-flow/nodes/NodeContent.d.ts +26 -3
  31. package/package.json +1 -1
  32. package/src/cmem/react-flow/ReactFlow/ReactFlow.stories.tsx +2 -2
  33. package/src/cmem/react-flow/_edges.scss +3 -2
  34. package/src/components/Depiction/Depiction.tsx +11 -10
  35. package/src/extensions/react-flow/_config.scss +7 -4
  36. package/src/extensions/react-flow/edges/EdgeDefault.tsx +60 -5
  37. package/src/extensions/react-flow/edges/EdgeLabel.tsx +45 -1
  38. package/src/extensions/react-flow/edges/_edges.scss +131 -33
  39. package/src/extensions/react-flow/edges/edgeTypes.ts +13 -9
  40. package/src/extensions/react-flow/edges/stories/EdgeDefault.stories.tsx +34 -13
  41. package/src/extensions/react-flow/index.ts +2 -2
  42. package/src/extensions/react-flow/nodes/NodeContent.tsx +93 -7
  43. package/src/extensions/react-flow/nodes/_nodes.scss +177 -50
  44. package/src/extensions/react-flow/nodes/stories/NodeContent.stories.tsx +30 -0
@@ -1,4 +1,4 @@
1
- import React, { memo } from "react";
1
+ import React, { memo, useEffect, useRef } from "react";
2
2
  import { Icon, Depiction, DepictionProps, OverflowText } from "../../../index";
3
3
  import { CLASSPREFIX as eccgui } from "../../../configuration/constants";
4
4
  import { ValidIconName } from "../../../components/Icon/canonicalIconNames";
@@ -81,3 +81,47 @@ export const EdgeLabel = memo(({
81
81
  </div>
82
82
  )
83
83
  });
84
+
85
+ interface EdgeLabelObjectProps extends React.SVGAttributes<SVGForeignObjectElement> {
86
+ /**
87
+ * The `<EdgeLabel />` element that need to be displayed.
88
+ */
89
+ children: React.ReactElement<EdgeLabelProps>;
90
+ /**
91
+ * Property from the `renderLabel` callback method.
92
+ */
93
+ edgeCenter: [number, number, number, number];
94
+ }
95
+
96
+ export const EdgeLabelObject = memo(({
97
+ children,
98
+ edgeCenter,
99
+ ...otherForeignObjectProps
100
+ } : EdgeLabelObjectProps) => {
101
+ const containerRef = useRef<SVGForeignObjectElement>(null);
102
+
103
+ useEffect(() => {
104
+ const labelElement = containerRef.current!.getElementsByClassName(`${eccgui}-graphviz__edge-label`);
105
+ if (labelElement.length > 0) {
106
+ const width = (labelElement[0] as HTMLElement).offsetWidth;
107
+ const height = (labelElement[0] as HTMLElement).offsetHeight;
108
+ containerRef.current!.setAttribute("width", width.toString());
109
+ containerRef.current!.setAttribute("height", height.toString());
110
+ containerRef.current!.setAttribute("x", (edgeCenter[0] - width/2).toString());
111
+ containerRef.current!.setAttribute("y", (edgeCenter[1] - height/2).toString());
112
+ }
113
+ })
114
+
115
+ return (
116
+ <foreignObject
117
+ ref={containerRef}
118
+ className={`${eccgui}-graphviz__edge-labelobject`}
119
+ width="1"
120
+ height="1"
121
+ {...otherForeignObjectProps}
122
+ requiredExtensions="http://www.w3.org/1999/xhtml"
123
+ >
124
+ { children }
125
+ </foreignObject>
126
+ )
127
+ });
@@ -1,15 +1,15 @@
1
1
  .react-flow__edge {
2
+ --#{$eccgui}-reactflow-node-color-default: #{$reactflow-edge-stroke-color-default};
3
+ --#{$eccgui}-reactflow-node-color-hover: #{$reactflow-edge-stroke-color-hover};
4
+ --#{$eccgui}-reactflow-node-color-selected: #{$reactflow-edge-stroke-color-selected};
2
5
 
3
6
  path, rect {
4
7
  shape-rendering: optimizeSpeed;
5
- /* TODO: transitions currently do not work like expected
6
- transition: $reactflow-transition-time * 0.5 $reactflow-transition-function;
7
- */
8
- stroke-opacity: $reactflow-edge-stroke-opacity;
8
+ stroke-opacity: $reactflow-edge-stroke-opacity-default;
9
9
  }
10
10
 
11
11
  text {
12
- opacity: $reactflow-edge-stroke-opacity;
12
+ opacity: $reactflow-edge-stroke-opacity-default;
13
13
  }
14
14
 
15
15
  &:hover {
@@ -31,11 +31,24 @@
31
31
  opacity: $reactflow-edge-stroke-opacity-selected;
32
32
  }
33
33
  }
34
+ stroke: var(--#{$eccgui}-reactflow-node-color-default);
35
+ color: var(--#{$eccgui}-reactflow-node-color-default);
36
+
37
+ &:hover {
38
+ stroke: var(--#{$eccgui}-reactflow-node-color-hover);
39
+ color: var(--#{$eccgui}-reactflow-node-color-hover);
40
+ }
41
+
42
+ &.selected {
43
+ stroke: var(--#{$eccgui}-reactflow-node-color-selected);
44
+ color: var(--#{$eccgui}-reactflow-node-color-selected);
45
+ }
34
46
  }
35
47
 
36
48
  path.react-flow__edge-path {
37
49
  stroke-width: 2;
38
50
  stroke: currentColor;
51
+ stroke-opacity: $reactflow-edge-stroke-opacity-default;
39
52
 
40
53
  .react-flow__edge.selected & {
41
54
  stroke-width: 2;
@@ -49,9 +62,12 @@ path.react-flow__edge-path-glow {
49
62
  fill: none;
50
63
  stroke-linecap: round;
51
64
 
52
- .react-flow__edge:hover &,
65
+ .react-flow__edge:hover & {
66
+ stroke-opacity: $reactflow-edge-stroke-opacity-hover * 0.2;
67
+ }
68
+
53
69
  .react-flow__edge.selected & {
54
- stroke-opacity: 0.1;
70
+ stroke-opacity: $reactflow-edge-stroke-opacity-selected * 0.2;
55
71
  }
56
72
 
57
73
  .react-flow__edge.animated & {
@@ -70,12 +86,6 @@ path.react-flow__edge-path-glow {
70
86
  }
71
87
  }
72
88
 
73
- .react-flow__edge-textwrapper {
74
- /* TODO: transitions currently do not work like expected
75
- transition: $reactflow-transition-time * 0.5 $reactflow-transition-function;
76
- */
77
- }
78
-
79
89
  .react-flow__edge-text {
80
90
  fill: currentColor;
81
91
  stroke: none;
@@ -84,39 +94,127 @@ path.react-flow__edge-path-glow {
84
94
  .react-flow__edge-textbg {
85
95
  }
86
96
 
97
+ // Stroke types
98
+
99
+ path.react-flow__edge-path--stroke-solid {
100
+ stroke-dasharray: unset;
101
+ }
102
+
103
+ path.react-flow__edge-path--stroke-dashed,
104
+ .react-flow__edge.animated path.react-flow__edge-path--stroke-dashed {
105
+ stroke-dasharray: 5;
106
+ }
107
+
108
+ path.react-flow__edge-path--stroke-dotted,
109
+ .react-flow__edge.animated path.react-flow__edge-path--stroke-dotted {
110
+ stroke-dasharray: 2;
111
+ }
112
+
113
+ path.react-flow__edge-path--stroke-double {
114
+ stroke: #fff !important;
115
+ stroke-opacity: 1 !important;
116
+ filter: drop-shadow(1px 1px 1px currentColor) drop-shadow(-1px -1px 1px currentColor);
117
+ }
118
+
119
+ path.react-flow__edge-path--stroke-doubledashed {
120
+ stroke: #fff !important;
121
+ stroke-opacity: 1 !important;
122
+ filter: drop-shadow(1px 1px 1px currentColor) drop-shadow(-1px -1px 1px currentColor);
123
+ stroke-dasharray: 5;
124
+ }
125
+
126
+ // Intent states
127
+
128
+ g[class*="#{$eccgui}-intent--"] {
129
+ color: var(--edge-intent-color);
130
+ }
131
+
132
+ g[class*="#{$eccgui}-intent--"] > path.react-flow__edge-path,
133
+ g[class*="#{$eccgui}-intent--"] > path.react-flow__edge-path-glow {
134
+ stroke: var(--edge-intent-color);
135
+
136
+ .react-flow__edge.selected & {
137
+ stroke: var(--edge-intent-color);
138
+ }
139
+ }
140
+
141
+ g.#{$eccgui}-intent--primary {
142
+ --edge-intent-color: #{$eccgui-color-primary};
143
+ }
144
+
145
+ g.#{$eccgui}-intent--accent {
146
+ --edge-intent-color: #{$eccgui-color-accent};
147
+ }
148
+
149
+ g.#{$eccgui}-intent--info {
150
+ --edge-intent-color: #{$eccgui-color-info-text};
151
+ }
152
+
153
+ g.#{$eccgui}-intent--success {
154
+ --edge-intent-color: #{$eccgui-color-success-text};
155
+ }
156
+
157
+ g.#{$eccgui}-intent--warning {
158
+ --edge-intent-color: #{$eccgui-color-warning-text};
159
+ }
160
+
161
+ g.#{$eccgui}-intent--danger {
162
+ --edge-intent-color: #{$eccgui-color-danger-text};
163
+ }
164
+
165
+ // Highlightning
166
+
167
+ path.react-flow__edge-path-highlight {
168
+ stroke-opacity: 1;
169
+ fill: none;
170
+ stroke-linecap: round;
171
+ stroke: #fff;
172
+ filter:
173
+ drop-shadow(2px -2px 1px var(--edge-highlight-default-color))
174
+ drop-shadow(-2px 2px 1px var(--edge-highlight-alternate-color, var(--edge-highlight-default-color)));
175
+ }
176
+
177
+ .#{$eccgui}-graphviz__edge--highlight-default {
178
+ --edge-highlight-default-color: #{$eccgui-color-accent};
179
+ --edge-highlight-alternate-color: #{$eccgui-color-accent};
180
+ }
181
+
182
+ .#{$eccgui}-graphviz__edge--highlight-alternate {
183
+ --edge-highlight-default-color: #{$eccgui-color-primary};
184
+ --edge-highlight-alternate-color: #{$eccgui-color-primary};
185
+ }
186
+
187
+ .#{$eccgui}-graphviz__edge--highlight-default.#{$eccgui}-graphviz__edge--highlight-alternate {
188
+ --edge-highlight-default-color: #{$eccgui-color-accent};
189
+ --edge-highlight-alternate-color: #{$eccgui-color-primary};
190
+ }
191
+
192
+
193
+
87
194
  // Type colors
88
195
 
89
196
  .react-flow__edge-default,
90
197
  .react-flow__edge-straight,
91
198
  .react-flow__edge-smoothstep,
92
199
  .react-flow__edge-step {
93
- stroke: $reactflow-edge-stroke-color;
94
- color: $reactflow-edge-stroke-color;
95
-
96
- &:hover {
97
- stroke: $reactflow-edge-stroke-color-hover;
98
- color: $reactflow-edge-stroke-color-hover;
99
- }
100
-
101
- &.selected {
102
- stroke: $reactflow-edge-stroke-color-selected;
103
- color: $reactflow-edge-stroke-color-selected;
104
- }
105
200
  }
106
201
 
107
202
  .react-flow__edge-success {
108
- stroke: $eccgui-color-success-text;
109
- color: $eccgui-color-success-text;
203
+ --#{$eccgui}-reactflow-node-color-default: #{$eccgui-color-success-text};
204
+ --#{$eccgui}-reactflow-node-color-hover: #{$eccgui-color-success-text};
205
+ --#{$eccgui}-reactflow-node-color-selected: #{$eccgui-color-success-text};
110
206
  }
111
207
 
112
208
  .react-flow__edge-warning {
113
- stroke: $eccgui-color-warning-text;
114
- color: $eccgui-color-warning-text;
209
+ --#{$eccgui}-reactflow-node-color-default: #{$eccgui-color-warning-text};
210
+ --#{$eccgui}-reactflow-node-color-hover: #{$eccgui-color-warning-text};
211
+ --#{$eccgui}-reactflow-node-color-selected: #{$eccgui-color-warning-text};
115
212
  }
116
213
 
117
214
  .react-flow__edge-danger {
118
- stroke: $eccgui-color-danger-text;
119
- color: $eccgui-color-danger-text;
215
+ --#{$eccgui}-reactflow-node-color-default: #{$eccgui-color-danger-text};
216
+ --#{$eccgui}-reactflow-node-color-hover: #{$eccgui-color-danger-text};
217
+ --#{$eccgui}-reactflow-node-color-selected: #{$eccgui-color-danger-text};
120
218
  }
121
219
 
122
220
  // Tools overlay
@@ -158,10 +256,10 @@ path.react-flow__edge-path-glow {
158
256
  // Custom label
159
257
 
160
258
  .#{$eccgui}-graphviz__edge-label {
161
- border: 0.5*$reactflow-node-border-width solid $reactflow-node-border-color;
259
+ border: 0.5*$reactflow-node-border-width solid currentColor;
162
260
  border-radius: $reactflow-node-border-radius;
163
261
  background: #fff; // TODO color
164
- color: $reactflow-node-color;
262
+ color: currentColor;
165
263
  display: inline-flex;
166
264
  align-items: center;
167
265
  width: auto;
@@ -12,13 +12,17 @@ export const edgeTypes = {
12
12
  default: EdgeDefault,
13
13
  straight: EdgeDefault,
14
14
  step: EdgeStep,
15
- smoothstep: EdgeStep,
16
- implicitEdge: EdgeDefault,
17
- importEdge: EdgeDefault,
18
- subclassEdge: EdgeDefault,
19
- subpropertyEdge: EdgeDefault,
20
- rdftypeEdge: EdgeDefault,
21
- successStep: EdgeStep,
22
- warningStep: EdgeStep,
23
- dangerStep: EdgeStep,
15
+
16
+ success: EdgeDefault,
17
+ warning: EdgeDefault,
18
+ danger: EdgeDefault,
19
+
20
+ implicit: EdgeDefault,
21
+ import: EdgeDefault,
22
+ subclass: EdgeDefault,
23
+ subproperty: EdgeDefault,
24
+ rdftype: EdgeDefault,
25
+
26
+ value: EdgeStep,
27
+ score: EdgeStep,
24
28
  };
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useEffect, useCallback } from "react";
2
2
  import { ComponentStory, ComponentMeta } from "@storybook/react";
3
- import { ReactFlow, Tag } from "./../../../../../index";
3
+ import { ReactFlow, EdgeLabel, EdgeLabelObject } from "./../../../../../index";
4
4
  import { ArrowHeadType, Elements, getMarkerEnd, ReactFlowProvider } from 'react-flow-renderer';
5
5
 
6
6
  import { EdgeDefault, EdgeDefaultDataProps as EdgeData } from "./../EdgeDefault";
@@ -16,6 +16,10 @@ export default {
16
16
  component: EdgeDefault,
17
17
  subcomponents: { EdgeDefaultDataProps },
18
18
  argTypes: {
19
+ type: {
20
+ control: "select",
21
+ options: [...(Object.keys(edgeTypes))],
22
+ },
19
23
  },
20
24
  } as ComponentMeta<typeof EdgeDefault>;
21
25
 
@@ -74,7 +78,7 @@ const Template: ComponentStory<typeof EdgeDefault> = (args) => (
74
78
  export const Default = Template.bind({});
75
79
  Default.args = {
76
80
  id: 'default',
77
- type: 'default',
81
+ type: 'dangerStep',
78
82
  label: "edge",
79
83
  arrowHeadType: "arrowclosed",
80
84
  source: 'node-1',
@@ -88,21 +92,14 @@ CustomLabel.args = {
88
92
  ...Default.args,
89
93
  id: "customlabel",
90
94
  arrowHeadType: undefined,
95
+ label: undefined,
91
96
  data: {
92
97
  renderLabel: (
93
98
  edgeCenter: [number, number, number, number]
94
99
  ) => (
95
- <foreignObject
96
- width={100}
97
- height={20}
98
- x={edgeCenter[0] - 50}
99
- y={edgeCenter[1] - 10}
100
- requiredExtensions="http://www.w3.org/1999/xhtml"
101
- >
102
- <body>
103
- <Tag>Custom label</Tag>
104
- </body>
105
- </foreignObject>
100
+ <EdgeLabelObject edgeCenter={edgeCenter}>
101
+ <EdgeLabel text="Custom label that is very long" />
102
+ </EdgeLabelObject>
106
103
  )
107
104
  }
108
105
  };
@@ -119,3 +116,27 @@ InverseEdge.args = {
119
116
  ),
120
117
  }
121
118
  };
119
+
120
+ export const AdjustStrokeType = Template.bind({});
121
+ AdjustStrokeType.args = {
122
+ ...Default.args,
123
+ data: {
124
+ strokeType: "double",
125
+ }
126
+ };
127
+
128
+ export const AdjustIntent = Template.bind({});
129
+ AdjustIntent.args = {
130
+ ...Default.args,
131
+ data: {
132
+ intent: "warning",
133
+ }
134
+ };
135
+
136
+ export const AdjustHighlight = Template.bind({});
137
+ AdjustHighlight.args = {
138
+ ...Default.args,
139
+ data: {
140
+ highlightColor: ["default", "alternate"]
141
+ }
142
+ };
@@ -3,7 +3,6 @@ export { NodeContent } from "./nodes/NodeContent";
3
3
  export { NodeContentExtension } from "./nodes/NodeContentExtension";
4
4
  export { NodeTools } from "./nodes/NodeTools";
5
5
  export { nodeTypes } from "./nodes/nodeTypes";
6
- export { EdgeDefault } from "./edges/EdgeDefault";
7
6
  export { EdgeStep } from "./edges/EdgeStep";
8
7
  export { EdgeTools } from "./edges/EdgeTools";
9
8
  export { edgeTypes } from "./edges/edgeTypes";
@@ -18,6 +17,7 @@ export type { NodeProps } from "./nodes/NodeDefault";
18
17
  export type { NodeContentProps } from "./nodes/NodeContent";
19
18
  export type { NodeContentExtensionProps } from "./nodes/NodeContentExtension";
20
19
  export type { NodeToolsProps } from "./nodes/NodeTools";
21
- export type { EdgeDefaultProps } from "./edges/EdgeDefault";
22
20
  export type { EdgeStepProps } from "./edges/EdgeStep";
23
21
  export type { MiniMapProps } from "./minimap/MiniMap";
22
+
23
+ export * from "./edges/EdgeDefault";
@@ -1,10 +1,12 @@
1
1
  import React from "react";
2
+ import Color from "color";
2
3
  import { Position, useStoreState as useStoreStateFlowLegacy } from "react-flow-renderer";
3
4
  import { useStore as useStoreStateFlowNext } from "react-flow-renderer-lts";
4
5
  import { Icon, Depiction, OverflowText } from "../../../index";
5
6
  import { CLASSPREFIX as eccgui } from "../../../configuration/constants";
6
7
  import { ValidIconName } from "../../../components/Icon/canonicalIconNames";
7
8
  import { DepictionProps } from "../../../components/Depiction/Depiction";
9
+ import { IntentTypes, intentClassName } from "../../../common/Intent";
8
10
  import { ReacFlowVersionSupportProps, useReactFlowVersion } from "../versionsupport";
9
11
  import { HandleDefault, HandleProps, HandleNextProps } from "./../handles/HandleDefault";
10
12
  import { NodeProps } from "./NodeDefault";
@@ -12,6 +14,7 @@ import { NodeContentExtensionProps } from "./NodeContentExtension";
12
14
  import { Resizable } from "re-resizable";
13
15
 
14
16
  export type HighlightingState = "success" | "warning" | "danger" | "match" | "altmatch";
17
+ export type NodeHighlightColor = "default" | "alternate" | Color | string;
15
18
 
16
19
  export interface IHandleProps extends HandleProps {
17
20
  category?: "configuration";
@@ -85,11 +88,27 @@ export interface NodeContentProps<NODE_DATA, NODE_CONTENT_PROPS = any>
85
88
  * Use this for example if you need more space for a label subline.
86
89
  * Also the depiction is displayed larger.
87
90
  */
88
- increadeHeader?: boolean;
91
+ enlargeHeader?: boolean;
89
92
  /**
93
+ * @deprecated
90
94
  * Set the type of used highlights to mark the node.
95
+ * Replaced by `intent` and `highlightColor` properties.
91
96
  */
92
97
  highlightedState?: HighlightingState | HighlightingState[];
98
+ /**
99
+ * Defines how the borders of a node are displayed.
100
+ * Use this property to overwrite default styles.
101
+ * You can use this to visuaize different states or type without depending only on color.
102
+ */
103
+ border?: "solid" | "double" | "dashed" | "dotted";
104
+ /**
105
+ * Feedback state of the node.
106
+ */
107
+ intent?: IntentTypes;
108
+ /**
109
+ * Set the type of used highlights to mark the node.
110
+ */
111
+ highlightColor?: NodeHighlightColor | [NodeHighlightColor, NodeHighlightColor];
93
112
  /**
94
113
  * Text used for tooltip used on icon and depiction.
95
114
  */
@@ -240,10 +259,14 @@ const addHandles = (handles: any, position: any, posDirection: any, isConnectabl
240
259
  });
241
260
  };
242
261
 
243
- export const gethighlightedStateClasses = (state: any, baseClassName: any) => {
262
+ export const gethighlightedStateClasses = (
263
+ state: HighlightingState | HighlightingState[],
264
+ baseClassName: string
265
+ ) => {
244
266
  let hightlights = typeof state === "string" ? [state] : state;
245
- //@ts-ignore
246
- return hightlights.map((item) => `${baseClassName}--highlight-${item}`).join(" ");
267
+ return hightlights.map(
268
+ (item : HighlightingState) => `${baseClassName}--highlight-${item}`
269
+ ).join(" ");
247
270
  };
248
271
 
249
272
  const MemoHandler = React.memo(
@@ -266,7 +289,7 @@ export function NodeContent<CONTENT_PROPS = any>({
266
289
  typeLabel,
267
290
  label,
268
291
  labelSubline,
269
- increadeHeader,
292
+ enlargeHeader,
270
293
  fullWidth,
271
294
  showExecutionButtons = true,
272
295
  executionButtons,
@@ -277,6 +300,9 @@ export function NodeContent<CONTENT_PROPS = any>({
277
300
  size = "small",
278
301
  minimalShape = "circular",
279
302
  highlightedState,
303
+ intent,
304
+ border,
305
+ highlightColor,
280
306
  handles = defaultHandles(),
281
307
  adaptHeightForHandleMinCount,
282
308
  adaptSizeIncrement = 15,
@@ -366,18 +392,29 @@ export function NodeContent<CONTENT_PROPS = any>({
366
392
  styleExpandDimensions["minHeight"] = Math.max(minHeightLeft, minHeightRight);
367
393
  }
368
394
 
395
+ const {
396
+ highlightClassNameSuffix,
397
+ highlightCustomPropertySettings
398
+ } = evaluateHighlightColors("--node-highlight", highlightColor);
399
+
369
400
  const resizableStyles = (!!onNodeResize === true && minimalShape === "none" && (width + height > 0)) ? { width, height } : {};
370
401
  const nodeContent = (
371
402
  <>
372
403
  <section
373
404
  ref={nodeContentRef}
374
405
  {...otherProps}
375
- style={{ ...style, ...styleExpandDimensions, ...resizableStyles }}
406
+ style={{ ...style, ...highlightCustomPropertySettings, ...styleExpandDimensions, ...resizableStyles }}
376
407
  className={
377
408
  `${eccgui}-graphviz__node` +
378
409
  ` ${eccgui}-graphviz__node--${size}` +
379
410
  ` ${eccgui}-graphviz__node--minimal-${minimalShape}` +
380
411
  (fullWidth ? ` ${eccgui}-graphviz__node--fullwidth` : "") +
412
+ (border ? ` ${eccgui}-graphviz__node--border-${border}` : "") +
413
+ (intent ? ` ${intentClassName(intent)}` : "") +
414
+ (highlightClassNameSuffix.length > 0
415
+ ? highlightClassNameSuffix.map(highlight => ` ${eccgui}-graphviz__node--highlight-${highlight}`).join("")
416
+ : ""
417
+ ) +
381
418
  (!!highlightedState
382
419
  ? " " + gethighlightedStateClasses(highlightedState, `${eccgui}-graphviz__node`)
383
420
  : "") +
@@ -388,7 +425,7 @@ export function NodeContent<CONTENT_PROPS = any>({
388
425
  >
389
426
  <header className={
390
427
  `${eccgui}-graphviz__node__header` +
391
- ((increadeHeader && minimalShape==="none") ? ` ${eccgui}-graphviz__node__header--large` : "")
428
+ ((enlargeHeader && minimalShape==="none") ? ` ${eccgui}-graphviz__node__header--large` : "")
392
429
  }>
393
430
  {(!!iconName || !!depiction || !!leftElement) && (
394
431
  <div className={`${eccgui}-graphviz__node__header-depiction`}>
@@ -500,3 +537,52 @@ export function NodeContent<CONTENT_PROPS = any>({
500
537
 
501
538
  return (isResizeable) ? resizableNode() : nodeContent;
502
539
  }
540
+
541
+ export const evaluateHighlightColors = (
542
+ baseCustomProperty: string,
543
+ highlightColor?: NodeHighlightColor | NodeHighlightColor[]
544
+ ) => {
545
+ let styleHighlightColors = {
546
+ [`${baseCustomProperty}-default-color`]: undefined,
547
+ [`${baseCustomProperty}-alternate-color`]: undefined,
548
+ } as React.CSSProperties;
549
+ const classesHightlightColors = [] as string[];
550
+ if (!!highlightColor) {
551
+ const highlightingColors = (typeof highlightColor === "string") ? [highlightColor] : highlightColor;
552
+ (highlightingColors as Array<string>).map((color, idx) => {
553
+ switch (color) {
554
+ case "default":
555
+ classesHightlightColors.push("default");
556
+ break;
557
+ case "alternate":
558
+ classesHightlightColors.push("alternate");
559
+ break;
560
+ default:
561
+ classesHightlightColors.push("custom");
562
+ let customColor = Color("#ffffff")
563
+ try {
564
+ customColor = Color(color);
565
+ } catch(ex) {
566
+ console.warn("Received invalid color for highlight: " + color)
567
+ }
568
+ if (idx === 0) {
569
+ styleHighlightColors = {
570
+ ...styleHighlightColors,
571
+ [`${baseCustomProperty}-default-color`]: customColor.rgb().toString(),
572
+ } as React.CSSProperties
573
+ } else {
574
+ styleHighlightColors = {
575
+ ...styleHighlightColors,
576
+ [`${baseCustomProperty}-alternate-color`]: customColor.rgb().toString(),
577
+ } as React.CSSProperties
578
+ }
579
+ break;
580
+ }
581
+ });
582
+ }
583
+
584
+ return {
585
+ highlightClassNameSuffix: classesHightlightColors,
586
+ highlightCustomPropertySettings: styleHighlightColors,
587
+ }
588
+ }