pict-section-flow 0.0.5 → 0.0.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pict-section-flow",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Pict Section Flow Diagram",
5
5
  "main": "source/Pict-Section-Flow.js",
6
6
  "scripts": {
@@ -133,6 +133,10 @@ class PictFlowCard extends libFableServiceProviderBase
133
133
  MinimumInputCount: (typeof tmpInput.MinimumInputCount === 'number') ? tmpInput.MinimumInputCount : 0,
134
134
  MaximumInputCount: (typeof tmpInput.MaximumInputCount === 'number') ? tmpInput.MaximumInputCount : -1
135
135
  };
136
+ if (tmpInput.PortType)
137
+ {
138
+ tmpPort.PortType = tmpInput.PortType;
139
+ }
136
140
  tmpPorts.push(tmpPort);
137
141
  }
138
142
 
@@ -140,13 +144,18 @@ class PictFlowCard extends libFableServiceProviderBase
140
144
  for (let i = 0; i < this.cardOutputs.length; i++)
141
145
  {
142
146
  let tmpOutput = this.cardOutputs[i];
143
- tmpPorts.push(
147
+ let tmpOutPort =
144
148
  {
145
149
  Hash: null,
146
150
  Direction: 'output',
147
151
  Side: tmpOutput.Side || 'right',
148
152
  Label: tmpOutput.Name || `Out ${i + 1}`
149
- });
153
+ };
154
+ if (tmpOutput.PortType)
155
+ {
156
+ tmpOutPort.PortType = tmpOutput.PortType;
157
+ }
158
+ tmpPorts.push(tmpOutPort);
150
159
  }
151
160
 
152
161
  // If no ports were defined, provide sensible defaults
@@ -50,6 +50,11 @@ class FlowCardPropertiesPanelForm extends libPictFlowCardPropertiesPanel
50
50
  let tmpContainerID = `pict-flow-panel-form-${pNodeData.Hash}`;
51
51
  pContainer.innerHTML = `<div id="${tmpContainerID}"></div>`;
52
52
 
53
+ // Bind the node data to AppData.Record so the form descriptors
54
+ // (which use addresses like Record.Data.SearchString) resolve against
55
+ // the actual node object.
56
+ this.pict.AppData.Record = pNodeData;
57
+
53
58
  try
54
59
  {
55
60
  // Look for an existing metacontroller or create one
@@ -61,6 +61,18 @@ class PictProviderFlowCSS extends libFableServiceProviderBase
61
61
  --pf-port-stroke: #ffffff;
62
62
  --pf-port-stroke-width: 2;
63
63
 
64
+ /* Port Type Colors */
65
+ --pf-port-event-in-fill: #3498db;
66
+ --pf-port-event-out-fill: #2ecc71;
67
+ --pf-port-setting-fill: #e67e22;
68
+ --pf-port-value-fill: #9b59b6;
69
+ --pf-port-error-fill: #e74c3c;
70
+
71
+ /* Connection Type Colors */
72
+ --pf-connection-event-stroke: #95a5a6;
73
+ --pf-connection-data-stroke: #9b59b6;
74
+ --pf-connection-error-stroke: #e74c3c;
75
+
64
76
  /* Panels */
65
77
  --pf-panel-bg: #ffffff;
66
78
  --pf-panel-border: #d0d4d8;
@@ -286,6 +298,22 @@ class PictProviderFlowCSS extends libFableServiceProviderBase
286
298
  r: 7;
287
299
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.20));
288
300
  }
301
+ /* Port type color overrides */
302
+ .pict-flow-port.port-type-event-in {
303
+ fill: var(--pf-port-event-in-fill);
304
+ }
305
+ .pict-flow-port.port-type-event-out {
306
+ fill: var(--pf-port-event-out-fill);
307
+ }
308
+ .pict-flow-port.port-type-setting {
309
+ fill: var(--pf-port-setting-fill);
310
+ }
311
+ .pict-flow-port.port-type-value {
312
+ fill: var(--pf-port-value-fill);
313
+ }
314
+ .pict-flow-port.port-type-error {
315
+ fill: var(--pf-port-error-fill);
316
+ }
289
317
  .pict-flow-port-label {
290
318
  fill: #7f8c8d;
291
319
  font-size: 9px;
@@ -326,6 +354,16 @@ class PictProviderFlowCSS extends libFableServiceProviderBase
326
354
  stroke: var(--pf-connection-selected-stroke);
327
355
  stroke-width: 3;
328
356
  }
