@@ -25,13 +25,20 @@ namespace S {
25
25
` ;
26
26
27
27
export const SymbolContainer = styled . div < { symbolType : string ; selected : boolean ; isOutPort : boolean } > `
28
- width: 17px ;
28
+ width: 15px ;
29
29
height: 15px;
30
- border: 5px hidden;
31
- background: ${ ( p ) => ( p . selected ? 'white' : 'rgba(0, 0, 0, 0.2)' ) } ;
30
+ background: ${ ( p ) => ( p . selected ? 'oklch(1 0 0 / 0.5)' : 'rgba(0, 0, 0, 0.2)' ) } ;
32
31
border-radius: ${ ( p ) => ( p . isOutPort ? '20px 0px 0px 20px' : '0px 20px 20px 0px' ) } ;
33
32
display: ${ ( p ) => p . symbolType == null ? 'none' : 'visible' } ;
34
33
text-align: center;
34
+ box-shadow: inset 0 2px 4px ${ ( p ) => ( p . selected ? 'rgb(0 0 0 / 0.05)' : 'rgb(0 0 0 / 0.01)' ) } ;
35
+ border: 1px solid oklch(0 0 0 / 0.2);
36
+ padding: 0 2px;
37
+ margin: 2px 0;
38
+ &:hover, &.hover {
39
+ background: rgb(192, 255, 0);
40
+ box-shadow: ${ ( p ) => p . selected ? '' : 'inset' } 0 4px 8px rgb(0 0 0 / 0.5);
41
+ }
35
42
` ;
36
43
37
44
export const Symbol = styled . div < { isOutPort : boolean } > `
@@ -42,12 +49,29 @@ namespace S {
42
49
padding:${ ( p ) => ( p . isOutPort ? '2px 0px 0px 2px' : '2px 2px 0px 0px' ) } ;
43
50
` ;
44
51
45
- export const Port = styled . div `
52
+ export const Port = styled . div < { isOutPort : boolean , hasLinks : boolean } > `
46
53
width: 15px;
47
54
height: 15px;
48
- background: rgba(255, 255, 255, 0.2);
49
- &:hover {
55
+ background: ${ ( p ) => p . hasLinks ? 'oklch(1 0 0 / 0.5)' : 'oklch(0 0 0 / 0.2)' } ;
56
+ color: ${ ( p ) => p . hasLinks ? 'oklch(0 0 0 / 0.8)' : 'oklch(1 0 0 / 0.8)' } ;
57
+ border: 1px solid oklch(0 0 0 / 0.2);
58
+ border-radius: ${ ( p ) => ( p . isOutPort ? '20px 0px 0px 20px' : '0px 20px 20px 0px' ) } ;
59
+ box-shadow: ${ ( p ) => p . hasLinks ? '' : 'inset' } 0 2px 4px ${ ( p ) => ( p . hasLinks ? 'rgb(0 0 0 / 0.1)' : 'rgb(0 0 0 / 0.05)' ) } ;
60
+ display: flex;
61
+ justify-content: center;
62
+ align-items: center;
63
+ padding: 0 2px;
64
+ margin: 2px 0;
65
+ &:hover, &.hover {
50
66
background: rgb(192, 255, 0);
67
+ box-shadow: ${ ( p ) => p . hasLinks ? '' : 'inset' } 0 4px 8px rgb(0 0 0 / 0.5);
68
+ }
69
+ & svg {
70
+ stroke-width: 3;
71
+ stroke: currentColor;
72
+ fill: none;
73
+ stroke-linecap: round;
74
+ stroke-linejoin: round;
51
75
}
52
76
` ;
53
77
}
@@ -93,10 +117,27 @@ export class CustomPortLabel extends React.Component<CustomPortLabelProps> {
93
117
symbolLabel = '◎' ;
94
118
}
95
119
120
+ const isIn = ! ! this . props . port . getOptions ( ) . in
121
+ const hasLinks = Object . keys ( this . props . port . getLinks ( ) ) . length > 0 ;
122
+ const isTrianglePort = this . props . port . getOptions ( ) . label . indexOf ( '▶' ) >= 0 &&
123
+ /* Workaround for Arguments being set up as triangle ports in other places */
124
+ ! this . props . node [ 'name' ] . match ( 'Argument \(.+?\):' ) ;
125
+
96
126
const port = (
97
- < PortWidget engine = { this . props . engine } port = { this . props . port } >
98
- < S . Port />
99
- </ PortWidget >
127
+ < S . Port isOutPort = { ! isIn } hasLinks = { hasLinks } >
128
+ { ! isTrianglePort ? null : ( isIn ?
129
+ < svg xmlns = "http://www.w3.org/2000/svg" width = "12" height = "12" viewBox = "0 0 24 24" >
130
+ < path stroke = "none" d = "M0 0h24v24H0z" fill = "none" />
131
+ < path d = "M3 12h12" />
132
+ < path d = "M11 8l4 4l-4 4" />
133
+ < path d = "M12 21a9 9 0 0 0 0 -18" />
134
+ </ svg > : < svg xmlns = "http://www.w3.org/2000/svg" width = "12" height = "12" viewBox = "0 0 24 24" >
135
+ < path stroke = "none" d = "M0 0h24v24H0z" fill = "none" />
136
+ < path d = "M9 12h12" />
137
+ < path d = "M17 16l4 -4l-4 -4" />
138
+ < path d = "M12 3a9 9 0 1 0 0 18" />
139
+ </ svg > ) }
140
+ </ S . Port >
100
141
) ;
101
142
102
143
const propLinks = this . props . port . links ;
@@ -105,6 +146,7 @@ export class CustomPortLabel extends React.Component<CustomPortLabelProps> {
105
146
portHasLink = true ;
106
147
}
107
148
149
+
108
150
const symbol = (
109
151
< S . SymbolContainer symbolType = { symbolLabel } selected = { portHasLink } isOutPort = { isOutPort } >
110
152
< S . Symbol isOutPort = { isOutPort } >
@@ -116,14 +158,16 @@ export class CustomPortLabel extends React.Component<CustomPortLabelProps> {
116
158
117
159
const label = (
118
160
< S . Label style = { { textAlign : ( ! this . props . port . getOptions ( ) . in && this . props . port . getOptions ( ) . label === '▶' ) ? 'right' : 'left' } } >
119
- { nodeType === "Literal Secret" ? "*****" : this . props . port . getOptions ( ) . label }
161
+ { nodeType === "Literal Secret" ? "*****" : this . props . port . getOptions ( ) . label . replace ( '▶' , '' ) . trim ( ) }
120
162
</ S . Label > ) ;
121
163
122
164
return (
123
165
< S . PortLabel >
124
- { this . props . port . getOptions ( ) . in ? port : label }
125
- { symbol }
126
- { this . props . port . getOptions ( ) . in ? label : port }
166
+ { this . props . port . getOptions ( ) . in ? null : label }
167
+ < PortWidget engine = { this . props . engine } port = { this . props . port } >
168
+ { symbolLabel == null ? port : symbol }
169
+ </ PortWidget >
170
+ { this . props . port . getOptions ( ) . in ? label : null }
127
171
</ S . PortLabel >
128
172
) ;
129
173
}
0 commit comments