357
+ /* Connection type color overrides (based on source port type) */
358
+ .pict-flow-connection.conn-type-value {
359
+ stroke: var(--pf-connection-data-stroke);
360
+ }
361
+ .pict-flow-connection.conn-type-setting {
362
+ stroke: var(--pf-connection-data-stroke);
363
+ }
364
+ .pict-flow-connection.conn-type-error {
365
+ stroke: var(--pf-connection-error-stroke);
366
+ }
329
367
  .pict-flow-connection-hitarea {
330
368
  fill: none;
331
369
  stroke: transparent;
@@ -591,6 +629,22 @@ class PictProviderFlowCSS extends libFableServiceProviderBase
591
629
  .pict-flow-info-panel-port.output {
592
630
  border-left: 3px solid var(--pf-port-output-fill);
593
631
  }
632
+ /* Info panel port type color overrides */
633
+ .pict-flow-info-panel-port.port-type-event-in {
634
+ border-left-color: var(--pf-port-event-in-fill);
635
+ }
636
+ .pict-flow-info-panel-port.port-type-event-out {
637
+ border-left-color: var(--pf-port-event-out-fill);
638
+ }
639
+ .pict-flow-info-panel-port.port-type-setting {
640
+ border-left-color: var(--pf-port-setting-fill);
641
+ }
642
+ .pict-flow-info-panel-port.port-type-value {
643
+ border-left-color: var(--pf-port-value-fill);
644
+ }
645
+ .pict-flow-info-panel-port.port-type-error {
646
+ border-left-color: var(--pf-port-error-fill);
647
+ }
594
648
  .pict-flow-info-panel-port-constraint {
595
649
  color: #8e99a4;
596
650
  font-size: 10px;
@@ -195,7 +195,12 @@ class PictProviderFlowConnectorShapes extends libFableServiceProviderBase
195
195
  {
196
196
  let tmpConfig = this._DefaultShapes['port'];
197
197
  let tmpElement = this._FlowView._SVGHelperProvider.createSVGElement(tmpConfig.ElementType);
198
- tmpElement.setAttribute('class', tmpConfig.ClassName + ' ' + pPortData.Direction);
198
+ let tmpClassName = tmpConfig.ClassName + ' ' + pPortData.Direction;
199
+ if (pPortData.PortType)
200
+ {
201
+ tmpClassName += ' port-type-' + pPortData.PortType;
202
+ }
203
+ tmpElement.setAttribute('class', tmpClassName);
199
204
  tmpElement.setAttribute('cx', String(pPosition.x));
200
205
  tmpElement.setAttribute('cy', String(pPosition.y));
201
206
  // Apply config attributes (r, etc.)
@@ -206,6 +211,10 @@ class PictProviderFlowConnectorShapes extends libFableServiceProviderBase
206
211
  tmpElement.setAttribute('data-port-hash', pPortData.Hash);
207
212
  tmpElement.setAttribute('data-node-hash', pNodeHash);
208
213
  tmpElement.setAttribute('data-port-direction', pPortData.Direction);
214
+ if (pPortData.PortType)
215
+ {
216
+ tmpElement.setAttribute('data-port-type', pPortData.PortType);
217
+ }
209
218
  tmpElement.setAttribute('data-element-type', 'port');
210
219
  return tmpElement;
211
220
  }
@@ -24,6 +24,21 @@ class PictServiceFlowConnectionRenderer extends libFableServiceProviderBase
24
24
  let tmpSourcePos = this._FlowView.getPortPosition(pConnection.SourceNodeHash, pConnection.SourcePortHash);
25
25
  let tmpTargetPos = this._FlowView.getPortPosition(pConnection.TargetNodeHash, pConnection.TargetPortHash);
26
26
 
27
+ // Look up the source port's PortType for connection coloring
28
+ let tmpSourcePortType = null;
29
+ let tmpSourceNode = this._FlowView.getNode(pConnection.SourceNodeHash);
30
+ if (tmpSourceNode && tmpSourceNode.Ports)
31
+ {
32
+ for (let i = 0; i < tmpSourceNode.Ports.length; i++)
33
+ {
34
+ if (tmpSourceNode.Ports[i].Hash === pConnection.SourcePortHash)
35
+ {
36
+ tmpSourcePortType = tmpSourceNode.Ports[i].PortType || null;
37
+ break;
38
+ }
39
+ }
40
+ }
41
+
27
42
  if (!tmpSourcePos || !tmpTargetPos) return;
28
43
 
29
44
  let tmpData = pConnection.Data || {};
@@ -69,6 +84,9 @@ class PictServiceFlowConnectionRenderer extends libFableServiceProviderBase
69
84
 
70
85
  let tmpViewIdentifier = this._FlowView.options.ViewIdentifier;
71
86
 
87
+ // Build the port-type CSS class suffix for connection coloring
88
+ let tmpConnTypeClass = tmpSourcePortType ? (' conn-type-' + tmpSourcePortType) : '';
89
+
72
90
  // Hit area (wider invisible path for easier selection)
73
91
  let tmpShapeProvider = this._FlowView._ConnectorShapesProvider;
74
92
  if (tmpShapeProvider)
@@ -78,6 +96,11 @@ class PictServiceFlowConnectionRenderer extends libFableServiceProviderBase
78
96
 
79
97
  let tmpPathElement = tmpShapeProvider.createConnectionPathElement(
80
98
  tmpPath, pConnection.Hash, pIsSelected, tmpViewIdentifier);
99
+ if (tmpConnTypeClass)
100
+ {
101
+ tmpPathElement.setAttribute('class',
102
+ (tmpPathElement.getAttribute('class') || '') + tmpConnTypeClass);
103
+ }
81
104
  if (tmpStrokeDashArray)
82
105
  {
83
106
  tmpPathElement.setAttribute('stroke-dasharray', tmpStrokeDashArray);
@@ -94,7 +117,7 @@ class PictServiceFlowConnectionRenderer extends libFableServiceProviderBase
94
117
  pConnectionsLayer.appendChild(tmpHitArea);
95
118
 
96
119
  let tmpPathElement = this._FlowView._SVGHelperProvider.createSVGElement('path');
97
- tmpPathElement.setAttribute('class', `pict-flow-connection ${pIsSelected ? 'selected' : ''}`);
120
+ tmpPathElement.setAttribute('class', `pict-flow-connection${tmpConnTypeClass} ${pIsSelected ? 'selected' : ''}`);
98
121
  tmpPathElement.setAttribute('d', tmpPath);
99
122
  tmpPathElement.setAttribute('data-connection-hash', pConnection.Hash);
100
123
  tmpPathElement.setAttribute('data-element-type', 'connection');
@@ -329,13 +329,22 @@ class PictViewFlowNode extends libPictView
329
329
  else
330
330
  {
331
331
  tmpCircle = this._FlowView._SVGHelperProvider.createSVGElement('circle');
332
- tmpCircle.setAttribute('class', `pict-flow-port ${tmpPort.Direction}`);
332
+ let tmpPortClass = `pict-flow-port ${tmpPort.Direction}`;
333
+ if (tmpPort.PortType)
334
+ {
335
+ tmpPortClass += ` port-type-${tmpPort.PortType}`;
336
+ }
337
+ tmpCircle.setAttribute('class', tmpPortClass);
333
338
  tmpCircle.setAttribute('cx', String(tmpPosition.x));
334
339
  tmpCircle.setAttribute('cy', String(tmpPosition.y));
335
340
  tmpCircle.setAttribute('r', '5');
336
341
  tmpCircle.setAttribute('data-port-hash', tmpPort.Hash);
337
342
  tmpCircle.setAttribute('data-node-hash', pNodeData.Hash);
338
343
  tmpCircle.setAttribute('data-port-direction', tmpPort.Direction);
344
+ if (tmpPort.PortType)
345
+ {
346
+ tmpCircle.setAttribute('data-port-type', tmpPort.PortType);
347
+ }
339
348
  tmpCircle.setAttribute('data-element-type', 'port');
340
349
  }
341
350
  pGroup.appendChild(tmpCircle);